• Resolved jerryjariwala

    (@jerryjariwala)


    i am able to create roles like this programmatically but i can’t set role priority. can anybody help me on how to set role priority when creating a role??

    add_role( “um_” . $user_info->user_login . “_club_member”, $user_info->user_login . ” Club Member”, array());

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support andrewshu

    (@andrewshu)

    Hello @jerryjariwala

    You need to insert this data into the wp_options table. All data for user roles is stored in the option with option_name “um_role_club_member_meta” (where test).

    Sorry, but customizations are not included in our support. You need to investigate this option by yourself. You could check some roles to investigate how data is saved in this option.

    Regards.

    missveronica

    (@missveronicatv)

    @jerryjariwala

    You can try this code snippet

    $userrole_metakey = $user_info->user_login . "_club_member";
    add_role( "um_" . $userrole_metakey, $user_info->user_login . " Club Member", array());
    $rolemeta = get_option( "um_role_{$userrole_metakey}_meta", false );
    $rolemeta['_um_priority'] = 77;
    update_option( "um_role_{$userrole_metakey}_meta", $rolemeta );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to assign role priority programmatically’ is closed to new replies.