Skip to:
Content

BuddyPress.org

Changeset 3751


Ignore:
Timestamp:
01/20/2011 03:56:04 AM (14 years ago)
Author:
johnjamesjacoby
Message:

First pass at BP_Component class. Refactor Activity component to use BP_Component. Introduce page templates for root directories. Rename bp-activity-templatetags to bp-activity-template per WP coding standards. Split bp-activity up into smaller parts. Introduce get_slug functions for activity component. More refactoring to do on other components. This will temporarily break trunk while refactoring happens, so be sure to pin to the previous revision if needed.

Location:
trunk
Files:
9 added
17 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r3743 r3751  
    11<?php
    22
    3 // Required Files
    4 require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-classes.php' );
    5 require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-templatetags.php' );
    6 require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-filters.php' );
    7 
    8 function bp_activity_setup_globals() {
    9     global $bp, $current_blog;
    10 
    11     // Define a slug, if necessary
    12     if ( !defined( 'BP_ACTIVITY_SLUG' ) )
    13         define( 'BP_ACTIVITY_SLUG', bp_core_component_slug_from_root_slug( $bp->pages->activity->slug ) );
    14 
    15     // For internal identification
    16     $bp->activity->id   = 'activity';
    17     $bp->activity->name = $bp->pages->activity->name;
    18 
    19     // Slugs
    20     $bp->activity->slug      = BP_ACTIVITY_SLUG;
    21     $bp->activity->root_slug = $bp->pages->activity->slug;
    22 
    23     // Tables
    24     $bp->activity->table_name      = $bp->table_prefix . 'bp_activity';
    25     $bp->activity->table_name_meta = $bp->table_prefix . 'bp_activity_meta';
    26 
    27     // Notifications
    28     $bp->activity->format_notification_function = 'bp_activity_format_notifications';
    29 
    30     // Register this in the active components array
    31     $bp->active_components[$bp->activity->slug] = $bp->activity->id;
    32 
    33     do_action( 'bp_activity_setup_globals' );
    34 }
    35 add_action( 'bp_setup_globals', 'bp_activity_setup_globals' );
    36 
    37 function bp_activity_setup_nav() {
    38     global $bp;
    39 
    40     /* Add 'Activity' to the main navigation */
    41     bp_core_new_nav_item( array( 'name' => __( 'Activity', 'buddypress' ), 'slug' => $bp->activity->name, 'position' => 10, 'screen_function' => 'bp_activity_screen_my_activity', 'default_subnav_slug' => 'just-me', 'item_css_id' => $bp->activity->id ) );
    42 
    43     if ( !is_user_logged_in() && !isset( $bp->displayed_user->id ) )
    44         return;
    45 
    46     $user_domain = ( isset( $bp->displayed_user->domain ) ) ? $bp->displayed_user->domain : $bp->loggedin_user->domain;
    47     $user_login = ( isset( $bp->displayed_user->userdata->user_login ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;
    48     $activity_link = $user_domain . $bp->activity->slug . '/';
    49 
    50     /* Add the subnav items to the activity nav item if we are using a theme that supports this */
    51     bp_core_new_subnav_item( array( 'name' => __( 'Personal', 'buddypress' ), 'slug' => 'just-me', 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->name, 'screen_function' => 'bp_activity_screen_my_activity', 'position' => 10 ) );
    52 
    53     if ( bp_is_active( 'friends' ) )
    54         bp_core_new_subnav_item( array( 'name' => __( 'Friends', 'buddypress' ), 'slug' => BP_FRIENDS_SLUG, 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_friends', 'position' => 20, 'item_css_id' => 'activity-friends' ) );
    55 
    56     if ( bp_is_active( 'groups' ) )
    57         bp_core_new_subnav_item( array( 'name' => __( 'Groups', 'buddypress' ), 'slug' => BP_GROUPS_SLUG, 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->slug, 'screen_function' => 'bp_activity_screen_groups', 'position' => 30, 'item_css_id' => 'activity-groups' ) );
    58 
    59     bp_core_new_subnav_item( array( 'name' => __( 'Favorites', 'buddypress' ), 'slug' => 'favorites', 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->name, 'screen_function' => 'bp_activity_screen_favorites', 'position' => 40, 'item_css_id' => 'activity-favs' ) );
    60     bp_core_new_subnav_item( array( 'name' => sprintf( __( '@%s Mentions', 'buddypress' ), $user_login ), 'slug' => 'mentions', 'parent_url' => $activity_link, 'parent_slug' => $bp->activity->name, 'screen_function' => 'bp_activity_screen_mentions', 'position' => 50, 'item_css_id' => 'activity-mentions' ) );
    61 
    62     if ( $bp->current_component == $bp->activity->slug ) {
    63         if ( bp_is_my_profile() ) {
    64             $bp->bp_options_title = __( 'My Activity', 'buddypress' );
    65         } else {
    66             $bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
    67             $bp->bp_options_title = $bp->displayed_user->fullname;
     3class BP_Activity_Component extends BP_Component {
     4
     5    /**
     6     * Start the activity component creation process
     7     */
     8    function BP_Activity_Component() {
     9        parent::start( 'activity', __( 'Activity Streams', 'buddypress' ) );
     10    }
     11
     12    /**
     13     * Setup globals
     14     *
     15     * @global obj $bp
     16     */
     17    function _setup_globals() {
     18        global $bp;
     19
     20        // Define a slug, if necessary
     21        if ( !defined( 'BP_ACTIVITY_SLUG' ) )
     22            define( 'BP_ACTIVITY_SLUG', 'activity' );
     23
     24        // Do some slug checks
     25        $this->slug      = defined( 'BP_ACTIVITY_SLUG' )       ? BP_ACTIVITY_SLUG           : $this->id;
     26        $this->root_slug = isset( $bp->pages->activity->slug ) ? $bp->pages->activity->slug : $this->slug;
     27
     28        // Tables
     29        $this->table_name      = $bp->table_prefix . 'bp_activity';
     30        $this->table_name_meta = $bp->table_prefix . 'bp_activity_meta';
     31    }
     32   
     33    /**
     34     * Include files
     35     *
     36     * @global obj $bp
     37     */
     38    function _includes() {
     39        require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-actions.php'      );
     40        require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-filters.php'      );
     41        require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-screens.php'      );
     42        require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-classes.php'      );
     43        require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-functions.php'    );
     44        require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-template.php' );
     45    }
     46
     47    /**
     48     * Setup BuddyBar navigation
     49     *
     50     * @global obj $bp
     51     */
     52    function _setup_nav() {
     53        global $bp;
     54
     55        // Add 'Activity' to the main navigation
     56        bp_core_new_nav_item( array(
     57            'name'                => __( 'Activity', 'buddypress' ),
     58            'slug'                => $bp->activity->slug,
     59            'position'            => 10,
     60            'screen_function'     => 'bp_activity_screen_my_activity',
     61            'default_subnav_slug' => 'just-me',
     62            'item_css_id'         => $bp->activity->id )
     63        );
     64
     65        // Stop if there is no user displayed or logged in
     66        if ( !is_user_logged_in() && !isset( $bp->displayed_user->id ) )
     67            return;
     68
     69        // User links
     70        $user_domain   = ( isset( $bp->displayed_user->domain ) )               ? $bp->displayed_user->domain               : $bp->loggedin_user->domain;
     71        $user_login    = ( isset( $bp->displayed_user->userdata->user_login ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;
     72        $activity_link = $user_domain . $bp->activity->slug . '/';
     73
     74        // Add the subnav items to the activity nav item if we are using a theme that supports this
     75        bp_core_new_subnav_item( array(
     76            'name'            => __( 'Personal', 'buddypress' ),
     77            'slug'            => 'just-me',
     78            'parent_url'      => $activity_link,
     79            'parent_slug'     => $bp->activity->slug,
     80            'screen_function' => 'bp_activity_screen_my_activity',
     81            'position'        => 10
     82        ) );
     83
     84        // Additional menu if friends is active
     85        if ( bp_is_active( 'friends' ) ) {
     86            bp_core_new_subnav_item( array(
     87                'name'            => __( 'Friends', 'buddypress' ),
     88                'slug'            => BP_FRIENDS_SLUG,
     89                'parent_url'      => $activity_link,
     90                'parent_slug'     => $bp->activity->slug,
     91                'screen_function' => 'bp_activity_screen_friends',
     92                'position'        => 20,
     93                'item_css_id'     => 'activity-friends'
     94            ) );
    6895        }
    69     }
    70    
    71     do_action( 'bp_activity_setup_nav' );
    72 }
    73 add_action( 'bp_setup_nav', 'bp_activity_setup_nav' );
    74 
    75 function bp_activity_directory_activity_setup() {
    76     global $bp;
    77 
    78     if ( $bp->current_component == $bp->activity->slug && empty( $bp->current_action ) ) {
    79         $bp->is_directory = true;
    80 
    81         do_action( 'bp_activity_directory_activity_setup' );
    82         bp_core_load_template( apply_filters( 'bp_activity_directory_activity_setup', 'activity/index' ) );
    83     }
    84 }
    85 add_action( 'wp', 'bp_activity_directory_activity_setup', 2 );
    86 
    87 
    88 /********************************************************************************
    89  * Screen Functions
    90  *
    91  * Screen functions are the controllers of BuddyPress. They will execute when their
    92  * specific URL is caught. They will first save or manipulate data using business
    93  * functions, then pass on the user to a template file.
    94  */
    95 
    96 function bp_activity_screen_my_activity() {
    97     do_action( 'bp_activity_screen_my_activity' );
    98     bp_core_load_template( apply_filters( 'bp_activity_template_my_activity', 'members/single/home' ) );
    99 }
    100 
    101 function bp_activity_screen_friends() {
    102     global $bp;
    103 
    104     if ( !bp_is_active( 'friends' ) )
    105         return false;
    106 
    107     if ( !is_super_admin() )
    108         $bp->is_item_admin = false;
    109 
    110     do_action( 'bp_activity_screen_friends' );
    111     bp_core_load_template( apply_filters( 'bp_activity_template_friends_activity', 'members/single/home' ) );
    112 }
    113 
    114 function bp_activity_screen_groups() {
    115     global $bp;
    116 
    117     if ( !bp_is_active( 'groups' ) )
    118         return false;
    119 
    120     if ( !is_super_admin() )
    121         $bp->is_item_admin = false;
    122 
    123     do_action( 'bp_activity_screen_groups' );
    124     bp_core_load_template( apply_filters( 'bp_activity_template_groups_activity', 'members/single/home' ) );
    125 }
    126 
    127 function bp_activity_screen_favorites() {
    128     global $bp;
    129 
    130     if ( !is_super_admin() )
    131         $bp->is_item_admin = false;
    132 
    133     do_action( 'bp_activity_screen_favorites' );
    134     bp_core_load_template( apply_filters( 'bp_activity_template_favorite_activity', 'members/single/home' ) );
    135 }
    136 
    137 function bp_activity_screen_mentions() {
    138     global $bp;
    139 
    140     if ( !is_super_admin() )
    141         $bp->is_item_admin = false;
    142 
    143     do_action( 'bp_activity_screen_mentions' );
    144     bp_core_load_template( apply_filters( 'bp_activity_template_mention_activity', 'members/single/home' ) );
    145 }
    146 
    147 /**
    148  * bp_activity_remove_screen_notifications()
    149  *
    150  * Removes activity notifications from the notification menu when a user clicks on them and
    151  * is taken to a specific screen.
    152  *
    153  * @package BuddyPress Activity
    154  */
    155 function bp_activity_remove_screen_notifications() {
    156     global $bp;
    157 
    158     bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, $bp->activity->id, 'new_at_mention' );
    159 }
    160 add_action( 'bp_activity_screen_my_activity', 'bp_activity_remove_screen_notifications' );
    161 add_action( 'bp_activity_screen_single_activity_permalink', 'bp_activity_remove_screen_notifications' );
    162 add_action( 'bp_activity_screen_mentions', 'bp_activity_remove_screen_notifications' );
    163 
    164 function bp_activity_screen_single_activity_permalink() {
    165     global $bp;
    166 
    167     if ( !$bp->displayed_user->id || $bp->current_component != $bp->activity->name )
    168         return false;
    169 
    170     if ( empty( $bp->current_action ) || !is_numeric( $bp->current_action ) )
    171         return false;
    172 
    173     /* Get the activity details */
    174     $activity = bp_activity_get_specific( array( 'activity_ids' => $bp->current_action ) );
    175 
    176     if ( !$activity = $activity['activities'][0] )
    177         bp_core_redirect( $bp->root_domain );
    178 
    179     $has_access = true;
    180     /* Redirect based on the type of activity */
    181     if ( $activity->component == $bp->groups->id ) {
    182         if ( !function_exists( 'groups_get_group' ) )
    183             bp_core_redirect( $bp->root_domain );
    184 
    185         if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) {
    186             /* Check to see if the group is not public, if so, check the user has access to see this activity */
    187             if ( 'public' != $group->status ) {
    188                 if ( !groups_is_user_member( $bp->loggedin_user->id, $group->id ) )
    189                     $has_access = false;
     96
     97        // Additional menu if groups is active
     98        if ( bp_is_active( 'groups' ) ) {
     99            bp_core_new_subnav_item( array(
     100                'name'            => __( 'Groups', 'buddypress' ),
     101                'slug'            => BP_GROUPS_SLUG,
     102                'parent_url'      => $activity_link,
     103                'parent_slug'     => $bp->activity->slug,
     104                'screen_function' => 'bp_activity_screen_groups',
     105                'position'        => 30,
     106                'item_css_id'     => 'activity-groups'
     107            ) );
     108        }
     109
     110        // Favorite activity items
     111        bp_core_new_subnav_item( array(
     112            'name'            => __( 'Favorites', 'buddypress' ),
     113            'slug'            => 'favorites',
     114            'parent_url'      => $activity_link,
     115            'parent_slug'     => $bp->activity->slug,
     116            'screen_function' => 'bp_activity_screen_favorites',
     117            'position'        => 40,
     118            'item_css_id'     => 'activity-favs'
     119        ) );
     120
     121        // @ mentions
     122        bp_core_new_subnav_item( array(
     123            'name'            => sprintf( __( '@%s Mentions', 'buddypress' ), $user_login ),
     124            'slug'            => 'mentions',
     125            'parent_url'      => $activity_link,
     126            'parent_slug'     => $bp->activity->slug,
     127            'screen_function' => 'bp_activity_screen_mentions',
     128            'position'        => 50,
     129            'item_css_id'     => 'activity-mentions'
     130        ) );
     131
     132        // Adjust title based on view
     133        if ( bp_is_activity_component() ) {
     134            if ( bp_is_my_profile() ) {
     135                $bp->bp_options_title = __( 'My Activity', 'buddypress' );
     136            } else {
     137                $bp->bp_options_avatar = bp_core_fetch_avatar( array(
     138                    'item_id' => $bp->displayed_user->id,
     139                    'type'    => 'thumb'
     140                ) );
     141                $bp->bp_options_title  = $bp->displayed_user->fullname;
    190142            }
    191143        }
    192144    }
    193 
    194     $has_access = apply_filters( 'bp_activity_permalink_access', $has_access, &$activity );
    195 
    196     do_action( 'bp_activity_screen_single_activity_permalink', $activity, $has_access );
    197 
    198     if ( !$has_access ) {
    199         bp_core_add_message( __( 'You do not have access to this activity.', 'buddypress' ), 'error' );
    200 
    201         if ( is_user_logged_in() )
    202             bp_core_redirect( $bp->loggedin_user->domain );
    203         else
    204             bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . esc_url( $bp->root_domain . '/' . $bp->activity->slug . '/p/' . $bp->current_action ) ) );
    205     }
    206 
    207     bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink' ) );
    208 }
    209 /* This screen is not attached to a nav item, so we need to add an action for it. */
    210 add_action( 'wp', 'bp_activity_screen_single_activity_permalink', 3 );
    211 
    212 function bp_activity_screen_notification_settings() {
    213     global $bp;
    214 
    215     $mention = get_user_meta( $bp->displayed_user->id, 'notification_activity_new_mention', true );
    216     if ( !$mention )
    217         $mention = 'yes';
    218 
    219     $reply = get_user_meta( $bp->displayed_user->id, 'notification_activity_new_reply', true );
    220     if ( !$reply )
    221         $reply = 'yes';
    222 ?>
    223     <table class="notification-settings zebra" id="activity-notification-settings">
    224         <thead>
    225             <tr>
    226                 <th class="icon"></th>
    227                 <th class="title"><?php _e( 'Activity', 'buddypress' ) ?></th>
    228                 <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
    229                 <th class="no"><?php _e( 'No', 'buddypress' )?></th>
    230             </tr>
    231         </thead>
    232 
    233         <tbody>
    234             <tr id="activity-notification-settings-mentions">
    235                 <td></td>
    236                 <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) ?></td>
    237                 <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php checked( $mention, 'yes', true ) ?>/></td>
    238                 <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php checked( $mention, 'no', true ) ?>/></td>
    239             </tr>
    240             <tr id="activity-notification-settings-replies">
    241                 <td></td>
    242                 <td><?php _e( "A member replies to an update or comment you've posted", 'buddypress' ) ?></td>
    243                 <td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" value="yes" <?php checked( $reply, 'yes', true ) ?>/></td>
    244                 <td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php checked( $reply, 'no', true ) ?>/></td>
    245             </tr>
    246 
    247             <?php do_action( 'bp_activity_screen_notification_settings' ) ?>
    248         </tbody>
    249     </table>
    250 <?php
    251 }
    252 add_action( 'bp_notification_settings', 'bp_activity_screen_notification_settings', 1 );
    253 
    254 /********************************************************************************
    255  * Action Functions
    256  *
    257  * Action functions are exactly the same as screen functions, however they do not
    258  * have a template screen associated with them. Usually they will send the user
    259  * back to the default screen after execution.
     145}
     146// Create the activity component
     147$bp->activity = new BP_Activity_Component();
     148
     149/**
     150 * @todo Figure out if this is still needed
     151 *
     152 * @global obj $bp
    260153 */
    261 
    262 function bp_activity_action_permalink_router() {
    263     global $bp;
    264 
    265     if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'p' )
    266         return false;
    267 
    268     if ( empty( $bp->action_variables[0] ) || !is_numeric( $bp->action_variables[0] ) )
    269         return false;
    270 
    271     /* Get the activity details */
    272     $activity = bp_activity_get_specific( array( 'activity_ids' => $bp->action_variables[0] ) );
    273 
    274     if ( !$activity = $activity['activities'][0] )
    275         bp_core_redirect( $bp->root_domain );
    276 
    277     $redirect = false;
    278     /* Redirect based on the type of activity */
    279     if ( $activity->component == $bp->groups->id ) {
    280         if ( $activity->user_id ) {
    281             $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id . '/';
    282         } else {
    283             if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) )
    284                 $redirect = bp_get_group_permalink( $group ) . $bp->activity->slug . '/' . $activity->id . '/';
    285         }
    286     } else {
    287         $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id;
    288     }
    289 
    290     $redirect = apply_filters( 'bp_activity_permalink_redirect_url', $redirect, &$activity );
    291 
    292     if ( !$redirect )
    293         bp_core_redirect( $bp->root_domain );
    294 
    295     /* Redirect to the actual activity permalink page */
    296     bp_core_redirect( $redirect );
    297 }
    298 add_action( 'wp', 'bp_activity_action_permalink_router', 3 );
    299 
    300 function bp_activity_action_delete_activity() {
    301     global $bp;
    302 
    303     if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'delete' )
    304         return false;
    305 
    306     if ( empty( $bp->action_variables[0] ) || !is_numeric( $bp->action_variables[0] ) )
    307         return false;
    308 
    309     /* Check the nonce */
    310     check_admin_referer( 'bp_activity_delete_link' );
    311 
    312     $activity_id = $bp->action_variables[0];
    313     $activity = new BP_Activity_Activity( $activity_id );
    314 
    315     /* Check access */
    316     if ( !is_super_admin() && $activity->user_id != $bp->loggedin_user->id )
    317         return false;
    318 
    319     /* Call the action before the delete so plugins can still fetch information about it */
    320     do_action( 'bp_activity_action_delete_activity', $activity_id, $activity->user_id );
    321 
    322     /* Now delete the activity item */
    323     if ( bp_activity_delete( array( 'id' => $activity_id, 'user_id' => $activity->user_id ) ) )
    324         bp_core_add_message( __( 'Activity deleted', 'buddypress' ) );
    325     else
    326         bp_core_add_message( __( 'There was an error when deleting that activity', 'buddypress' ), 'error' );
    327 
    328     bp_core_redirect( wp_get_referer() );
    329 }
    330 add_action( 'wp', 'bp_activity_action_delete_activity', 3 );
    331 
    332 function bp_activity_action_post_update() {
    333     global $bp;
    334 
    335     if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'post' )
    336         return false;
    337 
    338     /* Check the nonce */
    339     check_admin_referer( 'post_update', '_wpnonce_post_update' );
    340 
    341     $content = apply_filters( 'bp_activity_post_update_content', $_POST['whats-new'] );
    342     $object = apply_filters( 'bp_activity_post_update_object', $_POST['whats-new-post-object'] );
    343     $item_id = apply_filters( 'bp_activity_post_update_item_id', $_POST['whats-new-post-in'] );
    344 
    345     if ( empty( $content ) ) {
    346         bp_core_add_message( __( 'Please enter some content to post.', 'buddypress' ), 'error' );
    347         bp_core_redirect( wp_get_referer() );
    348     }
    349 
    350     if ( !(int)$item_id ) {
    351         $activity_id = bp_activity_post_update( array( 'content' => $content ) );
    352 
    353     } else if ( 'groups' == $object && function_exists( 'groups_post_update' ) ) {
    354         if ( (int)$item_id ) {
    355             $activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) );
    356         }
    357     } else
    358         $activity_id = apply_filters( 'bp_activity_custom_update', $object, $item_id, $content );
    359 
    360     if ( !empty( $activity_id ) )
    361         bp_core_add_message( __( 'Update Posted!', 'buddypress' ) );
    362     else
    363         bp_core_add_message( __( 'There was an error when posting your update, please try again.', 'buddypress' ), 'error' );
    364 
    365     bp_core_redirect( wp_get_referer() );
    366 }
    367 add_action( 'wp', 'bp_activity_action_post_update', 3 );
    368 
    369 function bp_activity_action_post_comment() {
    370     global $bp;
    371 
    372     if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'reply' )
    373         return false;
    374 
    375     /* Check the nonce */
    376     check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
    377 
    378     $activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] );
    379     $content = apply_filters( 'bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id] );
    380 
    381     if ( empty( $content ) ) {
    382         bp_core_add_message( __( 'Please do not leave the comment area blank.', 'buddypress' ), 'error' );
    383         bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
    384     }
    385 
    386     $comment_id = bp_activity_new_comment( array(
    387         'content' => $content,
    388         'activity_id' => $activity_id,
    389         'parent_id' => $parent_id
    390     ));
    391 
    392     if ( !empty( $comment_id ) )
    393         bp_core_add_message( __( 'Reply Posted!', 'buddypress' ) );
    394     else
    395         bp_core_add_message( __( 'There was an error posting that reply, please try again.', 'buddypress' ), 'error' );
    396 
    397     bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
    398 }
    399 add_action( 'wp', 'bp_activity_action_post_comment', 3 );
    400 
    401 function bp_activity_action_mark_favorite() {
    402     global $bp;
    403 
    404     if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'favorite' )
    405         return false;
    406 
    407     /* Check the nonce */
    408     check_admin_referer( 'mark_favorite' );
    409 
    410     if ( bp_activity_add_user_favorite( $bp->action_variables[0] ) )
    411         bp_core_add_message( __( 'Activity marked as favorite.', 'buddypress' ) );
    412     else
    413         bp_core_add_message( __( 'There was an error marking that activity as a favorite, please try again.', 'buddypress' ), 'error' );
    414 
    415     bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
    416 }
    417 add_action( 'wp', 'bp_activity_action_mark_favorite', 3 );
    418 
    419 function bp_activity_action_remove_favorite() {
    420     global $bp;
    421 
    422     if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'unfavorite' )
    423         return false;
    424 
    425     /* Check the nonce */
    426     check_admin_referer( 'unmark_favorite' );
    427 
    428     if ( bp_activity_remove_user_favorite( $bp->action_variables[0] ) )
    429         bp_core_add_message( __( 'Activity removed as favorite.', 'buddypress' ) );
    430     else
    431         bp_core_add_message( __( 'There was an error removing that activity as a favorite, please try again.', 'buddypress' ), 'error' );
    432 
    433     bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
    434 }
    435 add_action( 'wp', 'bp_activity_action_remove_favorite', 3 );
    436 
    437 function bp_activity_action_sitewide_feed() {
    438     global $bp, $wp_query;
    439 
    440     if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'feed' || ( isset( $bp->displayed_user->id ) && $bp->displayed_user->id ) || isset( $bp->groups->current_group ) )
    441         return false;
    442 
    443     $wp_query->is_404 = false;
    444     status_header( 200 );
    445 
    446     include_once( 'bp-activity/feeds/bp-activity-sitewide-feed.php' );
    447     die;
    448 }
    449 add_action( 'wp', 'bp_activity_action_sitewide_feed', 3 );
    450 
    451 function bp_activity_action_personal_feed() {
    452     global $bp, $wp_query;
    453 
    454     if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'feed' )
    455         return false;
    456 
    457     $wp_query->is_404 = false;
    458     status_header( 200 );
    459 
    460     include_once( 'bp-activity/feeds/bp-activity-personal-feed.php' );
    461     die;
    462 }
    463 add_action( 'wp', 'bp_activity_action_personal_feed', 3 );
    464 
    465 function bp_activity_action_friends_feed() {
    466     global $bp, $wp_query;
    467 
    468     if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != $bp->friends->slug || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
    469         return false;
    470 
    471     $wp_query->is_404 = false;
    472     status_header( 200 );
    473 
    474     include_once( 'bp-activity/feeds/bp-activity-friends-feed.php' );
    475     die;
    476 }
    477 add_action( 'wp', 'bp_activity_action_friends_feed', 3 );
    478 
    479 function bp_activity_action_my_groups_feed() {
    480     global $bp, $wp_query;
    481 
    482     if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != $bp->groups->slug || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
    483         return false;
    484 
    485     $wp_query->is_404 = false;
    486     status_header( 200 );
    487 
    488     include_once( 'bp-activity/feeds/bp-activity-mygroups-feed.php' );
    489     die;
    490 }
    491 add_action( 'wp', 'bp_activity_action_my_groups_feed', 3 );
    492 
    493 function bp_activity_action_mentions_feed() {
    494     global $bp, $wp_query;
    495 
    496     if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'mentions' || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
    497         return false;
    498 
    499     $wp_query->is_404 = false;
    500     status_header( 200 );
    501 
    502     include_once( 'bp-activity/feeds/bp-activity-mentions-feed.php' );
    503     die;
    504 }
    505 add_action( 'wp', 'bp_activity_action_mentions_feed', 3 );
    506 
    507 function bp_activity_action_favorites_feed() {
    508     global $bp, $wp_query;
    509 
    510     if ( $bp->current_component != $bp->activity->slug || !$bp->displayed_user->id || $bp->current_action != 'favorites' || !isset( $bp->action_variables[0] ) || $bp->action_variables[0] != 'feed' )
    511         return false;
    512 
    513     $wp_query->is_404 = false;
    514     status_header( 200 );
    515 
    516     include_once( 'bp-activity/feeds/bp-activity-favorites-feed.php' );
    517     die;
    518 }
    519 add_action( 'wp', 'bp_activity_action_favorites_feed', 3 );
     154function bp_activity_directory_activity_setup() {
     155    global $bp;
     156
     157    if ( bp_is_activity_component() && empty( $bp->current_action ) ) {
     158        $bp->is_directory = true;
     159
     160        do_action( 'bp_activity_directory_activity_setup' );
     161
     162        bp_core_load_template( apply_filters( 'bp_activity_directory_activity_setup', 'activity/index' ) );
     163    }
     164}
     165add_action( 'wp', 'bp_activity_directory_activity_setup', 2 );
    520166
    521167/**
    522  * bp_activity_find_mentions()
    523  *
    524168 * Searches through the content of an activity item to locate usernames, designated by an @ sign
    525169 *
     
    542186
    543187/**
    544  * bp_activity_reduce_mention_count()
    545  *
    546188 * Reduces new mention count for mentioned users when activity items are deleted
    547189 *
     
    571213
    572214/**
    573  * bp_activity_format_notifications()
    574  *
    575215 * Formats notifications related to activity
    576216 *
     
    586226    switch ( $action ) {
    587227        case 'new_at_mention':
    588             $activity_id = $item_id;
    589             $poster_user_id = $secondary_item_id;
    590 
    591             $at_mention_link = $bp->loggedin_user->domain . $bp->activity->slug . '/mentions/';
     228            $activity_id      = $item_id;
     229            $poster_user_id   = $secondary_item_id;
     230            $at_mention_link  = $bp->loggedin_user->domain . $bp->activity->slug . '/mentions/';
    592231            $at_mention_title = sprintf( __( '@%s Mentions', 'buddypress' ), $bp->loggedin_user->userdata->user_nicename );
    593232
     
    607246}
    608247
    609 /********************************************************************************
    610  * Business Functions
    611  *
    612  * Business functions are where all the magic happens in BuddyPress. They will
    613  * handle the actual saving or manipulation of information. Usually they will
    614  * hand off to a database class for data access, then return
    615  * true or false on success or failure.
    616  */
    617 
    618 function bp_activity_get( $args = '' ) {
    619     $defaults = array(
    620         'max' => false, // Maximum number of results to return
    621         'page' => 1, // page 1 without a per_page will result in no pagination.
    622         'per_page' => false, // results per page
    623         'sort' => 'DESC', // sort ASC or DESC
    624         'display_comments' => false, // false for no comments. 'stream' for within stream display, 'threaded' for below each activity item
    625 
    626         'search_terms' => false, // Pass search terms as a string
    627         'show_hidden' => false, // Show activity items that are hidden site-wide?
    628         'exclude' => false, // Comma-separated list of activity IDs to exclude
    629         'in' => false, // Comma-separated list or array of activity IDs to which you want to limit the query
    630 
    631         /**
    632          * Pass filters as an array -- all filter items can be multiple values comma separated:
    633          * array(
    634          *  'user_id' => false, // user_id to filter on
    635          *  'object' => false, // object to filter on e.g. groups, profile, status, friends
    636          *  'action' => false, // action to filter on e.g. activity_update, profile_updated
    637          *  'primary_id' => false, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
    638          *  'secondary_id' => false, // secondary object ID to filter on e.g. a post_id
    639          * );
    640          */
    641         'filter' => array()
    642     );
    643 
    644     $r = wp_parse_args( $args, $defaults );
    645     extract( $r, EXTR_SKIP );
    646 
    647     /* Attempt to return a cached copy of the first page of sitewide activity. */
    648     if ( 1 == (int)$page && empty( $max ) && empty( $search_terms ) && empty( $filter ) && 'DESC' == $sort && empty( $exclude ) ) {
    649         if ( !$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' ) ) {
    650             $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden );
    651             wp_cache_set( 'bp_activity_sitewide_front', $activity, 'bp' );
    652         }
    653     } else
    654         $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden, $exclude, $in );
    655 
    656     return apply_filters( 'bp_activity_get', $activity, &$r );
    657 }
    658 
    659 function bp_activity_get_specific( $args = '' ) {
    660     $defaults = array(
    661         'activity_ids' => false, // A single activity_id or array of IDs.
    662         'page' => 1, // page 1 without a per_page will result in no pagination.
    663         'per_page' => false, // results per page
    664         'max' => false, // Maximum number of results to return
    665         'sort' => 'DESC', // sort ASC or DESC
    666         'display_comments' => false // true or false to display threaded comments for these specific activity items
    667     );
    668 
    669     $r = wp_parse_args( $args, $defaults );
    670     extract( $r, EXTR_SKIP );
    671 
    672     return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get( $max, $page, $per_page, $sort, false, false, $display_comments, false, false, $activity_ids ) );
    673 }
    674 
    675 function bp_activity_add( $args = '' ) {
    676     global $bp;
    677 
    678     $defaults = array(
    679         'id'                => false, // Pass an existing activity ID to update an existing entry.
    680 
    681         'action'            => '', // The activity action - e.g. "Jon Doe posted an update"
    682         'content'           => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"
    683 
    684         'component'         => false, // The name/ID of the component e.g. groups, profile, mycomponent
    685         'type'              => false, // The activity type e.g. activity_update, profile_updated
    686         'primary_link'      => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
    687 
    688         'user_id'           => $bp->loggedin_user->id, // Optional: The user to record the activity for, can be false if this activity is not for a user.
    689         'item_id'           => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id
    690         'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id
    691         'recorded_time'     => bp_core_current_time(), // The GMT time that this activity was recorded
    692         'hide_sitewide'     => false // Should this be hidden on the sitewide activity stream?
    693     );
    694 
    695     $params = wp_parse_args( $args, $defaults );
    696     extract( $params, EXTR_SKIP );
    697 
    698     /* Make sure we are backwards compatible */
    699     if ( empty( $component ) && !empty( $component_name ) )
    700         $component = $component_name;
    701 
    702     if ( empty( $type ) && !empty( $component_action ) )
    703         $type = $component_action;
    704 
    705     $activity = new BP_Activity_Activity( $id );
    706 
    707     $activity->user_id = $user_id;
    708     $activity->component = $component;
    709     $activity->type = $type;
    710     $activity->action = $action;
    711     $activity->content = $content;
    712     $activity->primary_link = $primary_link;
    713     $activity->item_id = $item_id;
    714     $activity->secondary_item_id = $secondary_item_id;
    715     $activity->date_recorded = $recorded_time;
    716     $activity->hide_sitewide = $hide_sitewide;
    717 
    718     if ( !$activity->save() )
    719         return false;
    720 
    721     /* If this is an activity comment, rebuild the tree */
    722     if ( 'activity_comment' == $activity->type )
    723         BP_Activity_Activity::rebuild_activity_comment_tree( $activity->item_id );
    724 
    725     wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
    726     do_action( 'bp_activity_add', $params );
    727 
    728     return $activity->id;
    729 }
    730 
    731 function bp_activity_post_update( $args = '' ) {
    732     global $bp;
    733 
    734     $defaults = array(
    735         'content' => false,
    736         'user_id' => $bp->loggedin_user->id
    737     );
    738 
    739     $r = wp_parse_args( $args, $defaults );
    740     extract( $r, EXTR_SKIP );
    741 
    742     if ( empty( $content ) || !strlen( trim( $content ) ) )
    743         return false;
    744 
    745     /* Record this on the user's profile */
    746     $from_user_link = bp_core_get_userlink( $user_id );
    747     $activity_action = sprintf( __( '%s posted an update:', 'buddypress' ), $from_user_link );
    748     $activity_content = $content;
    749 
    750     $primary_link = bp_core_get_userlink( $user_id, false, true );
    751 
    752     /* Now write the values */
    753     $activity_id = bp_activity_add( array(
    754         'user_id' => $user_id,
    755         'action' => apply_filters( 'bp_activity_new_update_action', $activity_action ),
    756         'content' => apply_filters( 'bp_activity_new_update_content', $activity_content ),
    757         'primary_link' => apply_filters( 'bp_activity_new_update_primary_link', $primary_link ),
    758         'component' => $bp->activity->id,
    759         'type' => 'activity_update'
    760     ) );
    761 
    762     /* Add this update to the "latest update" usermeta so it can be fetched anywhere. */
    763     update_user_meta( $bp->loggedin_user->id, 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
    764 
    765     /* Require the notifications code so email notifications can be set on the 'bp_activity_posted_update' action. */
    766     require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-notifications.php' );
    767 
    768     do_action( 'bp_activity_posted_update', $content, $user_id, $activity_id );
    769 
    770     return $activity_id;
    771 }
    772 
    773 function bp_activity_new_comment( $args = '' ) {
    774     global $bp;
    775 
    776     $defaults = array(
    777         'id' => false,
    778         'content' => false,
    779         'user_id' => $bp->loggedin_user->id,
    780         'activity_id' => false, // ID of the root activity item
    781         'parent_id' => false // ID of a parent comment (optional)
    782     );
    783 
    784     $params = wp_parse_args( $args, $defaults );
    785     extract( $params, EXTR_SKIP );
    786 
    787     if ( empty($content) || empty($user_id) || empty($activity_id) )
    788         return false;
    789 
    790     if ( empty($parent_id) )
    791         $parent_id = $activity_id;
    792 
    793     /* Check to see if the parent activity is hidden, and if so, hide this comment publically. */
    794     $activity = new BP_Activity_Activity( $activity_id );
    795     $is_hidden = ( (int)$activity->hide_sitewide ) ? 1 : 0;
    796 
    797     /* Insert the activity comment */
    798     $comment_id = bp_activity_add( array(
    799         'id' => $id,
    800         'action' => apply_filters( 'bp_activity_comment_action', sprintf( __( '%s posted a new activity comment:', 'buddypress' ), bp_core_get_userlink( $user_id ) ) ),
    801         'content' => apply_filters( 'bp_activity_comment_content', $content ),
    802         'component' => $bp->activity->id,
    803         'type' => 'activity_comment',
    804         'user_id' => $user_id,
    805         'item_id' => $activity_id,
    806         'secondary_item_id' => $parent_id,
    807         'hide_sitewide' => $is_hidden
    808     ) );
    809 
    810     /* Send an email notification if settings allow */
    811     require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-notifications.php' );
    812     bp_activity_new_comment_notification( $comment_id, $user_id, $params );
    813 
    814     /* Clear the comment cache for this activity */
    815     wp_cache_delete( 'bp_activity_comments_' . $parent_id );
    816 
    817     do_action( 'bp_activity_comment_posted', $comment_id, $params );
    818 
    819     return $comment_id;
    820 }
    821 
    822 /**
    823  * bp_activity_get_activity_id()
    824  *
    825  * Fetch the activity_id for an existing activity entry in the DB.
    826  *
    827  * @package BuddyPress Activity
    828  */
    829 function bp_activity_get_activity_id( $args = '' ) {
    830     $defaults = array(
    831         'user_id' => false,
    832         'component' => false,
    833         'type' => false,
    834         'item_id' => false,
    835         'secondary_item_id' => false,
    836         'action' => false,
    837         'content' => false,
    838         'date_recorded' => false,
    839     );
    840 
    841     $r = wp_parse_args( $args, $defaults );
    842     extract( $r, EXTR_SKIP );
    843 
    844     return apply_filters( 'bp_activity_get_activity_id', BP_Activity_Activity::get_id( $user_id, $component, $type, $item_id, $secondary_item_id, $action, $content, $date_recorded ) );
    845 }
    846 
    847 /***
    848  * Deleting Activity
    849  *
    850  * If you're looking to hook into one action that provides the ID(s) of
    851  * the activity/activities deleted, then use:
    852  *
    853  * add_action( 'bp_activity_deleted_activities', 'my_function' );
    854  *
    855  * The action passes one parameter that is a single activity ID or an
    856  * array of activity IDs depending on the number deleted.
    857  *
    858  * If you are deleting an activity comment please use bp_activity_delete_comment();
    859 */
    860 
    861 function bp_activity_delete( $args = '' ) {
    862     global $bp;
    863 
    864     /* Pass one or more the of following variables to delete by those variables */
    865     $defaults = array(
    866         'id' => false,
    867         'action' => false,
    868         'content' => false,
    869         'component' => false,
    870         'type' => false,
    871         'primary_link' => false,
    872         'user_id' => false,
    873         'item_id' => false,
    874         'secondary_item_id' => false,
    875         'date_recorded' => false,
    876         'hide_sitewide' => false
    877     );
    878 
    879     $args = wp_parse_args( $args, $defaults );
    880 
    881     if ( !$activity_ids_deleted = BP_Activity_Activity::delete( $args ) )
    882         return false;
    883 
    884     /* Check if the user's latest update has been deleted */
    885     if ( empty( $args['user_id'] ) )
    886         $user_id = $bp->loggedin_user->id;
    887     else
    888         $user_id = $args['user_id'];
    889 
    890     $latest_update = get_user_meta( $user_id, 'bp_latest_update', true );
    891     if ( !empty( $latest_update ) ) {
    892         if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) )
    893             delete_user_meta( $user_id, 'bp_latest_update' );
    894     }
    895 
    896     do_action( 'bp_activity_delete', $args );
    897     do_action( 'bp_activity_deleted_activities', $activity_ids_deleted );
    898 
    899     wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
    900 
    901     return true;
    902 }
    903     /* The following functions have been deprecated in place of bp_activity_delete() */
    904     function bp_activity_delete_by_item_id( $args = '' ) {
    905         global $bp;
    906 
    907         $defaults = array( 'item_id' => false, 'component' => false, 'type' => false, 'user_id' => false, 'secondary_item_id' => false );
    908         $r = wp_parse_args( $args, $defaults );
    909         extract( $r, EXTR_SKIP );
    910 
    911         return bp_activity_delete( array( 'item_id' => $item_id, 'component' => $component, 'type' => $type, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
    912     }
    913 
    914     function bp_activity_delete_by_activity_id( $activity_id ) {
    915         return bp_activity_delete( array( 'id' => $activity_id ) );
    916     }
    917 
    918     function bp_activity_delete_by_content( $user_id, $content, $component, $type ) {
    919         return bp_activity_delete( array( 'user_id' => $user_id, 'content' => $content, 'component' => $component, 'type' => $type ) );
    920     }
    921 
    922     function bp_activity_delete_for_user_by_component( $user_id, $component ) {
    923         return bp_activity_delete( array( 'user_id' => $user_id, 'component' => $component ) );
    924     }
    925     /* End deprecation */
    926 
    927 function bp_activity_delete_comment( $activity_id, $comment_id ) {
    928     /***
    929      * You may want to hook into this filter if you want to override this function and
    930      * handle the deletion of child comments differently. Make sure you return false.
    931      */
    932     if ( !apply_filters( 'bp_activity_delete_comment_pre', true, $activity_id, $comment_id ) )
    933         return false;
    934 
    935     /* Delete any children of this comment. */
    936     bp_activity_delete_children( $activity_id, $comment_id );
    937 
    938     /* Delete the actual comment */
    939     if ( !bp_activity_delete( array( 'id' => $comment_id, 'type' => 'activity_comment' ) ) )
    940         return false;
    941 
    942     /* Recalculate the comment tree */
    943     BP_Activity_Activity::rebuild_activity_comment_tree( $activity_id );
    944 
    945     do_action( 'bp_activity_delete_comment', $activity_id, $comment_id );
    946 
    947     return true;
    948 }
    949     function bp_activity_delete_children( $activity_id, $comment_id) {
    950         /* Recursively delete all children of this comment. */
    951         if ( $children = BP_Activity_Activity::get_child_comments( $comment_id ) ) {
    952             foreach( (array)$children as $child )
    953                 bp_activity_delete_children( $activity_id, $child->id );
    954         }
    955         bp_activity_delete( array( 'secondary_item_id' => $comment_id, 'type' => 'activity_comment', 'item_id' => $activity_id ) );
    956     }
    957 
    958 function bp_activity_get_permalink( $activity_id, $activity_obj = false ) {
    959     global $bp;
    960 
    961     if ( !$activity_obj )
    962         $activity_obj = new BP_Activity_Activity( $activity_id );
    963 
    964     if ( 'new_blog_post' == $activity_obj->type || 'new_blog_comment' == $activity_obj->type || 'new_forum_topic' == $activity_obj->type || 'new_forum_post' == $activity_obj->type )
    965         $link = $activity_obj->primary_link;
    966     else {
    967         if ( 'activity_comment' == $activity_obj->type )
    968             $link = $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activity_obj->item_id . '/';
    969         else
    970             $link = $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activity_obj->id . '/';
    971     }
    972 
    973     return apply_filters( 'bp_activity_get_permalink', $link );
    974 }
    975 
    976 function bp_activity_hide_user_activity( $user_id ) {
    977     return BP_Activity_Activity::hide_all_for_user( $user_id );
    978 }
    979 
    980 /**
    981  * bp_activity_thumbnail_content_images()
    982  *
    983  * Take content, remove all images and replace them with one thumbnail image.
    984  *
    985  * @package BuddyPress Activity
    986  * @param $content str - The content to work with
    987  * @param $link str - Optional. The URL that the image should link to
    988  * @return $content str - The content with images stripped and replaced with a single thumb.
    989  */
    990 function bp_activity_thumbnail_content_images( $content, $link = false ) {
    991     global $post;
    992 
    993     preg_match_all( '/<img[^>]*>/Ui', $content, $matches );
    994     $content = preg_replace('/<img[^>]*>/Ui', '', $content );
    995 
    996     if ( !empty( $matches ) && !empty( $matches[0] ) ) {
    997         /* Get the SRC value */
    998         preg_match( '/<img.*?(src\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $src );
    999 
    1000         /* Get the width and height */
    1001         preg_match( '/<img.*?(height\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $height );
    1002         preg_match( '/<img.*?(width\=[\'|"]{0,1}.*?[\'|"]{0,1})[\s|>]{1}/i', $matches[0][0], $width );
    1003 
    1004         if ( !empty( $src ) ) {
    1005             $src = substr( substr( str_replace( 'src=', '', $src[1] ), 0, -1 ), 1 );
    1006             $height = substr( substr( str_replace( 'height=', '', $height[1] ), 0, -1 ), 1 );
    1007             $width = substr( substr( str_replace( 'width=', '', $width[1] ), 0, -1 ), 1 );
    1008 
    1009             if ( empty( $width ) || empty( $height ) ) {
    1010                 $width = 100;
    1011                 $height = 100;
    1012             }
    1013 
    1014             $ratio = (int)$width / (int)$height;
    1015             $new_height = (int)$height >= 100 ? 100 : $height;
    1016             $new_width = $new_height * $ratio;
    1017 
    1018             $image = '<img src="' . esc_attr( $src ) . '" width="' . $new_width . '" height="' . $new_height . '" alt="' . __( 'Thumbnail', 'buddypress' ) . '" class="align-left thumbnail" />';
    1019 
    1020             if ( !empty( $link ) ) {
    1021                 $image = '<a href="' . $link . '">' . $image . '</a>';
    1022             }
    1023 
    1024             $content = $image . $content;
    1025         }
    1026     }
    1027 
    1028     return apply_filters( 'bp_activity_thumbnail_content_images', $content, $matches );
    1029 }
     248/** Actions *******************************************************************/
    1030249
    1031250function bp_activity_set_action( $component_id, $key, $value ) {
     
    1036255
    1037256    $bp->activity->actions->{$component_id}->{$key} = apply_filters( 'bp_activity_set_action', array(
    1038         'key' => $key,
     257        'key'   => $key,
    1039258        'value' => $value
    1040259    ), $component_id, $key, $value );
     
    1049268    return apply_filters( 'bp_activity_get_action', $bp->activity->actions->{$component_id}->{$key}, $component_id, $key );
    1050269}
     270
     271/** Favorites *****************************************************************/
    1051272
    1052273function bp_activity_get_user_favorites( $user_id ) {
     
    1069290        $user_id = $bp->loggedin_user->id;
    1070291
    1071     /* Update the user's personal favorites */
     292    // Update the user's personal favorites
    1072293    $my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) );
    1073294    $my_favs[] = $activity_id;
    1074295
    1075     /* Update the total number of users who have favorited this activity */
     296    // Update the total number of users who have favorited this activity
    1076297    $fav_count = bp_activity_get_meta( $activity_id, 'favorite_count' );
    1077298
     
    1095316        $user_id = $bp->loggedin_user->id;
    1096317
    1097     /* Remove the fav from the user's favs */
     318    // Remove the fav from the user's favs
    1098319    $my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) );
    1099320    $my_favs = array_flip( (array) $my_favs );
     
    1101322    $my_favs = array_unique( array_flip( $my_favs ) );
    1102323
    1103     /* Update the total number of users who have favorited this activity */
     324    // Update the total number of users who have favorited this activity
    1104325    $fav_count = bp_activity_get_meta( $activity_id, 'favorite_count' );
    1105326
     
    1133354}
    1134355
    1135 /********************************************************************************
    1136  * Activity Meta Functions
    1137  *
    1138  * Meta functions allow you to store extra data for a particular item.
    1139  */
     356/** Meta **********************************************************************/
     357
    1140358
    1141359function bp_activity_delete_meta( $activity_id, $meta_key = false, $meta_value = false ) {
     
    1152370    $meta_value = trim( $meta_value );
    1153371
    1154     if ( !$meta_key ) {
     372    if ( !$meta_key )
    1155373        $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id = %d", $activity_id ) );
    1156     } else if ( $meta_value ) {
     374    else if ( $meta_value )
    1157375        $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id = %d AND meta_key = %s AND meta_value = %s", $activity_id, $meta_key, $meta_value ) );
    1158     } else {
     376    else
    1159377        $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id = %d AND meta_key = %s", $activity_id, $meta_key ) );
    1160     }
    1161378
    1162379    wp_cache_delete( 'bp_activity_meta_' . $meta_key . '_' . $activity_id, 'bp' );
     
    1207424    $meta_value = maybe_serialize( $meta_value );
    1208425
    1209     if ( empty( $meta_value ) ) {
     426    if ( empty( $meta_value ) )
    1210427        return bp_activity_delete_meta( $activity_id, $meta_key );
    1211     }
    1212428
    1213429    $cur = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name_meta} WHERE activity_id = %d AND meta_key = %s", $activity_id, $meta_key ) );
    1214430
    1215     if ( !$cur ) {
     431    if ( !$cur )
    1216432        $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->activity->table_name_meta} ( activity_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $activity_id, $meta_key, $meta_value ) );
    1217     } else if ( $cur->meta_value != $meta_value ) {
     433    else if ( $cur->meta_value != $meta_value )
    1218434        $wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name_meta} SET meta_value = %s WHERE activity_id = %d AND meta_key = %s", $meta_value, $activity_id, $meta_key ) );
    1219     } else {
    1220         return false;
    1221     }
     435    else
     436        return false;
    1222437
    1223438    wp_cache_set( 'bp_activity_meta_' . $meta_key . '_' . $activity_id, $meta_value, 'bp' );
     
    1225440    return true;
    1226441}
     442
     443/** Clean up ******************************************************************/
    1227444
    1228445function bp_activity_remove_data( $user_id ) {
     
    1236453    do_action( 'bp_activity_remove_data', $user_id );
    1237454}
    1238 add_action( 'wpmu_delete_user', 'bp_activity_remove_data' );
    1239 add_action( 'delete_user', 'bp_activity_remove_data' );
     455add_action( 'wpmu_delete_user',  'bp_activity_remove_data' );
     456add_action( 'delete_user',       'bp_activity_remove_data' );
    1240457add_action( 'bp_make_spam_user', 'bp_activity_remove_data' );
    1241458
    1242459/**
    1243  * updates_register_activity_actions()
    1244  *
    1245460 * Register the activity stream actions for updates
    1246461 *
     
    1256471add_action( 'bp_register_activity_actions', 'updates_register_activity_actions' );
    1257472
    1258 /********************************************************************************
    1259  * Custom Actions
    1260  *
    1261  * Functions to set up custom BuddyPress actions that all other components can
    1262  * hook in to.
    1263  */
    1264 
    1265 /* Allow core components and dependent plugins to register activity actions */
    1266 function bp_register_activity_actions() {
    1267     do_action( 'bp_register_activity_actions' );
    1268 }
    1269 add_action( 'bp_init', 'bp_register_activity_actions', 8 );
    1270 
    1271473?>
  • trunk/bp-activity/bp-activity-filters.php

    r3666 r3751  
    11<?php
    22
    3 /* Apply WordPress defined filters */
     3// Apply WordPress defined filters
    44add_filter( 'bp_get_activity_action',                'bp_activity_filter_kses', 1 );
    55add_filter( 'bp_get_activity_content_body',          'bp_activity_filter_kses', 1 );
     
    6464add_filter( 'bp_get_activity_feed_item_description', 'stripslashes_deep' );
    6565
    66 /* Apply BuddyPress defined filters */
     66// Apply BuddyPress defined filters
    6767add_filter( 'bp_get_activity_content',               'bp_activity_make_nofollow_filter' );
    6868add_filter( 'bp_get_activity_content_body',          'bp_activity_make_nofollow_filter' );
     
    7474add_filter( 'bp_get_activity_parent_content', 'bp_create_excerpt' );
    7575
    76 /* Allow shortcodes in activity posts */
     76// Allow shortcodes in activity posts
    7777add_filter( 'bp_get_activity_content', 'do_shortcode' );
    7878add_filter( 'bp_get_activity_content_body', 'do_shortcode' );
  • trunk/bp-activity/bp-activity-template.php

    r3739 r3751  
    11<?php
    22
     3/**
     4 * BuddyPress Activity Template Functions
     5 *
     6 * @package BuddyPress
     7 * @subpackage Activity Template
     8 */
     9
     10/**
     11 * Output the activity component slug
     12 *
     13 * @package BuddyPress
     14 * @subpackage Activity Template
     15 * @since BuddyPress {unknown}
     16 *
     17 * @uses bp_get_activity_slug()
     18 */
     19function bp_activity_slug() {
     20    echo bp_get_activity_slug();
     21}
     22    /**
     23     * Return the activity component slug
     24     *
     25     * @package BuddyPress
     26     * @subpackage Activity Template
     27     * @since BuddyPress {unknown}
     28     */
     29    function bp_get_activity_slug() {
     30        global $bp;
     31        return apply_filters( 'bp_get_activity_slug', $bp->activation->slug );
     32    }
     33
     34/**
     35 * Output the activity component root slug
     36 *
     37 * @package BuddyPress
     38 * @subpackage Activity Template
     39 * @since BuddyPress {unknown}
     40 *
     41 * @uses bp_get_activity_root_slug()
     42 */
     43function bp_activity_root_slug() {
     44    echo bp_get_activity_root_slug();
     45}
     46    /**
     47     * Return the activity component root slug
     48     *
     49     * @package BuddyPress
     50     * @subpackage Activity Template
     51     * @since BuddyPress {unknown}
     52     */
     53    function bp_get_activity_root_slug() {
     54        global $bp;
     55        return apply_filters( 'bp_get_activity_root_slug', $bp->activity->root_slug );
     56    }
     57
     58/**
     59 * The main activity template loop
     60 *
     61 * This is responsible for loading a group of activity items and displaying them
     62 *
     63 * @package BuddyPress
     64 * @subpackage Activity Template
     65 * @since {unknown}
     66 */
    367class BP_Activity_Template {
    468    var $current_activity = -1;
     
    811875}
    812876    function bp_get_activity_comment_form_action() {
    813         return apply_filters( 'bp_get_activity_comment_form_action', site_url( BP_ACTIVITY_SLUG . '/reply/' ) );
     877        global $bp;
     878
     879        return apply_filters( 'bp_get_activity_comment_form_action', home_url( $bp->activity->root_slug . '/reply/' ) );
    814880    }
    815881
     
    838904}
    839905    function bp_get_activity_favorite_link() {
    840         global $activities_template;
    841         return apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/favorite/' . $activities_template->activity->id . '/' ), 'mark_favorite' ) );
     906        global $bp, $activities_template;
     907        return apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( $bp->activity->root_slug . '/favorite/' . $activities_template->activity->id . '/' ), 'mark_favorite' ) );
    842908    }
    843909
     
    846912}
    847913    function bp_get_activity_unfavorite_link() {
    848         global $activities_template;
    849         return apply_filters( 'bp_get_activity_unfavorite_link', wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/unfavorite/' . $activities_template->activity->id . '/' ), 'unmark_favorite' ) );
     914        global $bp, $activities_template;
     915        return apply_filters( 'bp_get_activity_unfavorite_link', wp_nonce_url( home_url( $bp->activity->root_slug . '/unfavorite/' . $activities_template->activity->id . '/' ), 'unmark_favorite' ) );
    850916    }
    851917
     
    897963
    898964        $latest_update = '&quot;' . apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 180 ) ) ) ) . '&quot;';
    899         $latest_update .= ' &middot; <a href="' . $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $update['id'] . '/"> ' . __( 'View', 'buddypress' ) . '</a>';
     965        $latest_update .= ' &middot; <a href="' . $bp->root_domain . '/' . $bp->activity->root_slug . '/p/' . $update['id'] . '/"> ' . __( 'View', 'buddypress' ) . '</a>';
    900966
    901967        return apply_filters( 'bp_get_activity_latest_update', $latest_update  );
     
    10651131}
    10661132    function bp_get_activity_post_form_action() {
    1067         return apply_filters( 'bp_get_activity_post_form_action', site_url( BP_ACTIVITY_SLUG . '/post/' ) );
     1133        return apply_filters( 'bp_get_activity_post_form_action', home_url( bp_get_activity_root_slug() . '/post/' ) );
    10681134    }
    10691135
     
    10741140}
    10751141    function bp_get_sitewide_activity_feed_link() {
    1076         global $bp;
    1077 
    1078         return apply_filters( 'bp_get_sitewide_activity_feed_link', site_url( $bp->activity->slug . '/feed/' ) );
     1142        return apply_filters( 'bp_get_sitewide_activity_feed_link', home_url( bp_get_activity_root_slug() . '/feed/' ) );
    10791143    }
    10801144
  • trunk/bp-activity/feeds/bp-activity-favorites-feed.php

    r3503 r3751  
    55 * @package BuddyPress
    66 */
    7 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
     7header('Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
    88header('Status: 200 OK');
    99?>
    10 <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
     10
     11<?php echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?'.'>'; ?>
    1112
    1213<rss version="2.0"
     
    2122    <title><?php bp_site_name() ?> | <?php echo $bp->displayed_user->fullname; ?> | <?php _e( 'Favorite Activity', 'buddypress' ) ?></title>
    2223    <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    23     <link><?php echo site_url( BP_ACTIVITY_SLUG . '/#my-favorites/' ) ?></link>
     24    <link><?php echo home_url( bp_get_activity_root_slug() . '/#my-favorites/' ) ?></link>
    2425    <description><?php echo $bp->displayed_user->fullname; ?> - <?php _e( 'Favorite Activity', 'buddypress' ) ?></description>
    2526    <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
    2627    <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
    2728    <language><?php echo get_option('rss_language'); ?></language>
     29
    2830    <?php do_action('bp_activity_favorites_feed_head'); ?>
    2931
     
    3537    <?php if ( bp_has_activities( 'include=' . $fav_ids . '&max=50&display_comments=stream' ) ) : ?>
    3638        <?php while ( bp_activities() ) : bp_the_activity(); ?>
     39
    3740            <item>
    3841                <guid><?php bp_activity_thread_permalink() ?></guid>
     
    5558                    ]]>
    5659                </description>
     60
    5761                <?php do_action('bp_activity_favorites_feed_item'); ?>
     62
    5863            </item>
     64
    5965        <?php endwhile; ?>
     66    <?php endif; ?>
    6067
    61     <?php endif; ?>
    6268</channel>
    6369</rss>
  • trunk/bp-activity/feeds/bp-activity-mentions-feed.php

    r3503 r3751  
    2121    <title><?php bp_site_name() ?> | <?php echo $bp->displayed_user->fullname; ?> | <?php _e( 'Mentions', 'buddypress' ) ?></title>
    2222    <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    23     <link><?php echo site_url( BP_ACTIVITY_SLUG . '/#mentions/' ) ?></link>
     23    <link><?php echo home_url( bp_get_activity_root_slug() . '/#mentions/' ) ?></link>
    2424    <description><?php echo $bp->displayed_user->fullname; ?> - <?php _e( 'Mentions', 'buddypress' ) ?></description>
    2525    <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
  • trunk/bp-activity/feeds/bp-activity-mygroups-feed.php

    r3503 r3751  
    2121    <title><?php bp_site_name() ?> | <?php echo $bp->displayed_user->fullname; ?> | <?php _e( 'My Groups - Public Activity', 'buddypress' ) ?></title>
    2222    <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    23     <link><?php echo site_url( BP_ACTIVITY_SLUG . '/#my-groups/' ) ?></link>
     23    <link><?php echo home_url( bp_get_activity_root_slug() . '/#my-groups/' ) ?></link>
    2424    <description><?php echo $bp->displayed_user->fullname; ?> - <?php _e( 'My Groups - Public Activity', 'buddypress' ) ?></description>
    2525    <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
  • trunk/bp-blogs.php

    r3736 r3751  
    3030
    3131    // Notifications
    32     $bp->blogs->format_notification_function      = 'bp_blogs_format_notifications';
     32    $bp->blogs->notification_callback      = 'bp_blogs_format_notifications';
    3333
    3434    // Register this in the active components array
  • trunk/bp-core.php

    r3745 r3751  
    2828
    2929// Load the files containing functions that we globally will need.
     30require ( BP_PLUGIN_DIR . '/bp-core/bp-core-component.php'     );
    3031require ( BP_PLUGIN_DIR . '/bp-core/bp-core-hooks.php'         );
    3132require ( BP_PLUGIN_DIR . '/bp-core/bp-core-catchuri.php'      );
     
    132133    if ( !defined( 'BP_DEFAULT_COMPONENT' ) ) {
    133134        if ( isset( $bp->pages->activity ) )
    134             $bp->default_component = $bp->pages->activity->name;
     135            $bp->default_component = $bp->activity->id;
    135136        else
    136             $bp->default_component = $bp->pages->profile->name;
     137            $bp->default_component = $bp->profile->id;
    137138    } else {
    138139        $bp->default_component = BP_DEFAULT_COMPONENT;
     
    188189    do_action( 'bp_core_setup_globals' );
    189190}
    190 add_action( 'bp_setup_globals', 'bp_core_setup_globals' );
     191add_action( 'bp_setup_globals', 'bp_core_setup_globals', 1 );
    191192
    192193/**
  • trunk/bp-core/admin/bp-core-update.php

    r3745 r3751  
    323323
    324324    function step_pages() {
     325        global $bp;
     326
    325327        if ( !current_user_can( 'activate_plugins' ) )
    326328            return false;
    327329
     330        // Determine where to get the pages from
    328331        if ( !defined( 'BP_ENABLE_MULTIBLOG' ) && is_multisite() )
    329332            $existing_pages = get_blog_option( BP_ROOT_BLOG, 'bp-pages' );
     
    331334            $existing_pages = get_option( 'bp-pages' );
    332335
     336        // Get disabled components
    333337        $disabled_components = apply_filters( 'bp_deactivated_components', get_site_option( 'bp-deactivated-components' ) );
    334338
    335339        // Check for defined slugs
    336         if ( defined( 'BP_MEMBERS_SLUG' ) && BP_MEMBERS_SLUG )
    337             $members_slug = constant( 'BP_MEMBERS_SLUG' );
     340        if ( isset( $bp->members->slug ) )
     341            $members_slug = $bp->members->slug;
    338342        else
    339             $members_slug = __( 'members', 'buddypress' );
    340 
    341         if ( defined( 'BP_GROUPS_SLUG' ) && BP_GROUPS_SLUG )
     343            $members_slug = __( 'Members', 'buddypress' );
     344
     345        // Groups
     346        if ( isset( $bp->groups->slug ) )
    342347            $groups_slug = constant( 'BP_GROUPS_SLUG' );
    343348        else
    344             $groups_slug = __( 'groups', 'buddypress' );
    345 
    346         if ( defined( 'BP_ACTIVITY_SLUG' ) && BP_ACTIVITY_SLUG )
    347             $activity_slug = constant( 'BP_ACTIVITY_SLUG' );
     349            $groups_slug = __( 'Groups', 'buddypress' );
     350
     351        // Activity
     352        if ( isset( $bp->activity->slug ) )
     353            $activity_slug = $bp->activity->slug;
    348354        else
    349355            $activity_slug = __( 'activity', 'buddypress' );
    350356
    351         if ( defined( 'BP_FORUMS_SLUG' ) && BP_FORUMS_SLUG )
    352             $forums_slug = constant( 'BP_FORUMS_SLUG' );
     357        // Forums
     358        if ( isset( $bp->forums->slug ) )
     359            $forums_slug = $bp->forums->slug;
    353360        else
    354361            $forums_slug = __( 'forums', 'buddypress' );
    355362
    356         if ( defined( 'BP_BLOGS_SLUG' ) && BP_BLOGS_SLUG )
    357             $blogs_slug = constant( 'BP_BLOGS_SLUG' );
     363        // Blogs
     364        if ( isset( $bp->blogs->slug ) )
     365            $blogs_slug = $bp->blogs->slug;
    358366        else
    359367            $blogs_slug = __( 'blogs', 'buddypress' );
    360368
    361         if ( defined( 'BP_REGISTER_SLUG' ) && BP_REGISTER_SLUG )
    362             $register_slug = constant( 'BP_REGISTER_SLUG' );
     369        // Register
     370        if ( isset( $bp->register->slug ) )
     371            $register_slug = $bp->register->slug;
    363372        else
    364373            $register_slug = __( 'register', 'buddypress' );
    365374
    366         if ( defined( 'BP_ACTIVATION_SLUG' ) && BP_ACTIVATION_SLUG )
    367             $activation_slug = constant( 'BP_ACTIVATION_SLUG' );
     375        if ( isset( $bp->activation->slug ) )
     376            $activation_slug = $bp->activation->slug;
    368377        else
    369378            $activation_slug = __( 'activate', 'buddypress' );
    370379
     380        // What kind of setup is taking place
    371381        if ( 'new' == $this->setup_type ) : ?>
    372382
  • trunk/bp-core/bp-core-notifications.php

    r3357 r3751  
    6060                continue;
    6161
    62             if ( function_exists( $bp->{$component_name}->format_notification_function ) ) {
    63                 $renderable[] = call_user_func( $bp->{$component_name}->format_notification_function, $component_action_name, $component_action_items[0]->item_id, $component_action_items[0]->secondary_item_id, $action_item_count );
     62            if ( function_exists( $bp->{$component_name}->notification_callback ) ) {
     63                $renderable[] = call_user_func( $bp->{$component_name}->notification_callback, $component_action_name, $component_action_items[0]->item_id, $component_action_items[0]->secondary_item_id, $action_item_count );
    6464            }
    6565        }
  • trunk/bp-core/bp-core-templatetags.php

    r3749 r3751  
    390390
    391391        if ( !empty( $update['id'] ) )
    392             $update_content .= ' &middot; <a href="' . $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $update['id'] . '">' . __( 'View', 'buddypress' ) . '</a>';
     392            $update_content .= ' &middot; <a href="' . $bp->root_domain . '/' . $bp->activity->root_slug . '/p/' . $update['id'] . '">' . __( 'View', 'buddypress' ) . '</a>';
    393393
    394394        return apply_filters( 'bp_get_member_latest_update', $update_content );
     
    17741774}
    17751775
    1776 function bp_is_page($page) {
     1776function bp_is_page( $page ) {
    17771777    global $bp;
    17781778
     
    17961796
    17971797function bp_is_profile_component() {
    1798     if ( bp_is_current_component( BP_XPROFILE_SLUG ) )
     1798    if ( bp_is_current_component( 'xprofile' ) )
    17991799        return true;
    18001800
     
    18031803
    18041804function bp_is_activity_component() {
    1805     if ( defined( 'BP_ACTIVITY_SLUG' ) && bp_is_current_component( BP_ACTIVITY_SLUG ) )
     1805    if ( bp_is_current_component( 'activity' ) )
    18061806        return true;
    18071807
     
    18101810
    18111811function bp_is_blogs_component() {
    1812     if ( is_multisite() && defined( 'BP_BLOGS_SLUG' ) && bp_is_current_component( BP_BLOGS_SLUG ) )
     1812    if ( is_multisite() && bp_is_current_component( 'blogs' ) )
    18131813        return true;
    18141814
     
    18171817
    18181818function bp_is_messages_component() {
    1819     if ( defined( 'BP_MESSAGES_SLUG' ) && bp_is_current_component( BP_MESSAGES_SLUG ) )
     1819    if ( bp_is_current_component( 'messages' ) )
    18201820        return true;
    18211821
     
    18241824
    18251825function bp_is_friends_component() {
    1826     if ( defined( 'BP_FRIENDS_SLUG' ) && bp_is_current_component( BP_FRIENDS_SLUG ) )
     1826
     1827    if ( bp_is_current_component( 'friends' ) )
    18271828        return true;
    18281829
     
    18311832
    18321833function bp_is_groups_component() {
    1833     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) )
     1834    if ( bp_is_current_component( 'groups' ) )
    18341835        return true;
    18351836
     
    18381839
    18391840function bp_is_settings_component() {
    1840     if ( bp_is_current_component( BP_SETTINGS_SLUG ) )
     1841    if ( bp_is_current_component( 'settings' ) )
    18411842        return true;
    18421843
     
    18561857    global $bp;
    18571858
    1858     if ( !empty( $bp->activity->slug ) && bp_is_current_component( $bp->activity->slug ) )
     1859    if ( bp_is_current_component( 'activity' ) )
    18591860        return true;
    18601861
     
    18651866    global $bp;
    18661867
    1867     if ( !empty( $bp->activity->slug ) && bp_is_current_component( $bp->activity->slug ) && 'my-friends' == $bp->current_action )
     1868    if ( bp_is_current_component( 'activity' ) && 'my-friends' == $bp->current_action )
    18681869        return true;
    18691870
     
    18741875    global $bp;
    18751876
    1876     if ( defined( 'BP_ACTIVITY_SLUG' ) && bp_is_current_component( BP_ACTIVITY_SLUG ) && is_numeric( $bp->current_action ) )
     1877    if ( bp_is_current_component( 'activity' ) && is_numeric( $bp->current_action ) )
    18771878        return true;
    18781879
     
    18831884    global $bp;
    18841885
    1885     if ( defined( 'BP_XPROFILE_SLUG' ) && bp_is_current_component( BP_XPROFILE_SLUG ) || isset( $bp->core->profile->slug ) && bp_is_current_component( $bp->core->profile->slug ) )
     1886    if ( bp_is_current_component( 'xprofile' ) )
    18861887        return true;
    18871888
     
    18921893    global $bp;
    18931894
    1894     if ( defined( 'BP_XPROFILE_SLUG' ) && bp_is_current_component( BP_XPROFILE_SLUG ) && 'edit' == $bp->current_action )
     1895    if ( bp_is_current_component( 'xprofile' ) && 'edit' == $bp->current_action )
    18951896        return true;
    18961897
     
    19011902    global $bp;
    19021903
    1903     if ( defined( 'BP_XPROFILE_SLUG' ) && bp_is_current_component( BP_XPROFILE_SLUG ) && 'change-avatar' == $bp->current_action )
     1904    if ( bp_is_current_component( 'xprofile' ) && 'change-avatar' == $bp->current_action )
    19041905        return true;
    19051906
     
    19101911    global $bp;
    19111912
    1912     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) )
     1913    if ( bp_is_current_component( 'groups' ) )
    19131914        return true;
    19141915
     
    19191920    global $bp;
    19201921
    1921     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && isset( $bp->groups->current_group ) && $bp->groups->current_group )
     1922    if ( bp_is_current_component( 'groups' ) && isset( $bp->groups->current_group ) && $bp->groups->current_group )
    19221923        return true;
    19231924
     
    19281929    global $bp;
    19291930
    1930     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && $bp->is_single_item && ( !$bp->current_action || 'home' == $bp->current_action ) )
     1931    if ( bp_is_current_component( 'groups' ) && $bp->is_single_item && ( !$bp->current_action || 'home' == $bp->current_action ) )
    19311932        return true;
    19321933
     
    19371938    global $bp;
    19381939
    1939     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && 'create' == $bp->current_action )
     1940    if ( bp_is_current_component( 'groups' ) && 'create' == $bp->current_action )
    19401941        return true;
    19411942
     
    19471948    global $bp;
    19481949
    1949     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && $bp->is_single_item && 'admin' == $bp->current_action )
     1950    if ( bp_is_current_component( 'groups' ) && $bp->is_single_item && 'admin' == $bp->current_action )
    19501951        return true;
    19511952
     
    19561957    global $bp;
    19571958
    1958     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && $bp->is_single_item && 'forum' == $bp->current_action )
     1959    if ( bp_is_current_component( 'groups' ) && $bp->is_single_item && 'forum' == $bp->current_action )
    19591960        return true;
    19601961
     
    19651966    global $bp;
    19661967
    1967     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && $bp->is_single_item && 'activity' == $bp->current_action )
     1968    if ( bp_is_current_component( 'groups' ) && $bp->is_single_item && 'activity' == $bp->current_action )
    19681969        return true;
    19691970
     
    19741975    global $bp;
    19751976
    1976     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && $bp->is_single_item && 'forum' == $bp->current_action && isset( $bp->action_variables[0] ) && 'topic' == $bp->action_variables[0] )
     1977    if ( bp_is_current_component( 'groups' ) && $bp->is_single_item && 'forum' == $bp->current_action && isset( $bp->action_variables[0] ) && 'topic' == $bp->action_variables[0] )
    19771978        return true;
    19781979
     
    19831984    global $bp;
    19841985
    1985     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && $bp->is_single_item && 'forum' == $bp->current_action && isset( $bp->action_variables[0] ) && 'topic' == $bp->action_variables[0] && isset( $bp->action_variables[2] ) && 'edit' == $bp->action_variables[2] )
     1986    if ( bp_is_current_component( 'groups' ) && $bp->is_single_item && 'forum' == $bp->current_action && isset( $bp->action_variables[0] ) && 'topic' == $bp->action_variables[0] && isset( $bp->action_variables[2] ) && 'edit' == $bp->action_variables[2] )
    19861987        return true;
    19871988
     
    19921993    global $bp;
    19931994
    1994     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && $bp->is_single_item && 'members' == $bp->current_action )
     1995    if ( bp_is_current_component( 'groups' ) && $bp->is_single_item && 'members' == $bp->current_action )
    19951996        return true;
    19961997
     
    20012002    global $bp;
    20022003
    2003     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && 'send-invites' == $bp->current_action )
     2004    if ( bp_is_current_component( 'groups' ) && 'send-invites' == $bp->current_action )
    20042005        return true;
    20052006
     
    20102011    global $bp;
    20112012
    2012     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && 'request-membership' == $bp->current_action )
     2013    if ( bp_is_current_component( 'groups' ) && 'request-membership' == $bp->current_action )
    20132014        return true;
    20142015
     
    20192020    global $bp;
    20202021
    2021     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && $bp->is_single_item && 'leave-group' == $bp->current_action )
     2022    if ( bp_is_current_component( 'groups' ) && $bp->is_single_item && 'leave-group' == $bp->current_action )
    20222023        return true;
    20232024
     
    20282029    global $bp;
    20292030
    2030     if ( defined( 'BP_GROUPS_SLUG' ) && bp_is_current_component( BP_GROUPS_SLUG ) && $bp->is_single_item )
     2031    if ( bp_is_current_component( 'groups' ) && $bp->is_single_item )
    20312032        return true;
    20322033
     
    20372038    global $bp;
    20382039
    2039     if ( is_multisite() && defined( 'BP_BLOGS_SLUG' ) && bp_is_current_component( BP_BLOGS_SLUG ) )
     2040    if ( is_multisite() && bp_is_current_component( 'blogs' ) )
    20402041        return true;
    20412042
     
    20462047    global $bp;
    20472048
    2048     if ( is_multisite() && defined( 'BP_BLOGS_SLUG' ) && bp_is_current_component( BP_BLOGS_SLUG ) && 'recent-posts' == $bp->current_action )
     2049    if ( is_multisite() && bp_is_current_component( 'blogs' ) && 'recent-posts' == $bp->current_action )
    20492050        return true;
    20502051
     
    20552056    global $bp;
    20562057
    2057     if ( is_multisite() && defined( 'BP_BLOGS_SLUG' ) && bp_is_current_component( BP_BLOGS_SLUG ) && 'recent-comments' == $bp->current_action )
     2058    if ( is_multisite() && bp_is_current_component( 'blogs' ) && 'recent-comments' == $bp->current_action )
    20582059        return true;
    20592060
     
    20642065    global $bp;
    20652066
    2066     if ( is_multisite() && defined( 'BP_BLOGS_SLUG' ) && bp_is_current_component( BP_BLOGS_SLUG ) && 'create' == $bp->current_action )
     2067    if ( is_multisite() && bp_is_current_component( 'blogs' ) && 'create' == $bp->current_action )
    20672068        return true;
    20682069
     
    20712072
    20722073function bp_is_user_friends() {
    2073     if ( defined( 'BP_FRIENDS_SLUG' ) && bp_is_current_component( BP_FRIENDS_SLUG ) )
     2074
     2075    if ( bp_is_current_component( 'friends' ) )
    20742076        return true;
    20752077
     
    20802082    global $bp;
    20812083
    2082     if ( defined( 'BP_FRIENDS_SLUG' ) && bp_is_current_component( BP_FRIENDS_SLUG ) && 'requests' == $bp->current_action )
     2084    if ( bp_is_current_component( 'friends' ) && 'requests' == $bp->current_action )
    20832085        return true;
    20842086
     
    20872089
    20882090function bp_is_user_messages() {
    2089     if ( defined( 'BP_MESSAGES_SLUG' ) && bp_is_current_component( BP_MESSAGES_SLUG ) )
     2091
     2092    if ( bp_is_current_component( 'messages' ) )
    20902093        return true;
    20912094
     
    20962099    global $bp;
    20972100
    2098     if ( defined( 'BP_MESSAGES_SLUG' ) && bp_is_current_component( BP_MESSAGES_SLUG ) && ( !$bp->current_action || 'inbox' == $bp->current_action ) )
     2101    if ( bp_is_current_component( 'messages' ) && ( !$bp->current_action || 'inbox' == $bp->current_action ) )
    20992102        return true;
    21002103
     
    21052108    global $bp;
    21062109
    2107     if ( defined( 'BP_MESSAGES_SLUG' ) && bp_is_current_component( BP_MESSAGES_SLUG ) && 'sentbox' == $bp->current_action )
     2110    if ( bp_is_current_component( 'messages' ) && 'sentbox' == $bp->current_action )
    21082111        return true;
    21092112
     
    21152118    global $bp;
    21162119
    2117     if ( defined( 'BP_MESSAGES_SLUG' ) && bp_is_current_component( BP_MESSAGES_SLUG ) && 'notices' == $bp->current_action )
     2120    if ( bp_is_current_component( 'messages' ) && 'notices' == $bp->current_action )
    21182121        return true;
    21192122
     
    21252128    global $bp;
    21262129
    2127     if ( defined( 'BP_MESSAGES_SLUG' ) && bp_is_current_component( BP_MESSAGES_SLUG ) && 'compose' == $bp->current_action )
     2130    if ( bp_is_current_component( 'messages' ) && 'compose' == $bp->current_action )
    21282131        return true;
    21292132
     
    21412144
    21422145function bp_is_activation_page() {
    2143     if ( bp_is_current_component( BP_ACTIVATION_SLUG ) )
     2146    if ( bp_is_current_component( 'activation' ) )
    21442147        return true;
    21452148
     
    21482151
    21492152function bp_is_register_page() {
    2150     if ( bp_is_current_component( BP_REGISTER_SLUG ) )
     2153    if ( bp_is_current_component( 'register' ) )
    21512154        return true;
    21522155
  • trunk/bp-core/css/admin.dev.css

    r3745 r3751  
    1 html {
    2     padding-top: 28px !important;
    3 }
    4 
    51div#bp-admin {
    62    margin: 25px 15px 25px 0;
  • trunk/bp-friends.php

    r3742 r3751  
    2424
    2525    // Notifications
    26     $bp->friends->format_notification_function = 'friends_format_notifications';
     26    $bp->friends->notification_callback = 'friends_format_notifications';
    2727
    2828    // Register this in the active components array
  • trunk/bp-groups.php

    r3728 r3751  
    3434
    3535    // Notifications
    36     $bp->groups->format_notification_function = 'groups_format_notifications';
     36    $bp->groups->notification_callback = 'groups_format_notifications';
    3737
    3838    // Register this in the active components array
  • trunk/bp-messages.php

    r3728 r3751  
    2525
    2626    // Notifications
    27     $bp->messages->format_notification_function = 'messages_format_notifications';
     27    $bp->messages->notification_callback = 'messages_format_notifications';
    2828
    2929    // Register this in the active components array
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r3698 r3751  
    9595add_action( 'wp_ajax_forums_filter', 'bp_dtheme_object_template_loader' );
    9696
    97 /* This function will load the activity loop template when activity is requested via AJAX */
     97// This function will load the activity loop template when activity is requested via AJAX
    9898function bp_dtheme_activity_template_loader() {
    9999    global $bp;
    100100
    101     /* We need to calculate and return the feed URL for each scope */
    102     $feed_url = site_url( BP_ACTIVITY_SLUG . '/feed/' );
     101    // We need to calculate and return the feed URL for each scope
     102    $feed_url = home_url( bp_get_activity_root_slug() . '/feed/' );
    103103
    104104    switch ( $_POST['scope'] ) {
    105105        case 'friends':
    106             $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/friends/feed/';
     106            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/friends/feed/';
    107107            break;
    108108        case 'groups':
    109             $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/groups/feed/';
     109            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/groups/feed/';
    110110            break;
    111111        case 'favorites':
    112             $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/favorites/feed/';
     112            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/favorites/feed/';
    113113            break;
    114114        case 'mentions':
    115             $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/mentions/feed/';
     115            $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/mentions/feed/';
    116116            delete_user_meta( $bp->loggedin_user->id, 'bp_new_mention_count' );
    117117            break;
  • trunk/bp-themes/bp-default/activity/index.php

    r3698 r3751  
     1<?php
     2
     3/**
     4 * Template Name: BuddyPress - Activity Directory
     5 *
     6 * @package bbPress
     7 * @subpackage Theme
     8 */
     9
     10?>
     11
    112<?php get_header() ?>
    213
     
    516
    617            <?php if ( !is_user_logged_in() ) : ?>
     18
    719                <h3><?php _e( 'Site Activity', 'buddypress' ) ?></h3>
     20
    821            <?php endif; ?>
    922
     
    1124
    1225            <?php if ( is_user_logged_in() ) : ?>
     26
    1327                <?php locate_template( array( 'activity/post-form.php'), true ) ?>
     28
    1429            <?php endif; ?>
    1530
     
    2035                    <?php do_action( 'bp_before_activity_type_tab_all' ) ?>
    2136
    22                     <li class="selected" id="activity-all"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/' ?>" title="<?php _e( 'The public activity for everyone on this site.', 'buddypress' ) ?>"><?php printf( __( 'All Members (%s)', 'buddypress' ), bp_get_total_site_member_count() ) ?></a></li>
     37                    <li class="selected" id="activity-all"><a href="<?php echo bp_loggedin_user_domain() . bp_get_group_slug() . '/' ?>" title="<?php _e( 'The public activity for everyone on this site.', 'buddypress' ) ?>"><?php printf( __( 'All Members (%s)', 'buddypress' ), bp_get_total_site_member_count() ) ?></a></li>
    2338
    2439                    <?php if ( is_user_logged_in() ) : ?>
     
    2742
    2843                        <?php if ( bp_is_active( 'friends' ) ) : ?>
     44
    2945                            <?php if ( bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
    30                                 <li id="activity-friends"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/' . BP_FRIENDS_SLUG . '/' ?>" title="<?php _e( 'The activity of my friends only.', 'buddypress' ) ?>"><?php printf( __( 'My Friends (%s)', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ) ?></a></li>
     46
     47                                <li id="activity-friends"><a href="<?php echo bp_loggedin_user_domain() . bp_get_group_slug() . '/' . BP_FRIENDS_SLUG . '/' ?>" title="<?php _e( 'The activity of my friends only.', 'buddypress' ) ?>"><?php printf( __( 'My Friends (%s)', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ) ?></a></li>
     48
    3149                            <?php endif; ?>
     50
    3251                        <?php endif; ?>
    3352
     
    3554
    3655                        <?php if ( bp_is_active( 'groups' ) ) : ?>
     56
    3757                            <?php if ( bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) : ?>
    38                                 <li id="activity-groups"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/' . BP_GROUPS_SLUG . '/' ?>" title="<?php _e( 'The activity of groups I am a member of.', 'buddypress' ) ?>"><?php printf( __( 'My Groups (%s)', 'buddypress' ), bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>
     58
     59                                <li id="activity-groups"><a href="<?php echo bp_loggedin_user_domain() . bp_get_group_slug() . '/' . BP_GROUPS_SLUG . '/' ?>" title="<?php _e( 'The activity of groups I am a member of.', 'buddypress' ) ?>"><?php printf( __( 'My Groups (%s)', 'buddypress' ), bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>
     60
    3961                            <?php endif; ?>
     62
    4063                        <?php endif; ?>
    4164
     
    4366
    4467                        <?php if ( bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) : ?>
    45                             <li id="activity-favorites"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/favorites/' ?>" title="<?php _e( "The activity I've marked as a favorite.", 'buddypress' ) ?>"><?php printf( __( 'My Favorites (<span>%s</span>)', 'buddypress' ), bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>
     68
     69                            <li id="activity-favorites"><a href="<?php echo bp_loggedin_user_domain() . bp_get_group_slug() . '/favorites/' ?>" title="<?php _e( "The activity I've marked as a favorite.", 'buddypress' ) ?>"><?php printf( __( 'My Favorites (<span>%s</span>)', 'buddypress' ), bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>
     70
    4671                        <?php endif; ?>
    4772
    4873                        <?php do_action( 'bp_before_activity_type_tab_mentions' ) ?>
    4974
    50                         <li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/mentions/' ?>" title="<?php _e( 'Activity that I have been mentioned in.', 'buddypress' ) ?>"><?php printf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() ) ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><?php printf( __( '(%s new)', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) ?></strong><?php endif; ?></a></li>
     75                        <li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . bp_get_group_slug() . '/mentions/' ?>" title="<?php _e( 'Activity that I have been mentioned in.', 'buddypress' ) ?>"><?php printf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() ) ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><?php printf( __( '(%s new)', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) ?></strong><?php endif; ?></a></li>
    5176
    5277                    <?php endif; ?>
     
    6893
    6994                            <?php if ( bp_is_active( 'blogs' ) ) : ?>
     95
    7096                                <option value="new_blog_post"><?php _e( 'Show Blog Posts', 'buddypress' ) ?></option>
    7197                                <option value="new_blog_comment"><?php _e( 'Show Blog Comments', 'buddypress' ) ?></option>
     98
    7299                            <?php endif; ?>
    73100
    74101                            <?php if ( bp_is_active( 'forums' ) ) : ?>
    75                                 <option value="new_forum_topic"><?php _e( 'Show New Forum Topics', 'buddypress' ) ?></option>
    76                                 <option value="new_forum_post"><?php _e( 'Show Forum Replies', 'buddypress' ) ?></option>
     102
     103                                <option value="new_forum_topic"><?php _e( 'Show New Forum Topics', 'buddypress' ); ?></option>
     104                                <option value="new_forum_post"><?php _e( 'Show Forum Replies', 'buddypress' ); ?></option>
     105
    77106                            <?php endif; ?>
    78107
    79108                            <?php if ( bp_is_active( 'groups' ) ) : ?>
    80                                 <option value="created_group"><?php _e( 'Show New Groups', 'buddypress' ) ?></option>
    81                                 <option value="joined_group"><?php _e( 'Show New Group Memberships', 'buddypress' ) ?></option>
     109
     110                                <option value="created_group"><?php _e( 'Show New Groups', 'buddypress' ); ?></option>
     111                                <option value="joined_group"><?php _e( 'Show New Group Memberships', 'buddypress' ); ?></option>
     112
    82113                            <?php endif; ?>
    83114
    84115                            <?php if ( bp_is_active( 'friends' ) ) : ?>
    85                                 <option value="friendship_accepted,friendship_created"><?php _e( 'Show Friendship Connections', 'buddypress' ) ?></option>
     116
     117                                <option value="friendship_accepted,friendship_created"><?php _e( 'Show Friendship Connections', 'buddypress' ); ?></option>
     118
    86119                            <?php endif; ?>
    87120
    88                             <option value="new_member"><?php _e( 'Show New Members', 'buddypress' ) ?></option>
     121                            <option value="new_member"><?php _e( 'Show New Members', 'buddypress' ); ?></option>
    89122
    90                             <?php do_action( 'bp_activity_filter_options' ) ?>
     123                            <?php do_action( 'bp_activity_filter_options' ); ?>
     124
    91125                        </select>
    92126                    </li>
     
    97131
    98132            <div class="activity" role="main">
     133
    99134                <?php locate_template( array( 'activity/activity-loop.php' ), true ) ?>
     135
    100136            </div><!-- .activity -->
    101137
     
    107143    </div><!-- #content -->
    108144
    109     <?php get_sidebar() ?>
     145<?php get_sidebar() ?>
    110146
    111147<?php get_footer() ?>
  • trunk/bp-xprofile.php

    r3728 r3751  
    4343
    4444    // Notifications
    45     $bp->profile->format_notification_function = 'xprofile_format_notifications';
     45    $bp->profile->notification_callback = 'xprofile_format_notifications';
    4646
    4747    // Register this in the active components array
Note: See TracChangeset for help on using the changeset viewer.