BuddyPress - Version 1.0.2

Version Description

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

bp-activity/bp-activity-templatetags.php CHANGED
@@ -33,7 +33,7 @@ class BP_Activity_Template {
33
if ( $type == 'friends' && ( bp_is_home() || is_site_admin() || $bp->loggedin_user->id == $user_id ) )
34
$this->activities = bp_activity_get_friends_activity( $user_id, $timeframe, $this->pag_num, $this->pag_page );
35
36
- if ( !$max )
37
$this->total_activity_count = (int)$this->activities['total'];
38
else
39
$this->total_activity_count = (int)$max;
@@ -309,6 +309,15 @@ function bp_activities_member_rss_link() {
309
310
/* Template tags for RSS feed output */
311
312
function bp_activity_feed_item_title() {
313
echo bp_get_activity_feed_item_title();
314
}
33
if ( $type == 'friends' && ( bp_is_home() || is_site_admin() || $bp->loggedin_user->id == $user_id ) )
34
$this->activities = bp_activity_get_friends_activity( $user_id, $timeframe, $this->pag_num, $this->pag_page );
35
36
+ if ( !$max || $max >= (int)$this->activities['total'] )
37
$this->total_activity_count = (int)$this->activities['total'];
38
else
39
$this->total_activity_count = (int)$max;
309
310
/* Template tags for RSS feed output */
311
312
+ function bp_activity_feed_item_guid() {
313
+ echo bp_get_activity_feed_item_guid();
314
+ }
315
+ function bp_get_activity_feed_item_guid() {
316
+ global $activities_template;
317
+
318
+ return apply_filters( 'bp_get_activity_feed_item_title', md5( $activities_template->activity->date_recorded . '-' . $activities_template->activity->content ) );
319
+ }
320
+
321
function bp_activity_feed_item_title() {
322
echo bp_get_activity_feed_item_title();
323
}
bp-activity/feeds/bp-activity-friends-feed.php CHANGED
@@ -23,16 +23,17 @@ header('Status: 200 OK');
23
<link><?php echo $bp->displayed_user->domain . $bp->activity->slug . '/my-friends/feed' ?></link>
24
<description><?php printf( __( '%s - Friends Activity Feed', 'buddypress' ), $bp->displayed_user->fullname ) ?></description>
25
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_get_last_updated(), false); ?></pubDate>
26
- <generator>http://buddypress.org/?bp-activity-version=<?php echo BP_ACTIVITY_VERSION ?></generator>
27
<language><?php echo get_option('rss_language'); ?></language>
28
<?php do_action('bp_activity_friends_feed_head'); ?>
29
30
<?php if ( bp_has_activities( 'type=friends&max=50' ) ) : ?>
31
<?php while ( bp_activities() ) : bp_the_activity(); ?>
32
<item>
33
<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
34
<link><?php echo bp_activity_feed_item_link() ?></link>
35
- <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_feed_item_date(), false); ?></pubDate>
36
37
<description><![CDATA[<?php bp_activity_feed_item_description() ?>]]></description>
38
<?php do_action('bp_activity_personal_feed_item'); ?>
23
<link><?php echo $bp->displayed_user->domain . $bp->activity->slug . '/my-friends/feed' ?></link>
24
<description><?php printf( __( '%s - Friends Activity Feed', 'buddypress' ), $bp->displayed_user->fullname ) ?></description>
25
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_get_last_updated(), false); ?></pubDate>
26
+ <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
27
<language><?php echo get_option('rss_language'); ?></language>
28
<?php do_action('bp_activity_friends_feed_head'); ?>
29
30
<?php if ( bp_has_activities( 'type=friends&max=50' ) ) : ?>
31
<?php while ( bp_activities() ) : bp_the_activity(); ?>
32
<item>
33
+ <guid><?php bp_activity_feed_item_guid() ?></guid>
34
<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
35
<link><?php echo bp_activity_feed_item_link() ?></link>
36
+ <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_get_activity_feed_item_date(), false); ?></pubDate>
37
38
<description><![CDATA[<?php bp_activity_feed_item_description() ?>]]></description>
39
<?php do_action('bp_activity_personal_feed_item'); ?>
bp-activity/feeds/bp-activity-personal-feed.php CHANGED
@@ -23,16 +23,17 @@ header('Status: 200 OK');
23
<link><?php echo $bp->displayed_user->domain . $bp->activity->slug . '/feed' ?></link>
24
<description><?php printf( __( '%s - Activity Feed', 'buddypress' ), $bp->displayed_user->fullname ) ?></description>
25
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_get_last_updated(), false); ?></pubDate>
26
- <generator>http://buddypress.org/?bp-activity-version=<?php echo BP_ACTIVITY_VERSION ?></generator>
27
<language><?php echo get_option('rss_language'); ?></language>
28
<?php do_action('bp_activity_personal_feed_head'); ?>
29
30
<?php if ( bp_has_activities( 'type=personal&max=50' ) ) : ?>
31
<?php while ( bp_activities() ) : bp_the_activity(); ?>
32
<item>
33
<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
34
<link><?php echo bp_activity_feed_item_link() ?></link>
35
- <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_feed_item_date(), false); ?></pubDate>
36
37
<description><![CDATA[<?php bp_activity_feed_item_description() ?>]]></description>
38
<?php do_action('bp_activity_personal_feed_item'); ?>
23
<link><?php echo $bp->displayed_user->domain . $bp->activity->slug . '/feed' ?></link>
24
<description><?php printf( __( '%s - Activity Feed', 'buddypress' ), $bp->displayed_user->fullname ) ?></description>
25
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_get_last_updated(), false); ?></pubDate>
26
+ <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
27
<language><?php echo get_option('rss_language'); ?></language>
28
<?php do_action('bp_activity_personal_feed_head'); ?>
29
30
<?php if ( bp_has_activities( 'type=personal&max=50' ) ) : ?>
31
<?php while ( bp_activities() ) : bp_the_activity(); ?>
32
<item>
33
+ <guid><?php bp_activity_feed_item_guid() ?></guid>
34
<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
35
<link><?php echo bp_activity_feed_item_link() ?></link>
36
+ <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_get_activity_feed_item_date(), false); ?></pubDate>
37
38
<description><![CDATA[<?php bp_activity_feed_item_description() ?>]]></description>
39
<?php do_action('bp_activity_personal_feed_item'); ?>
bp-activity/feeds/bp-activity-sitewide-feed.php CHANGED
@@ -24,16 +24,17 @@ header('Status: 200 OK');
24
<link><?php echo site_url() . '/' . $bp->activity->slug . '/feed' ?></link>
25
<description><?php _e( 'Site Wide Activity Feed', 'buddypress' ) ?></description>
26
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_get_last_updated(), false); ?></pubDate>
27
- <generator>http://buddypress.org/?bp-activity-version=<?php echo BP_ACTIVITY_VERSION ?></generator>
28
<language><?php echo get_option('rss_language'); ?></language>
29
<?php do_action('bp_activity_sitewide_feed_head'); ?>
30
31
<?php if ( bp_has_activities( 'type=sitewide&max=50' ) ) : ?>
32
<?php while ( bp_activities() ) : bp_the_activity(); ?>
33
<item>
34
<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
35
- <link><?php echo bp_activity_feed_item_link() ?></link>
36
- <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_feed_item_date(), false); ?></pubDate>
37
38
<description><![CDATA[<?php bp_activity_feed_item_description() ?>]]></description>
39
<?php do_action('bp_activity_personal_feed_item'); ?>
24
<link><?php echo site_url() . '/' . $bp->activity->slug . '/feed' ?></link>
25
<description><?php _e( 'Site Wide Activity Feed', 'buddypress' ) ?></description>
26
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_activity_get_last_updated(), false); ?></pubDate>
27
+ <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
28
<language><?php echo get_option('rss_language'); ?></language>
29
<?php do_action('bp_activity_sitewide_feed_head'); ?>
30
31
<?php if ( bp_has_activities( 'type=sitewide&max=50' ) ) : ?>
32
<?php while ( bp_activities() ) : bp_the_activity(); ?>
33
<item>
34
+ <guid><?php bp_activity_feed_item_guid() ?></guid>
35
<title><![CDATA[<?php bp_activity_feed_item_title() ?>]]></title>
36
+ <link><?php bp_activity_feed_item_link() ?></link>
37
+ <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', bp_get_activity_feed_item_date(), false); ?></pubDate>
38
39
<description><![CDATA[<?php bp_activity_feed_item_description() ?>]]></description>
40
<?php do_action('bp_activity_personal_feed_item'); ?>
bp-blogs.php CHANGED
@@ -453,7 +453,7 @@ add_action( 'edit_post', 'bp_blogs_record_post' );
453
454
455
function bp_blogs_record_comment( $comment_id, $is_approved ) {
456
- global $wpdb;
457
458
if ( !$is_approved )
459
return false;
453
454
455
function bp_blogs_record_comment( $comment_id, $is_approved ) {
456
+ global $wpdb, $bp;
457
458
if ( !$is_approved )
459
return false;
bp-blogs/bp-blogs-templatetags.php CHANGED
@@ -98,7 +98,7 @@ function bp_blogs_signup_blog( $blogname = '', $blog_title = '', $errors = '' )
98
<p>
99
<label for="blog_public_on"><?php _e('Privacy:', 'buddypress') ?></label>
100
<?php _e('I would like my blog to appear in search engines like Google and Technorati, and in public listings around this site.', 'buddypress'); ?>
101
- <div style="clear:both;"></div>
102
<label class="checkbox" for="blog_public_on">
103
<input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if( !isset( $_POST['blog_public'] ) || '1' == $_POST['blog_public'] ) { ?>checked="checked"<?php } ?> />
104
<strong><?php _e( 'Yes' , 'buddypress'); ?></strong>
@@ -221,7 +221,7 @@ class BP_Blogs_User_Blogs_Template {
221
wp_cache_set( 'bp_blogs_for_user_' . $user_id, $this->blogs, 'bp' );
222
}
223
224
- if ( !$max )
225
$this->total_blog_count = (int)$this->blogs['count'];
226
else
227
$this->total_blog_count = (int)$max;
@@ -397,7 +397,7 @@ class BP_Blogs_Blog_Post_Template {
397
wp_cache_set( 'bp_user_posts_' . $user_id, $this->posts, 'bp' );
398
}
399
400
- if ( !$max )
401
$this->total_post_count = (int)$this->posts['count'];
402
else
403
$this->total_post_count = (int)$max;
@@ -831,7 +831,7 @@ class BP_Blogs_Post_Comment_Template {
831
wp_cache_set( 'bp_user_comments_' . $user_id, $this->comments, 'bp' );
832
}
833
834
- if ( !$max )
835
$this->total_comment_count = (int)$this->comments['count'];
836
else
837
$this->total_comment_count = (int)$max;
@@ -1084,7 +1084,7 @@ class BP_Blogs_Site_Blogs_Template {
1084
}
1085
}
1086
1087
- if ( !$max )
1088
$this->total_blog_count = (int)$this->blogs['total'];
1089
else
1090
$this->total_blog_count = (int)$max;
@@ -1227,7 +1227,7 @@ function bp_the_site_blog_avatar() {
1227
* In future BuddyPress versions you will be able to set the avatar for a blog.
1228
* Right now you can use a filter with the ID of the blog to change it if you wish.
1229
*/
1230
- return apply_filters( 'bp_get_blogs_blog_avatar_' . $site_blogs_template->blog->blog_id, '<img src="http://www.gravatar.com/avatar/' . md5( $site_blogs_template->blog->blog_id . '.blogs@' . $bp->root_domain ) . '?d=identicon&amp;s=150" class="avatar blog-avatar" alt="' . __( 'Blog Avatar', 'buddypress' ) . '" />', $site_blogs_template->blog->blog_id );
1231
}
1232
1233
function bp_the_site_blog_avatar_thumb() {
@@ -1236,7 +1236,7 @@ function bp_the_site_blog_avatar_thumb() {
1236
function bp_get_the_site_blog_avatar_thumb() {
1237
global $site_blogs_template, $bp;
1238
1239
- return apply_filters( 'bp_get_blogs_blog_avatar_thumb_' . $site_blogs_template->blog->blog_id, '<img src="http://www.gravatar.com/avatar/' . md5( $site_blogs_template->blog->blog_id . '.blogs@' . $bp->root_domain ) . '?d=identicon&amp;s=50" class="avatar blog-avatar thumb" alt="' . __( 'Blog Avatar', 'buddypress' ) . '" />', $site_blogs_template->blog->blog_id );
1240
}
1241
1242
function bp_the_site_blog_avatar_mini() {
@@ -1245,7 +1245,7 @@ function bp_the_site_blog_avatar_mini() {
1245
function bp_get_the_site_blog_avatar_mini() {
1246
global $site_blogs_template, $bp;
1247
1248
- return apply_filters( 'bp_get_blogs_blog_avatar_mini_' . $site_blogs_template->blog->blog_id, '<img src="http://www.gravatar.com/avatar/' . md5( $site_blogs_template->blog->blog_id . '.blogs@' . $bp->root_domain ) . '?d=identicon&amp;s=25" class="avatar blog-avatar mini" alt="' . __( 'Blog Avatar', 'buddypress' ) . '" />', $site_blogs_template->blog->blog_id );
1249
}
1250
1251
function bp_the_site_blog_link() {
98
<p>
99
<label for="blog_public_on"><?php _e('Privacy:', 'buddypress') ?></label>
100
<?php _e('I would like my blog to appear in search engines like Google and Technorati, and in public listings around this site.', 'buddypress'); ?>
101
+ <div class="clear"></div>
102
<label class="checkbox" for="blog_public_on">
103
<input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if( !isset( $_POST['blog_public'] ) || '1' == $_POST['blog_public'] ) { ?>checked="checked"<?php } ?> />
104
<strong><?php _e( 'Yes' , 'buddypress'); ?></strong>
221
wp_cache_set( 'bp_blogs_for_user_' . $user_id, $this->blogs, 'bp' );
222
}
223
224
+ if ( !$max || $max >= (int)$this->blogs['count'] )
225
$this->total_blog_count = (int)$this->blogs['count'];
226
else
227
$this->total_blog_count = (int)$max;
397
wp_cache_set( 'bp_user_posts_' . $user_id, $this->posts, 'bp' );
398
}
399
400
+ if ( !$max || $max >= (int)$this->posts['count'] )
401
$this->total_post_count = (int)$this->posts['count'];
402
else
403
$this->total_post_count = (int)$max;
831
wp_cache_set( 'bp_user_comments_' . $user_id, $this->comments, 'bp' );
832
}
833
834
+ if ( !$max || $max >= (int)$this->comments['count'] )
835
$this->total_comment_count = (int)$this->comments['count'];
836
else
837
$this->total_comment_count = (int)$max;
1084
}
1085
}
1086
1087
+ if ( !$max || $max >= (int)$this->blogs['total'] )
1088
$this->total_blog_count = (int)$this->blogs['total'];
1089
else
1090
$this->total_blog_count = (int)$max;
1227
* In future BuddyPress versions you will be able to set the avatar for a blog.
1228
* Right now you can use a filter with the ID of the blog to change it if you wish.
1229
*/
1230
+ return apply_filters( 'bp_get_blogs_blog_avatar_' . $site_blogs_template->blog->blog_id, '<img src="' . apply_filters( 'bp_gravatar_url', 'http://www.gravatar.com/avatar/' ) . md5( $site_blogs_template->blog->blog_id . '.blogs@' . $bp->root_domain ) . '?d=identicon&amp;s=150" class="avatar blog-avatar" alt="' . __( 'Blog Avatar', 'buddypress' ) . '" />', $site_blogs_template->blog->blog_id );
1231
}
1232
1233
function bp_the_site_blog_avatar_thumb() {
1236
function bp_get_the_site_blog_avatar_thumb() {
1237
global $site_blogs_template, $bp;
1238
1239
+ return apply_filters( 'bp_get_blogs_blog_avatar_thumb_' . $site_blogs_template->blog->blog_id, '<img src="' . apply_filters( 'bp_gravatar_url', 'http://www.gravatar.com/avatar/' ) . md5( $site_blogs_template->blog->blog_id . '.blogs@' . $bp->root_domain ) . '?d=identicon&amp;s=50" class="avatar blog-avatar thumb" alt="' . __( 'Blog Avatar', 'buddypress' ) . '" />', $site_blogs_template->blog->blog_id );
1240
}
1241
1242
function bp_the_site_blog_avatar_mini() {
1245
function bp_get_the_site_blog_avatar_mini() {
1246
global $site_blogs_template, $bp;
1247
1248
+ return apply_filters( 'bp_get_blogs_blog_avatar_mini_' . $site_blogs_template->blog->blog_id, '<img src="' . apply_filters( 'bp_gravatar_url', 'http://www.gravatar.com/avatar/' ) . md5( $site_blogs_template->blog->blog_id . '.blogs@' . $bp->root_domain ) . '?d=identicon&amp;s=25" class="avatar blog-avatar mini" alt="' . __( 'Blog Avatar', 'buddypress' ) . '" />', $site_blogs_template->blog->blog_id );
1249
}
1250
1251
function bp_the_site_blog_link() {
bp-core.php CHANGED
@@ -21,10 +21,6 @@ if ( !defined( 'CUSTOM_USER_TABLE' ) )
21
if ( !defined( 'CUSTOM_USER_META_TABLE' ) )
22
define( 'CUSTOM_USER_META_TABLE', $wpdb->base_prefix . 'usermeta' );
23
24
- /* Load the language file */
25
- if ( file_exists( BP_PLUGIN_DIR . '/bp-languages/buddypress-' . get_locale() . '.mo' ) )
26
- load_textdomain( 'buddypress', BP_PLUGIN_DIR . '/bp-languages/buddypress-' . get_locale() . '.mo' );
27
-
28
/* Load the files containing functions that we globally will need. */
29
require ( BP_PLUGIN_DIR . '/bp-core/bp-core-catchuri.php' );
30
require ( BP_PLUGIN_DIR . '/bp-core/bp-core-classes.php' );
@@ -1511,6 +1507,23 @@ 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
*
21
if ( !defined( 'CUSTOM_USER_META_TABLE' ) )
22
define( 'CUSTOM_USER_META_TABLE', $wpdb->base_prefix . 'usermeta' );
23
24
/* Load the files containing functions that we globally will need. */
25
require ( BP_PLUGIN_DIR . '/bp-core/bp-core-catchuri.php' );
26
require ( BP_PLUGIN_DIR . '/bp-core/bp-core-classes.php' );
1507
add_action( 'delete_user', 'bp_core_remove_data', 1 );
1508
1509
1510
+ /**
1511
+ * bp_load_buddypress_textdomain()
1512
+ *
1513
+ * Load the buddypress translation file for current language
1514
+ *
1515
+ * @package BuddyPress Core
1516
+ */
1517
+ function bp_core_load_buddypress_textdomain() {
1518
+ $locale = apply_filters( 'buddypress_locale', get_locale() );
1519
+ $mofile = BP_PLUGIN_DIR . "/bp-languages/buddypress-$locale.mo";
1520
+
1521
+ if ( file_exists( $mofile ) )
1522
+ load_textdomain( 'buddypress', $mofile );
1523
+ }
1524
+ add_action ( 'plugins_loaded', 'bp_core_load_buddypress_textdomain', 9 );
1525
+
1526
+
1527
/**
1528
* bp_core_clear_user_object_cache()
1529
*
bp-core/bp-core-adminbar.php CHANGED
@@ -259,6 +259,8 @@ function bp_adminbar_random_menu() {
259
<li><a href="<?php echo $bp->root_domain . '/' . $bp->blogs->slug . '/?random-blog' ?>"><?php _e( 'Random Blog', 'buddypress' ) ?></a></li>
260
261
<?php endif; ?>
262
</ul>
263
</li>
264
<?php
259
<li><a href="<?php echo $bp->root_domain . '/' . $bp->blogs->slug . '/?random-blog' ?>"><?php _e( 'Random Blog', 'buddypress' ) ?></a></li>
260
261
<?php endif; ?>
262
+
263
+ <?php do_action( 'bp_adminbar_random_menu' ) ?>
264
</ul>
265
</li>
266
<?php
bp-core/bp-core-avatars.php CHANGED
@@ -377,11 +377,11 @@ function bp_core_avatar_cropstore( $source, $canvas, $v1_x1, $v1_y1, $v1_w, $v1_
377
$filename_item_id = $item_id . '-';
378
379
if ( $filename != 'avatar' ) {
380
- $v1_filename = '-' . $filename_item_id . $filename . '-thumb';
381
- $v2_filename = '-' . $filename_item_id . $filename . '-full';
382
} else {
383
- $v1_filename = '-avatar1';
384
- $v2_filename = '-avatar2';
385
}
386
387
$v1_filename = apply_filters( 'bp_avatar_v1_filename', $v1_filename );
377
$filename_item_id = $item_id . '-';
378
379
if ( $filename != 'avatar' ) {
380
+ $v1_filename = '-' . md5( $filename_item_id . $filename . time() ) . '-thumb';
381
+ $v2_filename = '-' . md5( $filename_item_id . $filename . time() ) . '-full';
382
} else {
383
+ $v1_filename = md5( $source . time() ) . '-avatar1';
384
+ $v2_filename = md5( $source . time() ) . '-avatar2';
385
}
386
387
$v1_filename = apply_filters( 'bp_avatar_v1_filename', $v1_filename );
bp-core/bp-core-templatetags.php CHANGED
@@ -500,7 +500,7 @@ function bp_is_page($page) {
500
}
501
502
function bp_has_custom_signup_page() {
503
- if ( file_exists( WP_CONTENT_DIR . '/themes/' . get_blog_option( 1, 'template') . '/register.php') )
504
return true;
505
506
return false;
@@ -797,7 +797,7 @@ class BP_Core_Members_Template {
797
}
798
}
799
800
- if ( !$max )
801
$this->total_member_count = (int)$this->members['total'];
802
else
803
$this->total_member_count = (int)$max;
500
}
501
502
function bp_has_custom_signup_page() {
503
+ if ( file_exists( WP_CONTENT_DIR . '/themes/' . get_blog_option( BP_ROOT_BLOG, 'template') . '/register.php') )
504
return true;
505
506
return false;
797
}
798
}
799
800
+ if ( !$max || $max >= (int)$this->members['total'] )
801
$this->total_member_count = (int)$this->members['total'];
802
else
803
$this->total_member_count = (int)$max;
bp-core/css/admin-bar.css CHANGED
@@ -199,7 +199,7 @@ body { padding-top: 28px !important; }
199
200
#wp-admin-bar img.avatar {
201
float: left !important;
202
- border: 2px solid #fff !important !important;
203
margin-right: 8px !important;
204
}
205
199
200
#wp-admin-bar img.avatar {
201
float: left !important;
202
+ border: 2px solid #fff !important;
203
margin-right: 8px !important;
204
}
205
bp-forums.php CHANGED
@@ -154,9 +154,6 @@ function bp_forums_new_topic( $title = '', $topic_text = '', $topic_tags = '', $
154
155
function bp_forums_new_post( $post_text = '', $topic_id = 0 ) {
156
global $bbpress_live;
157
-
158
- if ( !check_admin_referer( 'bp_forums_new_reply' ) )
159
- return false;
160
161
if ( !is_object( $bbpress_live ) ) {
162
include_once( ABSPATH . WPINC . '/class-IXR.php' );
154
155
function bp_forums_new_post( $post_text = '', $topic_id = 0 ) {
156
global $bbpress_live;
157
158
if ( !is_object( $bbpress_live ) ) {
159
include_once( ABSPATH . WPINC . '/class-IXR.php' );
bp-forums/bbpress-plugins/buddypress-enable.php CHANGED
@@ -23,10 +23,7 @@ function for_buddypress_strip_tags( $_post, $post ) {
23
$_post['poster_ip'],
24
$_post['pingback_queued']
25
);
26
-
27
- $_post['post_text'] = str_replace( '<', '[', $_post['post_text'] );
28
- $_post['post_text'] = str_replace( '>', ']', $_post['post_text'] );
29
-
30
return $_post;
31
}
32
add_filter( 'bb_xmlrpc_prepare_post', 'for_buddypress_strip_tags', 10, 2 );
@@ -49,7 +46,6 @@ add_filter( 'bb_xmlrpc_prepare_topic', 'for_buddypress_prepare_topic', 10, 2 );
49
50
function for_buddypress_pre_post( $post_text, $post_id, $topic_id ){
51
$post_text = stripslashes( stripslashes_deep($post_text) );
52
- $post_text = str_replace( '/amp/', '&', $post_text );
53
$post_text = html_entity_decode( $post_text, ENT_COMPAT, "UTF-8" );
54
55
return $post_text;
23
$_post['poster_ip'],
24
$_post['pingback_queued']
25
);
26
+
27
return $_post;
28
}
29
add_filter( 'bb_xmlrpc_prepare_post', 'for_buddypress_strip_tags', 10, 2 );
46
47
function for_buddypress_pre_post( $post_text, $post_id, $topic_id ){
48
$post_text = stripslashes( stripslashes_deep($post_text) );
49
$post_text = html_entity_decode( $post_text, ENT_COMPAT, "UTF-8" );
50
51
return $post_text;
bp-forums/bp-forums-filters.php CHANGED
@@ -1,11 +1,6 @@
1
<?php
2
3
/* BuddyPress filters */
4
- add_filter( 'bp_forums_new_post_text', 'bp_forums_filter_encode' );
5
-
6
- add_filter( 'bp_get_the_topic_post_content', 'bp_forums_filter_decode' );
7
- add_filter( 'bp_get_the_topic_latest_post_excerpt', 'bp_forums_filter_decode' );
8
-
9
add_filter( 'bp_get_the_topic_latest_post_excerpt', 'bp_create_excerpt' );
10
11
/* Apply WordPress defined filters */
@@ -40,22 +35,4 @@ function bp_forums_add_allowed_tags( $allowedtags ) {
40
}
41
add_filter( 'edit_allowedtags', 'bp_forums_add_allowed_tags' );
42
43
-
44
- function bp_forums_filter_encode( $content ) {
45
- $content = htmlentities( $content, ENT_COMPAT, "UTF-8" );
46
- $content = str_replace( '&', '/amp/', $content );
47
-
48
- return $content;
49
- }
50
-
51
- function bp_forums_filter_decode( $content ) {
52
- $content = str_replace( '/amp/', '&', $content );
53
- $content = @html_entity_decode( $content, ENT_COMPAT, "UTF-8" );
54
- $content = str_replace( '[', '<', $content );
55
- $content = str_replace( ']', '>', $content );
56
- $content = stripslashes( wp_filter_kses( $content ) );
57
-
58
- return $content;
59
- }
60
-
61
?>
1
<?php
2
3
/* BuddyPress filters */
4
add_filter( 'bp_get_the_topic_latest_post_excerpt', 'bp_create_excerpt' );
5
6
/* Apply WordPress defined filters */
35
}
36
add_filter( 'edit_allowedtags', 'bp_forums_add_allowed_tags' );
37
38
?>
bp-forums/bp-forums-templatetags.php CHANGED
@@ -30,8 +30,10 @@ class BP_Forums_Template_Forum {
30
$this->topic_count = 0;
31
$this->total_topic_count = 0;
32
} else {
33
- if ( !$max )
34
- $this->total_topic_count = count( bp_forums_get_topics( $forum_id ) );
35
else
36
$this->total_topic_count = (int)$max;
37
@@ -394,7 +396,7 @@ class BP_Forums_Template_Topic {
394
$this->post_count = 0;
395
$this->total_post_count = 0;
396
} else {
397
- if ( !$max )
398
$this->total_post_count = (int) $forum_template->topic->topic_posts;
399
else
400
$this->total_post_count = (int)$max;
30
$this->topic_count = 0;
31
$this->total_topic_count = 0;
32
} else {
33
+ $forum_count = count( bp_forums_get_topics( $forum_id ) );
34
+
35
+ if ( !$max || $max >= $forum_count )
36
+ $this->total_topic_count = $forum_count;
37
else
38
$this->total_topic_count = (int)$max;
39
396
$this->post_count = 0;
397
$this->total_post_count = 0;
398
} else {
399
+ if ( !$max || $max >= (int) $forum_template->topic->topic_posts )
400
$this->total_post_count = (int) $forum_template->topic->topic_posts;
401
else
402
$this->total_post_count = (int)$max;
bp-forums/installation-readme.txt CHANGED
@@ -59,7 +59,7 @@ Follow these steps to get forums up and running:
59
60
$bb->bb_xmlrpc_allow_user_switching = true;
61
62
- 12. Log into your WPMU admin interface and head to "Site Admin > Group Forums" fill in the details on that
63
page. Make sure you don't leave out the ending slash on your bbPress URL. (http://example.com/bbpress/)
64
Enter the username and password for the user that you signed up in step 8.
65
59
60
$bb->bb_xmlrpc_allow_user_switching = true;
61
62
+ 12. Log into your WPMU admin interface and head to "BuddyPress > Forums Setup" fill in the details on that
63
page. Make sure you don't leave out the ending slash on your bbPress URL. (http://example.com/bbpress/)
64
Enter the username and password for the user that you signed up in step 8.
65
bp-friends.php CHANGED
@@ -102,6 +102,8 @@ function friends_setup_nav() {
102
$bp->bp_options_title = $bp->displayed_user->fullname;
103
}
104
}
105
}
106
add_action( 'wp', 'friends_setup_nav', 2 );
107
add_action( 'admin_menu', 'friends_setup_nav', 2 );
@@ -123,7 +125,10 @@ function friends_screen_requests() {
123
global $bp;
124
125
if ( isset($bp->action_variables) && 'accept' == $bp->action_variables[0] && is_numeric($bp->action_variables[1]) ) {
126
-
127
if ( friends_accept_friendship( $bp->action_variables[1] ) ) {
128
bp_core_add_message( __( 'Friendship accepted', 'buddypress' ) );
129
} else {
@@ -132,6 +137,9 @@ function friends_screen_requests() {
132
bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
133
134
} else if ( isset($bp->action_variables) && 'reject' == $bp->action_variables[0] && is_numeric($bp->action_variables[1]) ) {
135
136
if ( friends_reject_friendship( $bp->action_variables[1] ) ) {
137
bp_core_add_message( __( 'Friendship rejected', 'buddypress' ) );
@@ -240,7 +248,7 @@ function friends_action_remove_friend() {
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 {
@@ -574,13 +582,9 @@ function friends_check_friendship( $user_id, $possible_friend_id ) {
574
Create a new friend relationship
575
**************************************************************************/
576
577
- function friends_add_friend( $initiator_userid, $friend_userid ) {
578
global $bp;
579
580
- /* Check the nonce */
581
- if ( !check_admin_referer( 'friends_add_friend' ) )
582
- return false;
583
-
584
$friendship = new BP_Friends_Friendship;
585
586
if ( (int)$friendship->is_confirmed )
@@ -592,17 +596,24 @@ function friends_add_friend( $initiator_userid, $friend_userid ) {
592
$friendship->is_limited = 0;
593
$friendship->date_created = time();
594
595
if ( $friendship->save() ) {
596
597
- // Add the on screen notification
598
- bp_core_add_notification( $friendship->initiator_user_id, $friendship->friend_user_id, 'friends', 'friendship_request' );
599
-
600
- // Send the email notification
601
- require_once( BP_PLUGIN_DIR . '/bp-friends/bp-friends-notifications.php' );
602
- friends_notification_new_request( $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
603
-
604
- do_action( 'friends_friendship_requested', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
605
-
606
return true;
607
}
608
@@ -617,10 +628,6 @@ function friends_add_friend( $initiator_userid, $friend_userid ) {
617
618
function friends_remove_friend( $initiator_userid, $friend_userid ) {
619
global $bp;
620
-
621
- /* Check the nonce */
622
- if ( !check_admin_referer( 'friends_remove_friend' ) )
623
- return false;
624
625
$friendship_id = BP_Friends_Friendship::get_friendship_id( $initiator_userid, $friend_userid );
626
$friendship = new BP_Friends_Friendship( $friendship_id );
@@ -641,10 +648,6 @@ function friends_remove_friend( $initiator_userid, $friend_userid ) {
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;
648
649
$friendship = new BP_Friends_Friendship( $friendship_id, true, false );
650
@@ -672,11 +675,7 @@ function friends_accept_friendship( $friendship_id ) {
672
return false;
673
}
674
675
- function friends_reject_friendship( $friendship_id ) {
676
- /* Check the nonce */
677
- if ( !check_admin_referer( 'friends_reject_friendship' ) )
678
- return false;
679
-
680
$friendship = new BP_Friends_Friendship( $friendship_id, true, false );
681
682
if ( !$friendship->is_confirmed && BP_Friends_Friendship::reject( $friendship_id ) ) {
102
$bp->bp_options_title = $bp->displayed_user->fullname;
103
}
104
}
105
+
106
+ do_action( 'friends_setup_nav' );
107
}
108
add_action( 'wp', 'friends_setup_nav', 2 );
109
add_action( 'admin_menu', 'friends_setup_nav', 2 );
125
global $bp;
126
127
if ( isset($bp->action_variables) && 'accept' == $bp->action_variables[0] && is_numeric($bp->action_variables[1]) ) {
128
+ /* Check the nonce */
129
+ if ( !check_admin_referer( 'friends_accept_friendship' ) )
130
+ return false;
131
+
132
if ( friends_accept_friendship( $bp->action_variables[1] ) ) {
133
bp_core_add_message( __( 'Friendship accepted', 'buddypress' ) );
134
} else {
137
bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
138
139
} else if ( isset($bp->action_variables) && 'reject' == $bp->action_variables[0] && is_numeric($bp->action_variables[1]) ) {
140
+ /* Check the nonce */
141
+ if ( !check_admin_referer( 'friends_reject_friendship' ) )
142
+ return false;
143
144
if ( friends_reject_friendship( $bp->action_variables[1] ) ) {
145
bp_core_add_message( __( 'Friendship rejected', 'buddypress' ) );
248
249
if ( !check_admin_referer( 'friends_remove_friend' ) )
250
return false;
251
+
252
if ( !friends_remove_friend( $bp->loggedin_user->id, $potential_friend_id ) ) {
253
bp_core_add_message( __( 'Friendship could not be canceled.', 'buddypress' ), 'error' );
254
} else {
582
Create a new friend relationship
583
**************************************************************************/
584
585
+ function friends_add_friend( $initiator_userid, $friend_userid, $force_accept = false ) {
586
global $bp;
587
588
$friendship = new BP_Friends_Friendship;
589
590
if ( (int)$friendship->is_confirmed )
596
$friendship->is_limited = 0;
597
$friendship->date_created = time();
598
599
+ if ( $force_accept )
600
+ $friendship->is_confirmed = 1;
601
+
602
if ( $friendship->save() ) {
603
604
+ if ( !$force_accept ) {
605
+ // Add the on screen notification
606
+ bp_core_add_notification( $friendship->initiator_user_id, $friendship->friend_user_id, 'friends', 'friendship_request' );
607
+
608
+ // Send the email notification
609
+ require_once( BP_PLUGIN_DIR . '/bp-friends/bp-friends-notifications.php' );
610
+ friends_notification_new_request( $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
611
+
612
+ do_action( 'friends_friendship_requested', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
613
+ } else {
614
+ do_action( 'friends_friendship_accepted', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id );
615
+ }
616
+
617
return true;
618
}
619
628
629
function friends_remove_friend( $initiator_userid, $friend_userid ) {
630
global $bp;
631
632
$friendship_id = BP_Friends_Friendship::get_friendship_id( $initiator_userid, $friend_userid );
633
$friendship = new BP_Friends_Friendship( $friendship_id );
648
649
function friends_accept_friendship( $friendship_id ) {
650
global $bp;
651
652
$friendship = new BP_Friends_Friendship( $friendship_id, true, false );
653
675
return false;
676
}
677
678
+ function friends_reject_friendship( $friendship_id ) {
679
$friendship = new BP_Friends_Friendship( $friendship_id, true, false );
680
681
if ( !$friendship->is_confirmed && BP_Friends_Friendship::reject( $friendship_id ) ) {
bp-friends/bp-friends-templatetags.php CHANGED
@@ -46,7 +46,7 @@ class BP_Friendship_Template {
46
$this->friendships = $this->friendships['requests'];
47
$this->friendship_count = count($this->friendships);
48
} else {
49
- if ( !$max )
50
$this->total_friend_count = (int)$this->friendships['total'];
51
else
52
$this->total_friend_count = (int)$max;
46
$this->friendships = $this->friendships['requests'];
47
$this->friendship_count = count($this->friendships);
48
} else {
49
+ if ( !$max || $max >= (int)$this->friendships['total'] )
50
$this->total_friend_count = (int)$this->friendships['total'];
51
else
52
$this->total_friend_count = (int)$max;
bp-groups.php CHANGED
@@ -283,6 +283,8 @@ function groups_setup_nav() {
283
}
284
}
285
}
286
}
287
add_action( 'wp', 'groups_setup_nav', 2 );
288
add_action( 'admin_menu', 'groups_setup_nav', 2 );
@@ -318,6 +320,9 @@ function groups_screen_group_invites() {
318
$group_id = $bp->action_variables[1];
319
320
if ( isset($bp->action_variables) && in_array( 'accept', $bp->action_variables ) && is_numeric($group_id) ) {
321
322
if ( !groups_accept_invite( $bp->loggedin_user->id, $group_id ) ) {
323
bp_core_add_message( __('Group invite could not be accepted', 'buddypress'), 'error' );
@@ -331,7 +336,10 @@ function groups_screen_group_invites() {
331
bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
332
333
} else if ( isset($bp->action_variables) && in_array( 'reject', $bp->action_variables ) && is_numeric($group_id) ) {
334
-
335
if ( !groups_reject_invite( $bp->loggedin_user->id, $group_id ) ) {
336
bp_core_add_message( __('Group invite could not be rejected', 'buddypress'), 'error' );
337
} else {
@@ -430,6 +438,10 @@ function groups_screen_group_forum() {
430
431
/* Posting a reply */
432
if ( isset( $_POST['submit_reply'] ) && function_exists( 'bp_forums_new_post') ) {
433
groups_new_group_forum_post( $_POST['reply_text'], $topic_id );
434
bp_core_redirect( bp_get_group_permalink( $group_obj ) . '/forum/topic/' . $topic_id );
435
}
@@ -442,6 +454,10 @@ function groups_screen_group_forum() {
442
443
/* Posting a topic */
444
if ( isset( $_POST['submit_topic'] ) && function_exists( 'bp_forums_new_topic') ) {
445
groups_new_group_forum_topic( $_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id );
446
bp_core_redirect( bp_get_group_permalink( $group_obj ) . '/forum/' );
447
}
@@ -462,7 +478,10 @@ function groups_screen_group_wire() {
462
463
if ( $bp->is_single_item ) {
464
if ( 'post' == $wire_action && BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group_obj->id ) ) {
465
-
466
if ( !groups_new_wire_post( $group_obj->id, $_POST['wire-post-textarea'] ) ) {
467
bp_core_add_message( __('Wire message could not be posted.', 'buddypress'), 'error' );
468
} else {
@@ -478,6 +497,10 @@ function groups_screen_group_wire() {
478
} else if ( 'delete' == $wire_action && BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group_obj->id ) ) {
479
$wire_message_id = $bp->action_variables[1];
480
481
if ( !groups_delete_wire_post( $wire_message_id, $bp->groups->table_name_wire ) ) {
482
bp_core_add_message( __('There was an error deleting the wire message.', 'buddypress'), 'error' );
483
} else {
@@ -515,6 +538,10 @@ function groups_screen_group_invite() {
515
516
if ( $bp->is_single_item ) {
517
if ( isset($bp->action_variables) && 'send' == $bp->action_variables[0] ) {
518
// Send the invites.
519
groups_send_invites($group_obj);
520
@@ -576,6 +603,10 @@ function groups_screen_group_request_membership() {
576
if ( 'private' == $group_obj->status ) {
577
// If the user has submitted a request, send it.
578
if ( isset( $_POST['group-request-send']) ) {
579
if ( !groups_send_membership_request( $bp->loggedin_user->id, $group_obj->id ) ) {
580
bp_core_add_message( __( 'There was an error sending your group membership request, please try again.', 'buddypress' ), 'error' );
581
} else {
@@ -611,6 +642,10 @@ function groups_screen_group_admin_edit_details() {
611
612
// If the edit form has been submitted, save the edited details
613
if ( isset( $_POST['save'] ) ) {
614
if ( !groups_edit_base_group_details( $_POST['group-id'], $_POST['group-name'], $_POST['group-desc'], $_POST['group-news'], (int)$_POST['group-notify-members'] ) ) {
615
bp_core_add_message( __( 'There was an error updating group details, please try again.', 'buddypress' ), 'error' );
616
} else {
@@ -646,7 +681,13 @@ function groups_screen_group_admin_settings() {
646
$enable_forum = ( isset($_POST['group-show-forum'] ) ) ? 1 : 0;
647
$enable_photos = ( isset($_POST['group-show-photos'] ) ) ? 1 : 0;
648
$photos_admin_only = ( $_POST['group-photos-status'] != 'all' ) ? 1 : 0;
649
- $status = $_POST['group-status'];
650
651
if ( !groups_edit_group_settings( $_POST['group-id'], $enable_wire, $enable_forum, $enable_photos, $photos_admin_only, $status ) ) {
652
bp_core_add_message( __( 'There was an error updating group settings, please try again.', 'buddypress' ), 'error' );
@@ -722,6 +763,10 @@ function groups_screen_group_admin_manage_members() {
722
if ( 'promote' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
723
$user_id = $bp->action_variables[2];
724
725
// Promote a user.
726
if ( !groups_promote_member( $user_id, $group_obj->id ) ) {
727
bp_core_add_message( __( 'There was an error when promoting that user, please try again', 'buddypress' ), 'error' );
@@ -736,7 +781,11 @@ function groups_screen_group_admin_manage_members() {
736
737
if ( 'demote' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
738
$user_id = $bp->action_variables[2];
739
-
740
// Demote a user.
741
if ( !groups_demote_member( $user_id, $group_obj->id ) ) {
742
bp_core_add_message( __( 'There was an error when demoting that user, please try again', 'buddypress' ), 'error' );
@@ -751,7 +800,11 @@ function groups_screen_group_admin_manage_members() {
751
752
if ( 'ban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
753
$user_id = $bp->action_variables[2];
754
-
755
// Ban a user.
756
if ( !groups_ban_member( $user_id, $group_obj->id ) ) {
757
bp_core_add_message( __( 'There was an error when banning that user, please try again', 'buddypress' ), 'error' );
@@ -766,7 +819,11 @@ function groups_screen_group_admin_manage_members() {
766
767
if ( 'unban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
768
$user_id = $bp->action_variables[2];
769
-
770
// Remove a ban for user.
771
if ( !groups_unban_member( $user_id, $group_obj->id ) ) {
772
bp_core_add_message( __( 'There was an error when unbanning that user, please try again', 'buddypress' ), 'error' );
@@ -804,6 +861,10 @@ function groups_screen_group_admin_requests() {
804
if ( isset($request_action) && isset($membership_id) ) {
805
if ( 'accept' == $request_action && is_numeric($membership_id) ) {
806
807
// Accept the membership request
808
if ( !groups_accept_membership_request( $membership_id ) ) {
809
bp_core_add_message( __( 'There was an error accepting the membership request, please try again.', 'buddypress' ), 'error' );
@@ -812,7 +873,10 @@ function groups_screen_group_admin_requests() {
812
}
813
814
} else if ( 'reject' == $request_action && is_numeric($membership_id) ) {
815
-
816
// Reject the membership request
817
if ( !groups_reject_membership_request( $membership_id ) ) {
818
bp_core_add_message( __( 'There was an error rejecting the membership request, please try again.', 'buddypress' ), 'error' );
@@ -843,6 +907,10 @@ function groups_screen_group_admin_delete_group() {
843
return false;
844
845
if ( isset( $_POST['delete-group-button'] ) && isset( $_POST['delete-group-understand'] ) ) {
846
// Group admin has deleted the group, now do it.
847
if ( !groups_delete_group( $_POST['group-id']) ) {
848
bp_core_add_message( __( 'There was an error deleting the group, please try again.', 'buddypress' ), 'error' );
@@ -1095,11 +1163,11 @@ function groups_format_notifications( $action, $item_id, $secondary_item_id, $to
1095
case 'new_membership_request':
1096
$group_id = $secondary_item_id;
1097
$requesting_user_id = $item_id;
1098
-
1099
$group = new BP_Groups_Group( $group_id, false, false );
1100
1101
$group_link = bp_get_group_permalink( $group );
1102
-
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 {
@@ -1517,7 +1585,7 @@ function groups_create_group( $step, $group_id ) {
1517
if ( !check_admin_referer( 'groups_step4_save' ) )
1518
return false;
1519
1520
- groups_send_invites( $group_obj, true );
1521
1522
do_action( 'groups_created_group', $group_obj->id );
1523
@@ -1531,7 +1599,10 @@ function groups_create_group( $step, $group_id ) {
1531
1532
function groups_check_slug( $slug ) {
1533
global $bp;
1534
-
1535
if ( in_array( $slug, $bp->groups->forbidden_names ) ) {
1536
$slug = $slug . '-' . rand();
1537
}
@@ -1543,9 +1614,6 @@ function groups_check_slug( $slug ) {
1543
while ( BP_Groups_Group::check_slug( $slug ) );
1544
}
1545
1546
- if ( 'wp' == substr( $slug, 0, 2 ) )
1547
- $slug = substr( $slug, 2, strlen( $slug ) - 2 );
1548
-
1549
return $slug;
1550
}
1551
@@ -1591,10 +1659,6 @@ function groups_new_group_forum( $group_id = false, $group_name = false, $group_
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' ) )
1597
- return false;
1598
1599
if ( $forum_post = bp_forums_new_post( $post_text, $topic_id ) ) {
1600
bp_core_add_message( __( 'Reply posted successfully!', 'buddypress') );
@@ -1613,10 +1677,6 @@ function groups_new_group_forum_post( $post_text, $topic_id ) {
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' ) )
1619
- return false;
1620
1621
if ( $topic = bp_forums_new_topic( $topic_title, $topic_text, $topic_tags, $forum_id ) ) {
1622
bp_core_add_message( __( 'Topic posted successfully!', 'buddypress') );
@@ -1635,10 +1695,6 @@ function groups_new_group_forum_topic( $topic_title, $topic_text, $topic_tags, $
1635
1636
function groups_invite_user( $user_id, $group_id ) {
1637
global $bp;
1638
-
1639
- /* Check the nonce */
1640
- if ( !check_admin_referer( 'groups_invite_uninvite_user' ) )
1641
- return false;
1642
1643
if ( groups_is_user_member( $user_id, $group_id ) )
1644
return false;
@@ -1658,16 +1714,8 @@ function groups_invite_user( $user_id, $group_id ) {
1658
return true;
1659
}
1660
1661
- function groups_uninvite_user( $user_id, $group_id, $skip_check = false ) {
1662
global $bp;
1663
-
1664
- /* Because this is called on groups_leave_group() and a nonce has already been
1665
- * checked, we need a way of overriding a double check.
1666
- */
1667
- if ( !$skip_check ) {
1668
- if ( !check_admin_referer( 'groups_invite_uninvite_user' ) )
1669
- return false;
1670
- }
1671
1672
if ( !BP_Groups_Member::delete( $user_id, $group_id ) )
1673
return false;
@@ -1679,10 +1727,6 @@ function groups_uninvite_user( $user_id, $group_id, $skip_check = false ) {
1679
1680
function groups_accept_invite( $user_id, $group_id ) {
1681
global $group_obj;
1682
-
1683
- /* Check the nonce */
1684
- if ( !check_admin_referer( 'groups_accept_invite' ) )
1685
- return false;
1686
1687
if ( groups_is_user_member( $user_id, $group_id ) )
1688
return false;
@@ -1734,13 +1778,8 @@ function groups_get_invites_for_user( $user_id = false ) {
1734
return BP_Groups_Member::get_invites( $user_id );
1735
}
1736
1737
- function groups_send_invites( $group_obj, $skip_check = false ) {
1738
global $bp;
1739
-
1740
- if ( !$skip_check ) {
1741
- if ( !check_admin_referer( 'groups_send_invites', '_wpnonce_send_invites' ) )
1742
- return false;
1743
- }
1744
1745
require_once ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );
1746
@@ -1770,11 +1809,7 @@ function groups_check_group_exists( $group_id ) {
1770
1771
function groups_leave_group( $group_id, $user_id = false ) {
1772
global $bp;
1773
-
1774
- /* Check the nonce */
1775
- if ( !check_admin_referer( 'groups_leave_group' ) )
1776
- return false;
1777
-
1778
if ( !$user_id )
1779
$user_id = $bp->loggedin_user->id;
1780
@@ -1796,10 +1831,6 @@ function groups_leave_group( $group_id, $user_id = false ) {
1796
1797
function groups_join_group( $group_id, $user_id = false ) {
1798
global $bp;
1799
-
1800
- /* Check the nonce */
1801
- if ( !check_admin_referer( 'groups_join_group' ) )
1802
- return false;
1803
1804
if ( !$user_id )
1805
$user_id = $bp->loggedin_user->id;
@@ -1857,10 +1888,6 @@ function groups_is_group_mod( $user_id, $group_id ) {
1857
function groups_new_wire_post( $group_id, $content ) {
1858
global $group_obj, $bp;
1859
1860
- /* Check the nonce first. */
1861
- if ( !check_admin_referer( 'bp_wire_post' ) )
1862
- return false;
1863
-
1864
$private = false;
1865
if ( $group_obj->status != 'public' )
1866
$private = true;
@@ -1876,11 +1903,7 @@ function groups_new_wire_post( $group_id, $content ) {
1876
1877
function groups_delete_wire_post( $wire_post_id, $table_name ) {
1878
global $bp;
1879
-
1880
- /* Check the nonce first. */
1881
- if ( !check_admin_referer( 'bp_wire_delete_link' ) )
1882
- return false;
1883
-
1884
if ( bp_wire_delete_post( $wire_post_id, $bp->groups->slug, $table_name ) ) {
1885
do_action( 'groups_deleted_wire_post', $wire_post_id );
1886
return true;
@@ -1891,11 +1914,7 @@ function groups_delete_wire_post( $wire_post_id, $table_name ) {
1891
1892
function groups_edit_base_group_details( $group_id, $group_name, $group_desc, $group_news, $notify_members ) {
1893
global $bp;
1894
-
1895
- /* Check the nonce first. */
1896
- if ( !check_admin_referer( 'groups_edit_group_details' ) )
1897
- return false;
1898
-
1899
if ( empty( $group_name ) || empty( $group_desc ) )
1900
return false;
1901
@@ -1920,15 +1939,20 @@ function groups_edit_base_group_details( $group_id, $group_name, $group_desc, $g
1920
function groups_edit_group_settings( $group_id, $enable_wire, $enable_forum, $enable_photos, $photos_admin_only, $status ) {
1921
global $bp;
1922
1923
- /* Check the nonce first. */
1924
- if ( !check_admin_referer( 'groups_edit_group_settings' ) )
1925
- return false;
1926
-
1927
$group = new BP_Groups_Group( $group_id, false, false );
1928
$group->enable_wire = $enable_wire;
1929
$group->enable_forum = $enable_forum;
1930
$group->enable_photos = $enable_photos;
1931
$group->photos_admin_only = $photos_admin_only;
1932
$group->status = $status;
1933
1934
if ( !$group->save() )
@@ -1948,10 +1972,6 @@ function groups_edit_group_settings( $group_id, $enable_wire, $enable_forum, $en
1948
1949
function groups_promote_member( $user_id, $group_id ) {
1950
global $bp;
1951
-
1952
- /* Check the nonce first. */
1953
- if ( !check_admin_referer( 'groups_promote_member' ) )
1954
- return false;
1955
1956
if ( !$bp->is_item_admin )
1957
return false;
@@ -1965,10 +1985,6 @@ function groups_promote_member( $user_id, $group_id ) {
1965
1966
function groups_demote_member( $user_id, $group_id ) {
1967
global $bp;
1968
-
1969
- /* Check the nonce first. */
1970
- if ( !check_admin_referer( 'groups_demote_member' ) )
1971
- return false;
1972
1973
if ( !$bp->is_item_admin )
1974
return false;
@@ -1983,10 +1999,6 @@ function groups_demote_member( $user_id, $group_id ) {
1983
function groups_ban_member( $user_id, $group_id ) {
1984
global $bp;
1985
1986
- /* Check the nonce first. */
1987
- if ( !check_admin_referer( 'groups_ban_member' ) )
1988
- return false;
1989
-
1990
if ( !$bp->is_item_admin )
1991
return false;
1992
@@ -1999,10 +2011,6 @@ function groups_ban_member( $user_id, $group_id ) {
1999
2000
function groups_unban_member( $user_id, $group_id ) {
2001
global $bp;
2002
-
2003
- /* Check the nonce first. */
2004
- if ( !check_admin_referer( 'groups_unban_member' ) )
2005
- return false;
2006
2007
if ( !$bp->is_item_admin )
2008
return false;
@@ -2017,10 +2025,6 @@ function groups_unban_member( $user_id, $group_id ) {
2017
function groups_send_membership_request( $requesting_user_id, $group_id ) {
2018
global $bp;
2019
2020
- /* Check the nonce first. */
2021
- if ( !check_admin_referer( 'groups_request_membership' ) )
2022
- return false;
2023
-
2024
$requesting_user = new BP_Groups_Member;
2025
$requesting_user->group_id = $group_id;
2026
$requesting_user->user_id = $requesting_user_id;
@@ -2049,14 +2053,14 @@ function groups_send_membership_request( $requesting_user_id, $group_id ) {
2049
return false;
2050
}
2051
2052
- function groups_accept_membership_request( $membership_id ) {
2053
global $bp;
2054
2055
- /* Check the nonce first. */
2056
- if ( !check_admin_referer( 'groups_accept_membership_request' ) )
2057
- return false;
2058
2059
- $membership = new BP_Groups_Member( false, false, $membership_id );
2060
$membership->accept_request();
2061
2062
if ( !$membership->save() )
@@ -2077,13 +2081,11 @@ function groups_accept_membership_request( $membership_id ) {
2077
return true;
2078
}
2079
2080
- function groups_reject_membership_request( $membership_id ) {
2081
-
2082
- /* Check the nonce first. */
2083
- if ( !check_admin_referer( 'groups_reject_membership_request' ) )
2084
- return false;
2085
-
2086
- $membership = new BP_Groups_Member( false, false, $membership_id );
2087
2088
if ( !BP_Groups_Member::delete( $membership->user_id, $membership->group_id ) )
2089
return false;
@@ -2097,6 +2099,21 @@ function groups_reject_membership_request( $membership_id ) {
2097
return true;
2098
}
2099
2100
function groups_redirect_to_random_group() {
2101
global $bp, $wpdb;
2102
@@ -2110,10 +2127,6 @@ add_action( 'wp', 'groups_redirect_to_random_group', 6 );
2110
2111
function groups_delete_group( $group_id ) {
2112
global $bp;
2113
-
2114
- /* Check the nonce first. */
2115
- if ( !check_admin_referer( 'groups_delete_group' ) )
2116
- return false;
2117
2118
// Check the user is the group admin.
2119
if ( !$bp->is_item_admin )
283
}
284
}
285
}
286
+
287
+ do_action( 'groups_setup_nav', $has_access );
288
}
289
add_action( 'wp', 'groups_setup_nav', 2 );
290
add_action( 'admin_menu', 'groups_setup_nav', 2 );
320
$group_id = $bp->action_variables[1];
321
322
if ( isset($bp->action_variables) && in_array( 'accept', $bp->action_variables ) && is_numeric($group_id) ) {
323
+ /* Check the nonce */
324
+ if ( !check_admin_referer( 'groups_accept_invite' ) )
325
+ return false;
326
327
if ( !groups_accept_invite( $bp->loggedin_user->id, $group_id ) ) {
328
bp_core_add_message( __('Group invite could not be accepted', 'buddypress'), 'error' );
336
bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action );
337
338
} else if ( isset($bp->action_variables) && in_array( 'reject', $bp->action_variables ) && is_numeric($group_id) ) {
339
+ /* Check the nonce */
340
+ if ( !check_admin_referer( 'groups_reject_invite' ) )
341
+ return false;
342
+
343
if ( !groups_reject_invite( $bp->loggedin_user->id, $group_id ) ) {
344
bp_core_add_message( __('Group invite could not be rejected', 'buddypress'), 'error' );
345
} else {
438
439
/* Posting a reply */
440
if ( isset( $_POST['submit_reply'] ) && function_exists( 'bp_forums_new_post') ) {
441
+ /* Check the nonce */
442
+ if ( !check_admin_referer( 'bp_forums_new_reply' ) )
443
+ return false;
444
+
445
groups_new_group_forum_post( $_POST['reply_text'], $topic_id );
446
bp_core_redirect( bp_get_group_permalink( $group_obj ) . '/forum/topic/' . $topic_id );
447
}
454
455
/* Posting a topic */
456
if ( isset( $_POST['submit_topic'] ) && function_exists( 'bp_forums_new_topic') ) {
457
+ /* Check the nonce */
458
+ if ( !check_admin_referer( 'bp_forums_new_topic' ) )
459
+ return false;
460
+
461
groups_new_group_forum_topic( $_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id );
462
bp_core_redirect( bp_get_group_permalink( $group_obj ) . '/forum/' );
463
}
478
479
if ( $bp->is_single_item ) {
480
if ( 'post' == $wire_action && BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group_obj->id ) ) {
481
+ /* Check the nonce first. */
482
+ if ( !check_admin_referer( 'bp_wire_post' ) )
483
+ return false;
484
+
485
if ( !groups_new_wire_post( $group_obj->id, $_POST['wire-post-textarea'] ) ) {
486
bp_core_add_message( __('Wire message could not be posted.', 'buddypress'), 'error' );
487
} else {
497
} else if ( 'delete' == $wire_action && BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group_obj->id ) ) {
498
$wire_message_id = $bp->action_variables[1];
499
500
+ /* Check the nonce first. */
501
+ if ( !check_admin_referer( 'bp_wire_delete_link' ) )
502
+ return false;
503
+
504
if ( !groups_delete_wire_post( $wire_message_id, $bp->groups->table_name_wire ) ) {
505
bp_core_add_message( __('There was an error deleting the wire message.', 'buddypress'), 'error' );
506
} else {
538
539
if ( $bp->is_single_item ) {
540
if ( isset($bp->action_variables) && 'send' == $bp->action_variables[0] ) {
541
+
542
+ if ( !check_admin_referer( 'groups_send_invites', '_wpnonce_send_invites' ) )
543
+ return false;
544
+
545
// Send the invites.
546
groups_send_invites($group_obj);
547
603
if ( 'private' == $group_obj->status ) {
604
// If the user has submitted a request, send it.
605
if ( isset( $_POST['group-request-send']) ) {
606
+ /* Check the nonce first. */
607
+ if ( !check_admin_referer( 'groups_request_membership' ) )
608
+ return false;
609
+
610
if ( !groups_send_membership_request( $bp->loggedin_user->id, $group_obj->id ) ) {
611
bp_core_add_message( __( 'There was an error sending your group membership request, please try again.', 'buddypress' ), 'error' );
612
} else {
642
643
// If the edit form has been submitted, save the edited details
644
if ( isset( $_POST['save'] ) ) {
645
+ /* Check the nonce first. */
646
+ if ( !check_admin_referer( 'groups_edit_group_details' ) )
647
+ return false;
648
+
649
if ( !groups_edit_base_group_details( $_POST['group-id'], $_POST['group-name'], $_POST['group-desc'], $_POST['group-news'], (int)$_POST['group-notify-members'] ) ) {
650
bp_core_add_message( __( 'There was an error updating group details, please try again.', 'buddypress' ), 'error' );
651
} else {
681
$enable_forum = ( isset($_POST['group-show-forum'] ) ) ? 1 : 0;
682
$enable_photos = ( isset($_POST['group-show-photos'] ) ) ? 1 : 0;
683
$photos_admin_only = ( $_POST['group-photos-status'] != 'all' ) ? 1 : 0;
684
+
685
+ $allowed_status = apply_filters( 'groups_allowed_status', array( 'public', 'private', 'hidden' ) );
686
+ $status = ( in_array( $_POST['group-status'], $allowed_status ) ) ? $_POST['group-status'] : 'public';
687
+
688
+ /* Check the nonce first. */
689
+ if ( !check_admin_referer( 'groups_edit_group_settings' ) )
690
+ return false;
691
692
if ( !groups_edit_group_settings( $_POST['group-id'], $enable_wire, $enable_forum, $enable_photos, $photos_admin_only, $status ) ) {
693
bp_core_add_message( __( 'There was an error updating group settings, please try again.', 'buddypress' ), 'error' );
763
if ( 'promote' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
764
$user_id = $bp->action_variables[2];
765
766
+ /* Check the nonce first. */
767
+ if ( !check_admin_referer( 'groups_promote_member' ) )
768
+ return false;
769
+
770
// Promote a user.
771
if ( !groups_promote_member( $user_id, $group_obj->id ) ) {
772
bp_core_add_message( __( 'There was an error when promoting that user, please try again', 'buddypress' ), 'error' );
781
782
if ( 'demote' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
783
$user_id = $bp->action_variables[2];
784
+
785
+ /* Check the nonce first. */
786
+ if ( !check_admin_referer( 'groups_demote_member' ) )
787
+ return false;
788
+
789
// Demote a user.
790
if ( !groups_demote_member( $user_id, $group_obj->id ) ) {
791
bp_core_add_message( __( 'There was an error when demoting that user, please try again', 'buddypress' ), 'error' );
800
801
if ( 'ban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
802
$user_id = $bp->action_variables[2];
803
+
804
+ /* Check the nonce first. */
805
+ if ( !check_admin_referer( 'groups_ban_member' ) )
806
+ return false;
807
+
808
// Ban a user.
809
if ( !groups_ban_member( $user_id, $group_obj->id ) ) {
810
bp_core_add_message( __( 'There was an error when banning that user, please try again', 'buddypress' ), 'error' );
819
820
if ( 'unban' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
821
$user_id = $bp->action_variables[2];
822
+
823
+ /* Check the nonce first. */
824
+ if ( !check_admin_referer( 'groups_unban_member' ) )
825
+ return false;
826
+
827
// Remove a ban for user.
828
if ( !groups_unban_member( $user_id, $group_obj->id ) ) {
829
bp_core_add_message( __( 'There was an error when unbanning that user, please try again', 'buddypress' ), 'error' );
861
if ( isset($request_action) && isset($membership_id) ) {
862
if ( 'accept' == $request_action && is_numeric($membership_id) ) {
863
864
+ /* Check the nonce first. */
865
+ if ( !check_admin_referer( 'groups_accept_membership_request' ) )
866
+ return false;
867
+
868
// Accept the membership request
869
if ( !groups_accept_membership_request( $membership_id ) ) {
870
bp_core_add_message( __( 'There was an error accepting the membership request, please try again.', 'buddypress' ), 'error' );
873
}
874
875
} else if ( 'reject' == $request_action && is_numeric($membership_id) ) {
876
+ /* Check the nonce first. */
877
+ if ( !check_admin_referer( 'groups_reject_membership_request' ) )
878
+ return false;
879
+
880
// Reject the membership request
881
if ( !groups_reject_membership_request( $membership_id ) ) {
882
bp_core_add_message( __( 'There was an error rejecting the membership request, please try again.', 'buddypress' ), 'error' );
907
return false;
908
909
if ( isset( $_POST['delete-group-button'] ) && isset( $_POST['delete-group-understand'] ) ) {
910
+ /* Check the nonce first. */
911
+ if ( !check_admin_referer( 'groups_delete_group' ) )
912
+ return false;
913
+
914
// Group admin has deleted the group, now do it.
915
if ( !groups_delete_group( $_POST['group-id']) ) {
916
bp_core_add_message( __( 'There was an error deleting the group, please try again.', 'buddypress' ), 'error' );
1163
case 'new_membership_request':
1164
$group_id = $secondary_item_id;
1165
$requesting_user_id = $item_id;
1166
+
1167
$group = new BP_Groups_Group( $group_id, false, false );
1168
1169
$group_link = bp_get_group_permalink( $group );
1170
+
1171
if ( (int)$total_items > 1 ) {
1172
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 );
1173
} else {
1585
if ( !check_admin_referer( 'groups_step4_save' ) )
1586
return false;
1587
1588
+ groups_send_invites( $group_obj );
1589
1590
do_action( 'groups_created_group', $group_obj->id );
1591
1599
1600
function groups_check_slug( $slug ) {
1601
global $bp;
1602
+
1603
+ if ( 'wp' == substr( $slug, 0, 2 ) )
1604
+ $slug = substr( $slug, 2, strlen( $slug ) - 2 );
1605
+
1606
if ( in_array( $slug, $bp->groups->forbidden_names ) ) {
1607
$slug = $slug . '-' . rand();
1608
}
1614
while ( BP_Groups_Group::check_slug( $slug ) );
1615
}
1616
1617
return $slug;
1618
}
1619
1659
1660
function groups_new_group_forum_post( $post_text, $topic_id ) {
1661
global $group_obj, $bp;
1662
1663
if ( $forum_post = bp_forums_new_post( $post_text, $topic_id ) ) {
1664
bp_core_add_message( __( 'Reply posted successfully!', 'buddypress') );
1677
1678
function groups_new_group_forum_topic( $topic_title, $topic_text, $topic_tags, $forum_id ) {
1679
global $group_obj, $bp;
1680
1681
if ( $topic = bp_forums_new_topic( $topic_title, $topic_text, $topic_tags, $forum_id ) ) {
1682
bp_core_add_message( __( 'Topic posted successfully!', 'buddypress') );
1695
1696
function groups_invite_user( $user_id, $group_id ) {
1697
global $bp;
1698
1699
if ( groups_is_user_member( $user_id, $group_id ) )
1700
return false;
1714
return true;
1715
}
1716
1717
+ function groups_uninvite_user( $user_id, $group_id, $deprecated = true ) {
1718
global $bp;
1719
1720
if ( !BP_Groups_Member::delete( $user_id, $group_id ) )
1721
return false;
1727
1728
function groups_accept_invite( $user_id, $group_id ) {
1729
global $group_obj;
1730
1731
if ( groups_is_user_member( $user_id, $group_id ) )
1732
return false;
1778
return BP_Groups_Member::get_invites( $user_id );
1779
}
1780
1781
+ function groups_send_invites( $group_obj, $deprecated = true ) {
1782
global $bp;
1783
1784
require_once ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );
1785
1809
1810
function groups_leave_group( $group_id, $user_id = false ) {
1811
global $bp;
1812
+
1813
if ( !$user_id )
1814
$user_id = $bp->loggedin_user->id;
1815
1831
1832
function groups_join_group( $group_id, $user_id = false ) {
1833
global $bp;
1834
1835
if ( !$user_id )
1836
$user_id = $bp->loggedin_user->id;
1888
function groups_new_wire_post( $group_id, $content ) {
1889
global $group_obj, $bp;
1890
1891
$private = false;
1892
if ( $group_obj->status != 'public' )
1893
$private = true;
1903
1904
function groups_delete_wire_post( $wire_post_id, $table_name ) {
1905
global $bp;
1906
+
1907
if ( bp_wire_delete_post( $wire_post_id, $bp->groups->slug, $table_name ) ) {
1908
do_action( 'groups_deleted_wire_post', $wire_post_id );
1909
return true;
1914
1915
function groups_edit_base_group_details( $group_id, $group_name, $group_desc, $group_news, $notify_members ) {
1916
global $bp;
1917
+
1918
if ( empty( $group_name ) || empty( $group_desc ) )
1919
return false;
1920
1939
function groups_edit_group_settings( $group_id, $enable_wire, $enable_forum, $enable_photos, $photos_admin_only, $status ) {
1940
global $bp;
1941
1942
$group = new BP_Groups_Group( $group_id, false, false );
1943
$group->enable_wire = $enable_wire;
1944
$group->enable_forum = $enable_forum;
1945
$group->enable_photos = $enable_photos;
1946
$group->photos_admin_only = $photos_admin_only;
1947
+
1948
+ /***
1949
+ * Before we potentially switch the group status, if it has been changed to public
1950
+ * from private and there are outstanding membership requests, auto-accept those requests.
1951
+ */
1952
+ if ( 'private' == $group->status && 'public' == $status )
1953
+ groups_accept_all_pending_membership_requests( $group->id );
1954
+
1955
+ /* Now update the status */
1956
$group->status = $status;
1957
1958
if ( !$group->save() )
1972
1973
function groups_promote_member( $user_id, $group_id ) {
1974
global $bp;
1975
1976
if ( !$bp->is_item_admin )
1977
return false;
1985
1986
function groups_demote_member( $user_id, $group_id ) {
1987
global $bp;
1988
1989
if ( !$bp->is_item_admin )
1990
return false;
1999
function groups_ban_member( $user_id, $group_id ) {
2000
global $bp;
2001
2002
if ( !$bp->is_item_admin )
2003
return false;
2004
2011
2012
function groups_unban_member( $user_id, $group_id ) {
2013
global $bp;
2014
2015
if ( !$bp->is_item_admin )
2016
return false;
2025
function groups_send_membership_request( $requesting_user_id, $group_id ) {
2026
global $bp;
2027
2028
$requesting_user = new BP_Groups_Member;
2029
$requesting_user->group_id = $group_id;
2030
$requesting_user->user_id = $requesting_user_id;
2053
return false;
2054
}
2055
2056
+ function groups_accept_membership_request( $membership_id, $user_id = false, $group_id = false ) {
2057
global $bp;
2058
2059
+ if ( $user_id && $group_id )
2060
+ $membership = new BP_Groups_Member( $user_id, $group_id );
2061
+ else
2062
+ $membership = new BP_Groups_Member( false, false, $membership_id );
2063
2064
$membership->accept_request();
2065
2066
if ( !$membership->save() )
2081
return true;
2082
}
2083
2084
+ function groups_reject_membership_request( $membership_id, $user_id = false, $group_id = false ) {
2085
+ if ( $user_id && $group_id )
2086
+ $membership = new BP_Groups_Member( $user_id, $group_id );
2087
+ else
2088
+ $membership = new BP_Groups_Member( false, false, $membership_id );
2089
2090
if ( !BP_Groups_Member::delete( $membership->user_id, $membership->group_id ) )
2091
return false;
2099
return true;
2100
}
2101
2102
+ function groups_accept_all_pending_membership_requests( $group_id ) {
2103
+ $user_ids = BP_Groups_Member::get_all_membership_request_user_ids( $group_id );
2104
+
2105
+ if ( !$user_ids )
2106
+ return false;
2107
+
2108
+ foreach ( (array) $user_ids as $user_id ) {
2109
+ groups_accept_membership_request( false, $user_id, $group_id );
2110
+ }
2111
+
2112
+ do_action( 'groups_accept_all_pending_membership_requests', $group_id );
2113
+
2114
+ return true;
2115
+ }
2116
+
2117
function groups_redirect_to_random_group() {
2118
global $bp, $wpdb;
2119
2127
2128
function groups_delete_group( $group_id ) {
2129
global $bp;
2130
2131
// Check the user is the group admin.
2132
if ( !$bp->is_item_admin )
bp-groups/bp-groups-classes.php CHANGED
@@ -916,6 +916,12 @@ Class BP_Groups_Member {
916
return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_mod = 1 AND is_banned = 0", $group_id ) );
917
}
918
919
function get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true ) {
920
global $bp, $wpdb;
921
916
return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_mod = 1 AND is_banned = 0", $group_id ) );
917
}
918
919
+ function get_all_membership_request_user_ids( $group_id ) {
920
+ global $bp, $wpdb;
921
+
922
+ return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0 AND inviter_id = 0", $group_id ) );
923
+ }
924
+
925
function get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true ) {
926
global $bp, $wpdb;
927
bp-groups/bp-groups-templatetags.php CHANGED
@@ -306,7 +306,7 @@ function bp_groups_random_selection( $total_groups = 5 ) {
306
?>
307
<li>
308
<div class="item-avatar">
309
- <a href="<?php echo bp_get_group_permalink( $group ) ?>" title="<?php echo bp_get_group_name( $group ) ?>"><?php echo get_group_avatar_thumb( $group ) ?></a>
310
</div>
311
312
<div class="item">
@@ -467,7 +467,7 @@ class BP_Groups_User_Groups_Template {
467
$this->total_group_count = 1;
468
$this->group_count = 1;
469
} else {
470
- if ( !$max )
471
$this->total_group_count = (int)$this->groups['total'];
472
else
473
$this->total_group_count = (int)$max;
@@ -980,7 +980,7 @@ function bp_group_all_members_permalink( $deprecated = true, $deprecated2 = fals
980
if ( !$group )
981
$group =& $groups_template->group;
982
983
- return apply_filters( 'bp_get_group_all_members_permalink', bp_get_group_permalink( $group ) . '/' . BP_MEMBERS_SLUG );
984
}
985
986
function bp_group_random_members( $group = false ) {
@@ -1641,7 +1641,7 @@ class BP_Groups_Group_Members_Template {
1641
1642
$this->members = BP_Groups_Member::get_all_for_group( $group_id, $this->pag_num, $this->pag_page, $exclude_admins_mods, $exclude_banned );
1643
1644
- if ( !$max )
1645
$this->total_member_count = (int)$this->members['count'];
1646
else
1647
$this->total_member_count = (int)$max;
@@ -1917,7 +1917,7 @@ class BP_Groups_Site_Groups_Template {
1917
}
1918
}
1919
1920
- if ( !$max )
1921
$this->total_group_count = (int)$this->groups['total'];
1922
else
1923
$this->total_group_count = (int)$max;
@@ -2222,7 +2222,7 @@ class BP_Groups_Membership_Requests_Template {
2222
2223
$this->requests = BP_Groups_Group::get_membership_requests( $group_id, $this->pag_num, $this->pag_page );
2224
2225
- if ( !$max )
2226
$this->total_request_count = (int)$this->requests['total'];
2227
else
2228
$this->total_request_count = (int)$max;
306
?>
307
<li>
308
<div class="item-avatar">
309
+ <a href="<?php echo bp_get_group_permalink( $group ) ?>" title="<?php echo bp_get_group_name( $group ) ?>"><?php echo bp_get_group_avatar_thumb( $group ) ?></a>
310
</div>
311
312
<div class="item">
467
$this->total_group_count = 1;
468
$this->group_count = 1;
469
} else {
470
+ if ( !$max || $max >= (int)$this->groups['total'] )
471
$this->total_group_count = (int)$this->groups['total'];
472
else
473
$this->total_group_count = (int)$max;
980
if ( !$group )
981
$group =& $groups_template->group;
982
983
+ return apply_filters( 'bp_get_group_all_members_permalink', bp_get_group_permalink( $group ) . '/members' );
984
}
985
986
function bp_group_random_members( $group = false ) {
1641
1642
$this->members = BP_Groups_Member::get_all_for_group( $group_id, $this->pag_num, $this->pag_page, $exclude_admins_mods, $exclude_banned );
1643
1644
+ if ( !$max || $max >= (int)$this->members['count'] )
1645
$this->total_member_count = (int)$this->members['count'];
1646
else
1647
$this->total_member_count = (int)$max;
1917
}
1918
}
1919
1920
+ if ( !$max || $max >= (int)$this->groups['total'] )
1921
$this->total_group_count = (int)$this->groups['total'];
1922
else
1923
$this->total_group_count = (int)$max;
2222
2223
$this->requests = BP_Groups_Group::get_membership_requests( $group_id, $this->pag_num, $this->pag_page );
2224
2225
+ if ( !$max || $max >= (int)$this->requests['total'] )
2226
$this->total_request_count = (int)$this->requests['total'];
2227
else
2228
$this->total_request_count = (int)$max;
bp-loader.php CHANGED
@@ -4,12 +4,12 @@ Plugin Name: BuddyPress
4
Plugin URI: http://buddypress.org/download/
5
Description: BuddyPress will add social networking features to a new or existing WordPress MU installation.
6
Author: The BuddyPress Community
7
- Version: 1.0.1
8
Author URI: http://buddypress.org/developers/
9
Site Wide Only: true
10
*/
11
12
- define( 'BP_VERSION', '1.0.1' );
13
14
/***
15
* This file will load in each BuddyPress component based on which
4
Plugin URI: http://buddypress.org/download/
5
Description: BuddyPress will add social networking features to a new or existing WordPress MU installation.
6
Author: The BuddyPress Community
7
+ Version: 1.0.2
8
Author URI: http://buddypress.org/developers/
9
Site Wide Only: true
10
*/
11
12
+ define( 'BP_VERSION', '1.0.2' );
13
14
/***
15
* This file will load in each BuddyPress component based on which
bp-messages.php CHANGED
@@ -158,6 +158,8 @@ function messages_setup_nav() {
158
$bp->bp_options_title = $bp->displayed_user->fullname;
159
}
160
}
161
}
162
add_action( 'wp', 'messages_setup_nav', 2 );
163
add_action( 'admin_menu', 'messages_setup_nav', 2 );
@@ -191,6 +193,9 @@ function messages_screen_compose() {
191
}
192
193
if ( $recipients || ( isset($_POST['send-notice']) && is_site_admin() ) ) {
194
messages_send_message( $recipients, $_POST['subject'], $_POST['content'], $_POST['thread_id'], false, true );
195
}
196
@@ -300,7 +305,9 @@ function messages_action_delete_message() {
300
if ( !$thread_id || !is_numeric($thread_id) || !BP_Messages_Thread::check_access($thread_id) ) {
301
bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action );
302
} else {
303
- //echo $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action; die;
304
// delete message
305
if ( !messages_delete_thread($thread_id) ) {
306
bp_core_add_message( __('There was an error deleting that message.', 'buddypress'), 'error' );
@@ -324,6 +331,9 @@ function messages_action_bulk_delete() {
324
if ( !$thread_ids || !BP_Messages_Thread::check_access($thread_ids) ) {
325
bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action );
326
} else {
327
if ( !messages_delete_thread( $thread_ids ) ) {
328
bp_core_add_message( __('There was an error deleting messages.', 'buddypress'), 'error' );
329
} else {
@@ -382,10 +392,7 @@ function messages_send_message( $recipients, $subject, $content, $thread_id, $fr
382
global $pmessage;
383
global $message, $type;
384
global $bp, $current_user;
385
-
386
- if ( !check_admin_referer( 'messages_send_message' ) )
387
- return false;
388
-
389
messages_add_callback_values( $recipients, $subject, $content );
390
391
if ( isset( $_POST['send-notice'] ) ) {
@@ -542,9 +549,6 @@ function messages_send_notice( $subject, $message, $from_template ) {
542
**************************************************************************/
543
544
function messages_delete_thread( $thread_ids ) {
545
- if ( !check_admin_referer( 'messages_delete_thread' ) )
546
- return false;
547
-
548
if ( is_array($thread_ids) ) {
549
$error = 0;
550
for ( $i = 0; $i < count($thread_ids); $i++ ) {
158
$bp->bp_options_title = $bp->displayed_user->fullname;
159
}
160
}
161
+
162
+ do_action( 'messages_setup_nav' );
163
}
164
add_action( 'wp', 'messages_setup_nav', 2 );
165
add_action( 'admin_menu', 'messages_setup_nav', 2 );
193
}
194
195
if ( $recipients || ( isset($_POST['send-notice']) && is_site_admin() ) ) {
196
+ if ( !check_admin_referer( 'messages_send_message' ) )
197
+ return false;
198
+
199
messages_send_message( $recipients, $_POST['subject'], $_POST['content'], $_POST['thread_id'], false, true );
200
}
201
305
if ( !$thread_id || !is_numeric($thread_id) || !BP_Messages_Thread::check_access($thread_id) ) {
306
bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action );
307
} else {
308
+ if ( !check_admin_referer( 'messages_delete_thread' ) )
309
+ return false;
310
+
311
// delete message
312
if ( !messages_delete_thread($thread_id) ) {
313
bp_core_add_message( __('There was an error deleting that message.', 'buddypress'), 'error' );
331
if ( !$thread_ids || !BP_Messages_Thread::check_access($thread_ids) ) {
332
bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action );
333
} else {
334
+ if ( !check_admin_referer( 'messages_delete_thread' ) )
335
+ return false;
336
+
337
if ( !messages_delete_thread( $thread_ids ) ) {
338
bp_core_add_message( __('There was an error deleting messages.', 'buddypress'), 'error' );
339
} else {
392
global $pmessage;
393
global $message, $type;
394
global $bp, $current_user;
395
+
396
messages_add_callback_values( $recipients, $subject, $content );
397
398
if ( isset( $_POST['send-notice'] ) ) {
549
**************************************************************************/
550
551
function messages_delete_thread( $thread_ids ) {
552
if ( is_array($thread_ids) ) {
553
$error = 0;
554
for ( $i = 0; $i < count($thread_ids); $i++ ) {
bp-messages/bp-messages-ajax.php CHANGED
@@ -28,10 +28,15 @@ add_action( 'wp_ajax_messages_send_reply', 'messages_ajax_send_reply' );
28
29
function messages_ajax_autocomplete_results() {
30
global $bp;
31
32
// Get the friend ids based on the search terms
33
- $friends = apply_filters( 'bp_friends_autocomplete_list', friends_search_friends( $_GET['q'], $bp->loggedin_user->id, $_GET['limit'], 1 ), $_GET['q'], $_GET['limit'] );
34
35
if ( $friends['friends'] ) {
36
foreach ( $friends['friends'] as $user_id ) {
37
$ud = get_userdata($user_id);
28
29
function messages_ajax_autocomplete_results() {
30
global $bp;
31
+
32
+ $friends = false;
33
34
// Get the friend ids based on the search terms
35
+ if ( function_exists( 'friends_search_friends' ) )
36
+ $friends = friends_search_friends( $_GET['q'], $bp->loggedin_user->id, $_GET['limit'], 1 );
37
38
+ $friends = apply_filters( 'bp_friends_autocomplete_list', $friends, $_GET['q'], $_GET['limit'] );
39
+
40
if ( $friends['friends'] ) {
41
foreach ( $friends['friends'] as $user_id ) {
42
$ud = get_userdata($user_id);
bp-messages/bp-messages-templatetags.php CHANGED
@@ -15,7 +15,7 @@ Class BP_Messages_Template {
15
var $pag_num;
16
var $pag_links;
17
18
- function bp_messages_template( $user_id, $box, $per_page, $max ) {
19
$this->pag_page = isset( $_GET['mpage'] ) ? intval( $_GET['mpage'] ) : 1;
20
$this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : $per_page;
21
$this->user_id = $user_id;
@@ -24,17 +24,19 @@ Class BP_Messages_Template {
24
if ( 'notices' == $this->box )
25
$this->threads = BP_Messages_Notice::get_notices();
26
else
27
- $this->threads = BP_Messages_Thread::get_current_threads_for_user( $this->user_id, $this->box, $this->pag_num, $this->pag_page );
28
29
if ( !$this->threads ) {
30
$this->thread_count = 0;
31
$this->total_thread_count = 0;
32
} else {
33
- if ( !$max ) {
34
if ( 'notices' == $this->box )
35
- $this->total_thread_count = BP_Messages_Notice::get_total_notice_count();
36
else
37
- $this->total_thread_count = BP_Messages_Thread::get_total_threads_for_user( $this->user_id, $this->box );
38
} else {
39
$this->total_thread_count = (int)$max;
40
}
@@ -112,7 +114,8 @@ function bp_has_message_threads( $args = '' ) {
112
'user_id' => $bp->loggedin_user->id,
113
'box' => 'inbox',
114
'per_page' => 10,
115
- 'max' => false
116
);
117
118
$r = wp_parse_args( $args, $defaults );
@@ -130,7 +133,7 @@ function bp_has_message_threads( $args = '' ) {
130
if ( 'notices' == $bp->current_action )
131
$box = 'notices';
132
133
- $messages_template = new BP_Messages_Template( $user_id, $box, $per_page, $max );
134
}
135
136
return $messages_template->has_threads();
15
var $pag_num;
16
var $pag_links;
17
18
+ function bp_messages_template( $user_id, $box, $per_page, $max, $type ) {
19
$this->pag_page = isset( $_GET['mpage'] ) ? intval( $_GET['mpage'] ) : 1;
20
$this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : $per_page;
21
$this->user_id = $user_id;
24
if ( 'notices' == $this->box )
25
$this->threads = BP_Messages_Notice::get_notices();
26
else
27
+ $this->threads = BP_Messages_Thread::get_current_threads_for_user( $this->user_id, $this->box, $this->pag_num, $this->pag_page, $type );
28
29
if ( !$this->threads ) {
30
$this->thread_count = 0;
31
$this->total_thread_count = 0;
32
} else {
33
+ $total_notice_count = BP_Messages_Notice::get_total_notice_count();
34
+
35
+ if ( !$max || $max >= (int)$total_notice_count ) {
36
if ( 'notices' == $this->box )
37
+ $this->total_thread_count = (int)$total_notice_count;
38
else
39
+ $this->total_thread_count = (int)BP_Messages_Thread::get_total_threads_for_user( $this->user_id, $this->box, $type );
40
} else {
41
$this->total_thread_count = (int)$max;
42
}
114
'user_id' => $bp->loggedin_user->id,
115
'box' => 'inbox',
116
'per_page' => 10,
117
+ 'max' => false,
118
+ 'type' => 'all'
119
);
120
121
$r = wp_parse_args( $args, $defaults );
133
if ( 'notices' == $bp->current_action )
134
$box = 'notices';
135
136
+ $messages_template = new BP_Messages_Template( $user_id, $box, $per_page, $max, $type );
137
}
138
139
return $messages_template->has_threads();
bp-themes/bphome/style.css CHANGED
@@ -2,7 +2,7 @@
2
Theme Name: BuddyPress Default Home Theme
3
Theme URI: http://buddypress.com/
4
Description: A widget framework theme for the home of a BuddyPress enabled installation. This theme is not required to use BuddyPress.
5
- Version: 1.0.1
6
Author: Andy Peatling
7
Author URI: http://apeatling.wordpress.com
8
*/
2
Theme Name: BuddyPress Default Home Theme
3
Theme URI: http://buddypress.com/
4
Description: A widget framework theme for the home of a BuddyPress enabled installation. This theme is not required to use BuddyPress.
5
+ Version: 1.0.2
6
Author: Andy Peatling
7
Author URI: http://apeatling.wordpress.com
8
*/
bp-themes/bpmember/groups/admin/manage-members.php CHANGED
@@ -44,7 +44,7 @@
44
45
<ul id="members-list" class="item-list single-line">
46
<?php while ( bp_group_members() ) : bp_group_the_member(); ?>
47
- <?php if ( bp_group_member_is_banned() ) : ?>
48
<li class="banned-user">
49
<?php bp_group_member_avatar_mini() ?>
50
44
45
<ul id="members-list" class="item-list single-line">
46
<?php while ( bp_group_members() ) : bp_group_the_member(); ?>
47
+ <?php if ( bp_get_group_member_is_banned() ) : ?>
48
<li class="banned-user">
49
<?php bp_group_member_avatar_mini() ?>
50
bp-themes/bpmember/style.css CHANGED
@@ -2,7 +2,7 @@
2
Theme Name: BuddyPress Default Member Theme
3
Theme URI: http://buddypress.org
4
Description: The default member theme for BuddyPress. This theme handles all non-blog pages.
5
- Version: 1.0.1
6
Author: Andy Peatling
7
Author URI: http://apeatling.wordpress.com
8
*/
2
Theme Name: BuddyPress Default Member Theme
3
Theme URI: http://buddypress.org
4
Description: The default member theme for BuddyPress. This theme handles all non-blog pages.
5
+ Version: 1.0.2
6
Author: Andy Peatling
7
Author URI: http://apeatling.wordpress.com
8
*/
bp-themes/bpskeletonmember/groups/admin/manage-members.php CHANGED
@@ -59,7 +59,7 @@
59
<ul id="members-list" class="item-list single-line">
60
<?php while ( bp_group_members() ) : bp_group_the_member(); ?>
61
62
- <?php if ( bp_group_member_is_banned() ) : ?>
63
64
<li class="banned-user">
65
<?php bp_group_member_avatar_mini() ?>
59
<ul id="members-list" class="item-list single-line">
60
<?php while ( bp_group_members() ) : bp_group_the_member(); ?>
61
62
+ <?php if ( bp_get_group_member_is_banned() ) : ?>
63
64
<li class="banned-user">
65
<?php bp_group_member_avatar_mini() ?>
bp-themes/bpskeletonmember/userbar.php CHANGED
@@ -27,7 +27,7 @@
27
<?php else : ?>
28
29
<p class="avatar">
30
- <img src="<?php echo site_url( MUPLUGINDIR . '/bp-core/images/mystery-man.jpg' ) ?>" alt="No User" width="50" height="50" />
31
</p>
32
33
<p id="login-text"><?php _e( 'You must log in to access your account.', 'buddypress' ) ?></p>
27
<?php else : ?>
28
29
<p class="avatar">
30
+ <img src="<?php echo BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg' ?>" alt="No User" width="50" height="50" />
31
</p>
32
33
<p id="login-text"><?php _e( 'You must log in to access your account.', 'buddypress' ) ?></p>
bp-wire.php CHANGED
@@ -56,6 +56,8 @@ function bp_wire_setup_nav() {
56
$bp->bp_options_title = $bp->displayed_user->fullname;
57
}
58
}
59
}
60
add_action( 'wp', 'bp_wire_setup_nav', 2 );
61
add_action( 'admin_menu', 'bp_wire_setup_nav', 2 );
56
$bp->bp_options_title = $bp->displayed_user->fullname;
57
}
58
}
59
+
60
+ do_action( 'bp_wire_setup_nav' );
61
}
62
add_action( 'wp', 'bp_wire_setup_nav', 2 );
63
add_action( 'admin_menu', 'bp_wire_setup_nav', 2 );
bp-xprofile.php CHANGED
@@ -215,6 +215,8 @@ function xprofile_setup_nav() {
215
$bp->bp_options_title = $bp->displayed_user->fullname;
216
}
217
}
218
}
219
add_action( 'wp', 'xprofile_setup_nav', 2 );
220
add_action( 'admin_menu', 'xprofile_setup_nav', 2 );
215
$bp->bp_options_title = $bp->displayed_user->fullname;
216
}
217
}
218
+
219
+ do_action( 'xprofile_setup_nav' );
220
}
221
add_action( 'wp', 'xprofile_setup_nav', 2 );
222
add_action( 'admin_menu', 'xprofile_setup_nav', 2 );
bp-xprofile/bp-xprofile-signup.php CHANGED
@@ -1,5 +1,11 @@
1
<?php
2
3
/**************************************************************************
4
xprofile_add_signup_fields()
5
@@ -94,7 +100,7 @@ function xprofile_validate_signup_fields( $result ) {
94
if ( $_POST['stage'] != 'validate-user-signup' ) return $result;
95
96
extract($result);
97
-
98
if ( $bp_signup_has_errors || $bp_signup_avatar_has_errors )
99
$errors->add( 'bp_xprofile_errors', '' );
100
@@ -103,12 +109,12 @@ function xprofile_validate_signup_fields( $result ) {
103
add_filter( 'wpmu_validate_user_signup', 'xprofile_validate_signup_fields', 10, 1 );
104
105
function xprofile_add_profile_meta( $meta ) {
106
- global $bp, $bp_blog_signup_meta;
107
108
if ( $_POST['stage'] == 'validate-blog-signup' ) {
109
$bp_meta = $bp_blog_signup_meta;
110
} else if ( $_POST['stage'] == 'validate-user-signup' ) {
111
- $bp_meta = unserialize( stripslashes( $_COOKIE['bp_xprofile_meta'] ) );
112
} else {
113
$bp_meta = $meta;
114
}
@@ -123,9 +129,10 @@ function xprofile_load_signup_meta() {
123
global $canvas, $original;
124
global $current_site, $active_signup;
125
global $wp_upload_error;
126
127
if ( $_POST['stage'] != 'validate-user-signup' ) return;
128
-
129
$counter = 0;
130
$bp_signup_has_errors = false;
131
$prev_field_id = -1;
@@ -175,7 +182,7 @@ function xprofile_load_signup_meta() {
175
}
176
177
// validate the avatar upload if there is one.
178
- $avatar_error = false;
179
$checked_upload = false;
180
$checked_size = false;
181
$checked_type = false;
@@ -221,22 +228,19 @@ function xprofile_load_signup_meta() {
221
}
222
}
223
224
- if ( !$bp_signup_has_errors && !$bp_signup_avatar_has_errors ) {
225
- /* Destroy and existing cookies */
226
- setcookie( 'bp_xprofile_meta', false, time()-1000, COOKIEPATH );
227
-
228
$public = (int) $_POST['blog_public'];
229
230
// put the user profile meta in a session ready to store.
231
for ( $i = 0; $i < count($bp_xprofile_callback); $i++ ) {
232
- $bp_meta['field_' . $bp_xprofile_callback[$i]['field_id']] .= $bp_xprofile_callback[$i]['value'];
233
}
234
235
- $bp_meta['xprofile_field_ids'] = $_POST['xprofile_ids'];
236
- $bp_meta['avatar_image_resized'] = $canvas;
237
- $bp_meta['avatar_image_original'] = $original;
238
239
- setcookie( 'bp_xprofile_meta', serialize($bp_meta), time()+60*60*24, COOKIEPATH );
240
}
241
}
242
add_action( 'init', 'xprofile_load_signup_meta' );
@@ -245,7 +249,7 @@ function xprofile_load_blog_signup_meta() {
245
global $bp_blog_signup_meta;
246
247
if ( $_POST['stage'] != 'validate-blog-signup' ) return;
248
-
249
$blog_meta = array(
250
'public' => $_POST['blog_public'],
251
'lang_id' => 1, // deprecated
@@ -276,7 +280,7 @@ function xprofile_on_activate_blog( $blog_id, $user_id, $password, $title, $meta
276
add_action( 'wpmu_activate_blog', 'xprofile_on_activate_blog', 1, 5 );
277
278
279
- function xprofile_on_activate_user( $user_id, $password, $meta ) {
280
xprofile_extract_signup_meta( $user_id, $meta );
281
282
if ( bp_has_custom_activation_page() )
1
<?php
2
3
+ function xprofile_clear_signup_cookie() {
4
+ if ( !isset( $_REQUEST['action'] ) && $_POST['stage'] != 'validate-blog-signup' && $_POST['stage'] != 'validate-user-signup' )
5
+ setcookie( 'bp_xprofile_meta', false, time()-1000, COOKIEPATH );
6
+ }
7
+ add_action( 'init', 'xprofile_clear_signup_cookie' );
8
+
9
/**************************************************************************
10
xprofile_add_signup_fields()
11
100
if ( $_POST['stage'] != 'validate-user-signup' ) return $result;
101
102
extract($result);
103
+
104
if ( $bp_signup_has_errors || $bp_signup_avatar_has_errors )
105
$errors->add( 'bp_xprofile_errors', '' );
106
109
add_filter( 'wpmu_validate_user_signup', 'xprofile_validate_signup_fields', 10, 1 );
110
111
function xprofile_add_profile_meta( $meta ) {
112
+ global $bp, $bp_blog_signup_meta, $bp_user_signup_meta;
113
114
if ( $_POST['stage'] == 'validate-blog-signup' ) {
115
$bp_meta = $bp_blog_signup_meta;
116
} else if ( $_POST['stage'] == 'validate-user-signup' ) {
117
+ $bp_meta = $bp_user_signup_meta;
118
} else {
119
$bp_meta = $meta;
120
}
129
global $canvas, $original;
130
global $current_site, $active_signup;
131
global $wp_upload_error;
132
+ global $bp_user_signup_meta;
133
134
if ( $_POST['stage'] != 'validate-user-signup' ) return;
135
+
136
$counter = 0;
137
$bp_signup_has_errors = false;
138
$prev_field_id = -1;
182
}
183
184
// validate the avatar upload if there is one.
185
+ $bp_signup_avatar_has_errors = false;
186
$checked_upload = false;
187
$checked_size = false;
188
$checked_type = false;
228
}
229
}
230
231
+ if ( !$bp_signup_has_errors && !$bp_signup_avatar_has_errors ) {
232
$public = (int) $_POST['blog_public'];
233
234
// put the user profile meta in a session ready to store.
235
for ( $i = 0; $i < count($bp_xprofile_callback); $i++ ) {
236
+ $bp_user_signup_meta['field_' . $bp_xprofile_callback[$i]['field_id']] .= $bp_xprofile_callback[$i]['value'];
237
}
238
239
+ $bp_user_signup_meta['xprofile_field_ids'] = $_POST['xprofile_ids'];
240
+ $bp_user_signup_meta['avatar_image_resized'] = $canvas;
241
+ $bp_user_signup_meta['avatar_image_original'] = $original;
242
243
+ setcookie( 'bp_xprofile_meta', serialize($bp_user_signup_meta), time()+60*60*24, COOKIEPATH );
244
}
245
}
246
add_action( 'init', 'xprofile_load_signup_meta' );
249
global $bp_blog_signup_meta;
250
251
if ( $_POST['stage'] != 'validate-blog-signup' ) return;
252
+
253
$blog_meta = array(
254
'public' => $_POST['blog_public'],
255
'lang_id' => 1, // deprecated
280
add_action( 'wpmu_activate_blog', 'xprofile_on_activate_blog', 1, 5 );
281
282
283
+ function xprofile_on_activate_user( $user_id, $password, $meta ) {
284
xprofile_extract_signup_meta( $user_id, $meta );
285
286
if ( bp_has_custom_activation_page() )
bp-xprofile/bp-xprofile-templatetags.php CHANGED
@@ -312,7 +312,7 @@ function bp_profile_group_name( $deprecated = true ) {
312
echo bp_get_profile_group_name();
313
}
314
}
315
- function bp_get_profile_group_name( $deprecated = true ) {
316
global $bp;
317
318
$group_id = $bp->action_variables[1];
312
echo bp_get_profile_group_name();
313
}
314
}
315
+ function bp_get_profile_group_name() {
316
global $bp;
317
318
$group_id = $bp->action_variables[1];
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: apeatling
3
Tags: wpmu, buddypress, social, networking, profiles, messaging, friends, groups, forums, activity
4
Requires at least: 2.7.1
5
Tested up to: 2.7.1
6
- Stable tag: 1.0.1
7
8
BuddyPress is a suite of WordPress MU social networking plugins and themes.
9
3
Tags: wpmu, buddypress, social, networking, profiles, messaging, friends, groups, forums, activity
4
Requires at least: 2.7.1
5
Tested up to: 2.7.1
6
+ Stable tag: 1.0.2
7
8
BuddyPress is a suite of WordPress MU social networking plugins and themes.
9