WordPress.org

Ready to get started?Download WordPress

Forums

Paid Memberships Pro
[resolved] Allow editors to change/add membership levels for members (10 posts)

  1. rwilki
    Member
    Posted 11 months ago #

    Love this plugin! I have modified my functions file a little to allow an editor to add new members. But for some reason, the drop down field for membership levels isn't available to change. Is there a way to allow editors to change this?

    Thanks,
    Bob

    http://wordpress.org/plugins/paid-memberships-pro/

  2. strangerstudios
    Member
    Plugin Author

    Posted 11 months ago #

    Hi, Bob. The plugin is set to only allow administrators to change membership levels on users. You can change the permission here:
    https://github.com/strangerstudios/paid-memberships-pro/blob/dev/includes/profile.php#L9

    And then further down it checks if a the user can edit the user being edited before saving the changes here:
    https://github.com/strangerstudios/paid-memberships-pro/blob/dev/includes/profile.php#L166

    You can change those current_user_can calls to suit your needs. I'll look into adding filters in the next release so you can change these without hacking the core plugin.

  3. rwilki
    Member
    Posted 11 months ago #

    Thanks so much! I'll try that.

    Prior to realizing this issue, I did manage to let Editor manage users by this code. I don't suppose, there's a capability that I can add to their "list" to make this work rather than hacking the plugin?

    // let editor manage users
    $edit_editor = get_role('editor'); // Get the user role
    $edit_editor->add_cap('list_users');
    $edit_editor->add_cap('create_users');
    $edit_editor->add_cap('delete_users');

    Thanks,
    Bob

  4. Slocum Themes
    Member
    Plugin Author

    Posted 10 months ago #

    Hi Bob,

    I just wanted to let you know that we added a filter in the newest version (1.7.2) which will be released this later on this week.

    This file shows where the filter is located in the code: https://github.com/strangerstudios/paid-memberships-pro/blob/dev/includes/profile.php#L10.

    Thank You

  5. rwilki
    Member
    Posted 10 months ago #

    So grateful for your help @Slocum Design Studio! Worked like a charm. Wow. Love this plugin more than ever!

    Thanks,
    Bob

  6. Gene
    Member
    Posted 10 months ago #

    Hi, I'm trying to accomplish the same thing as Bob, to allow my Editors to create/delete/edit new members. I've added the code that Bob has provided above. What else do I need to add so that Editors can change the PMP membership level as well?

    Thanks for any help, much appreciated!

  7. rwilki
    Member
    Posted 10 months ago #

    Gene, it was pretty simple. If you go to the github link Slocum Desigin Studio posted above https://github.com/strangerstudios/paid-memberships-pro/blob/dev/includes/profile.php#L10 and follow the directions for which line of code is changed in the profile.php file, the change should work for you.

    Let me know if you have questions.

    BTW, my code was a guess at changing something in the functions file and it doesn't work.

    Thanks,
    Bob

  8. Gene
    Member
    Posted 10 months ago #

    Hi Bob, actually your code does work, partially. It allows an editor to list, create and delete users. I did add the edit capability.

    $edit_editor->add_cap('edit_users');

    Apparently, I was doing it wrong... at first, I added

    $edit_editor->add_cap('membership_level_capability');

    Obviously, that was wrong, it should have been this instead

    $edit_editor->add_cap('manage_options');

    Thanks!

  9. Gene
    Member
    Posted 10 months ago #

    Also, you may want to check this code snippet as well...

    http://wordpress.stackexchange.com/questions/4479/editor-can-create-any-new-user-except-administrator

    It will prevent your editors from modifying the administrators and prevent them from creating users with admin role.

  10. rwilki
    Member
    Posted 10 months ago #

    wow thanks Gene. I'm aware of your second code snippet. GREAT piece of code. I like keeping the editor locked down as much as possible.... thanks!

Reply

You must log in to post.

About this Plugin

About this Topic