function __construct() { global $bp; // Ensure that we have access to some utility functions. Must use require_once() // because BP Core is loaded during incremental upgrades require_once BP_PLUGIN_DIR . '/bp-core/bp-core-functions.php'; // Get current DB version $this->database_version = !empty($bp->database_version) ? (int) $bp->database_version : 0; if (!empty($bp->is_network_activate)) { $this->is_network_activate = $bp->is_network_activate; } elseif (!$this->current_step()) { setcookie('bp-wizard-step', 0, time() + 60 * 60 * 24, COOKIEPATH); $_COOKIE['bp-wizard-step'] = 0; } $this->new_version = constant('BP_DB_VERSION'); $this->setup_type = !empty($bp->maintenance_mode) ? $bp->maintenance_mode : ''; $this->current_step = $this->current_step(); // Remove the admin menu while we update/install remove_action(bp_core_admin_hook(), 'bp_core_add_admin_menu', 9); // Call the save method that will save data and modify $current_step if (isset($_POST['save'])) { $this->save($_POST['save']); } // Build the steps needed for update or new installations $this->steps = $this->add_steps(); }
function etivite_bp_activity_block_init() { if (file_exists(dirname(__FILE__) . '/languages/' . get_locale() . '.mo')) { load_textdomain('bp-activity-block', dirname(__FILE__) . '/languages/' . get_locale() . '.mo'); } require dirname(__FILE__) . '/bp-activity-block.php'; add_action(bp_core_admin_hook(), 'etivite_bp_activity_block_admin_add_admin_menu'); }
/** * Set the actions & filters * * @package Rendez Vous * @subpackage Admin * * @since Rendez Vous (1.2.0) */ private function setup_hooks() { // update plugin's db version add_action('bp_admin_init', array($this, 'maybe_update')); // javascript add_action('bp_admin_enqueue_scripts', array($this, 'enqueue_script')); // Page add_action(bp_core_admin_hook(), array($this, 'admin_menu')); add_action('admin_head', array($this, 'admin_head'), 999); add_action('bp_admin_tabs', array($this, 'admin_tab')); }
/** * Setup the admin hooks, actions and filters * * @package BP Reshare * @subpackage Admin * @since version 1.0 * * @uses bp_core_admin_hook() to hook the right menu (network or not) * @uses buddyreshare() to get plugin's main instance */ private function setup_actions() { $buddyreshare = buddyreshare(); // Current blog is not the one where BuddyPress is activated so let's warn the administrator if (!$buddyreshare::buddypress_site_check()) { add_action('admin_notices', array($this, 'warning_notice')); } else { add_action($this->notice_hook, array($this, 'activation_notice')); add_action(bp_core_admin_hook(), array($this, 'admin_menus')); add_action('bp_register_admin_settings', array($this, 'register_settings')); } }
/** * BPSP_NXTClass() * * Constructor, loads all the required hooks */ function BPSP_NXTClass() { // Add our screen to BuddyPress menu add_action(bp_core_admin_hook(), array(__CLASS__, 'menus')); // Ensure compatibility add_action('admin_notices', 'bpsp_check'); // Help Screen add_action('admin_head', array(__CLASS__, 'screen_help')); // Support link add_filter('plugin_row_meta', array(__CLASS__, 'support_link'), 10, 2); // Settings link add_action('plugin_action_links_' . BPSP_PLUGIN_FILE, array(__CLASS__, 'action_link'), 10, 4); // Initialize our options add_option('bpsp_allow_only_admins'); add_option('bpsp_global_status'); add_option('bpsp_gradebook_format'); add_option('bpsp_private_responses'); add_option('bpsp_worldcat_key'); add_option('bpsp_isbndb_key'); add_option('bpsp_load_css'); }
/** * Set up the admin hooks, actions, and filters. * * @access private * @since BuddyPress (1.6.0) * * @uses add_action() To add various actions. * @uses add_filter() To add various filters. */ private function setup_actions() { /** General Actions ***************************************************/ // Add some page specific output to the <head> add_action('bp_admin_head', array($this, 'admin_head'), 999); // Add menu item to settings menu add_action(bp_core_admin_hook(), array($this, 'admin_menus'), 5); // Enqueue all admin JS and CSS add_action('bp_admin_enqueue_scripts', array($this, 'enqueue_scripts')); /** BuddyPress Actions ************************************************/ // Load the BuddyPress metabox in the WP Nav Menu Admin UI add_action('load-nav-menus.php', 'bp_admin_wp_nav_menu_meta_box'); // Add settings add_action('bp_register_admin_settings', array($this, 'register_admin_settings')); // Add a link to BuddyPress About page to the admin bar add_action('admin_bar_menu', array($this, 'admin_bar_about_link'), 15); // Add a description of new BuddyPress tools in the available tools page add_action('tool_box', 'bp_core_admin_available_tools_intro'); add_action('bp_network_tool_box', 'bp_core_admin_available_tools_intro'); // On non-multisite, catch add_action('load-users.php', 'bp_core_admin_user_manage_spammers'); /** Filters ***********************************************************/ // Add link to settings page add_filter('plugin_action_links', array($this, 'modify_plugin_action_links'), 10, 2); add_filter('network_admin_plugin_action_links', array($this, 'modify_plugin_action_links'), 10, 2); // Add "Mark as Spam" row actions on users.php add_filter('ms_user_row_actions', 'bp_core_admin_user_row_actions', 10, 2); add_filter('user_row_actions', 'bp_core_admin_user_row_actions', 10, 2); }
* bp_example_add_admin_menu() * * This function will add a WordPress wp-admin admin menu for your component under the * "BuddyPress" menu. */ function bp_example_add_admin_menu() { global $bp; if (!is_super_admin()) { return false; } add_submenu_page('bp-general-settings', __('Example Admin', 'bp-example'), __('Example Admin', 'bp-example'), 'manage_options', 'bp-example-settings', 'bp_example_admin'); } // The bp_core_admin_hook() function returns the correct hook (admin_menu or network_admin_menu), // depending on how WordPress and BuddyPress are configured add_action(bp_core_admin_hook(), 'bp_example_add_admin_menu'); /** * bp_example_admin() * * Checks for form submission, saves component settings and outputs admin screen HTML. */ function bp_example_admin() { global $bp; /* If the form has been submitted and the admin referrer checks out, save the settings */ if (isset($_POST['submit']) && check_admin_referer('example-settings')) { update_option('example-setting-one', $_POST['example-setting-one']); update_option('example-setting-two', $_POST['example-setting-two']); $updated = true; } $setting_one = get_option('example-setting-one');
function bpdd_init() { add_action(bp_core_admin_hook(), 'bpdd_admin_page', 99); }
exit; } function xprofile_add_admin_css() { if (!empty($_GET['page']) && strpos($_GET['page'], 'bp-profile-setup') !== false) { if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { wp_enqueue_style('xprofile-admin-css', BP_PLUGIN_URL . '/bp-xprofile/admin/css/admin.dev.css', array(), '20110723'); } else { wp_enqueue_style('xprofile-admin-css', BP_PLUGIN_URL . '/bp-xprofile/admin/css/admin.css', array(), '20110723'); } } } add_action(bp_core_admin_hook(), 'xprofile_add_admin_css'); function xprofile_add_admin_js() { if (!empty($_GET['page']) && strpos($_GET['page'], 'bp-profile-setup') !== false) { wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-tabs'); wp_enqueue_script('jquery-ui-mouse'); wp_enqueue_script('jquery-ui-draggable'); wp_enqueue_script('jquery-ui-droppable'); wp_enqueue_script('jquery-ui-sortable'); if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { wp_enqueue_script('xprofile-admin-js', BP_PLUGIN_URL . '/bp-xprofile/admin/js/admin.dev.js', array('jquery', 'jquery-ui-sortable'), '20110723'); } else { wp_enqueue_script('xprofile-admin-js', BP_PLUGIN_URL . '/bp-xprofile/admin/js/admin.js', array('jquery', 'jquery-ui-sortable'), '20110723'); } } } add_action(bp_core_admin_hook(), 'xprofile_add_admin_js', 1);
* @uses bp_xprofile_install() runs the installation of DB tables for the xprofile component * @uses nxt_enqueue_script() Adds a JS file to the JS queue ready for output * @uses add_submenu_page() Adds a submenu tab to a top level tab in the admin area * @uses xprofile_install() Runs the DB table installation function * @return */ function xprofile_add_admin_menu() { global $nxtdb, $bp; if (!is_super_admin()) { return false; } $hook = add_submenu_page('bp-general-settings', __('Profile Fields', 'buddypress'), __('Profile Fields', 'buddypress'), 'manage_options', 'bp-profile-setup', 'xprofile_admin'); add_action("admin_print_styles-{$hook}", 'bp_core_add_admin_menu_styles'); } add_action(bp_core_admin_hook(), 'xprofile_add_admin_menu'); /** * Handles all actions for the admin area for creating, editing and deleting * profile groups and fields. */ function xprofile_admin($message = '', $type = 'error') { global $bp; $type = preg_replace('|[^a-z]|i', '', $type); $groups = BP_XProfile_Group::get(array('fetch_fields' => true)); if (isset($_GET['mode']) && isset($_GET['group_id']) && 'add_field' == $_GET['mode']) { xprofile_admin_manage_field($_GET['group_id']); } else { if (isset($_GET['mode']) && isset($_GET['group_id']) && isset($_GET['field_id']) && 'edit_field' == $_GET['mode']) { xprofile_admin_manage_field($_GET['group_id'], $_GET['field_id']); } else {
/** * Setup the admin hooks, actions and filters * * @since BuddyPress (1.6) * @access private * * @uses add_action() To add various actions * @uses add_filter() To add various filters */ private function setup_actions() { /** General Actions ***************************************************/ // Add some page specific output to the <head> add_action('bp_admin_head', array($this, 'admin_head'), 999); // Add menu item to settings menu add_action(bp_core_admin_hook(), array($this, 'admin_menus'), 5); // Enqueue all admin JS and CSS add_action('bp_admin_enqueue_scripts', array($this, 'enqueue_scripts')); /** BuddyPress Actions ************************************************/ // Add settings add_action('bp_register_admin_settings', array($this, 'register_admin_settings')); /** Filters ***********************************************************/ // Add link to settings page add_filter('plugin_action_links', array($this, 'modify_plugin_action_links'), 10, 2); add_filter('network_admin_plugin_action_links', array($this, 'modify_plugin_action_links'), 10, 2); }
include WP_PLUGIN_DIR . '/bebop/core/templates/admin/bebop-content.php'; } else { if ($_GET['page'] == 'bebop_error_log') { include WP_PLUGIN_DIR . '/bebop/core/templates/admin/bebop-error-log.php'; } else { if ($_GET['page'] == 'bebop_general_log') { include WP_PLUGIN_DIR . '/bebop/core/templates/admin/bebop-general-log.php'; } } } } } } } add_action(bp_core_admin_hook(), 'bebop_admin_menu'); function bebop_admin_stylesheets() { wp_register_style('bebop-admin-styles', plugins_url() . '/bebop/core/resources/css/admin.css'); wp_enqueue_style('bebop-admin-styles'); } add_action(bp_core_admin_hook(), 'bebop_admin_stylesheets'); //wp_adminbar function bebop_admin_bar_resources() { global $wp_admin_bar; global $bp; $wp_admin_bar->add_node(array('id' => 'my-account-buddypress-bebop', 'title' => __('Resources', 'bebop'), 'href' => bp_displayed_user_domain() . 'bebop/', 'parent' => 'my-account-buddypress')); $wp_admin_bar->add_node(array('id' => 'my-account-buddypress-bebop-content', 'title' => __('Content', 'bebop'), 'href' => bp_displayed_user_domain() . 'bebop/bebop-content', 'parent' => 'my-account-buddypress-bebop')); $wp_admin_bar->add_node(array('id' => 'my-account-buddypress-bebop-content-manager', 'title' => __('Content Manager', 'bebop'), 'href' => bp_displayed_user_domain() . 'bebop/bebop-manager', 'parent' => 'my-account-buddypress-bebop')); $wp_admin_bar->add_node(array('id' => 'my-account-buddypress-bebop-accounts', 'title' => __('Accounts', 'bebop'), 'href' => bp_displayed_user_domain() . 'bebop/bebop-accounts', 'parent' => 'my-account-buddypress-bebop')); }
/** * Initializes the wp-admin area "BuddyPress" menus and sub menus. * * @uses bp_current_user_can() returns true if the current user is a site admin, false if not. */ function bp_core_admin_menu_init() { add_action(bp_core_admin_hook(), 'bp_core_add_admin_menu', 9); }
* @return boolean * @version 3, 4/6/2013, stergatu, fix the admin menu link for single wp installation * @since 0.5 * @todo write the bp_group_documents_add_admin_style (minor) */ function bp_group_documents_group_add_admin_menu() { global $wpdb; $bp = buddypress(); /* Add the administration tab under the "Site Admin" tab for site administrators */ $page = add_submenu_page(bp_group_documents_find_admin_location(), 'Buddypress Group Documents ' . __('Settings'), '<span class="bp-group-documents-admin-menu-header">' . __('Buddypress Group Documents', 'bp-group-documents') . '</span>', 'manage_options', 'bp-group-documents-settings', 'bp_group_documents_admin'); // add styles only on bp-group-documents admin page, see: // http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Load_scripts_only_on_plugin_pages //add_action( 'admin_print_styles-'.$page, 'bp_group_documents_add_admin_style' ); } add_action(bp_core_admin_hook(), 'bp_group_documents_group_add_admin_menu', 10); /** * Add settings link on plugin page * @param type $links * @param type $file * @return array * @since version 0.6 * @version 3, 21/4/2015 esc_url * v2, 3/9/2013, fix the BP_GROUP_DOCUMENTS_DIR * version 1, 4/6/2013 stergtu * */ function bp_group_documents_settings_link($links, $file) { $this_plugin = BP_GROUP_DOCUMENTS_DIR . '/loader.php'; if ($file == $this_plugin) {
/** * Set admin-related actions and filters. * * @access private * @since BuddyPress (2.0.0) */ private function setup_actions() { /** Extended Profile *****************************************/ // Add some page specific output to the <head> add_action('bp_admin_head', array($this, 'admin_head'), 999); // Add menu item to all users menu add_action(bp_core_admin_hook(), array($this, 'admin_menus'), 5); // Enqueue all admin JS and CSS add_action('bp_admin_enqueue_scripts', array($this, 'enqueue_scripts')); // Create the Profile Navigation (Profile/Extended Profile) add_action('edit_user_profile', array($this, 'profile_nav'), 99, 1); // Add a row action to users listing add_filter(bp_core_do_network_admin() ? 'ms_user_row_actions' : 'user_row_actions', array($this, 'row_actions'), 10, 2); /** Signups **************************************************************/ if (is_admin()) { if (!is_multisite()) { add_action('pre_user_query', array($this, 'remove_signups_from_user_query'), 10, 1); } // Reorganise the views navigation in users.php and signups page if (current_user_can($this->capability)) { add_filter("views_{$this->users_screen}", array($this, 'signup_filter_view'), 10, 1); add_filter('set-screen-option', array($this, 'signup_screen_options'), 10, 3); } } }
if (!defined('ABSPATH')) { exit; } function bp_forums_add_admin_menu() { global $bp; if (!is_super_admin()) { return false; } $page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php'; // Add the administration tab under the "Site Admin" tab for site administrators $hook = add_submenu_page($page, __('Forums', 'buddypress'), __('Forums', 'buddypress'), 'manage_options', 'bb-forums-setup', "bp_forums_bbpress_admin"); // Fudge the highlighted subnav item when on the BuddyPress Forums admin page add_action("admin_head-{$hook}", 'bp_core_modify_admin_menu_highlight'); } add_action(bp_core_admin_hook(), 'bp_forums_add_admin_menu'); /** * Outputs the markup for the bb-forums-admin panel */ function bp_forums_bbpress_admin() { global $bp; // The text and URL of the Site Wide Forums button differs depending on whether bbPress // is running if (is_plugin_active('bbpress/bbpress.php')) { // The bbPress admin page will always be on the root blog. switch_to_blog() will // pass through if we're already there. switch_to_blog(bp_get_root_blog_id()); $button_url = admin_url(add_query_arg(array('page' => 'bbpress'), 'options-general.php')); restore_current_blog(); $button_text = __('Configure Site Wide Forums', 'buddypress');
/** * Initializes the nxt-admin area "BuddyPress" menus and sub menus. * * @package BuddyPress Core * @uses is_super_admin() returns true if the current user is a site admin, false if not */ function bp_core_admin_menu_init() { if (!is_super_admin()) { return false; } add_action(bp_core_admin_hook(), 'bp_core_add_admin_menu', 9); require BP_PLUGIN_DIR . '/bp-core/admin/bp-core-admin.php'; }
/** * Set up the admin hooks, actions, and filters. * * @since 1.6.0 * */ private function setup_actions() { /* General Actions ***************************************************/ // Add some page specific output to the <head>. add_action('bp_admin_head', array($this, 'admin_head'), 999); // Add menu item to settings menu. add_action('admin_menu', array($this, 'site_admin_menus'), 5); add_action(bp_core_admin_hook(), array($this, 'admin_menus'), 5); // Enqueue all admin JS and CSS. add_action('bp_admin_enqueue_scripts', array($this, 'admin_register_styles'), 1); add_action('bp_admin_enqueue_scripts', array($this, 'admin_register_scripts'), 1); add_action('bp_admin_enqueue_scripts', array($this, 'enqueue_scripts')); /* BuddyPress Actions ************************************************/ // Load the BuddyPress metabox in the WP Nav Menu Admin UI. add_action('load-nav-menus.php', 'bp_admin_wp_nav_menu_meta_box'); // Add settings. add_action('bp_register_admin_settings', array($this, 'register_admin_settings')); // Add a link to BuddyPress About page to the admin bar. add_action('admin_bar_menu', array($this, 'admin_bar_about_link'), 15); // Add a description of new BuddyPress tools in the available tools page. add_action('tool_box', 'bp_core_admin_available_tools_intro'); add_action('bp_network_tool_box', 'bp_core_admin_available_tools_intro'); // On non-multisite, catch. add_action('load-users.php', 'bp_core_admin_user_manage_spammers'); // Emails. add_filter('manage_' . bp_get_email_post_type() . '_posts_columns', array($this, 'emails_register_situation_column')); add_action('manage_' . bp_get_email_post_type() . '_posts_custom_column', array($this, 'emails_display_situation_column_data'), 10, 2); /* Filters ***********************************************************/ // Add link to settings page. add_filter('plugin_action_links', array($this, 'modify_plugin_action_links'), 10, 2); add_filter('network_admin_plugin_action_links', array($this, 'modify_plugin_action_links'), 10, 2); // Add "Mark as Spam" row actions on users.php. add_filter('ms_user_row_actions', 'bp_core_admin_user_row_actions', 10, 2); add_filter('user_row_actions', 'bp_core_admin_user_row_actions', 10, 2); // Emails add_filter('bp_admin_menu_order', array($this, 'emails_admin_menu_order'), 20); }
<?php function invite_anyone_admin_add() { $parent = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php'; $plugin_page = add_submenu_page($parent, __('Invite Anyone', 'invite-anyone'), __('Invite Anyone', 'invite-anyone'), 'manage_options', 'invite-anyone', 'invite_anyone_admin_panel'); add_action("admin_print_scripts-{$plugin_page}", 'invite_anyone_admin_scripts'); add_action("admin_print_styles-{$plugin_page}", 'invite_anyone_admin_styles'); } add_action(bp_core_admin_hook(), 'invite_anyone_admin_add', 80); /* Stolen from Welcome Pack - thanks, Paul! */ function invite_anyone_admin_add_action_link($links, $file) { if ('invite-anyone/invite-anyone.php' != $file) { return $links; } if (function_exists('bp_core_do_network_admin')) { $settings_url = add_query_arg('page', 'invite-anyone', bp_core_do_network_admin() ? network_admin_url('admin.php') : admin_url('admin.php')); } else { $settings_url = add_query_arg('page', 'invite-anyone', is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php')); } $settings_link = '<a href="' . $settings_url . '">' . __('Settings', 'invite-anyone') . '</a>'; array_unshift($links, $settings_link); return $links; } add_filter('plugin_action_links', 'invite_anyone_admin_add_action_link', 10, 2); function invite_anyone_admin_scripts() { wp_enqueue_script('invite-anyone-admin-js', WP_PLUGIN_URL . '/invite-anyone/admin/admin-js.js'); } function invite_anyone_admin_styles()
<?php /** * Add the BP-Portfolio submenu under the BuddyPress menu */ function bp_portfolio_add_admin_menu() { global $bp; if (!is_super_admin()) { return false; } $hook = add_submenu_page('bp-general-settings', __('BP-Portfolio', 'bp-portfolio'), __('BP-Portfolio', 'bp-portfolio'), 'manage_options', 'bp-portfolio-settings', 'bp_portfolio_admin_screen'); add_action("admin_print_styles-{$hook}", 'bp_core_add_admin_menu_styles'); } add_action(bp_core_admin_hook(), 'bp_portfolio_add_admin_menu'); /* * Checks for form submission, saves component settings and outputs admin screen HTML. */ function bp_portfolio_admin_screen() { /* If the form has been submitted and the admin referrer checks out, save the settings */ if (isset($_POST['submit']) && check_admin_referer('portfolio-settings')) { update_option('bp_portfolio_template', $_POST['active-template']); update_option('bp_portfolio_desc_max_size', $_POST['description-max-size']); $updated = true; } $description_max_size = get_option('bp_portfolio_desc_max_size'); $active_template = get_option('bp_portfolio_template'); ?> <div class="wrap">
if ($error) { $redirect = add_query_arg(array('updated' => 'group-type-change-error'), wp_get_referer()); } else { $redirect = add_query_arg(array('updated' => 'group-type-change-success'), wp_get_referer()); } wp_redirect($redirect); exit; } add_action('bp_groups_admin_load', 'bp_groups_admin_process_group_type_bulk_changes'); /** * Display an admin notice upon group type bulk update. * * @since 2.7.0 */ function bp_groups_admin_groups_type_change_notice() { $updated = isset($_REQUEST['updated']) ? $_REQUEST['updated'] : false; // Display feedback. if ($updated && in_array($updated, array('group-type-change-error', 'group-type-change-success'), true)) { if ('group-type-change-error' === $updated) { $notice = __('There was an error while changing group type. Please try again.', 'buddypress'); $type = 'error'; } else { $notice = __('Group type was changed successfully.', 'buddypress'); $type = 'updated'; } bp_core_add_admin_notice($notice, $type); } } add_action(bp_core_admin_hook(), 'bp_groups_admin_groups_type_change_notice');
if (is_admin() && !empty($_REQUEST['page']) && 'bp-activity' == $_REQUEST['page']) { add_filter('set-screen-option', 'bp_activity_admin_screen_options', 10, 3); } /** * Register the Activity component admin screen. * * @since BuddyPress (1.6) */ function bp_activity_add_admin_menu() { // Add our screen $hook = add_menu_page(_x('Activity', 'Admin Dashbord SWA page title', 'buddypress'), _x('Activity', 'Admin Dashbord SWA menu', 'buddypress'), 'bp_moderate', 'bp-activity', 'bp_activity_admin', 'div'); // Hook into early actions to load custom CSS and our init handler. add_action("load-{$hook}", 'bp_activity_admin_load'); } add_action(bp_core_admin_hook(), 'bp_activity_add_admin_menu'); /** * Add activity component to custom menus array. * * Several BuddyPress components have top-level menu items in the Dashboard, * which all appear together in the middle of the Dashboard menu. This function * adds the Activity page to the array of these menu items. * * @since BuddyPress (1.7.0) * * @param array $custom_menus The list of top-level BP menu items. * * @return array $custom_menus List of top-level BP menu items, with Activity added. */ function bp_activity_admin_menu_order($custom_menus = array()) {
function setup_hooks() { add_action(bp_core_admin_hook(), array(&$this, 'admin_menu')); // Catch save submits add_action('admin_init', array(&$this, 'admin_submit')); }
/** * Initializes the wp-admin area "BuddyPress" menus and sub menus. * * @package BuddyPress Core * @uses bp_current_user_can() returns true if the current user is a site admin, false if not */ function bp_core_admin_menu_init() { if (!bp_current_user_can('bp_moderate')) { return false; } add_action(bp_core_admin_hook(), 'bp_core_add_admin_menu', 9); require BP_PLUGIN_DIR . '/bp-core/admin/bp-core-admin.php'; }
/** * Setup the admin hooks, actions and filters * * @since BuddyPress (1.6) * @access private * * @uses add_action() To add various actions * @uses add_filter() To add various filters */ private function setup_actions() { // Start the wizard if in maintenance mode if (bp_get_maintenance_mode()) { add_action(bp_core_admin_hook(), array($this, 'start_wizard'), 2); } /** General Actions ***************************************************/ // Attach the BuddyPress admin_init action to the WordPress admin_init action. add_action('admin_init', array($this, 'admin_init')); // Add some page specific output to the <head> add_action('admin_head', array($this, 'admin_head')); // Add menu item to settings menu add_action(bp_core_admin_hook(), array($this, 'admin_menus'), 5); // Add notice if not using a BuddyPress theme add_action('admin_notices', array($this, 'admin_notices')); add_action('network_admin_notices', array($this, 'admin_notices')); // Enqueue all admin JS and CSS add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); /** BuddyPress Actions ************************************************/ // Add settings add_action('bp_admin_init', array($this, 'register_admin_settings')); /** Filters ***********************************************************/ // Add link to settings page add_filter('plugin_action_links', array($this, 'add_settings_link'), 10, 2); }
// !WP BACKEND ADMIN SETTINGS // // Functions to add the backend admin menu to control changing default settings /** * Adds "Group Email Options" panel under "BuddyPress" in the admin/network admin * * The add_action() hook is conditional to account for variations between WP 3.0.x/3.1.x and * BP < 1.2.7/>1.2.8. * * @package BuddyPress Group Email Subscription */ function ass_admin_menu() { add_submenu_page('bp-general-settings', __("Group Email Options", 'bp-ass'), __("Group Email Options", 'bp-ass'), 'manage_options', 'ass_admin_options', "ass_admin_options"); } add_action(bp_core_admin_hook(), 'ass_admin_menu'); // function to create the back end admin form function ass_admin_options() { //print_r($_POST); die(); if (!empty($_POST)) { if (ass_update_dashboard_settings()) { ?> <div id="message" class="updated"> <p><?php _e('Settings saved.', 'bp-ass'); ?> </p> </div>
check_admin_referer('bp-do-counts'); // Stores messages $messages = array(); wp_cache_flush(); foreach ((array) bp_admin_repair_list() as $item) { if (isset($item[2]) && isset($_POST[$item[0]]) && 1 === absint($_POST[$item[0]]) && is_callable($item[2])) { $messages[] = call_user_func($item[2]); } } if (count($messages)) { foreach ($messages as $message) { bp_admin_tools_feedback($message[1]); } } } add_action(bp_core_admin_hook(), 'bp_admin_repair_handler'); /** * Get the array of the repair list. * * @return array */ function bp_admin_repair_list() { $repair_list = array(); // Members: // - member count // - last_activity migration (2.0) $repair_list[20] = array('bp-total-member-count', __('Count total members', 'buddypress'), 'bp_admin_repair_count_members'); $repair_list[25] = array('bp-last-activity', __('Repair user "last activity" data', 'buddypress'), 'bp_admin_repair_last_activity'); // Friends: // - user friend count
/** * Constructor. * * @since 3.0 */ public function __construct() { add_action(bp_core_admin_hook(), array('DP_Welcome_Pack_Admin', 'setup_menu')); }
if (is_admin() && !empty($_REQUEST['page']) && 'bp-groups' == $_REQUEST['page']) { add_filter('set-screen-option', 'bp_groups_admin_screen_options', 10, 3); } /** * Register the Groups component admin screen. * * @since 1.7.0 */ function bp_groups_add_admin_menu() { // Add our screen $hook = add_menu_page(_x('Groups', 'Admin Groups page title', 'buddypress'), _x('Groups', 'Admin Groups menu', 'buddypress'), 'bp_moderate', 'bp-groups', 'bp_groups_admin', 'div'); // Hook into early actions to load custom CSS and our init handler. add_action("load-{$hook}", 'bp_groups_admin_load'); } add_action(bp_core_admin_hook(), 'bp_groups_add_admin_menu'); /** * Add groups component to custom menus array. * * This ensures that the Groups menu item appears in the proper order on the * main Dashboard menu. * * @since 1.7.0 * * @param array $custom_menus Array of BP top-level menu items. * * @return array Menu item array, with Groups added. */ function bp_groups_admin_menu_order($custom_menus = array()) { array_push($custom_menus, 'bp-groups');
private function _add_hooks() { add_action(bp_core_admin_hook(), array($this, 'add_menu_page')); add_action('admin_enqueue_scripts', array($this, 'enqueue_dependencies')); }