BuddyPress - Version 1.6-beta2

Version Description

= 1.5 = See: http://codex.buddypress.org/releases/version-1-5/

= 1.2.9 = Compatibility with WordPress 3.2

= 1.2.8 = Compatibility with WordPress 3.1

= 1.2.7 = Fixes over 10 bugs.

Download this release

Release Info

Developer DJPaul
Plugin Icon 128x128 BuddyPress
Version 1.6-beta2
Comparing to
See all releases

Code changes from version 1.6-beta1 to 1.6-beta2

bp-activity/bp-activity-admin.php CHANGED
@@ -119,7 +119,7 @@ add_action( 'wp_ajax_bp-activity-admin-reply', 'bp_activity_admin_reply' );
119
* @since 1.6
120
*/
121
function bp_activity_admin_screen_options( $value, $option, $new_value ) {
122
- if ( 'toplevel_page_bp_activity_per_page' != $option )
123
return $value;
124
125
// Per page
@@ -138,7 +138,7 @@ function bp_activity_admin_screen_options( $value, $option, $new_value ) {
138
* @since 1.0
139
*/
140
function bp_activity_admin_edit_hidden_metaboxes( $hidden, $screen ) {
141
- if ( empty( $screen->id ) || 'toplevel_page_bp-activity' != $screen->id )
142
return $hidden;
143
144
// Hide the primary link meta box by default
@@ -199,11 +199,11 @@ function bp_activity_admin_load() {
199
);
200
201
// Register metaboxes for the edit screen.
202
- add_meta_box( 'submitdiv', _x( 'Status', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_status', 'toplevel_page_bp-activity', 'side', 'core' );
203
- add_meta_box( 'bp_activity_itemids', _x( 'Primary Item/Secondary Item', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_itemids', 'toplevel_page_bp-activity', 'advanced', 'core' );
204
- add_meta_box( 'bp_activity_link', _x( 'Link', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_link', 'toplevel_page_bp-activity', 'advanced', 'core' );
205
- add_meta_box( 'bp_activity_type', _x( 'Type', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_type', 'toplevel_page_bp-activity', 'advanced', 'core' );
206
- add_meta_box( 'bp_activity_userid', _x( 'Author ID', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_userid', 'toplevel_page_bp-activity', 'advanced', 'core' );
207
208
// Enqueue javascripts
209
wp_enqueue_script( 'postbox' );
@@ -305,6 +305,13 @@ function bp_activity_admin_load() {
305
break;
306
307
case 'ham' :
308
bp_activity_mark_as_ham( $activity );
309
$result = $activity->save();
310
@@ -559,13 +566,10 @@ function bp_activity_admin_edit() {
559
<?php if ( ! empty( $activity ) ) : ?>
560
561
<form action="<?php echo esc_attr( $form_url ); ?>" id="bp-activities-edit-form" method="post">
562
- <div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>">
563
- <div id="side-info-column" class="inner-sidebar">
564
- <?php do_meta_boxes( 'toplevel_page_bp-activity', 'side', $activity ); ?>
565
- </div>
566
567
- <div id="post-body" class="has-sidebar">
568
- <div id="post-body-content" class="has-sidebar-content">
569
<div id="postdiv" class="postarea">
570
<div id="bp_activity_action" class="postbox">
571
<h3><?php _e( 'Action', 'buddypress' ); ?></h3>
@@ -581,12 +585,19 @@ function bp_activity_admin_edit() {
581
</div>
582
</div>
583
</div>
584
585
- <?php do_meta_boxes( 'toplevel_page_bp-activity', 'advanced', $activity ); ?>
586
</div>
587
- </div>
588
- </div>
589
590
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
591
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
592
<?php wp_nonce_field( 'edit-activity_' . $activity->id ); ?>
@@ -596,7 +607,7 @@ function bp_activity_admin_edit() {
596
<p><?php printf( __( 'No activity found with this ID. <a href="%s">Go back and try again</a>.', 'buddypress' ), network_admin_url( 'admin.php?page=bp-activity' ) ); ?></p>
597
<?php endif; ?>
598
599
- </div>
600
601
<?php
602
}
@@ -1178,6 +1189,9 @@ class BP_Activity_List_Table extends WP_List_Table {
1178
// This was a mis-named activity type from before BP 1.6
1179
unset( $actions['friends_register_activity_action'] );
1180
1181
// Sort array by the human-readable value
1182
natsort( $actions );
1183
?>
119
* @since 1.6
120
*/
121
function bp_activity_admin_screen_options( $value, $option, $new_value ) {
122
+ if ( 'toplevel_page_bp_activity_per_page' != $option && 'toplevel_page_bp_activity_network_per_page' != $option )
123
return $value;
124
125
// Per page
138
* @since 1.0
139
*/
140
function bp_activity_admin_edit_hidden_metaboxes( $hidden, $screen ) {
141
+ if ( empty( $screen->id ) || 'toplevel_page_bp-activity' != $screen->id && 'toplevel_page_bp-activity_network' != $screen->id )
142
return $hidden;
143
144
// Hide the primary link meta box by default
199
);
200
201
// Register metaboxes for the edit screen.
202
+ add_meta_box( 'submitdiv', _x( 'Status', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_status', get_current_screen()->id, 'side', 'core' );
203
+ add_meta_box( 'bp_activity_itemids', _x( 'Primary Item/Secondary Item', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_itemids', get_current_screen()->id, 'normal', 'core' );
204
+ add_meta_box( 'bp_activity_link', _x( 'Link', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_link', get_current_screen()->id, 'normal', 'core' );
205
+ add_meta_box( 'bp_activity_type', _x( 'Type', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_type', get_current_screen()->id, 'normal', 'core' );
206
+ add_meta_box( 'bp_activity_userid', _x( 'Author ID', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_userid', get_current_screen()->id, 'normal', 'core' );
207
208
// Enqueue javascripts
209
wp_enqueue_script( 'postbox' );
305
break;
306
307
case 'ham' :
308
+ /**
309
+ * Remove moderation and blacklist checks in case we want to ham an activity
310
+ * which contains one of these listed keys.
311
+ */
312
+ remove_action( 'bp_activity_before_save', 'bp_activity_check_moderation_keys', 2, 1 );
313
+ remove_action( 'bp_activity_before_save', 'bp_activity_check_blacklist_keys', 2, 1 );
314
+
315
bp_activity_mark_as_ham( $activity );
316
$result = $activity->save();
317
566
<?php if ( ! empty( $activity ) ) : ?>
567
568
<form action="<?php echo esc_attr( $form_url ); ?>" id="bp-activities-edit-form" method="post">
569
+ <div id="poststuff">
570
571
+ <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
572
+ <div id="post-body-content">
573
<div id="postdiv" class="postarea">
574
<div id="bp_activity_action" class="postbox">
575
<h3><?php _e( 'Action', 'buddypress' ); ?></h3>
585
</div>
586
</div>
587
</div>
588
+ </div><!-- #post-body-content -->
589
590
+ <div id="postbox-container-1" class="postbox-container">
591
+ <?php do_meta_boxes( get_current_screen()->id, 'side', $activity ); ?>
592
</div>
593
594
+ <div id="postbox-container-2" class="postbox-container">
595
+ <?php do_meta_boxes( get_current_screen()->id, 'normal', $activity ); ?>
596
+ <?php do_meta_boxes( get_current_screen()->id, 'advanced', $activity ); ?>
597
+ </div>
598
+ </div><!-- #post-body -->
599
+
600
+ </div><!-- #poststuff -->
601
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
602
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
603
<?php wp_nonce_field( 'edit-activity_' . $activity->id ); ?>
607
<p><?php printf( __( 'No activity found with this ID. <a href="%s">Go back and try again</a>.', 'buddypress' ), network_admin_url( 'admin.php?page=bp-activity' ) ); ?></p>
608
<?php endif; ?>
609
610
+ </div><!-- .wrap -->
611
612
<?php
613
}
1189
// This was a mis-named activity type from before BP 1.6
1190
unset( $actions['friends_register_activity_action'] );
1191
1192
+ // This type has not been used since BP 1.0.3. It will be re-instated in a future version.
1193
+ unset( $actions['updated_profile'] );
1194
+
1195
// Sort array by the human-readable value
1196
natsort( $actions );
1197
?>
bp-activity/bp-activity-akismet.php CHANGED
@@ -496,7 +496,7 @@ class BP_Akismet {
496
return;
497
498
// Display meta box with a low priority (low position on screen by default)
499
- add_meta_box( 'bp_activity_history', __( 'Activity History', 'buddypress' ), array( $this, 'history_metabox' ), 'toplevel_page_bp-activity', 'advanced', 'low' );
500
}
501
502
/**
496
return;
497
498
// Display meta box with a low priority (low position on screen by default)
499
+ add_meta_box( 'bp_activity_history', __( 'Activity History', 'buddypress' ), array( $this, 'history_metabox' ), get_current_screen()->id, 'normal', 'low' );
500
}
501
502
/**
bp-activity/bp-activity-classes.php CHANGED
@@ -91,9 +91,14 @@ class BP_Activity_Activity {
91
if ( false === $wpdb->query( $q ) )
92
return false;
93
94
if ( empty( $this->id ) )
95
$this->id = $wpdb->insert_id;
96
97
do_action_ref_array( 'bp_activity_after_save', array( &$this ) );
98
99
return true;
@@ -128,7 +133,8 @@ class BP_Activity_Activity {
128
10 => 'spam'
129
);
130
131
- $args = bp_core_parse_args_array( $old_args_keys, func_get_args() );
132
}
133
134
$defaults = array(
91
if ( false === $wpdb->query( $q ) )
92
return false;
93
94
+ // If this is a new activity item, set the $id property
95
if ( empty( $this->id ) )
96
$this->id = $wpdb->insert_id;
97
98
+ // If an existing activity item, prevent any changes to the content generating new @mention notifications.
99
+ else
100
+ add_filter( 'bp_activity_at_name_do_notifications', '__return_false' );
101
+
102
do_action_ref_array( 'bp_activity_after_save', array( &$this ) );
103
104
return true;
133
10 => 'spam'
134
);
135
136
+ $func_args = func_get_args();
137
+ $args = bp_core_parse_args_array( $old_args_keys, $func_args );
138
}
139
140
$defaults = array(
bp-activity/bp-activity-filters.php CHANGED
@@ -149,12 +149,12 @@ function bp_activity_check_moderation_keys( $activity ) {
149
function bp_activity_check_blacklist_keys( $activity ) {
150
151
// Only check specific types of activity updates
152
- if ( !in_array( $activity->type, bp_activity_get_moderated_activity_types() ) )
153
return;
154
155
- // Unset the activity component so activity stream update fails
156
- if ( !bp_core_check_for_blacklist( $activity->user_id, '', $activity->content ) )
157
- $activity->component = false;
158
}
159
160
/**
@@ -230,7 +230,7 @@ function bp_activity_at_name_filter( $content, $activity_id = 0 ) {
230
continue;
231
232
// If an activity_id is provided, we can send email and BP notifications
233
- if ( $activity_id ) {
234
bp_activity_at_message_notification( $activity_id, $user_id );
235
}
236
149
function bp_activity_check_blacklist_keys( $activity ) {
150
151
// Only check specific types of activity updates
152
+ if ( ! in_array( $activity->type, bp_activity_get_moderated_activity_types() ) )
153
return;
154
155
+ // Mark as spam
156
+ if ( ! bp_core_check_for_blacklist( $activity->user_id, '', $activity->content ) )
157
+ bp_activity_mark_as_spam( $activity, 'by_blacklist' );
158
}
159
160
/**
230
continue;
231
232
// If an activity_id is provided, we can send email and BP notifications
233
+ if ( $activity_id && apply_filters( 'bp_activity_at_name_do_notifications', true ) ) {
234
bp_activity_at_message_notification( $activity_id, $user_id );
235
}
236
bp-activity/bp-activity-template.php CHANGED
@@ -134,8 +134,9 @@ class BP_Activity_Template {
134
11 => 'spam',
135
12 => 'page_arg'
136
);
137
-
138
- $args = bp_core_parse_args_array( $old_args_keys, func_get_args() );
139
}
140
141
$defaults = array(
134
11 => 'spam',
135
12 => 'page_arg'
136
);
137
+
138
+ $func_args = func_get_args();
139
+ $args = bp_core_parse_args_array( $old_args_keys, $func_args );
140
}
141
142
$defaults = array(
bp-core/admin/bp-core-components.php CHANGED
@@ -227,7 +227,7 @@ function bp_core_admin_components_options() {
227
228
<?php endif; ?>
229
230
- <label class="screen-reader-text" for="bp_components[<?php echo esc_attr( $name ); ?>]"><?php sprintf( __( 'Select %s', 'bbpress' ), esc_html( $labels['title'] ) ); ?></label>
231
</th>
232
<td class="plugin-title" style="width: 190px;">
233
<span></span>
227
228
<?php endif; ?>
229
230
+ <label class="screen-reader-text" for="bp_components[<?php echo esc_attr( $name ); ?>]"><?php sprintf( __( 'Select %s', 'buddypress' ), esc_html( $labels['title'] ) ); ?></label>
231
</th>
232
<td class="plugin-title" style="width: 190px;">
233
<span></span>
bp-core/admin/bp-core-functions.php CHANGED
@@ -290,6 +290,15 @@ function bp_core_activation_notice() {
290
}
291
}
292
293
if ( !empty( $orphaned_components ) ) {
294
$admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
295
$notice = sprintf( __( 'The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress' ), $admin_url, '<strong>' . implode( '</strong>, <strong>', $orphaned_components ) . '</strong>' );
290
}
291
}
292
293
+ // Special case: If the Forums component is orphaned, but the bbPress 1.x installation is
294
+ // not correctly set up, don't show a nag. (In these cases, it's probably the case that the
295
+ // user is using bbPress 2.x; see https://buddypress.trac.wordpress.org/ticket/4292
296
+ if ( isset( $bp->forums->name ) && in_array( $bp->forums->name, $orphaned_components ) && !bp_forums_is_installed_correctly() ) {
297
+ $forum_key = array_search( $bp->forums->name, $orphaned_components );
298
+ unset( $orphaned_components[$forum_key] );
299
+ $orphaned_components = array_values( $orphaned_components );
300
+ }
301
+
302
if ( !empty( $orphaned_components ) ) {
303
$admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
304
$notice = sprintf( __( 'The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress' ), $admin_url, '<strong>' . implode( '</strong>, <strong>', $orphaned_components ) . '</strong>' );
bp-core/admin/bp-core-settings.php CHANGED
@@ -28,7 +28,7 @@ function bp_admin_setting_callback_admin_bar() {
28
?>
29
30
<input id="hide-loggedout-adminbar" name="hide-loggedout-adminbar" type="checkbox" value="1" <?php checked( !bp_hide_loggedout_adminbar( false ) ); ?> />
31
- <label for="hide-loggedout-adminbar"><?php _e( 'Show the admin bar for logged out users', 'buddypress' ); ?></label>
32
33
<?php
34
}
@@ -43,12 +43,27 @@ function bp_admin_setting_callback_admin_bar() {
43
function bp_admin_setting_callback_account_deletion() {
44
?>
45
46
- <input id="bp-disable-account-deletion" name="bp-disable-account-deletion" type="checkbox" value="1" <?php checked( !bp_disable_account_deletion( true ) ); ?> />
47
<label for="bp-disable-account-deletion"><?php _e( 'Allow registered members to delete their own accounts', 'buddypress' ); ?></label>
48
49
<?php
50
}
51
52
/** Activity *******************************************************************/
53
54
/**
@@ -82,12 +97,39 @@ function bp_admin_setting_callback_activity_akismet() {
82
function bp_admin_setting_callback_blogforum_comments() {
83
?>
84
85
- <input id="bp-disable-blogforum-comments" name="bp-disable-blogforum-comments" type="checkbox" value="1" <?php checked( bp_disable_blogforum_comments( true ) ); ?> />
86
<label for="bp-disable-blogforum-comments"><?php _e( 'Allow activity stream commenting on blog and forum posts', 'buddypress' ); ?></label>
87
88
<?php
89
}
90
91
/** XProfile ******************************************************************/
92
93
/**
@@ -123,7 +165,7 @@ function bp_admin_setting_callback_profile_sync() {
123
function bp_admin_setting_callback_avatar_uploads() {
124
?>
125
126
- <input id="bp-disable-avatar-uploads" name="bp-disable-avatar-uploads" type="checkbox" value="1" <?php checked( !bp_disable_avatar_uploads( true ) ); ?> />
127
<label for="bp-disable-avatar-uploads"><?php _e( 'Allow registered members to upload avatars', 'buddypress' ); ?></label>
128
129
<?php
@@ -148,7 +190,7 @@ function bp_admin_setting_callback_groups_section() { }
148
function bp_admin_setting_callback_group_creation() {
149
?>
150
151
- <input id="bp_restrict_group_creation" name="bp_restrict_group_creation" type="checkbox"value="1" <?php checked( !bp_restrict_group_creation( true ) ); ?> />
152
<label for="bp_restrict_group_creation"><?php _e( 'Enable group creation for all users', 'buddypress' ); ?></label>
153
<p class="description"><?php _e( 'Administrators can always create groups, regardless of this setting.', 'buddypress' ); ?></p>
154
@@ -203,9 +245,42 @@ function bp_admin_setting_callback_bbpress_configuration() {
203
* @uses do_settings_sections() To output the settings sections
204
*/
205
function bp_core_admin_settings() {
206
global $wp_settings_fields;
207
208
- if ( !empty( $_POST['submit'] ) ) {
209
check_admin_referer( 'buddypress-options' );
210
211
// Because many settings are saved with checkboxes, and thus will have no values
@@ -237,31 +312,11 @@ function bp_core_admin_settings() {
237
$value = isset( $_POST[$legacy_option] ) ? '' : 1;
238
bp_update_option( $legacy_option, $value );
239
}
240
- }
241
-
242
- // We're saving our own options, until the WP Settings API is updated to work with Multisite
243
- $form_action = add_query_arg( 'page', 'bp-settings', bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ); ?>
244
-
245
- <div class="wrap">
246
-
247
- <?php screen_icon( 'buddypress' ); ?>
248
249
- <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Settings', 'buddypress' ) ); ?></h2>
250
-
251
- <form action="<?php echo $form_action ?>" method="post">
252
-
253
- <?php settings_fields( 'buddypress' ); ?>
254
-
255
- <?php do_settings_sections( 'buddypress' ); ?>
256
-
257
- <p class="submit">
258
- <input type="submit" name="submit" class="button-primary" value="<?php _e( 'Save Changes', 'buddypress' ); ?>" />
259
- </p>
260
- </form>
261
- </div>
262
-
263
- <?php
264
}
265
266
/**
267
* Output settings API option
@@ -310,106 +365,4 @@ function bp_form_option( $option, $default = '' , $slug = false ) {
310
// Allow plugins to further filter the output
311
return apply_filters( 'bp_get_form_option', $value, $option );
312
}
313
-
314
- /**
315
- * Used to check if a BuddyPress slug conflicts with an existing known slug.
316
- *
317
- * @since BuddyPress (1.6)
318
- *
319
- * @param string $slug
320
- * @param string $default
321
- *
322
- * @uses bp_get_form_option() To get a sanitized slug string
323
- */
324
- function bp_form_slug_conflict_check( $slug, $default ) {
325
-
326
- // Only set the slugs once ver page load
327
- static $the_core_slugs = array();
328
-
329
- // Get the form value
330
- $this_slug = bp_get_form_option( $slug, $default, true );
331
-
332
- if ( empty( $the_core_slugs ) ) {
333
-
334
- // Slugs to check
335
- $core_slugs = apply_filters( 'bp_slug_conflict_check', array(
336
-
337
- /** WordPress Core ****************************************************/
338
-
339
- // Core Post Types
340
- 'post_base' => array( 'name' => __( 'Posts' ), 'default' => 'post', 'context' => 'WordPress' ),
341
- 'page_base' => array( 'name' => __( 'Pages' ), 'default' => 'page', 'context' => 'WordPress' ),
342
- 'revision_base' => array( 'name' => __( 'Revisions' ), 'default' => 'revision', 'context' => 'WordPress' ),
343
- 'attachment_base' => array( 'name' => __( 'Attachments' ), 'default' => 'attachment', 'context' => 'WordPress' ),
344
- 'nav_menu_base' => array( 'name' => __( 'Menus' ), 'default' => 'nav_menu_item', 'context' => 'WordPress' ),
345
-
346
- // Post Tags
347
- 'tag_base' => array( 'name' => __( 'Tag base' ), 'default' => 'tag', 'context' => 'WordPress' ),
348
-
349
- // Post Categories
350
- 'category_base' => array( 'name' => __( 'Category base' ), 'default' => 'category', 'context' => 'WordPress' ),
351
-
352
- ) );
353
-
354
- /** bbPress Core ******************************************************/
355
-
356
- if ( bp_forums_is_bbpress_active() ) {
357
-
358
- // Forum archive slug
359
- $core_slugs['_bbp_root_slug'] = array( 'name' => __( 'Forums base', 'buddypress' ), 'default' => 'forums', 'context' => 'buddypress' );
360
-
361
- // Topic archive slug
362
- $core_slugs['_bbp_topic_archive_slug'] = array( 'name' => __( 'Topics base', 'buddypress' ), 'default' => 'topics', 'context' => 'buddypress' );
363
-
364
- // Forum slug
365
- $core_slugs['_bbp_forum_slug'] = array( 'name' => __( 'Forum slug', 'buddypress' ), 'default' => 'forum', 'context' => 'buddypress' );
366
-
367
- // Topic slug
368
- $core_slugs['_bbp_topic_slug'] = array( 'name' => __( 'Topic slug', 'buddypress' ), 'default' => 'topic', 'context' => 'buddypress' );
369
-
370
- // Reply slug
371
- $core_slugs['_bbp_reply_slug'] = array( 'name' => __( 'Reply slug', 'buddypress' ), 'default' => 'reply', 'context' => 'buddypress' );
372
-
373
- // User profile slug
374
- $core_slugs['_bbp_user_slug'] = array( 'name' => __( 'User base', 'buddypress' ), 'default' => 'users', 'context' => 'buddypress' );
375
-
376
- // View slug
377
- $core_slugs['_bbp_view_slug'] = array( 'name' => __( 'View base', 'buddypress' ), 'default' => 'view', 'context' => 'buddypress' );
378
-
379
- // Topic tag slug
380
- $core_slugs['_bbp_topic_tag_slug'] = array( 'name' => __( 'Topic tag slug', 'buddypress' ), 'default' => 'topic-tag', 'context' => 'buddypress' );
381
- }
382
-
383
- /** BuddyPress Core *******************************************************/
384
-
385
- global $bp;
386
-
387
- // Loop through root slugs and check for conflict
388
- if ( !empty( $bp->pages ) ) {
389
- foreach ( $bp->pages as $page => $page_data ) {
390
- $page_base = $page . '_base';
391
- $page_title = sprintf( __( '%s page', 'buddypress' ), $page_data->title );
392
- $core_slugs[$page_base] = array( 'name' => $page_title, 'default' => $page_data->slug, 'context' => 'buddypress' );
393
- }
394
- }
395
-
396
- // Set the static
397
- $the_core_slugs = apply_filters( 'bp_slug_conflict', $core_slugs );
398
- }
399
-
400
- // Loop through slugs to check
401
- foreach( $the_core_slugs as $key => $value ) {
402
-
403
- // Get the slug
404
- $slug_check = bp_get_form_option( $key, $value['default'], true );
405
-
406
- // Compare
407
- if ( ( $slug != $key ) && ( $slug_check == $this_slug ) ) : ?>
408
-
409
- <span class="attention"><?php printf( __( 'Possible %1$s conflict: <strong>%2$s</strong>', 'buddypress' ), $value['context'], $value['name'] ); ?></span>
410
-
411
- <?php endif;
412
- }
413
- }
414
-
415
?>
28
?>
29
30
<input id="hide-loggedout-adminbar" name="hide-loggedout-adminbar" type="checkbox" value="1" <?php checked( !bp_hide_loggedout_adminbar( false ) ); ?> />
31
+ <label for="hide-loggedout-adminbar"><?php _e( 'Show the Toolbar for logged out users', 'buddypress' ); ?></label>
32
33
<?php
34
}
43
function bp_admin_setting_callback_account_deletion() {
44
?>
45
46
+ <input id="bp-disable-account-deletion" name="bp-disable-account-deletion" type="checkbox" value="1" <?php checked( !bp_disable_account_deletion( false ) ); ?> />
47
<label for="bp-disable-account-deletion"><?php _e( 'Allow registered members to delete their own accounts', 'buddypress' ); ?></label>
48
49
<?php
50
}
51
52
+ /**
53
+ * If user has upgraded to 1.6 and chose to retain their BuddyBar, offer then a switch to change over
54
+ * to the WP Toolbar.
55
+ *
56
+ * @since BuddyPress (1.6)
57
+ */
58
+ function bp_admin_setting_callback_force_buddybar() {
59
+ ?>
60
+
61
+ <input id="_bp_force_buddybar" name="_bp_force_buddybar" type="checkbox" value="1" <?php checked( ! bp_force_buddybar( true ) ); ?> />
62
+ <label for="_bp_force_buddybar"><?php _e( 'Switch to WordPress Toolbar', 'buddypress' ); ?></label>
63
+
64
+ <?php
65
+ }
66
+
67
/** Activity *******************************************************************/
68
69
/**
97
function bp_admin_setting_callback_blogforum_comments() {
98
?>
99
100
+ <input id="bp-disable-blogforum-comments" name="bp-disable-blogforum-comments" type="checkbox" value="1" <?php checked( !bp_disable_blogforum_comments( false ) ); ?> />
101
<label for="bp-disable-blogforum-comments"><?php _e( 'Allow activity stream commenting on blog and forum posts', 'buddypress' ); ?></label>
102
103
<?php
104
}
105
106
+ /**
107
+ * Sanitization for _bp_force_buddyvar
108
+ *
109
+ * If upgraded to 1.6 and you chose to keep the BuddyBar, a checkbox asks if you want to switch to
110
+ * the WP Toolbar. The option we store is 1 if the BuddyBar is forced on, so we use this function
111
+ * to flip the boolean before saving the intval.
112
+ *
113
+ * @since BuddyPress (1.6)
114
+ * @access Private
115
+ */
116
+ function bp_admin_sanitize_callback_force_buddybar( $value = false ) {
117
+ return $value ? 0 : 1;
118
+ }
119
+
120
+ /**
121
+ * Sanitization for bp-disable-blogforum-comments setting
122
+ *
123
+ * In the UI, a checkbox asks whether you'd like to *enable* blog/forum activity comments. For
124
+ * legacy reasons, the option that we store is 1 if these comments are *disabled*. So we use this
125
+ * function to flip the boolean before saving the intval.
126
+ *
127
+ * @since BuddyPress (1.6)
128
+ */
129
+ function bp_admin_sanitize_callback_blogforum_comments( $value = false ) {
130
+ return $value ? 0 : 1;
131
+ }
132
+
133
/** XProfile ******************************************************************/
134
135
/**
165
function bp_admin_setting_callback_avatar_uploads() {
166
?>
167
168
+ <input id="bp-disable-avatar-uploads" name="bp-disable-avatar-uploads" type="checkbox" value="1" <?php checked( !bp_disable_avatar_uploads( false ) ); ?> />
169
<label for="bp-disable-avatar-uploads"><?php _e( 'Allow registered members to upload avatars', 'buddypress' ); ?></label>
170
171
<?php
190
function bp_admin_setting_callback_group_creation() {
191
?>
192
193
+ <input id="bp_restrict_group_creation" name="bp_restrict_group_creation" type="checkbox"value="1" <?php checked( !bp_restrict_group_creation( false ) ); ?> />
194
<label for="bp_restrict_group_creation"><?php _e( 'Enable group creation for all users', 'buddypress' ); ?></label>
195
<p class="description"><?php _e( 'Administrators can always create groups, regardless of this setting.', 'buddypress' ); ?></p>
196
245
* @uses do_settings_sections() To output the settings sections
246
*/
247
function bp_core_admin_settings() {
248
+
249
+ // We're saving our own options, until the WP Settings API is updated to work with Multisite
250
+ $form_action = add_query_arg( 'page', 'bp-settings', bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) );
251
+
252
+ ?>
253
+
254
+ <div class="wrap">
255
+
256
+ <?php screen_icon( 'buddypress' ); ?>
257
+
258
+ <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Settings', 'buddypress' ) ); ?></h2>
259
+
260
+ <form action="<?php echo $form_action ?>" method="post">
261
+
262
+ <?php settings_fields( 'buddypress' ); ?>
263
+
264
+ <?php do_settings_sections( 'buddypress' ); ?>
265
+
266
+ <p class="submit">
267
+ <input type="submit" name="submit" class="button-primary" value="<?php _e( 'Save Changes', 'buddypress' ); ?>" />
268
+ </p>
269
+ </form>
270
+ </div>
271
+
272
+ <?php
273
+ }
274
+
275
+ /**
276
+ * Save our settings
277
+ *
278
+ * @since BuddyPress (1.6)
279
+ */
280
+ function bp_core_admin_settings_save() {
281
global $wp_settings_fields;
282
283
+ if ( isset( $_GET['page'] ) && 'bp-settings' == $_GET['page'] && !empty( $_POST['submit'] ) ) {
284
check_admin_referer( 'buddypress-options' );
285
286
// Because many settings are saved with checkboxes, and thus will have no values
312
$value = isset( $_POST[$legacy_option] ) ? '' : 1;
313
bp_update_option( $legacy_option, $value );
314
}
315
316
+ bp_core_redirect( add_query_arg( 'page', 'bp-settings', bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ) );
317
+ }
318
}
319
+ add_action( 'bp_admin_init', 'bp_core_admin_settings_save', 100 );
320
321
/**
322
* Output settings API option
365
// Allow plugins to further filter the output
366
return apply_filters( 'bp_get_form_option', $value, $option );
367
}
368
?>
bp-core/admin/bp-core-update.php CHANGED
@@ -339,7 +339,7 @@ class BP_Core_Setup_Wizard {
339
<td>
340
<p><label><input type="radio" name="bp_pages[members]" <?php checked( empty( $existing_pages['members'] ) ); ?> value="<?php echo $members_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $members_slug ); ?>/</label></p>
341
342
- <?php if ( $members_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['members']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
343
344
<p><label><input type="radio" name="bp_pages[members]" <?php checked( !empty( $existing_pages['members'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $members_page_dropdown ?></label></p>
345
@@ -357,7 +357,7 @@ class BP_Core_Setup_Wizard {
357
<td>
358
<p><label><input type="radio" name="bp_pages[groups]" <?php checked( empty( $existing_pages['groups'] ) ); ?> value="<?php echo $groups_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $groups_slug ); ?>/</label></p>
359
360
- <?php if ( $groups_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['groups']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
361
<p><label><input type="radio" name="bp_pages[groups]" <?php checked( !empty( $existing_pages['groups'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $groups_page_dropdown ?></label></p>
362
<?php endif ?>
363
</td>
@@ -394,7 +394,7 @@ class BP_Core_Setup_Wizard {
394
<td>
395
<p><label><input type="radio" name="bp_pages[activity]" <?php checked( empty( $existing_pages['activity'] ) ); ?> value="<?php echo $activity_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $activity_slug ); ?>/</label></p>
396
397
- <?php if ( $activity_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['activity']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
398
<p><label><input type="radio" name="bp_pages[activity]" <?php checked( !empty( $existing_pages['activity'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $activity_page_dropdown ?></label></p>
399
<?php endif ?>
400
</td>
@@ -412,7 +412,7 @@ class BP_Core_Setup_Wizard {
412
<td>
413
<p><label><input type="radio" name="bp_pages[forums]" <?php checked( empty( $existing_pages['forums'] ) ); ?> value="<?php echo $forums_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $forums_slug ); ?>/</label></p>
414
415
- <?php if ( $forums_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['forums']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
416
<p><label><input type="radio" name="bp_pages[forums]" <?php checked( !empty( $existing_pages['forums'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $forums_page_dropdown ?></label></p>
417
<?php endif ?>
418
</td>
@@ -428,7 +428,7 @@ class BP_Core_Setup_Wizard {
428
<td>
429
<p><label><input type="radio" name="bp_pages[register]" <?php checked( empty( $existing_pages['register'] ) ); ?> value="<?php echo $register_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $register_slug ) ?>/</label></p>
430
431
- <?php if ( $register_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['register']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
432
<p><label><input type="radio" name="bp_pages[register]" <?php checked( !empty( $existing_pages['register'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $register_page_dropdown ?></label></p>
433
<?php endif ?>
434
</td>
@@ -442,7 +442,7 @@ class BP_Core_Setup_Wizard {
442
<td>
443
<p><label><input type="radio" name="bp_pages[activate]" <?php checked( empty( $existing_pages['activate'] ) ); ?> value="<?php echo $activation_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $activation_slug ); ?>/</label></p>
444
445
- <?php if ( $activate_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['activate']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
446
<p><label><input type="radio" name="bp_pages[activate]" <?php checked( !empty( $existing_pages['activate'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $activate_page_dropdown ?></label></p>
447
<?php endif ?>
448
</td>
339
<td>
340
<p><label><input type="radio" name="bp_pages[members]" <?php checked( empty( $existing_pages['members'] ) ); ?> value="<?php echo $members_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $members_slug ); ?>/</label></p>
341
342
+ <?php if ( $members_page_dropdown = wp_dropdown_pages( "name=bp-members-page&echo=0&selected={$existing_pages['members']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
343
344
<p><label><input type="radio" name="bp_pages[members]" <?php checked( !empty( $existing_pages['members'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $members_page_dropdown ?></label></p>
345
357
<td>
358
<p><label><input type="radio" name="bp_pages[groups]" <?php checked( empty( $existing_pages['groups'] ) ); ?> value="<?php echo $groups_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $groups_slug ); ?>/</label></p>
359
360
+ <?php if ( $groups_page_dropdown = wp_dropdown_pages( "name=bp-groups-page&echo=0&selected={$existing_pages['groups']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
361
<p><label><input type="radio" name="bp_pages[groups]" <?php checked( !empty( $existing_pages['groups'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $groups_page_dropdown ?></label></p>
362
<?php endif ?>
363
</td>
394
<td>
395
<p><label><input type="radio" name="bp_pages[activity]" <?php checked( empty( $existing_pages['activity'] ) ); ?> value="<?php echo $activity_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $activity_slug ); ?>/</label></p>
396
397
+ <?php if ( $activity_page_dropdown = wp_dropdown_pages( "name=bp-activity-page&echo=0&selected={$existing_pages['activity']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
398
<p><label><input type="radio" name="bp_pages[activity]" <?php checked( !empty( $existing_pages['activity'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $activity_page_dropdown ?></label></p>
399
<?php endif ?>
400
</td>
412
<td>
413
<p><label><input type="radio" name="bp_pages[forums]" <?php checked( empty( $existing_pages['forums'] ) ); ?> value="<?php echo $forums_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $forums_slug ); ?>/</label></p>
414
415
+ <?php if ( $forums_page_dropdown = wp_dropdown_pages( "name=bp-forums-page&echo=0&selected={$existing_pages['forums']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
416
<p><label><input type="radio" name="bp_pages[forums]" <?php checked( !empty( $existing_pages['forums'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $forums_page_dropdown ?></label></p>
417
<?php endif ?>
418
</td>
428
<td>
429
<p><label><input type="radio" name="bp_pages[register]" <?php checked( empty( $existing_pages['register'] ) ); ?> value="<?php echo $register_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ) ?> <?php echo home_url( $register_slug ) ?>/</label></p>
430
431
+ <?php if ( $register_page_dropdown = wp_dropdown_pages( "name=bp-register-page&echo=0&selected={$existing_pages['register']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
432
<p><label><input type="radio" name="bp_pages[register]" <?php checked( !empty( $existing_pages['register'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $register_page_dropdown ?></label></p>
433
<?php endif ?>
434
</td>
442
<td>
443
<p><label><input type="radio" name="bp_pages[activate]" <?php checked( empty( $existing_pages['activate'] ) ); ?> value="<?php echo $activation_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $activation_slug ); ?>/</label></p>
444
445
+ <?php if ( $activate_page_dropdown = wp_dropdown_pages( "name=bp-activate-page&echo=0&selected={$existing_pages['activate']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>
446
<p><label><input type="radio" name="bp_pages[activate]" <?php checked( !empty( $existing_pages['activate'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $activate_page_dropdown ?></label></p>
447
<?php endif ?>
448
</td>
bp-core/admin/css/common.css CHANGED
@@ -1 +1 @@
1
- div#icon-buddypress{background:url(../images/icons32.png) no-repeat -370px -6px}div#icon-buddypress-activity{background:url(../images/icons32.png) no-repeat -10px -6px}ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a img{display:none}ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a{background-image:url(../images/menu.png)!important;background-position:-178pxpx -34px}ul#adminmenu li.toplevel_page_bp-wizard:hover .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-wizard.wp-has-current-submenu .wp-menu-image a{background-position:-178px -2px}ul#adminmenu li.toplevel_page_bp-components .wp-menu-image a img,ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a img{display:none}ul#adminmenu li.toplevel_page_bp-components .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a{background-image:url(../images/menu.png)!important;background-position:-178px -34px}ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image a{background-position:-178px -2px}ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image a img{display:none}ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image a{background-image:url(../images/menu.png)!important;background-position:0 -34px}ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image a{background-position:0 -2px}.dashboard_page_bp-wizard td.plugin-title span,.settings_page_bp-components td.plugin-title span{float:left;width:18px;height:18px;background-image:url(../images/menu.png);background-position:-4px -40px;background-repeat:no-repeat;margin-right:5px}.dashboard_page_bp-wizard tr.active td.plugin-title span,.settings_page_bp-components tr.active td.plugin-title span{background-position-y:-7px}.dashboard_page_bp-wizard tr.activity td.plugin-title span,.settings_page_bp-components tr.activity td.plugin-title span{background-position-x:-4px}.dashboard_page_bp-wizard tr.xprofile td.plugin-title span,.settings_page_bp-components tr.xprofile td.plugin-title span{background-image:url(../images/menu-wp.png);background-position-x:-305px}.dashboard_page_bp-wizard tr.settings td.plugin-title span,.settings_page_bp-components tr.settings td.plugin-title span{background-image:url(../images/menu-wp.png);background-position-x:-334px}.dashboard_page_bp-wizard tr.groups td.plugin-title span,.settings_page_bp-components tr.groups td.plugin-title span{background-position-x:-66px}.dashboard_page_bp-wizard tr.messages td.plugin-title span,.settings_page_bp-components tr.messages td.plugin-title span{background-position-x:-154px}.dashboard_page_bp-wizard tr.forums td.plugin-title span,.settings_page_bp-components tr.forums td.plugin-title span{background-image:url(../images/menu-wp.png);background-position-x:-36px}.dashboard_page_bp-wizard tr.blogs td.plugin-title span,.settings_page_bp-components tr.blogs td.plugin-title span{background-position-x:-125px}.dashboard_page_bp-wizard tr.friends td.plugin-title span,.settings_page_bp-components tr.friends td.plugin-title span{background-position-x:-95px}.dashboard_page_bp-wizard tr.core td.plugin-title span,.settings_page_bp-components tr.core td.plugin-title span{background-position-x:-184px}.dashboard_page_bp-wizard tr.members td.plugin-title span,.settings_page_bp-components tr.members td.plugin-title span{background-position-x:-36px}
1
+ div#icon-buddypress{background:url(../images/icons32.png) no-repeat -370px -6px}div#icon-buddypress-activity{background:url(../images/icons32.png) no-repeat -10px -6px}ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a img{display:none}ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a{background-image:url(../images/menu.png)!important;background-position:-178pxpx -34px}ul#adminmenu li.toplevel_page_bp-wizard:hover .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-wizard.wp-has-current-submenu .wp-menu-image a{background-position:-178px -2px}ul#adminmenu li.toplevel_page_bp-components .wp-menu-image a img,ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a img{display:none}ul#adminmenu li.toplevel_page_bp-components .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image a{background-image:url(../images/menu.png)!important;background-position:-178px -34px}ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image a{background-position:-178px -2px}ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image a img,ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image a img{display:none}ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image a{background-image:url(../images/menu.png)!important;background-position:0 -34px}ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image a,ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image a{background-position:0 -2px}.dashboard_page_bp-wizard td.plugin-title span,.settings_page_bp-components td.plugin-title span{float:left;width:18px;height:18px;background-image:url(../images/menu.png);background-position:-4px -40px;background-repeat:no-repeat;margin-right:5px}.dashboard_page_bp-wizard tr.active td.plugin-title span,.settings_page_bp-components tr.active td.plugin-title span{background-position-y:-7px}.dashboard_page_bp-wizard tr.activity td.plugin-title span,.settings_page_bp-components tr.activity td.plugin-title span{background-position-x:-4px}.dashboard_page_bp-wizard tr.xprofile td.plugin-title span,.settings_page_bp-components tr.xprofile td.plugin-title span{background-image:url(../images/menu-wp.png);background-position-x:-305px}.dashboard_page_bp-wizard tr.settings td.plugin-title span,.settings_page_bp-components tr.settings td.plugin-title span{background-image:url(../images/menu-wp.png);background-position-x:-334px}.dashboard_page_bp-wizard tr.groups td.plugin-title span,.settings_page_bp-components tr.groups td.plugin-title span{background-position-x:-66px}.dashboard_page_bp-wizard tr.messages td.plugin-title span,.settings_page_bp-components tr.messages td.plugin-title span{background-position-x:-154px}.dashboard_page_bp-wizard tr.forums td.plugin-title span,.settings_page_bp-components tr.forums td.plugin-title span{background-image:url(../images/menu-wp.png);background-position-x:-36px}.dashboard_page_bp-wizard tr.blogs td.plugin-title span,.settings_page_bp-components tr.blogs td.plugin-title span{background-position-x:-125px}.dashboard_page_bp-wizard tr.friends td.plugin-title span,.settings_page_bp-components tr.friends td.plugin-title span{background-position-x:-95px}.dashboard_page_bp-wizard tr.core td.plugin-title span,.settings_page_bp-components tr.core td.plugin-title span{background-position-x:-184px}.dashboard_page_bp-wizard tr.members td.plugin-title span,.settings_page_bp-components tr.members td.plugin-title span{background-position-x:-36px}
bp-core/admin/css/common.dev.css CHANGED
@@ -51,16 +51,21 @@ ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-men
51
}
52
53
/* Activity */
54
- ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image a img {
55
display: none;
56
}
57
- ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image a {
58
background-image: url( ../images/menu.png ) !important;
59
background-position: 0 -34px;
60
}
61
ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image a,
62
ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image a,
63
- ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image a {
64
background-position: 0 -2px;
65
}
66
51
}
52
53
/* Activity */
54
+ ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image a img,
55
+ ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image a img {
56
display: none;
57
}
58
+ ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image a,
59
+ ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image a {
60
background-image: url( ../images/menu.png ) !important;
61
background-position: 0 -34px;
62
}
63
ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image a,
64
ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image a,
65
+ ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image a,
66
+ ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image a,
67
+ ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image a,
68
+ ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image a {
69
background-position: 0 -2px;
70
}
71
bp-core/bp-core-admin.php CHANGED
@@ -286,7 +286,13 @@ class BP_Admin {
286
add_settings_field( 'hide-loggedout-adminbar', __( 'Toolbar', 'buddypress' ), 'bp_admin_setting_callback_admin_bar', 'buddypress', 'bp_main' );
287
register_setting ( 'buddypress', 'hide-loggedout-adminbar', 'intval' );
288
289
- // Allow favorites setting
290
add_settings_field( 'bp-disable-account-deletion', __( 'Account Deletion', 'buddypress' ), 'bp_admin_setting_callback_account_deletion', 'buddypress', 'bp_main' );
291
register_setting ( 'buddypress', 'bp-disable-account-deletion', 'intval' );
292
@@ -339,7 +345,7 @@ class BP_Admin {
339
340
// Activity commenting on blog and forum posts
341
add_settings_field( 'bp-disable-blogforum-comments', __( 'Blog &amp; Forum Comments', 'buddypress' ), 'bp_admin_setting_callback_blogforum_comments', 'buddypress', 'bp_activity' );
342
- register_setting( 'buddypress', 'bp-disable-blogforum-comments', 'intval' );
343
344
// Allow activity akismet
345
if ( is_plugin_active( 'akismet/akismet.php' ) && defined( 'AKISMET_VERSION' ) ) {
286
add_settings_field( 'hide-loggedout-adminbar', __( 'Toolbar', 'buddypress' ), 'bp_admin_setting_callback_admin_bar', 'buddypress', 'bp_main' );
287
register_setting ( 'buddypress', 'hide-loggedout-adminbar', 'intval' );
288
289
+ // Only show 'switch to Toolbar' option if the user chose to retain the BuddyBar during the 1.6 upgrade
290
+ if ( (bool) bp_get_option( '_bp_force_buddybar', false ) ) {
291
+ add_settings_field( '_bp_force_buddybar', __( 'Toolbar', 'buddypress' ), 'bp_admin_setting_callback_force_buddybar', 'buddypress', 'bp_main' );
292
+ register_setting( 'buddypress', '_bp_force_buddybar', 'bp_admin_sanitize_callback_force_buddybar' );
293
+ }
294
+
295
+ // Allow account deletion
296
add_settings_field( 'bp-disable-account-deletion', __( 'Account Deletion', 'buddypress' ), 'bp_admin_setting_callback_account_deletion', 'buddypress', 'bp_main' );
297
register_setting ( 'buddypress', 'bp-disable-account-deletion', 'intval' );
298
345
346
// Activity commenting on blog and forum posts
347
add_settings_field( 'bp-disable-blogforum-comments', __( 'Blog &amp; Forum Comments', 'buddypress' ), 'bp_admin_setting_callback_blogforum_comments', 'buddypress', 'bp_activity' );
348
+ register_setting( 'buddypress', 'bp-disable-blogforum-comments', 'bp_admin_sanitize_callback_blogforum_comments' );
349
350
// Allow activity akismet
351
if ( is_plugin_active( 'akismet/akismet.php' ) && defined( 'AKISMET_VERSION' ) ) {
bp-core/bp-core-buddybar.php CHANGED
@@ -631,11 +631,12 @@ function bp_core_load_admin_bar() {
631
global $wp_version;
632
633
// Don't show if Toolbar is disabled for non-logged in users
634
- if ( (int) bp_get_option( 'hide-loggedout-adminbar' ) )
635
return;
636
637
// Show the WordPress Toolbar
638
if ( bp_use_wp_admin_bar() && $wp_version >= 3.1 ) {
639
// Respect user's Toolbar display preferences
640
if ( is_user_logged_in() && ( bp_get_admin_bar_pref( 'front', bp_loggedin_user_id() ) || bp_get_admin_bar_pref( 'admin', bp_loggedin_user_id() ) ) )
641
return;
@@ -644,7 +645,6 @@ function bp_core_load_admin_bar() {
644
645
// Hide the WordPress Toolbar
646
} elseif ( !bp_use_wp_admin_bar() ) {
647
-
648
// Keep the WP Toolbar from loading
649
show_admin_bar( false );
650
631
global $wp_version;
632
633
// Don't show if Toolbar is disabled for non-logged in users
634
+ if ( (int) bp_get_option( 'hide-loggedout-adminbar' ) && ! is_user_logged_in() )
635
return;
636
637
// Show the WordPress Toolbar
638
if ( bp_use_wp_admin_bar() && $wp_version >= 3.1 ) {
639
+
640
// Respect user's Toolbar display preferences
641
if ( is_user_logged_in() && ( bp_get_admin_bar_pref( 'front', bp_loggedin_user_id() ) || bp_get_admin_bar_pref( 'admin', bp_loggedin_user_id() ) ) )
642
return;
645
646
// Hide the WordPress Toolbar
647
} elseif ( !bp_use_wp_admin_bar() ) {
648
// Keep the WP Toolbar from loading
649
show_admin_bar( false );
650
bp-core/bp-core-classes.php CHANGED
@@ -124,7 +124,7 @@ class BP_Core_User {
124
* @param integer $user_id The ID for the user
125
* @param boolean $populate_extras Whether to fetch extra information such as group/friendship counts or not.
126
*/
127
- public function __construct( $user_id, $populate_extras = false ) {
128
if ( !empty( $user_id ) ) {
129
$this->id = $user_id;
130
$this->populate();
@@ -147,7 +147,7 @@ class BP_Core_User {
147
* @uses bp_core_fetch_avatar() Returns HTML formatted avatar for a user
148
* @uses bp_profile_last_updated_date() Returns the last updated date for a user.
149
*/
150
- private function populate() {
151
152
if ( bp_is_active( 'xprofile' ) )
153
$this->profile_data = $this->get_profile_data();
@@ -180,7 +180,7 @@ class BP_Core_User {
180
/**
181
* Populates extra fields such as group and friendship counts.
182
*/
183
- private function populate_extras() {
184
185
if ( bp_is_active( 'friends' ) ) {
186
$this->total_friends = BP_Friends_Friendship::total_friend_count( $this->id );
@@ -192,13 +192,13 @@ class BP_Core_User {
192
}
193
}
194
195
- private function get_profile_data() {
196
return BP_XProfile_ProfileData::get_all_for_user( $this->id );
197
}
198
199
/** Static Methods ********************************************************/
200
201
- public static function get_users( $type, $limit = 0, $page = 1, $user_id = 0, $include = false, $search_terms = false, $populate_extras = true, $exclude = false, $meta_key = false, $meta_value = false ) {
202
global $wpdb, $bp;
203
204
$sql = array();
@@ -391,7 +391,7 @@ class BP_Core_User {
391
* @return mixed False on error, otherwise associative array of results.
392
* @static
393
*/
394
- public static function get_users_by_letter( $letter, $limit = null, $page = 1, $populate_extras = true, $exclude = '' ) {
395
global $bp, $wpdb;
396
397
$pag_sql = '';
@@ -453,7 +453,7 @@ class BP_Core_User {
453
* @return array Associative array
454
* @static
455
*/
456
- public static function get_specific_users( $user_ids, $limit = null, $page = 1, $populate_extras = true ) {
457
global $wpdb;
458
459
$pag_sql = '';
@@ -498,7 +498,7 @@ class BP_Core_User {
498
* @return array Associative array
499
* @static
500
*/
501
- public static function search_users( $search_terms, $limit = null, $page = 1, $populate_extras = true ) {
502
global $bp, $wpdb;
503
504
$user_ids = array();
@@ -542,7 +542,7 @@ class BP_Core_User {
542
* @return mixed False on error, otherwise associative array of results.
543
* @static
544
*/
545
- public static function get_user_extras( &$paged_users, &$user_ids, $type = false ) {
546
global $bp, $wpdb;
547
548
if ( empty( $user_ids ) )
@@ -622,7 +622,7 @@ class BP_Core_User {
622
* @return array Associative array
623
* @static
624
*/
625
- public static function get_core_userdata( $user_id ) {
626
global $wpdb;
627
628
if ( !$user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d LIMIT 1", $user_id ) ) )
@@ -705,7 +705,7 @@ class BP_Core_Notification {
705
*
706
* @param integer $id
707
*/
708
- public function __construct( $id = 0 ) {
709
if ( !empty( $id ) ) {
710
$this->id = $id;
711
$this->populate();
@@ -719,7 +719,7 @@ class BP_Core_Notification {
719
* @global wpdb $wpdb WordPress database object
720
* @return bool Success or failure
721
*/
722
- public function save() {
723
global $bp, $wpdb;
724
725
// Update
@@ -747,7 +747,7 @@ class BP_Core_Notification {
747
* @global BuddyPress $bp The one true BuddyPress instance
748
* @global wpdb $wpdb WordPress database object
749
*/
750
- private function populate() {
751
global $bp, $wpdb;
752
753
if ( $notification = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->core->table_name_notifications} WHERE id = %d", $this->id ) ) ) {
@@ -763,7 +763,7 @@ class BP_Core_Notification {
763
764
/** Static Methods ********************************************************/
765
766
- public static function check_access( $user_id, $notification_id ) {
767
global $wpdb, $bp;
768
769
return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->core->table_name_notifications} WHERE id = %d AND user_id = %d", $notification_id, $user_id ) );
@@ -779,7 +779,7 @@ class BP_Core_Notification {
779
* @return array Associative array
780
* @static
781
*/
782
- public static function get_all_for_user( $user_id, $status = 'is_new' ) {
783
global $bp, $wpdb;
784
785
$is_new = 'is_new' == $status ? ' AND is_new = 1 ' : '';
@@ -797,7 +797,7 @@ class BP_Core_Notification {
797
* @param string $component_action
798
* @static
799
*/
800
- public static function delete_for_user_by_type( $user_id, $component_name, $component_action ) {
801
global $bp, $wpdb;
802
803
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE user_id = %d AND component_name = %s AND component_action = %s", $user_id, $component_name, $component_action ) );
@@ -815,7 +815,7 @@ class BP_Core_Notification {
815
* @param integer $secondary_item_id (optional) The secondary item id of the notifications that we wish to use to delete.
816
* @static
817
*/
818
- public static function delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false ) {
819
global $bp, $wpdb;
820
821
$secondary_item_sql = !empty( $secondary_item_id ) ? $wpdb->prepare( " AND secondary_item_id = %d", $secondary_item_id ) : '';
@@ -833,7 +833,7 @@ class BP_Core_Notification {
833
* @param string $component_action The action of the component the notification was sent from.
834
* @static
835
*/
836
- public static function delete_from_user_by_type( $user_id, $component_name, $component_action ) {
837
global $bp, $wpdb;
838
839
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE item_id = %d AND component_name = %s AND component_action = %s", $user_id, $component_name, $component_action ) );
@@ -850,7 +850,7 @@ class BP_Core_Notification {
850
* @param string $secondary_item_id Optional secondary item id that the notifications are to have.
851
* @static
852
*/
853
- public static function delete_all_by_type( $item_id, $component_name, $component_action, $secondary_item_id ) {
854
global $bp, $wpdb;
855
856
if ( $component_action )
@@ -1002,7 +1002,7 @@ class BP_Button {
1002
* @param array $args
1003
* @return bool False if not allowed
1004
*/
1005
- public function __construct( $args = '' ) {
1006
1007
// Default arguments
1008
$defaults = array(
@@ -1106,7 +1106,7 @@ class BP_Button {
1106
*
1107
* @return string
1108
*/
1109
- public function contents() {
1110
return $this->contents;
1111
}
1112
@@ -1115,7 +1115,7 @@ class BP_Button {
1115
*
1116
* Output contents of button
1117
*/
1118
- public function display() {
1119
if ( !empty( $this->contents ) )
1120
echo $this->contents;
1121
}
@@ -1137,7 +1137,7 @@ class BP_Embed extends WP_Embed {
1137
*
1138
* @global unknown $wp_embed
1139
*/
1140
- public function __construct() {
1141
global $wp_embed;
1142
1143
// Make sure we populate the WP_Embed handlers array.
@@ -1186,7 +1186,7 @@ class BP_Embed extends WP_Embed {
1186
* @param string $url The URL attempting to be embeded.
1187
* @return string The embed HTML on success, otherwise the original URL.
1188
*/
1189
- public function shortcode( $attr, $url = '' ) {
1190
if ( empty( $url ) )
1191
return '';
1192
@@ -1251,7 +1251,7 @@ class BP_Embed extends WP_Embed {
1251
* @param array $rawattr Untouched shortcode attributes from {@link WP_Embed::shortcode()}.
1252
* @return string The embed HTML on success, otherwise the original URL.
1253
*/
1254
- public function parse_oembed( $id, $url, $attr, $rawattr ) {
1255
$id = intval( $id );
1256
1257
if ( $id ) {
124
* @param integer $user_id The ID for the user
125
* @param boolean $populate_extras Whether to fetch extra information such as group/friendship counts or not.
126
*/
127
+ function __construct( $user_id, $populate_extras = false ) {
128
if ( !empty( $user_id ) ) {
129
$this->id = $user_id;
130
$this->populate();
147
* @uses bp_core_fetch_avatar() Returns HTML formatted avatar for a user
148
* @uses bp_profile_last_updated_date() Returns the last updated date for a user.
149
*/
150
+ function populate() {
151
152
if ( bp_is_active( 'xprofile' ) )
153
$this->profile_data = $this->get_profile_data();
180
/**
181
* Populates extra fields such as group and friendship counts.
182
*/
183
+ function populate_extras() {
184
185
if ( bp_is_active( 'friends' ) ) {
186
$this->total_friends = BP_Friends_Friendship::total_friend_count( $this->id );
192
}
193
}
194
195
+ function get_profile_data() {
196
return BP_XProfile_ProfileData::get_all_for_user( $this->id );
197
}
198
199
/** Static Methods ********************************************************/
200
201
+ function get_users( $type, $limit = 0, $page = 1, $user_id = 0, $include = false, $search_terms = false, $populate_extras = true, $exclude = false, $meta_key = false, $meta_value = false ) {
202
global $wpdb, $bp;
203
204
$sql = array();
391
* @return mixed False on error, otherwise associative array of results.
392
* @static
393
*/
394
+ function get_users_by_letter( $letter, $limit = null, $page = 1, $populate_extras = true, $exclude = '' ) {
395
global $bp, $wpdb;
396
397
$pag_sql = '';
453
* @return array Associative array
454
* @static
455
*/
456
+ function get_specific_users( $user_ids, $limit = null, $page = 1, $populate_extras = true ) {
457
global $wpdb;
458
459
$pag_sql = '';
498
* @return array Associative array
499
* @static
500
*/
501
+ function search_users( $search_terms, $limit = null, $page = 1, $populate_extras = true ) {
502
global $bp, $wpdb;
503
504
$user_ids = array();
542
* @return mixed False on error, otherwise associative array of results.
543
* @static
544
*/
545
+ function get_user_extras( &$paged_users, &$user_ids, $type = false ) {
546
global $bp, $wpdb;
547
548
if ( empty( $user_ids ) )
622
* @return array Associative array
623
* @static
624
*/
625
+ function get_core_userdata( $user_id ) {
626
global $wpdb;
627
628
if ( !$user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d LIMIT 1", $user_id ) ) )
705
*
706
* @param integer $id
707
*/
708
+ function __construct( $id = 0 ) {
709
if ( !empty( $id ) ) {
710
$this->id = $id;
711
$this->populate();
719
* @global wpdb $wpdb WordPress database object
720
* @return bool Success or failure
721
*/
722
+ function save() {
723
global $bp, $wpdb;
724
725
// Update
747
* @global BuddyPress $bp The one true BuddyPress instance
748
* @global wpdb $wpdb WordPress database object
749
*/
750
+ function populate() {
751
global $bp, $wpdb;
752
753
if ( $notification = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->core->table_name_notifications} WHERE id = %d", $this->id ) ) ) {
763
764
/** Static Methods ********************************************************/
765
766
+ function check_access( $user_id, $notification_id ) {
767
global $wpdb, $bp;
768
769
return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->core->table_name_notifications} WHERE id = %d AND user_id = %d", $notification_id, $user_id ) );
779
* @return array Associative array
780
* @static
781
*/
782
+ function get_all_for_user( $user_id, $status = 'is_new' ) {
783
global $bp, $wpdb;
784
785
$is_new = 'is_new' == $status ? ' AND is_new = 1 ' : '';
797
* @param string $component_action
798
* @static
799
*/
800
+ function delete_for_user_by_type( $user_id, $component_name, $component_action ) {
801
global $bp, $wpdb;
802
803
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE user_id = %d AND component_name = %s AND component_action = %s", $user_id, $component_name, $component_action ) );
815
* @param integer $secondary_item_id (optional) The secondary item id of the notifications that we wish to use to delete.
816
* @static
817
*/
818
+ function delete_for_user_by_item_id( $user_id, $item_id, $component_name, $component_action, $secondary_item_id = false ) {
819
global $bp, $wpdb;
820
821
$secondary_item_sql = !empty( $secondary_item_id ) ? $wpdb->prepare( " AND secondary_item_id = %d", $secondary_item_id ) : '';
833
* @param string $component_action The action of the component the notification was sent from.
834
* @static
835
*/
836
+ function delete_from_user_by_type( $user_id, $component_name, $component_action ) {
837
global $bp, $wpdb;
838
839
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->core->table_name_notifications} WHERE item_id = %d AND component_name = %s AND component_action = %s", $user_id, $component_name, $component_action ) );
850
* @param string $secondary_item_id Optional secondary item id that the notifications are to have.
851
* @static
852
*/
853
+ function delete_all_by_type( $item_id, $component_name, $component_action, $secondary_item_id ) {
854
global $bp, $wpdb;
855
856
if ( $component_action )
1002
* @param array $args
1003
* @return bool False if not allowed
1004
*/
1005
+ function __construct( $args = '' ) {
1006
1007
// Default arguments
1008
$defaults = array(
1106
*
1107
* @return string
1108
*/
1109
+ function contents() {
1110
return $this->contents;
1111
}
1112
1115
*
1116
* Output contents of button
1117
*/
1118
+ function display() {
1119
if ( !empty( $this->contents ) )
1120
echo $this->contents;
1121
}
1137
*
1138
* @global unknown $wp_embed
1139
*/
1140
+ function __construct() {
1141
global $wp_embed;
1142
1143
// Make sure we populate the WP_Embed handlers array.
1186
* @param string $url The URL attempting to be embeded.
1187
* @return string The embed HTML on success, otherwise the original URL.
1188
*/
1189
+ function shortcode( $attr, $url = '' ) {
1190
if ( empty( $url ) )
1191
return '';
1192
1251
* @param array $rawattr Untouched shortcode attributes from {@link WP_Embed::shortcode()}.
1252
* @return string The embed HTML on success, otherwise the original URL.
1253
*/
1254
+ function parse_oembed( $id, $url, $attr, $rawattr ) {
1255
$id = intval( $id );
1256
1257
if ( $id ) {
bp-core/bp-core-functions.php CHANGED
@@ -978,7 +978,7 @@ function bp_use_wp_admin_bar() {
978
* 3 => 'blip'
979
* );
980
*
981
- * For the second argument, $func_args, you should just pass func_get_args().
982
*
983
* @since BuddyPress (1.6)
984
* @param array $old_args_keys
978
* 3 => 'blip'
979
* );
980
*
981
+ * For the second argument, $func_args, you should just pass the value of func_get_args().
982
*
983
* @since BuddyPress (1.6)
984
* @param array $old_args_keys
bp-core/bp-core-options.php CHANGED
@@ -56,7 +56,7 @@ function bp_get_default_options() {
56
'bp-disable-avatar-uploads' => false,
57
58
// Allow users to delete their own accounts
59
- 'bp-disable-account-deletion' => true,
60
61
// Allow comments on blog and forum activity items
62
'bp-disable-blogforum-comments' => true,
56
'bp-disable-avatar-uploads' => false,
57
58
// Allow users to delete their own accounts
59
+ 'bp-disable-account-deletion' => false,
60
61
// Allow comments on blog and forum activity items
62
'bp-disable-blogforum-comments' => true,
bp-core/bp-core-template.php CHANGED
@@ -1551,6 +1551,9 @@ function bp_the_body_class() {
1551
1552
/** User **************************************************************/
1553
1554
if ( !bp_is_directory() ) :
1555
if ( bp_is_user_blogs() )
1556
$bp_classes[] = 'my-blogs';
1551
1552
/** User **************************************************************/
1553
1554
+ if ( bp_is_user() )
1555
+ $bp_classes[] = 'bp-user';
1556
+
1557
if ( !bp_is_directory() ) :
1558
if ( bp_is_user_blogs() )
1559
$bp_classes[] = 'my-blogs';
bp-core/css/buddybar.css CHANGED
@@ -1 +1 @@
1
- body,body.wp-admin{padding-top:25px!important}#wp-admin-bar{position:fixed;top:0;left:0;height:25px;font-size:11px;width:100%;z-index:9999}#wp-admin-bar .padder{position:relative;padding:0;width:100%;margin:0 auto;background:url(../images/60pc_black.png);height:25px}body#bp-default #wp-admin-bar .padder{max-width:1250px}#wp-admin-bar *{z-index:999}#wp-admin-bar div#admin-bar-logo{position:absolute;top:5px;left:10px}#wp-admin-bar a img{border:0}#wp-admin-bar li{list-style:none;margin:0;padding:0;line-height:100%;text-align:left}#wp-admin-bar li a{padding:7px 15px 7px 15px;color:#eee;text-decoration:none;font-size:11px}#wp-admin-bar li.alt{border:0}#wp-admin-bar li.no-arrow a{padding-right:15px}#wp-admin-bar ul li ul li a span{display:none}#wp-admin-bar li:hover,#wp-admin-bar li.hover{position:static}#admin-bar-logo{float:left;font-weight:bold;font-size:11px;padding:5px 8px;margin:0;text-decoration:none;color:#fff}body#bp-default #admin-bar-logo{padding:2px 8px}#wp-admin-bar ul{margin:0;list-style:none;line-height:1;cursor:pointer;height:auto;padding:0}#wp-admin-bar ul li{padding:0;float:left;position:relative;background:url(../images/admin-menu-arrow.gif) 88% 53% no-repeat;padding-right:11px}#wp-admin-bar ul li.no-arrow{background:0;padding-right:0}#wp-admin-bar ul li ul li{background-image:none}#wp-admin-bar ul li.align-right{position:absolute;right:0}#wp-admin-bar ul li a{display:block}#wp-admin-bar ul.main-nav li:hover,#wp-admin-bar ul.main-nav li.sfhover,#wp-admin-bar ul.main-nav li ul li.sfhover{background-color:#333}#wp-admin-bar ul li ul{position:absolute;width:185px;left:-999em;margin-left:0;background:#333;border:1px solid #222;-moz-box-shadow:0 4px 8px rgba(0,0,0,0.1);-webkit-box-shadow:0 4px 8px rgba(0,0,0,0.1);-moz-border-radius:3px;-webkit-border-radius:3px;-moz-border-radius-topleft:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:0;-webkit-border-top-right-radius:0}#wp-admin-bar ul li>ul{border-top:0}#wp-admin-bar ul li ul a{color:#eee}#wp-admin-bar ul li ul li{float:left;width:174px;margin:0}#wp-admin-bar ul li ul li:hover a{color:#fff}#wp-admin-bar ul li div.admin-bar-clear{clear:both}#wp-admin-bar ul.main-nav li ul li:hover,#wp-admin-bar ul.main-nav li ul li.sfhover,#wp-admin-bar ul.main-nav li ul li.sfhover{background-color:#222}#wp-admin-bar ul li ul ul{margin:-25px 0 0 184px;-moz-border-radius:3px;-webkit-border-radius:3px}#wp-admin-bar ul li ul li:hover ul li a{color:#eee}#wp-admin-bar ul li ul li ul li:hover a{color:#fff}#wp-admin-bar ul li:hover ul,#wp-admin-bar ul li ul li:hover ul,#wp-admin-bar ul li.sfhover ul,#wp-admin-bar ul li ul li.sfhover ul{left:auto}#wp-admin-bar ul li.align-right:hover ul{right:0}#wp-admin-bar ul li:hover ul ul,#wp-admin-bar li.sfhover ul li ul{left:-999em}#wp-admin-bar img.avatar{float:left;margin-right:8px}#wp-admin-bar span.activity{display:block;margin-left:34px;padding:0}#wp-admin-bar ul.author-list li a{height:17px}#wp-admin-bar ul li#bp-adminbar-notifications-menu a span{padding:0 6px;margin-left:2px;background:#fff;color:#000;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}#wp-admin-bar-user-info img.avatar{height:64px;width:64px}
1
+ body:not(.wp-admin){padding-top:25px!important}#wp-admin-bar{position:fixed;top:0;left:0;height:25px;font-size:11px;width:100%;z-index:9999}#wp-admin-bar .padder{position:relative;padding:0;width:100%;margin:0 auto;background:url(../images/60pc_black.png);height:25px}body#bp-default #wp-admin-bar .padder{max-width:1250px}#wp-admin-bar *{z-index:999}#wp-admin-bar div#admin-bar-logo{position:absolute;top:5px;left:10px}#wp-admin-bar a img{border:0}#wp-admin-bar li{list-style:none;margin:0;padding:0;line-height:100%;text-align:left}#wp-admin-bar li a{padding:7px 15px 7px 15px;color:#eee;text-decoration:none;font-size:11px}#wp-admin-bar li.alt{border:0}#wp-admin-bar li.no-arrow a{padding-right:15px}#wp-admin-bar ul li ul li a span{display:none}#wp-admin-bar li:hover,#wp-admin-bar li.hover{position:static}#admin-bar-logo{float:left;font-weight:bold;font-size:11px;padding:5px 8px;margin:0;text-decoration:none;color:#fff}body#bp-default #admin-bar-logo{padding:2px 8px}#wp-admin-bar ul{margin:0;list-style:none;line-height:1;cursor:pointer;height:auto;padding:0}#wp-admin-bar ul li{padding:0;float:left;position:relative;background:url(../images/admin-menu-arrow.gif) 88% 53% no-repeat;padding-right:11px}#wp-admin-bar ul li.no-arrow{background:0;padding-right:0}#wp-admin-bar ul li ul li{background-image:none}#wp-admin-bar ul li.align-right{position:absolute;right:0}#wp-admin-bar ul li a{display:block}#wp-admin-bar ul.main-nav li:hover,#wp-admin-bar ul.main-nav li.sfhover,#wp-admin-bar ul.main-nav li ul li.sfhover{background-color:#333}#wp-admin-bar ul li ul{position:absolute;width:185px;left:-999em;margin-left:0;background:#333;border:1px solid #222;-moz-box-shadow:0 4px 8px rgba(0,0,0,0.1);-webkit-box-shadow:0 4px 8px rgba(0,0,0,0.1);-moz-border-radius:3px;-webkit-border-radius:3px;-moz-border-radius-topleft:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:0;-webkit-border-top-right-radius:0}#wp-admin-bar ul li>ul{border-top:0}#wp-admin-bar ul li ul a{color:#eee}#wp-admin-bar ul li ul li{float:left;width:174px;margin:0}#wp-admin-bar ul li ul li:hover a{color:#fff}#wp-admin-bar ul li div.admin-bar-clear{clear:both}#wp-admin-bar ul.main-nav li ul li:hover,#wp-admin-bar ul.main-nav li ul li.sfhover,#wp-admin-bar ul.main-nav li ul li.sfhover{background-color:#222}#wp-admin-bar ul li ul ul{margin:-25px 0 0 184px;-moz-border-radius:3px;-webkit-border-radius:3px}#wp-admin-bar ul li ul li:hover ul li a{color:#eee}#wp-admin-bar ul li ul li ul li:hover a{color:#fff}#wp-admin-bar ul li:hover ul,#wp-admin-bar ul li ul li:hover ul,#wp-admin-bar ul li.sfhover ul,#wp-admin-bar ul li ul li.sfhover ul{left:auto}#wp-admin-bar ul li.align-right:hover ul{right:0}#wp-admin-bar ul li:hover ul ul,#wp-admin-bar li.sfhover ul li ul{left:-999em}#wp-admin-bar img.avatar{float:left;margin-right:8px}#wp-admin-bar span.activity{display:block;margin-left:34px;padding:0}#wp-admin-bar ul.author-list li a{height:17px}#wp-admin-bar ul li#bp-adminbar-notifications-menu a span{padding:0 6px;margin-left:2px;background:#fff;color:#000;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}#wp-admin-bar-user-info img.avatar{height:64px;width:64px}
bp-core/css/buddybar.dev.css CHANGED
@@ -1,5 +1,4 @@
1
- body,
2
- body.wp-admin {
3
padding-top: 25px !important;
4
}
5
#wp-admin-bar {
1
+ body:not(.wp-admin) {
2
padding-top: 25px !important;
3
}
4
#wp-admin-bar {
bp-core/deprecated/1.5.php CHANGED
@@ -535,4 +535,132 @@ function bp_dtheme_deprecated() {
535
}
536
add_action( 'after_setup_theme', 'bp_dtheme_deprecated', 15 );
537
538
?>
535
}
536
add_action( 'after_setup_theme', 'bp_dtheme_deprecated', 15 );
537
538
+ /**
539
+ * In BP 1.5, the Settings functions were moved out of the Core and Members
540
+ * components, and moved into a new Settings component. This function is no
541
+ * longer needed as the nav structure is set up by the {@link BP_Component} class.
542
+ *
543
+ * @deprecated BuddyPress (1.5)
544
+ * @since BuddyPress (1.6)
545
+ */
546
+ function bp_core_add_settings_nav() {
547
+ _deprecated_function( __FUNCTION__, '1.5' );
548
+ }
549
+
550
+ /**
551
+ * In BP 1.5, the Settings functions were moved out of the Core and Members
552
+ * components, and moved into a new Settings component. This function is no
553
+ * longer needed as new template files for the Settings component were
554
+ * introduced.
555
+ *
556
+ * @deprecated BuddyPress (1.5)
557
+ * @since BuddyPress (1.6)
558
+ */
559
+ function bp_core_screen_general_settings() {
560
+ _deprecated_function( __FUNCTION__, '1.5', 'Moved into theme template' );
561
+ }
562
+
563
+ /**
564
+ * In BP 1.5, the Settings functions were moved out of the Core and Members
565
+ * components, and moved into a new Settings component. This function is no
566
+ * longer needed as new template files for the Settings component were
567
+ * introduced.
568
+ *
569
+ * @deprecated BuddyPress (1.5)
570
+ * @since BuddyPress (1.6)
571
+ */
572
+ function bp_core_screen_general_settings_title() {
573
+ _deprecated_function( __FUNCTION__, '1.5', 'Moved into theme template' );
574
+ }
575
+
576
+ /**
577
+ * In BP 1.5, the Settings functions were moved out of the Core and Members
578
+ * components, and moved into a new Settings component. This function is no
579
+ * longer needed as new template files for the Settings component were
580
+ * introduced.
581
+ *
582
+ * @deprecated BuddyPress (1.5)
583
+ * @since BuddyPress (1.6)
584
+ */
585
+ function bp_core_screen_general_settings_content() {
586
+ _deprecated_function( __FUNCTION__, '1.5', 'Moved into theme template' );
587
+ }
588
+
589
+ /**
590
+ * In BP 1.5, the Settings functions were moved out of the Core and Members
591
+ * components, and moved into a new Settings component. This function is no
592
+ * longer needed as new template files for the Settings component were
593
+ * introduced.
594
+ *
595
+ * @deprecated BuddyPress (1.5)
596
+ * @since BuddyPress (1.6)
597
+ */
598
+ function bp_core_screen_notification_settings() {
599
+ _deprecated_function( __FUNCTION__, '1.5', 'Moved into theme template' );
600
+ }
601
+
602
+ /**
603
+ * In BP 1.5, the Settings functions were moved out of the Core and Members
604
+ * components, and moved into a new Settings component. This function is no
605
+ * longer needed as new template files for the Settings component were
606
+ * introduced.
607
+ *
608
+ * @deprecated BuddyPress (1.5)
609
+ * @since BuddyPress (1.6)
610
+ */
611
+ function bp_core_screen_notification_settings_title() {
612
+ _deprecated_function( __FUNCTION__, '1.5', 'Moved into theme template' );
613
+ }
614
+
615
+ /**
616
+ * In BP 1.5, the Settings functions were moved out of the Core and Members
617
+ * components, and moved into a new Settings component. This function is no
618
+ * longer needed as new template files for the Settings component were
619
+ * introduced.
620
+ *
621
+ * @deprecated BuddyPress (1.5)
622
+ * @since BuddyPress (1.6)
623
+ */
624
+ function bp_core_screen_notification_settings_content() {
625
+ _deprecated_function( __FUNCTION__, '1.5', 'Moved into theme template' );
626
+ }
627
+
628
+ /**
629
+ * In BP 1.5, the Settings functions were moved out of the Core and Members
630
+ * components, and moved into a new Settings component. This function is no
631
+ * longer needed as new template files for the Settings component were
632
+ * introduced.
633
+ *
634
+ * @deprecated BuddyPress (1.5)
635
+ * @since BuddyPress (1.6)
636
+ */
637
+ function bp_core_screen_delete_account() {
638
+ _deprecated_function( __FUNCTION__, '1.5', 'Moved into theme template' );
639
+ }
640
+
641
+ /**
642
+ * In BP 1.5, the Settings functions were moved out of the Core and Members
643
+ * components, and moved into a new Settings component. This function is no
644
+ * longer needed as new template files for the Settings component were
645
+ * introduced.
646
+ *
647
+ * @deprecated BuddyPress (1.5)
648
+ * @since BuddyPress (1.6)
649
+ */
650
+ function bp_core_screen_delete_account_title() {
651
+ _deprecated_function( __FUNCTION__, '1.5', 'Moved into theme template' );
652
+ }
653
+
654
+ /**
655
+ * In BP 1.5, the Settings functions were moved out of the Core and Members
656
+ * components, and moved into a new Settings component. This function is no
657
+ * longer needed as new template files for the Settings component were
658
+ * introduced.
659
+ *
660
+ * @deprecated BuddyPress (1.5)
661
+ * @since BuddyPress (1.6)
662
+ */
663
+ function bp_core_screen_delete_account_content() {
664
+ _deprecated_function( __FUNCTION__, '1.5', 'Moved into theme template' );
665
+ }
666
?>
bp-forums/bp-forums-admin.php CHANGED
@@ -18,9 +18,27 @@ function bp_forums_add_admin_menu() {
18
}
19
add_action( bp_core_admin_hook(), 'bp_forums_add_admin_menu' );
20
21
function bp_forums_bbpress_admin() {
22
global $bp;
23
24
$action = bp_get_admin_url( 'admin.php?page=bb-forums-setup&reinstall=1' ); ?>
25
26
<div class="wrap">
@@ -77,13 +95,15 @@ function bp_forums_bbpress_admin() {
77
<li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li>
78
<li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li>
79
</ul>
80
<div>
81
- <a class="button thickbox button-primary" href="<?php bp_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) ); ?>"><?php _e( 'Install Site Wide Forums', 'buddypress' ) ?></a> &nbsp;
82
</div>
83
</div>
84
85
<?php endif; ?>
86
87
</div>
88
<?php
89
}
@@ -93,6 +113,21 @@ function bp_forums_bbpress_install_wizard() {
93
94
$step = isset( $_REQUEST['step'] ) ? $_REQUEST['step'] : '';
95
96
switch( $step ) {
97
case 'existing':
98
if ( isset( $_REQUEST['doinstall'] ) && ( 1 == (int) $_REQUEST['doinstall'] ) ) {
@@ -196,7 +231,7 @@ function bp_forums_bbpress_install_wizard() {
196
<li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li>
197
</ul>
198
<div>
199
- <a class="button thickbox button-primary" href="<?php bp_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) ); ?>"><?php _e( 'Install Site Wide Forums', 'buddypress' ) ?></a> &nbsp;
200
</div>
201
</div>
202
18
}
19
add_action( bp_core_admin_hook(), 'bp_forums_add_admin_menu' );
20
21
+ /**
22
+ * Outputs the markup for the bb-forums-admin panel
23
+ */
24
function bp_forums_bbpress_admin() {
25
global $bp;
26
27
+ // The text and URL of the Site Wide Forums button differs depending on whether bbPress
28
+ // is running
29
+ if ( is_plugin_active( 'bbpress/bbpress.php' ) ) {
30
+ // The bbPress admin page will always be on the root blog. switch_to_blog() will
31
+ // pass through if we're already there.
32
+ switch_to_blog( bp_get_root_blog_id() );
33
+ $button_url = admin_url( add_query_arg( array( 'page' => 'bbpress' ), 'options-general.php' ) );
34
+ restore_current_blog();
35
+
36
+ $button_text = __( 'Configure Site Wide Forums', 'buddypress' );
37
+ } else {
38
+ $button_url = bp_get_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) );
39
+ $button_text = __( 'Install Site Wide Forums', 'buddypress' );
40
+ }
41
+
42
$action = bp_get_admin_url( 'admin.php?page=bb-forums-setup&reinstall=1' ); ?>
43
44
<div class="wrap">
95
<li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li>
96
<li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li>
97
</ul>
98
+
99
<div>
100
+ <a class="button thickbox button-primary" href="<?php echo esc_attr( $button_url ) ?>"><?php echo esc_html( $button_text ) ?></a> &nbsp;
101
</div>
102
</div>
103
104
<?php endif; ?>
105
106
+ <p class="clear description"><?php printf( __( 'Need help deciding between Group Forums and Site Wide Forums? Visit <a href="%s">the BuddyPress codex</a> for more information.', 'buddypress' ), 'http://codex.buddypress.org/getting-started/installing-group-and-sitewide-forums/' ) ?></p>
107
</div>
108
<?php
109
}
113
114
$step = isset( $_REQUEST['step'] ) ? $_REQUEST['step'] : '';
115
116
+ // The text and URL of the Site Wide Forums button differs depending on whether bbPress
117
+ // is running
118
+ if ( is_plugin_active( 'bbpress/bbpress.php' ) ) {
119
+ // The bbPress admin page will always be on the root blog. switch_to_blog() will
120
+ // pass through if we're already there.
121
+ switch_to_blog( bp_get_root_blog_id() );
122
+ $button_url = admin_url( add_query_arg( array( 'page' => 'bbpress' ), 'options-general.php' ) );
123
+ restore_current_blog();
124
+
125
+ $button_text = __( 'Configure Site Wide Forums', 'buddypress' );
126
+ } else {
127
+ $button_url = bp_get_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) );
128
+ $button_text = __( 'Install Site Wide Forums', 'buddypress' );
129
+ }
130
+
131
switch( $step ) {
132
case 'existing':
133
if ( isset( $_REQUEST['doinstall'] ) && ( 1 == (int) $_REQUEST['doinstall'] ) ) {
231
<li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li>
232
</ul>
233
<div>
234
+ <a class="button thickbox button-primary" href="<?php echo esc_attr( $button_url ) ?>"><?php echo esc_html( $button_text ) ?></a> &nbsp;
235
</div>
236
</div>
237
bp-friends/bp-friends-classes.php CHANGED
@@ -16,7 +16,7 @@ class BP_Friends_Friendship {
16
17
var $friend;
18
19
- public function __construct( $id = null, $is_request = false, $populate_friend_details = true ) {
20
$this->is_request = $is_request;
21
22
if ( !empty( $id ) ) {
@@ -26,7 +26,7 @@ class BP_Friends_Friendship {
26
}
27
}
28
29
- private function populate() {
30
global $wpdb, $bp;
31
32
if ( $friendship = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) ) ) {
@@ -46,7 +46,7 @@ class BP_Friends_Friendship {
46
}
47
}
48
49
- public function save() {
50
global $wpdb, $bp;
51
52
$this->initiator_user_id = apply_filters( 'friends_friendship_initiator_user_id_before_save', $this->initiator_user_id, $this->id );
@@ -72,7 +72,7 @@ class BP_Friends_Friendship {
72
return $result;
73
}
74
75
- public function delete() {
76
global $wpdb, $bp;
77
78
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) );
@@ -80,7 +80,7 @@ class BP_Friends_Friendship {
80
81
/** Static Methods ********************************************************/
82
83
- public static function get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) {
84
global $wpdb, $bp;
85
86
if ( !empty( $friend_requests_only ) ) {
@@ -105,19 +105,19 @@ class BP_Friends_Friendship {
105
return $fids;
106
}
107
108
- public static function get_friendship_id( $user_id, $friend_id ) {
109
global $wpdb, $bp;
110
111
return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->friends->table_name} WHERE ( initiator_user_id = %d AND friend_user_id = %d ) OR ( initiator_user_id = %d AND friend_user_id = %d ) AND is_confirmed = 1", $user_id, $friend_id, $friend_id, $user_id ) );
112
}
113
114
- public static function get_friendship_request_user_ids( $user_id ) {
115
global $wpdb, $bp;
116
117
return $wpdb->get_col( $wpdb->prepare( "SELECT initiator_user_id FROM {$bp->friends->table_name} WHERE friend_user_id = %d AND is_confirmed = 0", $user_id ) );
118
}
119
120
- public static function total_friend_count( $user_id = 0 ) {
121
global $wpdb, $bp;
122
123
if ( empty( $user_id ) )
@@ -136,7 +136,7 @@ class BP_Friends_Friendship {
136
return (int) $count;
137
}
138
139
- public static function search_friends( $filter, $user_id, $limit = null, $page = null ) {
140
global $wpdb, $bp;
141
142
// TODO: Optimize this function.
@@ -176,7 +176,7 @@ class BP_Friends_Friendship {
176
return array( 'friends' => $filtered_friend_ids, 'total' => (int) $total_friend_ids );
177
}
178
179
- public static function check_is_friend( $loggedin_userid, $possible_friend_userid ) {
180
global $wpdb, $bp;
181
182
if ( empty( $loggedin_userid ) || empty( $possible_friend_userid ) )
@@ -195,31 +195,31 @@ class BP_Friends_Friendship {
195
}
196
}
197
198
- public static function get_bulk_last_active( $user_ids ) {
199
global $wpdb;
200
201
return $wpdb->get_results( $wpdb->prepare( "SELECT meta_value as last_activity, user_id FROM {$wpdb->usermeta} WHERE meta_key = %s AND user_id IN ( {$user_ids} ) ORDER BY meta_value DESC", bp_get_user_meta_key( 'last_activity' ) ) );
202
}
203
204
- public static function accept($friendship_id) {
205
global $wpdb, $bp;
206
207
return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = %s WHERE id = %d AND friend_user_id = %d", bp_core_current_time(), $friendship_id, bp_loggedin_user_id() ) );
208
}
209
210
- public static function withdraw($friendship_id) {
211
global $wpdb, $bp;
212
213
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND initiator_user_id = %d", $friendship_id, bp_loggedin_user_id() ) );
214
}
215
216
- public static function reject($friendship_id) {
217
global $wpdb, $bp;
218
219
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND friend_user_id = %d", $friendship_id, bp_loggedin_user_id() ) );
220
}
221
222
- public static function search_users( $filter, $user_id, $limit = null, $page = null ) {
223
global $wpdb;
224
225
$filter = like_escape( $wpdb->escape( $filter ) );
@@ -245,7 +245,7 @@ class BP_Friends_Friendship {
245
return $filtered_fids;
246
}
247
248
- public static function search_users_count( $filter ) {
249
global $wpdb, $bp;
250
251
$filter = like_escape( $wpdb->escape( $filter ) );
@@ -268,7 +268,7 @@ class BP_Friends_Friendship {
268
return $user_count[0];
269
}
270
271
- public static function sort_by_name( $user_ids ) {
272
global $wpdb, $bp;
273
274
if ( !bp_is_active( 'xprofile' ) )
@@ -277,7 +277,7 @@ class BP_Friends_Friendship {
277
return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$bp->profile->table_name_data} pd, {$bp->profile->table_name_fields} pf WHERE pf.id = pd.field_id AND pf.name = %s AND pd.user_id IN ( {$user_ids} ) ORDER BY pd.value ASC", bp_xprofile_fullname_field_name() ) );
278
}
279
280
- public static function get_random_friends( $user_id, $total_friends = 5 ) {
281
global $wpdb, $bp;
282
283
$fids = array();
@@ -295,7 +295,7 @@ class BP_Friends_Friendship {
295
return false;
296
}
297
298
- public static function get_invitable_friend_count( $user_id, $group_id ) {
299
300
// Setup some data we'll use below
301
$is_group_admin = BP_Groups_Member::check_is_admin( $user_id, $group_id );
@@ -322,13 +322,13 @@ class BP_Friends_Friendship {
322
return $invitable_count;
323
}
324
325
- public static function get_user_ids_for_friendship( $friendship_id ) {
326
global $wpdb, $bp;
327
328
return $wpdb->get_row( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE id = %d", $friendship_id ) );
329
}
330
331
- public static function delete_all_for_user( $user_id ) {
332
global $wpdb, $bp;
333
334
// Get friends of $user_id
16
17
var $friend;
18
19
+ function __construct( $id = null, $is_request = false, $populate_friend_details = true ) {
20
$this->is_request = $is_request;
21
22
if ( !empty( $id ) ) {
26
}
27
}
28
29
+ function populate() {
30
global $wpdb, $bp;
31
32
if ( $friendship = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) ) ) {
46
}
47
}
48
49
+ function save() {
50
global $wpdb, $bp;
51
52
$this->initiator_user_id = apply_filters( 'friends_friendship_initiator_user_id_before_save', $this->initiator_user_id, $this->id );
72
return $result;
73
}
74
75
+ function delete() {
76
global $wpdb, $bp;
77
78
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) );
80
81
/** Static Methods ********************************************************/
82
83
+ function get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) {
84
global $wpdb, $bp;
85
86
if ( !empty( $friend_requests_only ) ) {
105
return $fids;
106
}
107
108
+ function get_friendship_id( $user_id, $friend_id ) {
109
global $wpdb, $bp;
110
111
return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->friends->table_name} WHERE ( initiator_user_id = %d AND friend_user_id = %d ) OR ( initiator_user_id = %d AND friend_user_id = %d ) AND is_confirmed = 1", $user_id, $friend_id, $friend_id, $user_id ) );
112
}
113
114
+ function get_friendship_request_user_ids( $user_id ) {
115
global $wpdb, $bp;
116
117
return $wpdb->get_col( $wpdb->prepare( "SELECT initiator_user_id FROM {$bp->friends->table_name} WHERE friend_user_id = %d AND is_confirmed = 0", $user_id ) );
118
}
119
120
+ function total_friend_count( $user_id = 0 ) {
121
global $wpdb, $bp;
122
123
if ( empty( $user_id ) )
136
return (int) $count;
137
}
138
139
+ function search_friends( $filter, $user_id, $limit = null, $page = null ) {
140
global $wpdb, $bp;
141
142
// TODO: Optimize this function.
176
return array( 'friends' => $filtered_friend_ids, 'total' => (int) $total_friend_ids );
177
}
178
179
+ function check_is_friend( $loggedin_userid, $possible_friend_userid ) {
180
global $wpdb, $bp;
181
182
if ( empty( $loggedin_userid ) || empty( $possible_friend_userid ) )
195
}
196
}
197
198
+ function get_bulk_last_active( $user_ids ) {
199
global $wpdb;
200
201
return $wpdb->get_results( $wpdb->prepare( "SELECT meta_value as last_activity, user_id FROM {$wpdb->usermeta} WHERE meta_key = %s AND user_id IN ( {$user_ids} ) ORDER BY meta_value DESC", bp_get_user_meta_key( 'last_activity' ) ) );
202
}
203
204
+ function accept($friendship_id) {
205
global $wpdb, $bp;
206
207
return $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET is_confirmed = 1, date_created = %s WHERE id = %d AND friend_user_id = %d", bp_core_current_time(), $friendship_id, bp_loggedin_user_id() ) );
208
}
209
210
+ function withdraw($friendship_id) {
211
global $wpdb, $bp;
212
213
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND initiator_user_id = %d", $friendship_id, bp_loggedin_user_id() ) );
214
}
215
216
+ function reject($friendship_id) {
217
global $wpdb, $bp;
218
219
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND friend_user_id = %d", $friendship_id, bp_loggedin_user_id() ) );
220
}
221
222
+ function search_users( $filter, $user_id, $limit = null, $page = null ) {
223
global $wpdb;
224
225
$filter = like_escape( $wpdb->escape( $filter ) );
245
return $filtered_fids;
246
}
247
248
+ function search_users_count( $filter ) {
249
global $wpdb, $bp;
250
251
$filter = like_escape( $wpdb->escape( $filter ) );
268
return $user_count[0];
269
}
270
271
+ function sort_by_name( $user_ids ) {
272
global $wpdb, $bp;
273
274
if ( !bp_is_active( 'xprofile' ) )
277
return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$bp->profile->table_name_data} pd, {$bp->profile->table_name_fields} pf WHERE pf.id = pd.field_id AND pf.name = %s AND pd.user_id IN ( {$user_ids} ) ORDER BY pd.value ASC", bp_xprofile_fullname_field_name() ) );
278
}
279
280
+ function get_random_friends( $user_id, $total_friends = 5 ) {
281
global $wpdb, $bp;
282
283
$fids = array();
295
return false;
296
}
297
298
+ function get_invitable_friend_count( $user_id, $group_id ) {
299
300
// Setup some data we'll use below
301
$is_group_admin = BP_Groups_Member::check_is_admin( $user_id, $group_id );
322
return $invitable_count;
323
}
324
325
+ function get_user_ids_for_friendship( $friendship_id ) {
326
global $wpdb, $bp;
327
328
return $wpdb->get_row( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE id = %d", $friendship_id ) );
329
}
330
331
+ function delete_all_for_user( $user_id ) {
332
global $wpdb, $bp;
333
334
// Get friends of $user_id
bp-groups/bp-groups-cache.php CHANGED
@@ -96,7 +96,7 @@ add_action( 'groups_settings_updated', 'bp_core_clear_cache' );
96
add_action( 'groups_unban_member', 'bp_core_clear_cache' );
97
add_action( 'groups_ban_member', 'bp_core_clear_cache' );
98
add_action( 'groups_demote_member', 'bp_core_clear_cache' );
99
- add_action( 'groups_premote_member', 'bp_core_clear_cache' );
100
add_action( 'groups_membership_rejected', 'bp_core_clear_cache' );
101
add_action( 'groups_membership_accepted', 'bp_core_clear_cache' );
102
add_action( 'groups_membership_requested', 'bp_core_clear_cache' );
96
add_action( 'groups_unban_member', 'bp_core_clear_cache' );
97
add_action( 'groups_ban_member', 'bp_core_clear_cache' );
98
add_action( 'groups_demote_member', 'bp_core_clear_cache' );
99
+ add_action( 'groups_promote_member', 'bp_core_clear_cache' );
100
add_action( 'groups_membership_rejected', 'bp_core_clear_cache' );
101
add_action( 'groups_membership_accepted', 'bp_core_clear_cache' );
102
add_action( 'groups_membership_requested', 'bp_core_clear_cache' );
bp-groups/bp-groups-classes.php CHANGED
@@ -48,14 +48,14 @@ class BP_Groups_Group {
48
*/
49
public $user_has_access;
50
51
- public function __construct( $id = null ) {
52
if ( !empty( $id ) ) {
53
$this->id = $id;
54
$this->populate();
55
}
56
}
57
58
- private function populate() {
59
global $wpdb, $bp;
60
61
if ( $group = $wpdb->get_row( $wpdb->prepare( "SELECT g.* FROM {$bp->groups->table_name} g WHERE g.id = %d", $this->id ) ) ) {
@@ -94,7 +94,7 @@ class BP_Groups_Group {
94
}
95
}
96
97
- public function save() {
98
global $wpdb, $bp;
99
100
$this->creator_id = apply_filters( 'groups_group_creator_id_before_save', $this->creator_id, $this->id );
@@ -165,7 +165,7 @@ class BP_Groups_Group {
165
return true;
166
}
167
168
- public function delete() {
169
global $wpdb, $bp;
170
171
// Delete groupmeta for the group
@@ -194,7 +194,7 @@ class BP_Groups_Group {
194
195
/** Static Methods ********************************************************/
196
197
- public static function group_exists( $slug, $table_name = false ) {
198
global $wpdb, $bp;
199
200
if ( empty( $table_name ) )
@@ -206,7 +206,7 @@ class BP_Groups_Group {
206
return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$table_name} WHERE slug = %s", $slug ) );
207
}
208
209
- public static function get_id_from_slug( $slug ) {
210
return BP_Groups_Group::group_exists( $slug );
211
}
212
@@ -215,7 +215,7 @@ class BP_Groups_Group {
215
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 = %d", $group_id, $user_id ) );
216
}
217
218
- public static function filter_user_groups( $filter, $user_id = 0, $order = false, $limit = null, $page = null ) {
219
global $wpdb, $bp;
220
221
if ( empty( $user_id ) )
@@ -240,7 +240,7 @@ class BP_Groups_Group {
240
return array( 'groups' => $paged_groups, 'total' => $total_groups );
241
}
242
243
- public static function search_groups( $filter, $limit = null, $page = null, $sort_by = false, $order = false ) {
244
global $wpdb, $bp;
245
246
$filter = like_escape( $wpdb->escape( $filter ) );
@@ -263,19 +263,19 @@ class BP_Groups_Group {
263
return array( 'groups' => $paged_groups, 'total' => $total_groups );
264
}
265
266
- public static function check_slug( $slug ) {
267
global $wpdb, $bp;
268
269
return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE slug = %s", $slug ) );
270
}
271
272
- public static function get_slug( $group_id ) {
273
global $wpdb, $bp;
274
275
return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE id = %d", $group_id ) );
276
}
277
278
- public static function has_members( $group_id ) {
279
global $wpdb, $bp;
280
281
$members = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d", $group_id ) );
@@ -286,13 +286,13 @@ class BP_Groups_Group {
286
return true;
287
}
288
289
- public static function has_membership_requests( $group_id ) {
290
global $wpdb, $bp;
291
292
return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0", $group_id ) );
293
}
294
295
- public static function get_membership_requests( $group_id, $limit = null, $page = null ) {
296
global $wpdb, $bp;
297
298
if ( !empty( $limit ) && !empty( $page ) ) {
@@ -305,7 +305,7 @@ class BP_Groups_Group {
305
return array( 'requests' => $paged_requests, 'total' => $total_requests );
306
}
307
308
- public static function get( $type = 'newest', $per_page = null, $page = null, $user_id = 0, $search_terms = false, $include = false, $populate_extras = true, $exclude = false, $show_hidden = false ) {
309
global $wpdb, $bp;
310
311
$sql = array();
@@ -430,7 +430,7 @@ class BP_Groups_Group {
430
return array( 'groups' => $paged_groups, 'total' => $total_groups );
431
}
432
433
- public static function get_by_most_forum_topics( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
434
global $wpdb, $bp, $bbdb;
435
436
if ( empty( $bbdb ) )
@@ -471,7 +471,7 @@ class BP_Groups_Group {
471
return array( 'groups' => $paged_groups, 'total' => $total_groups );
472
}
473
474
- public static function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false, $populate_extras = true, $exclude = false ) {
475
global $wpdb, $bp, $bbdb;
476
477
if ( empty( $bbdb ) )
@@ -512,7 +512,7 @@ class BP_Groups_Group {
512
return array( 'groups' => $paged_groups, 'total' => $total_groups );
513
}
514
515
- public static function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true, $exclude = false ) {
516
global $wpdb, $bp;
517
518
// Multibyte compliance
@@ -552,7 +552,7 @@ class BP_Groups_Group {
552
return array( 'groups' => $paged_groups, 'total' => $total_groups );
553
}
554
555
- public static function get_random( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
556
global $wpdb, $bp;
557
558
$pag_sql = $hidden_sql = $search_sql = $exclude_sql = '';
@@ -591,7 +591,7 @@ class BP_Groups_Group {
591
return array( 'groups' => $paged_groups, 'total' => $total_groups );
592
}
593
594
- public static function get_group_extras( &$paged_groups, &$group_ids, $type = false ) {
595
global $bp, $wpdb;
596
597
if ( empty( $group_ids ) )
@@ -623,13 +623,13 @@ class BP_Groups_Group {
623
return $paged_groups;
624
}
625
626
- public static function delete_all_invites( $group_id ) {
627
global $wpdb, $bp;
628
629
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE group_id = %d AND invite_sent = 1", $group_id ) );
630
}
631
632
- public static function get_total_group_count() {
633
global $wpdb, $bp;
634
635
$hidden_sql = '';
@@ -639,18 +639,35 @@ class BP_Groups_Group {
639
return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name} {$hidden_sql}" ) );
640
}
641
642
- public static function get_global_forum_topic_count( $type ) {
643
global $bbdb, $wpdb, $bp;
644
645
if ( 'unreplied' == $type )
646
$bp->groups->filter_sql = ' AND t.topic_posts = 1';
647
648
- $extra_sql = apply_filters( 'groups_total_public_forum_topic_count', $bp->groups->filter_sql, $type );
649
650
return $wpdb->get_var( "SELECT COUNT(t.topic_id) FROM {$bbdb->topics} AS t, {$bp->groups->table_name} AS g LEFT JOIN {$bp->groups->table_name_groupmeta} AS gm ON g.id = gm.group_id WHERE (gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id) AND g.status = 'public' AND t.topic_status = '0' AND t.topic_sticky != '2' {$extra_sql} " );
651
}
652
653
- public static function get_total_member_count( $group_id ) {
654
global $wpdb, $bp;
655
656
return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0", $group_id ) );
@@ -665,7 +682,7 @@ class BP_Groups_Group {
665
* @param str $status 'public', 'private', 'hidden', 'all' Which group types to count
666
* @return int The topic count
667
*/
668
- public static function get_global_topic_count( $status = 'public', $search_terms = false ) {
669
global $bbdb, $wpdb, $bp;
670
671
switch ( $status ) {
@@ -719,8 +736,8 @@ class BP_Groups_Member {
719
var $invite_sent;
720
var $user;
721
722
- public function __construct( $user_id = 0, $group_id = 0, $id = false, $populate = true ) {
723
-
724
// User and group are not empty, and ID is
725
if ( !empty( $user_id ) && !empty( $group_id ) && empty( $id ) ) {
726
$this->user_id = $user_id;
@@ -741,7 +758,7 @@ class BP_Groups_Member {
741
}
742
}
743
744
- private function populate() {
745
global $wpdb, $bp;
746
747
if ( $this->user_id && $this->group_id && !$this->id )
@@ -770,7 +787,7 @@ class BP_Groups_Member {
770
}
771
}
772
773
- public function save() {
774
global $wpdb, $bp;
775
776
$this->user_id = apply_filters( 'groups_member_user_id_before_save', $this->user_id, $this->id );
@@ -808,7 +825,7 @@ class BP_Groups_Member {
808
return true;
809
}
810
811
- public function promote( $status = 'mod' ) {
812
if ( 'mod' == $status ) {
813
$this->is_admin = 0;
814
$this->is_mod = 1;
@@ -824,7 +841,7 @@ class BP_Groups_Member {
824
return $this->save();
825
}
826
827
- public function demote() {
828
$this->is_mod = 0;
829
$this->is_admin = 0;
830
$this->user_title = false;
@@ -832,7 +849,7 @@ class BP_Groups_Member {
832
return $this->save();
833
}
834
835
- public function ban() {
836
837
if ( !empty( $this->is_admin ) )
838
return false;
@@ -849,7 +866,7 @@ class BP_Groups_Member {
849
return $this->save();
850
}
851
852
- public function unban() {
853
854
if ( !empty( $this->is_admin ) )
855
return false;
@@ -862,7 +879,7 @@ class BP_Groups_Member {
862
return $this->save();
863
}
864
865
- public function accept_invite() {
866
867
$this->inviter_id = 0;
868
$this->is_confirmed = 1;
@@ -871,7 +888,7 @@ class BP_Groups_Member {
871
bp_update_user_meta( $this->user_id, 'total_group_count', (int) bp_get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );
872
}
873
874
- public function accept_request() {
875
876
$this->is_confirmed = 1;
877
$this->date_modified = bp_core_current_time();
@@ -879,7 +896,7 @@ class BP_Groups_Member {
879
bp_update_user_meta( $this->user_id, 'total_group_count', (int) bp_get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );
880
}
881
882
- public function remove() {
883
global $wpdb, $bp;
884
885
$sql = $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $this->user_id, $this->group_id );
@@ -898,13 +915,13 @@ class BP_Groups_Member {
898
899
/** Static Methods ********************************************************/
900
901
- public static function delete( $user_id, $group_id ) {
902
global $wpdb, $bp;
903
904
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );
905
}
906
907
- public static function get_group_ids( $user_id, $limit = false, $page = false ) {
908
global $wpdb, $bp;
909
910
$pag_sql = '';
@@ -925,7 +942,7 @@ class BP_Groups_Member {
925
return array( 'groups' => $groups, 'total' => (int) $total_groups );
926
}
927
928
- public static function get_recently_joined( $user_id, $limit = false, $page = false, $filter = false ) {
929
global $wpdb, $bp;
930
931
$pag_sql = $hidden_sql = $filter_sql = '';
@@ -947,7 +964,7 @@ class BP_Groups_Member {
947
return array( 'groups' => $paged_groups, 'total' => $total_groups );
948
}
949
950
- public static function get_is_admin_of( $user_id, $limit = false, $page = false, $filter = false ) {
951
global $wpdb, $bp;
952
953
$pag_sql = $hidden_sql = $filter_sql = '';
@@ -969,7 +986,7 @@ class BP_Groups_Member {
969
return array( 'groups' => $paged_groups, 'total' => $total_groups );
970
}
971
972
- public static function get_is_mod_of( $user_id, $limit = false, $page = false, $filter = false ) {
973
global $wpdb, $bp;
974
975
$pag_sql = $hidden_sql = $filter_sql = '';
@@ -991,7 +1008,7 @@ class BP_Groups_Member {
991
return array( 'groups' => $paged_groups, 'total' => $total_groups );
992
}
993
994
- public static function total_group_count( $user_id = 0 ) {
995
global $bp, $wpdb;
996
997
if ( empty( $user_id ) )
@@ -1004,7 +1021,7 @@ class BP_Groups_Member {
1004
}
1005
}
1006
1007
- public static function get_invites( $user_id, $limit = false, $page = false, $exclude = false ) {
1008
global $wpdb, $bp;
1009
1010
$pag_sql = ( !empty( $limit ) && !empty( $page ) ) ? $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ) : '';
@@ -1017,7 +1034,7 @@ class BP_Groups_Member {
1017
return array( 'groups' => $paged_groups, 'total' => $total_groups );
1018
}
1019
1020
- public static function check_has_invite( $user_id, $group_id, $type = 'sent' ) {
1021
global $wpdb, $bp;
1022
1023
if ( empty( $user_id ) )
@@ -1031,7 +1048,7 @@ class BP_Groups_Member {
1031
return $wpdb->get_var( $wpdb->prepare( $sql, $user_id, $group_id ) );
1032
}
1033
1034
- public static function delete_invite( $user_id, $group_id ) {
1035
global $wpdb, $bp;
1036
1037
if ( empty( $user_id ) )
@@ -1040,7 +1057,7 @@ class BP_Groups_Member {
1040
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) );
1041
}
1042
1043
- public static function delete_request( $user_id, $group_id ) {
1044
global $wpdb, $bp;
1045
1046
if ( empty( $user_id ) )
@@ -1049,7 +1066,7 @@ class BP_Groups_Member {
1049
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id = 0 AND invite_sent = 0", $user_id, $group_id ) );
1050
}
1051
1052
- public static function check_is_admin( $user_id, $group_id ) {
1053
global $wpdb, $bp;
1054
1055
if ( empty( $user_id ) )
@@ -1058,7 +1075,7 @@ class BP_Groups_Member {
1058
return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_admin = 1 AND is_banned = 0", $user_id, $group_id ) );
1059
}
1060
1061
- public static function check_is_mod( $user_id, $group_id ) {
1062
global $wpdb, $bp;
1063
1064
if ( empty( $user_id ) )
@@ -1067,7 +1084,7 @@ class BP_Groups_Member {
1067
return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_mod = 1 AND is_banned = 0", $user_id, $group_id ) );
1068
}
1069
1070
- public static function check_is_member( $user_id, $group_id ) {
1071
global $wpdb, $bp;
1072
1073
if ( empty( $user_id ) )
@@ -1076,7 +1093,7 @@ class BP_Groups_Member {
1076
return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 1 AND is_banned = 0", $user_id, $group_id ) );
1077
}
1078
1079
- public static function check_is_banned( $user_id, $group_id ) {
1080
global $wpdb, $bp;
1081
1082
if ( empty( $user_id ) )
@@ -1094,7 +1111,7 @@ class BP_Groups_Member {
1094
* @param int $group_id
1095
* @since 1.2.6
1096
*/
1097
- public static function check_is_creator( $user_id, $group_id ) {
1098
global $bp, $wpdb;
1099
1100
if ( empty( $user_id ) )
@@ -1103,7 +1120,7 @@ class BP_Groups_Member {
1103
return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name} WHERE creator_id = %d AND id = %d", $user_id, $group_id ) );
1104
}
1105
1106
- public static function check_for_membership_request( $user_id, $group_id ) {
1107
global $wpdb, $bp;
1108
1109
if ( empty( $user_id ) )
@@ -1112,7 +1129,7 @@ class BP_Groups_Member {
1112
return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND is_banned = 0 AND inviter_id = 0", $user_id, $group_id ) );
1113
}
1114
1115
- public static function get_random_groups( $user_id, $total_groups = 5 ) {
1116
global $wpdb, $bp;
1117
1118
// If the user is logged in and viewing their random groups, we can show hidden and private groups
@@ -1123,31 +1140,31 @@ class BP_Groups_Member {
1123
}
1124
}
1125
1126
- public static function get_group_member_ids( $group_id ) {
1127
global $bp, $wpdb;
1128
1129
return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0", $group_id ) );
1130
}
1131
1132
- public static function get_group_administrator_ids( $group_id ) {
1133
global $bp, $wpdb;
1134
1135
return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_admin = 1 AND is_banned = 0", $group_id ) );
1136
}
1137
1138
- public static function get_group_moderator_ids( $group_id ) {
1139
global $bp, $wpdb;
1140
1141
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 ) );
1142
}
1143
1144
- public static function get_all_membership_request_user_ids( $group_id ) {
1145
global $bp, $wpdb;
1146
1147
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 ) );
1148
}
1149
1150
- public static function get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true, $exclude = false ) {
1151
global $bp, $wpdb;
1152
1153
$pag_sql = '';
@@ -1199,7 +1216,7 @@ class BP_Groups_Member {
1199
return array( 'members' => $members, 'count' => $total_member_count );
1200
}
1201
1202
- public static function delete_all( $group_id ) {
1203
global $wpdb, $bp;
1204
1205
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE group_id = %d", $group_id ) );
@@ -1214,7 +1231,7 @@ class BP_Groups_Member {
1214
* @since 1.0
1215
* @uses BP_Groups_Member
1216
*/
1217
- public static function delete_all_for_user( $user_id ) {
1218
global $bp, $wpdb;
1219
1220
// Get all the group ids for the current user's groups and update counts
48
*/
49
public $user_has_access;
50
51
+ function __construct( $id = null ) {
52
if ( !empty( $id ) ) {
53
$this->id = $id;
54
$this->populate();
55
}
56
}
57
58
+ function populate() {
59
global $wpdb, $bp;
60
61
if ( $group = $wpdb->get_row( $wpdb->prepare( "SELECT g.* FROM {$bp->groups->table_name} g WHERE g.id = %d", $this->id ) ) ) {
94
}
95
}
96
97
+ function save() {
98
global $wpdb, $bp;
99
100
$this->creator_id = apply_filters( 'groups_group_creator_id_before_save', $this->creator_id, $this->id );
165
return true;
166
}
167
168
+ function delete() {
169
global $wpdb, $bp;
170
171
// Delete groupmeta for the group
194
195
/** Static Methods ********************************************************/
196
197
+ function group_exists( $slug, $table_name = false ) {
198
global $wpdb, $bp;
199
200
if ( empty( $table_name ) )
206
return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$table_name} WHERE slug = %s", $slug ) );
207
}
208
209
+ function get_id_from_slug( $slug ) {
210
return BP_Groups_Group::group_exists( $slug );
211
}
212
215
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 = %d", $group_id, $user_id ) );
216
}
217
218
+ function filter_user_groups( $filter, $user_id = 0, $order = false, $limit = null, $page = null ) {
219
global $wpdb, $bp;
220
221
if ( empty( $user_id ) )
240
return array( 'groups' => $paged_groups, 'total' => $total_groups );
241
}
242
243
+ function search_groups( $filter, $limit = null, $page = null, $sort_by = false, $order = false ) {
244
global $wpdb, $bp;
245
246
$filter = like_escape( $wpdb->escape( $filter ) );
263
return array( 'groups' => $paged_groups, 'total' => $total_groups );
264
}
265
266
+ function check_slug( $slug ) {
267
global $wpdb, $bp;
268
269
return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE slug = %s", $slug ) );
270
}
271
272
+ function get_slug( $group_id ) {
273
global $wpdb, $bp;
274
275
return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE id = %d", $group_id ) );
276
}
277
278
+ function has_members( $group_id ) {
279
global $wpdb, $bp;
280
281
$members = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d", $group_id ) );
286
return true;
287
}
288
289
+ function has_membership_requests( $group_id ) {
290
global $wpdb, $bp;
291
292
return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0", $group_id ) );
293
}
294
295
+ function get_membership_requests( $group_id, $limit = null, $page = null ) {
296
global $wpdb, $bp;
297
298
if ( !empty( $limit ) && !empty( $page ) ) {
305
return array( 'requests' => $paged_requests, 'total' => $total_requests );
306
}
307
308
+ function get( $type = 'newest', $per_page = null, $page = null, $user_id = 0, $search_terms = false, $include = false, $populate_extras = true, $exclude = false, $show_hidden = false ) {
309
global $wpdb, $bp;
310
311
$sql = array();
430
return array( 'groups' => $paged_groups, 'total' => $total_groups );
431
}
432
433
+ function get_by_most_forum_topics( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
434
global $wpdb, $bp, $bbdb;
435
436
if ( empty( $bbdb ) )
471
return array( 'groups' => $paged_groups, 'total' => $total_groups );
472
}
473
474
+ function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false, $populate_extras = true, $exclude = false ) {
475
global $wpdb, $bp, $bbdb;
476
477
if ( empty( $bbdb ) )
512
return array( 'groups' => $paged_groups, 'total' => $total_groups );
513
}
514
515
+ function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true, $exclude = false ) {
516
global $wpdb, $bp;
517
518
// Multibyte compliance
552
return array( 'groups' => $paged_groups, 'total' => $total_groups );
553
}
554
555
+ function get_random( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {
556
global $wpdb, $bp;
557
558
$pag_sql = $hidden_sql = $search_sql = $exclude_sql = '';
591
return array( 'groups' => $paged_groups, 'total' => $total_groups );
592
}
593
594
+ function get_group_extras( &$paged_groups, &$group_ids, $type = false ) {
595
global $bp, $wpdb;
596
597
if ( empty( $group_ids ) )
623
return $paged_groups;
624
}
625
626
+ function delete_all_invites( $group_id ) {
627
global $wpdb, $bp;
628
629
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE group_id = %d AND invite_sent = 1", $group_id ) );
630
}
631
632
+ function get_total_group_count() {
633
global $wpdb, $bp;
634
635
$hidden_sql = '';
639
return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name} {$hidden_sql}" ) );
640
}
641
642
+ function get_global_forum_topic_count( $type ) {
643
global $bbdb, $wpdb, $bp;
644
645
if ( 'unreplied' == $type )
646
$bp->groups->filter_sql = ' AND t.topic_posts = 1';
647
648
+ /**
649
+ * Provide backward-compatibility for the groups_total_public_forum_topic_count SQL filter.
650
+ * Developers: DO NOT use this filter. It will be removed in BP 1.7. Instead, use
651
+ * get_global_forum_topic_count_extra_sql. See https://buddypress.trac.wordpress.org/ticket/4306
652
+ */
653
+ $maybe_extra_sql = apply_filters( 'groups_total_public_forum_topic_count', $bp->groups->filter_sql, $type );
654
+
655
+ if ( is_int( $maybe_extra_sql ) )
656
+ $extra_sql = $bp->groups->filter_sql;
657
+ else
658
+ $extra_sql = $maybe_extra_sql;
659
+
660
+ // Developers: use this filter instead
661
+ $extra_sql = apply_filters( 'get_global_forum_topic_count_extra_sql', $bp->groups->filter_sql, $type );
662
+
663
+ // Make sure the $extra_sql begins with an AND
664
+ if ( 'AND' != substr( trim( strtoupper( $extra_sql ) ), 0, 3 ) )
665
+ $extra_sql = ' AND ' . $extra_sql;
666
667
return $wpdb->get_var( "SELECT COUNT(t.topic_id) FROM {$bbdb->topics} AS t, {$bp->groups->table_name} AS g LEFT JOIN {$bp->groups->table_name_groupmeta} AS gm ON g.id = gm.group_id WHERE (gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id) AND g.status = 'public' AND t.topic_status = '0' AND t.topic_sticky != '2' {$extra_sql} " );
668
}
669
670
+ function get_total_member_count( $group_id ) {
671
global $wpdb, $bp;
672
673
return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 AND is_banned = 0", $group_id ) );
682
* @param str $status 'public', 'private', 'hidden', 'all' Which group types to count
683
* @return int The topic count
684
*/
685
+ function get_global_topic_count( $status = 'public', $search_terms = false ) {
686
global $bbdb, $wpdb, $bp;
687
688
switch ( $status ) {
736
var $invite_sent;
737
var $user;
738
739
+ function __construct( $user_id = 0, $group_id = 0, $id = false, $populate = true ) {
740
+
741
// User and group are not empty, and ID is
742
if ( !empty( $user_id ) && !empty( $group_id ) && empty( $id ) ) {
743
$this->user_id = $user_id;
758
}
759
}
760
761
+ function populate() {
762
global $wpdb, $bp;
763
764
if ( $this->user_id && $this->group_id && !$this->id )
787
}
788
}
789
790
+ function save() {
791
global $wpdb, $bp;
792
793
$this->user_id = apply_filters( 'groups_member_user_id_before_save', $this->user_id, $this->id );
825
return true;
826
}
827
828
+ function promote( $status = 'mod' ) {
829
if ( 'mod' == $status ) {
830
$this->is_admin = 0;
831
$this->is_mod = 1;
841
return $this->save();
842
}
843
844
+ function demote() {
845
$this->is_mod = 0;
846
$this->is_admin = 0;
847
$this->user_title = false;
849
return $this->save();
850
}
851
852
+ function ban() {
853
854
if ( !empty( $this->is_admin ) )
855
return false;
866
return $this->save();
867
}
868
869
+ function unban() {
870
871
if ( !empty( $this->is_admin ) )
872
return false;
879
return $this->save();
880
}
881
882
+ function accept_invite() {
883
884
$this->inviter_id = 0;
885
$this->is_confirmed = 1;
888
bp_update_user_meta( $this->user_id, 'total_group_count', (int) bp_get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );
889
}
890
891
+ function accept_request() {
892
893
$this->is_confirmed = 1;
894
$this->date_modified = bp_core_current_time();
896
bp_update_user_meta( $this->user_id, 'total_group_count', (int) bp_get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );
897
}
898
899
+ function remove() {
900
global $wpdb, $bp;
901
902
$sql = $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $this->user_id, $this->group_id );
915
916
/** Static Methods ********************************************************/
917
918
+ function delete( $user_id, $group_id ) {
919
global $wpdb, $bp;
920
921
return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) );
922
}
923
924
+ function get_group_ids( $user_id, $limit = false, $page = false ) {
925
global $wpdb, $bp;
926
927
$pag_sql = '';
942
return array( 'groups' => $groups, 'total' => (int) $total_groups );
943
}
944
945
+ function get_recently_joined( $user_id, $limit = false, $page = false, $filter = false ) {
946
global $wpdb, $bp;
947
948
$pag_sql = $hidden_sql = $filter_sql = '';
964
return array( 'groups' => $paged_groups, 'total' => $total_groups );
965
}
966
967
+ function get_is_admin_of( $user_id, $limit = false, $page = false, $filter = false ) {
968
global $wpdb, $bp;
969
970
$pag_sql = $hidden_sql = $filter_sql = '';
986
return array( 'groups' => $paged_groups, 'total' => $total_groups );
987
}
988
989
+ function get_is_mod_of( $user_id, $limit = false, $page = false, $filter = false ) {
990
global $wpdb, $bp;
991
992
$pag_sql = $hidden_sql = $filter_sql = '';
1008
return array( 'groups' => $paged_groups, 'total' => $total_groups );
1009
}
1010
1011
+ function total_group_count( $user_id = 0 ) {
1012
global $bp, $wpdb;
1013
1014
if ( empty( $user_id ) )
1021
}
1022
}
1023
1024
+ function get_invites( $user_id, $limit = false, $page = false, $exclude = false ) {
1025
global $wpdb, $bp;
1026
1027
$pag_sql = ( !empty( $limit ) && !empty( $page ) ) ? $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ) : '';
1034
return array( 'groups' => $paged_groups, 'total' => $total_groups );
1035
}
1036
1037
+ function check_has_invite( $user_id, $group_id, $type = 'sent' ) {
1038
global $wpdb, $bp;
1039
1040
if ( empty( $user_id ) )
1048
return $wpdb->get_var( $wpdb->prepare( $sql, $user_id, $group_id ) );
1049
}
1050
1051
+ function delete_invite( $user_id, $group_id ) {
1052
global $wpdb, $bp;
1053
1054
if ( empty( $user_id ) )
1057
<