Ultimate FAQ - Version 1.6.15

Version Description

  • Added in a option to let users submit custom fields along with their questions when using the submit question shortcode
Download this release

Release Info

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

Code changes from version 1.6.14 to 1.6.15

Functions/EWD_UFAQ_Submit_Question.php CHANGED
@@ -1,9 +1,12 @@
1
  <?php
2
- function EWD_UFAQ_Submit_Question($success_message) {
3
  $Submit_Question_Captcha = get_option("EWD_UFAQ_Submit_Question_Captcha");
4
  $Admin_Question_Notification = get_option("EWD_UFAQ_Admin_Question_Notification");
5
  $Submit_FAQ_Email = get_option("EWD_UFAQ_Submit_FAQ_Email");
6
 
 
 
 
7
  $Post_Title = sanitize_text_field($_POST['Post_Title']);
8
  $Post_Body = (isset($_POST['Post_Body']) ? sanitize_text_field($_POST['Post_Body']) : '');
9
  $Post_Author = sanitize_text_field($_POST['Post_Author']);
@@ -24,6 +27,34 @@ function EWD_UFAQ_Submit_Question($success_message) {
24
 
25
  update_post_meta($post_id, "EWD_UFAQ_Post_Author", $Post_Author);
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  if ($Submit_FAQ_Email != 0 and isset($_POST['Author_Email'])) {
28
  update_post_meta($post_id, 'EWD_UFAQ_Post_Author_Email', sanitize_text_field($_POST['Author_Email']));
29
  if (function_exists('EWD_URP_Send_Email_To_Non_User')) {
1
  <?php
2
+ function EWD_UFAQ_Submit_Question($success_message) {
3
  $Submit_Question_Captcha = get_option("EWD_UFAQ_Submit_Question_Captcha");
4
  $Admin_Question_Notification = get_option("EWD_UFAQ_Admin_Question_Notification");
5
  $Submit_FAQ_Email = get_option("EWD_UFAQ_Submit_FAQ_Email");
6
 
7
+ $FAQ_Fields_Array = get_option("EWD_UFAQ_FAQ_Fields");
8
+ if (!is_array($FAQ_Fields_Array)) {$FAQ_Fields_Array = array();}
9
+
10
  $Post_Title = sanitize_text_field($_POST['Post_Title']);
11
  $Post_Body = (isset($_POST['Post_Body']) ? sanitize_text_field($_POST['Post_Body']) : '');
12
  $Post_Author = sanitize_text_field($_POST['Post_Author']);
27
 
28
  update_post_meta($post_id, "EWD_UFAQ_Post_Author", $Post_Author);
29
 
30
+ foreach ($FAQ_Fields_Array as $FAQ_Field_Item) {
31
+ if ($FAQ_Field_Item['FieldType'] == "checkbox") {$FieldName = "Custom_Field_" . $FAQ_Field_Item['FieldID'];}
32
+ else {$FieldName = "Custom_Field_" . $FAQ_Field_Item['FieldID'];}
33
+ if (isset($_POST[$FieldName]) or isset($_FILES[$FieldName])) {
34
+ // If it's a file, pass back to Prepare_Data_For_Insertion.php to upload the file and get the name
35
+ $Value = '';
36
+ if ($FAQ_Field_Item['FieldType'] == "checkbox") {
37
+ foreach ($_POST[$FieldName] as $SingleValue) {$Value .= trim(sanitize_text_field($SingleValue)) . ",";}
38
+ $Value = substr($Value, 0, strlen($Value)-1);
39
+ }
40
+ else {
41
+ $Value = stripslashes_deep(trim(sanitize_text_field($_POST[$FieldName])));
42
+ $Options = explode(",", $FAQ_Field_Item['FieldValues']);
43
+ if (sizeOf($Options) > 0 and $Options[0] != "") {
44
+ $Trimmed_Options = array_map('trim', $Options);
45
+ $Options = $Trimmed_Options;
46
+ $InArray = in_array($Value, $Options);
47
+ }
48
+ }
49
+ if (!isset($InArray) or $InArray) {
50
+ update_post_meta($post_id, "Custom_Field_" . $FAQ_Field_Item['FieldID'], $Value);
51
+ }
52
+ unset($Value);
53
+ unset($InArray);
54
+ unset($FieldName);
55
+ }
56
+ }
57
+
58
  if ($Submit_FAQ_Email != 0 and isset($_POST['Author_Email'])) {
59
  update_post_meta($post_id, 'EWD_UFAQ_Post_Author_Email', sanitize_text_field($_POST['Author_Email']));
60
  if (function_exists('EWD_URP_Send_Email_To_Non_User')) {
Functions/Update_Admin_Databases.php CHANGED
@@ -51,6 +51,7 @@ function EWD_UFAQ_UpdateOptions() {
51
  if (isset($_POST['reveal_effect']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Reveal_Effect', sanitize_text_field($_POST['reveal_effect']));}
52
  if (isset($_POST['pretty_permalinks']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Pretty_Permalinks', sanitize_text_field($_POST['pretty_permalinks']));}
53
  if (isset($_POST['allow_proposed_answer']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Allow_Proposed_Answer', sanitize_text_field($_POST['allow_proposed_answer']));}
 
54
  if (isset($_POST['submit_question_captcha']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Submit_Question_Captcha', sanitize_text_field($_POST['submit_question_captcha']));}
55
  if (isset($_POST['admin_question_notification']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Question_Notification', sanitize_text_field($_POST['admin_question_notification']));}
56
  if (isset($_POST['Options_Submit']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Notification_Email', sanitize_text_field($_POST['admin_notification_email']));}
51
  if (isset($_POST['reveal_effect']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Reveal_Effect', sanitize_text_field($_POST['reveal_effect']));}
52
  if (isset($_POST['pretty_permalinks']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Pretty_Permalinks', sanitize_text_field($_POST['pretty_permalinks']));}
53
  if (isset($_POST['allow_proposed_answer']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Allow_Proposed_Answer', sanitize_text_field($_POST['allow_proposed_answer']));}
54
+ if (isset($_POST['submit_custom_fields']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Submit_Custom_Fields', sanitize_text_field($_POST['submit_custom_fields']));}
55
  if (isset($_POST['submit_question_captcha']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Submit_Question_Captcha', sanitize_text_field($_POST['submit_question_captcha']));}
56
  if (isset($_POST['admin_question_notification']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Question_Notification', sanitize_text_field($_POST['admin_question_notification']));}
57
  if (isset($_POST['Options_Submit']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Notification_Email', sanitize_text_field($_POST['admin_notification_email']));}
Main.php CHANGED
@@ -2,19 +2,19 @@
2
  /*
3
  Plugin Name: Ultimate FAQ
4
  Plugin URI: http://www.EtoileWebDesign.com/wordpress-plugins/
5
- Description: A plugin that lets you create FAQs (frequently asked questions), organize them, publicize them, etc.
6
  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: ultimate-faqs
10
- Version: 1.6.13
11
  */
12
 
13
  global $ewd_ufaq_message;
14
  global $UFAQ_Full_Version;
15
  global $EWD_UFAQ_Version;
16
 
17
- $EWD_UFAQ_Version = '1.6.11';
18
  if (get_option("EWD_UFAQ_Version") == "") {update_option("EWD_UFAQ_Version", $EWD_UFAQ_Version);}
19
 
20
  define( 'EWD_UFAQ_CD_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
@@ -194,6 +194,7 @@ function Set_EWD_UFAQ_Options() {
194
  if (get_option("EWD_UFAQ_Reveal_Effect") == "") {update_option("EWD_UFAQ_Reveal_Effect", "none");}
195
  if (get_option("EWD_UFAQ_Pretty_Permalinks") == "") {update_option("EWD_UFAQ_Pretty_Permalinks", "No");}
196
  if (get_option("EWD_UFAQ_Allow_Proposed_Answer") == "") {update_option("EWD_UFAQ_Allow_Proposed_Answer", "No");}
 
197
  if (get_option("EWD_UFAQ_Submit_Question_Captcha") == "") {update_option("EWD_UFAQ_Submit_Question_Captcha", "No");}
198
  if (get_option("EWD_UFAQ_Admin_Question_Notification") == "") {update_option("EWD_UFAQ_Admin_Question_Notification", "No");}
199
  if (get_option("EWD_UFAQ_Submit_FAQ_Email") == "") {update_option("EWD_UFAQ_Submit_FAQ_Email", 0);}
2
  /*
3
  Plugin Name: Ultimate FAQ
4
  Plugin URI: http://www.EtoileWebDesign.com/wordpress-plugins/
5
+ Description: FAQ plugin that lets you easily create, order and publicize FAQs using shortcodes, with many unique styles, WooCommerce FAQs and AJAX FAQ search
6
  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: ultimate-faqs
10
+ Version: 1.6.15
11
  */
12
 
13
  global $ewd_ufaq_message;
14
  global $UFAQ_Full_Version;
15
  global $EWD_UFAQ_Version;
16
 
17
+ $EWD_UFAQ_Version = '1.6.14';
18
  if (get_option("EWD_UFAQ_Version") == "") {update_option("EWD_UFAQ_Version", $EWD_UFAQ_Version);}
19
 
20
  define( 'EWD_UFAQ_CD_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
194
  if (get_option("EWD_UFAQ_Reveal_Effect") == "") {update_option("EWD_UFAQ_Reveal_Effect", "none");}
195
  if (get_option("EWD_UFAQ_Pretty_Permalinks") == "") {update_option("EWD_UFAQ_Pretty_Permalinks", "No");}
196
  if (get_option("EWD_UFAQ_Allow_Proposed_Answer") == "") {update_option("EWD_UFAQ_Allow_Proposed_Answer", "No");}
197
+ if (get_option("EWD_UFAQ_Submit_Custom_Fields") == "") {update_option("EWD_UFAQ_Submit_Custom_Fields", "No");}
198
  if (get_option("EWD_UFAQ_Submit_Question_Captcha") == "") {update_option("EWD_UFAQ_Submit_Question_Captcha", "No");}
199
  if (get_option("EWD_UFAQ_Admin_Question_Notification") == "") {update_option("EWD_UFAQ_Admin_Question_Notification", "No");}
200
  if (get_option("EWD_UFAQ_Submit_FAQ_Email") == "") {update_option("EWD_UFAQ_Submit_FAQ_Email", 0);}
Shortcodes/SubmitFAQ.php CHANGED
@@ -7,8 +7,12 @@ function Insert_Question_Form($atts) {
7
 
8
  $Custom_CSS = get_option('EWD_UFAQ_Custom_CSS');
9
  $Allow_Proposed_Answer = get_option("EWD_UFAQ_Allow_Proposed_Answer");
 
10
  $Submit_Question_Captcha = get_option("EWD_UFAQ_Submit_Question_Captcha");
11
  $Submit_FAQ_Email = get_option("EWD_UFAQ_Submit_FAQ_Email");
 
 
 
12
 
13
  $ReturnString = "";
14
 
@@ -76,6 +80,33 @@ function Insert_Question_Form($atts) {
76
  $ReturnString .= "</div>";
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  $ReturnString .= "<div class='form-field'>";
80
  $ReturnString .= "<div id='ewd-faq-review-author' class='ewd-faq-review-label'>";
81
  $ReturnString .= $Review_Author_Label . ": ";
7
 
8
  $Custom_CSS = get_option('EWD_UFAQ_Custom_CSS');
9
  $Allow_Proposed_Answer = get_option("EWD_UFAQ_Allow_Proposed_Answer");
10
+ $Submit_Custom_Fields = get_option("EWD_UFAQ_Submit_Custom_Fields");
11
  $Submit_Question_Captcha = get_option("EWD_UFAQ_Submit_Question_Captcha");
12
  $Submit_FAQ_Email = get_option("EWD_UFAQ_Submit_FAQ_Email");
13
+
14
+ $FAQ_Fields_Array = get_option("EWD_UFAQ_FAQ_Fields");
15
+ if (!is_array($FAQ_Fields_Array)) {$FAQ_Fields_Array = array();}
16
 
17
  $ReturnString = "";
18
 
80
  $ReturnString .= "</div>";
81
  }
82
 
83
+ if ($Submit_Custom_Fields == "Yes") {
84
+ foreach ($FAQ_Fields_Array as $FAQ_Field_Item) {
85
+ $ReturnString .= "<div class='form-field'>";
86
+ $ReturnString .= "<div class='ufaq-submit-custom-field-label'>" . $FAQ_Field_Item['FieldName'] . ": </div>";
87
+ if ($FAQ_Field_Item['FieldType'] == 'text') {$ReturnString .= "<input type='text' name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' />";}
88
+ if ($FAQ_Field_Item['FieldType'] == 'textarea') {$ReturnString .= "<textarea name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' ></textarea>";}
89
+ if ($FAQ_Field_Item['FieldType'] == 'link') {$ReturnString .= "<input type='url' name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' />";}
90
+ if ($FAQ_Field_Item['FieldType'] == 'date') {$ReturnString .= "<input type='date' name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' />";}
91
+ if ($FAQ_Field_Item['FieldType'] == 'datetime') {$ReturnString .= "<input type='datetime-local' name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' />";}
92
+ if ($FAQ_Field_Item['FieldType'] == 'select') {
93
+ $Options = explode(",", $FAQ_Field_Item['FieldValues']);
94
+ $ReturnString .= "<select name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' />";
95
+ foreach ($Options as $Option) {$ReturnString .= "<option value='" . $Option . "' >" . $Option . "</option>";}
96
+ $ReturnString .= '</select>';
97
+ }
98
+ if ($FAQ_Field_Item['FieldType'] == 'radio') {
99
+ $Options = explode(",", $FAQ_Field_Item['FieldValues']);
100
+ foreach ($Options as $Option) {$ReturnString .= "<input type='radio' name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' value='" . $Option . "' > " . $Option . "<br />";}
101
+ }
102
+ if ($FAQ_Field_Item['FieldType'] == 'checkbox') {
103
+ $Options = explode(",", $FAQ_Field_Item['FieldValues']);
104
+ foreach ($Options as $Option) {$ReturnString .= "<input type='checkbox' name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "[]' value='" . $Option . "' > " . $Option . "<br />";}
105
+ }
106
+ $ReturnString .= "</div>";
107
+ }
108
+ }
109
+
110
  $ReturnString .= "<div class='form-field'>";
111
  $ReturnString .= "<div id='ewd-faq-review-author' class='ewd-faq-review-label'>";
112
  $ReturnString .= $Review_Author_Label . ": ";
css/ewd-ufaq-styles.css CHANGED
@@ -480,6 +480,9 @@ PChanges
480
  font-size: 1.2em;
481
  margin-bottom: 20px;
482
  }
 
 
 
483
 
484
  .rrssb-buttons li a .rrssb-text {
485
  color: #fff;
480
  font-size: 1.2em;
481
  margin-bottom: 20px;
482
  }
483
+ .ewd-ufaq-question-form .form-field {
484
+ margin-bottom: 20px;
485
+ }
486
 
487
  .rrssb-buttons li a .rrssb-text {
488
  color: #fff;
html/OptionsPage.php CHANGED
@@ -25,6 +25,7 @@
25
  $Reveal_Effect = get_option("EWD_UFAQ_Reveal_Effect");
26
  $Pretty_Permalinks = get_option("EWD_UFAQ_Pretty_Permalinks");
27
  $Allow_Proposed_Answer = get_option("EWD_UFAQ_Allow_Proposed_Answer");
 
28
  $Submit_Question_Captcha = get_option("EWD_UFAQ_Submit_Question_Captcha");
29
  $Admin_Question_Notification = get_option("EWD_UFAQ_Admin_Question_Notification");
30
  $Admin_Notification_Email = get_option("EWD_UFAQ_Admin_Notification_Email");
@@ -486,6 +487,16 @@
486
  </td>
487
  </tr>
488
  <tr>
 
 
 
 
 
 
 
 
 
 
489
  <th scope="row">Submit Question Captcha</th>
490
  <td>
491
  <fieldset><legend class="screen-reader-text"><span>Submit Question Captcha</span></legend>
25
  $Reveal_Effect = get_option("EWD_UFAQ_Reveal_Effect");
26
  $Pretty_Permalinks = get_option("EWD_UFAQ_Pretty_Permalinks");
27
  $Allow_Proposed_Answer = get_option("EWD_UFAQ_Allow_Proposed_Answer");
28
+ $Submit_Custom_Fields = get_option("EWD_UFAQ_Submit_Custom_Fields");
29
  $Submit_Question_Captcha = get_option("EWD_UFAQ_Submit_Question_Captcha");
30
  $Admin_Question_Notification = get_option("EWD_UFAQ_Admin_Question_Notification");
31
  $Admin_Notification_Email = get_option("EWD_UFAQ_Admin_Notification_Email");
487
  </td>
488
  </tr>
489
  <tr>
490
+ <th scope="row">Submit Custom Fields</th>
491
+ <td>
492
+ <fieldset><legend class="screen-reader-text"><span>Submit Custom Fields</span></legend>
493
+ <label title='Yes'><input type='radio' name='submit_custom_fields' value='Yes' <?php if($Submit_Custom_Fields == "Yes") {echo "checked='checked'";} ?> <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?> /> <span>Yes</span></label><br />
494
+ <label title='No'><input type='radio' name='submit_custom_fields' value='No' <?php if($Submit_Custom_Fields == "No") {echo "checked='checked'";} ?> <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?> /> <span>No</span></label><br />
495
+ <p>When using the user-submitted question shortcode, should users be able to fill in custom fields for the question they're submitting? File type custom fields cannot be submitted.</p>
496
+ </fieldset>
497
+ </td>
498
+ </tr>
499
+ <tr>
500
  <th scope="row">Submit Question Captcha</th>
501
  <td>
502
  <fieldset><legend class="screen-reader-text"><span>Submit Question Captcha</span></legend>
readme.txt CHANGED
@@ -266,6 +266,9 @@ Video 3 - FAQs Ordering
266
 
267
 
268
  == Changelog ==
 
 
 
269
  = 1.6.14 =
270
  - Fixed a deprecated function issue for PHP 7.2 users
271
 
266
 
267
 
268
  == Changelog ==
269
+ = 1.6.15 =
270
+ - Added in a option to let users submit custom fields along with their questions when using the submit question shortcode
271
+
272
  = 1.6.14 =
273
  - Fixed a deprecated function issue for PHP 7.2 users
274