[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/admin/ -> bp-core-admin-actions.php (source)

   1  <?php
   2  /**
   3   * BuddyPress Admin Actions.
   4   *
   5   * This file contains the actions that are used through-out BuddyPress Admin. They
   6   * are consolidated here to make searching for them easier, and to help developers
   7   * understand at a glance the order in which things occur.
   8   *
   9   * There are a few common places that additional actions can currently be found.
  10   *
  11   *  - BuddyPress: In {@link BuddyPress::setup_actions()} in BuddyPress.php
  12   *  - Admin: More in {@link bp_Admin::setup_actions()} in admin.php
  13   *
  14   * @package BuddyPress
  15   * @subpackage Admin
  16   * @since 2.3.0
  17   * @see bp-core-actions.php
  18   * @see bp-core-filters.php
  19   */
  20  
  21  // Exit if accessed directly.
  22  defined( 'ABSPATH' ) || exit;
  23  
  24  /**
  25   * Attach BuddyPress to WordPress.
  26   *
  27   * BuddyPress uses its own internal actions to help aid in third-party plugin
  28   * development, and to limit the amount of potential future code changes when
  29   * updates to WordPress core occur.
  30   *
  31   * These actions exist to create the concept of 'plugin dependencies'. They
  32   * provide a safe way for plugins to execute code *only* when BuddyPress is
  33   * installed and activated, without needing to do complicated guesswork.
  34   *
  35   * For more information on how this works, see the 'Plugin Dependency' section
  36   * near the bottom of this file.
  37   *
  38   *          v--WordPress Actions       v--BuddyPress Sub-actions
  39   */
  40  add_action( 'admin_menu',                         'bp_admin_menu'                    );
  41  add_action( 'admin_init',                         'bp_admin_init'                    );
  42  add_action( 'admin_head',                         'bp_admin_head'                    );
  43  add_action( 'admin_notices',                      'bp_admin_notices'                 );
  44  add_action( 'admin_enqueue_scripts',              'bp_admin_enqueue_scripts'         );
  45  add_action( 'customize_controls_enqueue_scripts', 'bp_admin_enqueue_scripts', 8      );
  46  add_action( 'network_admin_menu',                 'bp_admin_menu'                    );
  47  add_action( 'custom_menu_order',                  'bp_admin_custom_menu_order'       );
  48  add_action( 'menu_order',                         'bp_admin_menu_order'              );
  49  add_action( 'wpmu_new_blog',                      'bp_new_site',               10, 6 );
  50  
  51  // Hook on to admin_init.
  52  add_action( 'bp_admin_init', 'bp_setup_updater',          1000 );
  53  add_action( 'bp_admin_init', 'bp_core_activation_notice', 1010 );
  54  add_action( 'bp_admin_init', 'bp_register_importers'           );
  55  add_action( 'bp_admin_init', 'bp_register_admin_style'         );
  56  add_action( 'bp_admin_init', 'bp_register_admin_settings'      );
  57  add_action( 'bp_admin_init', 'bp_do_activation_redirect', 1    );
  58  
  59  // Add a new separator.
  60  add_action( 'bp_admin_menu', 'bp_admin_separator' );
  61  
  62  /**
  63   * When a new site is created in a multisite installation, run the activation
  64   * routine on that site.
  65   *
  66   * @since 1.7.0
  67   *
  68   * @param int    $blog_id ID of the blog being installed to.
  69   * @param int    $user_id ID of the user the install is for.
  70   * @param string $domain  Domain to use with the install.
  71   * @param string $path    Path to use with the install.
  72   * @param int    $site_id ID of the site being installed to.
  73   * @param array  $meta    Metadata to use with the site creation.
  74   */
  75  function bp_new_site( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
  76  
  77      // Bail if plugin is not network activated.
  78      if ( ! is_plugin_active_for_network( buddypress()->basename ) )
  79          return;
  80  
  81      // Switch to the new blog.
  82      switch_to_blog( $blog_id );
  83  
  84      /**
  85       * Fires the activation routine for a new site created in a multisite installation.
  86       *
  87       * @since 1.7.0
  88       *
  89       * @param int    $blog_id ID of the blog being installed to.
  90       * @param int    $user_id ID of the user the install is for.
  91       * @param string $domain  Domain to use with the install.
  92       * @param string $path    Path to use with the install.
  93       * @param int    $site_id ID of the site being installed to.
  94       * @param array  $meta    Metadata to use with the site creation.
  95       */
  96      do_action( 'bp_new_site', $blog_id, $user_id, $domain, $path, $site_id, $meta );
  97  
  98      // Restore original blog.
  99      restore_current_blog();
 100  }
 101  
 102  /** Sub-Actions ***************************************************************/
 103  
 104  /**
 105   * Piggy back admin_init action.
 106   *
 107   * @since 1.7.0
 108   *
 109   */
 110  function bp_admin_init() {
 111  
 112      /**
 113       * Fires inside the bp_admin_init function.
 114       *
 115       * @since 1.6.0
 116       */
 117      do_action( 'bp_admin_init' );
 118  }
 119  
 120  /**
 121   * Piggy back admin_menu action.
 122   *
 123   * @since 1.7.0
 124   *
 125   */
 126  function bp_admin_menu() {
 127  
 128      /**
 129       * Fires inside the bp_admin_menu function.
 130       *
 131       * @since 1.7.0
 132       */
 133      do_action( 'bp_admin_menu' );
 134  }
 135  
 136  /**
 137   * Piggy back admin_head action.
 138   *
 139   * @since 1.7.0
 140   *
 141   */
 142  function bp_admin_head() {
 143  
 144      /**
 145       * Fires inside the bp_admin_head function.
 146       *
 147       * @since 1.6.0
 148       */
 149      do_action( 'bp_admin_head' );
 150  }
 151  
 152  /**
 153   * Piggy back admin_notices action.
 154   *
 155   * @since 1.7.0
 156   *
 157   */
 158  function bp_admin_notices() {
 159  
 160      /**
 161       * Fires inside the bp_admin_notices function.
 162       *
 163       * @since 1.5.0
 164       */
 165      do_action( 'bp_admin_notices' );
 166  }
 167  
 168  /**
 169   * Piggy back admin_enqueue_scripts action.
 170   *
 171   * @since 1.7.0
 172   *
 173   * @param string $hook_suffix The current admin page, passed to
 174   *                            'admin_enqueue_scripts'.
 175   */
 176  function bp_admin_enqueue_scripts( $hook_suffix = '' ) {
 177  
 178      /**
 179       * Fires inside the bp_admin_enqueue_scripts function.
 180       *
 181       * @since 1.7.0
 182       *
 183       * @param string $hook_suffix The current admin page, passed to admin_enqueue_scripts.
 184       */
 185      do_action( 'bp_admin_enqueue_scripts', $hook_suffix );
 186  }
 187  
 188  /**
 189   * Dedicated action to register BuddyPress importers.
 190   *
 191   * @since 1.7.0
 192   *
 193   */
 194  function bp_register_importers() {
 195  
 196      /**
 197       * Fires inside the bp_register_importers function.
 198       *
 199       * Used to register a BuddyPress importer.
 200       *
 201       * @since 1.7.0
 202       */
 203      do_action( 'bp_register_importers' );
 204  }
 205  
 206  /**
 207   * Dedicated action to register admin styles.
 208   *
 209   * @since 1.7.0
 210   *
 211   */
 212  function bp_register_admin_style() {
 213  
 214      /**
 215       * Fires inside the bp_register_admin_style function.
 216       *
 217       * @since 1.7.0
 218       */
 219      do_action( 'bp_register_admin_style' );
 220  }
 221  
 222  /**
 223   * Dedicated action to register admin settings.
 224   *
 225   * @since 1.7.0
 226   *
 227   */
 228  function bp_register_admin_settings() {
 229  
 230      /**
 231       * Fires inside the bp_register_admin_settings function.
 232       *
 233       * @since 1.6.0
 234       */
 235      do_action( 'bp_register_admin_settings' );
 236  }


Generated: Tue Sep 17 01:01:39 2019 Cross-referenced by PHPXref 0.7.1