Ticket #2676: redo-merge.patch
File redo-merge.patch, 248.8 KB (added by , 14 years ago) |
---|
-
bp-friends.php
102 102 103 103 function friends_screen_notification_settings() { 104 104 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> 124 114 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> 126 131 </table> 127 132 <?php 128 133 } … … 236 241 'type' => false, 237 242 'item_id' => false, 238 243 'secondary_item_id' => false, 239 'recorded_time' => gmdate( "Y-m-d H:i:s"),244 'recorded_time' => bp_core_current_time(), 240 245 'hide_sitewide' => false 241 246 ); 242 247 … … 317 322 $friendship->friend_user_id = $friend_userid; 318 323 $friendship->is_confirmed = 0; 319 324 $friendship->is_limited = 0; 320 $friendship->date_created = time();325 $friendship->date_created = bp_core_current_time(); 321 326 322 327 if ( $force_accept ) 323 328 $friendship->is_confirmed = 1; … … 371 376 if ( !$friendship->is_confirmed && BP_Friends_Friendship::accept( $friendship_id ) ) { 372 377 friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id ); 373 378 374 / * Remove the friend request notice */379 // Remove the friend request notice 375 380 bp_core_delete_notifications_for_user_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' ); 376 381 377 / * Add a friend accepted notice for the initiating user */382 // Add a friend accepted notice for the initiating user 378 383 bp_core_add_notification( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_accepted' ); 379 384 380 385 $initiator_link = bp_core_get_userlink( $friendship->initiator_user_id ); 381 386 $friend_link = bp_core_get_userlink( $friendship->friend_user_id ); 382 387 383 / * Record in activity streams for the initiator */388 // Record in activity streams for the initiator 384 389 friends_record_activity( array( 385 390 'user_id' => $friendship->initiator_user_id, 386 391 'type' => 'friendship_created', 387 392 '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 389 395 ) ); 390 396 391 / * Record in activity streams for the friend */397 // Record in activity streams for the friend 392 398 friends_record_activity( array( 393 399 'user_id' => $friendship->friend_user_id, 394 400 'type' => 'friendship_created', 395 401 'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%1$s and %2$s are now friends', 'buddypress' ), $friend_link, $initiator_link ), &$friendship ), 396 402 'item_id' => $friendship_id, 403 'secondary_item_id' => $friendship->initiator_user_id, 397 404 'hide_sitewide' => true /* We've already got the first entry site wide */ 398 405 ) ); 399 406 400 / * Send the email notification */407 // Send the email notification 401 408 require_once( BP_PLUGIN_DIR . '/bp-friends/bp-friends-notifications.php' ); 402 409 friends_notification_accepted_request( $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id ); 403 410 … … 443 450 $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id; 444 451 445 452 if ( !$count = wp_cache_get( 'bp_total_friend_count_' . $user_id, 'bp' ) ) { 446 $count = get_user meta( $user_id, 'total_friend_count');453 $count = get_user_meta( $user_id, 'total_friend_count', true ); 447 454 if ( empty( $count ) ) $count = 0; 448 455 wp_cache_set( 'bp_total_friend_count_' . $user_id, $count, 'bp' ); 449 456 } … … 546 553 547 554 function friends_update_friend_totals( $initiator_user_id, $friend_user_id, $status = 'add' ) { 548 555 if ( 'add' == $status ) { 549 update_user meta( $initiator_user_id, 'total_friend_count', (int)get_usermeta( $initiator_user_id, 'total_friend_count') + 1 );550 update_user meta( $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 ); 551 558 } else { 552 update_user meta( $initiator_user_id, 'total_friend_count', (int)get_usermeta( $initiator_user_id, 'total_friend_count') - 1 );553 update_user meta( $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 ); 554 561 } 555 562 } 556 563 … … 558 565 BP_Friends_Friendship::delete_all_for_user($user_id); 559 566 560 567 /* Remove usermeta */ 561 delete_user meta( $user_id, 'total_friend_count' );568 delete_user_meta( $user_id, 'total_friend_count' ); 562 569 563 570 /* Remove friendship requests FROM user */ 564 571 bp_core_delete_notifications_from_user( $user_id, $bp->friends->id, 'friendship_request' ); -
bp-activity.php
4 4 require ( BP_PLUGIN_DIR . '/bp-activity/bp-activity-filters.php' ); 5 5 6 6 function bp_activity_setup_globals() { 7 global $bp, $wpdb , $current_blog;7 global $bp, $wpdb; 8 8 9 9 if ( !defined( 'BP_ACTIVITY_SLUG' ) ) 10 10 define ( 'BP_ACTIVITY_SLUG', $bp->pages->activity->slug ); 11 11 12 / * For internal identification */12 // For internal identification 13 13 $bp->activity->id = 'activity'; 14 14 $bp->activity->name = $bp->pages->activity->name; 15 15 $bp->activity->slug = BP_ACTIVITY_SLUG; … … 18 18 $bp->activity->table_name_meta = $wpdb->base_prefix . 'bp_activity_meta'; 19 19 $bp->activity->format_notification_function = 'bp_activity_format_notifications'; 20 20 21 / * Register this in the active components array */21 // Register this in the active components array 22 22 $bp->active_components[$bp->activity->slug] = $bp->activity->id; 23 23 24 24 do_action( 'bp_activity_setup_globals' ); … … 92 92 if ( !bp_is_active( 'friends' ) ) 93 93 return false; 94 94 95 if ( !is_s ite_admin() )95 if ( !is_super_admin() ) 96 96 $bp->is_item_admin = false; 97 97 98 98 do_action( 'bp_activity_screen_friends' ); … … 105 105 if ( !bp_is_active( 'groups' ) ) 106 106 return false; 107 107 108 if ( !is_s ite_admin() )108 if ( !is_super_admin() ) 109 109 $bp->is_item_admin = false; 110 110 111 111 do_action( 'bp_activity_screen_groups' ); … … 115 115 function bp_activity_screen_favorites() { 116 116 global $bp; 117 117 118 if ( !is_s ite_admin() )118 if ( !is_super_admin() ) 119 119 $bp->is_item_admin = false; 120 120 121 121 do_action( 'bp_activity_screen_favorites' ); … … 125 125 function bp_activity_screen_mentions() { 126 126 global $bp; 127 127 128 if ( !is_s ite_admin() )128 if ( !is_super_admin() ) 129 129 $bp->is_item_admin = false; 130 130 131 131 do_action( 'bp_activity_screen_mentions' ); … … 172 172 if ( is_user_logged_in() ) 173 173 bp_core_redirect( $bp->loggedin_user->domain ); 174 174 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 ) ) ); 176 176 } 177 177 178 178 bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink' ) ); … … 182 182 183 183 function bp_activity_screen_notification_settings() { 184 184 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> 192 194 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> 205 208 206 <?php do_action( 'bp_activity_screen_notification_settings' ) ?> 209 <?php do_action( 'bp_activity_screen_notification_settings' ) ?> 210 </tbody> 207 211 </table> 208 212 <?php 209 213 } … … 270 274 $activity = new BP_Activity_Activity( $activity_id ); 271 275 272 276 /* Check access */ 273 if ( !is_s ite_admin() && $activity->user_id != $bp->loggedin_user->id )277 if ( !is_super_admin() && $activity->user_id != $bp->loggedin_user->id ) 274 278 return false; 275 279 276 280 /* Call the action before the delete so plugins can still fetch information about it */ … … 540 544 } 541 545 542 546 function bp_activity_add( $args = '' ) { 543 global $bp , $wpdb;547 global $bp; 544 548 545 549 $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. 547 551 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!" 550 554 551 'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent552 'type' => false, // The activity type e.g. activity_update, profile_updated553 '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) 554 558 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_id559 '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 557 561 '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 recorded559 '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? 560 564 ); 561 565 562 566 $params = wp_parse_args( $args, $defaults ); … … 627 631 ) ); 628 632 629 633 /* Add this update to the "latest update" usermeta so it can be fetched anywhere. */ 630 update_user meta( $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 ) ) ); 631 635 632 636 /* Require the notifications code so email notifications can be set on the 'bp_activity_posted_update' action. */ 633 637 require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-notifications.php' ); … … 754 758 else 755 759 $user_id = $args['user_id']; 756 760 757 $latest_update = get_user meta( $user_id, 'bp_latest_update');761 $latest_update = get_user_meta( $user_id, 'bp_latest_update', true ); 758 762 if ( !empty( $latest_update ) ) { 759 763 if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) ) 760 delete_user meta( $user_id, 'bp_latest_update' );764 delete_user_meta( $user_id, 'bp_latest_update' ); 761 765 } 762 766 763 767 do_action( 'bp_activity_delete', $args ); … … 908 912 } 909 913 910 914 function bp_activity_get_user_favorites( $user_id ) { 911 $my_favs = maybe_unserialize( get_user meta( $user_id, 'bp_favorite_activities') );915 $my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) ); 912 916 $existing_favs = bp_activity_get_specific( array( 'activity_ids' => $my_favs ) ); 913 917 914 918 foreach( (array)$existing_favs['activities'] as $fav ) 915 919 $new_favs[] = $fav->id; 916 920 917 921 $new_favs = array_unique( (array)$new_favs ); 918 update_user meta( $user_id, 'bp_favorite_activities', $new_favs );922 update_user_meta( $user_id, 'bp_favorite_activities', $new_favs ); 919 923 920 924 return apply_filters( 'bp_activity_get_user_favorites', $new_favs ); 921 925 } … … 927 931 $user_id = $bp->loggedin_user->id; 928 932 929 933 /* Update the user's personal favorites */ 930 $my_favs = maybe_unserialize( get_user meta( $bp->loggedin_user->id, 'bp_favorite_activities') );934 $my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) ); 931 935 $my_favs[] = $activity_id; 932 936 933 937 /* Update the total number of users who have favorited this activity */ … … 938 942 else 939 943 $fav_count = 1; 940 944 941 update_user meta( $bp->loggedin_user->id, 'bp_favorite_activities', $my_favs );945 update_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', $my_favs ); 942 946 bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count ); 943 947 944 948 do_action( 'bp_activity_add_user_favorite', $activity_id, $user_id ); … … 953 957 $user_id = $bp->loggedin_user->id; 954 958 955 959 /* Remove the fav from the user's favs */ 956 $my_favs = maybe_unserialize( get_user meta( $user_id, 'bp_favorite_activities') );960 $my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) ); 957 961 $my_favs = array_flip( (array) $my_favs ); 958 962 unset( $my_favs[$activity_id] ); 959 963 $my_favs = array_unique( array_flip( $my_favs ) ); … … 966 970 bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count ); 967 971 } 968 972 969 update_user meta( $user_id, 'bp_favorite_activities', $my_favs );973 update_user_meta( $user_id, 'bp_favorite_activities', $my_favs ); 970 974 971 975 do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id ); 972 976 … … 1088 1092 bp_activity_delete( array( 'user_id' => $user_id ) ); 1089 1093 1090 1094 // Remove any usermeta 1091 delete_user meta( $user_id, 'bp_latest_update' );1092 delete_user meta( $user_id, 'bp_favorite_activities' );1095 delete_user_meta( $user_id, 'bp_latest_update' ); 1096 delete_user_meta( $user_id, 'bp_favorite_activities' ); 1093 1097 1094 1098 do_action( 'bp_activity_remove_data', $user_id ); 1095 1099 } … … 1097 1101 add_action( 'delete_user', 'bp_activity_remove_data' ); 1098 1102 add_action( 'make_spam_user', 'bp_activity_remove_data' ); 1099 1103 1104 /** 1105 * updates_register_activity_actions() 1106 * 1107 * Register the activity stream actions for updates 1108 * 1109 * @global array $bp 1110 */ 1111 function updates_register_activity_actions() { 1112 global $bp; 1100 1113 1114 bp_activity_set_action( $bp->activity->id, 'activity_update', __( 'Posted an update', 'buddypress' ) ); 1115 1116 do_action( 'updates_register_activity_actions' ); 1117 } 1118 add_action( 'bp_register_activity_actions', 'updates_register_activity_actions' ); 1119 1101 1120 /******************************************************************************** 1102 1121 * Custom Actions 1103 1122 * … … 1109 1128 function bp_register_activity_actions() { 1110 1129 do_action( 'bp_register_activity_actions' ); 1111 1130 } 1112 add_action( ' plugins_loaded', 'bp_register_activity_actions');1131 add_action( 'bp_loaded', 'bp_register_activity_actions', 8 ); 1113 1132 1114 1133 1115 1134 ?> 1135 No newline at end of file -
bp-themes/bp-default/groups/single/activity.php
1 1 <div class="item-list-tabs no-ajax" id="subnav"> 2 2 <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> 4 4 5 5 <?php do_action( 'bp_group_activity_syndication_options' ) ?> 6 6 -
bp-themes/bp-default/groups/single/request-membership.php
1 1 <?php do_action( 'bp_before_group_request_membership_content' ) ?> 2 2 3 3 <?php if ( !bp_group_has_requested_membership() ) : ?> 4 <p><?php printf( __( "You are requesting to become a member of the group '%s'.", "buddypress" ), bp_g roup_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> 5 5 6 6 <form action="<?php bp_group_form_action('request-membership') ?>" method="post" name="request-membership-form" id="request-membership-form" class="standard-form"> 7 7 <label for="group-request-membership-comments"><?php _e( 'Comments (optional)', 'buddypress' ); ?></label> -
bp-themes/bp-default/groups/single/forum/topic.php
18 18 <h3><?php bp_the_topic_title() ?> (<?php bp_the_topic_total_post_count() ?>)</h3> 19 19 <a class="button" href="<?php bp_forum_permalink() ?>/">← <?php _e( 'Group Forum', 'buddypress' ) ?></a> <a class="button" href="<?php bp_forum_directory_permalink() ?>/"><?php _e( 'Group Forum Directory', 'buddypress') ?></a></span> 20 20 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> 24 28 </div> 25 29 26 30 <ul id="topic-post-list" class="item-list"> … … 42 46 <?php if ( bp_group_is_admin() || bp_group_is_mod() || bp_get_the_topic_post_is_mine() ) : ?> 43 47 <?php bp_the_topic_post_admin_links() ?> 44 48 <?php endif; ?> 49 50 <?php do_action( 'bp_group_forum_post_meta' ); ?> 51 45 52 <a href="#post-<?php bp_the_topic_post_id() ?>" title="<?php _e( 'Permanent link to this post', 'buddypress' ) ?>">#</a> 46 53 </div> 47 54 </li> … … 70 77 <div id="post-topic-reply"> 71 78 <p id="post-reply"></p> 72 79 73 <?php if ( !bp_group_is_member() ) : ?>80 <?php if ( bp_groups_auto_join() && !bp_group_is_member() ) : ?> 74 81 <p><?php _e( 'You will auto join this group when you reply to this topic.', 'buddypress' ) ?></p> 75 82 <?php endif; ?> 76 83 -
bp-themes/bp-default/groups/single/group-header.php
35 35 <div id="item-meta"> 36 36 <?php bp_group_description() ?> 37 37 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 38 44 <?php bp_group_join_button() ?> 39 45 40 46 <?php do_action( 'bp_group_header_meta' ) ?> -
bp-themes/bp-default/groups/single/admin.php
194 194 <ul id="members-list" class="item-list single-line"> 195 195 <?php while ( bp_group_members() ) : bp_group_the_member(); ?> 196 196 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() ?> 198 199 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'); ?> 201 204 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> 203 210 204 <?php else : ?>211 <?php else : ?> 205 212 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 & 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 & 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> 209 216 210 <?php endif; ?>217 <?php endif; ?> 211 218 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> 214 220 221 <?php do_action( 'bp_group_manage_members_admin_item' ); ?> 222 223 </span> 224 </h5> 225 </li> 226 215 227 <?php endwhile; ?> 216 228 </ul> 217 229 -
bp-themes/bp-default/groups/single/forum.php
21 21 22 22 <?php do_action( 'bp_before_group_forum_post_new' ) ?> 23 23 24 <?php if ( !bp_group_is_member() ) : ?>24 <?php if ( bp_groups_auto_join() && !bp_group_is_member() ) : ?> 25 25 <p><?php _e( 'You will auto join this group when you start a new topic.', 'buddypress' ) ?></p> 26 26 <?php endif; ?> 27 27 -
bp-themes/bp-default/groups/create.php
52 52 <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> 53 53 </div> 54 54 <?php else : ?> 55 <?php if ( is_s ite_admin() ) : ?>55 <?php if ( is_super_admin() ) : ?> 56 56 <div class="checkbox"> 57 57 <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> 58 58 </div> -
bp-themes/bp-default/groups/groups-loop.php
4 4 5 5 <?php if ( bp_has_groups( bp_ajax_querystring( 'groups' ) ) ) : ?> 6 6 7 <div class="pagination">7 <div id="pag-top" class="pagination"> 8 8 9 <div class="pag-count" id="group-dir-count ">9 <div class="pag-count" id="group-dir-count-top"> 10 10 <?php bp_groups_pagination_count() ?> 11 11 </div> 12 12 13 <div class="pagination-links" id="group-dir-pag ">13 <div class="pagination-links" id="group-dir-pag-top"> 14 14 <?php bp_groups_pagination_links() ?> 15 15 </div> 16 16 17 17 </div> 18 18 19 <?php do_action( 'bp_before_directory_groups_list' ) ?> 20 19 21 <ul id="groups-list" class="item-list"> 20 22 <?php while ( bp_groups() ) : bp_the_group(); ?> 21 23 … … 52 54 <?php endwhile; ?> 53 55 </ul> 54 56 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 57 71 <?php else: ?> 58 72 59 73 <div id="message" class="info"> -
bp-themes/bp-default/footer.php
4 4 <?php do_action( 'bp_before_footer' ) ?> 5 5 6 6 <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> 8 8 9 9 <?php do_action( 'bp_footer' ) ?> 10 10 </div><!-- #footer --> -
bp-themes/bp-default/members/single/profile/profile-loop.php
15 15 <h4><?php bp_the_profile_group_name() ?></h4> 16 16 <?php endif; ?> 17 17 18 <table class="profile-fields ">18 <table class="profile-fields zebra"> 19 19 <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?> 20 20 21 21 <?php if ( bp_field_has_data() ) : ?> -
bp-themes/bp-default/members/single/groups.php
8 8 <li id="groups-order-select" class="last filter"> 9 9 10 10 <?php _e( 'Order By:', 'buddypress' ) ?> 11 <select id="groups- all">11 <select id="groups-sort-by"> 12 12 <option value="active"><?php _e( 'Last Active', 'buddypress' ) ?></option> 13 13 <option value="popular"><?php _e( 'Most Members', 'buddypress' ) ?></option> 14 14 <option value="newest"><?php _e( 'Newly Created', 'buddypress' ) ?></option> -
bp-themes/bp-default/members/single/messages/notices-loop.php
17 17 <?php do_action( 'bp_after_notices_pagination' ) ?> 18 18 <?php do_action( 'bp_before_notices' ) ?> 19 19 20 <table id="message-threads" >20 <table id="message-threads" class="zebra"> 21 21 <?php while ( bp_message_threads() ) : bp_message_thread(); ?> 22 22 <tr> 23 23 <td width="1%"> -
bp-themes/bp-default/members/single/messages/messages-loop.php
17 17 <?php do_action( 'bp_after_member_messages_pagination' ) ?> 18 18 <?php do_action( 'bp_before_member_messages_threads' ) ?> 19 19 20 <table id="message-threads" >20 <table id="message-threads" class="zebra"> 21 21 <?php while ( bp_message_threads() ) : bp_message_thread(); ?> 22 22 23 23 <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
10 10 </li> 11 11 </ul> 12 12 13 <?php if ( is_s ite_admin() ) : ?>13 <?php if ( is_super_admin() ) : ?> 14 14 <input type="checkbox" id="send-notice" name="send-notice" value="1" /> <?php _e( "This is a notice to all users.", "buddypress" ) ?> 15 15 <?php endif; ?> 16 16 -
bp-themes/bp-default/members/members-loop.php
4 4 5 5 <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?> 6 6 7 <div class="pagination">7 <div id="pag-top" class="pagination"> 8 8 9 <div class="pag-count" id="member-dir-count ">9 <div class="pag-count" id="member-dir-count-top"> 10 10 <?php bp_members_pagination_count() ?> 11 11 </div> 12 12 13 <div class="pagination-links" id="member-dir-pag ">13 <div class="pagination-links" id="member-dir-pag-top"> 14 14 <?php bp_members_pagination_links() ?> 15 15 </div> 16 16 … … 69 69 70 70 <?php bp_member_hidden_fields() ?> 71 71 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 72 84 <?php else: ?> 73 85 74 86 <div id="message" class="info"> -
bp-themes/bp-default/search.php
32 32 <div class="post-content"> 33 33 <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> 34 34 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> 36 36 37 37 <div class="entry"> 38 38 <?php the_content( __( 'Read the rest of this entry →', 'buddypress' ) ); ?> -
bp-themes/bp-default/activity/index.php
57 57 58 58 <div class="item-list-tabs no-ajax" id="subnav"> 59 59 <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> 61 61 62 62 <?php do_action( 'bp_activity_syndication_options' ) ?> 63 63 -
bp-themes/bp-default/index.php
23 23 <div class="post-content"> 24 24 <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> 25 25 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> 27 27 28 28 <div class="entry"> 29 29 <?php the_content( __( 'Read the rest of this entry →', 'buddypress' ) ); ?> -
bp-themes/bp-default/functions.php
1 1 <?php 2 2 3 / * Stop the theme from killing WordPress if BuddyPress is not enabled. */3 // Stop the theme from killing WordPress if BuddyPress is not enabled. 4 4 if ( !class_exists( 'BP_Core_User' ) ) 5 5 return false; 6 6 7 / * Register the widget columns */7 // Register the widget columns 8 8 register_sidebars( 1, 9 9 array( 10 'name' => 'Sidebar',10 'name' => 'Sidebar', 11 11 '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>' 15 15 ) 16 16 ); 17 17 18 / * Load the AJAX functions for the theme */18 // Load the AJAX functions for the theme 19 19 require_once( TEMPLATEPATH . '/_inc/ajax.php' ); 20 20 21 / * Load the javascript for the theme */21 // Load the javascript for the theme 22 22 wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) ); 23 23 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 ); 35 wp_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 */ 25 43 function bp_dtheme_add_blog_comments_js() { 26 44 if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); 27 45 } 28 46 add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' ); 29 47 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 */ 31 58 function bp_dtheme_blog_comments( $comment, $args, $depth ) { 32 59 $GLOBALS['comment'] = $comment; ?> 33 60 … … 65 92 </div> 66 93 67 94 </div> 68 </li>69 95 <?php 70 96 } 71 97 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 */ 73 107 function bp_dtheme_wp_pages_filter( $page_html ) { 74 108 if ( 'page_on_front' != substr( $page_html, 14, 13 ) ) 75 109 return $page_html; … … 85 119 } 86 120 add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' ); 87 121 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 */ 89 131 function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) { 90 if ( !is_admin() || !is_s ite_admin() )132 if ( !is_admin() || !is_super_admin() ) 91 133 return false; 92 134 93 135 if ( 'activity' == $_POST['page_on_front'] ) … … 97 139 } 98 140 add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 ); 99 141 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 */ 101 151 function bp_dtheme_page_on_front_template( $template ) { 102 152 global $wp_query; 103 153 … … 108 158 } 109 159 add_filter( 'page_template', 'bp_dtheme_page_on_front_template' ); 110 160 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 */ 112 168 function bp_dtheme_page_on_front() { 113 169 if ( 'page' != get_option( 'show_on_front' ) ) 114 170 return false; … … 116 172 return apply_filters( 'bp_dtheme_page_on_front', get_option( 'page_on_front' ) ); 117 173 } 118 174 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 */ 120 182 function bp_dtheme_fix_get_posts_on_activity_front() { 121 183 global $wp_query; 122 184 … … 125 187 } 126 188 add_action( 'pre_get_posts', 'bp_dtheme_fix_get_posts_on_activity_front' ); 127 189 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 */ 199 function 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 } 208 add_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 */ 219 function 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 } 235 add_filter( 'bp_get_activity_action_pre_meta', 'bp_dtheme_activity_secondary_avatars', 10, 2 ); 236 237 /** 129 238 * Custom header image support. You can remove this entirely in a child theme by adding this line 130 239 * to your functions.php: define( 'BP_DTHEME_DISABLE_CUSTOM_HEADER', true ); 240 * 241 * @package BuddyPress Theme 242 * @since 1.2 131 243 */ 132 244 function 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/) 134 246 define( 'HEADER_TEXTCOLOR', 'FFFFFF' ); 135 247 define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' ); // %s is theme dir uri 136 248 define( 'HEADER_IMAGE_WIDTH', 1250 ); … … 202 314 if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) ) 203 315 add_action( 'init', 'bp_dtheme_add_custom_header_support' ); 204 316 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 */ 206 323 function bp_dtheme_show_notice() { ?> 207 324 <div id="message" class="updated fade"> 208 325 <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> … … 214 331 if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) 215 332 add_action( 'admin_notices', 'bp_dtheme_show_notice' ); 216 333 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 <?php230 }231 add_action( 'wp_footer', 'bp_dtheme_js_terms' );232 233 334 // Member Buttons 234 335 add_action( 'bp_member_header_actions', 'bp_add_friend_button' ); 235 336 add_action( 'bp_member_header_actions', 'bp_send_public_message_button' ); -
bp-themes/bp-default/sidebar.php
14 14 <?php bp_loggedin_user_avatar( 'type=thumb&width=40&height=40' ) ?> 15 15 </a> 16 16 17 <h4><?php bp_loggedinuser_link()?></h4>17 <h4><?php echo bp_core_get_userlink( bp_loggedin_user_id() ); ?></h4> 18 18 <a class="button logout" href="<?php echo wp_logout_url( bp_get_root_domain() ) ?>"><?php _e( 'Log Out', 'buddypress' ) ?></a> 19 19 20 20 <?php do_action( 'bp_sidebar_me' ) ?> … … 39 39 40 40 <form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php echo site_url( 'wp-login.php', 'login' ) ?>" method="post"> 41 41 <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> 43 43 44 44 <label><?php _e( 'Password', 'buddypress' ) ?><br /> 45 45 <input type="password" name="pwd" id="sidebar-user-pass" class="input" value="" /></label> -
bp-themes/bp-default/blogs/blogs-loop.php
4 4 5 5 <?php if ( bp_has_blogs( bp_ajax_querystring( 'blogs' ) ) ) : ?> 6 6 7 <div class="pagination">7 <div id="pag-top" class="pagination"> 8 8 9 <div class="pag-count" id="blog-dir-count ">9 <div class="pag-count" id="blog-dir-count-top"> 10 10 <?php bp_blogs_pagination_count() ?> 11 11 </div> 12 12 13 <div class="pagination-links" id="blog-dir-pag ">13 <div class="pagination-links" id="blog-dir-pag-top"> 14 14 <?php bp_blogs_pagination_links() ?> 15 15 </div> 16 16 17 17 </div> 18 18 19 <?php do_action( 'bp_before_directory_blogs_list' ) ?> 20 19 21 <ul id="blogs-list" class="item-list"> 20 22 <?php while ( bp_blogs() ) : bp_the_blog(); ?> 21 23 … … 51 53 52 54 <?php bp_blog_hidden_fields() ?> 53 55 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 54 68 <?php else: ?> 55 69 56 70 <div id="message" class="info"> -
bp-themes/bp-default/archive.php
32 32 <div class="post-content"> 33 33 <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> 34 34 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> 36 36 37 37 <div class="entry"> 38 38 <?php the_content( __( 'Read the rest of this entry →', 'buddypress' ) ); ?> -
bp-themes/bp-default/single.php
26 26 <div class="post-content"> 27 27 <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> 28 28 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> 30 30 31 31 <div class="entry"> 32 32 <?php the_content( __( 'Read the rest of this entry →', 'buddypress' ) ); ?> -
bp-themes/bp-default/_inc/css/default.css
35 35 a:hover, a:active { color: #888; } 36 36 a:focus { outline: 1px dotted #ccc; } 37 37 38 .padder { padding: 20px; }38 .padder { padding: 19px; } 39 39 .clear { clear: left; } 40 40 41 41 p { margin-bottom: 15px; } … … 179 179 width: 224px; 180 180 margin-left: -226px; 181 181 margin-top: 1px; 182 border-left: 1px solid # e4e4e4;182 border-left: 1px solid #ddd; 183 183 -moz-border-radius-topright: 3px; 184 184 -webkit-border-top-right-radius: 3px; 185 185 background: url( ../images/sidebar_back.gif ) top left repeat-x; … … 273 273 274 274 div#content .padder { 275 275 margin-right: 225px; 276 border-right: 1px solid # e4e4e4;276 border-right: 1px solid #ddd; 277 277 -moz-border-radius-topleft: 6px; 278 278 -webkit-border-top-left-radius: 6px; 279 279 -moz-border-radius-bottomleft: 6px; … … 399 399 border-bottom: 1px solid #eaeaea; 400 400 } 401 401 ul.single-line li { border: none; } 402 body.activity-permalink ul.item-list li { padding-top: 0; }403 402 404 403 ul.item-list li img.avatar { 405 404 float: left; … … 448 447 div.item-list-tabs { 449 448 clear: left; 450 449 overflow: hidden; 451 margin: 25px - 20px 20px -20px;450 margin: 25px -19px 20px -19px; 452 451 background: #eaeaea; 453 452 } 454 453 div.item-list-tabs ul li a { … … 524 523 525 524 div.item-list-tabs#subnav { 526 525 background: #fff; 527 margin: -15px - 20px 15px -20px;526 margin: -15px -19px 15px -19px; 528 527 border-bottom: 1px solid #eaeaea; 529 528 min-height: 35px; 530 529 overflow: hidden; … … 574 573 -------------------------------------------------------------- */ 575 574 576 575 div.pagination { 577 margin: - 15px -20px 9px -20px;576 margin: -20px -20px 9px -20px; 578 577 border-bottom: 1px solid #eaeaea; 579 578 padding: 10px 20px 10px 20px; 580 579 color: #888; … … 604 603 font-weight: bold; 605 604 } 606 605 606 div#pag-bottom { 607 margin-top: 0; 608 } 609 607 610 /* > Error / Success Messages 608 611 -------------------------------------------------------------- */ 609 612 … … 644 647 /* > Buttons 645 648 -------------------------------------------------------------- */ 646 649 647 a.button, input[type=submit], input[type=button], 650 a.button, input[type=submit], input[type=button], input[type=reset], 648 651 ul.button-nav li a, div.generic-button a { 649 652 background: url( ../images/white-grad.png ) top left repeat-x; 650 653 border: 1px solid #ddd; … … 659 662 vertical-align: bottom; 660 663 cursor: pointer; 661 664 } 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, 663 666 ul.button-nav li a:hover, ul.button-nav li.current a, 664 667 div.generic-button a:hover { 665 668 border-color: #aaa; … … 840 843 table { 841 844 width: 100%; 842 845 } 846 table thead tr { 847 background: #eaeaea; 848 } 849 843 850 table#message-threads { 844 851 margin: 0 -20px; 845 852 width: auto; … … 888 895 margin: -9px -20px 20px -20px; 889 896 width: auto; 890 897 } 891 table.forum tr:first-child {892 background: #fafafa;893 }894 895 898 table.forum tr.sticky td { 896 899 background: #FFF9DB; 897 900 border-top: 1px solid #FFE8C4; … … 1145 1148 color: #888; 1146 1149 line-height: 220%; 1147 1150 } 1151 1152 .activity-list .activity-content .activity-header img.avatar { 1153 float: none !important; 1154 margin: 0 5px -8px 0 !important; 1155 } 1148 1156 1149 1157 .activity-list .activity-header a:first-child, span.highlight { 1150 1158 background: #EBF7FF; … … 1275 1283 background: #f5f5f5; 1276 1284 -moz-border-radius: 4px; 1277 1285 -webkit-border-radius: 4px; 1286 padding: 0 10px 0; 1278 1287 } 1279 1288 div.activity-comments ul, div.activity-comments ul li { 1280 1289 border: none; … … 1287 1296 1288 1297 div.activity-comments ul li { 1289 1298 border-top: 2px solid #fff; 1290 padding: 10px 15px 10px 0; 1291 margin-left: 15px; 1299 padding: 10px 0 0; 1292 1300 } 1293 1301 body.activity-permalink div.activity-comments ul li { 1294 1302 border-width: 1px; 1295 padding: 1 5px 0 15px0;1303 padding: 10px 0 0; 1296 1304 } 1297 1305 1298 1306 div.activity-comments ul li p:last-child { 1299 margin-bottom: 0;1307 margin-bottom: 10px; 1300 1308 } 1301 1309 1302 1310 div.activity-comments > ul > li:first-child { … … 1308 1316 } 1309 1317 1310 1318 div.activity-comments ul li > ul { 1311 margin-top: 5px;1312 margin-left: 2 5px;1319 margin-top: 0; 1320 margin-left: 20px; 1313 1321 } 1314 1322 body.activity-permalink div.activity-comments ul li > ul { 1315 1323 margin-top: 15px; … … 1342 1350 div.activity-comments form.ac-form { 1343 1351 display: none; 1344 1352 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; 1348 1355 -moz-border-radius: 4px; 1349 1356 -webkit-border-radius: 4px; 1350 1357 border-radius: 4px; … … 1747 1754 } 1748 1755 #footer a { 1749 1756 color: #bbb; 1750 } 1751 No newline at end of file 1757 } -
bp-themes/bp-default/_inc/ajax.php
187 187 </div> 188 188 189 189 <div class="acomment-meta"> 190 <?php echo bp_core_get_userlink( bp_get_activity_user_id() ) ?> · <?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( gmdate( "Y-m-d H:i:s") ) ) ?> ·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() ) ?> · <?php printf( __( '%s ago', 'buddypress' ), bp_core_time_since( bp_core_current_time() ) ) ?> · 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> 192 192 · <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> 193 193 </div> 194 194 … … 216 216 $activity = new BP_Activity_Activity( $_POST['id'] ); 217 217 218 218 /* Check access */ 219 if ( !is_s ite_admin() && $activity->user_id != $bp->loggedin_user->id )219 if ( !is_super_admin() && $activity->user_id != $bp->loggedin_user->id ) 220 220 return false; 221 221 222 222 if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) ) … … 249 249 $comment = new BP_Activity_Activity( $_POST['id'] ); 250 250 251 251 /* Check access */ 252 if ( !is_s ite_admin() && $comment->user_id != $bp->loggedin_user->id )252 if ( !is_super_admin() && $comment->user_id != $bp->loggedin_user->id ) 253 253 return false; 254 254 255 255 if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) ) … … 312 312 echo '<h4>' . $user->user_link . '</h4>'; 313 313 echo '<span class="activity">' . esc_attr( $user->last_active ) . '</span>'; 314 314 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> 316 316 </div>'; 317 317 echo '</li>'; 318 318 … … 404 404 if ( !groups_join_group( $group->id ) ) { 405 405 _e( 'Error joining group', 'buddypress' ); 406 406 } 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>'; 408 408 } 409 409 410 410 } else if ( 'private' == $group->status ) { … … 414 414 if ( !groups_send_membership_request( $bp->loggedin_user->id, $group->id ) ) { 415 415 _e( 'Error requesting membership', 'buddypress' ); 416 416 } 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>'; 418 418 } 419 419 } 420 420 … … 426 426 _e( 'Error leaving group', 'buddypress' ); 427 427 } else { 428 428 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>'; 430 430 } 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>'; 432 432 } 433 433 } 434 434 } … … 442 442 if ( !isset( $_POST['notice_id'] ) ) { 443 443 echo "-1<div id='message' class='error'><p>" . __('There was a problem closing the notice.', 'buddypress') . '</p></div>'; 444 444 } else { 445 $notice_ids = get_user meta( $userdata->ID, 'closed_notices');445 $notice_ids = get_user_meta( $userdata->ID, 'closed_notices', true ); 446 446 447 447 $notice_ids[] = (int) $_POST['notice_id']; 448 448 449 update_user meta( $userdata->ID, 'closed_notices', $notice_ids );449 update_user_meta( $userdata->ID, 'closed_notices', $notice_ids ); 450 450 } 451 451 } 452 452 add_action( 'wp_ajax_messages_close_notice', 'bp_dtheme_ajax_close_notice' ); … … 465 465 <?php do_action( 'bp_before_message_meta' ) ?> 466 466 <?php echo bp_loggedin_user_avatar( 'type=thumb&width=30&height=30' ); ?> 467 467 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> 469 469 470 470 <?php do_action( 'bp_after_message_meta' ) ?> 471 471 </div> -
bp-themes/bp-default/registration/register.php
179 179 <label for="signup_blog_url"><?php _e( 'Blog URL', 'buddypress' ) ?> <?php _e( '(required)', 'buddypress' ) ?></label> 180 180 <?php do_action( 'bp_signup_blog_url_errors' ) ?> 181 181 182 <?php if ( 'yes' == VHOST) : ?>182 <?php if ( is_subdomain_install() ) : ?> 183 183 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() ) ?> 184 184 <?php else : ?> 185 185 <?php echo site_url() ?>/ <input type="text" name="signup_blog_url" id="signup_blog_url" value="<?php bp_signup_blog_url_value() ?>" /> … … 206 206 <?php do_action( 'bp_before_registration_submit_buttons' ) ?> 207 207 208 208 <div class="submit"> 209 <input type="submit" name="signup_submit" id="signup_submit" value="<?php _e( 'Complete Sign Up', 'buddypress' ) ?> →" />209 <input type="submit" name="signup_submit" id="signup_submit" value="<?php _e( 'Complete Sign Up', 'buddypress' ) ?> →" /> 210 210 </div> 211 211 212 212 <?php do_action( 'bp_after_registration_submit_buttons' ) ?> -
bp-themes/bp-default/forums/index.php
36 36 37 37 <label><?php _e( 'Post In Group Forum:', 'buddypress' ) ?></label> 38 38 <select id="topic_group_id" name="topic_group_id"> 39 <option value="">----</option> 39 40 <?php while ( bp_groups() ) : bp_the_group(); ?> 40 41 <?php if ( 'public' == bp_get_group_status() ) : ?> 41 42 <option value="<?php bp_group_id() ?>"><?php bp_group_name() ?></option> -
bp-themes/bp-default/header.php
56 56 <div id="search-bar"> 57 57 <div class="padder"> 58 58 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() ) : ?> 62 60 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() ?> 66 64 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 67 71 <?php do_action( 'bp_search_login_bar' ) ?> 68 72 69 73 </div><!-- .padder --> -
bp-xprofile/bp-xprofile-admin.php
58 58 $type = ( $type == 'error' ) ? 'error' : 'updated'; ?> 59 59 60 60 <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> 62 62 </div> 63 63 <?php endif; ?> 64 64 -
bp-xprofile/bp-xprofile-templatetags.php
176 176 $css_classes = array(); 177 177 178 178 if ( $class ) 179 $css_classes[] = sanitize_title( attribute_escape( $class ) );179 $css_classes[] = sanitize_title( esc_attr( $class ) ); 180 180 181 181 /* Set a class with the field ID */ 182 182 $css_classes[] = 'field_' . $profile_template->field->id; … … 184 184 /* Set a class with the field name (sanitized) */ 185 185 $css_classes[] = 'field_' . sanitize_title( $profile_template->field->name ); 186 186 187 if ( $profile_template->current_field % 2 )187 if ( $profile_template->current_field % 2 == 1 ) 188 188 $css_classes[] = 'alt'; 189 189 190 190 $css_classes = apply_filters( 'bp_field_css_classes', &$css_classes ); … … 383 383 else 384 384 $selected = ''; 385 385 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] ); 387 387 } 388 388 break; 389 389 … … 404 404 else 405 405 $selected = ''; 406 406 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] ); 408 408 } 409 409 410 410 $html .= '</div>'; … … 429 429 } 430 430 } 431 431 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] ); 433 433 $selected = ''; 434 434 } 435 435 break; … … 461 461 462 462 switch ( $type ) { 463 463 case 'day': 464 $html .= '<option value=""' . attribute_escape( $default_select ) . '>--</option>';464 $html .= '<option value=""' . esc_attr( $default_select ) . '>--</option>'; 465 465 466 466 for ( $i = 1; $i < 32; $i++ ) { 467 467 if ( $day == $i ) … … 482 482 __( 'October', 'buddypress' ), __( 'November', 'buddypress' ), __( 'December', 'buddypress' ) 483 483 ); 484 484 485 $html .= '<option value=""' . attribute_escape( $default_select ) . '>------</option>';485 $html .= '<option value=""' . esc_attr( $default_select ) . '>------</option>'; 486 486 487 487 for ( $i = 0; $i < 12; $i++ ) { 488 488 if ( $month == $eng_months[$i] ) … … 495 495 break; 496 496 497 497 case 'year': 498 $html .= '<option value=""' . attribute_escape( $default_select ) . '>----</option>';498 $html .= '<option value=""' . esc_attr( $default_select ) . '>----</option>'; 499 499 500 500 for ( $i = date( 'Y', time() ); $i > 1899; $i-- ) { 501 501 if ( $year == $i ) … … 568 568 $selected = ''; 569 569 570 570 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>'; 572 572 } 573 573 574 574 do_action( 'xprofile_profile_group_tabs' ); … … 630 630 function bp_get_profile_last_updated() { 631 631 global $bp; 632 632 633 $last_updated = get_user meta( $bp->displayed_user->id, 'profile_last_updated');633 $last_updated = get_user_meta( $bp->displayed_user->id, 'profile_last_updated', true ); 634 634 635 635 if ( $last_updated ) 636 636 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
201 201 </div> 202 202 <?php endif; ?> 203 203 <div id="poststuff"> 204 <form action="<?php echo attribute_escape( $action ); ?>" method="post">204 <form action="<?php echo esc_attr( $action ); ?>" method="post"> 205 205 <div id="titlediv"> 206 206 <h3><label for="group_name"><?php _e( "Field Group Title", 'buddypress') ?> *</label></h3> 207 207 <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%" /> 209 209 </div> 210 210 </div> 211 211 … … 219 219 <?php endif; ?> 220 220 221 221 <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"/> 224 224 <?php _e( 'or', 'buddypress' ); ?> <a href="admin.php?page=bp-profile-setup" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a> 225 225 </p> 226 226 </form> … … 320 320 if ( $this->id != null ) 321 321 $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 ); 322 322 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 ); 324 324 325 325 /* 326 326 * Check for null so field options can be changed without changing any other part of the field. … … 546 546 $default_name = '[' . $j . ']'; 547 547 ?> 548 548 <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 ); ?>" /> 550 550 <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' ); ?> 551 551 <?php 552 552 if ( $j != 1 && $options[$i]->id != -1 ) : ?> … … 609 609 <div id="titlediv"> 610 610 <h3><label for="title"><?php _e( 'Field Title', 'buddypress' ); ?> *</label></h3> 611 611 <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%" /> 613 613 </div> 614 614 </div> 615 615 <?php … … 649 649 <input type="hidden" name="fieldtype" id="fieldtype" value="textbox" /> 650 650 <?php } ?> 651 651 <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 ); ?>" /> 653 653 <input type="submit" value="<?php _e( 'Save', 'buddypress' ); ?>" name="saveField" id="saveField" style="font-weight: bold" class="button-primary" /> 654 654 <?php _e( 'or', 'buddypress' ); ?> <a href="admin.php?page=bp-profile-setup" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a> 655 655 </p> -
bp-core/bp-core-widgets.php
58 58 <?php endwhile; ?> 59 59 </ul> 60 60 <?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'] ); ?>" /> 62 62 63 63 <?php else: ?> 64 64 … … 84 84 $max_members = strip_tags( $instance['max_members'] ); 85 85 ?> 86 86 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> 88 88 <?php 89 89 } 90 90 } … … 138 138 $max_members = strip_tags( $instance['max_members'] ); 139 139 ?> 140 140 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> 142 142 <?php 143 143 } 144 144 } … … 192 192 $max_members = strip_tags( $instance['max_members'] ); 193 193 ?> 194 194 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> 196 196 <?php 197 197 } 198 198 } -
bp-core/bp-core-filters.php
32 32 * @return The blog name for the root blog 33 33 */ 34 34 function 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 ) ); 36 36 } 37 37 add_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' ); 38 38 … … 65 65 function bp_core_allow_default_theme( $themes ) { 66 66 global $bp, $current_blog; 67 67 68 if ( !is_s ite_admin() )68 if ( !is_super_admin() ) 69 69 return $themes; 70 70 71 71 if ( $current_blog->ID == $bp->root_blog ) { … … 174 174 175 175 // Send email with activation link. 176 176 $activate_url = bp_get_activation_page() ."?key=$key"; 177 $activate_url = clean_url($activate_url);177 $activate_url = esc_url($activate_url); 178 178 179 179 $admin_email = get_site_option( "admin_email" ); 180 180 … … 203 203 global $current_site; 204 204 205 205 $activate_url = bp_get_activation_page() ."?key=$key"; 206 $activate_url = clean_url($activate_url);206 $activate_url = esc_url($activate_url); 207 207 $admin_email = get_site_option( "admin_email" ); 208 208 209 209 if ( empty( $admin_email ) ) … … 215 215 216 216 $from_name = ( '' == get_site_option( "site_name" ) ) ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) ); 217 217 $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}" ) ); 219 219 $subject = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' ); 220 220 221 221 /* Send the message */ -
bp-core/bp-core-notifications.php
4 4 global $bp; 5 5 6 6 if ( !$date_notified ) 7 $date_notified = time();7 $date_notified = bp_core_current_time(); 8 8 9 9 $notification = new BP_Core_Notification; 10 10 $notification->item_id = $item_id; -
bp-core/bp-core-adminbar.php
108 108 wp_cache_set( 'bp_blogs_of_user_' . $bp->loggedin_user->id . '_inc_hidden', $blogs, 'bp' ); 109 109 } 110 110 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 . '/">'; 112 112 113 113 _e( 'My Blogs', 'buddypress' ); 114 114 -
bp-core/bp-core-wpabstraction.php
24 24 return true; 25 25 } 26 26 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 */ 38 function 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 27 50 function bp_core_get_status_sql( $prefix = false ) { 28 51 if ( !bp_core_is_multisite() ) 29 52 return "{$prefix}user_status = 0"; -
bp-core/bp-core-cssjs.php
38 38 39 39 <style type="text/css"> 40 40 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; } 42 42 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a img { display: none; } 43 43 </style> 44 44 -
bp-core/bp-core-templatetags.php
125 125 $page = 1; 126 126 $search_terms = false; 127 127 128 / * User filtering */128 // User filtering 129 129 if ( !empty( $bp->displayed_user->id ) ) 130 130 $user_id = $bp->displayed_user->id; 131 131 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'] ) ) 134 134 $search_terms = $_REQUEST['s']; 135 135 136 136 // type: active ( default ) | random | newest | popular | online | alphabetical … … 156 156 $per_page = $max; 157 157 } 158 158 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. 160 160 if ( empty( $include ) && $bp->friends->slug == $bp->current_component && 'requests' == $bp->current_action ) 161 161 return false; 162 162 … … 328 328 function bp_get_member_registered() { 329 329 global $members_template; 330 330 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' ) ) ); 332 332 333 333 return apply_filters( 'bp_member_last_active', $registered ); 334 334 } … … 345 345 346 346 function bp_member_hidden_fields() { 347 347 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" />'; 349 349 } 350 350 351 351 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" />'; 353 353 } 354 354 355 355 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" />'; 357 357 } 358 358 } 359 359 … … 366 366 367 367 ?> 368 368 <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> 370 370 <input type="submit" id="members_search_submit" name="members_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" /> 371 371 </form> 372 372 <?php … … 516 516 if ( empty( $bp->bp_options_title ) ) 517 517 $bp->bp_options_title = __( 'Options', 'buddypress' ); 518 518 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 ) ); 520 520 } 521 521 522 522 … … 574 574 global $bp; 575 575 576 576 $defaults = array( 577 'type' => 'thumb', 578 'width' => false, 579 'height' => false 577 'type' => 'thumb', 578 'width' => false, 579 'height' => false, 580 'html' => true 580 581 ); 581 582 582 583 $r = wp_parse_args( $args, $defaults ); 583 584 extract( $r, EXTR_SKIP ); 584 585 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 ) ) ); 586 587 } 587 588 588 589 function bp_displayed_user_avatar( $args = '' ) { … … 592 593 global $bp; 593 594 594 595 $defaults = array( 595 'type' => 'thumb', 596 'width' => false, 597 'height' => false 596 'type' => 'thumb', 597 'width' => false, 598 'height' => false, 599 'html' => true 598 600 ); 599 601 600 602 $r = wp_parse_args( $args, $defaults ); 601 603 extract( $r, EXTR_SKIP ); 602 604 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 ) ) ); 604 606 } 605 607 606 608 function bp_avatar_admin_step() { … … 668 670 if ( !$user_id ) 669 671 $user_id = $bp->displayed_user->id; 670 672 671 $last_activity = bp_core_get_last_activity( get_user meta( $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') ); 672 674 673 675 if ( $echo ) 674 676 echo apply_filters( 'bp_last_activity', $last_activity ); … … 681 683 } 682 684 function bp_get_user_firstname( $name = false ) { 683 685 global $bp; 686 687 // Try to get displayed user 688 if ( empty( $name ) ) 689 $name = $bp->displayed_user->fullname; 684 690 685 if ( !$name ) 691 // Fall back on logged in user 692 if ( empty( $name ) ) 686 693 $name = $bp->loggedin_user->fullname; 687 694 688 695 $fullname = (array)explode( ' ', $name ); … … 705 712 <div class="bp-widget wp-profile"> 706 713 <h4><?php _e( 'My Profile' ) ?></h4> 707 714 708 <table class="wp-profile-fields ">715 <table class="wp-profile-fields zebra"> 709 716 <?php if ( $ud->display_name ) { ?> 710 717 <tr id="wp_displayname"> 711 718 <td class="label"> … … 783 790 } 784 791 785 792 function bp_format_time( $time, $just_date = false ) { 786 $date = date( get_option('date_format'), $time ); 793 if ( !$time ) 794 return false; 787 795 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? 788 806 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 ); 790 812 } 791 813 792 814 return apply_filters( 'bp_format_time', $date ); … … 863 885 function bp_get_page_title() { 864 886 global $bp, $post, $wp_query, $current_blog; 865 887 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' ) ) ) { 867 889 $title = __( 'Home', 'buddypress' ); 868 890 869 891 } else if ( bp_is_blog_page() ) { … … 951 973 return apply_filters( 'bp_get_activation_page', $page ); 952 974 } 953 975 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 */ 986 function 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 954 1002 function bp_search_form_action() { 955 1003 global $bp; 956 1004 … … 1364 1412 } 1365 1413 1366 1414 function 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 ); 1368 1423 } 1369 1424 1370 1425 function bp_is_page($page) { -
bp-core/bp-core-classes.php
50 50 * @uses bp_core_get_userurl() Returns the URL with no HTML markup for a user based on their user id 51 51 * @uses bp_core_get_userlink() Returns a HTML formatted link for a user with the user's full name as the link text 52 52 * @uses bp_core_get_user_email() Returns the email address for the user based on user ID 53 * @uses get_user meta() WordPress function returns the value of passed usermeta name from usermeta table53 * @uses get_user_meta() WordPress function returns the value of passed usermeta name from usermeta table 54 54 * @uses bp_core_fetch_avatar() Returns HTML formatted avatar for a user 55 55 * @uses bp_profile_last_updated_date() Returns the last updated date for a user. 56 56 */ … … 60 60 61 61 if ( $this->profile_data ) { 62 62 $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'] ); 64 64 $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'] ); 66 66 } else { 67 67 $this->user_url = bp_core_get_user_domain( $this->id ); 68 68 $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 ) ); 71 71 } 72 72 73 73 /* Cache a few things that are fetched often */ … … 79 79 $this->avatar_thumb = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb' ) ); 80 80 $this->avatar_mini = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) ); 81 81 82 $this->last_active = bp_core_get_last_activity( get_user meta( $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' ) ); 83 83 } 84 84 85 85 function populate_extras() { … … 177 177 $sql['pagination'] = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 178 178 179 179 /* 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 ); 181 182 182 183 /* Re-jig the SQL so we can get the total user count */ 183 184 unset( $sql['select_main'] ); … … 197 198 array_unshift( $sql, "SELECT COUNT(DISTINCT u.ID)" ); 198 199 199 200 /* 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 ); 201 203 202 204 /*** 203 205 * Lets fetch some other useful data in a separate queries, this will be faster than querying the data for every user in a list. … … 222 224 if ( $limit && $page ) 223 225 $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 224 226 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 } 227 237 228 238 $letter = like_escape( $wpdb->escape( $letter ) ); 229 239 $status_sql = bp_core_get_status_sql( 'u.' ); … … 435 445 436 446 if ( $this->id ) { 437 447 // 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 ); 439 449 } else { 440 450 // 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 ); 442 452 } 443 453 444 454 if ( !$result = $wpdb->query( $sql ) ) -
bp-core/bp-core-settings.php
21 21 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() ) ); 22 22 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() ) ); 23 23 24 if ( !is_s ite_admin() && !(int) $bp->site_options['bp-disable-account-deletion'] )24 if ( !is_super_admin() && !(int) $bp->site_options['bp-disable-account-deletion'] ) 25 25 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() ) ); 26 26 } 27 add_action( 'wp', 'bp_core_add_settings_nav', 2 ); 28 add_action( 'admin_menu', 'bp_core_add_settings_nav', 2 ); 27 add_action( 'bp_setup_nav', 'bp_core_add_settings_nav' ); 29 28 30 29 /**** GENERAL SETTINGS ****/ 31 30 … … 87 86 88 87 <form action="<?php echo $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/general' ?>" method="post" class="standard-form" id="settings-form"> 89 88 <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" /> 91 90 92 91 <label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ) ?></label> 93 92 <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small" /> <?php _e( 'New Password', 'buddypress' ) ?><br /> … … 114 113 115 114 if ( $_POST['notifications'] ) { 116 115 foreach ( (array)$_POST['notifications'] as $key => $value ) { 117 update_user meta( (int)$current_user->id, $key, $value );116 update_user_meta( (int)$current_user->id, $key, $value ); 118 117 } 119 118 } 120 119 -
bp-core/bp-core-catchuri.php
42 42 return false; 43 43 } 44 44 45 // Ajax or not? 45 46 if ( strpos( $_SERVER['REQUEST_URI'], 'wp-load.php' ) ) 46 47 $path = bp_core_referrer(); 47 48 else 48 $path = clean_url( $_SERVER['REQUEST_URI'] );49 $path = esc_url( $_SERVER['REQUEST_URI'] ); 49 50 50 51 $path = apply_filters( 'bp_uri', $path ); 51 52 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 54 55 $noget = substr( $path, 0, strpos( $path, '?' ) ); 55 if ( $noget != '' ) $path = $noget; 56 if ( $noget != '' ) 57 $path = $noget; 56 58 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 58 60 $bp_uri = explode( "/", $path ); 59 61 60 / * Loop and remove empties */62 // Loop and remove empties 61 63 foreach ( (array)$bp_uri as $key => $uri_chunk ) 62 64 if ( empty( $bp_uri[$key] ) ) unset( $bp_uri[$key] ); 63 65 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 } 70 84 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; 74 88 75 / * Get site path items */89 // Get site path items 76 90 $paths = explode( '/', bp_core_get_site_path() ); 77 91 78 / * Take empties off the end of path */92 // Take empties off the end of path 79 93 if ( empty( $paths[count($paths) - 1] ) ) 80 94 array_pop( $paths ); 81 95 82 / * Take empties off the start of path */96 // Take empties off the start of path 83 97 if ( empty( $paths[0] ) ) 84 98 array_shift( $paths ); 85 99 … … 89 103 } 90 104 } 91 105 92 / * Reset the keys by merging with an empty array */93 $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; 95 109 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) 97 111 foreach ( (array)$bp_pages as $page_key => $bp_page ) { 98 112 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. 100 114 $uri_chunks = explode( '/', $bp_page->slug ); 101 115 102 116 foreach ( (array)$uri_chunks as $key => $uri_chunk ) { … … 119 133 unset( $uri_chunks ); 120 134 } 121 135 122 / * This is not a BuddyPress page, so just return. */136 // This is not a BuddyPress page, so just return. 123 137 if ( in_array( 0, (array) $matches ) ) 124 138 return false; 125 139 126 / * Find the offset */140 // Find the offset 127 141 $uri_offset = 0; 128 142 $slug = explode( '/', $match->slug ); 129 143 … … 132 146 $uri_offset = count( $slug ); 133 147 } 134 148 135 / * Global the unfiltered offset to use in bp_core_load_template() */149 // Global the unfiltered offset to use in bp_core_load_template() 136 150 $bp_unfiltered_uri_offset = $uri_offset; 137 151 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 139 153 if ( 'members' == $match->key ) { 140 154 if ( !empty( $bp_uri[$uri_offset + 1] ) ) { 141 155 if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) ) … … 145 159 146 160 $uri_offset = $uri_offset + 2; 147 161 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. 149 163 for ( $i = 0; $i < $uri_offset; $i++ ) 150 164 unset( $bp_uri[$i] ); 151 165 … … 153 167 } 154 168 } 155 169 156 / * Reset the keys by merging with an empty array */170 // Reset the keys by merging with an empty array 157 171 $bp_uri = array_merge( array(), $bp_uri ); 158 172 159 / * Set the current component */173 // Set the current component 160 174 if ( empty( $current_component ) ) { 161 175 for ( $i = 0; $i <= $uri_offset; $i++ ) { 162 176 if ( !empty( $bp_uri[$i] ) ) { … … 169 183 } else 170 184 $i = 1; 171 185 172 / * Set the current action */186 // Set the current action 173 187 $current_action = $bp_uri[$i]; 174 188 175 / * Unset the current_component and action from action_variables */189 // Unset the current_component and action from action_variables 176 190 for ( $j = 0; $j <= $i; $j++ ) 177 191 unset( $bp_uri[$j] ); 178 192 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 180 194 $action_variables = $bp_uri; 181 195 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 183 197 if ( 'no' == VHOST && !$is_root_component ) 184 198 array_shift($bp_uri); 185 199 186 / * Reset the keys by merging with an empty array */200 // Reset the keys by merging with an empty array 187 201 $action_variables = array_merge( array(), $action_variables ); 188 202 189 203 //var_dump($current_component, $current_action, $bp_uri); -
bp-friends/bp-friends-notifications.php
5 5 6 6 $initiator_name = bp_core_get_user_displayname( $initiator_id ); 7 7 8 if ( 'no' == get_user meta( (int)$friend_id, 'notification_friends_friendship_request') )8 if ( 'no' == get_user_meta( (int)$friend_id, 'notification_friends_friendship_request', true ) ) 9 9 return false; 10 10 11 11 $ud = get_userdata( $friend_id ); … … 17 17 $initiator_link = bp_core_get_user_domain( $initiator_id ); 18 18 19 19 // 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 ); 22 23 23 24 $message = sprintf( __( 24 25 "%1$s wants to add you as a friend. … … 47 48 48 49 $friend_name = bp_core_get_user_displayname( $friend_id ); 49 50 50 if ( 'no' == get_user meta( (int)$initiator_id, 'notification_friends_friendship_accepted') )51 if ( 'no' == get_user_meta( (int)$initiator_id, 'notification_friends_friendship_accepted', true ) ) 51 52 return false; 52 53 53 54 $ud = get_userdata( $initiator_id ); … … 56 57 $settings_link = bp_core_get_user_domain( $initiator_id ) . BP_SETTINGS_SLUG . '/notifications'; 57 58 58 59 // 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 ); 61 63 62 64 $message = sprintf( __( 63 65 '%1$s accepted your friend request. -
bp-friends/bp-friends-templatetags.php
108 108 <input type="search" name="friend-search-box" id="friend-search-box" value="<?php echo $value ?>"<?php echo $disabled ?> /> 109 109 110 110 <?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 ) ?>" /> 112 112 113 113 </form> 114 114 <?php -
bp-friends/bp-friends-classes.php
60 60 61 61 if ( $this->id ) { 62 62 // 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 ) ); 64 64 } else { 65 65 // 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 ) ); 67 67 $this->id = $wpdb->insert_id; 68 68 } 69 69 … … 126 126 127 127 $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 ) ); 128 128 129 if ( !$count )130 return 0;129 if ( !$count && !get_usermeta( $user_id, 'total_friend_count' ) ) 130 return 0; 131 131 132 update_user meta( $user_id, 'total_friend_count', $count );132 update_user_meta( $user_id, 'total_friend_count', $count ); 133 133 return $count; 134 134 } 135 135 … … 201 201 function accept($friendship_id) { 202 202 global $wpdb, $bp; 203 203 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 ) ); 205 205 } 206 206 207 207 function reject($friendship_id) { … … 313 313 314 314 function delete_all_for_user( $user_id ) { 315 315 global $wpdb, $bp; 316 317 // Get friends of $user_id 318 $friend_ids = BP_Friends_Friendship::get_friend_user_ids( $user_id ); 316 319 317 320 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE friend_user_id = %d OR initiator_user_id = %d", $user_id, $user_id ) ); 318 321 319 322 // Delete friend request notifications for members who have a notification from this user. 320 323 $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 } 321 329 } 322 330 } 323 331 -
bp-activity/feeds/bp-activity-favorites-feed.php
14 14 xmlns:wfw="http://wellformedweb.org/CommentAPI/" 15 15 xmlns:dc="http://purl.org/dc/elements/1.1/" 16 16 xmlns:atom="http://www.w3.org/2005/Atom" 17 <?php do_action('bp_activity_ mentions_feed'); ?>17 <?php do_action('bp_activity_favorites_feed'); ?> 18 18 > 19 19 20 20 <channel> -
bp-activity/bp-activity-notifications.php
4 4 global $bp; 5 5 6 6 /* Scan for @username strings in an activity update. Notify each user. */ 7 $pattern = '/[@]+([A-Za-z0-9-_ ]+)/';7 $pattern = '/[@]+([A-Za-z0-9-_\.]+)/'; 8 8 preg_match_all( $pattern, $content, $usernames ); 9 9 10 10 /* Make sure there's only one instance of each username */ … … 16 16 continue; 17 17 18 18 // Now email the user with the contents of the message (if they have enabled email notifications) 19 if ( 'no' != get_user meta( $receiver_user_id, 'notification_activity_new_mention') ) {19 if ( 'no' != get_user_meta( $receiver_user_id, 'notification_activity_new_mention', true ) ) { 20 20 $poster_name = bp_core_get_user_displayname( $poster_user_id ); 21 21 22 22 $message_link = bp_activity_get_permalink( $activity_id ); … … 26 26 $content = bp_activity_filter_kses( stripslashes($content) ); 27 27 28 28 // 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 ); 32 33 33 34 $message = sprintf( __( 34 35 '%1$s mentioned you in an update: … … 60 61 61 62 $original_activity = new BP_Activity_Activity( $activity_id ); 62 63 63 if ( $original_activity->user_id != $commenter_id && 'no' != get_user meta( $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 ) ) { 64 65 $poster_name = bp_core_get_user_displayname( $commenter_id ); 65 66 $thread_link = bp_activity_get_permalink( $activity_id ); 66 67 $settings_link = bp_core_get_user_domain( $original_activity->user_id ) . BP_SETTINGS_SLUG . '/notifications/'; … … 69 70 $content = bp_activity_filter_kses( stripslashes($content) ); 70 71 71 72 // 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 ); 75 77 76 78 $message = sprintf( __( 77 79 '%1$s replied to one of your updates: … … 102 104 103 105 $parent_comment = new BP_Activity_Activity( $parent_id ); 104 106 105 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') ) {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 ) ) { 106 108 $poster_name = bp_core_get_user_displayname( $commenter_id ); 107 109 $thread_link = bp_activity_get_permalink( $activity_id ); 108 110 $settings_link = bp_core_get_user_domain( $parent_comment->user_id ) . BP_SETTINGS_SLUG . '/notifications/'; 109 111 110 112 // 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 ); 114 117 115 118 $poster_name = stripslashes( $poster_name ); 116 119 $content = bp_activity_filter_kses( stripslashes( $content ) ); … … 136 139 } 137 140 } 138 141 139 ?> 140 No newline at end of file 142 ?> -
bp-activity/bp-activity-templatetags.php
25 25 $this->disable_blogforum_replies = $bp->site_options['bp-disable-blogforum-comments']; 26 26 27 27 // Get an array of the logged in user's favorite activities 28 $this->my_favs = maybe_unserialize( get_user meta( $bp->loggedin_user->id, 'bp_favorite_activities') );28 $this->my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) ); 29 29 30 30 // Fetch specific activity items based on ID's 31 31 if ( !empty( $include ) ) … … 154 154 $object = $bp->groups->id; 155 155 $primary_id = $bp->groups->current_group->id; 156 156 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 ) ) 158 158 $show_hidden = true; 159 159 } 160 160 … … 402 402 return apply_filters( 'bp_get_activity_user_link', $link ); 403 403 } 404 404 405 /** 406 * bp_activity_avatar( $args ) 407 * 408 * Output the avatar of the user that performed the action 409 * 410 * @param array $args 411 */ 405 412 function bp_activity_avatar( $args = '' ) { 406 413 echo bp_get_activity_avatar( $args ); 407 414 } 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 */ 408 425 function bp_get_activity_avatar( $args = '' ) { 409 426 global $bp, $activities_template; 410 427 411 428 $defaults = array( 412 'type' => 'thumb',413 'width' => 20,429 'type' => 'thumb', 430 'width' => 20, 414 431 'height' => 20, 415 'class' => 'avatar',416 'alt' => __( 'Avatar', 'buddypress' ),417 'email' => false432 'class' => 'avatar', 433 'alt' => __( 'Avatar', 'buddypress' ), 434 'email' => false 418 435 ); 419 436 420 437 $r = wp_parse_args( $args, $defaults ); 421 438 extract( $r, EXTR_SKIP ); 422 439 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 ); 428 443 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 ) ) 439 446 $email = $activities_template->activity->user_email; 440 447 441 448 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 ) ) ); 442 449 } 443 450 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 */ 458 function 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 444 518 function bp_activity_action() { 445 519 echo bp_get_activity_action(); 446 520 } … … 449 523 450 524 $action = $activities_template->activity->action; 451 525 526 $action = apply_filters( 'bp_get_activity_action_pre_meta', $action, &$activities_template->activity ); 527 452 528 if ( !empty( $action ) ) 453 529 $action = bp_insert_activity_meta( $action ); 454 530 … … 506 582 $meta .= apply_filters( 'bp_activity_permalink', ' · <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 ); 507 583 508 584 /* 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_s ite_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 ) 510 586 $meta .= apply_filters( 'bp_activity_delete_link', ' · ' . bp_get_activity_delete_link(), &$activities_template->activity ); 511 587 512 588 $meta .= '</span>'; … … 585 661 586 662 $content .= '<li id="acomment-' . $comment->id . '">'; 587 663 $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> · ' . 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> · ' . sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( $comment->date_recorded ) ); 589 665 590 666 /* Reply link - the span is so that threaded reply links can be hidden when JS is off. */ 591 667 if ( is_user_logged_in() ) 592 668 $content .= '<span class="acomment-replylink"> · <a href="#acomment-' . $comment->id . '" class="acomment-reply" id="acomment-reply-' . $activities_template->activity->id . '">' . __( 'Reply', 'buddypress' ) . '</a></span>'; 593 669 594 670 /* Delete link */ 595 if ( $bp->loggedin_user->is_s ite_admin || $bp->loggedin_user->id == $comment->user_id )671 if ( $bp->loggedin_user->is_super_admin || $bp->loggedin_user->id == $comment->user_id ) 596 672 $content .= ' · <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>'; 597 673 598 674 $content .= '</div>'; … … 738 814 if ( !$user_id ) 739 815 $user_id = $bp->displayed_user->id; 740 816 741 if ( !$update = get_user meta( $user_id, 'bp_latest_update') )817 if ( !$update = get_user_meta( $user_id, 'bp_latest_update', true ) ) 742 818 return false; 743 819 744 $latest_update = '"' . trim( strip_tags( bp_create_excerpt( $update['content'], 40) ) ) . '"';820 $latest_update = '"' . apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 40 ) ) ) ) . '"'; 745 821 $latest_update .= ' · <a href="' . $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $update['id'] . '/"> ' . __( 'View', 'buddypress' ) . '</a>'; 746 822 747 823 return apply_filters( 'bp_get_activity_latest_update', $latest_update ); … … 776 852 else 777 853 unset($selected); 778 854 779 $component = attribute_escape( $component );855 $component = esc_attr( $component ); 780 856 781 857 switch ( $style ) { 782 858 case 'list': … … 804 880 /* Make sure all core internal component names are translatable */ 805 881 $translatable_components = array( __( 'profile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'blogs', 'buddypress' ) ); 806 882 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; 808 884 } 809 885 810 886 $link = remove_query_arg( 'afilter' , $link ); 811 887 812 888 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 . '>'; 814 890 815 891 return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) ); 816 892 } … … 840 916 echo bp_get_total_favorite_count_for_user( $user_id ); 841 917 } 842 918 function bp_get_total_mention_count_for_user( $user_id = false ) { 843 return apply_filters( 'bp_get_total_mention_count_for_user', get_user meta( $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 ) ); 844 920 } 845 921 846 922 function bp_send_public_message_link() { -
bp-activity/bp-activity-classes.php
531 531 function get_last_updated() { 532 532 global $bp, $wpdb; 533 533 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" ) ); 535 535 } 536 536 537 537 function total_favorite_count( $user_id ) { 538 538 global $bp; 539 539 540 if ( !$favorite_activity_entries = get_user meta( $user_id, 'bp_favorite_activities') )540 if ( !$favorite_activity_entries = get_user_meta( $user_id, 'bp_favorite_activities', true ) ) 541 541 return 0; 542 542 543 543 return count( maybe_unserialize( $favorite_activity_entries ) ); -
bp-loader.php
6 6 Author: The BuddyPress Community 7 7 Version: 1.3-bleeding 8 8 Author URI: http://buddypress.org/community/members/ 9 Network: true 9 10 */ 10 11 11 12 define( 'BP_VERSION', '1.3-bleeding' ); -
bp-blogs.php
163 163 'type' => false, 164 164 'item_id' => false, 165 165 'secondary_item_id' => false, 166 'recorded_time' => gmdate( "Y-m-d H:i:s"),166 'recorded_time' => bp_core_current_time(), 167 167 'hide_sitewide' => false 168 168 ); 169 169 … … 178 178 $action = apply_filters( 'bp_blogs_record_activity_action', $action ); 179 179 180 180 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 ); 182 182 183 183 /* Check for an existing entry and update if one exists. */ 184 184 $id = bp_activity_get_activity_id( array( … … 291 291 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'description', $description ); 292 292 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) ); 293 293 294 / * Only record this activity if the blog is public */294 // Only record this activity if the blog is public 295 295 if ( (int)$_POST['blog_public'] && !$no_activity ) { 296 / * Record this in activity streams */296 // Record this in activity streams 297 297 bp_blogs_record_activity( array( 298 298 '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 ), 300 300 'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', get_blog_option( $recorded_blog->blog_id, 'siteurl' ), $recorded_blog->blog_id ), 301 301 'type' => 'new_blog', 302 302 'item_id' => $recorded_blog->blog_id … … 307 307 } 308 308 add_action( 'wpmu_new_blog', 'bp_blogs_record_blog', 10, 2 ); 309 309 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 */ 319 function bp_blogs_update_option_blogname( $oldvalue, $newvalue ) { 320 global $wpdb; 321 bp_blogs_update_blogmeta( $wpdb->blogid, 'name', $newvalue ); 322 } 323 add_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 */ 334 function bp_blogs_update_option_blogdescription( $oldvalue, $newvalue ) { 335 global $wpdb; 336 bp_blogs_update_blogmeta( $wpdb->blogid, 'description', $newvalue ); 337 } 338 add_action( 'update_option_blogdescription', 'bp_blogs_update_option_blogdescription', 10, 2 ); 339 310 340 function bp_blogs_record_post( $post_id, $post, $user_id = false ) { 311 341 global $bp, $wpdb; 312 342 -
bp-messages.php
5 5 require ( BP_PLUGIN_DIR . '/bp-messages/bp-messages-filters.php' ); 6 6 7 7 function messages_setup_globals() { 8 global $bp , $wpdb;8 global $bp; 9 9 10 10 if ( !defined( 'BP_MESSAGES_SLUG' ) ) 11 11 define ( 'BP_MESSAGES_SLUG', 'messages' ); … … 13 13 /* For internal identification */ 14 14 $bp->messages->id = 'messages'; 15 15 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'; 19 19 $bp->messages->format_notification_function = 'messages_format_notifications'; 20 20 $bp->messages->slug = BP_MESSAGES_SLUG; 21 21 … … 44 44 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() ) ); 45 45 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() ) ); 46 46 47 if ( is_s ite_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_s ite_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() ) ); 49 49 50 50 if ( $bp->current_component == $bp->messages->slug ) { 51 51 if ( bp_is_my_profile() ) { … … 84 84 // Remove any saved message data from a previous session. 85 85 messages_remove_callback_values(); 86 86 87 / * Check if the message form has been submitted */87 // Check if the message form has been submitted 88 88 if ( isset( $_POST['send'] ) ) { 89 89 90 / * Check the nonce */90 // Check the nonce 91 91 check_admin_referer( 'messages_send_message' ); 92 92 93 / * Check we have what we need */93 // Check we have what we need 94 94 if ( empty( $_POST['subject'] ) || empty( $_POST['content'] ) ) { 95 95 bp_core_add_message( __( 'There was an error sending that message, please try again', 'buddypress' ), 'error' ); 96 96 } else { 97 / * If this is a notice, send it */97 // If this is a notice, send it 98 98 if ( isset( $_POST['send-notice'] ) ) { 99 99 if ( messages_send_notice( $_POST['subject'], $_POST['content'] ) ) { 100 100 bp_core_add_message( __( 'Notice sent successfully!', 'buddypress' ) ); … … 103 103 bp_core_add_message( __( 'There was an error sending that notice, please try again', 'buddypress' ), 'error' ); 104 104 } 105 105 } 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' ) 107 107 $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 ); 110 111 111 / * Send the message */112 // Send the message 112 113 if ( $thread_id = messages_new_message( array( 'recipients' => $recipients, 'subject' => $_POST['subject'], 'content' => $_POST['content'] ) ) ) { 113 114 bp_core_add_message( __( 'Message sent successfully!', 'buddypress' ) ); 114 115 bp_core_redirect( $bp->loggedin_user->domain . $bp->messages->slug . '/view/' . $thread_id . '/' ); … … 117 118 } 118 119 } 119 120 } 120 121 121 } 122 122 123 123 do_action( 'messages_screen_compose' ); … … 128 128 function messages_screen_notices() { 129 129 global $bp, $notice_id; 130 130 131 if ( !is_s ite_admin() )131 if ( !is_super_admin() ) 132 132 return false; 133 133 134 134 $notice_id = $bp->action_variables[1]; … … 165 165 166 166 function messages_screen_notification_settings() { 167 167 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> 187 177 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> 189 194 </table> 190 195 <?php 191 196 } … … 208 213 209 214 $thread_id = $bp->action_variables[0]; 210 215 211 if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access($thread_id) && !is_s ite_admin() ) )216 if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access($thread_id) && !is_super_admin() ) ) 212 217 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component ); 213 218 214 219 /* Check if a new reply has been submitted */ … … 327 332 'recipients' => false, // Can be an array of usernames, user_ids or mixed. 328 333 'subject' => false, 329 334 'content' => false, 330 'date_sent' => time()335 'date_sent' => bp_core_current_time() 331 336 ); 332 337 333 338 $r = wp_parse_args( $args, $defaults ); … … 344 349 $message->message = $content; 345 350 $message->date_sent = $date_sent; 346 351 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 348 353 if ( $thread_id ) { 349 354 $thread = new BP_Messages_Thread( $thread_id ); 350 355 $message->recipients = $thread->get_recipients(); 351 356 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 352 361 if ( empty( $message->subject ) ) 353 362 $message->subject = sprintf( __( 'Re: %s', 'buddypress' ), $thread->messages[0]->subject ); 354 363 364 // No thread ID, so make some adjustments 355 365 } else { 356 366 if ( empty( $recipients ) ) 357 367 return false; … … 405 415 406 416 407 417 function messages_send_notice( $subject, $message ) { 408 if ( !is_s ite_admin() || empty( $subject ) || empty( $message ) ) {418 if ( !is_super_admin() || empty( $subject ) || empty( $message ) ) { 409 419 return false; 410 420 } else { 411 421 // Has access to send notices, lets do it. 412 422 $notice = new BP_Messages_Notice; 413 423 $notice->subject = $subject; 414 424 $notice->message = $message; 415 $notice->date_sent = time();425 $notice->date_sent = bp_core_current_time(); 416 426 $notice->is_active = 1; 417 427 $notice->save(); // send it. 418 428 -
bp-forums.php
62 62 63 63 if ( $bp->groups->current_group = groups_get_group( array( 'group_id' => $_POST['topic_group_id'] ) ) ) { 64 64 /* Auto join this user if they are not yet a member of this group */ 65 if ( !is_s ite_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 ) ) 66 66 groups_join_group( $bp->groups->current_group->id, $bp->groups->current_group->id ); 67 67 68 68 if ( $forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ) ) { … … 72 72 bp_core_add_message( __( 'The topic was created successfully', 'buddypress') ); 73 73 74 74 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' ); 75 77 } 76 78 } 77 79 } … … 86 88 function bp_forums_add_admin_menu() { 87 89 global $bp; 88 90 89 if ( !is_s ite_admin() )91 if ( !is_super_admin() ) 90 92 return false; 91 93 92 94 require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-admin.php' ); … … 120 122 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 ) ); 121 123 } 122 124 125 function 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 123 144 /* Topic Functions */ 124 145 125 146 function bp_forums_get_forum_topics( $args = '' ) { … … 500 521 function bp_forums_filter_caps( $allcaps ) { 501 522 global $bp, $wp_roles, $bb_table_prefix; 502 523 503 $bb_cap = get_user meta( $bp->loggedin_user->id, $bb_table_prefix . 'capabilities');524 $bb_cap = get_user_meta( $bp->loggedin_user->id, $bb_table_prefix . 'capabilities', true ); 504 525 505 526 if ( empty( $bb_cap ) ) 506 527 return $allcaps; -
bp-groups.php
15 15 $bp->groups->name = $bp->pages->groups->name; 16 16 $bp->groups->slug = BP_GROUPS_SLUG; 17 17 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'; 21 21 $bp->groups->format_notification_function = 'groups_format_notifications'; 22 22 23 23 /* Register this in the active components array */ … … 36 36 37 37 $bp->groups->valid_status = apply_filters( 'groups_valid_status', array( 'public', 'private', 'hidden' ) ); 38 38 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 39 42 do_action( 'groups_setup_globals' ); 40 43 } 41 44 add_action( 'bp_setup_globals', 'groups_setup_globals' ); … … 50 53 $bp->groups->current_group = new BP_Groups_Group( $group_id ); 51 54 52 55 /* Using "item" not "group" for generic support in other components. */ 53 if ( is_s ite_admin() )56 if ( is_super_admin() ) 54 57 $bp->is_item_admin = 1; 55 58 else 56 59 $bp->is_item_admin = groups_is_user_admin( $bp->loggedin_user->id, $bp->groups->current_group->id ); … … 99 102 $bp->bp_options_title = $bp->groups->current_group->name; 100 103 101 104 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 ) . '" />'; 103 106 104 107 $group_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $bp->groups->current_group->slug . '/'; 105 108 106 109 // If this is a private or hidden group, does the user have access? 107 110 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_s ite_admin() )111 if ( $bp->groups->current_group->is_user_member && is_user_logged_in() || is_super_admin() ) 109 112 $bp->groups->current_group->user_has_access = true; 110 113 else 111 114 $bp->groups->current_group->user_has_access = false; … … 127 130 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' ) ); 128 131 129 132 // If this is a private group, and the user is not a member, show a "Request Membership" nav item. 130 if ( !is_s ite_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' ) 131 134 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 ) ); 132 135 133 136 if ( $bp->groups->current_group->enable_forum && function_exists('bp_forums_setup') ) … … 165 168 return false; 166 169 167 170 /* Don't show this menu to non site admins or if you're viewing your own profile */ 168 if ( !is_s ite_admin() )171 if ( !is_super_admin() ) 169 172 return false; 170 173 ?> 171 174 <li id="bp-adminbar-adminoptions-menu"> … … 225 228 $group = new BP_Groups_Group( $group_id ); 226 229 227 230 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 ), 229 232 'type' => 'joined_group', 230 233 'item_id' => $group->id 231 234 ) ); … … 291 294 check_admin_referer( 'bp_forums_new_reply' ); 292 295 293 296 /* 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 ) ) 295 298 groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id ); 296 299 297 300 if ( !$post_id = groups_new_group_forum_post( $_POST['reply_text'], $topic_id, $_GET['topic_page'] ) ) … … 469 472 check_admin_referer( 'bp_forums_new_topic' ); 470 473 471 474 /* 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 ) ) 473 476 groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id ); 474 477 475 478 if ( !$topic = groups_new_group_forum_topic( $_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id ) ) … … 710 713 $user_id = $bp->action_variables[3]; 711 714 $status = $bp->action_variables[2]; 712 715 713 / * Check the nonce first. */716 // Check the nonce first. 714 717 if ( !check_admin_referer( 'groups_promote_member' ) ) 715 718 return false; 716 719 717 720 // 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 ) ) 719 722 bp_core_add_message( __( 'There was an error when promoting that user, please try again', 'buddypress' ), 'error' ); 720 } else {723 else 721 724 bp_core_add_message( __( 'User promoted successfully', 'buddypress' ) ); 722 }723 725 724 726 do_action( 'groups_promoted_member', $user_id, $bp->groups->current_group->id ); 725 727 … … 729 731 if ( 'demote' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) { 730 732 $user_id = $bp->action_variables[2]; 731 733 732 / * Check the nonce first. */734 // Check the nonce first. 733 735 if ( !check_admin_referer( 'groups_demote_member' ) ) 734 736 return false; 735 737 736 738 // 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 ) ) 738 740 bp_core_add_message( __( 'There was an error when demoting that user, please try again', 'buddypress' ), 'error' ); 739 } else {741 else 740 742 bp_core_add_message( __( 'User demoted successfully', 'buddypress' ) ); 741 }742 743 743 744 do_action( 'groups_demoted_member', $user_id, $bp->groups->current_group->id ); 744 745 … … 748 749 if ( 'ban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) { 749 750 $user_id = $bp->action_variables[2]; 750 751 751 / * Check the nonce first. */752 // Check the nonce first. 752 753 if ( !check_admin_referer( 'groups_ban_member' ) ) 753 754 return false; 754 755 755 756 // 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 ) ) 757 758 bp_core_add_message( __( 'There was an error when banning that user, please try again', 'buddypress' ), 'error' ); 758 } else {759 else 759 760 bp_core_add_message( __( 'User banned successfully', 'buddypress' ) ); 760 }761 761 762 762 do_action( 'groups_banned_member', $user_id, $bp->groups->current_group->id ); 763 763 … … 767 767 if ( 'unban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) { 768 768 $user_id = $bp->action_variables[2]; 769 769 770 / * Check the nonce first. */770 // Check the nonce first. 771 771 if ( !check_admin_referer( 'groups_unban_member' ) ) 772 772 return false; 773 773 774 774 // 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 ) ) 776 776 bp_core_add_message( __( 'There was an error when unbanning that user, please try again', 'buddypress' ), 'error' ); 777 } else {777 else 778 778 bp_core_add_message( __( 'User ban removed successfully', 'buddypress' ) ); 779 }780 779 781 780 do_action( 'groups_unbanned_member', $user_id, $bp->groups->current_group->id ); 782 781 783 782 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/manage-members/' ); 784 783 } 785 784 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 786 803 do_action( 'groups_screen_group_admin_manage_members', $bp->groups->current_group->id ); 787 804 788 805 bp_core_load_template( apply_filters( 'groups_template_group_admin_manage_members', 'groups/single/home' ) ); … … 849 866 850 867 if ( $bp->current_component == $bp->groups->slug && 'delete-group' == $bp->action_variables[0] ) { 851 868 852 if ( !$bp->is_item_admin && !is_s ite_admin() )869 if ( !$bp->is_item_admin && !is_super_admin() ) 853 870 return false; 854 871 855 872 if ( isset( $_REQUEST['delete-group-button'] ) && isset( $_REQUEST['delete-group-understand'] ) ) { … … 880 897 881 898 function groups_screen_notification_settings() { 882 899 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> 914 909 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> 916 938 </table> 917 939 <?php 918 940 } … … 1040 1062 1041 1063 /* Once we compelete all steps, record the group creation in the activity stream. */ 1042 1064 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>' ) ), 1044 1066 'type' => 'created_group', 1045 1067 'item_id' => $bp->groups->new_group_id 1046 1068 ) ); … … 1217 1239 'type' => false, 1218 1240 'item_id' => false, 1219 1241 'secondary_item_id' => false, 1220 'recorded_time' => gmdate( "Y-m-d H:i:s"),1242 'recorded_time' => bp_core_current_time(), 1221 1243 'hide_sitewide' => $hide_sitewide 1222 1244 ); 1223 1245 … … 1480 1502 return true; 1481 1503 } 1482 1504 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 */ 1483 1512 function groups_delete_group( $group_id ) { 1484 1513 global $bp; 1485 1514 … … 1489 1518 1490 1519 // Get the group object 1491 1520 $group = new BP_Groups_Group( $group_id ); 1492 1493 1521 if ( !$group->delete() ) 1494 1522 return false; 1495 1523 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' ) ) 1498 1526 bp_activity_delete_by_item_id( array( 'item_id' => $group_id, 'component' => $bp->groups->id ) ); 1499 }1500 1527 1501 1528 // Remove all outstanding invites for this group 1502 1529 groups_delete_all_group_invites( $group_id ); … … 1504 1531 // Remove all notifications for any user belonging to this group 1505 1532 bp_core_delete_all_notifications_by_type( $group_id, $bp->groups->slug ); 1506 1533 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 } 1508 1539 1540 do_action( 'groups_delete_group', $group_id); 1541 1509 1542 return true; 1510 1543 } 1511 1544 … … 1566 1599 groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') - 1 ); 1567 1600 1568 1601 /* Modify user's group memberhip count */ 1569 update_user meta( $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 ); 1570 1603 1571 1604 /* If the user joined this group less than five minutes ago, remove the joined_group activity so 1572 1605 * users cannot flood the activity stream by joining/leaving the group in quick succession. … … 1616 1649 1617 1650 /* Record this in activity streams */ 1618 1651 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>' ) ), 1620 1653 'type' => 'joined_group', 1621 1654 'item_id' => $group_id 1622 1655 ) ); … … 1743 1776 return BP_Groups_Member::check_is_banned( $user_id, $group_id ); 1744 1777 } 1745 1778 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 */ 1787 function groups_is_user_creator( $user_id, $group_id ) { 1788 return BP_Groups_Member::check_is_creator( $user_id, $group_id ); 1789 } 1790 1746 1791 /*** Group Activity Posting **************************************************/ 1747 1792 1748 1793 function groups_post_update( $args = '' ) { … … 1763 1808 $bp->groups->current_group = new BP_Groups_Group( $group_id ); 1764 1809 1765 1810 /* Be sure the user is a member of the group before posting. */ 1766 if ( !is_s ite_admin() && !groups_is_user_member( $user_id, $group_id ) )1811 if ( !is_super_admin() && !groups_is_user_member( $user_id, $group_id ) ) 1767 1812 return false; 1768 1813 1769 1814 /* 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>' ); 1771 1816 $activity_content = $content; 1772 1817 1773 1818 $activity_id = groups_record_activity( array( … … 1808 1853 do_action( 'groups_new_group_forum', $forum, $group_id ); 1809 1854 } 1810 1855 1856 function 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 } 1872 add_action( 'groups_details_updated', 'groups_update_group_forum' ); 1873 1811 1874 function groups_new_group_forum_post( $post_text, $topic_id, $page = false ) { 1812 1875 global $bp; 1813 1876 … … 1820 1883 if ( $post_id = bp_forums_insert_post( array( 'post_text' => $post_text, 'topic_id' => $topic_id ) ) ) { 1821 1884 $topic = bp_forums_get_topic_details( $topic_id ); 1822 1885 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>' ); 1824 1887 $activity_content = bp_create_excerpt( $post_text ); 1825 1888 $primary_link = bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/'; 1826 1889 … … 1859 1922 if ( $topic_id = bp_forums_new_topic( array( 'topic_title' => $topic_title, 'topic_text' => $topic_text, 'topic_tags' => $topic_tags, 'forum_id' => $forum_id ) ) ) { 1860 1923 $topic = bp_forums_get_topic_details( $topic_id ); 1861 1924 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>' ); 1863 1926 $activity_content = bp_create_excerpt( $topic_text ); 1864 1927 1865 1928 /* Record this in activity streams */ … … 1891 1954 if ( function_exists( 'bp_activity_delete_by_item_id' ) ) 1892 1955 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' ) ); 1893 1956 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>' ); 1895 1958 $activity_content = bp_create_excerpt( $topic_text ); 1896 1959 1897 1960 /* Record this in activity streams */ … … 1925 1988 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 ) ) ) { 1926 1989 $topic = bp_forums_get_topic_details( $topic_id ); 1927 1990 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>' ); 1929 1992 $activity_content = bp_create_excerpt( $post_text ); 1930 1993 $primary_link = bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/'; 1931 1994 … … 2166 2229 2167 2230 do_action( 'groups_ban_member', $group_id, $user_id ); 2168 2231 2169 if ( !$member->ban() ) 2170 return false; 2171 2172 update_usermeta( $user_id, 'total_group_count', (int)$total_count - 1 ); 2232 return $member->ban(); 2173 2233 } 2174 2234 2175 2235 function groups_unban_member( $user_id, $group_id ) { … … 2185 2245 return $member->unban(); 2186 2246 } 2187 2247 2248 /*** Group Removal *******************************************************/ 2249 2250 function 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 2188 2264 /*** Group Membership ****************************************************/ 2189 2265 2190 2266 function groups_send_membership_request( $requesting_user_id, $group_id ) { … … 2246 2322 $group = new BP_Groups_Group( $group_id ); 2247 2323 2248 2324 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 ), 2250 2326 'type' => 'joined_group', 2251 2327 'item_id' => $group->id, 2252 2328 'user_id' => $user_id … … 2463 2539 add_action( 'groups_created_group', 'bp_core_clear_cache' ); 2464 2540 add_action( 'groups_group_avatar_updated', 'bp_core_clear_cache' ); 2465 2541 2466 ?> 2467 No newline at end of file 2542 ?> -
bp-blogs/bp-blogs-widgets.php
21 21 function widget($args, $instance) { 22 22 global $bp; 23 23 24 24 extract( $args ); 25 25 26 26 echo $before_widget; 27 echo $before_title 28 . $widget_name 29 . $after_title; ?> 27 echo $before_title . $widget_name . $after_title; 30 28 31 <?php32 29 if ( empty( $instance['max_posts'] ) || !$instance['max_posts'] ) 33 30 $instance['max_posts'] = 10; ?> 34 31 … … 80 77 $max_posts = strip_tags( $instance['max_posts'] ); 81 78 ?> 82 79 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> 84 81 <?php 85 82 } 86 83 } -
bp-blogs/bp-blogs-templatetags.php
269 269 270 270 function bp_blog_hidden_fields() { 271 271 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" />'; 273 273 } 274 274 275 275 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" />'; 277 277 } 278 278 279 279 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" />'; 281 281 } 282 282 } 283 283 … … 346 346 <form class="standard-form" id="setupform" method="post" action=""> 347 347 348 348 <input type="hidden" name="stage" value="gimmeanotherblog" /> 349 <?php do_action( "signup_hidden_fields"); ?>349 <?php do_action( 'signup_hidden_fields' ); ?> 350 350 351 351 <?php bp_blogs_signup_blog($blogname, $blog_title, $errors); ?> 352 352 <p> … … 363 363 global $current_site; 364 364 365 365 // Blog name 366 if( 'no' == constant( "VHOST") )366 if( !is_subdomain_install() ) 367 367 echo '<label for="blogname">' . __('Blog Name:', 'buddypress') . '</label>'; 368 368 else 369 369 echo '<label for="blogname">' . __('Blog Domain:', 'buddypress') . '</label>'; … … 372 372 <p class="error"><?php echo $errmsg ?></p> 373 373 <?php } 374 374 375 if ( 'no' == constant( "VHOST" ) ) {375 if ( !is_subdomain_install() ) 376 376 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 378 378 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 380 380 if ( !is_user_logged_in() ) { 381 381 print '(<strong>' . __( 'Your address will be ' , 'buddypress'); 382 if( 'no' == constant( "VHOST" ) ) { 382 383 if ( !is_subdomain_install() ) { 383 384 print $current_site->domain . $current_site->path . __( 'blogname' , 'buddypress'); 384 385 } else { 385 386 print __( 'domain.' , 'buddypress') . $current_site->domain . $current_site->path; 386 387 } 388 387 389 echo '.</strong> ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!)' , 'buddypress') . '</p>'; 388 390 } 389 391 -
bp-blogs/bp-blogs-classes.php
75 75 if ( !$bp->blogs ) 76 76 bp_blogs_setup_globals(); 77 77 78 if ( !is_user_logged_in() || ( !is_s ite_admin() && ( $user_id != $bp->loggedin_user->id ) ) )78 if ( !is_user_logged_in() || ( !is_super_admin() && ( $user_id != $bp->loggedin_user->id ) ) ) 79 79 $hidden_sql = "AND wb.public = 1"; 80 80 81 81 if ( $limit && $page ) … … 208 208 $user_id = $bp->displayed_user->id; 209 209 210 210 // 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_s ite_admin() )211 if ( ( is_user_logged_in() && $user_id == $bp->loggedin_user->id ) || is_super_admin() ) 212 212 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) ); 213 213 else 214 214 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) ); … … 222 222 223 223 $filter = like_escape( $wpdb->escape( $filter ) ); 224 224 225 if ( !is_s ite_admin() )225 if ( !is_super_admin() ) 226 226 $hidden_sql = "AND wb.public = 1"; 227 227 228 228 if ( $limit && $page ) … … 240 240 if ( !$bp->blogs ) 241 241 bp_blogs_setup_globals(); 242 242 243 if ( !is_s ite_admin() )243 if ( !is_super_admin() ) 244 244 $hidden_sql = "AND wb.public = 1"; 245 245 246 246 if ( $limit && $page ) … … 260 260 261 261 $letter = like_escape( $wpdb->escape( $letter ) ); 262 262 263 if ( !is_s ite_admin() )263 if ( !is_super_admin() ) 264 264 $hidden_sql = "AND wb.public = 1"; 265 265 266 266 if ( $limit && $page ) -
bp-languages/buddypress.pot
164 164 "---------------------\n" 165 165 msgstr "" 166 166 167 #: bp-activity/bp-activity-notifications.php:4 3168 #: bp-activity/bp-activity-notifications.php:8 6169 #: bp-activity/bp-activity-notifications.php:1 28170 #: bp-friends/bp-friends-notifications.php:3 3171 #: bp-friends/bp-friends-notifications.php:7 0172 #: bp-groups/bp-groups-notifications.php: 29173 #: bp-groups/bp-groups-notifications.php:7 7174 #: bp-groups/bp-groups-notifications.php:13 0175 #: bp-groups/bp-groups-notifications.php:17 6176 #: bp-groups/bp-groups-notifications.php:2 28177 #: bp-groups/bp-groups-notifications.php:28 5178 #: bp-messages/bp-messages-notifications.php:3 6167 #: 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 179 179 #, php-format 180 180 msgid "To disable these notifications please log in and go to: %s" 181 181 msgstr "" 182 182 183 #: bp-activity/bp-activity-notifications.php:7 4183 #: bp-activity/bp-activity-notifications.php:76 184 184 #, php-format 185 185 msgid "%s replied to one of your updates" 186 186 msgstr "" 187 187 188 #: bp-activity/bp-activity-notifications.php:7 7188 #: bp-activity/bp-activity-notifications.php:79 189 189 #, php-format 190 190 msgid "" 191 191 "%1$s replied to one of your updates:\n" … … 197 197 "---------------------\n" 198 198 msgstr "" 199 199 200 #: bp-activity/bp-activity-notifications.php:11 3200 #: bp-activity/bp-activity-notifications.php:116 201 201 #, php-format 202 202 msgid "%s replied to one of your comments" 203 203 msgstr "" 204 204 205 #: bp-activity/bp-activity-notifications.php:1 19205 #: bp-activity/bp-activity-notifications.php:122 206 206 #, php-format 207 207 msgid "" 208 208 "%1$s replied to one of your comments:\n" … … 1465 1465 msgid "Save Changes" 1466 1466 msgstr "" 1467 1467 1468 #: bp-core/bp-core-settings.php:13 11468 #: bp-core/bp-core-settings.php:130 1469 1469 msgid "Notification Settings" 1470 1470 msgstr "" 1471 1471 1472 #: bp-core/bp-core-settings.php:14 41472 #: bp-core/bp-core-settings.php:143 1473 1473 msgid "Email Notifications" 1474 1474 msgstr "" 1475 1475 1476 #: bp-core/bp-core-settings.php:14 51476 #: bp-core/bp-core-settings.php:144 1477 1477 msgid "Send a notification by email when:" 1478 1478 msgstr "" 1479 1479 1480 #: bp-core/bp-core-settings.php:18 61480 #: bp-core/bp-core-settings.php:185 1481 1481 msgid "" 1482 1482 "WARNING: Deleting your account will completely remove ALL content associated " 1483 1483 "with it. There is no way back, please be careful with this option." 1484 1484 msgstr "" 1485 1485 1486 #: bp-core/bp-core-settings.php:18 91486 #: bp-core/bp-core-settings.php:188 1487 1487 msgid "I understand the consequences of deleting my account." 1488 1488 msgstr "" 1489 1489 1490 #: bp-core/bp-core-settings.php:19 21490 #: bp-core/bp-core-settings.php:191 1491 1491 msgid "Delete My Account" 1492 1492 msgstr "" 1493 1493 … … 2004 2004 msgid "New friendship request from %s" 2005 2005 msgstr "" 2006 2006 2007 #: bp-friends/bp-friends-notifications.php:6 32007 #: bp-friends/bp-friends-notifications.php:65 2008 2008 #, php-format 2009 2009 msgid "" 2010 2010 "%1$s accepted your friend request.\n" … … 2510 2510 "---------------------\n" 2511 2511 msgstr "" 2512 2512 2513 #: bp-groups/bp-groups-notifications.php:6 22513 #: bp-groups/bp-groups-notifications.php:64 2514 2514 #, php-format 2515 2515 msgid "Membership request for group: %s" 2516 2516 msgstr "" 2517 2517 2518 #: bp-groups/bp-groups-notifications.php:6 52518 #: bp-groups/bp-groups-notifications.php:67 2519 2519 #, php-format 2520 2520 msgid "" 2521 2521 "%1$s wants to join the group \"%2$s\".\n" … … 2531 2531 "---------------------\n" 2532 2532 msgstr "" 2533 2533 2534 #: bp-groups/bp-groups-notifications.php:11 02534 #: bp-groups/bp-groups-notifications.php:113 2535 2535 #, php-format 2536 2536 msgid "Membership request for group \"%s\" accepted" 2537 2537 msgstr "" 2538 2538 2539 #: bp-groups/bp-groups-notifications.php:11 22539 #: bp-groups/bp-groups-notifications.php:115 2540 2540 #, php-format 2541 2541 msgid "" 2542 2542 "Your membership request for the group \"%1$s\" has been accepted.\n" … … 2546 2546 "---------------------\n" 2547 2547 msgstr "" 2548 2548 2549 #: bp-groups/bp-groups-notifications.php:12 02549 #: bp-groups/bp-groups-notifications.php:123 2550 2550 #, php-format 2551 2551 msgid "Membership request for group \"%s\" rejected" 2552 2552 msgstr "" 2553 2553 2554 #: bp-groups/bp-groups-notifications.php:12 22554 #: bp-groups/bp-groups-notifications.php:125 2555 2555 #, php-format 2556 2556 msgid "" 2557 2557 "Your membership request for the group \"%1$s\" has been rejected.\n" … … 2561 2561 "---------------------\n" 2562 2562 msgstr "" 2563 2563 2564 #: bp-groups/bp-groups-notifications.php:14 42564 #: bp-groups/bp-groups-notifications.php:147 2565 2565 msgid "an administrator" 2566 2566 msgstr "" 2567 2567 2568 #: bp-groups/bp-groups-notifications.php:1 472568 #: bp-groups/bp-groups-notifications.php:150 2569 2569 msgid "a moderator" 2570 2570 msgstr "" 2571 2571 2572 #: bp-groups/bp-groups-notifications.php:16 62572 #: bp-groups/bp-groups-notifications.php:169 2573 2573 #, php-format 2574 2574 msgid "You have been promoted in the group: \"%s\"" 2575 2575 msgstr "" 2576 2576 2577 #: bp-groups/bp-groups-notifications.php:1 692577 #: bp-groups/bp-groups-notifications.php:172 2578 2578 #, php-format 2579 2579 msgid "" 2580 2580 "You have been promoted to %1$s for the group: \"%2$s\".\n" … … 2584 2584 "---------------------\n" 2585 2585 msgstr "" 2586 2586 2587 #: bp-groups/bp-groups-notifications.php:21 42587 #: bp-groups/bp-groups-notifications.php:217 2588 2588 #, php-format 2589 2589 msgid "You have an invitation to the group: \"%s\"" 2590 2590 msgstr "" 2591 2591 2592 #: bp-groups/bp-groups-notifications.php:2 172592 #: bp-groups/bp-groups-notifications.php:220 2593 2593 #, php-format 2594 2594 msgid "" 2595 2595 "One of your friends %1$s has invited you to the group: \"%2$s\".\n" … … 2957 2957 msgid " Recipients" 2958 2958 msgstr "" 2959 2959 2960 #: bp-messages/bp-messages-notifications.php:2 22960 #: bp-messages/bp-messages-notifications.php:23 2961 2961 #, php-format 2962 2962 msgid "New message from %s" 2963 2963 msgstr "" 2964 2964 2965 #: bp-messages/bp-messages-notifications.php:2 52965 #: bp-messages/bp-messages-notifications.php:26 2966 2966 #, php-format 2967 2967 msgid "" 2968 2968 "%1$s sent you a new message:\n" … … 3218 3218 3219 3219 #: bp-themes/bp-default/activity/index.php:60 3220 3220 #: bp-themes/bp-default/groups/single/activity.php:3 3221 msgid "RSS Feed" 3222 msgstr "" 3223 3224 #: bp-themes/bp-default/activity/index.php:60 3225 #: bp-themes/bp-default/groups/single/activity.php:3 3221 3226 msgid "RSS" 3222 3227 msgstr "" 3223 3228 … … 3668 3673 msgid "Create a Group" 3669 3674 msgstr "" 3670 3675 3676 #: bp-themes/bp-default/functions.php:79 3677 msgid "said:" 3678 msgstr "" 3679 3680 #: bp-themes/bp-default/functions.php:80 3681 msgid "On" 3682 msgstr "" 3683 3684 #: bp-themes/bp-default/functions.php:84 3685 msgid "Your comment is awaiting moderation." 3686 msgstr "" 3687 3688 #: bp-themes/bp-default/functions.php:328 3689 #, php-format 3690 msgid "" 3691 "Theme activated! This theme contains <a href=\"%s\">custom header image</a> " 3692 "support and <a href=\"%s\">sidebar widgets</a>." 3693 msgstr "" 3694 3671 3695 #: bp-themes/bp-default/groups/create.php:7 3672 3696 #: bp-themes/bp-default/groups/index.php:7 3673 3697 msgid "Groups Directory" -
bp-messages/bp-messages-filters.php
44 44 add_filter( 'bp_get_message_thread_excerpt', 'make_clickable' ); 45 45 add_filter( 'bp_get_the_thread_message_content', 'make_clickable' ); 46 46 47 add_filter( 'bp_get_message_notice_subject', 'wpautop' );48 47 add_filter( 'bp_get_message_notice_text', 'wpautop' ); 49 add_filter( 'bp_get_message_thread_subject', 'wpautop' );50 48 add_filter( 'bp_get_the_thread_message_content', 'wpautop' ); 51 49 52 50 add_filter( 'bp_get_message_notice_subject', 'stripslashes_deep' ); -
bp-messages/bp-messages-notifications.php
7 7 $sender_name = bp_core_get_user_displayname( $sender_id ); 8 8 9 9 foreach( $recipients as $recipient ) { 10 if ( $sender_id == $recipient->user_id || 'no' == get_user meta( $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; 11 11 12 12 $ud = get_userdata( $recipient->user_id ); 13 13 $message_link = bp_core_get_user_domain( $recipient->user_id ) . BP_MESSAGES_SLUG .'/'; … … 18 18 $content = stripslashes( wp_filter_kses( $content ) ); 19 19 20 20 // 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 ); 23 24 24 25 $email_content = sprintf( __( 25 26 '%1$s sent you a new message: -
bp-messages/bp-messages-templatetags.php
161 161 $r = wp_parse_args( $args, $defaults ); 162 162 extract( $r, EXTR_SKIP ); 163 163 164 if ( 'notices' == $bp->current_action && !is_s ite_admin() ) {164 if ( 'notices' == $bp->current_action && !is_super_admin() ) { 165 165 wp_redirect( $bp->displayed_user->id ); 166 166 } else { 167 167 if ( 'inbox' == $bp->current_action ) … … 249 249 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' ) ); 250 250 } 251 251 252 function 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 252 267 function bp_message_thread_has_unread() { 253 268 global $messages_template; 254 269 … … 276 291 function bp_get_message_thread_last_post_date() { 277 292 global $messages_template; 278 293 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' ) ) ); 280 295 } 281 296 282 297 function bp_message_thread_avatar() { … … 326 341 function bp_get_messages_form_action() { 327 342 global $bp; 328 343 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] . '/' ) ); 330 345 } 331 346 332 347 function bp_messages_username_value() { … … 459 474 if ( empty( $notice ) ) 460 475 return false; 461 476 462 $closed_notices = get_user meta( $userdata->ID, 'closed_notices');477 $closed_notices = get_user_meta( $userdata->ID, 'closed_notices', true ); 463 478 464 479 if ( !$closed_notices ) 465 480 $closed_notices = array(); -
bp-messages/bp-messages-classes.php
243 243 function bp_messages_message( $id = null ) { 244 244 global $bp; 245 245 246 $this->date_sent = time();246 $this->date_sent = bp_core_current_time(); 247 247 $this->sender_id = $bp->loggedin_user->id; 248 248 249 249 if ( $id ) { … … 288 288 } 289 289 290 290 // 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 ) ) ) 292 292 return false; 293 293 294 294 if ( $new_thread ) { … … 387 387 do_action( 'messages_notice_before_save', $this ); 388 388 389 389 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 ); 391 391 } else { 392 392 $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 ); 393 393 } … … 401 401 // Now deactivate all notices apart from the new one. 402 402 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET is_active = 0 WHERE id != %d", $id ) ); 403 403 404 update_user meta( $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' ) ); 405 405 406 406 do_action( 'messages_notice_after_save', $this ); 407 407 -
bp-messages/css/autocomplete/jquery.autocompletefb.css
35 35 } 36 36 37 37 .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; 39 39 } 40 40 41 41 .ac_odd { -
bp-forums/bp-forums-admin.php
121 121 } 122 122 123 123 function bp_forums_bbpress_install() { 124 global $wpdb, $bbdb ;124 global $wpdb, $bbdb, $bp; 125 125 126 126 check_admin_referer( 'bp_forums_new_install_init' ); 127 127 … … 140 140 "define( 'BB_SECURE_A" => array( "'put your unique phrase here'", "'" . addslashes( SECURE_AUTH_KEY ) . "'" ), 141 141 "define( 'BB_LOGGED_I" => array( "'put your unique phrase here'", "'" . addslashes( LOGGED_IN_KEY ) . "'" ), 142 142 "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_'" ), 144 144 "define( 'BB_LANG', '" => array( "''", "'" . WPLANG . "'" ) 145 145 ) 146 146 ); … … 153 153 } 154 154 155 155 $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' ) . '\';'; 160 160 161 161 if ( bp_core_is_multisite() ) 162 162 $file .= "\n" . '$bb->wordpress_mu_primary_blog_id = ' . BP_ROOT_BLOG . ';'; 163 163 164 164 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 ) . '\');'; 166 166 167 167 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 ) . '\');'; 169 169 170 170 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 ) . '\');'; 172 172 173 173 $file .= "\n\n" . 'define(\'WP_AUTH_COOKIE_VERSION\', 2);'; 174 174 $file .= "\n\n" . '?>'; -
bp-forums/bp-forums-filters.php
2 2 3 3 /* Apply WordPress defined filters */ 4 4 add_filter( 'bp_forums_bbconfig_location', 'wp_filter_kses', 1 ); 5 add_filter( 'bp_forums_bbconfig_location', ' attribute_escape', 1 );5 add_filter( 'bp_forums_bbconfig_location', 'esc_attr', 1 ); 6 6 7 7 add_filter( 'bp_get_the_topic_title', 'wp_filter_kses', 1 ); 8 8 add_filter( 'bp_get_the_topic_latest_post_excerpt', 'bp_forums_filter_kses', 1 ); … … 30 30 add_filter( 'bp_get_the_topic_latest_post_excerpt', 'stripslashes_deep' ); 31 31 add_filter( 'bp_get_the_topic_poster_name', 'stripslashes_deep' ); 32 32 add_filter( 'bp_get_the_topic_last_poster_name', 'stripslashes_deep' ); 33 add_filter( 'bp_get_the_topic_object_name', 'stripslashes_deep' ); 33 34 34 35 add_filter( 'bp_get_the_topic_post_content', 'make_clickable' ); 35 36 … … 83 84 return "<a $text rel=\"nofollow\">"; 84 85 } 85 86 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 */ 96 function 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 .= ' | ' . bp_get_the_topic_title(); 102 } 103 } 104 105 return $title; 106 } 107 add_filter( 'bp_page_title', 'bp_forums_add_forum_topic_to_page_title' ); 108 109 ?> -
bp-forums/bp-forums-templatetags.php
258 258 global $forum_template; 259 259 260 260 $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 ) ); 262 262 } 263 263 264 264 function bp_the_topic_poster_id() { … … 556 556 557 557 $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'edit', 'bp_forums_edit_topic' ) . '">' . __( 'Edit Topic', 'buddypress' ) . '</a>'; 558 558 559 if ( $bp->is_item_admin || $bp->is_item_mod || is_s ite_admin() ) {559 if ( $bp->is_item_admin || $bp->is_item_mod || is_super_admin() ) { 560 560 if ( 0 == (int)$forum_template->topic->topic_sticky ) 561 561 $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'stick', 'bp_forums_stick_topic' ) . '">' . __( 'Sticky Topic', 'buddypress' ) . '</a>'; 562 562 else … … 711 711 var $sort_by; 712 712 var $order; 713 713 714 function BP_Forums_Template_Topic( $topic_id, $per_page, $max ) {714 function BP_Forums_Template_Topic( $topic_id, $per_page, $max, $order ) { 715 715 global $bp, $current_user, $forum_template; 716 716 717 717 $this->pag_page = isset( $_REQUEST['topic_page'] ) ? intval( $_REQUEST['topic_page'] ) : 1; … … 813 813 $defaults = array( 814 814 'topic_id' => false, 815 815 'per_page' => 15, 816 'max' => false 816 'max' => false, 817 'order' => 'ASC' 817 818 ); 818 819 819 820 $r = wp_parse_args( $args, $defaults ); … … 823 824 $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[1] ); 824 825 825 826 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 ); 827 828 else 828 829 return false; 829 830 … … 935 936 if ( $_SERVER['QUERY_STRING'] ) 936 937 $query_vars = '?' . $_SERVER['QUERY_STRING']; 937 938 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 . ' '; 939 940 $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> | '; 940 941 941 942 return $links; … … 948 949 global $bp; 949 950 950 951 $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 ) ); 952 953 } 953 954 954 955 function bp_the_topic_pagination() { … … 990 991 991 992 ?> 992 993 <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> 994 995 <input type="submit" id="forums_search_submit" name="forums_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" /> 995 996 </form> 996 997 <?php … … 1038 1039 function bp_get_forum_action() { 1039 1040 global $topic_template; 1040 1041 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'] ) ); 1042 1043 } 1043 1044 1044 1045 function bp_forum_topic_action() { … … 1047 1048 function bp_get_forum_topic_action() { 1048 1049 global $bp; 1049 1050 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'] ) ); 1051 1052 } 1052 1053 1053 1054 function bp_forum_topic_count_for_user( $user_id = false ) { -
bp-forums/bp-forums-bbpress.php
65 65 66 66 /* This must be loaded before functionss.bb-admin.php otherwise we get a function conflict. */ 67 67 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' ); 69 69 70 70 require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' ); 71 71 … … 103 103 /* Set the site admins as the keymasters */ 104 104 $site_admins = get_site_option( 'site_admins', array('admin') ); 105 105 foreach ( (array)$site_admins as $site_admin ) 106 update_user meta( 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 ) ); 107 107 108 108 // Create the first forum. 109 109 bb_new_forum( array( 'forum_name' => 'Default Forum' ) ); … … 130 130 $args = wp_parse_args( $args, $defaults ); 131 131 extract( $args, EXTR_SKIP ); 132 132 133 return update_user meta( $id, $meta_key, $meta_value );133 return update_user_meta( $id, $meta_key, $meta_value ); 134 134 } 135 135 } 136 136 -
bp-core.php
70 70 global $action_variables; 71 71 72 72 $current_user = wp_get_current_user(); 73 74 // Get the base database prefix 75 $bp->table_prefix = bp_core_get_table_prefix(); 73 76 74 77 /* The domain for the root of the site where the main blog resides */ 75 78 $bp->root_domain = bp_core_get_root_domain(); … … 94 97 /* The core userdata of the user who is currently logged in. */ 95 98 $bp->loggedin_user->userdata = bp_core_get_core_userdata( $bp->loggedin_user->id ); 96 99 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 99 103 100 104 /* The user id of the user currently being viewed, set in /bp-core/bp-core-catchuri.php */ 101 105 $bp->displayed_user->id = $displayed_user_id; … … 141 145 $bp->bp_options_nav = array(); 142 146 143 147 /* 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'] ); 145 149 $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' ); 147 151 148 152 /* 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 ); 150 154 $bp->displayed_user->fullname = bp_core_get_user_displayname( $bp->displayed_user->id ); 151 155 152 156 /* Used to determine if user has admin rights on current content. If the logged in user is viewing … … 158 162 /* Used to determine if the logged in user is a moderator for the current content. */ 159 163 $bp->is_item_mod = false; 160 164 161 $bp->core->table_name_notifications = $ wpdb->base_prefix . 'bp_notifications';165 $bp->core->table_name_notifications = $bp->table_prefix . 'bp_notifications'; 162 166 163 167 if ( !$bp->current_component && $bp->displayed_user->id ) 164 168 $bp->current_component = $bp->default_component; … … 168 172 add_action( 'bp_setup_globals', 'bp_core_setup_globals' ); 169 173 170 174 /** 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 */ 182 function bp_core_get_table_prefix() { 183 global $wpdb; 184 185 return apply_filters( 'bp_core_get_table_prefix', $wpdb->base_prefix ); 186 } 187 188 /** 171 189 * bp_core_define_slugs() 172 190 * 173 191 * Define the slugs used for BuddyPress pages, based on the slugs of the WP pages used. … … 237 255 * Initializes the wp-admin area "BuddyPress" menus and sub menus. 238 256 * 239 257 * @package BuddyPress Core 240 * @uses is_s ite_admin() returns true if the current user is a site admin, false if not258 * @uses is_super_admin() returns true if the current user is a site admin, false if not 241 259 */ 242 260 function bp_core_admin_menu_init() { 243 if ( !is_s ite_admin() )261 if ( !is_super_admin() ) 244 262 return false; 245 263 246 264 require ( BP_PLUGIN_DIR . '/bp-core/admin/bp-core-admin.php' ); … … 254 272 * 255 273 * @package BuddyPress Core 256 274 * @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 259 276 * @uses add_submenu_page() WP function to add a submenu item 260 277 */ 261 278 function bp_core_add_admin_menu() { 262 if ( !is_s ite_admin() )279 if ( !is_super_admin() ) 263 280 return false; 264 281 265 282 /* Add the administration tab under the "Site Admin" tab for site administrators */ … … 381 398 function bp_core_action_set_spammer_status() { 382 399 global $bp, $wpdb; 383 400 384 if ( !is_s ite_admin() || bp_is_my_profile() || !$bp->displayed_user->id )401 if ( !is_super_admin() || bp_is_my_profile() || !$bp->displayed_user->id ) 385 402 return false; 386 403 387 404 if ( 'admin' == $bp->current_component && ( 'mark-spammer' == $bp->current_action || 'unmark-spammer' == $bp->current_action ) ) { … … 445 462 function bp_core_action_delete_user() { 446 463 global $bp; 447 464 448 if ( !is_s ite_admin() || bp_is_my_profile() || !$bp->displayed_user->id )465 if ( !is_super_admin() || bp_is_my_profile() || !$bp->displayed_user->id ) 449 466 return false; 450 467 451 468 if ( 'admin' == $bp->current_component && 'delete-user' == $bp->current_action ) { … … 515 532 * @package BuddyPress Core 516 533 * @global $current_user WordPress global variable containing current logged in user information 517 534 * @param user_id The ID of the user. 518 * @uses get_user meta() WordPress function to get the usermeta for a user.535 * @uses get_user_meta() WordPress function to get the usermeta for a user. 519 536 */ 520 537 function bp_core_get_user_domain( $user_id, $user_nicename = false, $user_login = false ) { 521 538 global $bp; … … 625 642 return false; 626 643 627 644 /* 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_s ite_admin() )645 if ( $site_admin_only && !is_super_admin() ) 629 646 return false; 630 647 631 648 if ( empty( $item_css_id ) ) … … 772 789 return false; 773 790 774 791 /* 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_s ite_admin() )792 if ( $site_admin_only && !is_super_admin() ) 776 793 return false; 777 794 778 795 if ( empty( $item_css_id ) ) … … 902 919 * 903 920 * @package BuddyPress Core 904 921 * @param $username str Username to check. 905 * @global $wpdb WordPress DB access object.906 922 * @return false on no match 907 923 * @return int the user ID of the matched user. 908 924 */ 909 925 function bp_core_get_random_member() { 910 global $bp , $wpdb;926 glob