/** * Register feature * * @return void * * @access protected */ protected function registerFeature() { //add feature $capability = aam_Core_ConfigPress::getParam('aam.feature.my_feature.capability', 'administrator'); if (current_user_can($capability)) { add_action('admin_print_scripts', array($this, 'printScripts')); add_action('admin_print_styles', array($this, 'printStyles')); aam_View_Collection::registerFeature((object) array('uid' => 'my_feature', 'position' => 100, 'title' => __('My Feature', 'aam'), 'subjects' => array(aam_Control_Subject_Role::UID, aam_Control_Subject_User::UID, aam_Control_Subject_Visitor::UID), 'controller' => $this)); } }
/** * Register new UI feature * * @return void * * @access protected */ protected function registerFeature() { $capability = aam_Core_ConfigPress::getParam('aam.feature.activity_log.capability', 'administrator'); if (current_user_can($capability)) { add_action('admin_print_scripts', array($this, 'printScripts')); add_action('admin_print_styles', array($this, 'printStyles')); add_filter('aam_ajax_call', array($this, 'ajax'), 10, 2); add_action('aam_localization_labels', array($this, 'localizationLabels')); aam_View_Collection::registerFeature((object) array('uid' => 'activity_log', 'position' => 35, 'title' => __('Activity Log', 'aam'), 'subjects' => array(aam_Control_Subject_Role::UID, aam_Control_Subject_User::UID), 'controller' => $this)); } }
/** * Prepare default list of features * * Check if current user has proper capability to use the feature * * @return array * * @access protected */ protected function registerDefaultFeatures() { $features = array(); //Main Menu Tab aam_View_Collection::registerFeature((object) array('uid' => self::FEATURE_ADMIN_MENU, 'position' => 5, 'title' => __('Admin Menu', 'aam'), 'subjects' => array(aam_Control_Subject_Role::UID, aam_Control_Subject_User::UID), 'controller' => 'aam_View_Menu')); //Metaboxes & Widgets Tab aam_View_Collection::registerFeature((object) array('uid' => self::FEATURE_METABOX, 'position' => 10, 'title' => __('Metabox & Widget', 'aam'), 'subjects' => array(aam_Control_Subject_Role::UID, aam_Control_Subject_User::UID, aam_Control_Subject_Visitor::UID), 'controller' => 'aam_View_Metabox')); //Capability Tab aam_View_Collection::registerFeature((object) array('uid' => self::FEATURE_CAPABILITY, 'position' => 15, 'title' => __('Capability', 'aam'), 'subjects' => array(aam_Control_Subject_Role::UID, aam_Control_Subject_User::UID), 'controller' => 'aam_View_Capability')); //Posts & Pages Tab aam_View_Collection::registerFeature((object) array('uid' => self::FEATURE_POST_ACCESS, 'position' => 20, 'title' => __('Posts & Pages', 'aam'), 'subjects' => array(aam_Control_Subject_Role::UID, aam_Control_Subject_User::UID, aam_Control_Subject_Visitor::UID), 'controller' => 'aam_View_Post')); //Event Manager Tab aam_View_Collection::registerFeature((object) array('uid' => self::FEATURE_EVENT_MANAGER, 'position' => 25, 'title' => __('Event Manager', 'aam'), 'subjects' => array(aam_Control_Subject_Role::UID, aam_Control_Subject_User::UID), 'controller' => 'aam_View_Event')); return $features; }
/** * Register feature * * The Feature Example Extension has UI interface. That is why it is very * important to make sure that it is backend (there is no need to load this * Extension if user is browsing frontend). * * From release 2.5, each Extension has its own capability assigned to it. By * default all Extensions have capability "Administrator" but this can be changed * with ConfigPress setting aam.feature.[you feature ID].capability. * For more information about this part of functionality chech official AAM * tutorial "AAM Super Admin" http://wpaam.com/tutorials/aam-super-admin/ * * @return void * * @access protected */ protected function registerFeature() { //add feature $capability = aam_Core_ConfigPress::getParam('aam.feature.' . self::FEATURE_ID . '.capability', 'administrator'); //makre sure that current user has access to current Extension. This is //mandatory check and should be obeyed by all developers if (current_user_can($capability)) { //register the Extension's javascript add_action('admin_print_scripts', array($this, 'printScripts')); //register the Extension's stylesheet add_action('admin_print_styles', array($this, 'printStyles')); //register the Feature aam_View_Collection::registerFeature((object) array('uid' => self::FEATURE_ID, 'position' => 150, 'title' => __('Feature Example', 'aam'), 'subjects' => array(aam_Control_Subject_Role::UID, aam_Control_Subject_User::UID, aam_Control_Subject_Visitor::UID), 'controller' => $this)); } }