Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mike Walsh

    (@mpwalsh8)

    Can you see if it works correctly if you use “Editor”
    Instead of “Author”? If it does, I think I know why.

    Thread Starter gdisalvo

    (@gdisalvo)

    Mike,

    No Luck Editor does same.

    Looks like I will try to remove the new role for now unless you know where I can tweak it?

    Plugin Author Mike Walsh

    (@mpwalsh8)

    I’ll have to look at the code and see. I know I check for Editor capability for the Manage and Report menus and Admin capability for the Options menu but the SwimTeam menu should be available to any subscriber but I don’t recall an explicit check for anything special.

    Thread Starter gdisalvo

    (@gdisalvo)

    Hi Mike,

    I changed the role back to subscribe. At the bottom was capabilities “swimteam”

    In the meta for the user – I had both.

    And that seems to work – I will run a few more test.

    Apparently, when adding role and trying to use a template like get role prior to assigning the swimteam role, it doesn’t work in tandem.

    I will write back to see what else is going on as this could be a word press feature hidden.

    Thread Starter gdisalvo

    (@gdisalvo)

    Hi Mike,

    Here is the answer. Apparently, without the subscriber role you cannot enter swimteam from frontend. The new role is to be used to distinguish that they are more than subscribe and less than author editor and admin. New custom role swimteam.

    In the theme function.

    function swimteam_addroles() {
    global $wp_roles;
    $role = get_role(‘swimteam’);
    $wp_roles->remove_role( ‘swimteam’ );
    ///// Just in case add the role for new changes in user admin
    $wp_roles->add_role( ‘swimteam’, ‘Swim Team’, array(‘swimteam’) );
    }
    add_action( ‘init’, ‘swimteam_addroles’ );

    function swimteam_addcaps() {
    global $current_user;
    ///// Check for non admin users and if they have been assigned swimteam
    if ( !current_user_can(‘manage_options’) && current_user_can( ‘swimteam’ ) ) {
    get_currentuserinfo();
    $user = wp_get_current_user();
    $userid = $user->ID;
    $roles = $user->roles;
    $role = array_shift($roles);
    ///// If they have swimteam change or add capabilties to their user
    ///// This gets them Reporting and extra swimteam TABs for viewing rosters and emails
    switch($role) {
    case (‘swimteam’):
    $user->add_cap(‘subscriber’);
    $user->add_cap(‘swimteam’);
    break;
    default:
    break;
    }

    }
    }
    add_action( ‘init’, ‘swimteam_addcaps’, 10, 0 );

    //////
    And in the swimteam user menu I check user can do swimteam role than allow TAB to be made and visible.

    In case you can use this in your future.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘ISSUE with ADMIN.PHP’ is closed to new replies.