Skip to:
Content

BuddyPress.org

Ticket #1901: plugins_reloaded.patch

File plugins_reloaded.patch, 9.4 KB (added by johnjamesjacoby, 15 years ago)

Centralize plugins_loaded actions into bp-loader.php

  • bp-activity.php

     
    8383
    8484        do_action( 'bp_activity_setup_globals' );
    8585}
    86 add_action( 'plugins_loaded', 'bp_activity_setup_globals', 5 );
     86add_action( 'bp_setup_globals', 'bp_activity_setup_globals' );
    8787add_action( 'admin_menu', 'bp_activity_setup_globals', 2 );
    8888
    8989function bp_activity_check_installed() {
     
    9898        /* Register 'activity' as a root component (for RSS feed use) */
    9999        bp_core_add_root_component( BP_ACTIVITY_SLUG );
    100100}
    101 add_action( 'plugins_loaded', 'bp_activity_setup_root_component', 2 );
     101add_action( 'bp_setup_root_component', 'bp_activity_setup_root_component' );
    102102
    103103function bp_activity_setup_nav() {
    104104        global $bp;
     
    133133
    134134        do_action( 'bp_activity_setup_nav' );
    135135}
    136 add_action( 'plugins_loaded', 'bp_activity_setup_nav' );
     136add_action( 'bp_setup_nav', 'bp_activity_setup_nav' );
    137137add_action( 'admin_menu', 'bp_activity_setup_nav' );
    138138
    139139function bp_activity_directory_activity_setup() {
  • bp-blogs.php

     
    100100
    101101        do_action( 'bp_blogs_setup_globals' );
    102102}
    103 add_action( 'plugins_loaded', 'bp_blogs_setup_globals', 5 );
     103add_action( 'bp_setup_globals', 'bp_blogs_setup_globals' );
    104104add_action( 'admin_menu', 'bp_blogs_setup_globals', 2 );
    105105
    106106function bp_blogs_setup_root_component() {
    107107        /* Register 'blogs' as a root component */
    108108        bp_core_add_root_component( BP_BLOGS_SLUG );
    109109}
    110 add_action( 'plugins_loaded', 'bp_blogs_setup_root_component', 2 );
     110add_action( 'bp_setup_root_component', 'bp_blogs_setup_root_component' );
    111111
    112112/**
    113113 * bp_blogs_setup_nav()
     
    151151
    152152        do_action( 'bp_blogs_setup_nav' );
    153153}
    154 add_action( 'plugins_loaded', 'bp_blogs_setup_nav' );
     154add_action( 'bp_setup_nav', 'bp_blogs_setup_nav' );
    155155add_action( 'admin_menu', 'bp_blogs_setup_nav' );
    156156
    157157function bp_blogs_directory_blogs_setup() {
     
    230230
    231231        do_action( 'bp_blogs_register_activity_actions' );
    232232}
    233 add_action( 'plugins_loaded', 'bp_blogs_register_activity_actions' );
     233add_action( 'bp_register_activity_actions', 'bp_blogs_register_activity_actions' );
    234234
    235235function bp_blogs_record_activity( $args = '' ) {
    236236        global $bp;
  • bp-core.php

     
    181181
    182182        do_action( 'bp_core_setup_globals' );
    183183}
    184 add_action( 'plugins_loaded', 'bp_core_setup_globals', 5 );
     184add_action( 'bp_setup_globals', 'bp_core_setup_globals' );
    185185add_action( '_admin_menu', 'bp_core_setup_globals', 2 ); // must be _admin_menu hook.
    186186
    187187
     
    377377                }
    378378        }
    379379}
    380 add_action( 'plugins_loaded', 'bp_core_setup_nav' );
     380add_action( 'bp_setup_nav', 'bp_core_setup_nav' );
    381381add_action( 'admin_menu', 'bp_core_setup_nav' );
    382382
    383383
  • bp-core/bp-core-widgets.php

     
    77        add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Whos_Online_Widget");') );
    88        add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Recently_Active_Widget");') );
    99}
    10 add_action( 'plugins_loaded', 'bp_core_register_widgets' );
     10add_action( 'bp_register_widgets', 'bp_core_register_widgets' );
    1111
    1212/*** WELCOME WIDGET *****************/
    1313
  • bp-forums.php

     
    2828
    2929        do_action( 'bp_forums_setup' );
    3030}
    31 add_action( 'plugins_loaded', 'bp_forums_setup', 5 );
     31add_action( 'bp_setup_globals', 'bp_forums_setup' );
    3232add_action( 'admin_head', 'bp_forums_setup', 2 );
    3333
    3434function bp_forums_is_installed_correctly() {
     
    4444        /* Register 'forums' as a root component */
    4545        bp_core_add_root_component( BP_FORUMS_SLUG );
    4646}
    47 add_action( 'plugins_loaded', 'bp_forums_setup_root_component', 2 );
     47add_action( 'bp_setup_root_component', 'bp_forums_setup_root_component' );
    4848
    4949function bp_forums_directory_forums_setup() {
    5050        global $bp;
  • bp-friends.php

     
    4747
    4848        do_action( 'friends_setup_globals' );
    4949}
    50 add_action( 'plugins_loaded', 'friends_setup_globals', 5 );
     50add_action( 'bp_setup_globals', 'friends_setup_globals' );
    5151add_action( 'admin_menu', 'friends_setup_globals', 2 );
    5252
    5353function friends_check_installed() {
     
    302302
    303303        do_action( 'friends_register_activity_actions' );
    304304}
    305 add_action( 'plugins_loaded', 'friends_register_activity_actions' );
     305add_action( 'bp_register_activity_actions', 'friends_register_activity_actions' );
    306306
    307307function friends_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) {
    308308        global $bp;
  • bp-groups.php

     
    9696
    9797        do_action( 'groups_setup_globals' );
    9898}
    99 add_action( 'plugins_loaded', 'groups_setup_globals', 5 );
     99add_action( 'bp_setup_globals', 'groups_setup_globals' );
    100100add_action( 'admin_menu', 'groups_setup_globals', 2 );
    101101
    102102function groups_setup_root_component() {
    103103        /* Register 'groups' as a root component */
    104104        bp_core_add_root_component( BP_GROUPS_SLUG );
    105105}
    106 add_action( 'plugins_loaded', 'groups_setup_root_component', 2 );
     106add_action( 'bp_setup_root_component', 'groups_setup_root_component' );
    107107
    108108function groups_check_installed() {
    109109        /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
     
    216216
    217217        do_action( 'groups_setup_nav', $bp->groups->current_group->user_has_access );
    218218}
    219 add_action( 'plugins_loaded', 'groups_setup_nav' );
     219add_action( 'bp_setup_nav', 'groups_setup_nav' );
    220220add_action( 'admin_menu', 'groups_setup_nav' );
    221221
    222222function groups_directory_groups_setup() {
     
    12661266
    12671267        do_action( 'groups_register_activity_actions' );
    12681268}
    1269 add_action( 'plugins_loaded', 'groups_register_activity_actions' );
     1269add_action( 'bp_register_activity_actions', 'groups_register_activity_actions' );
    12701270
    12711271function groups_record_activity( $args = '' ) {
    12721272        global $bp;
  • bp-groups/bp-groups-widgets.php

     
    44function groups_register_widgets() {
    55        add_action('widgets_init', create_function('', 'return register_widget("BP_Groups_Widget");') );
    66}
    7 add_action( 'plugins_loaded', 'groups_register_widgets' );
     7add_action( 'bp_register_widgets', 'groups_register_widgets' );
    88
    99/*** GROUPS WIDGET *****************/
    1010
  • bp-loader.php

     
    5555}
    5656add_action( 'plugins_loaded', 'bp_loaded' );
    5757
     58/* Allow dependent plugins to set their globals in a safe way */
     59function bp_setup_globals() {
     60        do_action( 'bp_setup_globals' );
     61}
     62add_action( 'plugins_loaded', 'bp_setup_globals', 5 );
     63
     64/* Allow dependent plugins to set their root components in a safe way */
     65function bp_setup_root_components() {
     66        do_action( 'bp_setup_root_components' );
     67}
     68add_action( 'plugins_loaded', 'bp_setup_root_components', 2 );
     69
     70/* Allow dependent plugins to set their root components in a safe way */
     71function bp_setup_nav() {
     72        do_action( 'bp_setup_nav' );
     73}
     74add_action( 'plugins_loaded', 'bp_setup_nav' );
     75
    5876/* Activation Function */
    5977function bp_loader_activate() {
    6078        /* Force refresh theme roots. */
  • bp-messages.php

     
    8282
    8383        do_action( 'messages_setup_globals' );
    8484}
    85 add_action( 'plugins_loaded', 'messages_setup_globals', 5 );
     85add_action( 'bp_setup_globals', 'messages_setup_globals' );
    8686add_action( 'admin_menu', 'messages_setup_globals', 2 );
    8787
    8888function messages_check_installed() {
     
    129129
    130130        do_action( 'messages_setup_nav' );
    131131}
    132 add_action( 'plugins_loaded', 'messages_setup_nav' );
     132add_action( 'bp_setup_nav', 'messages_setup_nav' );
    133133add_action( 'admin_menu', 'messages_setup_nav' );
    134134
    135135
  • bp-xprofile.php

     
    124124
    125125        do_action( 'xprofile_setup_globals' );
    126126}
    127 add_action( 'plugins_loaded', 'xprofile_setup_globals', 5 );
     127add_action( 'bp_setup_globals', 'xprofile_setup_globals', 5 );
    128128add_action( 'admin_menu', 'xprofile_setup_globals', 2 );
    129129
    130130/**
     
    194194
    195195        do_action( 'xprofile_setup_nav' );
    196196}
    197 add_action( 'plugins_loaded', 'xprofile_setup_nav' );
     197add_action( 'bp_setup_nav', 'xprofile_setup_nav' );
    198198add_action( 'admin_menu', 'xprofile_setup_nav' );
    199199
    200200
     
    464464
    465465        do_action( 'xprofile_register_activity_actions' );
    466466}
    467 add_action( 'plugins_loaded', 'xprofile_register_activity_actions' );
     467add_action( 'bp_register_activity_actions', 'xprofile_register_activity_actions' );
    468468
    469469/**
    470470 * xprofile_record_activity()