Changeset 825140
- Timestamp:
- 12/18/2013 11:48:11 PM (12 years ago)
- Location:
- wp-admin-no-show/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
wp-admin-no-show.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-admin-no-show/trunk/readme.txt
r794104 r825140 4 4 Tags: admin bar, admin menu, dashboard, disable, remove, hide 5 5 Requires at least: 3.1 6 Tested up to: 3. 77 Stable tag: 1.4. 26 Tested up to: 3.8 7 Stable tag: 1.4.3 8 8 License: MIT License 9 9 License URI: http://www.opensource.org/licenses/mit-license.php … … 39 39 40 40 == Changelog == 41 42 = 1.4.3 = 43 * Removed improper use of current_user_can("role") function with WordPress Check User Role Function (AppThemes). Thanks to @massimopadovan for pointing it out. 44 * Tested for WordPress 3.8 compatibility. 41 45 42 46 = 1.4.2 = -
wp-admin-no-show/trunk/wp-admin-no-show.php
r794104 r825140 4 4 Plugin URI: http://www.dougsparling.org 5 5 Description: Efectively blocks admin portion of site for selected user roles. Any attempt to manually navigate to wp-admin section of site and user will be redirected to selected site page. Hides admin bar. 6 Version: 1.4. 26 Version: 1.4.3 7 7 Author: Doug Sparling 8 8 Author URI: http://www.dougsparling.org … … 68 68 // whitelist administrator for redirect 69 69 continue; 70 } else if ( current_user_can( $role ) ) {70 } else if ( wp_admin_no_show_check_user_role( $role ) ) { 71 71 $disable = true; 72 72 } … … 116 116 } 117 117 foreach ( $blacklist_roles as $role ) { 118 if ( current_user_can( $role ) ) {118 if ( wp_admin_no_show_check_user_role( $role ) ) { 119 119 $disable = true; 120 120 } … … 129 129 } 130 130 add_action( 'init', 'wp_admin_no_show_admin_bar_disable' ); 131 132 /** 133 * Checks if a particular user has a role. 134 * Returns true if a match was found. 135 * http://docs.appthemes.com/tutorials/wordpress-check-user-role-function/ 136 * 137 * @param string $role Role name. 138 * @param int $user_id (Optional) The ID of a user. Defaults to the current user. 139 * @return bool 140 */ 141 function wp_admin_no_show_check_user_role( $role, $user_id = null ) { 142 if ( is_numeric( $user_id ) ) 143 $user = get_userdata( $user_id ); 144 else 145 $user = wp_get_current_user(); 146 147 if ( empty( $user ) ) 148 return false; 149 150 return in_array( $role, (array) $user->roles ); 151 } 131 152 132 153 /**
Note: See TracChangeset
for help on using the changeset viewer.