Title: ISSUE with ADMIN.PHP
Last modified: August 21, 2016

---

# ISSUE with ADMIN.PHP

 *  Resolved [gdisalvo](https://wordpress.org/support/users/gdisalvo/)
 * (@gdisalvo)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/issue-with-adminphp/)
 * Hi Mike,
 * I created a new ROLE = swimteam
    Added the capability author
 * When check it on simple plugin or templates works fine.
 * When I check the user meta – its there as
 * a:1:{s:8:”swimteam”;b:1;}
 * When they access swim team from main menu and use
 * [http://********/wp-admin/admin.php?page=swimteam.php](http://********/wp-admin/admin.php?page=swimteam.php)
 * I get
 * You do not have sufficient permissions to access this page.
 * Is there something your are checking in ADMIN to allow subscribers into Swimteam?
   I am trying to hide TABs in the user menu if they are nt in the new role.
 * Can you assist?
 * [http://wordpress.org/plugins/wp-swimteam/](http://wordpress.org/plugins/wp-swimteam/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/issue-with-adminphp/#post-4126353)
 * 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](https://wordpress.org/support/users/gdisalvo/)
 * (@gdisalvo)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/issue-with-adminphp/#post-4126358)
 * 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](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/issue-with-adminphp/#post-4126359)
 * 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](https://wordpress.org/support/users/gdisalvo/)
 * (@gdisalvo)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/issue-with-adminphp/#post-4126360)
 * 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](https://wordpress.org/support/users/gdisalvo/)
 * (@gdisalvo)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/issue-with-adminphp/#post-4126393)
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-swimteam.svg)
 * [Swim Team](https://wordpress.org/plugins/wp-swimteam/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-swimteam/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-swimteam/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-swimteam/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-swimteam/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-swimteam/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [gdisalvo](https://wordpress.org/support/users/gdisalvo/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/issue-with-adminphp/#post-4126393)
 * Status: resolved