Title: AGCA capability
Last modified: January 15, 2019

---

# AGCA capability

 *  [patbell101](https://wordpress.org/support/users/patbell101/)
 * (@patbell101)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/agca-capability/)
 * I don’t understand how to add the AGCA capability to one user who I wish to set
   as the AGCA admin as opposed to other admins. I can see the option to “exclude
   agca admin from customisations” and how to set what that capability is but afaics
   the facility to single out one admin user as the agca admin requires more functionality.
 * So I installed User Role Editor and using edit capabilities for an individual
   user wouldn’t allow me to remove one. So I created a new role an checked all 
   capabilities except edit-dashboard (accepting the default suggested by AGCA) 
   but that now only shows Dashboard. Perhaps User Role editor clashes with AGCA?
   
   I think this is a problem with URE. Is there another way to do this?
 * Either I am missing something or you have given us a functionality without properly
   implementing it.

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

 *  Plugin Author [cusmin](https://wordpress.org/support/users/cusmin/)
 * (@cusmin)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/agca-capability/#post-11093153)
 * Hi! Thanks for your message. Basically, the capability feature in AGCA is used
   only for deciding whether the customizations will be applied to a particular 
   user or not.
 * Here is a piece of code that you may use to restrict access to AGCA for all of
   your users, except for yourself. Please change the username of your admin, it’s
   set “admin” as a default.
 *     ```
       function agca_access_only_admin(){
       	if(is_admin()){
       		$screen = get_current_screen();
       		if($screen->id === 'tools_page_ag-custom-admin/plugin'){
       			$user = wp_get_current_user();
   
       			//Update this ////////////////////
       			$accessAllowedOnlyTo = 'admin';
       			//////////////////////////////////
   
       			if($user->data->user_login != $accessAllowedOnlyTo){
       				wp_die( 'You are not authorized to see this page.' );
       			}
       		}
       	}
       }
       add_action('current_screen', 'agca_access_only_admin');
       ```
   
 * You can add this code to your theme’s functions.php
    -  This reply was modified 7 years, 4 months ago by [cusmin](https://wordpress.org/support/users/cusmin/).
 *  Thread Starter [patbell101](https://wordpress.org/support/users/patbell101/)
 * (@patbell101)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/agca-capability/#post-11099884)
 * Sorry but this doesn’t work. I am creating a new code snippet with this and the
   function line has an error “this.read_variable(…) is undefined”
 * Can you check the code please?
 *  Plugin Author [cusmin](https://wordpress.org/support/users/cusmin/)
 * (@cusmin)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/agca-capability/#post-11101875)
 * Can you please provide the code that you’re trying to use? Thanks.
 *  Thread Starter [patbell101](https://wordpress.org/support/users/patbell101/)
 * (@patbell101)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/agca-capability/#post-11101920)
 * Your code.
 *     ```
       function agca_access_only_admin(){
       	if(is_admin()){
       		$screen = get_current_screen();
       		if($screen->id === 'tools_page_ag-custom-admin/plugin'){
       			$user = wp_get_current_user();
   
       			//Update this ////////////////////
       			$accessAllowedOnlyTo = 'admin';
       			//////////////////////////////////
   
       			if($user->data->user_login != $accessAllowedOnlyTo){
       				wp_die( 'You are not authorized to see this page.' );
       			}
       		}
       	}
       }
       add_action('current_screen', 'agca_access_only_admin');
       ```
   
 *  Plugin Author [cusmin](https://wordpress.org/support/users/cusmin/)
 * (@cusmin)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/agca-capability/#post-11159041)
 * I’m sorry but the error does not seem to be linked to this code. Could you provide
   more information, screenshots or stack trace? Thanks

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

The topic ‘AGCA capability’ is closed to new replies.

 * ![](https://ps.w.org/ag-custom-admin/assets/icon.svg?rev=2928712)
 * [AGCA - Custom Dashboard & Login Page](https://wordpress.org/plugins/ag-custom-admin/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ag-custom-admin/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ag-custom-admin/)
 * [Active Topics](https://wordpress.org/support/plugin/ag-custom-admin/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ag-custom-admin/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ag-custom-admin/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [cusmin](https://wordpress.org/support/users/cusmin/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/agca-capability/#post-11159041)
 * Status: not resolved