Ultimate FAQ - Version 1.6.17

Version Description

  • Added an option to change who has access to the FAQ admin area
Download this release

Release Info

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

Code changes from version 1.6.16 to 1.6.17

Functions/Update_Admin_Databases.php CHANGED
@@ -17,6 +17,8 @@ function EWD_UFAQ_UpdateOptions() {
17
 
18
  if ( ! wp_verify_nonce( $_POST['EWD_UFAQ_Save_Options_Nonce'], 'EWD_UFAQ_Save_Options' ) ) {return;}
19
 
 
 
20
  $Custom_CSS = (isset($_POST['custom_css']) ? EWD_UFAQ_Validate_CSS($_POST['custom_css']) : null);
21
  $Social_Media_Array = (isset($_POST['Socialmedia']) ? $_POST['Socialmedia'] : array());
22
  array_walk($Social_Media_Array, 'sanitize_text_field');
@@ -42,6 +44,7 @@ function EWD_UFAQ_UpdateOptions() {
42
  if (isset($_POST['permalink_type'])) {update_option('EWD_UFAQ_Permalink_Type', sanitize_text_field($_POST['permalink_type']));}
43
  if (isset($_POST['show_tinymce'])) {update_option('EWD_UFAQ_Show_TinyMCE', sanitize_text_field($_POST['show_tinymce']));}
44
  if (isset($_POST['comments_on'])) {update_option('EWD_UFAQ_Comments_On', sanitize_text_field($_POST['comments_on']));}
 
45
 
46
  if (isset($_POST['display_style']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Display_Style', sanitize_text_field($_POST['display_style']));}
47
  if (isset($_POST['color_block_shape']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Color_Block_Shape', sanitize_text_field($_POST['color_block_shape']));}
17
 
18
  if ( ! wp_verify_nonce( $_POST['EWD_UFAQ_Save_Options_Nonce'], 'EWD_UFAQ_Save_Options' ) ) {return;}
19
 
20
+ if (get_option("EWD_UFAQ_Access_Role") != '' and !current_user_can(get_option("EWD_UFAQ_Access_Role"))) {return;}
21
+
22
  $Custom_CSS = (isset($_POST['custom_css']) ? EWD_UFAQ_Validate_CSS($_POST['custom_css']) : null);
23
  $Social_Media_Array = (isset($_POST['Socialmedia']) ? $_POST['Socialmedia'] : array());
24
  array_walk($Social_Media_Array, 'sanitize_text_field');
44
  if (isset($_POST['permalink_type'])) {update_option('EWD_UFAQ_Permalink_Type', sanitize_text_field($_POST['permalink_type']));}
45
  if (isset($_POST['show_tinymce'])) {update_option('EWD_UFAQ_Show_TinyMCE', sanitize_text_field($_POST['show_tinymce']));}
46
  if (isset($_POST['comments_on'])) {update_option('EWD_UFAQ_Comments_On', sanitize_text_field($_POST['comments_on']));}
47
+ if (isset($_POST['access_role'])) {update_option('EWD_UFAQ_Access_Role', sanitize_text_field($_POST['access_role']));}
48
 
49
  if (isset($_POST['display_style']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Display_Style', sanitize_text_field($_POST['display_style']));}
50
  if (isset($_POST['color_block_shape']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Color_Block_Shape', sanitize_text_field($_POST['color_block_shape']));}
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: ultimate-faqs
10
- Version: 1.6.16
11
  */
12
 
13
  global $ewd_ufaq_message;
14
  global $UFAQ_Full_Version;
15
  global $EWD_UFAQ_Version;
16
 
17
- $EWD_UFAQ_Version = '1.6.16';
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__ ) );
@@ -38,28 +38,31 @@ function EWD_UFAQ_Enable_Sub_Menu() {
38
  global $submenu;
39
 
40
  $Admin_Approval = get_option("EWD_UFAQ_Admin_Approval");
 
 
 
41
 
42
  remove_menu_page('edit.php?post_type=ufaq');
43
 
44
- add_menu_page( 'Ultimate FAQs', 'FAQs', 'edit_posts', 'EWD-UFAQ-Options', 'EWD_UFAQ_Output_Pages', 'dashicons-format-chat', '49.1' );
45
- add_submenu_page('EWD-UFAQ-Options', 'FAQ Options', 'FAQ Settings', 'edit_posts', 'EWD-UFAQ-Options&DisplayPage=Options', 'EWD_UFAQ_Output_Pages');
46
  if ($Admin_Approval == "Yes") {
47
  $submenu['EWD-UFAQ-Options'][6] = $submenu['EWD-UFAQ-Options'][1];
48
- $submenu['EWD-UFAQ-Options'][1] = array( 'Approved FAQs', 'edit_posts', "edit.php?post_type=ufaq&post_status=publish", "Approved FAQs" );
49
- $submenu['EWD-UFAQ-Options'][2] = array( 'Awaiting Approval', 'edit_posts', "edit.php?post_type=ufaq&post_status=draft", "Awaiting Approval" );
50
- $submenu['EWD-UFAQ-Options'][3] = array( 'Add New', 'edit_posts', "post-new.php?post_type=ufaq", "Add New" );
51
- $submenu['EWD-UFAQ-Options'][4] = array( 'FAQ Categories', 'manage_categories', "edit-tags.php?taxonomy=ufaq-category&post_type=ufaq", "FAQ Categories" );
52
- $submenu['EWD-UFAQ-Options'][5] = array( 'FAQ Tags', 'manage_categories', "edit-tags.php?taxonomy=ufaq-tag&post_type=ufaq", "FAQ Tags" );
53
  }
54
  else {
55
  $submenu['EWD-UFAQ-Options'][5] = $submenu['EWD-UFAQ-Options'][1];
56
- $submenu['EWD-UFAQ-Options'][1] = array( 'FAQs', 'edit_posts', "edit.php?post_type=ufaq", "FAQs" );
57
- $submenu['EWD-UFAQ-Options'][2] = array( 'Add New', 'edit_posts', "post-new.php?post_type=ufaq", "Add New" );
58
- $submenu['EWD-UFAQ-Options'][3] = array( 'FAQ Categories', 'manage_categories', "edit-tags.php?taxonomy=ufaq-category&post_type=ufaq", "FAQ Categories" );
59
- $submenu['EWD-UFAQ-Options'][4] = array( 'FAQ Tags', 'manage_categories', "edit-tags.php?taxonomy=ufaq-tag&post_type=ufaq", "FAQ Tags" );
60
  }
61
- add_submenu_page('EWD-UFAQ-Options', 'FAQ Export', 'FAQ Export', 'edit_posts', 'EWD-UFAQ-Options&DisplayPage=Export', 'EWD_UFAQ_Output_Pages');
62
- add_submenu_page('EWD-UFAQ-Options', 'FAQ Import', 'FAQ Import', 'edit_posts', 'EWD-UFAQ-Options&DisplayPage=ImportPosts', 'EWD_UFAQ_Output_Pages');
63
 
64
  $submenu['EWD-UFAQ-Options'][0][0] = "Dashboard";
65
  ksort($submenu['EWD-UFAQ-Options']);
@@ -186,6 +189,7 @@ function Set_EWD_UFAQ_Options() {
186
  if (get_option("EWD_UFAQ_Permalink_Type") == "") {update_option("EWD_UFAQ_Permalink_Type", "SamePage");}
187
  if (get_option("EWD_UFAQ_Show_TinyMCE") == "") {update_option("EWD_UFAQ_Show_TinyMCE", "Yes");}
188
  if (get_option("EWD_UFAQ_Comments_On") == "") {update_option("EWD_UFAQ_Comments_On", "Yes");}
 
189
 
190
  if (get_option("EWD_UFAQ_Display_Style") == "") {update_option("EWD_UFAQ_Display_Style", "Default");}
191
  if (get_option("EWD_UFAQ_Color_Block_Shape") == "") {update_option("EWD_UFAQ_Color_Block_Shape", "Square");}
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.17
11
  */
12
 
13
  global $ewd_ufaq_message;
14
  global $UFAQ_Full_Version;
15
  global $EWD_UFAQ_Version;
16
 
17
+ $EWD_UFAQ_Version = '1.6.17';
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__ ) );
38
  global $submenu;
39
 
40
  $Admin_Approval = get_option("EWD_UFAQ_Admin_Approval");
41
+ $Access_Role = get_option("UPCP_Access_Role");
42
+
43
+ if ($Access_Role == "") {$Access_Role = "edit_posts";}
44
 
45
  remove_menu_page('edit.php?post_type=ufaq');
46
 
47
+ add_menu_page( 'Ultimate FAQs', 'FAQs', $Access_Role, 'EWD-UFAQ-Options', 'EWD_UFAQ_Output_Pages', 'dashicons-format-chat', '49.1' );
48
+ add_submenu_page('EWD-UFAQ-Options', 'FAQ Options', 'FAQ Settings', $Access_Role, 'EWD-UFAQ-Options&DisplayPage=Options', 'EWD_UFAQ_Output_Pages');
49
  if ($Admin_Approval == "Yes") {
50
  $submenu['EWD-UFAQ-Options'][6] = $submenu['EWD-UFAQ-Options'][1];
51
+ $submenu['EWD-UFAQ-Options'][1] = array( 'Approved FAQs', $Access_Role, "edit.php?post_type=ufaq&post_status=publish", "Approved FAQs" );
52
+ $submenu['EWD-UFAQ-Options'][2] = array( 'Awaiting Approval', $Access_Role, "edit.php?post_type=ufaq&post_status=draft", "Awaiting Approval" );
53
+ $submenu['EWD-UFAQ-Options'][3] = array( 'Add New', $Access_Role, "post-new.php?post_type=ufaq", "Add New" );
54
+ $submenu['EWD-UFAQ-Options'][4] = array( 'FAQ Categories', $Access_Role, "edit-tags.php?taxonomy=ufaq-category&post_type=ufaq", "FAQ Categories" );
55
+ $submenu['EWD-UFAQ-Options'][5] = array( 'FAQ Tags', $Access_Role, "edit-tags.php?taxonomy=ufaq-tag&post_type=ufaq", "FAQ Tags" );
56
  }
57
  else {
58
  $submenu['EWD-UFAQ-Options'][5] = $submenu['EWD-UFAQ-Options'][1];
59
+ $submenu['EWD-UFAQ-Options'][1] = array( 'FAQs', $Access_Role, "edit.php?post_type=ufaq", "FAQs" );
60
+ $submenu['EWD-UFAQ-Options'][2] = array( 'Add New', $Access_Role, "post-new.php?post_type=ufaq", "Add New" );
61
+ $submenu['EWD-UFAQ-Options'][3] = array( 'FAQ Categories', $Access_Role, "edit-tags.php?taxonomy=ufaq-category&post_type=ufaq", "FAQ Categories" );
62
+ $submenu['EWD-UFAQ-Options'][4] = array( 'FAQ Tags', $Access_Role, "edit-tags.php?taxonomy=ufaq-tag&post_type=ufaq", "FAQ Tags" );
63
  }
64
+ add_submenu_page('EWD-UFAQ-Options', 'FAQ Export', 'FAQ Export', $Access_Role, 'EWD-UFAQ-Options&DisplayPage=Export', 'EWD_UFAQ_Output_Pages');
65
+ add_submenu_page('EWD-UFAQ-Options', 'FAQ Import', 'FAQ Import', $Access_Role, 'EWD-UFAQ-Options&DisplayPage=ImportPosts', 'EWD_UFAQ_Output_Pages');
66
 
67
  $submenu['EWD-UFAQ-Options'][0][0] = "Dashboard";
68
  ksort($submenu['EWD-UFAQ-Options']);
189
  if (get_option("EWD_UFAQ_Permalink_Type") == "") {update_option("EWD_UFAQ_Permalink_Type", "SamePage");}
190
  if (get_option("EWD_UFAQ_Show_TinyMCE") == "") {update_option("EWD_UFAQ_Show_TinyMCE", "Yes");}
191
  if (get_option("EWD_UFAQ_Comments_On") == "") {update_option("EWD_UFAQ_Comments_On", "Yes");}
192
+ if (get_option("EWD_UFAQ_Access_Role") == "") {update_option("EWD_UFAQ_Access_Role", "edit_posts");}
193
 
194
  if (get_option("EWD_UFAQ_Display_Style") == "") {update_option("EWD_UFAQ_Display_Style", "Default");}
195
  if (get_option("EWD_UFAQ_Color_Block_Shape") == "") {update_option("EWD_UFAQ_Color_Block_Shape", "Square");}
html/OptionsPage.php CHANGED
@@ -16,6 +16,7 @@
16
  $Permalink_Type = get_option("EWD_UFAQ_Permalink_Type");
17
  $Show_TinyMCE = get_option("EWD_UFAQ_Show_TinyMCE");
18
  $Comments_On = get_option("EWD_UFAQ_Comments_On");
 
19
 
20
  $Display_Style = get_option("EWD_UFAQ_Display_Style");
21
  $Color_Block_Shape = get_option("EWD_UFAQ_Color_Block_Shape");
@@ -204,6 +205,22 @@
204
  </fieldset>
205
  </td>
206
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  </table>
208
 
209
  <br />
16
  $Permalink_Type = get_option("EWD_UFAQ_Permalink_Type");
17
  $Show_TinyMCE = get_option("EWD_UFAQ_Show_TinyMCE");
18
  $Comments_On = get_option("EWD_UFAQ_Comments_On");
19
+ $Access_Role = get_option("EWD_UFAQ_Access_Role");
20
 
21
  $Display_Style = get_option("EWD_UFAQ_Display_Style");
22
  $Color_Block_Shape = get_option("EWD_UFAQ_Color_Block_Shape");
205
  </fieldset>
206
  </td>
207
  </tr>
208
+ <tr>
209
+ <th scope="row"><?php _e("Set Access Role", 'ultimate-faqs')?> <br/>
210
+ </th>
211
+ <td>
212
+ <fieldset><legend class="screen-reader-text"><span>Set Access Role</span></legend>
213
+ <label title='Access Role'></label><select name='access_role'>
214
+ <option value="administrator"<?php if($Access_Role == "administrator") {echo " selected=selected";} ?>>Administrator</option>
215
+ <option value="delete_others_pages"<?php if($Access_Role == "delete_others_pages") {echo " selected=selected";} ?>>Editor</option>
216
+ <option value="delete_published_posts"<?php if($Access_Role == "delete_published_posts") {echo " selected=selected";} ?>>Author</option>
217
+ <option value="delete_posts"<?php if($Access_Role == "edit_posts") {echo " selected=selected";} ?>>Contributor</option>
218
+ <option value="read"<?php if($Access_Role == "read") {echo " selected=selected";} ?>>Subscriber</option>
219
+ </select>
220
+ <p><?php _e("Which level of user should have access to FAQs, Settings, etc.?", 'ultimate-faqs')?></p>
221
+ </fieldset>
222
+ </td>
223
+ </tr>
224
  </table>
225
 
226
  <br />
readme.txt CHANGED
@@ -266,6 +266,9 @@ Video 3 - FAQs Ordering
266
 
267
 
268
  == Changelog ==
 
 
 
269
  = 1.6.16 =
270
  - Added in an option to have the category toggles accordion
271
 
266
 
267
 
268
  == Changelog ==
269
+ = 1.6.17 =
270
+ - Added an option to change who has access to the FAQ admin area
271
+
272
  = 1.6.16 =
273
  - Added in an option to have the category toggles accordion
274