Ultimate FAQ - Version 1.5.5

Version Description

  • Added in a new admin notification option for when questions are received
  • Added in two new shortcode attributes, 'include_category_ids' and 'exclude_category_ids', to let users include categories by ID instead of only by slug
  • Fixed two typos in the labelling area of the backend
Download this release

Release Info

Developer Rustaurius
Plugin Icon 128x128 Ultimate FAQ
Version 1.5.5
Comparing to
See all releases

Code changes from version 1.5.4 to 1.5.5

Functions/EWD_UFAQ_Submit_Question.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
  function EWD_UFAQ_Submit_Question($success_message) {
 
 
3
  $Post_Title = sanitize_text_field($_POST['Post_Title']);
4
  $Post_Body = sanitize_text_field($_POST['Post_Body']);
5
  $Post_Author = sanitize_text_field($_POST['Post_Author']);
@@ -15,7 +17,33 @@ function EWD_UFAQ_Submit_Question($success_message) {
15
 
16
  update_post_meta($post_id, "EWD_UFAQ_Post_Author", $Post_Author);
17
 
 
 
 
 
18
  return $success_message;
19
  }
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  ?>
1
  <?php
2
  function EWD_UFAQ_Submit_Question($success_message) {
3
+ $Admin_Question_Notification = get_option("EWD_UFAQ_Admin_Question_Notification");
4
+
5
  $Post_Title = sanitize_text_field($_POST['Post_Title']);
6
  $Post_Body = sanitize_text_field($_POST['Post_Body']);
7
  $Post_Author = sanitize_text_field($_POST['Post_Author']);
17
 
18
  update_post_meta($post_id, "EWD_UFAQ_Post_Author", $Post_Author);
19
 
20
+ if ($Admin_Question_Notification == "Yes") {
21
+ EWD_UFAQ_Send_Admin_Notification_Email($post_id, $Post_Title, $Post_Body);
22
+ }
23
+
24
  return $success_message;
25
  }
26
 
27
+ function EWD_UFAQ_Send_Admin_Notification_Email($post_id, $Post_Title, $Post_Body) {
28
+ $Admin_Email = get_option( 'admin_email' );
29
+
30
+ $ReviewLink = site_url() . "/wp-admin/post.php?post=" . $post_id . "&action=edit";
31
+
32
+ $Subject_Line = __("New Question Received", 'EWD_UFAQ');
33
+
34
+ $Message_Body = __("Hello Admin,", 'EWD_UFAQ') . "<br/><br/>";
35
+ $Message_Body .= __("You've received a new question titled", 'EWD_UFAQ') . " '" . $Post_Title . "'.<br/><br/>";
36
+ if ($Post_Body != "") {
37
+ $Message_Body .= __("The answer reads:<br>", 'EWD_UFAQ');
38
+ $Message_Body .= $Post_Body . "<br><br><br>";
39
+ }
40
+ $Message_Body .= __("You can view the question in the admin area by going to the following link:<br>", 'EWD_UFAQ');
41
+ $Message_Body .= "<a href='" . $ReviewLink . "' />" . __("See the review", 'EWD_UFAQ') . "</a><br/><br/>";
42
+ $Message_Body .= __("Have a great day,", 'EWD_UFAQ') . "<br/><br/>";
43
+ $Message_Body .= __("Ultimate FAQs Team");
44
+
45
+ $headers = array('Content-Type: text/html; charset=UTF-8');
46
+ $Mail_Success = wp_mail($Admin_Email, $Subject_Line, $Message_Body, $headers);
47
+ }
48
+
49
  ?>
Functions/Update_Admin_Databases.php CHANGED
@@ -44,6 +44,7 @@ function EWD_UFAQ_UpdateOptions() {
44
  if (isset($_POST['reveal_effect']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Reveal_Effect', $_POST['reveal_effect']);}
45
  if (isset($_POST['pretty_permalinks']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Pretty_Permalinks', $_POST['pretty_permalinks']);}
46
  if (isset($_POST['allow_proposed_answer']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Allow_Proposed_Answer', $_POST['allow_proposed_answer']);}
 
47
  if (isset($_POST['faq_auto_complete_titles']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Auto_Complete_Titles', $_POST['faq_auto_complete_titles']);}
48
  if (isset($_POST['slug_base']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Slug_Base', $_POST['slug_base']);}
49
  if (isset($_POST['Socialmedia']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Social_Media', $Social_Media);}
44
  if (isset($_POST['reveal_effect']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Reveal_Effect', $_POST['reveal_effect']);}
45
  if (isset($_POST['pretty_permalinks']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Pretty_Permalinks', $_POST['pretty_permalinks']);}
46
  if (isset($_POST['allow_proposed_answer']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Allow_Proposed_Answer', $_POST['allow_proposed_answer']);}
47
+ if (isset($_POST['admin_question_notification']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Question_Notification', $_POST['admin_question_notification']);}
48
  if (isset($_POST['faq_auto_complete_titles']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Auto_Complete_Titles', $_POST['faq_auto_complete_titles']);}
49
  if (isset($_POST['slug_base']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Slug_Base', $_POST['slug_base']);}
50
  if (isset($_POST['Socialmedia']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Social_Media', $Social_Media);}
Main.php CHANGED
@@ -7,14 +7,14 @@ Author: Etoile Web Design
7
  Author URI: http://www.EtoileWebDesign.com/wordpress-plugins/
8
  Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/
9
  Text Domain: EWD_UFAQ
10
- Version: 1.5.4
11
  */
12
 
13
  global $ewd_ufaq_message;
14
  global $UFAQ_Full_Version;
15
  global $EWD_UFAQ_Version;
16
 
17
- $EWD_UFAQ_Version = '1.5.0';
18
 
19
  define( 'EWD_UFAQ_CD_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
20
  define( 'EWD_UFAQ_CD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
@@ -189,7 +189,8 @@ function Set_EWD_UFAQ_Options() {
189
  if (get_option("EWD_UFAQ_Reveal_Effect") == "") {update_option("EWD_UFAQ_Reveal_Effect", "none");}
190
  if (get_option("EWD_UFAQ_Pretty_Permalinks") == "") {update_option("EWD_UFAQ_Pretty_Permalinks", "No");}
191
  if (get_option("EWD_UFAQ_Allow_Proposed_Answer") == "") {update_option("EWD_UFAQ_Allow_Proposed_Answer", "No");}
192
- if (get_option("FAQ_Auto_Complete_Titles") == "") {update_option("FAQ_Auto_Complete_Titles", "Yes");}
 
193
  if (get_option("EWD_UFAQ_Slug_Base") == "") {update_option("EWD_UFAQ_Slug_Base", "ufaqs");}
194
 
195
  if (get_option("EWD_UFAQ_Group_By_Category") == "") {update_option("EWD_UFAQ_Group_By_Category", "No");}
7
  Author URI: http://www.EtoileWebDesign.com/wordpress-plugins/
8
  Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/
9
  Text Domain: EWD_UFAQ
10
+ Version: 1.5.5
11
  */
12
 
13
  global $ewd_ufaq_message;
14
  global $UFAQ_Full_Version;
15
  global $EWD_UFAQ_Version;
16
 
17
+ $EWD_UFAQ_Version = '1.5.5';
18
 
19
  define( 'EWD_UFAQ_CD_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
20
  define( 'EWD_UFAQ_CD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
189
  if (get_option("EWD_UFAQ_Reveal_Effect") == "") {update_option("EWD_UFAQ_Reveal_Effect", "none");}
190
  if (get_option("EWD_UFAQ_Pretty_Permalinks") == "") {update_option("EWD_UFAQ_Pretty_Permalinks", "No");}
191
  if (get_option("EWD_UFAQ_Allow_Proposed_Answer") == "") {update_option("EWD_UFAQ_Allow_Proposed_Answer", "No");}
192
+ if (get_option("EWD_UFAQ_Admin_Question_Notification") == "") {update_option("EWD_UFAQ_Admin_Question_Notification", "No");}
193
+ if (get_option("EWD_UFAQ_Auto_Complete_Titles") == "") {update_option("EWD_UFAQ_Auto_Complete_Titles", "Yes");}
194
  if (get_option("EWD_UFAQ_Slug_Base") == "") {update_option("EWD_UFAQ_Slug_Base", "ufaqs");}
195
 
196
  if (get_option("EWD_UFAQ_Group_By_Category") == "") {update_option("EWD_UFAQ_Group_By_Category", "No");}
Shortcodes/DisplayFAQs.php CHANGED
@@ -77,6 +77,8 @@ function Display_FAQs($atts) {
77
  'post__in' => "",
78
  'include_category' => "",
79
  'exclude_category' => "",
 
 
80
  'no_comments' => "",
81
  'orderby' => "",
82
  'order' => "",
@@ -119,6 +121,13 @@ function Display_FAQs($atts) {
119
 
120
  if (isset($_GET['include_category'])) {$include_category = $_GET['include_category'];}
121
  if (get_query_var('ufaq_category_slug') != "") {$include_category = get_query_var('ufaq_category_slug');}
 
 
 
 
 
 
 
122
  if ($include_category != "" ) {$include_category_array = explode(",", $include_category);}
123
  else {$include_category_array = array();}
124
  if (sizeOf($include_category_array) > 0) {
@@ -127,6 +136,13 @@ function Display_FAQs($atts) {
127
  'terms' => $include_category_array
128
  );
129
  }
 
 
 
 
 
 
 
130
  if ($exclude_category != "" ) {$exclude_category_array = explode(",", $exclude_category);}
131
  else {$exclude_category_array = array();}
132
  if (sizeOf($exclude_category_array) > 0) {
77
  'post__in' => "",
78
  'include_category' => "",
79
  'exclude_category' => "",
80
+ 'include_category_ids' => "",
81
+ 'exclude_category_ids' => "",
82
  'no_comments' => "",
83
  'orderby' => "",
84
  'order' => "",
121
 
122
  if (isset($_GET['include_category'])) {$include_category = $_GET['include_category'];}
123
  if (get_query_var('ufaq_category_slug') != "") {$include_category = get_query_var('ufaq_category_slug');}
124
+ if ($include_category_ids != "") {
125
+ foreach ($include_category_ids as $Category_ID) {
126
+ $Term = get_term_by('id', $Category_ID, 'ufaq-category');
127
+ $include_category .= $Term->term_id . ",";
128
+ }
129
+ $include_category = substr($include_category, 0, -1);
130
+ }
131
  if ($include_category != "" ) {$include_category_array = explode(",", $include_category);}
132
  else {$include_category_array = array();}
133
  if (sizeOf($include_category_array) > 0) {
136
  'terms' => $include_category_array
137
  );
138
  }
139
+ if ($exclude_category_ids != "") {
140
+ foreach ($exclude_category_ids as $Category_ID) {
141
+ $Term = get_term_by('id', $Category_ID, 'ufaq-category');
142
+ $exclude_category .= $Term->term_id . ",";
143
+ }
144
+ $exclude_category = substr($exclude_category, 0, -1);
145
+ }
146
  if ($exclude_category != "" ) {$exclude_category_array = explode(",", $exclude_category);}
147
  else {$exclude_category_array = array();}
148
  if (sizeOf($exclude_category_array) > 0) {
html/OptionsPage.php CHANGED
@@ -23,6 +23,7 @@
23
  $Reveal_Effect = get_option("EWD_UFAQ_Reveal_Effect");
24
  $Pretty_Permalinks = get_option("EWD_UFAQ_Pretty_Permalinks");
25
  $Allow_Proposed_Answer = get_option("EWD_UFAQ_Allow_Proposed_Answer");
 
26
  $FAQ_Auto_Complete_Titles = get_option("EWD_UFAQ_Auto_Complete_Titles");
27
  $Slug_Base = get_option("EWD_UFAQ_Slug_Base");
28
  $Socialmedia_String = get_option("EWD_UFAQ_Social_Media");
@@ -376,6 +377,16 @@
376
  </td>
377
  </tr>
378
  <tr>
 
 
 
 
 
 
 
 
 
 
379
  <th scope="row">FAQ Auto Complete Titles</th>
380
  <td>
381
  <fieldset><legend class="screen-reader-text"><span>FAQ Auto Complete Titles</span></legend>
@@ -710,13 +721,13 @@
710
  </fieldset>
711
  </div>
712
  <div class='ufaq-option ufaq-label-option'>
713
- <?php _e("Review Author", 'EWD_UFAQ')?>
714
  <fieldset>
715
  <input type='text' name='review_author_label' value='<?php echo $Review_Author_Label; ?>' <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?>/>
716
  </fieldset>
717
  </div>
718
  <div class='ufaq-option ufaq-label-option'>
719
- <?php _e("What name should be displayed with your review?", 'EWD_UFAQ')?>
720
  <fieldset>
721
  <input type='text' name='what_name_with_review_label' value='<?php echo $What_Name_With_Review_Label; ?>' <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?>/>
722
  </fieldset>
23
  $Reveal_Effect = get_option("EWD_UFAQ_Reveal_Effect");
24
  $Pretty_Permalinks = get_option("EWD_UFAQ_Pretty_Permalinks");
25
  $Allow_Proposed_Answer = get_option("EWD_UFAQ_Allow_Proposed_Answer");
26
+ $Admin_Question_Notification = get_option("EWD_UFAQ_Admin_Question_Notification");
27
  $FAQ_Auto_Complete_Titles = get_option("EWD_UFAQ_Auto_Complete_Titles");
28
  $Slug_Base = get_option("EWD_UFAQ_Slug_Base");
29
  $Socialmedia_String = get_option("EWD_UFAQ_Social_Media");
377
  </td>
378
  </tr>
379
  <tr>
380
+ <th scope="row">Admin Question Notification</th>
381
+ <td>
382
+ <fieldset><legend class="screen-reader-text"><span>Admin Question Notification</span></legend>
383
+ <label title='Yes'><input type='radio' name='admin_question_notification' value='Yes' <?php if($Admin_Question_Notification == "Yes") {echo "checked='checked'";} ?> /> <span>Yes</span></label><br />
384
+ <label title='No'><input type='radio' name='admin_question_notification' value='No' <?php if($Admin_Question_Notification == "No") {echo "checked='checked'";} ?> /> <span>No</span></label><br />
385
+ <p>Should an email be sent to the site administrator when a question is submitted?</p>
386
+ </fieldset>
387
+ </td>
388
+ </tr>
389
+ <tr>
390
  <th scope="row">FAQ Auto Complete Titles</th>
391
  <td>
392
  <fieldset><legend class="screen-reader-text"><span>FAQ Auto Complete Titles</span></legend>
721
  </fieldset>
722
  </div>
723
  <div class='ufaq-option ufaq-label-option'>
724
+ <?php _e("Question Author", 'EWD_UFAQ')?>
725
  <fieldset>
726
  <input type='text' name='review_author_label' value='<?php echo $Review_Author_Label; ?>' <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?>/>
727
  </fieldset>
728
  </div>
729
  <div class='ufaq-option ufaq-label-option'>
730
+ <?php _e("What name should be displayed with your question?", 'EWD_UFAQ')?>
731
  <fieldset>
732
  <input type='text' name='what_name_with_review_label' value='<?php echo $What_Name_With_Review_Label; ?>' <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?>/>
733
  </fieldset>
readme.txt CHANGED
@@ -49,7 +49,8 @@ Ultimate FAQ uses the WordPress custom post type functionality to create an FAQ
49
  * Choose from 15 toggle icon sets
50
  * WooCommerce FAQ tab with specific FAQs for each product on product page (<a href='https://www.youtube.com/watch?v=cH3p0fW4c5o'>YouTube Video</a>)
51
  * Different FAQ display styles for your frequently asked questions
52
- * User-submitted FAQs
 
53
  * AJAX easy FAQ search with autocomplete for FAQ titles
54
  * Import/Export of FAQs from spreadsheet
55
  * Export FAQs to PDF
@@ -209,6 +210,11 @@ Video 3 - FAQs Ordering
209
  9. All answers displayed in the 'list' FAQ mode
210
 
211
  == Changelog ==
 
 
 
 
 
212
  = 1.5.4 =
213
  - Fixed an issue where the most viewed FAQ stat was being sorted as a string
214
 
49
  * Choose from 15 toggle icon sets
50
  * WooCommerce FAQ tab with specific FAQs for each product on product page (<a href='https://www.youtube.com/watch?v=cH3p0fW4c5o'>YouTube Video</a>)
51
  * Different FAQ display styles for your frequently asked questions
52
+ * User-submitted FAQs and also (optionally) answers
53
+ * Admin notification on FAQ submission
54
  * AJAX easy FAQ search with autocomplete for FAQ titles
55
  * Import/Export of FAQs from spreadsheet
56
  * Export FAQs to PDF
210
  9. All answers displayed in the 'list' FAQ mode
211
 
212
  == Changelog ==
213
+ = 1.5.5 =
214
+ - Added in a new admin notification option for when questions are received
215
+ - Added in two new shortcode attributes, 'include_category_ids' and 'exclude_category_ids', to let users include categories by ID instead of only by slug
216
+ - Fixed two typos in the labelling area of the backend
217
+
218
  = 1.5.4 =
219
  - Fixed an issue where the most viewed FAQ stat was being sorted as a string
220