0

how do you make the user role "contributor" to be same as the user role "seller" by using functions.php

I've tried user role editor, but it seems to be the dokan multivendor plugin has set only into user role "seller" but I wanted to make the "contributor" to be same as the seller role

1
  • How are you creating user role "seller"?
    – sakibmoon
    May 27, 2015 at 20:56

2 Answers 2

1

Contributor has the following capabilities

  • delete_posts
  • edit_posts
  • read

You can create the "Seller" role to have same capabilities as Contributor

add_role(
    'seller',
    __( 'Seller' ),
    array(
        'read'         => true,
        'edit_posts'   => true,
        'delete_posts' => true,
    )
);

Warning from codex

NB: This setting is saved to the database (in table wp_options, field wp_user_roles), so it might be better to run this on theme/plugin activation

In functions.php, you should use this in after_setup_theme hook.

EDIT

You can also create a user role who have same permission as another this way

add_role(
    'specialuser',
    __('Special User'),
    get_role('seller')->capabilities
);

It will grant specialuser same capabilities as seller.

2
  • Hi, what about a custom user role forexample my newly added custom role is "specialuser" I wanted to make that user role to be same as the "seller" user role
    – pryde1919
    May 29, 2015 at 0:03
  • @pryde1919 check my edit.
    – sakibmoon
    May 29, 2015 at 4:26
0

should I copy the code from the link provided? http://codex.wordpress.org/Plugin_API/Action_Reference/after_setup_theme

it's a twentytwelve theme, my theme is oxygen theme, how can I impliment the code? change the word twentytwelve into oxygen?

1
  • You should post this as a comment under sakibmoon's answer, and not as an answer to your own question (which is it not). A comment on that answer will generate a notification to sakibmoon, and is the proper place to ask for clarification.
    – Gabriel
    Jun 3, 2015 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.