• On the Posts page (wp-admin/profile.php), I would like to remove the link to “Profile” or remove access to the page completely for users.

    Said another way: I want an Admin to register each user. I don’t want the users to change their profile, username, or password.

    FYI: I’m sure someone is wondering why I wouldn’t want a user to update their profile. More importantly, I don’t want them to change their username and password–actually, any of their profile. My company wants to provide and anonymous blog where all employees have the same username and password. Admin will change the password periodically.

    Below is code that I’ve tried in profile.php by another person’s suggestion, but it did not work.

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

    Is there a ready-made plugin or existing feature that will do this? Or, could someone tell me what code to insert in which PHP file?

Viewing 5 replies - 1 through 5 (of 5 total)
  • There’s a few plugins that might do what you want, but I haven’t tried any of them.

    Admin Menu Management

    Page Restrict

    WP-CMS

    They may work, and would certainly be worth exploring further for your needs.

    Thread Starter rkyle2

    (@rkyle2)

    Thanks for your quick reply. I’ll explore each of those and report findings/usability here to help others with a similar issue.

    rkyle2, The code that you posted does work. You are putting it in the wrong file. The file, profile.php simply points to user-edit.php

    The user-edit.php contains the real code, and is where the code-snippet you posted is supposed to go.

    Directions to install:

    1. Take a fresh copy of user-edit.php and open it up in dreamweaver.

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

    4. Save the document, and close dreamweaver.

    5. Back up the original user-edit.php located on the server

    6. Upload the edited user-edit.php

    7. Test it. Administrators will still be able to edit their profile.

    8. If it doesn’t work, try these steps over again with another fresh copy of user-edit.php

    9. If it works, rejoice!!

    Thread Starter rkyle2

    (@rkyle2)

    Thanks a lot! And, thanks for the walk-through.

    if i take the code snippet:

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

    and put that in to user-edit.php, then the user still goes to the dashboard profile view where they are told that they can not edit their profile.

    what about removing the link to ‘siteurl’ in comments.php?

    i left

    <p>Logged in as <?php echo $user_identity; ?>

    in place to show the username but it is simply text now without being a link redirecting to wp-admin.

    i may have to redo this when i update wordpress, but taking notes is no big deal.

    also combined with :
    Peter’s Login Redirect

    i can manage access to the dashboard. Sometimes people want the subscribers only on the front side of the content.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Need to remove link to Profile from Post page’ is closed to new replies.