WORDPRESS: How to disable “Admin bar” and prevent subscribers from accessing the “Edit Profile Page”

WORDPRESS: How to disable “Admin bar” and prevent subscribers from accessing the “Edit Profile Page”

PART 1

1. On FTP, View/Edit functions.php [found on your current theme’s folder]
(make sure to make a back-up copy first, just in case you make a mistake in editing the .php file)

2. Add the ff. at the end of the script… just before “?>

// show admin bar only for admins
if (!current_user_can(‘manage_options’)) {
add_filter(‘show_admin_bar’, ‘__return_false’);
}
// show admin bar only for admins and editors
if (!current_user_can(‘edit_posts’)) {
add_filter(‘show_admin_bar’, ‘__return_false’);
}

3. Save the .php file

4. Update on FTP

5. Test the new settings. (Only Admins/Editors should be able to view the admin bar.)

PART 2

1. On FTP, View/Edit user-edit.php (make sure to make a back-up copy first, just in case you make a mistake in editing the .php file)

2. Search for the phrase:

default: $profileuser = get_user_to_edit($user_id);

if ( !current_user_can(‘edit_user’, $user_id) )
wp_die(__(‘You do not have permission to edit this user.’));

include (‘admin-header.php’);
?>

3. After that phrase, add the ff:

<?php
if (‘profile.php’ == basename($_SERVER[‘SCRIPT_NAME’]) && !current_user_can(‘edit_users’) )
wp_die(__(‘You are not allowed to edit.’));
?>

4. Save the .php file

5. Update on FTP

6. Test the new settings. (Subscribers should see “You are not allowed to edit.” on the Profile page while Admins can still access it)

***You may also use WP Editor on Admin Panel to make changes to functions.php and user-edit.php files.

Advertisements

2 thoughts on “WORDPRESS: How to disable “Admin bar” and prevent subscribers from accessing the “Edit Profile Page”

  1. Hi! Someone in my Myspace group shared this site with us so
    I came to check it out. I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers! Outstanding blog and brilliant style and design.

  2. Cerebromedullospinal Disconnection or Ventral Pontine Syndrome is also known as “Locked-in Syndrome” which is a kind of pseudo-coma.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s