Skip to:
Content

BuddyPress.org

Ticket #2676: redo-merge.patch

File redo-merge.patch, 248.8 KB (added by boonebgorges, 14 years ago)
  • bp-friends.php

     
    102102
    103103function friends_screen_notification_settings() {
    104104        global $current_user; ?>
    105         <table class="notification-settings" id="friends-notification-settings">
    106                 <tr>
    107                         <th class="icon"></th>
    108                         <th class="title"><?php _e( 'Friends', 'buddypress' ) ?></th>
    109                         <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
    110                         <th class="no"><?php _e( 'No', 'buddypress' )?></th>
    111                 </tr>
    112                 <tr>
    113                         <td></td>
    114                         <td><?php _e( 'A member sends you a friendship request', 'buddypress' ) ?></td>
    115                         <td class="yes"><input type="radio" name="notifications[notification_friends_friendship_request]" value="yes" <?php if ( !get_usermeta( $current_user->id,'notification_friends_friendship_request') || 'yes' == get_usermeta( $current_user->id,'notification_friends_friendship_request') ) { ?>checked="checked" <?php } ?>/></td>
    116                         <td class="no"><input type="radio" name="notifications[notification_friends_friendship_request]" value="no" <?php if ( get_usermeta( $current_user->id,'notification_friends_friendship_request') == 'no' ) { ?>checked="checked" <?php } ?>/></td>
    117                 </tr>
    118                 <tr>
    119                         <td></td>
    120                         <td><?php _e( 'A member accepts your friendship request', 'buddypress' ) ?></td>
    121                         <td class="yes"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="yes" <?php if ( !get_usermeta( $current_user->id,'notification_friends_friendship_accepted') || 'yes' == get_usermeta( $current_user->id,'notification_friends_friendship_accepted') ) { ?>checked="checked" <?php } ?>/></td>
    122                         <td class="no"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id,'notification_friends_friendship_accepted') ) { ?>checked="checked" <?php } ?>/></td>
    123                 </tr>
     105        <table class="notification-settings zebra" id="friends-notification-settings">
     106                <thead>
     107                        <tr>
     108                                <th class="icon"></th>
     109                                <th class="title"><?php _e( 'Friends', 'buddypress' ) ?></th>
     110                                <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
     111                                <th class="no"><?php _e( 'No', 'buddypress' )?></th>
     112                        </tr>
     113                </thead>
    124114
    125                 <?php do_action( 'friends_screen_notification_settings' ); ?>
     115                <tbody>
     116                        <tr>
     117                                <td></td>
     118                                <td><?php _e( 'A member sends you a friendship request', 'buddypress' ) ?></td>
     119                                <td class="yes"><input type="radio" name="notifications[notification_friends_friendship_request]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_friends_friendship_request', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_friends_friendship_request', true ) ) { ?>checked="checked" <?php } ?>/></td>
     120                                <td class="no"><input type="radio" name="notifications[notification_friends_friendship_request]" value="no" <?php if ( get_user_meta( $current_user->id, 'notification_friends_friendship_request', true ) == 'no' ) { ?>checked="checked" <?php } ?>/></td>
     121                        </tr>
     122                        <tr>
     123                                <td></td>
     124                                <td><?php _e( 'A member accepts your friendship request', 'buddypress' ) ?></td>
     125                                <td class="yes"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_friends_friendship_accepted', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_friends_friendship_accepted', true ) ) { ?>checked="checked" <?php } ?>/></td>
     126                                <td class="no"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_friends_friendship_accepted', true ) ) { ?>checked="checked" <?php } ?>/></td>
     127                        </tr>
     128
     129                        <?php do_action( 'friends_screen_notification_settings' ); ?>
     130                </tbody>
    126131        </table>
    127132<?php
    128133}
     
    236241                'type' => false,
    237242                'item_id' => false,
    238243                'secondary_item_id' => false,
    239                 'recorded_time' => gmdate( "Y-m-d H:i:s" ),
     244                'recorded_time' => bp_core_current_time(),
    240245                'hide_sitewide' => false
    241246        );
    242247
     
    317322        $friendship->friend_user_id = $friend_userid;
    318323        $friendship->is_confirmed = 0;
    319324        $friendship->is_limited = 0;
    320         $friendship->date_created = time();
     325        $friendship->date_created = bp_core_current_time();
    321326
    322327        if ( $force_accept )
    323328                $friendship->is_confirmed = 1;
     
    371376        if ( !$friendship->is_confirmed && BP_Friends_Friendship::accept( $friendship_id ) ) {
    372377                friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id );
    373378
    374                 /* Remove the friend request notice */
     379                // Remove the friend request notice
    375380                bp_core_delete_notifications_for_user_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' );
    376381
    377                 /* Add a friend accepted notice for the initiating user */
     382                // Add a friend accepted notice for the initiating user
    378383                bp_core_add_notification( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_accepted' );
    379384
    380385                $initiator_link = bp_core_get_userlink( $friendship->initiator_user_id );
    381386                $friend_link = bp_core_get_userlink( $friendship->friend_user_id );
    382387
    383                 /* Record in activity streams for the initiator */
     388                // Record in activity streams for the initiator
    384389                friends_record_activity( array(
    385390                        'user_id' => $friendship->initiator_user_id,
    386391                        'type' => 'friendship_created',
    387392                        'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%1$s and %2$s are now friends', 'buddypress' ), $initiator_link, $friend_link ), &$friendship ),
    388                         'item_id' => $friendship_id
     393                        'item_id' => $friendship_id,
     394                        'secondary_item_id' => $friendship->friend_user-id
    389395                ) );
    390396
    391                 /* Record in activity streams for the friend */
     397                // Record in activity streams for the friend
    392398                friends_record_activity( array(
    393399                        'user_id' => $friendship->friend_user_id,
    394400                        'type' => 'friendship_created',
    395401                        'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%1$s and %2$s are now friends', 'buddypress' ), $friend_link, $initiator_link ), &$friendship ),
    396402                        'item_id' => $friendship_id,
     403                        'secondary_item_id' => $friendship->initiator_user_id,
    397404                        'hide_sitewide' => true /* We've already got the first entry site wide */
    398405                ) );
    399406
    400                 /* Send the email notification */
     407                // Send the email notification
    401408                require_once( BP_PLUGIN_DIR . '/bp-friends/bp-friends-notifications.php' );
    402409                friends_notification_accepted_request( $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
    403410
     
    443450                $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
    444451
    445452        if ( !$count = wp_cache_get( 'bp_total_friend_count_' . $user_id, 'bp' ) ) {
    446                 $count = get_usermeta( $user_id, 'total_friend_count' );
     453                $count = get_user_meta( $user_id, 'total_friend_count', true );
    447454                if ( empty( $count ) ) $count = 0;
    448455                wp_cache_set( 'bp_total_friend_count_' . $user_id, $count, 'bp' );
    449456        }
     
    546553
    547554function friends_update_friend_totals( $initiator_user_id, $friend_user_id, $status = 'add' ) {
    548555        if ( 'add' == $status ) {
    549                 update_usermeta( $initiator_user_id, 'total_friend_count', (int)get_usermeta( $initiator_user_id, 'total_friend_count' ) + 1 );
    550                 update_usermeta( $friend_user_id, 'total_friend_count', (int)get_usermeta( $friend_user_id, 'total_friend_count' ) + 1 );
     556                update_user_meta( $initiator_user_id, 'total_friend_count', (int)get_user_meta( $initiator_user_id, 'total_friend_count', true ) + 1 );
     557                update_user_meta( $friend_user_id, 'total_friend_count', (int)get_user_meta( $friend_user_id, 'total_friend_count', true ) + 1 );
    551558        } else {
    552                 update_usermeta( $initiator_user_id, 'total_friend_count', (int)get_usermeta( $initiator_user_id, 'total_friend_count' ) - 1 );
    553                 update_usermeta( $friend_user_id, 'total_friend_count', (int)get_usermeta( $friend_user_id, 'total_friend_count' ) - 1 );
     559                update_user_meta( $initiator_user_id, 'total_friend_count', (int)get_user_meta( $initiator_user_id, 'total_friend_count', true ) - 1 );
     560                update_user_meta( $friend_user_id, 'total_friend_count', (int)get_user_meta( $friend_user_id, 'total_friend_count', true ) - 1 );
    554561        }
    555562}
    556563
     
    558565        BP_Friends_Friendship::delete_all_for_user($user_id);
    559566
    560567        /* Remove usermeta */
    561         delete_usermeta( $user_id, 'total_friend_count' );
     568        delete_user_meta( $user_id, 'total_friend_count' );
    562569
    563570        /* Remove friendship requests FROM user */
    564571        bp_core_delete_notifications_from_user( $user_id, $bp->friends->id, 'friendship_request' );
  • bp-activity.php

     
    44require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-filters.php' );
    55
    66function bp_activity_setup_globals() {
    7         global $bp, $wpdb, $current_blog;
     7        global $bp, $wpdb;
    88
    99        if ( !defined( 'BP_ACTIVITY_SLUG' ) )
    1010                define ( 'BP_ACTIVITY_SLUG', $bp->pages->activity->slug );
    1111
    12         /* For internal identification */
     12        // For internal identification
    1313        $bp->activity->id = 'activity';
    1414        $bp->activity->name = $bp->pages->activity->name;
    1515        $bp->activity->slug = BP_ACTIVITY_SLUG;
     
    1818        $bp->activity->table_name_meta = $wpdb->base_prefix . 'bp_activity_meta';
    1919        $bp->activity->format_notification_function = 'bp_activity_format_notifications';
    2020
    21         /* Register this in the active components array */
     21        // Register this in the active components array
    2222        $bp->active_components[$bp->activity->slug] = $bp->activity->id;
    2323
    2424        do_action( 'bp_activity_setup_globals' );
     
    9292        if ( !bp_is_active( 'friends' ) )
    9393                return false;
    9494
    95         if ( !is_site_admin() )
     95        if ( !is_super_admin() )
    9696                $bp->is_item_admin = false;
    9797
    9898        do_action( 'bp_activity_screen_friends' );
     
    105105        if ( !bp_is_active( 'groups' ) )
    106106                return false;
    107107
    108         if ( !is_site_admin() )
     108        if ( !is_super_admin() )
    109109                $bp->is_item_admin = false;
    110110
    111111        do_action( 'bp_activity_screen_groups' );
     
    115115function bp_activity_screen_favorites() {
    116116        global $bp;
    117117
    118         if ( !is_site_admin() )
     118        if ( !is_super_admin() )
    119119                $bp->is_item_admin = false;
    120120
    121121        do_action( 'bp_activity_screen_favorites' );
     
    125125function bp_activity_screen_mentions() {
    126126        global $bp;
    127127
    128         if ( !is_site_admin() )
     128        if ( !is_super_admin() )
    129129                $bp->is_item_admin = false;
    130130
    131131        do_action( 'bp_activity_screen_mentions' );
     
    172172                if ( is_user_logged_in() )
    173173                        bp_core_redirect( $bp->loggedin_user->domain );
    174174                else
    175                         bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . clean_url( $bp->root_domain . '/' . $bp->activity->slug . '/p/' . $bp->current_action ) ) );
     175                        bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . esc_url( $bp->root_domain . '/' . $bp->activity->slug . '/p/' . $bp->current_action ) ) );
    176176        }
    177177
    178178        bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink' ) );
     
    182182
    183183function bp_activity_screen_notification_settings() {
    184184        global $bp; ?>
    185         <table class="notification-settings" id="activity-notification-settings">
    186                 <tr>
    187                         <th class="icon"></th>
    188                         <th class="title"><?php _e( 'Activity', 'buddypress' ) ?></th>
    189                         <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
    190                         <th class="no"><?php _e( 'No', 'buddypress' )?></th>
    191                 </tr>
     185        <table class="notification-settings zebra" id="activity-notification-settings">
     186                <thead>
     187                        <tr>
     188                                <th class="icon"></th>
     189                                <th class="title"><?php _e( 'Activity', 'buddypress' ) ?></th>
     190                                <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
     191                                <th class="no"><?php _e( 'No', 'buddypress' )?></th>
     192                        </tr>
     193                </thead>
    192194
    193                 <tr>
    194                         <td></td>
    195                         <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( $bp->loggedin_user->id, $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login ) ) ?></td>
    196                         <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php if ( !get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_mention' ) || 'yes' == get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_mention' ) ) { ?>checked="checked" <?php } ?>/></td>
    197                         <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php if ( 'no' == get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_mention' ) ) { ?>checked="checked" <?php } ?>/></td>
    198                 </tr>
    199                 <tr>
    200                         <td></td>
    201                         <td><?php printf( __( "A member replies to an update or comment you've posted", 'buddypress' ), $current_user->user_login ) ?></td>
    202                         <td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" value="yes" <?php if ( !get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_reply' ) || 'yes' == get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_reply' ) ) { ?>checked="checked" <?php } ?>/></td>
    203                         <td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php if ( 'no' == get_usermeta( $bp->loggedin_user->id, 'notification_activity_new_reply' ) ) { ?>checked="checked" <?php } ?>/></td>
    204                 </tr>
     195                <tbody>
     196                        <tr>
     197                                <td></td>
     198                                <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( $bp->loggedin_user->id, $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login ) ) ?></td>
     199                                <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php if ( !get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_mention', true ) || 'yes' == get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_mention', true ) ) { ?>checked="checked" <?php } ?>/></td>
     200                                <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php if ( 'no' == get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_mention', true ) ) { ?>checked="checked" <?php } ?>/></td>
     201                        </tr>
     202                        <tr>
     203                                <td></td>
     204                                <td><?php printf( __( "A member replies to an update or comment you've posted", 'buddypress' ), $current_user->user_login ) ?></td>
     205                                <td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" value="yes" <?php if ( !get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_reply', true ) || 'yes' == get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_reply', true ) ) { ?>checked="checked" <?php } ?>/></td>
     206                                <td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php if ( 'no' == get_user_meta( $bp->loggedin_user->id, 'notification_activity_new_reply', true ) ) { ?>checked="checked" <?php } ?>/></td>
     207                        </tr>
    205208
    206                 <?php do_action( 'bp_activity_screen_notification_settings' ) ?>
     209                        <?php do_action( 'bp_activity_screen_notification_settings' ) ?>
     210                </tbody>
    207211        </table>
    208212<?php
    209213}
     
    270274        $activity = new BP_Activity_Activity( $activity_id );
    271275
    272276        /* Check access */
    273         if ( !is_site_admin() && $activity->user_id != $bp->loggedin_user->id )
     277        if ( !is_super_admin() && $activity->user_id != $bp->loggedin_user->id )
    274278                return false;
    275279
    276280        /* Call the action before the delete so plugins can still fetch information about it */
     
    540544}
    541545
    542546function bp_activity_add( $args = '' ) {
    543         global $bp, $wpdb;
     547        global $bp;
    544548
    545549        $defaults = array(
    546                 'id' => false, // Pass an existing activity ID to update an existing entry.
     550                'id'                => false, // Pass an existing activity ID to update an existing entry.
    547551
    548                 'action' => '', // The activity action - e.g. "Jon Doe posted an update"
    549                 'content' => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"
     552                'action'            => '', // The activity action - e.g. "Jon Doe posted an update"
     553                'content'           => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"
    550554
    551                 'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent
    552                 'type' => false, // The activity type e.g. activity_update, profile_updated
    553                 'primary_link' => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
     555                'component'         => false, // The name/ID of the component e.g. groups, profile, mycomponent
     556                'type'              => false, // The activity type e.g. activity_update, profile_updated
     557                'primary_link'      => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)
    554558
    555                 '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.
    556                 'item_id' => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id
     559                '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.
     560                'item_id'           => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id
    557561                'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id
    558                 'recorded_time' => gmdate( "Y-m-d H:i:s" ), // The GMT time that this activity was recorded
    559                 'hide_sitewide' => false // Should this be hidden on the sitewide activity stream?
     562                'recorded_time'     => bp_core_current_time(), // The GMT time that this activity was recorded
     563                'hide_sitewide'     => false // Should this be hidden on the sitewide activity stream?
    560564        );
    561565
    562566        $params = wp_parse_args( $args, $defaults );
     
    627631        ) );
    628632
    629633        /* Add this update to the "latest update" usermeta so it can be fetched anywhere. */
    630         update_usermeta( $bp->loggedin_user->id, 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
     634        update_user_meta( $bp->loggedin_user->id, 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
    631635
    632636        /* Require the notifications code so email notifications can be set on the 'bp_activity_posted_update' action. */
    633637        require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-notifications.php' );
     
    754758        else
    755759                $user_id = $args['user_id'];
    756760
    757         $latest_update = get_usermeta( $user_id, 'bp_latest_update' );
     761        $latest_update = get_user_meta( $user_id, 'bp_latest_update', true );
    758762        if ( !empty( $latest_update ) ) {
    759763                if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) )
    760                         delete_usermeta( $user_id, 'bp_latest_update' );
     764                        delete_user_meta( $user_id, 'bp_latest_update' );
    761765        }
    762766
    763767        do_action( 'bp_activity_delete', $args );
     
    908912}
    909913
    910914function bp_activity_get_user_favorites( $user_id ) {
    911         $my_favs = maybe_unserialize( get_usermeta( $user_id, 'bp_favorite_activities' ) );
     915        $my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) );
    912916        $existing_favs = bp_activity_get_specific( array( 'activity_ids' => $my_favs ) );
    913917
    914918        foreach( (array)$existing_favs['activities'] as $fav )
    915919                $new_favs[] = $fav->id;
    916920
    917921        $new_favs = array_unique( (array)$new_favs );
    918         update_usermeta( $user_id, 'bp_favorite_activities', $new_favs );
     922        update_user_meta( $user_id, 'bp_favorite_activities', $new_favs );
    919923
    920924        return apply_filters( 'bp_activity_get_user_favorites', $new_favs );
    921925}
     
    927931                $user_id = $bp->loggedin_user->id;
    928932
    929933        /* Update the user's personal favorites */
    930         $my_favs = maybe_unserialize( get_usermeta( $bp->loggedin_user->id, 'bp_favorite_activities' ) );
     934        $my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) );
    931935        $my_favs[] = $activity_id;
    932936
    933937        /* Update the total number of users who have favorited this activity */
     
    938942        else
    939943                $fav_count = 1;
    940944
    941         update_usermeta( $bp->loggedin_user->id, 'bp_favorite_activities', $my_favs );
     945        update_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', $my_favs );
    942946        bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count );
    943947
    944948        do_action( 'bp_activity_add_user_favorite', $activity_id, $user_id );
     
    953957                $user_id = $bp->loggedin_user->id;
    954958
    955959        /* Remove the fav from the user's favs */
    956         $my_favs = maybe_unserialize( get_usermeta( $user_id, 'bp_favorite_activities' ) );
     960        $my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) );
    957961        $my_favs = array_flip( (array) $my_favs );
    958962        unset( $my_favs[$activity_id] );
    959963        $my_favs = array_unique( array_flip( $my_favs ) );
     
    966970                bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count );
    967971        }
    968972
    969         update_usermeta( $user_id, 'bp_favorite_activities', $my_favs );
     973        update_user_meta( $user_id, 'bp_favorite_activities', $my_favs );
    970974
    971975        do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id );
    972976
     
    10881092        bp_activity_delete( array( 'user_id' => $user_id ) );
    10891093
    10901094        // Remove any usermeta
    1091         delete_usermeta( $user_id, 'bp_latest_update' );
    1092         delete_usermeta( $user_id, 'bp_favorite_activities' );
     1095        delete_user_meta( $user_id, 'bp_latest_update' );
     1096        delete_user_meta( $user_id, 'bp_favorite_activities' );
    10931097
    10941098        do_action( 'bp_activity_remove_data', $user_id );
    10951099}
     
    10971101add_action( 'delete_user', 'bp_activity_remove_data' );
    10981102add_action( 'make_spam_user', 'bp_activity_remove_data' );
    10991103
     1104/**
     1105 * updates_register_activity_actions()
     1106 *
     1107 * Register the activity stream actions for updates
     1108 *
     1109 * @global array $bp
     1110 */
     1111function updates_register_activity_actions() {
     1112        global $bp;
    11001113
     1114        bp_activity_set_action( $bp->activity->id, 'activity_update', __( 'Posted an update', 'buddypress' ) );
     1115
     1116        do_action( 'updates_register_activity_actions' );
     1117}
     1118add_action( 'bp_register_activity_actions', 'updates_register_activity_actions' );
     1119
    11011120/********************************************************************************
    11021121 * Custom Actions
    11031122 *
     
    11091128function bp_register_activity_actions() {
    11101129        do_action( 'bp_register_activity_actions' );
    11111130}
    1112 add_action( 'plugins_loaded', 'bp_register_activity_actions' );
     1131add_action( 'bp_loaded', 'bp_register_activity_actions', 8 );
    11131132
    11141133
    11151134?>
     1135 No newline at end of file
  • bp-themes/bp-default/groups/single/activity.php

     
    11<div class="item-list-tabs no-ajax" id="subnav">
    22        <ul>
    3                 <li class="feed"><a href="<?php bp_group_activity_feed_link() ?>" title="RSS Feed"><?php _e( 'RSS', 'buddypress' ) ?></a></li>
     3                <li class="feed"><a href="<?php bp_group_activity_feed_link() ?>" title="<?php _e( 'RSS Feed', 'buddypress' ); ?>"><?php _e( 'RSS', 'buddypress' ) ?></a></li>
    44
    55                <?php do_action( 'bp_group_activity_syndication_options' ) ?>
    66
  • bp-themes/bp-default/groups/single/request-membership.php

     
    11<?php do_action( 'bp_before_group_request_membership_content' ) ?>
    22
    33<?php if ( !bp_group_has_requested_membership() ) : ?>
    4         <p><?php printf( __( "You are requesting to become a member of the group '%s'.", "buddypress" ), bp_group_name( false, false ) ); ?></p>
     4        <p><?php printf( __( "You are requesting to become a member of the group '%s'.", "buddypress" ), bp_get_group_name( false ) ); ?></p>
    55
    66        <form action="<?php bp_group_form_action('request-membership') ?>" method="post" name="request-membership-form" id="request-membership-form" class="standard-form">
    77                <label for="group-request-membership-comments"><?php _e( 'Comments (optional)', 'buddypress' ); ?></label>
  • bp-themes/bp-default/groups/single/forum/topic.php

     
    1818                        <h3><?php bp_the_topic_title() ?> (<?php bp_the_topic_total_post_count() ?>)</h3>
    1919                        <a class="button" href="<?php bp_forum_permalink() ?>/">&larr; <?php _e( 'Group Forum', 'buddypress' ) ?></a> &nbsp; <a class="button" href="<?php bp_forum_directory_permalink() ?>/"><?php _e( 'Group Forum Directory', 'buddypress') ?></a></span>
    2020
    21                         <?php if ( bp_group_is_admin() || bp_group_is_mod() || bp_get_the_topic_is_mine() ) : ?>
    22                                 <div class="admin-links"><?php bp_the_topic_admin_links() ?></div>
    23                         <?php endif; ?>
     21                        <div class="admin-links">
     22                                <?php if ( bp_group_is_admin() || bp_group_is_mod() || bp_get_the_topic_is_mine() ) : ?>
     23                                        <?php bp_the_topic_admin_links() ?>
     24                                <?php endif; ?>
     25
     26                                <?php do_action( 'bp_group_forum_topic_meta' ); ?>
     27                        </div>
    2428                </div>
    2529
    2630                <ul id="topic-post-list" class="item-list">
     
    4246                                                <?php if ( bp_group_is_admin() || bp_group_is_mod() || bp_get_the_topic_post_is_mine() ) : ?>
    4347                                                        <?php bp_the_topic_post_admin_links() ?>
    4448                                                <?php endif; ?>
     49
     50                                                <?php do_action( 'bp_group_forum_post_meta' ); ?>
     51
    4552                                                <a href="#post-<?php bp_the_topic_post_id() ?>" title="<?php _e( 'Permanent link to this post', 'buddypress' ) ?>">#</a>
    4653                                        </div>
    4754                                </li>
     
    7077                                        <div id="post-topic-reply">
    7178                                                <p id="post-reply"></p>
    7279
    73                                                 <?php if ( !bp_group_is_member() ) : ?>
     80                                                <?php if ( bp_groups_auto_join() && !bp_group_is_member() ) : ?>
    7481                                                        <p><?php _e( 'You will auto join this group when you reply to this topic.', 'buddypress' ) ?></p>
    7582                                                <?php endif; ?>
    7683
  • bp-themes/bp-default/groups/single/group-header.php

     
    3535        <div id="item-meta">
    3636                <?php bp_group_description() ?>
    3737
     38                <?php if ( bp_is_group_forum() && is_user_logged_in() && !bp_is_group_forum_topic() ) : ?>
     39                        <div class="generic-button group-button">
     40                                <a href="#post-new" class=""><?php _e( 'New Topic', 'buddypress' ) ?></a>
     41                        </div>
     42                <?php endif; ?>
     43
    3844                <?php bp_group_join_button() ?>
    3945
    4046                <?php do_action( 'bp_group_header_meta' ) ?>
  • bp-themes/bp-default/groups/single/admin.php

     
    194194                        <ul id="members-list" class="item-list single-line">
    195195                                <?php while ( bp_group_members() ) : bp_group_the_member(); ?>
    196196
    197                                         <?php if ( bp_get_group_member_is_banned() ) : ?>
     197                                        <li class="<?php bp_group_member_css_class(); ?>">
     198                                                <?php bp_group_member_avatar_mini() ?>
    198199
    199                                                 <li class="banned-user">
    200                                                         <?php bp_group_member_avatar_mini() ?>
     200                                                <h5>
     201                                                        <?php bp_group_member_link() ?>
     202                                                       
     203                                                        <?php if ( bp_get_group_member_is_banned() ) _e( '(banned)', 'buddypress'); ?>
    201204
    202                                                         <h5><?php bp_group_member_link() ?> <?php _e( '(banned)', 'buddypress') ?> <span class="small"> - <a href="<?php bp_group_member_unban_link() ?>" class="confirm" title="<?php _e( 'Kick and ban this member', 'buddypress' ) ?>"><?php _e( 'Remove Ban', 'buddypress' ); ?></a> </h5>
     205                                                        <span class="small"> -
     206                                                       
     207                                                        <?php if ( bp_get_group_member_is_banned() ) : ?>
     208                                                               
     209                                                                <a href="<?php bp_group_member_unban_link() ?>" class="confirm" title="<?php _e( 'Unban this member', 'buddypress' ) ?>"><?php _e( 'Remove Ban', 'buddypress' ); ?></a>
    203210
    204                                         <?php else : ?>
     211                                                        <?php else : ?>
    205212
    206                                                 <li>
    207                                                         <?php bp_group_member_avatar_mini() ?>
    208                                                         <h5><?php bp_group_member_link() ?>  <span class="small"> - <a href="<?php bp_group_member_ban_link() ?>" class="confirm" title="<?php _e( 'Kick and ban this member', 'buddypress' ); ?>"><?php _e( 'Kick &amp; Ban', 'buddypress' ); ?></a> | <a href="<?php bp_group_member_promote_mod_link() ?>" class="confirm" title="<?php _e( 'Promote to Mod', 'buddypress' ); ?>"><?php _e( 'Promote to Mod', 'buddypress' ); ?></a> | <a href="<?php bp_group_member_promote_admin_link() ?>" class="confirm" title="<?php _e( 'Promote to Admin', 'buddypress' ); ?>"><?php _e( 'Promote to Admin', 'buddypress' ); ?></a></span></h5>
     213                                                                <a href="<?php bp_group_member_ban_link() ?>" class="confirm" title="<?php _e( 'Kick and ban this member', 'buddypress' ); ?>"><?php _e( 'Kick &amp; Ban', 'buddypress' ); ?></a>
     214                                                                | <a href="<?php bp_group_member_promote_mod_link() ?>" class="confirm" title="<?php _e( 'Promote to Mod', 'buddypress' ); ?>"><?php _e( 'Promote to Mod', 'buddypress' ); ?></a>
     215                                                                | <a href="<?php bp_group_member_promote_admin_link() ?>" class="confirm" title="<?php _e( 'Promote to Admin', 'buddypress' ); ?>"><?php _e( 'Promote to Admin', 'buddypress' ); ?></a>
    209216
    210                                         <?php endif; ?>
     217                                                        <?php endif; ?>
    211218
    212                                                         <?php do_action( 'bp_group_manage_members_admin_item' ); ?>
    213                                                 </li>
     219                                                                | <a href="<?php bp_group_member_remove_link() ?>" class="confirm" title="<?php _e( 'Remove this member', 'buddypress' ); ?>"><?php _e( 'Remove from group', 'buddypress' ); ?></a>
    214220
     221                                                                <?php do_action( 'bp_group_manage_members_admin_item' ); ?>
     222
     223                                                        </span>
     224                                                </h5>
     225                                        </li>
     226
    215227                                <?php endwhile; ?>
    216228                        </ul>
    217229
  • bp-themes/bp-default/groups/single/forum.php

     
    2121
    2222                                <?php do_action( 'bp_before_group_forum_post_new' ) ?>
    2323
    24                                 <?php if ( !bp_group_is_member() ) : ?>
     24                                <?php if ( bp_groups_auto_join() && !bp_group_is_member() ) : ?>
    2525                                        <p><?php _e( 'You will auto join this group when you start a new topic.', 'buddypress' ) ?></p>
    2626                                <?php endif; ?>
    2727
  • bp-themes/bp-default/groups/create.php

     
    5252                                                                <label><input type="checkbox" name="group-show-forum" id="group-show-forum" value="1"<?php if ( bp_get_new_group_enable_forum() ) { ?> checked="checked"<?php } ?> /> <?php _e('Enable discussion forum', 'buddypress') ?></label>
    5353                                                        </div>
    5454                                                <?php else : ?>
    55                                                         <?php if ( is_site_admin() ) : ?>
     55                                                        <?php if ( is_super_admin() ) : ?>
    5656                                                                <div class="checkbox">
    5757                                                                        <label><input type="checkbox" disabled="disabled" name="disabled" id="disabled" value="0" /> <?php printf( __('<strong>Attention Site Admin:</strong> Group forums require the <a href="%s">correct setup and configuration</a> of a bbPress installation.', 'buddypress' ), bp_get_root_domain() . '/wp-admin/admin.php?page=bb-forums-setup' ) ?></label>
    5858                                                                </div>
  • bp-themes/bp-default/groups/groups-loop.php

     
    44
    55<?php if ( bp_has_groups( bp_ajax_querystring( 'groups' ) ) ) : ?>
    66
    7         <div class="pagination">
     7        <div id="pag-top" class="pagination">
    88
    9                 <div class="pag-count" id="group-dir-count">
     9                <div class="pag-count" id="group-dir-count-top">
    1010                        <?php bp_groups_pagination_count() ?>
    1111                </div>
    1212
    13                 <div class="pagination-links" id="group-dir-pag">
     13                <div class="pagination-links" id="group-dir-pag-top">
    1414                        <?php bp_groups_pagination_links() ?>
    1515                </div>
    1616
    1717        </div>
    1818
     19        <?php do_action( 'bp_before_directory_groups_list' ) ?>
     20
    1921        <ul id="groups-list" class="item-list">
    2022        <?php while ( bp_groups() ) : bp_the_group(); ?>
    2123
     
    5254        <?php endwhile; ?>
    5355        </ul>
    5456
    55         <?php do_action( 'bp_after_groups_loop' ) ?>
    56 
     57        <?php do_action( 'bp_after_directory_groups_list' ) ?>
     58 
     59        <div id="pag-bottom" class="pagination">
     60 
     61                <div class="pag-count" id="group-dir-count-bottom">
     62                        <?php bp_groups_pagination_count() ?>
     63                </div>
     64 
     65                <div class="pagination-links" id="group-dir-pag-bottom">
     66                        <?php bp_groups_pagination_links() ?>
     67                </div>
     68 
     69        </div>
     70 
    5771<?php else: ?>
    5872
    5973        <div id="message" class="info">
  • bp-themes/bp-default/footer.php

     
    44                <?php do_action( 'bp_before_footer' ) ?>
    55
    66                <div id="footer">
    7                 <p><?php printf( __( '%s is proudly powered by <a href="http://wordpress.org">WordPress</a> and <a href="http://buddypress.org">BuddyPress</a>', 'buddypress' ), bloginfo('name') ); ?></p>
     7                <p><?php printf( __( '%s is proudly powered by <a href="http://wordpress.org">WordPress</a> and <a href="http://buddypress.org">BuddyPress</a>', 'buddypress' ), get_bloginfo( 'name' ) ); ?></p>
    88
    99                        <?php do_action( 'bp_footer' ) ?>
    1010                </div><!-- #footer -->
  • bp-themes/bp-default/members/single/profile/profile-loop.php

     
    1515                                                <h4><?php bp_the_profile_group_name() ?></h4>
    1616                                        <?php endif; ?>
    1717
    18                                         <table class="profile-fields">
     18                                        <table class="profile-fields zebra">
    1919                                                <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
    2020
    2121                                                        <?php if ( bp_field_has_data() ) : ?>
  • bp-themes/bp-default/members/single/groups.php

     
    88                <li id="groups-order-select" class="last filter">
    99
    1010                        <?php _e( 'Order By:', 'buddypress' ) ?>
    11                         <select id="groups-all">
     11                        <select id="groups-sort-by">
    1212                                <option value="active"><?php _e( 'Last Active', 'buddypress' ) ?></option>
    1313                                <option value="popular"><?php _e( 'Most Members', 'buddypress' ) ?></option>
    1414                                <option value="newest"><?php _e( 'Newly Created', 'buddypress' ) ?></option>
  • bp-themes/bp-default/members/single/messages/notices-loop.php

     
    1717        <?php do_action( 'bp_after_notices_pagination' ) ?>
    1818        <?php do_action( 'bp_before_notices' ) ?>
    1919
    20         <table id="message-threads">
     20        <table id="message-threads" class="zebra">
    2121                <?php while ( bp_message_threads() ) : bp_message_thread(); ?>
    2222                        <tr>
    2323                                <td width="1%">
  • bp-themes/bp-default/members/single/messages/messages-loop.php

     
    1717        <?php do_action( 'bp_after_member_messages_pagination' ) ?>
    1818        <?php do_action( 'bp_before_member_messages_threads' ) ?>
    1919
    20         <table id="message-threads">
     20        <table id="message-threads" class="zebra">
    2121                <?php while ( bp_message_threads() ) : bp_message_thread(); ?>
    2222
    2323                        <tr id="m-<?php bp_message_thread_id() ?>"<?php if ( bp_message_thread_has_unread() ) : ?> class="unread"<?php else: ?> class="read"<?php endif; ?>>
  • bp-themes/bp-default/members/single/messages/compose.php

     
    1010                </li>
    1111        </ul>
    1212
    13         <?php if ( is_site_admin() ) : ?>
     13        <?php if ( is_super_admin() ) : ?>
    1414                <input type="checkbox" id="send-notice" name="send-notice" value="1" /> <?php _e( "This is a notice to all users.", "buddypress" ) ?>
    1515        <?php endif; ?>
    1616
  • bp-themes/bp-default/members/members-loop.php

     
    44
    55<?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
    66
    7         <div class="pagination">
     7        <div id="pag-top" class="pagination">
    88
    9                 <div class="pag-count" id="member-dir-count">
     9                <div class="pag-count" id="member-dir-count-top">
    1010                        <?php bp_members_pagination_count() ?>
    1111                </div>
    1212
    13                 <div class="pagination-links" id="member-dir-pag">
     13                <div class="pagination-links" id="member-dir-pag-top">
    1414                        <?php bp_members_pagination_links() ?>
    1515                </div>
    1616
     
    6969
    7070        <?php bp_member_hidden_fields() ?>
    7171
     72        <div id="pag-bottom" class="pagination">
     73
     74                <div class="pag-count" id="member-dir-count-bottom">
     75                        <?php bp_members_pagination_count() ?>
     76                </div>
     77
     78                <div class="pagination-links" id="member-dir-pag-bottom">
     79                        <?php bp_members_pagination_links() ?>
     80                </div>
     81
     82        </div>
     83
    7284<?php else: ?>
    7385
    7486        <div id="message" class="info">
  • bp-themes/bp-default/search.php

     
    3232                                                <div class="post-content">
    3333                                                        <h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    3434
    35                                                         <p class="date"><?php the_time('F j, Y') ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
     35                                                        <p class="date"><?php the_time() ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
    3636
    3737                                                        <div class="entry">
    3838                                                                <?php the_content( __( 'Read the rest of this entry &rarr;', 'buddypress' ) ); ?>
  • bp-themes/bp-default/activity/index.php

     
    5757
    5858                        <div class="item-list-tabs no-ajax" id="subnav">
    5959                                <ul>
    60                                         <li class="feed"><a href="<?php bp_sitewide_activity_feed_link() ?>" title="RSS Feed"><?php _e( 'RSS', 'buddypress' ) ?></a></li>
     60                                        <li class="feed"><a href="<?php bp_sitewide_activity_feed_link() ?>" title="<?php _e( 'RSS Feed', 'buddypress' ); ?>"><?php _e( 'RSS', 'buddypress' ) ?></a></li>
    6161
    6262                                        <?php do_action( 'bp_activity_syndication_options' ) ?>
    6363
  • bp-themes/bp-default/index.php

     
    2323                                                <div class="post-content">
    2424                                                        <h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    2525
    26                                                         <p class="date"><?php the_time('F j, Y') ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
     26                                                        <p class="date"><?php the_time() ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
    2727
    2828                                                        <div class="entry">
    2929                                                                <?php the_content( __( 'Read the rest of this entry &rarr;', 'buddypress' ) ); ?>
  • bp-themes/bp-default/functions.php

     
    11<?php
    22
    3 /* Stop the theme from killing WordPress if BuddyPress is not enabled. */
     3// Stop the theme from killing WordPress if BuddyPress is not enabled.
    44if ( !class_exists( 'BP_Core_User' ) )
    55        return false;
    66
    7 /* Register the widget columns */
     7// Register the widget columns
    88register_sidebars( 1,
    99        array(
    10                 'name' => 'Sidebar',
     10                'name'          => 'Sidebar',
    1111                'before_widget' => '<div id="%1$s" class="widget %2$s">',
    12                 'after_widget' => '</div>',
    13                 'before_title' => '<h3 class="widgettitle">',
    14                 'after_title' => '</h3>'
     12                'after_widget'  => '</div>',
     13                'before_title'  => '<h3 class="widgettitle">',
     14                'after_title'   => '</h3>'
    1515        )
    1616);
    1717
    18 /* Load the AJAX functions for the theme */
     18// Load the AJAX functions for the theme
    1919require_once( TEMPLATEPATH . '/_inc/ajax.php' );
    2020
    21 /* Load the javascript for the theme */
     21// Load the javascript for the theme
    2222wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
    2323
    24 /* Add the JS needed for blog comment replies */
     24// Add words that we need to use in JS to the end of the page so they can be translated and still used.
     25$params = array(
     26        'my_favs'           => __( 'My Favorites', 'buddypress' ),
     27        'accepted'          => __( 'Accepted', 'buddypress' ),
     28        'rejected'          => __( 'Rejected', 'buddypress' ),
     29        'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ),
     30        'show_all'          => __( 'Show all', 'buddypress' ),
     31        'comments'          => __( 'comments', 'buddypress' ),
     32        'close'             => __( 'Close', 'buddypress' ),
     33        'mention_explain'   => sprintf( __( "%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress' ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname( bp_get_displayed_user_fullname() ), bp_get_user_firstname( bp_get_displayed_user_fullname() ) )
     34);
     35wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
     36
     37/**
     38 * Add the JS needed for blog comment replies
     39 *
     40 * @package BuddyPress Theme
     41 * @since 1.2
     42 */
    2543function bp_dtheme_add_blog_comments_js() {
    2644        if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
    2745}
    2846add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' );
    2947
    30 /* HTML for outputting blog comments as defined by the WP comment API */
     48/**
     49 * HTML for outputting blog comments as defined by the WP comment API
     50 *
     51 * @param mixed $comment Comment record from database
     52 * @param array $args Arguments from wp_list_comments() call
     53 * @param int $depth Comment nesting level
     54 * @see wp_list_comments()
     55 * @package BuddyPress Theme
     56 * @since 1.2
     57 */
    3158function bp_dtheme_blog_comments( $comment, $args, $depth ) {
    3259        $GLOBALS['comment'] = $comment; ?>
    3360
     
    6592                        </div>
    6693
    6794                </div>
    68         </li>
    6995<?php
    7096}
    7197
    72 /* Filter the dropdown for selecting the page to show on front to include "Activity Stream" */
     98/**
     99 * Filter the dropdown for selecting the page to show on front to include "Activity Stream"
     100 *
     101 * @param string $page_html A list of pages as a dropdown (select list)
     102 * @see wp_dropdown_pages()
     103 * @return string
     104 * @package BuddyPress Theme
     105 * @since 1.2
     106 */
    73107function bp_dtheme_wp_pages_filter( $page_html ) {
    74108        if ( 'page_on_front' != substr( $page_html, 14, 13 ) )
    75109                return $page_html;
     
    85119}
    86120add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' );
    87121
    88 /* Hijack the saving of page on front setting to save the activity stream setting */
     122/**
     123 * Hijack the saving of page on front setting to save the activity stream setting
     124 *
     125 * @param $string $oldvalue Previous value of get_option( 'page_on_front' )
     126 * @param $string $oldvalue New value of get_option( 'page_on_front' )
     127 * @return string
     128 * @package BuddyPress Theme
     129 * @since 1.2
     130 */
    89131function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
    90         if ( !is_admin() || !is_site_admin() )
     132        if ( !is_admin() || !is_super_admin() )
    91133                return false;
    92134
    93135        if ( 'activity' == $_POST['page_on_front'] )
     
    97139}
    98140add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 );
    99141
    100 /* Load the activity stream template if settings allow */
     142/**
     143 * Load the activity stream template if settings allow
     144 *
     145 * @param string $template Absolute path to the page template
     146 * @return string
     147 * @global WP_Query $wp_query WordPress query object
     148 * @package BuddyPress Theme
     149 * @since 1.2
     150 */
    101151function bp_dtheme_page_on_front_template( $template ) {
    102152        global $wp_query;
    103153
     
    108158}
    109159add_filter( 'page_template', 'bp_dtheme_page_on_front_template' );
    110160
    111 /* Return the ID of a page set as the home page. */
     161/**
     162 * Return the ID of a page set as the home page.
     163 *
     164 * @return false|int ID of page set as the home page
     165 * @package BuddyPress Theme
     166 * @since 1.2
     167 */
    112168function bp_dtheme_page_on_front() {
    113169        if ( 'page' != get_option( 'show_on_front' ) )
    114170                return false;
     
    116172        return apply_filters( 'bp_dtheme_page_on_front', get_option( 'page_on_front' ) );
    117173}
    118174
    119 /* Force the page ID as a string to stop the get_posts query from kicking up a fuss. */
     175/**
     176 * Force the page ID as a string to stop the get_posts query from kicking up a fuss.
     177 *
     178 * @global WP_Query $wp_query WordPress query object
     179 * @package BuddyPress Theme
     180 * @since 1.2
     181 */
    120182function bp_dtheme_fix_get_posts_on_activity_front() {
    121183        global $wp_query;
    122184
     
    125187}
    126188add_action( 'pre_get_posts', 'bp_dtheme_fix_get_posts_on_activity_front' );
    127189
    128 /****
     190/**
     191 * WP 3.0 requires there to be a non-null post in the posts array
     192 *
     193 * @param array $posts Posts as retrieved by WP_Query
     194 * @global WP_Query $wp_query WordPress query object
     195 * @return array
     196 * @package BuddyPress Theme
     197 * @since 1.2.5
     198 */
     199function bp_dtheme_fix_the_posts_on_activity_front( $posts ) {
     200        global $wp_query;
     201
     202        // NOTE: the double quotes around '"activity"' are thanks to our previous function bp_dtheme_fix_get_posts_on_activity_front()
     203        if ( empty( $posts ) && !empty( $wp_query->query_vars['page_id'] ) && '"activity"' == $wp_query->query_vars['page_id'] )
     204                $posts = array( (object) array( 'ID' => 'activity' ) );
     205
     206        return $posts;
     207}
     208add_filter( 'the_posts', 'bp_dtheme_fix_the_posts_on_activity_front' );
     209
     210/**
     211 * Add secondary avatar image to this activity stream's record, if supported
     212 *
     213 * @param string $action The text of this activity
     214 * @param BP_Activity_Activity $activity Activity object
     215 * @return string
     216 * @package BuddyPress Theme
     217 * @since 1.2.6
     218 */
     219function bp_dtheme_activity_secondary_avatars( $action, $activity ) {
     220        switch ( $activity->component ) {
     221                case 'groups' :
     222                case 'blogs' :
     223                case 'friends' :
     224                        // Only insert avatar if one exists
     225                        if ( $secondary_avatar = bp_get_activity_secondary_avatar() ) {
     226                                $reverse_content = strrev( $action );
     227                                $position        = strpos( $reverse_content, 'a<' );
     228                                $action          = substr_replace( $action, $secondary_avatar, -$position - 2, 0 );
     229                        }
     230                        break;
     231        }
     232
     233        return $action;
     234}
     235add_filter( 'bp_get_activity_action_pre_meta', 'bp_dtheme_activity_secondary_avatars', 10, 2 );
     236
     237/**
    129238 * Custom header image support. You can remove this entirely in a child theme by adding this line
    130239 * to your functions.php: define( 'BP_DTHEME_DISABLE_CUSTOM_HEADER', true );
     240 *
     241 * @package BuddyPress Theme
     242 * @since 1.2
    131243 */
    132244function bp_dtheme_add_custom_header_support() {
    133         /* Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/) */
     245        // Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/)
    134246        define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
    135247        define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' ); // %s is theme dir uri
    136248        define( 'HEADER_IMAGE_WIDTH', 1250 );
     
    202314if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) )
    203315        add_action( 'init', 'bp_dtheme_add_custom_header_support' );
    204316
    205 /* Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html) */
     317/**
     318 * Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html)
     319 *
     320 * @package BuddyPress Theme
     321 * @since 1.2
     322 */
    206323function bp_dtheme_show_notice() { ?>
    207324        <div id="message" class="updated fade">
    208325                <p><?php printf( __( 'Theme activated! This theme contains <a href="%s">custom header image</a> support and <a href="%s">sidebar widgets</a>.', 'buddypress' ), admin_url( 'themes.php?page=custom-header' ), admin_url( 'widgets.php' ) ) ?></p>
     
    214331if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" )
    215332        add_action( 'admin_notices', 'bp_dtheme_show_notice' );
    216333
    217 /* Add words that we need to use in JS to the end of the page so they can be translated and still used. */
    218 function bp_dtheme_js_terms() { ?>
    219 <script type="text/javascript">
    220         var bp_terms_my_favs = '<?php _e( "My Favorites", "buddypress" ) ?>';
    221         var bp_terms_accepted = '<?php _e( "Accepted", "buddypress" ) ?>';
    222         var bp_terms_rejected = '<?php _e( "Rejected", "buddypress" ) ?>';
    223         var bp_terms_show_all_comments = '<?php _e( "Show all comments for this thread", "buddypress" ) ?>';
    224         var bp_terms_show_all = '<?php _e( "Show all", "buddypress" ) ?>';
    225         var bp_terms_comments = '<?php _e( "comments", "buddypress" ) ?>';
    226         var bp_terms_close = '<?php _e( "Close", "buddypress" ) ?>';
    227         var bp_terms_mention_explain = '<?php printf( __( "%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", "buddypress" ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname()) ); ?>';
    228         </script>
    229 <?php
    230 }
    231 add_action( 'wp_footer', 'bp_dtheme_js_terms' );
    232 
    233334// Member Buttons
    234335add_action( 'bp_member_header_actions',    'bp_add_friend_button' );
    235336add_action( 'bp_member_header_actions',    'bp_send_public_message_button' );
  • bp-themes/bp-default/sidebar.php

     
    1414                                <?php bp_loggedin_user_avatar( 'type=thumb&width=40&height=40' ) ?>
    1515                        </a>
    1616
    17                         <h4><?php bp_loggedinuser_link() ?></h4>
     17                        <h4><?php echo bp_core_get_userlink( bp_loggedin_user_id() ); ?></h4>
    1818                        <a class="button logout" href="<?php echo wp_logout_url( bp_get_root_domain() ) ?>"><?php _e( 'Log Out', 'buddypress' ) ?></a>
    1919
    2020                        <?php do_action( 'bp_sidebar_me' ) ?>
     
    3939
    4040                <form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php echo site_url( 'wp-login.php', 'login' ) ?>" method="post">
    4141                        <label><?php _e( 'Username', 'buddypress' ) ?><br />
    42                         <input type="text" name="log" id="sidebar-user-login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" /></label>
     42                        <input type="text" name="log" id="sidebar-user-login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" /></label>
    4343
    4444                        <label><?php _e( 'Password', 'buddypress' ) ?><br />
    4545                        <input type="password" name="pwd" id="sidebar-user-pass" class="input" value="" /></label>
  • bp-themes/bp-default/blogs/blogs-loop.php

     
    44
    55<?php if ( bp_has_blogs( bp_ajax_querystring( 'blogs' ) ) ) : ?>
    66
    7         <div class="pagination">
     7        <div id="pag-top" class="pagination">
    88
    9                 <div class="pag-count" id="blog-dir-count">
     9                <div class="pag-count" id="blog-dir-count-top">
    1010                        <?php bp_blogs_pagination_count() ?>
    1111                </div>
    1212
    13                 <div class="pagination-links" id="blog-dir-pag">
     13                <div class="pagination-links" id="blog-dir-pag-top">
    1414                        <?php bp_blogs_pagination_links() ?>
    1515                </div>
    1616
    1717        </div>
    1818
     19        <?php do_action( 'bp_before_directory_blogs_list' ) ?>
     20
    1921        <ul id="blogs-list" class="item-list">
    2022        <?php while ( bp_blogs() ) : bp_the_blog(); ?>
    2123
     
    5153
    5254        <?php bp_blog_hidden_fields() ?>
    5355
     56        <div id="pag-bottom" class="pagination">
     57
     58                <div class="pag-count" id="blog-dir-count-bottom">
     59                        <?php bp_blogs_pagination_count() ?>
     60                </div>
     61
     62                <div class="pagination-links" id="blog-dir-pag-bottom">
     63                        <?php bp_blogs_pagination_links() ?>
     64                </div>
     65
     66        </div>
     67
    5468<?php else: ?>
    5569
    5670        <div id="message" class="info">
  • bp-themes/bp-default/archive.php

     
    3232                                                <div class="post-content">
    3333                                                        <h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    3434
    35                                                         <p class="date"><?php the_time('F j, Y') ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
     35                                                        <p class="date"><?php the_time() ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
    3636
    3737                                                        <div class="entry">
    3838                                                                <?php the_content( __( 'Read the rest of this entry &rarr;', 'buddypress' ) ); ?>
  • bp-themes/bp-default/single.php

     
    2626                                        <div class="post-content">
    2727                                                <h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    2828
    29                                                 <p class="date"><?php the_time('F j, Y') ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em></p>
     29                                                <p class="date"><?php the_time() ?> <em><?php _e( 'in', 'buddypress' ) ?> <?php the_category(', ') ?> <?php printf( __( 'by %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></em> <?php edit_post_link( __( 'Edit this entry', 'buddypress' ), '<em class="edit-link">', '</em>' ); ?></p>
    3030
    3131                                                <div class="entry">
    3232                                                        <?php the_content( __( 'Read the rest of this entry &rarr;', 'buddypress' ) ); ?>
  • bp-themes/bp-default/_inc/css/default.css

     
    3535a:hover, a:active { color: #888; }
    3636a:focus { outline: 1px dotted #ccc; }
    3737
    38 .padder { padding: 20px; }
     38.padder { padding: 19px; }
    3939.clear { clear: left; }
    4040
    4141p {     margin-bottom: 15px; }
     
    179179        width: 224px;
    180180        margin-left: -226px;
    181181        margin-top: 1px;
    182         border-left: 1px solid #e4e4e4;
     182        border-left: 1px solid #ddd;
    183183        -moz-border-radius-topright: 3px;
    184184        -webkit-border-top-right-radius: 3px;
    185185        background: url( ../images/sidebar_back.gif ) top left repeat-x;
     
    273273
    274274div#content .padder {
    275275        margin-right: 225px;
    276         border-right: 1px solid #e4e4e4;
     276        border-right: 1px solid #ddd;
    277277        -moz-border-radius-topleft: 6px;
    278278        -webkit-border-top-left-radius: 6px;
    279279        -moz-border-radius-bottomleft: 6px;
     
    399399                border-bottom: 1px solid #eaeaea;
    400400        }
    401401                ul.single-line li { border: none; }
    402                 body.activity-permalink ul.item-list li { padding-top: 0; }
    403402
    404403                ul.item-list li img.avatar {
    405404                        float: left;
     
    448447div.item-list-tabs {
    449448        clear: left;
    450449        overflow: hidden;
    451         margin: 25px -20px 20px -20px;
     450        margin: 25px -19px 20px -19px;
    452451        background: #eaeaea;
    453452}
    454453        div.item-list-tabs ul li a {
     
    524523
    525524        div.item-list-tabs#subnav {
    526525                background: #fff;
    527                 margin: -15px -20px 15px -20px;
     526                margin: -15px -19px 15px -19px;
    528527                border-bottom: 1px solid #eaeaea;
    529528                min-height: 35px;
    530529                overflow: hidden;
     
    574573-------------------------------------------------------------- */
    575574
    576575div.pagination {
    577         margin: -15px -20px 9px -20px;
     576        margin: -20px -20px 9px -20px;
    578577        border-bottom: 1px solid #eaeaea;
    579578        padding: 10px 20px 10px 20px;
    580579        color: #888;
     
    604603                                font-weight: bold;
    605604                        }
    606605
     606div#pag-bottom {
     607        margin-top: 0;
     608}
     609
    607610/* > Error / Success Messages
    608611-------------------------------------------------------------- */
    609612
     
    644647/* > Buttons
    645648-------------------------------------------------------------- */
    646649
    647 a.button, input[type=submit], input[type=button],
     650a.button, input[type=submit], input[type=button], input[type=reset],
    648651ul.button-nav li a, div.generic-button a {
    649652        background: url( ../images/white-grad.png ) top left repeat-x;
    650653        border: 1px solid #ddd;
     
    659662        vertical-align: bottom;
    660663        cursor: pointer;
    661664}
    662         a.button:hover, a.button:focus, input[type=submit]:hover, input[type=button]:hover,
     665        a.button:hover, a.button:focus, input[type=submit]:hover, input[type=button]:hover, input[type=reset]:hover,
    663666        ul.button-nav li a:hover, ul.button-nav li.current a,
    664667        div.generic-button a:hover {
    665668                border-color: #aaa;
     
    840843table {
    841844        width: 100%;
    842845}
     846        table thead tr {
     847                background: #eaeaea;
     848        }
     849
    843850        table#message-threads {
    844851                margin: 0 -20px;
    845852                width: auto;
     
    888895        margin: -9px -20px 20px -20px;
    889896        width: auto;
    890897}
    891         table.forum tr:first-child {
    892                 background: #fafafa;
    893         }
    894 
    895898        table.forum tr.sticky td {
    896899                background: #FFF9DB;
    897900                border-top: 1px solid #FFE8C4;
     
    11451148                color: #888;
    11461149                line-height: 220%;
    11471150        }
     1151       
     1152        .activity-list .activity-content .activity-header img.avatar {
     1153                float: none !important;
     1154                margin: 0 5px -8px 0 !important;
     1155        }
    11481156
    11491157        .activity-list .activity-header a:first-child, span.highlight {
    11501158                background: #EBF7FF;
     
    12751283        background: #f5f5f5;
    12761284        -moz-border-radius: 4px;
    12771285        -webkit-border-radius: 4px;
     1286        padding: 0 10px 0;
    12781287}
    12791288div.activity-comments ul, div.activity-comments ul li {
    12801289        border: none;
     
    12871296
    12881297        div.activity-comments ul li {
    12891298                border-top: 2px solid #fff;
    1290                 padding: 10px 15px 10px 0;
    1291                 margin-left: 15px;
     1299                padding: 10px 0 0;
    12921300        }
    12931301                body.activity-permalink div.activity-comments ul li {
    12941302                        border-width: 1px;
    1295                         padding: 15px 0 15px 0;
     1303                        padding: 10px 0 0;
    12961304                }
    12971305
    12981306                div.activity-comments ul li p:last-child {
    1299                         margin-bottom: 0;
     1307                        margin-bottom: 10px;
    13001308                }
    13011309
    13021310                div.activity-comments > ul > li:first-child {
     
    13081316                }
    13091317
    13101318        div.activity-comments ul li > ul {
    1311                 margin-top: 5px;
    1312                 margin-left: 25px;
     1319                margin-top: 0;
     1320                margin-left: 20px;
    13131321        }
    13141322                body.activity-permalink div.activity-comments ul li > ul {
    13151323                        margin-top: 15px;
     
    13421350        div.activity-comments form.ac-form {
    13431351                display: none;
    13441352                margin: 10px 0 10px 33px;
    1345                 background: #eee;
    1346                 border-bottom: 1px solid #ddd;
    1347                 border-right: 1px solid #ddd;
     1353                background: #fafafa;
     1354                border: 1px solid #ddd;
    13481355                -moz-border-radius: 4px;
    13491356                -webkit-border-radius: 4px;
    13501357                border-radius: 4px;
     
    17471754}
    17481755        #footer a {
    17491756                color: #bbb;
    1750         }
    1751  No newline at end of file
     1757        }
  • bp-themes/bp-default/_inc/ajax.php

     
    187187                                </div>
    188188
    189189                                <div class="acomment-meta">
    190                                         <?php echo bp_core_get_userlink( bp_get_activity_user_id() ) ?> &middot; <?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( gmdate( "Y-m-d H:i:s" ) ) ) ?> &middot;
    191                                         <a class="acomment-reply" href="#acomment-<?php bp_activity_id() ?>" id="acomment-reply-<?php echo attribute_escape( $_POST['form_id'] ) ?>"><?php _e( 'Reply', 'buddypress' ) ?></a>
     190                                        <?php echo bp_core_get_userlink( bp_get_activity_user_id() ) ?> &middot; <?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?> &middot;
     191                                        <a class="acomment-reply" href="#acomment-<?php bp_activity_id() ?>" id="acomment-reply-<?php echo esc_attr( $_POST['form_id'] ) ?>"><?php _e( 'Reply', 'buddypress' ) ?></a>
    192192                                         &middot; <a href="<?php echo wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link' ) ?>" class="delete acomment-delete confirm"><?php _e( 'Delete', 'buddypress' ) ?></a>
    193193                                </div>
    194194
     
    216216        $activity = new BP_Activity_Activity( $_POST['id'] );
    217217
    218218        /* Check access */
    219         if ( !is_site_admin() && $activity->user_id != $bp->loggedin_user->id )
     219        if ( !is_super_admin() && $activity->user_id != $bp->loggedin_user->id )
    220220                return false;
    221221
    222222        if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) )
     
    249249        $comment = new BP_Activity_Activity( $_POST['id'] );
    250250
    251251        /* Check access */
    252         if ( !is_site_admin() && $comment->user_id != $bp->loggedin_user->id )
     252        if ( !is_super_admin() && $comment->user_id != $bp->loggedin_user->id )
    253253                return false;
    254254
    255255        if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) )
     
    312312                echo '<h4>' . $user->user_link . '</h4>';
    313313                echo '<span class="activity">' . esc_attr( $user->last_active ) . '</span>';
    314314                echo '<div class="action">
    315                                 <a class="remove" href="' . wp_nonce_url( $bp->loggedin_user->domain . $bp->groups->slug . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id, 'groups_invite_uninvite_user' ) . '" id="uid-' . attribute_escape( $user->id ) . '">' . __( 'Remove Invite', 'buddypress' ) . '</a>
     315                                <a class="remove" href="' . wp_nonce_url( $bp->loggedin_user->domain . $bp->groups->slug . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id, 'groups_invite_uninvite_user' ) . '" id="uid-' . esc_attr( $user->id ) . '">' . __( 'Remove Invite', 'buddypress' ) . '</a>
    316316                          </div>';
    317317                echo '</li>';
    318318
     
    404404                        if ( !groups_join_group( $group->id ) ) {
    405405                                _e( 'Error joining group', 'buddypress' );
    406406                        } else {
    407                                 echo '<a id="group-' . attribute_escape( $group->id ) . '" class="leave-group" rel="leave" title="' . __( 'Leave Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
     407                                echo '<a id="group-' . esc_attr( $group->id ) . '" class="leave-group" rel="leave" title="' . __( 'Leave Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
    408408                        }
    409409
    410410                } else if ( 'private' == $group->status ) {
     
    414414                        if ( !groups_send_membership_request( $bp->loggedin_user->id, $group->id ) ) {
    415415                                _e( 'Error requesting membership', 'buddypress' );
    416416                        } else {
    417                                 echo '<a id="group-' . attribute_escape( $group->id ) . '" class="membership-requested" rel="membership-requested" title="' . __( 'Membership Requested', 'buddypress' ) . '" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Membership Requested', 'buddypress' ) . '</a>';
     417                                echo '<a id="group-' . esc_attr( $group->id ) . '" class="membership-requested" rel="membership-requested" title="' . __( 'Membership Requested', 'buddypress' ) . '" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Membership Requested', 'buddypress' ) . '</a>';
    418418                        }
    419419                }
    420420
     
    426426                        _e( 'Error leaving group', 'buddypress' );
    427427                } else {
    428428                        if ( 'public' == $group->status ) {
    429                                 echo '<a id="group-' . attribute_escape( $group->id ) . '" class="join-group" rel="join" title="' . __( 'Join Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ) . '">' . __( 'Join Group', 'buddypress' ) . '</a>';
     429                                echo '<a id="group-' . esc_attr( $group->id ) . '" class="join-group" rel="join" title="' . __( 'Join Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ) . '">' . __( 'Join Group', 'buddypress' ) . '</a>';
    430430                        } else if ( 'private' == $group->status ) {
    431                                 echo '<a id="group-' . attribute_escape( $group->id ) . '" class="request-membership" rel="join" title="' . __( 'Request Membership', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_send_membership_request' ) . '">' . __( 'Request Membership', 'buddypress' ) . '</a>';
     431                                echo '<a id="group-' . esc_attr( $group->id ) . '" class="request-membership" rel="join" title="' . __( 'Request Membership', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_send_membership_request' ) . '">' . __( 'Request Membership', 'buddypress' ) . '</a>';
    432432                        }
    433433                }
    434434        }
     
    442442        if ( !isset( $_POST['notice_id'] ) ) {
    443443                echo "-1<div id='message' class='error'><p>" . __('There was a problem closing the notice.', 'buddypress') . '</p></div>';
    444444        } else {
    445                 $notice_ids = get_usermeta( $userdata->ID, 'closed_notices' );
     445                $notice_ids = get_user_meta( $userdata->ID, 'closed_notices', true );
    446446
    447447                $notice_ids[] = (int) $_POST['notice_id'];
    448448
    449                 update_usermeta( $userdata->ID, 'closed_notices', $notice_ids );
     449                update_user_meta( $userdata->ID, 'closed_notices', $notice_ids );
    450450        }
    451451}
    452452add_action( 'wp_ajax_messages_close_notice', 'bp_dtheme_ajax_close_notice' );
     
    465465                                <?php do_action( 'bp_before_message_meta' ) ?>
    466466                                <?php echo bp_loggedin_user_avatar( 'type=thumb&width=30&height=30' ); ?>
    467467
    468                                 <strong><a href="<?php echo $bp->loggedin_user->domain ?>"><?php echo $bp->loggedin_user->fullname ?></a> <span class="activity"><?php printf( __( 'Sent %s ago', 'buddypress' ), bp_core_time_since( time() ) ) ?></span></strong>
     468                                <strong><a href="<?php echo $bp->loggedin_user->domain ?>"><?php echo $bp->loggedin_user->fullname ?></a> <span class="activity"><?php printf( __( 'Sent %s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?></span></strong>
    469469
    470470                                <?php do_action( 'bp_after_message_meta' ) ?>
    471471                        </div>
  • bp-themes/bp-default/registration/register.php

     
    179179                                                        <label for="signup_blog_url"><?php _e( 'Blog URL', 'buddypress' ) ?> <?php _e( '(required)', 'buddypress' ) ?></label>
    180180                                                        <?php do_action( 'bp_signup_blog_url_errors' ) ?>
    181181
    182                                                         <?php if ( 'yes' == VHOST ) : ?>
     182                                                        <?php if ( is_subdomain_install() ) : ?>
    183183                                                                http:// <input type="text" name="signup_blog_url" id="signup_blog_url" value="<?php bp_signup_blog_url_value() ?>" /> .<?php echo str_replace( 'http://', '', site_url() ) ?>
    184184                                                        <?php else : ?>
    185185                                                                <?php echo site_url() ?>/ <input type="text" name="signup_blog_url" id="signup_blog_url" value="<?php bp_signup_blog_url_value() ?>" />
     
    206206                                <?php do_action( 'bp_before_registration_submit_buttons' ) ?>
    207207
    208208                                <div class="submit">
    209                                         <input type="submit"name="signup_submit" id="signup_submit" value="<?php _e( 'Complete Sign Up', 'buddypress' ) ?> &rarr;" />
     209                                        <input type="submit" name="signup_submit" id="signup_submit" value="<?php _e( 'Complete Sign Up', 'buddypress' ) ?> &rarr;" />
    210210                                </div>
    211211
    212212                                <?php do_action( 'bp_after_registration_submit_buttons' ) ?>
  • bp-themes/bp-default/forums/index.php

     
    3636
    3737                                                        <label><?php _e( 'Post In Group Forum:', 'buddypress' ) ?></label>
    3838                                                        <select id="topic_group_id" name="topic_group_id">
     39                                                                <option value="">----</option>
    3940                                                                <?php while ( bp_groups() ) : bp_the_group(); ?>
    4041                                                                        <?php if ( 'public' == bp_get_group_status() ) : ?>
    4142                                                                                <option value="<?php bp_group_id() ?>"><?php bp_group_name() ?></option>
  • bp-themes/bp-default/header.php

     
    5656                        <div id="search-bar">
    5757                                <div class="padder">
    5858
    59                                 <form action="<?php echo bp_search_form_action() ?>" method="post" id="search-form">
    60                                         <input type="text" id="search-terms" name="search-terms" value="" />
    61                                         <?php echo bp_search_form_type_select() ?>
     59                                <?php if ( bp_search_form_enabled() ) : ?>
    6260
    63                                         <input type="submit" name="search-submit" id="search-submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
    64                                         <?php wp_nonce_field( 'bp_search_form' ) ?>
    65                                 </form><!-- #search-form -->
     61                                        <form action="<?php echo bp_search_form_action() ?>" method="post" id="search-form">
     62                                                <input type="text" id="search-terms" name="search-terms" value="" />
     63                                                <?php echo bp_search_form_type_select() ?>
    6664
     65                                                <input type="submit" name="search-submit" id="search-submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
     66                                                <?php wp_nonce_field( 'bp_search_form' ) ?>
     67                                        </form><!-- #search-form -->
     68
     69                                <?php endif; ?>
     70
    6771                                <?php do_action( 'bp_search_login_bar' ) ?>
    6872
    6973                                </div><!-- .padder -->
  • bp-xprofile/bp-xprofile-admin.php

     
    5858                                $type = ( $type == 'error' ) ? 'error' : 'updated'; ?>
    5959
    6060                                <div id="message" class="<?php echo $type; ?> fade">
    61                                         <p><?php echo wp_specialchars( attribute_escape( $message ) ); ?></p>
     61                                        <p><?php echo wp_specialchars( esc_attr( $message ) ); ?></p>
    6262                                </div>
    6363<?php           endif; ?>
    6464
  • bp-xprofile/bp-xprofile-templatetags.php

     
    176176                $css_classes = array();
    177177
    178178                if ( $class )
    179                         $css_classes[] = sanitize_title( attribute_escape( $class ) );
     179                        $css_classes[] = sanitize_title( esc_attr( $class ) );
    180180
    181181                /* Set a class with the field ID */
    182182                $css_classes[] = 'field_' . $profile_template->field->id;
     
    184184                /* Set a class with the field name (sanitized) */
    185185                $css_classes[] = 'field_' . sanitize_title( $profile_template->field->name );
    186186
    187                 if ( $profile_template->current_field % 2 )
     187                if ( $profile_template->current_field % 2 == 1 )
    188188                        $css_classes[] = 'alt';
    189189
    190190                $css_classes = apply_filters( 'bp_field_css_classes', &$css_classes );
     
    383383                                        else
    384384                                                $selected = '';
    385385
    386                                         $html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . attribute_escape( stripslashes( $options[$k]->name ) ) . '">' . attribute_escape( stripslashes( $options[$k]->name ) ) . '</option>', $options[$k] );
     386                                        $html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . esc_attr( stripslashes( $options[$k]->name ) ) . '">' . esc_attr( stripslashes( $options[$k]->name ) ) . '</option>', $options[$k] );
    387387                                }
    388388                                break;
    389389
     
    404404                                        else
    405405                                                $selected = '';
    406406
    407                                         $html .= apply_filters( 'bp_get_the_profile_field_options_radio', '<label><input' . $selected . ' type="radio" name="field_' . $field->id . '" id="option_' . $options[$k]->id . '" value="' . attribute_escape( $options[$k]->name ) . '"> ' . attribute_escape( $options[$k]->name ) . '</label>', $options[$k] );
     407                                        $html .= apply_filters( 'bp_get_the_profile_field_options_radio', '<label><input' . $selected . ' type="radio" name="field_' . $field->id . '" id="option_' . $options[$k]->id . '" value="' . esc_attr( $options[$k]->name ) . '"> ' . esc_attr( $options[$k]->name ) . '</label>', $options[$k] );
    408408                                }
    409409
    410410                                $html .= '</div>';
     
    429429                                                }
    430430                                        }
    431431
    432                                         $html .= apply_filters( 'bp_get_the_profile_field_options_checkbox', '<label><input' . $selected . ' type="checkbox" name="field_' . $field->id . '[]" id="field_' . $options[$k]->id . '_' . $k . '" value="' . attribute_escape( $options[$k]->name ) . '"> ' . attribute_escape( $options[$k]->name ) . '</label>', $options[$k] );
     432                                        $html .= apply_filters( 'bp_get_the_profile_field_options_checkbox', '<label><input' . $selected . ' type="checkbox" name="field_' . $field->id . '[]" id="field_' . $options[$k]->id . '_' . $k . '" value="' . esc_attr( $options[$k]->name ) . '"> ' . esc_attr( $options[$k]->name ) . '</label>', $options[$k] );
    433433                                        $selected = '';
    434434                                }
    435435                                break;
     
    461461
    462462                                switch ( $type ) {
    463463                                        case 'day':
    464                                                 $html .= '<option value=""' . attribute_escape( $default_select ) . '>--</option>';
     464                                                $html .= '<option value=""' . esc_attr( $default_select ) . '>--</option>';
    465465
    466466                                                for ( $i = 1; $i < 32; $i++ ) {
    467467                                                        if ( $day == $i )
     
    482482                                                                 __( 'October', 'buddypress' ), __( 'November', 'buddypress' ), __( 'December', 'buddypress' )
    483483                                                                );
    484484
    485                                                 $html .= '<option value=""' . attribute_escape( $default_select ) . '>------</option>';
     485                                                $html .= '<option value=""' . esc_attr( $default_select ) . '>------</option>';
    486486
    487487                                                for ( $i = 0; $i < 12; $i++ ) {
    488488                                                        if ( $month == $eng_months[$i] )
     
    495495                                                break;
    496496
    497497                                        case 'year':
    498                                                 $html .= '<option value=""' . attribute_escape( $default_select ) . '>----</option>';
     498                                                $html .= '<option value=""' . esc_attr( $default_select ) . '>----</option>';
    499499
    500500                                                for ( $i = date( 'Y', time() ); $i > 1899; $i-- ) {
    501501                                                        if ( $year == $i )
     
    568568                        $selected = '';
    569569
    570570                if ( $groups[$i]->fields )
    571                         echo '<li' . $selected . '><a href="' . $bp->displayed_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . attribute_escape( $groups[$i]->name ) . '</a></li>';
     571                        echo '<li' . $selected . '><a href="' . $bp->displayed_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . esc_attr( $groups[$i]->name ) . '</a></li>';
    572572        }
    573573
    574574        do_action( 'xprofile_profile_group_tabs' );
     
    630630        function bp_get_profile_last_updated() {
    631631                global $bp;
    632632
    633                 $last_updated = get_usermeta( $bp->displayed_user->id, 'profile_last_updated' );
     633                $last_updated = get_user_meta( $bp->displayed_user->id, 'profile_last_updated', true );
    634634
    635635                if ( $last_updated )
    636636                        return apply_filters( 'bp_get_profile_last_updated', sprintf( __('Profile updated %s ago', 'buddypress'), bp_core_time_since( strtotime( $last_updated ) ) ) );
  • bp-xprofile/bp-xprofile-classes.php

     
    201201                                </div>
    202202<?php endif; ?>
    203203                        <div id="poststuff">
    204                                 <form action="<?php echo attribute_escape( $action ); ?>" method="post">
     204                                <form action="<?php echo esc_attr( $action ); ?>" method="post">
    205205                                        <div id="titlediv">
    206206                                                <h3><label for="group_name"><?php _e( "Field Group Title", 'buddypress') ?> *</label></h3>
    207207                                                <div id="titlewrap">
    208                                                         <input type="text" name="group_name" id="title" value="<?php echo attribute_escape( $this->name ); ?>" style="width:50%" />
     208                                                        <input type="text" name="group_name" id="title" value="<?php echo esc_attr( $this->name ); ?>" style="width:50%" />
    209209                                                </div>
    210210                                        </div>
    211211
     
    219219<?php endif; ?>
    220220
    221221                                        <p class="submit">
    222                                                 <input type="hidden" name="group_order" id="group_order" value="<?php echo attribute_escape( $this->group_order ); ?>" />
    223                                                 <input type="submit" name="save_group" value="<?php echo attribute_escape( $button ); ?>" class="button-primary"/>
     222                                                <input type="hidden" name="group_order" id="group_order" value="<?php echo esc_attr( $this->group_order ); ?>" />
     223                                                <input type="submit" name="save_group" value="<?php echo esc_attr( $button ); ?>" class="button-primary"/>
    224224                                                <?php _e( 'or', 'buddypress' ); ?> <a href="admin.php?page=bp-profile-setup" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a>
    225225                                        </p>
    226226                                </form>
     
    320320                if ( $this->id != null )
    321321                        $sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, order_by = %s, field_order = %d WHERE id = %d", $this->group_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order, $this->id );
    322322                else
    323                         $sql = $wpdb->prepare( "INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, order_by, field_order ) VALUES (%d, 0, %s, %s, %s, %d, %s, %d )", $this->group_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order );
     323                        $sql = $wpdb->prepare( "INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, order_by, field_order ) VALUES (%d, %d, %s, %s, %s, %d, %s, %d )", $this->group_id, $this->parent_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order );
    324324
    325325                /*
    326326                 * Check for null so field options can be changed without changing any other part of the field.
     
    546546                                                        $default_name = '[' . $j . ']';
    547547?>
    548548                                                <p><?php _e('Option', 'buddypress'); ?> <?php echo $j; ?>:
    549                                                    <input type="text" name="<?php echo $type; ?>_option[<?php echo $j; ?>]" id="<?php echo $type; ?>_option<?php echo $j; ?>" value="<?php echo attribute_escape( $options[$i]->name ); ?>" />
     549                                                   <input type="text" name="<?php echo $type; ?>_option[<?php echo $j; ?>]" id="<?php echo $type; ?>_option<?php echo $j; ?>" value="<?php echo esc_attr( $options[$i]->name ); ?>" />
    550550                                                   <input type="<?php echo $default_input; ?>" name="isDefault_<?php echo $type; ?>_option<?php echo $default_name; ?>" <?php if ( (int) $options[$i]->is_default_option ) {?> checked="checked"<?php } ?> " value="<?php echo $j; ?>" /> <?php _e( 'Default Value', 'buddypress' ); ?>
    551551<?php
    552552                                        if ( $j != 1 && $options[$i]->id != -1 ) : ?>
     
    609609                                <div id="titlediv">
    610610                                        <h3><label for="title"><?php _e( 'Field Title', 'buddypress' ); ?> *</label></h3>
    611611                                        <div id="titlewrap">
    612                                                 <input type="text" name="title" id="title" value="<?php echo attribute_escape( $this->name ); ?>" style="width:50%" />
     612                                                <input type="text" name="title" id="title" value="<?php echo esc_attr( $this->name ); ?>" style="width:50%" />
    613613                                        </div>
    614614                                </div>
    615615<?php
     
    649649                                <input type="hidden" name="fieldtype" id="fieldtype" value="textbox" />
    650650<?php   } ?>
    651651                                <p class="submit">
    652                                         <input type="hidden" name="field_order" id="field_order" value="<?php echo attribute_escape( $this->field_order ); ?>" />
     652                                        <input type="hidden" name="field_order" id="field_order" value="<?php echo esc_attr( $this->field_order ); ?>" />
    653653                                        <input type="submit" value="<?php _e( 'Save', 'buddypress' ); ?>" name="saveField" id="saveField" style="font-weight: bold" class="button-primary" />
    654654                                        <?php _e( 'or', 'buddypress' ); ?> <a href="admin.php?page=bp-profile-setup" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a>
    655655                                </p>
  • bp-core/bp-core-widgets.php

     
    5858                                <?php endwhile; ?>
    5959                        </ul>
    6060                        <?php wp_nonce_field( 'bp_core_widget_members', '_wpnonce-members' ); ?>
    61                         <input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo attribute_escape( $instance['max_members'] ); ?>" />
     61                        <input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo esc_attr( $instance['max_members'] ); ?>" />
    6262
    6363                <?php else: ?>
    6464
     
    8484                $max_members = strip_tags( $instance['max_members'] );
    8585                ?>
    8686
    87                 <p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo attribute_escape( $max_members ); ?>" style="width: 30%" /></label></p>
     87                <p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
    8888        <?php
    8989        }
    9090}
     
    138138                $max_members = strip_tags( $instance['max_members'] );
    139139                ?>
    140140
    141                 <p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo attribute_escape( $max_members ); ?>" style="width: 30%" /></label></p>
     141                <p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
    142142        <?php
    143143        }
    144144}
     
    192192                $max_members = strip_tags( $instance['max_members'] );
    193193                ?>
    194194
    195                 <p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo attribute_escape( $max_members ); ?>" style="width: 30%" /></label></p>
     195                <p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
    196196        <?php
    197197        }
    198198}
  • bp-core/bp-core-filters.php

     
    3232 * @return The blog name for the root blog
    3333 */
    3434function bp_core_email_from_name_filter() {
    35         return apply_filters( 'bp_core_email_from_name_filter', get_blog_option( BP_ROOT_BLOG, 'blogname' ) );
     35        return apply_filters( 'bp_core_email_from_name_filter', wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES ) );
    3636}
    3737add_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' );
    3838
     
    6565function bp_core_allow_default_theme( $themes ) {
    6666        global $bp, $current_blog;
    6767
    68         if ( !is_site_admin() )
     68        if ( !is_super_admin() )
    6969                return $themes;
    7070
    7171        if ( $current_blog->ID == $bp->root_blog ) {
     
    174174
    175175        // Send email with activation link.
    176176        $activate_url = bp_get_activation_page() ."?key=$key";
    177         $activate_url = clean_url($activate_url);
     177        $activate_url = esc_url($activate_url);
    178178
    179179        $admin_email = get_site_option( "admin_email" );
    180180
     
    203203        global $current_site;
    204204
    205205        $activate_url = bp_get_activation_page() ."?key=$key";
    206         $activate_url = clean_url($activate_url);
     206        $activate_url = esc_url($activate_url);
    207207        $admin_email = get_site_option( "admin_email" );
    208208
    209209        if ( empty( $admin_email ) )
     
    215215
    216216        $from_name = ( '' == get_site_option( "site_name" ) ) ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
    217217        $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    218         $message = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n", 'buddypress' ), $activate_url . $email, clean_url("http://{$domain}{$path}" ) );
     218        $message = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n", 'buddypress' ), $activate_url . $email, esc_url( "http://{$domain}{$path}" ) );
    219219        $subject = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' );
    220220
    221221        /* Send the message */
  • bp-core/bp-core-notifications.php

     
    44        global $bp;
    55
    66        if ( !$date_notified )
    7                 $date_notified = time();
     7                $date_notified = bp_core_current_time();
    88
    99        $notification = new BP_Core_Notification;
    1010        $notification->item_id = $item_id;
  • bp-core/bp-core-adminbar.php

     
    108108                wp_cache_set( 'bp_blogs_of_user_' . $bp->loggedin_user->id . '_inc_hidden', $blogs, 'bp' );
    109109        }
    110110
    111         echo '<li id="bp-adminbar-blogs-menu"><a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/my-blogs">';
     111        echo '<li id="bp-adminbar-blogs-menu"><a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/">';
    112112
    113113        _e( 'My Blogs', 'buddypress' );
    114114
  • bp-core/bp-core-wpabstraction.php

     
    2424        return true;
    2525}
    2626
     27/**
     28 * bp_core_is_main_site
     29 *
     30 * Checks if current blog is root blog of site
     31 *
     32 * @since 1.2.6
     33 * @package BuddyPress
     34 *
     35 * @param int $blog_id optional blog id to test (default current blog)
     36 * @return bool True if not multisite or $blog_id is main site
     37 */
     38function bp_core_is_main_site( $blog_id = '' ) {
     39        global $current_site, $current_blog;
     40
     41        if ( !bp_core_is_multisite() )
     42                return true;
     43
     44        if ( empty( $blog_id ) )
     45                $blog_id = $current_blog->blog_id;
     46
     47        return $blog_id == $current_site->blog_id;
     48}
     49
    2750function bp_core_get_status_sql( $prefix = false ) {
    2851        if ( !bp_core_is_multisite() )
    2952                return "{$prefix}user_status = 0";
  • bp-core/bp-core-cssjs.php

     
    3838
    3939        <style type="text/css">
    4040                ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a { background-image: url( <?php echo BP_PLUGIN_URL . '/bp-core/images/admin_menu_icon.png' ?> ) !important; background-position: -1px -32px; }
    41                 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a { background-position: -1px 0; }
     41                ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a, ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image a { background-position: -1px 0; }
    4242                ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a img { display: none; }
    4343        </style>
    4444
  • bp-core/bp-core-templatetags.php

     
    125125        $page = 1;
    126126        $search_terms = false;
    127127
    128         /* User filtering */
     128        // User filtering
    129129        if ( !empty( $bp->displayed_user->id ) )
    130130                $user_id = $bp->displayed_user->id;
    131131
    132         /* Pass a filter if ?s= is set. */
    133         if ( $_REQUEST['s'] )
     132        // Pass a filter if ?s= is set.
     133        if ( isset( $_REQUEST['s'] ) && !empty( $_REQUEST['s'] ) )
    134134                $search_terms = $_REQUEST['s'];
    135135
    136136        // type: active ( default ) | random | newest | popular | online | alphabetical
     
    156156                        $per_page = $max;
    157157        }
    158158
    159         /* Make sure we return no members if we looking at friendship requests and there are none. */
     159        // Make sure we return no members if we looking at friendship requests and there are none.
    160160        if ( empty( $include ) && $bp->friends->slug == $bp->current_component && 'requests' == $bp->current_action )
    161161                return false;
    162162
     
    328328        function bp_get_member_registered() {
    329329                global $members_template;
    330330
    331                 $registered = attribute_escape( bp_core_get_last_activity( $members_template->member->user_registered, __( 'registered %s ago', 'buddypress' ) ) );
     331                $registered = esc_attr( bp_core_get_last_activity( $members_template->member->user_registered, __( 'registered %s ago', 'buddypress' ) ) );
    332332
    333333                return apply_filters( 'bp_member_last_active', $registered );
    334334        }
     
    345345
    346346function bp_member_hidden_fields() {
    347347        if ( isset( $_REQUEST['s'] ) ) {
    348                 echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['s'] ) . '" name="search_terms" />';
     348                echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['s'] ) . '" name="search_terms" />';
    349349        }
    350350
    351351        if ( isset( $_REQUEST['letter'] ) ) {
    352                 echo '<input type="hidden" id="selected_letter" value="' . attribute_escape( $_REQUEST['letter'] ) . '" name="selected_letter" />';
     352                echo '<input type="hidden" id="selected_letter" value="' . esc_attr( $_REQUEST['letter'] ) . '" name="selected_letter" />';
    353353        }
    354354
    355355        if ( isset( $_REQUEST['members_search'] ) ) {
    356                 echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['members_search'] ) . '" name="search_terms" />';
     356                echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['members_search'] ) . '" name="search_terms" />';
    357357        }
    358358}
    359359
     
    366366
    367367        ?>
    368368        <form action="" method="get" id="search-members-form">
    369                 <label><input type="text" name="s" id="members_search" value="<?php echo attribute_escape( $search_value ) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
     369                <label><input type="text" name="s" id="members_search" value="<?php echo esc_attr( $search_value ) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
    370370                <input type="submit" id="members_search_submit" name="members_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
    371371        </form>
    372372<?php
     
    516516        if ( empty( $bp->bp_options_title ) )
    517517                $bp->bp_options_title = __( 'Options', 'buddypress' );
    518518
    519         echo apply_filters( 'bp_get_options_title', attribute_escape( $bp->bp_options_title ) );
     519        echo apply_filters( 'bp_get_options_title', esc_attr( $bp->bp_options_title ) );
    520520}
    521521
    522522
     
    574574                global $bp;
    575575
    576576                $defaults = array(
    577                         'type' => 'thumb',
    578                         'width' => false,
    579                         'height' => false
     577                        'type'          => 'thumb',
     578                        'width'         => false,
     579                        'height'        => false,
     580                        'html'          => true
    580581                );
    581582
    582583                $r = wp_parse_args( $args, $defaults );
    583584                extract( $r, EXTR_SKIP );
    584585
    585                 return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
     586                return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->loggedin_user->id, 'type' => $type, 'width' => $width, 'height' => $height, 'html' => $html ) ) );
    586587        }
    587588
    588589function bp_displayed_user_avatar( $args = '' ) {
     
    592593                global $bp;
    593594
    594595                $defaults = array(
    595                         'type' => 'thumb',
    596                         'width' => false,
    597                         'height' => false
     596                        'type'          => 'thumb',
     597                        'width'         => false,
     598                        'height'        => false,
     599                        'html'          => true
    598600                );
    599601
    600602                $r = wp_parse_args( $args, $defaults );
    601603                extract( $r, EXTR_SKIP );
    602604
    603                 return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
     605                return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => $type, 'width' => $width, 'height' => $height, 'html' => $html ) ) );
    604606        }
    605607
    606608function bp_avatar_admin_step() {
     
    668670        if ( !$user_id )
    669671                $user_id = $bp->displayed_user->id;
    670672
    671         $last_activity = bp_core_get_last_activity( get_usermeta( $user_id, 'last_activity' ), __('active %s ago', 'buddypress') );
     673        $last_activity = bp_core_get_last_activity( get_user+meta( $user_id, 'last_activity', true ), __('active %s ago', 'buddypress') );
    672674
    673675        if ( $echo )
    674676                echo apply_filters( 'bp_last_activity', $last_activity );
     
    681683}
    682684        function bp_get_user_firstname( $name = false ) {
    683685                global $bp;
     686       
     687                // Try to get displayed user
     688                if ( empty( $name ) )
     689                        $name = $bp->displayed_user->fullname;
    684690
    685                 if ( !$name )
     691                // Fall back on logged in user
     692                if ( empty( $name ) )
    686693                        $name = $bp->loggedin_user->fullname;
    687694
    688695                $fullname = (array)explode( ' ', $name );
     
    705712<div class="bp-widget wp-profile">
    706713        <h4><?php _e( 'My Profile' ) ?></h4>
    707714
    708         <table class="wp-profile-fields">
     715        <table class="wp-profile-fields zebra">
    709716                <?php if ( $ud->display_name ) { ?>
    710717                <tr id="wp_displayname">
    711718                        <td class="label">
     
    783790}
    784791
    785792function bp_format_time( $time, $just_date = false ) {
    786         $date = date( get_option('date_format'), $time );
     793        if ( !$time )
     794                return false;
    787795
     796        // Get GMT offset from root blog
     797        $root_blog_offset = get_blog_option( BP_ROOT_BLOG, 'gmt_offset' );
     798
     799        // Calculate offset time
     800        $time_offest = $time + ( $root_blog_offset * 3600 );
     801
     802        // Current date (January 1, 2010)
     803        $date = date( 'F j, Y ', $time_offest );
     804
     805        // Should we show the time also?
    788806        if ( !$just_date ) {
    789                 $date .= ' ' . __( 'at', 'buddypress' ) . date( ' ' . get_option('time_format'), $time );
     807                // Current time (9:50pm)
     808                $time = date( ' g:ia', $time_offest );
     809
     810                // Return string formatted with date and time
     811                $date = sprintf( __( '%1$s at %2$s', 'buddypress' ), $date, $time );
    790812        }
    791813
    792814        return apply_filters( 'bp_format_time', $date );
     
    863885function bp_get_page_title() {
    864886        global $bp, $post, $wp_query, $current_blog;
    865887
    866         if ( is_front_page() || !bp_current_component() || ( is_home() && bp_is_page( 'home' ) ) ) {
     888        if ( is_front_page() || ( is_home() && bp_is_page( 'home' ) ) ) {
    867889                $title = __( 'Home', 'buddypress' );
    868890
    869891        } else if ( bp_is_blog_page() ) {
     
    951973                return apply_filters( 'bp_get_activation_page', $page );
    952974        }
    953975
     976/**
     977 * bp_search_form_available()
     978 *
     979 * Only show the search form if there are available objects to search for.
     980 *
     981 * @global array $bp
     982 * @uses function_exists
     983 * @uses bp_core_is_multisite()
     984 * @return bool Filterable result
     985 */
     986function bp_search_form_enabled() {
     987        global $bp;
     988
     989        if ( function_exists( 'xprofile_install' )
     990                 || function_exists( 'groups_install' )
     991                 || ( function_exists( 'bp_blogs_install' ) && bp_core_is_multisite() )
     992                 || ( function_exists( 'bp_forums_setup' ) && !(int)$bp->site_options['bp-disable-forum-directory'] )
     993                ) {
     994                $search_enabled = true;
     995        } else {
     996                $search_enabled = false;
     997        }
     998
     999        return apply_filters( 'bp_search_form_enabled', $search_enabled );
     1000}
     1001
    9541002function bp_search_form_action() {
    9551003        global $bp;
    9561004
     
    13641412}
    13651413
    13661414function bp_is_activity_front_page() {
    1367         return ( 'page' == get_option('show_on_front') && 'activity' == get_option('page_on_front') && $_SERVER['REQUEST_URI'] == bp_core_get_site_path() );
     1415        global $current_blog;
     1416
     1417        if ( bp_core_is_main_site() )
     1418                $path = bp_core_get_site_path();
     1419        else
     1420                $path = $current_blog->path;
     1421
     1422        return ( 'page' == get_option('show_on_front') && 'activity' == get_option('page_on_front') && $_SERVER['REQUEST_URI'] == $path );
    13681423}
    13691424
    13701425function bp_is_page($page) {
  • bp-core/bp-core-classes.php

     
    5050         * @uses bp_core_get_userurl() Returns the URL with no HTML markup for a user based on their user id
    5151         * @uses bp_core_get_userlink() Returns a HTML formatted link for a user with the user's full name as the link text
    5252         * @uses bp_core_get_user_email() Returns the email address for the user based on user ID
    53          * @uses get_usermeta() WordPress function returns the value of passed usermeta name from usermeta table
     53         * @uses get_user_meta() WordPress function returns the value of passed usermeta name from usermeta table
    5454         * @uses bp_core_fetch_avatar() Returns HTML formatted avatar for a user
    5555         * @uses bp_profile_last_updated_date() Returns the last updated date for a user.
    5656         */
     
    6060
    6161                if ( $this->profile_data ) {
    6262                        $this->user_url = bp_core_get_user_domain( $this->id, $this->profile_data['user_nicename'], $this->profile_data['user_login'] );
    63                         $this->fullname = attribute_escape( $this->profile_data[BP_XPROFILE_FULLNAME_FIELD_NAME]['field_data'] );
     63                        $this->fullname = esc_attr( $this->profile_data[BP_XPROFILE_FULLNAME_FIELD_NAME]['field_data'] );
    6464                        $this->user_link = "<a href='{$this->user_url}' title='{$this->fullname}'>{$this->fullname}</a>";
    65                         $this->email = attribute_escape( $this->profile_data['user_email'] );
     65                        $this->email = esc_attr( $this->profile_data['user_email'] );
    6666                } else {
    6767                        $this->user_url = bp_core_get_user_domain( $this->id );
    6868                        $this->user_link = bp_core_get_userlink( $this->id );
    69                         $this->fullname = attribute_escape( bp_core_get_user_displayname( $this->id ) );
    70                         $this->email = attribute_escape( bp_core_get_user_email( $this->id ) );
     69                        $this->fullname = esc_attr( bp_core_get_user_displayname( $this->id ) );
     70                        $this->email = esc_attr( bp_core_get_user_email( $this->id ) );
    7171                }
    7272
    7373                /* Cache a few things that are fetched often */
     
    7979                $this->avatar_thumb = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb' ) );
    8080                $this->avatar_mini = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) );
    8181
    82                 $this->last_active = bp_core_get_last_activity( get_usermeta( $this->id, 'last_activity' ), __( 'active %s ago', 'buddypress' ) );
     82                $this->last_active = bp_core_get_last_activity( get_user_meta( $this->id, 'last_activity', true ), __( 'active %s ago', 'buddypress' ) );
    8383        }
    8484
    8585        function populate_extras() {
     
    177177                        $sql['pagination'] = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    178178
    179179                /* Get paginated results */
    180                 $paged_users = $wpdb->get_results( join( ' ', (array)$sql ) );
     180                $paged_users_sql = apply_filters( 'bp_core_get_paged_users_sql', join( ' ', (array)$sql ), $sql );
     181                $paged_users     = $wpdb->get_results( $paged_users_sql );
    181182
    182183                /* Re-jig the SQL so we can get the total user count */
    183184                unset( $sql['select_main'] );
     
    197198                array_unshift( $sql, "SELECT COUNT(DISTINCT u.ID)" );
    198199
    199200                /* Get total user results */
    200                 $total_users = $wpdb->get_var( join( ' ', (array)$sql ) );
     201                $total_users_sql = apply_filters( 'bp_core_get_total_users_sql', join( ' ', (array)$sql ), $sql );
     202                $total_users     = $wpdb->get_var( $total_users_sql );
    201203
    202204                /***
    203205                 * Lets fetch some other useful data in a separate queries, this will be faster than querying the data for every user in a list.
     
    222224                if ( $limit && $page )
    223225                        $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    224226
    225                 if ( strlen($letter) > 1 || is_numeric($letter) || !$letter )
    226                         return false;
     227                // Multibyte compliance
     228                if ( function_exists( 'mb_strlen' ) ) {
     229                        if ( mb_strlen( $letter, 'UTF-8' ) > 1 || is_numeric( $letter ) || !$letter ) {
     230                                return false;
     231                        }
     232                } else {
     233                        if ( strlen( $letter ) > 1 || is_numeric( $letter ) || !$letter ) {
     234                                return false;
     235                        }
     236                }
    227237
    228238                $letter = like_escape( $wpdb->escape( $letter ) );
    229239                $status_sql = bp_core_get_status_sql( 'u.' );
     
    435445
    436446                if ( $this->id ) {
    437447                        // Update
    438                         $sql = $wpdb->prepare( "UPDATE {$bp->core->table_name_notifications} SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = FROM_UNIXTIME(%d), is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id );
     448                        $sql = $wpdb->prepare( "UPDATE {$bp->core->table_name_notifications} SET item_id = %d, secondary_item_id = %d, user_id = %d, component_name = %s, component_action = %d, date_notified = %s, is_new = %d ) WHERE id = %d", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new, $this->id );
    439449                } else {
    440450                        // Save
    441                         $sql = $wpdb->prepare( "INSERT INTO {$bp->core->table_name_notifications} ( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, FROM_UNIXTIME(%d), %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new );
     451                        $sql = $wpdb->prepare( "INSERT INTO {$bp->core->table_name_notifications} ( item_id, secondary_item_id, user_id, component_name, component_action, date_notified, is_new ) VALUES ( %d, %d, %d, %s, %s, %s, %d )", $this->item_id, $this->secondary_item_id, $this->user_id, $this->component_name, $this->component_action, $this->date_notified, $this->is_new );
    442452                }
    443453
    444454                if ( !$result = $wpdb->query( $sql ) )
  • bp-core/bp-core-settings.php

     
    2121        bp_core_new_subnav_item( array( 'name' => __( 'General', 'buddypress' ), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_general_settings', 'position' => 10, 'user_has_access' => bp_is_my_profile() ) );
    2222        bp_core_new_subnav_item( array( 'name' => __( 'Notifications', 'buddypress' ), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_notification_settings', 'position' => 20, 'user_has_access' => bp_is_my_profile() ) );
    2323
    24         if ( !is_site_admin() && !(int) $bp->site_options['bp-disable-account-deletion'] )
     24        if ( !is_super_admin() && !(int) $bp->site_options['bp-disable-account-deletion'] )
    2525                bp_core_new_subnav_item( array( 'name' => __( 'Delete Account', 'buddypress' ), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $bp->settings->slug, 'screen_function' => 'bp_core_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_my_profile() ) );
    2626}
    27 add_action( 'wp', 'bp_core_add_settings_nav', 2 );
    28 add_action( 'admin_menu', 'bp_core_add_settings_nav', 2 );
     27add_action( 'bp_setup_nav', 'bp_core_add_settings_nav' );
    2928
    3029/**** GENERAL SETTINGS ****/
    3130
     
    8786
    8887        <form action="<?php echo $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/general' ?>" method="post" class="standard-form" id="settings-form">
    8988                <label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label>
    90                 <input type="text" name="email" id="email" value="<?php echo attribute_escape( $current_user->user_email ); ?>" class="settings-input" />
     89                <input type="text" name="email" id="email" value="<?php echo esc_attr( $current_user->user_email ); ?>" class="settings-input" />
    9190
    9291                <label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ) ?></label>
    9392                <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'New Password', 'buddypress' ) ?><br />
     
    114113
    115114                if ( $_POST['notifications'] ) {
    116115                        foreach ( (array)$_POST['notifications'] as $key => $value ) {
    117                                 update_usermeta( (int)$current_user->id, $key, $value );
     116                                update_user_meta( (int)$current_user->id, $key, $value );
    118117                        }
    119118                }
    120119
  • bp-core/bp-core-catchuri.php

     
    4242                        return false;
    4343        }
    4444
     45        // Ajax or not?
    4546        if ( strpos( $_SERVER['REQUEST_URI'], 'wp-load.php' ) )
    4647                $path = bp_core_referrer();
    4748        else
    48                 $path = clean_url( $_SERVER['REQUEST_URI'] );
     49                $path = esc_url( $_SERVER['REQUEST_URI'] );
    4950
    5051        $path = apply_filters( 'bp_uri', $path );
    5152
    52         // Firstly, take GET variables off the URL to avoid problems,
    53         // they are still registered in the global $_GET variable */
     53        // Take GET variables off the URL to avoid problems,
     54        // they are still registered in the global $_GET variable
    5455        $noget = substr( $path, 0, strpos( $path, '?' ) );
    55         if ( $noget != '' ) $path = $noget;
     56        if ( $noget != '' )
     57                $path = $noget;
    5658
    57         /* Fetch the current URI and explode each part separated by '/' into an array */
     59        // Fetch the current URI and explode each part separated by '/' into an array
    5860        $bp_uri = explode( "/", $path );
    5961
    60         /* Loop and remove empties */
     62        // Loop and remove empties
    6163        foreach ( (array)$bp_uri as $key => $uri_chunk )
    6264                if ( empty( $bp_uri[$key] ) ) unset( $bp_uri[$key] );
    6365
    64         if ( defined( 'BP_ENABLE_MULTIBLOG' ) || 1 != BP_ROOT_BLOG ) {
    65                 /* If we are running BuddyPress on any blog, not just a root blog, we need to first
    66                    shift off the blog name if we are running a subdirectory install of WPMU. */
    67                 if ( $current_blog->path != '/' )
    68                         array_shift( $bp_uri );
    69         }
     66        // Running off blog other than root
     67        if ( defined( 'BP_ENABLE_MULTIBLOG' ) || 1 != BP_ROOT_BLOG ) {
     68 
     69                // Any subdirectory names must be removed from $bp_uri.
     70                // This includes two cases: (1) when WP is installed in a subdirectory,
     71                // and (2) when BP is running on secondary blog of a subdirectory
     72                // multisite installation. Phew!
     73                if ( $chunks = explode( '/', $current_blog->path ) ) {
     74                        foreach( $chunks as $key => $chunk ) {
     75                                $bkey = array_search( $chunk, $bp_uri );
     76 
     77                                if ( $bkey !== false )
     78                                        unset( $bp_uri[$bkey] );
     79 
     80                                $bp_uri = array_values( $bp_uri );
     81                        }
     82                }
     83        }
    7084
    71         /* Set the indexes, these are incresed by one if we are not on a VHOST install */
    72         $component_index = 0;
    73         $action_index = $component_index + 1;
     85        // Set the indexes, these are incresed by one if we are not on a VHOST install
     86        $component_index        = 0;
     87        $action_index           = $component_index + 1;
    7488
    75         /* Get site path items */
     89        // Get site path items
    7690        $paths = explode( '/', bp_core_get_site_path() );
    7791
    78         /* Take empties off the end of path */
     92        // Take empties off the end of path
    7993        if ( empty( $paths[count($paths) - 1] ) )
    8094                array_pop( $paths );
    8195
    82         /* Take empties off the start of path */
     96        // Take empties off the start of path
    8397        if ( empty( $paths[0] ) )
    8498                array_shift( $paths );
    8599
     
    89103                }
    90104        }
    91105
    92         /* Reset the keys by merging with an empty array */
    93         $bp_uri = array_merge( array(), $bp_uri );
    94         $bp_unfiltered_uri = $bp_uri;
     106        // Reset the keys by merging with an empty array
     107        $bp_uri                         = array_merge( array(), $bp_uri );
     108        $bp_unfiltered_uri      = $bp_uri;
    95109
    96         /* Find a match within registered BuddyPress controlled WP pages (check members first) */
     110        // Find a match within registered BuddyPress controlled WP pages (check members first)
    97111        foreach ( (array)$bp_pages as $page_key => $bp_page ) {
    98112                if ( in_array( $bp_page->name, (array)$bp_uri ) ) {
    99                         /* Match found, now match the slug to make sure. */
     113                        // Match found, now match the slug to make sure.
    100114                        $uri_chunks = explode( '/', $bp_page->slug );
    101115
    102116                        foreach ( (array)$uri_chunks as $key => $uri_chunk ) {
     
    119133                unset( $uri_chunks );
    120134        }
    121135
    122         /* This is not a BuddyPress page, so just return. */
     136        // This is not a BuddyPress page, so just return.
    123137        if ( in_array( 0, (array) $matches ) )
    124138                return false;
    125139
    126         /* Find the offset */
     140        // Find the offset
    127141        $uri_offset = 0;
    128142        $slug = explode( '/', $match->slug );
    129143
     
    132146                $uri_offset = count( $slug );
    133147        }
    134148
    135         /* Global the unfiltered offset to use in bp_core_load_template() */
     149        // Global the unfiltered offset to use in bp_core_load_template()
    136150        $bp_unfiltered_uri_offset = $uri_offset;
    137151
    138         /* This is a members page so lets check if we have a displayed member */
     152        // This is a members page so lets check if we have a displayed member
    139153        if ( 'members' == $match->key ) {
    140154                if ( !empty( $bp_uri[$uri_offset + 1] ) ) {
    141155                        if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     
    145159
    146160                        $uri_offset = $uri_offset + 2;
    147161
    148                         /* Remove everything from the URI up to the offset and take it from there. */
     162                        // Remove everything from the URI up to the offset and take it from there.
    149163                        for ( $i = 0; $i < $uri_offset; $i++ )
    150164                                unset( $bp_uri[$i] );
    151165
     
    153167                }
    154168        }
    155169
    156         /* Reset the keys by merging with an empty array */
     170        // Reset the keys by merging with an empty array
    157171        $bp_uri = array_merge( array(), $bp_uri );
    158172
    159         /* Set the current component */
     173        // Set the current component
    160174        if ( empty( $current_component ) ) {
    161175                for ( $i = 0; $i <= $uri_offset; $i++ ) {
    162176                        if ( !empty( $bp_uri[$i] ) ) {
     
    169183        } else
    170184                $i = 1;
    171185
    172         /* Set the current action */
     186        // Set the current action
    173187        $current_action = $bp_uri[$i];
    174188
    175         /* Unset the current_component and action from action_variables */
     189        // Unset the current_component and action from action_variables
    176190        for ( $j = 0; $j <= $i; $j++ )
    177191                unset( $bp_uri[$j] );
    178192
    179         /* Set the entire URI as the action variables, we will unset the current_component and action in a second */
     193        // Set the entire URI as the action variables, we will unset the current_component and action in a second
    180194        $action_variables = $bp_uri;
    181195
    182         /* Remove the username from action variables if this is not a VHOST install */
     196        // Remove the username from action variables if this is not a VHOST install
    183197        if ( 'no' == VHOST && !$is_root_component )
    184198                array_shift($bp_uri);
    185199
    186         /* Reset the keys by merging with an empty array */
     200        // Reset the keys by merging with an empty array
    187201        $action_variables = array_merge( array(), $action_variables );
    188202
    189203        //var_dump($current_component, $current_action, $bp_uri);
  • bp-friends/bp-friends-notifications.php

     
    55
    66        $initiator_name = bp_core_get_user_displayname( $initiator_id );
    77
    8         if ( 'no' == get_usermeta( (int)$friend_id, 'notification_friends_friendship_request' ) )
     8        if ( 'no' == get_user_meta( (int)$friend_id, 'notification_friends_friendship_request', true ) )
    99                return false;
    1010
    1111        $ud = get_userdata( $friend_id );
     
    1717        $initiator_link = bp_core_get_user_domain( $initiator_id );
    1818
    1919        // Set up and send the message
    20         $to = $ud->user_email;
    21         $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'New friendship request from %s', 'buddypress' ), $initiator_name );
     20        $to       = $ud->user_email;
     21        $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     22        $subject  = '[' . $sitename . '] ' . sprintf( __( 'New friendship request from %s', 'buddypress' ), $initiator_name );
    2223
    2324        $message = sprintf( __(
    2425"%1$s wants to add you as a friend.
     
    4748
    4849        $friend_name = bp_core_get_user_displayname( $friend_id );
    4950
    50         if ( 'no' == get_usermeta( (int)$initiator_id, 'notification_friends_friendship_accepted' ) )
     51        if ( 'no' == get_user_meta( (int)$initiator_id, 'notification_friends_friendship_accepted', true ) )
    5152                return false;
    5253
    5354        $ud = get_userdata( $initiator_id );
     
    5657        $settings_link = bp_core_get_user_domain( $initiator_id ) .  BP_SETTINGS_SLUG . '/notifications';
    5758
    5859        // Set up and send the message
    59         $to = $ud->user_email;
    60         $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $friend_name );
     60        $to       = $ud->user_email;
     61        $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     62        $subject  = '[' . $sitename . '] ' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $friend_name );
    6163
    6264        $message = sprintf( __(
    6365'%1$s accepted your friend request.
  • bp-friends/bp-friends-templatetags.php

     
    108108                <input type="search" name="friend-search-box" id="friend-search-box" value="<?php echo $value ?>"<?php echo $disabled ?> />
    109109
    110110                <?php wp_nonce_field( 'friends_search', '_wpnonce_friend_search' ) ?>
    111                 <input type="hidden" name="initiator" id="initiator" value="<?php echo attribute_escape( $bp->displayed_user->id ) ?>" />
     111                <input type="hidden" name="initiator" id="initiator" value="<?php echo esc_attr( $bp->displayed_user->id ) ?>" />
    112112
    113113                </form>
    114114        <?php
  • bp-friends/bp-friends-classes.php

     
    6060
    6161                if ( $this->id ) {
    6262                        // Update
    63                         $result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = FROM_UNIXTIME(%d) ) WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );
     63                        $result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = %s ) WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );
    6464                } else {
    6565                        // Save
    66                         $result = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->friends->table_name} ( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, FROM_UNIXTIME(%d) )", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created ) );
     66                        $result = $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->friends->table_name} ( initiator_user_id, friend_user_id, is_confirmed, is_limited, date_created ) VALUES ( %d, %d, %d, %d, %s )", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created ) );
    6767                        $this->id = $wpdb->insert_id;
    6868                }
    6969
     
    126126
    127127                $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d OR friend_user_id = %d) AND is_confirmed = 1", $user_id, $user_id ) );
    128128
    129                 if ( !$count )
    130                         return 0;
     129                if ( !$count && !get_usermeta( $user_id, 'total_friend_count' ) )
     130                        return 0;
    131131
    132                 update_usermeta( $user_id, 'total_friend_count', $count );
     132                update_user_meta( $user_id, 'total_friend_count', $count );
    133133                return $count;
    134134        }
    135135
     
    201201        function accept($friendship_id) {
    202202                global $wpdb, $bp;
    203203
    204                 return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = FROM_UNIXTIME(%d) WHERE id = %d AND friend_user_id = %d", time(), $friendship_id, $bp->loggedin_user->id ) );
     204                return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = %s WHERE id = %d AND friend_user_id = %d", bp_core_current_time(), $friendship_id, $bp->loggedin_user->id ) );
    205205        }
    206206
    207207        function reject($friendship_id) {
     
    313313
    314314        function delete_all_for_user( $user_id ) {
    315315                global $wpdb, $bp;
     316               
     317                // Get friends of $user_id
     318                $friend_ids = BP_Friends_Friendship::get_friend_user_ids( $user_id );
    316319
    317320                $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE friend_user_id = %d OR initiator_user_id = %d", $user_id, $user_id ) );
    318321
    319322                // Delete friend request notifications for members who have a notification from this user.
    320323                $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE component_name = 'friends' AND ( component_action = 'friendship_request' OR component_action = 'friendship_accepted' ) AND item_id = %d", $user_id ) );
     324               
     325                // Loop through friend_ids and update their counts
     326                foreach ( (array)$friend_ids as $friend_id ) {
     327                        BP_Friends_Friendship::total_friend_count( $friend_id );
     328                }
    321329        }
    322330}
    323331
  • bp-activity/feeds/bp-activity-favorites-feed.php

     
    1414        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    1515        xmlns:dc="http://purl.org/dc/elements/1.1/"
    1616        xmlns:atom="http://www.w3.org/2005/Atom"
    17         <?php do_action('bp_activity_mentions_feed'); ?>
     17        <?php do_action('bp_activity_favorites_feed'); ?>
    1818>
    1919
    2020<channel>
  • bp-activity/bp-activity-notifications.php

     
    44        global $bp;
    55
    66        /* Scan for @username strings in an activity update. Notify each user. */
    7         $pattern = '/[@]+([A-Za-z0-9-_]+)/';
     7        $pattern = '/[@]+([A-Za-z0-9-_\.]+)/';
    88        preg_match_all( $pattern, $content, $usernames );
    99
    1010        /* Make sure there's only one instance of each username */
     
    1616                        continue;
    1717
    1818                // Now email the user with the contents of the message (if they have enabled email notifications)
    19                 if ( 'no' != get_usermeta( $receiver_user_id, 'notification_activity_new_mention' ) ) {
     19                if ( 'no' != get_user_meta( $receiver_user_id, 'notification_activity_new_mention', true ) ) {
    2020                        $poster_name = bp_core_get_user_displayname( $poster_user_id );
    2121
    2222                        $message_link = bp_activity_get_permalink( $activity_id );
     
    2626                        $content = bp_activity_filter_kses( stripslashes($content) );
    2727
    2828                        // Set up and send the message
    29                         $ud = bp_core_get_core_userdata( $receiver_user_id );
    30                         $to = $ud->user_email;
    31                         $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( '%s mentioned you in an update', 'buddypress' ), $poster_name );
     29                        $ud       = bp_core_get_core_userdata( $receiver_user_id );
     30                        $to       = $ud->user_email;
     31                        $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     32                        $subject  = '[' . $sitename . '] ' . sprintf( __( '%s mentioned you in an update', 'buddypress' ), $poster_name );
    3233
    3334$message = sprintf( __(
    3435'%1$s mentioned you in an update:
     
    6061
    6162        $original_activity = new BP_Activity_Activity( $activity_id );
    6263
    63         if ( $original_activity->user_id != $commenter_id && 'no' != get_usermeta( $original_activity->user_id, 'notification_activity_new_reply' ) ) {
     64        if ( $original_activity->user_id != $commenter_id && 'no' != get_user_meta( $original_activity->user_id, 'notification_activity_new_reply', true ) ) {
    6465                $poster_name = bp_core_get_user_displayname( $commenter_id );
    6566                $thread_link = bp_activity_get_permalink( $activity_id );
    6667                $settings_link = bp_core_get_user_domain( $original_activity->user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
     
    6970                $content = bp_activity_filter_kses( stripslashes($content) );
    7071
    7172                // Set up and send the message
    72                 $ud = bp_core_get_core_userdata( $original_activity->user_id );
    73                 $to = $ud->user_email;
    74                 $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( '%s replied to one of your updates', 'buddypress' ), $poster_name );
     73                $ud       = bp_core_get_core_userdata( $original_activity->user_id );
     74                $to       = $ud->user_email;
     75                $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     76                $subject = '[' . $sitename . '] ' . sprintf( __( '%s replied to one of your updates', 'buddypress' ), $poster_name );
    7577
    7678$message = sprintf( __(
    7779'%1$s replied to one of your updates:
     
    102104
    103105        $parent_comment = new BP_Activity_Activity( $parent_id );
    104106
    105         if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != get_usermeta( $parent_comment->user_id, 'notification_activity_new_reply' ) ) {
     107        if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != get_user_meta( $parent_comment->user_id, 'notification_activity_new_reply', true ) ) {
    106108                $poster_name = bp_core_get_user_displayname( $commenter_id );
    107109                $thread_link = bp_activity_get_permalink( $activity_id );
    108110                $settings_link = bp_core_get_user_domain( $parent_comment->user_id ) .  BP_SETTINGS_SLUG . '/notifications/';
    109111
    110112                // Set up and send the message
    111                 $ud = bp_core_get_core_userdata( $parent_comment->user_id );
    112                 $to = $ud->user_email;
    113                 $subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( '%s replied to one of your comments', 'buddypress' ), $poster_name );
     113                $ud       = bp_core_get_core_userdata( $parent_comment->user_id );
     114                $to       = $ud->user_email;
     115                $sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     116                $subject = '[' . $sitename . '] ' . sprintf( __( '%s replied to one of your comments', 'buddypress' ), $poster_name );
    114117
    115118                $poster_name = stripslashes( $poster_name );
    116119                $content = bp_activity_filter_kses( stripslashes( $content ) );
     
    136139        }
    137140}
    138141
    139 ?>
    140  No newline at end of file
     142?>
  • bp-activity/bp-activity-templatetags.php

     
    2525                $this->disable_blogforum_replies = $bp->site_options['bp-disable-blogforum-comments'];
    2626
    2727                // Get an array of the logged in user's favorite activities
    28                 $this->my_favs = maybe_unserialize( get_usermeta( $bp->loggedin_user->id, 'bp_favorite_activities' ) );
     28                $this->my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) );
    2929
    3030                // Fetch specific activity items based on ID's
    3131                if ( !empty( $include ) )
     
    154154                $object = $bp->groups->id;
    155155                $primary_id = $bp->groups->current_group->id;
    156156
    157                 if ( 'public' != $bp->groups->current_group->status && groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
     157                if ( 'public' != $bp->groups->current_group->status && ( groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) || $bp->loggedin_user->is_super_admin ) )
    158158                        $show_hidden = true;
    159159        }
    160160
     
    402402                return apply_filters( 'bp_get_activity_user_link', $link );
    403403        }
    404404
     405/**
     406 * bp_activity_avatar( $args )
     407 *
     408 * Output the avatar of the user that performed the action
     409 *
     410 * @param array $args
     411 */
    405412function bp_activity_avatar( $args = '' ) {
    406413        echo bp_get_activity_avatar( $args );
    407414}
     415        /**
     416         * bp_get_activity_avatar( $args )
     417         *
     418         * Return the avatar of the user that performed the action
     419         *
     420         * @global array $bp
     421         * @global object $activities_template
     422         * @param array $args optional
     423         * @return string
     424         */
    408425        function bp_get_activity_avatar( $args = '' ) {
    409426                global $bp, $activities_template;
    410427
    411428                $defaults = array(
    412                         'type' => 'thumb',
    413                         'width' => 20,
     429                        'type'   => 'thumb',
     430                        'width'  => 20,
    414431                        'height' => 20,
    415                         'class' => 'avatar',
    416                         'alt' => __( 'Avatar', 'buddypress' ),
    417                         'email' => false
     432                        'class'  => 'avatar',
     433                        'alt'    => __( 'Avatar', 'buddypress' ),
     434                        'email'  => false
    418435                );
    419436
    420437                $r = wp_parse_args( $args, $defaults );
    421438                extract( $r, EXTR_SKIP );
    422439
    423                 $item_id = false;
    424                 if ( (int)$activities_template->activity->user_id )
    425                         $item_id = $activities_template->activity->user_id;
    426                 else if ( $activities_template->activity->item_id )
    427                         $item_id = $activities_template->activity->item_id;
     440                // Primary activity avatar is always a user, but can be modified via a filter
     441                $object  = apply_filters( 'bp_get_activity_avatar_object_' . $activities_template->activity->component, 'user' );
     442                $item_id = apply_filters( 'bp_get_activity_avatar_item_id', $activities_template->activity->user_id );
    428443
    429                 $object = 'user';
    430                 if ( $bp->groups->id == $activities_template->activity->component && !(int) $activities_template->activity->user_id )
    431                         $object = 'group';
    432                 if ( $bp->blogs->id == $activities_template->activity->component && !(int) $activities_template->activity->user_id )
    433                         $object = 'blog';
    434 
    435                 $object = apply_filters( 'bp_get_activity_avatar_object_' . $activities_template->activity->component, $object );
    436 
    437                 /* If this is a user object pass the users' email address for Gravatar so we don't have to refetch it. */
    438                 if ( 'user' == $object && empty($email) )
     444                // If this is a user object pass the users' email address for Gravatar so we don't have to refetch it.
     445                if ( 'user' == $object && empty( $email ) )
    439446                        $email = $activities_template->activity->user_email;
    440447
    441448                return apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $email ) ) );
    442449        }
    443450
     451/**
     452 * bp_activity_secondary_avatar( $args )
     453 *
     454 * Output the avatar of the object that action was performed on
     455 *
     456 * @param array $args optional
     457 */
     458function bp_activity_secondary_avatar( $args = '' ) {
     459        echo bp_get_activity_secondary_avatar( $args );
     460}
     461        /**
     462         * bp_get_activity_secondary_avatar( $args )
     463         *
     464         * Return the avatar of the object that action was performed on
     465         *
     466         * @global array $bp
     467         * @global object $activities_template
     468         * @param array $args optional
     469         * @return string
     470         */
     471        function bp_get_activity_secondary_avatar( $args = '' ) {
     472                global $bp, $activities_template;
     473
     474                $defaults = array(
     475                        'type'   => 'thumb',
     476                        'width'  => 20,
     477                        'height' => 20,
     478                        'class'  => 'avatar',
     479                        'alt'    => __( 'Avatar', 'buddypress' ),
     480                        'email'  => false
     481                );
     482
     483                $r = wp_parse_args( $args, $defaults );
     484                extract( $r, EXTR_SKIP );
     485
     486                // Set item_id and object (default to user)
     487                switch ( $activities_template->activity->component ) {
     488                        case 'groups' :
     489                                $object = 'group';
     490                                $item_id = $activities_template->activity->item_id;
     491                                break;
     492                        case 'blogs' :
     493                                $object = 'blog';
     494                                $item_id = $activities_template->activity->item_id;
     495                                break;
     496                        case 'friends' :
     497                                $object  = 'user';
     498                                $item_id = $activities_template->activity->secondary_item_id;
     499                                break;
     500                        default :
     501                                $object  = 'user';
     502                                $item_id = $activities_template->activity->user_id;
     503                                $email = $activities_template->activity->user_email;
     504                                break;
     505                }
     506
     507                // Allow object and item_id to be filtered
     508                $object  = apply_filters( 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component, $object );
     509                $item_id = apply_filters( 'bp_get_activity_secondary_avatar_item_id', $item_id );
     510
     511                // If we have no item_id or object, there is no avatar to display
     512                if ( empty( $item_id ) || empty( $object ) )
     513                        return false;
     514
     515                return apply_filters( 'bp_get_activity_secondary_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $email ) ) );
     516        }
     517
    444518function bp_activity_action() {
    445519        echo bp_get_activity_action();
    446520}
     
    449523
    450524                $action = $activities_template->activity->action;
    451525
     526                $action = apply_filters( 'bp_get_activity_action_pre_meta', $action, &$activities_template->activity );
     527
    452528                if ( !empty( $action ) )
    453529                        $action = bp_insert_activity_meta( $action );
    454530
     
    506582                $meta .= apply_filters( 'bp_activity_permalink', ' &middot; <a href="' . bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ) . '" class="view" title="' . __( 'View Thread / Permalink', 'buddypress' ) . '">' . __( 'View', 'buddypress' ) . '</a>', &$activities_template->activity );
    507583
    508584                /* Add the delete link if the user has permission on this item */
    509                 if ( ( is_user_logged_in() && $activities_template->activity->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin || $bp->loggedin_user->is_site_admin )
     585                if ( ( is_user_logged_in() && $activities_template->activity->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin || $bp->loggedin_user->is_super_admin )
    510586                         $meta .= apply_filters( 'bp_activity_delete_link', ' &middot; ' . bp_get_activity_delete_link(), &$activities_template->activity );
    511587
    512588                $meta .= '</span>';
     
    585661
    586662                                $content .= '<li id="acomment-' . $comment->id . '">';
    587663                                $content .= '<div class="acomment-avatar"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . bp_core_fetch_avatar( array( 'item_id' => $comment->user_id, 'width' => 25, 'height' => 25, 'email' => $comment->user_email ) ) . '</a></div>';
    588                                 $content .= '<div class="acomment-meta"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . apply_filters( 'bp_get_member_name', $comment->user_fullname ) . '</a> &middot; ' . sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( strtotime( $comment->date_recorded ) ) );
     664                                $content .= '<div class="acomment-meta"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . apply_filters( 'bp_get_member_name', $comment->user_fullname ) . '</a> &middot; ' . sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( $comment->date_recorded ) );
    589665
    590666                                /* Reply link - the span is so that threaded reply links can be hidden when JS is off. */
    591667                                if ( is_user_logged_in() )
    592668                                        $content .= '<span class="acomment-replylink"> &middot; <a href="#acomment-' . $comment->id . '" class="acomment-reply" id="acomment-reply-' . $activities_template->activity->id . '">' . __( 'Reply', 'buddypress' ) . '</a></span>';
    593669
    594670                                /* Delete link */
    595                                 if ( $bp->loggedin_user->is_site_admin || $bp->loggedin_user->id == $comment->user_id )
     671                                if ( $bp->loggedin_user->is_super_admin || $bp->loggedin_user->id == $comment->user_id )
    596672                                        $content .= ' &middot; <a href="' . wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/?cid=' . $comment->id, 'bp_activity_delete_link' ) . '" class="delete acomment-delete">' . __( 'Delete', 'buddypress' ) . '</a>';
    597673
    598674                                $content .= '</div>';
     
    738814                if ( !$user_id )
    739815                        $user_id = $bp->displayed_user->id;
    740816
    741                 if ( !$update = get_usermeta( $user_id, 'bp_latest_update' ) )
     817                if ( !$update = get_user_meta( $user_id, 'bp_latest_update', true ) )
    742818                        return false;
    743819
    744                 $latest_update = '&quot;' . trim( strip_tags( bp_create_excerpt( $update['content'], 40 ) ) ) . '&quot;';
     820                $latest_update = '&quot;' . apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 40 ) ) ) ) . '&quot;';
    745821                $latest_update .= ' &middot; <a href="' . $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $update['id'] . '/"> ' . __( 'View', 'buddypress' ) . '</a>';
    746822
    747823                return apply_filters( 'bp_get_activity_latest_update', $latest_update  );
     
    776852                        else
    777853                                unset($selected);
    778854
    779                         $component = attribute_escape( $component );
     855                        $component = esc_attr( $component );
    780856
    781857                        switch ( $style ) {
    782858                                case 'list':
     
    804880                        /* Make sure all core internal component names are translatable */
    805881                        $translatable_components = array( __( 'profile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'blogs', 'buddypress' ) );
    806882
    807                         $component_links[] = $before . '<a href="' . attribute_escape( $link ) . '">' . ucwords( __( $component, 'buddypress' ) ) . '</a>' . $after;
     883                        $component_links[] = $before . '<a href="' . esc_attr( $link ) . '">' . ucwords( __( $component, 'buddypress' ) ) . '</a>' . $after;
    808884                }
    809885
    810886                $link = remove_query_arg( 'afilter' , $link );
    811887
    812888                if ( isset( $_GET['afilter'] ) )
    813                         $component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . attribute_escape( $link ) . '"">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
     889                        $component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . esc_attr( $link ) . '"">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
    814890
    815891                return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
    816892        }
     
    840916        echo bp_get_total_favorite_count_for_user( $user_id );
    841917}
    842918        function bp_get_total_mention_count_for_user( $user_id = false ) {
    843                 return apply_filters( 'bp_get_total_mention_count_for_user', get_usermeta( $user_id, 'bp_new_mention_count' ) );
     919                return apply_filters( 'bp_get_total_mention_count_for_user', get_user_meta( $user_id, 'bp_new_mention_count', true ) );
    844920        }
    845921
    846922function bp_send_public_message_link() {
  • bp-activity/bp-activity-classes.php

     
    531531        function get_last_updated() {
    532532                global $bp, $wpdb;
    533533
    534                 return $wpdb->get_var( $wpdb->prepare( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded ASC LIMIT 1" ) );
     534                return $wpdb->get_var( $wpdb->prepare( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded DESC LIMIT 1" ) );
    535535        }
    536536
    537537        function total_favorite_count( $user_id ) {
    538538                global $bp;
    539539
    540                 if ( !$favorite_activity_entries = get_usermeta( $user_id, 'bp_favorite_activities' ) )
     540                if ( !$favorite_activity_entries = get_user_meta( $user_id, 'bp_favorite_activities', true ) )
    541541                        return 0;
    542542
    543543                return count( maybe_unserialize( $favorite_activity_entries ) );
  • bp-loader.php

     
    66Author: The BuddyPress Community
    77Version: 1.3-bleeding
    88Author URI: http://buddypress.org/community/members/
     9Network: true
    910*/
    1011
    1112define( 'BP_VERSION', '1.3-bleeding' );
  • bp-blogs.php

     
    163163                'type' => false,
    164164                'item_id' => false,
    165165                'secondary_item_id' => false,
    166                 'recorded_time' => gmdate( "Y-m-d H:i:s" ),
     166                'recorded_time' => bp_core_current_time(),
    167167                'hide_sitewide' => false
    168168        );
    169169
     
    178178                $action = apply_filters( 'bp_blogs_record_activity_action', $action );
    179179
    180180        if ( !empty( $content ) )
    181                 $content = apply_filters( 'bp_blogs_record_activity_content', bp_create_excerpt( $content ) );
     181                $content = apply_filters( 'bp_blogs_record_activity_content', bp_create_excerpt( $content ), $content );
    182182
    183183        /* Check for an existing entry and update if one exists. */
    184184        $id = bp_activity_get_activity_id( array(
     
    291291        bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'description', $description );
    292292        bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
    293293
    294         /* Only record this activity if the blog is public */
     294        // Only record this activity if the blog is public
    295295        if ( (int)$_POST['blog_public'] && !$no_activity ) {
    296                 /* Record this in activity streams */
     296                // Record this in activity streams
    297297                bp_blogs_record_activity( array(
    298298                        'user_id' => $recorded_blog->user_id,
    299                         'action' => apply_filters( 'bp_blogs_activity_created_blog_action', sprintf( __( '%1$s created the blog %2$s', 'buddypress'), bp_core_get_userlink( $recorded_blog->user_id ), '<a href="' . get_blog_option( $recorded_blog->blog_id, 'siteurl' ) . '">' . attribute_escape( $name ) . '</a>' ), &$recorded_blog, $name, $description ),
     299                        'action' => apply_filters( 'bp_blogs_activity_created_blog_action', sprintf( __( '%1$s created the blog %2$s', 'buddypress'), bp_core_get_userlink( $recorded_blog->user_id ), '<a href="' . get_blog_option( $recorded_blog->blog_id, 'siteurl' ) . '">' . esc_attr( $name ) . '</a>' ), &$recorded_blog, $name, $description ),
    300300                        'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', get_blog_option( $recorded_blog->blog_id, 'siteurl' ), $recorded_blog->blog_id ),
    301301                        'type' => 'new_blog',
    302302                        'item_id' => $recorded_blog->blog_id
     
    307307}
    308308add_action( 'wpmu_new_blog', 'bp_blogs_record_blog', 10, 2 );
    309309
     310/**
     311 * bp_blogs_update_option_blogname()
     312 *
     313 * Updates blogname in BuddyPress blogmeta table
     314 *
     315 * @global object $wpdb DB Layer
     316 * @param string $oldvalue Value before save (not used)
     317 * @param string $newvalue Value to change meta to
     318 */
     319function bp_blogs_update_option_blogname( $oldvalue, $newvalue ) {
     320        global $wpdb;
     321        bp_blogs_update_blogmeta( $wpdb->blogid, 'name', $newvalue );
     322}
     323add_action( 'update_option_blogname', 'bp_blogs_update_option_blogname', 10, 2 );
     324
     325/**
     326 * bp_blogs_update_option_blogdescription()
     327 *
     328 * Updates blogdescription in BuddyPress blogmeta table
     329 *
     330 * @global object $wpdb DB Layer
     331 * @param string $oldvalue Value before save (not used)
     332 * @param string $newvalue Value to change meta to
     333 */
     334function bp_blogs_update_option_blogdescription( $oldvalue, $newvalue ) {
     335        global $wpdb;
     336        bp_blogs_update_blogmeta( $wpdb->blogid, 'description', $newvalue );
     337}
     338add_action( 'update_option_blogdescription', 'bp_blogs_update_option_blogdescription', 10, 2 );
     339
    310340function bp_blogs_record_post( $post_id, $post, $user_id = false ) {
    311341        global $bp, $wpdb;
    312342
  • bp-messages.php

     
    55require ( BP_PLUGIN_DIR . '/bp-messages/bp-messages-filters.php' );
    66
    77function messages_setup_globals() {
    8         global $bp, $wpdb;
     8        global $bp;
    99
    1010        if ( !defined( 'BP_MESSAGES_SLUG' ) )
    1111                define ( 'BP_MESSAGES_SLUG', 'messages' );
     
    1313        /* For internal identification */
    1414        $bp->messages->id = 'messages';
    1515
    16         $bp->messages->table_name_messages = $wpdb->base_prefix . 'bp_messages_messages';
    17         $bp->messages->table_name_recipients = $wpdb->base_prefix . 'bp_messages_recipients';
    18         $bp->messages->table_name_notices = $wpdb->base_prefix . 'bp_messages_notices';
     16        $bp->messages->table_name_messages              = $bp->base_prefix . 'bp_messages_messages';
     17        $bp->messages->table_name_recipients    = $bp->base_prefix . 'bp_messages_recipients';
     18        $bp->messages->table_name_notices               = $bp->base_prefix . 'bp_messages_notices';
    1919        $bp->messages->format_notification_function = 'messages_format_notifications';
    2020        $bp->messages->slug = BP_MESSAGES_SLUG;
    2121
     
    4444        bp_core_new_subnav_item( array( 'name' => __( 'Sent Messages', 'buddypress' ), 'slug' => 'sentbox', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_sentbox', 'position' => 20, 'user_has_access' => bp_is_my_profile() ) );
    4545        bp_core_new_subnav_item( array( 'name' => __( 'Compose', 'buddypress' ), 'slug' => 'compose', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_compose', 'position' => 30, 'user_has_access' => bp_is_my_profile() ) );
    4646
    47         if ( is_site_admin() )
    48                 bp_core_new_subnav_item( array( 'name' => __( 'Notices', 'buddypress' ), 'slug' => 'notices', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_notices', 'position' => 90, 'user_has_access' => is_site_admin() ) );
     47        if ( is_super_admin() )
     48                bp_core_new_subnav_item( array( 'name' => __( 'Notices', 'buddypress' ), 'slug' => 'notices', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_notices', 'position' => 90, 'user_has_access' => is_super_admin() ) );
    4949
    5050        if ( $bp->current_component == $bp->messages->slug ) {
    5151                if ( bp_is_my_profile() ) {
     
    8484        // Remove any saved message data from a previous session.
    8585        messages_remove_callback_values();
    8686
    87         /* Check if the message form has been submitted */
     87        // Check if the message form has been submitted
    8888        if ( isset( $_POST['send'] ) ) {
    8989
    90                 /* Check the nonce */
     90                // Check the nonce
    9191                check_admin_referer( 'messages_send_message' );
    9292
    93                 /* Check we have what we need */
     93                // Check we have what we need
    9494                if ( empty( $_POST['subject'] ) || empty( $_POST['content'] ) ) {
    9595                        bp_core_add_message( __( 'There was an error sending that message, please try again', 'buddypress' ), 'error' );
    9696                } else {
    97                         /* If this is a notice, send it */
     97                        // If this is a notice, send it
    9898                        if ( isset( $_POST['send-notice'] ) ) {
    9999                                if ( messages_send_notice( $_POST['subject'], $_POST['content'] ) ) {
    100100                                        bp_core_add_message( __( 'Notice sent successfully!', 'buddypress' ) );
     
    103103                                        bp_core_add_message( __( 'There was an error sending that notice, please try again', 'buddypress' ), 'error' );
    104104                                }
    105105                        } else {
    106                                 /* Filter recipients into the format we need - array( 'username/userid', 'username/userid' ) */
     106                                // Filter recipients into the format we need - array( 'username/userid', 'username/userid' )
    107107                                $autocomplete_recipients = explode( ',', $_POST['send-to-input'] );
    108                                 $typed_recipients = explode( ' ', $_POST['send_to_usernames'] );
    109                                 $recipients = array_merge( (array) $autocomplete_recipients, (array) $typed_recipients );
     108                                $typed_recipients        = explode( ' ', $_POST['send_to_usernames'] );
     109                                $recipients              = array_merge( (array) $autocomplete_recipients, (array) $typed_recipients );
     110                                $recipients              = apply_filters( 'bp_messages_recipients', $recipients );
    110111
    111                                 /* Send the message */
     112                                // Send the message
    112113                                if ( $thread_id = messages_new_message( array( 'recipients' => $recipients, 'subject' => $_POST['subject'], 'content' => $_POST['content'] ) ) ) {
    113114                                        bp_core_add_message( __( 'Message sent successfully!', 'buddypress' ) );
    114115                                        bp_core_redirect( $bp->loggedin_user->domain . $bp->messages->slug . '/view/' . $thread_id . '/' );
     
    117118                                }
    118119                        }
    119120                }
    120 
    121121        }
    122122
    123123        do_action( 'messages_screen_compose' );
     
    128128function messages_screen_notices() {
    129129        global $bp, $notice_id;
    130130
    131         if ( !is_site_admin() )
     131        if ( !is_super_admin() )
    132132                return false;
    133133
    134134        $notice_id = $bp->action_variables[1];
     
    165165
    166166function messages_screen_notification_settings() {
    167167        global $current_user; ?>
    168         <table class="notification-settings" id="messages-notification-settings">
    169                 <tr>
    170                         <th class="icon"></th>
    171                         <th class="title"><?php _e( 'Messages', 'buddypress' ) ?></th>
    172                         <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
    173                         <th class="no"><?php _e( 'No', 'buddypress' )?></th>
    174                 </tr>
    175                 <tr>
    176                         <td></td>
    177                         <td><?php _e( 'A member sends you a new message', 'buddypress' ) ?></td>
    178                         <td class="yes"><input type="radio" name="notifications[notification_messages_new_message]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_messages_new_message' ) || 'yes' == get_usermeta( $current_user->id, 'notification_messages_new_message' ) ) { ?>checked="checked" <?php } ?>/></td>
    179                         <td class="no"><input type="radio" name="notifications[notification_messages_new_message]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_messages_new_message' ) ) { ?>checked="checked" <?php } ?>/></td>
    180                 </tr>
    181                 <tr>
    182                         <td></td>
    183                         <td><?php _e( 'A new site notice is posted', 'buddypress' ) ?></td>
    184                         <td class="yes"><input type="radio" name="notifications[notification_messages_new_notice]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_messages_new_notice' ) || 'yes' == get_usermeta( $current_user->id, 'notification_messages_new_notice' ) ) { ?>checked="checked" <?php } ?>/></td>
    185                         <td class="no"><input type="radio" name="notifications[notification_messages_new_notice]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_messages_new_notice' ) ) { ?>checked="checked" <?php } ?>/></td>
    186                 </tr>
     168        <table class="notification-settings zebra" id="messages-notification-settings">
     169                <thead>
     170                        <tr>
     171                                <th class="icon"></th>
     172                                <th class="title"><?php _e( 'Messages', 'buddypress' ) ?></th>
     173                                <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
     174                                <th class="no"><?php _e( 'No', 'buddypress' )?></th>
     175                        </tr>
     176                </thead>
    187177
    188                 <?php do_action( 'messages_screen_notification_settings' ) ?>
     178                <tbody>
     179                        <tr>
     180                                <td></td>
     181                                <td><?php _e( 'A member sends you a new message', 'buddypress' ) ?></td>
     182                                <td class="yes"><input type="radio" name="notifications[notification_messages_new_message]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_messages_new_message', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_messages_new_message', true ) ) { ?>checked="checked" <?php } ?>/></td>
     183                                <td class="no"><input type="radio" name="notifications[notification_messages_new_message]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_messages_new_message', true ) ) { ?>checked="checked" <?php } ?>/></td>
     184                        </tr>
     185                        <tr>
     186                                <td></td>
     187                                <td><?php _e( 'A new site notice is posted', 'buddypress' ) ?></td>
     188                                <td class="yes"><input type="radio" name="notifications[notification_messages_new_notice]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_messages_new_notice', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_messages_new_notice', true ) ) { ?>checked="checked" <?php } ?>/></td>
     189                                <td class="no"><input type="radio" name="notifications[notification_messages_new_notice]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_messages_new_notice', true ) ) { ?>checked="checked" <?php } ?>/></td>
     190                        </tr>
     191
     192                        <?php do_action( 'messages_screen_notification_settings' ) ?>
     193                </tbody>
    189194        </table>
    190195<?php
    191196}
     
    208213
    209214        $thread_id = $bp->action_variables[0];
    210215
    211         if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access($thread_id) && !is_site_admin() ) )
     216        if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access($thread_id) && !is_super_admin() ) )
    212217                bp_core_redirect( $bp->displayed_user->domain . $bp->current_component );
    213218
    214219        /* Check if a new reply has been submitted */
     
    327332                'recipients' => false, // Can be an array of usernames, user_ids or mixed.
    328333                'subject' => false,
    329334                'content' => false,
    330                 'date_sent' => time()
     335                'date_sent' => bp_core_current_time()
    331336        );
    332337
    333338        $r = wp_parse_args( $args, $defaults );
     
    344349        $message->message = $content;
    345350        $message->date_sent = $date_sent;
    346351
    347         /* If we have a thread ID, use the existing recipients, otherwise use the recipients passed */
     352        // If we have a thread ID, use the existing recipients, otherwise use the recipients passed
    348353        if ( $thread_id ) {
    349354                $thread = new BP_Messages_Thread( $thread_id );
    350355                $message->recipients = $thread->get_recipients();
    351356
     357                // Strip the sender from the recipient list if they exist
     358                if ( isset( $message->recipients[$sender_id] ) )
     359                        unset( $message->recipients[$sender_id] );
     360
    352361                if ( empty( $message->subject ) )
    353362                        $message->subject = sprintf( __( 'Re: %s', 'buddypress' ), $thread->messages[0]->subject );
    354363
     364        // No thread ID, so make some adjustments
    355365        } else {
    356366                if ( empty( $recipients ) )
    357367                        return false;
     
    405415
    406416
    407417function messages_send_notice( $subject, $message ) {
    408         if ( !is_site_admin() || empty( $subject ) || empty( $message ) ) {
     418        if ( !is_super_admin() || empty( $subject ) || empty( $message ) ) {
    409419                return false;
    410420        } else {
    411421                // Has access to send notices, lets do it.
    412422                $notice = new BP_Messages_Notice;
    413423                $notice->subject = $subject;
    414424                $notice->message = $message;
    415                 $notice->date_sent = time();
     425                $notice->date_sent = bp_core_current_time();
    416426                $notice->is_active = 1;
    417427                $notice->save(); // send it.
    418428
  • bp-forums.php

     
    6262
    6363                        if ( $bp->groups->current_group = groups_get_group( array( 'group_id' => $_POST['topic_group_id'] ) ) ) {
    6464                                /* Auto join this user if they are not yet a member of this group */
    65                                 if ( !is_site_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
     65                                if ( !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
    6666                                        groups_join_group( $bp->groups->current_group->id, $bp->groups->current_group->id );
    6767
    6868                                if ( $forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ) ) {
     
    7272                                                bp_core_add_message( __( 'The topic was created successfully', 'buddypress') );
    7373
    7474                                        bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . '/forum/topic/' . $topic->topic_slug . '/' );
     75                                } else {
     76                                        bp_core_add_message( __( 'Please pick the group forum where you would like to post this topic.', 'buddypress' ), 'error' );
    7577                                }
    7678                        }
    7779                }
     
    8688function bp_forums_add_admin_menu() {
    8789        global $bp;
    8890
    89         if ( !is_site_admin() )
     91        if ( !is_super_admin() )
    9092                return false;
    9193
    9294        require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-admin.php' );
     
    120122        return bb_new_forum( array( 'forum_name' => stripslashes( $forum_name ), 'forum_desc' => stripslashes( $forum_desc ), 'forum_parent' => $forum_parent_id, 'forum_order' => $forum_order, 'forum_is_category' => $forum_is_category ) );
    121123}
    122124
     125function bp_forums_update_forum( $args = '' ) {
     126        do_action( 'bbpress_init' );
     127
     128        $defaults = array(
     129                'forum_id'                      => '',
     130                'forum_name'            => '',
     131                'forum_desc'            => '',
     132                'forum_slug'            => '',
     133                'forum_parent_id'       => BP_FORUMS_PARENT_FORUM_ID,
     134                'forum_order'           => false,
     135                'forum_is_category'     => 0
     136        );
     137
     138        $r = wp_parse_args( $args, $defaults );
     139        extract( $r, EXTR_SKIP );
     140
     141        return bb_update_forum( array( 'forum_id' => (int)$forum_id, 'forum_name' => stripslashes( $forum_name ), 'forum_desc' => stripslashes( $forum_desc ), 'forum_slug' => stripslashes( $forum_slug ), 'forum_parent' => $forum_parent_id, 'forum_order' => $forum_order, 'forum_is_category' => $forum_is_category ) );
     142}
     143
    123144/* Topic Functions */
    124145
    125146function bp_forums_get_forum_topics( $args = '' ) {
     
    500521function bp_forums_filter_caps( $allcaps ) {
    501522        global $bp, $wp_roles, $bb_table_prefix;
    502523
    503         $bb_cap = get_usermeta( $bp->loggedin_user->id, $bb_table_prefix . 'capabilities' );
     524        $bb_cap = get_user_meta( $bp->loggedin_user->id, $bb_table_prefix . 'capabilities', true );
    504525
    505526        if ( empty( $bb_cap ) )
    506527                return $allcaps;
  • bp-groups.php

     
    1515        $bp->groups->name = $bp->pages->groups->name;
    1616        $bp->groups->slug = BP_GROUPS_SLUG;
    1717
    18         $bp->groups->table_name = $wpdb->base_prefix . 'bp_groups';
    19         $bp->groups->table_name_members = $wpdb->base_prefix . 'bp_groups_members';
    20         $bp->groups->table_name_groupmeta = $wpdb->base_prefix . 'bp_groups_groupmeta';
     18        $bp->groups->table_name = $bp->base_prefix . 'bp_groups';
     19        $bp->groups->table_name_members = $bp->base_prefix . 'bp_groups_members';
     20        $bp->groups->table_name_groupmeta = $bp->base_prefix . 'bp_groups_groupmeta';
    2121        $bp->groups->format_notification_function = 'groups_format_notifications';
    2222
    2323        /* Register this in the active components array */
     
    3636
    3737        $bp->groups->valid_status = apply_filters( 'groups_valid_status', array( 'public', 'private', 'hidden' ) );
    3838
     39        // Auto join group when non group member performs group activity
     40        $bp->groups->auto_join = defined( 'BP_DISABLE_AUTO_GROUP_JOIN' ) ? false : true;
     41
    3942        do_action( 'groups_setup_globals' );
    4043}
    4144add_action( 'bp_setup_globals', 'groups_setup_globals' );
     
    5053                $bp->groups->current_group = new BP_Groups_Group( $group_id );
    5154
    5255                /* Using "item" not "group" for generic support in other components. */
    53                 if ( is_site_admin() )
     56                if ( is_super_admin() )
    5457                        $bp->is_item_admin = 1;
    5558                else
    5659                        $bp->is_item_admin = groups_is_user_admin( $bp->loggedin_user->id, $bp->groups->current_group->id );
     
    99102                        $bp->bp_options_title = $bp->groups->current_group->name;
    100103
    101104                        if ( !$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->groups->current_group->id, 'object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'alt' => __( 'Group Avatar', 'buddypress' ) ) ) )
    102                                 $bp->bp_options_avatar = '<img src="' . attribute_escape( $group->avatar_full ) . '" class="avatar" alt="' . attribute_escape( $group->name ) . '" />';
     105                                $bp->bp_options_avatar = '<img src="' . esc_attr( $group->avatar_full ) . '" class="avatar" alt="' . esc_attr( $group->name ) . '" />';
    103106
    104107                        $group_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $bp->groups->current_group->slug . '/';
    105108
    106109                        // If this is a private or hidden group, does the user have access?
    107110                        if ( 'private' == $bp->groups->current_group->status || 'hidden' == $bp->groups->current_group->status ) {
    108                                 if ( $bp->groups->current_group->is_user_member && is_user_logged_in() || is_site_admin() )
     111                                if ( $bp->groups->current_group->is_user_member && is_user_logged_in() || is_super_admin() )
    109112                                        $bp->groups->current_group->user_has_access = true;
    110113                                else
    111114                                        $bp->groups->current_group->user_has_access = false;
     
    127130                                bp_core_new_subnav_item( array( 'name' => __( 'Admin', 'buddypress' ), 'slug' => 'admin', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_admin', 'position' => 20, 'user_has_access' => ( $bp->is_item_admin + (int)$bp->is_item_mod ), 'item_css_id' => 'admin' ) );
    128131
    129132                        // If this is a private group, and the user is not a member, show a "Request Membership" nav item.
    130                         if ( !is_site_admin() && is_user_logged_in() && !$bp->groups->current_group->is_user_member && !groups_check_for_membership_request( $bp->loggedin_user->id, $bp->groups->current_group->id ) && $bp->groups->current_group->status == 'private' )
     133                        if ( !is_super_admin() && is_user_logged_in() && !$bp->groups->current_group->is_user_member && !groups_check_for_membership_request( $bp->loggedin_user->id, $bp->groups->current_group->id ) && $bp->groups->current_group->status == 'private' )
    131134                                bp_core_new_subnav_item( array( 'name' => __( 'Request Membership', 'buddypress' ), 'slug' => 'request-membership', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_request_membership', 'position' => 30 ) );
    132135
    133136                        if ( $bp->groups->current_group->enable_forum && function_exists('bp_forums_setup') )
     
    165168                return false;
    166169
    167170        /* Don't show this menu to non site admins or if you're viewing your own profile */
    168         if ( !is_site_admin() )
     171        if ( !is_super_admin() )
    169172                return false;
    170173        ?>
    171174        <li id="bp-adminbar-adminoptions-menu">
     
    225228                        $group = new BP_Groups_Group( $group_id );
    226229
    227230                        groups_record_activity( array(
    228                                 'action' => apply_filters( 'groups_activity_accepted_invite_action', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . attribute_escape( $group->name ) . '</a>' ), $bp->loggedin_user->id, &$group ),
     231                                'action' => apply_filters( 'groups_activity_accepted_invite_action', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . esc_attr( $group->name ) . '</a>' ), $bp->loggedin_user->id, &$group ),
    229232                                'type' => 'joined_group',
    230233                                'item_id' => $group->id
    231234                        ) );
     
    291294                                check_admin_referer( 'bp_forums_new_reply' );
    292295
    293296                                /* Auto join this user if they are not yet a member of this group */
    294                                 if ( !is_site_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
     297                                if ( $bp->groups->auto_join && !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
    295298                                        groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id );
    296299
    297300                                if ( !$post_id = groups_new_group_forum_post( $_POST['reply_text'], $topic_id, $_GET['topic_page'] ) )
     
    469472                                check_admin_referer( 'bp_forums_new_topic' );
    470473
    471474                                /* Auto join this user if they are not yet a member of this group */
    472                                 if ( !is_site_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
     475                                if ( $bp->groups->auto_join && !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
    473476                                        groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id );
    474477
    475478                                if ( !$topic = groups_new_group_forum_topic( $_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id ) )
     
    710713                        $user_id = $bp->action_variables[3];
    711714                        $status = $bp->action_variables[2];
    712715
    713                         /* Check the nonce first. */
     716                        // Check the nonce first.
    714717                        if ( !check_admin_referer( 'groups_promote_member' ) )
    715718                                return false;
    716719
    717720                        // Promote a user.
    718                         if ( !groups_promote_member( $user_id, $bp->groups->current_group->id, $status ) ) {
     721                        if ( !groups_promote_member( $user_id, $bp->groups->current_group->id, $status ) )
    719722                                bp_core_add_message( __( 'There was an error when promoting that user, please try again', 'buddypress' ), 'error' );
    720                         } else {
     723                        else
    721724                                bp_core_add_message( __( 'User promoted successfully', 'buddypress' ) );
    722                         }
    723725
    724726                        do_action( 'groups_promoted_member', $user_id, $bp->groups->current_group->id );
    725727
     
    729731                if ( 'demote' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
    730732                        $user_id = $bp->action_variables[2];
    731733
    732                         /* Check the nonce first. */
     734                        // Check the nonce first.
    733735                        if ( !check_admin_referer( 'groups_demote_member' ) )
    734736                                return false;
    735737
    736738                        // Demote a user.
    737                         if ( !groups_demote_member( $user_id, $bp->groups->current_group->id ) ) {
     739                        if ( !groups_demote_member( $user_id, $bp->groups->current_group->id ) )
    738740                                bp_core_add_message( __( 'There was an error when demoting that user, please try again', 'buddypress' ), 'error' );
    739                         } else {
     741                        else
    740742                                bp_core_add_message( __( 'User demoted successfully', 'buddypress' ) );
    741                         }
    742743
    743744                        do_action( 'groups_demoted_member', $user_id, $bp->groups->current_group->id );
    744745
     
    748749                if ( 'ban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
    749750                        $user_id = $bp->action_variables[2];
    750751
    751                         /* Check the nonce first. */
     752                        // Check the nonce first.
    752753                        if ( !check_admin_referer( 'groups_ban_member' ) )
    753754                                return false;
    754755
    755756                        // Ban a user.
    756                         if ( !groups_ban_member( $user_id, $bp->groups->current_group->id ) ) {
     757                        if ( !groups_ban_member( $user_id, $bp->groups->current_group->id ) )
    757758                                bp_core_add_message( __( 'There was an error when banning that user, please try again', 'buddypress' ), 'error' );
    758                         } else {
     759                        else
    759760                                bp_core_add_message( __( 'User banned successfully', 'buddypress' ) );
    760                         }
    761761
    762762                        do_action( 'groups_banned_member', $user_id, $bp->groups->current_group->id );
    763763
     
    767767                if ( 'unban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
    768768                        $user_id = $bp->action_variables[2];
    769769
    770                         /* Check the nonce first. */
     770                        // Check the nonce first.
    771771                        if ( !check_admin_referer( 'groups_unban_member' ) )
    772772                                return false;
    773773
    774774                        // Remove a ban for user.
    775                         if ( !groups_unban_member( $user_id, $bp->groups->current_group->id ) ) {
     775                        if ( !groups_unban_member( $user_id, $bp->groups->current_group->id ) )
    776776                                bp_core_add_message( __( 'There was an error when unbanning that user, please try again', 'buddypress' ), 'error' );
    777                         } else {
     777                        else
    778778                                bp_core_add_message( __( 'User ban removed successfully', 'buddypress' ) );
    779                         }
    780779
    781780                        do_action( 'groups_unbanned_member', $user_id, $bp->groups->current_group->id );
    782781
    783782                        bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
    784783                }
    785784
     785                if ( 'remove' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
     786                        $user_id = $bp->action_variables[2];
     787
     788                        // Check the nonce first.
     789                        if ( !check_admin_referer( 'groups_remove_member' ) )
     790                                return false;
     791
     792                        // Remove a user.
     793                        if ( !groups_remove_member( $bp->groups->current_group->id, $user_id ) )
     794                                bp_core_add_message( __( 'There was an error removing that user from the group, please try again', 'buddypress' ), 'error' );
     795                        else
     796                                bp_core_add_message( __( 'User removed successfully', 'buddypress' ) );
     797
     798                        do_action( 'groups_removed_member', $user_id, $bp->groups->current_group->id );
     799
     800                        bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' );
     801                }
     802
    786803                do_action( 'groups_screen_group_admin_manage_members', $bp->groups->current_group->id );
    787804
    788805                bp_core_load_template( apply_filters( 'groups_template_group_admin_manage_members', 'groups/single/home' ) );
     
    849866
    850867        if ( $bp->current_component == $bp->groups->slug && 'delete-group' == $bp->action_variables[0] ) {
    851868
    852                 if ( !$bp->is_item_admin && !is_site_admin() )
     869                if ( !$bp->is_item_admin && !is_super_admin() )
    853870                        return false;
    854871
    855872                if ( isset( $_REQUEST['delete-group-button'] ) && isset( $_REQUEST['delete-group-understand'] ) ) {
     
    880897
    881898function groups_screen_notification_settings() {
    882899        global $current_user; ?>
    883         <table class="notification-settings" id="groups-notification-settings">
    884                 <tr>
    885                         <th class="icon"></th>
    886                         <th class="title"><?php _e( 'Groups', 'buddypress' ) ?></th>
    887                         <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
    888                         <th class="no"><?php _e( 'No', 'buddypress' )?></th>
    889                 </tr>
    890                 <tr>
    891                         <td></td>
    892                         <td><?php _e( 'A member invites you to join a group', 'buddypress' ) ?></td>
    893                         <td class="yes"><input type="radio" name="notifications[notification_groups_invite]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_invite') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_invite') ) { ?>checked="checked" <?php } ?>/></td>
    894                         <td class="no"><input type="radio" name="notifications[notification_groups_invite]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_invite') ) { ?>checked="checked" <?php } ?>/></td>
    895                 </tr>
    896                 <tr>
    897                         <td></td>
    898                         <td><?php _e( 'Group information is updated', 'buddypress' ) ?></td>
    899                         <td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_group_updated') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_group_updated') ) { ?>checked="checked" <?php } ?>/></td>
    900                         <td class="no"><input type="radio" name="notifications[notification_groups_group_updated]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_group_updated') ) { ?>checked="checked" <?php } ?>/></td>
    901                 </tr>
    902                 <tr>
    903                         <td></td>
    904                         <td><?php _e( 'You are promoted to a group administrator or moderator', 'buddypress' ) ?></td>
    905                         <td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_admin_promotion') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_admin_promotion') ) { ?>checked="checked" <?php } ?>/></td>
    906                         <td class="no"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_admin_promotion') ) { ?>checked="checked" <?php } ?>/></td>
    907                 </tr>
    908                 <tr>
    909                         <td></td>
    910                         <td><?php _e( 'A member requests to join a private group for which you are an admin', 'buddypress' ) ?></td>
    911                         <td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" value="yes" <?php if ( !get_usermeta( $current_user->id, 'notification_groups_membership_request') || 'yes' == get_usermeta( $current_user->id, 'notification_groups_membership_request') ) { ?>checked="checked" <?php } ?>/></td>
    912                         <td class="no"><input type="radio" name="notifications[notification_groups_membership_request]" value="no" <?php if ( 'no' == get_usermeta( $current_user->id, 'notification_groups_membership_request') ) { ?>checked="checked" <?php } ?>/></td>
    913                 </tr>
     900        <table class="notification-settings zebra" id="groups-notification-settings">
     901                <thead>
     902                        <tr>
     903                                <th class="icon"></th>
     904                                <th class="title"><?php _e( 'Groups', 'buddypress' ) ?></th>
     905                                <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
     906                                <th class="no"><?php _e( 'No', 'buddypress' )?></th>
     907                        </tr>
     908                </thead>
    914909
    915                 <?php do_action( 'groups_screen_notification_settings' ); ?>
     910                <tbody>
     911                        <tr>
     912                                <td></td>
     913                                <td><?php _e( 'A member invites you to join a group', 'buddypress' ) ?></td>
     914                                <td class="yes"><input type="radio" name="notifications[notification_groups_invite]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_groups_invite', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_groups_invite', true ) ) { ?>checked="checked" <?php } ?>/></td>
     915                                <td class="no"><input type="radio" name="notifications[notification_groups_invite]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_groups_invite', true ) ) { ?>checked="checked" <?php } ?>/></td>
     916                        </tr>
     917                        <tr>
     918                                <td></td>
     919                                <td><?php _e( 'Group information is updated', 'buddypress' ) ?></td>
     920                                <td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_groups_group_updated', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_groups_group_updated', true ) ) { ?>checked="checked" <?php } ?>/></td>
     921                                <td class="no"><input type="radio" name="notifications[notification_groups_group_updated]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_groups_group_updated', true ) ) { ?>checked="checked" <?php } ?>/></td>
     922                        </tr>
     923                        <tr>
     924                                <td></td>
     925                                <td><?php _e( 'You are promoted to a group administrator or moderator', 'buddypress' ) ?></td>
     926                                <td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_groups_admin_promotion', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_groups_admin_promotion', true ) ) { ?>checked="checked" <?php } ?>/></td>
     927                                <td class="no"><input type="radio" name="notifications[notification_groups_admin_promotion]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_groups_admin_promotion', true ) ) { ?>checked="checked" <?php } ?>/></td>
     928                        </tr>
     929                        <tr>
     930                                <td></td>
     931                                <td><?php _e( 'A member requests to join a private group for which you are an admin', 'buddypress' ) ?></td>
     932                                <td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_groups_membership_request', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_groups_membership_request', true ) ) { ?>checked="checked" <?php } ?>/></td>
     933                                <td class="no"><input type="radio" name="notifications[notification_groups_membership_request]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_groups_membership_request', true ) ) { ?>checked="checked" <?php } ?>/></td>
     934                        </tr>
     935
     936                        <?php do_action( 'groups_screen_notification_settings' ); ?>
     937                </tbody>
    916938        </table>
    917939<?php
    918940}
     
    10401062
    10411063                        /* Once we compelete all steps, record the group creation in the activity stream. */
    10421064                        groups_record_activity( array(
    1043                                 'action' => apply_filters( 'groups_activity_created_group_action', sprintf( __( '%1$s created the group %2$s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' ) ),
     1065                                'action' => apply_filters( 'groups_activity_created_group_action', sprintf( __( '%1$s created the group %2$s', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' ) ),
    10441066                                'type' => 'created_group',
    10451067                                'item_id' => $bp->groups->new_group_id
    10461068                        ) );
     
    12171239                'type' => false,
    12181240                'item_id' => false,
    12191241                'secondary_item_id' => false,
    1220                 'recorded_time' => gmdate( "Y-m-d H:i:s" ),
     1242                'recorded_time' => bp_core_current_time(),
    12211243                'hide_sitewide' => $hide_sitewide
    12221244        );
    12231245
     
    14801502        return true;
    14811503}
    14821504
     1505/**
     1506 * Delete a group and all of its associated meta
     1507 *
     1508 * @global object $bp BuddyPress global settings
     1509 * @param int $group_id
     1510 * @since 1.0
     1511 */
    14831512function groups_delete_group( $group_id ) {
    14841513        global $bp;
    14851514
     
    14891518
    14901519        // Get the group object
    14911520        $group = new BP_Groups_Group( $group_id );
    1492 
    14931521        if ( !$group->delete() )
    14941522                return false;
    14951523
    1496         /* Delete all group activity from activity streams */
    1497         if ( function_exists( 'bp_activity_delete_by_item_id' ) ) {
     1524        // Delete all group activity from activity streams
     1525        if ( bp_is_active( 'activity' ) )
    14981526                bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component' => $bp->groups->id ) );
    1499         }
    15001527
    15011528        // Remove all outstanding invites for this group
    15021529        groups_delete_all_group_invites( $group_id );
     
    15041531        // Remove all notifications for any user belonging to this group
    15051532        bp_core_delete_all_notifications_by_type( $group_id, $bp->groups->slug );
    15061533
    1507         do_action( 'groups_delete_group', $group_id );
     1534        // Remove forum if component is active and current group has one
     1535        if ( function_exists( 'bp_forums_setup' ) && $group->enable_forum ) {
     1536                do_action( 'bbpress_init' );
     1537                bb_delete_forum( groups_get_groupmeta( $group_id, 'forum_id' ) );
     1538        }
    15081539
     1540        do_action( 'groups_delete_group', $group_id);
     1541
    15091542        return true;
    15101543}
    15111544
     
    15661599        groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') - 1 );
    15671600
    15681601        /* Modify user's group memberhip count */
    1569         update_usermeta( $user_id, 'total_group_count', (int) get_usermeta( $user_id, 'total_group_count') - 1 );
     1602        update_user_meta( $user_id, 'total_group_count', (int) get_user_meta( $user_id, 'total_group_count', true ) - 1 );
    15701603
    15711604        /* If the user joined this group less than five minutes ago, remove the joined_group activity so
    15721605         * users cannot flood the activity stream by joining/leaving the group in quick succession.
     
    16161649
    16171650        /* Record this in activity streams */
    16181651        groups_record_activity( array(
    1619                 'action' => apply_filters( 'groups_activity_joined_group', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' ) ),
     1652                'action' => apply_filters( 'groups_activity_joined_group', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' ) ),
    16201653                'type' => 'joined_group',
    16211654                'item_id' => $group_id
    16221655        ) );
     
    17431776        return BP_Groups_Member::check_is_banned( $user_id, $group_id );
    17441777}
    17451778
     1779/**
     1780 * Is the specified user the creator of the group?
     1781 *
     1782 * @param int $user_id
     1783 * @param int $group_id
     1784 * @since 1.2.6
     1785 * @uses BP_Groups_Member
     1786 */
     1787function groups_is_user_creator( $user_id, $group_id ) {
     1788        return BP_Groups_Member::check_is_creator( $user_id, $group_id );
     1789}
     1790
    17461791/*** Group Activity Posting **************************************************/
    17471792
    17481793function groups_post_update( $args = '' ) {
     
    17631808        $bp->groups->current_group = new BP_Groups_Group( $group_id );
    17641809
    17651810        /* Be sure the user is a member of the group before posting. */
    1766         if ( !is_site_admin() && !groups_is_user_member( $user_id, $group_id ) )
     1811        if ( !is_super_admin() && !groups_is_user_member( $user_id, $group_id ) )
    17671812                return false;
    17681813
    17691814        /* Record this in activity streams */
    1770         $activity_action = sprintf( __( '%1$s posted an update in the group %2$s:', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
     1815        $activity_action = sprintf( __( '%1$s posted an update in the group %2$s:', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
    17711816        $activity_content = $content;
    17721817
    17731818        $activity_id = groups_record_activity( array(
     
    18081853        do_action( 'groups_new_group_forum', $forum, $group_id );
    18091854}
    18101855
     1856function groups_update_group_forum( $group_id ) {
     1857
     1858        $group = new BP_Groups_Group( $group_id );
     1859
     1860        if ( !$group->enable_forum || !function_exists( 'bp_forums_setup' ) )
     1861                return false;
     1862
     1863        $args = array(
     1864                'forum_id'      => groups_get_groupmeta( $group_id, 'forum_id' ),
     1865                'forum_name'    => $group->name,
     1866                'forum_desc'    => $group->desc,
     1867                'forum_slug'    => $group->slug
     1868        );
     1869
     1870        bp_forums_update_forum( apply_filters( 'groups_update_group_forum', $args ) );
     1871}
     1872add_action( 'groups_details_updated', 'groups_update_group_forum' );
     1873
    18111874function groups_new_group_forum_post( $post_text, $topic_id, $page = false ) {
    18121875        global $bp;
    18131876
     
    18201883        if ( $post_id = bp_forums_insert_post( array( 'post_text' => $post_text, 'topic_id' => $topic_id ) ) ) {
    18211884                $topic = bp_forums_get_topic_details( $topic_id );
    18221885
    1823                 $activity_action = sprintf( __( '%1$s posted on the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . attribute_escape( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
     1886                $activity_action = sprintf( __( '%1$s posted on the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
    18241887                $activity_content = bp_create_excerpt( $post_text );
    18251888                $primary_link = bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/';
    18261889
     
    18591922        if ( $topic_id = bp_forums_new_topic( array( 'topic_title' => $topic_title, 'topic_text' => $topic_text, 'topic_tags' => $topic_tags, 'forum_id' => $forum_id ) ) ) {
    18601923                $topic = bp_forums_get_topic_details( $topic_id );
    18611924
    1862                 $activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . attribute_escape( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
     1925                $activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $bp->loggedin_user->id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
    18631926                $activity_content = bp_create_excerpt( $topic_text );
    18641927
    18651928                /* Record this in activity streams */
     
    18911954                if ( function_exists( 'bp_activity_delete_by_item_id' ) )
    18921955                        bp_activity_delete_by_item_id( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $topic_id, 'component' => $bp->groups->id, 'type' => 'new_forum_topic' ) );
    18931956
    1894                 $activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $topic->topic_poster ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . attribute_escape( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
     1957                $activity_action = sprintf( __( '%1$s started the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $topic->topic_poster ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'/">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
    18951958                $activity_content = bp_create_excerpt( $topic_text );
    18961959
    18971960                /* Record this in activity streams */
     
    19251988        if ( $post_id = bp_forums_insert_post( array( 'post_id' => $post_id, 'post_text' => $post_text, 'post_time' => $post->post_time, 'topic_id' => $topic_id, 'poster_id' => $post->poster_id ) ) ) {
    19261989                $topic = bp_forums_get_topic_details( $topic_id );
    19271990
    1928                 $activity_action = sprintf( __( '%1$s posted on the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $post->poster_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'">' . attribute_escape( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . attribute_escape( $bp->groups->current_group->name ) . '</a>' );
     1991                $activity_action = sprintf( __( '%1$s posted on the forum topic %2$s in the group %3$s:', 'buddypress'), bp_core_get_userlink( $post->poster_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug .'">' . esc_attr( $topic->topic_title ) . '</a>', '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );
    19291992                $activity_content = bp_create_excerpt( $post_text );
    19301993                $primary_link = bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/';
    19311994
     
    21662229
    21672230        do_action( 'groups_ban_member', $group_id, $user_id );
    21682231
    2169         if ( !$member->ban() )
    2170                 return false;
    2171 
    2172         update_usermeta( $user_id, 'total_group_count', (int)$total_count - 1 );
     2232        return $member->ban();
    21732233}
    21742234
    21752235function groups_unban_member( $user_id, $group_id ) {
     
    21852245        return $member->unban();
    21862246}
    21872247
     2248/*** Group Removal *******************************************************/
     2249
     2250function groups_remove_member( $user_id, $group_id ) {
     2251        global $bp;
     2252
     2253        if ( !$bp->is_item_admin )
     2254                return false;
     2255
     2256        $member = new BP_Groups_Member( $user_id, $group_id );
     2257
     2258        do_action( 'groups_remove_member', $group_id, $user_id );
     2259
     2260        if ( !$member->remove( $user_id, $group_id ) )
     2261                return false;
     2262}
     2263
    21882264/*** Group Membership ****************************************************/
    21892265
    21902266function groups_send_membership_request( $requesting_user_id, $group_id ) {
     
    22462322        $group = new BP_Groups_Group( $group_id );
    22472323
    22482324        groups_record_activity( array(
    2249                 'action' => apply_filters( 'groups_activity_membership_accepted_action', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . attribute_escape( $group->name ) . '</a>' ), $user_id, &$group ),
     2325                'action' => apply_filters( 'groups_activity_membership_accepted_action', sprintf( __( '%1$s joined the group %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . esc_attr( $group->name ) . '</a>' ), $user_id, &$group ),
    22502326                'type' => 'joined_group',
    22512327                'item_id' => $group->id,
    22522328                'user_id' => $user_id
     
    24632539add_action( 'groups_created_group', 'bp_core_clear_cache' );
    24642540add_action( 'groups_group_avatar_updated', 'bp_core_clear_cache' );
    24652541
    2466 ?>
    2467  No newline at end of file
     2542?>
  • bp-blogs/bp-blogs-widgets.php

     
    2121        function widget($args, $instance) {
    2222                global $bp;
    2323
    24             extract( $args );
     24                extract( $args );
    2525
    2626                echo $before_widget;
    27                 echo $before_title
    28                    . $widget_name
    29                    . $after_title; ?>
     27                echo $before_title . $widget_name . $after_title;
    3028
    31                 <?php
    3229                if ( empty( $instance['max_posts'] ) || !$instance['max_posts'] )
    3330                        $instance['max_posts'] = 10; ?>
    3431
     
    8077                $max_posts = strip_tags( $instance['max_posts'] );
    8178                ?>
    8279
    83                 <p><label for="bp-blogs-widget-posts-max"><?php _e('Max posts to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_posts' ); ?>" name="<?php echo $this->get_field_name( 'max_posts' ); ?>" type="text" value="<?php echo attribute_escape( $max_posts ); ?>" style="width: 30%" /></label></p>
     80                <p><label for="bp-blogs-widget-posts-max"><?php _e('Max posts to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_posts' ); ?>" name="<?php echo $this->get_field_name( 'max_posts' ); ?>" type="text" value="<?php echo esc_attr( $max_posts ); ?>" style="width: 30%" /></label></p>
    8481        <?php
    8582        }
    8683}
  • bp-blogs/bp-blogs-templatetags.php

     
    269269
    270270function bp_blog_hidden_fields() {
    271271        if ( isset( $_REQUEST['s'] ) ) {
    272                 echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['s'] ). '" name="search_terms" />';
     272                echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['s'] ). '" name="search_terms" />';
    273273        }
    274274
    275275        if ( isset( $_REQUEST['letter'] ) ) {
    276                 echo '<input type="hidden" id="selected_letter" value="' . attribute_escape( $_REQUEST['letter'] ) . '" name="selected_letter" />';
     276                echo '<input type="hidden" id="selected_letter" value="' . esc_attr( $_REQUEST['letter'] ) . '" name="selected_letter" />';
    277277        }
    278278
    279279        if ( isset( $_REQUEST['blogs_search'] ) ) {
    280                 echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['blogs_search'] ) . '" name="search_terms" />';
     280                echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['blogs_search'] ) . '" name="search_terms" />';
    281281        }
    282282}
    283283
     
    346346                <form class="standard-form" id="setupform" method="post" action="">
    347347
    348348                        <input type="hidden" name="stage" value="gimmeanotherblog" />
    349                         <?php do_action( "signup_hidden_fields" ); ?>
     349                        <?php do_action( 'signup_hidden_fields' ); ?>
    350350
    351351                        <?php bp_blogs_signup_blog($blogname, $blog_title, $errors); ?>
    352352                        <p>
     
    363363        global $current_site;
    364364
    365365        // Blog name
    366         if( 'no' == constant( "VHOST" ) )
     366        if( !is_subdomain_install() )
    367367                echo '<label for="blogname">' . __('Blog Name:', 'buddypress') . '</label>';
    368368        else
    369369                echo '<label for="blogname">' . __('Blog Domain:', 'buddypress') . '</label>';
     
    372372                <p class="error"><?php echo $errmsg ?></p>
    373373        <?php }
    374374
    375         if( 'no' == constant( "VHOST" ) ) {
     375        if ( !is_subdomain_install() )
    376376                echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span> <input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="50" /><br />';
    377         } else {
     377        else
    378378                echo '<input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="50" /> <span class="suffix_address">.' . $current_site->domain . $current_site->path . '</span><br />';
    379         }
     379
    380380        if ( !is_user_logged_in() ) {
    381381                print '(<strong>' . __( 'Your address will be ' , 'buddypress');
    382                 if( 'no' == constant( "VHOST" ) ) {
     382
     383                if ( !is_subdomain_install() ) {
    383384                        print $current_site->domain . $current_site->path . __( 'blogname' , 'buddypress');
    384385                } else {
    385386                        print __( 'domain.' , 'buddypress') . $current_site->domain . $current_site->path;
    386387                }
     388
    387389                echo '.</strong> ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!)' , 'buddypress') . '</p>';
    388390        }
    389391
  • bp-blogs/bp-blogs-classes.php

     
    7575                if ( !$bp->blogs )
    7676                        bp_blogs_setup_globals();
    7777
    78                 if ( !is_user_logged_in() || ( !is_site_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
     78                if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) )
    7979                        $hidden_sql = "AND wb.public = 1";
    8080
    8181                if ( $limit && $page )
     
    208208                        $user_id = $bp->displayed_user->id;
    209209
    210210                // If the user is logged in return the blog count including their hidden blogs.
    211                 if ( ( is_user_logged_in() && $user_id == $bp->loggedin_user->id ) || is_site_admin() )
     211                if ( ( is_user_logged_in() && $user_id == $bp->loggedin_user->id ) || is_super_admin() )
    212212                        return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) );
    213213                else
    214214                        return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) );
     
    222222
    223223                $filter = like_escape( $wpdb->escape( $filter ) );
    224224
    225                 if ( !is_site_admin() )
     225                if ( !is_super_admin() )
    226226                        $hidden_sql = "AND wb.public = 1";
    227227
    228228                if ( $limit && $page )
     
    240240                if ( !$bp->blogs )
    241241                        bp_blogs_setup_globals();
    242242
    243                 if ( !is_site_admin() )
     243                if ( !is_super_admin() )
    244244                        $hidden_sql = "AND wb.public = 1";
    245245
    246246                if ( $limit && $page )
     
    260260
    261261                $letter = like_escape( $wpdb->escape( $letter ) );
    262262
    263                 if ( !is_site_admin() )
     263                if ( !is_super_admin() )
    264264                        $hidden_sql = "AND wb.public = 1";
    265265
    266266                if ( $limit && $page )
  • bp-languages/buddypress.pot

     
    164164"---------------------\n"
    165165msgstr ""
    166166
    167 #: bp-activity/bp-activity-notifications.php:43
    168 #: bp-activity/bp-activity-notifications.php:86
    169 #: bp-activity/bp-activity-notifications.php:128
    170 #: bp-friends/bp-friends-notifications.php:33
    171 #: bp-friends/bp-friends-notifications.php:70
    172 #: bp-groups/bp-groups-notifications.php:29
    173 #: bp-groups/bp-groups-notifications.php:77
    174 #: bp-groups/bp-groups-notifications.php:130
    175 #: bp-groups/bp-groups-notifications.php:176
    176 #: bp-groups/bp-groups-notifications.php:228
    177 #: bp-groups/bp-groups-notifications.php:285
    178 #: bp-messages/bp-messages-notifications.php:36
     167#: bp-activity/bp-activity-notifications.php:44
     168#: bp-activity/bp-activity-notifications.php:88
     169#: bp-activity/bp-activity-notifications.php:131
     170#: bp-friends/bp-friends-notifications.php:34
     171#: bp-friends/bp-friends-notifications.php:72
     172#: bp-groups/bp-groups-notifications.php:30
     173#: bp-groups/bp-groups-notifications.php:79
     174#: bp-groups/bp-groups-notifications.php:133
     175#: bp-groups/bp-groups-notifications.php:179
     176#: bp-groups/bp-groups-notifications.php:231
     177#: bp-groups/bp-groups-notifications.php:289
     178#: bp-messages/bp-messages-notifications.php:37
    179179#, php-format
    180180msgid "To disable these notifications please log in and go to: %s"
    181181msgstr ""
    182182
    183 #: bp-activity/bp-activity-notifications.php:74
     183#: bp-activity/bp-activity-notifications.php:76
    184184#, php-format
    185185msgid "%s replied to one of your updates"
    186186msgstr ""
    187187
    188 #: bp-activity/bp-activity-notifications.php:77
     188#: bp-activity/bp-activity-notifications.php:79
    189189#, php-format
    190190msgid ""
    191191"%1$s replied to one of your updates:\n"
     
    197197"---------------------\n"
    198198msgstr ""
    199199
    200 #: bp-activity/bp-activity-notifications.php:113
     200#: bp-activity/bp-activity-notifications.php:116
    201201#, php-format
    202202msgid "%s replied to one of your comments"
    203203msgstr ""
    204204
    205 #: bp-activity/bp-activity-notifications.php:119
     205#: bp-activity/bp-activity-notifications.php:122
    206206#, php-format
    207207msgid ""
    208208"%1$s replied to one of your comments:\n"
     
    14651465msgid "Save Changes"
    14661466msgstr ""
    14671467
    1468 #: bp-core/bp-core-settings.php:131
     1468#: bp-core/bp-core-settings.php:130
    14691469msgid "Notification Settings"
    14701470msgstr ""
    14711471
    1472 #: bp-core/bp-core-settings.php:144
     1472#: bp-core/bp-core-settings.php:143
    14731473msgid "Email Notifications"
    14741474msgstr ""
    14751475
    1476 #: bp-core/bp-core-settings.php:145
     1476#: bp-core/bp-core-settings.php:144
    14771477msgid "Send a notification by email when:"
    14781478msgstr ""
    14791479
    1480 #: bp-core/bp-core-settings.php:186
     1480#: bp-core/bp-core-settings.php:185
    14811481msgid ""
    14821482"WARNING: Deleting your account will completely remove ALL content associated "
    14831483"with it. There is no way back, please be careful with this option."
    14841484msgstr ""
    14851485
    1486 #: bp-core/bp-core-settings.php:189
     1486#: bp-core/bp-core-settings.php:188
    14871487msgid "I understand the consequences of deleting my account."
    14881488msgstr ""
    14891489
    1490 #: bp-core/bp-core-settings.php:192
     1490#: bp-core/bp-core-settings.php:191
    14911491msgid "Delete My Account"
    14921492msgstr ""
    14931493
     
    20042004msgid "New friendship request from %s"
    20052005msgstr ""
    20062006
    2007 #: bp-friends/bp-friends-notifications.php:63
     2007#: bp-friends/bp-friends-notifications.php:65
    20082008#, php-format
    20092009msgid ""
    20102010"%1$s accepted your friend request.\n"
     
    25102510"---------------------\n"
    25112511msgstr ""
    25122512
    2513 #: bp-groups/bp-groups-notifications.php:62
     2513#: bp-groups/bp-groups-notifications.php:64
    25142514#, php-format
    25152515msgid "Membership request for group: %s"
    25162516msgstr ""
    25172517
    2518 #: bp-groups/bp-groups-notifications.php:65
     2518#: bp-groups/bp-groups-notifications.php:67
    25192519#, php-format
    25202520msgid ""
    25212521"%1$s wants to join the group \"%2$s\".\n"
     
    25312531"---------------------\n"
    25322532msgstr ""
    25332533
    2534 #: bp-groups/bp-groups-notifications.php:110
     2534#: bp-groups/bp-groups-notifications.php:113
    25352535#, php-format
    25362536msgid "Membership request for group \"%s\" accepted"
    25372537msgstr ""
    25382538
    2539 #: bp-groups/bp-groups-notifications.php:112
     2539#: bp-groups/bp-groups-notifications.php:115
    25402540#, php-format
    25412541msgid ""
    25422542"Your membership request for the group \"%1$s\" has been accepted.\n"
     
    25462546"---------------------\n"
    25472547msgstr ""
    25482548
    2549 #: bp-groups/bp-groups-notifications.php:120
     2549#: bp-groups/bp-groups-notifications.php:123
    25502550#, php-format
    25512551msgid "Membership request for group \"%s\" rejected"
    25522552msgstr ""
    25532553
    2554 #: bp-groups/bp-groups-notifications.php:122
     2554#: bp-groups/bp-groups-notifications.php:125
    25552555#, php-format
    25562556msgid ""
    25572557"Your membership request for the group \"%1$s\" has been rejected.\n"
     
    25612561"---------------------\n"
    25622562msgstr ""
    25632563
    2564 #: bp-groups/bp-groups-notifications.php:144
     2564#: bp-groups/bp-groups-notifications.php:147
    25652565msgid "an administrator"
    25662566msgstr ""
    25672567
    2568 #: bp-groups/bp-groups-notifications.php:147
     2568#: bp-groups/bp-groups-notifications.php:150
    25692569msgid "a moderator"
    25702570msgstr ""
    25712571
    2572 #: bp-groups/bp-groups-notifications.php:166
     2572#: bp-groups/bp-groups-notifications.php:169
    25732573#, php-format
    25742574msgid "You have been promoted in the group: \"%s\""
    25752575msgstr ""
    25762576
    2577 #: bp-groups/bp-groups-notifications.php:169
     2577#: bp-groups/bp-groups-notifications.php:172
    25782578#, php-format
    25792579msgid ""
    25802580"You have been promoted to %1$s for the group: \"%2$s\".\n"
     
    25842584"---------------------\n"
    25852585msgstr ""
    25862586
    2587 #: bp-groups/bp-groups-notifications.php:214
     2587#: bp-groups/bp-groups-notifications.php:217
    25882588#, php-format
    25892589msgid "You have an invitation to the group: \"%s\""
    25902590msgstr ""
    25912591
    2592 #: bp-groups/bp-groups-notifications.php:217
     2592#: bp-groups/bp-groups-notifications.php:220
    25932593#, php-format
    25942594msgid ""
    25952595"One of your friends %1$s has invited you to the group: \"%2$s\".\n"
     
    29572957msgid " Recipients"
    29582958msgstr ""
    29592959
    2960 #: bp-messages/bp-messages-notifications.php:22
     2960#: bp-messages/bp-messages-notifications.php:23
    29612961#, php-format
    29622962msgid "New message from %s"
    29632963msgstr ""
    29642964
    2965 #: bp-messages/bp-messages-notifications.php:25
     2965#: bp-messages/bp-messages-notifications.php:26
    29662966#, php-format
    29672967msgid ""
    29682968"%1$s sent you a new message:\n"
     
    32183218
    32193219#: bp-themes/bp-default/activity/index.php:60
    32203220#: bp-themes/bp-default/groups/single/activity.php:3
     3221msgid "RSS Feed"
     3222msgstr ""
     3223
     3224#: bp-themes/bp-default/activity/index.php:60
     3225#: bp-themes/bp-default/groups/single/activity.php:3
    32213226msgid "RSS"
    32223227msgstr ""
    32233228
     
    36683673msgid "Create a Group"
    36693674msgstr ""
    36703675
     3676#: bp-themes/bp-default/functions.php:79
     3677msgid "said:"
     3678msgstr ""
     3679
     3680#: bp-themes/bp-default/functions.php:80
     3681msgid "On"
     3682msgstr ""
     3683
     3684#: bp-themes/bp-default/functions.php:84
     3685msgid "Your comment is awaiting moderation."
     3686msgstr ""
     3687
     3688#: bp-themes/bp-default/functions.php:328
     3689#, php-format
     3690msgid ""
     3691"Theme activated! This theme contains <a href=\"%s\">custom header image</a> "
     3692"support and <a href=\"%s\">sidebar widgets</a>."
     3693msgstr ""
     3694
    36713695#: bp-themes/bp-default/groups/create.php:7
    36723696#: bp-themes/bp-default/groups/index.php:7
    36733697msgid "Groups Directory"
  • bp-messages/bp-messages-filters.php

     
    4444add_filter( 'bp_get_message_thread_excerpt', 'make_clickable' );
    4545add_filter( 'bp_get_the_thread_message_content', 'make_clickable' );
    4646
    47 add_filter( 'bp_get_message_notice_subject', 'wpautop' );
    4847add_filter( 'bp_get_message_notice_text', 'wpautop' );
    49 add_filter( 'bp_get_message_thread_subject', 'wpautop' );
    5048add_filter( 'bp_get_the_thread_message_content', 'wpautop' );
    5149
    5250add_filter( 'bp_get_message_notice_subject', 'stripslashes_deep' );
  • bp-messages/bp-messages-notifications.php

     
    77        $sender_name = bp_core_get_user_displayname( $sender_id );
    88
    99        foreach( $recipients as $recipient ) {
    10                 if ( $sender_id == $recipient->user_id || 'no' == get_usermeta( $recipient->user_id, 'notification_messages_new_message' ) ) continue;
     10                if ( $sender_id == $recipient->user_id || 'no' == get_user_meta( $recipient->user_id, 'notification_messages_new_message', true ) ) continue;
    1111
    1212                $ud = get_userdata( $recipient->user_id );
    1313                $message_link = bp_core_get_user_domain( $recipient->user_id ) . BP_MESSAGES_SLUG .'/';
     
    1818                $content = stripslashes( wp_filter_kses( $content ) );
    1919
    2020                // Set up and send the message
    21                 $email_to = $ud->user_email;
    22                 $email_subject = '[' . get_blog_option( BP_ROOT_BLOG, 'blogname' ) . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), $sender_name );
     21                $email_to      = $ud->user_email;
     22                $sitename      = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
     23                $email_subject = '[' . $sitename . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), $sender_name );
    2324
    2425                $email_content = sprintf( __(
    2526'%1$s sent you a new message:
  • bp-messages/bp-messages-templatetags.php

     
    161161        $r = wp_parse_args( $args, $defaults );
    162162        extract( $r, EXTR_SKIP );
    163163
    164         if ( 'notices' == $bp->current_action && !is_site_admin() ) {
     164        if ( 'notices' == $bp->current_action && !is_super_admin() ) {
    165165                wp_redirect( $bp->displayed_user->id );
    166166        } else {
    167167                if ( 'inbox' == $bp->current_action )
     
    249249                return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->messages->slug . '/' . $bp->current_action . '/delete/' . $messages_template->thread->thread_id, 'messages_delete_thread' ) );
    250250        }
    251251
     252function bp_message_css_class() {
     253        echo bp_get_message_css_class();
     254}
     255
     256        function bp_get_message_css_class() {
     257                global $messages_template;
     258
     259                $class = false;
     260
     261                if ( $messages_template->current_thread % 2 == 1 )
     262                        $class .= 'alt';
     263
     264                return apply_filters( 'bp_get_message_css_class', trim( $class ) );
     265        }
     266
    252267function bp_message_thread_has_unread() {
    253268        global $messages_template;
    254269
     
    276291        function bp_get_message_thread_last_post_date() {
    277292                global $messages_template;
    278293
    279                 return apply_filters( 'bp_get_message_thread_last_post_date', bp_format_time( strtotime( $messages_template->thread->last_message_date ) ) );
     294                return apply_filters( 'bp_get_message_thread_last_post_date', bp_format_time( get_date_from_gmt( $messages_template->thread->last_message_date, 'U' ) ) );
    280295        }
    281296
    282297function bp_message_thread_avatar() {
     
    326341        function bp_get_messages_form_action() {
    327342                global $bp;
    328343
    329                 return apply_filters( 'bp_get_messages_form_action', $bp->loggedin_user->domain . $bp->messages->slug . '/' . $bp->current_action . '/' . $bp->action_variables[0] . '/' );
     344                return apply_filters( 'bp_get_messages_form_action', trailingslashit( $bp->loggedin_user->domain . $bp->messages->slug . '/' . $bp->current_action . '/' . $bp->action_variables[0] . '/' ) );
    330345        }
    331346
    332347function bp_messages_username_value() {
     
    459474        if ( empty( $notice ) )
    460475                return false;
    461476
    462         $closed_notices = get_usermeta( $userdata->ID, 'closed_notices' );
     477        $closed_notices = get_user_meta( $userdata->ID, 'closed_notices', true );
    463478
    464479        if ( !$closed_notices )
    465480                $closed_notices = array();
  • bp-messages/bp-messages-classes.php

     
    243243        function bp_messages_message( $id = null ) {
    244244                global $bp;
    245245
    246                 $this->date_sent = time();
     246                $this->date_sent = bp_core_current_time();
    247247                $this->sender_id = $bp->loggedin_user->id;
    248248
    249249                if ( $id ) {
     
    288288                }
    289289
    290290                // First insert the message into the messages table
    291                 if ( !$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_messages} ( thread_id, sender_id, subject, message, date_sent ) VALUES ( %d, %d, %s, %s, FROM_UNIXTIME(%d) )", $this->thread_id, $this->sender_id, $this->subject, $this->message, $this->date_sent ) ) )
     291                if ( !$wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_messages} ( thread_id, sender_id, subject, message, date_sent ) VALUES ( %d, %d, %s, %s, %s )", $this->thread_id, $this->sender_id, $this->subject, $this->message, $this->date_sent ) ) )
    292292                        return false;
    293293
    294294                if ( $new_thread ) {
     
    387387                do_action( 'messages_notice_before_save', $this );
    388388
    389389                if ( !$this->id ) {
    390                         $sql = $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_notices} (subject, message, date_sent, is_active) VALUES (%s, %s, FROM_UNIXTIME(%d), %d)", $this->subject, $this->message, $this->date_sent, $this->is_active );
     390                        $sql = $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_notices} (subject, message, date_sent, is_active) VALUES (%s, %s, %s, %d)", $this->subject, $this->message, $this->date_sent, $this->is_active );
    391391                } else {
    392392                        $sql = $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET subject = %s, message = %s, is_active = %d WHERE id = %d", $this->subject, $this->message, $this->is_active, $this->id );
    393393                }
     
    401401                // Now deactivate all notices apart from the new one.
    402402                $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET is_active = 0 WHERE id != %d", $id ) );
    403403
    404                 update_usermeta( $bp->loggedin_user->id, 'last_activity', date( 'Y-m-d H:i:s' ) );
     404                update_user_meta( $bp->loggedin_user->id, 'last_activity', date( 'Y-m-d H:i:s' ) );
    405405
    406406                do_action( 'messages_notice_after_save', $this );
    407407
  • bp-messages/css/autocomplete/jquery.autocompletefb.css

     
    3535                }
    3636
    3737.ac_loading {
    38         background : url('../../images/ajax-loader.gif') right center no-repeat;
     38        background : url('../../../bp-themes/bp-default/_inc/images/ajax-loader.gif') right center no-repeat;
    3939}
    4040
    4141.ac_odd {
  • bp-forums/bp-forums-admin.php

     
    121121}
    122122
    123123function bp_forums_bbpress_install() {
    124         global $wpdb, $bbdb;
     124        global $wpdb, $bbdb, $bp;
    125125
    126126        check_admin_referer( 'bp_forums_new_install_init' );
    127127
     
    140140                        "define( 'BB_SECURE_A"                  => array( "'put your unique phrase here'",  "'" . addslashes( SECURE_AUTH_KEY ) . "'" ),
    141141                        "define( 'BB_LOGGED_I"                  => array( "'put your unique phrase here'",  "'" . addslashes( LOGGED_IN_KEY ) . "'" ),
    142142                        "define( 'BB_NONCE_KE"                  => array( "'put your unique phrase here'",  "'" . addslashes( NONCE_KEY ) . "'" ),
    143                         "\$bb_table_prefix = '"                 => array( "'bb_'",                          "'" . $wpdb->base_prefix . "bb_'" ),
     143                        "\$bb_table_prefix = '"                 => array( "'bb_'",                          "'" . $bp->table_prefix . "bb_'" ),
    144144                        "define( 'BB_LANG', '"                  => array( "''",                                 "'" . WPLANG . "'" )
    145145                )
    146146        );
     
    153153        }
    154154
    155155        $file = substr( $file, 0, -2 );
    156         $file .= "\n" .   '$bb->custom_user_table = "' . $wpdb->users . '";';
    157         $file .= "\n" .   '$bb->custom_user_meta_table = "' . $wpdb->usermeta . '";';
    158         $file .= "\n\n" . '$bb->uri = "' . BP_PLUGIN_URL . '/bp-forums/bbpress/";';
    159         $file .= "\n" .   '$bb->name = "' . get_blog_option( BP_ROOT_BLOG, 'name' ) . ' ' . __( 'Forums', 'buddypress' ) . '";';
     156        $file .= "\n" .   '$bb->custom_user_table = \'' . $wpdb->users . '\';';
     157        $file .= "\n" .   '$bb->custom_user_meta_table = \'' . $wpdb->usermeta . '\';';
     158        $file .= "\n\n" . '$bb->uri = \'' . BP_PLUGIN_URL . '/bp-forums/bbpress/\';';
     159        $file .= "\n" .   '$bb->name = \'' . get_blog_option( BP_ROOT_BLOG, 'name' ) . ' ' . __( 'Forums', 'buddypress' ) . '\';';
    160160
    161161        if ( bp_core_is_multisite() )
    162162                $file .= "\n" .   '$bb->wordpress_mu_primary_blog_id = ' . BP_ROOT_BLOG . ';';
    163163
    164164        if ( defined( 'AUTH_SALT' ) )
    165                 $file .= "\n\n" . 'define(\'BB_AUTH_SALT\', "' . addslashes( AUTH_SALT ) . '");';
     165                $file .= "\n\n" . 'define(\'BB_AUTH_SALT\', \'' . addslashes( AUTH_SALT ) . '\');';
    166166
    167167        if ( defined( 'LOGGED_IN_SALT' ) )
    168                 $file .= "\n" .   'define(\'BB_LOGGED_IN_SALT\', "' . addslashes( LOGGED_IN_SALT ) . '");';
     168                $file .= "\n" .   'define(\'BB_LOGGED_IN_SALT\', \'' . addslashes( LOGGED_IN_SALT ) . '\');';
    169169
    170170        if ( defined( 'SECURE_AUTH_SALT' ) )
    171                 $file .= "\n" .   'define(\'BB_SECURE_AUTH_SALT\', "' . addslashes( SECURE_AUTH_SALT ) . '");';
     171                $file .= "\n" .   'define(\'BB_SECURE_AUTH_SALT\', \'' . addslashes( SECURE_AUTH_SALT ) . '\');';
    172172
    173173        $file .= "\n\n" . 'define(\'WP_AUTH_COOKIE_VERSION\', 2);';
    174174        $file .= "\n\n" . '?>';
  • bp-forums/bp-forums-filters.php

     
    22
    33/* Apply WordPress defined filters */
    44add_filter( 'bp_forums_bbconfig_location', 'wp_filter_kses', 1 );
    5 add_filter( 'bp_forums_bbconfig_location', 'attribute_escape', 1 );
     5add_filter( 'bp_forums_bbconfig_location', 'esc_attr', 1 );
    66
    77add_filter( 'bp_get_the_topic_title', 'wp_filter_kses', 1 );
    88add_filter( 'bp_get_the_topic_latest_post_excerpt', 'bp_forums_filter_kses', 1 );
     
    3030add_filter( 'bp_get_the_topic_latest_post_excerpt', 'stripslashes_deep' );
    3131add_filter( 'bp_get_the_topic_poster_name', 'stripslashes_deep' );
    3232add_filter( 'bp_get_the_topic_last_poster_name', 'stripslashes_deep' );
     33add_filter( 'bp_get_the_topic_object_name', 'stripslashes_deep' );
    3334
    3435add_filter( 'bp_get_the_topic_post_content', 'make_clickable' );
    3536
     
    8384                return "<a $text rel=\"nofollow\">";
    8485        }
    8586
    86 ?>
    87  No newline at end of file
     87/**
     88 * bp_forums_add_forum_topic_to_page_title( $title )
     89 *
     90 * Append forum topic to page title
     91 *
     92 * @global object $bp
     93 * @param string $title
     94 * @return string
     95 */
     96function bp_forums_add_forum_topic_to_page_title( $title ) {
     97        global $bp;
     98
     99        if ( $bp->current_action == 'forum' && $bp->action_variables[0] == 'topic' ) {
     100                if ( bp_has_forum_topic_posts() ) {
     101                        $title .= ' &#124; ' . bp_get_the_topic_title();
     102                }
     103        }
     104
     105        return $title;
     106}
     107add_filter( 'bp_page_title', 'bp_forums_add_forum_topic_to_page_title' );
     108
     109?>
  • bp-forums/bp-forums-templatetags.php

     
    258258                global $forum_template;
    259259
    260260                $post = bb_get_first_post( (int)$forum_template->topic->topic_id, false );
    261                 return apply_filters( 'bp_get_the_topic_text', attribute_escape( $post->post_text ) );
     261                return apply_filters( 'bp_get_the_topic_text', esc_attr( $post->post_text ) );
    262262        }
    263263
    264264function bp_the_topic_poster_id() {
     
    556556
    557557                $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'edit', 'bp_forums_edit_topic' ) . '">' . __( 'Edit Topic', 'buddypress' ) . '</a>';
    558558
    559                 if ( $bp->is_item_admin || $bp->is_item_mod || is_site_admin() ) {
     559                if ( $bp->is_item_admin || $bp->is_item_mod || is_super_admin() ) {
    560560                        if ( 0 == (int)$forum_template->topic->topic_sticky )
    561561                                $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'stick', 'bp_forums_stick_topic' ) . '">' . __( 'Sticky Topic', 'buddypress' ) . '</a>';
    562562                        else
     
    711711        var $sort_by;
    712712        var $order;
    713713
    714         function BP_Forums_Template_Topic( $topic_id, $per_page, $max ) {
     714        function BP_Forums_Template_Topic( $topic_id, $per_page, $max, $order ) {
    715715                global $bp, $current_user, $forum_template;
    716716
    717717                $this->pag_page        = isset( $_REQUEST['topic_page'] ) ? intval( $_REQUEST['topic_page'] ) : 1;
     
    813813        $defaults = array(
    814814                'topic_id' => false,
    815815                'per_page' => 15,
    816                 'max' => false
     816                'max'      => false,
     817                'order'    => 'ASC'
    817818        );
    818819
    819820        $r = wp_parse_args( $args, $defaults );
     
    823824                $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[1] );
    824825
    825826        if ( is_numeric( $topic_id ) )
    826                 $topic_template = new BP_Forums_Template_Topic( $topic_id, $per_page, $max );
     827                $topic_template = new BP_Forums_Template_Topic( $topic_id, $per_page, $max, $order );
    827828        else
    828829                return false;
    829830
     
    935936                if ( $_SERVER['QUERY_STRING'] )
    936937                        $query_vars = '?' . $_SERVER['QUERY_STRING'];
    937938
    938                 $links  = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . $topic_template->post->id . 'edit/post/' . $topic_template->post->post_id . '/' . $query_vars, 'bp_forums_edit_post' ) . '">' . __( 'Edit', 'buddypress' ) . '</a> ' . $seperator . ' ';
     939                $links  = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'edit/post/' . $topic_template->post->post_id . '/' . $query_vars, 'bp_forums_edit_post' ) . '">' . __( 'Edit', 'buddypress' ) . '</a> ' . $seperator . ' ';
    939940                $links .= '<a class="confirm" id="post-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete/post/' . $topic_template->post->post_id, 'bp_forums_delete_post' ) . '">' . __( 'Delete', 'buddypress' ) . '</a> | ';
    940941
    941942                return $links;
     
    948949                global $bp;
    949950
    950951                $post = bp_forums_get_post( $bp->action_variables[4] );
    951                 return apply_filters( 'bp_get_the_topic_post_edit_text', attribute_escape( $post->post_text ) );
     952                return apply_filters( 'bp_get_the_topic_post_edit_text', esc_attr( $post->post_text ) );
    952953        }
    953954
    954955function bp_the_topic_pagination() {
     
    990991
    991992?>
    992993        <form action="" method="get" id="search-forums-form">
    993                 <label><input type="text" name="s" id="forums_search" value="<?php echo attribute_escape($search_value) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
     994                <label><input type="text" name="s" id="forums_search" value="<?php echo esc_attr($search_value) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
    994995                <input type="submit" id="forums_search_submit" name="forums_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
    995996        </form>
    996997<?php
     
    10381039        function bp_get_forum_action() {
    10391040                global $topic_template;
    10401041
    1041                 return apply_filters( 'bp_get_forum_action', $bp->root_domain . attribute_escape( $_SERVER['REQUEST_URI'] ) );
     1042                return apply_filters( 'bp_get_forum_action', $bp->root_domain . esc_attr( $_SERVER['REQUEST_URI'] ) );
    10421043        }
    10431044
    10441045function bp_forum_topic_action() {
     
    10471048        function bp_get_forum_topic_action() {
    10481049                global $bp;
    10491050
    1050                 return apply_filters( 'bp_get_forum_topic_action', $bp->root_domain . attribute_escape( $_SERVER['REQUEST_URI'] ) );
     1051                return apply_filters( 'bp_get_forum_topic_action', $bp->root_domain . esc_attr( $_SERVER['REQUEST_URI'] ) );
    10511052        }
    10521053
    10531054function bp_forum_topic_count_for_user( $user_id = false ) {
  • bp-forums/bp-forums-bbpress.php

     
    6565
    6666        /* This must be loaded before functionss.bb-admin.php otherwise we get a function conflict. */
    6767        if ( !$tables_installed = (boolean) $bbdb->get_results( 'DESCRIBE `' . $bbdb->forums . '`;', ARRAY_A ) )
    68                 require_once( ABSPATH . 'wp-admin/upgrade-functions.php' );
     68                require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    6969
    7070        require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
    7171
     
    103103                /* Set the site admins as the keymasters */
    104104                $site_admins = get_site_option( 'site_admins', array('admin') );
    105105                foreach ( (array)$site_admins as $site_admin )
    106                         update_usermeta( bp_core_get_userid( $site_admin ), $bb_table_prefix . 'capabilities', array( 'keymaster' => true ) );
     106                        update_user_meta( bp_core_get_userid( $site_admin ), $bb_table_prefix . 'capabilities', array( 'keymaster' => true ) );
    107107
    108108                // Create the first forum.
    109109                bb_new_forum( array( 'forum_name' => 'Default Forum' ) );
     
    130130                $args = wp_parse_args( $args, $defaults );
    131131                extract( $args, EXTR_SKIP );
    132132
    133                 return update_usermeta( $id, $meta_key, $meta_value );
     133                return update_user_meta( $id, $meta_key, $meta_value );
    134134        }
    135135}
    136136
  • bp-core.php

     
    7070        global $action_variables;
    7171
    7272        $current_user = wp_get_current_user();
     73       
     74        // Get the base database prefix
     75        $bp->table_prefix = bp_core_get_table_prefix();
    7376
    7477        /* The domain for the root of the site where the main blog resides */
    7578        $bp->root_domain = bp_core_get_root_domain();
     
    9497        /* The core userdata of the user who is currently logged in. */
    9598        $bp->loggedin_user->userdata = bp_core_get_core_userdata( $bp->loggedin_user->id );
    9699
    97         /* is_site_admin() hits the DB on single WP installs, so we need to get this separately so we can call it in a loop. */
    98         $bp->loggedin_user->is_site_admin = is_site_admin();
     100        /* is_super_admin() hits the DB on single WP installs, so we need to get this separately so we can call it in a loop. */
     101        $bp->loggedin_user->is_super_admin = is_super_admin();
     102        $bp->loggedin_user->is_super_admin  = $bp->loggedin_user->is_super_admin; // deprecated 1.2.6
    99103
    100104        /* The user id of the user currently being viewed, set in /bp-core/bp-core-catchuri.php */
    101105        $bp->displayed_user->id = $displayed_user_id;
     
    141145        $bp->bp_options_nav = array();
    142146
    143147        /* Fetches the default Gravatar image to use if the user/group/blog has no avatar or gravatar */
    144         $bp->grav_default->user = apply_filters( 'bp_user_gravatar_default', $bp->site_options['user-avatar-default'] );
     148        $bp->grav_default->user  = apply_filters( 'bp_user_gravatar_default', $bp->site_options['user-avatar-default'] );
    145149        $bp->grav_default->group = apply_filters( 'bp_group_gravatar_default', 'identicon' );
    146         $bp->grav_default->blog = apply_filters( 'bp_blog_gravatar_default', 'identicon' );
     150        $bp->grav_default->blog  = apply_filters( 'bp_blog_gravatar_default', 'identicon' );
    147151
    148152        /* Fetch the full name for the logged in and current user */
    149         $bp->loggedin_user->fullname = bp_core_get_user_displayname( $bp->loggedin_user->id );
     153        $bp->loggedin_user->fullname  = bp_core_get_user_displayname( $bp->loggedin_user->id );
    150154        $bp->displayed_user->fullname = bp_core_get_user_displayname( $bp->displayed_user->id );
    151155
    152156        /* Used to determine if user has admin rights on current content. If the logged in user is viewing
     
    158162        /* Used to determine if the logged in user is a moderator for the current content. */
    159163        $bp->is_item_mod = false;
    160164
    161         $bp->core->table_name_notifications = $wpdb->base_prefix . 'bp_notifications';
     165        $bp->core->table_name_notifications = $bp->table_prefix . 'bp_notifications';
    162166
    163167        if ( !$bp->current_component && $bp->displayed_user->id )
    164168                $bp->current_component = $bp->default_component;
     
    168172add_action( 'bp_setup_globals', 'bp_core_setup_globals' );
    169173
    170174/**
     175 * bp_core_get_table_prefix()
     176 *
     177 * Allow filtering of database prefix. Intended for use in multinetwork installations.
     178 *
     179 * @global object $wpdb WordPress database object
     180 * @return string Filtered database prefix
     181 */
     182function bp_core_get_table_prefix() {
     183        global $wpdb;
     184
     185        return apply_filters( 'bp_core_get_table_prefix', $wpdb->base_prefix );
     186}
     187
     188/**
    171189 * bp_core_define_slugs()
    172190 *
    173191 * Define the slugs used for BuddyPress pages, based on the slugs of the WP pages used.
     
    237255 * Initializes the wp-admin area "BuddyPress" menus and sub menus.
    238256 *
    239257 * @package BuddyPress Core
    240  * @uses is_site_admin() returns true if the current user is a site admin, false if not
     258 * @uses is_super_admin() returns true if the current user is a site admin, false if not
    241259 */
    242260function bp_core_admin_menu_init() {
    243         if ( !is_site_admin() )
     261        if ( !is_super_admin() )
    244262                return false;
    245263
    246264        require ( BP_PLUGIN_DIR . '/bp-core/admin/bp-core-admin.php' );
     
    254272 *
    255273 * @package BuddyPress Core
    256274 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
    257  * @global $wpdb WordPress DB access object.
    258  * @uses is_site_admin() returns true if the current user is a site admin, false if not
     275 * @uses is_super_admin() returns true if the current user is a site admin, false if not
    259276 * @uses add_submenu_page() WP function to add a submenu item
    260277 */
    261278function bp_core_add_admin_menu() {
    262         if ( !is_site_admin() )
     279        if ( !is_super_admin() )
    263280                return false;
    264281
    265282        /* Add the administration tab under the "Site Admin" tab for site administrators */
     
    381398function bp_core_action_set_spammer_status() {
    382399        global $bp, $wpdb;
    383400
    384         if ( !is_site_admin() || bp_is_my_profile() || !$bp->displayed_user->id )
     401        if ( !is_super_admin() || bp_is_my_profile() || !$bp->displayed_user->id )
    385402                return false;
    386403
    387404        if ( 'admin' == $bp->current_component && ( 'mark-spammer' == $bp->current_action || 'unmark-spammer' == $bp->current_action ) ) {
     
    445462function bp_core_action_delete_user() {
    446463        global $bp;
    447464
    448         if ( !is_site_admin() || bp_is_my_profile() || !$bp->displayed_user->id )
     465        if ( !is_super_admin() || bp_is_my_profile() || !$bp->displayed_user->id )
    449466                return false;
    450467
    451468        if ( 'admin' == $bp->current_component && 'delete-user' == $bp->current_action ) {
     
    515532 * @package BuddyPress Core
    516533 * @global $current_user WordPress global variable containing current logged in user information
    517534 * @param user_id The ID of the user.
    518  * @uses get_usermeta() WordPress function to get the usermeta for a user.
     535 * @uses get_user_meta() WordPress function to get the usermeta for a user.
    519536 */
    520537function bp_core_get_user_domain( $user_id, $user_nicename = false, $user_login = false ) {
    521538        global $bp;
     
    625642                return false;
    626643
    627644        /* If this is for site admins only and the user is not one, don't create the subnav item */
    628         if ( $site_admin_only && !is_site_admin() )
     645        if ( $site_admin_only && !is_super_admin() )
    629646                return false;
    630647
    631648        if ( empty( $item_css_id ) )
     
    772789                return false;
    773790
    774791        /* If this is for site admins only and the user is not one, don't create the subnav item */
    775         if ( $site_admin_only && !is_site_admin() )
     792        if ( $site_admin_only && !is_super_admin() )
    776793                return false;
    777794
    778795        if ( empty( $item_css_id ) )
     
    902919 *
    903920 * @package BuddyPress Core
    904921 * @param $username str Username to check.
    905  * @global $wpdb WordPress DB access object.
    906922 * @return false on no match
    907923 * @return int the user ID of the matched user.
    908924 */
    909925function bp_core_get_random_member() {
    910         global $bp, $wpdb;
     926        glob