Skip to:
Content

BuddyPress.org

Changeset 2656


Ignore:
Timestamp:
02/10/2010 09:13:14 PM (15 years ago)
Author:
apeatling
Message:

Moving BuddyPress registration functions to their own actions. Props jjj

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r2644 r2656  
    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
     
    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_components', 'bp_activity_setup_root_component' );
    102102
    103103function bp_activity_setup_nav() {
     
    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
     
    10921092add_action( 'make_spam_user', 'bp_activity_remove_data' );
    10931093
     1094
     1095/********************************************************************************
     1096 * Custom Actions
     1097 *
     1098 * Functions to set up custom BuddyPress actions that all other components can
     1099 * hook in to.
     1100 */
     1101
     1102/* Allow core components and dependent plugins to register activity actions */
     1103function bp_register_activity_actions() {
     1104    do_action( 'bp_register_activity_actions' );
     1105}
     1106add_action( 'plugins_loaded', 'bp_register_activity_actions' );
     1107
     1108
    10941109?>
  • trunk/bp-blogs.php

    r2636 r2656  
    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
     
    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_components', 'bp_blogs_setup_root_component' );
    111111
    112112/**
     
    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
     
    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 = '' ) {
     
    829829add_action( 'delete_user', 'bp_blogs_remove_data', 1 );
    830830
     831
     832/********************************************************************************
     833 * Caching
     834 *
     835 * Caching functions handle the clearing of cached objects and pages on specific
     836 * actions throughout BuddyPress.
     837 */
     838
    831839function bp_blogs_clear_blog_object_cache( $blog_id, $user_id ) {
    832840    wp_cache_delete( 'bp_blogs_of_user_' . $user_id, 'bp' );
  • trunk/bp-core.php

    r2653 r2656  
    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
     
    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
     
    20632063add_filter( 'login_redirect', 'bp_core_login_redirect' );
    20642064
     2065
     2066/********************************************************************************
     2067 * Custom Actions
     2068 *
     2069 * Functions to set up custom BuddyPress actions that all other components can
     2070 * hook in to.
     2071 */
     2072
     2073/* Allow core components and dependent plugins to set globals */
     2074function bp_setup_globals() {
     2075    do_action( 'bp_setup_globals' );
     2076}
     2077add_action( 'plugins_loaded', 'bp_setup_globals', 5 );
     2078
     2079/* Allow core components and dependent plugins to set root components */
     2080function bp_setup_root_components() {
     2081    do_action( 'bp_setup_root_components' );
     2082}
     2083add_action( 'plugins_loaded', 'bp_setup_root_components', 2 );
     2084
     2085/* Allow core components and dependent plugins to set their nav */
     2086function bp_setup_nav() {
     2087    do_action( 'bp_setup_nav' );
     2088}
     2089add_action( 'plugins_loaded', 'bp_setup_nav' );
     2090
     2091
     2092/********************************************************************************
     2093 * Caching
     2094 *
     2095 * Caching functions handle the clearing of cached objects and pages on specific
     2096 * actions throughout BuddyPress.
     2097 */
     2098
    20652099/**
    20662100 * bp_core_clear_user_object_cache()
  • trunk/bp-core/bp-core-widgets.php

    r2544 r2656  
    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 *****************/
  • trunk/bp-forums.php

    r2641 r2656  
    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
     
    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_components', 'bp_forums_setup_root_component' );
    4848
    4949function bp_forums_directory_forums_setup() {
     
    499499}
    500500
    501 // List actions to clear super cached pages on, if super cache is installed
    502 add_action( 'bp_forums_new_forum', 'bp_core_clear_cache' );
    503 add_action( 'bp_forums_new_topic', 'bp_core_clear_cache' );
    504 add_action( 'bp_forums_new_post', 'bp_core_clear_cache' );
    505501
    506502function bp_forums_filter_caps( $allcaps ) {
     
    536532add_action( 'init', 'bp_forums_filter_template_paths' );
    537533
     534
     535/********************************************************************************
     536 * Caching
     537 *
     538 * Caching functions handle the clearing of cached objects and pages on specific
     539 * actions throughout BuddyPress.
     540 */
     541
     542// List actions to clear super cached pages on, if super cache is installed
     543add_action( 'bp_forums_new_forum', 'bp_core_clear_cache' );
     544add_action( 'bp_forums_new_topic', 'bp_core_clear_cache' );
     545add_action( 'bp_forums_new_post', 'bp_core_clear_cache' );
     546
    538547?>
  • trunk/bp-friends.php

    r2618 r2656  
    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
     
    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 ) {
     
    626626add_action( 'make_spam_user', 'friends_remove_data', 1 );
    627627
     628
     629/********************************************************************************
     630 * Caching
     631 *
     632 * Caching functions handle the clearing of cached objects and pages on specific
     633 * actions throughout BuddyPress.
     634 */
     635
    628636function friends_clear_friend_object_cache( $friendship_id ) {
    629637    if ( !$friendship = new BP_Friends_Friendship( $friendship_id ) )
  • trunk/bp-groups.php

    r2646 r2656  
    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
     
    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_components', 'groups_setup_root_component' );
    107107
    108108function groups_check_installed() {
     
    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
     
    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 = '' ) {
     
    25552555add_action( 'delete_user', 'groups_remove_data_for_user', 1 );
    25562556add_action( 'make_spam_user', 'groups_remove_data_for_user', 1 );
     2557
     2558
     2559/********************************************************************************
     2560 * Caching
     2561 *
     2562 * Caching functions handle the clearing of cached objects and pages on specific
     2563 * actions throughout BuddyPress.
     2564 */
    25572565
    25582566function groups_clear_group_object_cache( $group_id ) {
  • trunk/bp-groups/bp-groups-widgets.php

    r2444 r2656  
    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 *****************/
  • trunk/bp-messages.php

    r2576 r2656  
    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
     
    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
     
    592592
    593593
     594/********************************************************************************
     595 * Caching
     596 *
     597 * Caching functions handle the clearing of cached objects and pages on specific
     598 * actions throughout BuddyPress.
     599 */
     600
    594601// List actions to clear super cached pages on, if super cache is installed
    595602add_action( 'messages_delete_thread', 'bp_core_clear_cache' );
  • trunk/bp-xprofile.php

    r2645 r2656  
    125125    do_action( 'xprofile_setup_globals' );
    126126}
    127 add_action( 'plugins_loaded', 'xprofile_setup_globals', 5 );
     127add_action( 'bp_setup_globals', 'xprofile_setup_globals' );
    128128add_action( 'admin_menu', 'xprofile_setup_globals', 2 );
    129129
     
    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
     
    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/**
     
    952952add_action( 'delete_user', 'xprofile_remove_data', 1 );
    953953
     954
     955/********************************************************************************
     956 * Caching
     957 *
     958 * Caching functions handle the clearing of cached objects and pages on specific
     959 * actions throughout BuddyPress.
     960 */
     961
    954962function xprofile_clear_profile_groups_object_cache( $group_obj ) {
    955963    wp_cache_delete( 'xprofile_groups', 'bp' );
Note: See TracChangeset for help on using the changeset viewer.