Skip to:
Content

BuddyPress.org

Changeset 1262


Ignore:
Timestamp:
03/26/2009 11:20:12 AM (17 years ago)
Author:
apeatling
Message:

Selectively including files that only need to be included at specific times.

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core.php

    r1250 r1262  
    1414define( 'BP_CORE_DB_VERSION', '1030' );
    1515
     16/* Place your custom code (actions/filters) in a file called bp-custom.php and it will be loaded before anything else. */
     17if ( file_exists( WPMU_PLUGIN_DIR . '/bp-custom.php' ) )
     18        require( WPMU_PLUGIN_DIR . '/bp-custom.php' );
     19
    1620/* Load the language file */
    1721if ( file_exists( WPMU_PLUGIN_DIR . '/bp-languages/buddypress-' . get_locale() . '.mo' ) )
    1822        load_textdomain( 'buddypress', WPMU_PLUGIN_DIR . '/bp-languages/buddypress-' . get_locale() . '.mo' );
    1923
    20 /* Place your custom code (actions/filters) in a file called bp-custom.php and it will be loaded before anything else. */
    21 if ( file_exists( WPMU_PLUGIN_DIR . '/bp-custom.php' ) )
    22         require( WPMU_PLUGIN_DIR . '/bp-custom.php' );
    23 
     24/* Load the files containing functions that we globally will need. */
    2425require ( 'bp-core/bp-core-catchuri.php' );
    2526require ( 'bp-core/bp-core-classes.php' );
     
    3233require ( 'bp-core/bp-core-ajax.php' );
    3334require ( 'bp-core/bp-core-notifications.php' );
    34 require ( 'bp-core/bp-core-admin.php' );
    35 require ( 'bp-core/bp-core-signup.php' );
    36 require ( 'bp-core/bp-core-activation.php' );
    3735
    3836/* Define the slug for member pages and the members directory (e.g. domain.com/[members] ) */
     
    9290        $bp->displayed_user->domain = bp_core_get_user_domain($displayed_user_id);
    9391       
    94         /* The component being used eg: http://andy.domain.com/ [profile] */
     92        /* The component being used eg: http://domain.com/members/andy/ [profile] */
    9593        $bp->current_component = $current_component; // type: string
    9694       
    97         /* The current action for the component eg: http://andy.domain.com/profile/ [edit] */
     95        /* The current action for the component eg: http://domain.com/members/andy/profile/ [edit] */
    9896        $bp->current_action = $current_action; // type: string
    9997       
    100         /* The action variables for the current action eg: http://andy.domain.com/profile/edit/ [group] / [6] */
     98        /* The action variables for the current action eg: http://domain.com/members/andy/profile/edit/ [group] / [6] */
    10199        $bp->action_variables = $action_variables; // type: array
    102100       
    103         /* Only used where a component has a sub item, e.g. groups: http://andy.domain.com/groups/ [my-group] / home - manipulated in the actual component not in catch uri code.*/
     101        /* Only used where a component has a sub item, e.g. groups: http://domain.com/members/andy/groups/ [my-group] / home - manipulated in the actual component not in catch uri code.*/
    104102        $bp->current_item = ''; // type: string
    105103
     
    107105        $bp->is_single_item = false;
    108106
    109         /* The default component to use if none are set and someone visits: http://andy.domain.com/ */
     107        /* The default component to use if none are set and someone visits: http://domain.com/members/andy */
    110108        $bp->default_component = 'profile';
    111109       
     
    224222        global $wpdb, $bp;
    225223
    226         if ( is_site_admin() ) {
    227                 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    228                 if ( get_site_option('bp-core-db-version') < BP_CORE_DB_VERSION )
    229                         bp_core_install();
    230         }
     224        if ( !is_site_admin() )
     225                return false;
     226       
     227        require ( 'bp-core/bp-core-admin.php' );
     228
     229        /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
     230        if ( get_site_option('bp-core-db-version') < BP_CORE_DB_VERSION )
     231                bp_core_install();
    231232}
    232233add_action( 'admin_menu', 'bp_core_check_installed' );
     
    246247        global $wpdb, $bp;
    247248       
    248         if ( is_site_admin() ) {
    249                 /* Add the administration tab under the "Site Admin" tab for site administrators */
    250                 add_submenu_page( 'wpmu-admin.php', __("BuddyPress", 'buddypress'), __("BuddyPress", 'buddypress'), 1, "bp_core_admin_settings", "bp_core_admin_settings" );
    251         }
     249        if ( !is_site_admin() )
     250                return false;
     251               
     252        /* Add the administration tab under the "Site Admin" tab for site administrators */
     253        add_submenu_page( 'wpmu-admin.php', __("BuddyPress", 'buddypress'), __("BuddyPress", 'buddypress'), 1, "bp_core_admin_settings", "bp_core_admin_settings" );
     254
    252255}
    253256add_action( 'admin_menu', 'bp_core_add_admin_menu' );
  • trunk/bp-forums.php

    r1250 r1262  
    2121define ( 'BP_FORUMS_PARENT_FORUM_ID', apply_filters( 'bp_forums_parent_forum_id', 0 ) );
    2222
    23 require ( 'bp-forums/bp-forums-admin.php' );
    2423require ( 'bp-forums/bp-forums-bbpress-live.php' );
    2524require ( 'bp-forums/bp-forums-templatetags.php' );
    2625require ( 'bp-forums/bp-forums-filters.php' );
     26
     27if ( is_admin() )
     28        require ( 'bp-forums/bp-forums-admin.php' );
    2729
    2830function bp_forums_setup() {
  • trunk/bp-forums/bp-forums-templatetags.php

    r1214 r1262  
    297297                $this->pag_page = isset( $_REQUEST['page'] ) ? intval( $_REQUEST['page'] ) : 1;
    298298                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $posts_per_page;
    299                
    300                 $this->posts = bp_forums_get_posts( $topic_id, $this->pag_num, $this->pag_page );
     299       
     300                $this->topic_id = $topic_id;
     301                $forum_template->topic = (object) bp_forums_get_topic_details( $this->topic_id );
     302               
     303                $this->posts = bp_forums_get_posts( $this->topic_id, $this->pag_num, $this->pag_page );
    301304               
    302305                if ( !$this->posts ) {
     
    305308                } else {
    306309                        $this->post_count = count( $this->posts );
    307                         $this->total_post_count = count( bp_forums_get_posts( $topic_id ) );                   
    308                 }
    309                
    310                 $this->topic_id = $topic_id;
    311                 $forum_template->topic = (object) bp_forums_get_topic_details( $topic_id );
     310                        $this->total_post_count = (int) $forum_template->topic->topic_posts;                   
     311                }
    312312
    313313                $this->pag_links = paginate_links( array(
  • trunk/bp-friends.php

    r1250 r1262  
    2222require ( 'bp-friends/bp-friends-cssjs.php' );
    2323require ( 'bp-friends/bp-friends-templatetags.php' );
    24 require ( 'bp-friends/bp-friends-notifications.php' );
    2524require ( 'bp-friends/bp-friends-filters.php' );
    2625
     
    8079        global $wpdb, $bp;
    8180
    82         if ( is_site_admin() ) {
    83                 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    84                 if ( get_site_option('bp-friends-db-version') < BP_FRIENDS_DB_VERSION )
    85                         friends_install();
    86         }
     81        if ( !is_site_admin() )
     82                return false;
     83       
     84        /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
     85        if ( get_site_option('bp-friends-db-version') < BP_FRIENDS_DB_VERSION )
     86                friends_install();
    8787}
    8888add_action( 'admin_menu', 'friends_check_installed' );
     
    509509       
    510510        if ( $friendship->save() ) {
     511               
     512                // Add the on screen notification
    511513                bp_core_add_notification( $friendship->initiator_user_id, $friendship->friend_user_id, 'friends', 'friendship_request' );       
     514               
     515                // Send the email notification
     516                require_once( 'bp-friends/bp-friends-notifications.php' );
     517                friends_notification_new_request( $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
     518               
    512519                do_action( 'friends_friendship_requested', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );     
    513520               
     
    566573                // Record in activity streams
    567574                friends_record_activity( array( 'item_id' => $friendship_id, 'component_name' => 'friends', 'component_action' => 'friendship_accepted', 'is_private' => 0, 'user_id' => $friendship->initiator_user_id, 'secondary_user_id' => $friendship->friend_user_id ) );
     575               
     576                // Send the email notification
     577                require_once( 'bp-friends/bp-friends-notifications.php' );
     578                friends_notification_accepted_request( $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
    568579
    569580                do_action( 'friends_friendship_accepted', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
  • trunk/bp-friends/bp-friends-notifications.php

    r1151 r1262  
    3636        wp_mail( $to, $subject, $message );
    3737}
    38 add_action( 'friends_friendship_requested', 'friends_notification_new_request', 10, 3 );
     38
    3939
    4040function friends_notification_accepted_request( $friendship_id, $initiator_id, $friend_id ) {
     
    7171        wp_mail( $to, $subject, $message );
    7272}
    73 add_action( 'friends_friendship_accepted', 'friends_notification_accepted_request', 10, 3 );
    7473
    7574
  • trunk/bp-groups.php

    r1255 r1262  
    99Site Wide Only: true
    1010*/
    11 
     11 
    1212require_once( 'bp-core.php' );
    1313
     
    2323require ( 'bp-groups/bp-groups-templatetags.php' );
    2424require ( 'bp-groups/bp-groups-widgets.php' );
    25 require ( 'bp-groups/bp-groups-notifications.php' );
    2625require ( 'bp-groups/bp-groups-filters.php' );
    27 require ( 'bp-groups/bp-groups-admin.php' );
    2826
    2927/**************************************************************************
     
    161159        global $wpdb, $bp;
    162160       
    163         if ( is_site_admin() ) {
    164                 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    165                 if ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION )
    166                         groups_install();
    167         }
     161        if ( !is_site_admin() )
     162                return false;
     163
     164        require ( 'bp-groups/bp-groups-admin.php' );
     165
     166        /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
     167        if ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION )
     168                groups_install();
    168169}
    169170add_action( 'admin_menu', 'groups_check_installed' );
     
    172173        global $wpdb, $bp;
    173174       
    174         if ( is_site_admin() ) {
    175                 /* Add the administration tab under the "Site Admin" tab for site administrators */
    176                 add_submenu_page( 'wpmu-admin.php', __("Groups", 'buddypress'), __("Groups", 'buddypress'), 1, "groups_admin_settings", "groups_admin_settings" );
    177         }
     175        if ( !is_site_admin() )
     176                return false;
     177               
     178        /* Add the administration tab under the "Site Admin" tab for site administrators */
     179        add_submenu_page( 'wpmu-admin.php', __("Groups", 'buddypress'), __("Groups", 'buddypress'), 1, "groups_admin_settings", "groups_admin_settings" );
    178180}
    179181add_action( 'admin_menu', 'groups_add_admin_menu' );
     
    17401742                        return false;
    17411743        }
     1744       
     1745        require_once ( 'bp-groups/bp-groups-notifications.php' );
    17421746
    17431747        // Send friend invites.
     
    19011905                return false;
    19021906
    1903         if ( $notify_members )
     1907        if ( $notify_members ) {
     1908                require_once ( 'bp-groups/bp-groups-notifications.php' );
    19041909                groups_notification_group_updated( $group->id );
    1905 
     1910        }
     1911               
    19061912        do_action( 'groups_details_updated', $group->id );
    19071913       
     
    20252031        if ( $requesting_user->save() ) {
    20262032                $admins = groups_get_group_admins( $group_id );
    2027                
     2033
     2034                require_once ( 'bp-groups/bp-groups-notifications.php' );
     2035
    20282036                for ( $i = 0; $i < count( $admins ); $i++ ) {
    20292037                        // Saved okay, now send the email notification
     
    20582066
    20592067        /* Send a notification to the user. */
     2068        require_once ( 'bp-groups/bp-groups-notifications.php' );
    20602069        groups_notification_membership_request_completed( $membership->user_id, $membership->group_id, true );
    20612070       
     
    20772086       
    20782087        // Send a notification to the user.
     2088        require_once ( 'bp-groups/bp-groups-notifications.php' );
    20792089        groups_notification_membership_request_completed( $membership->user_id, $membership->group_id, false );
    20802090       
  • trunk/bp-groups/bp-groups-ajax.php

    r1250 r1262  
    4848        check_ajax_referer( 'group-filter-box' );
    4949       
    50         load_template( get_template_directory() . '/groups/group-loop.php' );
     50        load_template( TEMPLATEPATH . '/groups/group-loop.php' );
    5151}
    5252add_action( 'wp_ajax_group_filter', 'groups_ajax_group_filter' );
  • trunk/bp-messages.php

    r1258 r1262  
    2222require ( 'bp-messages/bp-messages-cssjs.php' );
    2323require ( 'bp-messages/bp-messages-templatetags.php' );
    24 require ( 'bp-messages/bp-messages-notifications.php' );
    2524require ( 'bp-messages/bp-messages-filters.php' );
    2625
     
    131130        global $wpdb, $bp;
    132131
    133         if ( is_site_admin() ) {
    134                 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    135                 if ( get_site_option('bp-messages-db-version') < BP_MESSAGES_DB_VERSION )
    136                         messages_install();
    137         }
     132        if ( !is_site_admin() )
     133                return false;
     134       
     135        /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
     136        if ( get_site_option('bp-messages-db-version') < BP_MESSAGES_DB_VERSION )
     137                messages_install();
    138138}
    139139add_action( 'admin_menu', 'messages_check_installed', 1 );
     
    478478                                $type = 'success';
    479479                               
    480                                 // Send notices to the recipients
     480                                // Send screen notifications to the recipients
    481481                                for ( $i = 0; $i < count($pmessage->recipients); $i++ ) {
    482482                                        if ( $pmessage->recipients[$i] != $bp->loggedin_user->id ) {
     
    485485                                }
    486486                               
     487                                // Send email notifications to the recipients
     488                                require_once( 'bp-messages/bp-messages-notifications.php' );
     489                                messages_notification_new_message( array( 'item_id' => $pmessage->id, 'recipient_ids' => $pmessage->recipients, 'thread_id' => $pmessage->thread_id, 'component_name' => 'messages', 'component_action' => 'message_sent', 'is_private' => 1 ) );
     490
    487491                                do_action( 'messages_send_message', array( 'item_id' => $pmessage->id, 'recipient_ids' => $pmessage->recipients, 'thread_id' => $pmessage->thread_id, 'component_name' => 'messages', 'component_action' => 'message_sent', 'is_private' => 1 ) );
    488492               
  • trunk/bp-messages/bp-messages-notifications.php

    r1058 r1262  
    3636        }
    3737}
    38 add_action( 'messages_send_message', 'messages_notification_new_message' );
     38
    3939
    4040/* This is too expensive to send on normal servers uncomment at your own risk. */
  • trunk/bp-xprofile.php

    r1255 r1262  
    1818define ( 'BP_XPROFILE_SLUG', apply_filters( 'xprofile_slug', 'profile' ) );
    1919
    20 /* Database access classes and functions */
    2120require ( 'bp-xprofile/bp-xprofile-classes.php' );
    22 
    23 /* Functions for handling the admin area tabs for administrators */
    24 require ( 'bp-xprofile/bp-xprofile-admin.php' );
    25 
    26 /* Functions for applying filters to Xprofile specfic output */
    2721require ( 'bp-xprofile/bp-xprofile-filters.php' );
    28 
    29 /* Functions to handle the modification and saving of signup pages */
    3022require ( 'bp-xprofile/bp-xprofile-signup.php' );
    31 
    32 /* Template tag functions that can be used in theme template files */
    3323require ( 'bp-xprofile/bp-xprofile-templatetags.php' );
    34 
    35 /* Functions to handle the sending of email notifications */
    3624require ( 'bp-xprofile/bp-xprofile-notifications.php' );
    37 
    38 /* Functions to handle the selective inclusion of CSS and JS files */
    3925require ( 'bp-xprofile/bp-xprofile-cssjs.php' );
    4026
     
    195181                return false;
    196182
     183        require ( 'bp-xprofile/bp-xprofile-admin.php' );
     184       
    197185        /* Add the administration tab under the "Site Admin" tab for site administrators */
    198186        add_submenu_page( 'wpmu-admin.php', __("Profile Fields", 'buddypress'), __("Profile Fields", 'buddypress'), 1, "xprofile_settings", "xprofile_admin" );
Note: See TracChangeset for help on using the changeset viewer.