Skip to:
Content
Pages
Categories
Search
Top
Bottom

lock profile editing from non administrators

  • @cyclune

    Member

    Hi!

    Is there a way to lock the user profiles for non administrators?

    thank you for help!

    cyclune

Viewing 6 replies - 1 through 6 (of 6 total)
  • @_ck_

    Participant

    Only admin can change profiles in the first place, except for the profile owner.

    Are you saying you don’t want the member themselves to be able to change their own profile?

    @chrishajer

    Participant

    I have thought about this as well. I would like to prevent members from editing their own profile, or at least their email. What happens is people register with a real email address, get their password, then change the email so you don’t know their real email address. I would like to prevent that, and I think cyclune was talking about something similar, prevent a member from editing their own profile.

    @_ck_

    Participant

    untested, in theory:

    function bb_tweaks_no_profile_edit($retvalue, $capability, $args) {
    if ($capability=="edit_user") {return bb_current_user_can( 'administrate');}
    return $retvalue;
    }
    add_filter('bb_current_user_can', 'bb_tweaks_no_profile_edit',10,3);

    @cyclune

    Member

    Chrishajer is right. I have bbpress linked with WordPress. I don’t want the users to change their own profile with wrong email adresses or new user names.

    _ck_ – where do I have to insert this piece of code???

    cyclune

    @_ck_

    Participant

    make it into a mini-plugin, ie.

    <?php
    /*
    Plugin Name: No Profit Edit
    */
    function bb_tweaks_no_profile_edit($retvalue, $capability, $args) {
    if ($capability=="edit_user") {return bb_current_user_can( 'administrate');}
    return $retvalue;
    }
    add_filter('bb_current_user_can', 'bb_tweaks_no_profile_edit',10,3);
    ?>

    Save it as no-profile-edit.php put into my-plugins and activate.

    Make sure you don’t put any spaces at the beginning or end of the file.

    @cyclune

    Member

    Greeeeeeat!

    Thank you, it works!

    Cyclune

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar