BuddyPress - Version 1.0.1

Version Description

Download this release

Release Info

Developer apeatling
Plugin Icon 128x128 BuddyPress
Version 1.0.1
Comparing to
See all releases

Code changes from version 1.0 to 1.0.1

Files changed (59) hide show
  1. bp-activity.php +0 -1
  2. bp-activity/bp-activity-filters.php +10 -1
  3. bp-activity/bp-activity-templatetags.php +5 -3
  4. bp-activity/bp-activity-widgets.php +3 -5
  5. bp-blogs.php +17 -18
  6. bp-blogs/bp-blogs-widgets.php +6 -4
  7. bp-core.php +300 -107
  8. bp-core/bp-core-admin.php +3 -3
  9. bp-core/bp-core-adminbar.php +2 -2
  10. bp-core/bp-core-ajax-handler.php +0 -11
  11. bp-core/bp-core-ajax.php +5 -0
  12. bp-core/bp-core-avatars.php +2 -2
  13. bp-core/bp-core-catchuri.php +19 -10
  14. bp-core/bp-core-classes.php +1 -1
  15. bp-core/bp-core-cssjs.php +3 -1
  16. bp-core/bp-core-settings.php +4 -2
  17. bp-core/bp-core-templatetags.php +24 -34
  18. bp-core/bp-core-widgets.php +19 -16
  19. bp-forums.php +1 -3
  20. bp-friends.php +87 -7
  21. bp-friends/bp-friends-notifications.php +2 -2
  22. bp-friends/bp-friends-templatetags.php +1 -1
  23. bp-groups.php +26 -21
  24. bp-groups/bp-groups-admin.php +3 -3
  25. bp-groups/bp-groups-ajax.php +11 -11
  26. bp-groups/bp-groups-filters.php +1 -0
  27. bp-groups/bp-groups-notifications.php +2 -2
  28. bp-groups/bp-groups-templatetags.php +16 -16
  29. bp-groups/bp-groups-widgets.php +10 -8
  30. bp-languages/buddypress.pot +190 -195
  31. bp-loader.php +12 -12
  32. bp-messages.php +16 -17
  33. bp-messages/autocomplete/bp-messages-autocomplete.php +0 -22
  34. bp-messages/bp-messages-ajax.php +17 -0
  35. bp-messages/bp-messages-classes.php +3 -3
  36. bp-messages/bp-messages-cssjs.php +17 -4
  37. bp-messages/bp-messages-notifications.php +4 -4
  38. bp-messages/bp-messages-templatetags.php +8 -8
  39. bp-messages/js/autocomplete/init.php +0 -16
  40. bp-messages/js/autocomplete/jquery.autocomplete.js +3 -1
  41. bp-themes/bphome/comments-popup.php +1 -1
  42. bp-themes/bphome/comments.php +1 -1
  43. bp-themes/bphome/css/base.css +5 -3
  44. bp-themes/bphome/style.css +1 -1
  45. bp-themes/bpmember/css/base.css +3 -2
  46. bp-themes/bpmember/messages/compose.php +1 -1
  47. bp-themes/bpmember/style.css +1 -1
  48. bp-themes/bpskeletonmember/directories/blogs/index.php +1 -1
  49. bp-themes/bpskeletonmember/directories/groups/index.php +1 -1
  50. bp-themes/bpskeletonmember/directories/members/index.php +1 -1
  51. bp-themes/bpskeletonmember/header.php +1 -1
  52. bp-themes/bpskeletonmember/messages/compose.php +2 -2
  53. bp-wire.php +0 -2
  54. bp-wire/bp-wire-templatetags.php +1 -1
  55. bp-xprofile.php +4 -5
  56. bp-xprofile/bp-xprofile-classes.php +3 -3
  57. bp-xprofile/bp-xprofile-notifications.php +1 -1
  58. bp-xprofile/bp-xprofile-signup.php +68 -47
  59. readme.txt +10 -2
bp-activity.php CHANGED
@@ -1,6 +1,5 @@
1
<?php
2
3
- define ( 'BP_ACTIVITY_VERSION', '1.0' );
4
define ( 'BP_ACTIVITY_DB_VERSION', '1300' );
5
6
/* Define the slug for the component */
1
<?php
2
3
define ( 'BP_ACTIVITY_DB_VERSION', '1300' );
4
5
/* Define the slug for the component */
bp-activity/bp-activity-filters.php CHANGED
@@ -1,6 +1,8 @@
1
<?php
2
3
/* Apply WordPress defined filters */
4
add_filter( 'bp_get_activity_content', 'wptexturize' );
5
6
add_filter( 'bp_get_activity_content', 'convert_smilies' );
@@ -9,8 +11,15 @@ add_filter( 'bp_get_activity_content', 'convert_chars' );
9
10
add_filter( 'bp_get_activity_content', 'wpautop' );
11
12
add_filter( 'bp_get_activity_content', 'stripslashes_deep' );
13
14
- add_filter( 'bp_get_activity_content', 'make_clickable' );
15
16
?>
1
<?php
2
3
/* Apply WordPress defined filters */
4
+ add_filter( 'bp_get_activity_content', 'wp_filter_kses', 1 );
5
+
6
add_filter( 'bp_get_activity_content', 'wptexturize' );
7
8
add_filter( 'bp_get_activity_content', 'convert_smilies' );
11
12
add_filter( 'bp_get_activity_content', 'wpautop' );
13
14
+ add_filter( 'bp_get_activity_content', 'make_clickable' );
15
+
16
add_filter( 'bp_get_activity_content', 'stripslashes_deep' );
17
18
+ function bp_activity_add_allowed_tags( $allowedtags ) {
19
+ $allowedtags['span'] = array();
20
+ $allowedtags['span']['class'] = array();
21
+ return $allowedtags;
22
+ }
23
+ add_filter( 'edit_allowedtags', 'bp_activity_add_allowed_tags', 1 );
24
25
?>
bp-activity/bp-activity-templatetags.php CHANGED
@@ -219,14 +219,16 @@ function bp_activity_content() {
219
echo bp_get_activity_content();
220
}
221
function bp_get_activity_content() {
222
- global $activities_template;
223
224
if ( bp_is_home() && $activities_template->activity_type == 'personal' ) {
225
- return apply_filters( 'bp_get_activity_content', bp_activity_content_filter( $activities_template->activity->content, $activities_template->activity->date_recorded, $activities_template->full_name ) );
226
} else {
227
$activities_template->activity->content = bp_activity_insert_time_since( $activities_template->activity->content, $activities_template->activity->date_recorded );
228
- return apply_filters( 'bp_get_activity_content', $activities_template->activity->content );
229
}
230
}
231
232
function bp_activity_content_filter( $content, $date_recorded, $full_name, $insert_time = true, $filter_words = true, $filter_you = true ) {
219
echo bp_get_activity_content();
220
}
221
function bp_get_activity_content() {
222
+ global $activities_template, $allowed_tags;
223
224
if ( bp_is_home() && $activities_template->activity_type == 'personal' ) {
225
+ $content = bp_activity_content_filter( $activities_template->activity->content, $activities_template->activity->date_recorded, $activities_template->full_name );
226
} else {
227
$activities_template->activity->content = bp_activity_insert_time_since( $activities_template->activity->content, $activities_template->activity->date_recorded );
228
+ $content = $activities_template->activity->content;
229
}
230
+
231
+ return apply_filters( 'bp_get_activity_content', $content );
232
}
233
234
function bp_activity_content_filter( $content, $date_recorded, $full_name, $insert_time = true, $filter_words = true, $filter_you = true ) {
bp-activity/bp-activity-widgets.php CHANGED
@@ -27,9 +27,8 @@ function bp_activity_widget_sitewide_activity($args) {
27
. $after_title; ?>
28
29
<?php
30
- if ( empty( $options['max_items'] ) ) {
31
$options['max_items'] = 20;
32
- }
33
?>
34
35
<?php
@@ -46,7 +45,7 @@ function bp_activity_widget_sitewide_activity($args) {
46
<ul id="site-wide-stream" class="activity-list">
47
<?php foreach( $activity['activities'] as $item ) : ?>
48
<li class="<?php echo $item['component_name'] ?>">
49
- <?php echo apply_filters( 'bp_activity_content', bp_activity_content_filter( $item['content'], $item['date_recorded'], '', true, false, true ) ); ?>
50
</li>
51
<?php endforeach; ?>
52
</ul>
@@ -74,9 +73,8 @@ function bp_activity_widget_sitewide_activity_control() {
74
update_blog_option( $current_blog->blog_id, 'bp_activity_widget_sitewide_activity', $options );
75
}
76
77
- $max_items = attribute_escape( $options['max_items'] );
78
?>
79
- <p><label for="bp-activity-widget-sitewide-items-max"><?php _e('Max Number of Items:', 'buddypress'); ?> <input class="widefat" id="bp-activity-widget-sitewide-items-max" name="bp-activity-widget-sitewide-items-max" type="text" value="<?php echo $max_items; ?>" style="width: 30%" /></label></p>
80
<input type="hidden" id="bp-activity-widget-sitewide-submit" name="bp-activity-widget-sitewide-submit" value="1" />
81
<?php
82
}
27
. $after_title; ?>
28
29
<?php
30
+ if ( !$options['max_items'] || empty( $options['max_items'] ) )
31
$options['max_items'] = 20;
32
?>
33
34
<?php
45
<ul id="site-wide-stream" class="activity-list">
46
<?php foreach( $activity['activities'] as $item ) : ?>
47
<li class="<?php echo $item['component_name'] ?>">
48
+ <?php echo apply_filters( 'bp_get_activity_content', bp_activity_content_filter( $item['content'], $item['date_recorded'], '', true, false, true ) ); ?>
49
</li>
50
<?php endforeach; ?>
51
</ul>
73
update_blog_option( $current_blog->blog_id, 'bp_activity_widget_sitewide_activity', $options );
74
}
75
76
?>
77
+ <p><label for="bp-activity-widget-sitewide-items-max"><?php _e('Max Number of Items:', 'buddypress'); ?> <input class="widefat" id="bp-activity-widget-sitewide-items-max" name="bp-activity-widget-sitewide-items-max" type="text" value="<?php echo attribute_escape( $options['max_items'] ); ?>" style="width: 30%" /></label></p>
78
<input type="hidden" id="bp-activity-widget-sitewide-submit" name="bp-activity-widget-sitewide-submit" value="1" />
79
<?php
80
}
bp-blogs.php CHANGED
@@ -1,6 +1,5 @@
1
<?php
2
3
- define ( 'BP_BLOGS_VERSION', '1.0' );
4
define ( 'BP_BLOGS_DB_VERSION', '1300' );
5
6
/* Define the slug for the component */
@@ -194,7 +193,7 @@ function bp_blogs_directory_blogs_setup() {
194
bp_core_load_template( apply_filters( 'bp_blogs_template_directory_blogs_setup', 'directories/blogs/index' ) );
195
}
196
}
197
- add_action( 'wp', 'bp_blogs_directory_blogs_setup', 5 );
198
199
function bp_blogs_screen_my_blogs() {
200
do_action( 'bp_blogs_screen_my_blogs' );
@@ -380,7 +379,7 @@ function bp_blogs_record_blog( $blog_id, $user_id ) {
380
$is_private = 1;
381
382
// Record in activity streams
383
- bp_blogs_record_activity( array( 'item_id' => $recorded_blog_id, 'component_name' => 'blogs', 'component_action' => 'new_blog', 'is_private' => $is_private, 'user_id' => $recorded_blog->user_id ) );
384
385
do_action( 'bp_blogs_new_blog', $recorded_blog, $is_private, $is_recorded );
386
}
@@ -418,7 +417,7 @@ function bp_blogs_record_post( $post_id, $blog_id = false, $user_id = false ) {
418
$recorded_post_id = $recorded_post->save();
419
420
bp_blogs_update_blogmeta( $recorded_post->blog_id, 'last_activity', time() );
421
- bp_blogs_record_activity( array( 'item_id' => $recorded_post->id, 'component_name' => 'blogs', 'component_action' => 'new_blog_post', 'is_private' => bp_blogs_is_blog_hidden( $recorded_post->blog_id ), 'user_id' => $recorded_post->user_id, 'recorded_time' => strtotime( $post->post_date ) ) );
422
}
423
} else {
424
$existing_post = new BP_Blogs_Post( null, $blog_id, $post_id );
@@ -443,8 +442,8 @@ function bp_blogs_record_post( $post_id, $blog_id = false, $user_id = false ) {
443
$recorded_post = $existing_post;
444
445
/* Delete and re-add the activity stream item to reflect potential content changes. */
446
- bp_blogs_delete_activity( array( 'item_id' => $recorded_post->id, 'component_name' => 'blogs', 'component_action' => 'new_blog_post', 'user_id' => $recorded_post->user_id ) );
447
- bp_blogs_record_activity( array( 'item_id' => $recorded_post->id, 'component_name' => 'blogs', 'component_action' => 'new_blog_post', 'is_private' => bp_blogs_is_blog_hidden( $recorded_post->blog_id ), 'user_id' => $recorded_post->user_id, 'recorded_time' => strtotime( $post->post_date ) ) );
448
}
449
450
do_action( 'bp_blogs_new_blog_post', $recorded_post, $is_private, $is_recorded );
@@ -478,7 +477,7 @@ function bp_blogs_record_comment( $comment_id, $is_approved ) {
478
$recorded_commment_id = $recorded_comment->save();
479
480
bp_blogs_update_blogmeta( $recorded_comment->blog_id, 'last_activity', time() );
481
- bp_blogs_record_activity( array( 'item_id' => $recorded_comment->blog_id, 'secondary_item_id' => $recorded_commment_id, 'component_name' => 'blogs', 'component_action' => 'new_blog_comment', 'is_private' => $is_private, 'user_id' => $recorded_comment->user_id, 'recorded_time' => $recorded_comment->date_created ) );
482
}
483
add_action( 'comment_post', 'bp_blogs_record_comment', 10, 2 );
484
@@ -487,8 +486,8 @@ function bp_blogs_approve_comment( $comment_id, $comment ) {
487
488
$recorded_comment = bp_blogs_record_comment( $comment_id, true );
489
490
- bp_blogs_delete_activity( array( 'item_id' => $recorded_comment->blog_id, 'secondary_item_id' => $recorded_commment_id, 'component_name' => 'blogs', 'component_action' => 'new_blog_comment', 'user_id' => $recorded_comment->user_id ) );
491
- bp_blogs_record_activity( array( 'item_id' => $recorded_comment->blog_id, 'secondary_item_id' => $recorded_commment_id, 'component_name' => 'blogs', 'component_action' => 'new_blog_comment', 'is_private' => $is_private, 'user_id' => $recorded_comment->user_id, 'recorded_time' => $recorded_comment->date_created ) );
492
}
493
add_action( 'comment_approved_', 'bp_blogs_approve_comment', 10, 2 );
494
@@ -519,7 +518,7 @@ function bp_blogs_remove_blog( $blog_id ) {
519
BP_Blogs_Blog::delete_blog_for_all( $blog_id );
520
521
// Delete activity stream item
522
- bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => 'blogs', 'component_action' => 'new_blog', 'user_id' => $bp->loggedin_user->id ) );
523
524
do_action( 'bp_blogs_remove_blog', $blog_id );
525
}
@@ -534,7 +533,7 @@ function bp_blogs_remove_blog_for_user( $user_id, $blog_id ) {
534
BP_Blogs_Blog::delete_blog_for_user( $blog_id, $user_id );
535
536
// Delete activity stream item
537
- bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => 'blogs', 'component_action' => 'new_blog', 'user_id' => $current_user->ID ) );
538
539
do_action( 'bp_blogs_remove_blog_for_user', $blog_id, $user_id );
540
}
@@ -552,7 +551,7 @@ function bp_blogs_remove_post( $post_id ) {
552
BP_Blogs_Post::delete( $post_id, $blog_id );
553
554
// Delete activity stream item
555
- bp_blogs_delete_activity( array( 'item_id' => $post->id, 'component_name' => 'blogs', 'component_action' => 'new_blog_post', 'user_id' => $post->user_id ) );
556
557
do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $post->user_id );
558
}
@@ -565,7 +564,7 @@ function bp_blogs_remove_comment( $comment_id ) {
565
BP_Blogs_Comment::delete( $comment_id, $wpdb->blogid );
566
567
// Delete activity stream item
568
- bp_blogs_delete_activity( array( 'item_id' => $recorded_comment->blog_id, 'secondary_item_id' => $recorded_comment->id, 'component_name' => 'blogs', 'component_action' => 'new_blog_comment', 'user_id' => $recorded_comment->user_id ) );
569
570
do_action( 'bp_blogs_remove_comment', $blog_id, $comment_id, $bp->loggedin_user->id );
571
}
@@ -580,7 +579,7 @@ function bp_blogs_remove_data_for_blog( $blog_id ) {
580
BP_Blogs_Comment::delete_comments_for_blog( $blog_id );
581
582
// Delete activity stream item
583
- bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => 'blogs', 'component_action' => false, 'user_id' => $bp->loggedin_user->id ) );
584
585
do_action( 'bp_blogs_remove_data_for_blog', $blog_id );
586
}
@@ -757,8 +756,8 @@ function bp_blogs_force_buddypress_theme( $template ) {
757
if ( empty( $member_theme ) )
758
$member_theme = 'bpmember';
759
760
- add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
761
- add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
762
763
return $member_theme;
764
} else {
@@ -776,8 +775,8 @@ function bp_blogs_force_buddypress_stylesheet( $stylesheet ) {
776
if ( empty( $member_theme ) )
777
$member_theme = 'bpmember';
778
779
- add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
780
- add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
781
782
return $member_theme;
783
} else {
1
<?php
2
3
define ( 'BP_BLOGS_DB_VERSION', '1300' );
4
5
/* Define the slug for the component */
193
bp_core_load_template( apply_filters( 'bp_blogs_template_directory_blogs_setup', 'directories/blogs/index' ) );
194
}
195
}
196
+ add_action( 'wp', 'bp_blogs_directory_blogs_setup', 2 );
197
198
function bp_blogs_screen_my_blogs() {
199
do_action( 'bp_blogs_screen_my_blogs' );
379
$is_private = 1;
380
381
// Record in activity streams
382
+ bp_blogs_record_activity( array( 'item_id' => $recorded_blog_id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog', 'is_private' => $is_private, 'user_id' => $recorded_blog->user_id ) );
383
384
do_action( 'bp_blogs_new_blog', $recorded_blog, $is_private, $is_recorded );
385
}
417
$recorded_post_id = $recorded_post->save();
418
419
bp_blogs_update_blogmeta( $recorded_post->blog_id, 'last_activity', time() );
420
+ bp_blogs_record_activity( array( 'item_id' => $recorded_post->id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog_post', 'is_private' => bp_blogs_is_blog_hidden( $recorded_post->blog_id ), 'user_id' => $recorded_post->user_id, 'recorded_time' => strtotime( $post->post_date ) ) );
421
}
422
} else {
423
$existing_post = new BP_Blogs_Post( null, $blog_id, $post_id );
442
$recorded_post = $existing_post;
443
444
/* Delete and re-add the activity stream item to reflect potential content changes. */
445
+ bp_blogs_delete_activity( array( 'item_id' => $recorded_post->id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog_post', 'user_id' => $recorded_post->user_id ) );
446
+ bp_blogs_record_activity( array( 'item_id' => $recorded_post->id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog_post', 'is_private' => bp_blogs_is_blog_hidden( $recorded_post->blog_id ), 'user_id' => $recorded_post->user_id, 'recorded_time' => strtotime( $post->post_date ) ) );
447
}
448
449
do_action( 'bp_blogs_new_blog_post', $recorded_post, $is_private, $is_recorded );
477
$recorded_commment_id = $recorded_comment->save();
478
479
bp_blogs_update_blogmeta( $recorded_comment->blog_id, 'last_activity', time() );
480
+ bp_blogs_record_activity( array( 'item_id' => $recorded_comment->blog_id, 'secondary_item_id' => $recorded_commment_id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog_comment', 'is_private' => $is_private, 'user_id' => $recorded_comment->user_id, 'recorded_time' => $recorded_comment->date_created ) );
481
}
482
add_action( 'comment_post', 'bp_blogs_record_comment', 10, 2 );
483
486
487
$recorded_comment = bp_blogs_record_comment( $comment_id, true );
488
489
+ bp_blogs_delete_activity( array( 'item_id' => $recorded_comment->blog_id, 'secondary_item_id' => $recorded_commment_id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog_comment', 'user_id' => $recorded_comment->user_id ) );
490
+ bp_blogs_record_activity( array( 'item_id' => $recorded_comment->blog_id, 'secondary_item_id' => $recorded_commment_id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog_comment', 'is_private' => $is_private, 'user_id' => $recorded_comment->user_id, 'recorded_time' => $recorded_comment->date_created ) );
491
}
492
add_action( 'comment_approved_', 'bp_blogs_approve_comment', 10, 2 );
493
518
BP_Blogs_Blog::delete_blog_for_all( $blog_id );
519
520
// Delete activity stream item
521
+ bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog', 'user_id' => $bp->loggedin_user->id ) );
522
523
do_action( 'bp_blogs_remove_blog', $blog_id );
524
}
533
BP_Blogs_Blog::delete_blog_for_user( $blog_id, $user_id );
534
535
// Delete activity stream item
536
+ bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog', 'user_id' => $current_user->ID ) );
537
538
do_action( 'bp_blogs_remove_blog_for_user', $blog_id, $user_id );
539
}
551
BP_Blogs_Post::delete( $post_id, $blog_id );
552
553
// Delete activity stream item
554
+ bp_blogs_delete_activity( array( 'item_id' => $post->id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog_post', 'user_id' => $post->user_id ) );
555
556
do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $post->user_id );
557
}
564
BP_Blogs_Comment::delete( $comment_id, $wpdb->blogid );
565
566
// Delete activity stream item
567
+ bp_blogs_delete_activity( array( 'item_id' => $recorded_comment->blog_id, 'secondary_item_id' => $recorded_comment->id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog_comment', 'user_id' => $recorded_comment->user_id ) );
568
569
do_action( 'bp_blogs_remove_comment', $blog_id, $comment_id, $bp->loggedin_user->id );
570
}
579
BP_Blogs_Comment::delete_comments_for_blog( $blog_id );
580
581
// Delete activity stream item
582
+ bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component_name' => $bp->blogs->slug, 'component_action' => false, 'user_id' => $bp->loggedin_user->id ) );
583
584
do_action( 'bp_blogs_remove_data_for_blog', $blog_id );
585
}
756
if ( empty( $member_theme ) )
757
$member_theme = 'bpmember';
758
759
+ add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
760
+ add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );
761
762
return $member_theme;
763
} else {
775
if ( empty( $member_theme ) )
776
$member_theme = 'bpmember';
777
778
+ add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
779
+ add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );
780
781
return $member_theme;
782
} else {
bp-blogs/bp-blogs-widgets.php CHANGED
@@ -20,14 +20,17 @@ function bp_blogs_widget_recent_posts($args) {
20
21
extract($args);
22
$options = get_blog_option( $current_blog->blog_id, 'bp_blogs_widget_recent_posts' );
23
?>
24
<?php echo $before_widget; ?>
25
<?php echo $before_title
26
. $widget_name
27
. $after_title; ?>
28
29
- <?php $posts = bp_blogs_get_latest_posts( null, $options['max_posts'] ) ?>
30
- <?php $counter = 0; ?>
31
32
<?php if ( $posts ) : ?>
33
<div class="item-options" id="recent-posts-options">
@@ -75,9 +78,8 @@ function bp_blogs_widget_recent_posts_control() {
75
update_blog_option( $current_blog->blog_id, 'bp_blogs_widget_recent_posts', $options );
76
}
77
78
- $max_posts = attribute_escape( $options['max_posts'] );
79
?>
80
- <p><label for="bp-blogs-widget-recent-posts-max"><?php _e('Max Number of Posts:', 'buddypress'); ?> <input class="widefat" id="bp-blogs-widget-recent-posts-max" name="bp-blogs-widget-recent-posts-max" type="text" value="<?php echo $max_posts; ?>" style="width: 30%" /></label></p>
81
<input type="hidden" id="bp-blogs-widget-recent-posts-submit" name="bp-blogs-widget-recent-posts-submit" value="1" />
82
<?php
83
}
20
21
extract($args);
22
$options = get_blog_option( $current_blog->blog_id, 'bp_blogs_widget_recent_posts' );
23
+
24
+ if ( empty( $options['max_posts'] ) || !$options['max_posts'] )
25
+ $options['max_posts'] = 5;
26
?>
27
<?php echo $before_widget; ?>
28
<?php echo $before_title
29
. $widget_name
30
. $after_title; ?>
31
32
+ <?php $posts = bp_blogs_get_latest_posts( null, $options['max_posts'] ) ?>
33
+ <?php $counter = 0; ?>
34
35
<?php if ( $posts ) : ?>
36
<div class="item-options" id="recent-posts-options">
78
update_blog_option( $current_blog->blog_id, 'bp_blogs_widget_recent_posts', $options );
79
}
80
81
?>
82
+ <p><label for="bp-blogs-widget-recent-posts-max"><?php _e('Max Number of Posts:', 'buddypress'); ?> <input class="widefat" id="bp-blogs-widget-recent-posts-max" name="bp-blogs-widget-recent-posts-max" type="text" value="<?php echo attribute_escape( $options['max_posts'] ); ?>" style="width: 30%" /></label></p>
83
<input type="hidden" id="bp-blogs-widget-recent-posts-submit" name="bp-blogs-widget-recent-posts-submit" value="1" />
84
<?php
85
}
bp-core.php CHANGED
@@ -1,7 +1,5 @@
1
<?php
2
-
3
/* Define the current version number for checking if DB tables are up to date. */
4
- define( 'BP_CORE_VERSION', '1.0' );
5
define( 'BP_CORE_DB_VERSION', '1300' );
6
7
/* Define the path and url of the BuddyPress plugins directory */
@@ -38,8 +36,9 @@ require ( BP_PLUGIN_DIR . '/bp-core/bp-core-widgets.php' );
38
require ( BP_PLUGIN_DIR . '/bp-core/bp-core-ajax.php' );
39
require ( BP_PLUGIN_DIR . '/bp-core/bp-core-notifications.php' );
40
41
if ( !defined( 'BP_DISABLE_ADMIN_BAR') )
42
- require ( 'bp-core/bp-core-adminbar.php' );
43
44
/* Define the slug for member pages and the members directory (e.g. domain.com/[members] ) */
45
if ( !defined( 'BP_MEMBERS_SLUG' ) )
@@ -139,8 +138,8 @@ function bp_core_setup_globals() {
139
$bp->grav_default = get_site_option( 'user-avatar-default' );
140
141
/* Fetch the full name for the logged in and current user */
142
- $bp->loggedin_user->fullname = bp_core_global_user_fullname( $bp->loggedin_user->id );
143
- $bp->displayed_user->fullname = bp_core_global_user_fullname( $bp->displayed_user->id );
144
145
/* Used to determine if user has admin rights on current content. If the logged in user is viewing
146
their own profile and wants to delete a post on their wire, is_item_admin is used. This is a
@@ -158,9 +157,20 @@ function bp_core_setup_globals() {
158
$bp->current_component = $bp->default_component;
159
}
160
add_action( 'plugins_loaded', 'bp_core_setup_globals', 3 );
161
- add_action( '_admin_menu', 'bp_core_setup_globals', 1 ); // must be _admin_menu hook.
162
163
- function bp_core_setup_root_components() {
164
/* Add core root components */
165
bp_core_add_root_component( BP_MEMBERS_SLUG );
166
bp_core_add_root_component( BP_REGISTER_SLUG );
@@ -168,18 +178,20 @@ function bp_core_setup_root_components() {
168
bp_core_add_root_component( BP_SEARCH_SLUG );
169
bp_core_add_root_component( BP_HOME_BLOG_SLUG );
170
}
171
- add_action( 'plugins_loaded', 'bp_core_setup_root_components', 1 );
172
173
- function bp_core_setup_session() {
174
- // Start a session for error/success feedback on redirect and for signup functions.
175
- @session_start();
176
-
177
- // Render any error/success feedback on the template
178
- if ( $_SESSION['message'] != '' )
179
- add_action( 'template_notices', 'bp_core_render_notice' );
180
- }
181
- add_action( 'wp', 'bp_core_setup_session', 3 );
182
183
function bp_core_install() {
184
global $wpdb, $bp;
185
@@ -244,6 +256,38 @@ function bp_core_check_installed() {
244
}
245
add_action( 'admin_menu', 'bp_core_check_installed' );
246
247
/**
248
* bp_core_add_admin_menu()
249
*
@@ -322,7 +366,18 @@ function bp_core_setup_nav() {
322
add_action( 'wp', 'bp_core_setup_nav', 2 );
323
add_action( 'admin_menu', 'bp_core_setup_nav', 2 );
324
325
- function bp_core_directory_members() {
326
global $bp;
327
328
if ( !is_home() && is_null( $bp->displayed_user->id ) && $bp->current_component == $bp->default_component ) {
@@ -333,7 +388,7 @@ function bp_core_directory_members() {
333
bp_core_load_template( apply_filters( 'bp_core_template_directory_members', 'directories/members/index' ) );
334
}
335
}
336
- add_action( 'wp', 'bp_core_directory_members', 5 );
337
338
/**
339
* bp_core_get_user_domain()
@@ -353,7 +408,7 @@ function bp_core_get_user_domain( $user_id ) {
353
354
$ud = get_userdata($user_id);
355
356
- return $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/';
357
}
358
359
/**
@@ -367,7 +422,7 @@ function bp_core_get_user_domain( $user_id ) {
367
* @return $domain The domain URL for the blog.
368
*/
369
function bp_core_get_root_domain() {
370
- return get_blog_option( BP_ROOT_BLOG, 'siteurl' );
371
}
372
373
/**
@@ -382,7 +437,7 @@ function bp_core_get_root_domain() {
382
* @return The user id for the user that is currently being displayed, return zero if this is not a user home and just a normal blog.
383
*/
384
function bp_core_get_displayed_userid( $user_login ) {
385
- return bp_core_get_userid_from_user_login( $user_login );
386
}
387
388
/**
@@ -606,14 +661,14 @@ function bp_core_add_root_component( $slug ) {
606
function bp_core_get_random_member() {
607
global $bp, $wpdb;
608
609
- if ( $bp->current_component == BP_MEMBERS_SLUG && isset( $_GET['random'] ) ) {
610
$user = BP_Core_User::get_random_users(1);
611
-
612
$ud = get_userdata( $user['users'][0]->user_id );
613
bp_core_redirect( $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login );
614
}
615
}
616
- add_action( 'wp', 'bp_core_get_random_member', 6 );
617
618
/**
619
* bp_core_get_userid()
@@ -629,26 +684,12 @@ add_action( 'wp', 'bp_core_get_random_member', 6 );
629
function bp_core_get_userid( $username ) {
630
global $wpdb;
631
632
- $sql = $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $username );
633
- return $wpdb->get_var($sql);
634
- }
635
-
636
- /**
637
- * bp_core_get_userid_from_user_login()
638
- *
639
- * Returns the user_id from a user login
640
- * @package BuddyPress Core
641
- * @param $path str Path to check.
642
- * @global $wpdb WordPress DB access object.
643
- * @return false on no match
644
- * @return int the user ID of the matched user.
645
- */
646
- function bp_core_get_userid_from_user_login( $user_login ) {
647
- global $wpdb;
648
-
649
- if ( !empty( $user_login ) )
650
- return $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $user_login ) );
651
}
652
653
/**
654
* bp_core_get_username()
@@ -666,12 +707,14 @@ function bp_core_get_username( $uid ) {
666
global $userdata;
667
668
if ( $uid == $userdata->ID )
669
- return __( 'You', 'buddypress' );
670
671
if ( !$ud = get_userdata($uid) )
672
return false;
673
674
- return $ud->user_login;
675
}
676
677
/**
@@ -694,7 +737,7 @@ function bp_core_get_userurl( $uid ) {
694
695
$ud = get_userdata($uid);
696
697
- return $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/';
698
}
699
700
/**
@@ -710,7 +753,7 @@ function bp_core_get_userurl( $uid ) {
710
*/
711
function bp_core_get_user_email( $uid ) {
712
$ud = get_userdata($uid);
713
- return $ud->user_email;
714
}
715
716
/**
@@ -744,7 +787,7 @@ function bp_core_get_userlink( $user_id, $no_anchor = false, $just_link = false,
744
return false;
745
746
if ( function_exists('bp_fetch_user_fullname') ) {
747
- $display_name = bp_fetch_user_fullname( $user_id, false );
748
749
if ( $with_s )
750
$display_name = sprintf( __( "%s's", 'buddypress' ), $display_name );
@@ -753,9 +796,6 @@ function bp_core_get_userlink( $user_id, $no_anchor = false, $just_link = false,
753
$display_name = $ud->display_name;
754
}
755
756
- // if ( $user_id == $userdata->ID && !$no_you )
757
- // $display_name = 'You';
758
-
759
if ( $no_anchor )
760
return $display_name;
761
@@ -768,26 +808,54 @@ function bp_core_get_userlink( $user_id, $no_anchor = false, $just_link = false,
768
return '<a href="' . $url . '">' . $display_name . '</a>';
769
}
770
771
/**
772
- * bp_core_global_user_fullname()
773
*
774
- * Returns the full name for the user, or the display name if Xprofile component is not installed.
775
*
776
* @package BuddyPress Core
777
- * @param $user_id string The user ID of the user.
778
- * @param
779
- * @uses bp_fetch_user_fullname() Returns the full name for a user based on user ID.
780
- * @uses get_userdata() Fetches a new userdata object for the user ID passed.
781
- * @return Either the users full name, or the display name.
782
*/
783
- function bp_core_global_user_fullname( $user_id ) {
784
- if ( function_exists('bp_fetch_user_fullname') ) {
785
- return bp_fetch_user_fullname( $user_id, false );
786
- } else {
787
- $ud = get_userdata($user_id);
788
- return $current_user->display_name;
789
}
790
}
791
792
/**
793
* bp_core_get_userlink_by_email()
@@ -802,9 +870,10 @@ function bp_core_global_user_fullname( $user_id ) {
802
*/
803
function bp_core_get_userlink_by_email( $email ) {
804
$user = get_user_by_email( $email );
805
- return bp_core_get_userlink( $user->ID, false, false, true );
806
}
807
808
/**
809
* bp_core_get_userlink_by_username()
810
*
@@ -819,9 +888,10 @@ function bp_core_get_userlink_by_username( $username ) {
819
global $wpdb;
820
821
$user_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $username ) );
822
- return bp_core_get_userlink( $user_id, false, false, true );
823
}
824
825
/**
826
* bp_core_get_user_email()
827
*
@@ -843,14 +913,23 @@ function bp_core_format_time( $time, $just_date = false ) {
843
return $date;
844
}
845
846
function bp_core_add_message( $message, $type = false ) {
847
if ( !$type )
848
$type = 'success';
849
-
850
- $_SESSION['message'] = $message;
851
- $_SESSION['message_type'] = $type;
852
}
853
854
/**
855
* bp_core_render_notice()
856
*
@@ -861,20 +940,18 @@ function bp_core_add_message( $message, $type = false ) {
861
* @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
862
*/
863
function bp_core_render_notice() {
864
- if ( $_SESSION['message'] ) {
865
- $type = ( 'success' == $_SESSION['message_type'] ) ? 'updated' : 'error';
866
?>
867
<div id="message" class="<?php echo $type; ?>">
868
- <p><?php echo $_SESSION['message']; ?></p>
869
</div>
870
- <?php
871
- unset( $_SESSION['message'] );
872
- unset( $_SESSION['message_type'] );
873
-
874
do_action( 'bp_core_render_notice' );
875
}
876
}
877
878
/**
879
* bp_core_time_since()
880
*
@@ -952,6 +1029,7 @@ function bp_core_time_since( $older_date, $newer_date = false ) {
952
return $output;
953
}
954
955
/**
956
* bp_core_record_activity()
957
*
@@ -1004,6 +1082,7 @@ function bp_core_get_last_activity( $last_activity_date, $string ) {
1004
return $last_active;
1005
}
1006
1007
/**
1008
* bp_core_get_all_posts_for_user()
1009
*
@@ -1023,6 +1102,7 @@ function bp_core_get_all_posts_for_user( $user_id = null ) {
1023
return $wpdb->get_col( $wpdb->prepare( "SELECT post_id FROM $wpdb->posts WHERE post_author = %d AND post_status = 'publish' AND post_type = 'post'", $user_id ) );
1024
}
1025
1026
/**
1027
* bp_core_get_site_path()
1028
*
@@ -1038,6 +1118,16 @@ function bp_core_get_site_path() {
1038
return $current_site->path;
1039
}
1040
1041
function bp_core_redirect( $location, $status = 302 ) {
1042
global $bp_no_status_set;
1043
@@ -1126,8 +1216,17 @@ function bp_core_referrer() {
1126
return implode( '/', $referer );
1127
}
1128
1129
- function bp_core_get_member_themes() {
1130
- add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
1131
$themes = get_themes();
1132
1133
if ( $themes ) {
@@ -1145,15 +1244,68 @@ function bp_core_get_member_themes() {
1145
1146
return $member_themes;
1147
}
1148
1149
- function bp_core_set_member_theme_root() {
1150
- return apply_filters( 'bp_core_set_member_theme_root', WP_CONTENT_DIR . "/bp-themes" );
1151
}
1152
1153
- function bp_core_set_member_theme_root_uri() {
1154
- return apply_filters( 'bp_core_set_member_theme_root_uri', WP_CONTENT_URL . '/bp-themes' );
1155
}
1156
1157
function bp_core_add_illegal_names() {
1158
global $bp;
1159
@@ -1189,6 +1341,7 @@ function bp_core_email_from_name_filter() {
1189
}
1190
add_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' );
1191
1192
/**
1193
* bp_core_email_from_name_filter()
1194
*
@@ -1205,47 +1358,78 @@ function bp_core_email_from_address_filter() {
1205
add_filter( 'wp_mail_from', 'bp_core_email_from_address_filter' );
1206
1207
1208
function bp_core_delete_account() {
1209
global $bp;
1210
1211
// Be careful with this function!
1212
1213
require_once( ABSPATH . '/wp-admin/includes/mu.php' );
1214
require_once( ABSPATH . '/wp-admin/includes/user.php' );
1215
1216
return wpmu_delete_user( $bp->loggedin_user->id );
1217
}
1218
1219
- function bp_core_search_site() {
1220
global $bp;
1221
-
1222
if ( $bp->current_component == BP_SEARCH_SLUG ) {
1223
$search_terms = $_POST['search-terms'];
1224
$search_which = $_POST['search-which'];
1225
1226
- switch ( $search_which ) {
1227
- case 'members': default:
1228
- $search = BP_MEMBERS_SLUG;
1229
- break;
1230
- case 'groups':
1231
- $search = BP_GROUPS_SLUG;
1232
- break;
1233
- case 'blogs':
1234
- $search = BP_BLOGS_SLUG;
1235
- break;
1236
}
1237
-
1238
- $search_url = apply_filters( 'bp_core_search_site', site_url( $search . '/?s=' . urlencode($search_terms) ), $search_terms );
1239
1240
bp_core_redirect( $search_url );
1241
}
1242
}
1243
- add_action( 'wp', 'bp_core_search_site', 5 );
1244
1245
/**
1246
* bp_core_ucfirst()
1247
*
1248
- * Localization save ucfirst() support.
1249
*
1250
* @package BuddyPress Core
1251
*/
@@ -1258,6 +1442,7 @@ function bp_core_ucfirst( $str ) {
1258
}
1259
}
1260
1261
/**
1262
* bp_core_strip_username_spaces()
1263
*
@@ -1270,6 +1455,7 @@ function bp_core_strip_username_spaces( $username ) {
1270
}
1271
add_action( 'pre_user_login', 'bp_core_strip_username_spaces' );
1272
1273
/**
1274
* bp_core_clear_cache()
1275
* REQUIRES WP-SUPER-CACHE
@@ -1289,14 +1475,13 @@ function bp_core_clear_cache() {
1289
}
1290
}
1291
1292
- function bp_core_print_version_numbers() {
1293
- global $bp;
1294
-
1295
- foreach ( $bp->version_numbers as $name => $version ) {
1296
- echo ucwords($name) . ': <b>' . $version . '</b> / ';
1297
- }
1298
- }
1299
-
1300
function bp_core_print_generation_time() {
1301
global $wpdb;
1302
?>
@@ -1325,6 +1510,14 @@ function bp_core_remove_data( $user_id ) {
1325
add_action( 'wpmu_delete_user', 'bp_core_remove_data', 1 );
1326
add_action( 'delete_user', 'bp_core_remove_data', 1 );
1327
1328
function bp_core_clear_user_object_cache( $user_id ) {
1329
wp_cache_delete( 'bp_user_' . $user_id, 'bp' );
1330
wp_cache_delete( 'bp_core_avatar_v1_u' . $user_id, 'bp' );
1
<?php
2
/* Define the current version number for checking if DB tables are up to date. */
3
define( 'BP_CORE_DB_VERSION', '1300' );
4
5
/* Define the path and url of the BuddyPress plugins directory */
36
require ( BP_PLUGIN_DIR . '/bp-core/bp-core-ajax.php' );
37
require ( BP_PLUGIN_DIR . '/bp-core/bp-core-notifications.php' );
38
39
+ /* If BP_DISABLE_ADMIN_BAR is defined, do not load the global admin bar */
40
if ( !defined( 'BP_DISABLE_ADMIN_BAR') )
41
+ require ( BP_PLUGIN_DIR . '/bp-core/bp-core-adminbar.php' );
42
43
/* Define the slug for member pages and the members directory (e.g. domain.com/[members] ) */
44
if ( !defined( 'BP_MEMBERS_SLUG' ) )
138
$bp->grav_default = get_site_option( 'user-avatar-default' );
139
140
/* Fetch the full name for the logged in and current user */
141
+ $bp->loggedin_user->fullname = bp_core_get_user_displayname( $bp->loggedin_user->id );
142
+ $bp->displayed_user->fullname = bp_core_get_user_displayname( $bp->displayed_user->id );
143
144
/* Used to determine if user has admin rights on current content. If the logged in user is viewing
145
their own profile and wants to delete a post on their wire, is_item_admin is used. This is a
157
$bp->current_component = $bp->default_component;
158
}
159
add_action( 'plugins_loaded', 'bp_core_setup_globals', 3 );
160
+ add_action( '_admin_menu', 'bp_core_setup_globals', 3 ); // must be _admin_menu hook.
161
+
162
163
+ /**
164
+ * bp_core_setup_root_uris()
165
+ *
166
+ * Adds the core URIs that should run in the root of the installation.
167
+ *
168
+ * For example: http://example.org/search or http://example.org/members
169
+ *
170
+ * @package BuddyPress Core
171
+ * @uses bp_core_add_root_component() Adds a slug to the root components global variable.
172
+ */
173
+ function bp_core_setup_root_uris() {
174
/* Add core root components */
175
bp_core_add_root_component( BP_MEMBERS_SLUG );
176
bp_core_add_root_component( BP_REGISTER_SLUG );
178
bp_core_add_root_component( BP_SEARCH_SLUG );
179
bp_core_add_root_component( BP_HOME_BLOG_SLUG );
180
}
181
+ add_action( 'plugins_loaded', 'bp_core_setup_root_uris', 2 );
182
183
184
+ /**
185
+ * bp_core_install()
186
+ *
187
+ * Installs the core DB tables for BuddyPress.
188
+ *
189
+ * @package BuddyPress Core
190
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
191
+ * @global $wpdb WordPress DB access object.
192
+ * @uses dbDelta() Performs a table creation, or upgrade based on what already exists in the DB.
193
+ * @uses bp_core_add_illegal_names() Adds illegal blog names to the WP settings
194
+ */
195
function bp_core_install() {
196
global $wpdb, $bp;
197
256
}
257
add_action( 'admin_menu', 'bp_core_check_installed' );
258
259
+
260
+ /**
261
+ * bp_core_setup_cookies()
262
+ *
263
+ * Checks if there is a feedback message in the WP cookie, if so, adds a "template_notices" action
264
+ * so that the message can be parsed into the template and displayed to the user.
265
+ *
266
+ * After the message is displayed, it removes the message vars from the cookie so that the message
267
+ * is not shown to the user multiple times.
268
+ *
269
+ * @package BuddyPress Core
270
+ * @global $bp_message The message text
271
+ * @global $bp_message_type The type of message (error/success)
272
+ * @uses setcookie() Sets a cookie value for the user.
273
+ */
274
+ function bp_core_setup_cookies() {
275
+ global $bp_message, $bp_message_type;
276
+
277
+ // Render any error/success feedback on the template
278
+ if ( $_COOKIE['bp-message'] == '' || !isset( $_COOKIE['bp-message'] ) )
279
+ return false;
280
+
281
+ $bp_message = $_COOKIE['bp-message'];
282
+ $bp_message_type = $_COOKIE['bp-message-type'];
283
+ add_action( 'template_notices', 'bp_core_render_notice' );
284
+
285
+ setcookie( 'bp-message', false, time() - 1000, COOKIEPATH );
286
+ setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH );
287
+ }
288
+ add_action( 'init', 'bp_core_setup_cookies' );
289
+
290
+
291
/**
292
* bp_core_add_admin_menu()
293
*
366
add_action( 'wp', 'bp_core_setup_nav', 2 );
367
add_action( 'admin_menu', 'bp_core_setup_nav', 2 );
368
369
+ /**
370
+ * bp_core_action_directory_members()
371
+ *
372
+ * Listens to the $bp component and action variables to determine if the user is viewing the members
373
+ * directory page. If they are, it will set up the directory and load the members directory template.
374
+ *
375
+ * @package BuddyPress Core
376
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
377
+ * @uses wp_enqueue_script() Loads a JS script into the header of the page.
378
+ * @uses bp_core_load_template() Loads a specific template file.
379
+ */
380
+ function bp_core_action_directory_members() {
381
global $bp;
382
383
if ( !is_home() && is_null( $bp->displayed_user->id ) && $bp->current_component == $bp->default_component ) {
388
bp_core_load_template( apply_filters( 'bp_core_template_directory_members', 'directories/members/index' ) );
389
}
390
}
391
+ add_action( 'wp', 'bp_core_action_directory_members', 2 );
392
393
/**
394
* bp_core_get_user_domain()
408
409
$ud = get_userdata($user_id);
410
411
+ return apply_filters( 'bp_core_get_user_domain', $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/' );
412
}
413
414
/**
422
* @return $domain The domain URL for the blog.
423
*/
424
function bp_core_get_root_domain() {
425
+ return apply_filters( 'bp_core_get_root_domain', get_blog_option( BP_ROOT_BLOG, 'siteurl' ) );
426
}
427
428
/**
437
* @return The user id for the user that is currently being displayed, return zero if this is not a user home and just a normal blog.
438
*/
439
function bp_core_get_displayed_userid( $user_login ) {
440
+ return apply_filters( 'bp_core_get_displayed_userid', bp_core_get_userid_from_user_login( $user_login ) );
441
}
442
443
/**
661
function bp_core_get_random_member() {
662
global $bp, $wpdb;
663
664
+ if ( !$bp->current_component && isset( $_GET['random-member'] ) ) {
665
$user = BP_Core_User::get_random_users(1);
666
+
667
$ud = get_userdata( $user['users'][0]->user_id );
668
bp_core_redirect( $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login );
669
}
670
}
671
+ add_action( 'wp', 'bp_core_get_random_member' );
672
673
/**
674
* bp_core_get_userid()
684
function bp_core_get_userid( $username ) {
685
global $wpdb;
686
687
+ if ( !empty( $username ) )
688
+ return apply_filters( 'bp_core_get_userid', $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $username ) ) );
689
}
690
+ function bp_core_get_userid_from_user_login( $deprecated ) {
691
+ return bp_core_get_userid( $deprecated );
692
+ }
693
694
/**
695
* bp_core_get_username()
707
global $userdata;
708
709
if ( $uid == $userdata->ID )
710
+ $username = __( 'You', 'buddypress' );
711
712
if ( !$ud = get_userdata($uid) )
713
return false;
714
715
+ $username = $ud->user_login;
716
+
717
+ return apply_filters( 'bp_core_get_username', $username );
718
}
719
720
/**
737
738
$ud = get_userdata($uid);
739
740
+ return apply_filters( 'bp_core_get_userurl', $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/' );
741
}
742
743
/**
753
*/
754
function bp_core_get_user_email( $uid ) {
755
$ud = get_userdata($uid);
756
+ return apply_filters( 'bp_core_get_user_email', $ud->user_email );
757
}
758
759
/**
787
return false;
788
789
if ( function_exists('bp_fetch_user_fullname') ) {
790
+ $display_name = bp_core_get_user_displayname( $user_id );
791
792
if ( $with_s )
793
$display_name = sprintf( __( "%s's", 'buddypress' ), $display_name );
796
$display_name = $ud->display_name;
797
}
798
799
if ( $no_anchor )
800
return $display_name;
801
808
return '<a href="' . $url . '">' . $display_name . '</a>';
809
}
810
811
+
812
/**
813
+ * bp_core_get_user_displayname()
814
*
815
+ * Fetch the display name for a user. This will use the "Name" field in xprofile if it is installed.
816
+ * Otherwise, it will fall back to the normal WP display_name, or user_nicename, depending on what has been set.
817
*
818
* @package BuddyPress Core
819
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
820
+ * @uses wp_cache_get() Will try and fetch the value from the cache, rather than querying the DB again.
821
+ * @uses get_userdata() Fetches the WP userdata for a specific user.
822
+ * @uses xprofile_set_field_data() Will update the field data for a user based on field name and user id.
823
+ * @uses wp_cache_set() Adds a value to the cache.
824
+ * @return str The display name for the user in question.
825
*/
826
+ function bp_core_get_user_displayname( $user_id ) {
827
+ global $bp;
828
+
829
+ if ( !$user_id )
830
+ return false;
831
+
832
+ if ( !$fullname = wp_cache_get( 'bp_user_fullname_' . $user_id, 'bp' ) ) {
833
+ if ( function_exists('xprofile_install') ) {
834
+ $fullname = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id );
835
+
836
+ if ( empty($fullname) || !$fullname ) {
837
+ $ud = get_userdata($user_id);
838
+
839
+ if ( empty( $ud->display_name ) )
840
+ $fullname = $ud->user_nicename;
841
+ else
842
+ $fullname = $ud->display_name;
843
+
844
+ xprofile_set_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id, $fullname );
845
+ }
846
+ } else {
847
+ $ud = get_userdata($user_id);
848
+ $fullname = $ud->display_name;
849
+ }
850
+
851
+ wp_cache_set( 'bp_user_fullname_' . $user_id, $fullname, 'bp' );
852
}
853
+
854
+ return apply_filters( 'bp_core_get_user_displayname', stripslashes( trim( $fullname ) ) );
855
}
856
+ /* DEPRECATED Use: bp_core_get_user_displayname */
857
+ function bp_core_global_user_fullname( $user_id ) { return bp_core_get_user_displayname( $user_id ); }
858
+
859
860
/**
861
* bp_core_get_userlink_by_email()
870
*/
871
function bp_core_get_userlink_by_email( $email ) {
872
$user = get_user_by_email( $email );
873
+ return apply_filters( 'bp_core_get_userlink_by_email', bp_core_get_userlink( $user->ID, false, false, true ) );
874
}
875
876
+
877
/**
878
* bp_core_get_userlink_by_username()
879
*
888
global $wpdb;
889
890
$user_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $username ) );
891
+ return apply_filters( 'bp_core_get_userlink_by_username', bp_core_get_userlink( $user_id, false, false, true ) );
892
}
893
894
+
895
/**
896
* bp_core_get_user_email()
897
*
913
return $date;
914
}
915
916
+
917
+ /**
918
+ * bp_core_add_message()
919
+ *
920
+ * Adds a feedback (error/success) message to the WP cookie so it can be displayed after the page reloads.
921
+ *
922
+ * @package BuddyPress Core
923
+ */
924
function bp_core_add_message( $message, $type = false ) {
925
if ( !$type )
926
$type = 'success';
927
+
928
+ setcookie( 'bp-message', $message, time()+60*60*24, COOKIEPATH );
929
+ setcookie( 'bp-message-type', $type, time()+60*60*24, COOKIEPATH );
930
}
931
932
+
933
/**
934
* bp_core_render_notice()
935
*
940
* @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
941
*/
942
function bp_core_render_notice() {
943
+ if ( $_COOKIE['bp-message'] ) {
944
+ $type = ( 'success' == $_COOKIE['bp-message-type'] ) ? 'updated' : 'error';
945
?>
946
<div id="message" class="<?php echo $type; ?>">
947
+ <p><?php echo stripslashes( $_COOKIE['bp-message'] ); ?></p>
948
</div>
949
+ <?php
950
do_action( 'bp_core_render_notice' );
951
}
952
}
953
954
+
955
/**
956
* bp_core_time_since()
957
*
1029
return $output;
1030
}
1031
1032
+
1033
/**
1034
* bp_core_record_activity()
1035
*
1082
return $last_active;
1083
}
1084
1085
+
1086
/**
1087
* bp_core_get_all_posts_for_user()
1088
*
1102
return $wpdb->get_col( $wpdb->prepare( "SELECT post_id FROM $wpdb->posts WHERE post_author = %d AND post_status = 'publish' AND post_type = 'post'", $user_id ) );
1103
}
1104
1105
+
1106
/**
1107
* bp_core_get_site_path()
1108
*
1118
return $current_site->path;
1119
}
1120
1121
+ /**
1122
+ * bp_core_redirect()
1123
+ *
1124
+ * Performs a status safe wp_redirect() that is compatible with bp_catch_uri()
1125
+ *
1126
+ * @package BuddyPress Core
1127
+ * @global $bp_no_status_set Makes sure that there are no conflicts with status_header() called in bp_core_do_catch_uri()
1128
+ * @uses get_themes()
1129
+ * @return An array containing all of the themes.
1130
+ */
1131
function bp_core_redirect( $location, $status = 302 ) {
1132
global $bp_no_status_set;
1133
1216
return implode( '/', $referer );
1217
}
1218
1219
+ /**
1220
+ * bp_core_get_buddypress_themes()
1221
+ *
1222
+ * Gets an array of all the BuddyPress themes in the /bp-themes/ directory.
1223
+ *
1224
+ * @package BuddyPress Core
1225
+ * @uses get_themes()
1226
+ * @return An array containing all of the themes.
1227
+ */
1228
+ function bp_core_get_buddypress_themes() {
1229
+ add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
1230
$themes = get_themes();
1231
1232
if ( $themes ) {
1244
1245
return $member_themes;
1246
}
1247
+ function bp_core_get_member_themes() { return bp_core_get_buddypress_themes(); } // DEPRECATED
1248
+
1249
+
1250
+ /**
1251
+ * bp_get_buddypress_theme_uri()
1252
+ *
1253
+ * Get the url of the selected BuddyPress theme.
1254
+ *
1255
+ * @package BuddyPress Core
1256
+ */
1257
+ function bp_get_buddypress_theme_uri() {
1258
+ return apply_filters( 'bp_get_buddypress_theme_uri', WP_CONTENT_URL . '/bp-themes/' . get_site_option( 'active-member-theme' ) );
1259
+ }
1260
+
1261
+
1262
+ /**
1263
+ * bp_get_buddypress_theme_path()
1264
+ *
1265
+ * Get the path of the selected BuddyPress theme.
1266
+ *
1267
+ * @package BuddyPress Core
1268
+ */
1269
+ function bp_get_buddypress_theme_path() {
1270
+ return apply_filters( 'bp_get_buddypress_theme_path', WP_CONTENT_DIR . '/bp-themes/' . get_site_option( 'active-member-theme' ) );
1271
+ }
1272
+
1273
1274
+ /**
1275
+ * bp_core_filter_buddypress_theme_root()
1276
+ *
1277
+ * Adds a filter that changes the root path of the theme directory to the bp-themes directory.
1278
+ *
1279
+ * @package BuddyPress Core
1280
+ */
1281
+ function bp_core_filter_buddypress_theme_root() {
1282
+ return apply_filters( 'bp_core_filter_buddypress_theme_root', WP_CONTENT_DIR . "/bp-themes" );
1283
}
1284
1285
+
1286
+ /**
1287
+ * bp_core_filter_buddypress_theme_root_uri()
1288
+ *
1289
+ * Adds a filter that changes the root URI of the theme directory to the bp-themes directory.
1290
+ *
1291
+ * @package BuddyPress Core
1292
+ */
1293
+ function bp_core_filter_buddypress_theme_root_uri() {
1294
+ return apply_filters( 'bp_core_filter_buddypress_theme_root_uri', WP_CONTENT_URL . '/bp-themes' );
1295
}
1296
1297
+
1298
+ /**
1299
+ * bp_core_add_illegal_names()
1300
+ *
1301
+ * Adds illegal names to WP so that root components will not conflict with
1302
+ * blog names on a subdirectory installation.
1303
+ *
1304
+ * For example, it would stop someone creating a blog with the slug "groups".
1305
+ *
1306
+ * @package BuddyPress Core
1307
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
1308
+ */
1309
function bp_core_add_illegal_names() {
1310
global $bp;
1311
1341
}
1342
add_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' );
1343
1344
+
1345
/**
1346
* bp_core_email_from_name_filter()
1347
*
1358
add_filter( 'wp_mail_from', 'bp_core_email_from_address_filter' );
1359
1360
1361
+ /**
1362
+ * bp_core_delete_account()
1363
+ *
1364
+ * Allows a user to completely remove their account from the system
1365
+ *
1366
+ * @package BuddyPress Core
1367
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
1368
+ * @uses check_admin_referer() Checks for a valid security nonce.
1369
+ * @uses is_site_admin() Checks to see if the user is a site administrator.
1370
+ * @uses wpmu_delete_user() Deletes a user from the system.
1371
+ */
1372
function bp_core_delete_account() {
1373
global $bp;
1374
1375
// Be careful with this function!
1376
1377
+ if ( !check_admin_referer( 'delete-account' ) )
1378
+ return false;
1379
+
1380
+ /* Site admins should not be allowed to delete their accounts */
1381
+ if ( is_site_admin() )
1382
+ return false;
1383
+
1384
require_once( ABSPATH . '/wp-admin/includes/mu.php' );
1385
require_once( ABSPATH . '/wp-admin/includes/user.php' );
1386
1387
return wpmu_delete_user( $bp->loggedin_user->id );
1388
}
1389
1390
+
1391
+ /**
1392
+ * bp_core_search_site()
1393
+ *
1394
+ * A javascript free implementation of the search functions in BuddyPress
1395
+ *
1396
+ * @package BuddyPress Core
1397
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
1398
+ * @param $slug The slug to redirect to for searching.
1399
+ */
1400
+ function bp_core_action_search_site( $slug = false ) {
1401
global $bp;
1402
+
1403
if ( $bp->current_component == BP_SEARCH_SLUG ) {
1404
$search_terms = $_POST['search-terms'];
1405
$search_which = $_POST['search-which'];
1406
1407
+ if ( !$slug || empty( $slug ) ) {
1408
+ switch ( $search_which ) {
1409
+ case 'members': default:
1410
+ $slug = BP_MEMBERS_SLUG;
1411
+ break;
1412
+ case 'groups':
1413
+ $slug = BP_GROUPS_SLUG;
1414
+ break;
1415
+ case 'blogs':
1416
+ $slug = BP_BLOGS_SLUG;
1417
+ break;
1418
+ }
1419
}
1420
+
1421
+ $search_url = apply_filters( 'bp_core_search_site', site_url( $slug . '/?s=' . urlencode($search_terms) ), $search_terms );
1422
1423
bp_core_redirect( $search_url );
1424
}
1425
}
1426
+ add_action( 'init', 'bp_core_action_search_site', 5 );
1427
+
1428
1429
/**
1430
* bp_core_ucfirst()
1431
*
1432
+ * Localization safe ucfirst() support.
1433
*
1434
* @package BuddyPress Core
1435
*/
1442
}
1443
}
1444
1445
+
1446
/**
1447
* bp_core_strip_username_spaces()
1448
*
1455
}
1456
add_action( 'pre_user_login', 'bp_core_strip_username_spaces' );
1457
1458
+
1459
/**
1460
* bp_core_clear_cache()
1461
* REQUIRES WP-SUPER-CACHE
1475
}
1476
}
1477
1478
+ /**
1479
+ * bp_core_print_generation_time()
1480
+ *
1481
+ * Prints the generation time in the footer of the site.
1482
+ *
1483
+ * @package BuddyPress Core
1484
+ */
1485
function bp_core_print_generation_time() {
1486
global $wpdb;
1487
?>
1510
add_action( 'wpmu_delete_user', 'bp_core_remove_data', 1 );
1511
add_action( 'delete_user', 'bp_core_remove_data', 1 );
1512
1513
+
1514
+ /**
1515
+ * bp_core_clear_user_object_cache()
1516
+ *
1517
+ * Clears all cached objects for a user, or a user is part of.
1518
+ *
1519
+ * @package BuddyPress Core
1520
+ */
1521
function bp_core_clear_user_object_cache( $user_id ) {
1522
wp_cache_delete( 'bp_user_' . $user_id, 'bp' );
1523
wp_cache_delete( 'bp_core_avatar_v1_u' . $user_id, 'bp' );
bp-core/bp-core-admin.php CHANGED
@@ -37,7 +37,7 @@ function bp_core_admin_settings() {
37
</div>
38
<?php endif; ?>
39
40
- <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" id="bp-admin-form">
41
42
<table class="form-table">
43
<tbody>
@@ -88,7 +88,7 @@ function bp_core_admin_settings() {
88
<tr>
89
<th scope="row"><?php _e('Select theme to use for BuddyPress generated pages', 'buddypress' ) ?>:</th>
90
<td>
91
- <?php $themes = bp_core_get_member_themes() ?>
92
<?php if ( $themes ) : ?>
93
<select name="bp-admin[active-member-theme]" id="active-member-theme">
94
<?php
@@ -169,7 +169,7 @@ function bp_core_admin_component_setup() {
169
</div>
170
<?php endif; ?>
171
172
- <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" id="bp-admin-component-form">
173
174
<p>
175
<?php _e(
37
</div>
38
<?php endif; ?>
39
40
+ <form action="" method="post" id="bp-admin-form">
41
42
<table class="form-table">
43
<tbody>
88
<tr>
89
<th scope="row"><?php _e('Select theme to use for BuddyPress generated pages', 'buddypress' ) ?>:</th>
90
<td>
91
+ <?php $themes = bp_core_get_buddypress_themes() ?>
92
<?php if ( $themes ) : ?>
93
<select name="bp-admin[active-member-theme]" id="active-member-theme">
94
<?php
169
</div>
170
<?php endif; ?>
171
172
+ <form action="" method="post" id="bp-admin-component-form">
173
174
<p>
175
<?php _e(
bp-core/bp-core-adminbar.php CHANGED
@@ -249,10 +249,10 @@ function bp_adminbar_random_menu() {
249
<li class="align-right" id="bp-adminbar-visitrandom-menu">
250
<a href="#"><?php _e( 'Visit', 'buddypress' ) ?></a>
251
<ul class="random-list">
252
- <li><a href="<?php echo $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/?random' ?>"><?php _e( 'Random Member', 'buddypress' ) ?></a></li>
253
254
<?php if ( function_exists('groups_install') ) : ?>
255
- <li class="alt"><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug . '/?random' ?>"><?php _e( 'Random Group', 'buddypress' ) ?></a></li>
256
<?php endif; ?>
257
258
<?php if ( function_exists('bp_blogs_install') ) : ?>
249
<li class="align-right" id="bp-adminbar-visitrandom-menu">
250
<a href="#"><?php _e( 'Visit', 'buddypress' ) ?></a>
251
<ul class="random-list">
252
+ <li><a href="<?php echo $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/?random-member' ?>"><?php _e( 'Random Member', 'buddypress' ) ?></a></li>
253
254
<?php if ( function_exists('groups_install') ) : ?>
255
+ <li class="alt"><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug . '/?random-group' ?>"><?php _e( 'Random Group', 'buddypress' ) ?></a></li>
256
<?php endif; ?>
257
258
<?php if ( function_exists('bp_blogs_install') ) : ?>
bp-core/bp-core-ajax-handler.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
- define('DOING_AJAX', true);
3
- require_once( preg_replace('%(.*)[/\\\\]wp-content[/\\\\].*%', '\1', $_SERVER['SCRIPT_FILENAME'] ) . '/wp-load.php' );
4
-
5
- wp();
6
-
7
- do_action( 'wp_ajax_' . $_POST['action'] );
8
-
9
- /* Head shot! */
10
- die('0');
11
- ?>
bp-core/bp-core-ajax.php CHANGED
@@ -1,5 +1,10 @@
1
<?php
2
3
function bp_core_ajax_widget_members() {
4
global $bp;
5
1
<?php
2
3
+ function bp_core_add_ajax_hook() {
4
+ do_action( 'wp_ajax_' . $_REQUEST['action'] );
5
+ }
6
+ add_action( 'init', 'bp_core_add_ajax_hook' );
7
+
8
function bp_core_ajax_widget_members() {
9
global $bp;
10
bp-core/bp-core-avatars.php CHANGED
@@ -45,7 +45,7 @@ function bp_core_get_avatar( $user, $version = 1, $width = null, $height = null,
45
if ( $no_tag )
46
return $url;
47
else
48
- return apply_filters( 'bp_core_get_avatar', '<img src="' . $url . '" alt="" class="avatar photo" width="' . $width . '" height="' . $height . '" />', $user, $version, $width, $height, $no_tag );
49
} else {
50
$ud = get_userdata($user);
51
@@ -61,7 +61,7 @@ function bp_core_get_avatar( $user, $version = 1, $width = null, $height = null,
61
if ( $no_tag )
62
return apply_filters( 'bp_core_get_avatar', $gravatar . constant('CORE_AVATAR_V' . $version . '_W'), $user, $version, $width, $height, $no_tag );
63
else
64
- return apply_filters( 'bp_core_get_avatar', '<img src="' . $gravatar . constant('CORE_AVATAR_V' . $version . '_W') . '" alt="" class="avatar" width="' . $width . '" height="' . $height . '" />', $user, $version, $width, $height, $no_tag );
65
}
66
}
67
45
if ( $no_tag )
46
return $url;
47
else
48
+ return apply_filters( 'bp_core_get_avatar', '<img src="' . attribute_escape( $url ) . '" alt="" class="avatar photo" width="' . attribute_escape( $width ) . '" height="' . attribute_escape( $height ) . '" />', $user, $version, $width, $height, $no_tag );
49
} else {
50
$ud = get_userdata($user);
51
61
if ( $no_tag )
62
return apply_filters( 'bp_core_get_avatar', $gravatar . constant('CORE_AVATAR_V' . $version . '_W'), $user, $version, $width, $height, $no_tag );
63
else
64
+ return apply_filters( 'bp_core_get_avatar', '<img src="' . attribute_escape( $gravatar ) . constant('CORE_AVATAR_V' . $version . '_W') . '" alt="" class="avatar" width="' . attribute_escape( $width ) . '" height="' . attribute_escape( $height ) . '" />', $user, $version, $width, $height, $no_tag );
65
}
66
}
67
bp-core/bp-core-catchuri.php CHANGED
@@ -32,11 +32,13 @@ function bp_core_set_uri_globals() {
32
global $bp_unfiltered_uri;
33
global $bp, $current_blog;
34
35
- /* Only catch URI's on the root blog */
36
- if ( BP_ROOT_BLOG != (int) $current_blog->blog_id )
37
- return false;
38
39
- if ( strpos( $_SERVER['REQUEST_URI'], 'bp-core-ajax-handler.php' ) )
40
$path = bp_core_referrer();
41
else
42
$path = clean_url( $_SERVER['REQUEST_URI'] );
@@ -51,6 +53,13 @@ function bp_core_set_uri_globals() {
51
/* Fetch the current URI and explode each part seperated by '/' into an array */
52
$bp_uri = explode( "/", $path );
53
54
/* Take empties off the end of complete URI */
55
if ( empty( $bp_uri[count($bp_uri) - 1] ) )
56
array_pop( $bp_uri );
@@ -93,7 +102,7 @@ function bp_core_set_uri_globals() {
93
$bp_unfiltered_uri = $bp_uri;
94
95
/* Catch a member page and set the current member ID */
96
- if ( $bp_uri[0] == BP_MEMBERS_SLUG || in_array( 'bp-core-ajax-handler.php', $bp_uri ) ) {
97
$is_member_page = true;
98
$is_root_component = true;
99
@@ -262,7 +271,7 @@ function bp_core_catch_profile_uri() {
262
263
function bp_core_force_buddypress_theme( $template ) {
264
global $is_member_page, $bp;
265
-
266
$member_theme = get_site_option( 'active-member-theme' );
267
268
if ( empty( $member_theme ) )
@@ -270,8 +279,8 @@ function bp_core_force_buddypress_theme( $template ) {
270
271
if ( $is_member_page ) {
272
273
- add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
274
- add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
275
276
return $member_theme;
277
} else {
@@ -289,8 +298,8 @@ function bp_core_force_buddypress_stylesheet( $stylesheet ) {
289
$member_theme = 'bpmember';
290
291
if ( $is_member_page ) {
292
- add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
293
- add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
294
295
return $member_theme;
296
} else {
32
global $bp_unfiltered_uri;
33
global $bp, $current_blog;
34
35
+ if ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) {
36
+ /* Only catch URI's on the root blog if we are not running BP on multiple blogs */
37
+ if ( BP_ROOT_BLOG != (int) $current_blog->blog_id )
38
+ return false;
39
+ }
40
41
+ if ( strpos( $_SERVER['REQUEST_URI'], 'wp-load.php' ) )
42
$path = bp_core_referrer();
43
else
44
$path = clean_url( $_SERVER['REQUEST_URI'] );
53
/* Fetch the current URI and explode each part seperated by '/' into an array */
54
$bp_uri = explode( "/", $path );
55
56
+ if ( defined( 'BP_ENABLE_MULTIBLOG' ) ) {
57
+ /* If we are running BuddyPress on any blog, not just a root blog, we need to first
58
+ shift off the blog name if we are running a subdirectory install of WPMU. */
59
+ if ( $current_blog->path != '/' )
60
+ array_shift( $bp_uri );
61
+ }
62
+
63
/* Take empties off the end of complete URI */
64
if ( empty( $bp_uri[count($bp_uri) - 1] ) )
65
array_pop( $bp_uri );
102
$bp_unfiltered_uri = $bp_uri;
103
104
/* Catch a member page and set the current member ID */
105
+ if ( $bp_uri[0] == BP_MEMBERS_SLUG || in_array( 'wp-load.php', $bp_uri ) ) {
106
$is_member_page = true;
107
$is_root_component = true;
108
271
272
function bp_core_force_buddypress_theme( $template ) {
273
global $is_member_page, $bp;
274
+
275
$member_theme = get_site_option( 'active-member-theme' );
276
277
if ( empty( $member_theme ) )
279
280
if ( $is_member_page ) {
281
282
+ add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
283
+ add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );
284
285
return $member_theme;
286
} else {
298
$member_theme = 'bpmember';
299
300
if ( $is_member_page ) {
301
+ add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
302
+ add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );
303
304
return $member_theme;
305
} else {
bp-core/bp-core-classes.php CHANGED
@@ -62,7 +62,7 @@ class BP_Core_User {
62
$this->user_url = bp_core_get_userurl( $this->id );
63
$this->user_link = bp_core_get_userlink( $this->id );
64
65
- $this->fullname = bp_fetch_user_fullname( $this->id, false );
66
$this->email = bp_core_get_user_email( $this->id );
67
$this->last_active = bp_core_get_last_activity( get_usermeta( $this->id, 'last_activity' ), __( 'active %s ago', 'buddypress' ) );
68
62
$this->user_url = bp_core_get_userurl( $this->id );
63
$this->user_link = bp_core_get_userlink( $this->id );
64
65
+ $this->fullname = bp_core_get_user_displayname( $this->id );
66
$this->email = bp_core_get_user_email( $this->id );
67
$this->last_active = bp_core_get_last_activity( get_usermeta( $this->id, 'last_activity' ), __( 'active %s ago', 'buddypress' ) );
68
bp-core/bp-core-cssjs.php CHANGED
@@ -25,8 +25,10 @@ add_action( 'admin_menu', 'bp_core_add_js' );
25
* @uses get_option() Selects a site setting from the DB.
26
*/
27
function bp_core_add_ajax_js() {
28
echo
29
- '<script type="text/javascript">var ajaxurl = "' . BP_PLUGIN_URL . '/bp-core/bp-core-ajax-handler.php";</script>
30
';
31
}
32
add_action( 'wp_head', 'bp_core_add_ajax_js' );
25
* @uses get_option() Selects a site setting from the DB.
26
*/
27
function bp_core_add_ajax_js() {
28
+ global $bp;
29
+
30
echo
31
+ '<script type="text/javascript">var ajaxurl = "' . $bp->root_domain . str_replace( 'index.php', 'wp-load.php', $_SERVER['SCRIPT_NAME'] ) . '";</script>
32
';
33
}
34
add_action( 'wp_head', 'bp_core_add_ajax_js' );
bp-core/bp-core-settings.php CHANGED
@@ -8,7 +8,9 @@ function bp_core_add_settings_nav() {
8
9
bp_core_add_subnav_item( 'settings', 'general', __('General', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_general_settings', false, bp_is_home() );
10
bp_core_add_subnav_item( 'settings', 'notifications', __('Notifications', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_notification_settings', false, bp_is_home() );
11
- bp_core_add_subnav_item( 'settings', 'delete-account', __('Delete Account', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_delete_account', false, bp_is_home() );
12
}
13
add_action( 'wp', 'bp_core_add_settings_nav', 2 );
14
add_action( 'admin_menu', 'bp_core_add_settings_nav', 2 );
@@ -73,7 +75,7 @@ function bp_core_screen_general_settings_content() {
73
74
<form action="<?php echo $bp->loggedin_user->domain . 'settings/general' ?>" method="post" id="settings-form">
75
<label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label>
76
- <input type="text" name="email" id="email" value="<?php echo $current_user->user_email ?>" class="settings-input" />
77
78
<label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ) ?></label>
79
<input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'New Password', 'buddypress' ) ?>
8
9
bp_core_add_subnav_item( 'settings', 'general', __('General', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_general_settings', false, bp_is_home() );
10
bp_core_add_subnav_item( 'settings', 'notifications', __('Notifications', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_notification_settings', false, bp_is_home() );
11
+
12
+ if ( !is_site_admin() )
13
+ bp_core_add_subnav_item( 'settings', 'delete-account', __('Delete Account', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_delete_account', false, bp_is_home() );
14
}
15
add_action( 'wp', 'bp_core_add_settings_nav', 2 );
16
add_action( 'admin_menu', 'bp_core_add_settings_nav', 2 );
75
76
<form action="<?php echo $bp->loggedin_user->domain . 'settings/general' ?>" method="post" id="settings-form">
77
<label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label>
78
+ <input type="text" name="email" id="email" value="<?php echo attribute_escape( $current_user->user_email ); ?>" class="settings-input" />
79
80
<label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ) ?></label>
81
<input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'New Password', 'buddypress' ) ?>
bp-core/bp-core-templatetags.php CHANGED
@@ -176,7 +176,7 @@ function bp_get_options_title() {
176
if ( empty( $bp->bp_options_title ) )
177
$bp->bp_options_title = __( 'Options', 'buddypress' );
178
179
- echo apply_filters( 'bp_get_options_avatar', $bp->bp_options_title );
180
}
181
182
function bp_comment_author_avatar() {
@@ -230,34 +230,12 @@ function bp_is_home() {
230
return false;
231
}
232
233
function bp_fetch_user_fullname( $user_id, $echo = true ) {
234
- global $bp;
235
-
236
- if ( !$user_id )
237
- return false;
238
-
239
- if ( !$fullname = wp_cache_get( 'bp_user_fullname_' . $user_id, 'bp' ) ) {
240
- if ( function_exists('xprofile_install') ) {
241
- $fullname = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id );
242
-
243
- if ( empty($fullname) || !$fullname ) {
244
- $ud = get_userdata($user_id);
245
- $fullname = $ud->display_name;
246
-
247
- xprofile_set_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id, $fullname );
248
- }
249
- } else {
250
- $ud = get_userdata($user_id);
251
- $fullname = $ud->display_name;
252
- }
253
-
254
- wp_cache_set( 'bp_user_fullname_' . $user_id, $fullname, 'bp' );
255
- }
256
-
257
if ( $echo )
258
- echo apply_filters( 'bp_fetch_user_fullname', stripslashes( trim( $fullname ) ) );
259
else
260
- return apply_filters( 'bp_fetch_user_fullname', stripslashes ( trim ( $fullname ) ) );
261
}
262
263
function bp_last_activity( $user_id = false, $echo = true ) {
@@ -438,13 +416,10 @@ function bp_your_or_their( $capitalize = true, $echo = true ) {
438
}
439
440
function bp_loggedinuser_link() {
441
- global $bp, $current_user;
442
443
if ( $link = bp_core_get_userlink( $bp->loggedin_user->id ) ) {
444
echo apply_filters( 'bp_loggedinuser_link', $link );
445
- } else {
446
- $ud = get_userdata($displayed_user->id);
447
- echo apply_filters( 'bp_loggedinuser_link', $ud->user_login );
448
}
449
}
450
@@ -466,7 +441,11 @@ function bp_is_blog_page() {
466
}
467
468
function bp_page_title() {
469
- global $bp, $post, $wp_query;
470
471
if ( is_home() && bp_is_page( 'home' ) ) {
472
$title = __( 'Home', 'buddypress' );
@@ -494,8 +473,13 @@ function bp_page_title() {
494
$title = get_the_title($post->ID);
495
}
496
497
- echo apply_filters( 'bp_page_title', get_blog_option( BP_ROOT_BLOG, 'blogname' ) . ' &#8212; ' . $title, $title );
498
499
}
500
501
function bp_styles() {
@@ -1059,9 +1043,15 @@ function bp_directory_members_search_form() {
1059
}
1060
1061
function bp_home_blog_url() {
1062
- global $bp;
1063
1064
- if ( 'bphome' == get_blog_option( BP_ROOT_BLOG, 'template' ) )
1065
echo $bp->root_domain . '/' . BP_HOME_BLOG_SLUG;
1066
else
1067
echo $bp->root_domain;
176
if ( empty( $bp->bp_options_title ) )
177
$bp->bp_options_title = __( 'Options', 'buddypress' );
178
179
+ echo apply_filters( 'bp_get_options_avatar', attribute_escape( $bp->bp_options_title ) );
180
}
181
182
function bp_comment_author_avatar() {
230
return false;
231
}
232
233
+ /* DEPRECATED Use: bp_core_get_user_displayname() */
234
function bp_fetch_user_fullname( $user_id, $echo = true ) {
235
if ( $echo )
236
+ echo apply_filters( 'bp_fetch_user_fullname', bp_core_get_user_displayname( $user_id ) );
237
else
238
+ return apply_filters( 'bp_fetch_user_fullname', bp_core_get_user_displayname( $user_id ) );
239
}
240
241
function bp_last_activity( $user_id = false, $echo = true ) {
416
}
417
418
function bp_loggedinuser_link() {
419
+ global $bp;
420
421
if ( $link = bp_core_get_userlink( $bp->loggedin_user->id ) ) {
422
echo apply_filters( 'bp_loggedinuser_link', $link );
423
}
424
}
425
441
}
442
443
function bp_page_title() {
444
+ echo bp_get_page_title();
445
+ }
446
+
447
+ function bp_get_page_title() {
448
+ global $bp, $post, $wp_query, $current_blog;
449
450
if ( is_home() && bp_is_page( 'home' ) ) {
451
$title = __( 'Home', 'buddypress' );
473
$title = get_the_title($post->ID);
474
}
475
476
+ if ( defined( 'BP_ENABLE_MULTIBLOG' ) ) {
477
+ $blog_title = get_blog_option( $current_blog->blog_id, 'blogname' );
478
+ } else {
479
+ $blog_title = get_blog_option( BP_ROOT_BLOG, 'blogname' );
480
+ }
481
482
+ return apply_filters( 'bp_page_title', $blog_title . ' &#8212; ' . attribute_escape( $title ), attribute_escape( $title ) );
483
}
484
485
function bp_styles() {
1043
}
1044
1045
function bp_home_blog_url() {
1046
+ global $bp, $current_blog;
1047
+
1048
+ if ( defined( 'BP_ENABLE_MULTIBLOG' ) ) {
1049
+ $blog_id = $current_blog->blog_id;
1050
+ } else {
1051
+ $blog_id = BP_ROOT_BLOG;
1052
+ }
1053
1054
+ if ( 'bphome' == get_blog_option( $blog_id, 'template' ) )
1055
echo $bp->root_domain . '/' . BP_HOME_BLOG_SLUG;
1056
else
1057
echo $bp->root_domain;
bp-core/bp-core-widgets.php CHANGED
@@ -38,8 +38,8 @@ function bp_core_widget_welcome($args) {
38
. $widget_name
39
. $after_title; ?>
40
41
- <?php if ( $options['title'] ) : ?><h3><?php echo $options['title'] ?></h3><?php endif; ?>
42
- <?php if ( $options['text'] ) : ?><p><?php echo $options['text'] ?></p><?php endif; ?>
43
44
<?php if ( !is_user_logged_in() ) { ?>
45
<div class="create-account"><div class="visit generic-button"><a href="<?php bp_signup_page() ?>" title="<?php _e('Create Account', 'buddypress') ?>"><?php _e('Create Account', 'buddypress') ?></a></div></div>
@@ -63,14 +63,12 @@ function bp_core_widget_welcome_control() {
63
$options = $newoptions;
64
update_blog_option( $current_blog->blog_id, 'bp_core_widget_welcome', $options );
65
}
66
-
67
- $title = attribute_escape( $options['title'] );
68
- $text = attribute_escape( $options['text'] );
69
?>
70
- <p><label for="bp-widget-welcome-title"><?php _e('Title:', 'buddypress'); ?> <input class="widefat" id="bp-widget-welcome-title" name="bp-widget-welcome-title" type="text" value="<?php echo $title; ?>" /></label></p>
71
<p>
72
<label for="bp-widget-welcome-text"><?php _e( 'Welcome Text:' , 'buddypress'); ?>
73
- <textarea id="bp-widget-welcome-text" name="bp-widget-welcome-text" class="widefat" style="height: 100px"><?php echo $text; ?></textarea>
74
</label>
75
</p>
76
<input type="hidden" id="bp-widget-welcome-submit" name="bp-widget-welcome-submit" value="1" />
@@ -90,7 +88,10 @@ function bp_core_widget_members($args) {
90
. $widget_name
91
. $after_title; ?>
92
93
- <?php
94
if ( !$users = wp_cache_get( 'newest_users', 'bp' ) ) {
95
$users = BP_Core_User::get_newest_users( $options['max_members'] );
96
wp_cache_set( 'newest_users', $users, 'bp' );
@@ -125,7 +126,7 @@ function bp_core_widget_members($args) {
125
wp_nonce_field( 'bp_core_widget_members', '_wpnonce-members' );
126
?>
127
128
- <input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo $options['max_members'] ?>" />
129
130
<?php else: ?>
131
<div class="widget-error">
@@ -153,7 +154,7 @@ function bp_core_widget_members_control() {
153
154
$max_members = attribute_escape( $options['max_members'] );
155
?>
156
- <p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="bp-core-widget-members-max" name="bp-core-widget-members-max" type="text" value="<?php echo $max_members; ?>" style="width: 30%" /></label></p>
157
<input type="hidden" id="bp-core-widget-members-submit" name="bp-core-widget-members-submit" value="1" />
158
<?php
159
}
@@ -171,7 +172,10 @@ function bp_core_widget_whos_online($args) {
171
. $widget_name
172
. $after_title; ?>
173
174
- <?php
175
if ( !$users = wp_cache_get( 'online_users', 'bp' ) ) {
176
$users = BP_Core_User::get_online_users( $options['max_members'] );
177
wp_cache_set( 'online_users', $users, 'bp' );
@@ -184,7 +188,7 @@ function bp_core_widget_whos_online($args) {
184
<div class="avatar-block">
185
<?php foreach ( (array) $users['users'] as $user ) : ?>
186
<div class="item-avatar">
187
- <a href="<?php echo bp_core_get_userurl($user->user_id) ?>" title="<?php bp_fetch_user_fullname( $user->user_id, true ) ?>"><?php echo bp_core_get_avatar( $user->user_id, 1 ) ?></a>
188
</div>
189
<?php endforeach; ?>
190
</div>
@@ -194,7 +198,7 @@ function bp_core_widget_whos_online($args) {
194
wp_nonce_field( 'bp_core_widget_members', '_wpnonce-members' );
195
?>
196
197
- <input type="hidden" name="bp_core_widget_members_max" id="bp_core_widget_members_max" value="<?php echo $options['max_members'] ?>" />
198
199
<?php else: ?>
200
<div class="widget-error">
@@ -222,10 +226,9 @@ function bp_core_widget_whos_online_control() {
222
$options = $newoptions;
223
update_blog_option( $current_blog->blog_id, 'bp_core_widget_whos_online', $options );
224
}
225
-
226
- $max_members = attribute_escape( $options['max_members'] );
227
?>
228
- <p><label for="bp-widget-whos-online-max-members"><?php _e('Maximum number of members to show:', 'buddypress'); ?><br /><input class="widefat" id="bp-widget-whos-online-max-members" name="bp-widget-whos-online-max-members" type="text" value="<?php echo $max_members; ?>" style="width: 30%" /></label></p>
229
<input type="hidden" id="bp-widget-whos-online-submit" name="bp-widget-whos-online-submit" value="1" />
230
<?php
231
}
38
. $widget_name
39
. $after_title; ?>
40
41
+ <?php if ( $options['title'] ) : ?><h3><?php echo attribute_escape( $options['title'] ) ?></h3><?php endif; ?>
42
+ <?php if ( $options['text'] ) : ?><p><?php echo attribute_escape( $options['text'] ) ?></p><?php endif; ?>
43
44
<?php if ( !is_user_logged_in() ) { ?>
45
<div class="create-account"><div class="visit generic-button"><a href="<?php bp_signup_page() ?>" title="<?php _e('Create Account', 'buddypress') ?>"><?php _e('Create Account', 'buddypress') ?></a></div></div>
63
$options = $newoptions;
64
update_blog_option( $current_blog->blog_id, 'bp_core_widget_welcome', $options );
65
}
66
+
67
?>
68
+ <p><label for="bp-widget-welcome-title"><?php _e('Title:', 'buddypress'); ?> <input class="widefat" id="bp-widget-welcome-title" name="bp-widget-welcome-title" type="text" value="<?php echo attribute_escape( $options['title'] ); ?>" /></label></p>
69
<p>
70
<label for="bp-widget-welcome-text"><?php _e( 'Welcome Text:' , 'buddypress'); ?>
71
+ <textarea id="bp-widget-welcome-text" name="bp-widget-welcome-text" class="widefat" style="height: 100px"><?php echo htmlspecialchars( $options['text'] ); ?></textarea>
72
</label>
73
</p>
74
<input type="hidden" id="bp-widget-welcome-submit" name="bp-widget-welcome-submit" value="1" />
88
. $widget_name
89
. $after_title; ?>
90
91
+ <?php
92
+ if ( empty( $options['max_members'] ) || !$options['max_members'] )
93
+ $options['max_members'] = 5;
94
+
95
if ( !$users = wp_cache_get( 'newest_users', 'bp' ) ) {
96
$users = BP_Core_User::get_newest_users( $options['max_members'] );
97
wp_cache_set( 'newest_users', $users, 'bp' );
126
wp_nonce_field( 'bp_core_widget_members', '_wpnonce-members' );
127
?>
128
129
+ <input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo attribute_escape( $options['max_members'] ); ?>" />
130
131
<?php else: ?>
132
<div class="widget-error">
154
155
$max_members = attribute_escape( $options['max_members'] );
156
?>
157
+ <p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="bp-core-widget-members-max" name="bp-core-widget-members-max" type="text" value="<?php echo attribute_escape( $options['max_members'] ); ?>" style="width: 30%" /></label></p>
158
<input type="hidden" id="bp-core-widget-members-submit" name="bp-core-widget-members-submit" value="1" />
159
<?php
160
}
172
. $widget_name
173
. $after_title; ?>
174
175
+ <?php
176
+ if ( empty( $options['max_members'] ) || !$options['max_members'] )
177
+ $options['max_members'] = 5;
178
+
179
if ( !$users = wp_cache_get( 'online_users', 'bp' ) ) {
180
$users = BP_Core_User::get_online_users( $options['max_members'] );
181
wp_cache_set( 'online_users', $users, 'bp' );
188
<div class="avatar-block">
189
<?php foreach ( (array) $users['users'] as $user ) : ?>
190
<div class="item-avatar">
191
+ <a href="<?php echo bp_core_get_userurl($user->user_id) ?>" title="<?php echo bp_core_get_user_displayname( $user->user_id ) ?>"><?php echo bp_core_get_avatar( $user->user_id, 1 ) ?></a>
192
</div>
193
<?php endforeach; ?>
194
</div>
198
wp_nonce_field( 'bp_core_widget_members', '_wpnonce-members' );
199
?>
200
201
+ <input type="hidden" name="bp_core_widget_members_max" id="bp_core_widget_members_max" value="<?php echo attribute_escape( $options['max_members'] ); ?>" />
202
203
<?php else: ?>
204
<div class="widget-error">
226
$options = $newoptions;
227
update_blog_option( $current_blog->blog_id, 'bp_core_widget_whos_online', $options );
228
}
229
+
230
?>
231
+ <p><label for="bp-widget-whos-online-max-members"><?php _e('Maximum number of members to show:', 'buddypress'); ?><br /><input class="widefat" id="bp-widget-whos-online-max-members" name="bp-widget-whos-online-max-members" type="text" value="<?php echo attribute_escape( $options['max_members'] ); ?>" style="width: 30%" /></label></p>
232
<input type="hidden" id="bp-widget-whos-online-submit" name="bp-widget-whos-online-submit" value="1" />
233
<?php
234
}
bp-forums.php CHANGED
@@ -1,7 +1,5 @@
1
<?php
2
3
- define ( 'BP_FORUMS_VERSION', '1.0' );
4
-
5
/* Define the parent forum ID */
6
if ( !defined( 'BP_FORUMS_PARENT_FORUM_ID' ) )
7
define ( 'BP_FORUMS_PARENT_FORUM_ID', 1 );
@@ -11,7 +9,7 @@ require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-templatetags.php' );
11
require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-filters.php' );
12
13
if ( is_admin() )
14
- require ( 'bp-forums/bp-forums-admin.php' );
15
16
function bp_forums_setup() {
17
global $bp, $bbpress_live;
1
<?php
2
3
/* Define the parent forum ID */
4
if ( !defined( 'BP_FORUMS_PARENT_FORUM_ID' ) )
5
define ( 'BP_FORUMS_PARENT_FORUM_ID', 1 );
9
require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-filters.php' );
10
11
if ( is_admin() )
12
+ require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-admin.php' );
13
14
function bp_forums_setup() {
15
global $bp, $bbpress_live;
bp-friends.php CHANGED
@@ -1,6 +1,5 @@
1
<?php
2
3
- define ( 'BP_FRIENDS_VERSION', '1.0' );
4
define ( 'BP_FRIENDS_DB_VERSION', '1300' );
5
6
/* Define the slug for the component */
@@ -181,6 +180,85 @@ function friends_screen_notification_settings() {
181
add_action( 'bp_notification_settings', 'friends_screen_notification_settings' );
182
183
184
/**************************************************************************
185
friends_record_activity()
186
@@ -256,7 +334,7 @@ function friends_format_notifications( $action, $item_id, $secondary_item_id, $t
256
if ( (int)$total_items > 1 ) {
257
return apply_filters( 'bp_friends_multiple_friendship_accepted_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/my-friends/newest" title="' . __( 'My Friends', 'buddypress' ) . '">' . sprintf( __('%d friends accepted your friendship requests', 'buddypress' ), (int)$total_items ) . '</a>', (int)$total_items );
258
} else {
259
- $user_fullname = bp_core_global_user_fullname( $item_id );
260
$user_url = bp_core_get_userurl( $item_id );
261
return apply_filters( 'bp_friends_single_friendship_accepted_notification', '<a href="' . $user_url . '?new" title="' . $user_fullname .'\'s profile">' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
262
}
@@ -266,7 +344,7 @@ function friends_format_notifications( $action, $item_id, $secondary_item_id, $t
266
if ( (int)$total_items > 1 ) {
267
return apply_filters( 'bp_friends_multiple_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have %d pending friendship requests', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
268
} else {
269
- $user_fullname = bp_core_global_user_fullname( $item_id );
270
$user_url = bp_core_get_userurl( $item_id );
271
return apply_filters( 'bp_friends_single_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have a friendship request from %s', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
272
}
@@ -392,7 +470,7 @@ function friends_get_friends_list( $user_id ) {
392
393
for ( $i = 0; $i < count($friend_ids); $i++ ) {
394
if ( function_exists('bp_user_fullname') )
395
- $display_name = bp_fetch_user_fullname($friend_ids[$i], false);
396
397
if ( $display_name != ' ' ) {
398
$friends[] = array(
@@ -430,7 +508,7 @@ function friends_get_friends_invite_list( $user_id = false, $group_id ) {
430
if ( groups_check_user_has_invite( $friend_ids['friends'][$i]->user_id, $group_id ) || groups_is_user_member( $friend_ids['friends'][$i]->user_id, $group_id ) )
431
continue;
432
433
- $display_name = bp_fetch_user_fullname($friend_ids['friends'][$i]->user_id, false);
434
435
if ( $display_name != ' ' ) {
436
$friends[] = array(
@@ -548,7 +626,7 @@ function friends_remove_friend( $initiator_userid, $friend_userid ) {
548
$friendship = new BP_Friends_Friendship( $friendship_id );
549
550
// Remove the activity stream items
551
- friends_delete_activity( array( 'item_id' => $friendship_id, 'component_name' => 'friends', 'component_action' => 'friendship_accepted', 'user_id' => $bp->displayed_user->id ) );
552
553
do_action( 'friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid );
554
@@ -562,6 +640,8 @@ function friends_remove_friend( $initiator_userid, $friend_userid ) {
562
}
563
564
function friends_accept_friendship( $friendship_id ) {
565
/* Check the nonce */
566
if ( !check_admin_referer( 'friends_accept_friendship' ) )
567
return false;
@@ -578,7 +658,7 @@ function friends_accept_friendship( $friendship_id ) {
578
bp_core_add_notification( $friendship->friend_user_id, $friendship->initiator_user_id, 'friends', 'friendship_accepted' );
579
580
// Record in activity streams
581
- friends_record_activity( array( 'item_id' => $friendship_id, 'component_name' => 'friends', 'component_action' => 'friendship_accepted', 'is_private' => 0, 'user_id' => $friendship->initiator_user_id, 'secondary_user_id' => $friendship->friend_user_id ) );
582
583
// Send the email notification
584
require_once( BP_PLUGIN_DIR . '/bp-friends/bp-friends-notifications.php' );
1
<?php
2
3
define ( 'BP_FRIENDS_DB_VERSION', '1300' );
4
5
/* Define the slug for the component */
180
add_action( 'bp_notification_settings', 'friends_screen_notification_settings' );
181
182
183
+ /***** Actions **********/
184
+
185
+ function friends_action_add_friend() {
186
+ global $bp;
187
+
188
+ if ( $bp->current_component != $bp->friends->slug || $bp->current_action != 'add-friend' )
189
+ return false;
190
+
191
+ $potential_friend_id = $bp->action_variables[0];
192
+
193
+ if ( !is_numeric( $potential_friend_id ) || !isset( $potential_friend_id ) )
194
+ return false;
195
+
196
+ if ( $potential_friend_id == $bp->loggedin_user->id )
197
+ return false;
198
+
199
+ $friendship_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id );
200
+
201
+ if ( 'not_friends' == $friendship_status ) {
202
+
203
+ if ( !check_admin_referer( 'friends_add_friend' ) )
204
+ return false;
205
+
206
+ if ( !friends_add_friend( $bp->loggedin_user->id, $potential_friend_id ) ) {
207
+ bp_core_add_message( __( 'Friendship could not be requested.', 'buddypress' ), 'error' );
208
+ } else {
209
+ bp_core_add_message( __( 'Friendship requested', 'buddypress' ) );
210
+ }
211
+ } else if ( 'is_friend' == $friendship_status ) {
212
+ bp_core_add_message( __( 'You are already friends with this user', 'buddypress' ), 'error' );
213
+ } else {
214
+ bp_core_add_message( __( 'You already have a pending friendship request with this user', 'buddypress' ), 'error' );
215
+ }
216
+
217
+ bp_core_redirect( $_SERVER['HTTP_REFERER'] );
218
+
219
+ return false;
220
+ }
221
+ add_action( 'init', 'friends_action_add_friend' );
222
+
223
+ function friends_action_remove_friend() {
224
+ global $bp;
225
+
226
+ if ( $bp->current_component != $bp->friends->slug || $bp->current_action != 'remove-friend' )
227
+ return false;
228
+
229
+ $potential_friend_id = $bp->action_variables[0];
230
+
231
+ if ( !is_numeric( $potential_friend_id ) || !isset( $potential_friend_id ) )
232
+ return false;
233
+
234
+ if ( $potential_friend_id == $bp->loggedin_user->id )
235
+ return false;
236
+
237
+ $friendship_status = BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $potential_friend_id );
238
+
239
+ if ( 'is_friend' == $friendship_status ) {
240
+
241
+ if ( !check_admin_referer( 'friends_remove_friend' ) )
242
+ return false;
243
+
244
+ if ( !friends_remove_friend( $bp->loggedin_user->id, $potential_friend_id ) ) {
245
+ bp_core_add_message( __( 'Friendship could not be canceled.', 'buddypress' ), 'error' );
246
+ } else {
247
+ bp_core_add_message( __( 'Friendship canceled', 'buddypress' ) );
248
+ }
249
+ } else if ( 'is_friends' == $friendship_status ) {
250
+ bp_core_add_message( __( 'You are not yet friends with this user', 'buddypress' ), 'error' );
251
+ } else {
252
+ bp_core_add_message( __( 'You have a pending friendship request with this user', 'buddypress' ), 'error' );
253
+ }
254
+
255
+ bp_core_redirect( $_SERVER['HTTP_REFERER'] );
256
+
257
+ return false;
258
+ }
259
+ add_action( 'init', 'friends_action_remove_friend' );
260
+
261
+
262
/**************************************************************************
263
friends_record_activity()
264
334
if ( (int)$total_items > 1 ) {
335
return apply_filters( 'bp_friends_multiple_friendship_accepted_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/my-friends/newest" title="' . __( 'My Friends', 'buddypress' ) . '">' . sprintf( __('%d friends accepted your friendship requests', 'buddypress' ), (int)$total_items ) . '</a>', (int)$total_items );
336
} else {
337
+ $user_fullname = bp_core_get_user_displayname( $item_id );
338
$user_url = bp_core_get_userurl( $item_id );
339
return apply_filters( 'bp_friends_single_friendship_accepted_notification', '<a href="' . $user_url . '?new" title="' . $user_fullname .'\'s profile">' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
340
}
344
if ( (int)$total_items > 1 ) {
345
return apply_filters( 'bp_friends_multiple_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have %d pending friendship requests', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );
346
} else {
347
+ $user_fullname = bp_core_get_user_displayname( $item_id );
348
$user_url = bp_core_get_userurl( $item_id );
349
return apply_filters( 'bp_friends_single_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have a friendship request from %s', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
350
}
470
471
for ( $i = 0; $i < count($friend_ids); $i++ ) {
472
if ( function_exists('bp_user_fullname') )
473
+ $display_name = bp_core_get_user_displayname( $friend_ids[$i] );
474
475
if ( $display_name != ' ' ) {
476
$friends[] = array(
508
if ( groups_check_user_has_invite( $friend_ids['friends'][$i]->user_id, $group_id ) || groups_is_user_member( $friend_ids['friends'][$i]->user_id, $group_id ) )
509
continue;
510
511
+ $display_name = bp_core_get_user_displayname( $friend_ids['friends'][$i]->user_id );
512
513
if ( $display_name != ' ' ) {
514
$friends[] = array(
626
$friendship = new BP_Friends_Friendship( $friendship_id );
627
628
// Remove the activity stream items
629
+ friends_delete_activity( array( 'item_id' => $friendship_id, 'component_name' => $bp->friends->slug, 'component_action' => 'friendship_accepted', 'user_id' => $bp->displayed_user->id ) );
630
631
do_action( 'friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid );
632
640
}
641
642
function friends_accept_friendship( $friendship_id ) {
643
+ global $bp;
644
+
645
/* Check the nonce */
646
if ( !check_admin_referer( 'friends_accept_friendship' ) )
647
return false;
658
bp_core_add_notification( $friendship->friend_user_id, $friendship->initiator_user_id, 'friends', 'friendship_accepted' );
659
660
// Record in activity streams
661
+ friends_record_activity( array( 'item_id' => $friendship_id, 'component_name' => $bp->friends->slug, 'component_action' => 'friendship_accepted', 'is_private' => 0, 'user_id' => $friendship->initiator_user_id, 'secondary_user_id' => $friendship->friend_user_id ) );
662
663
// Send the email notification
664
require_once( BP_PLUGIN_DIR . '/bp-friends/bp-friends-notifications.php' );
bp-friends/bp-friends-notifications.php CHANGED
@@ -3,7 +3,7 @@
3
function friends_notification_new_request( $friendship_id, $initiator_id, $friend_id ) {
4
global $bp;
5
6
- $initiator_name = bp_fetch_user_fullname( $initiator_id, false );
7
8
if ( 'no' == get_usermeta( (int)$friend_id, 'notification_friends_friendship_request' ) )
9
return false;
@@ -42,7 +42,7 @@ function friends_notification_accepted_request( $friendship_id, $initiator_id, $
42
43
$friendship = new BP_Friends_Friendship( $friendship_id, false, false );
44
45
- $friend_name = bp_fetch_user_fullname( $friend_id, false );
46
47
if ( 'no' == get_usermeta( (int)$initiator_id, 'notification_friends_friendship_accepted' ) )
48
return false;
3
function friends_notification_new_request( $friendship_id, $initiator_id, $friend_id ) {
4
global $bp;
5
6
+ $initiator_name = bp_core_get_user_displayname( $initiator_id );
7
8
if ( 'no' == get_usermeta( (int)$friend_id, 'notification_friends_friendship_request' ) )
9
return false;
42
43
$friendship = new BP_Friends_Friendship( $friendship_id, false, false );
44
45
+ $friend_name = bp_core_get_user_displayname( $friend_id );
46
47
if ( 'no' == get_usermeta( (int)$initiator_id, 'notification_friends_friendship_accepted' ) )
48
return false;
bp-friends/bp-friends-templatetags.php CHANGED
@@ -304,7 +304,7 @@ function bp_friend_search_form() {
304
<input type="search" name="friend-search-box" id="friend-search-box" value="<?php echo $value ?>"<?php echo $disabled ?> />
305
306
<?php wp_nonce_field( 'friends_search', '_wpnonce_friend_search' ) ?>
307
- <input type="hidden" name="initiator" id="initiator" value="<?php echo $bp->displayed_user->id ?>" />
308
309
</form>
310
<?php
304
<input type="search" name="friend-search-box" id="friend-search-box" value="<?php echo $value ?>"<?php echo $disabled ?> />
305
306
<?php wp_nonce_field( 'friends_search', '_wpnonce_friend_search' ) ?>
307
+ <input type="hidden" name="initiator" id="initiator" value="<?php echo attribute_escape( $bp->displayed_user->id ) ?>" />
308
309
</form>
310
<?php
bp-groups.php CHANGED
@@ -1,6 +1,5 @@
1
<?php
2
3
- define ( 'BP_GROUPS_VERSION', '1.0' );
4
define ( 'BP_GROUPS_DB_VERSION', '1300' );
5
6
/* Define the slug for the component */
@@ -298,7 +297,7 @@ function groups_directory_groups_setup() {
298
bp_core_load_template( apply_filters( 'groups_template_directory_groups', 'directories/groups/index' ) );
299
}
300
}
301
- add_action( 'wp', 'groups_directory_groups_setup', 5 );
302
303
/***** Screens **********/
304
@@ -361,36 +360,42 @@ function groups_screen_create_group() {
361
$create_group_step = 1;
362
$completed_to_step = 0;
363
364
- unset($_SESSION['group_obj_id']);
365
- unset($_SESSION['completed_to_step']);
366
367
$no_instantiate = true;
368
$reset_steps = true;
369
}
370
371
- if ( isset($_SESSION['completed_to_step']) && !$reset_steps ) {
372
- $completed_to_step = $_SESSION['completed_to_step'];
373
}
374
375
if ( isset( $_POST['save'] ) || isset( $_POST['skip'] ) ) {
376
- $group_obj = new BP_Groups_Group( $_SESSION['group_obj_id'] );
377
378
- if ( !$group_id = groups_create_group( $create_group_step, $_SESSION['group_obj_id'] ) ) {
379
bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' );
380
bp_core_redirect( $bp->loggedin_user->domain . $bp->groups->slug . '/create/step/' . $create_group_step );
381
} else {
382
$create_group_step++;
383
$completed_to_step++;
384
- $_SESSION['completed_to_step'] = $completed_to_step;
385
- $_SESSION['group_obj_id'] = $group_id;
386
}
387
388
if ( $completed_to_step == 4 )
389
bp_core_redirect( bp_get_group_permalink( $group_obj ) );
390
}
391
392
- if ( isset($_SESSION['group_obj_id']) && !$group_obj && !$no_instantiate )
393
- $group_obj = new BP_Groups_Group( $_SESSION['group_obj_id'] );
394
395
bp_core_load_template( apply_filters( 'groups_template_create_group', 'groups/create' ) );
396
}
@@ -947,7 +952,7 @@ function groups_record_activity( $args = true ) {
947
948
if ( !$group_obj ) {
949
if ( !$group_obj = wp_cache_get( 'groups_group_nouserdata_' . $item_id, 'bp' ) ) {
950
- $group_obj = new BP_Groups_Group( $group_obj->id, false, false );
951
wp_cache_set( 'groups_group_nouserdata_' . $item_id, $group_obj, 'bp' );
952
}
953
}
@@ -1098,7 +1103,7 @@ function groups_format_notifications( $action, $item_id, $secondary_item_id, $to
1098
if ( (int)$total_items > 1 ) {
1099
return apply_filters( 'bp_groups_multiple_new_membership_requests_notification', '<a href="' . $group_link . '/admin/membership-requests/" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . sprintf( __('%d new membership requests for the group "%s"', 'buddypress' ), (int)$total_items, $group->name ) . '</a>', $group_link, $total_items, $group->name );
1100
} else {
1101
- $user_fullname = bp_core_global_user_fullname( $requesting_user_id );
1102
return apply_filters( 'bp_groups_single_new_membership_request_notification', '<a href="' . $group_link . '/admin/membership-requests/" title="' . $user_fullname .' requests group membership">' . sprintf( __('%s requests membership for the group "%s"', 'buddypress' ), $user_fullname, $group->name ) . '</a>', $group_link, $user_fullname, $group->name );
1103
}
1104
break;
@@ -1585,7 +1590,7 @@ function groups_new_group_forum( $group_id = false, $group_name = false, $group_
1585
}
1586
1587
function groups_new_group_forum_post( $post_text, $topic_id ) {
1588
- global $group_obj;
1589
1590
/* Check the nonce */
1591
if ( !check_admin_referer( 'bp_forums_new_reply' ) )
@@ -1607,7 +1612,7 @@ function groups_new_group_forum_post( $post_text, $topic_id ) {
1607
}
1608
1609
function groups_new_group_forum_topic( $topic_title, $topic_text, $topic_tags, $forum_id ) {
1610
- global $group_obj;
1611
1612
/* Check the nonce */
1613
if ( !check_admin_referer( 'bp_forums_new_topic' ) )
@@ -2095,7 +2100,7 @@ function groups_reject_membership_request( $membership_id ) {
2095
function groups_redirect_to_random_group() {
2096
global $bp, $wpdb;
2097
2098
- if ( $bp->current_component == $bp->groups->slug && isset( $_GET['random'] ) ) {
2099
$group = groups_get_random_group();
2100
2101
bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/' . $group['groups'][0]->slug );
@@ -2276,8 +2281,8 @@ function groups_force_buddypress_theme( $template ) {
2276
if ( empty($member_theme) )
2277
$member_theme = 'bpmember';
2278
2279
- add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
2280
- add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
2281
2282
return $member_theme;
2283
}
@@ -2294,8 +2299,8 @@ function groups_force_buddypress_stylesheet( $stylesheet ) {
2294
if ( empty( $member_theme ) )
2295
$member_theme = 'bpmember';
2296
2297
- add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
2298
- add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
2299
2300
return $member_theme;
2301
}
1
<?php
2
3
define ( 'BP_GROUPS_DB_VERSION', '1300' );
4
5
/* Define the slug for the component */
297
bp_core_load_template( apply_filters( 'groups_template_directory_groups', 'directories/groups/index' ) );
298
}
299
}
300
+ add_action( 'wp', 'groups_directory_groups_setup', 2 );
301
302
/***** Screens **********/
303
360
$create_group_step = 1;
361
$completed_to_step = 0;
362
363
+ setcookie( 'bp_group_obj_id', false, time() - 1000, COOKIEPATH );
364
+ setcookie( 'bp_group_completed_to_step', false, time() - 1000, COOKIEPATH );
365
366
$no_instantiate = true;
367
$reset_steps = true;
368
}
369
370
+ if ( isset($_COOKIE['bp_group_completed_to_step']) && !$reset_steps ) {
371
+ $completed_to_step = $_COOKIE['bp_group_completed_to_step'];
372
}
373
374
if ( isset( $_POST['save'] ) || isset( $_POST['skip'] ) ) {
375
+ $group_obj = new BP_Groups_Group( $_COOKIE['bp_group_obj_id'] );
376
377
+ if ( !$group_id = groups_create_group( $create_group_step, $_COOKIE['bp_group_obj_id'] ) ) {
378
bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' );
379
bp_core_redirect( $bp->loggedin_user->domain . $bp->groups->slug . '/create/step/' . $create_group_step );
380
} else {
381
$create_group_step++;
382
$completed_to_step++;
383
+
384
+ /* Unset cookie info */
385
+ setcookie( 'bp_group_obj_id', false, time() - 1000, COOKIEPATH );
386
+ setcookie( 'bp_group_completed_to_step', false, time() - 1000, COOKIEPATH );
387
+
388
+ /* Reset cookie info */
389
+ setcookie( 'bp_group_obj_id', $group_id, time()+60*60*24, COOKIEPATH );
390
+ setcookie( 'bp_group_completed_to_step', $completed_to_step, time()+60*60*24, COOKIEPATH );
391
}
392
393
if ( $completed_to_step == 4 )
394
bp_core_redirect( bp_get_group_permalink( $group_obj ) );
395
}
396
397
+ if ( isset($_COOKIE['bp_group_obj_id']) && !$group_obj && !$no_instantiate )
398
+ $group_obj = new BP_Groups_Group( $_COOKIE['bp_group_obj_id'] );
399
400
bp_core_load_template( apply_filters( 'groups_template_create_group', 'groups/create' ) );
401
}
952
953
if ( !$group_obj ) {
954
if ( !$group_obj = wp_cache_get( 'groups_group_nouserdata_' . $item_id, 'bp' ) ) {
955
+ $group_obj = new BP_Groups_Group( $item_id, false, false );
956
wp_cache_set( 'groups_group_nouserdata_' . $item_id, $group_obj, 'bp' );
957
}
958
}
1103
if ( (int)$total_items > 1 ) {
1104
return apply_filters( 'bp_groups_multiple_new_membership_requests_notification', '<a href="' . $group_link . '/admin/membership-requests/" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . sprintf( __('%d new membership requests for the group "%s"', 'buddypress' ), (int)$total_items, $group->name ) . '</a>', $group_link, $total_items, $group->name );
1105
} else {
1106
+ $user_fullname = bp_core_get_user_displayname( $requesting_user_id );
1107
return apply_filters( 'bp_groups_single_new_membership_request_notification', '<a href="' . $group_link . '/admin/membership-requests/" title="' . $user_fullname .' requests group membership">' . sprintf( __('%s requests membership for the group "%s"', 'buddypress' ), $user_fullname, $group->name ) . '</a>', $group_link, $user_fullname, $group->name );
1108
}
1109
break;
1590
}
1591
1592
function groups_new_group_forum_post( $post_text, $topic_id ) {
1593
+ global $group_obj, $bp;
1594
1595
/* Check the nonce */
1596
if ( !check_admin_referer( 'bp_forums_new_reply' ) )
1612
}
1613
1614
function groups_new_group_forum_topic( $topic_title, $topic_text, $topic_tags, $forum_id ) {
1615
+ global $group_obj, $bp;
1616
1617
/* Check the nonce */
1618
if ( !check_admin_referer( 'bp_forums_new_topic' ) )
2100
function groups_redirect_to_random_group() {
2101
global $bp, $wpdb;
2102
2103
+ if ( $bp->current_component == $bp->groups->slug && isset( $_GET['random-group'] ) ) {
2104
$group = groups_get_random_group();
2105
2106
bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/' . $group['groups'][0]->slug );
2281
if ( empty($member_theme) )
2282
$member_theme = 'bpmember';
2283
2284
+ add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
2285
+ add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );
2286
2287
return $member_theme;
2288
}
2299
if ( empty( $member_theme ) )
2300
$member_theme = 'bpmember';
2301
2302
+ add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
2303
+ add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );
2304
2305
return $member_theme;
2306
}
bp-groups/bp-groups-admin.php CHANGED
@@ -32,13 +32,13 @@ function groups_admin_settings() {
32
<div class="wrap" style="position: relative">
33
<h2><?php _e( 'Groups', 'buddypress' ) ?></h2>
34
35
- <form id="wpmu-search" method="post" action="<?php $_SERVER['PHP_SELF'] ?>">
36
- <input type="text" size="17" value="<?php echo $_REQUEST['s'] ?>" name="s" />
37
<input id="post-query-submit" class="button" type="submit" value="<?php _e( 'Search Groups', 'buddypress' ) ?>" />
38
</form>
39
40
<?php if ( bp_has_site_groups( 'type=active&per_page=10' ) ) : ?>
41
- <form id="bp-group-admin-list" method="post" action="<?php $_SERVER['PHP_SELF'] ?>">
42
<div class="tablenav">
43
<div class="tablenav-pages">
44
<?php bp_site_groups_pagination_count() ?> <?php bp_site_groups_pagination_links() ?>
32
<div class="wrap" style="position: relative">
33
<h2><?php _e( 'Groups', 'buddypress' ) ?></h2>
34
35
+ <form id="wpmu-search" method="post" action="">
36
+ <input type="text" size="17" value="<?php echo attribute_escape( stripslashes( $_REQUEST['s'] ) ); ?>" name="s" />
37
<input id="post-query-submit" class="button" type="submit" value="<?php _e( 'Search Groups', 'buddypress' ) ?>" />
38
</form>
39
40
<?php if ( bp_has_site_groups( 'type=active&per_page=10' ) ) : ?>
41
+ <form id="bp-group-admin-list" method="post" action="">
42
<div class="tablenav">
43
<div class="tablenav-pages">
44
<?php bp_site_groups_pagination_count() ?> <?php bp_site_groups_pagination_links() ?>
bp-groups/bp-groups-ajax.php CHANGED
@@ -23,9 +23,9 @@ function groups_ajax_invite_user() {
23
echo '<li id="uid-' . $user->id . '">';
24
echo $user->avatar_thumb;
25
echo '<h4>' . $user->user_link . '</h4>';
26
- echo '<span class="activity">' . $user->last_active . '</span>';
27
echo '<div class="action">
28
- <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-' . $user->id . '">' . __( 'Remove Invite', 'buddypress' ) . '</a>
29
</div>';
30
echo '</li>';
31
@@ -88,11 +88,11 @@ function groups_ajax_widget_groups_list() {
88
?>
89
<li>
90
<div class="item-avatar">
91
- <img src="<?php echo $group->avatar_thumb ?>" class="avatar" alt="<?php echo $group->name ?> Avatar" />
92
</div>
93
94
<div class="item">
95
- <div class="item-title"><a href="<?php echo bp_get_group_permalink( $group ) ?>" title="<?php echo $group->name ?>"><?php echo $group->name ?></a></div>
96
<div class="item-meta">
97
<span class="activity">
98
<?php
@@ -144,7 +144,7 @@ function groups_ajax_member_list() {
144
145
<?php if ( function_exists( 'friends_install' ) ) : ?>
146
<div class="action">
147
- <?php bp_add_friend_button( bp_group_member_id() ) ?>
148
</div>
149
<?php endif; ?>
150
</li>
@@ -157,7 +157,7 @@ function groups_ajax_member_list() {
157
</div>
158
159
<?php endif; ?>
160
- <input type="hidden" name="group_id" id="group_id" value="<?php echo $_REQUEST['group_id'] ?>" />
161
<?php
162
}
163
add_action( 'wp_ajax_get_group_members', 'groups_ajax_member_list' );
@@ -202,7 +202,7 @@ function groups_ajax_member_admin_list() {
202
</div>
203
204
<?php endif;?>
205
- <input type="hidden" name="group_id" i