Version Description
See: http://codex.buddypress.org/releases/version-2-1-4/
Download this release
Release Info
Developer | netweb |
Plugin | BuddyPress |
Version | 2.1.4 |
Comparing to | |
See all releases |
Code changes from version 2.2.6 to 2.1.4
- bp-activity/admin/js/admin.js +2 -4
- bp-activity/admin/js/admin.min.js +2 -2
- bp-activity/bp-activity-actions.php +17 -173
- bp-activity/bp-activity-admin.php +21 -147
- bp-activity/bp-activity-akismet.php +4 -57
- bp-activity/bp-activity-cache.php +1 -2
- bp-activity/bp-activity-classes.php +140 -769
- bp-activity/bp-activity-cssjs.php +2 -9
- bp-activity/bp-activity-filters.php +19 -248
- bp-activity/bp-activity-functions.php +48 -937
- bp-activity/bp-activity-loader.php +1 -20
- bp-activity/bp-activity-notifications.php +12 -170
- bp-activity/bp-activity-screens.php +29 -161
- bp-activity/bp-activity-template.php +374 -1014
- bp-activity/css/mentions-rtl.css +4 -17
- bp-activity/css/mentions-rtl.min.css +1 -1
- bp-activity/css/mentions.css +4 -17
- bp-activity/css/mentions.min.css +1 -1
- bp-activity/js/mentions.js +13 -70
- bp-activity/js/mentions.min.js +2 -2
- bp-blogs/bp-blogs-actions.php +1 -1
- bp-blogs/bp-blogs-activity.php +26 -120
- bp-blogs/bp-blogs-cache.php +16 -8
- bp-blogs/bp-blogs-classes.php +8 -53
- bp-blogs/bp-blogs-filters.php +3 -71
- bp-blogs/bp-blogs-functions.php +182 -174
- bp-blogs/bp-blogs-loader.php +2 -65
- bp-blogs/bp-blogs-screens.php +10 -43
- bp-blogs/bp-blogs-template.php +15 -344
- bp-blogs/bp-blogs-widgets.php +1 -10
- bp-core/admin/bp-core-actions.php +1 -1
- bp-core/admin/bp-core-components.php +6 -6
- bp-core/admin/bp-core-functions.php +56 -75
- bp-core/admin/bp-core-schema.php +10 -19
- bp-core/admin/bp-core-settings.php +2 -2
- bp-core/admin/bp-core-slugs.php +8 -2
- bp-core/admin/bp-core-tools.php +1 -1
- bp-core/admin/css/common-rtl.css +0 -20
- bp-core/admin/css/common-rtl.min.css +1 -1
- bp-core/admin/css/common.css +0 -20
- bp-core/admin/css/common.min.css +1 -1
- bp-core/admin/images/member-types.png +0 -0
- bp-core/admin/images/mentions.gif +0 -0
- bp-core/bp-core-actions.php +1 -3
- bp-core/bp-core-admin.php +166 -212
- bp-core/bp-core-adminbar.php +2 -2
- bp-core/bp-core-avatars.php +113 -165
- bp-core/bp-core-buddybar.php +21 -27
- bp-core/bp-core-cache.php +12 -2
- bp-core/bp-core-caps.php +3 -3
- bp-core/bp-core-catchuri.php +36 -14
- bp-core/bp-core-classes.php +56 -332
- bp-core/bp-core-component.php +2 -16
- bp-core/bp-core-cssjs.php +3 -3
- bp-core/bp-core-dependency.php +9 -37
- bp-core/bp-core-filters.php +46 -268
- bp-core/bp-core-functions.php +39 -138
- bp-core/bp-core-loader.php +2 -17
- bp-core/bp-core-moderation.php +62 -82
- bp-core/bp-core-options.php +2 -2
- bp-core/bp-core-taxonomy.php +0 -81
- bp-core/bp-core-template-loader.php +15 -24
- bp-core/bp-core-template.php +26 -98
- bp-core/bp-core-theme-compatibility.php +16 -20
- bp-core/bp-core-update.php +1 -80
- bp-core/bp-core-widgets.php +441 -3
- bp-core/bp-core-wpabstraction.php +4 -4
- bp-core/deprecated/1.5.php +2 -2
- bp-core/deprecated/1.6.php +1 -1
- bp-core/deprecated/1.7.php +1 -1
- bp-core/deprecated/1.9.php +2 -2
- bp-core/deprecated/2.0.php +1 -1
- bp-core/deprecated/2.1.php +2 -2
- bp-core/deprecated/2.2.php +0 -116
- bp-core/deprecated/js/autocomplete/jquery.autocomplete.js +2 -25
- bp-core/deprecated/js/autocomplete/jquery.autocomplete.min.js +2 -2
- bp-core/deprecated/js/autocomplete/jquery.autocompletefb.min.js +1 -1
- bp-core/deprecated/js/autocomplete/jquery.bgiframe.min.js +1 -1
- bp-core/deprecated/js/autocomplete/jquery.dimensions.min.js +1 -1
- bp-core/deprecated/js/jquery-scroll-to.min.js +1 -1
- bp-core/js/confirm.min.js +1 -1
- bp-core/js/jquery-cookie.min.js +1 -1
- bp-core/js/jquery-query.min.js +1 -1
- bp-core/js/jquery.atwho.js +66 -117
- bp-core/js/jquery.atwho.min.js +2 -2
- bp-core/js/jquery.caret.js +23 -36
- bp-core/js/jquery.caret.min.js +2 -2
- bp-core/js/widget-members.js +2 -2
- bp-core/js/widget-members.min.js +2 -2
- bp-forums/bp-forums-actions.php +1 -1
- bp-forums/bp-forums-bbpress-sa.php +5 -27
- bp-forums/bp-forums-bbpress.php +1 -1
- bp-forums/bp-forums-filters.php +1 -15
- bp-forums/bp-forums-functions.php +5 -116
- bp-forums/bp-forums-loader.php +1 -1
- bp-forums/bp-forums-screens.php +4 -84
- bp-forums/bp-forums-template.php +21 -582
- bp-forums/deprecated/1.6.php +2 -2
- bp-forums/deprecated/1.7.php +1 -1
- bp-friends/bp-friends-actions.php +3 -3
- bp-friends/bp-friends-activity.php +16 -152
- bp-friends/bp-friends-cache.php +1 -1
- bp-friends/bp-friends-classes.php +2 -16
- bp-friends/bp-friends-functions.php +20 -168
- bp-friends/bp-friends-loader.php +1 -16
- bp-friends/bp-friends-notifications.php +11 -123
- bp-friends/bp-friends-screens.php +2 -33
- bp-friends/bp-friends-template.php +7 -105
- bp-friends/bp-friends-widgets.php +1 -8
- bp-friends/js/widget-friends.js +2 -2
- bp-friends/js/widget-friends.min.js +2 -2
- bp-groups/admin/js/admin.min.js +1 -1
- bp-groups/bp-groups-actions.php +6 -9
- bp-groups/bp-groups-activity.php +1 -189
- bp-groups/bp-groups-admin.php +17 -51
- bp-groups/bp-groups-adminbar.php +59 -34
- bp-groups/bp-groups-cache.php +1 -1
- bp-groups/bp-groups-classes.php +30 -75
- bp-groups/bp-groups-filters.php +1 -23
- bp-groups/bp-groups-forums.php +1 -1
- bp-groups/bp-groups-functions.php +12 -39
- bp-groups/bp-groups-loader.php +3 -72
- bp-groups/bp-groups-notifications.php +40 -394
- bp-groups/bp-groups-screens.php +34 -31
- bp-groups/bp-groups-template.php +145 -562
- bp-groups/bp-groups-widgets.php +4 -4
- bp-groups/js/widget-groups.js +2 -2
- bp-groups/js/widget-groups.min.js +2 -2
- bp-loader.php +19 -32
- bp-members/admin/bp-members-classes.php +6 -49
- bp-members/admin/js/admin.min.js +1 -1
- bp-members/bp-members-actions.php +4 -4
- bp-members/bp-members-activity.php +0 -96
- bp-members/bp-members-admin.php +41 -205
- bp-members/bp-members-adminbar.php +1 -1
- bp-members/bp-members-cache.php +0 -59
- bp-members/bp-members-classes.php +7 -133
- bp-members/bp-members-filters.php +1 -10
- bp-members/bp-members-functions.php +14 -65
bp-activity/admin/js/admin.js
CHANGED
@@ -165,11 +165,9 @@ $(document).ready( function () {
|
|
165 |
$( '#bp_activity_action h3, #bp_activity_content h3' ).unbind( 'click' );
|
166 |
|
167 |
// redo the post box toggles to reset the one made by comment.js in favor
|
168 |
-
// of activity administration page id so that metaboxes are still collapsible
|
169 |
// in single Activity Administration screen.
|
170 |
-
|
171 |
-
postboxes.add_postbox_toggles( bp_activity_admin_vars.page );
|
172 |
-
}
|
173 |
});
|
174 |
|
175 |
})(jQuery);
|
165 |
$( '#bp_activity_action h3, #bp_activity_content h3' ).unbind( 'click' );
|
166 |
|
167 |
// redo the post box toggles to reset the one made by comment.js in favor
|
168 |
+
// of activity administration page id so that metaboxes are still collapsible
|
169 |
// in single Activity Administration screen.
|
170 |
+
postboxes.add_postbox_toggles( bp_activity_admin_vars.page );
|
|
|
|
|
171 |
});
|
172 |
|
173 |
})(jQuery);
|
bp-activity/admin/js/admin.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
-
!function(a){var b={init:function(){a(document).on("click",".row-actions a.reply",b.open),a(document).on("click","#bp-activities-container a.cancel",b.close),a(document).on("click","#bp-activities-container a.save",b.send),a(document).on("keyup","#bp-activities:visible",function(a){27===a.which&&b.close()})},open:function(){var b=a("#bp-activities-container").hide();return a(this).parents("tr").after(b),b.fadeIn("300"),a("#bp-activities").focus(),!1},close:function(){return a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide()}),!1},send:function(){a("#bp-replysubmit .error").hide(),a("#bp-replysubmit .waiting").show();var c={};return c["_ajax_nonce-bp-activity-admin-reply"]=a('#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]').val(),c.action="bp-activity-admin-reply",c.content=a("#bp-activities").val(),c.parent_id=a("#bp-activities-container").prev().data("parent_id"),c.root_id=a("#bp-activities-container").prev().data("root_id"),a.ajax({data:c,type:"POST",url:ajaxurl,error:function(a){b.error(a)},success:function(a){b.show(a)}}),!1},error:function(b){var c=b.statusText;a("#bp-replysubmit .waiting").hide(),b.responseText&&(c=b.responseText.replace(/<.[^<>]*?>/g,"")),c&&a("#bp-replysubmit .error").html(c).show()},show:function(c){var d,e,f;return"string"==typeof c?(b.error({responseText:c}),!1):(f=wpAjax.parseAjaxResponse(c),f.errors?(b.error({responseText:wpAjax.broken}),!1):(f=f.responses[0],void a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide(),a("#bp-activities-container").before(f.data),e=a("#activity-"+f.id),d=e.closest(".widefat").css("backgroundColor"),e.animate({backgroundColor:"#CEB"},300).animate({backgroundColor:d},300)})))}};a(document).ready(function(){b.init(),a("#bp_activity_action h3, #bp_activity_content h3").unbind("click"),
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
+
!function(a){var b={init:function(){a(document).on("click",".row-actions a.reply",b.open),a(document).on("click","#bp-activities-container a.cancel",b.close),a(document).on("click","#bp-activities-container a.save",b.send),a(document).on("keyup","#bp-activities:visible",function(a){27===a.which&&b.close()})},open:function(){var b=a("#bp-activities-container").hide();return a(this).parents("tr").after(b),b.fadeIn("300"),a("#bp-activities").focus(),!1},close:function(){return a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide()}),!1},send:function(){a("#bp-replysubmit .error").hide(),a("#bp-replysubmit .waiting").show();var c={};return c["_ajax_nonce-bp-activity-admin-reply"]=a('#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]').val(),c.action="bp-activity-admin-reply",c.content=a("#bp-activities").val(),c.parent_id=a("#bp-activities-container").prev().data("parent_id"),c.root_id=a("#bp-activities-container").prev().data("root_id"),a.ajax({data:c,type:"POST",url:ajaxurl,error:function(a){b.error(a)},success:function(a){b.show(a)}}),!1},error:function(b){var c=b.statusText;a("#bp-replysubmit .waiting").hide(),b.responseText&&(c=b.responseText.replace(/<.[^<>]*?>/g,"")),c&&a("#bp-replysubmit .error").html(c).show()},show:function(c){var d,e,f;return"string"==typeof c?(b.error({responseText:c}),!1):(f=wpAjax.parseAjaxResponse(c),f.errors?(b.error({responseText:wpAjax.broken}),!1):(f=f.responses[0],void a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide(),a("#bp-activities-container").before(f.data),e=a("#activity-"+f.id),d=e.closest(".widefat").css("backgroundColor"),e.animate({backgroundColor:"#CEB"},300).animate({backgroundColor:d},300)})))}};a(document).ready(function(){b.init(),a("#bp_activity_action h3, #bp_activity_content h3").unbind("click"),postboxes.add_postbox_toggles(bp_activity_admin_vars.page)})}(jQuery);
|
bp-activity/bp-activity-actions.php
CHANGED
@@ -10,22 +10,16 @@
|
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
-
defined( 'ABSPATH' )
|
14 |
|
15 |
/**
|
16 |
* Allow core components and dependent plugins to register activity actions.
|
17 |
*
|
18 |
-
* @since BuddyPress (1.2
|
19 |
*
|
20 |
* @uses do_action() To call 'bp_register_activity_actions' hook.
|
21 |
*/
|
22 |
function bp_register_activity_actions() {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Fires on bp_init to allow core components and dependent plugins to register activity actions.
|
26 |
-
*
|
27 |
-
* @since BuddyPress (1.2.0)
|
28 |
-
*/
|
29 |
do_action( 'bp_register_activity_actions' );
|
30 |
}
|
31 |
add_action( 'bp_init', 'bp_register_activity_actions', 8 );
|
@@ -91,7 +85,7 @@ function bp_activity_action_permalink_router() {
|
|
91 |
}
|
92 |
|
93 |
// Set redirect to users' activity stream
|
94 |
-
}
|
95 |
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
|
96 |
}
|
97 |
|
@@ -102,13 +96,7 @@ function bp_activity_action_permalink_router() {
|
|
102 |
$redirect = add_query_arg( urlencode_deep( $query_frags ), $redirect );
|
103 |
}
|
104 |
|
105 |
-
|
106 |
-
* Filter the intended redirect url before the redirect occurs for the single activity item.
|
107 |
-
*
|
108 |
-
* @since BuddyPress (1.2.2)
|
109 |
-
*
|
110 |
-
* @param array Array with url to redirect to and activity related to the redirect.
|
111 |
-
*/
|
112 |
if ( ! $redirect = apply_filters_ref_array( 'bp_activity_permalink_redirect_url', array( $redirect, &$activity ) ) ) {
|
113 |
bp_core_redirect( bp_get_root_domain() );
|
114 |
}
|
@@ -161,14 +149,7 @@ function bp_activity_action_delete_activity( $activity_id = 0 ) {
|
|
161 |
if ( ! bp_activity_user_can_delete( $activity ) )
|
162 |
return false;
|
163 |
|
164 |
-
|
165 |
-
* Fires before the deletion so plugins can still fetch information about it.
|
166 |
-
*
|
167 |
-
* @since BuddyPress (1.5.0)
|
168 |
-
*
|
169 |
-
* @param int $activity_id The activity ID.
|
170 |
-
* @param int $user_id The user associated with the activity.
|
171 |
-
*/
|
172 |
do_action( 'bp_activity_before_action_delete_activity', $activity_id, $activity->user_id );
|
173 |
|
174 |
// Delete the activity item and provide user feedback
|
@@ -177,14 +158,6 @@ function bp_activity_action_delete_activity( $activity_id = 0 ) {
|
|
177 |
else
|
178 |
bp_core_add_message( __( 'There was an error when deleting that activity', 'buddypress' ), 'error' );
|
179 |
|
180 |
-
/**
|
181 |
-
* Fires after the deletion so plugins can act afterwards based on the activity.
|
182 |
-
*
|
183 |
-
* @since BuddyPress (1.1.0)
|
184 |
-
*
|
185 |
-
* @param int $activity_id The activity ID.
|
186 |
-
* @param int $user_id The user associated with the activity.
|
187 |
-
*/
|
188 |
do_action( 'bp_activity_action_delete_activity', $activity_id, $activity->user_id );
|
189 |
|
190 |
// Check for the redirect query arg, otherwise let WP handle things
|
@@ -230,31 +203,16 @@ function bp_activity_action_spam_activity( $activity_id = 0 ) {
|
|
230 |
// Check nonce
|
231 |
check_admin_referer( 'bp_activity_akismet_spam_' . $activity->id );
|
232 |
|
233 |
-
|
234 |
-
* Fires before the marking activity as spam so plugins can modify things if they want to.
|
235 |
-
*
|
236 |
-
* @since BuddyPress (1.6.0)
|
237 |
-
*
|
238 |
-
* @param int $activity_id Activity ID to be marked as spam.
|
239 |
-
* @param object $activity Activity object for the ID to be marked as spam.
|
240 |
-
*/
|
241 |
do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity );
|
242 |
|
243 |
// Mark as spam
|
244 |
bp_activity_mark_as_spam( $activity );
|
245 |
$activity->save();
|
246 |
|
247 |
-
// Tell the user the spamming has been
|
248 |
bp_core_add_message( __( 'The activity item has been marked as spam and is no longer visible.', 'buddypress' ) );
|
249 |
|
250 |
-
/**
|
251 |
-
* Fires after the marking activity as spam so plugins can act afterwards based on the activity.
|
252 |
-
*
|
253 |
-
* @since BuddyPress (1.6.0)
|
254 |
-
*
|
255 |
-
* @param int $activity_id Activity ID that was marked as spam.
|
256 |
-
* @param int $user_id User ID associated with activity.
|
257 |
-
*/
|
258 |
do_action( 'bp_activity_action_spam_activity', $activity_id, $activity->user_id );
|
259 |
|
260 |
// Check for the redirect query arg, otherwise let WP handle things
|
@@ -295,36 +253,14 @@ function bp_activity_action_post_update() {
|
|
295 |
// Check the nonce
|
296 |
check_admin_referer( 'post_update', '_wpnonce_post_update' );
|
297 |
|
298 |
-
|
299 |
-
* Filters the content provided in the activity input field.
|
300 |
-
*
|
301 |
-
* @since BuddyPress (1.2.0)
|
302 |
-
*
|
303 |
-
* @param string $whats-new Activity message being posted.
|
304 |
-
*/
|
305 |
$content = apply_filters( 'bp_activity_post_update_content', $_POST['whats-new'] );
|
306 |
|
307 |
if ( ! empty( $_POST['whats-new-post-object'] ) ) {
|
308 |
-
|
309 |
-
/**
|
310 |
-
* Filters the item type that the activity update should be associated with.
|
311 |
-
*
|
312 |
-
* @since BuddyPress (1.2.0)
|
313 |
-
*
|
314 |
-
* @param string $whats-new-post-object Item type to associate with.
|
315 |
-
*/
|
316 |
$object = apply_filters( 'bp_activity_post_update_object', $_POST['whats-new-post-object'] );
|
317 |
}
|
318 |
|
319 |
if ( ! empty( $_POST['whats-new-post-in'] ) ) {
|
320 |
-
|
321 |
-
/**
|
322 |
-
* Filters what component the activity is being to.
|
323 |
-
*
|
324 |
-
* @since BuddyPress (1.2.0)
|
325 |
-
*
|
326 |
-
* @param string $whats-new-post-in Chosen component to post activity to.
|
327 |
-
*/
|
328 |
$item_id = apply_filters( 'bp_activity_post_update_item_id', $_POST['whats-new-post-in'] );
|
329 |
}
|
330 |
|
@@ -339,22 +275,13 @@ function bp_activity_action_post_update() {
|
|
339 |
$activity_id = bp_activity_post_update( array( 'content' => $content ) );
|
340 |
|
341 |
// Post to groups object
|
342 |
-
}
|
343 |
if ( (int) $item_id ) {
|
344 |
$activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) );
|
345 |
}
|
346 |
|
|
|
347 |
} else {
|
348 |
-
|
349 |
-
/**
|
350 |
-
* Filters activity object for BuddyPress core and plugin authors before posting activity update.
|
351 |
-
*
|
352 |
-
* @since BuddyPress (1.2.0)
|
353 |
-
*
|
354 |
-
* @param string $object Activity item being associated to.
|
355 |
-
* @param string $item_id Component ID being posted to.
|
356 |
-
* @param string $content Activity content being posted.
|
357 |
-
*/
|
358 |
$activity_id = apply_filters( 'bp_activity_custom_update', $object, $item_id, $content );
|
359 |
}
|
360 |
|
@@ -362,7 +289,7 @@ function bp_activity_action_post_update() {
|
|
362 |
if ( !empty( $activity_id ) )
|
363 |
bp_core_add_message( __( 'Update Posted!', 'buddypress' ) );
|
364 |
else
|
365 |
-
bp_core_add_message( __( 'There was an error when posting your update
|
366 |
|
367 |
// Redirect
|
368 |
bp_core_redirect( wp_get_referer() );
|
@@ -395,22 +322,7 @@ function bp_activity_action_post_comment() {
|
|
395 |
// Check the nonce
|
396 |
check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
|
397 |
|
398 |
-
/**
|
399 |
-
* Filters the activity ID a comment will be in reply to.
|
400 |
-
*
|
401 |
-
* @since BuddyPress (1.2.0)
|
402 |
-
*
|
403 |
-
* @param string $comment_form_id ID of the activity being replied to.
|
404 |
-
*/
|
405 |
$activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] );
|
406 |
-
|
407 |
-
/**
|
408 |
-
* Filters the comment content for a comment reply.
|
409 |
-
*
|
410 |
-
* @since BuddyPress (1.2.0)
|
411 |
-
*
|
412 |
-
* @param string $ac_input_activity_id Comment content being posted.
|
413 |
-
*/
|
414 |
$content = apply_filters( 'bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id] );
|
415 |
|
416 |
if ( empty( $content ) ) {
|
@@ -427,7 +339,7 @@ function bp_activity_action_post_comment() {
|
|
427 |
if ( !empty( $comment_id ) )
|
428 |
bp_core_add_message( __( 'Reply Posted!', 'buddypress' ) );
|
429 |
else
|
430 |
-
bp_core_add_message( __( 'There was an error posting that reply
|
431 |
|
432 |
bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
|
433 |
}
|
@@ -461,7 +373,7 @@ function bp_activity_action_mark_favorite() {
|
|
461 |
if ( bp_activity_add_user_favorite( bp_action_variable( 0 ) ) )
|
462 |
bp_core_add_message( __( 'Activity marked as favorite.', 'buddypress' ) );
|
463 |
else
|
464 |
-
bp_core_add_message( __( 'There was an error marking that activity as a favorite
|
465 |
|
466 |
bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) );
|
467 |
}
|
@@ -495,7 +407,7 @@ function bp_activity_action_remove_favorite() {
|
|
495 |
if ( bp_activity_remove_user_favorite( bp_action_variable( 0 ) ) )
|
496 |
bp_core_add_message( __( 'Activity removed as favorite.', 'buddypress' ) );
|
497 |
else
|
498 |
-
bp_core_add_message( __( 'There was an error removing that activity as a favorite
|
499 |
|
500 |
bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) );
|
501 |
}
|
@@ -728,13 +640,7 @@ function bp_activity_setup_akismet() {
|
|
728 |
if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) )
|
729 |
return;
|
730 |
|
731 |
-
|
732 |
-
* Filters if BuddyPress Activity Akismet support has been disabled by another plugin.
|
733 |
-
*
|
734 |
-
* @since BuddyPress (1.6.0)
|
735 |
-
*
|
736 |
-
* @param bool bp_is_akismet_active Return value of bp_is_akismet_active boolean function.
|
737 |
-
*/
|
738 |
if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) )
|
739 |
return;
|
740 |
|
@@ -753,17 +659,10 @@ function bp_ajax_get_suggestions() {
|
|
753 |
exit;
|
754 |
}
|
755 |
|
756 |
-
$
|
757 |
'term' => sanitize_text_field( $_GET['term'] ),
|
758 |
'type' => sanitize_text_field( $_GET['type'] ),
|
759 |
-
);
|
760 |
-
|
761 |
-
// Support per-Group suggestions.
|
762 |
-
if ( ! empty( $_GET['group-id'] ) ) {
|
763 |
-
$args['group_id'] = absint( $_GET['group-id'] );
|
764 |
-
}
|
765 |
-
|
766 |
-
$results = bp_core_get_suggestions( $args );
|
767 |
|
768 |
if ( is_wp_error( $results ) ) {
|
769 |
wp_send_json_error( $results->get_error_message() );
|
@@ -773,58 +672,3 @@ function bp_ajax_get_suggestions() {
|
|
773 |
wp_send_json_success( $results );
|
774 |
}
|
775 |
add_action( 'wp_ajax_bp_get_suggestions', 'bp_ajax_get_suggestions' );
|
776 |
-
|
777 |
-
/**
|
778 |
-
* Detect a change in post type status, and initiate an activity update if necessary.
|
779 |
-
*
|
780 |
-
* @since BuddyPress (2.2.0)
|
781 |
-
*
|
782 |
-
* @todo Support untrashing better.
|
783 |
-
*
|
784 |
-
* @param string $new_status New status for the post.
|
785 |
-
* @param string $old_status Old status for the post.
|
786 |
-
* @param object $post Post data.
|
787 |
-
*/
|
788 |
-
function bp_activity_catch_transition_post_type_status( $new_status, $old_status, $post ) {
|
789 |
-
if ( ! post_type_supports( $post->post_type, 'buddypress-activity' ) ) {
|
790 |
-
return;
|
791 |
-
}
|
792 |
-
|
793 |
-
// This is an edit.
|
794 |
-
if ( $new_status === $old_status ) {
|
795 |
-
// An edit of an existing post should update the existing activity item.
|
796 |
-
if ( $new_status == 'publish' ) {
|
797 |
-
bp_activity_post_type_update( $post );
|
798 |
-
}
|
799 |
-
|
800 |
-
return;
|
801 |
-
}
|
802 |
-
|
803 |
-
// Publishing a previously unpublished post.
|
804 |
-
if ( 'publish' === $new_status ) {
|
805 |
-
// Untrashing the post type - nothing here yet.
|
806 |
-
if ( 'trash' == $old_status ) {
|
807 |
-
|
808 |
-
/**
|
809 |
-
* Fires if untrashing post in a post type.
|
810 |
-
*
|
811 |
-
* This is a variable filter that is dependent on the post type
|
812 |
-
* being untrashed.
|
813 |
-
*
|
814 |
-
* @since BuddyPress (2.2.0)
|
815 |
-
*
|
816 |
-
* @param WP_Post $post Post data.
|
817 |
-
*/
|
818 |
-
do_action( 'bp_activity_post_type_untrash_' . $post->post_type, $post );
|
819 |
-
} else {
|
820 |
-
// Record the post.
|
821 |
-
bp_activity_post_type_publish( $post->ID, $post );
|
822 |
-
}
|
823 |
-
|
824 |
-
// Unpublishing a previously published post.
|
825 |
-
} elseif ( 'publish' === $old_status ) {
|
826 |
-
// Some form of pending status - only remove the activity entry
|
827 |
-
bp_activity_post_type_unpublish( $post->ID, $post );
|
828 |
-
}
|
829 |
-
}
|
830 |
-
add_action( 'transition_post_status', 'bp_activity_catch_transition_post_type_status', 10, 3 );
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
14 |
|
15 |
/**
|
16 |
* Allow core components and dependent plugins to register activity actions.
|
17 |
*
|
18 |
+
* @since BuddyPress (1.2)
|
19 |
*
|
20 |
* @uses do_action() To call 'bp_register_activity_actions' hook.
|
21 |
*/
|
22 |
function bp_register_activity_actions() {
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
do_action( 'bp_register_activity_actions' );
|
24 |
}
|
25 |
add_action( 'bp_init', 'bp_register_activity_actions', 8 );
|
85 |
}
|
86 |
|
87 |
// Set redirect to users' activity stream
|
88 |
+
} else if ( ! empty( $activity->user_id ) ) {
|
89 |
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
|
90 |
}
|
91 |
|
96 |
$redirect = add_query_arg( urlencode_deep( $query_frags ), $redirect );
|
97 |
}
|
98 |
|
99 |
+
// Allow redirect to be filtered
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
if ( ! $redirect = apply_filters_ref_array( 'bp_activity_permalink_redirect_url', array( $redirect, &$activity ) ) ) {
|
101 |
bp_core_redirect( bp_get_root_domain() );
|
102 |
}
|
149 |
if ( ! bp_activity_user_can_delete( $activity ) )
|
150 |
return false;
|
151 |
|
152 |
+
// Call the action before the delete so plugins can still fetch information about it
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
do_action( 'bp_activity_before_action_delete_activity', $activity_id, $activity->user_id );
|
154 |
|
155 |
// Delete the activity item and provide user feedback
|
158 |
else
|
159 |
bp_core_add_message( __( 'There was an error when deleting that activity', 'buddypress' ), 'error' );
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
do_action( 'bp_activity_action_delete_activity', $activity_id, $activity->user_id );
|
162 |
|
163 |
// Check for the redirect query arg, otherwise let WP handle things
|
203 |
// Check nonce
|
204 |
check_admin_referer( 'bp_activity_akismet_spam_' . $activity->id );
|
205 |
|
206 |
+
// Call an action before the spamming so plugins can modify things if they want to
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity );
|
208 |
|
209 |
// Mark as spam
|
210 |
bp_activity_mark_as_spam( $activity );
|
211 |
$activity->save();
|
212 |
|
213 |
+
// Tell the user the spamming has been succesful
|
214 |
bp_core_add_message( __( 'The activity item has been marked as spam and is no longer visible.', 'buddypress' ) );
|
215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
do_action( 'bp_activity_action_spam_activity', $activity_id, $activity->user_id );
|
217 |
|
218 |
// Check for the redirect query arg, otherwise let WP handle things
|
253 |
// Check the nonce
|
254 |
check_admin_referer( 'post_update', '_wpnonce_post_update' );
|
255 |
|
256 |
+
// Get activity info
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
$content = apply_filters( 'bp_activity_post_update_content', $_POST['whats-new'] );
|
258 |
|
259 |
if ( ! empty( $_POST['whats-new-post-object'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
$object = apply_filters( 'bp_activity_post_update_object', $_POST['whats-new-post-object'] );
|
261 |
}
|
262 |
|
263 |
if ( ! empty( $_POST['whats-new-post-in'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
$item_id = apply_filters( 'bp_activity_post_update_item_id', $_POST['whats-new-post-in'] );
|
265 |
}
|
266 |
|
275 |
$activity_id = bp_activity_post_update( array( 'content' => $content ) );
|
276 |
|
277 |
// Post to groups object
|
278 |
+
} else if ( 'groups' == $object && bp_is_active( 'groups' ) ) {
|
279 |
if ( (int) $item_id ) {
|
280 |
$activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) );
|
281 |
}
|
282 |
|
283 |
+
// Special circumstance so let filters handle it
|
284 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
$activity_id = apply_filters( 'bp_activity_custom_update', $object, $item_id, $content );
|
286 |
}
|
287 |
|
289 |
if ( !empty( $activity_id ) )
|
290 |
bp_core_add_message( __( 'Update Posted!', 'buddypress' ) );
|
291 |
else
|
292 |
+
bp_core_add_message( __( 'There was an error when posting your update, please try again.', 'buddypress' ), 'error' );
|
293 |
|
294 |
// Redirect
|
295 |
bp_core_redirect( wp_get_referer() );
|
322 |
// Check the nonce
|
323 |
check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
|
324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
$activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
$content = apply_filters( 'bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id] );
|
327 |
|
328 |
if ( empty( $content ) ) {
|
339 |
if ( !empty( $comment_id ) )
|
340 |
bp_core_add_message( __( 'Reply Posted!', 'buddypress' ) );
|
341 |
else
|
342 |
+
bp_core_add_message( __( 'There was an error posting that reply, please try again.', 'buddypress' ), 'error' );
|
343 |
|
344 |
bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
|
345 |
}
|
373 |
if ( bp_activity_add_user_favorite( bp_action_variable( 0 ) ) )
|
374 |
bp_core_add_message( __( 'Activity marked as favorite.', 'buddypress' ) );
|
375 |
else
|
376 |
+
bp_core_add_message( __( 'There was an error marking that activity as a favorite, please try again.', 'buddypress' ), 'error' );
|
377 |
|
378 |
bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) );
|
379 |
}
|
407 |
if ( bp_activity_remove_user_favorite( bp_action_variable( 0 ) ) )
|
408 |
bp_core_add_message( __( 'Activity removed as favorite.', 'buddypress' ) );
|
409 |
else
|
410 |
+
bp_core_add_message( __( 'There was an error removing that activity as a favorite, please try again.', 'buddypress' ), 'error' );
|
411 |
|
412 |
bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) );
|
413 |
}
|
640 |
if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) )
|
641 |
return;
|
642 |
|
643 |
+
// Bail if BuddyPress Activity Akismet support has been disabled by another plugin
|
|
|
|
|
|
|
|
|
|
|
|
|
644 |
if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) )
|
645 |
return;
|
646 |
|
659 |
exit;
|
660 |
}
|
661 |
|
662 |
+
$results = bp_core_get_suggestions( array(
|
663 |
'term' => sanitize_text_field( $_GET['term'] ),
|
664 |
'type' => sanitize_text_field( $_GET['type'] ),
|
665 |
+
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
666 |
|
667 |
if ( is_wp_error( $results ) ) {
|
668 |
wp_send_json_error( $results->get_error_message() );
|
672 |
wp_send_json_success( $results );
|
673 |
}
|
674 |
add_action( 'wp_ajax_bp_get_suggestions', 'bp_ajax_get_suggestions' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp-activity/bp-activity-admin.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
-
defined( 'ABSPATH' )
|
15 |
|
16 |
// Include WP's list table class
|
17 |
if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
@@ -171,14 +171,6 @@ function bp_activity_admin_edit_hidden_metaboxes( $hidden, $screen ) {
|
|
171 |
// Hide the primary link meta box by default
|
172 |
$hidden = array_merge( (array) $hidden, array( 'bp_activity_itemids', 'bp_activity_link', 'bp_activity_type', 'bp_activity_userid', ) );
|
173 |
|
174 |
-
/**
|
175 |
-
* Filters default hidden metaboxes so plugins can alter list.
|
176 |
-
*
|
177 |
-
* @since BuddyPress (1.6.0)
|
178 |
-
*
|
179 |
-
* @param array $hidden Default metaboxes to hide.
|
180 |
-
* @param WP_Screen $screen Screen identifier.
|
181 |
-
*/
|
182 |
return apply_filters( 'bp_hide_meta_boxes', array_unique( $hidden ), $screen );
|
183 |
}
|
184 |
add_filter( 'default_hidden_meta_boxes', 'bp_activity_admin_edit_hidden_metaboxes', 10, 2 );
|
@@ -206,13 +198,7 @@ function bp_activity_admin_load() {
|
|
206 |
|
207 |
$doaction = bp_admin_list_table_current_bulk_action();
|
208 |
|
209 |
-
|
210 |
-
* Fires at top of Activity admin page.
|
211 |
-
*
|
212 |
-
* @since BuddyPress (1.6.0)
|
213 |
-
*
|
214 |
-
* @param string $doaction Current $_GET action being performed in admin screen.
|
215 |
-
*/
|
216 |
do_action( 'bp_activity_admin_load', $doaction );
|
217 |
|
218 |
// Edit screen
|
@@ -314,13 +300,7 @@ function bp_activity_admin_load() {
|
|
314 |
// Get activity IDs
|
315 |
$activity_ids = array_map( 'absint', (array) $_REQUEST['aid'] );
|
316 |
|
317 |
-
|
318 |
-
* Filters list of IDs being spammed/un-spammed/deleted.
|
319 |
-
*
|
320 |
-
* @since BuddyPress (1.6.0)
|
321 |
-
*
|
322 |
-
* @param array $activity_ids Activity IDs to spam/un-spam/delete.
|
323 |
-
*/
|
324 |
$activity_ids = apply_filters( 'bp_activity_admin_action_activity_ids', $activity_ids );
|
325 |
|
326 |
// Is this a bulk request?
|
@@ -404,17 +384,7 @@ function bp_activity_admin_load() {
|
|
404 |
unset( $activity );
|
405 |
}
|
406 |
|
407 |
-
|
408 |
-
* Fires before redirect for plugins to do something with activity.
|
409 |
-
*
|
410 |
-
* Passes an activity array counts how many were spam, not spam, deleted, and IDs that were errors.
|
411 |
-
*
|
412 |
-
* @since BuddyPress (1.6.0)
|
413 |
-
*
|
414 |
-
* @param array Array holding spam, not spam, deleted counts, error IDs.
|
415 |
-
* @param string $redirect_to URL to redirect to.
|
416 |
-
* @param array $activity_ids Original array of activity IDs.
|
417 |
-
*/
|
418 |
do_action( 'bp_activity_admin_action_after', array( $spammed, $unspammed, $deleted, $errors ), $redirect_to, $activity_ids );
|
419 |
|
420 |
// Add arguments to the redirect URL so that on page reload, we can easily display what we've just done.
|
@@ -431,13 +401,7 @@ function bp_activity_admin_load() {
|
|
431 |
if ( ! empty( $errors ) )
|
432 |
$redirect_to = add_query_arg( 'error', implode ( ',', array_map( 'absint', $errors ) ), $redirect_to );
|
433 |
|
434 |
-
|
435 |
-
* Filters redirect URL after activity spamming/un-spamming/deletion occurs.
|
436 |
-
*
|
437 |
-
* @since BuddyPress (1.6.0)
|
438 |
-
*
|
439 |
-
* @param string $redirect_to URL to redirect to.
|
440 |
-
*/
|
441 |
wp_redirect( apply_filters( 'bp_activity_admin_action_redirect', $redirect_to ) );
|
442 |
exit;
|
443 |
|
@@ -548,13 +512,7 @@ function bp_activity_admin_load() {
|
|
548 |
if ( false === $result )
|
549 |
$error = $activity->id;
|
550 |
|
551 |
-
|
552 |
-
* Fires before redirect so plugins can do something first on save action.
|
553 |
-
*
|
554 |
-
* @since BuddyPress (1.6.0)
|
555 |
-
*
|
556 |
-
* @param array Array holding activity object and ID that holds error.
|
557 |
-
*/
|
558 |
do_action_ref_array( 'bp_activity_admin_edit_after', array( &$activity, $error ) );
|
559 |
|
560 |
// If an error occurred, pass back the activity ID that failed
|
@@ -563,13 +521,7 @@ function bp_activity_admin_load() {
|
|
563 |
else
|
564 |
$redirect_to = add_query_arg( 'updated', (int) $activity->id, $redirect_to );
|
565 |
|
566 |
-
|
567 |
-
* Filters URL to redirect to after saving.
|
568 |
-
*
|
569 |
-
* @since BuddyPress (1.6.0)
|
570 |
-
*
|
571 |
-
* @param string $redirect_to URL to redirect to.
|
572 |
-
*/
|
573 |
wp_redirect( apply_filters( 'bp_activity_admin_edit_redirect', $redirect_to ) );
|
574 |
exit;
|
575 |
|
@@ -634,13 +586,7 @@ function bp_activity_admin_edit() {
|
|
634 |
$form_url = remove_query_arg( array( 'action', 'deleted', 'error', 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] );
|
635 |
$form_url = add_query_arg( 'action', 'save', $form_url );
|
636 |
|
637 |
-
|
638 |
-
* Fires before activity edit form is displays so plugins can modify the activity.
|
639 |
-
*
|
640 |
-
* @since BuddyPress (1.6.0)
|
641 |
-
*
|
642 |
-
* @param array Array holding single activity object.
|
643 |
-
*/
|
644 |
do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) ); ?>
|
645 |
|
646 |
<div class="wrap">
|
@@ -649,7 +595,7 @@ function bp_activity_admin_edit() {
|
|
649 |
|
650 |
<?php if ( ! empty( $activity ) ) : ?>
|
651 |
|
652 |
-
<form action="<?php echo
|
653 |
<div id="poststuff">
|
654 |
|
655 |
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
@@ -798,7 +744,7 @@ function bp_activity_admin_get_activity_actions() {
|
|
798 |
$actions = array();
|
799 |
|
800 |
// Walk through the registered actions, and build an array of actions/values.
|
801 |
-
foreach (
|
802 |
$action = array_values( (array) $action );
|
803 |
|
804 |
for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ ) {
|
@@ -831,7 +777,7 @@ function bp_activity_admin_edit_metabox_type( $item ) {
|
|
831 |
$selected = $item->type;
|
832 |
|
833 |
// Walk through the registered actions, and build an array of actions/values.
|
834 |
-
foreach (
|
835 |
$action = array_values( (array) $action );
|
836 |
|
837 |
for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ )
|
@@ -948,19 +894,13 @@ function bp_activity_admin_index() {
|
|
948 |
$messages[] = sprintf( _n( '%s activity item has been successfully unspammed.', '%s activity items have been successfully unspammed.', $unspammed, 'buddypress' ), number_format_i18n( $unspammed ) );
|
949 |
|
950 |
if ( $updated > 0 )
|
951 |
-
$messages[] = __( 'The activity item has been updated
|
952 |
}
|
953 |
|
954 |
// Prepare the activity items for display
|
955 |
$bp_activity_list_table->prepare_items();
|
956 |
|
957 |
-
|
958 |
-
* Fires before edit form is displayed so plugins can modify the activity messages.
|
959 |
-
*
|
960 |
-
* @since BuddyPress (1.6.0)
|
961 |
-
*
|
962 |
-
* @param array $messages Array of messages to display at top of page.
|
963 |
-
*/
|
964 |
do_action( 'bp_activity_admin_index', $messages ); ?>
|
965 |
|
966 |
<div class="wrap">
|
@@ -1053,17 +993,6 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
1053 |
*/
|
1054 |
protected $activity_user_id = array();
|
1055 |
|
1056 |
-
/**
|
1057 |
-
* If users can comment on blog & forum activity items
|
1058 |
-
*
|
1059 |
-
* @since BuddyPress (2.2.2)
|
1060 |
-
*
|
1061 |
-
* @link https://buddypress.trac.wordpress.org/ticket/6277
|
1062 |
-
*
|
1063 |
-
* @var bool
|
1064 |
-
*/
|
1065 |
-
public $disable_blogforum_comments = false;
|
1066 |
-
|
1067 |
/**
|
1068 |
* Constructor.
|
1069 |
*
|
@@ -1153,7 +1082,7 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
1153 |
'count_total' => 'count_query',
|
1154 |
) );
|
1155 |
|
1156 |
-
// If we're viewing a specific activity, flatten all
|
1157 |
if ( $include_id ) {
|
1158 |
$activities['activities'] = BP_Activity_List_Table::flatten_activity_array( $activities['activities'] );
|
1159 |
$activities['total'] = count( $activities['activities'] );
|
@@ -1167,7 +1096,7 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
1167 |
foreach ( $activities['activities'] as $activity_item ) {
|
1168 |
$new_activities[] = (array) $activity_item;
|
1169 |
|
1170 |
-
// Build an array of activity-to-user ID mappings for better
|
1171 |
$this->activity_user_id[$activity_item->id] = $activity_item->user_id;
|
1172 |
}
|
1173 |
|
@@ -1279,20 +1208,10 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
1279 |
$url_base = bp_get_admin_url( 'admin.php?page=bp-activity' ); ?>
|
1280 |
|
1281 |
<ul class="subsubsub">
|
1282 |
-
<li class="all"><a href="<?php echo esc_url( $url_base ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
|
1283 |
-
<li class="spam"><a href="<?php echo esc_url( add_query_arg( 'activity_status', 'spam', $url_base ) ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam <span class="count">(%s)</span>', 'buddypress' ), number_format_i18n( $this->spam_count ) ); ?></a></li>
|
1284 |
-
|
1285 |
-
<?php
|
1286 |
|
1287 |
-
|
1288 |
-
* Fires inside listing of views so plugins can add their own.
|
1289 |
-
*
|
1290 |
-
* @since BuddyPress (1.6.0)
|
1291 |
-
*
|
1292 |
-
* @param string $url_base Current URL base for view.
|
1293 |
-
* @param string $view Current view being displayed.
|
1294 |
-
*/
|
1295 |
-
do_action( 'bp_activity_list_table_get_views', $url_base, $this->view ); ?>
|
1296 |
</ul>
|
1297 |
<?php
|
1298 |
}
|
@@ -1310,13 +1229,6 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
1310 |
$actions['bulk_ham'] = __( 'Not Spam', 'buddypress' );
|
1311 |
$actions['bulk_delete'] = __( 'Delete Permanently', 'buddypress' );
|
1312 |
|
1313 |
-
/**
|
1314 |
-
* Filters the default bulk actions so plugins can add custom actions.
|
1315 |
-
*
|
1316 |
-
* @since BuddyPress (1.6.0)
|
1317 |
-
*
|
1318 |
-
* @param array $actions Default available actions for bulk operations.
|
1319 |
-
*/
|
1320 |
return apply_filters( 'bp_activity_list_table_get_bulk_actions', $actions );
|
1321 |
}
|
1322 |
|
@@ -1376,7 +1288,7 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
1376 |
$selected = ( ! empty( $_REQUEST['activity_type'] ) ) ? $_REQUEST['activity_type'] : '';
|
1377 |
|
1378 |
// Get the actions
|
1379 |
-
$activity_actions =
|
1380 |
|
1381 |
<div class="alignleft actions">
|
1382 |
<select name="activity_type">
|
@@ -1517,14 +1429,7 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
1517 |
// Start timestamp
|
1518 |
echo '<div class="submitted-on">';
|
1519 |
|
1520 |
-
|
1521 |
-
* Filters available actions for plugins to alter.
|
1522 |
-
*
|
1523 |
-
* @since BuddyPress (1.6.0)
|
1524 |
-
*
|
1525 |
-
* @param array $actions Array of available actions user could use.
|
1526 |
-
* @param array $item Current item being added to page.
|
1527 |
-
*/
|
1528 |
$actions = apply_filters( 'bp_activity_admin_comment_row_actions', array_filter( $actions ), $item );
|
1529 |
|
1530 |
/* translators: 2: activity admin ui date/time */
|
@@ -1535,23 +1440,8 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
1535 |
|
1536 |
// Get activity content - if not set, use the action
|
1537 |
if ( ! empty( $item['content'] ) ) {
|
1538 |
-
|
1539 |
-
/**
|
1540 |
-
* Filters current activity item content.
|
1541 |
-
*
|
1542 |
-
* @since BuddyPress (1.2.0)
|
1543 |
-
*
|
1544 |
-
* @param array $item Array index holding current activity item content.
|
1545 |
-
*/
|
1546 |
$content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $item['content'] ) );
|
1547 |
} else {
|
1548 |
-
/**
|
1549 |
-
* Filters current activity item action.
|
1550 |
-
*
|
1551 |
-
* @since BuddyPress (1.2.0)
|
1552 |
-
*
|
1553 |
-
* @var array $item Array index holding current activity item action.
|
1554 |
-
*/
|
1555 |
$content = apply_filters_ref_array( 'bp_get_activity_action', array( $item['action'] ) );
|
1556 |
}
|
1557 |
|
@@ -1569,15 +1459,6 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
1569 |
*/
|
1570 |
function column_response( $item ) {
|
1571 |
// Is $item is a root activity?
|
1572 |
-
|
1573 |
-
/**
|
1574 |
-
* Filters default list of default root activity types.
|
1575 |
-
*
|
1576 |
-
* @since BuddyPress (1.6.0)
|
1577 |
-
*
|
1578 |
-
* @param array Array of default activity types.
|
1579 |
-
* @param array $item Current item being displayed.
|
1580 |
-
*/
|
1581 |
if ( empty( $item['item_id'] ) || ! in_array( $item['type'], apply_filters( 'bp_activity_admin_root_activity_types', array( 'activity_comment' ), $item ) ) ) {
|
1582 |
$comment_count = !empty( $item['children'] ) ? bp_activity_recurse_comment_count( (object) $item ) : 0;
|
1583 |
$root_activity_url = bp_get_admin_url( 'admin.php?page=bp-activity&aid=' . $item['id'] );
|
@@ -1623,7 +1504,7 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
1623 |
|
1624 |
/**
|
1625 |
* If, somehow, the referenced activity has been deleted, leaving its associated
|
1626 |
-
*
|
1627 |
*/
|
1628 |
if ( empty( $activity['activities'] ) )
|
1629 |
return bp_loggedin_user_id();
|
@@ -1692,13 +1573,6 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
1692 |
}
|
1693 |
}
|
1694 |
|
1695 |
-
/**
|
1696 |
-
* Filters if an activity item can be commented on or not.
|
1697 |
-
*
|
1698 |
-
* @since BuddyPress (2.0.0)
|
1699 |
-
*
|
1700 |
-
* @param bool $can_comment Whether an activity item can be commented on or not.
|
1701 |
-
*/
|
1702 |
return apply_filters( 'bp_activity_list_table_can_comment', $can_comment );
|
1703 |
}
|
1704 |
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
// Include WP's list table class
|
17 |
if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
171 |
// Hide the primary link meta box by default
|
172 |
$hidden = array_merge( (array) $hidden, array( 'bp_activity_itemids', 'bp_activity_link', 'bp_activity_type', 'bp_activity_userid', ) );
|
173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
return apply_filters( 'bp_hide_meta_boxes', array_unique( $hidden ), $screen );
|
175 |
}
|
176 |
add_filter( 'default_hidden_meta_boxes', 'bp_activity_admin_edit_hidden_metaboxes', 10, 2 );
|
198 |
|
199 |
$doaction = bp_admin_list_table_current_bulk_action();
|
200 |
|
201 |
+
// Call an action for plugins to hook in early
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
do_action( 'bp_activity_admin_load', $doaction );
|
203 |
|
204 |
// Edit screen
|
300 |
// Get activity IDs
|
301 |
$activity_ids = array_map( 'absint', (array) $_REQUEST['aid'] );
|
302 |
|
303 |
+
// Call a filter for plugins to modify the requested activities to load
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
$activity_ids = apply_filters( 'bp_activity_admin_action_activity_ids', $activity_ids );
|
305 |
|
306 |
// Is this a bulk request?
|
384 |
unset( $activity );
|
385 |
}
|
386 |
|
387 |
+
// Call actions for plugins to do something before we redirect
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
do_action( 'bp_activity_admin_action_after', array( $spammed, $unspammed, $deleted, $errors ), $redirect_to, $activity_ids );
|
389 |
|
390 |
// Add arguments to the redirect URL so that on page reload, we can easily display what we've just done.
|
401 |
if ( ! empty( $errors ) )
|
402 |
$redirect_to = add_query_arg( 'error', implode ( ',', array_map( 'absint', $errors ) ), $redirect_to );
|
403 |
|
404 |
+
// Redirect
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
wp_redirect( apply_filters( 'bp_activity_admin_action_redirect', $redirect_to ) );
|
406 |
exit;
|
407 |
|
512 |
if ( false === $result )
|
513 |
$error = $activity->id;
|
514 |
|
515 |
+
// Call actions for plugins to do something before we redirect
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
do_action_ref_array( 'bp_activity_admin_edit_after', array( &$activity, $error ) );
|
517 |
|
518 |
// If an error occurred, pass back the activity ID that failed
|
521 |
else
|
522 |
$redirect_to = add_query_arg( 'updated', (int) $activity->id, $redirect_to );
|
523 |
|
524 |
+
// Redirect
|
|
|
|
|
|
|
|
|
|
|
|
|
525 |
wp_redirect( apply_filters( 'bp_activity_admin_edit_redirect', $redirect_to ) );
|
526 |
exit;
|
527 |
|
586 |
$form_url = remove_query_arg( array( 'action', 'deleted', 'error', 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] );
|
587 |
$form_url = add_query_arg( 'action', 'save', $form_url );
|
588 |
|
589 |
+
// Call an action for plugins to modify the activity before we display the edit form
|
|
|
|
|
|
|
|
|
|
|
|
|
590 |
do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) ); ?>
|
591 |
|
592 |
<div class="wrap">
|
595 |
|
596 |
<?php if ( ! empty( $activity ) ) : ?>
|
597 |
|
598 |
+
<form action="<?php echo esc_attr( $form_url ); ?>" id="bp-activities-edit-form" method="post">
|
599 |
<div id="poststuff">
|
600 |
|
601 |
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
744 |
$actions = array();
|
745 |
|
746 |
// Walk through the registered actions, and build an array of actions/values.
|
747 |
+
foreach ( buddypress()->activity->actions as $action ) {
|
748 |
$action = array_values( (array) $action );
|
749 |
|
750 |
for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ ) {
|
777 |
$selected = $item->type;
|
778 |
|
779 |
// Walk through the registered actions, and build an array of actions/values.
|
780 |
+
foreach ( $bp->activity->actions as $action ) {
|
781 |
$action = array_values( (array) $action );
|
782 |
|
783 |
for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ )
|
894 |
$messages[] = sprintf( _n( '%s activity item has been successfully unspammed.', '%s activity items have been successfully unspammed.', $unspammed, 'buddypress' ), number_format_i18n( $unspammed ) );
|
895 |
|
896 |
if ( $updated > 0 )
|
897 |
+
$messages[] = __( 'The activity item has been updated succesfully.', 'buddypress' );
|
898 |
}
|
899 |
|
900 |
// Prepare the activity items for display
|
901 |
$bp_activity_list_table->prepare_items();
|
902 |
|
903 |
+
// Call an action for plugins to modify the activity before we display the edit form
|
|
|
|
|
|
|
|
|
|
|
|
|
904 |
do_action( 'bp_activity_admin_index', $messages ); ?>
|
905 |
|
906 |
<div class="wrap">
|
993 |
*/
|
994 |
protected $activity_user_id = array();
|
995 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
996 |
/**
|
997 |
* Constructor.
|
998 |
*
|
1082 |
'count_total' => 'count_query',
|
1083 |
) );
|
1084 |
|
1085 |
+
// If we're viewing a specific activity, flatten all activites into a single array.
|
1086 |
if ( $include_id ) {
|
1087 |
$activities['activities'] = BP_Activity_List_Table::flatten_activity_array( $activities['activities'] );
|
1088 |
$activities['total'] = count( $activities['activities'] );
|
1096 |
foreach ( $activities['activities'] as $activity_item ) {
|
1097 |
$new_activities[] = (array) $activity_item;
|
1098 |
|
1099 |
+
// Build an array of activity-to-user ID mappings for better efficency in the In Response To column
|
1100 |
$this->activity_user_id[$activity_item->id] = $activity_item->user_id;
|
1101 |
}
|
1102 |
|
1208 |
$url_base = bp_get_admin_url( 'admin.php?page=bp-activity' ); ?>
|
1209 |
|
1210 |
<ul class="subsubsub">
|
1211 |
+
<li class="all"><a href="<?php echo esc_attr( esc_url( $url_base ) ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
|
1212 |
+
<li class="spam"><a href="<?php echo esc_attr( esc_url( add_query_arg( 'activity_status', 'spam', $url_base ) ) ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam <span class="count">(%s)</span>', 'buddypress' ), number_format_i18n( $this->spam_count ) ); ?></a></li>
|
|
|
|
|
1213 |
|
1214 |
+
<?php do_action( 'bp_activity_list_table_get_views', $url_base, $this->view ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1215 |
</ul>
|
1216 |
<?php
|
1217 |
}
|
1229 |
$actions['bulk_ham'] = __( 'Not Spam', 'buddypress' );
|
1230 |
$actions['bulk_delete'] = __( 'Delete Permanently', 'buddypress' );
|
1231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1232 |
return apply_filters( 'bp_activity_list_table_get_bulk_actions', $actions );
|
1233 |
}
|
1234 |
|
1288 |
$selected = ( ! empty( $_REQUEST['activity_type'] ) ) ? $_REQUEST['activity_type'] : '';
|
1289 |
|
1290 |
// Get the actions
|
1291 |
+
$activity_actions = buddypress()->activity->actions; ?>
|
1292 |
|
1293 |
<div class="alignleft actions">
|
1294 |
<select name="activity_type">
|
1429 |
// Start timestamp
|
1430 |
echo '<div class="submitted-on">';
|
1431 |
|
1432 |
+
// Other plugins can filter which actions are shown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1433 |
$actions = apply_filters( 'bp_activity_admin_comment_row_actions', array_filter( $actions ), $item );
|
1434 |
|
1435 |
/* translators: 2: activity admin ui date/time */
|
1440 |
|
1441 |
// Get activity content - if not set, use the action
|
1442 |
if ( ! empty( $item['content'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1443 |
$content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $item['content'] ) );
|
1444 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1445 |
$content = apply_filters_ref_array( 'bp_get_activity_action', array( $item['action'] ) );
|
1446 |
}
|
1447 |
|
1459 |
*/
|
1460 |
function column_response( $item ) {
|
1461 |
// Is $item is a root activity?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1462 |
if ( empty( $item['item_id'] ) || ! in_array( $item['type'], apply_filters( 'bp_activity_admin_root_activity_types', array( 'activity_comment' ), $item ) ) ) {
|
1463 |
$comment_count = !empty( $item['children'] ) ? bp_activity_recurse_comment_count( (object) $item ) : 0;
|
1464 |
$root_activity_url = bp_get_admin_url( 'admin.php?page=bp-activity&aid=' . $item['id'] );
|
1504 |
|
1505 |
/**
|
1506 |
* If, somehow, the referenced activity has been deleted, leaving its associated
|
1507 |
+
* activites as orphans, use the logged in user's ID to avoid errors.
|
1508 |
*/
|
1509 |
if ( empty( $activity['activities'] ) )
|
1510 |
return bp_loggedin_user_id();
|
1573 |
}
|
1574 |
}
|
1575 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1576 |
return apply_filters( 'bp_activity_list_table_can_comment', $can_comment );
|
1577 |
}
|
1578 |
|
bp-activity/bp-activity-akismet.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Akismet support for the Activity component.
|
@@ -112,13 +112,6 @@ class BP_Akismet {
|
|
112 |
if ( $desc )
|
113 |
echo '<span class="akismet-status"><a href="' . esc_url( bp_get_admin_url( 'admin.php?page=bp-activity&action=edit&aid=' . $activity['id'] ) ) . '#bp_activity_history">' . htmlspecialchars( $desc ) . '</a></span>';
|
114 |
|
115 |
-
/**
|
116 |
-
* Filters the list of actions for the current activity's row.
|
117 |
-
*
|
118 |
-
* @since BuddyPress (1.6.0)
|
119 |
-
*
|
120 |
-
* @param array $actions Array of available actions for the current activity item's row.
|
121 |
-
*/
|
122 |
return apply_filters( 'bp_akismet_comment_row_action', $actions );
|
123 |
}
|
124 |
|
@@ -246,14 +239,6 @@ class BP_Akismet {
|
|
246 |
* @return array List of activity types.
|
247 |
*/
|
248 |
public static function get_activity_types() {
|
249 |
-
|
250 |
-
/**
|
251 |
-
* Filters the list of activity types that Akismet should automatically check for spam.
|
252 |
-
*
|
253 |
-
* @since BuddyPress (1.6.0)
|
254 |
-
*
|
255 |
-
* @param array Array of default activity types for Akismet to check.
|
256 |
-
*/
|
257 |
return apply_filters( 'bp_akismet_get_activity_types', array( 'activity_comment', 'activity_update' ) );
|
258 |
}
|
259 |
|
@@ -269,14 +254,6 @@ class BP_Akismet {
|
|
269 |
// Record this item so we can do some tidyup in BP_Akismet::check_member_activity_update()
|
270 |
$this->last_activity = $activity;
|
271 |
|
272 |
-
/**
|
273 |
-
* Fires after marking an activity item has been marked as spam.
|
274 |
-
*
|
275 |
-
* @since BuddyPress (1.6.0)
|
276 |
-
*
|
277 |
-
* @param BP_Activity_Activity $activity Activity object being marked as spam.
|
278 |
-
* @param string $source Source of the whom marked as spam. Either "by_a_person" (e.g. a person has manually marked the activity as spam) or "by_akismet".
|
279 |
-
*/
|
280 |
do_action( 'bp_activity_akismet_mark_as_spam', $activity, $source );
|
281 |
}
|
282 |
|
@@ -293,14 +270,6 @@ class BP_Akismet {
|
|
293 |
if ( 'true' == bp_activity_get_meta( $activity->id, '_bp_akismet_result' ) && !bp_activity_get_meta( $activity->id, '_bp_akismet_user_result' ) )
|
294 |
$activity->content = bp_activity_at_name_filter( $activity->content, $activity->id );
|
295 |
|
296 |
-
/**
|
297 |
-
* Fires after marking an activity item has been marked as ham.
|
298 |
-
*
|
299 |
-
* @since BuddyPress (1.6.0)
|
300 |
-
*
|
301 |
-
* @param BP_Activity_Activity $activity Activity object being marked as ham.
|
302 |
-
* @param string $source Source of the whom marked as ham. Either "by_a_person" (e.g. a person has manually marked the activity as ham) or "by_akismet" (automatically hammed).
|
303 |
-
*/
|
304 |
do_action( 'bp_activity_akismet_mark_as_ham', $activity, $source );
|
305 |
}
|
306 |
|
@@ -342,14 +311,6 @@ class BP_Akismet {
|
|
342 |
elseif ( !empty( $activity->secondary_item_id ) && !empty( $_POST['_bp_as_nonce_' . $activity->secondary_item_id] ) )
|
343 |
$activity_data['akismet_comment_nonce'] = wp_verify_nonce( $_POST["_bp_as_nonce_{$activity->secondary_item_id}"], "_bp_as_nonce_{$userdata->ID}_{$activity->secondary_item_id}" ) ? 'passed' : 'failed';
|
344 |
|
345 |
-
/**
|
346 |
-
* Filters activity data before being sent to Akismet to inspect.
|
347 |
-
*
|
348 |
-
* @since BuddyPress (1.6.0)
|
349 |
-
*
|
350 |
-
* @param array $activity_data Array of activity data for Akismet to inspect.
|
351 |
-
* @param BP_Activity_Activity $activity Activity item data.
|
352 |
-
*/
|
353 |
return apply_filters( 'bp_akismet_build_akismet_data_package', $activity_data, $activity );
|
354 |
}
|
355 |
|
@@ -386,14 +347,7 @@ class BP_Akismet {
|
|
386 |
|
387 |
// Spam
|
388 |
if ( 'true' == $activity_data['bp_as_result'] ) {
|
389 |
-
|
390 |
-
* Fires after an activity item has been proven to be spam, but before officially being marked as spam.
|
391 |
-
*
|
392 |
-
* @since BuddyPress (1.6.0)
|
393 |
-
*
|
394 |
-
* @param BP_Activity_Activity $activity The activity item proven to be spam.
|
395 |
-
* @param array $activity_data Array of activity data for item including Akismet check results data.
|
396 |
-
*/
|
397 |
do_action_ref_array( 'bp_activity_akismet_spam_caught', array( &$activity, $activity_data ) );
|
398 |
|
399 |
// Mark as spam
|
@@ -477,7 +431,7 @@ class BP_Akismet {
|
|
477 |
/**
|
478 |
* Contact Akismet to check if this is spam or ham.
|
479 |
*
|
480 |
-
* Props to WordPress core Akismet plugin for
|
481 |
*
|
482 |
* @since BuddyPress (1.6)
|
483 |
*
|
@@ -496,7 +450,7 @@ class BP_Akismet {
|
|
496 |
if ( function_exists( 'akismet_init' ) && ( empty( $akismet_api_host ) || empty( $akismet_api_port ) ) )
|
497 |
akismet_init();
|
498 |
|
499 |
-
$query_string = $path = '';
|
500 |
|
501 |
$activity_data['blog'] = bp_get_option( 'home' );
|
502 |
$activity_data['blog_charset'] = bp_get_option( 'blog_charset' );
|
@@ -660,13 +614,6 @@ class BP_Akismet {
|
|
660 |
function bp_activity_akismet_delete_old_metadata() {
|
661 |
global $bp, $wpdb;
|
662 |
|
663 |
-
/**
|
664 |
-
* Filters the threshold for how many days old Akismet metadata needs to be before being automatically deleted.
|
665 |
-
*
|
666 |
-
* @since BuddyPress (1.6.0)
|
667 |
-
*
|
668 |
-
* @param integer 15 How many days old metadata needs to be.
|
669 |
-
*/
|
670 |
$interval = apply_filters( 'bp_activity_akismet_delete_meta_interval', 15 );
|
671 |
|
672 |
// Enforce a minimum of 1 day
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Akismet support for the Activity component.
|
112 |
if ( $desc )
|
113 |
echo '<span class="akismet-status"><a href="' . esc_url( bp_get_admin_url( 'admin.php?page=bp-activity&action=edit&aid=' . $activity['id'] ) ) . '#bp_activity_history">' . htmlspecialchars( $desc ) . '</a></span>';
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
return apply_filters( 'bp_akismet_comment_row_action', $actions );
|
116 |
}
|
117 |
|
239 |
* @return array List of activity types.
|
240 |
*/
|
241 |
public static function get_activity_types() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
return apply_filters( 'bp_akismet_get_activity_types', array( 'activity_comment', 'activity_update' ) );
|
243 |
}
|
244 |
|
254 |
// Record this item so we can do some tidyup in BP_Akismet::check_member_activity_update()
|
255 |
$this->last_activity = $activity;
|
256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
do_action( 'bp_activity_akismet_mark_as_spam', $activity, $source );
|
258 |
}
|
259 |
|
270 |
if ( 'true' == bp_activity_get_meta( $activity->id, '_bp_akismet_result' ) && !bp_activity_get_meta( $activity->id, '_bp_akismet_user_result' ) )
|
271 |
$activity->content = bp_activity_at_name_filter( $activity->content, $activity->id );
|
272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
do_action( 'bp_activity_akismet_mark_as_ham', $activity, $source );
|
274 |
}
|
275 |
|
311 |
elseif ( !empty( $activity->secondary_item_id ) && !empty( $_POST['_bp_as_nonce_' . $activity->secondary_item_id] ) )
|
312 |
$activity_data['akismet_comment_nonce'] = wp_verify_nonce( $_POST["_bp_as_nonce_{$activity->secondary_item_id}"], "_bp_as_nonce_{$userdata->ID}_{$activity->secondary_item_id}" ) ? 'passed' : 'failed';
|
313 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
return apply_filters( 'bp_akismet_build_akismet_data_package', $activity_data, $activity );
|
315 |
}
|
316 |
|
347 |
|
348 |
// Spam
|
349 |
if ( 'true' == $activity_data['bp_as_result'] ) {
|
350 |
+
// Action for plugin authors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
do_action_ref_array( 'bp_activity_akismet_spam_caught', array( &$activity, $activity_data ) );
|
352 |
|
353 |
// Mark as spam
|
431 |
/**
|
432 |
* Contact Akismet to check if this is spam or ham.
|
433 |
*
|
434 |
+
* Props to WordPress core Akismet plugin for alot of this.
|
435 |
*
|
436 |
* @since BuddyPress (1.6)
|
437 |
*
|
450 |
if ( function_exists( 'akismet_init' ) && ( empty( $akismet_api_host ) || empty( $akismet_api_port ) ) )
|
451 |
akismet_init();
|
452 |
|
453 |
+
$query_string = $path = $response = '';
|
454 |
|
455 |
$activity_data['blog'] = bp_get_option( 'home' );
|
456 |
$activity_data['blog_charset'] = bp_get_option( 'blog_charset' );
|
614 |
function bp_activity_akismet_delete_old_metadata() {
|
615 |
global $bp, $wpdb;
|
616 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
617 |
$interval = apply_filters( 'bp_activity_akismet_delete_meta_interval', 15 );
|
618 |
|
619 |
// Enforce a minimum of 1 day
|
bp-activity/bp-activity-cache.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/**
|
13 |
* Slurp up activitymeta for a specified set of activity items.
|
@@ -43,7 +43,6 @@ function bp_activity_update_meta_cache( $activity_ids = false ) {
|
|
43 |
*/
|
44 |
function bp_activity_clear_cache_for_activity( $activity ) {
|
45 |
wp_cache_delete( $activity->id, 'bp_activity' );
|
46 |
-
wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
|
47 |
}
|
48 |
add_action( 'bp_activity_after_save', 'bp_activity_clear_cache_for_activity' );
|
49 |
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/**
|
13 |
* Slurp up activitymeta for a specified set of activity items.
|
43 |
*/
|
44 |
function bp_activity_clear_cache_for_activity( $activity ) {
|
45 |
wp_cache_delete( $activity->id, 'bp_activity' );
|
|
|
46 |
}
|
47 |
add_action( 'bp_activity_after_save', 'bp_activity_clear_cache_for_activity' );
|
48 |
|
bp-activity/bp-activity-classes.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/**
|
13 |
* Database interaction class for the BuddyPress activity component.
|
@@ -135,12 +135,11 @@ class BP_Activity_Activity {
|
|
135 |
* Populate the object with data about the specific activity item.
|
136 |
*/
|
137 |
public function populate() {
|
138 |
-
global $wpdb;
|
139 |
|
140 |
$row = wp_cache_get( $this->id, 'bp_activity' );
|
141 |
|
142 |
if ( false === $row ) {
|
143 |
-
$bp = buddypress();
|
144 |
$row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id = %d", $this->id ) );
|
145 |
|
146 |
wp_cache_set( $this->id, $row, 'bp_activity' );
|
@@ -170,7 +169,7 @@ class BP_Activity_Activity {
|
|
170 |
|
171 |
// If no callback is available, use the literal string from
|
172 |
// the database row
|
173 |
-
}
|
174 |
$this->action = $row->action;
|
175 |
|
176 |
// Provide a fallback to avoid PHP notices
|
@@ -185,9 +184,7 @@ class BP_Activity_Activity {
|
|
185 |
* @return bool True on success.
|
186 |
*/
|
187 |
public function save() {
|
188 |
-
global $wpdb;
|
189 |
-
|
190 |
-
$bp = buddypress();
|
191 |
|
192 |
$this->id = apply_filters_ref_array( 'bp_activity_id_before_save', array( $this->id, &$this ) );
|
193 |
$this->item_id = apply_filters_ref_array( 'bp_activity_item_id_before_save', array( $this->item_id, &$this ) );
|
@@ -204,52 +201,32 @@ class BP_Activity_Activity {
|
|
204 |
$this->mptt_right = apply_filters_ref_array( 'bp_activity_mptt_right_before_save', array( $this->mptt_right, &$this ) );
|
205 |
$this->is_spam = apply_filters_ref_array( 'bp_activity_is_spam_before_save', array( $this->is_spam, &$this ) );
|
206 |
|
207 |
-
|
208 |
-
* Fires before the current activity item gets saved.
|
209 |
-
*
|
210 |
-
* Please use this hook to filter the properties above. Each part will be passed in.
|
211 |
-
*
|
212 |
-
* @since BuddyPress (1.0.0)
|
213 |
-
*
|
214 |
-
* @param BP_Activity_Activity Current instance of the activity item being saved.
|
215 |
-
*/
|
216 |
do_action_ref_array( 'bp_activity_before_save', array( &$this ) );
|
217 |
|
218 |
-
if (
|
219 |
return false;
|
220 |
-
}
|
221 |
|
222 |
-
if (
|
223 |
$this->primary_link = bp_loggedin_user_domain();
|
224 |
-
}
|
225 |
|
226 |
// If we have an existing ID, update the activity item, otherwise insert it.
|
227 |
-
if (
|
228 |
$q = $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component = %s, type = %s, action = %s, content = %s, primary_link = %s, date_recorded = %s, item_id = %d, secondary_item_id = %d, hide_sitewide = %d, is_spam = %d WHERE id = %d", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam, $this->id );
|
229 |
-
|
230 |
$q = $wpdb->prepare( "INSERT INTO {$bp->activity->table_name} ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide, is_spam ) VALUES ( %d, %s, %s, %s, %s, %s, %s, %d, %d, %d, %d )", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam );
|
231 |
-
}
|
232 |
|
233 |
-
if ( false === $wpdb->query( $q ) )
|
234 |
return false;
|
235 |
-
}
|
236 |
|
237 |
// If this is a new activity item, set the $id property
|
238 |
-
if ( empty( $this->id ) )
|
239 |
$this->id = $wpdb->insert_id;
|
240 |
|
241 |
// If an existing activity item, prevent any changes to the content generating new @mention notifications.
|
242 |
-
|
243 |
add_filter( 'bp_activity_at_name_do_notifications', '__return_false' );
|
244 |
-
}
|
245 |
|
246 |
-
/**
|
247 |
-
* Fires after an activity item has been saved to the database.
|
248 |
-
*
|
249 |
-
* @since BuddyPress (1.0.0)
|
250 |
-
*
|
251 |
-
* @param BP_Activity_Activity Reference to current instance of activity being saved.
|
252 |
-
*/
|
253 |
do_action_ref_array( 'bp_activity_after_save', array( &$this ) );
|
254 |
|
255 |
return true;
|
@@ -267,34 +244,42 @@ class BP_Activity_Activity {
|
|
267 |
*
|
268 |
* @param array $args {
|
269 |
* An array of arguments. All items are optional.
|
270 |
-
*
|
271 |
-
*
|
272 |
-
*
|
273 |
-
* @type int|bool
|
274 |
-
* @type int|bool
|
275 |
-
*
|
276 |
-
* @type
|
277 |
-
* @type array
|
278 |
-
*
|
279 |
-
* @type array
|
280 |
-
*
|
281 |
-
* @type array
|
282 |
-
*
|
283 |
-
* @type array
|
284 |
-
*
|
285 |
-
*
|
286 |
-
* @type
|
287 |
-
* @type string
|
288 |
-
*
|
289 |
-
* @type
|
290 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
* }
|
292 |
* @return array The array returned has two keys:
|
293 |
* - 'total' is the count of located activities
|
294 |
* - 'activities' is an array of the located activities
|
295 |
*/
|
296 |
public static function get( $args = array() ) {
|
297 |
-
global $wpdb;
|
298 |
|
299 |
// Backward compatibility with old method of passing arguments
|
300 |
if ( !is_array( $args ) || func_num_args() > 1 ) {
|
@@ -318,8 +303,7 @@ class BP_Activity_Activity {
|
|
318 |
$args = bp_core_parse_args_array( $old_args_keys, $func_args );
|
319 |
}
|
320 |
|
321 |
-
$
|
322 |
-
$r = wp_parse_args( $args, array(
|
323 |
'page' => 1, // The current page
|
324 |
'per_page' => 25, // Activity items per page
|
325 |
'max' => false, // Max number of items to return
|
@@ -328,16 +312,16 @@ class BP_Activity_Activity {
|
|
328 |
'in' => false, // Array of ids to limit query by (IN)
|
329 |
'meta_query' => false, // Filter by activitymeta
|
330 |
'date_query' => false, // Filter by date
|
331 |
-
'filter_query' => false, // Advanced filtering - see BP_Activity_Query
|
332 |
'filter' => false, // See self::get_filter_sql()
|
333 |
-
'scope' => false, // Preset activity arguments
|
334 |
'search_terms' => false, // Terms to search by
|
335 |
'display_comments' => false, // Whether to include activity comments
|
336 |
'show_hidden' => false, // Show items marked hide_sitewide
|
337 |
'spam' => 'ham_only', // Spam status
|
338 |
'update_meta_cache' => true,
|
339 |
'count_total' => false,
|
340 |
-
)
|
|
|
|
|
341 |
|
342 |
// Select conditions
|
343 |
$select_sql = "SELECT DISTINCT a.id";
|
@@ -352,72 +336,44 @@ class BP_Activity_Activity {
|
|
352 |
// Excluded types
|
353 |
$excluded_types = array();
|
354 |
|
355 |
-
// Scope takes precedence
|
356 |
-
if ( ! empty( $r['scope'] ) ) {
|
357 |
-
$scope_query = self::get_scope_query_sql( $r['scope'], $r );
|
358 |
-
|
359 |
-
// Add our SQL conditions if matches were found
|
360 |
-
if ( ! empty( $scope_query['sql'] ) ) {
|
361 |
-
$where_conditions['scope_query_sql'] = $scope_query['sql'];
|
362 |
-
}
|
363 |
-
|
364 |
-
// override some arguments if needed
|
365 |
-
if ( ! empty( $scope_query['override'] ) ) {
|
366 |
-
$r = self::array_replace_recursive( $r, $scope_query['override'] );
|
367 |
-
}
|
368 |
-
|
369 |
-
// Advanced filtering
|
370 |
-
} elseif ( ! empty( $r['filter_query'] ) ) {
|
371 |
-
$filter_query = new BP_Activity_Query( $r['filter_query'] );
|
372 |
-
$sql = $filter_query->get_sql();
|
373 |
-
if ( ! empty( $sql ) ) {
|
374 |
-
$where_conditions['filter_query_sql'] = $sql;
|
375 |
-
}
|
376 |
-
}
|
377 |
-
|
378 |
-
// Regular filtering
|
379 |
-
if ( $r['filter'] && $filter_sql = BP_Activity_Activity::get_filter_sql( $r['filter'] ) ) {
|
380 |
-
$where_conditions['filter_sql'] = $filter_sql;
|
381 |
-
}
|
382 |
-
|
383 |
// Spam
|
384 |
-
if ( 'ham_only' == $
|
385 |
$where_conditions['spam_sql'] = 'a.is_spam = 0';
|
386 |
-
|
387 |
$where_conditions['spam_sql'] = 'a.is_spam = 1';
|
388 |
-
}
|
389 |
|
390 |
// Searching
|
391 |
-
if ( $
|
392 |
-
$search_terms_like = '%' . bp_esc_like( $
|
393 |
$where_conditions['search_sql'] = $wpdb->prepare( 'a.content LIKE %s', $search_terms_like );
|
394 |
}
|
395 |
|
|
|
|
|
|
|
|
|
396 |
// Sorting
|
397 |
-
$sort
|
398 |
-
if ( $sort != 'ASC' && $sort != 'DESC' ) {
|
399 |
$sort = 'DESC';
|
400 |
-
}
|
401 |
|
402 |
// Hide Hidden Items?
|
403 |
-
if (
|
404 |
$where_conditions['hidden_sql'] = "a.hide_sitewide = 0";
|
405 |
-
}
|
406 |
|
407 |
// Exclude specified items
|
408 |
-
if ( !
|
409 |
-
$exclude = implode( ',', wp_parse_id_list( $
|
410 |
$where_conditions['exclude'] = "a.id NOT IN ({$exclude})";
|
411 |
}
|
412 |
|
413 |
// The specific ids to which you want to limit the query
|
414 |
-
if ( !
|
415 |
-
$in = implode( ',', wp_parse_id_list( $
|
416 |
$where_conditions['in'] = "a.id IN ({$in})";
|
417 |
}
|
418 |
|
419 |
// Process meta_query into SQL
|
420 |
-
$meta_query_sql = self::get_meta_query_sql( $
|
421 |
|
422 |
if ( ! empty( $meta_query_sql['join'] ) ) {
|
423 |
$join_sql .= $meta_query_sql['join'];
|
@@ -428,7 +384,7 @@ class BP_Activity_Activity {
|
|
428 |
}
|
429 |
|
430 |
// Process date_query into SQL
|
431 |
-
$date_query_sql = self::get_date_query_sql( $
|
432 |
|
433 |
if ( ! empty( $date_query_sql ) ) {
|
434 |
$where_conditions['date'] = $date_query_sql;
|
@@ -437,45 +393,34 @@ class BP_Activity_Activity {
|
|
437 |
// Alter the query based on whether we want to show activity item
|
438 |
// comments in the stream like normal comments or threaded below
|
439 |
// the activity.
|
440 |
-
if ( false === $
|
441 |
$excluded_types[] = 'activity_comment';
|
442 |
}
|
443 |
|
444 |
// Exclude 'last_activity' items unless the 'action' filter has
|
445 |
// been explicitly set
|
446 |
-
if ( empty( $
|
447 |
$excluded_types[] = 'last_activity';
|
448 |
}
|
449 |
|
|
|
|
|
|
|
|
|
|
|
450 |
// Build the excluded type sql part
|
451 |
if ( ! empty( $excluded_types ) ) {
|
452 |
$not_in = "'" . implode( "', '", esc_sql( $excluded_types ) ) . "'";
|
453 |
$where_conditions['excluded_types'] = "a.type NOT IN ({$not_in})";
|
454 |
}
|
455 |
|
456 |
-
|
457 |
-
* Filters the MySQL WHERE conditions for the Activity items get method.
|
458 |
-
*
|
459 |
-
* @since BuddyPress (1.9.0)
|
460 |
-
*
|
461 |
-
* @param array $where_conditions Current conditions for MySQL WHERE statement.
|
462 |
-
* @param array $r Parsed arguments passed into method.
|
463 |
-
* @param string $select_sql Current SELECT MySQL statement at point of execution.
|
464 |
-
* @param string $from_sql Current FROM MySQL statement at point of execution.
|
465 |
-
* @param string $join_sql Current INNER JOIN MySQL statement at point of execution.
|
466 |
-
*/
|
467 |
$where_conditions = apply_filters( 'bp_activity_get_where_conditions', $where_conditions, $r, $select_sql, $from_sql, $join_sql );
|
468 |
|
469 |
// Join the where conditions together
|
470 |
$where_sql = 'WHERE ' . join( ' AND ', $where_conditions );
|
471 |
|
472 |
-
|
473 |
-
* Filters the preferred order of indexes for activity item.
|
474 |
-
*
|
475 |
-
* @since BuddyPress (1.6.0)
|
476 |
-
*
|
477 |
-
* @param array Array of indexes in preferred order.
|
478 |
-
*/
|
479 |
$indexes = apply_filters( 'bp_activity_preferred_index_order', array( 'user_id', 'item_id', 'secondary_item_id', 'date_recorded', 'component', 'type', 'hide_sitewide', 'is_spam' ) );
|
480 |
|
481 |
foreach( $indexes as $key => $index ) {
|
@@ -492,8 +437,8 @@ class BP_Activity_Activity {
|
|
492 |
}
|
493 |
|
494 |
// Sanitize page and per_page parameters
|
495 |
-
$page = absint( $
|
496 |
-
$per_page = absint( $
|
497 |
|
498 |
$retval = array(
|
499 |
'activities' => null,
|
@@ -501,17 +446,7 @@ class BP_Activity_Activity {
|
|
501 |
'has_more_items' => null,
|
502 |
);
|
503 |
|
504 |
-
|
505 |
-
* Filters if BuddyPress should use legacy query structure over current structure for version 2.0+.
|
506 |
-
*
|
507 |
-
* It is not recommended to use the legacy structure, but allowed to if needed.
|
508 |
-
*
|
509 |
-
* @since BuddyPress (2.0.0)
|
510 |
-
*
|
511 |
-
* @param bool Whether to use legacy structure or not.
|
512 |
-
* @param BP_Activity_Activity Current method being called.
|
513 |
-
* @param array $r Parsed arguments passed into method.
|
514 |
-
*/
|
515 |
if ( apply_filters( 'bp_use_legacy_activity_query', false, __METHOD__, $r ) ) {
|
516 |
|
517 |
// Legacy queries joined against the user table
|
@@ -520,27 +455,13 @@ class BP_Activity_Activity {
|
|
520 |
|
521 |
if ( ! empty( $page ) && ! empty( $per_page ) ) {
|
522 |
$pag_sql = $wpdb->prepare( "LIMIT %d, %d", absint( ( $page - 1 ) * $per_page ), $per_page );
|
523 |
-
|
524 |
-
/** this filter is documented in bp-activity/bp-activity-classes.php */
|
525 |
$activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) );
|
526 |
} else {
|
527 |
-
$
|
528 |
-
|
529 |
-
/**
|
530 |
-
* Filters the legacy MySQL query statement so plugins can alter before results are fetched.
|
531 |
-
*
|
532 |
-
* @since BuddyPress (1.5.0)
|
533 |
-
*
|
534 |
-
* @param string Concatenated MySQL statement pieces to be query results with for legacy query.
|
535 |
-
* @param string $select_sql Final SELECT MySQL statement portion for legacy query.
|
536 |
-
* @param string $from_sql Final FROM MySQL statement portion for legacy query.
|
537 |
-
* @param string $where_sql Final WHERE MySQL statement portion for legacy query.
|
538 |
-
* @param string $sort Final sort direction for legacy query.
|
539 |
-
*/
|
540 |
-
$activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) );
|
541 |
}
|
542 |
|
543 |
} else {
|
|
|
544 |
// Query first for activity IDs
|
545 |
$activity_ids_sql = "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}";
|
546 |
|
@@ -550,14 +471,6 @@ class BP_Activity_Activity {
|
|
550 |
$activity_ids_sql .= $wpdb->prepare( " LIMIT %d, %d", absint( ( $page - 1 ) * $per_page ), $per_page + 1 );
|
551 |
}
|
552 |
|
553 |
-
/**
|
554 |
-
* Filters the paged activities MySQL statement.
|
555 |
-
*
|
556 |
-
* @since BuddyPress (2.0.0)
|
557 |
-
*
|
558 |
-
* @param string $activity_ids_sql MySQL statement used to query for Activity IDs.
|
559 |
-
* @param array $r Array of arguments passed into method.
|
560 |
-
*/
|
561 |
$activity_ids_sql = apply_filters( 'bp_activity_paged_activities_sql', $activity_ids_sql, $r );
|
562 |
|
563 |
$activity_ids = $wpdb->get_col( $activity_ids_sql );
|
@@ -582,13 +495,12 @@ class BP_Activity_Activity {
|
|
582 |
$activity_ids[] = $activity->id;
|
583 |
}
|
584 |
|
585 |
-
if ( ! empty( $activity_ids ) && $
|
586 |
bp_activity_update_meta_cache( $activity_ids );
|
587 |
}
|
588 |
|
589 |
-
if ( $activities && $
|
590 |
-
$activities = BP_Activity_Activity::append_comments( $activities, $
|
591 |
-
}
|
592 |
|
593 |
// Pre-fetch data associated with activity users and other objects
|
594 |
BP_Activity_Activity::prefetch_object_data( $activities );
|
@@ -601,22 +513,12 @@ class BP_Activity_Activity {
|
|
601 |
// If $max is set, only return up to the max results
|
602 |
if ( ! empty( $r['count_total'] ) ) {
|
603 |
|
604 |
-
/**
|
605 |
-
* Filters the total activities MySQL statement.
|
606 |
-
*
|
607 |
-
* @since BuddyPress (1.5.0)
|
608 |
-
*
|
609 |
-
* @param string MySQL statement used to query for total activities.
|
610 |
-
* @param string $where_sql MySQL WHERE statement portion.
|
611 |
-
* @param string $sort sort direction for query.
|
612 |
-
*/
|
613 |
$total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$join_sql} {$where_sql}", $where_sql, $sort );
|
614 |
$total_activities = $wpdb->get_var( $total_activities_sql );
|
615 |
|
616 |
-
if ( !empty( $
|
617 |
-
if ( (int) $total_activities > (int) $
|
618 |
-
$total_activities = $
|
619 |
-
}
|
620 |
}
|
621 |
|
622 |
$retval['total'] = $total_activities;
|
@@ -737,14 +639,6 @@ class BP_Activity_Activity {
|
|
737 |
* @param array $activities Array of activities.
|
738 |
*/
|
739 |
protected static function prefetch_object_data( $activities ) {
|
740 |
-
|
741 |
-
/**
|
742 |
-
* Filters inside prefetch_object_data method to aid in pre-fetching object data associated with activity item.
|
743 |
-
*
|
744 |
-
* @since BuddyPress (2.0.0)
|
745 |
-
*
|
746 |
-
* @param array $activities Array of activities.
|
747 |
-
*/
|
748 |
return apply_filters( 'bp_activity_prefetch_object_data', $activities );
|
749 |
}
|
750 |
|
@@ -841,110 +735,6 @@ class BP_Activity_Activity {
|
|
841 |
return $sql;
|
842 |
}
|
843 |
|
844 |
-
/**
|
845 |
-
* Get the SQL for the 'scope' param in BP_Activity_Activity::get().
|
846 |
-
*
|
847 |
-
* A scope is a predetermined set of activity arguments. This method is used
|
848 |
-
* to grab these activity arguments and override any existing args if needed.
|
849 |
-
*
|
850 |
-
* Can handle multiple scopes.
|
851 |
-
*
|
852 |
-
* @since BuddyPress (2.2.0)
|
853 |
-
*
|
854 |
-
* @param mixed $scope The activity scope. Accepts string or array of scopes
|
855 |
-
* @param array $r Current activity arguments. Same as those of BP_Activity_Activity::get(),
|
856 |
-
* but merged with defaults.
|
857 |
-
* @return array 'sql' WHERE SQL string and 'override' activity args
|
858 |
-
*/
|
859 |
-
public static function get_scope_query_sql( $scope = false, $r = array() ) {
|
860 |
-
|
861 |
-
// Define arrays for future use
|
862 |
-
$query_args = array();
|
863 |
-
$override = array();
|
864 |
-
$retval = array();
|
865 |
-
|
866 |
-
// Check for array of scopes
|
867 |
-
if ( is_array( $scope ) ) {
|
868 |
-
$scopes = $scope;
|
869 |
-
|
870 |
-
// Explode a comma separated string of scopes
|
871 |
-
} elseif ( is_string( $scope ) ) {
|
872 |
-
$scopes = explode( ',', $scope );
|
873 |
-
}
|
874 |
-
|
875 |
-
// Bail if no scope passed
|
876 |
-
if ( empty( $scopes ) ) {
|
877 |
-
return false;
|
878 |
-
}
|
879 |
-
|
880 |
-
// Helper to easily grab the 'user_id'
|
881 |
-
if ( ! empty( $r['filter']['user_id'] ) ) {
|
882 |
-
$r['user_id'] = $r['filter']['user_id'];
|
883 |
-
}
|
884 |
-
|
885 |
-
// parse each scope; yes! we handle multiples!
|
886 |
-
foreach ( $scopes as $scope ) {
|
887 |
-
$scope_args = array();
|
888 |
-
|
889 |
-
/**
|
890 |
-
* Plugins can hook here to set their activity arguments for custom scopes.
|
891 |
-
*
|
892 |
-
* This is a dynamic filter based on the activity scope. eg:
|
893 |
-
* - 'bp_activity_set_groups_scope_args'
|
894 |
-
* - 'bp_activity_set_friends_scope_args'
|
895 |
-
*
|
896 |
-
* To see how this filter is used, plugin devs should check out:
|
897 |
-
* - bp_groups_filter_activity_scope() - used for 'groups' scope
|
898 |
-
* - bp_friends_filter_activity_scope() - used for 'friends' scope
|
899 |
-
*
|
900 |
-
* @since BuddyPress (2.2.0)
|
901 |
-
*
|
902 |
-
* @param array {
|
903 |
-
* Activity query clauses.
|
904 |
-
*
|
905 |
-
* @type array {
|
906 |
-
* Activity arguments for your custom scope.
|
907 |
-
* See {@link BP_Activity_Query::_construct()} for more details.
|
908 |
-
* }
|
909 |
-
* @type array $override Optional. Override existing activity arguments passed by $r.
|
910 |
-
* }
|
911 |
-
* @param array $r Current activity arguments passed in BP_Activity_Activity::get()
|
912 |
-
*/
|
913 |
-
$scope_args = apply_filters( "bp_activity_set_{$scope}_scope_args", array(), $r );
|
914 |
-
|
915 |
-
if ( ! empty( $scope_args ) ) {
|
916 |
-
// merge override properties from other scopes
|
917 |
-
// this might be a problem...
|
918 |
-
if ( ! empty( $scope_args['override'] ) ) {
|
919 |
-
$override = array_merge( $override, $scope_args['override'] );
|
920 |
-
unset( $scope_args['override'] );
|
921 |
-
}
|
922 |
-
|
923 |
-
// save scope args
|
924 |
-
if ( ! empty( $scope_args ) ) {
|
925 |
-
$query_args[] = $scope_args;
|
926 |
-
}
|
927 |
-
}
|
928 |
-
}
|
929 |
-
|
930 |
-
if ( ! empty( $query_args ) ) {
|
931 |
-
// set relation to OR
|
932 |
-
$query_args['relation'] = 'OR';
|
933 |
-
|
934 |
-
$query = new BP_Activity_Query( $query_args );
|
935 |
-
$sql = $query->get_sql();
|
936 |
-
if ( ! empty( $sql ) ) {
|
937 |
-
$retval['sql'] = $sql;
|
938 |
-
}
|
939 |
-
}
|
940 |
-
|
941 |
-
if ( ! empty( $override ) ) {
|
942 |
-
$retval['override'] = $override;
|
943 |
-
}
|
944 |
-
|
945 |
-
return $retval;
|
946 |
-
}
|
947 |
-
|
948 |
/**
|
949 |
* In BuddyPress 1.2.x, this was used to retrieve specific activity stream items (for example, on an activity's permalink page).
|
950 |
*
|
@@ -971,64 +761,51 @@ class BP_Activity_Activity {
|
|
971 |
/**
|
972 |
* Get the first activity ID that matches a set of criteria.
|
973 |
*
|
974 |
-
* @param int
|
975 |
-
* @param string $component
|
976 |
-
* @param string $type
|
977 |
-
* @param int
|
978 |
-
* @param int
|
979 |
-
* @param string $action
|
980 |
-
* @param string $content
|
981 |
-
* @param string $date_recorded
|
982 |
-
*
|
983 |
-
* @todo Should parameters be optional?
|
984 |
-
*
|
985 |
* @return int|bool Activity ID on success, false if none is found.
|
986 |
*/
|
987 |
public static function get_id( $user_id, $component, $type, $item_id, $secondary_item_id, $action, $content, $date_recorded ) {
|
988 |
-
global $wpdb;
|
989 |
-
|
990 |
-
$bp = buddypress();
|
991 |
|
992 |
$where_args = false;
|
993 |
|
994 |
-
if ( !
|
995 |
$where_args[] = $wpdb->prepare( "user_id = %d", $user_id );
|
996 |
-
}
|
997 |
|
998 |
-
if ( !
|
999 |
$where_args[] = $wpdb->prepare( "component = %s", $component );
|
1000 |
-
}
|
1001 |
|
1002 |
-
if ( !
|
1003 |
$where_args[] = $wpdb->prepare( "type = %s", $type );
|
1004 |
-
}
|
1005 |
|
1006 |
-
if ( !
|
1007 |
$where_args[] = $wpdb->prepare( "item_id = %d", $item_id );
|
1008 |
-
}
|
1009 |
|
1010 |
-
if ( !
|
1011 |
$where_args[] = $wpdb->prepare( "secondary_item_id = %d", $secondary_item_id );
|
1012 |
-
}
|
1013 |
|
1014 |
-
if ( !
|
1015 |
$where_args[] = $wpdb->prepare( "action = %s", $action );
|
1016 |
-
}
|
1017 |
|
1018 |
-
if ( !
|
1019 |
$where_args[] = $wpdb->prepare( "content = %s", $content );
|
1020 |
-
}
|
1021 |
|
1022 |
-
if ( !
|
1023 |
$where_args[] = $wpdb->prepare( "date_recorded = %s", $date_recorded );
|
1024 |
-
}
|
1025 |
|
1026 |
-
if ( !
|
1027 |
$where_sql = 'WHERE ' . join( ' AND ', $where_args );
|
1028 |
-
|
1029 |
-
|
1030 |
|
1031 |
-
return
|
1032 |
}
|
1033 |
|
1034 |
/**
|
@@ -1055,9 +832,7 @@ class BP_Activity_Activity {
|
|
1055 |
* @return array|bool An array of deleted activity IDs on success, false on failure.
|
1056 |
*/
|
1057 |
public static function delete( $args = array() ) {
|
1058 |
-
global $wpdb;
|
1059 |
-
|
1060 |
-
$bp = buddypress();
|
1061 |
|
1062 |
$defaults = array(
|
1063 |
'id' => false,
|
@@ -1158,11 +933,10 @@ class BP_Activity_Activity {
|
|
1158 |
* @return bool True on success.
|
1159 |
*/
|
1160 |
public static function delete_activity_item_comments( $activity_ids = array(), $delete_meta = true ) {
|
1161 |
-
global $wpdb;
|
1162 |
|
1163 |
-
$
|
1164 |
|
1165 |
-
$delete_meta = (bool) $delete_meta;
|
1166 |
$activity_ids = implode( ',', wp_parse_id_list( $activity_ids ) );
|
1167 |
|
1168 |
if ( $delete_meta ) {
|
@@ -1230,6 +1004,7 @@ class BP_Activity_Activity {
|
|
1230 |
*
|
1231 |
* @since BuddyPress (1.2)
|
1232 |
*
|
|
|
1233 |
* @global wpdb $wpdb WordPress database object.
|
1234 |
*
|
1235 |
* @param int $activity_id Activity ID to fetch comments for.
|
@@ -1240,7 +1015,7 @@ class BP_Activity_Activity {
|
|
1240 |
* @return array The updated activities with nested comments.
|
1241 |
*/
|
1242 |
public static function get_activity_comments( $activity_id, $left, $right, $spam = 'ham_only', $top_level_parent_id = 0 ) {
|
1243 |
-
global $wpdb;
|
1244 |
|
1245 |
if ( empty( $top_level_parent_id ) ) {
|
1246 |
$top_level_parent_id = $activity_id;
|
@@ -1254,9 +1029,7 @@ class BP_Activity_Activity {
|
|
1254 |
$comments = false;
|
1255 |
|
1256 |
// A true cache miss
|
1257 |
-
}
|
1258 |
-
|
1259 |
-
$bp = buddypress();
|
1260 |
|
1261 |
// Select the user's fullname with the query
|
1262 |
if ( bp_is_active( 'xprofile' ) ) {
|
@@ -1280,29 +1053,7 @@ class BP_Activity_Activity {
|
|
1280 |
|
1281 |
// Legacy query - not recommended
|
1282 |
$func_args = func_get_args();
|
1283 |
-
|
1284 |
-
/**
|
1285 |
-
* Filters if BuddyPress should use the legacy activity query.
|
1286 |
-
*
|
1287 |
-
* @since BuddyPress (2.0.0)
|
1288 |
-
*
|
1289 |
-
* @param bool Whether or not to use the legacy query.
|
1290 |
-
* @param BP_Activity_Activity Magic method referring to currently called method.
|
1291 |
-
* @param array $func_args Array of the method's argument list.
|
1292 |
-
*/
|
1293 |
if ( apply_filters( 'bp_use_legacy_activity_query', false, __METHOD__, $func_args ) ) {
|
1294 |
-
|
1295 |
-
/**
|
1296 |
-
* Filters the MySQL prepared statement for the legacy activity query.
|
1297 |
-
*
|
1298 |
-
* @since BuddyPress (1.5.0)
|
1299 |
-
*
|
1300 |
-
* @param string Prepared statement for the activity query.
|
1301 |
-
* @param int $activity_id Activity ID to fetch comments for.
|
1302 |
-
* @param int $left Left-most node boundary.
|
1303 |
-
* @param int $right Right-most node boundary.
|
1304 |
-
* @param string $spam_sql SQL Statement portion to differentiate between ham or spam.
|
1305 |
-
*/
|
1306 |
$sql = apply_filters( 'bp_activity_comments_user_join_filter', $wpdb->prepare( "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp->activity->table_name} a, {$wpdb->users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.type = 'activity_comment' {$spam_sql} AND a.item_id = %d AND a.mptt_left > %d AND a.mptt_left < %d ORDER BY a.date_recorded ASC", $top_level_parent_id, $left, $right ), $activity_id, $left, $right, $spam_sql );
|
1307 |
|
1308 |
$descendants = $wpdb->get_results( $sql );
|
@@ -1384,39 +1135,35 @@ class BP_Activity_Activity {
|
|
1384 |
*
|
1385 |
* @since BuddyPress (1.2)
|
1386 |
*
|
1387 |
-
* @global
|
|
|
1388 |
*
|
1389 |
-
* @param
|
1390 |
-
* @param
|
1391 |
-
* @return int Right
|
1392 |
*/
|
1393 |
public static function rebuild_activity_comment_tree( $parent_id, $left = 1 ) {
|
1394 |
-
global $wpdb;
|
1395 |
-
|
1396 |
-
$bp = buddypress();
|
1397 |
|
1398 |
// The right value of this node is the left value + 1
|
1399 |
-
$right =
|
1400 |
|
1401 |
// Get all descendants of this node
|
1402 |
-
$
|
1403 |
-
$descendants = wp_list_pluck( $comments, 'id' );
|
1404 |
|
1405 |
// Loop the descendants and recalculate the left and right values
|
1406 |
-
foreach ( (array) $descendants as $
|
1407 |
-
$right = BP_Activity_Activity::rebuild_activity_comment_tree( $
|
1408 |
-
}
|
1409 |
|
1410 |
// We've got the left value, and now that we've processed the children
|
1411 |
// of this node we also know the right value
|
1412 |
-
if ( 1
|
1413 |
$wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE id = %d", $left, $right, $parent_id ) );
|
1414 |
-
|
1415 |
$wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE type = 'activity_comment' AND id = %d", $left, $right, $parent_id ) );
|
1416 |
-
}
|
1417 |
|
1418 |
// Return the right value of this node + 1
|
1419 |
-
return
|
1420 |
}
|
1421 |
|
1422 |
/**
|
@@ -1424,15 +1171,14 @@ class BP_Activity_Activity {
|
|
1424 |
*
|
1425 |
* @since BuddyPress (1.2)
|
1426 |
*
|
|
|
1427 |
* @global wpdb $wpdb WordPress database object.
|
1428 |
*
|
1429 |
-
* @param int $parent_id ID of an
|
1430 |
* @return object Numerically indexed array of child comments.
|
1431 |
*/
|
1432 |
public static function get_child_comments( $parent_id ) {
|
1433 |
-
global $wpdb;
|
1434 |
-
|
1435 |
-
$bp = buddypress();
|
1436 |
|
1437 |
return $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND secondary_item_id = %d", $parent_id ) );
|
1438 |
}
|
@@ -1448,11 +1194,9 @@ class BP_Activity_Activity {
|
|
1448 |
* @return array List of component names.
|
1449 |
*/
|
1450 |
public static function get_recorded_components( $skip_last_activity = true ) {
|
1451 |
-
global $wpdb;
|
1452 |
-
|
1453 |
-
$bp = buddypress();
|
1454 |
|
1455 |
-
if (
|
1456 |
$components = $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} WHERE action != '' AND action != 'last_activity' ORDER BY component ASC" );
|
1457 |
} else {
|
1458 |
$components = $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" );
|
@@ -1604,9 +1348,7 @@ class BP_Activity_Activity {
|
|
1604 |
* @return string ISO timestamp.
|
1605 |
*/
|
1606 |
public static function get_last_updated() {
|
1607 |
-
global $wpdb;
|
1608 |
-
|
1609 |
-
$bp = buddypress();
|
1610 |
|
1611 |
return $wpdb->get_var( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded DESC LIMIT 1" );
|
1612 |
}
|
@@ -1620,15 +1362,10 @@ class BP_Activity_Activity {
|
|
1620 |
* @return int A count of the user's favorites.
|
1621 |
*/
|
1622 |
public static function total_favorite_count( $user_id ) {
|
|
|
|
|
1623 |
|
1624 |
-
|
1625 |
-
$favorite_activity_entries = bp_get_user_meta( $user_id, 'bp_favorite_activities', true );
|
1626 |
-
if ( ! empty( $favorite_activity_entries ) ) {
|
1627 |
-
return count( maybe_unserialize( $favorite_activity_entries ) );
|
1628 |
-
}
|
1629 |
-
|
1630 |
-
// No favorites
|
1631 |
-
return 0;
|
1632 |
}
|
1633 |
|
1634 |
/**
|
@@ -1638,9 +1375,7 @@ class BP_Activity_Activity {
|
|
1638 |
* @return int|bool The ID of the first matching item if found, otherwise false.
|
1639 |
*/
|
1640 |
public static function check_exists_by_content( $content ) {
|
1641 |
-
global $wpdb;
|
1642 |
-
|
1643 |
-
$bp = buddypress();
|
1644 |
|
1645 |
return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE content = %s", $content ) );
|
1646 |
}
|
@@ -1652,309 +1387,10 @@ class BP_Activity_Activity {
|
|
1652 |
* @param int
|
1653 |
*/
|
1654 |
public static function hide_all_for_user( $user_id ) {
|
1655 |
-
global $wpdb;
|
1656 |
-
|
1657 |
-
$bp = buddypress();
|
1658 |
|
1659 |
return $wpdb->get_var( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET hide_sitewide = 1 WHERE user_id = %d", $user_id ) );
|
1660 |
}
|
1661 |
-
|
1662 |
-
/**
|
1663 |
-
* PHP-agnostic version of {@link array_replace_recursive()}.
|
1664 |
-
*
|
1665 |
-
* array_replace_recursive() is a PHP 5.3 function. BuddyPress (and
|
1666 |
-
* WordPress) currently supports down to PHP 5.2, so this method is a workaround
|
1667 |
-
* for PHP 5.2.
|
1668 |
-
*
|
1669 |
-
* Note: array_replace_recursive() supports infinite arguments, but for our use-
|
1670 |
-
* case, we only need to support two arguments.
|
1671 |
-
*
|
1672 |
-
* Subject to removal once WordPress makes PHP 5.3.0 the minimum requirement.
|
1673 |
-
*
|
1674 |
-
* @since BuddyPress (2.2.0)
|
1675 |
-
*
|
1676 |
-
* @see http://php.net/manual/en/function.array-replace-recursive.php#109390
|
1677 |
-
*
|
1678 |
-
* @param array $base Array with keys needing to be replaced
|
1679 |
-
* @param array $replacements Array with the replaced keys
|
1680 |
-
* @return array
|
1681 |
-
*/
|
1682 |
-
protected static function array_replace_recursive( $base = array(), $replacements = array() ) {
|
1683 |
-
if ( function_exists( 'array_replace_recursive' ) ) {
|
1684 |
-
return array_replace_recursive( $base, $replacements );
|
1685 |
-
}
|
1686 |
-
|
1687 |
-
// PHP 5.2-compatible version
|
1688 |
-
// http://php.net/manual/en/function.array-replace-recursive.php#109390
|
1689 |
-
foreach ( array_slice( func_get_args(), 1 ) as $replacements ) {
|
1690 |
-
$bref_stack = array( &$base );
|
1691 |
-
$head_stack = array( $replacements );
|
1692 |
-
|
1693 |
-
do {
|
1694 |
-
end( $bref_stack );
|
1695 |
-
|
1696 |
-
$bref = &$bref_stack[ key( $bref_stack ) ];
|
1697 |
-
$head = array_pop( $head_stack );
|
1698 |
-
|
1699 |
-
unset( $bref_stack[ key($bref_stack) ] );
|
1700 |
-
|
1701 |
-
foreach ( array_keys( $head ) as $key ) {
|
1702 |
-
if ( isset( $key, $bref ) && is_array( $bref[$key] ) && is_array( $head[$key] ) ) {
|
1703 |
-
$bref_stack[] = &$bref[ $key ];
|
1704 |
-
$head_stack[] = $head[ $key ];
|
1705 |
-
} else {
|
1706 |
-
$bref[ $key ] = $head[ $key ];
|
1707 |
-
}
|
1708 |
-
}
|
1709 |
-
} while( count( $head_stack ) );
|
1710 |
-
}
|
1711 |
-
|
1712 |
-
return $base;
|
1713 |
-
}
|
1714 |
-
}
|
1715 |
-
|
1716 |
-
/**
|
1717 |
-
* Class for generating the WHERE SQL clause for advanced activity fetching.
|
1718 |
-
*
|
1719 |
-
* This is notably used in {@link BP_Activity_Activity::get()} with the
|
1720 |
-
* 'filter_query' parameter.
|
1721 |
-
*
|
1722 |
-
* @since BuddyPress (2.2.0)
|
1723 |
-
*/
|
1724 |
-
class BP_Activity_Query extends BP_Recursive_Query {
|
1725 |
-
/**
|
1726 |
-
* Array of activity queries.
|
1727 |
-
*
|
1728 |
-
* See {@see BP_Activity_Query::__construct()} for information on query arguments.
|
1729 |
-
*
|
1730 |
-
* @since BuddyPress (2.2.0)
|
1731 |
-
* @access public
|
1732 |
-
* @var array
|
1733 |
-
*/
|
1734 |
-
public $queries = array();
|
1735 |
-
|
1736 |
-
/**
|
1737 |
-
* Table alias.
|
1738 |
-
*
|
1739 |
-
* @since BuddyPress (2.2.0)
|
1740 |
-
* @access public
|
1741 |
-
* @var string
|
1742 |
-
*/
|
1743 |
-
public $table_alias = '';
|
1744 |
-
|
1745 |
-
/**
|
1746 |
-
* Supported DB columns.
|
1747 |
-
*
|
1748 |
-
* See the 'wp_bp_activity' DB table schema.
|
1749 |
-
*
|
1750 |
-
* @since BuddyPress (2.2.0)
|
1751 |
-
* @access public
|
1752 |
-
* @var array
|
1753 |
-
*/
|
1754 |
-
public $db_columns = array(
|
1755 |
-
'id', 'user_id', 'component', 'type', 'action', 'content',
|
1756 |
-
'item_id', 'secondary_item_id', 'hide_sitewide', 'is_spam',
|
1757 |
-
);
|
1758 |
-
|
1759 |
-
/**
|
1760 |
-
* Constructor.
|
1761 |
-
*
|
1762 |
-
* @since BuddyPress (2.2.0)
|
1763 |
-
*
|
1764 |
-
* @param array $query {
|
1765 |
-
* Array of query clauses.
|
1766 |
-
*
|
1767 |
-
* @type array {
|
1768 |
-
* @type string $column Required. The column to query against. Basically, any DB column in the main
|
1769 |
-
* 'wp_bp_activity' table.
|
1770 |
-
* @type string $value Required. Value to filter by.
|
1771 |
-
* @type string $compare Optional. The comparison operator. Default '='.
|
1772 |
-
* Accepts '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', 'LIKE',
|
1773 |
-
* 'NOT LIKE', BETWEEN', 'NOT BETWEEN', 'REGEXP', 'NOT REGEXP', 'RLIKE'
|
1774 |
-
* @type string $relation Optional. The boolean relationship between the activity queries.
|
1775 |
-
* Accepts 'OR', 'AND'. Default 'AND'.
|
1776 |
-
* @type array {
|
1777 |
-
* Optional. Another fully-formed activity query. See parameters above.
|
1778 |
-
* }
|
1779 |
-
* }
|
1780 |
-
* }
|
1781 |
-
*/
|
1782 |
-
public function __construct( $query = array() ) {
|
1783 |
-
if ( ! is_array( $query ) ) {
|
1784 |
-
return;
|
1785 |
-
}
|
1786 |
-
|
1787 |
-
$this->queries = $this->sanitize_query( $query );
|
1788 |
-
}
|
1789 |
-
|
1790 |
-
/**
|
1791 |
-
* Generates WHERE SQL clause to be appended to a main query.
|
1792 |
-
*
|
1793 |
-
* @since BuddyPress (2.2.0)
|
1794 |
-
* @access public
|
1795 |
-
*
|
1796 |
-
* @param string $alias An existing table alias that is compatible with the current query clause.
|
1797 |
-
* Default: 'a'. BP_Activity_Activity::get() uses 'a', so we default to that.
|
1798 |
-
* @return string SQL fragment to append to the main WHERE clause.
|
1799 |
-
*/
|
1800 |
-
public function get_sql( $alias = 'a' ) {
|
1801 |
-
if ( ! empty( $alias ) ) {
|
1802 |
-
$this->table_alias = sanitize_title( $alias );
|
1803 |
-
}
|
1804 |
-
|
1805 |
-
$sql = $this->get_sql_clauses();
|
1806 |
-
|
1807 |
-
// we only need the 'where' clause
|
1808 |
-
//
|
1809 |
-
// also trim trailing "AND" clause from parent BP_Recursive_Query class
|
1810 |
-
// since it's not necessary for our needs
|
1811 |
-
return preg_replace( '/^\sAND/', '', $sql['where'] );
|
1812 |
-
}
|
1813 |
-
|
1814 |
-
/**
|
1815 |
-
* Generate WHERE clauses for a first-order clause.
|
1816 |
-
*
|
1817 |
-
* @since BuddyPress (2.2.0)
|
1818 |
-
* @access protected
|
1819 |
-
*
|
1820 |
-
* @param array $clause Array of arguments belonging to the clause.
|
1821 |
-
* @param array $parent_query Parent query to which the clause belongs.
|
1822 |
-
* @return array {
|
1823 |
-
* @type array $where Array of subclauses for the WHERE statement.
|
1824 |
-
* @type array $join Empty array. Not used.
|
1825 |
-
* }
|
1826 |
-
*/
|
1827 |
-
protected function get_sql_for_clause( $clause, $parent_query ) {
|
1828 |
-
global $wpdb;
|
1829 |
-
|
1830 |
-
$sql_chunks = array(
|
1831 |
-
'where' => array(),
|
1832 |
-
'join' => array(),
|
1833 |
-
);
|
1834 |
-
|
1835 |
-
$column = isset( $clause['column'] ) ? $this->validate_column( $clause['column'] ) : '';
|
1836 |
-
$value = isset( $clause['value'] ) ? $clause['value'] : '';
|
1837 |
-
if ( empty( $column ) || ! isset( $clause['value'] ) ) {
|
1838 |
-
return $sql_chunks;
|
1839 |
-
}
|
1840 |
-
|
1841 |
-
if ( isset( $clause['compare'] ) ) {
|
1842 |
-
$clause['compare'] = strtoupper( $clause['compare'] );
|
1843 |
-
} else {
|
1844 |
-
$clause['compare'] = isset( $clause['value'] ) && is_array( $clause['value'] ) ? 'IN' : '=';
|
1845 |
-
}
|
1846 |
-
|
1847 |
-
// default 'compare' to '=' if no valid operator is found
|
1848 |
-
if ( ! in_array( $clause['compare'], array(
|
1849 |
-
'=', '!=', '>', '>=', '<', '<=',
|
1850 |
-
'LIKE', 'NOT LIKE',
|
1851 |
-
'IN', 'NOT IN',
|
1852 |
-
'BETWEEN', 'NOT BETWEEN',
|
1853 |
-
'REGEXP', 'NOT REGEXP', 'RLIKE'
|
1854 |
-
) ) ) {
|
1855 |
-
$clause['compare'] = '=';
|
1856 |
-
}
|
1857 |
-
|
1858 |
-
$compare = $clause['compare'];
|
1859 |
-
|
1860 |
-
$alias = ! empty( $this->table_alias ) ? "{$this->table_alias}." : '';
|
1861 |
-
|
1862 |
-
// Next, Build the WHERE clause.
|
1863 |
-
$where = '';
|
1864 |
-
|
1865 |
-
// value.
|
1866 |
-
if ( isset( $clause['value'] ) ) {
|
1867 |
-
if ( in_array( $compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) {
|
1868 |
-
if ( ! is_array( $value ) ) {
|
1869 |
-
$value = preg_split( '/[,\s]+/', $value );
|
1870 |
-
}
|
1871 |
-
}
|
1872 |
-
|
1873 |
-
// tinyint
|
1874 |
-
if ( ! empty( $column ) && true === in_array( $column, array( 'hide_sitewide', 'is_spam' ) ) ) {
|
1875 |
-
$sql_chunks['where'][] = $wpdb->prepare( "{$alias}{$column} = %d", $value );
|
1876 |
-
|
1877 |
-
} else {
|
1878 |
-
switch ( $compare ) {
|
1879 |
-
// IN uses different syntax
|
1880 |
-
case 'IN' :
|
1881 |
-
case 'NOT IN' :
|
1882 |
-
$in_sql = BP_Activity_Activity::get_in_operator_sql( "{$alias}{$column}", $value );
|
1883 |
-
|
1884 |
-
// 'NOT IN' operator is as easy as a string replace!
|
1885 |
-
if ( 'NOT IN' === $compare ) {
|
1886 |
-
$in_sql = str_replace( 'IN', 'NOT IN', $in_sql );
|
1887 |
-
}
|
1888 |
-
|
1889 |
-
$sql_chunks['where'][] = $in_sql;
|
1890 |
-
break;
|
1891 |
-
|
1892 |
-
case 'BETWEEN' :
|
1893 |
-
case 'NOT BETWEEN' :
|
1894 |
-
$value = array_slice( $value, 0, 2 );
|
1895 |
-
$where = $wpdb->prepare( '%s AND %s', $value );
|
1896 |
-
break;
|
1897 |
-
|
1898 |
-
case 'LIKE' :
|
1899 |
-
case 'NOT LIKE' :
|
1900 |
-
$value = '%' . bp_esc_like( $value ) . '%';
|
1901 |
-
$where = $wpdb->prepare( '%s', $value );
|
1902 |
-
break;
|
1903 |
-
|
1904 |
-
default :
|
1905 |
-
$where = $wpdb->prepare( '%s', $value );
|
1906 |
-
break;
|
1907 |
-
|
1908 |
-
}
|
1909 |
-
}
|
1910 |
-
|
1911 |
-
if ( $where ) {
|
1912 |
-
$sql_chunks['where'][] = "{$alias}{$column} {$compare} {$where}";
|
1913 |
-
}
|
1914 |
-
}
|
1915 |
-
|
1916 |
-
/*
|
1917 |
-
* Multiple WHERE clauses should be joined in parentheses.
|
1918 |
-
*/
|
1919 |
-
if ( 1 < count( $sql_chunks['where'] ) ) {
|
1920 |
-
$sql_chunks['where'] = array( '( ' . implode( ' AND ', $sql_chunks['where'] ) . ' )' );
|
1921 |
-
}
|
1922 |
-
|
1923 |
-
return $sql_chunks;
|
1924 |
-
}
|
1925 |
-
|
1926 |
-
/**
|
1927 |
-
* Determine whether a clause is first-order.
|
1928 |
-
*
|
1929 |
-
* @since BuddyPress (2.2.0)
|
1930 |
-
* @access protected
|
1931 |
-
*
|
1932 |
-
* @param array $query Clause to check.
|
1933 |
-
* @return bool
|
1934 |
-
*/
|
1935 |
-
protected function is_first_order_clause( $query ) {
|
1936 |
-
return isset( $query['column'] ) || isset( $query['value'] );
|
1937 |
-
}
|
1938 |
-
|
1939 |
-
/**
|
1940 |
-
* Validates a column name parameter.
|
1941 |
-
*
|
1942 |
-
* Column names are checked against a whitelist of known tables.
|
1943 |
-
* See {@link BP_Activity_Query::db_tables}.
|
1944 |
-
*
|
1945 |
-
* @since BuddyPress (2.2.0)
|
1946 |
-
* @access public
|
1947 |
-
*
|
1948 |
-
* @param string $column The user-supplied column name.
|
1949 |
-
* @return string A validated column name value.
|
1950 |
-
*/
|
1951 |
-
public function validate_column( $column = '' ) {
|
1952 |
-
if ( in_array( $column, $this->db_columns ) ) {
|
1953 |
-
return $column;
|
1954 |
-
} else {
|
1955 |
-
return '';
|
1956 |
-
}
|
1957 |
-
}
|
1958 |
}
|
1959 |
|
1960 |
/**
|
@@ -2013,14 +1449,7 @@ class BP_Activity_Feed {
|
|
2013 |
* @param array $args Optional
|
2014 |
*/
|
2015 |
public function __construct( $args = array() ) {
|
2016 |
-
|
2017 |
-
/**
|
2018 |
-
* Filters if BuddyPress should consider feeds enabled. If disabled, it will return early.
|
2019 |
-
*
|
2020 |
-
* @since BuddyPress (1.8.0)
|
2021 |
-
*
|
2022 |
-
* @param bool true Default true aka feeds are enabled.
|
2023 |
-
*/
|
2024 |
if ( false === (bool) apply_filters( 'bp_activity_enable_feeds', true ) ) {
|
2025 |
global $wp_query;
|
2026 |
|
@@ -2066,13 +1495,7 @@ class BP_Activity_Feed {
|
|
2066 |
'activity_args' => array()
|
2067 |
) );
|
2068 |
|
2069 |
-
|
2070 |
-
* Fires before the feed is setup so plugins can modify.
|
2071 |
-
*
|
2072 |
-
* @since BuddyPress (1.8.0)
|
2073 |
-
*
|
2074 |
-
* @param BP_Activity_Feed Reference to current instance of activity feed.
|
2075 |
-
*/
|
2076 |
do_action_ref_array( 'bp_activity_feed_prefetch', array( &$this ) );
|
2077 |
|
2078 |
// Setup class properties
|
@@ -2084,13 +1507,7 @@ class BP_Activity_Feed {
|
|
2084 |
return false;
|
2085 |
}
|
2086 |
|
2087 |
-
|
2088 |
-
* Fires after the feed is setup so plugins can modify.
|
2089 |
-
*
|
2090 |
-
* @since BuddyPress (1.8.0)
|
2091 |
-
*
|
2092 |
-
* @param BP_Activity_Feed Reference to current instance of activity feed.
|
2093 |
-
*/
|
2094 |
do_action_ref_array( 'bp_activity_feed_postfetch', array( &$this ) );
|
2095 |
|
2096 |
// Setup feed hooks
|
@@ -2147,14 +1564,6 @@ class BP_Activity_Feed {
|
|
2147 |
* Fire a hook to ensure backward compatibility for RSS attributes.
|
2148 |
*/
|
2149 |
public function backpat_rss_attributes() {
|
2150 |
-
|
2151 |
-
/**
|
2152 |
-
* Fires inside backpat_rss_attributes method for backwards compatibility related to RSS attributes.
|
2153 |
-
*
|
2154 |
-
* This hook was originally separated out for individual components but has since been abstracted into the BP_Activity_Feed class.
|
2155 |
-
*
|
2156 |
-
* @since BuddyPress (1.0.0)
|
2157 |
-
*/
|
2158 |
do_action( 'bp_activity_' . $this->id . '_feed' );
|
2159 |
}
|
2160 |
|
@@ -2162,14 +1571,6 @@ class BP_Activity_Feed {
|
|
2162 |
* Fire a hook to ensure backward compatibility for channel elements.
|
2163 |
*/
|
2164 |
public function backpat_channel_elements() {
|
2165 |
-
|
2166 |
-
/**
|
2167 |
-
* Fires inside backpat_channel_elements method for backwards compatibility related to RSS channel elements.
|
2168 |
-
*
|
2169 |
-
* This hook was originally separated out for individual components but has since been abstracted into the BP_Activity_Feed class.
|
2170 |
-
*
|
2171 |
-
* @since BuddyPress (1.0.0)
|
2172 |
-
*/
|
2173 |
do_action( 'bp_activity_' . $this->id . '_feed_head' );
|
2174 |
}
|
2175 |
|
@@ -2192,13 +1593,6 @@ class BP_Activity_Feed {
|
|
2192 |
break;
|
2193 |
}
|
2194 |
|
2195 |
-
/**
|
2196 |
-
* Fires inside backpat_item_elements method for backwards compatibility related to RSS item elements.
|
2197 |
-
*
|
2198 |
-
* This hook was originally separated out for individual components but has since been abstracted into the BP_Activity_Feed class.
|
2199 |
-
*
|
2200 |
-
* @since BuddyPress (1.0.0)
|
2201 |
-
*/
|
2202 |
do_action( 'bp_activity_' . $id . '_feed_item' );
|
2203 |
}
|
2204 |
|
@@ -2252,7 +1646,6 @@ class BP_Activity_Feed {
|
|
2252 |
|
2253 |
// Set content-type
|
2254 |
@header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
|
2255 |
-
send_nosniff_header();
|
2256 |
|
2257 |
// Cache-related variables
|
2258 |
$last_modified = mysql2date( 'D, d M Y H:i:s O', bp_activity_get_last_updated(), false );
|
@@ -2275,8 +1668,7 @@ class BP_Activity_Feed {
|
|
2275 |
$client_etag = trim( $client_etag, '"' );
|
2276 |
|
2277 |
// Strip suffixes from ETag if they exist (eg. "-gzip")
|
2278 |
-
$etag_suffix_pos = strpos( $client_etag, '-' )
|
2279 |
-
if ( ! empty( $etag_suffix_pos ) ) {
|
2280 |
$client_etag = substr( $client_etag, 0, $etag_suffix_pos );
|
2281 |
}
|
2282 |
|
@@ -2326,14 +1718,7 @@ class BP_Activity_Feed {
|
|
2326 |
xmlns:atom="http://www.w3.org/2005/Atom"
|
2327 |
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
2328 |
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
|
2329 |
-
<?php
|
2330 |
-
|
2331 |
-
/**
|
2332 |
-
* Fires at the end of the opening RSS tag for feed output so plugins can add extra attributes.
|
2333 |
-
*
|
2334 |
-
* @since BuddyPress (1.8.0)
|
2335 |
-
*/
|
2336 |
-
do_action( 'bp_activity_feed_rss_attributes' ); ?>
|
2337 |
>
|
2338 |
|
2339 |
<channel>
|
@@ -2347,14 +1732,7 @@ class BP_Activity_Feed {
|
|
2347 |
<ttl><?php echo $this->ttl; ?></ttl>
|
2348 |
<sy:updatePeriod><?php echo $this->update_period; ?></sy:updatePeriod>
|
2349 |
<sy:updateFrequency><?php echo $this->update_frequency; ?></sy:updateFrequency>
|
2350 |
-
<?php
|
2351 |
-
|
2352 |
-
/**
|
2353 |
-
* Fires at the end of channel elements list in RSS feed so plugins can add extra channel elements.
|
2354 |
-
*
|
2355 |
-
* @since BuddyPress (1.8.0)
|
2356 |
-
*/
|
2357 |
-
do_action( 'bp_activity_feed_channel_elements' ); ?>
|
2358 |
|
2359 |
<?php if ( bp_has_activities( $this->activity_args ) ) : ?>
|
2360 |
<?php while ( bp_activities() ) : bp_the_activity(); ?>
|
@@ -2372,14 +1750,7 @@ class BP_Activity_Feed {
|
|
2372 |
<slash:comments><?php bp_activity_comment_count(); ?></slash:comments>
|
2373 |
<?php endif; ?>
|
2374 |
|
2375 |
-
<?php
|
2376 |
-
|
2377 |
-
/**
|
2378 |
-
* Fires at the end of the individual RSS Item list in RSS feed so plugins can add extra item elements.
|
2379 |
-
*
|
2380 |
-
* @since BuddyPress (1.8.0)
|
2381 |
-
*/
|
2382 |
-
do_action( 'bp_activity_feed_item_elements' ); ?>
|
2383 |
</item>
|
2384 |
<?php endwhile; ?>
|
2385 |
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/**
|
13 |
* Database interaction class for the BuddyPress activity component.
|
135 |
* Populate the object with data about the specific activity item.
|
136 |
*/
|
137 |
public function populate() {
|
138 |
+
global $wpdb, $bp;
|
139 |
|
140 |
$row = wp_cache_get( $this->id, 'bp_activity' );
|
141 |
|
142 |
if ( false === $row ) {
|
|
|
143 |
$row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE id = %d", $this->id ) );
|
144 |
|
145 |
wp_cache_set( $this->id, $row, 'bp_activity' );
|
169 |
|
170 |
// If no callback is available, use the literal string from
|
171 |
// the database row
|
172 |
+
} else if ( ! empty( $row->action ) ) {
|
173 |
$this->action = $row->action;
|
174 |
|
175 |
// Provide a fallback to avoid PHP notices
|
184 |
* @return bool True on success.
|
185 |
*/
|
186 |
public function save() {
|
187 |
+
global $wpdb, $bp;
|
|
|
|
|
188 |
|
189 |
$this->id = apply_filters_ref_array( 'bp_activity_id_before_save', array( $this->id, &$this ) );
|
190 |
$this->item_id = apply_filters_ref_array( 'bp_activity_item_id_before_save', array( $this->item_id, &$this ) );
|
201 |
$this->mptt_right = apply_filters_ref_array( 'bp_activity_mptt_right_before_save', array( $this->mptt_right, &$this ) );
|
202 |
$this->is_spam = apply_filters_ref_array( 'bp_activity_is_spam_before_save', array( $this->is_spam, &$this ) );
|
203 |
|
204 |
+
// Use this, not the filters above
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
do_action_ref_array( 'bp_activity_before_save', array( &$this ) );
|
206 |
|
207 |
+
if ( !$this->component || !$this->type )
|
208 |
return false;
|
|
|
209 |
|
210 |
+
if ( !$this->primary_link )
|
211 |
$this->primary_link = bp_loggedin_user_domain();
|
|
|
212 |
|
213 |
// If we have an existing ID, update the activity item, otherwise insert it.
|
214 |
+
if ( $this->id )
|
215 |
$q = $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component = %s, type = %s, action = %s, content = %s, primary_link = %s, date_recorded = %s, item_id = %d, secondary_item_id = %d, hide_sitewide = %d, is_spam = %d WHERE id = %d", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam, $this->id );
|
216 |
+
else
|
217 |
$q = $wpdb->prepare( "INSERT INTO {$bp->activity->table_name} ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide, is_spam ) VALUES ( %d, %s, %s, %s, %s, %s, %s, %d, %d, %d, %d )", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam );
|
|
|
218 |
|
219 |
+
if ( false === $wpdb->query( $q ) )
|
220 |
return false;
|
|
|
221 |
|
222 |
// If this is a new activity item, set the $id property
|
223 |
+
if ( empty( $this->id ) )
|
224 |
$this->id = $wpdb->insert_id;
|
225 |
|
226 |
// If an existing activity item, prevent any changes to the content generating new @mention notifications.
|
227 |
+
else
|
228 |
add_filter( 'bp_activity_at_name_do_notifications', '__return_false' );
|
|
|
229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
do_action_ref_array( 'bp_activity_after_save', array( &$this ) );
|
231 |
|
232 |
return true;
|
244 |
*
|
245 |
* @param array $args {
|
246 |
* An array of arguments. All items are optional.
|
247 |
+
* @type int $page Which page of results to fetch. Using page=1
|
248 |
+
* without per_page will result in no pagination.
|
249 |
+
* Default: 1.
|
250 |
+
* @type int|bool $per_page Number of results per page. Default: 25.
|
251 |
+
* @type int|bool $max Maximum number of results to return.
|
252 |
+
* Default: false (unlimited).
|
253 |
+
* @type string $sort ASC or DESC. Default: 'DESC'.
|
254 |
+
* @type array $exclude Array of activity IDs to exclude.
|
255 |
+
* Default: false.
|
256 |
+
* @type array $in Array of ids to limit query by (IN).
|
257 |
+
* Default: false.
|
258 |
+
* @type array $meta_query An array of meta_query conditions.
|
259 |
+
* See WP_Meta_Query::queries for description.
|
260 |
+
* @type array $date_query An array of date_query conditions.
|
261 |
+
* See first parameter of WP_Date_Query::__construct()
|
262 |
+
* for description.
|
263 |
+
* @type array $filter See BP_Activity_Activity::get_filter_sql().
|
264 |
+
* @type string $search_terms Limit results by a search term.
|
265 |
+
* Default: false.
|
266 |
+
* @type bool $display_comments Whether to include activity comments.
|
267 |
+
* Default: false.
|
268 |
+
* @type bool $show_hidden Whether to show items marked hide_sitewide.
|
269 |
+
* Default: false.
|
270 |
+
* @type string $spam Spam status. Default: 'ham_only'.
|
271 |
+
* @type bool $update_meta_cache Whether to pre-fetch metadata for
|
272 |
+
* queried activity items. Default: true.
|
273 |
+
* @type string|bool $count_total If true, an additional DB query
|
274 |
+
* is run to count the total activity items for the query.
|
275 |
+
* Default: false.
|
276 |
* }
|
277 |
* @return array The array returned has two keys:
|
278 |
* - 'total' is the count of located activities
|
279 |
* - 'activities' is an array of the located activities
|
280 |
*/
|
281 |
public static function get( $args = array() ) {
|
282 |
+
global $wpdb, $bp;
|
283 |
|
284 |
// Backward compatibility with old method of passing arguments
|
285 |
if ( !is_array( $args ) || func_num_args() > 1 ) {
|
303 |
$args = bp_core_parse_args_array( $old_args_keys, $func_args );
|
304 |
}
|
305 |
|
306 |
+
$defaults = array(
|
|
|
307 |
'page' => 1, // The current page
|
308 |
'per_page' => 25, // Activity items per page
|
309 |
'max' => false, // Max number of items to return
|
312 |
'in' => false, // Array of ids to limit query by (IN)
|
313 |
'meta_query' => false, // Filter by activitymeta
|
314 |
'date_query' => false, // Filter by date
|
|
|
315 |
'filter' => false, // See self::get_filter_sql()
|
|
|
316 |
'search_terms' => false, // Terms to search by
|
317 |
'display_comments' => false, // Whether to include activity comments
|
318 |
'show_hidden' => false, // Show items marked hide_sitewide
|
319 |
'spam' => 'ham_only', // Spam status
|
320 |
'update_meta_cache' => true,
|
321 |
'count_total' => false,
|
322 |
+
);
|
323 |
+
$r = wp_parse_args( $args, $defaults );
|
324 |
+
extract( $r );
|
325 |
|
326 |
// Select conditions
|
327 |
$select_sql = "SELECT DISTINCT a.id";
|
336 |
// Excluded types
|
337 |
$excluded_types = array();
|
338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
// Spam
|
340 |
+
if ( 'ham_only' == $spam )
|
341 |
$where_conditions['spam_sql'] = 'a.is_spam = 0';
|
342 |
+
elseif ( 'spam_only' == $spam )
|
343 |
$where_conditions['spam_sql'] = 'a.is_spam = 1';
|
|
|
344 |
|
345 |
// Searching
|
346 |
+
if ( $search_terms ) {
|
347 |
+
$search_terms_like = '%' . bp_esc_like( $search_terms ) . '%';
|
348 |
$where_conditions['search_sql'] = $wpdb->prepare( 'a.content LIKE %s', $search_terms_like );
|
349 |
}
|
350 |
|
351 |
+
// Filtering
|
352 |
+
if ( $filter && $filter_sql = BP_Activity_Activity::get_filter_sql( $filter ) )
|
353 |
+
$where_conditions['filter_sql'] = $filter_sql;
|
354 |
+
|
355 |
// Sorting
|
356 |
+
if ( $sort != 'ASC' && $sort != 'DESC' )
|
|
|
357 |
$sort = 'DESC';
|
|
|
358 |
|
359 |
// Hide Hidden Items?
|
360 |
+
if ( !$show_hidden )
|
361 |
$where_conditions['hidden_sql'] = "a.hide_sitewide = 0";
|
|
|
362 |
|
363 |
// Exclude specified items
|
364 |
+
if ( !empty( $exclude ) ) {
|
365 |
+
$exclude = implode( ',', wp_parse_id_list( $exclude ) );
|
366 |
$where_conditions['exclude'] = "a.id NOT IN ({$exclude})";
|
367 |
}
|
368 |
|
369 |
// The specific ids to which you want to limit the query
|
370 |
+
if ( !empty( $in ) ) {
|
371 |
+
$in = implode( ',', wp_parse_id_list( $in ) );
|
372 |
$where_conditions['in'] = "a.id IN ({$in})";
|
373 |
}
|
374 |
|
375 |
// Process meta_query into SQL
|
376 |
+
$meta_query_sql = self::get_meta_query_sql( $meta_query );
|
377 |
|
378 |
if ( ! empty( $meta_query_sql['join'] ) ) {
|
379 |
$join_sql .= $meta_query_sql['join'];
|
384 |
}
|
385 |
|
386 |
// Process date_query into SQL
|
387 |
+
$date_query_sql = self::get_date_query_sql( $date_query );
|
388 |
|
389 |
if ( ! empty( $date_query_sql ) ) {
|
390 |
$where_conditions['date'] = $date_query_sql;
|
393 |
// Alter the query based on whether we want to show activity item
|
394 |
// comments in the stream like normal comments or threaded below
|
395 |
// the activity.
|
396 |
+
if ( false === $display_comments || 'threaded' === $display_comments ) {
|
397 |
$excluded_types[] = 'activity_comment';
|
398 |
}
|
399 |
|
400 |
// Exclude 'last_activity' items unless the 'action' filter has
|
401 |
// been explicitly set
|
402 |
+
if ( empty( $filter['object'] ) ) {
|
403 |
$excluded_types[] = 'last_activity';
|
404 |
}
|
405 |
|
406 |
+
// Exclude 'new_member' items if xprofile component is not active
|
407 |
+
if ( ! bp_is_active( 'xprofile' ) ) {
|
408 |
+
$excluded_types[] = 'new_member';
|
409 |
+
}
|
410 |
+
|
411 |
// Build the excluded type sql part
|
412 |
if ( ! empty( $excluded_types ) ) {
|
413 |
$not_in = "'" . implode( "', '", esc_sql( $excluded_types ) ) . "'";
|
414 |
$where_conditions['excluded_types'] = "a.type NOT IN ({$not_in})";
|
415 |
}
|
416 |
|
417 |
+
// Filter the where conditions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
$where_conditions = apply_filters( 'bp_activity_get_where_conditions', $where_conditions, $r, $select_sql, $from_sql, $join_sql );
|
419 |
|
420 |
// Join the where conditions together
|
421 |
$where_sql = 'WHERE ' . join( ' AND ', $where_conditions );
|
422 |
|
423 |
+
// Define the preferred order for indexes
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
$indexes = apply_filters( 'bp_activity_preferred_index_order', array( 'user_id', 'item_id', 'secondary_item_id', 'date_recorded', 'component', 'type', 'hide_sitewide', 'is_spam' ) );
|
425 |
|
426 |
foreach( $indexes as $key => $index ) {
|
437 |
}
|
438 |
|
439 |
// Sanitize page and per_page parameters
|
440 |
+
$page = absint( $page );
|
441 |
+
$per_page = absint( $per_page );
|
442 |
|
443 |
$retval = array(
|
444 |
'activities' => null,
|
446 |
'has_more_items' => null,
|
447 |
);
|
448 |
|
449 |
+
// Filter and return true to use the legacy query structure (not recommended)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
if ( apply_filters( 'bp_use_legacy_activity_query', false, __METHOD__, $r ) ) {
|
451 |
|
452 |
// Legacy queries joined against the user table
|
455 |
|
456 |
if ( ! empty( $page ) && ! empty( $per_page ) ) {
|
457 |
$pag_sql = $wpdb->prepare( "LIMIT %d, %d", absint( ( $page - 1 ) * $per_page ), $per_page );
|
|
|
|
|
458 |
$activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) );
|
459 |
} else {
|
460 |
+
$activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $select_sql, $from_sql, $where_sql, $sort ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
}
|
462 |
|
463 |
} else {
|
464 |
+
|
465 |
// Query first for activity IDs
|
466 |
$activity_ids_sql = "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}";
|
467 |
|
471 |
$activity_ids_sql .= $wpdb->prepare( " LIMIT %d, %d", absint( ( $page - 1 ) * $per_page ), $per_page + 1 );
|
472 |
}
|
473 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
474 |
$activity_ids_sql = apply_filters( 'bp_activity_paged_activities_sql', $activity_ids_sql, $r );
|
475 |
|
476 |
$activity_ids = $wpdb->get_col( $activity_ids_sql );
|
495 |
$activity_ids[] = $activity->id;
|
496 |
}
|
497 |
|
498 |
+
if ( ! empty( $activity_ids ) && $update_meta_cache ) {
|
499 |
bp_activity_update_meta_cache( $activity_ids );
|
500 |
}
|
501 |
|
502 |
+
if ( $activities && $display_comments )
|
503 |
+
$activities = BP_Activity_Activity::append_comments( $activities, $spam );
|
|
|
504 |
|
505 |
// Pre-fetch data associated with activity users and other objects
|
506 |
BP_Activity_Activity::prefetch_object_data( $activities );
|
513 |
// If $max is set, only return up to the max results
|
514 |
if ( ! empty( $r['count_total'] ) ) {
|
515 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
$total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$join_sql} {$where_sql}", $where_sql, $sort );
|
517 |
$total_activities = $wpdb->get_var( $total_activities_sql );
|
518 |
|
519 |
+
if ( !empty( $max ) ) {
|
520 |
+
if ( (int) $total_activities > (int) $max )
|
521 |
+
$total_activities = $max;
|
|
|
522 |
}
|
523 |
|
524 |
$retval['total'] = $total_activities;
|
639 |
* @param array $activities Array of activities.
|
640 |
*/
|
641 |
protected static function prefetch_object_data( $activities ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
642 |
return apply_filters( 'bp_activity_prefetch_object_data', $activities );
|
643 |
}
|
644 |
|
735 |
return $sql;
|
736 |
}
|
737 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
738 |
/**
|
739 |
* In BuddyPress 1.2.x, this was used to retrieve specific activity stream items (for example, on an activity's permalink page).
|
740 |
*
|
761 |
/**
|
762 |
* Get the first activity ID that matches a set of criteria.
|
763 |
*
|
764 |
+
* @param int $user_id The user ID to filter by.
|
765 |
+
* @param string $component The component to filter by.
|
766 |
+
* @param string $type The activity type to filter by.
|
767 |
+
* @param int $item_id The associated item to filter by.
|
768 |
+
* @param int $secondary_item_id The secondary associated item to filter by.
|
769 |
+
* @param string $action The action to filter by.
|
770 |
+
* @param string $content The content to filter by.
|
771 |
+
* @param string $date_recorded The date to filter by.
|
|
|
|
|
|
|
772 |
* @return int|bool Activity ID on success, false if none is found.
|
773 |
*/
|
774 |
public static function get_id( $user_id, $component, $type, $item_id, $secondary_item_id, $action, $content, $date_recorded ) {
|
775 |
+
global $bp, $wpdb;
|
|
|
|
|
776 |
|
777 |
$where_args = false;
|
778 |
|
779 |
+
if ( !empty( $user_id ) )
|
780 |
$where_args[] = $wpdb->prepare( "user_id = %d", $user_id );
|
|
|
781 |
|
782 |
+
if ( !empty( $component ) )
|
783 |
$where_args[] = $wpdb->prepare( "component = %s", $component );
|
|
|
784 |
|
785 |
+
if ( !empty( $type ) )
|
786 |
$where_args[] = $wpdb->prepare( "type = %s", $type );
|
|
|
787 |
|
788 |
+
if ( !empty( $item_id ) )
|
789 |
$where_args[] = $wpdb->prepare( "item_id = %d", $item_id );
|
|
|
790 |
|
791 |
+
if ( !empty( $secondary_item_id ) )
|
792 |
$where_args[] = $wpdb->prepare( "secondary_item_id = %d", $secondary_item_id );
|
|
|
793 |
|
794 |
+
if ( !empty( $action ) )
|
795 |
$where_args[] = $wpdb->prepare( "action = %s", $action );
|
|
|
796 |
|
797 |
+
if ( !empty( $content ) )
|
798 |
$where_args[] = $wpdb->prepare( "content = %s", $content );
|
|
|
799 |
|
800 |
+
if ( !empty( $date_recorded ) )
|
801 |
$where_args[] = $wpdb->prepare( "date_recorded = %s", $date_recorded );
|
|
|
802 |
|
803 |
+
if ( !empty( $where_args ) )
|
804 |
$where_sql = 'WHERE ' . join( ' AND ', $where_args );
|
805 |
+
else
|
806 |
+
return false;
|
807 |
|
808 |
+
return $wpdb->get_var( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" );
|
809 |
}
|
810 |
|
811 |
/**
|
832 |
* @return array|bool An array of deleted activity IDs on success, false on failure.
|
833 |
*/
|
834 |
public static function delete( $args = array() ) {
|
835 |
+
global $wpdb, $bp;
|
|
|
|
|
836 |
|
837 |
$defaults = array(
|
838 |
'id' => false,
|
933 |
* @return bool True on success.
|
934 |
*/
|
935 |
public static function delete_activity_item_comments( $activity_ids = array(), $delete_meta = true ) {
|
936 |
+
global $bp, $wpdb;
|
937 |
|
938 |
+
$delete_meta = (bool) $delete_meta;
|
939 |
|
|
|
940 |
$activity_ids = implode( ',', wp_parse_id_list( $activity_ids ) );
|
941 |
|
942 |
if ( $delete_meta ) {
|
1004 |
*
|
1005 |
* @since BuddyPress (1.2)
|
1006 |
*
|
1007 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
1008 |
* @global wpdb $wpdb WordPress database object.
|
1009 |
*
|
1010 |
* @param int $activity_id Activity ID to fetch comments for.
|
1015 |
* @return array The updated activities with nested comments.
|
1016 |
*/
|
1017 |
public static function get_activity_comments( $activity_id, $left, $right, $spam = 'ham_only', $top_level_parent_id = 0 ) {
|
1018 |
+
global $wpdb, $bp;
|
1019 |
|
1020 |
if ( empty( $top_level_parent_id ) ) {
|
1021 |
$top_level_parent_id = $activity_id;
|
1029 |
$comments = false;
|
1030 |
|
1031 |
// A true cache miss
|
1032 |
+
} else if ( empty( $comments ) ) {
|
|
|
|
|
1033 |
|
1034 |
// Select the user's fullname with the query
|
1035 |
if ( bp_is_active( 'xprofile' ) ) {
|
1053 |
|
1054 |
// Legacy query - not recommended
|
1055 |
$func_args = func_get_args();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1056 |
if ( apply_filters( 'bp_use_legacy_activity_query', false, __METHOD__, $func_args ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1057 |
$sql = apply_filters( 'bp_activity_comments_user_join_filter', $wpdb->prepare( "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp->activity->table_name} a, {$wpdb->users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.type = 'activity_comment' {$spam_sql} AND a.item_id = %d AND a.mptt_left > %d AND a.mptt_left < %d ORDER BY a.date_recorded ASC", $top_level_parent_id, $left, $right ), $activity_id, $left, $right, $spam_sql );
|
1058 |
|
1059 |
$descendants = $wpdb->get_results( $sql );
|
1135 |
*
|
1136 |
* @since BuddyPress (1.2)
|
1137 |
*
|
1138 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
1139 |
+
* @global wpdb $wpdb WordPress database object.
|
1140 |
*
|
1141 |
+
* @param int $parent_id ID of an activty or activity comment.
|
1142 |
+
* @param int $left Node boundary start for activity or activity comment.
|
1143 |
+
* @return int Right node boundary of activity or activity comment.
|
1144 |
*/
|
1145 |
public static function rebuild_activity_comment_tree( $parent_id, $left = 1 ) {
|
1146 |
+
global $wpdb, $bp;
|
|
|
|
|
1147 |
|
1148 |
// The right value of this node is the left value + 1
|
1149 |
+
$right = $left + 1;
|
1150 |
|
1151 |
// Get all descendants of this node
|
1152 |
+
$descendants = BP_Activity_Activity::get_child_comments( $parent_id );
|
|
|
1153 |
|
1154 |
// Loop the descendants and recalculate the left and right values
|
1155 |
+
foreach ( (array) $descendants as $descendant )
|
1156 |
+
$right = BP_Activity_Activity::rebuild_activity_comment_tree( $descendant->id, $right );
|
|
|
1157 |
|
1158 |
// We've got the left value, and now that we've processed the children
|
1159 |
// of this node we also know the right value
|
1160 |
+
if ( 1 == $left )
|
1161 |
$wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE id = %d", $left, $right, $parent_id ) );
|
1162 |
+
else
|
1163 |
$wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE type = 'activity_comment' AND id = %d", $left, $right, $parent_id ) );
|
|
|
1164 |
|
1165 |
// Return the right value of this node + 1
|
1166 |
+
return $right + 1;
|
1167 |
}
|
1168 |
|
1169 |
/**
|
1171 |
*
|
1172 |
* @since BuddyPress (1.2)
|
1173 |
*
|
1174 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
1175 |
* @global wpdb $wpdb WordPress database object.
|
1176 |
*
|
1177 |
+
* @param int $parent_id ID of an activty or activity comment.
|
1178 |
* @return object Numerically indexed array of child comments.
|
1179 |
*/
|
1180 |
public static function get_child_comments( $parent_id ) {
|
1181 |
+
global $bp, $wpdb;
|
|
|
|
|
1182 |
|
1183 |
return $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND secondary_item_id = %d", $parent_id ) );
|
1184 |
}
|
1194 |
* @return array List of component names.
|
1195 |
*/
|
1196 |
public static function get_recorded_components( $skip_last_activity = true ) {
|
1197 |
+
global $wpdb, $bp;
|
|
|
|
|
1198 |
|
1199 |
+
if ( $skip_last_activity ) {
|
1200 |
$components = $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} WHERE action != '' AND action != 'last_activity' ORDER BY component ASC" );
|
1201 |
} else {
|
1202 |
$components = $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" );
|
1348 |
* @return string ISO timestamp.
|
1349 |
*/
|
1350 |
public static function get_last_updated() {
|
1351 |
+
global $bp, $wpdb;
|
|
|
|
|
1352 |
|
1353 |
return $wpdb->get_var( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded DESC LIMIT 1" );
|
1354 |
}
|
1362 |
* @return int A count of the user's favorites.
|
1363 |
*/
|
1364 |
public static function total_favorite_count( $user_id ) {
|
1365 |
+
if ( !$favorite_activity_entries = bp_get_user_meta( $user_id, 'bp_favorite_activities', true ) )
|
1366 |
+
return 0;
|
1367 |
|
1368 |
+
return count( maybe_unserialize( $favorite_activity_entries ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1369 |
}
|
1370 |
|
1371 |
/**
|
1375 |
* @return int|bool The ID of the first matching item if found, otherwise false.
|
1376 |
*/
|
1377 |
public static function check_exists_by_content( $content ) {
|
1378 |
+
global $wpdb, $bp;
|
|
|
|
|
1379 |
|
1380 |
return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE content = %s", $content ) );
|
1381 |
}
|
1387 |
* @param int
|
1388 |
*/
|
1389 |
public static function hide_all_for_user( $user_id ) {
|
1390 |
+
global $wpdb, $bp;
|
|
|
|
|
1391 |
|
1392 |
return $wpdb->get_var( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET hide_sitewide = 1 WHERE user_id = %d", $user_id ) );
|
1393 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1394 |
}
|
1395 |
|
1396 |
/**
|
1449 |
* @param array $args Optional
|
1450 |
*/
|
1451 |
public function __construct( $args = array() ) {
|
1452 |
+
// If feeds are disabled, stop now!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1453 |
if ( false === (bool) apply_filters( 'bp_activity_enable_feeds', true ) ) {
|
1454 |
global $wp_query;
|
1455 |
|
1495 |
'activity_args' => array()
|
1496 |
) );
|
1497 |
|
1498 |
+
// Plugins can use this filter to modify the feed before it is setup
|
|
|
|
|
|
|
|
|
|
|
|
|
1499 |
do_action_ref_array( 'bp_activity_feed_prefetch', array( &$this ) );
|
1500 |
|
1501 |
// Setup class properties
|
1507 |
return false;
|
1508 |
}
|
1509 |
|
1510 |
+
// Plugins can use this filter to modify the feed after it's setup
|
|
|
|
|
|
|
|
|
|
|
|
|
1511 |
do_action_ref_array( 'bp_activity_feed_postfetch', array( &$this ) );
|
1512 |
|
1513 |
// Setup feed hooks
|
1564 |
* Fire a hook to ensure backward compatibility for RSS attributes.
|
1565 |
*/
|
1566 |
public function backpat_rss_attributes() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1567 |
do_action( 'bp_activity_' . $this->id . '_feed' );
|
1568 |
}
|
1569 |
|
1571 |
* Fire a hook to ensure backward compatibility for channel elements.
|
1572 |
*/
|
1573 |
public function backpat_channel_elements() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1574 |
do_action( 'bp_activity_' . $this->id . '_feed_head' );
|
1575 |
}
|
1576 |
|
1593 |
break;
|
1594 |
}
|
1595 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1596 |
do_action( 'bp_activity_' . $id . '_feed_item' );
|
1597 |
}
|
1598 |
|
1646 |
|
1647 |
// Set content-type
|
1648 |
@header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
|
|
|
1649 |
|
1650 |
// Cache-related variables
|
1651 |
$last_modified = mysql2date( 'D, d M Y H:i:s O', bp_activity_get_last_updated(), false );
|
1668 |
$client_etag = trim( $client_etag, '"' );
|
1669 |
|
1670 |
// Strip suffixes from ETag if they exist (eg. "-gzip")
|
1671 |
+
if ( $etag_suffix_pos = strpos( $client_etag, '-' ) ) {
|
|
|
1672 |
$client_etag = substr( $client_etag, 0, $etag_suffix_pos );
|
1673 |
}
|
1674 |
|
1718 |
xmlns:atom="http://www.w3.org/2005/Atom"
|
1719 |
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
1720 |
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
|
1721 |
+
<?php do_action( 'bp_activity_feed_rss_attributes' ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1722 |
>
|
1723 |
|
1724 |
<channel>
|
1732 |
<ttl><?php echo $this->ttl; ?></ttl>
|
1733 |
<sy:updatePeriod><?php echo $this->update_period; ?></sy:updatePeriod>
|
1734 |
<sy:updateFrequency><?php echo $this->update_frequency; ?></sy:updateFrequency>
|
1735 |
+
<?php do_action( 'bp_activity_feed_channel_elements' ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1736 |
|
1737 |
<?php if ( bp_has_activities( $this->activity_args ) ) : ?>
|
1738 |
<?php while ( bp_activities() ) : bp_the_activity(); ?>
|
1750 |
<slash:comments><?php bp_activity_comment_count(); ?></slash:comments>
|
1751 |
<?php endif; ?>
|
1752 |
|
1753 |
+
<?php do_action( 'bp_activity_feed_item_elements' ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1754 |
</item>
|
1755 |
<?php endwhile; ?>
|
1756 |
|
bp-activity/bp-activity-cssjs.php
CHANGED
@@ -41,15 +41,8 @@ function bp_activity_mentions_script() {
|
|
41 |
wp_style_add_data( 'bp-mentions-css', 'suffix', $min );
|
42 |
}
|
43 |
|
44 |
-
|
45 |
-
* Fires at the end of the Activity Mentions script.
|
46 |
-
*
|
47 |
-
* This is the hook where BP components can add their own prefetched results
|
48 |
-
* friends to the page for quicker @mentions lookups.
|
49 |
-
*
|
50 |
-
* @since BuddyPress (2.1.0)
|
51 |
-
*/
|
52 |
do_action( 'bp_activity_mentions_prime_results' );
|
53 |
}
|
54 |
add_action( 'bp_enqueue_scripts', 'bp_activity_mentions_script' );
|
55 |
-
add_action( 'bp_admin_enqueue_scripts', 'bp_activity_mentions_script' );
|
41 |
wp_style_add_data( 'bp-mentions-css', 'suffix', $min );
|
42 |
}
|
43 |
|
44 |
+
// Print a list of the current user's friends to the page for quicker @mentions lookups.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
do_action( 'bp_activity_mentions_prime_results' );
|
46 |
}
|
47 |
add_action( 'bp_enqueue_scripts', 'bp_activity_mentions_script' );
|
48 |
+
add_action( 'bp_admin_enqueue_scripts', 'bp_activity_mentions_script' );
|
bp-activity/bp-activity-filters.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/** Filters *******************************************************************/
|
14 |
|
@@ -113,7 +113,7 @@ add_action( 'bp_activity_before_save', 'bp_activity_check_blacklist_keys', 2, 1
|
|
113 |
/**
|
114 |
* Types of activity stream items to moderate.
|
115 |
*
|
116 |
-
* @since BuddyPress (1.6
|
117 |
*
|
118 |
* @return array $types List of the activity types to moderate.
|
119 |
*/
|
@@ -122,21 +122,13 @@ function bp_activity_get_moderated_activity_types() {
|
|
122 |
'activity_comment',
|
123 |
'activity_update'
|
124 |
);
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Filters the default activity types that BuddyPress should moderate.
|
128 |
-
*
|
129 |
-
* @since BuddyPress (1.6.0)
|
130 |
-
*
|
131 |
-
* @param array $types Default activity types to moderate.
|
132 |
-
*/
|
133 |
return apply_filters( 'bp_activity_check_activity_types', $types );
|
134 |
}
|
135 |
|
136 |
/**
|
137 |
* Moderate the posted activity item, if it contains moderate keywords.
|
138 |
*
|
139 |
-
* @since BuddyPress (1.6
|
140 |
*
|
141 |
* @param BP_Activity_Activity $activity The activity object to check.
|
142 |
*/
|
@@ -155,7 +147,7 @@ function bp_activity_check_moderation_keys( $activity ) {
|
|
155 |
/**
|
156 |
* Mark the posted activity as spam, if it contains blacklist keywords.
|
157 |
*
|
158 |
-
* @since BuddyPress (1.6
|
159 |
*
|
160 |
* @param BP_Activity_Activity $activity The activity object to check.
|
161 |
*/
|
@@ -173,7 +165,7 @@ function bp_activity_check_blacklist_keys( $activity ) {
|
|
173 |
/**
|
174 |
* Custom kses filtering for activity content.
|
175 |
*
|
176 |
-
* @since BuddyPress (1.1
|
177 |
*
|
178 |
* @uses apply_filters() To call the 'bp_activity_allowed_tags' hook.
|
179 |
* @uses wp_kses()
|
@@ -185,13 +177,11 @@ function bp_activity_filter_kses( $content ) {
|
|
185 |
global $allowedtags;
|
186 |
|
187 |
$activity_allowedtags = $allowedtags;
|
|
|
|
|
188 |
$activity_allowedtags['a']['class'] = array();
|
189 |
$activity_allowedtags['a']['id'] = array();
|
190 |
$activity_allowedtags['a']['rel'] = array();
|
191 |
-
$activity_allowedtags['a']['title'] = array();
|
192 |
-
$activity_allowedtags['b'] = array();
|
193 |
-
$activity_allowedtags['code'] = array();
|
194 |
-
$activity_allowedtags['i'] = array();
|
195 |
$activity_allowedtags['img'] = array();
|
196 |
$activity_allowedtags['img']['src'] = array();
|
197 |
$activity_allowedtags['img']['alt'] = array();
|
@@ -200,17 +190,8 @@ function bp_activity_filter_kses( $content ) {
|
|
200 |
$activity_allowedtags['img']['class'] = array();
|
201 |
$activity_allowedtags['img']['id'] = array();
|
202 |
$activity_allowedtags['img']['title'] = array();
|
203 |
-
$activity_allowedtags['
|
204 |
-
$activity_allowedtags['span']['class'] = array();
|
205 |
-
|
206 |
|
207 |
-
/**
|
208 |
-
* Filters the allowed HTML tags for BuddyPress Activity content.
|
209 |
-
*
|
210 |
-
* @since BuddyPress (1.2.0)
|
211 |
-
*
|
212 |
-
* @param array Array of allowed HTML tags and attributes.
|
213 |
-
*/
|
214 |
$activity_allowedtags = apply_filters( 'bp_activity_allowed_tags', $activity_allowedtags );
|
215 |
return wp_kses( $content, $activity_allowedtags );
|
216 |
}
|
@@ -276,7 +257,7 @@ function bp_activity_at_name_filter( $content, $activity_id = 0 ) {
|
|
276 |
* If mentions are found, replace @mention text with user links and add our
|
277 |
* hook to send mention notifications after the activity item is saved.
|
278 |
*
|
279 |
-
* @since BuddyPress (1.5
|
280 |
*
|
281 |
* @uses bp_activity_find_mentions()
|
282 |
*
|
@@ -313,7 +294,7 @@ function bp_activity_at_name_filter_updates( $activity ) {
|
|
313 |
/**
|
314 |
* Sends emails and BP notifications for users @-mentioned in an activity item.
|
315 |
*
|
316 |
-
* @since BuddyPress (1.7
|
317 |
*
|
318 |
* @uses bp_activity_at_message_notification()
|
319 |
* @uses bp_activity_update_mention_count_for_user()
|
@@ -338,14 +319,7 @@ function bp_activity_at_name_send_emails( $activity ) {
|
|
338 |
|
339 |
// Send @mentions and setup BP notifications
|
340 |
foreach( (array) $usernames as $user_id => $username ) {
|
341 |
-
|
342 |
-
* Filters BuddyPress' ability to send email notifications for @mentions.
|
343 |
-
*
|
344 |
-
* @since BuddyPress (1.6.0)
|
345 |
-
*
|
346 |
-
* @param bool Whether or not BuddyPress should send a notification to the mentioned users.
|
347 |
-
* @param array $usernames Array of users potentially notified.
|
348 |
-
*/
|
349 |
if ( apply_filters( 'bp_activity_at_name_do_notifications', true, $usernames ) ) {
|
350 |
bp_activity_at_message_notification( $activity->id, $user_id );
|
351 |
}
|
@@ -358,7 +332,7 @@ function bp_activity_at_name_send_emails( $activity ) {
|
|
358 |
/**
|
359 |
* Catch links in activity text so rel=nofollow can be added.
|
360 |
*
|
361 |
-
* @since BuddyPress (1.2
|
362 |
*
|
363 |
* @param string $text Activity text.
|
364 |
* @return string $text Text with rel=nofollow added to any links.
|
@@ -370,7 +344,7 @@ function bp_activity_make_nofollow_filter( $text ) {
|
|
370 |
/**
|
371 |
* Add rel=nofollow to a link.
|
372 |
*
|
373 |
-
* @since BuddyPress (1.2
|
374 |
*
|
375 |
* @param array $matches
|
376 |
*
|
@@ -386,7 +360,7 @@ function bp_activity_make_nofollow_filter( $text ) {
|
|
386 |
/**
|
387 |
* Truncate long activity entries when viewed in activity streams.
|
388 |
*
|
389 |
-
* @since BuddyPress (1.5
|
390 |
*
|
391 |
* @uses bp_is_single_activity()
|
392 |
* @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook.
|
@@ -406,22 +380,7 @@ function bp_activity_truncate_entry( $text ) {
|
|
406 |
if ( bp_is_single_activity() )
|
407 |
return $text;
|
408 |
|
409 |
-
/**
|
410 |
-
* Filters the appended text for the activity excerpt.
|
411 |
-
*
|
412 |
-
* @since BuddyPress (1.5.0)
|
413 |
-
*
|
414 |
-
* @param string $read_more Internationalized "Read more" text.
|
415 |
-
*/
|
416 |
$append_text = apply_filters( 'bp_activity_excerpt_append_text', __( '[Read more]', 'buddypress' ) );
|
417 |
-
|
418 |
-
/**
|
419 |
-
* Filters the excerpt length for the activity excerpt.
|
420 |
-
*
|
421 |
-
* @since BuddyPress (1.5.0)
|
422 |
-
*
|
423 |
-
* @param int $excerpt_length Number indicating how many words to trim the excerpt down to.
|
424 |
-
*/
|
425 |
$excerpt_length = apply_filters( 'bp_activity_excerpt_length', 358 );
|
426 |
|
427 |
// Run the text through the excerpt function. If it's too short, the original text will be
|
@@ -437,15 +396,6 @@ function bp_activity_truncate_entry( $text ) {
|
|
437 |
$excerpt = sprintf( '%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text );
|
438 |
}
|
439 |
|
440 |
-
/**
|
441 |
-
* Filters the composite activity excerpt entry.
|
442 |
-
*
|
443 |
-
* @since BuddyPress (1.5.0)
|
444 |
-
*
|
445 |
-
* @param string $excerpt Excerpt text and markup to be displayed.
|
446 |
-
* @param string $text The original activity entry text.
|
447 |
-
* @param string $append_text The final append text applied.
|
448 |
-
*/
|
449 |
return apply_filters( 'bp_activity_truncate_entry', $excerpt, $text, $append_text );
|
450 |
}
|
451 |
|
@@ -528,6 +478,8 @@ add_filter( 'bp_get_activity_css_class', 'bp_activity_timestamp_class', 9, 1 );
|
|
528 |
* @return array $response
|
529 |
*/
|
530 |
function bp_activity_heartbeat_last_recorded( $response = array(), $data = array() ) {
|
|
|
|
|
531 |
if ( empty( $data['bp_activity_last_recorded'] ) ) {
|
532 |
return $response;
|
533 |
}
|
@@ -547,7 +499,7 @@ function bp_activity_heartbeat_last_recorded( $response = array(), $data = array
|
|
547 |
$newest_activities = array();
|
548 |
$last_activity_recorded = 0;
|
549 |
|
550 |
-
//
|
551 |
add_filter( 'bp_get_activity_css_class', 'bp_activity_newest_class', 10, 1 );
|
552 |
|
553 |
ob_start();
|
@@ -596,26 +548,14 @@ function bp_activity_heartbeat_strings( $strings = array() ) {
|
|
596 |
|
597 |
$global_pulse = 0;
|
598 |
|
599 |
-
|
600 |
-
* Filter that checks whether the global heartbeat settings already exist.
|
601 |
-
*
|
602 |
-
* @since BuddyPress (2.0.0)
|
603 |
-
*
|
604 |
-
* @param array $settings Heartbeat settings array.
|
605 |
-
*/
|
606 |
$heartbeat_settings = apply_filters( 'heartbeat_settings', array() );
|
607 |
if ( ! empty( $heartbeat_settings['interval'] ) ) {
|
608 |
// 'Fast' is 5
|
609 |
$global_pulse = is_numeric( $heartbeat_settings['interval'] ) ? absint( $heartbeat_settings['interval'] ) : 5;
|
610 |
}
|
611 |
|
612 |
-
|
613 |
-
* Filters the pulse frequency to be used for the BuddyPress Activity heartbeat.
|
614 |
-
*
|
615 |
-
* @since BuddyPress (2.0.0)
|
616 |
-
*
|
617 |
-
* @param int $frequency The frequency in seconds between pulses.
|
618 |
-
*/
|
619 |
$bp_activity_pulse = apply_filters( 'bp_activity_heartbeat_pulse', 15 );
|
620 |
|
621 |
/**
|
@@ -638,172 +578,3 @@ function bp_activity_heartbeat_strings( $strings = array() ) {
|
|
638 |
return $strings;
|
639 |
}
|
640 |
add_filter( 'bp_core_get_js_strings', 'bp_activity_heartbeat_strings', 10, 1 );
|
641 |
-
|
642 |
-
/** Scopes ********************************************************************/
|
643 |
-
|
644 |
-
/**
|
645 |
-
* Set up activity arguments for use with the 'just-me' scope.
|
646 |
-
*
|
647 |
-
* @since BuddyPress (2.2.0)
|
648 |
-
*
|
649 |
-
* @param array $retval Empty array by default
|
650 |
-
* @param array $filter Current activity arguments
|
651 |
-
* @return array
|
652 |
-
*/
|
653 |
-
function bp_activity_filter_just_me_scope( $retval = array(), $filter = array() ) {
|
654 |
-
|
655 |
-
// Determine the user_id
|
656 |
-
if ( ! empty( $filter['user_id'] ) ) {
|
657 |
-
$user_id = $filter['user_id'];
|
658 |
-
} else {
|
659 |
-
$user_id = bp_displayed_user_id()
|
660 |
-
? bp_displayed_user_id()
|
661 |
-
: bp_loggedin_user_id();
|
662 |
-
}
|
663 |
-
|
664 |
-
// Should we show all items regardless of sitewide visibility?
|
665 |
-
$show_hidden = array();
|
666 |
-
if ( ! empty( $user_id ) && $user_id !== bp_loggedin_user_id() ) {
|
667 |
-
$show_hidden = array(
|
668 |
-
'column' => 'hide_sitewide',
|
669 |
-
'value' => 0
|
670 |
-
);
|
671 |
-
}
|
672 |
-
|
673 |
-
$retval = array(
|
674 |
-
'relation' => 'AND',
|
675 |
-
array(
|
676 |
-
'column' => 'user_id',
|
677 |
-
'value' => $user_id
|
678 |
-
),
|
679 |
-
$show_hidden,
|
680 |
-
|
681 |
-
// overrides
|
682 |
-
'override' => array(
|
683 |
-
'display_comments' => 'stream',
|
684 |
-
'filter' => array( 'user_id' => 0 ),
|
685 |
-
'show_hidden' => true
|
686 |
-
),
|
687 |
-
);
|
688 |
-
|
689 |
-
return $retval;
|
690 |
-
}
|
691 |
-
add_filter( 'bp_activity_set_just-me_scope_args', 'bp_activity_filter_just_me_scope', 10, 2 );
|
692 |
-
|
693 |
-
/**
|
694 |
-
* Set up activity arguments for use with the 'favorites' scope.
|
695 |
-
*
|
696 |
-
* @since BuddyPress (2.2.0)
|
697 |
-
*
|
698 |
-
* @param array $retval Empty array by default
|
699 |
-
* @param array $filter Current activity arguments
|
700 |
-
* @return array
|
701 |
-
*/
|
702 |
-
function bp_activity_filter_favorites_scope( $retval = array(), $filter = array() ) {
|
703 |
-
|
704 |
-
// Determine the user_id
|
705 |
-
if ( ! empty( $filter['user_id'] ) ) {
|
706 |
-
$user_id = $filter['user_id'];
|
707 |
-
} else {
|
708 |
-
$user_id = bp_displayed_user_id()
|
709 |
-
? bp_displayed_user_id()
|
710 |
-
: bp_loggedin_user_id();
|
711 |
-
}
|
712 |
-
|
713 |
-
// Determine the favorites
|
714 |
-
$favs = bp_activity_get_user_favorites( $user_id );
|
715 |
-
if ( empty( $favs ) ) {
|
716 |
-
$favs = array( 0 );
|
717 |
-
}
|
718 |
-
|
719 |
-
// Should we show all items regardless of sitewide visibility?
|
720 |
-
$show_hidden = array();
|
721 |
-
if ( ! empty( $user_id ) && ( $user_id !== bp_loggedin_user_id() ) ) {
|
722 |
-
$show_hidden = array(
|
723 |
-
'column' => 'hide_sitewide',
|
724 |
-
'value' => 0
|
725 |
-
);
|
726 |
-
}
|
727 |
-
|
728 |
-
$retval = array(
|
729 |
-
'relation' => 'AND',
|
730 |
-
array(
|
731 |
-
'column' => 'id',
|
732 |
-
'compare' => 'IN',
|
733 |
-
'value' => (array) $favs
|
734 |
-
),
|
735 |
-
$show_hidden,
|
736 |
-
|
737 |
-
// overrides
|
738 |
-
'override' => array(
|
739 |
-
'display_comments' => true,
|
740 |
-
'filter' => array( 'user_id' => 0 ),
|
741 |
-
'show_hidden' => true
|
742 |
-
),
|
743 |
-
);
|
744 |
-
|
745 |
-
return $retval;
|
746 |
-
}
|
747 |
-
add_filter( 'bp_activity_set_favorites_scope_args', 'bp_activity_filter_favorites_scope', 10, 2 );
|
748 |
-
|
749 |
-
|
750 |
-
/**
|
751 |
-
* Set up activity arguments for use with the 'favorites' scope.
|
752 |
-
*
|
753 |
-
* @since BuddyPress (2.2.0)
|
754 |
-
*
|
755 |
-
* @param array $retval Empty array by default
|
756 |
-
* @param array $filter Current activity arguments
|
757 |
-
* @return array
|
758 |
-
*/
|
759 |
-
function bp_activity_filter_mentions_scope( $retval = array(), $filter = array() ) {
|
760 |
-
|
761 |
-
// Are mentions disabled?
|
762 |
-
if ( ! bp_activity_do_mentions() ) {
|
763 |
-
return $retval;
|
764 |
-
}
|
765 |
-
|
766 |
-
// Determine the user_id
|
767 |
-
if ( ! empty( $filter['user_id'] ) ) {
|
768 |
-
$user_id = $filter['user_id'];
|
769 |
-
} else {
|
770 |
-
$user_id = bp_displayed_user_id()
|
771 |
-
? bp_displayed_user_id()
|
772 |
-
: bp_loggedin_user_id();
|
773 |
-
}
|
774 |
-
|
775 |
-
// Should we show all items regardless of sitewide visibility?
|
776 |
-
$show_hidden = array();
|
777 |
-
if ( ! empty( $user_id ) && $user_id !== bp_loggedin_user_id() ) {
|
778 |
-
$show_hidden = array(
|
779 |
-
'column' => 'hide_sitewide',
|
780 |
-
'value' => 0
|
781 |
-
);
|
782 |
-
}
|
783 |
-
|
784 |
-
$retval = array(
|
785 |
-
'relation' => 'AND',
|
786 |
-
array(
|
787 |
-
'column' => 'content',
|
788 |
-
'compare' => 'LIKE',
|
789 |
-
|
790 |
-
// Start search at @ symbol and stop search at closing tag delimiter.
|
791 |
-
'value' => '@' . bp_activity_get_user_mentionname( $user_id ) . '<'
|
792 |
-
),
|
793 |
-
$show_hidden,
|
794 |
-
|
795 |
-
// overrides
|
796 |
-
'override' => array(
|
797 |
-
|
798 |
-
// clear search terms so 'mentions' scope works with other scopes
|
799 |
-
'search_terms' => false,
|
800 |
-
|
801 |
-
'display_comments' => 'stream',
|
802 |
-
'filter' => array( 'user_id' => 0 ),
|
803 |
-
'show_hidden' => true
|
804 |
-
),
|
805 |
-
);
|
806 |
-
|
807 |
-
return $retval;
|
808 |
-
}
|
809 |
-
add_filter( 'bp_activity_set_mentions_scope_args', 'bp_activity_filter_mentions_scope', 10, 2 );
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/** Filters *******************************************************************/
|
14 |
|
113 |
/**
|
114 |
* Types of activity stream items to moderate.
|
115 |
*
|
116 |
+
* @since BuddyPress (1.6)
|
117 |
*
|
118 |
* @return array $types List of the activity types to moderate.
|
119 |
*/
|
122 |
'activity_comment',
|
123 |
'activity_update'
|
124 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
return apply_filters( 'bp_activity_check_activity_types', $types );
|
126 |
}
|
127 |
|
128 |
/**
|
129 |
* Moderate the posted activity item, if it contains moderate keywords.
|
130 |
*
|
131 |
+
* @since BuddyPress (1.6)
|
132 |
*
|
133 |
* @param BP_Activity_Activity $activity The activity object to check.
|
134 |
*/
|
147 |
/**
|
148 |
* Mark the posted activity as spam, if it contains blacklist keywords.
|
149 |
*
|
150 |
+
* @since BuddyPress (1.6)
|
151 |
*
|
152 |
* @param BP_Activity_Activity $activity The activity object to check.
|
153 |
*/
|
165 |
/**
|
166 |
* Custom kses filtering for activity content.
|
167 |
*
|
168 |
+
* @since BuddyPress (1.1)
|
169 |
*
|
170 |
* @uses apply_filters() To call the 'bp_activity_allowed_tags' hook.
|
171 |
* @uses wp_kses()
|
177 |
global $allowedtags;
|
178 |
|
179 |
$activity_allowedtags = $allowedtags;
|
180 |
+
$activity_allowedtags['span'] = array();
|
181 |
+
$activity_allowedtags['span']['class'] = array();
|
182 |
$activity_allowedtags['a']['class'] = array();
|
183 |
$activity_allowedtags['a']['id'] = array();
|
184 |
$activity_allowedtags['a']['rel'] = array();
|
|
|
|
|
|
|
|
|
185 |
$activity_allowedtags['img'] = array();
|
186 |
$activity_allowedtags['img']['src'] = array();
|
187 |
$activity_allowedtags['img']['alt'] = array();
|
190 |
$activity_allowedtags['img']['class'] = array();
|
191 |
$activity_allowedtags['img']['id'] = array();
|
192 |
$activity_allowedtags['img']['title'] = array();
|
193 |
+
$activity_allowedtags['code'] = array();
|
|
|
|
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
$activity_allowedtags = apply_filters( 'bp_activity_allowed_tags', $activity_allowedtags );
|
196 |
return wp_kses( $content, $activity_allowedtags );
|
197 |
}
|
257 |
* If mentions are found, replace @mention text with user links and add our
|
258 |
* hook to send mention notifications after the activity item is saved.
|
259 |
*
|
260 |
+
* @since BuddyPress (1.5)
|
261 |
*
|
262 |
* @uses bp_activity_find_mentions()
|
263 |
*
|
294 |
/**
|
295 |
* Sends emails and BP notifications for users @-mentioned in an activity item.
|
296 |
*
|
297 |
+
* @since BuddyPress (1.7)
|
298 |
*
|
299 |
* @uses bp_activity_at_message_notification()
|
300 |
* @uses bp_activity_update_mention_count_for_user()
|
319 |
|
320 |
// Send @mentions and setup BP notifications
|
321 |
foreach( (array) $usernames as $user_id => $username ) {
|
322 |
+
// If you want to disable notifications, you can use this filter to stop email sending
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
if ( apply_filters( 'bp_activity_at_name_do_notifications', true, $usernames ) ) {
|
324 |
bp_activity_at_message_notification( $activity->id, $user_id );
|
325 |
}
|
332 |
/**
|
333 |
* Catch links in activity text so rel=nofollow can be added.
|
334 |
*
|
335 |
+
* @since BuddyPress (1.2)
|
336 |
*
|
337 |
* @param string $text Activity text.
|
338 |
* @return string $text Text with rel=nofollow added to any links.
|
344 |
/**
|
345 |
* Add rel=nofollow to a link.
|
346 |
*
|
347 |
+
* @since BuddyPress (1.2)
|
348 |
*
|
349 |
* @param array $matches
|
350 |
*
|
360 |
/**
|
361 |
* Truncate long activity entries when viewed in activity streams.
|
362 |
*
|
363 |
+
* @since BuddyPress (1.5)
|
364 |
*
|
365 |
* @uses bp_is_single_activity()
|
366 |
* @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook.
|
380 |
if ( bp_is_single_activity() )
|
381 |
return $text;
|
382 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
$append_text = apply_filters( 'bp_activity_excerpt_append_text', __( '[Read more]', 'buddypress' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
$excerpt_length = apply_filters( 'bp_activity_excerpt_length', 358 );
|
385 |
|
386 |
// Run the text through the excerpt function. If it's too short, the original text will be
|
396 |
$excerpt = sprintf( '%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text );
|
397 |
}
|
398 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
return apply_filters( 'bp_activity_truncate_entry', $excerpt, $text, $append_text );
|
400 |
}
|
401 |
|
478 |
* @return array $response
|
479 |
*/
|
480 |
function bp_activity_heartbeat_last_recorded( $response = array(), $data = array() ) {
|
481 |
+
$bp = buddypress();
|
482 |
+
|
483 |
if ( empty( $data['bp_activity_last_recorded'] ) ) {
|
484 |
return $response;
|
485 |
}
|
499 |
$newest_activities = array();
|
500 |
$last_activity_recorded = 0;
|
501 |
|
502 |
+
// Temporarly add a just-posted class for new activity items
|
503 |
add_filter( 'bp_get_activity_css_class', 'bp_activity_newest_class', 10, 1 );
|
504 |
|
505 |
ob_start();
|
548 |
|
549 |
$global_pulse = 0;
|
550 |
|
551 |
+
// Check whether the global heartbeat settings already exist.
|
|
|
|
|
|
|
|
|
|
|
|
|
552 |
$heartbeat_settings = apply_filters( 'heartbeat_settings', array() );
|
553 |
if ( ! empty( $heartbeat_settings['interval'] ) ) {
|
554 |
// 'Fast' is 5
|
555 |
$global_pulse = is_numeric( $heartbeat_settings['interval'] ) ? absint( $heartbeat_settings['interval'] ) : 5;
|
556 |
}
|
557 |
|
558 |
+
// Filter here to specify a BP-specific pulse frequency
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
$bp_activity_pulse = apply_filters( 'bp_activity_heartbeat_pulse', 15 );
|
560 |
|
561 |
/**
|
578 |
return $strings;
|
579 |
}
|
580 |
add_filter( 'bp_core_get_js_strings', 'bp_activity_heartbeat_strings', 10, 1 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp-activity/bp-activity-functions.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
-
defined( 'ABSPATH' )
|
14 |
|
15 |
/**
|
16 |
* Check whether the $bp global lists an activity directory page.
|
@@ -45,14 +45,6 @@ function bp_activity_has_directory() {
|
|
45 |
* @return bool $retval True to enable mentions, false to disable.
|
46 |
*/
|
47 |
function bp_activity_do_mentions() {
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Filters whether or not mentions are enabled.
|
51 |
-
*
|
52 |
-
* @since BuddyPress (1.8.0)
|
53 |
-
*
|
54 |
-
* @param bool $enabled True to enable mentions, false to disable.
|
55 |
-
*/
|
56 |
return (bool) apply_filters( 'bp_activity_do_mentions', true );
|
57 |
}
|
58 |
|
@@ -64,18 +56,12 @@ function bp_activity_do_mentions() {
|
|
64 |
* @since BuddyPress (2.1.0)
|
65 |
*/
|
66 |
function bp_activity_maybe_load_mentions_scripts() {
|
67 |
-
$
|
68 |
-
|
|
|
|
|
69 |
|
70 |
-
|
71 |
-
* Filters whether or not BuddyPress should load mentions scripts and assets.
|
72 |
-
*
|
73 |
-
* @since BuddyPress (2.1.0)
|
74 |
-
*
|
75 |
-
* @param bool $load_mentions True to load mentions assets, false otherwise.
|
76 |
-
* @param bool $mentions_enabled True if mentions are enabled.
|
77 |
-
*/
|
78 |
-
return (bool) apply_filters( 'bp_activity_maybe_load_mentions_scripts', $load_mentions, $mentions_enabled );
|
79 |
}
|
80 |
|
81 |
/**
|
@@ -315,17 +301,17 @@ function bp_activity_get_userid_from_mentionname( $mentionname ) {
|
|
315 |
*
|
316 |
* @since BuddyPress (1.1.0)
|
317 |
*
|
318 |
-
* @param
|
319 |
-
* @param
|
320 |
-
* @param
|
321 |
-
* @param
|
322 |
-
* @param
|
323 |
-
*
|
324 |
-
*
|
325 |
-
*
|
326 |
* @return bool False if any param is empty, otherwise true.
|
327 |
*/
|
328 |
-
function bp_activity_set_action( $component_id, $type, $description, $format_callback = false, $label = false, $context = array()
|
329 |
$bp = buddypress();
|
330 |
|
331 |
// Return false if any of the above values are not set
|
@@ -347,235 +333,19 @@ function bp_activity_set_action( $component_id, $type, $description, $format_cal
|
|
347 |
$bp->activity->actions->{$component_id} = new stdClass;
|
348 |
}
|
349 |
|
350 |
-
/**
|
351 |
-
* Filters the action type being set for the current activity item.
|
352 |
-
*
|
353 |
-
* @since BuddyPress (1.1.0)
|
354 |
-
*
|
355 |
-
* @param array $array Array of arguments for action type being set.
|
356 |
-
* @param string $component_id ID of the current component being set.
|
357 |
-
* @param string $type Action type being set.
|
358 |
-
* @param string $description Action description for action being set.
|
359 |
-
* @param callable $format_callback Callback for formatting the action string.
|
360 |
-
* @param string $label String to describe this action in the activity stream filter dropdown.
|
361 |
-
* @param array $context Activity stream contexts where the filter should appear. 'activity', 'member',
|
362 |
-
* 'member_groups', 'group'.
|
363 |
-
*/
|
364 |
$bp->activity->actions->{$component_id}->{$type} = apply_filters( 'bp_activity_set_action', array(
|
365 |
'key' => $type,
|
366 |
'value' => $description,
|
367 |
'format_callback' => $format_callback,
|
368 |
'label' => $label,
|
369 |
'context' => $context,
|
370 |
-
'position' => $position,
|
371 |
), $component_id, $type, $description, $format_callback, $label, $context );
|
372 |
|
373 |
return true;
|
374 |
}
|
375 |
|
376 |
/**
|
377 |
-
*
|
378 |
-
*
|
379 |
-
* @since BuddyPress (2.2.0)
|
380 |
-
*
|
381 |
-
* @global $wp_post_types
|
382 |
-
*
|
383 |
-
* @param string $post_type The name of the post type, as registered with WordPress. Eg 'post' or 'page'.
|
384 |
-
* @param array $args {
|
385 |
-
* An associative array of tracking parameters. All items are optional.
|
386 |
-
*
|
387 |
-
* @type string $bp_activity_admin_filter String to use in the Dashboard > Activity dropdown.
|
388 |
-
* @type string $bp_activity_front_filter String to use in frontend dropdown.
|
389 |
-
* @type string $bp_activity_new_post String format to use for generating the activity action. Should be a
|
390 |
-
* translatable string where %1$s is replaced by a user link and %2$s is
|
391 |
-
* the URL of the newly created post.
|
392 |
-
* @type string $bp_activity_new_post_ms String format to use for generating the activity action on Multisite.
|
393 |
-
* Should be a translatable string where %1$s is replaced by a user link,
|
394 |
-
* %2$s is the URL of the newly created post, and %3$s is a link to
|
395 |
-
* the site.
|
396 |
-
* @type string $component_id ID of the BuddyPress component to associate the activity item.
|
397 |
-
* @type string $action_id Value for the 'type' param of the new activity item.
|
398 |
-
* @type callable $format_callback Callback for formatting the activity action string.
|
399 |
-
* Default: 'bp_activity_format_activity_action_custom_post_type_post'.
|
400 |
-
* @type array $contexts The directory contexts in which the filter will show.
|
401 |
-
* Default: array( 'activity' ),
|
402 |
-
* @type array $position Position of the item in filter dropdowns.
|
403 |
-
* @type string $singular Singular, translatable name of the post type item. If no value is
|
404 |
-
* provided, it's pulled from the 'singular_name' of the post type.
|
405 |
-
* @type bool $activity_comment Whether to allow comments on the activity items. Defaults to true if
|
406 |
-
* the post type does not natively support comments, otherwise false.
|
407 |
-
* }
|
408 |
-
*/
|
409 |
-
function bp_activity_set_post_type_tracking_args( $post_type = '', $args = array() ) {
|
410 |
-
global $wp_post_types;
|
411 |
-
$bp = buddypress();
|
412 |
-
|
413 |
-
if ( empty( $wp_post_types[ $post_type ] ) || ! post_type_supports( $post_type, 'buddypress-activity' ) || ! is_array( $args ) ) {
|
414 |
-
return false;
|
415 |
-
}
|
416 |
-
|
417 |
-
// Labels are loaded into the post type object.
|
418 |
-
foreach ( array( 'bp_activity_admin_filter', 'bp_activity_front_filter', 'bp_activity_new_post', 'bp_activity_new_post_ms' ) as $label_type ) {
|
419 |
-
if ( ! empty( $args[ $label_type ] ) ) {
|
420 |
-
$wp_post_types[ $post_type ]->labels->{$label_type} = $args[ $label_type ];
|
421 |
-
unset( $args[ $post_type ] );
|
422 |
-
}
|
423 |
-
}
|
424 |
-
|
425 |
-
// If there are any additional args, put them in the bp_activity attribute of the post type.
|
426 |
-
if ( ! empty( $args ) ) {
|
427 |
-
$wp_post_types[ $post_type ]->bp_activity = $args;
|
428 |
-
}
|
429 |
-
}
|
430 |
-
|
431 |
-
/**
|
432 |
-
* Get tracking arguments for a specific post type.
|
433 |
-
*
|
434 |
-
* @since BuddyPress (2.2.0)
|
435 |
-
*
|
436 |
-
* @param string $post_type Name of the post type
|
437 |
-
* @return object The tracking arguments of the post type.
|
438 |
-
*/
|
439 |
-
function bp_activity_get_post_type_tracking_args( $post_type ) {
|
440 |
-
if ( ! post_type_supports( $post_type, 'buddypress-activity' ) ) {
|
441 |
-
return false;
|
442 |
-
}
|
443 |
-
|
444 |
-
$post_type_object = get_post_type_object( $post_type );
|
445 |
-
|
446 |
-
$post_type_activity = array(
|
447 |
-
'component_id' => buddypress()->activity->id,
|
448 |
-
'action_id' => 'new_' . $post_type,
|
449 |
-
'format_callback' => 'bp_activity_format_activity_action_custom_post_type_post',
|
450 |
-
'front_filter' => $post_type_object->labels->name,
|
451 |
-
'contexts' => array( 'activity' ),
|
452 |
-
'position' => 0,
|
453 |
-
'singular' => strtolower( $post_type_object->labels->singular_name ),
|
454 |
-
'activity_comment' => ! post_type_supports( $post_type, 'comments' ),
|
455 |
-
);
|
456 |
-
|
457 |
-
if ( ! empty( $post_type_object->bp_activity ) ) {
|
458 |
-
$post_type_activity = bp_parse_args( (array) $post_type_object->bp_activity, $post_type_activity, $post_type . '_tracking_args' );
|
459 |
-
}
|
460 |
-
|
461 |
-
$post_type_activity = (object) $post_type_activity;
|
462 |
-
|
463 |
-
// Try to get the admin filter from the post type labels.
|
464 |
-
if ( ! empty( $post_type_object->labels->bp_activity_admin_filter ) ) {
|
465 |
-
$post_type_activity->admin_filter = $post_type_object->labels->bp_activity_admin_filter;
|
466 |
-
|
467 |
-
// Fall back to a generic name.
|
468 |
-
} else {
|
469 |
-
$post_type_activity->admin_filter = _x( 'New item published', 'Post Type generic activity post admin filter', 'buddypress' );
|
470 |
-
}
|
471 |
-
|
472 |
-
// Check for the front filter in the post type labels.
|
473 |
-
if ( ! empty( $post_type_object->labels->bp_activity_front_filter ) ) {
|
474 |
-
$post_type_activity->front_filter = $post_type_object->labels->bp_activity_front_filter;
|
475 |
-
}
|
476 |
-
|
477 |
-
// Try to get the action for new post type action on non-multisite installations.
|
478 |
-
if ( ! empty( $post_type_object->labels->bp_activity_new_post ) ) {
|
479 |
-
$post_type_activity->new_post_type_action = $post_type_object->labels->bp_activity_new_post;
|
480 |
-
}
|
481 |
-
|
482 |
-
// Try to get the action for new post type action on multisite installations.
|
483 |
-
if ( ! empty( $post_type_object->labels->bp_activity_new_post_ms ) ) {
|
484 |
-
$post_type_activity->new_post_type_action_ms = $post_type_object->labels->bp_activity_new_post_ms;
|
485 |
-
}
|
486 |
-
|
487 |
-
/**
|
488 |
-
* Filters tracking arguments for a specific post type.
|
489 |
-
*
|
490 |
-
* @since BuddyPress (2.2.0)
|
491 |
-
*
|
492 |
-
* @param object $post_type_activity The tracking arguments of the post type.
|
493 |
-
* @param string $post_type Name of the post type.
|
494 |
-
*/
|
495 |
-
return apply_filters( 'bp_activity_get_post_type_tracking_args', $post_type_activity, $post_type );
|
496 |
-
}
|
497 |
-
|
498 |
-
/**
|
499 |
-
* Get tracking arguments for all post types.
|
500 |
-
*
|
501 |
-
* @since BuddyPress (2.2.0)
|
502 |
-
*
|
503 |
-
* @return array List of post types with their tracking arguments.
|
504 |
-
*/
|
505 |
-
function bp_activity_get_post_types_tracking_args() {
|
506 |
-
// Fetch all public post types
|
507 |
-
$post_types = get_post_types( array( 'public' => true ), 'names' );
|
508 |
-
|
509 |
-
$post_types_tracking_args = array();
|
510 |
-
|
511 |
-
foreach ( $post_types as $post_type ) {
|
512 |
-
$track_post_type = bp_activity_get_post_type_tracking_args( $post_type );
|
513 |
-
|
514 |
-
if ( ! empty( $track_post_type ) ) {
|
515 |
-
$post_types_tracking_args[ $track_post_type->action_id ] = $track_post_type;
|
516 |
-
}
|
517 |
-
|
518 |
-
}
|
519 |
-
|
520 |
-
/**
|
521 |
-
* Filters tracking arguments for all post types.
|
522 |
-
*
|
523 |
-
* @since BuddyPress (2.2.0)
|
524 |
-
*
|
525 |
-
* @param array $post_types_tracking_args Array of post types with
|
526 |
-
* their tracking arguments.
|
527 |
-
*/
|
528 |
-
return apply_filters( 'bp_activity_get_post_types_tracking_args', $post_types_tracking_args );
|
529 |
-
}
|
530 |
-
|
531 |
-
/**
|
532 |
-
* Get all components' activity actions, sorted by their position attribute.
|
533 |
-
*
|
534 |
-
* @since BuddyPress (2.2.0)
|
535 |
-
*
|
536 |
-
* @return object actions ordered by their position
|
537 |
-
*/
|
538 |
-
function bp_activity_get_actions() {
|
539 |
-
$bp = buddypress();
|
540 |
-
|
541 |
-
$post_types = bp_activity_get_post_types_tracking_args();
|
542 |
-
|
543 |
-
// Create the actions for the post types, if they haven't already been created.
|
544 |
-
if ( ! empty( $post_types ) ) {
|
545 |
-
foreach ( $post_types as $post_type ) {
|
546 |
-
if ( isset( $bp->activity->actions->{$post_type->component_id}->{$post_type->action_id} ) ) {
|
547 |
-
continue;
|
548 |
-
}
|
549 |
-
|
550 |
-
bp_activity_set_action(
|
551 |
-
$post_type->component_id,
|
552 |
-
$post_type->action_id,
|
553 |
-
$post_type->admin_filter,
|
554 |
-
$post_type->format_callback,
|
555 |
-
$post_type->front_filter,
|
556 |
-
$post_type->contexts,
|
557 |
-
$post_type->position
|
558 |
-
);
|
559 |
-
}
|
560 |
-
}
|
561 |
-
|
562 |
-
// Sort the actions by their position within each component.
|
563 |
-
foreach ( $bp->activity->actions as $component => $actions ) {
|
564 |
-
$actions = (array) $actions;
|
565 |
-
$temp = bp_sort_by_key( $actions, 'position', 'num' );
|
566 |
-
|
567 |
-
// Restore keys.
|
568 |
-
$bp->activity->actions->{$component} = new stdClass;
|
569 |
-
foreach ( $temp as $key_ordered ) {
|
570 |
-
$bp->activity->actions->{$component}->{$key_ordered['key']} = $key_ordered;
|
571 |
-
}
|
572 |
-
}
|
573 |
-
|
574 |
-
return $bp->activity->actions;
|
575 |
-
}
|
576 |
-
|
577 |
-
/**
|
578 |
-
* Retrieve the current action from a component and key.
|
579 |
*
|
580 |
* @since BuddyPress (1.1.0)
|
581 |
*
|
@@ -592,23 +362,11 @@ function bp_activity_get_action( $component_id, $key ) {
|
|
592 |
return false;
|
593 |
}
|
594 |
|
595 |
-
$bp
|
596 |
-
$
|
|
|
|
|
597 |
|
598 |
-
$retval = false;
|
599 |
-
if ( isset( $actions->{$component_id}->{$key} ) ) {
|
600 |
-
$retval = $actions->{$component_id}->{$key};
|
601 |
-
}
|
602 |
-
|
603 |
-
/**
|
604 |
-
* Filters the current action by component and key.
|
605 |
-
*
|
606 |
-
* @since BuddyPress (1.1.0)
|
607 |
-
*
|
608 |
-
* @param string|bool $retval The action key.
|
609 |
-
* @param string $component_id The unique string ID of the component.
|
610 |
-
* @param string $key The action key.
|
611 |
-
*/
|
612 |
return apply_filters( 'bp_activity_get_action', $retval, $component_id, $key );
|
613 |
}
|
614 |
|
@@ -623,7 +381,7 @@ function bp_activity_get_types() {
|
|
623 |
$actions = array();
|
624 |
|
625 |
// Walk through the registered actions, and build an array of actions/values.
|
626 |
-
foreach (
|
627 |
$action = array_values( (array) $action );
|
628 |
|
629 |
for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ ) {
|
@@ -634,13 +392,6 @@ function bp_activity_get_types() {
|
|
634 |
// This was a mis-named activity type from before BP 1.6
|
635 |
unset( $actions['friends_register_activity_action'] );
|
636 |
|
637 |
-
/**
|
638 |
-
* Filters the available activity types.
|
639 |
-
*
|
640 |
-
* @since BuddyPress (1.7.0)
|
641 |
-
*
|
642 |
-
* @param array $actions Array of registered activity types.
|
643 |
-
*/
|
644 |
return apply_filters( 'bp_activity_get_types', $actions );
|
645 |
}
|
646 |
|
@@ -667,13 +418,6 @@ function bp_activity_get_user_favorites( $user_id = 0 ) {
|
|
667 |
// Get favorites for user
|
668 |
$favs = bp_get_user_meta( $user_id, 'bp_favorite_activities', true );
|
669 |
|
670 |
-
/**
|
671 |
-
* Filters the favorited activity items for a specified user.
|
672 |
-
*
|
673 |
-
* @since BuddyPress (1.2.0)
|
674 |
-
*
|
675 |
-
* @param array $favs Array of user's favorited activity items.
|
676 |
-
*/
|
677 |
return apply_filters( 'bp_activity_get_user_favorites', $favs );
|
678 |
}
|
679 |
|
@@ -729,14 +473,7 @@ function bp_activity_add_user_favorite( $activity_id, $user_id = 0 ) {
|
|
729 |
// Update activity meta counts
|
730 |
if ( bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count ) ) {
|
731 |
|
732 |
-
|
733 |
-
* Fires if bp_activity_update_meta() for favorite_count is successful and before returning a true value for success.
|
734 |
-
*
|
735 |
-
* @since BuddyPress (1.2.1)
|
736 |
-
*
|
737 |
-
* @param int $activity_id ID of the activity item being favorited.
|
738 |
-
* @param int $user_id ID of the user doing the favoriting.
|
739 |
-
*/
|
740 |
do_action( 'bp_activity_add_user_favorite', $activity_id, $user_id );
|
741 |
|
742 |
// Success
|
@@ -744,15 +481,7 @@ function bp_activity_add_user_favorite( $activity_id, $user_id = 0 ) {
|
|
744 |
|
745 |
// Saving meta was unsuccessful for an unknown reason
|
746 |
} else {
|
747 |
-
|
748 |
-
/**
|
749 |
-
* Fires if bp_activity_update_meta() for favorite_count is unsuccessful and before returning a false value for failure.
|
750 |
-
*
|
751 |
-
* @since BuddyPress (1.5.0)
|
752 |
-
*
|
753 |
-
* @param int $activity_id ID of the activity item being favorited.
|
754 |
-
* @param int $user_id ID of the user doing the favoriting.
|
755 |
-
*/
|
756 |
do_action( 'bp_activity_add_user_favorite_fail', $activity_id, $user_id );
|
757 |
|
758 |
return false;
|
@@ -809,14 +538,7 @@ function bp_activity_remove_user_favorite( $activity_id, $user_id = 0 ) {
|
|
809 |
// Update users favorites
|
810 |
if ( bp_update_user_meta( $user_id, 'bp_favorite_activities', $my_favs ) ) {
|
811 |
|
812 |
-
|
813 |
-
* Fires if bp_update_user_meta() is successful and before returning a true value for success.
|
814 |
-
*
|
815 |
-
* @since BuddyPress (1.2.1)
|
816 |
-
*
|
817 |
-
* @param int $activity_id ID of the activity item being unfavorited.
|
818 |
-
* @param int $user_id ID of the user doing the unfavoriting.
|
819 |
-
*/
|
820 |
do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id );
|
821 |
|
822 |
// Success
|
@@ -850,14 +572,6 @@ function bp_activity_remove_user_favorite( $activity_id, $user_id = 0 ) {
|
|
850 |
* @return int|null The ID of the located activity item. Null if none is found.
|
851 |
*/
|
852 |
function bp_activity_check_exists_by_content( $content ) {
|
853 |
-
|
854 |
-
/**
|
855 |
-
* Filters the results of the check for whether an activity item exists by specified content.
|
856 |
-
*
|
857 |
-
* @since BuddyPress (1.1.0)
|
858 |
-
*
|
859 |
-
* @param BP_Activity_Activity $content_exists ID of the activity if found, else null.
|
860 |
-
*/
|
861 |
return apply_filters( 'bp_activity_check_exists_by_content', BP_Activity_Activity::check_exists_by_content( $content ) );
|
862 |
}
|
863 |
|
@@ -872,14 +586,6 @@ function bp_activity_check_exists_by_content( $content ) {
|
|
872 |
* @return string Date last updated.
|
873 |
*/
|
874 |
function bp_activity_get_last_updated() {
|
875 |
-
|
876 |
-
/**
|
877 |
-
* Filters the value for the last updated time for an activity item.
|
878 |
-
*
|
879 |
-
* @since BuddyPress (1.1.0)
|
880 |
-
*
|
881 |
-
* @param BP_Activity_Activity $last_updated Date last updated.
|
882 |
-
*/
|
883 |
return apply_filters( 'bp_activity_get_last_updated', BP_Activity_Activity::get_last_updated() );
|
884 |
}
|
885 |
|
@@ -970,16 +676,7 @@ function bp_activity_get_meta( $activity_id = 0, $meta_key = '', $single = true
|
|
970 |
$retval = get_metadata( 'activity', $activity_id, $meta_key, $single );
|
971 |
remove_filter( 'query', 'bp_filter_metaid_column_name' );
|
972 |
|
973 |
-
|
974 |
-
* Filters the metadata for a specified activity item.
|
975 |
-
*
|
976 |
-
* @since BuddyPress (1.5.0)
|
977 |
-
*
|
978 |
-
* @param mixed $retval The meta values for the activity item.
|
979 |
-
* @param int $activity_id ID of the activity item.
|
980 |
-
* @param string $meta_key Meta key for the value being requested.
|
981 |
-
* @param bool $single Whether to return one matched meta key row or all.
|
982 |
-
*/
|
983 |
return apply_filters( 'bp_activity_get_meta', $retval, $activity_id, $meta_key, $single );
|
984 |
}
|
985 |
|
@@ -1060,13 +757,7 @@ function bp_activity_remove_all_user_data( $user_id = 0 ) {
|
|
1060 |
// Execute additional code
|
1061 |
do_action( 'bp_activity_remove_data', $user_id ); // Deprecated! Do not use!
|
1062 |
|
1063 |
-
|
1064 |
-
* Fires after the removal of all of a user's activity data.
|
1065 |
-
*
|
1066 |
-
* @since BuddyPress (1.5.0)
|
1067 |
-
*
|
1068 |
-
* @param int $user_id ID of the user being deleted.
|
1069 |
-
*/
|
1070 |
do_action( 'bp_activity_remove_all_user_data', $user_id );
|
1071 |
}
|
1072 |
add_action( 'wpmu_delete_user', 'bp_activity_remove_all_user_data' );
|
@@ -1115,7 +806,7 @@ function bp_activity_spam_all_user_data( $user_id = 0 ) {
|
|
1115 |
* If Akismet is present, update the activity history meta.
|
1116 |
*
|
1117 |
* This is usually taken care of when BP_Activity_Activity::save() happens, but
|
1118 |
-
* as we're going to be updating all the activity statuses directly, for
|
1119 |
* we need to update manually.
|
1120 |
*/
|
1121 |
if ( ! empty( $bp->activity->akismet ) ) {
|
@@ -1129,14 +820,7 @@ function bp_activity_spam_all_user_data( $user_id = 0 ) {
|
|
1129 |
// Mark all of this user's activities as spam
|
1130 |
$wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET is_spam = 1 WHERE user_id = %d", $user_id ) );
|
1131 |
|
1132 |
-
|
1133 |
-
* Fires after all activity data from a user has been marked as spam.
|
1134 |
-
*
|
1135 |
-
* @since BuddyPress (1.6.0)
|
1136 |
-
*
|
1137 |
-
* @param int $user_id ID of the user whose activity is being marked as spam.
|
1138 |
-
* @param array $activities Array of activity items being marked as spam.
|
1139 |
-
*/
|
1140 |
do_action( 'bp_activity_spam_all_user_data', $user_id, $activities['activities'] );
|
1141 |
}
|
1142 |
add_action( 'bp_make_spam_user', 'bp_activity_spam_all_user_data' );
|
@@ -1185,7 +869,7 @@ function bp_activity_ham_all_user_data( $user_id = 0 ) {
|
|
1185 |
* If Akismet is present, update the activity history meta.
|
1186 |
*
|
1187 |
* This is usually taken care of when BP_Activity_Activity::save() happens, but
|
1188 |
-
* as we're going to be updating all the activity statuses directly, for
|
1189 |
* we need to update manually.
|
1190 |
*/
|
1191 |
if ( ! empty( $bp->activity->akismet ) ) {
|
@@ -1196,17 +880,10 @@ function bp_activity_ham_all_user_data( $user_id = 0 ) {
|
|
1196 |
unset( $activity_obj );
|
1197 |
}
|
1198 |
|
1199 |
-
// Mark all of this user's activities as
|
1200 |
$wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET is_spam = 0 WHERE user_id = %d", $user_id ) );
|
1201 |
|
1202 |
-
|
1203 |
-
* Fires after all activity data from a user has been marked as ham.
|
1204 |
-
*
|
1205 |
-
* @since BuddyPress (1.6.0)
|
1206 |
-
*
|
1207 |
-
* @param int $user_id ID of the user whose activity is being marked as ham.
|
1208 |
-
* @param array $activities Array of activity items being marked as ham.
|
1209 |
-
*/
|
1210 |
do_action( 'bp_activity_ham_all_user_data', $user_id, $activities['activities'] );
|
1211 |
}
|
1212 |
add_action( 'bp_make_ham_user', 'bp_activity_ham_all_user_data' );
|
@@ -1236,13 +913,6 @@ function bp_activity_register_activity_actions() {
|
|
1236 |
__( 'Activity Comments', 'buddypress' )
|
1237 |
);
|
1238 |
|
1239 |
-
/**
|
1240 |
-
* Fires at the end of the activity actions registration.
|
1241 |
-
*
|
1242 |
-
* Allows plugin authors to add their own activity actions alongside the core actions.
|
1243 |
-
*
|
1244 |
-
* @since BuddyPress (1.6.0)
|
1245 |
-
*/
|
1246 |
do_action( 'bp_activity_register_activity_actions' );
|
1247 |
|
1248 |
// Backpat. Don't use this.
|
@@ -1265,26 +935,18 @@ function bp_activity_generate_action_string( $activity ) {
|
|
1265 |
}
|
1266 |
|
1267 |
// Check for registered format callback
|
1268 |
-
|
1269 |
-
if ( empty( $actions->{$activity->component}->{$activity->type}['format_callback'] ) ) {
|
1270 |
return false;
|
1271 |
}
|
1272 |
|
1273 |
// We apply the format_callback as a filter
|
1274 |
-
add_filter( 'bp_activity_generate_action_string',
|
1275 |
|
1276 |
-
|
1277 |
-
* Filters the string for the activity action being returned.
|
1278 |
-
*
|
1279 |
-
* @since BuddyPress (2.0.0)
|
1280 |
-
*
|
1281 |
-
* @param BP_Activity_Activity $action Action string being requested.
|
1282 |
-
* @param BP_Activity_Activity $activity Activity item object.
|
1283 |
-
*/
|
1284 |
$action = apply_filters( 'bp_activity_generate_action_string', $activity->action, $activity );
|
1285 |
|
1286 |
// Remove the filter for future activity items
|
1287 |
-
remove_filter( 'bp_activity_generate_action_string',
|
1288 |
|
1289 |
return $action;
|
1290 |
}
|
@@ -1300,15 +962,6 @@ function bp_activity_generate_action_string( $activity ) {
|
|
1300 |
*/
|
1301 |
function bp_activity_format_activity_action_activity_update( $action, $activity ) {
|
1302 |
$action = sprintf( __( '%s posted an update', 'buddypress' ), bp_core_get_userlink( $activity->user_id ) );
|
1303 |
-
|
1304 |
-
/**
|
1305 |
-
* Filters the formatted activity action update string.
|
1306 |
-
*
|
1307 |
-
* @since BuddyPress (1.2.0)
|
1308 |
-
*
|
1309 |
-
* @param string $action Activity action string value.
|
1310 |
-
* @param BP_Activity_Activity $activity Activity item object.
|
1311 |
-
*/
|
1312 |
return apply_filters( 'bp_activity_new_update_action', $action, $activity );
|
1313 |
}
|
1314 |
|
@@ -1323,75 +976,9 @@ function bp_activity_format_activity_action_activity_update( $action, $activity
|
|
1323 |
*/
|
1324 |
function bp_activity_format_activity_action_activity_comment( $action, $activity ) {
|
1325 |
$action = sprintf( __( '%s posted a new activity comment', 'buddypress' ), bp_core_get_userlink( $activity->user_id ) );
|
1326 |
-
|
1327 |
-
/**
|
1328 |
-
* Filters the formatted activity action comment string.
|
1329 |
-
*
|
1330 |
-
* @since BuddyPress (1.2.0)
|
1331 |
-
*
|
1332 |
-
* @param string $action Activity action string value.
|
1333 |
-
* @param BP_Activity_Activity $activity Activity item object.
|
1334 |
-
*/
|
1335 |
return apply_filters( 'bp_activity_comment_action', $action, $activity );
|
1336 |
}
|
1337 |
|
1338 |
-
/**
|
1339 |
-
* Format activity action strings for custom post types.
|
1340 |
-
*
|
1341 |
-
* @since BuddyPress (2.2.0)
|
1342 |
-
*
|
1343 |
-
* @param string $action Static activity action.
|
1344 |
-
* @param object $activity Activity data object.
|
1345 |
-
* @return string
|
1346 |
-
*/
|
1347 |
-
function bp_activity_format_activity_action_custom_post_type_post( $action, $activity ) {
|
1348 |
-
$bp = buddypress();
|
1349 |
-
|
1350 |
-
// Fetch all the tracked post types once.
|
1351 |
-
if ( empty( $bp->activity->track ) ) {
|
1352 |
-
$bp->activity->track = bp_activity_get_post_types_tracking_args();
|
1353 |
-
}
|
1354 |
-
|
1355 |
-
if ( empty( $activity->type ) || empty( $bp->activity->track[ $activity->type ] ) ) {
|
1356 |
-
return $action;
|
1357 |
-
}
|
1358 |
-
|
1359 |
-
$user_link = bp_core_get_userlink( $activity->user_id );
|
1360 |
-
$blog_url = get_home_url( $activity->item_id );
|
1361 |
-
|
1362 |
-
if ( empty( $activity->post_url ) ) {
|
1363 |
-
$post_url = add_query_arg( 'p', $activity->secondary_item_id, trailingslashit( $blog_url ) );
|
1364 |
-
} else {
|
1365 |
-
$post_url = $activity->post_url;
|
1366 |
-
}
|
1367 |
-
|
1368 |
-
if ( is_multisite() ) {
|
1369 |
-
$blog_link = '<a href="' . esc_url( $blog_url ) . '">' . get_blog_option( $activity->item_id, 'blogname' ) . '</a>';
|
1370 |
-
|
1371 |
-
if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_action_ms ) ) {
|
1372 |
-
$action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_action_ms, $user_link, $post_url, $blog_link );
|
1373 |
-
} else {
|
1374 |
-
$action = sprintf( _x( '%1$s wrote a new <a href="%2$s">item</a>, on the site %3$s', 'Activity Custom Post Type post action', 'buddypress' ), $user_link, esc_url( $post_url ), $blog_link );
|
1375 |
-
}
|
1376 |
-
} else {
|
1377 |
-
if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_action ) ) {
|
1378 |
-
$action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_action, $user_link, $post_url );
|
1379 |
-
} else {
|
1380 |
-
$action = sprintf( _x( '%1$s wrote a new <a href="%2$s">item</a>', 'Activity Custom Post Type post action', 'buddypress' ), $user_link, esc_url( $post_url ) );
|
1381 |
-
}
|
1382 |
-
}
|
1383 |
-
|
1384 |
-
/**
|
1385 |
-
* Filters the formatted custom post type activity post action string.
|
1386 |
-
*
|
1387 |
-
* @since BuddyPress (2.2.0)
|
1388 |
-
*
|
1389 |
-
* @param string $action Activity action string value.
|
1390 |
-
* @param BP_Activity_Activity $activity Activity item object.
|
1391 |
-
*/
|
1392 |
-
return apply_filters( 'bp_activity_custom_post_type_post_action', $action, $activity );
|
1393 |
-
}
|
1394 |
-
|
1395 |
/******************************************************************************
|
1396 |
* Business functions are where all the magic happens in BuddyPress. They will
|
1397 |
* handle the actual saving or manipulation of information. Usually they will
|
@@ -1433,14 +1020,12 @@ function bp_activity_get( $args = '' ) {
|
|
1433 |
'search_terms' => false, // Pass search terms as a string
|
1434 |
'meta_query' => false, // Filter by activity meta. See WP_Meta_Query for format
|
1435 |
'date_query' => false, // Filter by date. See first parameter of WP_Date_Query for format
|
1436 |
-
'filter_query' => false,
|
1437 |
'show_hidden' => false, // Show activity items that are hidden site-wide?
|
1438 |
'exclude' => false, // Comma-separated list of activity IDs to exclude
|
1439 |
'in' => false, // Comma-separated list or array of activity IDs to which you want to limit the query
|
1440 |
'spam' => 'ham_only', // 'ham_only' (default), 'spam_only' or 'all'.
|
1441 |
'update_meta_cache' => true,
|
1442 |
'count_total' => false,
|
1443 |
-
'scope' => false,
|
1444 |
|
1445 |
/**
|
1446 |
* Pass filters as an array -- all filter items can be multiple values comma separated:
|
@@ -1456,7 +1041,7 @@ function bp_activity_get( $args = '' ) {
|
|
1456 |
) );
|
1457 |
|
1458 |
// Attempt to return a cached copy of the first page of sitewide activity.
|
1459 |
-
if ( ( 1 === (int) $r['page'] ) && empty( $r['max'] ) && empty( $r['search_terms'] ) && empty( $r['meta_query'] ) && empty( $r['date_query'] ) && empty( $r['
|
1460 |
|
1461 |
$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' );
|
1462 |
if ( false === $activity ) {
|
@@ -1469,9 +1054,7 @@ function bp_activity_get( $args = '' ) {
|
|
1469 |
'search_terms' => $r['search_terms'],
|
1470 |
'meta_query' => $r['meta_query'],
|
1471 |
'date_query' => $r['date_query'],
|
1472 |
-
'filter_query' => $r['filter_query'],
|
1473 |
'filter' => $r['filter'],
|
1474 |
-
'scope' => $r['scope'],
|
1475 |
'display_comments' => $r['display_comments'],
|
1476 |
'show_hidden' => $r['show_hidden'],
|
1477 |
'spam' => $r['spam'],
|
@@ -1491,9 +1074,7 @@ function bp_activity_get( $args = '' ) {
|
|
1491 |
'search_terms' => $r['search_terms'],
|
1492 |
'meta_query' => $r['meta_query'],
|
1493 |
'date_query' => $r['date_query'],
|
1494 |
-
'filter_query' => $r['filter_query'],
|
1495 |
'filter' => $r['filter'],
|
1496 |
-
'scope' => $r['scope'],
|
1497 |
'display_comments' => $r['display_comments'],
|
1498 |
'show_hidden' => $r['show_hidden'],
|
1499 |
'exclude' => $r['exclude'],
|
@@ -1503,14 +1084,6 @@ function bp_activity_get( $args = '' ) {
|
|
1503 |
) );
|
1504 |
}
|
1505 |
|
1506 |
-
/**
|
1507 |
-
* Filters the requested activity item(s).
|
1508 |
-
*
|
1509 |
-
* @since BuddyPress (1.2.0)
|
1510 |
-
*
|
1511 |
-
* @param BP_Activity_Activity $activity Requested activity object.
|
1512 |
-
* @param array $r Arguments used for the activity query.
|
1513 |
-
*/
|
1514 |
return apply_filters_ref_array( 'bp_activity_get', array( &$activity, &$r ) );
|
1515 |
}
|
1516 |
|
@@ -1558,15 +1131,6 @@ function bp_activity_get_specific( $args = '' ) {
|
|
1558 |
'update_meta_cache' => $r['update_meta_cache'],
|
1559 |
);
|
1560 |
|
1561 |
-
/**
|
1562 |
-
* Filters the requested specific activity item.
|
1563 |
-
*
|
1564 |
-
* @since BuddyPress (1.2.0)
|
1565 |
-
*
|
1566 |
-
* @param BP_Activity_Activity $activity Requested activity object.
|
1567 |
-
* @param array $args Original passed in arguments.
|
1568 |
-
* @param array $get_args Constructed arguments used with request.
|
1569 |
-
*/
|
1570 |
return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get( $get_args ), $args, $get_args );
|
1571 |
}
|
1572 |
|
@@ -1669,14 +1233,6 @@ function bp_activity_add( $args = '' ) {
|
|
1669 |
}
|
1670 |
|
1671 |
wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
|
1672 |
-
|
1673 |
-
/**
|
1674 |
-
* Fires at the end of the execution of adding a new activity item, before returning the new activity item ID.
|
1675 |
-
*
|
1676 |
-
* @since BuddyPress (1.1.0)
|
1677 |
-
*
|
1678 |
-
* @param array $r Array of parsed arguments for the activity item being added.
|
1679 |
-
*/
|
1680 |
do_action( 'bp_activity_add', $r );
|
1681 |
|
1682 |
return $activity->id;
|
@@ -1723,41 +1279,15 @@ function bp_activity_post_update( $args = '' ) {
|
|
1723 |
$activity_content = $r['content'];
|
1724 |
$primary_link = bp_core_get_userlink( $r['user_id'], false, true );
|
1725 |
|
1726 |
-
/**
|
1727 |
-
* Filters the new activity content for current activity item.
|
1728 |
-
*
|
1729 |
-
* @since BuddyPress (1.2.0)
|
1730 |
-
*
|
1731 |
-
* @param string $activity_content Activity content posted by user.
|
1732 |
-
*/
|
1733 |
-
$add_content = apply_filters( 'bp_activity_new_update_content', $activity_content );
|
1734 |
-
|
1735 |
-
/**
|
1736 |
-
* Filters the activity primary link for current activity item.
|
1737 |
-
*
|
1738 |
-
* @since BuddyPress (1.2.0)
|
1739 |
-
*
|
1740 |
-
* @param string $primary_link Link to the profile for the user who posted the activity.
|
1741 |
-
*/
|
1742 |
-
$add_primary_link = apply_filters( 'bp_activity_new_update_primary_link', $primary_link );
|
1743 |
-
|
1744 |
// Now write the values
|
1745 |
$activity_id = bp_activity_add( array(
|
1746 |
'user_id' => $r['user_id'],
|
1747 |
-
'content' => $
|
1748 |
-
'primary_link' => $
|
1749 |
'component' => buddypress()->activity->id,
|
1750 |
'type' => 'activity_update',
|
1751 |
) );
|
1752 |
|
1753 |
-
/**
|
1754 |
-
* Filters the latest update content for the activity item.
|
1755 |
-
*
|
1756 |
-
* @since BuddyPress (1.6.0)
|
1757 |
-
*
|
1758 |
-
* @param string $r Content of the activity update.
|
1759 |
-
* @param string $activity_content Content of the activity update.
|
1760 |
-
*/
|
1761 |
$activity_content = apply_filters( 'bp_activity_latest_update_content', $r['content'], $activity_content );
|
1762 |
|
1763 |
// Add this update to the "latest update" usermeta so it can be fetched anywhere.
|
@@ -1766,288 +1296,11 @@ function bp_activity_post_update( $args = '' ) {
|
|
1766 |
'content' => $activity_content
|
1767 |
) );
|
1768 |
|
1769 |
-
/**
|
1770 |
-
* Fires at the end of an activity post update, before returning the updated activity item ID.
|
1771 |
-
*
|
1772 |
-
* @since BuddyPress (1.2.0)
|
1773 |
-
*
|
1774 |
-
* @param string $content Content of the activity post update.
|
1775 |
-
* @param int $user_id ID of the user posting the activity update.
|
1776 |
-
* @param int $activity_id ID of the activity item being updated.
|
1777 |
-
*/
|
1778 |
do_action( 'bp_activity_posted_update', $r['content'], $r['user_id'], $activity_id );
|
1779 |
|
1780 |
return $activity_id;
|
1781 |
}
|
1782 |
|
1783 |
-
/**
|
1784 |
-
* Create an activity item for a newly published post type post.
|
1785 |
-
*
|
1786 |
-
* @since BuddyPress (2.2.0)
|
1787 |
-
*
|
1788 |
-
* @param int $post_id ID of the new post.
|
1789 |
-
* @param WP_Post $post Post object.
|
1790 |
-
* @param int $user_id ID of the post author.
|
1791 |
-
* @return int|bool The ID of the activity on success. False on error.
|
1792 |
-
*/
|
1793 |
-
function bp_activity_post_type_publish( $post_id = 0, $post = null, $user_id = 0 ) {
|
1794 |
-
$bp = buddypress();
|
1795 |
-
|
1796 |
-
if ( ! is_a( $post, 'WP_Post' ) ) {
|
1797 |
-
return;
|
1798 |
-
}
|
1799 |
-
|
1800 |
-
// Get the post type tracking args.
|
1801 |
-
$activity_post_object = bp_activity_get_post_type_tracking_args( $post->post_type );
|
1802 |
-
|
1803 |
-
if ( 'publish' != $post->post_status || ! empty( $post->post_password ) || empty( $activity_post_object->action_id ) ) {
|
1804 |
-
return;
|
1805 |
-
}
|
1806 |
-
|
1807 |
-
if ( empty( $post_id ) ) {
|
1808 |
-
$post_id = $post->ID;
|
1809 |
-
}
|
1810 |
-
|
1811 |
-
$blog_id = get_current_blog_id();
|
1812 |
-
|
1813 |
-
if ( empty( $user_id ) ) {
|
1814 |
-
$user_id = (int) $post->post_author;
|
1815 |
-
}
|
1816 |
-
|
1817 |
-
// Bail if an activity item already exists for this post.
|
1818 |
-
$existing = bp_activity_get( array(
|
1819 |
-
'filter' => array(
|
1820 |
-
'action' => $activity_post_object->action_id,
|
1821 |
-
'primary_id' => $blog_id,
|
1822 |
-
'secondary_id' => $post_id,
|
1823 |
-
)
|
1824 |
-
) );
|
1825 |
-
|
1826 |
-
if ( ! empty( $existing['activities'] ) ) {
|
1827 |
-
return;
|
1828 |
-
}
|
1829 |
-
|
1830 |
-
/**
|
1831 |
-
* Filters whether or not to post the activity.
|
1832 |
-
*
|
1833 |
-
* This is a variable filter, dependent on the post type,
|
1834 |
-
* that lets components or plugins bail early if needed.
|
1835 |
-
*
|
1836 |
-
* @since BuddyPress (2.2.0)
|
1837 |
-
*
|
1838 |
-
* @param bool $value Whether or not to continue.
|
1839 |
-
* @param int $blog_id ID of the current site.
|
1840 |
-
* @param int $post_id ID of the current post being published.
|
1841 |
-
* @param int $user_id ID of the current user or post author.
|
1842 |
-
*/
|
1843 |
-
if ( false === apply_filters( "bp_activity_{$post->post_type}_pre_publish", true, $blog_id, $post_id, $user_id ) ) {
|
1844 |
-
return;
|
1845 |
-
}
|
1846 |
-
|
1847 |
-
// Record this in activity streams.
|
1848 |
-
$blog_url = get_home_url( $blog_id );
|
1849 |
-
$post_url = add_query_arg(
|
1850 |
-
'p',
|
1851 |
-
$post_id,
|
1852 |
-
trailingslashit( $blog_url )
|
1853 |
-
);
|
1854 |
-
|
1855 |
-
// Backward compatibility filters for the 'blogs' component.
|
1856 |
-
if ( 'blogs' == $activity_post_object->component_id ) {
|
1857 |
-
$activity_content = apply_filters( 'bp_blogs_activity_new_post_content', $post->post_content, $post, $post_url, $post->post_type );
|
1858 |
-
$activity_primary_link = apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_url, $post_id, $post->post_type );
|
1859 |
-
} else {
|
1860 |
-
$activity_content = $post->post_content;
|
1861 |
-
$activity_primary_link = $post_url;
|
1862 |
-
}
|
1863 |
-
|
1864 |
-
$activity_args = array(
|
1865 |
-
'user_id' => $user_id,
|
1866 |
-
'content' => $activity_content,
|
1867 |
-
'primary_link' => $activity_primary_link,
|
1868 |
-
'component' => $activity_post_object->component_id,
|
1869 |
-
'type' => $activity_post_object->action_id,
|
1870 |
-
'item_id' => $blog_id,
|
1871 |
-
'secondary_item_id' => $post_id,
|
1872 |
-
'recorded_time' => $post->post_date_gmt,
|
1873 |
-
);
|
1874 |
-
|
1875 |
-
// Remove large images and replace them with just one image thumbnail.
|
1876 |
-
if ( ! empty( $activity_args['content'] ) ) {
|
1877 |
-
$activity_args['content'] = bp_activity_thumbnail_content_images( $activity_args['content'], $activity_args['primary_link'], $activity_args );
|
1878 |
-
}
|
1879 |
-
|
1880 |
-
if ( ! empty( $activity_args['content'] ) ) {
|
1881 |
-
// Create the excerpt.
|
1882 |
-
$activity_excerpt = bp_create_excerpt( $activity_args['content'] );
|
1883 |
-
|
1884 |
-
// Backward compatibility filter for blog posts.
|
1885 |
-
if ( 'blogs' == $activity_post_object->component_id ) {
|
1886 |
-
$activity_args['content'] = apply_filters( 'bp_blogs_record_activity_content', $activity_excerpt, $activity_args['content'], $activity_args, $post->post_type );
|
1887 |
-
} else {
|
1888 |
-
$activity_args['content'] = $activity_excerpt;
|
1889 |
-
}
|
1890 |
-
}
|
1891 |
-
|
1892 |
-
// Set up the action by using the format functions.
|
1893 |
-
$action_args = array_merge( $activity_args, array(
|
1894 |
-
'post_title' => $post->post_title,
|
1895 |
-
'post_url' => $post_url,
|
1896 |
-
) );
|
1897 |
-
|
1898 |
-
$activity_args['action'] = call_user_func_array( $activity_post_object->format_callback, array( '', (object) $action_args ) );
|
1899 |
-
|
1900 |
-
// Make sure the action is set.
|
1901 |
-
if ( empty( $activity_args['action'] ) ) {
|
1902 |
-
return;
|
1903 |
-
} else {
|
1904 |
-
// Backward compatibility filter for the blogs component.
|
1905 |
-
if ( 'blogs' == $activity_post_object->component_id ) {
|
1906 |
-
$activity_args['action'] = apply_filters( 'bp_blogs_record_activity_action', $activity_args['action'] );
|
1907 |
-
}
|
1908 |
-
}
|
1909 |
-
|
1910 |
-
$activity_id = bp_activity_add( $activity_args );
|
1911 |
-
|
1912 |
-
/**
|
1913 |
-
* Fires after the publishing of an activity item for a newly published post type post.
|
1914 |
-
*
|
1915 |
-
* @since BuddyPress (2.2.0)
|
1916 |
-
*
|
1917 |
-
* @param int $activity_id ID of the newly published activity item.
|
1918 |
-
* @param WP_Post $post Post object.
|
1919 |
-
* @param array $activity_args Array of activity arguments.
|
1920 |
-
*/
|
1921 |
-
do_action( 'bp_activity_post_type_published', $activity_id, $post, $activity_args );
|
1922 |
-
|
1923 |
-
return $activity_id;
|
1924 |
-
}
|
1925 |
-
|
1926 |
-
/**
|
1927 |
-
* Update the activity item for a custom post type entry.
|
1928 |
-
*
|
1929 |
-
* @since BuddyPress (2.2.0)
|
1930 |
-
*
|
1931 |
-
* @param WP_Post $post Post item.
|
1932 |
-
* @return bool True on success, false on failure.
|
1933 |
-
*/
|
1934 |
-
function bp_activity_post_type_update( $post = null ) {
|
1935 |
-
$bp = buddypress();
|
1936 |
-
|
1937 |
-
if ( ! is_a( $post, 'WP_Post' ) ) {
|
1938 |
-
return;
|
1939 |
-
}
|
1940 |
-
|
1941 |
-
// Get the post type tracking args.
|
1942 |
-
$activity_post_object = bp_activity_get_post_type_tracking_args( $post->post_type );
|
1943 |
-
|
1944 |
-
if ( empty( $activity_post_object->action_id ) ) {
|
1945 |
-
return;
|
1946 |
-
}
|
1947 |
-
|
1948 |
-
$activity_id = bp_activity_get_activity_id( array(
|
1949 |
-
'component' => $activity_post_object->component_id,
|
1950 |
-
'item_id' => get_current_blog_id(),
|
1951 |
-
'secondary_item_id' => $post->ID,
|
1952 |
-
'type' => $activity_post_object->action_id,
|
1953 |
-
) );
|
1954 |
-
|
1955 |
-
// Activity ID doesn't exist, so stop!
|
1956 |
-
if ( empty( $activity_id ) ) {
|
1957 |
-
return;
|
1958 |
-
}
|
1959 |
-
|
1960 |
-
// Delete the activity if the post was updated with a password.
|
1961 |
-
if ( ! empty( $post->post_password ) ) {
|
1962 |
-
bp_activity_delete( array( 'id' => $activity_id ) );
|
1963 |
-
}
|
1964 |
-
|
1965 |
-
// Update the activity entry.
|
1966 |
-
$activity = new BP_Activity_Activity( $activity_id );
|
1967 |
-
|
1968 |
-
if ( ! empty( $post->post_content ) ) {
|
1969 |
-
// Make sure to update the thumbnail image.
|
1970 |
-
$post_content = bp_activity_thumbnail_content_images( $post->post_content, $activity->primary_link, (array) $activity );
|
1971 |
-
|
1972 |
-
// Generate an excerpt.
|
1973 |
-
$activity_excerpt = bp_create_excerpt( $post_content );
|
1974 |
-
|
1975 |
-
// Backward compatibility filter for the blogs component.
|
1976 |
-
if ( 'blogs' == $activity_post_object->component_id ) {
|
1977 |
-
$activity->content = apply_filters( 'bp_blogs_record_activity_content', $activity_excerpt, $post_content, (array) $activity, $post->post_type );
|
1978 |
-
} else {
|
1979 |
-
$activity->content = $activity_excerpt;
|
1980 |
-
}
|
1981 |
-
}
|
1982 |
-
|
1983 |
-
// Save the updated activity.
|
1984 |
-
$updated = $activity->save();
|
1985 |
-
|
1986 |
-
/**
|
1987 |
-
* Fires after the updating of an activity item for a custom post type entry.
|
1988 |
-
*
|
1989 |
-
* @since BuddyPress (2.2.0)
|
1990 |
-
*
|
1991 |
-
* @param WP_Post $post Post object.
|
1992 |
-
* @param BP_Activity_Activity $activity Activity object.
|
1993 |
-
*/
|
1994 |
-
do_action( 'bp_activity_post_type_updated', $post, $activity );
|
1995 |
-
|
1996 |
-
return $updated;
|
1997 |
-
}
|
1998 |
-
|
1999 |
-
/**
|
2000 |
-
* Unpublish an activity for the custom post type.
|
2001 |
-
*
|
2002 |
-
* @since BuddyPress (2.2.0)
|
2003 |
-
*
|
2004 |
-
* @param int $post_id ID of the post being unpublished.
|
2005 |
-
* @param WP_Post $post Post object.
|
2006 |
-
* @return bool True on success, false on failure.
|
2007 |
-
*/
|
2008 |
-
function bp_activity_post_type_unpublish( $post_id = 0, $post = null ) {
|
2009 |
-
$bp = buddypress();
|
2010 |
-
|
2011 |
-
if ( ! is_a( $post, 'WP_Post' ) ) {
|
2012 |
-
return;
|
2013 |
-
}
|
2014 |
-
|
2015 |
-
// Get the post type tracking args
|
2016 |
-
$activity_post_object = bp_activity_get_post_type_tracking_args( $post->post_type );
|
2017 |
-
|
2018 |
-
if ( empty( $activity_post_object->action_id ) ) {
|
2019 |
-
return;
|
2020 |
-
}
|
2021 |
-
|
2022 |
-
if ( empty( $post_id ) ) {
|
2023 |
-
$post_id = $post->ID;
|
2024 |
-
}
|
2025 |
-
|
2026 |
-
$delete_activity_args = array(
|
2027 |
-
'item_id' => get_current_blog_id(),
|
2028 |
-
'secondary_item_id' => $post_id,
|
2029 |
-
'component' => $activity_post_object->component_id,
|
2030 |
-
'type' => $activity_post_object->action_id,
|
2031 |
-
'user_id' => false,
|
2032 |
-
);
|
2033 |
-
|
2034 |
-
$deleted = bp_activity_delete_by_item_id( $delete_activity_args );
|
2035 |
-
|
2036 |
-
/**
|
2037 |
-
* Fires after the unpublishing for the custom post type.
|
2038 |
-
*
|
2039 |
-
* @since BuddyPress (2.2.0)
|
2040 |
-
*
|
2041 |
-
* @param array $delete_activity_args Array of arguments for activity deletion.
|
2042 |
-
* @param WP_Post $post Post object.
|
2043 |
-
* @param bool $activity Whether or not the activity
|
2044 |
-
* was successfully deleted.
|
2045 |
-
*/
|
2046 |
-
do_action( 'bp_activity_post_type_unpublished', $delete_activity_args, $post, $deleted );
|
2047 |
-
|
2048 |
-
return $deleted;
|
2049 |
-
}
|
2050 |
-
|
2051 |
/**
|
2052 |
* Add an activity comment.
|
2053 |
*
|
@@ -2058,6 +1311,7 @@ function bp_activity_post_type_unpublish( $post_id = 0, $post = null ) {
|
|
2058 |
* @uses bp_activity_add()
|
2059 |
* @uses apply_filters() To call the 'bp_activity_comment_action' hook.
|
2060 |
* @uses apply_filters() To call the 'bp_activity_comment_content' hook.
|
|
|
2061 |
* @uses wp_cache_delete()
|
2062 |
* @uses do_action() To call the 'bp_activity_comment_posted' hook.
|
2063 |
*
|
@@ -2075,13 +1329,6 @@ function bp_activity_post_type_unpublish( $post_id = 0, $post = null ) {
|
|
2075 |
* @return int|bool The ID of the comment on success, otherwise false.
|
2076 |
*/
|
2077 |
function bp_activity_new_comment( $args = '' ) {
|
2078 |
-
$bp = buddypress();
|
2079 |
-
$errors = new WP_Error();
|
2080 |
-
$feedback = __( 'There was an error posting your reply. Please try again.', 'buddypress' );
|
2081 |
-
|
2082 |
-
if ( empty( $bp->activity->errors ) ) {
|
2083 |
-
$bp->activity->errors = array();
|
2084 |
-
}
|
2085 |
|
2086 |
$r = wp_parse_args( $args, array(
|
2087 |
'id' => false,
|
@@ -2093,9 +1340,6 @@ function bp_activity_new_comment( $args = '' ) {
|
|
2093 |
|
2094 |
// Bail if missing necessary data
|
2095 |
if ( empty( $r['content'] ) || empty( $r['user_id'] ) || empty( $r['activity_id'] ) ) {
|
2096 |
-
$errors->add( 'missing_data', $feedback );
|
2097 |
-
$bp->activity->errors['new_comment'] = $errors;
|
2098 |
-
|
2099 |
return false;
|
2100 |
}
|
2101 |
|
@@ -2106,33 +1350,14 @@ function bp_activity_new_comment( $args = '' ) {
|
|
2106 |
|
2107 |
$activity_id = $r['activity_id'];
|
2108 |
|
2109 |
-
//
|
2110 |
$activity = new BP_Activity_Activity( $activity_id );
|
2111 |
-
|
2112 |
-
// Bail if the parent activity does not exist
|
2113 |
-
if ( empty( $activity->date_recorded ) ) {
|
2114 |
-
$errors->add( 'missing_activity', __( 'Sorry, the item you are replying to no longer exists.', 'buddypress' ) );
|
2115 |
-
$bp->activity->errors['new_comment'] = $errors;
|
2116 |
-
|
2117 |
-
return false;
|
2118 |
-
}
|
2119 |
-
|
2120 |
-
// Check to see if the parent activity is hidden, and if so, hide this comment publicly.
|
2121 |
$is_hidden = ( (int) $activity->hide_sitewide ) ? 1 : 0;
|
2122 |
|
2123 |
-
/**
|
2124 |
-
* Filters the content of a new comment.
|
2125 |
-
*
|
2126 |
-
* @since BuddyPress (1.2.0)
|
2127 |
-
*
|
2128 |
-
* @param string $r Content for the newly posted comment.
|
2129 |
-
*/
|
2130 |
-
$comment_content = apply_filters( 'bp_activity_comment_content', $r['content'] );
|
2131 |
-
|
2132 |
// Insert the activity comment
|
2133 |
$comment_id = bp_activity_add( array(
|
2134 |
'id' => $r['id'],
|
2135 |
-
'content' => $
|
2136 |
'component' => buddypress()->activity->id,
|
2137 |
'type' => 'activity_comment',
|
2138 |
'user_id' => $r['user_id'],
|
@@ -2153,22 +1378,8 @@ function bp_activity_new_comment( $args = '' ) {
|
|
2153 |
}
|
2154 |
wp_cache_delete( $activity_id, 'bp_activity' );
|
2155 |
|
2156 |
-
/**
|
2157 |
-
* Fires near the end of an activity comment posting, before the returning of the comment ID.
|
2158 |
-
*
|
2159 |
-
* @since BuddyPress (1.2.0)
|
2160 |
-
*
|
2161 |
-
* @param int $comment_id ID of the newly posted activity comment.
|
2162 |
-
* @param array $r Array of parsed comment arguments.
|
2163 |
-
* @param int $activity ID of the activity item being commented on.
|
2164 |
-
*/
|
2165 |
do_action( 'bp_activity_comment_posted', $comment_id, $r, $activity );
|
2166 |
|
2167 |
-
if ( empty( $comment_id ) ) {
|
2168 |
-
$errors->add( 'comment_failed', $feedback );
|
2169 |
-
$bp->activity->errors['new_comment'] = $errors;
|
2170 |
-
}
|
2171 |
-
|
2172 |
return $comment_id;
|
2173 |
}
|
2174 |
|
@@ -2198,13 +1409,6 @@ function bp_activity_get_activity_id( $args = '' ) {
|
|
2198 |
'date_recorded' => false,
|
2199 |
) );
|
2200 |
|
2201 |
-
/**
|
2202 |
-
* Filters the activity ID being requested.
|
2203 |
-
*
|
2204 |
-
* @since BuddyPress (1.2.0)
|
2205 |
-
*
|
2206 |
-
* @param BP_Activity_Activity ID returned by BP_Activity_Activity get_id() method with provided arguments.
|
2207 |
-
*/
|
2208 |
return apply_filters( 'bp_activity_get_activity_id', BP_Activity_Activity::get_id(
|
2209 |
$r['user_id'],
|
2210 |
$r['component'],
|
@@ -2266,13 +1470,6 @@ function bp_activity_delete( $args = '' ) {
|
|
2266 |
'hide_sitewide' => false
|
2267 |
) );
|
2268 |
|
2269 |
-
/**
|
2270 |
-
* Fires before an activity item proceeds to be deleted.
|
2271 |
-
*
|
2272 |
-
* @since BuddyPress (1.5.0)
|
2273 |
-
*
|
2274 |
-
* @param array $args Array of arguments to be used with the activity deletion.
|
2275 |
-
*/
|
2276 |
do_action( 'bp_before_activity_delete', $args );
|
2277 |
|
2278 |
// Adjust the new mention count of any mentioned member
|
@@ -2295,22 +1492,7 @@ function bp_activity_delete( $args = '' ) {
|
|
2295 |
}
|
2296 |
}
|
2297 |
|
2298 |
-
/**
|
2299 |
-
* Fires after the activity item has been deleted.
|
2300 |
-
*
|
2301 |
-
* @since BuddyPress (1.0.0)
|
2302 |
-
*
|
2303 |
-
* @param array $args Array of arguments used with the activity deletion.
|
2304 |
-
*/
|
2305 |
do_action( 'bp_activity_delete', $args );
|
2306 |
-
|
2307 |
-
/**
|
2308 |
-
* Fires after the activity item has been deleted.
|
2309 |
-
*
|
2310 |
-
* @since BuddyPress (1.2.0)
|
2311 |
-
*
|
2312 |
-
* @param array $activity_ids_deleted Array of affected activity item IDs.
|
2313 |
-
*/
|
2314 |
do_action( 'bp_activity_deleted_activities', $activity_ids_deleted );
|
2315 |
|
2316 |
wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
|
@@ -2324,7 +1506,7 @@ function bp_activity_delete( $args = '' ) {
|
|
2324 |
* You should use bp_activity_delete() instead.
|
2325 |
*
|
2326 |
* @since BuddyPress (1.1.0)
|
2327 |
-
* @deprecated BuddyPress (1.2
|
2328 |
*
|
2329 |
* @uses wp_parse_args()
|
2330 |
* @uses bp_activity_delete()
|
@@ -2367,7 +1549,7 @@ function bp_activity_delete( $args = '' ) {
|
|
2367 |
* You should use bp_activity_delete() instead.
|
2368 |
*
|
2369 |
* @since BuddyPress (1.1.0)
|
2370 |
-
* @deprecated BuddyPress (1.2
|
2371 |
*
|
2372 |
* @uses bp_activity_delete()
|
2373 |
*
|
@@ -2392,7 +1574,7 @@ function bp_activity_delete( $args = '' ) {
|
|
2392 |
* You should use bp_activity_delete() instead.
|
2393 |
*
|
2394 |
* @since BuddyPress (1.1.0)
|
2395 |
-
* @deprecated BuddyPress (1.2
|
2396 |
*
|
2397 |
* @uses bp_activity_delete()
|
2398 |
*
|
@@ -2428,18 +1610,9 @@ function bp_activity_delete( $args = '' ) {
|
|
2428 |
* @return bool True on success, false on failure
|
2429 |
*/
|
2430 |
function bp_activity_delete_comment( $activity_id, $comment_id ) {
|
2431 |
-
|
2432 |
-
/**
|
2433 |
-
* Filters whether BuddyPress should delete an activity comment or not.
|
2434 |
-
*
|
2435 |
* You may want to hook into this filter if you want to override this function and
|
2436 |
* handle the deletion of child comments differently. Make sure you return false.
|
2437 |
-
*
|
2438 |
-
* @since BuddyPress (1.2.0)
|
2439 |
-
*
|
2440 |
-
* @param bool $value Whether BuddyPress should continue or not.
|
2441 |
-
* @param int $activity_id ID of the root activity item being deleted.
|
2442 |
-
* @param int $comment_id ID of the comment being deleted.
|
2443 |
*/
|
2444 |
if ( ! apply_filters( 'bp_activity_delete_comment_pre', true, $activity_id, $comment_id ) ) {
|
2445 |
return false;
|
@@ -2459,14 +1632,6 @@ function bp_activity_delete_comment( $activity_id, $comment_id ) {
|
|
2459 |
// Recalculate the comment tree
|
2460 |
BP_Activity_Activity::rebuild_activity_comment_tree( $activity_id );
|
2461 |
|
2462 |
-
/**
|
2463 |
-
* Fires at the end of the deletion of an activity comment, before returning success.
|
2464 |
-
*
|
2465 |
-
* @since BuddyPress (1.2.0)
|
2466 |
-
*
|
2467 |
-
* @param int $activity_id ID of the activity that has had a comment deleted from.
|
2468 |
-
* @param int $comment_id ID of the comment that was deleted.
|
2469 |
-
*/
|
2470 |
do_action( 'bp_activity_delete_comment', $activity_id, $comment_id );
|
2471 |
|
2472 |
return true;
|
@@ -2496,7 +1661,7 @@ function bp_activity_delete_comment( $activity_id, $comment_id ) {
|
|
2496 |
bp_activity_delete_children( $activity_id, $child->id );
|
2497 |
}
|
2498 |
}
|
2499 |
-
|
2500 |
// Delete the comment itself
|
2501 |
bp_activity_delete( array(
|
2502 |
'secondary_item_id' => $comment_id,
|
@@ -2524,7 +1689,6 @@ function bp_activity_delete_comment( $activity_id, $comment_id ) {
|
|
2524 |
* @return string $link Permalink for the activity item.
|
2525 |
*/
|
2526 |
function bp_activity_get_permalink( $activity_id, $activity_obj = false ) {
|
2527 |
-
$bp = buddypress();
|
2528 |
|
2529 |
if ( empty( $activity_obj ) ) {
|
2530 |
$activity_obj = new BP_Activity_Activity( $activity_id );
|
@@ -2534,18 +1698,7 @@ function bp_activity_get_permalink( $activity_id, $activity_obj = false ) {
|
|
2534 |
$activity_obj = $activity_obj->current_comment;
|
2535 |
}
|
2536 |
|
2537 |
-
$
|
2538 |
-
'new_blog_post',
|
2539 |
-
'new_blog_comment',
|
2540 |
-
'new_forum_topic',
|
2541 |
-
'new_forum_post',
|
2542 |
-
);
|
2543 |
-
|
2544 |
-
if ( ! empty( $bp->activity->track ) ) {
|
2545 |
-
$use_primary_links = array_merge( $use_primary_links, array_keys( $bp->activity->track ) );
|
2546 |
-
}
|
2547 |
-
|
2548 |
-
if ( false !== array_search( $activity_obj->type, $use_primary_links ) ) {
|
2549 |
$link = $activity_obj->primary_link;
|
2550 |
} else {
|
2551 |
if ( 'activity_comment' == $activity_obj->type ) {
|
@@ -2555,13 +1708,6 @@ function bp_activity_get_permalink( $activity_id, $activity_obj = false ) {
|
|
2555 |
}
|
2556 |
}
|
2557 |
|
2558 |
-
/**
|
2559 |
-
* Filters the activity permalink for the specified activity item.
|
2560 |
-
*
|
2561 |
-
* @since BuddyPress (1.2.0)
|
2562 |
-
*
|
2563 |
-
* @param array $array Array holding activity permalink and activity item object.
|
2564 |
-
*/
|
2565 |
return apply_filters_ref_array( 'bp_activity_get_permalink', array( $link, &$activity_obj ) );
|
2566 |
}
|
2567 |
|
@@ -2641,15 +1787,6 @@ function bp_activity_thumbnail_content_images( $content, $link = false, $args =
|
|
2641 |
}
|
2642 |
}
|
2643 |
|
2644 |
-
/**
|
2645 |
-
* Filters the activity content that had a thumbnail replace images.
|
2646 |
-
*
|
2647 |
-
* @since BuddyPress (1.2.0)
|
2648 |
-
*
|
2649 |
-
* @param string $content Activity content that had images replaced in.
|
2650 |
-
* @param array $matches Array of all image tags found in the posted content.
|
2651 |
-
* @param array $args Arguments passed into function creating the activity update.
|
2652 |
-
*/
|
2653 |
return apply_filters( 'bp_activity_thumbnail_content_images', $content, $matches, $args );
|
2654 |
}
|
2655 |
|
@@ -2661,14 +1798,6 @@ function bp_activity_thumbnail_content_images( $content, $link = false, $args =
|
|
2661 |
* @return bool True if user is allowed to mark activity items as spam.
|
2662 |
*/
|
2663 |
function bp_activity_user_can_mark_spam() {
|
2664 |
-
|
2665 |
-
/**
|
2666 |
-
* Filters whether the current user should be able to mark items as spam.
|
2667 |
-
*
|
2668 |
-
* @since BuddyPress (1.6.0)
|
2669 |
-
*
|
2670 |
-
* @param bool $moderate Whether or not the current user has bp_moderate capability.
|
2671 |
-
*/
|
2672 |
return apply_filters( 'bp_activity_user_can_mark_spam', bp_current_user_can( 'bp_moderate' ) );
|
2673 |
}
|
2674 |
|
@@ -2707,15 +1836,6 @@ function bp_activity_mark_as_spam( &$activity, $source = 'by_a_person' ) {
|
|
2707 |
add_action( 'bp_activity_after_save', array( $bp->activity->akismet, 'update_activity_spam_meta' ), 1, 1 );
|
2708 |
}
|
2709 |
|
2710 |
-
/**
|
2711 |
-
* Fires at the end of the process to mark an activity item as spam.
|
2712 |
-
*
|
2713 |
-
* @since BuddyPress (1.6.0)
|
2714 |
-
*
|
2715 |
-
* @param BP_Activity_Activity $activity Activity item being marked as spam.
|
2716 |
-
* @param string $source Source of determination of spam status. For example
|
2717 |
-
* "by_a_person" or "by_akismet".
|
2718 |
-
*/
|
2719 |
do_action( 'bp_activity_mark_as_spam', $activity, $source );
|
2720 |
}
|
2721 |
|
@@ -2754,15 +1874,6 @@ function bp_activity_mark_as_ham( &$activity, $source = 'by_a_person' ) {
|
|
2754 |
add_action( 'bp_activity_after_save', array( $bp->activity->akismet, 'update_activity_ham_meta' ), 1, 1 );
|
2755 |
}
|
2756 |
|
2757 |
-
/**
|
2758 |
-
* Fires at the end of the process to mark an activity item as ham.
|
2759 |
-
*
|
2760 |
-
* @since BuddyPress (1.6.0)
|
2761 |
-
*
|
2762 |
-
* @param BP_Activity_Activity $activity Activity item being marked as ham.
|
2763 |
-
* @param string $source Source of determination of ham status. For example
|
2764 |
-
* "by_a_person" or "by_akismet".
|
2765 |
-
*/
|
2766 |
do_action( 'bp_activity_mark_as_ham', $activity, $source );
|
2767 |
}
|
2768 |
|
@@ -2902,7 +2013,7 @@ function bp_embed_activity_save_cache( $cache, $cachekey, $id ) {
|
|
2902 |
*
|
2903 |
* @since BuddyPress (2.0.0)
|
2904 |
*
|
2905 |
-
* @uses bp_is_activity_heartbeat_active() to check if
|
2906 |
* @uses bp_is_activity_directory() to check if the current page is the activity
|
2907 |
* directory.
|
2908 |
* @uses bp_is_active() to check if the group component is active.
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
14 |
|
15 |
/**
|
16 |
* Check whether the $bp global lists an activity directory page.
|
45 |
* @return bool $retval True to enable mentions, false to disable.
|
46 |
*/
|
47 |
function bp_activity_do_mentions() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
return (bool) apply_filters( 'bp_activity_do_mentions', true );
|
49 |
}
|
50 |
|
56 |
* @since BuddyPress (2.1.0)
|
57 |
*/
|
58 |
function bp_activity_maybe_load_mentions_scripts() {
|
59 |
+
$retval =
|
60 |
+
bp_activity_do_mentions() &&
|
61 |
+
bp_is_user_active() &&
|
62 |
+
( bp_is_activity_component() || bp_is_blog_page() && is_singular() && comments_open() || is_admin() );
|
63 |
|
64 |
+
return (bool) apply_filters( 'bp_activity_maybe_load_mentions_scripts', $retval );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
|
67 |
/**
|
301 |
*
|
302 |
* @since BuddyPress (1.1.0)
|
303 |
*
|
304 |
+
* @param string $component_id The unique string ID of the component.
|
305 |
+
* @param string $type The action type.
|
306 |
+
* @param string $description The action description.
|
307 |
+
* @param callable $format_callback Callback for formatting the action string.
|
308 |
+
* @param string $label String to describe this action in the activity stream
|
309 |
+
* filter dropdown.
|
310 |
+
* @param array $context Activity stream contexts where the filter should appear.
|
311 |
+
* 'activity', 'member', 'member_groups', 'group'
|
312 |
* @return bool False if any param is empty, otherwise true.
|
313 |
*/
|
314 |
+
function bp_activity_set_action( $component_id, $type, $description, $format_callback = false, $label = false, $context = array() ) {
|
315 |
$bp = buddypress();
|
316 |
|
317 |
// Return false if any of the above values are not set
|
333 |
$bp->activity->actions->{$component_id} = new stdClass;
|
334 |
}
|
335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
$bp->activity->actions->{$component_id}->{$type} = apply_filters( 'bp_activity_set_action', array(
|
337 |
'key' => $type,
|
338 |
'value' => $description,
|
339 |
'format_callback' => $format_callback,
|
340 |
'label' => $label,
|
341 |
'context' => $context,
|
|
|
342 |
), $component_id, $type, $description, $format_callback, $label, $context );
|
343 |
|
344 |
return true;
|
345 |
}
|
346 |
|
347 |
/**
|
348 |
+
* Retreive the current action from a component and key.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
*
|
350 |
* @since BuddyPress (1.1.0)
|
351 |
*
|
362 |
return false;
|
363 |
}
|
364 |
|
365 |
+
$bp = buddypress();
|
366 |
+
$retval = isset( $bp->activity->actions->{$component_id}->{$key} )
|
367 |
+
? $bp->activity->actions->{$component_id}->{$key}
|
368 |
+
: false;
|
369 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
return apply_filters( 'bp_activity_get_action', $retval, $component_id, $key );
|
371 |
}
|
372 |
|
381 |
$actions = array();
|
382 |
|
383 |
// Walk through the registered actions, and build an array of actions/values.
|
384 |
+
foreach ( buddypress()->activity->actions as $action ) {
|
385 |
$action = array_values( (array) $action );
|
386 |
|
387 |
for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ ) {
|
392 |
// This was a mis-named activity type from before BP 1.6
|
393 |
unset( $actions['friends_register_activity_action'] );
|
394 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
return apply_filters( 'bp_activity_get_types', $actions );
|
396 |
}
|
397 |
|
418 |
// Get favorites for user
|
419 |
$favs = bp_get_user_meta( $user_id, 'bp_favorite_activities', true );
|
420 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
return apply_filters( 'bp_activity_get_user_favorites', $favs );
|
422 |
}
|
423 |
|
473 |
// Update activity meta counts
|
474 |
if ( bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count ) ) {
|
475 |
|
476 |
+
// Execute additional code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
do_action( 'bp_activity_add_user_favorite', $activity_id, $user_id );
|
478 |
|
479 |
// Success
|
481 |
|
482 |
// Saving meta was unsuccessful for an unknown reason
|
483 |
} else {
|
484 |
+
// Execute additional code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
do_action( 'bp_activity_add_user_favorite_fail', $activity_id, $user_id );
|
486 |
|
487 |
return false;
|
538 |
// Update users favorites
|
539 |
if ( bp_update_user_meta( $user_id, 'bp_favorite_activities', $my_favs ) ) {
|
540 |
|
541 |
+
// Execute additional code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
542 |
do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id );
|
543 |
|
544 |
// Success
|
572 |
* @return int|null The ID of the located activity item. Null if none is found.
|
573 |
*/
|
574 |
function bp_activity_check_exists_by_content( $content ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
575 |
return apply_filters( 'bp_activity_check_exists_by_content', BP_Activity_Activity::check_exists_by_content( $content ) );
|
576 |
}
|
577 |
|
586 |
* @return string Date last updated.
|
587 |
*/
|
588 |
function bp_activity_get_last_updated() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
return apply_filters( 'bp_activity_get_last_updated', BP_Activity_Activity::get_last_updated() );
|
590 |
}
|
591 |
|
676 |
$retval = get_metadata( 'activity', $activity_id, $meta_key, $single );
|
677 |
remove_filter( 'query', 'bp_filter_metaid_column_name' );
|
678 |
|
679 |
+
// Filter result before returning
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
return apply_filters( 'bp_activity_get_meta', $retval, $activity_id, $meta_key, $single );
|
681 |
}
|
682 |
|
757 |
// Execute additional code
|
758 |
do_action( 'bp_activity_remove_data', $user_id ); // Deprecated! Do not use!
|
759 |
|
760 |
+
// Use this going forward
|
|
|
|
|
|
|
|
|
|
|
|
|
761 |
do_action( 'bp_activity_remove_all_user_data', $user_id );
|
762 |
}
|
763 |
add_action( 'wpmu_delete_user', 'bp_activity_remove_all_user_data' );
|
806 |
* If Akismet is present, update the activity history meta.
|
807 |
*
|
808 |
* This is usually taken care of when BP_Activity_Activity::save() happens, but
|
809 |
+
* as we're going to be updating all the activity statuses directly, for efficency,
|
810 |
* we need to update manually.
|
811 |
*/
|
812 |
if ( ! empty( $bp->activity->akismet ) ) {
|
820 |
// Mark all of this user's activities as spam
|
821 |
$wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET is_spam = 1 WHERE user_id = %d", $user_id ) );
|
822 |
|
823 |
+
// Call an action for plugins to use
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
824 |
do_action( 'bp_activity_spam_all_user_data', $user_id, $activities['activities'] );
|
825 |
}
|
826 |
add_action( 'bp_make_spam_user', 'bp_activity_spam_all_user_data' );
|
869 |
* If Akismet is present, update the activity history meta.
|
870 |
*
|
871 |
* This is usually taken care of when BP_Activity_Activity::save() happens, but
|
872 |
+
* as we're going to be updating all the activity statuses directly, for efficency,
|
873 |
* we need to update manually.
|
874 |
*/
|
875 |
if ( ! empty( $bp->activity->akismet ) ) {
|
880 |
unset( $activity_obj );
|
881 |
}
|
882 |
|
883 |
+
// Mark all of this user's activities as spam
|
884 |
$wpdb->query( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET is_spam = 0 WHERE user_id = %d", $user_id ) );
|
885 |
|
886 |
+
// Call an action for plugins to use
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
887 |
do_action( 'bp_activity_ham_all_user_data', $user_id, $activities['activities'] );
|
888 |
}
|
889 |
add_action( 'bp_make_ham_user', 'bp_activity_ham_all_user_data' );
|
913 |
__( 'Activity Comments', 'buddypress' )
|
914 |
);
|
915 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
916 |
do_action( 'bp_activity_register_activity_actions' );
|
917 |
|
918 |
// Backpat. Don't use this.
|
935 |
}
|
936 |
|
937 |
// Check for registered format callback
|
938 |
+
if ( empty( buddypress()->activity->actions->{$activity->component}->{$activity->type}['format_callback'] ) ) {
|
|
|
939 |
return false;
|
940 |
}
|
941 |
|
942 |
// We apply the format_callback as a filter
|
943 |
+
add_filter( 'bp_activity_generate_action_string', buddypress()->activity->actions->{$activity->component}->{$activity->type}['format_callback'], 10, 2 );
|
944 |
|
945 |
+
// Generate the action string (run through the filter defined above)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
946 |
$action = apply_filters( 'bp_activity_generate_action_string', $activity->action, $activity );
|
947 |
|
948 |
// Remove the filter for future activity items
|
949 |
+
remove_filter( 'bp_activity_generate_action_string', buddypress()->activity->actions->{$activity->component}->{$activity->type}['format_callback'], 10, 2 );
|
950 |
|
951 |
return $action;
|
952 |
}
|
962 |
*/
|
963 |
function bp_activity_format_activity_action_activity_update( $action, $activity ) {
|
964 |
$action = sprintf( __( '%s posted an update', 'buddypress' ), bp_core_get_userlink( $activity->user_id ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
965 |
return apply_filters( 'bp_activity_new_update_action', $action, $activity );
|
966 |
}
|
967 |
|
976 |
*/
|
977 |
function bp_activity_format_activity_action_activity_comment( $action, $activity ) {
|
978 |
$action = sprintf( __( '%s posted a new activity comment', 'buddypress' ), bp_core_get_userlink( $activity->user_id ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
979 |
return apply_filters( 'bp_activity_comment_action', $action, $activity );
|
980 |
}
|
981 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
982 |
/******************************************************************************
|
983 |
* Business functions are where all the magic happens in BuddyPress. They will
|
984 |
* handle the actual saving or manipulation of information. Usually they will
|
1020 |
'search_terms' => false, // Pass search terms as a string
|
1021 |
'meta_query' => false, // Filter by activity meta. See WP_Meta_Query for format
|
1022 |
'date_query' => false, // Filter by date. See first parameter of WP_Date_Query for format
|
|
|
1023 |
'show_hidden' => false, // Show activity items that are hidden site-wide?
|
1024 |
'exclude' => false, // Comma-separated list of activity IDs to exclude
|
1025 |
'in' => false, // Comma-separated list or array of activity IDs to which you want to limit the query
|
1026 |
'spam' => 'ham_only', // 'ham_only' (default), 'spam_only' or 'all'.
|
1027 |
'update_meta_cache' => true,
|
1028 |
'count_total' => false,
|
|
|
1029 |
|
1030 |
/**
|
1031 |
* Pass filters as an array -- all filter items can be multiple values comma separated:
|
1041 |
) );
|
1042 |
|
1043 |
// Attempt to return a cached copy of the first page of sitewide activity.
|
1044 |
+
if ( ( 1 === (int) $r['page'] ) && empty( $r['max'] ) && empty( $r['search_terms'] ) && empty( $r['meta_query'] ) && empty( $r['date_query'] ) && empty( $r['filter'] ) && empty( $r['exclude'] ) && empty( $r['in'] ) && ( 'DESC' === $r['sort'] ) && empty( $r['exclude'] ) && ( 'ham_only' === $r['spam'] ) ) {
|
1045 |
|
1046 |
$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' );
|
1047 |
if ( false === $activity ) {
|
1054 |
'search_terms' => $r['search_terms'],
|
1055 |
'meta_query' => $r['meta_query'],
|
1056 |
'date_query' => $r['date_query'],
|
|
|
1057 |
'filter' => $r['filter'],
|
|
|
1058 |
'display_comments' => $r['display_comments'],
|
1059 |
'show_hidden' => $r['show_hidden'],
|
1060 |
'spam' => $r['spam'],
|
1074 |
'search_terms' => $r['search_terms'],
|
1075 |
'meta_query' => $r['meta_query'],
|
1076 |
'date_query' => $r['date_query'],
|
|
|
1077 |
'filter' => $r['filter'],
|
|
|
1078 |
'display_comments' => $r['display_comments'],
|
1079 |
'show_hidden' => $r['show_hidden'],
|
1080 |
'exclude' => $r['exclude'],
|
1084 |
) );
|
1085 |
}
|
1086 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1087 |
return apply_filters_ref_array( 'bp_activity_get', array( &$activity, &$r ) );
|
1088 |
}
|
1089 |
|
1131 |
'update_meta_cache' => $r['update_meta_cache'],
|
1132 |
);
|
1133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1134 |
return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get( $get_args ), $args, $get_args );
|
1135 |
}
|
1136 |
|
1233 |
}
|
1234 |
|
1235 |
wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1236 |
do_action( 'bp_activity_add', $r );
|
1237 |
|
1238 |
return $activity->id;
|
1279 |
$activity_content = $r['content'];
|
1280 |
$primary_link = bp_core_get_userlink( $r['user_id'], false, true );
|
1281 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1282 |
// Now write the values
|
1283 |
$activity_id = bp_activity_add( array(
|
1284 |
'user_id' => $r['user_id'],
|
1285 |
+
'content' => apply_filters( 'bp_activity_new_update_content', $activity_content ),
|
1286 |
+
'primary_link' => apply_filters( 'bp_activity_new_update_primary_link', $primary_link ),
|
1287 |
'component' => buddypress()->activity->id,
|
1288 |
'type' => 'activity_update',
|
1289 |
) );
|
1290 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1291 |
$activity_content = apply_filters( 'bp_activity_latest_update_content', $r['content'], $activity_content );
|
1292 |
|
1293 |
// Add this update to the "latest update" usermeta so it can be fetched anywhere.
|
1296 |
'content' => $activity_content
|
1297 |
) );
|
1298 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1299 |
do_action( 'bp_activity_posted_update', $r['content'], $r['user_id'], $activity_id );
|
1300 |
|
1301 |
return $activity_id;
|
1302 |
}
|
1303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1304 |
/**
|
1305 |
* Add an activity comment.
|
1306 |
*
|
1311 |
* @uses bp_activity_add()
|
1312 |
* @uses apply_filters() To call the 'bp_activity_comment_action' hook.
|
1313 |
* @uses apply_filters() To call the 'bp_activity_comment_content' hook.
|
1314 |
+
* @uses bp_activity_new_comment_notification()
|
1315 |
* @uses wp_cache_delete()
|
1316 |
* @uses do_action() To call the 'bp_activity_comment_posted' hook.
|
1317 |
*
|
1329 |
* @return int|bool The ID of the comment on success, otherwise false.
|
1330 |
*/
|
1331 |
function bp_activity_new_comment( $args = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1332 |
|
1333 |
$r = wp_parse_args( $args, array(
|
1334 |
'id' => false,
|
1340 |
|
1341 |
// Bail if missing necessary data
|
1342 |
if ( empty( $r['content'] ) || empty( $r['user_id'] ) || empty( $r['activity_id'] ) ) {
|
|
|
|
|
|
|
1343 |
return false;
|
1344 |
}
|
1345 |
|
1350 |
|
1351 |
$activity_id = $r['activity_id'];
|
1352 |
|
1353 |
+
// Check to see if the parent activity is hidden, and if so, hide this comment publically.
|
1354 |
$activity = new BP_Activity_Activity( $activity_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1355 |
$is_hidden = ( (int) $activity->hide_sitewide ) ? 1 : 0;
|
1356 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1357 |
// Insert the activity comment
|
1358 |
$comment_id = bp_activity_add( array(
|
1359 |
'id' => $r['id'],
|
1360 |
+
'content' => apply_filters( 'bp_activity_comment_content', $r['content'] ),
|
1361 |
'component' => buddypress()->activity->id,
|
1362 |
'type' => 'activity_comment',
|
1363 |
'user_id' => $r['user_id'],
|
1378 |
}
|
1379 |
wp_cache_delete( $activity_id, 'bp_activity' );
|
1380 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1381 |
do_action( 'bp_activity_comment_posted', $comment_id, $r, $activity );
|
1382 |
|
|
|
|
|
|
|
|
|
|
|
1383 |
return $comment_id;
|
1384 |
}
|
1385 |
|
1409 |
'date_recorded' => false,
|
1410 |
) );
|
1411 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1412 |
return apply_filters( 'bp_activity_get_activity_id', BP_Activity_Activity::get_id(
|
1413 |
$r['user_id'],
|
1414 |
$r['component'],
|
1470 |
'hide_sitewide' => false
|
1471 |
) );
|
1472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1473 |
do_action( 'bp_before_activity_delete', $args );
|
1474 |
|
1475 |
// Adjust the new mention count of any mentioned member
|
1492 |
}
|
1493 |
}
|
1494 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1495 |
do_action( 'bp_activity_delete', $args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1496 |
do_action( 'bp_activity_deleted_activities', $activity_ids_deleted );
|
1497 |
|
1498 |
wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
|
1506 |
* You should use bp_activity_delete() instead.
|
1507 |
*
|
1508 |
* @since BuddyPress (1.1.0)
|
1509 |
+
* @deprecated BuddyPress (1.2)
|
1510 |
*
|
1511 |
* @uses wp_parse_args()
|
1512 |
* @uses bp_activity_delete()
|
1549 |
* You should use bp_activity_delete() instead.
|
1550 |
*
|
1551 |
* @since BuddyPress (1.1.0)
|
1552 |
+
* @deprecated BuddyPress (1.2)
|
1553 |
*
|
1554 |
* @uses bp_activity_delete()
|
1555 |
*
|
1574 |
* You should use bp_activity_delete() instead.
|
1575 |
*
|
1576 |
* @since BuddyPress (1.1.0)
|
1577 |
+
* @deprecated BuddyPress (1.2)
|
1578 |
*
|
1579 |
* @uses bp_activity_delete()
|
1580 |
*
|
1610 |
* @return bool True on success, false on failure
|
1611 |
*/
|
1612 |
function bp_activity_delete_comment( $activity_id, $comment_id ) {
|
1613 |
+
/***
|
|
|
|
|
|
|
1614 |
* You may want to hook into this filter if you want to override this function and
|
1615 |
* handle the deletion of child comments differently. Make sure you return false.
|
|
|
|
|
|
|
|
|
|
|
|
|
1616 |
*/
|
1617 |
if ( ! apply_filters( 'bp_activity_delete_comment_pre', true, $activity_id, $comment_id ) ) {
|
1618 |
return false;
|
1632 |
// Recalculate the comment tree
|
1633 |
BP_Activity_Activity::rebuild_activity_comment_tree( $activity_id );
|
1634 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1635 |
do_action( 'bp_activity_delete_comment', $activity_id, $comment_id );
|
1636 |
|
1637 |
return true;
|
1661 |
bp_activity_delete_children( $activity_id, $child->id );
|
1662 |
}
|
1663 |
}
|
1664 |
+
|
1665 |
// Delete the comment itself
|
1666 |
bp_activity_delete( array(
|
1667 |
'secondary_item_id' => $comment_id,
|
1689 |
* @return string $link Permalink for the activity item.
|
1690 |
*/
|
1691 |
function bp_activity_get_permalink( $activity_id, $activity_obj = false ) {
|
|
|
1692 |
|
1693 |
if ( empty( $activity_obj ) ) {
|
1694 |
$activity_obj = new BP_Activity_Activity( $activity_id );
|
1698 |
$activity_obj = $activity_obj->current_comment;
|
1699 |
}
|
1700 |
|
1701 |
+
if ( 'new_blog_post' == $activity_obj->type || 'new_blog_comment' == $activity_obj->type || 'new_forum_topic' == $activity_obj->type || 'new_forum_post' == $activity_obj->type ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1702 |
$link = $activity_obj->primary_link;
|
1703 |
} else {
|
1704 |
if ( 'activity_comment' == $activity_obj->type ) {
|
1708 |
}
|
1709 |
}
|
1710 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1711 |
return apply_filters_ref_array( 'bp_activity_get_permalink', array( $link, &$activity_obj ) );
|
1712 |
}
|
1713 |
|
1787 |
}
|
1788 |
}
|
1789 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1790 |
return apply_filters( 'bp_activity_thumbnail_content_images', $content, $matches, $args );
|
1791 |
}
|
1792 |
|
1798 |
* @return bool True if user is allowed to mark activity items as spam.
|
1799 |
*/
|
1800 |
function bp_activity_user_can_mark_spam() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1801 |
return apply_filters( 'bp_activity_user_can_mark_spam', bp_current_user_can( 'bp_moderate' ) );
|
1802 |
}
|
1803 |
|
1836 |
add_action( 'bp_activity_after_save', array( $bp->activity->akismet, 'update_activity_spam_meta' ), 1, 1 );
|
1837 |
}
|
1838 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1839 |
do_action( 'bp_activity_mark_as_spam', $activity, $source );
|
1840 |
}
|
1841 |
|
1874 |
add_action( 'bp_activity_after_save', array( $bp->activity->akismet, 'update_activity_ham_meta' ), 1, 1 );
|
1875 |
}
|
1876 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1877 |
do_action( 'bp_activity_mark_as_ham', $activity, $source );
|
1878 |
}
|
1879 |
|
2013 |
*
|
2014 |
* @since BuddyPress (2.0.0)
|
2015 |
*
|
2016 |
+
* @uses bp_is_activity_heartbeat_active() to check if heatbeat setting is on.
|
2017 |
* @uses bp_is_activity_directory() to check if the current page is the activity
|
2018 |
* directory.
|
2019 |
* @uses bp_is_active() to check if the group component is active.
|
bp-activity/bp-activity-loader.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
-
defined( 'ABSPATH' )
|
14 |
|
15 |
/**
|
16 |
* Main Activity Class.
|
@@ -60,8 +60,6 @@ class BP_Activity_Component extends BP_Component {
|
|
60 |
|
61 |
// Load Akismet support if Akismet is configured
|
62 |
$akismet_key = bp_get_option( 'wordpress_api_key' );
|
63 |
-
|
64 |
-
/** This filter is documented in bp-activity/bp-activity-actions.php */
|
65 |
if ( defined( 'AKISMET_VERSION' ) && ( !empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
|
66 |
$includes[] = 'akismet';
|
67 |
}
|
@@ -362,23 +360,6 @@ class BP_Activity_Component extends BP_Component {
|
|
362 |
|
363 |
parent::setup_actions();
|
364 |
}
|
365 |
-
|
366 |
-
/**
|
367 |
-
* Setup cache groups
|
368 |
-
*
|
369 |
-
* @since BuddyPress (2.2.0)
|
370 |
-
*/
|
371 |
-
public function setup_cache_groups() {
|
372 |
-
|
373 |
-
// Global groups
|
374 |
-
wp_cache_add_global_groups( array(
|
375 |
-
'bp_activity',
|
376 |
-
'bp_activity_comments',
|
377 |
-
'activity_meta'
|
378 |
-
) );
|
379 |
-
|
380 |
-
parent::setup_cache_groups();
|
381 |
-
}
|
382 |
}
|
383 |
|
384 |
/**
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
14 |
|
15 |
/**
|
16 |
* Main Activity Class.
|
60 |
|
61 |
// Load Akismet support if Akismet is configured
|
62 |
$akismet_key = bp_get_option( 'wordpress_api_key' );
|
|
|
|
|
63 |
if ( defined( 'AKISMET_VERSION' ) && ( !empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
|
64 |
$includes[] = 'akismet';
|
65 |
}
|
360 |
|
361 |
parent::setup_actions();
|
362 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
}
|
364 |
|
365 |
/**
|
bp-activity/bp-activity-notifications.php
CHANGED
@@ -8,14 +8,14 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/* Emails *********************************************************************/
|
14 |
|
15 |
/**
|
16 |
* Send email and BP notifications when a user is mentioned in an update.
|
17 |
*
|
18 |
-
* @since BuddyPress (1.2
|
19 |
*
|
20 |
* @uses bp_notifications_add_notification()
|
21 |
* @uses bp_get_user_meta()
|
@@ -99,59 +99,21 @@ To view and respond to the message, log in and visit: %3$s
|
|
99 |
$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
|
100 |
}
|
101 |
|
102 |
-
|
103 |
-
* Filters the user email that the @mention notification will be sent to.
|
104 |
-
*
|
105 |
-
* @since BuddyPress (1.2.0)
|
106 |
-
*
|
107 |
-
* @param string $to User email the notification is being sent to.
|
108 |
-
*/
|
109 |
$to = apply_filters( 'bp_activity_at_message_notification_to', $to );
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Filters the @mention notification subject that will be sent to user.
|
113 |
-
*
|
114 |
-
* @since BuddyPress (1.2.0)
|
115 |
-
*
|
116 |
-
* @param string $subject Email notification subject text.
|
117 |
-
* @param string $poster_name Name of the person who made the @mention.
|
118 |
-
*/
|
119 |
$subject = apply_filters( 'bp_activity_at_message_notification_subject', $subject, $poster_name );
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Filters the @mention notification message that will be sent to user.
|
123 |
-
*
|
124 |
-
* @since BuddyPress (1.2.0)
|
125 |
-
*
|
126 |
-
* @param string $message Email notification message text.
|
127 |
-
* @param string $poster_name Name of the person who made the @mention.
|
128 |
-
* @param string $content Content of the @mention.
|
129 |
-
* @param string $message_link URL permalink for the activity message.
|
130 |
-
* @param string $settings_link URL permalink for the user's notification settings area.
|
131 |
-
*/
|
132 |
$message = apply_filters( 'bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link );
|
133 |
|
134 |
wp_mail( $to, $subject, $message );
|
135 |
}
|
136 |
|
137 |
-
/**
|
138 |
-
* Fires after the sending of an @mention email notification.
|
139 |
-
*
|
140 |
-
* @since BuddyPress (1.5.0)
|
141 |
-
*
|
142 |
-
* @param BP_Activity_Activity $activity Activity Item object.
|
143 |
-
* @param string $subject Email notification subject text.
|
144 |
-
* @param string $message Email notification message text.
|
145 |
-
* @param string $content Content of the @mention.
|
146 |
-
* @param int $receiver_user_id The ID of the user who is receiving the update.
|
147 |
-
*/
|
148 |
do_action( 'bp_activity_sent_mention_email', $activity, $subject, $message, $content, $receiver_user_id );
|
149 |
}
|
150 |
|
151 |
/**
|
152 |
* Send email and BP notifications when an activity item receives a comment.
|
153 |
*
|
154 |
-
* @since BuddyPress (1.2
|
155 |
*
|
156 |
* @uses bp_get_user_meta()
|
157 |
* @uses bp_core_get_user_displayname()
|
@@ -215,52 +177,13 @@ To view your original update and all comments, log in and visit: %3$s
|
|
215 |
$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
|
216 |
}
|
217 |
|
218 |
-
|
219 |
-
* Filters the user email that the new comment notification will be sent to.
|
220 |
-
*
|
221 |
-
* @since BuddyPress (1.2.0)
|
222 |
-
*
|
223 |
-
* @param string $to User email the notification is being sent to.
|
224 |
-
*/
|
225 |
$to = apply_filters( 'bp_activity_new_comment_notification_to', $to );
|
226 |
-
|
227 |
-
/**
|
228 |
-
* Filters the new comment notification subject that will be sent to user.
|
229 |
-
*
|
230 |
-
* @since BuddyPress (1.2.0)
|
231 |
-
*
|
232 |
-
* @param string $subject Email notification subject text.
|
233 |
-
* @param string $poster_name Name of the person who made the comment.
|
234 |
-
*/
|
235 |
$subject = apply_filters( 'bp_activity_new_comment_notification_subject', $subject, $poster_name );
|
236 |
-
|
237 |
-
/**
|
238 |
-
* Filters the new comment notification message that will be sent to user.
|
239 |
-
*
|
240 |
-
* @since BuddyPress (1.2.0)
|
241 |
-
*
|
242 |
-
* @param string $message Email notification message text.
|
243 |
-
* @param string $poster_name Name of the person who made the comment.
|
244 |
-
* @param string $content Content of the comment.
|
245 |
-
* @param string $thread_link URL permalink for the activity thread.
|
246 |
-
* @param string $settings_link URL permalink for the user's notification settings area.
|
247 |
-
*/
|
248 |
$message = apply_filters( 'bp_activity_new_comment_notification_message', $message, $poster_name, $content, $thread_link, $settings_link );
|
249 |
|
250 |
wp_mail( $to, $subject, $message );
|
251 |
|
252 |
-
/**
|
253 |
-
* Fires after the sending of a reply to an update email notification.
|
254 |
-
*
|
255 |
-
* @since BuddyPress (1.5.0)
|
256 |
-
*
|
257 |
-
* @param int $user_id ID of the original activity item author.
|
258 |
-
* @param string $subject Email notification subject text.
|
259 |
-
* @param string $message Email notification message text.
|
260 |
-
* @param int $comment_id ID for the newly received comment.
|
261 |
-
* @param int $commenter_id ID of the user who made the comment.
|
262 |
-
* @param array $params Arguments used with the original activity comment.
|
263 |
-
*/
|
264 |
do_action( 'bp_activity_sent_reply_to_update_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params );
|
265 |
}
|
266 |
|
@@ -303,52 +226,13 @@ To view the original activity, your comment and all replies, log in and visit: %
|
|
303 |
$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
|
304 |
}
|
305 |
|
306 |
-
|
307 |
-
* Filters the user email that the new comment reply notification will be sent to.
|
308 |
-
*
|
309 |
-
* @since BuddyPress (1.2.0)
|
310 |
-
*
|
311 |
-
* @param string $to User email the notification is being sent to.
|
312 |
-
*/
|
313 |
$to = apply_filters( 'bp_activity_new_comment_notification_comment_author_to', $to );
|
314 |
-
|
315 |
-
/**
|
316 |
-
* Filters the new comment reply notification subject that will be sent to user.
|
317 |
-
*
|
318 |
-
* @since BuddyPress (1.2.0)
|
319 |
-
*
|
320 |
-
* @param string $subject Email notification subject text.
|
321 |
-
* @param string $poster_name Name of the person who made the comment reply.
|
322 |
-
*/
|
323 |
$subject = apply_filters( 'bp_activity_new_comment_notification_comment_author_subject', $subject, $poster_name );
|
324 |
-
|
325 |
-
/**
|
326 |
-
* Filters the new comment reply notification message that will be sent to user.
|
327 |
-
*
|
328 |
-
* @since BuddyPress (1.2.0)
|
329 |
-
*
|
330 |
-
* @param string $message Email notification message text.
|
331 |
-
* @param string $poster_name Name of the person who made the comment reply.
|
332 |
-
* @param string $content Content of the comment reply.
|
333 |
-
* @param string $settings_link URL permalink for the user's notification settings area.
|
334 |
-
* @param string $thread_link URL permalink for the activity thread.
|
335 |
-
*/
|
336 |
$message = apply_filters( 'bp_activity_new_comment_notification_comment_author_message', $message, $poster_name, $content, $settings_link, $thread_link );
|
337 |
|
338 |
wp_mail( $to, $subject, $message );
|
339 |
|
340 |
-
/**
|
341 |
-
* Fires after the sending of a reply to a reply email notification.
|
342 |
-
*
|
343 |
-
* @since BuddyPress (1.5.0)
|
344 |
-
*
|
345 |
-
* @param int $user_id ID of the original activity item author.
|
346 |
-
* @param string $subject Email notification subject text.
|
347 |
-
* @param string $message Email notification message text.
|
348 |
-
* @param int $comment_id ID for the newly received comment.
|
349 |
-
* @param int $commenter_id ID of the user who made the comment.
|
350 |
-
* @param array $params Arguments used with the original activity comment.
|
351 |
-
*/
|
352 |
do_action( 'bp_activity_sent_reply_to_reply_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params );
|
353 |
}
|
354 |
}
|
@@ -370,7 +254,7 @@ add_action( 'bp_activity_comment_posted', 'bp_activity_new_comment_notification_
|
|
370 |
/**
|
371 |
* Format notifications related to activity.
|
372 |
*
|
373 |
-
* @since BuddyPress (1.5
|
374 |
*
|
375 |
* @uses bp_loggedin_user_domain()
|
376 |
* @uses bp_get_activity_slug()
|
@@ -394,69 +278,27 @@ function bp_activity_format_notifications( $action, $item_id, $secondary_item_id
|
|
394 |
$poster_user_id = $secondary_item_id;
|
395 |
$at_mention_link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/';
|
396 |
$at_mention_title = sprintf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() );
|
397 |
-
$amount = 'single';
|
398 |
|
399 |
if ( (int) $total_items > 1 ) {
|
400 |
$text = sprintf( __( 'You have %1$d new mentions', 'buddypress' ), (int) $total_items );
|
401 |
-
$
|
402 |
} else {
|
403 |
$user_fullname = bp_core_get_user_displayname( $poster_user_id );
|
404 |
$text = sprintf( __( '%1$s mentioned you', 'buddypress' ), $user_fullname );
|
|
|
405 |
}
|
406 |
break;
|
407 |
}
|
408 |
|
409 |
if ( 'string' == $format ) {
|
410 |
-
|
411 |
-
/**
|
412 |
-
* Filters the @mention notification for the string format.
|
413 |
-
*
|
414 |
-
* This is a variable filter that is dependent on how many items
|
415 |
-
* need notified about. The two possible hooks are bp_activity_single_at_mentions_notification
|
416 |
-
* or bp_activity_multiple_at_mentions_notification.
|
417 |
-
*
|
418 |
-
* @since BuddyPress (1.5.0)
|
419 |
-
*
|
420 |
-
* @param string $string HTML anchor tag for the mention.
|
421 |
-
* @param string $at_mention_link The permalink for the mention.
|
422 |
-
* @param int $total_items How many items being notified about.
|
423 |
-
* @param int $activity_id ID of the activity item being formatted.
|
424 |
-
* @param int $poster_user_id ID of the user posting the mention.
|
425 |
-
*/
|
426 |
-
$return = apply_filters( 'bp_activity_' . $amount . '_at_mentions_notification', '<a href="' . esc_url( $at_mention_link ) . '" title="' . esc_attr( $at_mention_title ) . '">' . esc_html( $text ) . '</a>', $at_mention_link, (int) $total_items, $activity_id, $poster_user_id );
|
427 |
} else {
|
428 |
-
|
429 |
-
/**
|
430 |
-
* Filters the @mention notification for any non-string format.
|
431 |
-
*
|
432 |
-
* This is a variable filter that is dependent on how many items need notified about.
|
433 |
-
* The two possible hooks are bp_activity_single_at_mentions_notification
|
434 |
-
* or bp_activity_multiple_at_mentions_notification.
|
435 |
-
*
|
436 |
-
* @since BuddyPress (1.5.0)
|
437 |
-
*
|
438 |
-
* @param array $array Array holding the content and permalink for the mention notification.
|
439 |
-
* @param string $at_mention_link The permalink for the mention.
|
440 |
-
* @param int $total_items How many items being notified about.
|
441 |
-
* @param int $activity_id ID of the activity item being formatted.
|
442 |
-
* @param int $poster_user_id ID of the user posting the mention.
|
443 |
-
*/
|
444 |
-
$return = apply_filters( 'bp_activity_' . $amount . '_at_mentions_notification', array(
|
445 |
'text' => $text,
|
446 |
'link' => $at_mention_link
|
447 |
), $at_mention_link, (int) $total_items, $activity_id, $poster_user_id );
|
448 |
}
|
449 |
|
450 |
-
/**
|
451 |
-
* Fires right before returning the formatted activity notifications.
|
452 |
-
*
|
453 |
-
* @since BuddyPress (1.2.0)
|
454 |
-
*
|
455 |
-
* @param string $action The type of activity item.
|
456 |
-
* @param int $item_id The activity ID.
|
457 |
-
* @param int $secondary_item_id @mention mentioner ID.
|
458 |
-
* @param int $total_items Total amount of items to format.
|
459 |
-
*/
|
460 |
do_action( 'activity_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
|
461 |
|
462 |
return $return;
|
@@ -496,7 +338,7 @@ add_action( 'bp_activity_sent_mention_email', 'bp_activity_at_mention_add_notifi
|
|
496 |
/**
|
497 |
* Mark at-mention notifications as read when users visit their Mentions page.
|
498 |
*
|
499 |
-
* @since BuddyPress (1.5
|
500 |
*
|
501 |
* @uses bp_notifications_mark_all_notifications_by_type()
|
502 |
*/
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/* Emails *********************************************************************/
|
14 |
|
15 |
/**
|
16 |
* Send email and BP notifications when a user is mentioned in an update.
|
17 |
*
|
18 |
+
* @since BuddyPress (1.2)
|
19 |
*
|
20 |
* @uses bp_notifications_add_notification()
|
21 |
* @uses bp_get_user_meta()
|
99 |
$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
|
100 |
}
|
101 |
|
102 |
+
// Send the message
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
$to = apply_filters( 'bp_activity_at_message_notification_to', $to );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
$subject = apply_filters( 'bp_activity_at_message_notification_subject', $subject, $poster_name );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
$message = apply_filters( 'bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link );
|
106 |
|
107 |
wp_mail( $to, $subject, $message );
|
108 |
}
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
do_action( 'bp_activity_sent_mention_email', $activity, $subject, $message, $content, $receiver_user_id );
|
111 |
}
|
112 |
|
113 |
/**
|
114 |
* Send email and BP notifications when an activity item receives a comment.
|
115 |
*
|
116 |
+
* @since BuddyPress (1.2)
|
117 |
*
|
118 |
* @uses bp_get_user_meta()
|
119 |
* @uses bp_core_get_user_displayname()
|
177 |
$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
|
178 |
}
|
179 |
|
180 |
+
/* Send the message */
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
$to = apply_filters( 'bp_activity_new_comment_notification_to', $to );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
$subject = apply_filters( 'bp_activity_new_comment_notification_subject', $subject, $poster_name );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
$message = apply_filters( 'bp_activity_new_comment_notification_message', $message, $poster_name, $content, $thread_link, $settings_link );
|
184 |
|
185 |
wp_mail( $to, $subject, $message );
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
do_action( 'bp_activity_sent_reply_to_update_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params );
|
188 |
}
|
189 |
|
226 |
$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
|
227 |
}
|
228 |
|
229 |
+
/* Send the message */
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
$to = apply_filters( 'bp_activity_new_comment_notification_comment_author_to', $to );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
$subject = apply_filters( 'bp_activity_new_comment_notification_comment_author_subject', $subject, $poster_name );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
$message = apply_filters( 'bp_activity_new_comment_notification_comment_author_message', $message, $poster_name, $content, $settings_link, $thread_link );
|
233 |
|
234 |
wp_mail( $to, $subject, $message );
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
do_action( 'bp_activity_sent_reply_to_reply_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params );
|
237 |
}
|
238 |
}
|
254 |
/**
|
255 |
* Format notifications related to activity.
|
256 |
*
|
257 |
+
* @since BuddyPress (1.5)
|
258 |
*
|
259 |
* @uses bp_loggedin_user_domain()
|
260 |
* @uses bp_get_activity_slug()
|
278 |
$poster_user_id = $secondary_item_id;
|
279 |
$at_mention_link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/';
|
280 |
$at_mention_title = sprintf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() );
|
|
|
281 |
|
282 |
if ( (int) $total_items > 1 ) {
|
283 |
$text = sprintf( __( 'You have %1$d new mentions', 'buddypress' ), (int) $total_items );
|
284 |
+
$filter = 'bp_activity_multiple_at_mentions_notification';
|
285 |
} else {
|
286 |
$user_fullname = bp_core_get_user_displayname( $poster_user_id );
|
287 |
$text = sprintf( __( '%1$s mentioned you', 'buddypress' ), $user_fullname );
|
288 |
+
$filter = 'bp_activity_single_at_mentions_notification';
|
289 |
}
|
290 |
break;
|
291 |
}
|
292 |
|
293 |
if ( 'string' == $format ) {
|
294 |
+
$return = apply_filters( $filter, '<a href="' . esc_url( $at_mention_link ) . '" title="' . esc_attr( $at_mention_title ) . '">' . esc_html( $text ) . '</a>', $at_mention_link, (int) $total_items, $activity_id, $poster_user_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
} else {
|
296 |
+
$return = apply_filters( $filter, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
'text' => $text,
|
298 |
'link' => $at_mention_link
|
299 |
), $at_mention_link, (int) $total_items, $activity_id, $poster_user_id );
|
300 |
}
|
301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
do_action( 'activity_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
|
303 |
|
304 |
return $return;
|
338 |
/**
|
339 |
* Mark at-mention notifications as read when users visit their Mentions page.
|
340 |
*
|
341 |
+
* @since BuddyPress (1.5)
|
342 |
*
|
343 |
* @uses bp_notifications_mark_all_notifications_by_type()
|
344 |
*/
|
bp-activity/bp-activity-screens.php
CHANGED
@@ -12,12 +12,12 @@
|
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
-
defined( 'ABSPATH' )
|
16 |
|
17 |
/**
|
18 |
* Load the Activity directory.
|
19 |
*
|
20 |
-
* @since BuddyPress (1.5
|
21 |
*
|
22 |
* @uses bp_displayed_user_id()
|
23 |
* @uses bp_is_activity_component()
|
@@ -31,20 +31,8 @@ function bp_activity_screen_index() {
|
|
31 |
if ( bp_is_activity_directory() ) {
|
32 |
bp_update_is_directory( true, 'activity' );
|
33 |
|
34 |
-
/**
|
35 |
-
* Fires right before the loading of the Activity directory screen template file.
|
36 |
-
*
|
37 |
-
* @since BuddyPress (1.5.0)
|
38 |
-
*/
|
39 |
do_action( 'bp_activity_screen_index' );
|
40 |
|
41 |
-
/**
|
42 |
-
* Filters the template to load for the Activity directory screen.
|
43 |
-
*
|
44 |
-
* @since BuddyPress (1.5.0)
|
45 |
-
*
|
46 |
-
* @param string $template Path to the activity template to load.
|
47 |
-
*/
|
48 |
bp_core_load_template( apply_filters( 'bp_activity_screen_index', 'activity/index' ) );
|
49 |
}
|
50 |
}
|
@@ -53,35 +41,21 @@ add_action( 'bp_screens', 'bp_activity_screen_index' );
|
|
53 |
/**
|
54 |
* Load the 'My Activity' page.
|
55 |
*
|
56 |
-
* @since BuddyPress (1.0
|
57 |
*
|
58 |
* @uses do_action() To call the 'bp_activity_screen_my_activity' hook.
|
59 |
* @uses bp_core_load_template()
|
60 |
* @uses apply_filters() To call the 'bp_activity_template_my_activity' hook.
|
61 |
*/
|
62 |
function bp_activity_screen_my_activity() {
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Fires right before the loading of the "My Activity" screen template file.
|
66 |
-
*
|
67 |
-
* @since BuddyPress (1.0.0)
|
68 |
-
*/
|
69 |
do_action( 'bp_activity_screen_my_activity' );
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Filters the template to load for the "My Activity" screen.
|
73 |
-
*
|
74 |
-
* @since BuddyPress (1.0.0)
|
75 |
-
*
|
76 |
-
* @param string $template Path to the activity template to load.
|
77 |
-
*/
|
78 |
bp_core_load_template( apply_filters( 'bp_activity_template_my_activity', 'members/single/home' ) );
|
79 |
}
|
80 |
|
81 |
/**
|
82 |
* Load the 'My Friends' activity page.
|
83 |
*
|
84 |
-
* @since BuddyPress (1.0
|
85 |
*
|
86 |
* @uses bp_is_active()
|
87 |
* @uses bp_update_is_item_admin()
|
@@ -95,28 +69,14 @@ function bp_activity_screen_friends() {
|
|
95 |
return false;
|
96 |
|
97 |
bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Fires right before the loading of the "My Friends" screen template file.
|
101 |
-
*
|
102 |
-
* @since BuddyPress (1.2.0)
|
103 |
-
*/
|
104 |
do_action( 'bp_activity_screen_friends' );
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Filters the template to load for the "My Friends" screen.
|
108 |
-
*
|
109 |
-
* @since BuddyPress (1.0.0)
|
110 |
-
*
|
111 |
-
* @param string $template Path to the activity template to load.
|
112 |
-
*/
|
113 |
bp_core_load_template( apply_filters( 'bp_activity_template_friends_activity', 'members/single/home' ) );
|
114 |
}
|
115 |
|
116 |
/**
|
117 |
* Load the 'My Groups' activity page.
|
118 |
*
|
119 |
-
* @since BuddyPress (1.2
|
120 |
*
|
121 |
* @uses bp_is_active()
|
122 |
* @uses bp_update_is_item_admin()
|
@@ -130,28 +90,14 @@ function bp_activity_screen_groups() {
|
|
130 |
return false;
|
131 |
|
132 |
bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Fires right before the loading of the "My Groups" screen template file.
|
136 |
-
*
|
137 |
-
* @since BuddyPress (1.2.0)
|
138 |
-
*/
|
139 |
do_action( 'bp_activity_screen_groups' );
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Filters the template to load for the "My Groups" screen.
|
143 |
-
*
|
144 |
-
* @since BuddyPress (1.2.0)
|
145 |
-
*
|
146 |
-
* @param string $template Path to the activity template to load.
|
147 |
-
*/
|
148 |
bp_core_load_template( apply_filters( 'bp_activity_template_groups_activity', 'members/single/home' ) );
|
149 |
}
|
150 |
|
151 |
/**
|
152 |
* Load the 'Favorites' activity page.
|
153 |
*
|
154 |
-
* @since BuddyPress (1.2
|
155 |
*
|
156 |
* @uses bp_update_is_item_admin()
|
157 |
* @uses bp_current_user_can()
|
@@ -161,28 +107,14 @@ function bp_activity_screen_groups() {
|
|
161 |
*/
|
162 |
function bp_activity_screen_favorites() {
|
163 |
bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Fires right before the loading of the "Favorites" screen template file.
|
167 |
-
*
|
168 |
-
* @since BuddyPress (1.2.0)
|
169 |
-
*/
|
170 |
do_action( 'bp_activity_screen_favorites' );
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Filters the template to load for the "Favorites" screen.
|
174 |
-
*
|
175 |
-
* @since BuddyPress (1.2.0)
|
176 |
-
*
|
177 |
-
* @param string $template Path to the activity template to load.
|
178 |
-
*/
|
179 |
bp_core_load_template( apply_filters( 'bp_activity_template_favorite_activity', 'members/single/home' ) );
|
180 |
}
|
181 |
|
182 |
/**
|
183 |
* Load the 'Mentions' activity page.
|
184 |
*
|
185 |
-
* @since BuddyPress (1.2
|
186 |
*
|
187 |
* @uses bp_update_is_item_admin()
|
188 |
* @uses bp_current_user_can()
|
@@ -192,28 +124,14 @@ function bp_activity_screen_favorites() {
|
|
192 |
*/
|
193 |
function bp_activity_screen_mentions() {
|
194 |
bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
|
195 |
-
|
196 |
-
/**
|
197 |
-
* Fires right before the loading of the "Mentions" screen template file.
|
198 |
-
*
|
199 |
-
* @since BuddyPress (1.2.0)
|
200 |
-
*/
|
201 |
do_action( 'bp_activity_screen_mentions' );
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Filters the template to load for the "Mentions" screen.
|
205 |
-
*
|
206 |
-
* @since BuddyPress (1.2.0)
|
207 |
-
*
|
208 |
-
* @param string $template Path to the activity template to load.
|
209 |
-
*/
|
210 |
bp_core_load_template( apply_filters( 'bp_activity_template_mention_activity', 'members/single/home' ) );
|
211 |
}
|
212 |
|
213 |
/**
|
214 |
* Reset the logged-in user's new mentions data when he visits his mentions screen.
|
215 |
*
|
216 |
-
* @since BuddyPress (1.5
|
217 |
*
|
218 |
* @uses bp_is_my_profile()
|
219 |
* @uses bp_activity_clear_new_mentions()
|
@@ -228,7 +146,7 @@ add_action( 'bp_activity_screen_mentions', 'bp_activity_reset_my_new_mentions' )
|
|
228 |
/**
|
229 |
* Load the page for a single activity item.
|
230 |
*
|
231 |
-
* @since BuddyPress (1.2
|
232 |
*
|
233 |
* @global object $bp BuddyPress global settings
|
234 |
* @uses bp_is_activity_component()
|
@@ -300,23 +218,10 @@ function bp_activity_screen_single_activity_permalink() {
|
|
300 |
}
|
301 |
}
|
302 |
|
303 |
-
|
304 |
-
* Filters the access permission for a single activity view.
|
305 |
-
*
|
306 |
-
* @since BuddyPress (1.2.0)
|
307 |
-
*
|
308 |
-
* @param array $access Array holding the current $has_access value and current activity item instance.
|
309 |
-
*/
|
310 |
$has_access = apply_filters_ref_array( 'bp_activity_permalink_access', array( $has_access, &$activity ) );
|
311 |
|
312 |
-
|
313 |
-
* Fires before the loading of a single activity template file.
|
314 |
-
*
|
315 |
-
* @since BuddyPress (1.2.0)
|
316 |
-
*
|
317 |
-
* @param BP_Activity_Activity $activity Object representing the current activity item being displayed.
|
318 |
-
* @param bool $has_access Whether or not the current user has access to view activity.
|
319 |
-
*/
|
320 |
do_action( 'bp_activity_screen_single_activity_permalink', $activity, $has_access );
|
321 |
|
322 |
// Access is specifically disallowed
|
@@ -326,26 +231,11 @@ function bp_activity_screen_single_activity_permalink() {
|
|
326 |
bp_core_add_message( __( 'You do not have access to this activity.', 'buddypress' ), 'error' );
|
327 |
|
328 |
// Redirect based on logged in status
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
} else {
|
333 |
-
$url = sprintf(
|
334 |
-
site_url( 'wp-login.php?redirect_to=%s' ),
|
335 |
-
urlencode( esc_url_raw( bp_activity_get_permalink( (int) bp_current_action() ) ) )
|
336 |
-
);
|
337 |
-
}
|
338 |
-
|
339 |
-
bp_core_redirect( $url );
|
340 |
}
|
341 |
|
342 |
-
/**
|
343 |
-
* Filters the template to load for a single activity screen.
|
344 |
-
*
|
345 |
-
* @since BuddyPress (1.0.0)
|
346 |
-
*
|
347 |
-
* @param string $template Path to the activity template to load.
|
348 |
-
*/
|
349 |
bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink' ) );
|
350 |
}
|
351 |
add_action( 'bp_screens', 'bp_activity_screen_single_activity_permalink' );
|
@@ -353,7 +243,7 @@ add_action( 'bp_screens', 'bp_activity_screen_single_activity_permalink' );
|
|
353 |
/**
|
354 |
* Add activity notifications settings to the notifications settings page.
|
355 |
*
|
356 |
-
* @since BuddyPress (1.2
|
357 |
*
|
358 |
* @uses bp_get_user_meta()
|
359 |
* @uses bp_core_get_username()
|
@@ -400,14 +290,7 @@ function bp_activity_screen_notification_settings() {
|
|
400 |
<td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php checked( $reply, 'no', true ) ?>/></td>
|
401 |
</tr>
|
402 |
|
403 |
-
<?php
|
404 |
-
|
405 |
-
/**
|
406 |
-
* Fires inside the closing </tbody> tag for activity screen notification settings.
|
407 |
-
*
|
408 |
-
* @since BuddyPress (1.2.0)
|
409 |
-
*/
|
410 |
-
do_action( 'bp_activity_screen_notification_settings' ) ?>
|
411 |
</tbody>
|
412 |
</table>
|
413 |
|
@@ -415,22 +298,22 @@ function bp_activity_screen_notification_settings() {
|
|
415 |
}
|
416 |
add_action( 'bp_notification_settings', 'bp_activity_screen_notification_settings', 1 );
|
417 |
|
418 |
-
/** Theme
|
419 |
|
420 |
/**
|
421 |
* The main theme compat class for BuddyPress Activity.
|
422 |
*
|
423 |
-
* This class sets up the necessary theme
|
424 |
* activity template parts to the_title and the_content areas of a theme.
|
425 |
*
|
426 |
-
* @since BuddyPress (1.7
|
427 |
*/
|
428 |
class BP_Activity_Theme_Compat {
|
429 |
|
430 |
/**
|
431 |
* Set up the activity component theme compatibility.
|
432 |
*
|
433 |
-
* @since BuddyPress (1.7
|
434 |
*/
|
435 |
public function __construct() {
|
436 |
add_action( 'bp_setup_theme_compat', array( $this, 'is_activity' ) );
|
@@ -439,7 +322,7 @@ class BP_Activity_Theme_Compat {
|
|
439 |
/**
|
440 |
* Set up the theme compatibility hooks, if we're looking at an activity page.
|
441 |
*
|
442 |
-
* @since BuddyPress (1.7
|
443 |
*/
|
444 |
public function is_activity() {
|
445 |
|
@@ -451,7 +334,6 @@ class BP_Activity_Theme_Compat {
|
|
451 |
if ( ! bp_displayed_user_id() && ! bp_current_action() ) {
|
452 |
bp_update_is_directory( true, 'activity' );
|
453 |
|
454 |
-
/** This action is documented in bp-activity/bp-activity-screens.php */
|
455 |
do_action( 'bp_activity_screen_index' );
|
456 |
|
457 |
add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) );
|
@@ -473,20 +355,13 @@ class BP_Activity_Theme_Compat {
|
|
473 |
*
|
474 |
* This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
|
475 |
*
|
476 |
-
* @since BuddyPress (1.8
|
477 |
*
|
478 |
* @param string $templates The templates from bp_get_theme_compat_templates().
|
479 |
* @return array $templates Array of custom templates to look for.
|
480 |
*/
|
481 |
public function directory_template_hierarchy( $templates ) {
|
482 |
-
|
483 |
-
/**
|
484 |
-
* Filters the template hierarchy for the activity directory page.
|
485 |
-
*
|
486 |
-
* @since BuddyPress (1.8.0)
|
487 |
-
*
|
488 |
-
* @param array $index-directory Array holding template names to be merged into template list.
|
489 |
-
*/
|
490 |
$new_templates = apply_filters( 'bp_template_hierarchy_activity_directory', array(
|
491 |
'activity/index-directory.php'
|
492 |
) );
|
@@ -501,7 +376,7 @@ class BP_Activity_Theme_Compat {
|
|
501 |
/**
|
502 |
* Update the global $post with directory data.
|
503 |
*
|
504 |
-
* @since BuddyPress (1.7
|
505 |
*/
|
506 |
public function directory_dummy_post() {
|
507 |
bp_theme_compat_reset_post( array(
|
@@ -520,7 +395,7 @@ class BP_Activity_Theme_Compat {
|
|
520 |
/**
|
521 |
* Filter the_content with the groups index template part.
|
522 |
*
|
523 |
-
* @since BuddyPress (1.7
|
524 |
*/
|
525 |
public function directory_content() {
|
526 |
return bp_buffer_template_part( 'activity/index', null, false );
|
@@ -533,20 +408,13 @@ class BP_Activity_Theme_Compat {
|
|
533 |
*
|
534 |
* This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
|
535 |
*
|
536 |
-
* @since BuddyPress (1.8
|
537 |
*
|
538 |
* @param string $templates The templates from bp_get_theme_compat_templates().
|
539 |
* @return array $templates Array of custom templates to look for.
|
540 |
*/
|
541 |
public function single_template_hierarchy( $templates ) {
|
542 |
-
|
543 |
-
/**
|
544 |
-
* Filters the template hierarchy for the activity permalink pages.
|
545 |
-
*
|
546 |
-
* @since BuddyPress (1.8.0)
|
547 |
-
*
|
548 |
-
* @param array $index Array holding template names to be merged into template list.
|
549 |
-
*/
|
550 |
$new_templates = apply_filters( 'bp_template_hierarchy_activity_single_item', array(
|
551 |
'activity/single/index.php'
|
552 |
) );
|
@@ -561,7 +429,7 @@ class BP_Activity_Theme_Compat {
|
|
561 |
/**
|
562 |
* Update the global $post with the displayed user's data.
|
563 |
*
|
564 |
-
* @since BuddyPress (1.7
|
565 |
*/
|
566 |
public function single_dummy_post() {
|
567 |
bp_theme_compat_reset_post( array(
|
@@ -580,7 +448,7 @@ class BP_Activity_Theme_Compat {
|
|
580 |
/**
|
581 |
* Filter the_content with the members' activity permalink template part.
|
582 |
*
|
583 |
-
* @since BuddyPress (1.7
|
584 |
*/
|
585 |
public function single_dummy_content() {
|
586 |
return bp_buffer_template_part( 'activity/single/home', null, false );
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
16 |
|
17 |
/**
|
18 |
* Load the Activity directory.
|
19 |
*
|
20 |
+
* @since BuddyPress (1.5)
|
21 |
*
|
22 |
* @uses bp_displayed_user_id()
|
23 |
* @uses bp_is_activity_component()
|
31 |
if ( bp_is_activity_directory() ) {
|
32 |
bp_update_is_directory( true, 'activity' );
|
33 |
|
|
|
|
|
|
|
|
|
|
|
34 |
do_action( 'bp_activity_screen_index' );
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
bp_core_load_template( apply_filters( 'bp_activity_screen_index', 'activity/index' ) );
|
37 |
}
|
38 |
}
|
41 |
/**
|
42 |
* Load the 'My Activity' page.
|
43 |
*
|
44 |
+
* @since BuddyPress (1.0)
|
45 |
*
|
46 |
* @uses do_action() To call the 'bp_activity_screen_my_activity' hook.
|
47 |
* @uses bp_core_load_template()
|
48 |
* @uses apply_filters() To call the 'bp_activity_template_my_activity' hook.
|
49 |
*/
|
50 |
function bp_activity_screen_my_activity() {
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
do_action( 'bp_activity_screen_my_activity' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
bp_core_load_template( apply_filters( 'bp_activity_template_my_activity', 'members/single/home' ) );
|
53 |
}
|
54 |
|
55 |
/**
|
56 |
* Load the 'My Friends' activity page.
|
57 |
*
|
58 |
+
* @since BuddyPress (1.0)
|
59 |
*
|
60 |
* @uses bp_is_active()
|
61 |
* @uses bp_update_is_item_admin()
|
69 |
return false;
|
70 |
|
71 |
bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
do_action( 'bp_activity_screen_friends' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
bp_core_load_template( apply_filters( 'bp_activity_template_friends_activity', 'members/single/home' ) );
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
* Load the 'My Groups' activity page.
|
78 |
*
|
79 |
+
* @since BuddyPress (1.2)
|
80 |
*
|
81 |
* @uses bp_is_active()
|
82 |
* @uses bp_update_is_item_admin()
|
90 |
return false;
|
91 |
|
92 |
bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
do_action( 'bp_activity_screen_groups' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
bp_core_load_template( apply_filters( 'bp_activity_template_groups_activity', 'members/single/home' ) );
|
95 |
}
|
96 |
|
97 |
/**
|
98 |
* Load the 'Favorites' activity page.
|
99 |
*
|
100 |
+
* @since BuddyPress (1.2)
|
101 |
*
|
102 |
* @uses bp_update_is_item_admin()
|
103 |
* @uses bp_current_user_can()
|
107 |
*/
|
108 |
function bp_activity_screen_favorites() {
|
109 |
bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
do_action( 'bp_activity_screen_favorites' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
bp_core_load_template( apply_filters( 'bp_activity_template_favorite_activity', 'members/single/home' ) );
|
112 |
}
|
113 |
|
114 |
/**
|
115 |
* Load the 'Mentions' activity page.
|
116 |
*
|
117 |
+
* @since BuddyPress (1.2)
|
118 |
*
|
119 |
* @uses bp_update_is_item_admin()
|
120 |
* @uses bp_current_user_can()
|
124 |
*/
|
125 |
function bp_activity_screen_mentions() {
|
126 |
bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
do_action( 'bp_activity_screen_mentions' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
bp_core_load_template( apply_filters( 'bp_activity_template_mention_activity', 'members/single/home' ) );
|
129 |
}
|
130 |
|
131 |
/**
|
132 |
* Reset the logged-in user's new mentions data when he visits his mentions screen.
|
133 |
*
|
134 |
+
* @since BuddyPress (1.5)
|
135 |
*
|
136 |
* @uses bp_is_my_profile()
|
137 |
* @uses bp_activity_clear_new_mentions()
|
146 |
/**
|
147 |
* Load the page for a single activity item.
|
148 |
*
|
149 |
+
* @since BuddyPress (1.2)
|
150 |
*
|
151 |
* @global object $bp BuddyPress global settings
|
152 |
* @uses bp_is_activity_component()
|
218 |
}
|
219 |
}
|
220 |
|
221 |
+
// Allow access to be filtered
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
$has_access = apply_filters_ref_array( 'bp_activity_permalink_access', array( $has_access, &$activity ) );
|
223 |
|
224 |
+
// Allow additional code execution
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
do_action( 'bp_activity_screen_single_activity_permalink', $activity, $has_access );
|
226 |
|
227 |
// Access is specifically disallowed
|
231 |
bp_core_add_message( __( 'You do not have access to this activity.', 'buddypress' ), 'error' );
|
232 |
|
233 |
// Redirect based on logged in status
|
234 |
+
is_user_logged_in() ?
|
235 |
+
bp_core_redirect( bp_loggedin_user_domain() ) :
|
236 |
+
bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . esc_url( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . bp_current_action() . '/' ) ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
}
|
238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink' ) );
|
240 |
}
|
241 |
add_action( 'bp_screens', 'bp_activity_screen_single_activity_permalink' );
|
243 |
/**
|
244 |
* Add activity notifications settings to the notifications settings page.
|
245 |
*
|
246 |
+
* @since BuddyPress (1.2)
|
247 |
*
|
248 |
* @uses bp_get_user_meta()
|
249 |
* @uses bp_core_get_username()
|
290 |
<td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php checked( $reply, 'no', true ) ?>/></td>
|
291 |
</tr>
|
292 |
|
293 |
+
<?php do_action( 'bp_activity_screen_notification_settings' ) ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
</tbody>
|
295 |
</table>
|
296 |
|
298 |
}
|
299 |
add_action( 'bp_notification_settings', 'bp_activity_screen_notification_settings', 1 );
|
300 |
|
301 |
+
/** Theme Compatability *******************************************************/
|
302 |
|
303 |
/**
|
304 |
* The main theme compat class for BuddyPress Activity.
|
305 |
*
|
306 |
+
* This class sets up the necessary theme compatability actions to safely output
|
307 |
* activity template parts to the_title and the_content areas of a theme.
|
308 |
*
|
309 |
+
* @since BuddyPress (1.7)
|
310 |
*/
|
311 |
class BP_Activity_Theme_Compat {
|
312 |
|
313 |
/**
|
314 |
* Set up the activity component theme compatibility.
|
315 |
*
|
316 |
+
* @since BuddyPress (1.7)
|
317 |
*/
|
318 |
public function __construct() {
|
319 |
add_action( 'bp_setup_theme_compat', array( $this, 'is_activity' ) );
|
322 |
/**
|
323 |
* Set up the theme compatibility hooks, if we're looking at an activity page.
|
324 |
*
|
325 |
+
* @since BuddyPress (1.7)
|
326 |
*/
|
327 |
public function is_activity() {
|
328 |
|
334 |
if ( ! bp_displayed_user_id() && ! bp_current_action() ) {
|
335 |
bp_update_is_directory( true, 'activity' );
|
336 |
|
|
|
337 |
do_action( 'bp_activity_screen_index' );
|
338 |
|
339 |
add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) );
|
355 |
*
|
356 |
* This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
|
357 |
*
|
358 |
+
* @since BuddyPress (1.8)
|
359 |
*
|
360 |
* @param string $templates The templates from bp_get_theme_compat_templates().
|
361 |
* @return array $templates Array of custom templates to look for.
|
362 |
*/
|
363 |
public function directory_template_hierarchy( $templates ) {
|
364 |
+
// Setup our templates based on priority
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
$new_templates = apply_filters( 'bp_template_hierarchy_activity_directory', array(
|
366 |
'activity/index-directory.php'
|
367 |
) );
|
376 |
/**
|
377 |
* Update the global $post with directory data.
|
378 |
*
|
379 |
+
* @since BuddyPress (1.7)
|
380 |
*/
|
381 |
public function directory_dummy_post() {
|
382 |
bp_theme_compat_reset_post( array(
|
395 |
/**
|
396 |
* Filter the_content with the groups index template part.
|
397 |
*
|
398 |
+
* @since BuddyPress (1.7)
|
399 |
*/
|
400 |
public function directory_content() {
|
401 |
return bp_buffer_template_part( 'activity/index', null, false );
|
408 |
*
|
409 |
* This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
|
410 |
*
|
411 |
+
* @since BuddyPress (1.8)
|
412 |
*
|
413 |
* @param string $templates The templates from bp_get_theme_compat_templates().
|
414 |
* @return array $templates Array of custom templates to look for.
|
415 |
*/
|
416 |
public function single_template_hierarchy( $templates ) {
|
417 |
+
// Setup our templates based on priority
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
$new_templates = apply_filters( 'bp_template_hierarchy_activity_single_item', array(
|
419 |
'activity/single/index.php'
|
420 |
) );
|
429 |
/**
|
430 |
* Update the global $post with the displayed user's data.
|
431 |
*
|
432 |
+
* @since BuddyPress (1.7)
|
433 |
*/
|
434 |
public function single_dummy_post() {
|
435 |
bp_theme_compat_reset_post( array(
|
448 |
/**
|
449 |
* Filter the_content with the members' activity permalink template part.
|
450 |
*
|
451 |
+
* @since BuddyPress (1.7)
|
452 |
*/
|
453 |
public function single_dummy_content() {
|
454 |
return bp_buffer_template_part( 'activity/single/home', null, false );
|
bp-activity/bp-activity-template.php
CHANGED
@@ -8,12 +8,12 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Output the activity component slug.
|
15 |
*
|
16 |
-
* @since BuddyPress (1.5
|
17 |
*
|
18 |
* @uses bp_get_activity_slug()
|
19 |
*/
|
@@ -23,28 +23,20 @@ function bp_activity_slug() {
|
|
23 |
/**
|
24 |
* Return the activity component slug.
|
25 |
*
|
26 |
-
* @since BuddyPress (1.5
|
27 |
*
|
28 |
* @uses apply_filters() To call the 'bp_get_activity_slug' hook.
|
29 |
*
|
30 |
* @return string The activity component slug.
|
31 |
*/
|
32 |
function bp_get_activity_slug() {
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Filters the activity component slug.
|
36 |
-
*
|
37 |
-
* @since BuddyPress (1.5.0)
|
38 |
-
*
|
39 |
-
* @param string $slug Activity component slug.
|
40 |
-
*/
|
41 |
return apply_filters( 'bp_get_activity_slug', buddypress()->activity->slug );
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
* Output the activity component root slug.
|
46 |
*
|
47 |
-
* @since BuddyPress (1.5
|
48 |
*
|
49 |
* @uses bp_get_activity_root_slug()
|
50 |
*/
|
@@ -54,28 +46,20 @@ function bp_activity_root_slug() {
|
|
54 |
/**
|
55 |
* Return the activity component root slug.
|
56 |
*
|
57 |
-
* @since BuddyPress (1.5
|
58 |
*
|
59 |
* @uses apply_filters() To call the 'bp_get_activity_root_slug' hook.
|
60 |
*
|
61 |
* @return string The activity component root slug.
|
62 |
*/
|
63 |
function bp_get_activity_root_slug() {
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Filters the activity component root slug.
|
67 |
-
*
|
68 |
-
* @since BuddyPress (1.5.0)
|
69 |
-
*
|
70 |
-
* @param string $root_slug Activity component root slug.
|
71 |
-
*/
|
72 |
return apply_filters( 'bp_get_activity_root_slug', buddypress()->activity->root_slug );
|
73 |
}
|
74 |
|
75 |
/**
|
76 |
* Output activity directory permalink.
|
77 |
*
|
78 |
-
* @since BuddyPress (1.5
|
79 |
*
|
80 |
* @uses bp_get_activity_directory_permalink()
|
81 |
*/
|
@@ -85,9 +69,9 @@ function bp_activity_directory_permalink() {
|
|
85 |
/**
|
86 |
* Return activity directory permalink
|
87 |
*
|
88 |
-
* @since BuddyPress (1.5
|
89 |
*
|
90 |
-
* @uses
|
91 |
* @uses bp_get_root_domain()
|
92 |
* @uses bp_get_activity_root_slug()
|
93 |
* @uses apply_filters() To call the 'bp_get_activity_directory_permalink' hook.
|
@@ -95,14 +79,6 @@ function bp_activity_directory_permalink() {
|
|
95 |
* @return string Activity directory permalink.
|
96 |
*/
|
97 |
function bp_get_activity_directory_permalink() {
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Filters the activity directory permalink.
|
101 |
-
*
|
102 |
-
* @since BuddyPress (1.5.0)
|
103 |
-
*
|
104 |
-
* @param string $url Permalink url for the activity directory.
|
105 |
-
*/
|
106 |
return apply_filters( 'bp_get_activity_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_activity_root_slug() ) );
|
107 |
}
|
108 |
|
@@ -111,7 +87,7 @@ function bp_activity_directory_permalink() {
|
|
111 |
*
|
112 |
* This is responsible for loading a group of activity items and displaying them.
|
113 |
*
|
114 |
-
* @since BuddyPress (1.0
|
115 |
*/
|
116 |
class BP_Activity_Template {
|
117 |
var $current_activity = -1;
|
@@ -195,17 +171,14 @@ class BP_Activity_Template {
|
|
195 |
'per_page' => 20,
|
196 |
'page_arg' => 'acpage',
|
197 |
'max' => false,
|
198 |
-
'count_total' => false,
|
199 |
'sort' => false,
|
200 |
'include' => false,
|
201 |
'exclude' => false,
|
202 |
'in' => false,
|
203 |
'filter' => false,
|
204 |
-
'scope' => false,
|
205 |
'search_terms' => false,
|
206 |
'meta_query' => false,
|
207 |
'date_query' => false,
|
208 |
-
'filter_query' => false,
|
209 |
'display_comments' => 'threaded',
|
210 |
'show_hidden' => false,
|
211 |
'spam' => 'ham_only',
|
@@ -214,9 +187,9 @@ class BP_Activity_Template {
|
|
214 |
$r = wp_parse_args( $args, $defaults );
|
215 |
extract( $r );
|
216 |
|
217 |
-
$this->pag_arg =
|
218 |
-
$this->pag_page =
|
219 |
-
$this->pag_num =
|
220 |
|
221 |
// Check if blog/forum replies are disabled
|
222 |
$this->disable_blogforum_replies = isset( $bp->site_options['bp-disable-blogforum-comments'] ) ? $bp->site_options['bp-disable-blogforum-comments'] : false;
|
@@ -229,7 +202,6 @@ class BP_Activity_Template {
|
|
229 |
$this->activities = bp_activity_get_specific( array(
|
230 |
'activity_ids' => explode( ',', $include ),
|
231 |
'max' => $max,
|
232 |
-
'count_total' => $count_total,
|
233 |
'page' => $this->pag_page,
|
234 |
'per_page' => $this->pag_num,
|
235 |
'sort' => $sort,
|
@@ -244,16 +216,13 @@ class BP_Activity_Template {
|
|
244 |
$this->activities = bp_activity_get( array(
|
245 |
'display_comments' => $display_comments,
|
246 |
'max' => $max,
|
247 |
-
'count_total' => $count_total,
|
248 |
'per_page' => $this->pag_num,
|
249 |
'page' => $this->pag_page,
|
250 |
'sort' => $sort,
|
251 |
'search_terms' => $search_terms,
|
252 |
'meta_query' => $meta_query,
|
253 |
'date_query' => $date_query,
|
254 |
-
'filter_query' => $filter_query,
|
255 |
'filter' => $filter,
|
256 |
-
'scope' => $scope,
|
257 |
'show_hidden' => $show_hidden,
|
258 |
'exclude' => $exclude,
|
259 |
'in' => $in,
|
@@ -308,14 +277,13 @@ class BP_Activity_Template {
|
|
308 |
|
309 |
if ( (int) $this->total_activity_count && (int) $this->pag_num ) {
|
310 |
$this->pag_links = paginate_links( array(
|
311 |
-
'base' => add_query_arg( $
|
312 |
'format' => '',
|
313 |
'total' => ceil( (int) $this->total_activity_count / (int) $this->pag_num ),
|
314 |
'current' => (int) $this->pag_page,
|
315 |
'prev_text' => _x( '←', 'Activity pagination previous text', 'buddypress' ),
|
316 |
'next_text' => _x( '→', 'Activity pagination next text', 'buddypress' ),
|
317 |
-
'mid_size' => 1
|
318 |
-
'add_args' => array(),
|
319 |
) );
|
320 |
}
|
321 |
}
|
@@ -372,13 +340,7 @@ class BP_Activity_Template {
|
|
372 |
if ( $this->current_activity + 1 < $this->activity_count ) {
|
373 |
return true;
|
374 |
} elseif ( $this->current_activity + 1 == $this->activity_count ) {
|
375 |
-
|
376 |
-
/**
|
377 |
-
* Fires right before the rewinding of activity posts.
|
378 |
-
*
|
379 |
-
* @since BuddyPress (1.1.0)
|
380 |
-
*/
|
381 |
-
do_action( 'activity_loop_end' );
|
382 |
// Do some cleaning up after the loop
|
383 |
$this->rewind_activities();
|
384 |
}
|
@@ -404,15 +366,8 @@ class BP_Activity_Template {
|
|
404 |
if ( is_array( $this->activity ) )
|
405 |
$this->activity = (object) $this->activity;
|
406 |
|
407 |
-
if ( $this->current_activity == 0 )
|
408 |
-
|
409 |
-
/**
|
410 |
-
* Fires if the current activity item is the first in the activity loop.
|
411 |
-
*
|
412 |
-
* @since BuddyPress (1.1.0)
|
413 |
-
*/
|
414 |
do_action('activity_loop_start');
|
415 |
-
}
|
416 |
}
|
417 |
}
|
418 |
|
@@ -423,7 +378,7 @@ class BP_Activity_Template {
|
|
423 |
* $activities_template global, enabling the use of BuddyPress templates and
|
424 |
* template functions to display a list of activity items.
|
425 |
*
|
426 |
-
* @since BuddyPress (1.0
|
427 |
*
|
428 |
* @global object $activities_template {@link BP_Activity_Template}
|
429 |
* @global object $bp BuddyPress global settings.
|
@@ -440,88 +395,108 @@ class BP_Activity_Template {
|
|
440 |
* @uses apply_filters() To call the 'bp_has_activities' hook.
|
441 |
*
|
442 |
* @param array $args {
|
443 |
-
* Arguments for limiting the contents of the activity loop. Most
|
444 |
-
* are in the same format as {@link BP_Activity_Activity::get()}.
|
445 |
-
* because the format of the arguments accepted here differs in
|
446 |
-
* ways, and because bp_has_activities() determines some
|
447 |
-
* a dynamic fashion, we list all accepted arguments
|
448 |
-
*
|
449 |
-
*
|
450 |
-
*
|
451 |
-
*
|
452 |
-
*
|
453 |
-
*
|
454 |
-
*
|
455 |
-
* @type
|
456 |
-
* @type
|
457 |
-
*
|
458 |
-
*
|
459 |
-
*
|
460 |
-
* @type
|
461 |
-
* @type array|bool
|
462 |
-
*
|
463 |
-
*
|
464 |
-
*
|
465 |
-
*
|
466 |
-
*
|
467 |
-
*
|
468 |
-
*
|
469 |
-
*
|
470 |
-
*
|
471 |
-
*
|
472 |
-
*
|
473 |
-
* @type string
|
474 |
-
*
|
475 |
-
*
|
476 |
-
*
|
477 |
-
*
|
478 |
-
*
|
479 |
-
*
|
480 |
-
*
|
481 |
-
*
|
482 |
-
*
|
483 |
-
*
|
484 |
-
*
|
485 |
-
*
|
486 |
-
*
|
487 |
-
*
|
488 |
-
*
|
489 |
-
*
|
490 |
-
*
|
491 |
-
*
|
492 |
-
*
|
493 |
-
*
|
494 |
-
*
|
495 |
-
*
|
496 |
-
*
|
497 |
-
*
|
498 |
-
*
|
499 |
-
*
|
500 |
-
*
|
501 |
-
*
|
502 |
-
*
|
503 |
-
*
|
504 |
-
*
|
505 |
-
*
|
506 |
-
*
|
507 |
-
*
|
508 |
-
*
|
509 |
-
* @type
|
510 |
-
*
|
511 |
-
*
|
512 |
-
*
|
513 |
-
*
|
514 |
-
*
|
515 |
-
*
|
516 |
-
* @type bool
|
517 |
-
*
|
518 |
-
*
|
519 |
-
*
|
520 |
-
*
|
521 |
-
*
|
522 |
-
*
|
523 |
-
* @type bool
|
524 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
525 |
* }
|
526 |
* @return bool Returns true when activities are found, otherwise false.
|
527 |
*/
|
@@ -576,7 +551,6 @@ function bp_has_activities( $args = '' ) {
|
|
576 |
'page' => 1, // which page to load
|
577 |
'per_page' => 20, // number of items per page
|
578 |
'max' => false, // max number to return
|
579 |
-
'count_total' => false,
|
580 |
'show_hidden' => $show_hidden, // Show activity items that are hidden site-wide?
|
581 |
'spam' => 'ham_only', // Hide spammed items
|
582 |
|
@@ -596,7 +570,6 @@ function bp_has_activities( $args = '' ) {
|
|
596 |
|
597 |
'meta_query' => false, // filter on activity meta. See WP_Meta_Query for format
|
598 |
'date_query' => false, // filter by date. See first parameter of WP_Date_Query for format
|
599 |
-
'filter_query' => false, // advanced filtering. See BP_Activity_Query for format
|
600 |
|
601 |
// Searching
|
602 |
'search_terms' => false, // specify terms to search on
|
@@ -618,28 +591,78 @@ function bp_has_activities( $args = '' ) {
|
|
618 |
$page = 0;
|
619 |
}
|
620 |
|
621 |
-
// Search terms
|
622 |
if ( empty( $search_terms ) && ! empty( $_REQUEST['s'] ) )
|
623 |
$search_terms = $_REQUEST['s'];
|
624 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
// Do not exceed the maximum per page
|
626 |
if ( !empty( $max ) && ( (int) $per_page > (int) $max ) )
|
627 |
$per_page = $max;
|
628 |
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
* Support for basic filters in earlier BP versions is disabled by default.
|
633 |
-
* To enable, put add_filter( 'bp_activity_enable_afilter_support', '__return_true' );
|
634 |
-
* into bp-custom.php or your theme's functions.php.
|
635 |
-
*
|
636 |
-
* @since BuddyPress (1.6.0)
|
637 |
-
*
|
638 |
-
* @param bool $value True if BuddyPress should enable afilter support.
|
639 |
-
*/
|
640 |
if ( isset( $_GET['afilter'] ) && apply_filters( 'bp_activity_enable_afilter_support', false ) )
|
641 |
$filter = array( 'object' => $_GET['afilter'] );
|
642 |
-
|
643 |
$filter = array( 'user_id' => $user_id, 'object' => $object, 'action' => $action, 'primary_id' => $primary_id, 'secondary_id' => $secondary_id, 'offset' => $offset, 'since' => $since );
|
644 |
else
|
645 |
$filter = false;
|
@@ -653,17 +676,14 @@ function bp_has_activities( $args = '' ) {
|
|
653 |
'per_page' => $per_page,
|
654 |
'page_arg' => $page_arg,
|
655 |
'max' => $max,
|
656 |
-
'count_total' => $count_total,
|
657 |
'sort' => $sort,
|
658 |
'include' => $include,
|
659 |
'exclude' => $exclude,
|
660 |
'in' => $in,
|
661 |
'filter' => $filter,
|
662 |
-
'scope' => $scope,
|
663 |
'search_terms' => $search_terms,
|
664 |
'meta_query' => $meta_query,
|
665 |
'date_query' => $date_query,
|
666 |
-
'filter_query' => $filter_query,
|
667 |
'display_comments' => $display_comments,
|
668 |
'show_hidden' => $show_hidden,
|
669 |
'spam' => $spam,
|
@@ -672,22 +692,13 @@ function bp_has_activities( $args = '' ) {
|
|
672 |
|
673 |
$activities_template = new BP_Activity_Template( $template_args );
|
674 |
|
675 |
-
/**
|
676 |
-
* Filters whether or not there are activity items to display.
|
677 |
-
*
|
678 |
-
* @since BuddyPress (1.1.0)
|
679 |
-
*
|
680 |
-
* @param bool $has_activities Whether or not there are activity items to display.
|
681 |
-
* @param string $activities_template Current activities template being used.
|
682 |
-
* @param array $template_args Array of arguments passed into the BP_Activity_Template class.
|
683 |
-
*/
|
684 |
return apply_filters( 'bp_has_activities', $activities_template->has_activities(), $activities_template, $template_args );
|
685 |
}
|
686 |
|
687 |
/**
|
688 |
* Determine if there are still activities left in the loop.
|
689 |
*
|
690 |
-
* @since BuddyPress (1.0
|
691 |
*
|
692 |
* @global object $activities_template {@link BP_Activity_Template}
|
693 |
* @uses BP_Activity_Template::user_activities() {@link BP_Activity_Template::user_activities()}
|
@@ -702,7 +713,7 @@ function bp_activities() {
|
|
702 |
/**
|
703 |
* Get the current activity object in the loop.
|
704 |
*
|
705 |
-
* @since BuddyPress (1.0
|
706 |
*
|
707 |
* @global object $activities_template {@link BP_Activity_Template}
|
708 |
* @uses BP_Activity_Template::the_activity() {@link BP_Activity_Template::the_activity()}
|
@@ -720,35 +731,21 @@ function bp_the_activity() {
|
|
720 |
* @since BuddyPress (2.1.0)
|
721 |
*/
|
722 |
function bp_activity_load_more_link() {
|
723 |
-
echo
|
724 |
}
|
725 |
-
/**
|
726 |
-
* Get the URL for the Load More link
|
727 |
-
*
|
728 |
-
* @since BuddyPress (2.1.0)
|
729 |
-
*/
|
730 |
function bp_get_activity_load_more_link() {
|
731 |
global $activities_template;
|
732 |
|
733 |
-
$
|
734 |
-
$link = add_query_arg( $activities_template->pag_arg, $activities_template->pag_page + 1, $
|
735 |
|
736 |
-
|
737 |
-
* Filters the Load More link URL.
|
738 |
-
*
|
739 |
-
* @since BuddyPress (2.1.0)
|
740 |
-
*
|
741 |
-
* @param string $link The "Load More" link URL with appropriate query args
|
742 |
-
* @param string $url The original URL
|
743 |
-
* @param object $activities_template The activity template loop global
|
744 |
-
*/
|
745 |
-
return apply_filters( 'bp_get_activity_load_more_link', $link, $url, $activities_template );
|
746 |
}
|
747 |
|
748 |
/**
|
749 |
* Output the activity pagination count.
|
750 |
*
|
751 |
-
* @since BuddyPress (1.0
|
752 |
*
|
753 |
* @global object $activities_template {@link BP_Activity_Template}
|
754 |
* @uses BP_Activity_Template::the_activity() {@link BP_Activity_Template::the_activity()}
|
@@ -760,7 +757,7 @@ function bp_activity_pagination_count() {
|
|
760 |
/**
|
761 |
* Return the activity pagination count.
|
762 |
*
|
763 |
-
* @since BuddyPress (1.2
|
764 |
*
|
765 |
* @global object $activities_template {@link BP_Activity_Template}
|
766 |
* @uses bp_core_number_format()
|
@@ -781,7 +778,7 @@ function bp_activity_pagination_count() {
|
|
781 |
/**
|
782 |
* Output the activity pagination links.
|
783 |
*
|
784 |
-
* @since BuddyPress (1.0
|
785 |
*
|
786 |
* @uses bp_get_activity_pagination_links()
|
787 |
*/
|
@@ -792,7 +789,7 @@ function bp_activity_pagination_links() {
|
|
792 |
/**
|
793 |
* Return the activity pagination links.
|
794 |
*
|
795 |
-
* @since BuddyPress (1.0
|
796 |
*
|
797 |
* @global object $activities_template {@link BP_Activity_Template}
|
798 |
* @uses apply_filters() To call the 'bp_get_activity_pagination_links' hook.
|
@@ -802,20 +799,13 @@ function bp_activity_pagination_links() {
|
|
802 |
function bp_get_activity_pagination_links() {
|
803 |
global $activities_template;
|
804 |
|
805 |
-
/**
|
806 |
-
* Filters the activity pagination link output.
|
807 |
-
*
|
808 |
-
* @since BuddyPress (1.0.0)
|
809 |
-
*
|
810 |
-
* @param string $pag_links Output for the activity pagination links.
|
811 |
-
*/
|
812 |
return apply_filters( 'bp_get_activity_pagination_links', $activities_template->pag_links );
|
813 |
}
|
814 |
|
815 |
/**
|
816 |
* Return true when there are more activity items to be shown than currently appear.
|
817 |
*
|
818 |
-
* @since BuddyPress (1.5
|
819 |
*
|
820 |
* @global object $activities_template {@link BP_Activity_Template}
|
821 |
* @uses apply_filters() To call the 'bp_activity_has_more_items' hook.
|
@@ -837,20 +827,13 @@ function bp_activity_has_more_items() {
|
|
837 |
$has_more_items = (int) $remaining_pages > 0;
|
838 |
}
|
839 |
|
840 |
-
/**
|
841 |
-
* Filters whether there are more activity items to display.
|
842 |
-
*
|
843 |
-
* @since BuddyPress (1.5.0)
|
844 |
-
*
|
845 |
-
* @param bool $has_more_items Whether or not there are more activity items to display.
|
846 |
-
*/
|
847 |
return apply_filters( 'bp_activity_has_more_items', $has_more_items );
|
848 |
}
|
849 |
|
850 |
/**
|
851 |
* Output the activity count.
|
852 |
*
|
853 |
-
* @since BuddyPress (1.2
|
854 |
*
|
855 |
* @uses bp_get_activity_count()
|
856 |
*/
|
@@ -861,7 +844,7 @@ function bp_activity_count() {
|
|
861 |
/**
|
862 |
* Return the activity count.
|
863 |
*
|
864 |
-
* @since BuddyPress (1.2
|
865 |
*
|
866 |
* @global object $activities_template {@link BP_Activity_Template}
|
867 |
* @uses apply_filters() To call the 'bp_get_activity_count' hook.
|
@@ -871,20 +854,13 @@ function bp_activity_count() {
|
|
871 |
function bp_get_activity_count() {
|
872 |
global $activities_template;
|
873 |
|
874 |
-
/**
|
875 |
-
* Filters the activity count for the activity template.
|
876 |
-
*
|
877 |
-
* @since BuddyPress (1.2.0)
|
878 |
-
*
|
879 |
-
* @param int $activity_count The count for total activity.
|
880 |
-
*/
|
881 |
return apply_filters( 'bp_get_activity_count', (int) $activities_template->activity_count );
|
882 |
}
|
883 |
|
884 |
/**
|
885 |
* Output the number of activities per page.
|
886 |
*
|
887 |
-
* @since BuddyPress (1.2
|
888 |
*
|
889 |
* @uses bp_get_activity_per_page()
|
890 |
*/
|
@@ -895,7 +871,7 @@ function bp_activity_per_page() {
|
|
895 |
/**
|
896 |
* Return the number of activities per page.
|
897 |
*
|
898 |
-
* @since BuddyPress (1.2
|
899 |
*
|
900 |
* @global object $activities_template {@link BP_Activity_Template}
|
901 |
* @uses apply_filters() To call the 'bp_get_activity_per_page' hook.
|
@@ -905,20 +881,13 @@ function bp_activity_per_page() {
|
|
905 |
function bp_get_activity_per_page() {
|
906 |
global $activities_template;
|
907 |
|
908 |
-
/**
|
909 |
-
* Filters the activity posts per page value.
|
910 |
-
*
|
911 |
-
* @since BuddyPress (1.2.0)
|
912 |
-
*
|
913 |
-
* @param int $pag_num How many post should be displayed for pagination.
|
914 |
-
*/
|
915 |
return apply_filters( 'bp_get_activity_per_page', (int) $activities_template->pag_num );
|
916 |
}
|
917 |
|
918 |
/**
|
919 |
* Output the activities title.
|
920 |
*
|
921 |
-
* @since BuddyPress (1.0
|
922 |
*
|
923 |
* @uses bp_get_activities_title()
|
924 |
* @todo Deprecate.
|
@@ -930,31 +899,24 @@ function bp_activities_title() {
|
|
930 |
/**
|
931 |
* Return the activities title.
|
932 |
*
|
933 |
-
* @since BuddyPress (1.0
|
934 |
*
|
935 |
* @global string $bp_activity_title
|
936 |
* @uses apply_filters() To call the 'bp_get_activities_title' hook.
|
937 |
* @todo Deprecate.
|
938 |
*
|
939 |
-
* @return
|
940 |
*/
|
941 |
function bp_get_activities_title() {
|
942 |
global $bp_activity_title;
|
943 |
|
944 |
-
/**
|
945 |
-
* Filters the activities title for the activity template.
|
946 |
-
*
|
947 |
-
* @since BuddyPress (1.0.0)
|
948 |
-
*
|
949 |
-
* @param string $bp_activity_title The title to be displayed.
|
950 |
-
*/
|
951 |
return apply_filters( 'bp_get_activities_title', $bp_activity_title );
|
952 |
}
|
953 |
|
954 |
/**
|
955 |
* {@internal Missing Description}
|
956 |
*
|
957 |
-
* @since BuddyPress (1.0
|
958 |
*
|
959 |
* @uses bp_get_activities_no_activity()
|
960 |
* @todo Deprecate.
|
@@ -966,7 +928,7 @@ function bp_activities_no_activity() {
|
|
966 |
/**
|
967 |
* {@internal Missing Description}
|
968 |
*
|
969 |
-
* @since BuddyPress (1.0
|
970 |
*
|
971 |
* @global string $bp_activity_no_activity
|
972 |
* @uses apply_filters() To call the 'bp_get_activities_no_activity' hook
|
@@ -977,20 +939,13 @@ function bp_activities_no_activity() {
|
|
977 |
function bp_get_activities_no_activity() {
|
978 |
global $bp_activity_no_activity;
|
979 |
|
980 |
-
/**
|
981 |
-
* Filters the text used when there is no activity to display.
|
982 |
-
*
|
983 |
-
* @since BuddyPress (1.0.0)
|
984 |
-
*
|
985 |
-
* @param string $bp_activity_no_activity Text to display for no activity.
|
986 |
-
*/
|
987 |
return apply_filters( 'bp_get_activities_no_activity', $bp_activity_no_activity );
|
988 |
}
|
989 |
|
990 |
/**
|
991 |
* Output the activity ID.
|
992 |
*
|
993 |
-
* @since BuddyPress (1.2
|
994 |
*
|
995 |
* @uses bp_get_activity_id()
|
996 |
*/
|
@@ -1001,7 +956,7 @@ function bp_activity_id() {
|
|
1001 |
/**
|
1002 |
* Return the activity ID.
|
1003 |
*
|
1004 |
-
* @since BuddyPress (1.2
|
1005 |
*
|
1006 |
* @global object $activities_template {@link BP_Activity_Template}
|
1007 |
* @uses apply_filters() To call the 'bp_get_activity_id' hook.
|
@@ -1010,21 +965,13 @@ function bp_activity_id() {
|
|
1010 |
*/
|
1011 |
function bp_get_activity_id() {
|
1012 |
global $activities_template;
|
1013 |
-
|
1014 |
-
/**
|
1015 |
-
* Filters the activity ID being displayed.
|
1016 |
-
*
|
1017 |
-
* @since BuddyPress (1.2.0)
|
1018 |
-
*
|
1019 |
-
* @param int $id The activity ID.
|
1020 |
-
*/
|
1021 |
return apply_filters( 'bp_get_activity_id', $activities_template->activity->id );
|
1022 |
}
|
1023 |
|
1024 |
/**
|
1025 |
* Output the activity item ID.
|
1026 |
*
|
1027 |
-
* @since BuddyPress (1.2
|
1028 |
*
|
1029 |
* @uses bp_get_activity_item_id()
|
1030 |
*/
|
@@ -1035,7 +982,7 @@ function bp_activity_item_id() {
|
|
1035 |
/**
|
1036 |
* Return the activity item ID.
|
1037 |
*
|
1038 |
-
* @since BuddyPress (1.2
|
1039 |
*
|
1040 |
* @global object $activities_template {@link BP_Activity_Template}
|
1041 |
* @uses apply_filters() To call the 'bp_get_activity_item_id' hook.
|
@@ -1044,21 +991,13 @@ function bp_activity_item_id() {
|
|
1044 |
*/
|
1045 |
function bp_get_activity_item_id() {
|
1046 |
global $activities_template;
|
1047 |
-
|
1048 |
-
/**
|
1049 |
-
* Filters the activity item ID being displayed.
|
1050 |
-
*
|
1051 |
-
* @since BuddyPress (1.2.0)
|
1052 |
-
*
|
1053 |
-
* @param int $item_id The activity item ID.
|
1054 |
-
*/
|
1055 |
return apply_filters( 'bp_get_activity_item_id', $activities_template->activity->item_id );
|
1056 |
}
|
1057 |
|
1058 |
/**
|
1059 |
* Output the activity secondary item ID.
|
1060 |
*
|
1061 |
-
* @since BuddyPress (1.2
|
1062 |
*
|
1063 |
* @uses bp_get_activity_secondary_item_id()
|
1064 |
*/
|
@@ -1069,7 +1008,7 @@ function bp_activity_secondary_item_id() {
|
|
1069 |
/**
|
1070 |
* Return the activity secondary item ID.
|
1071 |
*
|
1072 |
-
* @since BuddyPress (1.2
|
1073 |
*
|
1074 |
* @global object $activities_template {@link BP_Activity_Template}
|
1075 |
* @uses apply_filters() To call the 'bp_get_activity_secondary_item_id' hook.
|
@@ -1078,21 +1017,13 @@ function bp_activity_secondary_item_id() {
|
|
1078 |
*/
|
1079 |
function bp_get_activity_secondary_item_id() {
|
1080 |
global $activities_template;
|
1081 |
-
|
1082 |
-
/**
|
1083 |
-
* Filters the activity secondary item ID being displayed.
|
1084 |
-
*
|
1085 |
-
* @since BuddyPress (1.2.0)
|
1086 |
-
*
|
1087 |
-
* @param int $secondary_item_id The activity secondary item ID.
|
1088 |
-
*/
|
1089 |
return apply_filters( 'bp_get_activity_secondary_item_id', $activities_template->activity->secondary_item_id );
|
1090 |
}
|
1091 |
|
1092 |
/**
|
1093 |
* Output the date the activity was recorded.
|
1094 |
*
|
1095 |
-
* @since BuddyPress (1.2
|
1096 |
*
|
1097 |
* @uses bp_get_activity_date_recorded()
|
1098 |
*/
|
@@ -1103,7 +1034,7 @@ function bp_activity_date_recorded() {
|
|
1103 |
/**
|
1104 |
* Return the date the activity was recorded.
|
1105 |
*
|
1106 |
-
* @since BuddyPress (1.2
|
1107 |
*
|
1108 |
* @global object $activities_template {@link BP_Activity_Template}
|
1109 |
* @uses apply_filters() To call the 'bp_get_activity_date_recorded' hook.
|
@@ -1112,14 +1043,6 @@ function bp_activity_date_recorded() {
|
|
1112 |
*/
|
1113 |
function bp_get_activity_date_recorded() {
|
1114 |
global $activities_template;
|
1115 |
-
|
1116 |
-
/**
|
1117 |
-
* Filters the date the activity was recorded.
|
1118 |
-
*
|
1119 |
-
* @since BuddyPress (1.2.0)
|
1120 |
-
*
|
1121 |
-
* @param int $date_recorded The activity's date.
|
1122 |
-
*/
|
1123 |
return apply_filters( 'bp_get_activity_date_recorded', $activities_template->activity->date_recorded );
|
1124 |
}
|
1125 |
|
@@ -1151,20 +1074,13 @@ function bp_activity_member_display_name() {
|
|
1151 |
? $activities_template->activity->display_name
|
1152 |
: '';
|
1153 |
|
1154 |
-
/**
|
1155 |
-
* Filters the display name of the member who posted the activity.
|
1156 |
-
*
|
1157 |
-
* @since BuddyPress (2.1.0)
|
1158 |
-
*
|
1159 |
-
* @param int $retval Display name for the member who posted.
|
1160 |
-
*/
|
1161 |
return apply_filters( 'bp_get_activity_member_display_name', $retval );
|
1162 |
}
|
1163 |
|
1164 |
/**
|
1165 |
* Output the activity object name.
|
1166 |
*
|
1167 |
-
* @since BuddyPress (1.2
|
1168 |
*
|
1169 |
* @uses bp_get_activity_object_name()
|
1170 |
*/
|
@@ -1175,7 +1091,7 @@ function bp_activity_object_name() {
|
|
1175 |
/**
|
1176 |
* Return the activity object name.
|
1177 |
*
|
1178 |
-
* @since BuddyPress (1.2
|
1179 |
*
|
1180 |
* @global object $activities_template {@link BP_Activity_Template}
|
1181 |
* @uses apply_filters() To call the 'bp_get_activity_object_name' hook.
|
@@ -1184,21 +1100,13 @@ function bp_activity_object_name() {
|
|
1184 |
*/
|
1185 |
function bp_get_activity_object_name() {
|
1186 |
global $activities_template;
|
1187 |
-
|
1188 |
-
/**
|
1189 |
-
* Filters the activity object name.
|
1190 |
-
*
|
1191 |
-
* @since BuddyPress (1.2.0)
|
1192 |
-
*
|
1193 |
-
* @param string $activity_component The activity object name.
|
1194 |
-
*/
|
1195 |
return apply_filters( 'bp_get_activity_object_name', $activities_template->activity->component );
|
1196 |
}
|
1197 |
|
1198 |
/**
|
1199 |
* Output the activity type.
|
1200 |
*
|
1201 |
-
* @since BuddyPress (1.2
|
1202 |
*
|
1203 |
* @uses bp_get_activity_type()
|
1204 |
*/
|
@@ -1209,7 +1117,7 @@ function bp_activity_type() {
|
|
1209 |
/**
|
1210 |
* Return the activity type.
|
1211 |
*
|
1212 |
-
* @since BuddyPress (1.2
|
1213 |
*
|
1214 |
* @global object $activities_template {@link BP_Activity_Template}
|
1215 |
* @uses apply_filters() To call the 'bp_get_activity_type' hook.
|
@@ -1218,14 +1126,6 @@ function bp_activity_type() {
|
|
1218 |
*/
|
1219 |
function bp_get_activity_type() {
|
1220 |
global $activities_template;
|
1221 |
-
|
1222 |
-
/**
|
1223 |
-
* Filters the activity type.
|
1224 |
-
*
|
1225 |
-
* @since BuddyPress (1.2.0)
|
1226 |
-
*
|
1227 |
-
* @param string $activity_type The activity type.
|
1228 |
-
*/
|
1229 |
return apply_filters( 'bp_get_activity_type', $activities_template->activity->type );
|
1230 |
}
|
1231 |
|
@@ -1234,8 +1134,8 @@ function bp_activity_type() {
|
|
1234 |
*
|
1235 |
* Just a wrapper for bp_activity_type().
|
1236 |
*
|
1237 |
-
* @since BuddyPress (1.2
|
1238 |
-
* @deprecated BuddyPress (1.5
|
1239 |
*
|
1240 |
* @todo Properly deprecate in favor of bp_activity_type() and
|
1241 |
* remove redundant echo
|
@@ -1249,8 +1149,8 @@ function bp_activity_type() {
|
|
1249 |
*
|
1250 |
* Just a wrapper for bp_get_activity_type().
|
1251 |
*
|
1252 |
-
* @since BuddyPress (1.2
|
1253 |
-
* @deprecated BuddyPress (1.5
|
1254 |
*
|
1255 |
* @todo Properly deprecate in favor of bp_get_activity_type().
|
1256 |
*
|
@@ -1263,7 +1163,7 @@ function bp_activity_type() {
|
|
1263 |
/**
|
1264 |
* Output the activity user ID.
|
1265 |
*
|
1266 |
-
* @since BuddyPress (1.1
|
1267 |
*
|
1268 |
* @uses bp_get_activity_user_id()
|
1269 |
*/
|
@@ -1274,7 +1174,7 @@ function bp_activity_user_id() {
|
|
1274 |
/**
|
1275 |
* Return the activity user ID.
|
1276 |
*
|
1277 |
-
* @since BuddyPress (1.1
|
1278 |
*
|
1279 |
* @global object $activities_template {@link BP_Activity_Template}
|
1280 |
* @uses apply_filters() To call the 'bp_get_activity_user_id' hook.
|
@@ -1283,21 +1183,13 @@ function bp_activity_user_id() {
|
|
1283 |
*/
|
1284 |
function bp_get_activity_user_id() {
|
1285 |
global $activities_template;
|
1286 |
-
|
1287 |
-
/**
|
1288 |
-
* Filters the activity user ID.
|
1289 |
-
*
|
1290 |
-
* @since BuddyPress (1.1.0)
|
1291 |
-
*
|
1292 |
-
* @param int $user_id The activity user ID.
|
1293 |
-
*/
|
1294 |
return apply_filters( 'bp_get_activity_user_id', $activities_template->activity->user_id );
|
1295 |
}
|
1296 |
|
1297 |
/**
|
1298 |
* Output the activity user link.
|
1299 |
*
|
1300 |
-
* @since BuddyPress (1.2
|
1301 |
*
|
1302 |
* @uses bp_get_activity_user_link()
|
1303 |
*/
|
@@ -1308,7 +1200,7 @@ function bp_activity_user_link() {
|
|
1308 |
/**
|
1309 |
* Return the activity user link.
|
1310 |
*
|
1311 |
-
* @since BuddyPress (1.2
|
1312 |
*
|
1313 |
* @global object $activities_template {@link BP_Activity_Template}
|
1314 |
* @uses bp_core_get_user_domain()
|
@@ -1325,20 +1217,13 @@ function bp_activity_user_link() {
|
|
1325 |
$link = bp_core_get_user_domain( $activities_template->activity->user_id, $activities_template->activity->user_nicename, $activities_template->activity->user_login );
|
1326 |
}
|
1327 |
|
1328 |
-
/**
|
1329 |
-
* Filters the activity user link.
|
1330 |
-
*
|
1331 |
-
* @since BuddyPress (1.2.0)
|
1332 |
-
*
|
1333 |
-
* @param string $link The activity user link.
|
1334 |
-
*/
|
1335 |
return apply_filters( 'bp_get_activity_user_link', $link );
|
1336 |
}
|
1337 |
|
1338 |
/**
|
1339 |
* Output the avatar of the user that performed the action.
|
1340 |
*
|
1341 |
-
* @since BuddyPress (1.1
|
1342 |
*
|
1343 |
* @see bp_get_activity_avatar() for description of arguments.
|
1344 |
* @uses bp_get_activity_avatar()
|
@@ -1351,7 +1236,7 @@ function bp_activity_avatar( $args = '' ) {
|
|
1351 |
/**
|
1352 |
* Return the avatar of the user that performed the action.
|
1353 |
*
|
1354 |
-
* @since BuddyPress (1.1
|
1355 |
*
|
1356 |
* @see bp_core_fetch_avatar() For a description of the arguments.
|
1357 |
* @global object $activities_template {@link BP_Activity_Template}
|
@@ -1424,40 +1309,15 @@ function bp_activity_avatar( $args = '' ) {
|
|
1424 |
}
|
1425 |
}
|
1426 |
|
1427 |
-
|
1428 |
-
* Filters the activity avatar object based on current activity item component.
|
1429 |
-
*
|
1430 |
-
* This is a variable filter dependent on the component used.
|
1431 |
-
* Possible hooks are bp_get_activity_avatar_object_blog,
|
1432 |
-
* bp_get_activity_avatar_object_group, and bp_get_activity_avatar_object_user.
|
1433 |
-
*
|
1434 |
-
* @since BuddyPress (1.1.0)
|
1435 |
-
*
|
1436 |
-
* @param string $component Component being displayed.
|
1437 |
-
*/
|
1438 |
$object = apply_filters( 'bp_get_activity_avatar_object_' . $current_activity_item->component, 'user' );
|
1439 |
$item_id = !empty( $user_id ) ? $user_id : $current_activity_item->user_id;
|
1440 |
-
|
1441 |
-
/**
|
1442 |
-
* Filters the activity avatar item ID.
|
1443 |
-
*
|
1444 |
-
* @since BuddyPress (1.2.10)
|
1445 |
-
*
|
1446 |
-
* @param int $item_id Item ID for the activity avatar.
|
1447 |
-
*/
|
1448 |
$item_id = apply_filters( 'bp_get_activity_avatar_item_id', $item_id );
|
1449 |
|
1450 |
-
// If this is a user object pass the users' email address for Gravatar so we don't have to
|
1451 |
if ( 'user' == $object && empty( $user_id ) && empty( $email ) && isset( $current_activity_item->user_email ) )
|
1452 |
$email = $current_activity_item->user_email;
|
1453 |
|
1454 |
-
/**
|
1455 |
-
* Filters the value returned by bp_core_fetch_avatar.
|
1456 |
-
*
|
1457 |
-
* @since BuddyPress (1.1.3)
|
1458 |
-
*
|
1459 |
-
* @param array $value Array of arguments calculated for use with bp_core_fetch_avatar.
|
1460 |
-
*/
|
1461 |
return apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array(
|
1462 |
'item_id' => $item_id,
|
1463 |
'object' => $object,
|
@@ -1473,7 +1333,7 @@ function bp_activity_avatar( $args = '' ) {
|
|
1473 |
/**
|
1474 |
* Output the avatar of the object that action was performed on.
|
1475 |
*
|
1476 |
-
* @since BuddyPress (1.2
|
1477 |
*
|
1478 |
* @see bp_get_activity_secondary_avatar() for description of arguments.
|
1479 |
* @uses bp_get_activity_secondary_avatar()
|
@@ -1487,7 +1347,7 @@ function bp_activity_secondary_avatar( $args = '' ) {
|
|
1487 |
/**
|
1488 |
* Return the avatar of the object that action was performed on
|
1489 |
*
|
1490 |
-
* @since BuddyPress (1.2
|
1491 |
*
|
1492 |
* @see bp_core_fetch_avatar() for description of arguments.
|
1493 |
* @global object $activities_template {@link BP_Activity_Template}
|
@@ -1586,26 +1446,8 @@ function bp_activity_secondary_avatar( $args = '' ) {
|
|
1586 |
break;
|
1587 |
}
|
1588 |
|
1589 |
-
|
1590 |
-
* Filters the activity secondary avatar object based on current activity item component.
|
1591 |
-
*
|
1592 |
-
* This is a variable filter dependent on the component used. Possible hooks are
|
1593 |
-
* bp_get_activity_secondary_avatar_object_blog, bp_get_activity_secondary_avatar_object_group,
|
1594 |
-
* and bp_get_activity_secondary_avatar_object_user.
|
1595 |
-
*
|
1596 |
-
* @since BuddyPress (1.2.10)
|
1597 |
-
*
|
1598 |
-
* @param string $object Component being displayed.
|
1599 |
-
*/
|
1600 |
$object = apply_filters( 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component, $object );
|
1601 |
-
|
1602 |
-
/**
|
1603 |
-
* Filters the activity secondary avatar item ID.
|
1604 |
-
*
|
1605 |
-
* @since BuddyPress (1.2.10)
|
1606 |
-
*
|
1607 |
-
* @param int $item_id ID for the secondary avatar item.
|
1608 |
-
*/
|
1609 |
$item_id = apply_filters( 'bp_get_activity_secondary_avatar_item_id', $item_id );
|
1610 |
|
1611 |
// If we have no item_id or object, there is no avatar to display
|
@@ -1626,41 +1468,23 @@ function bp_activity_secondary_avatar( $args = '' ) {
|
|
1626 |
) );
|
1627 |
|
1628 |
if ( !empty( $linked ) ) {
|
1629 |
-
|
1630 |
-
/**
|
1631 |
-
* Filters the secondary avatar link for current activity.
|
1632 |
-
*
|
1633 |
-
* @since BuddyPress (1.7.0)
|
1634 |
-
*
|
1635 |
-
* @param string $link Link to wrap the avatar image in.
|
1636 |
-
* @param string $component Activity component being acted on.
|
1637 |
-
*/
|
1638 |
$link = apply_filters( 'bp_get_activity_secondary_avatar_link', $link, $activities_template->activity->component );
|
1639 |
|
1640 |
-
/**
|
1641 |
-
* Filters the determined avatar for the secondary activity item.
|
1642 |
-
*
|
1643 |
-
* @since BuddyPress (1.2.10)
|
1644 |
-
*
|
1645 |
-
* @param string Formatted HTML <img> element, or raw avatar URL.
|
1646 |
-
*/
|
1647 |
-
$avatar = apply_filters( 'bp_get_activity_secondary_avatar', $avatar );
|
1648 |
-
|
1649 |
return sprintf( '<a href="%s" class="%s">%s</a>',
|
1650 |
$link,
|
1651 |
$link_class,
|
1652 |
-
$avatar
|
1653 |
);
|
1654 |
}
|
1655 |
|
1656 |
-
|
1657 |
return apply_filters( 'bp_get_activity_secondary_avatar', $avatar );
|
1658 |
}
|
1659 |
|
1660 |
/**
|
1661 |
* Output the activity action
|
1662 |
*
|
1663 |
-
* @since BuddyPress (1.2
|
1664 |
*
|
1665 |
* @param array $args See bp_get_activity_action()
|
1666 |
* @uses bp_get_activity_action()
|
@@ -1672,7 +1496,7 @@ function bp_activity_action( $args = array() ) {
|
|
1672 |
/**
|
1673 |
* Return the activity action
|
1674 |
*
|
1675 |
-
* @since BuddyPress (1.2
|
1676 |
*
|
1677 |
* @global object $activities_template {@link BP_Activity_Template}
|
1678 |
* @param array $args Only parameter is "no_timestamp". If true, timestamp is shown in output.
|
@@ -1696,33 +1520,18 @@ function bp_activity_action( $args = array() ) {
|
|
1696 |
extract( $args, EXTR_SKIP );
|
1697 |
|
1698 |
$action = $activities_template->activity->action;
|
1699 |
-
|
1700 |
-
/**
|
1701 |
-
* Filters the activity action before the action is inserted as meta.
|
1702 |
-
*
|
1703 |
-
* @since BuddyPress (1.2.10)
|
1704 |
-
*
|
1705 |
-
* @param array $value Array containing the current action, the current activity, and the $args array passed into the function.
|
1706 |
-
*/
|
1707 |
$action = apply_filters_ref_array( 'bp_get_activity_action_pre_meta', array( $action, &$activities_template->activity, $args ) );
|
1708 |
|
1709 |
if ( ! empty( $action ) && ! $no_timestamp )
|
1710 |
$action = bp_insert_activity_meta( $action );
|
1711 |
|
1712 |
-
/**
|
1713 |
-
* Filters the activity action after the action has been inserted as meta.
|
1714 |
-
*
|
1715 |
-
* @since BuddyPress (1.2.0)
|
1716 |
-
*
|
1717 |
-
* @param array $value Array containing the current action, the current activity, and the $args array passed into the function.
|
1718 |
-
*/
|
1719 |
return apply_filters_ref_array( 'bp_get_activity_action', array( $action, &$activities_template->activity, $args ) );
|
1720 |
}
|
1721 |
|
1722 |
/**
|
1723 |
* Output the activity content body
|
1724 |
*
|
1725 |
-
* @since BuddyPress (1.2
|
1726 |
*
|
1727 |
* @uses bp_get_activity_content_body()
|
1728 |
*/
|
@@ -1733,7 +1542,7 @@ function bp_activity_content_body() {
|
|
1733 |
/**
|
1734 |
* Return the activity content body
|
1735 |
*
|
1736 |
-
* @since BuddyPress (1.2
|
1737 |
*
|
1738 |
* @global object $activities_template {@link BP_Activity_Template}
|
1739 |
* @uses bp_insert_activity_meta()
|
@@ -1748,20 +1557,13 @@ function bp_activity_content_body() {
|
|
1748 |
if ( empty( $activities_template->activity->action ) && !empty( $activities_template->activity->content ) )
|
1749 |
$activities_template->activity->content = bp_insert_activity_meta( $activities_template->activity->content );
|
1750 |
|
1751 |
-
/**
|
1752 |
-
* Filters the activity content body.
|
1753 |
-
*
|
1754 |
-
* @since BuddyPress (1.2.0)
|
1755 |
-
*
|
1756 |
-
* @param array $value Array containing the current activity content body and the current activity.
|
1757 |
-
*/
|
1758 |
return apply_filters_ref_array( 'bp_get_activity_content_body', array( $activities_template->activity->content, &$activities_template->activity ) );
|
1759 |
}
|
1760 |
|
1761 |
/**
|
1762 |
* Does the activity have content?
|
1763 |
*
|
1764 |
-
* @since BuddyPress (1.2
|
1765 |
*
|
1766 |
* @global object $activities_template {@link BP_Activity_Template}
|
1767 |
*
|
@@ -1779,8 +1581,8 @@ function bp_activity_has_content() {
|
|
1779 |
/**
|
1780 |
* Output the activity content.
|
1781 |
*
|
1782 |
-
* @since BuddyPress (1.0
|
1783 |
-
* @deprecated BuddyPress (1.5
|
1784 |
*
|
1785 |
* @todo properly deprecate this function.
|
1786 |
*
|
@@ -1793,8 +1595,8 @@ function bp_activity_content() {
|
|
1793 |
/**
|
1794 |
* Return the activity content.
|
1795 |
*
|
1796 |
-
* @since BuddyPress (1.0
|
1797 |
-
* @deprecated BuddyPress (1.5
|
1798 |
*
|
1799 |
* @todo properly deprecate this function.
|
1800 |
*
|
@@ -1805,13 +1607,13 @@ function bp_activity_content() {
|
|
1805 |
* @return string The activity content.
|
1806 |
*/
|
1807 |
function bp_get_activity_content() {
|
1808 |
-
|
1809 |
/**
|
1810 |
* If you want to filter activity update content, please use
|
1811 |
* the filter 'bp_get_activity_content_body'
|
1812 |
*
|
1813 |
-
* This function is mainly for backwards
|
1814 |
*/
|
|
|
1815 |
$content = bp_get_activity_action() . ' ' . bp_get_activity_content_body();
|
1816 |
return apply_filters( 'bp_get_activity_content', $content );
|
1817 |
}
|
@@ -1822,7 +1624,7 @@ function bp_activity_content() {
|
|
1822 |
* This metadata includes the time since the item was posted (which will appear
|
1823 |
* as a link to the item's permalink).
|
1824 |
*
|
1825 |
-
* @since BuddyPress (1.2
|
1826 |
*
|
1827 |
* @global object $activities_template {@link BP_Activity_Template}
|
1828 |
* @uses bp_core_time_since()
|
@@ -1842,44 +1644,22 @@ function bp_insert_activity_meta( $content ) {
|
|
1842 |
// Strip any legacy time since placeholders from BP 1.0-1.1
|
1843 |
$content = str_replace( '<span class="time-since">%s</span>', '', $content );
|
1844 |
|
1845 |
-
|
1846 |
-
* Filters the activity item time since markup.
|
1847 |
-
*
|
1848 |
-
* @since BuddyPress (1.2.0)
|
1849 |
-
*
|
1850 |
-
* @param array $value Array containing the time since markup and the current activity component.
|
1851 |
-
*/
|
1852 |
$time_since = apply_filters_ref_array( 'bp_activity_time_since', array( '<span class="time-since">' . bp_core_time_since( $activities_template->activity->date_recorded ) . '</span>', &$activities_template->activity ) );
|
1853 |
|
1854 |
// Insert the permalink
|
1855 |
-
if ( !bp_is_single_activity() )
|
1856 |
-
|
1857 |
-
/**
|
1858 |
-
* Filters the activity permalink to be added to the activity content.
|
1859 |
-
*
|
1860 |
-
* @since BuddyPress (1.2.0)
|
1861 |
-
*
|
1862 |
-
* @param array $value Array containing the html markup for the activity permalink, after being parsed by sprintf and current activity component.
|
1863 |
-
*/
|
1864 |
$content = apply_filters_ref_array( 'bp_activity_permalink', array( sprintf( '%1$s <a href="%2$s" class="view activity-time-since" title="%3$s">%4$s</a>', $content, bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ), esc_attr__( 'View Discussion', 'buddypress' ), $time_since ), &$activities_template->activity ) );
|
1865 |
-
|
1866 |
$content .= str_pad( $time_since, strlen( $time_since ) + 2, ' ', STR_PAD_BOTH );
|
1867 |
-
}
|
1868 |
|
1869 |
-
/**
|
1870 |
-
* Filters the activity content after activity metadata has been attached.
|
1871 |
-
*
|
1872 |
-
* @since BuddyPress (1.2.0)
|
1873 |
-
*
|
1874 |
-
* @param string $content Activity content with the activity metadata added.
|
1875 |
-
*/
|
1876 |
return apply_filters( 'bp_insert_activity_meta', $content );
|
1877 |
}
|
1878 |
|
1879 |
/**
|
1880 |
* Determine if the current user can delete an activity item.
|
1881 |
*
|
1882 |
-
* @since BuddyPress (1.2
|
1883 |
*
|
1884 |
* @global object $activities_template {@link BP_Activity_Template}
|
1885 |
* @uses apply_filters() To call the 'bp_activity_user_can_delete' hook
|
@@ -1924,21 +1704,13 @@ function bp_activity_user_can_delete( $activity = false ) {
|
|
1924 |
}
|
1925 |
}
|
1926 |
|
1927 |
-
/**
|
1928 |
-
* Filters whether the current user can delete an activity item.
|
1929 |
-
*
|
1930 |
-
* @since BuddyPress (1.5.0)
|
1931 |
-
*
|
1932 |
-
* @param bool $can_delete Whether the user can delete the item.
|
1933 |
-
* @param object $activity Current activity item object.
|
1934 |
-
*/
|
1935 |
return (bool) apply_filters( 'bp_activity_user_can_delete', $can_delete, $activity );
|
1936 |
}
|
1937 |
|
1938 |
/**
|
1939 |
* Output the activity parent content.
|
1940 |
*
|
1941 |
-
* @since BuddyPress (1.2
|
1942 |
*
|
1943 |
* @see bp_get_activity_parent_content() for a description of arguments.
|
1944 |
* @uses bp_get_activity_parent_content()
|
@@ -1952,7 +1724,7 @@ function bp_activity_parent_content( $args = '' ) {
|
|
1952 |
/**
|
1953 |
* Return the activity content.
|
1954 |
*
|
1955 |
-
* @since BuddyPress (1.2
|
1956 |
*
|
1957 |
* @global object $activities_template {@link BP_Activity_Template}
|
1958 |
* @uses wp_parse_args()
|
@@ -1999,20 +1771,13 @@ function bp_activity_parent_content( $args = '' ) {
|
|
1999 |
// Remove images
|
2000 |
$content = preg_replace( '/<img[^>]*>/Ui', '', $content );
|
2001 |
|
2002 |
-
/**
|
2003 |
-
* Filters the activity parent content.
|
2004 |
-
*
|
2005 |
-
* @since BuddyPress (1.2.0)
|
2006 |
-
*
|
2007 |
-
* @param string $content Content set to be displayed as parent content.
|
2008 |
-
*/
|
2009 |
return apply_filters( 'bp_get_activity_parent_content', $content );
|
2010 |
}
|
2011 |
|
2012 |
/**
|
2013 |
* Output the parent activity's user ID.
|
2014 |
*
|
2015 |
-
* @since BuddyPress (1.7
|
2016 |
*/
|
2017 |
function bp_activity_parent_user_id() {
|
2018 |
echo bp_get_activity_parent_user_id();
|
@@ -2021,7 +1786,7 @@ function bp_activity_parent_user_id() {
|
|
2021 |
/**
|
2022 |
* Return the parent activity's user ID.
|
2023 |
*
|
2024 |
-
* @since BuddyPress (1.7
|
2025 |
*
|
2026 |
* @global BP_Activity_Template $activities_template
|
2027 |
*
|
@@ -2049,20 +1814,13 @@ function bp_activity_parent_user_id() {
|
|
2049 |
|
2050 |
$retval = $activities_template->activity_parents[$parent_id]->user_id;
|
2051 |
|
2052 |
-
/**
|
2053 |
-
* Filters the activity parent item's user ID.
|
2054 |
-
*
|
2055 |
-
* @since BuddyPress (1.7.0)
|
2056 |
-
*
|
2057 |
-
* @param int $retval ID for the activity parent's user.
|
2058 |
-
*/
|
2059 |
return (int) apply_filters( 'bp_get_activity_parent_user_id', $retval );
|
2060 |
}
|
2061 |
|
2062 |
/**
|
2063 |
* Output whether or not the current activity is in a current user's favorites.
|
2064 |
*
|
2065 |
-
* @since BuddyPress (1.2
|
2066 |
*
|
2067 |
* @uses bp_get_activity_is_favorite()
|
2068 |
*/
|
@@ -2073,7 +1831,7 @@ function bp_activity_is_favorite() {
|
|
2073 |
/**
|
2074 |
* Return whether the current activity is in a current user's favorites.
|
2075 |
*
|
2076 |
-
* @since BuddyPress (1.2
|
2077 |
*
|
2078 |
* @global object $activities_template {@link BP_Activity_Template}
|
2079 |
* @uses apply_filters() To call the 'bp_get_activity_is_favorite' hook.
|
@@ -2083,20 +1841,13 @@ function bp_activity_is_favorite() {
|
|
2083 |
function bp_get_activity_is_favorite() {
|
2084 |
global $activities_template;
|
2085 |
|
2086 |
-
/**
|
2087 |
-
* Filters whether the current activity item is in the current user's favorites.
|
2088 |
-
*
|
2089 |
-
* @since BuddyPress (1.2.0)
|
2090 |
-
*
|
2091 |
-
* @param bool $value Whether or not the current activity item is in the current user's favorites.
|
2092 |
-
*/
|
2093 |
return (bool) apply_filters( 'bp_get_activity_is_favorite', in_array( $activities_template->activity->id, (array) $activities_template->my_favs ) );
|
2094 |
}
|
2095 |
|
2096 |
/**
|
2097 |
* Output the comment markup for an activity item.
|
2098 |
*
|
2099 |
-
* @since BuddyPress (1.2
|
2100 |
*
|
2101 |
* @todo deprecate $args param
|
2102 |
*
|
@@ -2109,7 +1860,7 @@ function bp_activity_comments( $args = '' ) {
|
|
2109 |
/**
|
2110 |
* Get the comment markup for an activity item.
|
2111 |
*
|
2112 |
-
* @since BuddyPress (1.2
|
2113 |
*
|
2114 |
* @todo deprecate $args param
|
2115 |
*
|
@@ -2136,7 +1887,7 @@ function bp_activity_comments( $args = '' ) {
|
|
2136 |
* Note: The recursion itself used to happen entirely in this function. Now it is
|
2137 |
* split between here and the comment.php template.
|
2138 |
*
|
2139 |
-
* @since BuddyPress (1.2
|
2140 |
*
|
2141 |
* @param object $comment The activity object currently being recursed
|
2142 |
*
|
@@ -2152,13 +1903,6 @@ function bp_activity_comments( $args = '' ) {
|
|
2152 |
if ( empty( $comment->children ) )
|
2153 |
return false;
|
2154 |
|
2155 |
-
/**
|
2156 |
-
* Filters the opening tag for the template that lists activity comments.
|
2157 |
-
*
|
2158 |
-
* @since BuddyPress (1.6.0)
|
2159 |
-
*
|
2160 |
-
* @param string $value Opening tag for the HTML markup to use.
|
2161 |
-
*/
|
2162 |
echo apply_filters( 'bp_activity_recurse_comments_start_ul', '<ul>');
|
2163 |
foreach ( (array) $comment->children as $comment_child ) {
|
2164 |
// Put the comment into the global so it's available to filters
|
@@ -2178,21 +1922,13 @@ function bp_activity_comments( $args = '' ) {
|
|
2178 |
|
2179 |
unset( $activities_template->activity->current_comment );
|
2180 |
}
|
2181 |
-
|
2182 |
-
/**
|
2183 |
-
* Filters the closing tag for the template that list activity comments.
|
2184 |
-
*
|
2185 |
-
* @since BuddyPress (1.6.0)
|
2186 |
-
*
|
2187 |
-
* @param string $value Closing tag for the HTML markup to use.
|
2188 |
-
*/
|
2189 |
echo apply_filters( 'bp_activity_recurse_comments_end_ul', '</ul>');
|
2190 |
}
|
2191 |
|
2192 |
/**
|
2193 |
* Utility function that returns the comment currently being recursed.
|
2194 |
*
|
2195 |
-
* @since BuddyPress (1.5
|
2196 |
*
|
2197 |
* @global object $activities_template {@link BP_Activity_Template}
|
2198 |
* @uses apply_filters() To call the 'bp_activity_current_comment' hook.
|
@@ -2205,13 +1941,6 @@ function bp_activity_current_comment() {
|
|
2205 |
|
2206 |
$current_comment = !empty( $activities_template->activity->current_comment ) ? $activities_template->activity->current_comment : false;
|
2207 |
|
2208 |
-
/**
|
2209 |
-
* Filters the current comment being recursed.
|
2210 |
-
*
|
2211 |
-
* @since BuddyPress (1.5.0)
|
2212 |
-
*
|
2213 |
-
* @param object|bool $current_comment The activity comment currently being displayed. False on failure.
|
2214 |
-
*/
|
2215 |
return apply_filters( 'bp_activity_current_comment', $current_comment );
|
2216 |
}
|
2217 |
|
@@ -2219,7 +1948,7 @@ function bp_activity_current_comment() {
|
|
2219 |
/**
|
2220 |
* Output the ID of the activity comment currently being displayed.
|
2221 |
*
|
2222 |
-
* @since BuddyPress (1.5
|
2223 |
*
|
2224 |
* @uses bp_get_activity_comment_id()
|
2225 |
*/
|
@@ -2230,7 +1959,7 @@ function bp_activity_comment_id() {
|
|
2230 |
/**
|
2231 |
* Return the ID of the activity comment currently being displayed.
|
2232 |
*
|
2233 |
-
* @since BuddyPress (1.5
|
2234 |
*
|
2235 |
* @global object $activities_template {@link BP_Activity_Template}
|
2236 |
* @uses apply_filters() To call the 'bp_activity_comment_id' hook.
|
@@ -2243,20 +1972,13 @@ function bp_activity_comment_id() {
|
|
2243 |
|
2244 |
$comment_id = isset( $activities_template->activity->current_comment->id ) ? $activities_template->activity->current_comment->id : false;
|
2245 |
|
2246 |
-
/**
|
2247 |
-
* Filters the ID of the activity comment currently being displayed.
|
2248 |
-
*
|
2249 |
-
* @since BuddyPress (1.5.0)
|
2250 |
-
*
|
2251 |
-
* @param int|bool $comment_id ID for the comment currently being displayed.
|
2252 |
-
*/
|
2253 |
return apply_filters( 'bp_activity_comment_id', $comment_id );
|
2254 |
}
|
2255 |
|
2256 |
/**
|
2257 |
* Output the ID of the author of the activity comment currently being displayed.
|
2258 |
*
|
2259 |
-
* @since BuddyPress (1.5
|
2260 |
*
|
2261 |
* @uses bp_get_activity_comment_user_id()
|
2262 |
*/
|
@@ -2267,7 +1989,7 @@ function bp_activity_comment_user_id() {
|
|
2267 |
/**
|
2268 |
* Return the ID of the author of the activity comment currently being displayed.
|
2269 |
*
|
2270 |
-
* @since BuddyPress (1.5
|
2271 |
*
|
2272 |
* @global object $activities_template {@link BP_Activity_Template}
|
2273 |
* @uses apply_filters() To call the 'bp_activity_comment_user_id' hook.
|
@@ -2280,20 +2002,13 @@ function bp_activity_comment_user_id() {
|
|
2280 |
|
2281 |
$user_id = isset( $activities_template->activity->current_comment->user_id ) ? $activities_template->activity->current_comment->user_id : false;
|
2282 |
|
2283 |
-
/**
|
2284 |
-
* Filters the ID of the author of the activity comment currently being displayed.
|
2285 |
-
*
|
2286 |
-
* @since BuddyPress (1.5.0)
|
2287 |
-
*
|
2288 |
-
* @param int|bool $user_id ID for the author of the comment currently being displayed.
|
2289 |
-
*/
|
2290 |
return apply_filters( 'bp_activity_comment_user_id', $user_id );
|
2291 |
}
|
2292 |
|
2293 |
/**
|
2294 |
* Output the author link for the activity comment currently being displayed.
|
2295 |
*
|
2296 |
-
* @since BuddyPress (1.5
|
2297 |
*
|
2298 |
* @uses bp_get_activity_comment_user_link()
|
2299 |
*/
|
@@ -2304,7 +2019,7 @@ function bp_activity_comment_user_link() {
|
|
2304 |
/**
|
2305 |
* Return the author link for the activity comment currently being displayed.
|
2306 |
*
|
2307 |
-
* @since BuddyPress (1.5
|
2308 |
*
|
2309 |
* @uses bp_core_get_user_domain()
|
2310 |
* @uses bp_get_activity_comment_user_id()
|
@@ -2315,20 +2030,13 @@ function bp_activity_comment_user_link() {
|
|
2315 |
function bp_get_activity_comment_user_link() {
|
2316 |
$user_link = bp_core_get_user_domain( bp_get_activity_comment_user_id() );
|
2317 |
|
2318 |
-
/**
|
2319 |
-
* Filters the author link for the activity comment currently being displayed.
|
2320 |
-
*
|
2321 |
-
* @since BuddyPress (1.5.0)
|
2322 |
-
*
|
2323 |
-
* @param string $user_link Link for the author of the activity comment currently being displayed.
|
2324 |
-
*/
|
2325 |
return apply_filters( 'bp_activity_comment_user_link', $user_link );
|
2326 |
}
|
2327 |
|
2328 |
/**
|
2329 |
* Output the author name for the activity comment currently being displayed.
|
2330 |
*
|
2331 |
-
* @since BuddyPress (1.5
|
2332 |
*
|
2333 |
* @uses bp_get_activity_comment_name()
|
2334 |
*/
|
@@ -2342,7 +2050,7 @@ function bp_activity_comment_name() {
|
|
2342 |
* The use of the 'bp_acomment_name' filter is deprecated. Please use
|
2343 |
* 'bp_activity_comment_name'.
|
2344 |
*
|
2345 |
-
* @since BuddyPress (1.5
|
2346 |
*
|
2347 |
* @global object $activities_template {@link BP_Activity_Template}
|
2348 |
* @uses apply_filters() To call the 'bp_acomment_name' hook.
|
@@ -2353,27 +2061,18 @@ function bp_activity_comment_name() {
|
|
2353 |
function bp_get_activity_comment_name() {
|
2354 |
global $activities_template;
|
2355 |
|
2356 |
-
if ( isset( $activities_template->activity->current_comment->user_fullname ) )
|
2357 |
-
|
2358 |
$name = apply_filters( 'bp_acomment_name', $activities_template->activity->current_comment->user_fullname, $activities_template->activity->current_comment ); // backward compatibility
|
2359 |
-
|
2360 |
$name = $activities_template->activity->current_comment->display_name;
|
2361 |
-
}
|
2362 |
|
2363 |
-
/**
|
2364 |
-
* Filters the name of the author for the activity comment.
|
2365 |
-
*
|
2366 |
-
* @since BuddyPress (1.5.0)
|
2367 |
-
*
|
2368 |
-
* @param string $name Name to be displayed with the activity comment.
|
2369 |
-
*/
|
2370 |
return apply_filters( 'bp_activity_comment_name', $name );
|
2371 |
}
|
2372 |
|
2373 |
/**
|
2374 |
* Output the date_recorded of the activity comment currently being displayed.
|
2375 |
*
|
2376 |
-
* @since BuddyPress (1.5
|
2377 |
*
|
2378 |
* @uses bp_get_activity_comment_date_recorded()
|
2379 |
*/
|
@@ -2384,7 +2083,7 @@ function bp_activity_comment_date_recorded() {
|
|
2384 |
/**
|
2385 |
* Return the date_recorded for the activity comment currently being displayed.
|
2386 |
*
|
2387 |
-
* @since BuddyPress (1.5
|
2388 |
*
|
2389 |
* @global object $activities_template {@link BP_Activity_Template}
|
2390 |
* @uses bp_core_time_since()
|
@@ -2401,20 +2100,13 @@ function bp_activity_comment_date_recorded() {
|
|
2401 |
|
2402 |
$date_recorded = bp_core_time_since( $activities_template->activity->current_comment->date_recorded );
|
2403 |
|
2404 |
-
/**
|
2405 |
-
* Filters the recorded date of the activity comment currently being displayed.
|
2406 |
-
*
|
2407 |
-
* @since BuddyPress (1.5.0)
|
2408 |
-
*
|
2409 |
-
* @param string|bool Date for the activity comment currently being displayed.
|
2410 |
-
*/
|
2411 |
return apply_filters( 'bp_activity_comment_date_recorded', $date_recorded );
|
2412 |
}
|
2413 |
|
2414 |
/**
|
2415 |
* Output the 'delete' URL for the activity comment currently being displayed.
|
2416 |
*
|
2417 |
-
* @since BuddyPress (1.5
|
2418 |
*
|
2419 |
* @uses bp_get_activity_comment_delete_link()
|
2420 |
*/
|
@@ -2425,7 +2117,7 @@ function bp_activity_comment_delete_link() {
|
|
2425 |
/**
|
2426 |
* Gets the 'delete' URL for the activity comment currently being displayed
|
2427 |
*
|
2428 |
-
* @since BuddyPress (1.5
|
2429 |
*
|
2430 |
* @uses wp_nonce_url()
|
2431 |
* @uses bp_get_root_domain()
|
@@ -2439,20 +2131,13 @@ function bp_activity_comment_delete_link() {
|
|
2439 |
function bp_get_activity_comment_delete_link() {
|
2440 |
$link = wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_slug() . '/delete/' . bp_get_activity_comment_id() . '?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link' );
|
2441 |
|
2442 |
-
/**
|
2443 |
-
* Filters the link used for deleting the activity comment currently being displayed.
|
2444 |
-
*
|
2445 |
-
* @since BuddyPress (1.5.0)
|
2446 |
-
*
|
2447 |
-
* @param string $link Link to use for deleting the currently displayed activity comment.
|
2448 |
-
*/
|
2449 |
return apply_filters( 'bp_activity_comment_delete_link', $link );
|
2450 |
}
|
2451 |
|
2452 |
/**
|
2453 |
* Output the content of the activity comment currently being displayed.
|
2454 |
*
|
2455 |
-
* @since BuddyPress (1.5
|
2456 |
*
|
2457 |
* @uses bp_get_activity_comment_content()
|
2458 |
*/
|
@@ -2468,7 +2153,7 @@ function bp_activity_comment_content() {
|
|
2468 |
* 'bp_activity_comment_content' to modify the content of activity
|
2469 |
* comments only.
|
2470 |
*
|
2471 |
-
* @since BuddyPress (1.5
|
2472 |
*
|
2473 |
* @global object $activities_template {@link BP_Activity_Template}
|
2474 |
* @uses apply_filters() To call the 'bp_get_activity_content' hook.
|
@@ -2479,23 +2164,15 @@ function bp_activity_comment_content() {
|
|
2479 |
function bp_get_activity_comment_content() {
|
2480 |
global $activities_template;
|
2481 |
|
2482 |
-
/** This filter is documented in bp-activity/bp-activity-template.php */
|
2483 |
$content = apply_filters( 'bp_get_activity_content', $activities_template->activity->current_comment->content );
|
2484 |
|
2485 |
-
/**
|
2486 |
-
* Filters the content of the current activity comment.
|
2487 |
-
*
|
2488 |
-
* @since BuddyPress (1.2.0)
|
2489 |
-
*
|
2490 |
-
* @param string $content The content of the current activity comment.
|
2491 |
-
*/
|
2492 |
return apply_filters( 'bp_activity_comment_content', $content );
|
2493 |
}
|
2494 |
|
2495 |
/**
|
2496 |
* Output the activity comment count.
|
2497 |
*
|
2498 |
-
* @since BuddyPress (1.2
|
2499 |
*
|
2500 |
* @uses bp_activity_get_comment_count()
|
2501 |
*/
|
@@ -2506,7 +2183,7 @@ function bp_activity_comment_count() {
|
|
2506 |
/**
|
2507 |
* Return the comment count of an activity item.
|
2508 |
*
|
2509 |
-
* @since BuddyPress (1.2
|
2510 |
*
|
2511 |
* @global object $activities_template {@link BP_Activity_Template}
|
2512 |
* @uses bp_activity_recurse_comment_count()
|
@@ -2529,13 +2206,6 @@ function bp_activity_comment_count() {
|
|
2529 |
? bp_activity_recurse_comment_count( $activities_template->activity )
|
2530 |
: 0;
|
2531 |
|
2532 |
-
/**
|
2533 |
-
* Filters the activity comment count.
|
2534 |
-
*
|
2535 |
-
* @since BuddyPress (1.2.0)
|
2536 |
-
*
|
2537 |
-
* @param int $count The activity comment count.
|
2538 |
-
*/
|
2539 |
return apply_filters( 'bp_activity_get_comment_count', (int) $count );
|
2540 |
}
|
2541 |
|
@@ -2545,7 +2215,7 @@ function bp_activity_comment_count() {
|
|
2545 |
* This function recursively adds the total number of comments each
|
2546 |
* activity child has, and returns them.
|
2547 |
*
|
2548 |
-
* @since BuddyPress (1.2
|
2549 |
*
|
2550 |
* @uses bp_activity_recurse_comment_count()
|
2551 |
* @uses apply_filters() To call the 'bp_activity_recurse_comment_count' hook
|
@@ -2568,15 +2238,7 @@ function bp_activity_comment_count() {
|
|
2568 |
}
|
2569 |
}
|
2570 |
|
2571 |
-
|
2572 |
-
* Filters the total number of comments for the current comment.
|
2573 |
-
*
|
2574 |
-
* @since BuddyPress (2.1.0)
|
2575 |
-
*
|
2576 |
-
* @param int $new_count New total count for the current comment.
|
2577 |
-
* @param object $comment Activity comment object.
|
2578 |
-
* @param int $count Current iteration count for the current comment.
|
2579 |
-
*/
|
2580 |
return apply_filters( 'bp_activity_recurse_comment_count', $new_count, $comment, $count );
|
2581 |
}
|
2582 |
|
@@ -2593,25 +2255,17 @@ function bp_activity_comment_depth() {
|
|
2593 |
*
|
2594 |
* @since BuddyPress (2.0.0)
|
2595 |
*
|
2596 |
-
* @return int
|
2597 |
*/
|
2598 |
function bp_activity_get_comment_depth() {
|
2599 |
global $activities_template;
|
2600 |
-
|
2601 |
-
/**
|
2602 |
-
* Filters the comment depth of the current activity comment.
|
2603 |
-
*
|
2604 |
-
* @since BuddyPress (2.0.0)
|
2605 |
-
*
|
2606 |
-
* @param int $depth Depth for the current activity comment.
|
2607 |
-
*/
|
2608 |
return apply_filters( 'bp_activity_get_comment_depth', $activities_template->activity->current_comment->depth );
|
2609 |
}
|
2610 |
|
2611 |
/**
|
2612 |
* Output the activity comment link.
|
2613 |
*
|
2614 |
-
* @since BuddyPress (1.2
|
2615 |
*
|
2616 |
* @uses bp_get_activity_comment_link()
|
2617 |
*/
|
@@ -2622,7 +2276,7 @@ function bp_activity_comment_link() {
|
|
2622 |
/**
|
2623 |
* Return the activity comment link.
|
2624 |
*
|
2625 |
-
* @since BuddyPress (1.2
|
2626 |
*
|
2627 |
* @global object $activities_template {@link BP_Activity_Template}
|
2628 |
* @uses apply_filters() To call the 'bp_get_activity_comment_link' hook.
|
@@ -2631,21 +2285,13 @@ function bp_activity_comment_link() {
|
|
2631 |
*/
|
2632 |
function bp_get_activity_comment_link() {
|
2633 |
global $activities_template;
|
2634 |
-
|
2635 |
-
/**
|
2636 |
-
* Filters the comment link for the current activity comment.
|
2637 |
-
*
|
2638 |
-
* @since BuddyPress (1.2.0)
|
2639 |
-
*
|
2640 |
-
* @param string $value Constructed URL parameters with activity IDs.
|
2641 |
-
*/
|
2642 |
return apply_filters( 'bp_get_activity_comment_link', '?ac=' . $activities_template->activity->id . '/#ac-form-' . $activities_template->activity->id );
|
2643 |
}
|
2644 |
|
2645 |
/**
|
2646 |
* Output the activity comment form no javascript display CSS.
|
2647 |
*
|
2648 |
-
* @since BuddyPress (1.2
|
2649 |
*
|
2650 |
* @uses bp_get_activity_comment_form_nojs_display()
|
2651 |
*/
|
@@ -2656,7 +2302,7 @@ function bp_activity_comment_form_nojs_display() {
|
|
2656 |
/**
|
2657 |
* Return the activity comment form no javascript display CSS.
|
2658 |
*
|
2659 |
-
* @since BuddyPress (1.2
|
2660 |
*
|
2661 |
* @global object $activities_template {@link BP_Activity_Template}
|
2662 |
*
|
@@ -2674,7 +2320,7 @@ function bp_activity_comment_form_nojs_display() {
|
|
2674 |
/**
|
2675 |
* Output the activity comment form action.
|
2676 |
*
|
2677 |
-
* @since BuddyPress (1.2
|
2678 |
*
|
2679 |
* @uses bp_get_activity_comment_form_action()
|
2680 |
*/
|
@@ -2685,7 +2331,7 @@ function bp_activity_comment_form_action() {
|
|
2685 |
/**
|
2686 |
* Return the activity comment form action.
|
2687 |
*
|
2688 |
-
* @since BuddyPress (1.2
|
2689 |
*
|
2690 |
* @uses home_url()
|
2691 |
* @uses bp_get_activity_root_slug()
|
@@ -2694,21 +2340,13 @@ function bp_activity_comment_form_action() {
|
|
2694 |
* @return string The activity comment form action.
|
2695 |
*/
|
2696 |
function bp_get_activity_comment_form_action() {
|
2697 |
-
|
2698 |
-
/**
|
2699 |
-
* Filters the activity comment form action URL.
|
2700 |
-
*
|
2701 |
-
* @since BuddyPress (1.2.0)
|
2702 |
-
*
|
2703 |
-
* @param string $value URL to use in the comment form's action attribute.
|
2704 |
-
*/
|
2705 |
return apply_filters( 'bp_get_activity_comment_form_action', home_url( bp_get_activity_root_slug() . '/reply/' ) );
|
2706 |
}
|
2707 |
|
2708 |
/**
|
2709 |
* Output the activity permalink ID.
|
2710 |
*
|
2711 |
-
* @since BuddyPress (1.2
|
2712 |
*
|
2713 |
* @uses bp_get_activity_permalink_id()
|
2714 |
*/
|
@@ -2719,28 +2357,20 @@ function bp_activity_permalink_id() {
|
|
2719 |
/**
|
2720 |
* Return the activity permalink ID.
|
2721 |
*
|
2722 |
-
* @since BuddyPress (1.2
|
2723 |
*
|
2724 |
* @uses apply_filters() To call the 'bp_get_activity_permalink_id' hook.
|
2725 |
*
|
2726 |
* @return string The activity permalink ID.
|
2727 |
*/
|
2728 |
function bp_get_activity_permalink_id() {
|
2729 |
-
|
2730 |
-
/**
|
2731 |
-
* Filters the activity action permalink ID.
|
2732 |
-
*
|
2733 |
-
* @since BuddyPress (1.2.0)
|
2734 |
-
*
|
2735 |
-
* @param string $value Current action for the activity item.
|
2736 |
-
*/
|
2737 |
return apply_filters( 'bp_get_activity_permalink_id', bp_current_action() );
|
2738 |
}
|
2739 |
|
2740 |
/**
|
2741 |
* Output the activity thread permalink.
|
2742 |
*
|
2743 |
-
* @since BuddyPress (1.2
|
2744 |
*
|
2745 |
* @uses bp_get_activity_permalink_id()
|
2746 |
*/
|
@@ -2751,7 +2381,7 @@ function bp_activity_thread_permalink() {
|
|
2751 |
/**
|
2752 |
* Return the activity thread permalink.
|
2753 |
*
|
2754 |
-
* @since BuddyPress (1.2
|
2755 |
*
|
2756 |
* @uses bp_activity_get_permalink()
|
2757 |
* @uses apply_filters() To call the 'bp_get_activity_thread_permalink' hook.
|
@@ -2763,20 +2393,13 @@ function bp_activity_thread_permalink() {
|
|
2763 |
|
2764 |
$link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity );
|
2765 |
|
2766 |
-
/**
|
2767 |
-
* Filters the activity thread permalink.
|
2768 |
-
*
|
2769 |
-
* @since BuddyPress (1.2.0)
|
2770 |
-
*
|
2771 |
-
* @param string $link The activity thread permalink.
|
2772 |
-
*/
|
2773 |
return apply_filters( 'bp_get_activity_thread_permalink', $link );
|
2774 |
}
|
2775 |
|
2776 |
/**
|
2777 |
* Output the activity comment permalink.
|
2778 |
*
|
2779 |
-
* @since BuddyPress (1.8
|
2780 |
*
|
2781 |
* @uses bp_get_activity_permalink_id()
|
2782 |
*/
|
@@ -2786,7 +2409,7 @@ function bp_activity_comment_permalink() {
|
|
2786 |
/**
|
2787 |
* Return the activity comment permalink.
|
2788 |
*
|
2789 |
-
* @since BuddyPress (1.8
|
2790 |
*
|
2791 |
* @uses bp_activity_get_permalink()
|
2792 |
* @uses apply_filters() To call the 'bp_get_activity_comment_permalink' hook.
|
@@ -2809,21 +2432,13 @@ function bp_activity_comment_permalink() {
|
|
2809 |
// Append comment ID to end of activity permalink
|
2810 |
$link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ) . $comment_link;
|
2811 |
|
2812 |
-
/**
|
2813 |
-
* Filters the activity comment permalink.
|
2814 |
-
*
|
2815 |
-
* @since BuddyPress (1.8.0)
|
2816 |
-
*
|
2817 |
-
* @param string $link Activity comment permalink.
|
2818 |
-
* @param int $comment_id ID for the current activity comment.
|
2819 |
-
*/
|
2820 |
return apply_filters( 'bp_get_activity_comment_permalink', $link, $comment_id );
|
2821 |
}
|
2822 |
|
2823 |
/**
|
2824 |
* Output the activity favorite link.
|
2825 |
*
|
2826 |
-
* @since BuddyPress (1.2
|
2827 |
*
|
2828 |
* @uses bp_get_activity_favorite_link()
|
2829 |
*/
|
@@ -2834,7 +2449,7 @@ function bp_activity_favorite_link() {
|
|
2834 |
/**
|
2835 |
* Return the activity favorite link.
|
2836 |
*
|
2837 |
-
* @since BuddyPress (1.2
|
2838 |
*
|
2839 |
* @global object $activities_template {@link BP_Activity_Template}
|
2840 |
* @uses wp_nonce_url()
|
@@ -2846,21 +2461,13 @@ function bp_activity_favorite_link() {
|
|
2846 |
*/
|
2847 |
function bp_get_activity_favorite_link() {
|
2848 |
global $activities_template;
|
2849 |
-
|
2850 |
-
/**
|
2851 |
-
* Filters the activity favorite link.
|
2852 |
-
*
|
2853 |
-
* @since BuddyPress (1.2.0)
|
2854 |
-
*
|
2855 |
-
* @param string $value Constructed link for favoriting the activity comment.
|
2856 |
-
*/
|
2857 |
return apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . $activities_template->activity->id . '/' ), 'mark_favorite' ) );
|
2858 |
}
|
2859 |
|
2860 |
/**
|
2861 |
* Output the activity unfavorite link.
|
2862 |
*
|
2863 |
-
* @since BuddyPress (1.2
|
2864 |
*
|
2865 |
* @uses bp_get_activity_unfavorite_link()
|
2866 |
*/
|
@@ -2871,7 +2478,7 @@ function bp_activity_unfavorite_link() {
|
|
2871 |
/**
|
2872 |
* Return the activity unfavorite link.
|
2873 |
*
|
2874 |
-
* @since BuddyPress (1.2
|
2875 |
*
|
2876 |
* @global object $activities_template {@link BP_Activity_Template}
|
2877 |
* @uses wp_nonce_url()
|
@@ -2883,21 +2490,13 @@ function bp_activity_unfavorite_link() {
|
|
2883 |
*/
|
2884 |
function bp_get_activity_unfavorite_link() {
|
2885 |
global $activities_template;
|
2886 |
-
|
2887 |
-
/**
|
2888 |
-
* Filters the activity unfavorite link.
|
2889 |
-
*
|
2890 |
-
* @since BuddyPress (1.2.0)
|
2891 |
-
*
|
2892 |
-
* @param string $value Constructed link for unfavoriting the activity comment.
|
2893 |
-
*/
|
2894 |
return apply_filters( 'bp_get_activity_unfavorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/unfavorite/' . $activities_template->activity->id . '/' ), 'unmark_favorite' ) );
|
2895 |
}
|
2896 |
|
2897 |
/**
|
2898 |
* Output the activity CSS class.
|
2899 |
*
|
2900 |
-
* @since BuddyPress (1.0
|
2901 |
*
|
2902 |
* @uses bp_get_activity_css_class()
|
2903 |
*/
|
@@ -2908,7 +2507,7 @@ function bp_activity_css_class() {
|
|
2908 |
/**
|
2909 |
* Return the current activity item's CSS class.
|
2910 |
*
|
2911 |
-
* @since BuddyPress (1.0
|
2912 |
*
|
2913 |
* @global object $activities_template {@link BP_Activity_Template}
|
2914 |
* @uses apply_filters() To call the 'bp_activity_mini_activity_types' hook.
|
@@ -2921,13 +2520,6 @@ function bp_activity_css_class() {
|
|
2921 |
function bp_get_activity_css_class() {
|
2922 |
global $activities_template;
|
2923 |
|
2924 |
-
/**
|
2925 |
-
* Filters the available mini activity actions available as CSS classes.
|
2926 |
-
*
|
2927 |
-
* @since BuddyPress (1.2.0)
|
2928 |
-
*
|
2929 |
-
* @param array $value Array of classes used to determine classes applied to HTML element.
|
2930 |
-
*/
|
2931 |
$mini_activity_actions = apply_filters( 'bp_activity_mini_activity_types', array(
|
2932 |
'friendship_accepted',
|
2933 |
'friendship_created',
|
@@ -2945,20 +2537,13 @@ function bp_activity_css_class() {
|
|
2945 |
if ( bp_activity_get_comment_count() && bp_activity_can_comment() )
|
2946 |
$class .= ' has-comments';
|
2947 |
|
2948 |
-
/**
|
2949 |
-
* Filters the determined classes to add to the HTML element.
|
2950 |
-
*
|
2951 |
-
* @since BuddyPress (1.0.0)
|
2952 |
-
*
|
2953 |
-
* @param string $value Classes to be added to the HTML element.
|
2954 |
-
*/
|
2955 |
return apply_filters( 'bp_get_activity_css_class', $activities_template->activity->component . ' ' . $activities_template->activity->type . $class );
|
2956 |
}
|
2957 |
|
2958 |
/**
|
2959 |
* Output the activity delete link.
|
2960 |
*
|
2961 |
-
* @since BuddyPress (1.1
|
2962 |
*
|
2963 |
* @uses bp_get_activity_delete_link()
|
2964 |
*/
|
@@ -2969,13 +2554,14 @@ function bp_activity_delete_link() {
|
|
2969 |
/**
|
2970 |
* Return the activity delete link.
|
2971 |
*
|
2972 |
-
* @since BuddyPress (1.1
|
2973 |
*
|
2974 |
* @global object $activities_template {@link BP_Activity_Template}
|
2975 |
* @uses bp_get_root_domain()
|
2976 |
* @uses bp_get_activity_root_slug()
|
2977 |
* @uses bp_is_activity_component()
|
2978 |
* @uses bp_current_action()
|
|
|
2979 |
* @uses wp_get_referer()
|
2980 |
* @uses wp_nonce_url()
|
2981 |
* @uses apply_filters() To call the 'bp_get_activity_delete_link' hook.
|
@@ -2995,13 +2581,6 @@ function bp_activity_delete_link() {
|
|
2995 |
|
2996 |
$link = '<a href="' . esc_url( $url ) . '" class="button item-button bp-secondary-action ' . $class . ' confirm" rel="nofollow">' . __( 'Delete', 'buddypress' ) . '</a>';
|
2997 |
|
2998 |
-
/**
|
2999 |
-
* Filters the activity delete link.
|
3000 |
-
*
|
3001 |
-
* @since BuddyPress (1.1.0)
|
3002 |
-
*
|
3003 |
-
* @param string $link Activity delete HTML link.
|
3004 |
-
*/
|
3005 |
return apply_filters( 'bp_get_activity_delete_link', $link );
|
3006 |
}
|
3007 |
|
@@ -3045,20 +2624,13 @@ function bp_activity_delete_url() {
|
|
3045 |
|
3046 |
$url = wp_nonce_url( $url, 'bp_activity_delete_link' );
|
3047 |
|
3048 |
-
/**
|
3049 |
-
* Filters the activity delete URL.
|
3050 |
-
*
|
3051 |
-
* @since BuddyPress (2.1.0)
|
3052 |
-
*
|
3053 |
-
* @param string $url Activity delete URL.
|
3054 |
-
*/
|
3055 |
return apply_filters( 'bp_get_activity_delete_url', $url );
|
3056 |
}
|
3057 |
|
3058 |
/**
|
3059 |
* Output the activity latest update link.
|
3060 |
*
|
3061 |
-
* @since BuddyPress (1.2
|
3062 |
*
|
3063 |
* @see bp_get_activity_latest_update() for description of parameters.
|
3064 |
* @uses bp_get_activity_latest_update()
|
@@ -3072,7 +2644,7 @@ function bp_activity_latest_update( $user_id = 0 ) {
|
|
3072 |
/**
|
3073 |
* Return the activity latest update link.
|
3074 |
*
|
3075 |
-
* @since BuddyPress (1.2
|
3076 |
*
|
3077 |
* @uses bp_is_user_inactive()
|
3078 |
* @uses bp_core_is_user_deleted()
|
@@ -3098,36 +2670,16 @@ function bp_activity_latest_update( $user_id = 0 ) {
|
|
3098 |
if ( !$update = bp_get_user_meta( $user_id, 'bp_latest_update', true ) )
|
3099 |
return false;
|
3100 |
|
3101 |
-
/**
|
3102 |
-
* Filters the latest update excerpt.
|
3103 |
-
*
|
3104 |
-
* @since BuddyPress (1.2.10)
|
3105 |
-
*
|
3106 |
-
* @param string $value The excerpt for the latest update.
|
3107 |
-
*/
|
3108 |
$latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 358 ) ) ) );
|
|
|
3109 |
|
3110 |
-
$latest_update
|
3111 |
-
'%s <a href="%s">%s</a>',
|
3112 |
-
$latest_update,
|
3113 |
-
esc_url_raw( bp_activity_get_permalink( $update['id'] ) ),
|
3114 |
-
esc_attr__( 'View', 'buddypress' )
|
3115 |
-
);
|
3116 |
-
|
3117 |
-
/**
|
3118 |
-
* Filters the latest update excerpt with view link appended to the end.
|
3119 |
-
*
|
3120 |
-
* @since BuddyPress (1.2.0)
|
3121 |
-
*
|
3122 |
-
* @param string $latest_update The latest update with "view" link appended to it.
|
3123 |
-
*/
|
3124 |
-
return apply_filters( 'bp_get_activity_latest_update', $latest_update );
|
3125 |
}
|
3126 |
|
3127 |
/**
|
3128 |
* Output the activity filter links.
|
3129 |
*
|
3130 |
-
* @since BuddyPress (1.1
|
3131 |
*
|
3132 |
* @see bp_get_activity_filter_links() for description of parameters.
|
3133 |
* @uses bp_get_activity_filter_links()
|
@@ -3141,7 +2693,7 @@ function bp_activity_filter_links( $args = false ) {
|
|
3141 |
/**
|
3142 |
* Return the activity filter links.
|
3143 |
*
|
3144 |
-
* @since BuddyPress (1.1
|
3145 |
*
|
3146 |
* @uses wp_parse_args()
|
3147 |
* @uses BP_Activity_Activity::get_recorded_components() {@link BP_Activity_Activity}
|
@@ -3209,39 +2761,23 @@ function bp_activity_filter_links( $args = false ) {
|
|
3209 |
|
3210 |
$link = add_query_arg( 'afilter', $component );
|
3211 |
$link = remove_query_arg( 'acpage' , $link );
|
3212 |
-
|
3213 |
-
/**
|
3214 |
-
* Filters the activity filter link URL for the current activity component.
|
3215 |
-
*
|
3216 |
-
* @since BuddyPress (1.1.0)
|
3217 |
-
*
|
3218 |
-
* @param string $link The URL for the current component.
|
3219 |
-
* @param string $component The current component getting links constructed for.
|
3220 |
-
*/
|
3221 |
$link = apply_filters( 'bp_get_activity_filter_link_href', $link, $component );
|
3222 |
|
3223 |
-
$component_links[] = $before . '<a href="' .
|
3224 |
}
|
3225 |
|
3226 |
$link = remove_query_arg( 'afilter' , $link );
|
3227 |
|
3228 |
if ( isset( $_GET['afilter'] ) )
|
3229 |
-
$component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' .
|
3230 |
|
3231 |
-
/**
|
3232 |
-
* Filters all of the constructed filter links.
|
3233 |
-
*
|
3234 |
-
* @since BuddyPress (1.1.0)
|
3235 |
-
*
|
3236 |
-
* @param string $value All of the links to be displayed to the user.
|
3237 |
-
*/
|
3238 |
return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
|
3239 |
}
|
3240 |
|
3241 |
/**
|
3242 |
* Determine if a comment can be made on an activity item.
|
3243 |
*
|
3244 |
-
* @since BuddyPress (1.2
|
3245 |
*
|
3246 |
* @global object $activities_template {@link BP_Activity_Template}
|
3247 |
* @uses bp_get_activity_action_name()
|
@@ -3251,49 +2787,30 @@ function bp_activity_filter_links( $args = false ) {
|
|
3251 |
*/
|
3252 |
function bp_activity_can_comment() {
|
3253 |
global $activities_template;
|
3254 |
-
$bp = buddypress();
|
3255 |
|
3256 |
// Assume activity can be commented on
|
3257 |
$can_comment = true;
|
3258 |
|
3259 |
// Determine ability to comment based on activity action name
|
3260 |
$activity_action = bp_get_activity_action_name();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3261 |
|
3262 |
-
|
3263 |
-
|
3264 |
-
|
3265 |
-
|
3266 |
-
|
3267 |
-
$maybe_turn_off = array_fill_keys( array(
|
3268 |
-
'new_blog_post',
|
3269 |
-
'new_blog_comment',
|
3270 |
-
'new_forum_topic',
|
3271 |
-
'new_forum_post',
|
3272 |
-
), $turn_off );
|
3273 |
-
|
3274 |
-
$maybe_turn_off['activity_comment'] = 1;
|
3275 |
-
|
3276 |
-
// Fetch all the tracked post types once.
|
3277 |
-
if ( empty( $bp->activity->track ) ) {
|
3278 |
-
$bp->activity->track = bp_activity_get_post_types_tracking_args();
|
3279 |
-
}
|
3280 |
-
|
3281 |
-
foreach ( $bp->activity->track as $action => $tracking_args ) {
|
3282 |
-
if ( empty( $tracking_args->activity_comment ) ) {
|
3283 |
-
$maybe_turn_off[ $action ] = $turn_off;
|
3284 |
-
}
|
3285 |
}
|
3286 |
|
3287 |
-
$can_comment = empty( $maybe_turn_off[ $activity_action ] );
|
3288 |
-
|
3289 |
-
/**
|
3290 |
-
* Filters whether a comment can be made on an activity item.
|
3291 |
-
*
|
3292 |
-
* @since BuddyPress (1.5.0)
|
3293 |
-
*
|
3294 |
-
* @param bool $can_comment Status on if activity can be commented on.
|
3295 |
-
* @param string $activity_action Current activity action being checked on.
|
3296 |
-
*/
|
3297 |
return apply_filters( 'bp_activity_can_comment', $can_comment, $activity_action );
|
3298 |
}
|
3299 |
|
@@ -3333,44 +2850,28 @@ function bp_activity_can_comment_reply( $comment = '' ) {
|
|
3333 |
}
|
3334 |
}
|
3335 |
|
3336 |
-
/**
|
3337 |
-
* Filters whether a comment can be made on an activity reply item.
|
3338 |
-
*
|
3339 |
-
* @since BuddyPress (1.5.0)
|
3340 |
-
*
|
3341 |
-
* @param bool $can_comment Status on if activity reply can be commented on.
|
3342 |
-
* @param string $comment Current comment being checked on.
|
3343 |
-
*/
|
3344 |
return (bool) apply_filters( 'bp_activity_can_comment_reply', $can_comment, $comment );
|
3345 |
}
|
3346 |
|
3347 |
/**
|
3348 |
-
* Determine
|
3349 |
*
|
3350 |
* Defaults to true, but can be modified by plugins.
|
3351 |
*
|
3352 |
-
* @since BuddyPress (1.5
|
3353 |
*
|
3354 |
* @uses apply_filters() To call the 'bp_activity_can_favorite' hook.
|
3355 |
*
|
3356 |
* @return bool True if comment can receive comments.
|
3357 |
*/
|
3358 |
function bp_activity_can_favorite() {
|
3359 |
-
|
3360 |
-
/**
|
3361 |
-
* Filters whether or not users can favorite activity items.
|
3362 |
-
*
|
3363 |
-
* @since BuddyPress (1.5.0)
|
3364 |
-
*
|
3365 |
-
* @param bool $value Whether or not favoriting is enabled.
|
3366 |
-
*/
|
3367 |
return apply_filters( 'bp_activity_can_favorite', true );
|
3368 |
}
|
3369 |
|
3370 |
/**
|
3371 |
* Output the total favorite count for a specified user.
|
3372 |
*
|
3373 |
-
* @since BuddyPress (1.2
|
3374 |
*
|
3375 |
* @see bp_get_total_favorite_count_for_user() for description of parameters.
|
3376 |
* @uses bp_get_total_favorite_count_for_user()
|
@@ -3384,7 +2885,7 @@ function bp_total_favorite_count_for_user( $user_id = 0 ) {
|
|
3384 |
/**
|
3385 |
* Return the total favorite count for a specified user.
|
3386 |
*
|
3387 |
-
* @since BuddyPress (1.2
|
3388 |
*
|
3389 |
* @uses bp_activity_total_favorites_for_user()
|
3390 |
* @uses apply_filters() To call the 'bp_get_total_favorite_count_for_user' hook
|
@@ -3404,13 +2905,6 @@ function bp_total_favorite_count_for_user( $user_id = 0 ) {
|
|
3404 |
? bp_activity_total_favorites_for_user( $user_id )
|
3405 |
: false;
|
3406 |
|
3407 |
-
/**
|
3408 |
-
* Filters the total favorite count for a user.
|
3409 |
-
*
|
3410 |
-
* @since BuddyPress (1.2.0)
|
3411 |
-
*
|
3412 |
-
* @param int|bool $retval Total favorite count for a user. False on no favorites.
|
3413 |
-
*/
|
3414 |
return apply_filters( 'bp_get_total_favorite_count_for_user', $retval );
|
3415 |
}
|
3416 |
|
@@ -3418,7 +2912,7 @@ function bp_total_favorite_count_for_user( $user_id = 0 ) {
|
|
3418 |
/**
|
3419 |
* Output the total mention count for a specified user.
|
3420 |
*
|
3421 |
-
* @since BuddyPress (1.2
|
3422 |
*
|
3423 |
* @see bp_get_total_mention_count_for_user() for description of parameters.
|
3424 |
* @uses bp_get_total_favorite_count_for_user()
|
@@ -3432,7 +2926,7 @@ function bp_total_mention_count_for_user( $user_id = 0 ) {
|
|
3432 |
/**
|
3433 |
* Return the total mention count for a specified user.
|
3434 |
*
|
3435 |
-
* @since BuddyPress (1.2
|
3436 |
*
|
3437 |
* @uses bp_get_user_meta()
|
3438 |
* @uses apply_filters() To call the 'bp_get_total_mention_count_for_user' hook.
|
@@ -3452,31 +2946,24 @@ function bp_total_mention_count_for_user( $user_id = 0 ) {
|
|
3452 |
? bp_get_user_meta( $user_id, 'bp_new_mention_count', true )
|
3453 |
: false;
|
3454 |
|
3455 |
-
/**
|
3456 |
-
* Filters the total mention count for a user.
|
3457 |
-
*
|
3458 |
-
* @since BuddyPress (1.2.0)
|
3459 |
-
*
|
3460 |
-
* @param int|bool $retval Total mention count for a user. False on no mentions.
|
3461 |
-
*/
|
3462 |
return apply_filters( 'bp_get_total_mention_count_for_user', $retval );
|
3463 |
}
|
3464 |
|
3465 |
/**
|
3466 |
* Output the public message link for displayed user.
|
3467 |
*
|
3468 |
-
* @since BuddyPress (1.2
|
3469 |
*
|
3470 |
* @uses bp_get_send_public_message_link()
|
3471 |
*/
|
3472 |
function bp_send_public_message_link() {
|
3473 |
-
echo
|
3474 |
}
|
3475 |
|
3476 |
/**
|
3477 |
* Return the public message link for the displayed user.
|
3478 |
*
|
3479 |
-
* @since BuddyPress (1.2
|
3480 |
*
|
3481 |
* @uses is_user_logged_in()
|
3482 |
* @uses bp_is_my_profile()
|
@@ -3498,13 +2985,6 @@ function bp_send_public_message_link() {
|
|
3498 |
$retval = wp_nonce_url( $url );
|
3499 |
}
|
3500 |
|
3501 |
-
/**
|
3502 |
-
* Filters the public message link for the displayed user.
|
3503 |
-
*
|
3504 |
-
* @since BuddyPress (1.2.0)
|
3505 |
-
*
|
3506 |
-
* @param string $retval The URL for the public message link.
|
3507 |
-
*/
|
3508 |
return apply_filters( 'bp_get_send_public_message_link', $retval );
|
3509 |
}
|
3510 |
|
@@ -3538,7 +3018,7 @@ function bp_activity_recurse_comments_activity_ids( $activity = array(), $activi
|
|
3538 |
/**
|
3539 |
* Output the mentioned user display name.
|
3540 |
*
|
3541 |
-
* @since BuddyPress (1.2
|
3542 |
*
|
3543 |
* @see bp_get_mentioned_user_display_name() for description of parameters.
|
3544 |
* @uses bp_get_mentioned_user_display_name()
|
@@ -3552,7 +3032,7 @@ function bp_mentioned_user_display_name( $user_id_or_username = false ) {
|
|
3552 |
/**
|
3553 |
* Returns the mentioned user display name
|
3554 |
*
|
3555 |
-
* @since BuddyPress (1.2
|
3556 |
*
|
3557 |
* @uses bp_core_get_user_displayname()
|
3558 |
* @uses apply_filters() To call the 'bp_get_mentioned_user_display_name' hook.
|
@@ -3570,21 +3050,13 @@ function bp_mentioned_user_display_name( $user_id_or_username = false ) {
|
|
3570 |
$name = __( 'a user', 'buddypress' );
|
3571 |
}
|
3572 |
|
3573 |
-
/**
|
3574 |
-
* Filters the mentioned user display name.
|
3575 |
-
*
|
3576 |
-
* @since BuddyPress (1.2.0)
|
3577 |
-
*
|
3578 |
-
* @param string $name Display name for the mentioned user.
|
3579 |
-
* @param int|string $user_id_or_username User ID or username use for query.
|
3580 |
-
*/
|
3581 |
return apply_filters( 'bp_get_mentioned_user_display_name', $name, $user_id_or_username );
|
3582 |
}
|
3583 |
|
3584 |
/**
|
3585 |
* Output button for sending a public message (an @-mention).
|
3586 |
*
|
3587 |
-
* @since BuddyPress (1.2
|
3588 |
*
|
3589 |
* @see bp_get_send_public_message_button() for description of parameters.
|
3590 |
* @uses bp_get_send_public_message_button()
|
@@ -3598,7 +3070,7 @@ function bp_send_public_message_button( $args = '' ) {
|
|
3598 |
/**
|
3599 |
* Return button for sending a public message (an @-mention).
|
3600 |
*
|
3601 |
-
* @since BuddyPress (1.2
|
3602 |
*
|
3603 |
* @uses bp_get_send_public_message_link()
|
3604 |
* @uses wp_parse_args()
|
@@ -3636,20 +3108,14 @@ function bp_send_public_message_button( $args = '' ) {
|
|
3636 |
'link_class' => 'activity-button mention'
|
3637 |
) );
|
3638 |
|
3639 |
-
|
3640 |
-
* Filters the public message button HTML.
|
3641 |
-
*
|
3642 |
-
* @since BuddyPress (1.2.10)
|
3643 |
-
*
|
3644 |
-
* @param array $r Array of arguments for the public message button HTML.
|
3645 |
-
*/
|
3646 |
return bp_get_button( apply_filters( 'bp_get_send_public_message_button', $r ) );
|
3647 |
}
|
3648 |
|
3649 |
/**
|
3650 |
* Output the activity post form action.
|
3651 |
*
|
3652 |
-
* @since BuddyPress (1.2
|
3653 |
*
|
3654 |
* @uses bp_get_activity_post_form_action()
|
3655 |
*/
|
@@ -3660,7 +3126,7 @@ function bp_activity_post_form_action() {
|
|
3660 |
/**
|
3661 |
* Return the activity post form action.
|
3662 |
*
|
3663 |
-
* @since BuddyPress (1.2
|
3664 |
*
|
3665 |
* @uses home_url()
|
3666 |
* @uses bp_get_activity_root_slug()
|
@@ -3669,14 +3135,6 @@ function bp_activity_post_form_action() {
|
|
3669 |
* @return string The activity post form action.
|
3670 |
*/
|
3671 |
function bp_get_activity_post_form_action() {
|
3672 |
-
|
3673 |
-
/**
|
3674 |
-
* Filters the action url used for the activity post form.
|
3675 |
-
*
|
3676 |
-
* @since BuddyPress (1.2.0)
|
3677 |
-
*
|
3678 |
-
* @param string $value URL to be used for the activity post form.
|
3679 |
-
*/
|
3680 |
return apply_filters( 'bp_get_activity_post_form_action', home_url( bp_get_activity_root_slug() . '/post/' ) );
|
3681 |
}
|
3682 |
|
@@ -3688,7 +3146,7 @@ function bp_activity_post_form_action() {
|
|
3688 |
* Avatars are wrapped in <li> elements, but you've got to provide your own
|
3689 |
* <ul> or <ol> wrapper markup.
|
3690 |
*
|
3691 |
-
* @since BuddyPress (1.7
|
3692 |
*
|
3693 |
* @see bp_core_fetch_avatar() for a description of arguments.
|
3694 |
*
|
@@ -3740,22 +3198,13 @@ function bp_activity_comments_user_avatars( $args = array() ) {
|
|
3740 |
}
|
3741 |
}
|
3742 |
|
3743 |
-
/**
|
3744 |
-
* Filters the list of linked avatars for users who have commented on the current activity item.
|
3745 |
-
*
|
3746 |
-
* @since BuddyPress (1.7.0)
|
3747 |
-
*
|
3748 |
-
* @param string $retval HTML markup for the list of avatars.
|
3749 |
-
* @param array $r Array of arguments used for each avatar.
|
3750 |
-
* @param array $output Array of each avatar found, before imploded into single string.
|
3751 |
-
*/
|
3752 |
echo apply_filters( 'bp_activity_comments_user_avatars', $retval, $r, $output );
|
3753 |
}
|
3754 |
|
3755 |
/**
|
3756 |
* Return the IDs of every user who's left a comment on the current activity item.
|
3757 |
*
|
3758 |
-
* @since BuddyPress (1.7
|
3759 |
*
|
3760 |
* @return bool|array An array of IDs, or false if none are found.
|
3761 |
*/
|
@@ -3766,20 +3215,13 @@ function bp_activity_get_comments_user_ids() {
|
|
3766 |
? (array) bp_activity_recurse_comments_user_ids( $activities_template->activity->children )
|
3767 |
: array();
|
3768 |
|
3769 |
-
/**
|
3770 |
-
* Filters the list of user IDs for the current activity item.
|
3771 |
-
*
|
3772 |
-
* @since BuddyPress (1.7.0)
|
3773 |
-
*
|
3774 |
-
* @param array $value Array of unique user IDs for the current activity item.
|
3775 |
-
*/
|
3776 |
return apply_filters( 'bp_activity_get_comments_user_ids', array_unique( $user_ids ) );
|
3777 |
}
|
3778 |
|
3779 |
/**
|
3780 |
* Recurse through all activity comments and collect the IDs of the users who wrote them.
|
3781 |
*
|
3782 |
-
* @since BuddyPress (1.7
|
3783 |
*
|
3784 |
* @param array $comments Array of {@link BP_Activity_Activity} items.
|
3785 |
* @return array Array of user IDs.
|
@@ -3809,14 +3251,7 @@ function bp_activity_get_comments_user_ids() {
|
|
3809 |
}
|
3810 |
}
|
3811 |
|
3812 |
-
|
3813 |
-
* Filters the list of user IDs for the current activity comment item.
|
3814 |
-
*
|
3815 |
-
* @since BuddyPress (2.1.0)
|
3816 |
-
*
|
3817 |
-
* @param array $user_ids Array of user IDs for the current activity comment item.
|
3818 |
-
* @param array $comments Array of comments being checked for user IDs.
|
3819 |
-
*/
|
3820 |
return apply_filters( 'bp_activity_recurse_comments_user_ids', $user_ids, $comments );
|
3821 |
}
|
3822 |
|
@@ -3836,21 +3271,13 @@ function bp_displayed_user_mentionname() {
|
|
3836 |
* @return string Mentionname for the displayed user, if available.
|
3837 |
*/
|
3838 |
function bp_get_displayed_user_mentionname() {
|
3839 |
-
|
3840 |
-
/**
|
3841 |
-
* Filters the mentionname for the displayed user.
|
3842 |
-
*
|
3843 |
-
* @since BuddyPress (1.9.0)
|
3844 |
-
*
|
3845 |
-
* @param string $value The mentionanme for the displayed user.
|
3846 |
-
*/
|
3847 |
return apply_filters( 'bp_get_displayed_user_mentionname', bp_activity_get_user_mentionname( bp_displayed_user_id() ) );
|
3848 |
}
|
3849 |
|
3850 |
/**
|
3851 |
* Echo a list of all registered activity types for use in dropdowns or checkbox lists.
|
3852 |
*
|
3853 |
-
* @since BuddyPress (1.7
|
3854 |
*
|
3855 |
* @param string $output Optional. Either 'select' or 'checkbox'. Default: 'select'.
|
3856 |
* @param array $args {
|
@@ -3888,18 +3315,7 @@ function bp_activity_types_list( $output = 'select', $args = '' ) {
|
|
3888 |
break;
|
3889 |
}
|
3890 |
|
3891 |
-
|
3892 |
-
* Fires at the end of the listing of activity types.
|
3893 |
-
*
|
3894 |
-
* This is a variable action hook. The actual hook to use will depend on the output type specified.
|
3895 |
-
* Two default hooks are bp_activity_types_list_select and bp_activity_types_list_checkbox.
|
3896 |
-
*
|
3897 |
-
* @since BuddyPress (1.7.0)
|
3898 |
-
*
|
3899 |
-
* @param array $args Array of arguments passed into function.
|
3900 |
-
* @param string $type Activity type being rendered in the output.
|
3901 |
-
* @param string $description Description of the activity type being rendered.
|
3902 |
-
*/
|
3903 |
do_action( 'bp_activity_types_list_' . $output, $args, $type, $description );
|
3904 |
}
|
3905 |
|
@@ -3915,7 +3331,7 @@ function bp_activity_types_list( $output = 'select', $args = '' ) {
|
|
3915 |
/**
|
3916 |
* Output the sitewide activity feed link.
|
3917 |
*
|
3918 |
-
* @since BuddyPress (1.0
|
3919 |
*
|
3920 |
* @uses bp_get_sitewide_activity_feed_link()
|
3921 |
*/
|
@@ -3926,7 +3342,7 @@ function bp_sitewide_activity_feed_link() {
|
|
3926 |
/**
|
3927 |
* Returns the sitewide activity feed link.
|
3928 |
*
|
3929 |
-
* @since BuddyPress (1.0
|
3930 |
*
|
3931 |
* @uses home_url()
|
3932 |
* @uses bp_get_activity_root_slug()
|
@@ -3935,21 +3351,13 @@ function bp_sitewide_activity_feed_link() {
|
|
3935 |
* @return string The sitewide activity feed link.
|
3936 |
*/
|
3937 |
function bp_get_sitewide_activity_feed_link() {
|
3938 |
-
|
3939 |
-
/**
|
3940 |
-
* Filters the sidewide activity feed link.
|
3941 |
-
*
|
3942 |
-
* @since BuddyPress (1.0.0)
|
3943 |
-
*
|
3944 |
-
* @param string $value The feed link for sitewide activity.
|
3945 |
-
*/
|
3946 |
return apply_filters( 'bp_get_sitewide_activity_feed_link', bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/feed/' );
|
3947 |
}
|
3948 |
|
3949 |
/**
|
3950 |
* Output the member activity feed link.
|
3951 |
*
|
3952 |
-
* @since BuddyPress (1.2
|
3953 |
*
|
3954 |
* @uses bp_get_member_activity_feed_link()
|
3955 |
*/
|
@@ -3960,8 +3368,8 @@ function bp_member_activity_feed_link() {
|
|
3960 |
/**
|
3961 |
* Output the member activity feed link.
|
3962 |
*
|
3963 |
-
* @since BuddyPress (1.0
|
3964 |
-
* @deprecated BuddyPress (1.2
|
3965 |
*
|
3966 |
* @todo properly deprecate in favor of bp_member_activity_feed_link().
|
3967 |
*
|
@@ -3972,7 +3380,7 @@ function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link
|
|
3972 |
/**
|
3973 |
* Return the member activity feed link.
|
3974 |
*
|
3975 |
-
* @since BuddyPress (1.2
|
3976 |
*
|
3977 |
* @uses bp_is_profile_component()
|
3978 |
* @uses bp_is_current_action()
|
@@ -4012,21 +3420,14 @@ function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link
|
|
4012 |
$link = '';
|
4013 |
}
|
4014 |
|
4015 |
-
/**
|
4016 |
-
* Filters the member activity feed link.
|
4017 |
-
*
|
4018 |
-
* @since BuddyPress (1.0.0)
|
4019 |
-
*
|
4020 |
-
* @param string $link URL for the member activity feed.
|
4021 |
-
*/
|
4022 |
return apply_filters( 'bp_get_activities_member_rss_link', $link );
|
4023 |
}
|
4024 |
|
4025 |
/**
|
4026 |
* Return the member activity feed link.
|
4027 |
*
|
4028 |
-
* @since BuddyPress (1.0
|
4029 |
-
* @deprecated BuddyPress (1.2
|
4030 |
*
|
4031 |
* @todo properly deprecate in favor of bp_get_member_activity_feed_link().
|
4032 |
*
|
@@ -4042,7 +3443,7 @@ function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link
|
|
4042 |
/**
|
4043 |
* Outputs the activity feed item guid.
|
4044 |
*
|
4045 |
-
* @since BuddyPress (1.0
|
4046 |
*
|
4047 |
* @uses bp_activity_feed_item_guid()
|
4048 |
*/
|
@@ -4053,7 +3454,7 @@ function bp_activity_feed_item_guid() {
|
|
4053 |
/**
|
4054 |
* Returns the activity feed item guid.
|
4055 |
*
|
4056 |
-
* @since BuddyPress (1.2
|
4057 |
*
|
4058 |
* @global object $activities_template {@link BP_Activity_Template}
|
4059 |
* @uses apply_filters() To call the 'bp_get_activity_feed_item_guid' hook.
|
@@ -4063,20 +3464,13 @@ function bp_activity_feed_item_guid() {
|
|
4063 |
function bp_get_activity_feed_item_guid() {
|
4064 |
global $activities_template;
|
4065 |
|
4066 |
-
/**
|
4067 |
-
* Filters the activity feed item guid.
|
4068 |
-
*
|
4069 |
-
* @since BuddyPress (1.1.3)
|
4070 |
-
*
|
4071 |
-
* @param string $value Calculated md5 value for the activity feed item.
|
4072 |
-
*/
|
4073 |
return apply_filters( 'bp_get_activity_feed_item_guid', md5( $activities_template->activity->date_recorded . '-' . $activities_template->activity->content ) );
|
4074 |
}
|
4075 |
|
4076 |
/**
|
4077 |
* Output the activity feed item title.
|
4078 |
*
|
4079 |
-
* @since BuddyPress (1.0
|
4080 |
*
|
4081 |
* @uses bp_get_activity_feed_item_title()
|
4082 |
*/
|
@@ -4087,7 +3481,7 @@ function bp_activity_feed_item_title() {
|
|
4087 |
/**
|
4088 |
* Return the activity feed item title.
|
4089 |
*
|
4090 |
-
* @since BuddyPress (1.0
|
4091 |
*
|
4092 |
* @global object $activities_template {@link BP_Activity_Template}
|
4093 |
* @uses ent2ncr()
|
@@ -4117,20 +3511,13 @@ function bp_activity_feed_item_title() {
|
|
4117 |
$title .= ': ' . strip_tags( ent2ncr( trim( convert_chars( bp_create_excerpt( $activities_template->activity->content, 70, array( 'ending' => " […]" ) ) ) ) ) );
|
4118 |
}
|
4119 |
|
4120 |
-
/**
|
4121 |
-
* Filters the activity feed item title.
|
4122 |
-
*
|
4123 |
-
* @since BuddyPress (1.0.0)
|
4124 |
-
*
|
4125 |
-
* @param string $title The title for the activity feed item.
|
4126 |
-
*/
|
4127 |
return apply_filters( 'bp_get_activity_feed_item_title', $title );
|
4128 |
}
|
4129 |
|
4130 |
/**
|
4131 |
* Output the activity feed item link
|
4132 |
*
|
4133 |
-
* @since BuddyPress (1.0
|
4134 |
*
|
4135 |
* @uses bp_get_activity_feed_item_link()
|
4136 |
*/
|
@@ -4141,7 +3528,7 @@ function bp_activity_feed_item_link() {
|
|
4141 |
/**
|
4142 |
* Return the activity feed item link
|
4143 |
*
|
4144 |
-
* @since BuddyPress (1.0
|
4145 |
*
|
4146 |
* @global object $activities_template {@link BP_Activity_Template}
|
4147 |
* @uses apply_filters() To call the 'bp_get_activity_feed_item_link' hook.
|
@@ -4155,20 +3542,13 @@ function bp_activity_feed_item_link() {
|
|
4155 |
? $activities_template->activity->primary_link
|
4156 |
: '';
|
4157 |
|
4158 |
-
/**
|
4159 |
-
* Filters the activity feed item link.
|
4160 |
-
*
|
4161 |
-
* @since BuddyPress (1.0.0)
|
4162 |
-
*
|
4163 |
-
* @param string $retval The URL for the activity feed item.
|
4164 |
-
*/
|
4165 |
return apply_filters( 'bp_get_activity_feed_item_link', $retval );
|
4166 |
}
|
4167 |
|
4168 |
/**
|
4169 |
* Output the activity feed item date.
|
4170 |
*
|
4171 |
-
* @since BuddyPress (1.0
|
4172 |
*
|
4173 |
* @uses bp_get_activity_feed_item_date()
|
4174 |
*/
|
@@ -4179,7 +3559,7 @@ function bp_activity_feed_item_date() {
|
|
4179 |
/**
|
4180 |
* Return the activity feed item date.
|
4181 |
*
|
4182 |
-
* @since BuddyPress (1.0
|
4183 |
*
|
4184 |
* @global object $activities_template {@link BP_Activity_Template}
|
4185 |
* @uses apply_filters() To call the 'bp_get_activity_feed_item_date' hook.
|
@@ -4193,20 +3573,13 @@ function bp_activity_feed_item_date() {
|
|
4193 |
? $activities_template->activity->date_recorded
|
4194 |
: '';
|
4195 |
|
4196 |
-
/**
|
4197 |
-
* Filters the activity feed item date.
|
4198 |
-
*
|
4199 |
-
* @since BuddyPress (1.0.0)
|
4200 |
-
*
|
4201 |
-
* @param string $retval The date for the activity feed item.
|
4202 |
-
*/
|
4203 |
return apply_filters( 'bp_get_activity_feed_item_date', $retval );
|
4204 |
}
|
4205 |
|
4206 |
/**
|
4207 |
* Output the activity feed item description.
|
4208 |
*
|
4209 |
-
* @since BuddyPress (1.0
|
4210 |
*
|
4211 |
* @uses bp_get_activity_feed_item_description()
|
4212 |
*/
|
@@ -4217,7 +3590,7 @@ function bp_activity_feed_item_description() {
|
|
4217 |
/**
|
4218 |
* Return the activity feed item description.
|
4219 |
*
|
4220 |
-
* @since BuddyPress (1.0
|
4221 |
*
|
4222 |
* @global object $activities_template {@link BP_Activity_Template}
|
4223 |
* @uses ent2ncr()
|
@@ -4239,20 +3612,13 @@ function bp_activity_feed_item_description() {
|
|
4239 |
$content = ent2ncr( convert_chars( str_replace( '%s', '', $content ) ) );
|
4240 |
}
|
4241 |
|
4242 |
-
/**
|
4243 |
-
* Filters the activity feed item description.
|
4244 |
-
*
|
4245 |
-
* @since BuddyPress (1.0.0)
|
4246 |
-
*
|
4247 |
-
* @param string $content The description for the activity feed item.
|
4248 |
-
*/
|
4249 |
return apply_filters( 'bp_get_activity_feed_item_description', $content );
|
4250 |
}
|
4251 |
|
4252 |
/**
|
4253 |
* Template tag so we can hook activity feed to <head>.
|
4254 |
*
|
4255 |
-
* @since BuddyPress (1.5
|
4256 |
*
|
4257 |
* @uses bloginfo()
|
4258 |
* @uses bp_sitewide_activity_feed_link()
|
@@ -4301,7 +3667,7 @@ function bp_activity_show_filters( $context = '' ) {
|
|
4301 |
}
|
4302 |
|
4303 |
// On individual group pages, default to 'group'
|
4304 |
-
}
|
4305 |
$context = 'group';
|
4306 |
|
4307 |
// 'activity' everywhere else
|
@@ -4314,7 +3680,7 @@ function bp_activity_show_filters( $context = '' ) {
|
|
4314 |
|
4315 |
// Walk through the registered actions, and prepare an the
|
4316 |
// select box options.
|
4317 |
-
foreach (
|
4318 |
foreach ( $actions as $action ) {
|
4319 |
if ( ! in_array( $context, (array) $action['context'] ) ) {
|
4320 |
continue;
|
@@ -4330,14 +3696,17 @@ function bp_activity_show_filters( $context = '' ) {
|
|
4330 |
}
|
4331 |
|
4332 |
/**
|
4333 |
-
*
|
4334 |
*
|
4335 |
-
* @since BuddyPress (2.
|
4336 |
*
|
4337 |
-
* @param array $filters Array of filter options for the given
|
4338 |
-
*
|
|
|
|
|
|
|
4339 |
*/
|
4340 |
-
$filters = apply_filters( '
|
4341 |
|
4342 |
// Build the options output
|
4343 |
$output = '';
|
@@ -4348,14 +3717,5 @@ function bp_activity_show_filters( $context = '' ) {
|
|
4348 |
}
|
4349 |
}
|
4350 |
|
4351 |
-
/**
|
4352 |
-
* Filters the HTML markup result for the activity filter dropdown.
|
4353 |
-
*
|
4354 |
-
* @since BuddyPress (2.1.0)
|
4355 |
-
*
|
4356 |
-
* @param string $output HTML output for the activity filter dropdown.
|
4357 |
-
* @param array $filters Array of filter options for the given context, in the following format: $option_value => $option_name.
|
4358 |
-
* @param string $context Context for the filter. 'activity', 'member', 'member_groups', 'group'.
|
4359 |
-
*/
|
4360 |
return apply_filters( 'bp_get_activity_show_filters', $output, $filters, $context );
|
4361 |
}
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Output the activity component slug.
|
15 |
*
|
16 |
+
* @since BuddyPress (1.5)
|
17 |
*
|
18 |
* @uses bp_get_activity_slug()
|
19 |
*/
|
23 |
/**
|
24 |
* Return the activity component slug.
|
25 |
*
|
26 |
+
* @since BuddyPress (1.5)
|
27 |
*
|
28 |
* @uses apply_filters() To call the 'bp_get_activity_slug' hook.
|
29 |
*
|
30 |
* @return string The activity component slug.
|
31 |
*/
|
32 |
function bp_get_activity_slug() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
return apply_filters( 'bp_get_activity_slug', buddypress()->activity->slug );
|
34 |
}
|
35 |
|
36 |
/**
|
37 |
* Output the activity component root slug.
|
38 |
*
|
39 |
+
* @since BuddyPress (1.5)
|
40 |
*
|
41 |
* @uses bp_get_activity_root_slug()
|
42 |
*/
|
46 |
/**
|
47 |
* Return the activity component root slug.
|
48 |
*
|
49 |
+
* @since BuddyPress (1.5)
|
50 |
*
|
51 |
* @uses apply_filters() To call the 'bp_get_activity_root_slug' hook.
|
52 |
*
|
53 |
* @return string The activity component root slug.
|
54 |
*/
|
55 |
function bp_get_activity_root_slug() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
return apply_filters( 'bp_get_activity_root_slug', buddypress()->activity->root_slug );
|
57 |
}
|
58 |
|
59 |
/**
|
60 |
* Output activity directory permalink.
|
61 |
*
|
62 |
+
* @since BuddyPress (1.5)
|
63 |
*
|
64 |
* @uses bp_get_activity_directory_permalink()
|
65 |
*/
|
69 |
/**
|
70 |
* Return activity directory permalink
|
71 |
*
|
72 |
+
* @since BuddyPress (1.5)
|
73 |
*
|
74 |
+
* @uses traisingslashit()
|
75 |
* @uses bp_get_root_domain()
|
76 |
* @uses bp_get_activity_root_slug()
|
77 |
* @uses apply_filters() To call the 'bp_get_activity_directory_permalink' hook.
|
79 |
* @return string Activity directory permalink.
|
80 |
*/
|
81 |
function bp_get_activity_directory_permalink() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
return apply_filters( 'bp_get_activity_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_activity_root_slug() ) );
|
83 |
}
|
84 |
|
87 |
*
|
88 |
* This is responsible for loading a group of activity items and displaying them.
|
89 |
*
|
90 |
+
* @since BuddyPress (1.0)
|
91 |
*/
|
92 |
class BP_Activity_Template {
|
93 |
var $current_activity = -1;
|
171 |
'per_page' => 20,
|
172 |
'page_arg' => 'acpage',
|
173 |
'max' => false,
|
|
|
174 |
'sort' => false,
|
175 |
'include' => false,
|
176 |
'exclude' => false,
|
177 |
'in' => false,
|
178 |
'filter' => false,
|
|
|
179 |
'search_terms' => false,
|
180 |
'meta_query' => false,
|
181 |
'date_query' => false,
|
|
|
182 |
'display_comments' => 'threaded',
|
183 |
'show_hidden' => false,
|
184 |
'spam' => 'ham_only',
|
187 |
$r = wp_parse_args( $args, $defaults );
|
188 |
extract( $r );
|
189 |
|
190 |
+
$this->pag_arg = $r['page_arg'];
|
191 |
+
$this->pag_page = isset( $_REQUEST[ $this->pag_arg ] ) ? intval( $_REQUEST[ $this->pag_arg ] ) : $page;
|
192 |
+
$this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
|
193 |
|
194 |
// Check if blog/forum replies are disabled
|
195 |
$this->disable_blogforum_replies = isset( $bp->site_options['bp-disable-blogforum-comments'] ) ? $bp->site_options['bp-disable-blogforum-comments'] : false;
|
202 |
$this->activities = bp_activity_get_specific( array(
|
203 |
'activity_ids' => explode( ',', $include ),
|
204 |
'max' => $max,
|
|
|
205 |
'page' => $this->pag_page,
|
206 |
'per_page' => $this->pag_num,
|
207 |
'sort' => $sort,
|
216 |
$this->activities = bp_activity_get( array(
|
217 |
'display_comments' => $display_comments,
|
218 |
'max' => $max,
|
|
|
219 |
'per_page' => $this->pag_num,
|
220 |
'page' => $this->pag_page,
|
221 |
'sort' => $sort,
|
222 |
'search_terms' => $search_terms,
|
223 |
'meta_query' => $meta_query,
|
224 |
'date_query' => $date_query,
|
|
|
225 |
'filter' => $filter,
|
|
|
226 |
'show_hidden' => $show_hidden,
|
227 |
'exclude' => $exclude,
|
228 |
'in' => $in,
|
277 |
|
278 |
if ( (int) $this->total_activity_count && (int) $this->pag_num ) {
|
279 |
$this->pag_links = paginate_links( array(
|
280 |
+
'base' => add_query_arg( $page_arg, '%#%' ),
|
281 |
'format' => '',
|
282 |
'total' => ceil( (int) $this->total_activity_count / (int) $this->pag_num ),
|
283 |
'current' => (int) $this->pag_page,
|
284 |
'prev_text' => _x( '←', 'Activity pagination previous text', 'buddypress' ),
|
285 |
'next_text' => _x( '→', 'Activity pagination next text', 'buddypress' ),
|
286 |
+
'mid_size' => 1
|
|
|
287 |
) );
|
288 |
}
|
289 |
}
|
340 |
if ( $this->current_activity + 1 < $this->activity_count ) {
|
341 |
return true;
|
342 |
} elseif ( $this->current_activity + 1 == $this->activity_count ) {
|
343 |
+
do_action('activity_loop_end');
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
// Do some cleaning up after the loop
|
345 |
$this->rewind_activities();
|
346 |
}
|
366 |
if ( is_array( $this->activity ) )
|
367 |
$this->activity = (object) $this->activity;
|
368 |
|
369 |
+
if ( $this->current_activity == 0 ) // loop has just started
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
do_action('activity_loop_start');
|
|
|
371 |
}
|
372 |
}
|
373 |
|
378 |
* $activities_template global, enabling the use of BuddyPress templates and
|
379 |
* template functions to display a list of activity items.
|
380 |
*
|
381 |
+
* @since BuddyPress (1.0)
|
382 |
*
|
383 |
* @global object $activities_template {@link BP_Activity_Template}
|
384 |
* @global object $bp BuddyPress global settings.
|
395 |
* @uses apply_filters() To call the 'bp_has_activities' hook.
|
396 |
*
|
397 |
* @param array $args {
|
398 |
+
* Arguments for limiting the contents of the activity loop. Most
|
399 |
+
* arguments are in the same format as {@link BP_Activity_Activity::get()}.
|
400 |
+
* However, because the format of the arguments accepted here differs in
|
401 |
+
* a number of ways, and because bp_has_activities() determines some
|
402 |
+
* default arguments in a dynamic fashion, we list all accepted arguments
|
403 |
+
* here as well.
|
404 |
+
*
|
405 |
+
* Arguments can be passed as an associative array, or as a URL query
|
406 |
+
* string (eg, 'user_id=4&display_comments=threaded').
|
407 |
+
*
|
408 |
+
* @type int $page Which page of results to fetch. Using page=1 without
|
409 |
+
* per_page will result in no pagination. Default: 1.
|
410 |
+
* @type int|bool $per_page Number of results per page. Default: 20.
|
411 |
+
* @type string $page_arg The string used as a query parameter in
|
412 |
+
* pagination links. Default: 'acpage'.
|
413 |
+
* @type int|bool $max Maximum number of results to return.
|
414 |
+
* Default: false (unlimited).
|
415 |
+
* @type string $sort 'ASC' or 'DESC'. Default: 'DESC'.
|
416 |
+
* @type array|bool $exclude Array of activity IDs to exclude. Default: false.
|
417 |
+
* @type array|bool $in Array of IDs to limit query by (IN). 'in' is
|
418 |
+
* intended to be used in conjunction with other filter parameters.
|
419 |
+
* Default: false.
|
420 |
+
* @type array|bool $include Array of exact activity IDs to query.
|
421 |
+
* Providing an 'include' array will override all other filters
|
422 |
+
* passed in the argument array. When viewing a the permalink page
|
423 |
+
* for a single activity item, this value defaults to the ID of that
|
424 |
+
* item. Otherwise the default is false.
|
425 |
+
* @type array $meta_query Limit by activitymeta by passing an array of
|
426 |
+
* meta_query conditions. See {@link WP_Meta_Query::queries} for a
|
427 |
+
* description of the syntax.
|
428 |
+
* @type string $search_terms Limit results by a search term. Default: false.
|
429 |
+
* @type string|bool $scope Use one of BuddyPress's pre-built filters. In
|
430 |
+
* each case, the term 'current user' refers to the displayed user
|
431 |
+
* when looking at a user profile, and otherwise to the logged-in user.
|
432 |
+
* - 'just-me' retrieves items belonging only to the logged-in user;
|
433 |
+
* this is equivalent to passing a 'user_id' argument
|
434 |
+
* - 'friends' retrieves items belonging to the friends of the
|
435 |
+
* current user
|
436 |
+
* - 'groups' retrieves items associated with the groups to which
|
437 |
+
* the current user belongs
|
438 |
+
* - 'favorites' retrieves the current user's favorited activity
|
439 |
+
* items
|
440 |
+
* - 'mentions' retrieves activity items where the current user has
|
441 |
+
* received an @-mention
|
442 |
+
* The default value of 'scope' is set to one of the above if that
|
443 |
+
* value appears in the appropriate place in the URL; eg, 'scope' will
|
444 |
+
* be 'groups' when visiting http://example.com/members/joe/activity/groups/.
|
445 |
+
* Otherwise defaults to false.
|
446 |
+
* @type int|array|bool $user_id The ID(s) of user(s) whose activity should
|
447 |
+
* be fetched. Pass a single ID or an array of IDs. When viewing a
|
448 |
+
* user profile page (but not that user's activity subpages, ie My
|
449 |
+
* Friends, My Groups, etc), 'user_id' defaults to the ID of the
|
450 |
+
* displayed user. Otherwise the default is false.
|
451 |
+
* @type string|array|bool $object Filters by the `component` column in the
|
452 |
+
* database, which is generally the component ID in the case of
|
453 |
+
* BuddyPress components, or the plugin slug in the case of plugins.
|
454 |
+
* For example, 'groups' will limit results to those that are
|
455 |
+
* associated with the BP Groups component. Accepts a single
|
456 |
+
* component string, or an array of multiple components. Defaults to
|
457 |
+
* 'groups' when viewing the page of a single group, the My Groups
|
458 |
+
* activity filter, or the Activity > Groups filter of a user profile.
|
459 |
+
* Otherwise defaults to false.
|
460 |
+
* @type string|array|bool $action Filters by the `type` column in the
|
461 |
+
* database, which is a string categorizing the activity item (eg,
|
462 |
+
* 'new_blog_post', 'created_group'). Accepts a single type string,
|
463 |
+
* or an array of multiple types. Defaults to false.
|
464 |
+
* @type int|array|bool $primary_id Filters by the `item_id` column in the
|
465 |
+
* database. The meaning of 'primary_id' differs between components/
|
466 |
+
* types; for example, in the case of 'created_group', 'primary_id'
|
467 |
+
* is the ID of the group. Accepts a single ID, or an array of
|
468 |
+
* multiple IDs. When viewing a single group, defaults to the current
|
469 |
+
* group ID. When viewing a user's Groups stream page, defaults to
|
470 |
+
* the IDs of the user's groups. Otherwise defaults to false.
|
471 |
+
* @type int|array|bool $secondary_id Filters by the `secondary_item_id`
|
472 |
+
* column in the database. The meaning of 'secondary_id' differs
|
473 |
+
* between components/types. Accepts a single ID, or an array of
|
474 |
+
* multiple IDs. Defaults to false.
|
475 |
+
* @type int $offset Return only activity items with an ID greater than or
|
476 |
+
* equal to this one. Note that providing an offset will disable
|
477 |
+
* pagination. Default: false.
|
478 |
+
* @type string|bool $display_comments How to handle activity comments.
|
479 |
+
* Possible values:
|
480 |
+
* - 'threaded' - comments appear in a threaded tree, under their
|
481 |
+
* parent items
|
482 |
+
* - 'stream' - the activity stream is presented in a flat manner,
|
483 |
+
* with comments sorted in chronological order alongside other
|
484 |
+
* activity items
|
485 |
+
* - false - don't fetch activity comments at all
|
486 |
+
* Default: 'threaded'.
|
487 |
+
* @type bool $show_hidden Whether to show items marked hide_sitewide.
|
488 |
+
* Defaults to false, except in the following cases:
|
489 |
+
* - User is viewing his own activity stream
|
490 |
+
* - User is viewing the activity stream of a non-public group of
|
491 |
+
* which he is a member
|
492 |
+
* @type bool $show_hidden Normally defaults to false, except when:
|
493 |
+
* - a user is viewing his own activity stream
|
494 |
+
* - a user is viewing the activity stream of a non-public group of
|
495 |
+
* which he is a member
|
496 |
+
* @type string|bool $spam Spam status. 'ham_only', 'spam_only', or false
|
497 |
+
* to show all activity regardless of spam status. Default: 'ham_only'.
|
498 |
+
* @type bool $populate_extras Whether to pre-fetch the activity metadata
|
499 |
+
* for the queried items. Default: true.
|
500 |
* }
|
501 |
* @return bool Returns true when activities are found, otherwise false.
|
502 |
*/
|
551 |
'page' => 1, // which page to load
|
552 |
'per_page' => 20, // number of items per page
|
553 |
'max' => false, // max number to return
|
|
|
554 |
'show_hidden' => $show_hidden, // Show activity items that are hidden site-wide?
|
555 |
'spam' => 'ham_only', // Hide spammed items
|
556 |
|
570 |
|
571 |
'meta_query' => false, // filter on activity meta. See WP_Meta_Query for format
|
572 |
'date_query' => false, // filter by date. See first parameter of WP_Date_Query for format
|
|
|
573 |
|
574 |
// Searching
|
575 |
'search_terms' => false, // specify terms to search on
|
591 |
$page = 0;
|
592 |
}
|
593 |
|
|
|
594 |
if ( empty( $search_terms ) && ! empty( $_REQUEST['s'] ) )
|
595 |
$search_terms = $_REQUEST['s'];
|
596 |
|
597 |
+
// If you have passed a "scope" then this will override any filters you have passed.
|
598 |
+
if ( 'just-me' == $scope || 'friends' == $scope || 'groups' == $scope || 'favorites' == $scope || 'mentions' == $scope ) {
|
599 |
+
if ( 'just-me' == $scope )
|
600 |
+
$display_comments = 'stream';
|
601 |
+
|
602 |
+
// determine which user_id applies
|
603 |
+
if ( empty( $user_id ) )
|
604 |
+
$user_id = bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id();
|
605 |
+
|
606 |
+
// are we displaying user specific activity?
|
607 |
+
if ( is_numeric( $user_id ) ) {
|
608 |
+
$show_hidden = ( $user_id == bp_loggedin_user_id() && $scope != 'friends' ) ? 1 : 0;
|
609 |
+
|
610 |
+
switch ( $scope ) {
|
611 |
+
case 'friends':
|
612 |
+
if ( bp_is_active( 'friends' ) )
|
613 |
+
$friends = friends_get_friend_user_ids( $user_id );
|
614 |
+
if ( empty( $friends ) )
|
615 |
+
return false;
|
616 |
+
|
617 |
+
$user_id = implode( ',', (array) $friends );
|
618 |
+
break;
|
619 |
+
case 'groups':
|
620 |
+
if ( bp_is_active( 'groups' ) ) {
|
621 |
+
$groups = groups_get_user_groups( $user_id );
|
622 |
+
if ( empty( $groups['groups'] ) )
|
623 |
+
return false;
|
624 |
+
|
625 |
+
$object = $bp->groups->id;
|
626 |
+
$primary_id = implode( ',', (array) $groups['groups'] );
|
627 |
+
|
628 |
+
$user_id = 0;
|
629 |
+
}
|
630 |
+
break;
|
631 |
+
case 'favorites':
|
632 |
+
$favs = bp_activity_get_user_favorites( $user_id );
|
633 |
+
if ( empty( $favs ) )
|
634 |
+
return false;
|
635 |
+
|
636 |
+
$in = implode( ',', (array) $favs );
|
637 |
+
$display_comments = true;
|
638 |
+
$user_id = 0;
|
639 |
+
break;
|
640 |
+
case 'mentions':
|
641 |
+
|
642 |
+
// Are mentions disabled?
|
643 |
+
if ( ! bp_activity_do_mentions() ) {
|
644 |
+
return false;
|
645 |
+
}
|
646 |
+
|
647 |
+
// Start search at @ symbol and stop search at closing tag delimiter.
|
648 |
+
$search_terms = '@' . bp_activity_get_user_mentionname( $user_id ) . '<';
|
649 |
+
$display_comments = 'stream';
|
650 |
+
$user_id = 0;
|
651 |
+
break;
|
652 |
+
}
|
653 |
+
}
|
654 |
+
}
|
655 |
+
|
656 |
// Do not exceed the maximum per page
|
657 |
if ( !empty( $max ) && ( (int) $per_page > (int) $max ) )
|
658 |
$per_page = $max;
|
659 |
|
660 |
+
// Support for basic filters in earlier BP versions is disabled by default. To enable, put
|
661 |
+
// add_filter( 'bp_activity_enable_afilter_support', '__return_true' );
|
662 |
+
// into bp-custom.php or your theme's functions.php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
663 |
if ( isset( $_GET['afilter'] ) && apply_filters( 'bp_activity_enable_afilter_support', false ) )
|
664 |
$filter = array( 'object' => $_GET['afilter'] );
|
665 |
+
else if ( ! empty( $user_id ) || ! empty( $object ) || ! empty( $action ) || ! empty( $primary_id ) || ! empty( $secondary_id ) || ! empty( $offset ) || ! empty( $since ) )
|
666 |
$filter = array( 'user_id' => $user_id, 'object' => $object, 'action' => $action, 'primary_id' => $primary_id, 'secondary_id' => $secondary_id, 'offset' => $offset, 'since' => $since );
|
667 |
else
|
668 |
$filter = false;
|
676 |
'per_page' => $per_page,
|
677 |
'page_arg' => $page_arg,
|
678 |
'max' => $max,
|
|
|
679 |
'sort' => $sort,
|
680 |
'include' => $include,
|
681 |
'exclude' => $exclude,
|
682 |
'in' => $in,
|
683 |
'filter' => $filter,
|
|
|
684 |
'search_terms' => $search_terms,
|
685 |
'meta_query' => $meta_query,
|
686 |
'date_query' => $date_query,
|
|
|
687 |
'display_comments' => $display_comments,
|
688 |
'show_hidden' => $show_hidden,
|
689 |
'spam' => $spam,
|
692 |
|
693 |
$activities_template = new BP_Activity_Template( $template_args );
|
694 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
695 |
return apply_filters( 'bp_has_activities', $activities_template->has_activities(), $activities_template, $template_args );
|
696 |
}
|
697 |
|
698 |
/**
|
699 |
* Determine if there are still activities left in the loop.
|
700 |
*
|
701 |
+
* @since BuddyPress (1.0)
|
702 |
*
|
703 |
* @global object $activities_template {@link BP_Activity_Template}
|
704 |
* @uses BP_Activity_Template::user_activities() {@link BP_Activity_Template::user_activities()}
|
713 |
/**
|
714 |
* Get the current activity object in the loop.
|
715 |
*
|
716 |
+
* @since BuddyPress (1.0)
|
717 |
*
|
718 |
* @global object $activities_template {@link BP_Activity_Template}
|
719 |
* @uses BP_Activity_Template::the_activity() {@link BP_Activity_Template::the_activity()}
|
731 |
* @since BuddyPress (2.1.0)
|
732 |
*/
|
733 |
function bp_activity_load_more_link() {
|
734 |
+
echo bp_get_activity_load_more_link();
|
735 |
}
|
|
|
|
|
|
|
|
|
|
|
736 |
function bp_get_activity_load_more_link() {
|
737 |
global $activities_template;
|
738 |
|
739 |
+
$link = bp_get_requested_url();
|
740 |
+
$link = add_query_arg( $activities_template->pag_arg, $activities_template->pag_page + 1, $link );
|
741 |
|
742 |
+
return apply_filters( 'bp_get_activity_load_more_link', $link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
743 |
}
|
744 |
|
745 |
/**
|
746 |
* Output the activity pagination count.
|
747 |
*
|
748 |
+
* @since BuddyPress (1.0)
|
749 |
*
|
750 |
* @global object $activities_template {@link BP_Activity_Template}
|
751 |
* @uses BP_Activity_Template::the_activity() {@link BP_Activity_Template::the_activity()}
|
757 |
/**
|
758 |
* Return the activity pagination count.
|
759 |
*
|
760 |
+
* @since BuddyPress (1.2)
|
761 |
*
|
762 |
* @global object $activities_template {@link BP_Activity_Template}
|
763 |
* @uses bp_core_number_format()
|
778 |
/**
|
779 |
* Output the activity pagination links.
|
780 |
*
|
781 |
+
* @since BuddyPress (1.0)
|
782 |
*
|
783 |
* @uses bp_get_activity_pagination_links()
|
784 |
*/
|
789 |
/**
|
790 |
* Return the activity pagination links.
|
791 |
*
|
792 |
+
* @since BuddyPress (1.0)
|
793 |
*
|
794 |
* @global object $activities_template {@link BP_Activity_Template}
|
795 |
* @uses apply_filters() To call the 'bp_get_activity_pagination_links' hook.
|
799 |
function bp_get_activity_pagination_links() {
|
800 |
global $activities_template;
|
801 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
802 |
return apply_filters( 'bp_get_activity_pagination_links', $activities_template->pag_links );
|
803 |
}
|
804 |
|
805 |
/**
|
806 |
* Return true when there are more activity items to be shown than currently appear.
|
807 |
*
|
808 |
+
* @since BuddyPress (1.5)
|
809 |
*
|
810 |
* @global object $activities_template {@link BP_Activity_Template}
|
811 |
* @uses apply_filters() To call the 'bp_activity_has_more_items' hook.
|
827 |
$has_more_items = (int) $remaining_pages > 0;
|
828 |
}
|
829 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
830 |
return apply_filters( 'bp_activity_has_more_items', $has_more_items );
|
831 |
}
|
832 |
|
833 |
/**
|
834 |
* Output the activity count.
|
835 |
*
|
836 |
+
* @since BuddyPress (1.2)
|
837 |
*
|
838 |
* @uses bp_get_activity_count()
|
839 |
*/
|
844 |
/**
|
845 |
* Return the activity count.
|
846 |
*
|
847 |
+
* @since BuddyPress (1.2)
|
848 |
*
|
849 |
* @global object $activities_template {@link BP_Activity_Template}
|
850 |
* @uses apply_filters() To call the 'bp_get_activity_count' hook.
|
854 |
function bp_get_activity_count() {
|
855 |
global $activities_template;
|
856 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
857 |
return apply_filters( 'bp_get_activity_count', (int) $activities_template->activity_count );
|
858 |
}
|
859 |
|
860 |
/**
|
861 |
* Output the number of activities per page.
|
862 |
*
|
863 |
+
* @since BuddyPress (1.2)
|
864 |
*
|
865 |
* @uses bp_get_activity_per_page()
|
866 |
*/
|
871 |
/**
|
872 |
* Return the number of activities per page.
|
873 |
*
|
874 |
+
* @since BuddyPress (1.2)
|
875 |
*
|
876 |
* @global object $activities_template {@link BP_Activity_Template}
|
877 |
* @uses apply_filters() To call the 'bp_get_activity_per_page' hook.
|
881 |
function bp_get_activity_per_page() {
|
882 |
global $activities_template;
|
883 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
884 |
return apply_filters( 'bp_get_activity_per_page', (int) $activities_template->pag_num );
|
885 |
}
|
886 |
|
887 |
/**
|
888 |
* Output the activities title.
|
889 |
*
|
890 |
+
* @since BuddyPress (1.0)
|
891 |
*
|
892 |
* @uses bp_get_activities_title()
|
893 |
* @todo Deprecate.
|
899 |
/**
|
900 |
* Return the activities title.
|
901 |
*
|
902 |
+
* @since BuddyPress (1.0)
|
903 |
*
|
904 |
* @global string $bp_activity_title
|
905 |
* @uses apply_filters() To call the 'bp_get_activities_title' hook.
|
906 |
* @todo Deprecate.
|
907 |
*
|
908 |
+
* @return int The activities title.
|
909 |
*/
|
910 |
function bp_get_activities_title() {
|
911 |
global $bp_activity_title;
|
912 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
913 |
return apply_filters( 'bp_get_activities_title', $bp_activity_title );
|
914 |
}
|
915 |
|
916 |
/**
|
917 |
* {@internal Missing Description}
|
918 |
*
|
919 |
+
* @since BuddyPress (1.0)
|
920 |
*
|
921 |
* @uses bp_get_activities_no_activity()
|
922 |
* @todo Deprecate.
|
928 |
/**
|
929 |
* {@internal Missing Description}
|
930 |
*
|
931 |
+
* @since BuddyPress (1.0)
|
932 |
*
|
933 |
* @global string $bp_activity_no_activity
|
934 |
* @uses apply_filters() To call the 'bp_get_activities_no_activity' hook
|
939 |
function bp_get_activities_no_activity() {
|
940 |
global $bp_activity_no_activity;
|
941 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
942 |
return apply_filters( 'bp_get_activities_no_activity', $bp_activity_no_activity );
|
943 |
}
|
944 |
|
945 |
/**
|
946 |
* Output the activity ID.
|
947 |
*
|
948 |
+
* @since BuddyPress (1.2)
|
949 |
*
|
950 |
* @uses bp_get_activity_id()
|
951 |
*/
|
956 |
/**
|
957 |
* Return the activity ID.
|
958 |
*
|
959 |
+
* @since BuddyPress (1.2)
|
960 |
*
|
961 |
* @global object $activities_template {@link BP_Activity_Template}
|
962 |
* @uses apply_filters() To call the 'bp_get_activity_id' hook.
|
965 |
*/
|
966 |
function bp_get_activity_id() {
|
967 |
global $activities_template;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
968 |
return apply_filters( 'bp_get_activity_id', $activities_template->activity->id );
|
969 |
}
|
970 |
|
971 |
/**
|
972 |
* Output the activity item ID.
|
973 |
*
|
974 |
+
* @since BuddyPress (1.2)
|
975 |
*
|
976 |
* @uses bp_get_activity_item_id()
|
977 |
*/
|
982 |
/**
|
983 |
* Return the activity item ID.
|
984 |
*
|
985 |
+
* @since BuddyPress (1.2)
|
986 |
*
|
987 |
* @global object $activities_template {@link BP_Activity_Template}
|
988 |
* @uses apply_filters() To call the 'bp_get_activity_item_id' hook.
|
991 |
*/
|
992 |
function bp_get_activity_item_id() {
|
993 |
global $activities_template;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
994 |
return apply_filters( 'bp_get_activity_item_id', $activities_template->activity->item_id );
|
995 |
}
|
996 |
|
997 |
/**
|
998 |
* Output the activity secondary item ID.
|
999 |
*
|
1000 |
+
* @since BuddyPress (1.2)
|
1001 |
*
|
1002 |
* @uses bp_get_activity_secondary_item_id()
|
1003 |
*/
|
1008 |
/**
|
1009 |
* Return the activity secondary item ID.
|
1010 |
*
|
1011 |
+
* @since BuddyPress (1.2)
|
1012 |
*
|
1013 |
* @global object $activities_template {@link BP_Activity_Template}
|
1014 |
* @uses apply_filters() To call the 'bp_get_activity_secondary_item_id' hook.
|
1017 |
*/
|
1018 |
function bp_get_activity_secondary_item_id() {
|
1019 |
global $activities_template;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1020 |
return apply_filters( 'bp_get_activity_secondary_item_id', $activities_template->activity->secondary_item_id );
|
1021 |
}
|
1022 |
|
1023 |
/**
|
1024 |
* Output the date the activity was recorded.
|
1025 |
*
|
1026 |
+
* @since BuddyPress (1.2)
|
1027 |
*
|
1028 |
* @uses bp_get_activity_date_recorded()
|
1029 |
*/
|
1034 |
/**
|
1035 |
* Return the date the activity was recorded.
|
1036 |
*
|
1037 |
+
* @since BuddyPress (1.2)
|
1038 |
*
|
1039 |
* @global object $activities_template {@link BP_Activity_Template}
|
1040 |
* @uses apply_filters() To call the 'bp_get_activity_date_recorded' hook.
|
1043 |
*/
|
1044 |
function bp_get_activity_date_recorded() {
|
1045 |
global $activities_template;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1046 |
return apply_filters( 'bp_get_activity_date_recorded', $activities_template->activity->date_recorded );
|
1047 |
}
|
1048 |
|
1074 |
? $activities_template->activity->display_name
|
1075 |
: '';
|
1076 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1077 |
return apply_filters( 'bp_get_activity_member_display_name', $retval );
|
1078 |
}
|
1079 |
|
1080 |
/**
|
1081 |
* Output the activity object name.
|
1082 |
*
|
1083 |
+
* @since BuddyPress (1.2)
|
1084 |
*
|
1085 |
* @uses bp_get_activity_object_name()
|
1086 |
*/
|
1091 |
/**
|
1092 |
* Return the activity object name.
|
1093 |
*
|
1094 |
+
* @since BuddyPress (1.2)
|
1095 |
*
|
1096 |
* @global object $activities_template {@link BP_Activity_Template}
|
1097 |
* @uses apply_filters() To call the 'bp_get_activity_object_name' hook.
|
1100 |
*/
|
1101 |
function bp_get_activity_object_name() {
|
1102 |
global $activities_template;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1103 |
return apply_filters( 'bp_get_activity_object_name', $activities_template->activity->component );
|
1104 |
}
|
1105 |
|
1106 |
/**
|
1107 |
* Output the activity type.
|
1108 |
*
|
1109 |
+
* @since BuddyPress (1.2)
|
1110 |
*
|
1111 |
* @uses bp_get_activity_type()
|
1112 |
*/
|
1117 |
/**
|
1118 |
* Return the activity type.
|
1119 |
*
|
1120 |
+
* @since BuddyPress (1.2)
|
1121 |
*
|
1122 |
* @global object $activities_template {@link BP_Activity_Template}
|
1123 |
* @uses apply_filters() To call the 'bp_get_activity_type' hook.
|
1126 |
*/
|
1127 |
function bp_get_activity_type() {
|
1128 |
global $activities_template;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1129 |
return apply_filters( 'bp_get_activity_type', $activities_template->activity->type );
|
1130 |
}
|
1131 |
|
1134 |
*
|
1135 |
* Just a wrapper for bp_activity_type().
|
1136 |
*
|
1137 |
+
* @since BuddyPress (1.2)
|
1138 |
+
* @deprecated BuddyPress (1.5)
|
1139 |
*
|
1140 |
* @todo Properly deprecate in favor of bp_activity_type() and
|
1141 |
* remove redundant echo
|
1149 |
*
|
1150 |
* Just a wrapper for bp_get_activity_type().
|
1151 |
*
|
1152 |
+
* @since BuddyPress (1.2)
|
1153 |
+
* @deprecated BuddyPress (1.5)
|
1154 |
*
|
1155 |
* @todo Properly deprecate in favor of bp_get_activity_type().
|
1156 |
*
|
1163 |
/**
|
1164 |
* Output the activity user ID.
|
1165 |
*
|
1166 |
+
* @since BuddyPress (1.1)
|
1167 |
*
|
1168 |
* @uses bp_get_activity_user_id()
|
1169 |
*/
|
1174 |
/**
|
1175 |
* Return the activity user ID.
|
1176 |
*
|
1177 |
+
* @since BuddyPress (1.1)
|
1178 |
*
|
1179 |
* @global object $activities_template {@link BP_Activity_Template}
|
1180 |
* @uses apply_filters() To call the 'bp_get_activity_user_id' hook.
|
1183 |
*/
|
1184 |
function bp_get_activity_user_id() {
|
1185 |
global $activities_template;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1186 |
return apply_filters( 'bp_get_activity_user_id', $activities_template->activity->user_id );
|
1187 |
}
|
1188 |
|
1189 |
/**
|
1190 |
* Output the activity user link.
|
1191 |
*
|
1192 |
+
* @since BuddyPress (1.2)
|
1193 |
*
|
1194 |
* @uses bp_get_activity_user_link()
|
1195 |
*/
|
1200 |
/**
|
1201 |
* Return the activity user link.
|
1202 |
*
|
1203 |
+
* @since BuddyPress (1.2)
|
1204 |
*
|
1205 |
* @global object $activities_template {@link BP_Activity_Template}
|
1206 |
* @uses bp_core_get_user_domain()
|
1217 |
$link = bp_core_get_user_domain( $activities_template->activity->user_id, $activities_template->activity->user_nicename, $activities_template->activity->user_login );
|
1218 |
}
|
1219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1220 |
return apply_filters( 'bp_get_activity_user_link', $link );
|
1221 |
}
|
1222 |
|
1223 |
/**
|
1224 |
* Output the avatar of the user that performed the action.
|
1225 |
*
|
1226 |
+
* @since BuddyPress (1.1)
|
1227 |
*
|
1228 |
* @see bp_get_activity_avatar() for description of arguments.
|
1229 |
* @uses bp_get_activity_avatar()
|
1236 |
/**
|
1237 |
* Return the avatar of the user that performed the action.
|
1238 |
*
|
1239 |
+
* @since BuddyPress (1.1)
|
1240 |
*
|
1241 |
* @see bp_core_fetch_avatar() For a description of the arguments.
|
1242 |
* @global object $activities_template {@link BP_Activity_Template}
|
1309 |
}
|
1310 |
}
|
1311 |
|
1312 |
+
// Primary activity avatar is always a user, but can be modified via a filter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1313 |
$object = apply_filters( 'bp_get_activity_avatar_object_' . $current_activity_item->component, 'user' );
|
1314 |
$item_id = !empty( $user_id ) ? $user_id : $current_activity_item->user_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1315 |
$item_id = apply_filters( 'bp_get_activity_avatar_item_id', $item_id );
|
1316 |
|
1317 |
+
// If this is a user object pass the users' email address for Gravatar so we don't have to refetch it.
|
1318 |
if ( 'user' == $object && empty( $user_id ) && empty( $email ) && isset( $current_activity_item->user_email ) )
|
1319 |
$email = $current_activity_item->user_email;
|
1320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1321 |
return apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array(
|
1322 |
'item_id' => $item_id,
|
1323 |
'object' => $object,
|
1333 |
/**
|
1334 |
* Output the avatar of the object that action was performed on.
|
1335 |
*
|
1336 |
+
* @since BuddyPress (1.2)
|
1337 |
*
|
1338 |
* @see bp_get_activity_secondary_avatar() for description of arguments.
|
1339 |
* @uses bp_get_activity_secondary_avatar()
|
1347 |
/**
|
1348 |
* Return the avatar of the object that action was performed on
|
1349 |
*
|
1350 |
+
* @since BuddyPress (1.2)
|
1351 |
*
|
1352 |
* @see bp_core_fetch_avatar() for description of arguments.
|
1353 |
* @global object $activities_template {@link BP_Activity_Template}
|
1446 |
break;
|
1447 |
}
|
1448 |
|
1449 |
+
// Allow object, item_id, and link to be filtered
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1450 |
$object = apply_filters( 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component, $object );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1451 |
$item_id = apply_filters( 'bp_get_activity_secondary_avatar_item_id', $item_id );
|
1452 |
|
1453 |
// If we have no item_id or object, there is no avatar to display
|
1468 |
) );
|
1469 |
|
1470 |
if ( !empty( $linked ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1471 |
$link = apply_filters( 'bp_get_activity_secondary_avatar_link', $link, $activities_template->activity->component );
|
1472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1473 |
return sprintf( '<a href="%s" class="%s">%s</a>',
|
1474 |
$link,
|
1475 |
$link_class,
|
1476 |
+
apply_filters( 'bp_get_activity_secondary_avatar', $avatar )
|
1477 |
);
|
1478 |
}
|
1479 |
|
1480 |
+
// else
|
1481 |
return apply_filters( 'bp_get_activity_secondary_avatar', $avatar );
|
1482 |
}
|
1483 |
|
1484 |
/**
|
1485 |
* Output the activity action
|
1486 |
*
|
1487 |
+
* @since BuddyPress (1.2)
|
1488 |
*
|
1489 |
* @param array $args See bp_get_activity_action()
|
1490 |
* @uses bp_get_activity_action()
|
1496 |
/**
|
1497 |
* Return the activity action
|
1498 |
*
|
1499 |
+
* @since BuddyPress (1.2)
|
1500 |
*
|
1501 |
* @global object $activities_template {@link BP_Activity_Template}
|
1502 |
* @param array $args Only parameter is "no_timestamp". If true, timestamp is shown in output.
|
1520 |
extract( $args, EXTR_SKIP );
|
1521 |
|
1522 |
$action = $activities_template->activity->action;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1523 |
$action = apply_filters_ref_array( 'bp_get_activity_action_pre_meta', array( $action, &$activities_template->activity, $args ) );
|
1524 |
|
1525 |
if ( ! empty( $action ) && ! $no_timestamp )
|
1526 |
$action = bp_insert_activity_meta( $action );
|
1527 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1528 |
return apply_filters_ref_array( 'bp_get_activity_action', array( $action, &$activities_template->activity, $args ) );
|
1529 |
}
|
1530 |
|
1531 |
/**
|
1532 |
* Output the activity content body
|
1533 |
*
|
1534 |
+
* @since BuddyPress (1.2)
|
1535 |
*
|
1536 |
* @uses bp_get_activity_content_body()
|
1537 |
*/
|
1542 |
/**
|
1543 |
* Return the activity content body
|
1544 |
*
|
1545 |
+
* @since BuddyPress (1.2)
|
1546 |
*
|
1547 |
* @global object $activities_template {@link BP_Activity_Template}
|
1548 |
* @uses bp_insert_activity_meta()
|
1557 |
if ( empty( $activities_template->activity->action ) && !empty( $activities_template->activity->content ) )
|
1558 |
$activities_template->activity->content = bp_insert_activity_meta( $activities_template->activity->content );
|
1559 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1560 |
return apply_filters_ref_array( 'bp_get_activity_content_body', array( $activities_template->activity->content, &$activities_template->activity ) );
|
1561 |
}
|
1562 |
|
1563 |
/**
|
1564 |
* Does the activity have content?
|
1565 |
*
|
1566 |
+
* @since BuddyPress (1.2)
|
1567 |
*
|
1568 |
* @global object $activities_template {@link BP_Activity_Template}
|
1569 |
*
|
1581 |
/**
|
1582 |
* Output the activity content.
|
1583 |
*
|
1584 |
+
* @since BuddyPress (1.0)
|
1585 |
+
* @deprecated BuddyPress (1.5)
|
1586 |
*
|
1587 |
* @todo properly deprecate this function.
|
1588 |
*
|
1595 |
/**
|
1596 |
* Return the activity content.
|
1597 |
*
|
1598 |
+
* @since BuddyPress (1.0)
|
1599 |
+
* @deprecated BuddyPress (1.5)
|
1600 |
*
|
1601 |
* @todo properly deprecate this function.
|
1602 |
*
|
1607 |
* @return string The activity content.
|
1608 |
*/
|
1609 |
function bp_get_activity_content() {
|
|
|
1610 |
/**
|
1611 |
* If you want to filter activity update content, please use
|
1612 |
* the filter 'bp_get_activity_content_body'
|
1613 |
*
|
1614 |
+
* This function is mainly for backwards comptibility.
|
1615 |
*/
|
1616 |
+
|
1617 |
$content = bp_get_activity_action() . ' ' . bp_get_activity_content_body();
|
1618 |
return apply_filters( 'bp_get_activity_content', $content );
|
1619 |
}
|
1624 |
* This metadata includes the time since the item was posted (which will appear
|
1625 |
* as a link to the item's permalink).
|
1626 |
*
|
1627 |
+
* @since BuddyPress (1.2)
|
1628 |
*
|
1629 |
* @global object $activities_template {@link BP_Activity_Template}
|
1630 |
* @uses bp_core_time_since()
|
1644 |
// Strip any legacy time since placeholders from BP 1.0-1.1
|
1645 |
$content = str_replace( '<span class="time-since">%s</span>', '', $content );
|
1646 |
|
1647 |
+
// Insert the time since.
|
|
|
|
|
|
|
|
|
|
|
|
|
1648 |
$time_since = apply_filters_ref_array( 'bp_activity_time_since', array( '<span class="time-since">' . bp_core_time_since( $activities_template->activity->date_recorded ) . '</span>', &$activities_template->activity ) );
|
1649 |
|
1650 |
// Insert the permalink
|
1651 |
+
if ( !bp_is_single_activity() )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1652 |
$content = apply_filters_ref_array( 'bp_activity_permalink', array( sprintf( '%1$s <a href="%2$s" class="view activity-time-since" title="%3$s">%4$s</a>', $content, bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ), esc_attr__( 'View Discussion', 'buddypress' ), $time_since ), &$activities_template->activity ) );
|
1653 |
+
else
|
1654 |
$content .= str_pad( $time_since, strlen( $time_since ) + 2, ' ', STR_PAD_BOTH );
|
|
|
1655 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1656 |
return apply_filters( 'bp_insert_activity_meta', $content );
|
1657 |
}
|
1658 |
|
1659 |
/**
|
1660 |
* Determine if the current user can delete an activity item.
|
1661 |
*
|
1662 |
+
* @since BuddyPress (1.2)
|
1663 |
*
|
1664 |
* @global object $activities_template {@link BP_Activity_Template}
|
1665 |
* @uses apply_filters() To call the 'bp_activity_user_can_delete' hook
|
1704 |
}
|
1705 |
}
|
1706 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1707 |
return (bool) apply_filters( 'bp_activity_user_can_delete', $can_delete, $activity );
|
1708 |
}
|
1709 |
|
1710 |
/**
|
1711 |
* Output the activity parent content.
|
1712 |
*
|
1713 |
+
* @since BuddyPress (1.2)
|
1714 |
*
|
1715 |
* @see bp_get_activity_parent_content() for a description of arguments.
|
1716 |
* @uses bp_get_activity_parent_content()
|
1724 |
/**
|
1725 |
* Return the activity content.
|
1726 |
*
|
1727 |
+
* @since BuddyPress (1.2)
|
1728 |
*
|
1729 |
* @global object $activities_template {@link BP_Activity_Template}
|
1730 |
* @uses wp_parse_args()
|
1771 |
// Remove images
|
1772 |
$content = preg_replace( '/<img[^>]*>/Ui', '', $content );
|
1773 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1774 |
return apply_filters( 'bp_get_activity_parent_content', $content );
|
1775 |
}
|
1776 |
|
1777 |
/**
|
1778 |
* Output the parent activity's user ID.
|
1779 |
*
|
1780 |
+
* @since BuddyPress (1.7)
|
1781 |
*/
|
1782 |
function bp_activity_parent_user_id() {
|
1783 |
echo bp_get_activity_parent_user_id();
|
1786 |
/**
|
1787 |
* Return the parent activity's user ID.
|
1788 |
*
|
1789 |
+
* @since BuddyPress (1.7)
|
1790 |
*
|
1791 |
* @global BP_Activity_Template $activities_template
|
1792 |
*
|
1814 |
|
1815 |
$retval = $activities_template->activity_parents[$parent_id]->user_id;
|
1816 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1817 |
return (int) apply_filters( 'bp_get_activity_parent_user_id', $retval );
|
1818 |
}
|
1819 |
|
1820 |
/**
|
1821 |
* Output whether or not the current activity is in a current user's favorites.
|
1822 |
*
|
1823 |
+
* @since BuddyPress (1.2)
|
1824 |
*
|
1825 |
* @uses bp_get_activity_is_favorite()
|
1826 |
*/
|
1831 |
/**
|
1832 |
* Return whether the current activity is in a current user's favorites.
|
1833 |
*
|
1834 |
+
* @since BuddyPress (1.2)
|
1835 |
*
|
1836 |
* @global object $activities_template {@link BP_Activity_Template}
|
1837 |
* @uses apply_filters() To call the 'bp_get_activity_is_favorite' hook.
|
1841 |
function bp_get_activity_is_favorite() {
|
1842 |
global $activities_template;
|
1843 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1844 |
return (bool) apply_filters( 'bp_get_activity_is_favorite', in_array( $activities_template->activity->id, (array) $activities_template->my_favs ) );
|
1845 |
}
|
1846 |
|
1847 |
/**
|
1848 |
* Output the comment markup for an activity item.
|
1849 |
*
|
1850 |
+
* @since BuddyPress (1.2)
|
1851 |
*
|
1852 |
* @todo deprecate $args param
|
1853 |
*
|
1860 |
/**
|
1861 |
* Get the comment markup for an activity item.
|
1862 |
*
|
1863 |
+
* @since BuddyPress (1.2)
|
1864 |
*
|
1865 |
* @todo deprecate $args param
|
1866 |
*
|
1887 |
* Note: The recursion itself used to happen entirely in this function. Now it is
|
1888 |
* split between here and the comment.php template.
|
1889 |
*
|
1890 |
+
* @since BuddyPress (1.2)
|
1891 |
*
|
1892 |
* @param object $comment The activity object currently being recursed
|
1893 |
*
|
1903 |
if ( empty( $comment->children ) )
|
1904 |
return false;
|
1905 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1906 |
echo apply_filters( 'bp_activity_recurse_comments_start_ul', '<ul>');
|
1907 |
foreach ( (array) $comment->children as $comment_child ) {
|
1908 |
// Put the comment into the global so it's available to filters
|
1922 |
|
1923 |
unset( $activities_template->activity->current_comment );
|
1924 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1925 |
echo apply_filters( 'bp_activity_recurse_comments_end_ul', '</ul>');
|
1926 |
}
|
1927 |
|
1928 |
/**
|
1929 |
* Utility function that returns the comment currently being recursed.
|
1930 |
*
|
1931 |
+
* @since BuddyPress (1.5)
|
1932 |
*
|
1933 |
* @global object $activities_template {@link BP_Activity_Template}
|
1934 |
* @uses apply_filters() To call the 'bp_activity_current_comment' hook.
|
1941 |
|
1942 |
$current_comment = !empty( $activities_template->activity->current_comment ) ? $activities_template->activity->current_comment : false;
|
1943 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1944 |
return apply_filters( 'bp_activity_current_comment', $current_comment );
|
1945 |
}
|
1946 |
|
1948 |
/**
|
1949 |
* Output the ID of the activity comment currently being displayed.
|
1950 |
*
|
1951 |
+
* @since BuddyPress (1.5)
|
1952 |
*
|
1953 |
* @uses bp_get_activity_comment_id()
|
1954 |
*/
|
1959 |
/**
|
1960 |
* Return the ID of the activity comment currently being displayed.
|
1961 |
*
|
1962 |
+
* @since BuddyPress (1.5)
|
1963 |
*
|
1964 |
* @global object $activities_template {@link BP_Activity_Template}
|
1965 |
* @uses apply_filters() To call the 'bp_activity_comment_id' hook.
|
1972 |
|
1973 |
$comment_id = isset( $activities_template->activity->current_comment->id ) ? $activities_template->activity->current_comment->id : false;
|
1974 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1975 |
return apply_filters( 'bp_activity_comment_id', $comment_id );
|
1976 |
}
|
1977 |
|
1978 |
/**
|
1979 |
* Output the ID of the author of the activity comment currently being displayed.
|
1980 |
*
|
1981 |
+
* @since BuddyPress (1.5)
|
1982 |
*
|
1983 |
* @uses bp_get_activity_comment_user_id()
|
1984 |
*/
|
1989 |
/**
|
1990 |
* Return the ID of the author of the activity comment currently being displayed.
|
1991 |
*
|
1992 |
+
* @since BuddyPress (1.5)
|
1993 |
*
|
1994 |
* @global object $activities_template {@link BP_Activity_Template}
|
1995 |
* @uses apply_filters() To call the 'bp_activity_comment_user_id' hook.
|
2002 |
|
2003 |
$user_id = isset( $activities_template->activity->current_comment->user_id ) ? $activities_template->activity->current_comment->user_id : false;
|
2004 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005 |
return apply_filters( 'bp_activity_comment_user_id', $user_id );
|
2006 |
}
|
2007 |
|
2008 |
/**
|
2009 |
* Output the author link for the activity comment currently being displayed.
|
2010 |
*
|
2011 |
+
* @since BuddyPress (1.5)
|
2012 |
*
|
2013 |
* @uses bp_get_activity_comment_user_link()
|
2014 |
*/
|
2019 |
/**
|
2020 |
* Return the author link for the activity comment currently being displayed.
|
2021 |
*
|
2022 |
+
* @since BuddyPress (1.5)
|
2023 |
*
|
2024 |
* @uses bp_core_get_user_domain()
|
2025 |
* @uses bp_get_activity_comment_user_id()
|
2030 |
function bp_get_activity_comment_user_link() {
|
2031 |
$user_link = bp_core_get_user_domain( bp_get_activity_comment_user_id() );
|
2032 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2033 |
return apply_filters( 'bp_activity_comment_user_link', $user_link );
|
2034 |
}
|
2035 |
|
2036 |
/**
|
2037 |
* Output the author name for the activity comment currently being displayed.
|
2038 |
*
|
2039 |
+
* @since BuddyPress (1.5)
|
2040 |
*
|
2041 |
* @uses bp_get_activity_comment_name()
|
2042 |
*/
|
2050 |
* The use of the 'bp_acomment_name' filter is deprecated. Please use
|
2051 |
* 'bp_activity_comment_name'.
|
2052 |
*
|
2053 |
+
* @since BuddyPress (1.5)
|
2054 |
*
|
2055 |
* @global object $activities_template {@link BP_Activity_Template}
|
2056 |
* @uses apply_filters() To call the 'bp_acomment_name' hook.
|
2061 |
function bp_get_activity_comment_name() {
|
2062 |
global $activities_template;
|
2063 |
|
2064 |
+
if ( isset( $activities_template->activity->current_comment->user_fullname ) )
|
|
|
2065 |
$name = apply_filters( 'bp_acomment_name', $activities_template->activity->current_comment->user_fullname, $activities_template->activity->current_comment ); // backward compatibility
|
2066 |
+
else
|
2067 |
$name = $activities_template->activity->current_comment->display_name;
|
|
|
2068 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2069 |
return apply_filters( 'bp_activity_comment_name', $name );
|
2070 |
}
|
2071 |
|
2072 |
/**
|
2073 |
* Output the date_recorded of the activity comment currently being displayed.
|
2074 |
*
|
2075 |
+
* @since BuddyPress (1.5)
|
2076 |
*
|
2077 |
* @uses bp_get_activity_comment_date_recorded()
|
2078 |
*/
|
2083 |
/**
|
2084 |
* Return the date_recorded for the activity comment currently being displayed.
|
2085 |
*
|
2086 |
+
* @since BuddyPress (1.5)
|
2087 |
*
|
2088 |
* @global object $activities_template {@link BP_Activity_Template}
|
2089 |
* @uses bp_core_time_since()
|
2100 |
|
2101 |
$date_recorded = bp_core_time_since( $activities_template->activity->current_comment->date_recorded );
|
2102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2103 |
return apply_filters( 'bp_activity_comment_date_recorded', $date_recorded );
|
2104 |
}
|
2105 |
|
2106 |
/**
|
2107 |
* Output the 'delete' URL for the activity comment currently being displayed.
|
2108 |
*
|
2109 |
+
* @since BuddyPress (1.5)
|
2110 |
*
|
2111 |
* @uses bp_get_activity_comment_delete_link()
|
2112 |
*/
|
2117 |
/**
|
2118 |
* Gets the 'delete' URL for the activity comment currently being displayed
|
2119 |
*
|
2120 |
+
* @since BuddyPress (1.5)
|
2121 |
*
|
2122 |
* @uses wp_nonce_url()
|
2123 |
* @uses bp_get_root_domain()
|
2131 |
function bp_get_activity_comment_delete_link() {
|
2132 |
$link = wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_slug() . '/delete/' . bp_get_activity_comment_id() . '?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link' );
|
2133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2134 |
return apply_filters( 'bp_activity_comment_delete_link', $link );
|
2135 |
}
|
2136 |
|
2137 |
/**
|
2138 |
* Output the content of the activity comment currently being displayed.
|
2139 |
*
|
2140 |
+
* @since BuddyPress (1.5)
|
2141 |
*
|
2142 |
* @uses bp_get_activity_comment_content()
|
2143 |
*/
|
2153 |
* 'bp_activity_comment_content' to modify the content of activity
|
2154 |
* comments only.
|
2155 |
*
|
2156 |
+
* @since BuddyPress (1.5)
|
2157 |
*
|
2158 |
* @global object $activities_template {@link BP_Activity_Template}
|
2159 |
* @uses apply_filters() To call the 'bp_get_activity_content' hook.
|
2164 |
function bp_get_activity_comment_content() {
|
2165 |
global $activities_template;
|
2166 |
|
|
|
2167 |
$content = apply_filters( 'bp_get_activity_content', $activities_template->activity->current_comment->content );
|
2168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2169 |
return apply_filters( 'bp_activity_comment_content', $content );
|
2170 |
}
|
2171 |
|
2172 |
/**
|
2173 |
* Output the activity comment count.
|
2174 |
*
|
2175 |
+
* @since BuddyPress (1.2)
|
2176 |
*
|
2177 |
* @uses bp_activity_get_comment_count()
|
2178 |
*/
|
2183 |
/**
|
2184 |
* Return the comment count of an activity item.
|
2185 |
*
|
2186 |
+
* @since BuddyPress (1.2)
|
2187 |
*
|
2188 |
* @global object $activities_template {@link BP_Activity_Template}
|
2189 |
* @uses bp_activity_recurse_comment_count()
|
2206 |
? bp_activity_recurse_comment_count( $activities_template->activity )
|
2207 |
: 0;
|
2208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2209 |
return apply_filters( 'bp_activity_get_comment_count', (int) $count );
|
2210 |
}
|
2211 |
|
2215 |
* This function recursively adds the total number of comments each
|
2216 |
* activity child has, and returns them.
|
2217 |
*
|
2218 |
+
* @since BuddyPress (1.2)
|
2219 |
*
|
2220 |
* @uses bp_activity_recurse_comment_count()
|
2221 |
* @uses apply_filters() To call the 'bp_activity_recurse_comment_count' hook
|
2238 |
}
|
2239 |
}
|
2240 |
|
2241 |
+
// Filter and return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2242 |
return apply_filters( 'bp_activity_recurse_comment_count', $new_count, $comment, $count );
|
2243 |
}
|
2244 |
|
2255 |
*
|
2256 |
* @since BuddyPress (2.0.0)
|
2257 |
*
|
2258 |
+
* @return int
|
2259 |
*/
|
2260 |
function bp_activity_get_comment_depth() {
|
2261 |
global $activities_template;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2262 |
return apply_filters( 'bp_activity_get_comment_depth', $activities_template->activity->current_comment->depth );
|
2263 |
}
|
2264 |
|
2265 |
/**
|
2266 |
* Output the activity comment link.
|
2267 |
*
|
2268 |
+
* @since BuddyPress (1.2)
|
2269 |
*
|
2270 |
* @uses bp_get_activity_comment_link()
|
2271 |
*/
|
2276 |
/**
|
2277 |
* Return the activity comment link.
|
2278 |
*
|
2279 |
+
* @since BuddyPress (1.2)
|
2280 |
*
|
2281 |
* @global object $activities_template {@link BP_Activity_Template}
|
2282 |
* @uses apply_filters() To call the 'bp_get_activity_comment_link' hook.
|
2285 |
*/
|
2286 |
function bp_get_activity_comment_link() {
|
2287 |
global $activities_template;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2288 |
return apply_filters( 'bp_get_activity_comment_link', '?ac=' . $activities_template->activity->id . '/#ac-form-' . $activities_template->activity->id );
|
2289 |
}
|
2290 |
|
2291 |
/**
|
2292 |
* Output the activity comment form no javascript display CSS.
|
2293 |
*
|
2294 |
+
* @since BuddyPress (1.2)
|
2295 |
*
|
2296 |
* @uses bp_get_activity_comment_form_nojs_display()
|
2297 |
*/
|
2302 |
/**
|
2303 |
* Return the activity comment form no javascript display CSS.
|
2304 |
*
|
2305 |
+
* @since BuddyPress (1.2)
|
2306 |
*
|
2307 |
* @global object $activities_template {@link BP_Activity_Template}
|
2308 |
*
|
2320 |
/**
|
2321 |
* Output the activity comment form action.
|
2322 |
*
|
2323 |
+
* @since BuddyPress (1.2)
|
2324 |
*
|
2325 |
* @uses bp_get_activity_comment_form_action()
|
2326 |
*/
|
2331 |
/**
|
2332 |
* Return the activity comment form action.
|
2333 |
*
|
2334 |
+
* @since BuddyPress (1.2)
|
2335 |
*
|
2336 |
* @uses home_url()
|
2337 |
* @uses bp_get_activity_root_slug()
|
2340 |
* @return string The activity comment form action.
|
2341 |
*/
|
2342 |
function bp_get_activity_comment_form_action() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2343 |
return apply_filters( 'bp_get_activity_comment_form_action', home_url( bp_get_activity_root_slug() . '/reply/' ) );
|
2344 |
}
|
2345 |
|
2346 |
/**
|
2347 |
* Output the activity permalink ID.
|
2348 |
*
|
2349 |
+
* @since BuddyPress (1.2)
|
2350 |
*
|
2351 |
* @uses bp_get_activity_permalink_id()
|
2352 |
*/
|
2357 |
/**
|
2358 |
* Return the activity permalink ID.
|
2359 |
*
|
2360 |
+
* @since BuddyPress (1.2)
|
2361 |
*
|
2362 |
* @uses apply_filters() To call the 'bp_get_activity_permalink_id' hook.
|
2363 |
*
|
2364 |
* @return string The activity permalink ID.
|
2365 |
*/
|
2366 |
function bp_get_activity_permalink_id() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2367 |
return apply_filters( 'bp_get_activity_permalink_id', bp_current_action() );
|
2368 |
}
|
2369 |
|
2370 |
/**
|
2371 |
* Output the activity thread permalink.
|
2372 |
*
|
2373 |
+
* @since BuddyPress (1.2)
|
2374 |
*
|
2375 |
* @uses bp_get_activity_permalink_id()
|
2376 |
*/
|
2381 |
/**
|
2382 |
* Return the activity thread permalink.
|
2383 |
*
|
2384 |
+
* @since BuddyPress (1.2)
|
2385 |
*
|
2386 |
* @uses bp_activity_get_permalink()
|
2387 |
* @uses apply_filters() To call the 'bp_get_activity_thread_permalink' hook.
|
2393 |
|
2394 |
$link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity );
|
2395 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2396 |
return apply_filters( 'bp_get_activity_thread_permalink', $link );
|
2397 |
}
|
2398 |
|
2399 |
/**
|
2400 |
* Output the activity comment permalink.
|
2401 |
*
|
2402 |
+
* @since BuddyPress (1.8)
|
2403 |
*
|
2404 |
* @uses bp_get_activity_permalink_id()
|
2405 |
*/
|
2409 |
/**
|
2410 |
* Return the activity comment permalink.
|
2411 |
*
|
2412 |
+
* @since BuddyPress (1.8)
|
2413 |
*
|
2414 |
* @uses bp_activity_get_permalink()
|
2415 |
* @uses apply_filters() To call the 'bp_get_activity_comment_permalink' hook.
|
2432 |
// Append comment ID to end of activity permalink
|
2433 |
$link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ) . $comment_link;
|
2434 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2435 |
return apply_filters( 'bp_get_activity_comment_permalink', $link, $comment_id );
|
2436 |
}
|
2437 |
|
2438 |
/**
|
2439 |
* Output the activity favorite link.
|
2440 |
*
|
2441 |
+
* @since BuddyPress (1.2)
|
2442 |
*
|
2443 |
* @uses bp_get_activity_favorite_link()
|
2444 |
*/
|
2449 |
/**
|
2450 |
* Return the activity favorite link.
|
2451 |
*
|
2452 |
+
* @since BuddyPress (1.2)
|
2453 |
*
|
2454 |
* @global object $activities_template {@link BP_Activity_Template}
|
2455 |
* @uses wp_nonce_url()
|
2461 |
*/
|
2462 |
function bp_get_activity_favorite_link() {
|
2463 |
global $activities_template;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2464 |
return apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . $activities_template->activity->id . '/' ), 'mark_favorite' ) );
|
2465 |
}
|
2466 |
|
2467 |
/**
|
2468 |
* Output the activity unfavorite link.
|
2469 |
*
|
2470 |
+
* @since BuddyPress (1.2)
|
2471 |
*
|
2472 |
* @uses bp_get_activity_unfavorite_link()
|
2473 |
*/
|
2478 |
/**
|
2479 |
* Return the activity unfavorite link.
|
2480 |
*
|
2481 |
+
* @since BuddyPress (1.2)
|
2482 |
*
|
2483 |
* @global object $activities_template {@link BP_Activity_Template}
|
2484 |
* @uses wp_nonce_url()
|
2490 |
*/
|
2491 |
function bp_get_activity_unfavorite_link() {
|
2492 |
global $activities_template;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2493 |
return apply_filters( 'bp_get_activity_unfavorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/unfavorite/' . $activities_template->activity->id . '/' ), 'unmark_favorite' ) );
|
2494 |
}
|
2495 |
|
2496 |
/**
|
2497 |
* Output the activity CSS class.
|
2498 |
*
|
2499 |
+
* @since BuddyPress (1.0)
|
2500 |
*
|
2501 |
* @uses bp_get_activity_css_class()
|
2502 |
*/
|
2507 |
/**
|
2508 |
* Return the current activity item's CSS class.
|
2509 |
*
|
2510 |
+
* @since BuddyPress (1.0)
|
2511 |
*
|
2512 |
* @global object $activities_template {@link BP_Activity_Template}
|
2513 |
* @uses apply_filters() To call the 'bp_activity_mini_activity_types' hook.
|
2520 |
function bp_get_activity_css_class() {
|
2521 |
global $activities_template;
|
2522 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2523 |
$mini_activity_actions = apply_filters( 'bp_activity_mini_activity_types', array(
|
2524 |
'friendship_accepted',
|
2525 |
'friendship_created',
|
2537 |
if ( bp_activity_get_comment_count() && bp_activity_can_comment() )
|
2538 |
$class .= ' has-comments';
|
2539 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2540 |
return apply_filters( 'bp_get_activity_css_class', $activities_template->activity->component . ' ' . $activities_template->activity->type . $class );
|
2541 |
}
|
2542 |
|
2543 |
/**
|
2544 |
* Output the activity delete link.
|
2545 |
*
|
2546 |
+
* @since BuddyPress (1.1)
|
2547 |
*
|
2548 |
* @uses bp_get_activity_delete_link()
|
2549 |
*/
|
2554 |
/**
|
2555 |
* Return the activity delete link.
|
2556 |
*
|
2557 |
+
* @since BuddyPress (1.1)
|
2558 |
*
|
2559 |
* @global object $activities_template {@link BP_Activity_Template}
|
2560 |
* @uses bp_get_root_domain()
|
2561 |
* @uses bp_get_activity_root_slug()
|
2562 |
* @uses bp_is_activity_component()
|
2563 |
* @uses bp_current_action()
|
2564 |
+
* @uses add_query_arg()
|
2565 |
* @uses wp_get_referer()
|
2566 |
* @uses wp_nonce_url()
|
2567 |
* @uses apply_filters() To call the 'bp_get_activity_delete_link' hook.
|
2581 |
|
2582 |
$link = '<a href="' . esc_url( $url ) . '" class="button item-button bp-secondary-action ' . $class . ' confirm" rel="nofollow">' . __( 'Delete', 'buddypress' ) . '</a>';
|
2583 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2584 |
return apply_filters( 'bp_get_activity_delete_link', $link );
|
2585 |
}
|
2586 |
|
2624 |
|
2625 |
$url = wp_nonce_url( $url, 'bp_activity_delete_link' );
|
2626 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2627 |
return apply_filters( 'bp_get_activity_delete_url', $url );
|
2628 |
}
|
2629 |
|
2630 |
/**
|
2631 |
* Output the activity latest update link.
|
2632 |
*
|
2633 |
+
* @since BuddyPress (1.2)
|
2634 |
*
|
2635 |
* @see bp_get_activity_latest_update() for description of parameters.
|
2636 |
* @uses bp_get_activity_latest_update()
|
2644 |
/**
|
2645 |
* Return the activity latest update link.
|
2646 |
*
|
2647 |
+
* @since BuddyPress (1.2)
|
2648 |
*
|
2649 |
* @uses bp_is_user_inactive()
|
2650 |
* @uses bp_core_is_user_deleted()
|
2670 |
if ( !$update = bp_get_user_meta( $user_id, 'bp_latest_update', true ) )
|
2671 |
return false;
|
2672 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2673 |
$latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 358 ) ) ) );
|
2674 |
+
$latest_update .= ' <a href="' . bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $update['id'] . '/"> ' . __( 'View', 'buddypress' ) . '</a>';
|
2675 |
|
2676 |
+
return apply_filters( 'bp_get_activity_latest_update', $latest_update );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2677 |
}
|
2678 |
|
2679 |
/**
|
2680 |
* Output the activity filter links.
|
2681 |
*
|
2682 |
+
* @since BuddyPress (1.1)
|
2683 |
*
|
2684 |
* @see bp_get_activity_filter_links() for description of parameters.
|
2685 |
* @uses bp_get_activity_filter_links()
|
2693 |
/**
|
2694 |
* Return the activity filter links.
|
2695 |
*
|
2696 |
+
* @since BuddyPress (1.1)
|
2697 |
*
|
2698 |
* @uses wp_parse_args()
|
2699 |
* @uses BP_Activity_Activity::get_recorded_components() {@link BP_Activity_Activity}
|
2761 |
|
2762 |
$link = add_query_arg( 'afilter', $component );
|
2763 |
$link = remove_query_arg( 'acpage' , $link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2764 |
$link = apply_filters( 'bp_get_activity_filter_link_href', $link, $component );
|
2765 |
|
2766 |
+
$component_links[] = $before . '<a href="' . esc_attr( $link ) . '">' . ucwords( $component ) . '</a>' . $after;
|
2767 |
}
|
2768 |
|
2769 |
$link = remove_query_arg( 'afilter' , $link );
|
2770 |
|
2771 |
if ( isset( $_GET['afilter'] ) )
|
2772 |
+
$component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . esc_attr( $link ) . '">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
|
2773 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2774 |
return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
|
2775 |
}
|
2776 |
|
2777 |
/**
|
2778 |
* Determine if a comment can be made on an activity item.
|
2779 |
*
|
2780 |
+
* @since BuddyPress (1.2)
|
2781 |
*
|
2782 |
* @global object $activities_template {@link BP_Activity_Template}
|
2783 |
* @uses bp_get_activity_action_name()
|
2787 |
*/
|
2788 |
function bp_activity_can_comment() {
|
2789 |
global $activities_template;
|
|
|
2790 |
|
2791 |
// Assume activity can be commented on
|
2792 |
$can_comment = true;
|
2793 |
|
2794 |
// Determine ability to comment based on activity action name
|
2795 |
$activity_action = bp_get_activity_action_name();
|
2796 |
+
switch ( $activity_action ) {
|
2797 |
+
|
2798 |
+
// Maybe turn off for blog and forum updates
|
2799 |
+
case 'new_blog_post' :
|
2800 |
+
case 'new_blog_comment' :
|
2801 |
+
case 'new_forum_topic' :
|
2802 |
+
case 'new_forum_post' :
|
2803 |
+
if ( ! empty( $activities_template->disable_blogforum_replies ) ) {
|
2804 |
+
$can_comment = false;
|
2805 |
+
}
|
2806 |
+
break;
|
2807 |
|
2808 |
+
// Turn off for activity comments
|
2809 |
+
case 'activity_comment' :
|
2810 |
+
$can_comment = false;
|
2811 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2812 |
}
|
2813 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2814 |
return apply_filters( 'bp_activity_can_comment', $can_comment, $activity_action );
|
2815 |
}
|
2816 |
|
2850 |
}
|
2851 |
}
|
2852 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2853 |
return (bool) apply_filters( 'bp_activity_can_comment_reply', $can_comment, $comment );
|
2854 |
}
|
2855 |
|
2856 |
/**
|
2857 |
+
* Determine if an favorites are allowed.
|
2858 |
*
|
2859 |
* Defaults to true, but can be modified by plugins.
|
2860 |
*
|
2861 |
+
* @since BuddyPress (1.5)
|
2862 |
*
|
2863 |
* @uses apply_filters() To call the 'bp_activity_can_favorite' hook.
|
2864 |
*
|
2865 |
* @return bool True if comment can receive comments.
|
2866 |
*/
|
2867 |
function bp_activity_can_favorite() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2868 |
return apply_filters( 'bp_activity_can_favorite', true );
|
2869 |
}
|
2870 |
|
2871 |
/**
|
2872 |
* Output the total favorite count for a specified user.
|
2873 |
*
|
2874 |
+
* @since BuddyPress (1.2)
|
2875 |
*
|
2876 |
* @see bp_get_total_favorite_count_for_user() for description of parameters.
|
2877 |
* @uses bp_get_total_favorite_count_for_user()
|
2885 |
/**
|
2886 |
* Return the total favorite count for a specified user.
|
2887 |
*
|
2888 |
+
* @since BuddyPress (1.2)
|
2889 |
*
|
2890 |
* @uses bp_activity_total_favorites_for_user()
|
2891 |
* @uses apply_filters() To call the 'bp_get_total_favorite_count_for_user' hook
|
2905 |
? bp_activity_total_favorites_for_user( $user_id )
|
2906 |
: false;
|
2907 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2908 |
return apply_filters( 'bp_get_total_favorite_count_for_user', $retval );
|
2909 |
}
|
2910 |
|
2912 |
/**
|
2913 |
* Output the total mention count for a specified user.
|
2914 |
*
|
2915 |
+
* @since BuddyPress (1.2)
|
2916 |
*
|
2917 |
* @see bp_get_total_mention_count_for_user() for description of parameters.
|
2918 |
* @uses bp_get_total_favorite_count_for_user()
|
2926 |
/**
|
2927 |
* Return the total mention count for a specified user.
|
2928 |
*
|
2929 |
+
* @since BuddyPress (1.2)
|
2930 |
*
|
2931 |
* @uses bp_get_user_meta()
|
2932 |
* @uses apply_filters() To call the 'bp_get_total_mention_count_for_user' hook.
|
2946 |
? bp_get_user_meta( $user_id, 'bp_new_mention_count', true )
|
2947 |
: false;
|
2948 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2949 |
return apply_filters( 'bp_get_total_mention_count_for_user', $retval );
|
2950 |
}
|
2951 |
|
2952 |
/**
|
2953 |
* Output the public message link for displayed user.
|
2954 |
*
|
2955 |
+
* @since BuddyPress (1.2)
|
2956 |
*
|
2957 |
* @uses bp_get_send_public_message_link()
|
2958 |
*/
|
2959 |
function bp_send_public_message_link() {
|
2960 |
+
echo bp_get_send_public_message_link();
|
2961 |
}
|
2962 |
|
2963 |
/**
|
2964 |
* Return the public message link for the displayed user.
|
2965 |
*
|
2966 |
+
* @since BuddyPress (1.2)
|
2967 |
*
|
2968 |
* @uses is_user_logged_in()
|
2969 |
* @uses bp_is_my_profile()
|
2985 |
$retval = wp_nonce_url( $url );
|
2986 |
}
|
2987 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2988 |
return apply_filters( 'bp_get_send_public_message_link', $retval );
|
2989 |
}
|
2990 |
|
3018 |
/**
|
3019 |
* Output the mentioned user display name.
|
3020 |
*
|
3021 |
+
* @since BuddyPress (1.2)
|
3022 |
*
|
3023 |
* @see bp_get_mentioned_user_display_name() for description of parameters.
|
3024 |
* @uses bp_get_mentioned_user_display_name()
|
3032 |
/**
|
3033 |
* Returns the mentioned user display name
|
3034 |
*
|
3035 |
+
* @since BuddyPress (1.2)
|
3036 |
*
|
3037 |
* @uses bp_core_get_user_displayname()
|
3038 |
* @uses apply_filters() To call the 'bp_get_mentioned_user_display_name' hook.
|
3050 |
$name = __( 'a user', 'buddypress' );
|
3051 |
}
|
3052 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3053 |
return apply_filters( 'bp_get_mentioned_user_display_name', $name, $user_id_or_username );
|
3054 |
}
|
3055 |
|
3056 |
/**
|
3057 |
* Output button for sending a public message (an @-mention).
|
3058 |
*
|
3059 |
+
* @since BuddyPress (1.2)
|
3060 |
*
|
3061 |
* @see bp_get_send_public_message_button() for description of parameters.
|
3062 |
* @uses bp_get_send_public_message_button()
|
3070 |
/**
|
3071 |
* Return button for sending a public message (an @-mention).
|
3072 |
*
|
3073 |
+
* @since BuddyPress (1.2)
|
3074 |
*
|
3075 |
* @uses bp_get_send_public_message_link()
|
3076 |
* @uses wp_parse_args()
|
3108 |
'link_class' => 'activity-button mention'
|
3109 |
) );
|
3110 |
|
3111 |
+
// Filter and return the HTML button
|
|
|
|
|
|
|
|
|
|
|
|
|
3112 |
return bp_get_button( apply_filters( 'bp_get_send_public_message_button', $r ) );
|
3113 |
}
|
3114 |
|
3115 |
/**
|
3116 |
* Output the activity post form action.
|
3117 |
*
|
3118 |
+
* @since BuddyPress (1.2)
|
3119 |
*
|
3120 |
* @uses bp_get_activity_post_form_action()
|
3121 |
*/
|
3126 |
/**
|
3127 |
* Return the activity post form action.
|
3128 |
*
|
3129 |
+
* @since BuddyPress (1.2)
|
3130 |
*
|
3131 |
* @uses home_url()
|
3132 |
* @uses bp_get_activity_root_slug()
|
3135 |
* @return string The activity post form action.
|
3136 |
*/
|
3137 |
function bp_get_activity_post_form_action() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3138 |
return apply_filters( 'bp_get_activity_post_form_action', home_url( bp_get_activity_root_slug() . '/post/' ) );
|
3139 |
}
|
3140 |
|
3146 |
* Avatars are wrapped in <li> elements, but you've got to provide your own
|
3147 |
* <ul> or <ol> wrapper markup.
|
3148 |
*
|
3149 |
+
* @since BuddyPress (1.7)
|
3150 |
*
|
3151 |
* @see bp_core_fetch_avatar() for a description of arguments.
|
3152 |
*
|
3198 |
}
|
3199 |
}
|
3200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3201 |
echo apply_filters( 'bp_activity_comments_user_avatars', $retval, $r, $output );
|
3202 |
}
|
3203 |
|
3204 |
/**
|
3205 |
* Return the IDs of every user who's left a comment on the current activity item.
|
3206 |
*
|
3207 |
+
* @since BuddyPress (1.7)
|
3208 |
*
|
3209 |
* @return bool|array An array of IDs, or false if none are found.
|
3210 |
*/
|
3215 |
? (array) bp_activity_recurse_comments_user_ids( $activities_template->activity->children )
|
3216 |
: array();
|
3217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3218 |
return apply_filters( 'bp_activity_get_comments_user_ids', array_unique( $user_ids ) );
|
3219 |
}
|
3220 |
|
3221 |
/**
|
3222 |
* Recurse through all activity comments and collect the IDs of the users who wrote them.
|
3223 |
*
|
3224 |
+
* @since BuddyPress (1.7)
|
3225 |
*
|
3226 |
* @param array $comments Array of {@link BP_Activity_Activity} items.
|
3227 |
* @return array Array of user IDs.
|
3251 |
}
|
3252 |
}
|
3253 |
|
3254 |
+
// Filter and return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3255 |
return apply_filters( 'bp_activity_recurse_comments_user_ids', $user_ids, $comments );
|
3256 |
}
|
3257 |
|
3271 |
* @return string Mentionname for the displayed user, if available.
|
3272 |
*/
|
3273 |
function bp_get_displayed_user_mentionname() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3274 |
return apply_filters( 'bp_get_displayed_user_mentionname', bp_activity_get_user_mentionname( bp_displayed_user_id() ) );
|
3275 |
}
|
3276 |
|
3277 |
/**
|
3278 |
* Echo a list of all registered activity types for use in dropdowns or checkbox lists.
|
3279 |
*
|
3280 |
+
* @since BuddyPress (1.7)
|
3281 |
*
|
3282 |
* @param string $output Optional. Either 'select' or 'checkbox'. Default: 'select'.
|
3283 |
* @param array $args {
|
3315 |
break;
|
3316 |
}
|
3317 |
|
3318 |
+
// Allow custom markup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3319 |
do_action( 'bp_activity_types_list_' . $output, $args, $type, $description );
|
3320 |
}
|
3321 |
|
3331 |
/**
|
3332 |
* Output the sitewide activity feed link.
|
3333 |
*
|
3334 |
+
* @since BuddyPress (1.0)
|
3335 |
*
|
3336 |
* @uses bp_get_sitewide_activity_feed_link()
|
3337 |
*/
|
3342 |
/**
|
3343 |
* Returns the sitewide activity feed link.
|
3344 |
*
|
3345 |
+
* @since BuddyPress (1.0)
|
3346 |
*
|
3347 |
* @uses home_url()
|
3348 |
* @uses bp_get_activity_root_slug()
|
3351 |
* @return string The sitewide activity feed link.
|
3352 |
*/
|
3353 |
function bp_get_sitewide_activity_feed_link() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3354 |
return apply_filters( 'bp_get_sitewide_activity_feed_link', bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/feed/' );
|
3355 |
}
|
3356 |
|
3357 |
/**
|
3358 |
* Output the member activity feed link.
|
3359 |
*
|
3360 |
+
* @since BuddyPress (1.2)
|
3361 |
*
|
3362 |
* @uses bp_get_member_activity_feed_link()
|
3363 |
*/
|
3368 |
/**
|
3369 |
* Output the member activity feed link.
|
3370 |
*
|
3371 |
+
* @since BuddyPress (1.0)
|
3372 |
+
* @deprecated BuddyPress (1.2)
|
3373 |
*
|
3374 |
* @todo properly deprecate in favor of bp_member_activity_feed_link().
|
3375 |
*
|
3380 |
/**
|
3381 |
* Return the member activity feed link.
|
3382 |
*
|
3383 |
+
* @since BuddyPress (1.2)
|
3384 |
*
|
3385 |
* @uses bp_is_profile_component()
|
3386 |
* @uses bp_is_current_action()
|
3420 |
$link = '';
|
3421 |
}
|
3422 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3423 |
return apply_filters( 'bp_get_activities_member_rss_link', $link );
|
3424 |
}
|
3425 |
|
3426 |
/**
|
3427 |
* Return the member activity feed link.
|
3428 |
*
|
3429 |
+
* @since BuddyPress (1.0)
|
3430 |
+
* @deprecated BuddyPress (1.2)
|
3431 |
*
|
3432 |
* @todo properly deprecate in favor of bp_get_member_activity_feed_link().
|
3433 |
*
|
3443 |
/**
|
3444 |
* Outputs the activity feed item guid.
|
3445 |
*
|
3446 |
+
* @since BuddyPress (1.0)
|
3447 |
*
|
3448 |
* @uses bp_activity_feed_item_guid()
|
3449 |
*/
|
3454 |
/**
|
3455 |
* Returns the activity feed item guid.
|
3456 |
*
|
3457 |
+
* @since BuddyPress (1.2)
|
3458 |
*
|
3459 |
* @global object $activities_template {@link BP_Activity_Template}
|
3460 |
* @uses apply_filters() To call the 'bp_get_activity_feed_item_guid' hook.
|
3464 |
function bp_get_activity_feed_item_guid() {
|
3465 |
global $activities_template;
|
3466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3467 |
return apply_filters( 'bp_get_activity_feed_item_guid', md5( $activities_template->activity->date_recorded . '-' . $activities_template->activity->content ) );
|
3468 |
}
|
3469 |
|
3470 |
/**
|
3471 |
* Output the activity feed item title.
|
3472 |
*
|
3473 |
+
* @since BuddyPress (1.0)
|
3474 |
*
|
3475 |
* @uses bp_get_activity_feed_item_title()
|
3476 |
*/
|
3481 |
/**
|
3482 |
* Return the activity feed item title.
|
3483 |
*
|
3484 |
+
* @since BuddyPress (1.0)
|
3485 |
*
|
3486 |
* @global object $activities_template {@link BP_Activity_Template}
|
3487 |
* @uses ent2ncr()
|
3511 |
$title .= ': ' . strip_tags( ent2ncr( trim( convert_chars( bp_create_excerpt( $activities_template->activity->content, 70, array( 'ending' => " […]" ) ) ) ) ) );
|
3512 |
}
|
3513 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3514 |
return apply_filters( 'bp_get_activity_feed_item_title', $title );
|
3515 |
}
|
3516 |
|
3517 |
/**
|
3518 |
* Output the activity feed item link
|
3519 |
*
|
3520 |
+
* @since BuddyPress (1.0)
|
3521 |
*
|
3522 |
* @uses bp_get_activity_feed_item_link()
|
3523 |
*/
|
3528 |
/**
|
3529 |
* Return the activity feed item link
|
3530 |
*
|
3531 |
+
* @since BuddyPress (1.0)
|
3532 |
*
|
3533 |
* @global object $activities_template {@link BP_Activity_Template}
|
3534 |
* @uses apply_filters() To call the 'bp_get_activity_feed_item_link' hook.
|
3542 |
? $activities_template->activity->primary_link
|
3543 |
: '';
|
3544 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3545 |
return apply_filters( 'bp_get_activity_feed_item_link', $retval );
|
3546 |
}
|
3547 |
|
3548 |
/**
|
3549 |
* Output the activity feed item date.
|
3550 |
*
|
3551 |
+
* @since BuddyPress (1.0)
|
3552 |
*
|
3553 |
* @uses bp_get_activity_feed_item_date()
|
3554 |
*/
|
3559 |
/**
|
3560 |
* Return the activity feed item date.
|
3561 |
*
|
3562 |
+
* @since BuddyPress (1.0)
|
3563 |
*
|
3564 |
* @global object $activities_template {@link BP_Activity_Template}
|
3565 |
* @uses apply_filters() To call the 'bp_get_activity_feed_item_date' hook.
|
3573 |
? $activities_template->activity->date_recorded
|
3574 |
: '';
|
3575 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3576 |
return apply_filters( 'bp_get_activity_feed_item_date', $retval );
|
3577 |
}
|
3578 |
|
3579 |
/**
|
3580 |
* Output the activity feed item description.
|
3581 |
*
|
3582 |
+
* @since BuddyPress (1.0)
|
3583 |
*
|
3584 |
* @uses bp_get_activity_feed_item_description()
|
3585 |
*/
|
3590 |
/**
|
3591 |
* Return the activity feed item description.
|
3592 |
*
|
3593 |
+
* @since BuddyPress (1.0)
|
3594 |
*
|
3595 |
* @global object $activities_template {@link BP_Activity_Template}
|
3596 |
* @uses ent2ncr()
|
3612 |
$content = ent2ncr( convert_chars( str_replace( '%s', '', $content ) ) );
|
3613 |
}
|
3614 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3615 |
return apply_filters( 'bp_get_activity_feed_item_description', $content );
|
3616 |
}
|
3617 |
|
3618 |
/**
|
3619 |
* Template tag so we can hook activity feed to <head>.
|
3620 |
*
|
3621 |
+
* @since BuddyPress (1.5)
|
3622 |
*
|
3623 |
* @uses bloginfo()
|
3624 |
* @uses bp_sitewide_activity_feed_link()
|
3667 |
}
|
3668 |
|
3669 |
// On individual group pages, default to 'group'
|
3670 |
+
} else if ( bp_is_active( 'groups' ) && bp_is_group() ) {
|
3671 |
$context = 'group';
|
3672 |
|
3673 |
// 'activity' everywhere else
|
3680 |
|
3681 |
// Walk through the registered actions, and prepare an the
|
3682 |
// select box options.
|
3683 |
+
foreach ( buddypress()->activity->actions as $actions ) {
|
3684 |
foreach ( $actions as $action ) {
|
3685 |
if ( ! in_array( $context, (array) $action['context'] ) ) {
|
3686 |
continue;
|
3696 |
}
|
3697 |
|
3698 |
/**
|
3699 |
+
* Modify the filter options available in the activity filter dropdown.
|
3700 |
*
|
3701 |
+
* @since BuddyPress (2.1.0)
|
3702 |
*
|
3703 |
+
* @param array $filters Array of filter options for the given
|
3704 |
+
* context, in the following format:
|
3705 |
+
* $option_value => $option_name
|
3706 |
+
* @param string $context Context for the filter. 'activity'
|
3707 |
+
* 'member', 'member_groups', 'group'.
|
3708 |
*/
|
3709 |
+
$filters = apply_filters( 'bp_get_activity_show_filters', $filters, $context );
|
3710 |
|
3711 |
// Build the options output
|
3712 |
$output = '';
|
3717 |
}
|
3718 |
}
|
3719 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3720 |
return apply_filters( 'bp_get_activity_show_filters', $output, $filters, $context );
|
3721 |
}
|
bp-activity/css/mentions-rtl.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
.atwho-view {
|
2 |
-
background:
|
3 |
border-radius: 2px;
|
4 |
border: 1px solid rgb(204, 204, 204);
|
5 |
box-shadow: 0 0 5px rgba(204, 204, 204, 0.25), 0 0 1px #FFF;
|
@@ -16,7 +16,6 @@
|
|
16 |
left: 0;
|
17 |
}
|
18 |
.atwho-view ul {
|
19 |
-
background: #FFF;
|
20 |
list-style: none;
|
21 |
margin: auto;
|
22 |
padding: 0;
|
@@ -63,6 +62,9 @@
|
|
63 |
float: right;
|
64 |
margin: 0 0 0 10px;
|
65 |
}
|
|
|
|
|
|
|
66 |
}
|
67 |
@media (max-width: 400px) {
|
68 |
.atwho-view ul li {
|
@@ -75,19 +77,4 @@
|
|
75 |
margin-top: -5px;
|
76 |
width: 30px;
|
77 |
}
|
78 |
-
.atwho-view {
|
79 |
-
border-radius: 0;
|
80 |
-
height: 100%;
|
81 |
-
right: 0 !important;
|
82 |
-
width: 100%;
|
83 |
-
}
|
84 |
-
.atwho-view ul li .username {
|
85 |
-
display: inline-block;
|
86 |
-
margin: -10px 0 0 0;
|
87 |
-
padding: 10px 0;
|
88 |
-
}
|
89 |
-
.atwho-view ul li small {
|
90 |
-
display: inline-block;
|
91 |
-
margin-right: 20px;
|
92 |
-
}
|
93 |
}
|
1 |
.atwho-view {
|
2 |
+
background: #FFF;
|
3 |
border-radius: 2px;
|
4 |
border: 1px solid rgb(204, 204, 204);
|
5 |
box-shadow: 0 0 5px rgba(204, 204, 204, 0.25), 0 0 1px #FFF;
|
16 |
left: 0;
|
17 |
}
|
18 |
.atwho-view ul {
|
|
|
19 |
list-style: none;
|
20 |
margin: auto;
|
21 |
padding: 0;
|
62 |
float: right;
|
63 |
margin: 0 0 0 10px;
|
64 |
}
|
65 |
+
.atwho-view small {
|
66 |
+
display: none;
|
67 |
+
}
|
68 |
}
|
69 |
@media (max-width: 400px) {
|
70 |
.atwho-view ul li {
|
77 |
margin-top: -5px;
|
78 |
width: 30px;
|
79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
bp-activity/css/mentions-rtl.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.atwho-view{background
|
1 |
+
.atwho-view{background:#FFF;border-radius:2px;border:1px solid #ccc;box-shadow:0 0 5px rgba(204,204,204,.25),0 0 1px #FFF;color:#D84800;display:none;font-family:sans-serif;margin-top:18px;position:absolute;top:0;z-index:1000;left:0}.atwho-view ul{list-style:none;margin:auto;padding:0}.atwho-view ul li{border-bottom:1px solid #EFEFEF;box-sizing:content-box;cursor:pointer;display:block;font-size:14px;height:20px;line-height:20px;margin:0;overflow:hidden;padding:5px 10px}.atwho-view img{border-radius:2px;float:left;height:20px;margin-top:0;width:20px}.atwho-view strong{background:#EFEFEF;font:700}.atwho-view .username strong{color:#D54E21}.atwho-view small{color:#AAA;float:left;font-size:smaller;font-weight:400;margin:0 40px 0 10px}.atwho-view .cur{background:rgba(239,239,239,.5)}@media (max-width:900px){.atwho-view img{float:right;margin:0 0 0 10px}.atwho-view small{display:none}}@media (max-width:400px){.atwho-view ul li{font-size:16px;line-height:23px;padding:13px}.atwho-view ul li img{height:30px;margin-top:-5px;width:30px}}
|
bp-activity/css/mentions.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
.atwho-view {
|
2 |
-
background:
|
3 |
border-radius: 2px;
|
4 |
border: 1px solid rgb(204, 204, 204);
|
5 |
box-shadow: 0 0 5px rgba(204, 204, 204, 0.25), 0 0 1px #FFF;
|
@@ -16,7 +16,6 @@
|
|
16 |
left: 0;
|
17 |
}
|
18 |
.atwho-view ul {
|
19 |
-
background: #FFF;
|
20 |
list-style: none;
|
21 |
margin: auto;
|
22 |
padding: 0;
|
@@ -63,6 +62,9 @@
|
|
63 |
float: left;
|
64 |
margin: 0 10px 0 0;
|
65 |
}
|
|
|
|
|
|
|
66 |
}
|
67 |
@media (max-width: 400px) {
|
68 |
.atwho-view ul li {
|
@@ -75,19 +77,4 @@
|
|
75 |
margin-top: -5px;
|
76 |
width: 30px;
|
77 |
}
|
78 |
-
.atwho-view {
|
79 |
-
border-radius: 0;
|
80 |
-
height: 100%;
|
81 |
-
left: 0 !important;
|
82 |
-
width: 100%;
|
83 |
-
}
|
84 |
-
.atwho-view ul li .username {
|
85 |
-
display: inline-block;
|
86 |
-
margin: -10px 0 0 0;
|
87 |
-
padding: 10px 0;
|
88 |
-
}
|
89 |
-
.atwho-view ul li small {
|
90 |
-
display: inline-block;
|
91 |
-
margin-left: 20px;
|
92 |
-
}
|
93 |
}
|
1 |
.atwho-view {
|
2 |
+
background: #FFF;
|
3 |
border-radius: 2px;
|
4 |
border: 1px solid rgb(204, 204, 204);
|
5 |
box-shadow: 0 0 5px rgba(204, 204, 204, 0.25), 0 0 1px #FFF;
|
16 |
left: 0;
|
17 |
}
|
18 |
.atwho-view ul {
|
|
|
19 |
list-style: none;
|
20 |
margin: auto;
|
21 |
padding: 0;
|
62 |
float: left;
|
63 |
margin: 0 10px 0 0;
|
64 |
}
|
65 |
+
.atwho-view small {
|
66 |
+
display: none;
|
67 |
+
}
|
68 |
}
|
69 |
@media (max-width: 400px) {
|
70 |
.atwho-view ul li {
|
77 |
margin-top: -5px;
|
78 |
width: 30px;
|
79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
bp-activity/css/mentions.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.atwho-view{background
|
1 |
+
.atwho-view{background:#FFF;border-radius:2px;border:1px solid #ccc;box-shadow:0 0 5px rgba(204,204,204,.25),0 0 1px #FFF;color:#D84800;display:none;font-family:sans-serif;margin-top:18px;position:absolute;top:0;z-index:1000;left:0}.atwho-view ul{list-style:none;margin:auto;padding:0}.atwho-view ul li{border-bottom:1px solid #EFEFEF;box-sizing:content-box;cursor:pointer;display:block;font-size:14px;height:20px;line-height:20px;margin:0;overflow:hidden;padding:5px 10px}.atwho-view img{border-radius:2px;float:right;height:20px;margin-top:0;width:20px}.atwho-view strong{background:#EFEFEF;font:700}.atwho-view .username strong{color:#D54E21}.atwho-view small{color:#AAA;float:right;font-size:smaller;font-weight:400;margin:0 10px 0 40px}.atwho-view .cur{background:rgba(239,239,239,.5)}@media (max-width:900px){.atwho-view img{float:left;margin:0 10px 0 0}.atwho-view small{display:none}}@media (max-width:400px){.atwho-view ul li{font-size:16px;line-height:23px;padding:13px}.atwho-view ul li img{height:30px;margin-top:-5px;width:30px}}
|
bp-activity/js/mentions.js
CHANGED
@@ -76,50 +76,20 @@
|
|
76 |
* @since BuddyPress (2.1.0)
|
77 |
*/
|
78 |
before_reposition: function( offset ) {
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
iframeOffset,
|
83 |
-
move,
|
84 |
-
$view = $( '#atwho-ground-' + this.id + ' .atwho-view' ),
|
85 |
-
$body = $( 'body' ),
|
86 |
-
atwhoDataValue = this.$inputor.data( 'atwho' );
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
// Caret.js no longer calculates iframe caret position from the window (it's now just within the iframe).
|
91 |
-
// We need to get the iframe offset from the window and merge that into our object.
|
92 |
-
iframeOffset = $( atwhoDataValue.iframe ).offset();
|
93 |
-
if ( 'undefined' !== iframeOffset ) {
|
94 |
-
caret.left += iframeOffset.left;
|
95 |
-
caret.top += iframeOffset.top;
|
96 |
-
}
|
97 |
-
} else {
|
98 |
-
caret = this.$inputor.caret( 'offset' );
|
99 |
-
}
|
100 |
-
|
101 |
-
// If the caret is past horizontal half, then flip it, yo
|
102 |
-
if ( caret.left > ( $body.width() / 2 ) ) {
|
103 |
$view.addClass( 'right' );
|
104 |
-
move = caret
|
105 |
} else {
|
106 |
$view.removeClass( 'right' );
|
107 |
-
move = caret
|
108 |
}
|
109 |
|
110 |
-
|
111 |
-
if ( $body.width() <= 400 ) {
|
112 |
-
$( document ).scrollTop( caret.top - 6 );
|
113 |
-
}
|
114 |
-
|
115 |
-
// New position is under the caret (never above) and positioned to follow
|
116 |
-
// Dynamic sizing based on the input area (remove 'px' from end)
|
117 |
-
line = parseInt( this.$inputor.css( 'line-height' ).substr( 0, this.$inputor.css( 'line-height' ).length - 2 ), 10 );
|
118 |
-
if ( !line || line < 5 ) { // sanity check, and catch no line-height
|
119 |
-
line = 19;
|
120 |
-
}
|
121 |
-
|
122 |
-
offset.top = caret.top + line;
|
123 |
offset.left += move;
|
124 |
},
|
125 |
|
@@ -133,7 +103,8 @@
|
|
133 |
* @since BuddyPress (2.1.0)
|
134 |
*/
|
135 |
inserting_wrapper: function( $inputor, content, suffix ) {
|
136 |
-
|
|
|
137 |
}
|
138 |
}
|
139 |
},
|
@@ -151,8 +122,7 @@
|
|
151 |
* @since BuddyPress (2.1.0)
|
152 |
*/
|
153 |
remote_filter: function( query, render_view ) {
|
154 |
-
var self = $( this )
|
155 |
-
params = {};
|
156 |
|
157 |
mentionsItem = mentionsQueryCache[ query ];
|
158 |
if ( typeof mentionsItem === 'object' ) {
|
@@ -164,13 +134,7 @@
|
|
164 |
self.xhr.abort();
|
165 |
}
|
166 |
|
167 |
-
|
168 |
-
|
169 |
-
if ( $.isNumeric( this.$inputor.data( 'suggestions-group-id' ) ) ) {
|
170 |
-
params['group-id'] = parseInt( this.$inputor.data( 'suggestions-group-id' ), 10 );
|
171 |
-
}
|
172 |
-
|
173 |
-
self.xhr = $.getJSON( ajaxurl, params )
|
174 |
/**
|
175 |
* Success callback for the @suggestions lookup.
|
176 |
*
|
@@ -228,34 +192,13 @@
|
|
228 |
};
|
229 |
|
230 |
$( document ).ready(function() {
|
231 |
-
var
|
232 |
-
loadAttempts = 0,
|
233 |
-
users = [];
|
234 |
|
235 |
if ( typeof window.BP_Suggestions === 'object' ) {
|
236 |
users = window.BP_Suggestions.friends || users;
|
237 |
}
|
238 |
|
239 |
-
// Dashboard post 'visual' editor.
|
240 |
-
loadMentionsInTinyMCE = function() {
|
241 |
-
if ( loadAttempts < 4 || ! $( 'body' ).hasClass( 'wp-admin' ) ) {
|
242 |
-
loadAttempts++;
|
243 |
-
|
244 |
-
if ( typeof window.tinyMCE === 'undefined' || window.tinyMCE.activeEditor === null || typeof window.tinyMCE.activeEditor === 'undefined' ) {
|
245 |
-
setTimeout( loadMentionsInTinyMCE, 500 );
|
246 |
-
return;
|
247 |
-
}
|
248 |
-
}
|
249 |
-
|
250 |
-
$( window.tinyMCE.activeEditor.contentDocument.activeElement )
|
251 |
-
.atwho( 'setIframe', $( '#content_ifr' )[0] )
|
252 |
-
.bp_mentions( users );
|
253 |
-
};
|
254 |
-
|
255 |
// Activity/reply, post comments, dashboard post 'text' editor.
|
256 |
$( '.bp-suggestions, #comments form textarea, .wp-editor-area' ).bp_mentions( users );
|
257 |
-
|
258 |
-
// Dashboard post 'visual' editor.
|
259 |
-
loadMentionsInTinyMCE();
|
260 |
});
|
261 |
})( jQuery );
|
76 |
* @since BuddyPress (2.1.0)
|
77 |
*/
|
78 |
before_reposition: function( offset ) {
|
79 |
+
var $view = $( '#atwho-ground-' + this.id + ' .atwho-view' ),
|
80 |
+
caret = this.$inputor.caret( 'offset', { iframe: $( '#content_ifr' )[0] } ).left,
|
81 |
+
move;
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
// If the caret is past horizontal half, then flip it, yo.
|
84 |
+
if ( caret > ( $( 'body' ).width() / 2 ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
$view.addClass( 'right' );
|
86 |
+
move = caret - offset.left - this.view.$el.width();
|
87 |
} else {
|
88 |
$view.removeClass( 'right' );
|
89 |
+
move = caret - offset.left + 1;
|
90 |
}
|
91 |
|
92 |
+
offset.top += 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
offset.left += move;
|
94 |
},
|
95 |
|
103 |
* @since BuddyPress (2.1.0)
|
104 |
*/
|
105 |
inserting_wrapper: function( $inputor, content, suffix ) {
|
106 |
+
var new_suffix = ( suffix === '' ) ? suffix : suffix || ' ';
|
107 |
+
return '' + content + new_suffix;
|
108 |
}
|
109 |
}
|
110 |
},
|
122 |
* @since BuddyPress (2.1.0)
|
123 |
*/
|
124 |
remote_filter: function( query, render_view ) {
|
125 |
+
var self = $( this );
|
|
|
126 |
|
127 |
mentionsItem = mentionsQueryCache[ query ];
|
128 |
if ( typeof mentionsItem === 'object' ) {
|
134 |
self.xhr.abort();
|
135 |
}
|
136 |
|
137 |
+
self.xhr = $.getJSON( ajaxurl, { 'action': 'bp_get_suggestions', 'term': query, 'type': 'members' } )
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
/**
|
139 |
* Success callback for the @suggestions lookup.
|
140 |
*
|
192 |
};
|
193 |
|
194 |
$( document ).ready(function() {
|
195 |
+
var users = [];
|
|
|
|
|
196 |
|
197 |
if ( typeof window.BP_Suggestions === 'object' ) {
|
198 |
users = window.BP_Suggestions.friends || users;
|
199 |
}
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
// Activity/reply, post comments, dashboard post 'text' editor.
|
202 |
$( '.bp-suggestions, #comments form textarea, .wp-editor-area' ).bp_mentions( users );
|
|
|
|
|
|
|
203 |
});
|
204 |
})( jQuery );
|
bp-activity/js/mentions.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
-
!function(a){var b,c=[];a.fn.bp_mentions=function(d){a.isArray(d)&&(d={data:d});var e={delay:200,hide_without_suffix:!0,insert_tpl:"</>${atwho-data-value}</>",limit:10,start_with_space:!1,suffix:"",callbacks:{filter:function(a,b,c){var d,e,f,g=[],h=new RegExp("^"+a+"| "+a,"ig");for(e=0,f=b.length;f>e;e++)d=b[e],d[c].toLowerCase().match(h)&&g.push(d);return g},highlighter:function(a,b){if(!b)return a;var c=new RegExp(">(\\s*|[\\w\\s]*)("+this.at.replace("+","\\+")+"?"+b.replace("+","\\+")+")([\\w ]*)\\s*<","ig");return a.replace(c,function(a,b,c,d){return">"+b+"<strong>"+c+"</strong>"+d+"<"})},before_reposition:function(b){var c,d
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
+
!function(a){var b,c=[];a.fn.bp_mentions=function(d){a.isArray(d)&&(d={data:d});var e={delay:200,hide_without_suffix:!0,insert_tpl:"</>${atwho-data-value}</>",limit:10,start_with_space:!1,suffix:"",callbacks:{filter:function(a,b,c){var d,e,f,g=[],h=new RegExp("^"+a+"| "+a,"ig");for(e=0,f=b.length;f>e;e++)d=b[e],d[c].toLowerCase().match(h)&&g.push(d);return g},highlighter:function(a,b){if(!b)return a;var c=new RegExp(">(\\s*|[\\w\\s]*)("+this.at.replace("+","\\+")+"?"+b.replace("+","\\+")+")([\\w ]*)\\s*<","ig");return a.replace(c,function(a,b,c,d){return">"+b+"<strong>"+c+"</strong>"+d+"<"})},before_reposition:function(b){var c,d=a("#atwho-ground-"+this.id+" .atwho-view"),e=this.$inputor.caret("offset",{iframe:a("#content_ifr")[0]}).left;e>a("body").width()/2?(d.addClass("right"),c=e-b.left-this.view.$el.width()):(d.removeClass("right"),c=e-b.left+1),b.top+=1,b.left+=c},inserting_wrapper:function(a,b,c){var d=""===c?c:c||" ";return""+b+d}}},f={callbacks:{remote_filter:function(d,e){var f=a(this);return b=c[d],"object"==typeof b?void e(b):(f.xhr&&f.xhr.abort(),void(f.xhr=a.getJSON(ajaxurl,{action:"bp_get_suggestions",term:d,type:"members"}).done(function(b){if(b.success){var f=a.map(b.data,function(a){return a.search=a.search||a.ID+" "+a.name,a});c[d]=f,e(f)}})))}},data:a.map(d.data,function(a){return a.search=a.search||a.ID+" "+a.name,a}),at:"@",search_key:"search",tpl:'<li data-value="@${ID}"><img src="${image}" /><span class="username">@${ID}</span><small>${name}</small></li>'},g=a.extend(!0,{},e,f,d);return a.fn.atwho.call(this,g)},a(document).ready(function(){var b=[];"object"==typeof window.BP_Suggestions&&(b=window.BP_Suggestions.friends||b),a(".bp-suggestions, #comments form textarea, .wp-editor-area").bp_mentions(b)})}(jQuery);
|
bp-blogs/bp-blogs-actions.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Redirect to a random blog in the multisite network.
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Redirect to a random blog in the multisite network.
|
bp-blogs/bp-blogs-activity.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Register activity actions for the blogs component.
|
@@ -33,29 +33,28 @@ function bp_blogs_register_activity_actions() {
|
|
33 |
'new_blog',
|
34 |
__( 'New site created', 'buddypress' ),
|
35 |
'bp_blogs_format_activity_action_new_blog',
|
36 |
-
__( 'New Sites', 'buddypress' )
|
37 |
-
0
|
38 |
);
|
39 |
}
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
-
/**
|
55 |
-
* Fires after the registry of the default blog component activity actions.
|
56 |
-
*
|
57 |
-
* @since BuddyPress (1.1.0)
|
58 |
-
*/
|
59 |
do_action( 'bp_blogs_register_activity_actions' );
|
60 |
}
|
61 |
add_action( 'bp_register_activity_actions', 'bp_blogs_register_activity_actions' );
|
@@ -86,14 +85,6 @@ function bp_blogs_format_activity_action_new_blog( $action, $activity ) {
|
|
86 |
}
|
87 |
}
|
88 |
|
89 |
-
/**
|
90 |
-
* Filters the new blog activity action for the new blog.
|
91 |
-
*
|
92 |
-
* @since BuddyPress (2.0.0)
|
93 |
-
*
|
94 |
-
* @param string $action Constructed activity action.
|
95 |
-
* @param obj $activity Activity data object.
|
96 |
-
*/
|
97 |
return apply_filters( 'bp_blogs_format_activity_action_new_blog', $action, $activity );
|
98 |
}
|
99 |
|
@@ -117,68 +108,27 @@ function bp_blogs_format_activity_action_new_blog_post( $action, $activity ) {
|
|
117 |
bp_blogs_update_blogmeta( $activity->item_id, 'name', $blog_name );
|
118 |
}
|
119 |
|
120 |
-
|
121 |
-
* When the post is published we are faking an activity object
|
122 |
-
* to which we add 2 properties :
|
123 |
-
* - the post url
|
124 |
-
* - the post title
|
125 |
-
* This is done to build the 'post link' part of the activity
|
126 |
-
* action string.
|
127 |
-
* NB: in this case the activity has not yet been created.
|
128 |
-
*/
|
129 |
-
if ( isset( $activity->post_url ) ) {
|
130 |
-
$post_url = $activity->post_url;
|
131 |
-
|
132 |
-
/**
|
133 |
-
* The post_url property is not set, we need to build the url
|
134 |
-
* thanks to the post id which is also saved as the secondary
|
135 |
-
* item id property of the activity object.
|
136 |
-
*/
|
137 |
-
} else {
|
138 |
-
$post_url = add_query_arg( 'p', $activity->secondary_item_id, trailingslashit( $blog_url ) );
|
139 |
-
}
|
140 |
|
141 |
-
|
142 |
-
if ( isset( $activity->post_title ) ) {
|
143 |
-
$post_title = $activity->post_title;
|
144 |
-
|
145 |
-
// If activity already exists try to get the post title from activity meta
|
146 |
-
} else if ( ! empty( $activity->id ) ) {
|
147 |
-
$post_title = bp_activity_get_meta( $activity->id, 'post_title' );
|
148 |
-
}
|
149 |
|
150 |
-
|
151 |
-
* In case the post was published without a title
|
152 |
-
* or the activity meta was not found
|
153 |
-
*/
|
154 |
if ( empty( $post_title ) ) {
|
155 |
-
// Defaults to no title
|
156 |
-
$post_title = esc_html__( '(no title)', 'buddypress' );
|
157 |
-
|
158 |
switch_to_blog( $activity->item_id );
|
159 |
|
160 |
$post = get_post( $activity->secondary_item_id );
|
161 |
if ( is_a( $post, 'WP_Post' ) ) {
|
162 |
-
|
163 |
-
|
164 |
-
$post_title = $post->post_title;
|
165 |
-
}
|
166 |
-
|
167 |
-
// Make sure the activity exists before saving the post title in activity meta
|
168 |
-
if ( ! empty( $activity->id ) ) {
|
169 |
-
bp_activity_update_meta( $activity->id, 'post_title', $post_title );
|
170 |
-
}
|
171 |
}
|
172 |
|
173 |
restore_current_blog();
|
174 |
}
|
175 |
|
176 |
-
|
177 |
-
$post_link = '<a href="' . esc_url( $post_url ) . '">' . $post_title . '</a>';
|
178 |
|
179 |
$user_link = bp_core_get_userlink( $activity->user_id );
|
180 |
|
181 |
-
// Build the complete activity action string
|
182 |
if ( is_multisite() ) {
|
183 |
$action = sprintf( __( '%1$s wrote a new post, %2$s, on the site %3$s', 'buddypress' ), $user_link, $post_link, '<a href="' . esc_url( $blog_url ) . '">' . esc_html( $blog_name ) . '</a>' );
|
184 |
} else {
|
@@ -196,14 +146,6 @@ function bp_blogs_format_activity_action_new_blog_post( $action, $activity ) {
|
|
196 |
}
|
197 |
}
|
198 |
|
199 |
-
/**
|
200 |
-
* Filters the new blog post action for the new blog.
|
201 |
-
*
|
202 |
-
* @since BuddyPress (2.0.0)
|
203 |
-
*
|
204 |
-
* @param string $action Constructed activity action.
|
205 |
-
* @param obj $activity Activity data object.
|
206 |
-
*/
|
207 |
return apply_filters( 'bp_blogs_format_activity_action_new_blog_post', $action, $activity );
|
208 |
}
|
209 |
|
@@ -251,7 +193,7 @@ function bp_blogs_format_activity_action_new_blog_comment( $action, $activity )
|
|
251 |
restore_current_blog();
|
252 |
}
|
253 |
|
254 |
-
$post_link = '<a href="' .
|
255 |
$user_link = bp_core_get_userlink( $activity->user_id );
|
256 |
|
257 |
if ( is_multisite() ) {
|
@@ -271,14 +213,6 @@ function bp_blogs_format_activity_action_new_blog_comment( $action, $activity )
|
|
271 |
}
|
272 |
}
|
273 |
|
274 |
-
/**
|
275 |
-
* Filters the new blog comment action for the new blog.
|
276 |
-
*
|
277 |
-
* @since BuddyPress (2.0.0)
|
278 |
-
*
|
279 |
-
* @param string $action Constructed activity action.
|
280 |
-
* @param obj $activity Activity data object.
|
281 |
-
*/
|
282 |
return apply_filters( 'bp_blogs_format_activity_action_new_blog_comment', $action, $activity );
|
283 |
}
|
284 |
|
@@ -360,28 +294,10 @@ function bp_blogs_record_activity( $args = '' ) {
|
|
360 |
}
|
361 |
|
362 |
if ( ! empty( $r['action'] ) ) {
|
363 |
-
|
364 |
-
/**
|
365 |
-
* Filters the action associated with activity for activity stream.
|
366 |
-
*
|
367 |
-
* @since BuddyPress (1.2.0)
|
368 |
-
*
|
369 |
-
* @param string $value Action for the activity stream.
|
370 |
-
*/
|
371 |
$r['action'] = apply_filters( 'bp_blogs_record_activity_action', $r['action'] );
|
372 |
}
|
373 |
|
374 |
if ( ! empty( $r['content'] ) ) {
|
375 |
-
|
376 |
-
/**
|
377 |
-
* Filters the content associated with activity for activity stream.
|
378 |
-
*
|
379 |
-
* @since BuddyPress (1.2.0)
|
380 |
-
*
|
381 |
-
* @param string $value Generated excerpt from content for the activity stream.
|
382 |
-
* @param string $value Content for the activity stream.
|
383 |
-
* @param array $r Array of arguments used for the activity stream item.
|
384 |
-
*/
|
385 |
$r['content'] = apply_filters( 'bp_blogs_record_activity_content', bp_create_excerpt( $r['content'] ), $r['content'], $r );
|
386 |
}
|
387 |
|
@@ -611,16 +527,6 @@ function bp_blogs_sync_add_from_activity_comment( $comment_id, $params, $parent_
|
|
611 |
// add the comment hook back
|
612 |
add_action( 'comment_post', 'bp_blogs_record_comment', 10, 2 );
|
613 |
|
614 |
-
/**
|
615 |
-
* Fires after activity comments have been synced and posted as blog comments.
|
616 |
-
*
|
617 |
-
* @since BuddyPress (2.0.0)
|
618 |
-
*
|
619 |
-
* @param int $comment_id The activity ID for the posted activity comment.
|
620 |
-
* @param array $args Array of args used for the comment syncing.
|
621 |
-
* @param object $parent_activity Parameters of the blog post parent activity item.
|
622 |
-
* @param object $user User data object for the blog comment.
|
623 |
-
*/
|
624 |
do_action( 'bp_blogs_sync_add_from_activity_comment', $comment_id, $args, $parent_activity, $user );
|
625 |
}
|
626 |
add_action( 'bp_activity_comment_posted', 'bp_blogs_sync_add_from_activity_comment', 10, 3 );
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Register activity actions for the blogs component.
|
33 |
'new_blog',
|
34 |
__( 'New site created', 'buddypress' ),
|
35 |
'bp_blogs_format_activity_action_new_blog',
|
36 |
+
__( 'New Sites', 'buddypress' )
|
|
|
37 |
);
|
38 |
}
|
39 |
|
40 |
+
bp_activity_set_action(
|
41 |
+
$bp->blogs->id,
|
42 |
+
'new_blog_post',
|
43 |
+
__( 'New post published', 'buddypress' ),
|
44 |
+
'bp_blogs_format_activity_action_new_blog_post',
|
45 |
+
__( 'Posts', 'buddypress' ),
|
46 |
+
array( 'activity', 'member' )
|
47 |
+
);
|
48 |
+
|
49 |
+
bp_activity_set_action(
|
50 |
+
$bp->blogs->id,
|
51 |
+
'new_blog_comment',
|
52 |
+
__( 'New post comment posted', 'buddypress' ),
|
53 |
+
'bp_blogs_format_activity_action_new_blog_comment',
|
54 |
+
__( 'Comments', 'buddypress' ),
|
55 |
+
array( 'activity', 'member' )
|
56 |
+
);
|
57 |
|
|
|
|
|
|
|
|
|
|
|
58 |
do_action( 'bp_blogs_register_activity_actions' );
|
59 |
}
|
60 |
add_action( 'bp_register_activity_actions', 'bp_blogs_register_activity_actions' );
|
85 |
}
|
86 |
}
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
return apply_filters( 'bp_blogs_format_activity_action_new_blog', $action, $activity );
|
89 |
}
|
90 |
|
108 |
bp_blogs_update_blogmeta( $activity->item_id, 'name', $blog_name );
|
109 |
}
|
110 |
|
111 |
+
$post_url = add_query_arg( 'p', $activity->secondary_item_id, trailingslashit( $blog_url ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
+
$post_title = bp_activity_get_meta( $activity->id, 'post_title' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
+
// Should only be empty at the time of post creation
|
|
|
|
|
|
|
116 |
if ( empty( $post_title ) ) {
|
|
|
|
|
|
|
117 |
switch_to_blog( $activity->item_id );
|
118 |
|
119 |
$post = get_post( $activity->secondary_item_id );
|
120 |
if ( is_a( $post, 'WP_Post' ) ) {
|
121 |
+
$post_title = $post->post_title;
|
122 |
+
bp_activity_update_meta( $activity->id, 'post_title', $post_title );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
}
|
124 |
|
125 |
restore_current_blog();
|
126 |
}
|
127 |
|
128 |
+
$post_link = '<a href="' . $post_url . '">' . $post_title . '</a>';
|
|
|
129 |
|
130 |
$user_link = bp_core_get_userlink( $activity->user_id );
|
131 |
|
|
|
132 |
if ( is_multisite() ) {
|
133 |
$action = sprintf( __( '%1$s wrote a new post, %2$s, on the site %3$s', 'buddypress' ), $user_link, $post_link, '<a href="' . esc_url( $blog_url ) . '">' . esc_html( $blog_name ) . '</a>' );
|
134 |
} else {
|
146 |
}
|
147 |
}
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
return apply_filters( 'bp_blogs_format_activity_action_new_blog_post', $action, $activity );
|
150 |
}
|
151 |
|
193 |
restore_current_blog();
|
194 |
}
|
195 |
|
196 |
+
$post_link = '<a href="' . $post_url . '">' . $post_title . '</a>';
|
197 |
$user_link = bp_core_get_userlink( $activity->user_id );
|
198 |
|
199 |
if ( is_multisite() ) {
|
213 |
}
|
214 |
}
|
215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
return apply_filters( 'bp_blogs_format_activity_action_new_blog_comment', $action, $activity );
|
217 |
}
|
218 |
|
294 |
}
|
295 |
|
296 |
if ( ! empty( $r['action'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
$r['action'] = apply_filters( 'bp_blogs_record_activity_action', $r['action'] );
|
298 |
}
|
299 |
|
300 |
if ( ! empty( $r['content'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
$r['content'] = apply_filters( 'bp_blogs_record_activity_content', bp_create_excerpt( $r['content'] ), $r['content'], $r );
|
302 |
}
|
303 |
|
527 |
// add the comment hook back
|
528 |
add_action( 'comment_post', 'bp_blogs_record_comment', 10, 2 );
|
529 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
do_action( 'bp_blogs_sync_add_from_activity_comment', $comment_id, $args, $parent_activity, $user );
|
531 |
}
|
532 |
add_action( 'bp_activity_comment_posted', 'bp_blogs_sync_add_from_activity_comment', 10, 3 );
|
bp-blogs/bp-blogs-cache.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
-
defined( 'ABSPATH' )
|
15 |
|
16 |
/**
|
17 |
* Slurp up blogmeta for a specified set of blogs.
|
@@ -42,19 +42,27 @@ function bp_blogs_update_meta_cache( $blog_ids = false ) {
|
|
42 |
* @param int $blog_id ID of the current blog.
|
43 |
* @param int $user_id ID of the user whose blog cache should be cleared.
|
44 |
*/
|
45 |
-
function bp_blogs_clear_blog_object_cache( $blog_id
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
wp_cache_delete( 'bp_total_blogs', 'bp' );
|
52 |
}
|
53 |
|
54 |
// List actions to clear object caches on
|
55 |
add_action( 'bp_blogs_remove_blog_for_user', 'bp_blogs_clear_blog_object_cache', 10, 2 );
|
56 |
-
add_action( '
|
57 |
-
add_action( 'bp_blogs_remove_blog', 'bp_blogs_clear_blog_object_cache' );
|
58 |
|
59 |
// List actions to clear super cached pages on, if super cache is installed
|
60 |
add_action( 'bp_blogs_remove_data_for_blog', 'bp_core_clear_cache' );
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
/**
|
17 |
* Slurp up blogmeta for a specified set of blogs.
|
42 |
* @param int $blog_id ID of the current blog.
|
43 |
* @param int $user_id ID of the user whose blog cache should be cleared.
|
44 |
*/
|
45 |
+
function bp_blogs_clear_blog_object_cache( $blog_id, $user_id ) {
|
46 |
+
wp_cache_delete( 'bp_blogs_of_user_' . $user_id, 'bp' );
|
47 |
+
wp_cache_delete( 'bp_total_blogs_for_user_' . $user_id, 'bp' );
|
48 |
+
}
|
|
|
49 |
|
50 |
+
/**
|
51 |
+
* Clear cache when a new blog is created.
|
52 |
+
*
|
53 |
+
* @since BuddyPress (1.0.0)
|
54 |
+
*
|
55 |
+
* @param BP_Blogs_Blog $recorded_blog_obj The recorded blog, passed by
|
56 |
+
* 'bp_blogs_new_blog'.
|
57 |
+
*/
|
58 |
+
function bp_blogs_format_clear_blog_cache( $recorded_blog_obj ) {
|
59 |
+
bp_blogs_clear_blog_object_cache( false, $recorded_blog_obj->user_id );
|
60 |
wp_cache_delete( 'bp_total_blogs', 'bp' );
|
61 |
}
|
62 |
|
63 |
// List actions to clear object caches on
|
64 |
add_action( 'bp_blogs_remove_blog_for_user', 'bp_blogs_clear_blog_object_cache', 10, 2 );
|
65 |
+
add_action( 'bp_blogs_new_blog', 'bp_blogs_format_clear_blog_cache', 10, 2 );
|
|
|
66 |
|
67 |
// List actions to clear super cached pages on, if super cache is installed
|
68 |
add_action( 'bp_blogs_remove_data_for_blog', 'bp_core_clear_cache' );
|
bp-blogs/bp-blogs-classes.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* The main BuddyPress blog class.
|
@@ -58,15 +58,6 @@ class BP_Blogs_Blog {
|
|
58 |
$this->user_id = apply_filters( 'bp_blogs_blog_user_id_before_save', $this->user_id, $this->id );
|
59 |
$this->blog_id = apply_filters( 'bp_blogs_blog_id_before_save', $this->blog_id, $this->id );
|
60 |
|
61 |
-
/**
|
62 |
-
* Fires before the current blog item gets saved.
|
63 |
-
*
|
64 |
-
* Please use this hook to filter the properties above. Each part will be passed in.
|
65 |
-
*
|
66 |
-
* @since BuddyPress (1.0.0)
|
67 |
-
*
|
68 |
-
* @param BP_Blogs_Blog Current instance of the blog item being saved. Passed by reference.
|
69 |
-
*/
|
70 |
do_action_ref_array( 'bp_blogs_blog_before_save', array( &$this ) );
|
71 |
|
72 |
// Don't try and save if there is no user ID or blog ID set.
|
@@ -88,15 +79,6 @@ class BP_Blogs_Blog {
|
|
88 |
if ( !$wpdb->query($sql) )
|
89 |
return false;
|
90 |
|
91 |
-
/**
|
92 |
-
* Fires after the current blog item gets saved.
|
93 |
-
*
|
94 |
-
* Please use this hook to filter the properties above. Each part will be passed in.
|
95 |
-
*
|
96 |
-
* @since BuddyPress (1.0.0)
|
97 |
-
*
|
98 |
-
* @param BP_Blogs_Blog Current instance of the blog item being saved. Passed by reference.
|
99 |
-
*/
|
100 |
do_action_ref_array( 'bp_blogs_blog_after_save', array( &$this ) );
|
101 |
|
102 |
if ( $this->id )
|
@@ -156,7 +138,7 @@ class BP_Blogs_Blog {
|
|
156 |
$order_sql = "ORDER BY bm.meta_value DESC";
|
157 |
break;
|
158 |
case 'alphabetical':
|
159 |
-
$order_sql = "ORDER BY
|
160 |
break;
|
161 |
case 'newest':
|
162 |
$order_sql = "ORDER BY wb.registered DESC";
|
@@ -173,43 +155,16 @@ class BP_Blogs_Blog {
|
|
173 |
$include_sql = " AND b.blog_id IN ({$blog_ids_sql})";
|
174 |
}
|
175 |
|
176 |
-
if ( !
|
177 |
$search_terms_like = '%' . bp_esc_like( $search_terms ) . '%';
|
178 |
-
$search_terms_sql = $wpdb->prepare( '
|
|
|
|
|
179 |
} else {
|
180 |
-
$
|
|
|
181 |
}
|
182 |
|
183 |
-
$paged_blogs = $wpdb->get_results( "
|
184 |
-
SELECT b.blog_id, b.user_id as admin_user_id, u.user_email as admin_user_email, wb.domain, wb.path, bm.meta_value as last_activity, bm_name.meta_value as name
|
185 |
-
FROM
|
186 |
-
{$bp->blogs->table_name} b
|
187 |
-
LEFT JOIN {$bp->blogs->table_name_blogmeta} bm ON (b.blog_id = bm.blog_id)
|
188 |
-
LEFT JOIN {$bp->blogs->table_name_blogmeta} bm_name ON (b.blog_id = bm_name.blog_id)
|
189 |
-
LEFT JOIN {$bp->blogs->table_name_blogmeta} bm_description ON (b.blog_id = bm_description.blog_id)
|
190 |
-
LEFT JOIN {$wpdb->base_prefix}blogs wb ON (b.blog_id = wb.blog_id)
|
191 |
-
LEFT JOIN {$wpdb->users} u ON (b.user_id = u.ID)
|
192 |
-
WHERE
|
193 |
-
wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql}
|
194 |
-
AND bm.meta_key = 'last_activity' AND bm_name.meta_key = 'name' AND bm_description.meta_key = 'description'
|
195 |
-
{$search_terms_sql} {$user_sql} {$include_sql}
|
196 |
-
GROUP BY b.blog_id {$order_sql} {$pag_sql}
|
197 |
-
" );
|
198 |
-
|
199 |
-
$total_blogs = $wpdb->get_var( "
|
200 |
-
SELECT COUNT(DISTINCT b.blog_id)
|
201 |
-
FROM
|
202 |
-
{$bp->blogs->table_name} b
|
203 |
-
LEFT JOIN {$wpdb->base_prefix}blogs wb ON (b.blog_id = wb.blog_id)
|
204 |
-
LEFT JOIN {$bp->blogs->table_name_blogmeta} bm_name ON (b.blog_id = bm_name.blog_id)
|
205 |
-
LEFT JOIN {$bp->blogs->table_name_blogmeta} bm_description ON (b.blog_id = bm_description.blog_id)
|
206 |
-
WHERE
|
207 |
-
wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql}
|
208 |
-
AND
|
209 |
-
bm_name.meta_key = 'name' AND bm_description.meta_key = 'description'
|
210 |
-
{$search_terms_sql} {$user_sql} {$include_sql}
|
211 |
-
" );
|
212 |
-
|
213 |
$blog_ids = array();
|
214 |
foreach ( (array) $paged_blogs as $blog ) {
|
215 |
$blog_ids[] = (int) $blog->blog_id;
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* The main BuddyPress blog class.
|
58 |
$this->user_id = apply_filters( 'bp_blogs_blog_user_id_before_save', $this->user_id, $this->id );
|
59 |
$this->blog_id = apply_filters( 'bp_blogs_blog_id_before_save', $this->blog_id, $this->id );
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
do_action_ref_array( 'bp_blogs_blog_before_save', array( &$this ) );
|
62 |
|
63 |
// Don't try and save if there is no user ID or blog ID set.
|
79 |
if ( !$wpdb->query($sql) )
|
80 |
return false;
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
do_action_ref_array( 'bp_blogs_blog_after_save', array( &$this ) );
|
83 |
|
84 |
if ( $this->id )
|
138 |
$order_sql = "ORDER BY bm.meta_value DESC";
|
139 |
break;
|
140 |
case 'alphabetical':
|
141 |
+
$order_sql = "ORDER BY bm2.meta_value ASC";
|
142 |
break;
|
143 |
case 'newest':
|
144 |
$order_sql = "ORDER BY wb.registered DESC";
|
155 |
$include_sql = " AND b.blog_id IN ({$blog_ids_sql})";
|
156 |
}
|
157 |
|
158 |
+
if ( !empty( $search_terms ) ) {
|
159 |
$search_terms_like = '%' . bp_esc_like( $search_terms ) . '%';
|
160 |
+
$search_terms_sql = $wpdb->prepare( 'bm2.meta_value LIKE %s', $search_terms_like );
|
161 |
+
$paged_blogs = $wpdb->get_results( "SELECT b.blog_id, b.user_id as admin_user_id, u.user_email as admin_user_email, wb.domain, wb.path, bm.meta_value as last_activity, bm2.meta_value as name FROM {$bp->blogs->table_name} b, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2, {$wpdb->base_prefix}blogs wb, {$wpdb->users} u WHERE b.blog_id = wb.blog_id AND b.user_id = u.ID AND b.blog_id = bm.blog_id AND b.blog_id = bm2.blog_id AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'last_activity' AND bm2.meta_key = 'name' AND {$search_terms_sql} {$user_sql} {$include_sql} GROUP BY b.blog_id {$order_sql} {$pag_sql}" );
|
162 |
+
$total_blogs = $wpdb->get_var( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2 WHERE b.blog_id = wb.blog_id AND bm.blog_id = b.blog_id AND bm2.blog_id = b.blog_id AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'name' AND bm2.meta_key = 'description' AND {$search_terms_sql} {$user_sql} {$include_sql}" );
|
163 |
} else {
|
164 |
+
$paged_blogs = $wpdb->get_results( "SELECT b.blog_id, b.user_id as admin_user_id, u.user_email as admin_user_email, wb.domain, wb.path, bm.meta_value as last_activity, bm2.meta_value as name FROM {$bp->blogs->table_name} b, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2, {$wpdb->base_prefix}blogs wb, {$wpdb->users} u WHERE b.blog_id = wb.blog_id AND b.user_id = u.ID AND b.blog_id = bm.blog_id AND b.blog_id = bm2.blog_id {$user_sql} AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'last_activity' AND bm2.meta_key = 'name' {$include_sql} GROUP BY b.blog_id {$order_sql} {$pag_sql}" );
|
165 |
+
$total_blogs = $wpdb->get_var( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb WHERE b.blog_id = wb.blog_id {$user_sql} AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$include_sql} {$hidden_sql}" );
|
166 |
}
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
$blog_ids = array();
|
169 |
foreach ( (array) $paged_blogs as $blog ) {
|
170 |
$blog_ids[] = (int) $blog->blog_id;
|
bp-blogs/bp-blogs-filters.php
CHANGED
@@ -33,14 +33,6 @@ add_filter( 'bp_blog_latest_post_content', 'prepend_attachment' );
|
|
33 |
* @return string The new URL.
|
34 |
*/
|
35 |
function bp_blogs_creation_location( $url ) {
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Filters the 'Create a new site' link URL.
|
39 |
-
*
|
40 |
-
* @since BuddyPress (1.6.0)
|
41 |
-
*
|
42 |
-
* @param string $value URL for the 'Create a new site' signup page.
|
43 |
-
*/
|
44 |
return apply_filters( 'bp_blogs_creation_location', trailingslashit( bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create', $url ) );
|
45 |
}
|
46 |
add_filter( 'wp_signup_location', 'bp_blogs_creation_location' );
|
@@ -50,73 +42,13 @@ add_filter( 'wp_signup_location', 'bp_blogs_creation_location' );
|
|
50 |
*
|
51 |
* @since BuddyPress (2.1.0)
|
52 |
*
|
53 |
-
* @see
|
54 |
*
|
55 |
* @param array Current SQL clauses in array format
|
56 |
* @return array
|
57 |
*/
|
58 |
function bp_blogs_comments_clauses_select_by_id( $retval ) {
|
59 |
$retval['fields'] = 'comment_ID';
|
60 |
-
|
61 |
return $retval;
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Check whether the current post can be published.
|
66 |
-
*
|
67 |
-
* Abstracted from the deprecated `bp_blogs_record_post()`.
|
68 |
-
*
|
69 |
-
* @since BuddyPress (2.2.0)
|
70 |
-
*
|
71 |
-
* @param bool $return Whether the post should be published.
|
72 |
-
* @param int $blog_id ID of the blog.
|
73 |
-
* @param int $post_id ID of the post.
|
74 |
-
* @param int $user_id ID of the post author.
|
75 |
-
* @return bool True to authorize the post to be published, otherwise false.
|
76 |
-
*/
|
77 |
-
function bp_blogs_post_pre_publish( $return = true, $blog_id = 0, $post_id = 0, $user_id = 0 ) {
|
78 |
-
$bp = buddypress();
|
79 |
-
|
80 |
-
// If blog is not trackable, do not record the activity.
|
81 |
-
if ( ! bp_blogs_is_blog_trackable( $blog_id, $user_id ) ) {
|
82 |
-
return false;
|
83 |
-
}
|
84 |
-
|
85 |
-
/*
|
86 |
-
* Stop infinite loops with WordPress MU Sitewide Tags.
|
87 |
-
* That plugin changed the way its settings were stored at some point. Thus the dual check.
|
88 |
-
*/
|
89 |
-
if ( ! empty( $bp->site_options['sitewide_tags_blog'] ) ) {
|
90 |
-
$st_options = maybe_unserialize( $bp->site_options['sitewide_tags_blog'] );
|
91 |
-
$tags_blog_id = isset( $st_options['tags_blog_id'] ) ? $st_options['tags_blog_id'] : 0;
|
92 |
-
} else {
|
93 |
-
$tags_blog_id = isset( $bp->site_options['tags_blog_id'] ) ? $bp->site_options['tags_blog_id'] : 0;
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Filters whether or not BuddyPress should block sitewide tags activity.
|
98 |
-
*
|
99 |
-
* @since BuddyPress (2.2.0)
|
100 |
-
*
|
101 |
-
* @param bool $value Current status of the sitewide tags activity.
|
102 |
-
*/
|
103 |
-
if ( (int) $blog_id == $tags_blog_id && apply_filters( 'bp_blogs_block_sitewide_tags_activity', true ) ) {
|
104 |
-
return false;
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Filters whether or not the current blog is public.
|
109 |
-
*
|
110 |
-
* @since BuddyPress (2.2.0)
|
111 |
-
*
|
112 |
-
* @param int $value Value from the blog_public option for the current blog.
|
113 |
-
*/
|
114 |
-
$is_blog_public = apply_filters( 'bp_is_blog_public', (int) get_blog_option( $blog_id, 'blog_public' ) );
|
115 |
-
|
116 |
-
if ( 0 === $is_blog_public && is_multisite() ) {
|
117 |
-
return false;
|
118 |
-
}
|
119 |
-
|
120 |
-
return $return;
|
121 |
-
}
|
122 |
-
add_filter( 'bp_activity_post_pre_publish', 'bp_blogs_post_pre_publish', 10, 4 );
|
33 |
* @return string The new URL.
|
34 |
*/
|
35 |
function bp_blogs_creation_location( $url ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
return apply_filters( 'bp_blogs_creation_location', trailingslashit( bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create', $url ) );
|
37 |
}
|
38 |
add_filter( 'wp_signup_location', 'bp_blogs_creation_location' );
|
42 |
*
|
43 |
* @since BuddyPress (2.1.0)
|
44 |
*
|
45 |
+
* @see bp_blogs_update_post()
|
46 |
*
|
47 |
* @param array Current SQL clauses in array format
|
48 |
* @return array
|
49 |
*/
|
50 |
function bp_blogs_comments_clauses_select_by_id( $retval ) {
|
51 |
$retval['fields'] = 'comment_ID';
|
52 |
+
|
53 |
return $retval;
|
54 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp-blogs/bp-blogs-functions.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/**
|
13 |
* Check whether the $bp global lists an activity directory page.
|
@@ -283,15 +283,6 @@ function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) {
|
|
283 |
) );
|
284 |
}
|
285 |
|
286 |
-
/**
|
287 |
-
* Fires after BuddyPress has been made aware of a new site for activity tracking.
|
288 |
-
*
|
289 |
-
* @since BuddyPress (1.0.0)
|
290 |
-
*
|
291 |
-
* @param BP_Blogs_Blog $recorded_blog Current blog being recorded. Passed by reference.
|
292 |
-
* @param bool $is_private Whether or not the current blog being recorded is private.
|
293 |
-
* @param bool $is_recorded Whether or not the current blog was recorded.
|
294 |
-
*/
|
295 |
do_action_ref_array( 'bp_blogs_new_blog', array( &$recorded_blog, $is_private, $is_recorded ) );
|
296 |
}
|
297 |
add_action( 'wpmu_new_blog', 'bp_blogs_record_blog', 10, 2 );
|
@@ -411,63 +402,199 @@ function bp_blogs_update_option_thread_comments_depth( $oldvalue, $newvalue ) {
|
|
411 |
add_action( 'update_option_thread_comments_depth', 'bp_blogs_update_option_thread_comments_depth', 10, 2 );
|
412 |
|
413 |
/**
|
414 |
-
*
|
|
|
|
|
|
|
|
|
415 |
*
|
416 |
-
*
|
417 |
*
|
418 |
-
* @
|
419 |
-
*
|
|
|
|
|
|
|
|
|
|
|
420 |
*/
|
421 |
-
function
|
422 |
-
|
423 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
}
|
|
|
|
|
425 |
|
426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
|
428 |
-
|
429 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
} else {
|
431 |
-
$
|
432 |
}
|
433 |
|
434 |
-
|
|
|
435 |
|
436 |
-
//
|
437 |
-
|
|
|
438 |
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
}
|
450 |
-
add_action( 'bp_activity_post_type_published', 'bp_blogs_publish_post_activity_meta', 10, 3 );
|
451 |
|
452 |
/**
|
453 |
-
* Updates a blog post's activity
|
|
|
|
|
454 |
*
|
455 |
-
* @
|
456 |
*
|
457 |
-
* @param WP_Post
|
458 |
-
* @param BP_Activity_Activity $activity Activity object.
|
459 |
*/
|
460 |
-
function
|
461 |
-
if (
|
462 |
return;
|
463 |
}
|
464 |
|
465 |
-
|
466 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
if ( $post->post_title !== $existing_title ) {
|
468 |
-
bp_activity_update_meta( $
|
469 |
|
470 |
-
//
|
471 |
add_filter( 'comments_clauses', 'bp_blogs_comments_clauses_select_by_id' );
|
472 |
$comments = get_comments( array( 'post_id' => $post->ID ) );
|
473 |
remove_filter( 'comments_clauses', 'bp_blogs_comments_clauses_select_by_id' );
|
@@ -476,14 +603,14 @@ function bp_blogs_update_post_activity_meta( $post, $activity ) {
|
|
476 |
$activity_ids = array();
|
477 |
$comment_ids = wp_list_pluck( $comments, 'comment_ID' );
|
478 |
|
479 |
-
//
|
480 |
$args = array(
|
481 |
'update_meta_cache' => false,
|
482 |
'show_hidden' => true,
|
483 |
'per_page' => 99999,
|
484 |
);
|
485 |
|
486 |
-
//
|
487 |
$args['filter'] = array(
|
488 |
'object' => buddypress()->blogs->id,
|
489 |
'action' => 'new_blog_comment',
|
@@ -495,7 +622,7 @@ function bp_blogs_update_post_activity_meta( $post, $activity ) {
|
|
495 |
$activity_ids = (array) wp_list_pluck( $activities['activities'], 'id' );
|
496 |
}
|
497 |
|
498 |
-
//
|
499 |
unset( $args['filter'] );
|
500 |
$args['meta_query'] = array( array(
|
501 |
'key' => 'bp_blogs_post_comment_id',
|
@@ -510,7 +637,7 @@ function bp_blogs_update_post_activity_meta( $post, $activity ) {
|
|
510 |
$activity_ids = array_merge( $activity_ids, (array) wp_list_pluck( $activities['activities'], 'id' ) );
|
511 |
}
|
512 |
|
513 |
-
//
|
514 |
if ( ! empty( $activity_ids ) ) {
|
515 |
foreach ( $activity_ids as $aid ) {
|
516 |
bp_activity_update_meta( $aid, 'post_title', $post->post_title );
|
@@ -521,14 +648,13 @@ function bp_blogs_update_post_activity_meta( $post, $activity ) {
|
|
521 |
}
|
522 |
}
|
523 |
|
524 |
-
//
|
525 |
if( 'closed' == $post->comment_status ) {
|
526 |
-
bp_activity_update_meta( $
|
527 |
} else {
|
528 |
-
bp_activity_delete_meta( $
|
529 |
}
|
530 |
}
|
531 |
-
add_action( 'bp_activity_post_type_updated', 'bp_blogs_update_post_activity_meta', 10, 2 );
|
532 |
|
533 |
/**
|
534 |
* Record a new blog comment in the BuddyPress activity stream.
|
@@ -808,7 +934,7 @@ add_action( 'remove_user_from_blog', 'bp_blogs_remove_user_from_blog', 10, 2 );
|
|
808 |
* core function, so that we can be sure that the Blogs component is loaded
|
809 |
* first. See http://buddypress.trac.wordpress.org/ticket/3916.
|
810 |
*
|
811 |
-
* @since BuddyPress (1.6
|
812 |
* @access private
|
813 |
*/
|
814 |
function bp_blogs_maybe_add_user_to_blog() {
|
@@ -829,15 +955,6 @@ function bp_blogs_remove_blog( $blog_id ) {
|
|
829 |
global $bp;
|
830 |
|
831 |
$blog_id = (int) $blog_id;
|
832 |
-
|
833 |
-
/**
|
834 |
-
* Fires before a "blog created" item is removed from blogs
|
835 |
-
* tracker and activity stream.
|
836 |
-
*
|
837 |
-
* @since BuddyPress (1.5.0)
|
838 |
-
*
|
839 |
-
* @param int $blog_id ID of the blog having its item removed.
|
840 |
-
*/
|
841 |
do_action( 'bp_blogs_before_remove_blog', $blog_id );
|
842 |
|
843 |
BP_Blogs_Blog::delete_blog_for_all( $blog_id );
|
@@ -845,14 +962,6 @@ function bp_blogs_remove_blog( $blog_id ) {
|
|
845 |
// Delete activity stream item
|
846 |
bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->id, 'type' => 'new_blog' ) );
|
847 |
|
848 |
-
/**
|
849 |
-
* Fires after a "blog created" item has been removed from blogs
|
850 |
-
* tracker and activity stream.
|
851 |
-
*
|
852 |
-
* @since BuddyPress (1.0.0)
|
853 |
-
*
|
854 |
-
* @param int $blog_id ID of the blog who had its item removed.
|
855 |
-
*/
|
856 |
do_action( 'bp_blogs_remove_blog', $blog_id );
|
857 |
}
|
858 |
add_action( 'delete_blog', 'bp_blogs_remove_blog' );
|
@@ -869,14 +978,6 @@ function bp_blogs_remove_blog_for_user( $user_id, $blog_id ) {
|
|
869 |
$blog_id = (int) $blog_id;
|
870 |
$user_id = (int) $user_id;
|
871 |
|
872 |
-
/**
|
873 |
-
* Fires before a blog is removed from the tracker for a specific user.
|
874 |
-
*
|
875 |
-
* @since BuddyPress (1.5.0)
|
876 |
-
*
|
877 |
-
* @param int $blog_id ID of the blog being removed.
|
878 |
-
* @param int $user_id ID of the user having the blog removed for.
|
879 |
-
*/
|
880 |
do_action( 'bp_blogs_before_remove_blog_for_user', $blog_id, $user_id );
|
881 |
|
882 |
BP_Blogs_Blog::delete_blog_for_user( $blog_id, $user_id );
|
@@ -888,14 +989,6 @@ function bp_blogs_remove_blog_for_user( $user_id, $blog_id ) {
|
|
888 |
'type' => 'new_blog'
|
889 |
) );
|
890 |
|
891 |
-
/**
|
892 |
-
* Fires after a blog has been removed from the tracker for a specific user.
|
893 |
-
*
|
894 |
-
* @since BuddyPress (1.0.0)
|
895 |
-
*
|
896 |
-
* @param int $blog_id ID of the blog that was removed.
|
897 |
-
* @param int $user_id ID of the user having the blog removed for.
|
898 |
-
*/
|
899 |
do_action( 'bp_blogs_remove_blog_for_user', $blog_id, $user_id );
|
900 |
}
|
901 |
add_action( 'remove_user_from_blog', 'bp_blogs_remove_blog_for_user', 10, 2 );
|
@@ -922,29 +1015,11 @@ function bp_blogs_remove_post( $post_id, $blog_id = 0, $user_id = 0 ) {
|
|
922 |
if ( !$user_id )
|
923 |
$user_id = bp_loggedin_user_id();
|
924 |
|
925 |
-
/**
|
926 |
-
* Fires before removal of a blog post activity item from the activity stream.
|
927 |
-
*
|
928 |
-
* @since BuddyPress (1.5.0)
|
929 |
-
*
|
930 |
-
* @param int $blog_id ID of the blog associated with the post that was removed.
|
931 |
-
* @param int $post_id ID of the post that was removed.
|
932 |
-
* @param int $user_id ID of the user having the blog removed for.
|
933 |
-
*/
|
934 |
do_action( 'bp_blogs_before_remove_post', $blog_id, $post_id, $user_id );
|
935 |
|
936 |
// Delete activity stream item
|
937 |
bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'secondary_item_id' => $post_id, 'component' => $bp->blogs->id, 'type' => 'new_blog_post' ) );
|
938 |
|
939 |
-
/**
|
940 |
-
* Fires after removal of a blog post activity item from the activity stream.
|
941 |
-
*
|
942 |
-
* @since BuddyPress (1.0.0)
|
943 |
-
*
|
944 |
-
* @param int $blog_id ID of the blog associated with the post that was removed.
|
945 |
-
* @param int $post_id ID of the post that was removed.
|
946 |
-
* @param int $user_id ID of the user having the blog removed for.
|
947 |
-
*/
|
948 |
do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $user_id );
|
949 |
}
|
950 |
add_action( 'delete_post', 'bp_blogs_remove_post' );
|
@@ -1004,15 +1079,6 @@ function bp_blogs_remove_comment( $comment_id ) {
|
|
1004 |
}
|
1005 |
}
|
1006 |
|
1007 |
-
/**
|
1008 |
-
* Fires after a blog comment activity item was removed from activity stream.
|
1009 |
-
*
|
1010 |
-
* @since BuddyPress (1.0.0)
|
1011 |
-
*
|
1012 |
-
* @param int $blogid Item ID for the blog associated with the removed comment.
|
1013 |
-
* @param int $comment_id ID of the comment being removed.
|
1014 |
-
* @param int $value ID of the current logged in user.
|
1015 |
-
*/
|
1016 |
do_action( 'bp_blogs_remove_comment', $wpdb->blogid, $comment_id, bp_loggedin_user_id() );
|
1017 |
}
|
1018 |
add_action( 'delete_comment', 'bp_blogs_remove_comment' );
|
@@ -1144,9 +1210,7 @@ add_action( 'transition_comment_status', 'bp_blogs_transition_activity_status',
|
|
1144 |
* @return int $count Total blog count.
|
1145 |
*/
|
1146 |
function bp_blogs_total_blogs() {
|
1147 |
-
|
1148 |
-
|
1149 |
-
if ( false === $count ) {
|
1150 |
$blogs = BP_Blogs_Blog::get_all();
|
1151 |
$count = $blogs['total'];
|
1152 |
wp_cache_set( 'bp_total_blogs', $count, 'bp' );
|
@@ -1190,14 +1254,6 @@ function bp_blogs_total_blogs_for_user( $user_id = 0 ) {
|
|
1190 |
function bp_blogs_remove_data_for_blog( $blog_id ) {
|
1191 |
global $bp;
|
1192 |
|
1193 |
-
/**
|
1194 |
-
* Fires before all data related to a given blog is removed from blogs tracker
|
1195 |
-
* and activity stream.
|
1196 |
-
*
|
1197 |
-
* @since BuddyPress (1.5.0)
|
1198 |
-
*
|
1199 |
-
* @param int $blog_id ID of the blog whose data is being removed.
|
1200 |
-
*/
|
1201 |
do_action( 'bp_blogs_before_remove_data_for_blog', $blog_id );
|
1202 |
|
1203 |
// If this is regular blog, delete all data for that blog.
|
@@ -1206,14 +1262,6 @@ function bp_blogs_remove_data_for_blog( $blog_id ) {
|
|
1206 |
// Delete activity stream item
|
1207 |
bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->id, 'type' => false ) );
|
1208 |
|
1209 |
-
/**
|
1210 |
-
* Fires after all data related to a given blog has been removed from blogs tracker
|
1211 |
-
* and activity stream.
|
1212 |
-
*
|
1213 |
-
* @since BuddyPress (1.0.0)
|
1214 |
-
*
|
1215 |
-
* @param int $blog_id ID of the blog whose data is being removed.
|
1216 |
-
*/
|
1217 |
do_action( 'bp_blogs_remove_data_for_blog', $blog_id );
|
1218 |
}
|
1219 |
add_action( 'delete_blog', 'bp_blogs_remove_data_for_blog', 1 );
|
@@ -1280,7 +1328,7 @@ function bp_blogs_is_blog_hidden( $blog_id ) {
|
|
1280 |
*/
|
1281 |
|
1282 |
/**
|
1283 |
-
* Delete a
|
1284 |
*
|
1285 |
* @global object $wpdb WordPress database access object.
|
1286 |
* @global object $bp BuddyPress global settings.
|
@@ -1398,53 +1446,13 @@ function bp_blogs_remove_data( $user_id ) {
|
|
1398 |
if ( !is_multisite() )
|
1399 |
return false;
|
1400 |
|
1401 |
-
/**
|
1402 |
-
* Fires before all blog associations are removed for a given user.
|
1403 |
-
*
|
1404 |
-
* @since BuddyPress (1.5.0)
|
1405 |
-
*
|
1406 |
-
* @param int $user_id ID of the user whose blog associations are being removed.
|
1407 |
-
*/
|
1408 |
do_action( 'bp_blogs_before_remove_data', $user_id );
|
1409 |
|
1410 |
// If this is regular blog, delete all data for that blog.
|
1411 |
BP_Blogs_Blog::delete_blogs_for_user( $user_id );
|
1412 |
|
1413 |
-
/**
|
1414 |
-
* Fires after all blog associations are removed for a given user.
|
1415 |
-
*
|
1416 |
-
* @since BuddyPress (1.0.0)
|
1417 |
-
*
|
1418 |
-
* @param int $user_id ID of the user whose blog associations were removed.
|
1419 |
-
*/
|
1420 |
do_action( 'bp_blogs_remove_data', $user_id );
|
1421 |
}
|
1422 |
add_action( 'wpmu_delete_user', 'bp_blogs_remove_data' );
|
1423 |
add_action( 'delete_user', 'bp_blogs_remove_data' );
|
1424 |
add_action( 'bp_make_spam_user', 'bp_blogs_remove_data' );
|
1425 |
-
|
1426 |
-
/**
|
1427 |
-
* Restore all blog associations for a given user
|
1428 |
-
*
|
1429 |
-
* @since BuddyPress (2.2.0)
|
1430 |
-
*
|
1431 |
-
* @param int $user_id ID whose blog data should be restored.
|
1432 |
-
*/
|
1433 |
-
function bp_blogs_restore_data( $user_id = 0 ) {
|
1434 |
-
if ( ! is_multisite() ) {
|
1435 |
-
return;
|
1436 |
-
}
|
1437 |
-
|
1438 |
-
// Get the user's blogs
|
1439 |
-
$user_blogs = get_blogs_of_user( $user_id );
|
1440 |
-
if ( empty( $user_blogs ) ) {
|
1441 |
-
return;
|
1442 |
-
}
|
1443 |
-
|
1444 |
-
$blogs = array_keys( $user_blogs );
|
1445 |
-
|
1446 |
-
foreach ( $blogs as $blog_id ) {
|
1447 |
-
bp_blogs_add_user_to_blog( $user_id, false, $blog_id );
|
1448 |
-
}
|
1449 |
-
}
|
1450 |
-
add_action( 'bp_make_ham_user', 'bp_blogs_restore_data', 10, 1 );
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/**
|
13 |
* Check whether the $bp global lists an activity directory page.
|
283 |
) );
|
284 |
}
|
285 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
do_action_ref_array( 'bp_blogs_new_blog', array( &$recorded_blog, $is_private, $is_recorded ) );
|
287 |
}
|
288 |
add_action( 'wpmu_new_blog', 'bp_blogs_record_blog', 10, 2 );
|
402 |
add_action( 'update_option_thread_comments_depth', 'bp_blogs_update_option_thread_comments_depth', 10, 2 );
|
403 |
|
404 |
/**
|
405 |
+
* Detect a change in post status, and initiate an activity update if necessary.
|
406 |
+
*
|
407 |
+
* Posts get new activity updates when (a) they are being published, and (b)
|
408 |
+
* they have not already been published. This enables proper posting for
|
409 |
+
* regular posts as well as scheduled posts, while preventing post bumping.
|
410 |
*
|
411 |
+
* See #4090, #3746, #2546 for background.
|
412 |
*
|
413 |
+
* @since BuddyPress (2.0.0)
|
414 |
+
*
|
415 |
+
* @todo Support untrashing better
|
416 |
+
*
|
417 |
+
* @param string $new_status New status for the post.
|
418 |
+
* @param string $old_status Old status for the post.
|
419 |
+
* @param object $post Post data.
|
420 |
*/
|
421 |
+
function bp_blogs_catch_transition_post_status( $new_status, $old_status, $post ) {
|
422 |
+
|
423 |
+
// This is an edit
|
424 |
+
if ( $new_status === $old_status ) {
|
425 |
+
if ( $new_status == 'publish' ) {
|
426 |
+
bp_blogs_update_post( $post );
|
427 |
+
return;
|
428 |
+
}
|
429 |
+
}
|
430 |
+
|
431 |
+
// Publishing a previously unpublished post
|
432 |
+
if ( 'publish' === $new_status ) {
|
433 |
+
// Untrashing the post
|
434 |
+
// Nothing here yet
|
435 |
+
if ( 'trash' == $old_status ) {}
|
436 |
+
|
437 |
+
// Record the post
|
438 |
+
bp_blogs_record_post( $post->ID, $post );
|
439 |
+
|
440 |
+
// Unpublishing a previously published post
|
441 |
+
} else if ( 'publish' === $old_status ) {
|
442 |
+
// Some form of pending status
|
443 |
+
// Only remove the activity entry
|
444 |
+
bp_blogs_delete_activity( array(
|
445 |
+
'item_id' => get_current_blog_id(),
|
446 |
+
'secondary_item_id' => $post->ID,
|
447 |
+
'component' => buddypress()->blogs->id,
|
448 |
+
'type' => 'new_blog_post'
|
449 |
+
) );
|
450 |
}
|
451 |
+
}
|
452 |
+
add_action( 'transition_post_status', 'bp_blogs_catch_transition_post_status', 10, 3 );
|
453 |
|
454 |
+
/**
|
455 |
+
* Record a new blog post in the BuddyPress activity stream.
|
456 |
+
*
|
457 |
+
* @param int $post_id ID of the post being recorded.
|
458 |
+
* @param object $post The WP post object passed to the 'save_post' action.
|
459 |
+
* @param int $user_id Optional. The user to whom the activity item will be
|
460 |
+
* associated. Defaults to the post_author.
|
461 |
+
* @return bool|null Returns false on failure.
|
462 |
+
*/
|
463 |
+
function bp_blogs_record_post( $post_id, $post, $user_id = 0 ) {
|
464 |
+
global $bp, $wpdb;
|
465 |
|
466 |
+
$post_id = (int) $post_id;
|
467 |
+
$blog_id = (int) $wpdb->blogid;
|
468 |
+
|
469 |
+
// If blog is not trackable, do not record the activity.
|
470 |
+
if ( ! bp_blogs_is_blog_trackable( $blog_id, $user_id ) )
|
471 |
+
return false;
|
472 |
+
|
473 |
+
if ( !$user_id )
|
474 |
+
$user_id = (int) $post->post_author;
|
475 |
+
|
476 |
+
// Stop infinite loops with WordPress MU Sitewide Tags.
|
477 |
+
// That plugin changed the way its settings were stored at some point. Thus the dual check.
|
478 |
+
if ( !empty( $bp->site_options['sitewide_tags_blog'] ) ) {
|
479 |
+
$st_options = maybe_unserialize( $bp->site_options['sitewide_tags_blog'] );
|
480 |
+
$tags_blog_id = isset( $st_options['tags_blog_id'] ) ? $st_options['tags_blog_id'] : 0;
|
481 |
} else {
|
482 |
+
$tags_blog_id = isset( $bp->site_options['tags_blog_id'] ) ? $bp->site_options['tags_blog_id'] : 0;
|
483 |
}
|
484 |
|
485 |
+
if ( (int) $blog_id == $tags_blog_id && apply_filters( 'bp_blogs_block_sitewide_tags_activity', true ) )
|
486 |
+
return false;
|
487 |
|
488 |
+
// Don't record this if it's not a post
|
489 |
+
if ( !in_array( $post->post_type, apply_filters( 'bp_blogs_record_post_post_types', array( 'post' ) ) ) )
|
490 |
+
return false;
|
491 |
|
492 |
+
$is_blog_public = apply_filters( 'bp_is_blog_public', (int)get_blog_option( $blog_id, 'blog_public' ) );
|
493 |
+
|
494 |
+
if ( 'publish' == $post->post_status && empty( $post->post_password ) ) {
|
495 |
+
if ( $is_blog_public || !is_multisite() ) {
|
496 |
+
|
497 |
+
// Record this in activity streams
|
498 |
+
$post_permalink = add_query_arg(
|
499 |
+
'p',
|
500 |
+
$post_id,
|
501 |
+
trailingslashit( get_home_url( $blog_id ) )
|
502 |
+
);
|
503 |
+
|
504 |
+
if ( is_multisite() )
|
505 |
+
$activity_action = sprintf( __( '%1$s wrote a new post, %2$s, on the site %3$s', 'buddypress' ), bp_core_get_userlink( (int) $post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>', '<a href="' . get_blog_option( $blog_id, 'home' ) . '">' . get_blog_option( $blog_id, 'blogname' ) . '</a>' );
|
506 |
+
else
|
507 |
+
$activity_action = sprintf( __( '%1$s wrote a new post, %2$s', 'buddypress' ), bp_core_get_userlink( (int) $post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
|
508 |
+
|
509 |
+
// Make sure there's not an existing entry for this post (prevent bumping)
|
510 |
+
if ( bp_is_active( 'activity' ) ) {
|
511 |
+
$existing = bp_activity_get( array(
|
512 |
+
'filter' => array(
|
513 |
+
'action' => 'new_blog_post',
|
514 |
+
'primary_id' => $blog_id,
|
515 |
+
'secondary_id' => $post_id,
|
516 |
+
)
|
517 |
+
) );
|
518 |
+
|
519 |
+
if ( !empty( $existing['activities'] ) ) {
|
520 |
+
return;
|
521 |
+
}
|
522 |
+
}
|
523 |
+
|
524 |
+
$activity_content = $post->post_content;
|
525 |
+
|
526 |
+
$activity_id = bp_blogs_record_activity( array(
|
527 |
+
'user_id' => (int) $post->post_author,
|
528 |
+
'content' => apply_filters( 'bp_blogs_activity_new_post_content', $activity_content, $post, $post_permalink ),
|
529 |
+
'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
|
530 |
+
'type' => 'new_blog_post',
|
531 |
+
'item_id' => $blog_id,
|
532 |
+
'secondary_item_id' => $post_id,
|
533 |
+
'recorded_time' => $post->post_date_gmt,
|
534 |
+
) );
|
535 |
+
|
536 |
+
// save post title in activity meta
|
537 |
+
if ( bp_is_active( 'activity' ) ) {
|
538 |
+
bp_activity_update_meta( $activity_id, 'post_title', $post->post_title );
|
539 |
+
bp_activity_update_meta( $activity_id, 'post_url', $post_permalink );
|
540 |
+
}
|
541 |
+
}
|
542 |
+
|
543 |
+
// Update the blogs last activity
|
544 |
+
bp_blogs_update_blogmeta( $blog_id, 'last_activity', bp_core_current_time() );
|
545 |
+
} else {
|
546 |
+
bp_blogs_remove_post( $post_id, $blog_id, $user_id );
|
547 |
+
}
|
548 |
+
|
549 |
+
do_action( 'bp_blogs_new_blog_post', $post_id, $post, $user_id );
|
550 |
}
|
|
|
551 |
|
552 |
/**
|
553 |
+
* Updates a blog post's corresponding activity entry during a post edit.
|
554 |
+
*
|
555 |
+
* @since BuddyPress (2.0.0)
|
556 |
*
|
557 |
+
* @see bp_blogs_catch_transition_post_status()
|
558 |
*
|
559 |
+
* @param WP_Post $post
|
|
|
560 |
*/
|
561 |
+
function bp_blogs_update_post( $post ) {
|
562 |
+
if ( ! bp_is_active( 'activity' ) ) {
|
563 |
return;
|
564 |
}
|
565 |
|
566 |
+
$activity_id = bp_activity_get_activity_id( array(
|
567 |
+
'component' => buddypress()->blogs->id,
|
568 |
+
'item_id' => get_current_blog_id(),
|
569 |
+
'secondary_item_id' => $post->ID,
|
570 |
+
'type' => 'new_blog_post',
|
571 |
+
) );
|
572 |
+
|
573 |
+
// activity ID doesn't exist, so stop!
|
574 |
+
if ( empty( $activity_id ) ) {
|
575 |
+
return;
|
576 |
+
}
|
577 |
+
|
578 |
+
// update the activity entry
|
579 |
+
$activity = new BP_Activity_Activity( $activity_id );
|
580 |
+
|
581 |
+
if ( ! empty( $post->post_content ) ) {
|
582 |
+
// Make sure to update the thumbnail image
|
583 |
+
$post_content = bp_activity_thumbnail_content_images( $post->post_content, $activity->primary_link, (array) $activity );
|
584 |
+
|
585 |
+
// Make sure to apply the blop post excerpt
|
586 |
+
$activity->content = apply_filters( 'bp_blogs_record_activity_content', bp_create_excerpt( $post_content ), $post_content, (array) $activity );
|
587 |
+
}
|
588 |
+
|
589 |
+
// Save the updated activity
|
590 |
+
$activity->save();
|
591 |
+
|
592 |
+
// update post title in activity meta
|
593 |
+
$existing_title = bp_activity_get_meta( $activity_id, 'post_title' );
|
594 |
if ( $post->post_title !== $existing_title ) {
|
595 |
+
bp_activity_update_meta( $activity_id, 'post_title', $post->post_title );
|
596 |
|
597 |
+
// now update activity meta for post comments... sigh
|
598 |
add_filter( 'comments_clauses', 'bp_blogs_comments_clauses_select_by_id' );
|
599 |
$comments = get_comments( array( 'post_id' => $post->ID ) );
|
600 |
remove_filter( 'comments_clauses', 'bp_blogs_comments_clauses_select_by_id' );
|
603 |
$activity_ids = array();
|
604 |
$comment_ids = wp_list_pluck( $comments, 'comment_ID' );
|
605 |
|
606 |
+
// setup activity args
|
607 |
$args = array(
|
608 |
'update_meta_cache' => false,
|
609 |
'show_hidden' => true,
|
610 |
'per_page' => 99999,
|
611 |
);
|
612 |
|
613 |
+
// query for old-style "new_blog_comment" activity items
|
614 |
$args['filter'] = array(
|
615 |
'object' => buddypress()->blogs->id,
|
616 |
'action' => 'new_blog_comment',
|
622 |
$activity_ids = (array) wp_list_pluck( $activities['activities'], 'id' );
|
623 |
}
|
624 |
|
625 |
+
// query for activity comments connected to a blog post
|
626 |
unset( $args['filter'] );
|
627 |
$args['meta_query'] = array( array(
|
628 |
'key' => 'bp_blogs_post_comment_id',
|
637 |
$activity_ids = array_merge( $activity_ids, (array) wp_list_pluck( $activities['activities'], 'id' ) );
|
638 |
}
|
639 |
|
640 |
+
// update activity meta for all found activity items
|
641 |
if ( ! empty( $activity_ids ) ) {
|
642 |
foreach ( $activity_ids as $aid ) {
|
643 |
bp_activity_update_meta( $aid, 'post_title', $post->post_title );
|
648 |
}
|
649 |
}
|
650 |
|
651 |
+
// add post comment status to activity meta if closed
|
652 |
if( 'closed' == $post->comment_status ) {
|
653 |
+
bp_activity_update_meta( $activity_id, 'post_comment_status', $post->comment_status );
|
654 |
} else {
|
655 |
+
bp_activity_delete_meta( $activity_id, 'post_comment_status' );
|
656 |
}
|
657 |
}
|
|
|
658 |
|
659 |
/**
|
660 |
* Record a new blog comment in the BuddyPress activity stream.
|
934 |
* core function, so that we can be sure that the Blogs component is loaded
|
935 |
* first. See http://buddypress.trac.wordpress.org/ticket/3916.
|
936 |
*
|
937 |
+
* @since BuddyPress (1.6)
|
938 |
* @access private
|
939 |
*/
|
940 |
function bp_blogs_maybe_add_user_to_blog() {
|
955 |
global $bp;
|
956 |
|
957 |
$blog_id = (int) $blog_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
958 |
do_action( 'bp_blogs_before_remove_blog', $blog_id );
|
959 |
|
960 |
BP_Blogs_Blog::delete_blog_for_all( $blog_id );
|
962 |
// Delete activity stream item
|
963 |
bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->id, 'type' => 'new_blog' ) );
|
964 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
965 |
do_action( 'bp_blogs_remove_blog', $blog_id );
|
966 |
}
|
967 |
add_action( 'delete_blog', 'bp_blogs_remove_blog' );
|
978 |
$blog_id = (int) $blog_id;
|
979 |
$user_id = (int) $user_id;
|
980 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
981 |
do_action( 'bp_blogs_before_remove_blog_for_user', $blog_id, $user_id );
|
982 |
|
983 |
BP_Blogs_Blog::delete_blog_for_user( $blog_id, $user_id );
|
989 |
'type' => 'new_blog'
|
990 |
) );
|
991 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
992 |
do_action( 'bp_blogs_remove_blog_for_user', $blog_id, $user_id );
|
993 |
}
|
994 |
add_action( 'remove_user_from_blog', 'bp_blogs_remove_blog_for_user', 10, 2 );
|
1015 |
if ( !$user_id )
|
1016 |
$user_id = bp_loggedin_user_id();
|
1017 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1018 |
do_action( 'bp_blogs_before_remove_post', $blog_id, $post_id, $user_id );
|
1019 |
|
1020 |
// Delete activity stream item
|
1021 |
bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'secondary_item_id' => $post_id, 'component' => $bp->blogs->id, 'type' => 'new_blog_post' ) );
|
1022 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1023 |
do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $user_id );
|
1024 |
}
|
1025 |
add_action( 'delete_post', 'bp_blogs_remove_post' );
|
1079 |
}
|
1080 |
}
|
1081 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1082 |
do_action( 'bp_blogs_remove_comment', $wpdb->blogid, $comment_id, bp_loggedin_user_id() );
|
1083 |
}
|
1084 |
add_action( 'delete_comment', 'bp_blogs_remove_comment' );
|
1210 |
* @return int $count Total blog count.
|
1211 |
*/
|
1212 |
function bp_blogs_total_blogs() {
|
1213 |
+
if ( !$count = wp_cache_get( 'bp_total_blogs', 'bp' ) ) {
|
|
|
|
|
1214 |
$blogs = BP_Blogs_Blog::get_all();
|
1215 |
$count = $blogs['total'];
|
1216 |
wp_cache_set( 'bp_total_blogs', $count, 'bp' );
|
1254 |
function bp_blogs_remove_data_for_blog( $blog_id ) {
|
1255 |
global $bp;
|
1256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1257 |
do_action( 'bp_blogs_before_remove_data_for_blog', $blog_id );
|
1258 |
|
1259 |
// If this is regular blog, delete all data for that blog.
|
1262 |
// Delete activity stream item
|
1263 |
bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->id, 'type' => false ) );
|
1264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1265 |
do_action( 'bp_blogs_remove_data_for_blog', $blog_id );
|
1266 |
}
|
1267 |
add_action( 'delete_blog', 'bp_blogs_remove_data_for_blog', 1 );
|
1328 |
*/
|
1329 |
|
1330 |
/**
|
1331 |
+
* Delete a metadta from the DB for a blog.
|
1332 |
*
|
1333 |
* @global object $wpdb WordPress database access object.
|
1334 |
* @global object $bp BuddyPress global settings.
|
1446 |
if ( !is_multisite() )
|
1447 |
return false;
|
1448 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1449 |
do_action( 'bp_blogs_before_remove_data', $user_id );
|
1450 |
|
1451 |
// If this is regular blog, delete all data for that blog.
|
1452 |
BP_Blogs_Blog::delete_blogs_for_user( $user_id );
|
1453 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1454 |
do_action( 'bp_blogs_remove_data', $user_id );
|
1455 |
}
|
1456 |
add_action( 'wpmu_delete_user', 'bp_blogs_remove_data' );
|
1457 |
add_action( 'delete_user', 'bp_blogs_remove_data' );
|
1458 |
add_action( 'bp_make_spam_user', 'bp_blogs_remove_data' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp-blogs/bp-blogs-loader.php
CHANGED
@@ -5,14 +5,14 @@
|
|
5 |
*
|
6 |
* The blogs component tracks posts and comments to member activity streams,
|
7 |
* shows blogs the member can post to in their profiles, and caches useful
|
8 |
-
* information from those blogs to make
|
9 |
*
|
10 |
* @package BuddyPress
|
11 |
* @subpackage Blogs Core
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
-
defined( 'ABSPATH' )
|
16 |
|
17 |
class BP_Blogs_Component extends BP_Component {
|
18 |
|
@@ -75,30 +75,6 @@ class BP_Blogs_Component extends BP_Component {
|
|
75 |
|
76 |
// Setup the globals
|
77 |
parent::setup_globals( $args );
|
78 |
-
|
79 |
-
/*
|
80 |
-
* Set up the post post type to track.
|
81 |
-
*
|
82 |
-
* In case the config is not multisite, the blog_public option is ignored.
|
83 |
-
*/
|
84 |
-
if ( 0 !== apply_filters( 'bp_is_blog_public', (int) get_option( 'blog_public' ) ) || ! is_multisite() ) {
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Filters the post types to track for the Blog component.
|
88 |
-
*
|
89 |
-
* @since BuddyPress (1.5.0)
|
90 |
-
*
|
91 |
-
* @param array $value Array of post types to track.
|
92 |
-
*/
|
93 |
-
$post_types = apply_filters( 'bp_blogs_record_post_post_types', array( 'post' ) );
|
94 |
-
|
95 |
-
foreach ( $post_types as $post_type ) {
|
96 |
-
add_post_type_support( $post_type, 'buddypress-activity' );
|
97 |
-
}
|
98 |
-
}
|
99 |
-
|
100 |
-
// Filter the generic track parameters for the 'post' post type.
|
101 |
-
add_filter( 'bp_activity_get_post_type_tracking_args', array( $this, 'post_tracking_args' ), 10, 2 );
|
102 |
}
|
103 |
|
104 |
/**
|
@@ -270,45 +246,6 @@ class BP_Blogs_Component extends BP_Component {
|
|
270 |
|
271 |
parent::setup_title();
|
272 |
}
|
273 |
-
|
274 |
-
/**
|
275 |
-
* Setup cache groups
|
276 |
-
*
|
277 |
-
* @since BuddyPress (2.2.0)
|
278 |
-
*/
|
279 |
-
public function setup_cache_groups() {
|
280 |
-
|
281 |
-
// Global groups
|
282 |
-
wp_cache_add_global_groups( array(
|
283 |
-
'blog_meta'
|
284 |
-
) );
|
285 |
-
|
286 |
-
parent::setup_cache_groups();
|
287 |
-
}
|
288 |
-
|
289 |
-
/**
|
290 |
-
* Set up the tracking arguments for the 'post' post type.
|
291 |
-
*
|
292 |
-
* @since BuddyPress (2.2.0)
|
293 |
-
*
|
294 |
-
* @see bp_activity_get_post_type_tracking_args() for information on parameters.
|
295 |
-
*/
|
296 |
-
public function post_tracking_args( $params = array(), $post_type = 0 ) {
|
297 |
-
if ( 'post' != $post_type ) {
|
298 |
-
return $params;
|
299 |
-
}
|
300 |
-
|
301 |
-
// Set specific params for the 'post' post type.
|
302 |
-
$params->component_id = $this->id;
|
303 |
-
$params->action_id = 'new_blog_post';
|
304 |
-
$params->admin_filter = __( 'New post published', 'buddypress' );
|
305 |
-
$params->format_callback = 'bp_blogs_format_activity_action_new_blog_post';
|
306 |
-
$params->front_filter = __( 'Posts', 'buddypress' );
|
307 |
-
$params->contexts = array( 'activity', 'member' );
|
308 |
-
$params->position = 5;
|
309 |
-
|
310 |
-
return $params;
|
311 |
-
}
|
312 |
}
|
313 |
|
314 |
/**
|
5 |
*
|
6 |
* The blogs component tracks posts and comments to member activity streams,
|
7 |
* shows blogs the member can post to in their profiles, and caches useful
|
8 |
+
* information from those blogs to make quering blogs in bulk more performant.
|
9 |
*
|
10 |
* @package BuddyPress
|
11 |
* @subpackage Blogs Core
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
16 |
|
17 |
class BP_Blogs_Component extends BP_Component {
|
18 |
|
75 |
|
76 |
// Setup the globals
|
77 |
parent::setup_globals( $args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
|
80 |
/**
|
246 |
|
247 |
parent::setup_title();
|
248 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
}
|
250 |
|
251 |
/**
|
bp-blogs/bp-blogs-screens.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Load the "My Blogs" screen.
|
@@ -17,11 +17,6 @@ function bp_blogs_screen_my_blogs() {
|
|
17 |
if ( !is_multisite() )
|
18 |
return false;
|
19 |
|
20 |
-
/**
|
21 |
-
* Fires right before the loading of the My Blogs screen template file.
|
22 |
-
*
|
23 |
-
* @since BuddyPress (1.0.0)
|
24 |
-
*/
|
25 |
do_action( 'bp_blogs_screen_my_blogs' );
|
26 |
|
27 |
bp_core_load_template( apply_filters( 'bp_blogs_template_my_blogs', 'members/single/home' ) );
|
@@ -38,11 +33,6 @@ function bp_blogs_screen_create_a_blog() {
|
|
38 |
if ( !is_user_logged_in() || !bp_blog_signup_enabled() )
|
39 |
return false;
|
40 |
|
41 |
-
/**
|
42 |
-
* Fires right before the loading of the Create A Blog screen template file.
|
43 |
-
*
|
44 |
-
* @since BuddyPress (1.0.0)
|
45 |
-
*/
|
46 |
do_action( 'bp_blogs_screen_create_a_blog' );
|
47 |
|
48 |
bp_core_load_template( apply_filters( 'bp_blogs_template_create_a_blog', 'blogs/create' ) );
|
@@ -56,11 +46,6 @@ function bp_blogs_screen_index() {
|
|
56 |
if ( bp_is_blogs_directory() ) {
|
57 |
bp_update_is_directory( true, 'blogs' );
|
58 |
|
59 |
-
/**
|
60 |
-
* Fires right before the loading of the top-level Blogs screen template file.
|
61 |
-
*
|
62 |
-
* @since BuddyPress (1.0.0)
|
63 |
-
*/
|
64 |
do_action( 'bp_blogs_screen_index' );
|
65 |
|
66 |
bp_core_load_template( apply_filters( 'bp_blogs_screen_index', 'blogs/index' ) );
|
@@ -68,12 +53,12 @@ function bp_blogs_screen_index() {
|
|
68 |
}
|
69 |
add_action( 'bp_screens', 'bp_blogs_screen_index', 2 );
|
70 |
|
71 |
-
/** Theme
|
72 |
|
73 |
/**
|
74 |
* The main theme compat class for BuddyPress Blogs
|
75 |
*
|
76 |
-
* This class sets up the necessary theme
|
77 |
* group template parts to the_title and the_content areas of a theme.
|
78 |
*
|
79 |
* @since BuddyPress (1.7.0)
|
@@ -90,7 +75,7 @@ class BP_Blogs_Theme_Compat {
|
|
90 |
}
|
91 |
|
92 |
/**
|
93 |
-
* Are we looking at something that needs Blogs theme
|
94 |
*
|
95 |
* @since BuddyPress (1.7.0)
|
96 |
*/
|
@@ -108,12 +93,6 @@ class BP_Blogs_Theme_Compat {
|
|
108 |
if ( is_multisite() && ! bp_current_action() ) {
|
109 |
bp_update_is_directory( true, 'blogs' );
|
110 |
|
111 |
-
/**
|
112 |
-
* Fires if in the blog directory and BuddyPress needs Blog theme compatibility,
|
113 |
-
* before the actions and filters are added.
|
114 |
-
*
|
115 |
-
* @since BuddyPress (1.5.0)
|
116 |
-
*/
|
117 |
do_action( 'bp_blogs_screen_index' );
|
118 |
|
119 |
add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) );
|
@@ -143,14 +122,7 @@ class BP_Blogs_Theme_Compat {
|
|
143 |
* @return array $templates Array of custom templates to look for.
|
144 |
*/
|
145 |
public function directory_template_hierarchy( $templates ) {
|
146 |
-
|
147 |
-
/**
|
148 |
-
* Filters the custom templates used for theme compat with the blog directory page.
|
149 |
-
*
|
150 |
-
* @since BuddyPress (1.8.0)
|
151 |
-
*
|
152 |
-
* @param array $value Array of template paths to add to template list to look for.
|
153 |
-
*/
|
154 |
$new_templates = apply_filters( 'bp_template_hierarchy_blogs_create', array(
|
155 |
'blogs/index-directory.php'
|
156 |
) );
|
@@ -169,9 +141,11 @@ class BP_Blogs_Theme_Compat {
|
|
169 |
*/
|
170 |
public function directory_dummy_post() {
|
171 |
|
|
|
|
|
172 |
bp_theme_compat_reset_post( array(
|
173 |
'ID' => 0,
|
174 |
-
'post_title' =>
|
175 |
'post_author' => 0,
|
176 |
'post_date' => 0,
|
177 |
'post_content' => '',
|
@@ -206,14 +180,7 @@ class BP_Blogs_Theme_Compat {
|
|
206 |
* @return array $templates Array of custom templates to look for.
|
207 |
*/
|
208 |
public function create_template_hierarchy( $templates ) {
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Filters the custom templates used for theme compat with the blog create page.
|
212 |
-
*
|
213 |
-
* @since BuddyPress (1.8.0)
|
214 |
-
*
|
215 |
-
* @param array $value Array of template paths to add to template list to look for.
|
216 |
-
*/
|
217 |
$new_templates = apply_filters( 'bp_template_hierarchy_blogs_create', array(
|
218 |
'blogs/index-create.php'
|
219 |
) );
|
@@ -234,7 +201,7 @@ class BP_Blogs_Theme_Compat {
|
|
234 |
|
235 |
// Title based on ability to create blogs
|
236 |
if ( is_user_logged_in() && bp_blog_signup_enabled() ) {
|
237 |
-
$title = __( 'Create a Site', 'buddypress' );
|
238 |
} else {
|
239 |
$title = __( 'Sites', 'buddypress' );
|
240 |
}
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Load the "My Blogs" screen.
|
17 |
if ( !is_multisite() )
|
18 |
return false;
|
19 |
|
|
|
|
|
|
|
|
|
|
|
20 |
do_action( 'bp_blogs_screen_my_blogs' );
|
21 |
|
22 |
bp_core_load_template( apply_filters( 'bp_blogs_template_my_blogs', 'members/single/home' ) );
|
33 |
if ( !is_user_logged_in() || !bp_blog_signup_enabled() )
|
34 |
return false;
|
35 |
|
|
|
|
|
|
|
|
|
|
|
36 |
do_action( 'bp_blogs_screen_create_a_blog' );
|
37 |
|
38 |
bp_core_load_template( apply_filters( 'bp_blogs_template_create_a_blog', 'blogs/create' ) );
|
46 |
if ( bp_is_blogs_directory() ) {
|
47 |
bp_update_is_directory( true, 'blogs' );
|
48 |
|
|
|
|
|
|
|
|
|
|
|
49 |
do_action( 'bp_blogs_screen_index' );
|
50 |
|
51 |
bp_core_load_template( apply_filters( 'bp_blogs_screen_index', 'blogs/index' ) );
|
53 |
}
|
54 |
add_action( 'bp_screens', 'bp_blogs_screen_index', 2 );
|
55 |
|
56 |
+
/** Theme Compatability *******************************************************/
|
57 |
|
58 |
/**
|
59 |
* The main theme compat class for BuddyPress Blogs
|
60 |
*
|
61 |
+
* This class sets up the necessary theme compatability actions to safely output
|
62 |
* group template parts to the_title and the_content areas of a theme.
|
63 |
*
|
64 |
* @since BuddyPress (1.7.0)
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
+
* Are we looking at something that needs Blogs theme compatability?
|
79 |
*
|
80 |
* @since BuddyPress (1.7.0)
|
81 |
*/
|
93 |
if ( is_multisite() && ! bp_current_action() ) {
|
94 |
bp_update_is_directory( true, 'blogs' );
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
do_action( 'bp_blogs_screen_index' );
|
97 |
|
98 |
add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) );
|
122 |
* @return array $templates Array of custom templates to look for.
|
123 |
*/
|
124 |
public function directory_template_hierarchy( $templates ) {
|
125 |
+
// Setup our templates based on priority
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
$new_templates = apply_filters( 'bp_template_hierarchy_blogs_create', array(
|
127 |
'blogs/index-directory.php'
|
128 |
) );
|
141 |
*/
|
142 |
public function directory_dummy_post() {
|
143 |
|
144 |
+
$title = apply_filters( 'bp_blogs_directory_header', __( 'Sites', 'buddypress' ) );
|
145 |
+
|
146 |
bp_theme_compat_reset_post( array(
|
147 |
'ID' => 0,
|
148 |
+
'post_title' => $title,
|
149 |
'post_author' => 0,
|
150 |
'post_date' => 0,
|
151 |
'post_content' => '',
|
180 |
* @return array $templates Array of custom templates to look for.
|
181 |
*/
|
182 |
public function create_template_hierarchy( $templates ) {
|
183 |
+
// Setup our templates based on priority
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
$new_templates = apply_filters( 'bp_template_hierarchy_blogs_create', array(
|
185 |
'blogs/index-create.php'
|
186 |
) );
|
201 |
|
202 |
// Title based on ability to create blogs
|
203 |
if ( is_user_logged_in() && bp_blog_signup_enabled() ) {
|
204 |
+
$title = '<a class="button bp-title-button" href="' . trailingslashit( bp_get_root_domain() . '/' . bp_get_blogs_root_slug() ) . '">' . __( 'Sites', 'buddypress' ) . '</a> ' . __( 'Create a Site', 'buddypress' );
|
205 |
} else {
|
206 |
$title = __( 'Sites', 'buddypress' );
|
207 |
}
|
bp-blogs/bp-blogs-template.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Output the blogs component slug.
|
@@ -28,14 +28,6 @@ function bp_blogs_slug() {
|
|
28 |
* @return string The 'blogs' slug.
|
29 |
*/
|
30 |
function bp_get_blogs_slug() {
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Filters the blogs component slug.
|
34 |
-
*
|
35 |
-
* @since BuddyPress (1.5.0)
|
36 |
-
*
|
37 |
-
* @param string $slug Slug for the blogs component.
|
38 |
-
*/
|
39 |
return apply_filters( 'bp_get_blogs_slug', buddypress()->blogs->slug );
|
40 |
}
|
41 |
|
@@ -57,14 +49,6 @@ function bp_blogs_root_slug() {
|
|
57 |
* @return string The 'blogs' root slug.
|
58 |
*/
|
59 |
function bp_get_blogs_root_slug() {
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Filters the blogs component root slug.
|
63 |
-
*
|
64 |
-
* @since BuddyPress (1.5.0)
|
65 |
-
*
|
66 |
-
* @param string $root_slug Root slug for the blogs component.
|
67 |
-
*/
|
68 |
return apply_filters( 'bp_get_blogs_root_slug', buddypress()->blogs->root_slug );
|
69 |
}
|
70 |
|
@@ -90,14 +74,6 @@ function bp_blogs_directory_permalink() {
|
|
90 |
* @return string The URL of the Blogs directory.
|
91 |
*/
|
92 |
function bp_get_blogs_directory_permalink() {
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Filters the blog directory permalink.
|
96 |
-
*
|
97 |
-
* @since BuddyPress (1.5.0)
|
98 |
-
*
|
99 |
-
* @param string $value Permalink URL for the blog directory.
|
100 |
-
*/
|
101 |
return apply_filters( 'bp_get_blogs_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_blogs_root_slug() ) );
|
102 |
}
|
103 |
|
@@ -199,9 +175,8 @@ class BP_Blogs_Template {
|
|
199 |
*/
|
200 |
public function __construct( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg = 'bpage', $update_meta_cache = true, $include_blog_ids = false ) {
|
201 |
|
202 |
-
$this->
|
203 |
-
$this->
|
204 |
-
$this->pag_num = bp_sanitize_pagination_arg( 'num', $per_page );
|
205 |
|
206 |
// Backwards compatibility support for blogs by first letter
|
207 |
if ( ! empty( $_REQUEST['letter'] ) ) {
|
@@ -243,14 +218,13 @@ class BP_Blogs_Template {
|
|
243 |
// Build pagination links based on total blogs and current page number
|
244 |
if ( ! empty( $this->total_blog_count ) && ! empty( $this->pag_num ) ) {
|
245 |
$this->pag_links = paginate_links( array(
|
246 |
-
'base' => add_query_arg( $
|
247 |
'format' => '',
|
248 |
'total' => ceil( (int) $this->total_blog_count / (int) $this->pag_num ),
|
249 |
'current' => (int) $this->pag_page,
|
250 |
'prev_text' => _x( '←', 'Blog pagination previous text', 'buddypress' ),
|
251 |
'next_text' => _x( '→', 'Blog pagination next text', 'buddypress' ),
|
252 |
-
'mid_size' => 1
|
253 |
-
'add_args' => array(),
|
254 |
) );
|
255 |
}
|
256 |
}
|
@@ -303,12 +277,6 @@ class BP_Blogs_Template {
|
|
303 |
if ( ( $this->current_blog + 1 ) < $this->blog_count ) {
|
304 |
return true;
|
305 |
} elseif ( ( $this->current_blog + 1 ) === $this->blog_count ) {
|
306 |
-
|
307 |
-
/**
|
308 |
-
* Fires right before the rewinding of blogs listing after all are shown.
|
309 |
-
*
|
310 |
-
* @since BuddyPress (1.5.0)
|
311 |
-
*/
|
312 |
do_action( 'blog_loop_end' );
|
313 |
// Do some cleaning up after the loop
|
314 |
$this->rewind_blogs();
|
@@ -334,12 +302,6 @@ class BP_Blogs_Template {
|
|
334 |
|
335 |
// loop has just started
|
336 |
if ( 0 === $this->current_blog ) {
|
337 |
-
|
338 |
-
/**
|
339 |
-
* Fires if on the first blog in the loop.
|
340 |
-
*
|
341 |
-
* @since BuddyPress (1.5.0)
|
342 |
-
*/
|
343 |
do_action( 'blog_loop_start' );
|
344 |
}
|
345 |
}
|
@@ -395,7 +357,7 @@ function bp_rewind_blogs() {
|
|
395 |
function bp_has_blogs( $args = '' ) {
|
396 |
global $blogs_template;
|
397 |
|
398 |
-
//
|
399 |
$search_terms = ! empty( $_REQUEST['s'] )
|
400 |
? $_REQUEST['s']
|
401 |
: false;
|
@@ -421,15 +383,7 @@ function bp_has_blogs( $args = '' ) {
|
|
421 |
// Get the blogs
|
422 |
$blogs_template = new BP_Blogs_Template( $r['type'], $r['page'], $r['per_page'], $r['max'], $r['user_id'], $r['search_terms'], $r['page_arg'], $r['update_meta_cache'], $r['include_blog_ids'] );
|
423 |
|
424 |
-
|
425 |
-
* Filters whether or not there are blogs to list.
|
426 |
-
*
|
427 |
-
* @since BuddyPress (1.1.0)
|
428 |
-
*
|
429 |
-
* @param bool $value Whether or not there are blogs to list.
|
430 |
-
* @param BP_Blogs_Template $blogs_template Current blogs template object.
|
431 |
-
* @param array $r Parsed arguments used in blogs template query.
|
432 |
-
*/
|
433 |
return apply_filters( 'bp_has_blogs', $blogs_template->has_blogs(), $blogs_template, $r );
|
434 |
}
|
435 |
|
@@ -491,13 +445,6 @@ function bp_blogs_pagination_links() {
|
|
491 |
function bp_get_blogs_pagination_links() {
|
492 |
global $blogs_template;
|
493 |
|
494 |
-
/**
|
495 |
-
* Filters the blogs pagination links.
|
496 |
-
*
|
497 |
-
* @since BuddyPress (1.0.0)
|
498 |
-
*
|
499 |
-
* @param string $pag_links HTML pagination links.
|
500 |
-
*/
|
501 |
return apply_filters( 'bp_get_blogs_pagination_links', $blogs_template->pag_links );
|
502 |
}
|
503 |
|
@@ -579,16 +526,6 @@ function bp_blog_avatar( $args = '' ) {
|
|
579 |
*/
|
580 |
$avatar = apply_filters( 'bp_get_blog_avatar_' . $blogs_template->blog->blog_id, $avatar );
|
581 |
|
582 |
-
/**
|
583 |
-
* Filters a blog's avatar.
|
584 |
-
*
|
585 |
-
* @since BuddyPress (1.5.0)
|
586 |
-
*
|
587 |
-
* @param string $avatar Formatted HTML <img> element, or raw avatar
|
588 |
-
* URL based on $html arg.
|
589 |
-
* @param int $blog_id ID of the blog whose avatar is being displayed.
|
590 |
-
* @param array $r Array of arguments used when fetching avatar.
|
591 |
-
*/
|
592 |
return apply_filters( 'bp_get_blog_avatar', $avatar, $blogs_template->blog->blog_id, $r );
|
593 |
}
|
594 |
|
@@ -608,13 +545,6 @@ function bp_blog_permalink() {
|
|
608 |
$permalink = $protocol . $blogs_template->blog->domain . $blogs_template->blog->path;
|
609 |
}
|
610 |
|
611 |
-
/**
|
612 |
-
* Filters the blog permalink.
|
613 |
-
*
|
614 |
-
* @since BuddyPress (1.0.0)
|
615 |
-
*
|
616 |
-
* @param string $permalink Permalink URL for the blog.
|
617 |
-
*/
|
618 |
return apply_filters( 'bp_get_blog_permalink', $permalink );
|
619 |
}
|
620 |
|
@@ -632,13 +562,6 @@ function bp_blog_name() {
|
|
632 |
function bp_get_blog_name() {
|
633 |
global $blogs_template;
|
634 |
|
635 |
-
/**
|
636 |
-
* Filters the name of the current blog in the loop.
|
637 |
-
*
|
638 |
-
* @since BuddyPress (1.2.0)
|
639 |
-
*
|
640 |
-
* @param string $name Name of the current blog in the loop.
|
641 |
-
*/
|
642 |
return apply_filters( 'bp_get_blog_name', $blogs_template->blog->name );
|
643 |
}
|
644 |
|
@@ -660,13 +583,6 @@ function bp_blog_id() {
|
|
660 |
function bp_get_blog_id() {
|
661 |
global $blogs_template;
|
662 |
|
663 |
-
/**
|
664 |
-
* Filters the ID of the current blog in the loop.
|
665 |
-
*
|
666 |
-
* @since BuddyPress (1.7.0)
|
667 |
-
*
|
668 |
-
* @param int $blog_id ID of the current blog in the loop.
|
669 |
-
*/
|
670 |
return apply_filters( 'bp_get_blog_id', $blogs_template->blog->blog_id );
|
671 |
}
|
672 |
|
@@ -674,14 +590,6 @@ function bp_blog_id() {
|
|
674 |
* Output the description of the current blog in the loop.
|
675 |
*/
|
676 |
function bp_blog_description() {
|
677 |
-
|
678 |
-
/**
|
679 |
-
* Filters the description of the current blog in the loop.
|
680 |
-
*
|
681 |
-
* @since BuddyPress (1.2.0)
|
682 |
-
*
|
683 |
-
* @param string $value Description of the current blog in the loop.
|
684 |
-
*/
|
685 |
echo apply_filters( 'bp_blog_description', bp_get_blog_description() );
|
686 |
}
|
687 |
/**
|
@@ -692,13 +600,6 @@ function bp_blog_description() {
|
|
692 |
function bp_get_blog_description() {
|
693 |
global $blogs_template;
|
694 |
|
695 |
-
/**
|
696 |
-
* Filters the description of the current blog in the loop.
|
697 |
-
*
|
698 |
-
* @since BuddyPress (1.0.0)
|
699 |
-
*
|
700 |
-
* @param string $value Description of the current blog in the loop.
|
701 |
-
*/
|
702 |
return apply_filters( 'bp_get_blog_description', $blogs_template->blog->description );
|
703 |
}
|
704 |
|
@@ -731,13 +632,6 @@ function bp_blog_class() {
|
|
731 |
else
|
732 |
$classes[] = 'bp-single-blog';
|
733 |
|
734 |
-
/**
|
735 |
-
* Filters the row class of the current blog in the loop.
|
736 |
-
*
|
737 |
-
* @since BuddyPress (1.7.0)
|
738 |
-
*
|
739 |
-
* @param array $classes Array of classes to be applied to row.
|
740 |
-
*/
|
741 |
$classes = apply_filters( 'bp_get_blog_class', $classes );
|
742 |
$classes = array_merge( $classes, array() );
|
743 |
|
@@ -771,7 +665,7 @@ function bp_blog_last_active( $args = array() ) {
|
|
771 |
'active_format' => true
|
772 |
) );
|
773 |
|
774 |
-
// Backwards
|
775 |
if ( true === $r['active_format'] ) {
|
776 |
$r['active_format'] = __( 'active %s', 'buddypress' );
|
777 |
}
|
@@ -789,14 +683,6 @@ function bp_blog_last_active( $args = array() ) {
|
|
789 |
$last_activity = __( 'Never active', 'buddypress' );
|
790 |
}
|
791 |
|
792 |
-
/**
|
793 |
-
* Filters the last active date of the current blog in the loop.
|
794 |
-
*
|
795 |
-
* @since
|
796 |
-
*
|
797 |
-
* @param string $last_activity Last active date.
|
798 |
-
* @param array $r Array of parsed args used to determine formatting.
|
799 |
-
*/
|
800 |
return apply_filters( 'bp_blog_last_active', $last_activity, $r );
|
801 |
}
|
802 |
|
@@ -830,29 +716,12 @@ function bp_blog_latest_post( $args = array() ) {
|
|
830 |
|
831 |
if ( ! empty( $retval ) ) {
|
832 |
if ( ! empty( $r['latest_format'] ) ) {
|
833 |
-
|
834 |
-
/**
|
835 |
-
* Filters the title text of the latest post for the current blog in loop.
|
836 |
-
*
|
837 |
-
* @since BuddyPress (1.0.0)
|
838 |
-
*
|
839 |
-
* @param string $retval Title of the latest post.
|
840 |
-
*/
|
841 |
$retval = sprintf( __( 'Latest Post: %s', 'buddypress' ), '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>' );
|
842 |
} else {
|
843 |
-
|
844 |
-
/** This filter is documented in bp-blogs/bp-blogs-template.php */
|
845 |
$retval = '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>';
|
846 |
}
|
847 |
}
|
848 |
|
849 |
-
/**
|
850 |
-
* Filters the HTML markup result for the latest blog post in loop.
|
851 |
-
*
|
852 |
-
* @since BuddyPress (1.2.0)
|
853 |
-
*
|
854 |
-
* @param string $retval HTML markup for the latest post.
|
855 |
-
*/
|
856 |
return apply_filters( 'bp_get_blog_latest_post', $retval );
|
857 |
}
|
858 |
|
@@ -883,13 +752,6 @@ function bp_blog_latest_post_title() {
|
|
883 |
if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_title ) )
|
884 |
$retval = $blogs_template->blog->latest_post->post_title;
|
885 |
|
886 |
-
/**
|
887 |
-
* Filters the title text of the latest post on the current blog in the loop.
|
888 |
-
*
|
889 |
-
* @since BuddyPress (1.7.0)
|
890 |
-
*
|
891 |
-
* @param string $retval Title text for the latest post.
|
892 |
-
*/
|
893 |
return apply_filters( 'bp_get_blog_latest_post_title', $retval );
|
894 |
}
|
895 |
|
@@ -901,7 +763,7 @@ function bp_blog_latest_post_title() {
|
|
901 |
* @see bp_get_blog_latest_post_title()
|
902 |
*/
|
903 |
function bp_blog_latest_post_permalink() {
|
904 |
-
echo
|
905 |
}
|
906 |
/**
|
907 |
* Return the permalink of the latest post on the current blog in the loop.
|
@@ -920,13 +782,6 @@ function bp_blog_latest_post_permalink() {
|
|
920 |
if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->ID ) )
|
921 |
$retval = add_query_arg( 'p', $blogs_template->blog->latest_post->ID, bp_get_blog_permalink() );
|
922 |
|
923 |
-
/**
|
924 |
-
* Filters the permalink of the latest post on the current blog in the loop.
|
925 |
-
*
|
926 |
-
* @since BuddyPress (1.7.0)
|
927 |
-
*
|
928 |
-
* @param string $retval Permalink URL of the latest post.
|
929 |
-
*/
|
930 |
return apply_filters( 'bp_get_blog_latest_post_permalink', $retval );
|
931 |
}
|
932 |
|
@@ -957,13 +812,6 @@ function bp_blog_latest_post_content() {
|
|
957 |
if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_content ) )
|
958 |
$retval = $blogs_template->blog->latest_post->post_content;
|
959 |
|
960 |
-
/**
|
961 |
-
* Filters the content of the latest post on the current blog in the loop.
|
962 |
-
*
|
963 |
-
* @since BuddyPress (1.7.0)
|
964 |
-
*
|
965 |
-
* @param string $retval Content of the latest post on the current blog in the loop.
|
966 |
-
*/
|
967 |
return apply_filters( 'bp_get_blog_latest_post_content', $retval );
|
968 |
}
|
969 |
|
@@ -998,13 +846,6 @@ function bp_blog_latest_post_featured_image( $size = 'thumbnail' ) {
|
|
998 |
if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->images[$size] ) )
|
999 |
$retval = $blogs_template->blog->latest_post->images[$size];
|
1000 |
|
1001 |
-
/**
|
1002 |
-
* Filters the featured image of the latest post on the current blog in the loop.
|
1003 |
-
*
|
1004 |
-
* @since BuddyPress (1.7.0)
|
1005 |
-
*
|
1006 |
-
* @param string $retval The featured image of the latest post on the current blog in the loop.
|
1007 |
-
*/
|
1008 |
return apply_filters( 'bp_get_blog_latest_post_featured_image', $retval );
|
1009 |
}
|
1010 |
|
@@ -1021,15 +862,6 @@ function bp_blog_latest_post_featured_image( $size = 'thumbnail' ) {
|
|
1021 |
function bp_blog_latest_post_has_featured_image( $thumbnail = 'thumbnail' ) {
|
1022 |
$image = bp_get_blog_latest_post_featured_image( $thumbnail );
|
1023 |
|
1024 |
-
/**
|
1025 |
-
* Filters whether or not the latest blog post has a featured image.
|
1026 |
-
*
|
1027 |
-
* @since BuddyPress (1.7.0)
|
1028 |
-
*
|
1029 |
-
* @param bool $value Whether or not the latest blog post has a featured image.
|
1030 |
-
* @param string $thumbnail Image version to return.
|
1031 |
-
* @param string $image Returned value from bp_get_blog_latest_post_featured_image.
|
1032 |
-
*/
|
1033 |
return apply_filters( 'bp_blog_latest_post_has_featured_image', ! empty( $image ), $thumbnail, $image );
|
1034 |
}
|
1035 |
|
@@ -1063,14 +895,6 @@ function bp_total_blog_count() {
|
|
1063 |
* @return int Total number of blogs.
|
1064 |
*/
|
1065 |
function bp_get_total_blog_count() {
|
1066 |
-
|
1067 |
-
/**
|
1068 |
-
* Filters the total number of blogs on the site.
|
1069 |
-
*
|
1070 |
-
* @since BuddyPress (1.2.0)
|
1071 |
-
*
|
1072 |
-
* @param int $value Total number of blogs on the site.
|
1073 |
-
*/
|
1074 |
return apply_filters( 'bp_get_total_blog_count', bp_blogs_total_blogs() );
|
1075 |
}
|
1076 |
add_filter( 'bp_get_total_blog_count', 'bp_core_number_format' );
|
@@ -1090,14 +914,6 @@ function bp_total_blog_count_for_user( $user_id = 0 ) {
|
|
1090 |
* @return int Total number of blogs for the user.
|
1091 |
*/
|
1092 |
function bp_get_total_blog_count_for_user( $user_id = 0 ) {
|
1093 |
-
|
1094 |
-
/**
|
1095 |
-
* Filters the total number of blogs for a given user.
|
1096 |
-
*
|
1097 |
-
* @since BuddyPress (1.2.0)
|
1098 |
-
*
|
1099 |
-
* @param int $value Total number of blogs for a given user.
|
1100 |
-
*/
|
1101 |
return apply_filters( 'bp_get_total_blog_count_for_user', bp_blogs_total_blogs_for_user( $user_id ) );
|
1102 |
}
|
1103 |
add_filter( 'bp_get_total_blog_count_for_user', 'bp_core_number_format' );
|
@@ -1118,13 +934,6 @@ function bp_blog_signup_enabled() {
|
|
1118 |
|
1119 |
$active_signup = isset( $bp->site_options['registration'] ) ? $bp->site_options['registration'] : 'all';
|
1120 |
|
1121 |
-
/**
|
1122 |
-
* Filters whether or not blog creation is enabled.
|
1123 |
-
*
|
1124 |
-
* @since BuddyPress (1.0.0)
|
1125 |
-
*
|
1126 |
-
* @param string $active_signup Value of the registration site option creation status.
|
1127 |
-
*/
|
1128 |
$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user"
|
1129 |
|
1130 |
if ( 'none' == $active_signup || 'user' == $active_signup )
|
@@ -1151,17 +960,7 @@ function bp_show_blog_signup_form($blogname = '', $blog_title = '', $errors = ''
|
|
1151 |
$errors = new WP_Error();
|
1152 |
}
|
1153 |
|
1154 |
-
|
1155 |
-
* Filters the default values for Blog name, title, and any current errors.
|
1156 |
-
*
|
1157 |
-
* @since BuddyPress (1.0.0)
|
1158 |
-
*
|
1159 |
-
* @param array $value {
|
1160 |
-
* string $blogname Default blog name provided.
|
1161 |
-
* string $blog_title Default blog title provided.
|
1162 |
-
* WP_Error $errors WP_Error object.
|
1163 |
-
* }
|
1164 |
-
*/
|
1165 |
$filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
|
1166 |
$blogname = $filtered_results['blogname'];
|
1167 |
$blog_title = $filtered_results['blog_title'];
|
@@ -1178,14 +977,7 @@ function bp_show_blog_signup_form($blogname = '', $blog_title = '', $errors = ''
|
|
1178 |
<form class="standard-form" id="setupform" method="post" action="">
|
1179 |
|
1180 |
<input type="hidden" name="stage" value="gimmeanotherblog" />
|
1181 |
-
<?php
|
1182 |
-
|
1183 |
-
/**
|
1184 |
-
* Fires after the default hidden fields in blog signup form markup.
|
1185 |
-
*
|
1186 |
-
* @since BuddyPress (1.0.0)
|
1187 |
-
*/
|
1188 |
-
do_action( 'signup_hidden_fields' ); ?>
|
1189 |
|
1190 |
<?php bp_blogs_signup_blog($blogname, $blog_title, $errors); ?>
|
1191 |
<p>
|
@@ -1224,7 +1016,7 @@ function bp_blogs_signup_blog( $blogname = '', $blog_title = '', $errors = '' )
|
|
1224 |
if ( !is_subdomain_install() )
|
1225 |
echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span> <input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="63" /><br />';
|
1226 |
else
|
1227 |
-
echo '<input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="63"
|
1228 |
|
1229 |
if ( !is_user_logged_in() ) {
|
1230 |
print '(<strong>' . __( 'Your address will be ' , 'buddypress');
|
@@ -1266,14 +1058,6 @@ function bp_blogs_signup_blog( $blogname = '', $blog_title = '', $errors = '' )
|
|
1266 |
</p>
|
1267 |
|
1268 |
<?php
|
1269 |
-
|
1270 |
-
/**
|
1271 |
-
* Fires at the end of all of the default input fields for blog creation form.
|
1272 |
-
*
|
1273 |
-
* @since BuddyPress (1.0.0)
|
1274 |
-
*
|
1275 |
-
* @param WP_Error $errors WP_Error object if any present.
|
1276 |
-
*/
|
1277 |
do_action('signup_blogform', $errors);
|
1278 |
}
|
1279 |
|
@@ -1307,17 +1091,6 @@ function bp_blogs_validate_blog_signup() {
|
|
1307 |
$public = (int) $_POST['blog_public'];
|
1308 |
|
1309 |
$meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // depreciated
|
1310 |
-
|
1311 |
-
/**
|
1312 |
-
* Filters the default values for Blog meta.
|
1313 |
-
*
|
1314 |
-
* @since BuddyPress (1.0.0)
|
1315 |
-
*
|
1316 |
-
* @param array $meta {
|
1317 |
-
* string $value Default blog language ID.
|
1318 |
-
* string $public Default public status.
|
1319 |
-
* }
|
1320 |
-
*/
|
1321 |
$meta = apply_filters( 'add_signup_meta', $meta );
|
1322 |
|
1323 |
// If this is a subdomain install, set up the site inside the root domain.
|
@@ -1364,12 +1137,6 @@ function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name,
|
|
1364 |
</p>
|
1365 |
|
1366 |
<?php
|
1367 |
-
|
1368 |
-
/**
|
1369 |
-
* Fires after the default successful blog registration message markup.
|
1370 |
-
*
|
1371 |
-
* @since BuddyPress (1.0.0)
|
1372 |
-
*/
|
1373 |
do_action('signup_finished');
|
1374 |
}
|
1375 |
|
@@ -1378,14 +1145,6 @@ function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name,
|
|
1378 |
*/
|
1379 |
function bp_create_blog_link() {
|
1380 |
if ( bp_is_my_profile() )
|
1381 |
-
|
1382 |
-
/**
|
1383 |
-
* Filters "Create a Site" links for users viewing their own profiles.
|
1384 |
-
*
|
1385 |
-
* @since BuddyPress (1.0.0)
|
1386 |
-
*
|
1387 |
-
* @param string $value HTML link for creating a site.
|
1388 |
-
*/
|
1389 |
echo apply_filters( 'bp_create_blog_link', '<a href="' . bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create/">' . __( 'Create a Site', 'buddypress' ) . '</a>' );
|
1390 |
}
|
1391 |
|
@@ -1409,12 +1168,6 @@ function bp_blogs_blog_tabs() {
|
|
1409 |
</ul>
|
1410 |
|
1411 |
<?php
|
1412 |
-
|
1413 |
-
/**
|
1414 |
-
* Fires after the markup for the navigation tabs for a user Blogs page.
|
1415 |
-
*
|
1416 |
-
* @since BuddyPress (1.0.0)
|
1417 |
-
*/
|
1418 |
do_action( 'bp_blogs_blog_tabs' );
|
1419 |
}
|
1420 |
|
@@ -1430,13 +1183,6 @@ function bp_directory_blogs_search_form() {
|
|
1430 |
<input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />
|
1431 |
</form>';
|
1432 |
|
1433 |
-
/**
|
1434 |
-
* Filters the output for the blog directory search form.
|
1435 |
-
*
|
1436 |
-
* @since BuddyPress (1.9.0)
|
1437 |
-
*
|
1438 |
-
* @param string $search_form_html HTML markup for blog directory search form.
|
1439 |
-
*/
|
1440 |
echo apply_filters( 'bp_directory_blogs_search_form', $search_form_html );
|
1441 |
}
|
1442 |
|
@@ -1469,76 +1215,14 @@ function bp_blog_create_button() {
|
|
1469 |
'component' => 'blogs',
|
1470 |
'link_text' => __( 'Create a Site', 'buddypress' ),
|
1471 |
'link_title' => __( 'Create a Site', 'buddypress' ),
|
1472 |
-
'link_class' => 'blog-create
|
1473 |
'link_href' => trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_blogs_root_slug() ) . trailingslashit( 'create' ),
|
1474 |
'wrapper' => false,
|
1475 |
-
'block_self' => false,
|
1476 |
);
|
1477 |
|
1478 |
-
/**
|
1479 |
-
* Filters the Create a Site button.
|
1480 |
-
*
|
1481 |
-
* @since BuddyPress (2.0.0)
|
1482 |
-
*
|
1483 |
-
* @param array $button_args Array of arguments to be used for the Create a Site button.
|
1484 |
-
*/
|
1485 |
return bp_get_button( apply_filters( 'bp_get_blog_create_button', $button_args ) );
|
1486 |
}
|
1487 |
|
1488 |
-
/**
|
1489 |
-
* Output the Create a Site nav item.
|
1490 |
-
*
|
1491 |
-
* @since BuddyPress (2.2.0)
|
1492 |
-
*/
|
1493 |
-
function bp_blog_create_nav_item() {
|
1494 |
-
echo bp_get_blog_create_nav_item();
|
1495 |
-
}
|
1496 |
-
|
1497 |
-
/**
|
1498 |
-
* Get the Create a Site nav item.
|
1499 |
-
*
|
1500 |
-
* @since BuddyPress (2.2.0)
|
1501 |
-
*
|
1502 |
-
* @return string
|
1503 |
-
*/
|
1504 |
-
function bp_get_blog_create_nav_item() {
|
1505 |
-
// Get the create a site button
|
1506 |
-
$create_blog_button = bp_get_blog_create_button();
|
1507 |
-
|
1508 |
-
// Make sure the button is available
|
1509 |
-
if ( empty( $create_blog_button ) ) {
|
1510 |
-
return;
|
1511 |
-
}
|
1512 |
-
|
1513 |
-
$output = '<li id="blog-create-nav">' . $create_blog_button . '</li>';
|
1514 |
-
|
1515 |
-
return apply_filters( 'bp_get_blog_create_nav_item', $output );
|
1516 |
-
}
|
1517 |
-
|
1518 |
-
/**
|
1519 |
-
* Checks if a specific theme is still filtering the Blogs directory title
|
1520 |
-
* if so, transform the title button into a Blogs directory nav item.
|
1521 |
-
*
|
1522 |
-
* @since BuddyPress (2.2.0)
|
1523 |
-
*
|
1524 |
-
* @uses bp_blog_create_nav_item() to output the Create a Site nav item
|
1525 |
-
* @return string HTML Output
|
1526 |
-
*/
|
1527 |
-
function bp_blog_backcompat_create_nav_item() {
|
1528 |
-
// Bail if Blogs nav item is already used by bp-legacy
|
1529 |
-
if ( has_action( 'bp_blogs_directory_blog_types', 'bp_legacy_theme_blog_create_nav', 999 ) ) {
|
1530 |
-
return;
|
1531 |
-
}
|
1532 |
-
|
1533 |
-
// Bail if the theme is not filtering the Blogs directory title
|
1534 |
-
if ( ! has_filter( 'bp_blogs_directory_header' ) ) {
|
1535 |
-
return;
|
1536 |
-
}
|
1537 |
-
|
1538 |
-
bp_blog_create_nav_item();
|
1539 |
-
}
|
1540 |
-
add_action( 'bp_blogs_directory_blog_types', 'bp_blog_backcompat_create_nav_item', 1000 );
|
1541 |
-
|
1542 |
/**
|
1543 |
* Output button for visiting a blog in a loop.
|
1544 |
*
|
@@ -1585,13 +1269,7 @@ function bp_blogs_visit_blog_button( $args = '' ) {
|
|
1585 |
|
1586 |
$button = wp_parse_args( $args, $defaults );
|
1587 |
|
1588 |
-
|
1589 |
-
* Filters the button for visiting a blog in a loop.
|
1590 |
-
*
|
1591 |
-
* @since BuddyPress (1.2.10)
|
1592 |
-
*
|
1593 |
-
* @param array $button Array of arguments to be used for the button to visit a blog.
|
1594 |
-
*/
|
1595 |
return bp_get_button( apply_filters( 'bp_get_blogs_visit_blog_button', $button ) );
|
1596 |
}
|
1597 |
|
@@ -1645,13 +1323,6 @@ function bp_blogs_get_profile_stats( $args = '' ) {
|
|
1645 |
}
|
1646 |
}
|
1647 |
|
1648 |
-
|
1649 |
-
* Filters the number of blogs in user's profile.
|
1650 |
-
*
|
1651 |
-
* @since BuddyPress (2.0.0)
|
1652 |
-
*
|
1653 |
-
* @param string $value Output determined for the profile stats.
|
1654 |
-
* @param array $r Array of arguments used for default output if none provided.
|
1655 |
-
*/
|
1656 |
return apply_filters( 'bp_blogs_get_profile_stats', $r['output'], $r );
|
1657 |
}
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Output the blogs component slug.
|
28 |
* @return string The 'blogs' slug.
|
29 |
*/
|
30 |
function bp_get_blogs_slug() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
return apply_filters( 'bp_get_blogs_slug', buddypress()->blogs->slug );
|
32 |
}
|
33 |
|
49 |
* @return string The 'blogs' root slug.
|
50 |
*/
|
51 |
function bp_get_blogs_root_slug() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
return apply_filters( 'bp_get_blogs_root_slug', buddypress()->blogs->root_slug );
|
53 |
}
|
54 |
|
74 |
* @return string The URL of the Blogs directory.
|
75 |
*/
|
76 |
function bp_get_blogs_directory_permalink() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
return apply_filters( 'bp_get_blogs_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_blogs_root_slug() ) );
|
78 |
}
|
79 |
|
175 |
*/
|
176 |
public function __construct( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg = 'bpage', $update_meta_cache = true, $include_blog_ids = false ) {
|
177 |
|
178 |
+
$this->pag_page = isset( $_REQUEST[ $page_arg ] ) ? intval( $_REQUEST[ $page_arg ] ) : $page;
|
179 |
+
$this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
|
|
|
180 |
|
181 |
// Backwards compatibility support for blogs by first letter
|
182 |
if ( ! empty( $_REQUEST['letter'] ) ) {
|
218 |
// Build pagination links based on total blogs and current page number
|
219 |
if ( ! empty( $this->total_blog_count ) && ! empty( $this->pag_num ) ) {
|
220 |
$this->pag_links = paginate_links( array(
|
221 |
+
'base' => add_query_arg( $page_arg, '%#%' ),
|
222 |
'format' => '',
|
223 |
'total' => ceil( (int) $this->total_blog_count / (int) $this->pag_num ),
|
224 |
'current' => (int) $this->pag_page,
|
225 |
'prev_text' => _x( '←', 'Blog pagination previous text', 'buddypress' ),
|
226 |
'next_text' => _x( '→', 'Blog pagination next text', 'buddypress' ),
|
227 |
+
'mid_size' => 1
|
|
|
228 |
) );
|
229 |
}
|
230 |
}
|
277 |
if ( ( $this->current_blog + 1 ) < $this->blog_count ) {
|
278 |
return true;
|
279 |
} elseif ( ( $this->current_blog + 1 ) === $this->blog_count ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
do_action( 'blog_loop_end' );
|
281 |
// Do some cleaning up after the loop
|
282 |
$this->rewind_blogs();
|
302 |
|
303 |
// loop has just started
|
304 |
if ( 0 === $this->current_blog ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
do_action( 'blog_loop_start' );
|
306 |
}
|
307 |
}
|
357 |
function bp_has_blogs( $args = '' ) {
|
358 |
global $blogs_template;
|
359 |
|
360 |
+
// Checkfor and use search terms
|
361 |
$search_terms = ! empty( $_REQUEST['s'] )
|
362 |
? $_REQUEST['s']
|
363 |
: false;
|
383 |
// Get the blogs
|
384 |
$blogs_template = new BP_Blogs_Template( $r['type'], $r['page'], $r['per_page'], $r['max'], $r['user_id'], $r['search_terms'], $r['page_arg'], $r['update_meta_cache'], $r['include_blog_ids'] );
|
385 |
|
386 |
+
// Filter and return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
return apply_filters( 'bp_has_blogs', $blogs_template->has_blogs(), $blogs_template, $r );
|
388 |
}
|
389 |
|
445 |
function bp_get_blogs_pagination_links() {
|
446 |
global $blogs_template;
|
447 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
return apply_filters( 'bp_get_blogs_pagination_links', $blogs_template->pag_links );
|
449 |
}
|
450 |
|
526 |
*/
|
527 |
$avatar = apply_filters( 'bp_get_blog_avatar_' . $blogs_template->blog->blog_id, $avatar );
|
528 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
529 |
return apply_filters( 'bp_get_blog_avatar', $avatar, $blogs_template->blog->blog_id, $r );
|
530 |
}
|
531 |
|
545 |
$permalink = $protocol . $blogs_template->blog->domain . $blogs_template->blog->path;
|
546 |
}
|
547 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
548 |
return apply_filters( 'bp_get_blog_permalink', $permalink );
|
549 |
}
|
550 |
|
562 |
function bp_get_blog_name() {
|
563 |
global $blogs_template;
|
564 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
return apply_filters( 'bp_get_blog_name', $blogs_template->blog->name );
|
566 |
}
|
567 |
|
583 |
function bp_get_blog_id() {
|
584 |
global $blogs_template;
|
585 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
586 |
return apply_filters( 'bp_get_blog_id', $blogs_template->blog->blog_id );
|
587 |
}
|
588 |
|
590 |
* Output the description of the current blog in the loop.
|
591 |
*/
|
592 |
function bp_blog_description() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
593 |
echo apply_filters( 'bp_blog_description', bp_get_blog_description() );
|
594 |
}
|
595 |
/**
|
600 |
function bp_get_blog_description() {
|
601 |
global $blogs_template;
|
602 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
603 |
return apply_filters( 'bp_get_blog_description', $blogs_template->blog->description );
|
604 |
}
|
605 |
|
632 |
else
|
633 |
$classes[] = 'bp-single-blog';
|
634 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
635 |
$classes = apply_filters( 'bp_get_blog_class', $classes );
|
636 |
$classes = array_merge( $classes, array() );
|
637 |
|
665 |
'active_format' => true
|
666 |
) );
|
667 |
|
668 |
+
// Backwards compatibilty for anyone forcing a 'true' active_format
|
669 |
if ( true === $r['active_format'] ) {
|
670 |
$r['active_format'] = __( 'active %s', 'buddypress' );
|
671 |
}
|
683 |
$last_activity = __( 'Never active', 'buddypress' );
|
684 |
}
|
685 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
686 |
return apply_filters( 'bp_blog_last_active', $last_activity, $r );
|
687 |
}
|
688 |
|
716 |
|
717 |
if ( ! empty( $retval ) ) {
|
718 |
if ( ! empty( $r['latest_format'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
719 |
$retval = sprintf( __( 'Latest Post: %s', 'buddypress' ), '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>' );
|
720 |
} else {
|
|
|
|
|
721 |
$retval = '<a href="' . $blogs_template->blog->latest_post->guid . '">' . apply_filters( 'the_title', $retval ) . '</a>';
|
722 |
}
|
723 |
}
|
724 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
725 |
return apply_filters( 'bp_get_blog_latest_post', $retval );
|
726 |
}
|
727 |
|
752 |
if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_title ) )
|
753 |
$retval = $blogs_template->blog->latest_post->post_title;
|
754 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
755 |
return apply_filters( 'bp_get_blog_latest_post_title', $retval );
|
756 |
}
|
757 |
|
763 |
* @see bp_get_blog_latest_post_title()
|
764 |
*/
|
765 |
function bp_blog_latest_post_permalink() {
|
766 |
+
echo bp_get_blog_latest_post_permalink();
|
767 |
}
|
768 |
/**
|
769 |
* Return the permalink of the latest post on the current blog in the loop.
|
782 |
if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->ID ) )
|
783 |
$retval = add_query_arg( 'p', $blogs_template->blog->latest_post->ID, bp_get_blog_permalink() );
|
784 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
785 |
return apply_filters( 'bp_get_blog_latest_post_permalink', $retval );
|
786 |
}
|
787 |
|
812 |
if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_content ) )
|
813 |
$retval = $blogs_template->blog->latest_post->post_content;
|
814 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
815 |
return apply_filters( 'bp_get_blog_latest_post_content', $retval );
|
816 |
}
|
817 |
|
846 |
if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->images[$size] ) )
|
847 |
$retval = $blogs_template->blog->latest_post->images[$size];
|
848 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
849 |
return apply_filters( 'bp_get_blog_latest_post_featured_image', $retval );
|
850 |
}
|
851 |
|
862 |
function bp_blog_latest_post_has_featured_image( $thumbnail = 'thumbnail' ) {
|
863 |
$image = bp_get_blog_latest_post_featured_image( $thumbnail );
|
864 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
865 |
return apply_filters( 'bp_blog_latest_post_has_featured_image', ! empty( $image ), $thumbnail, $image );
|
866 |
}
|
867 |
|
895 |
* @return int Total number of blogs.
|
896 |
*/
|
897 |
function bp_get_total_blog_count() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
898 |
return apply_filters( 'bp_get_total_blog_count', bp_blogs_total_blogs() );
|
899 |
}
|
900 |
add_filter( 'bp_get_total_blog_count', 'bp_core_number_format' );
|
914 |
* @return int Total number of blogs for the user.
|
915 |
*/
|
916 |
function bp_get_total_blog_count_for_user( $user_id = 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
917 |
return apply_filters( 'bp_get_total_blog_count_for_user', bp_blogs_total_blogs_for_user( $user_id ) );
|
918 |
}
|
919 |
add_filter( 'bp_get_total_blog_count_for_user', 'bp_core_number_format' );
|
934 |
|
935 |
$active_signup = isset( $bp->site_options['registration'] ) ? $bp->site_options['registration'] : 'all';
|
936 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
937 |
$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user"
|
938 |
|
939 |
if ( 'none' == $active_signup || 'user' == $active_signup )
|
960 |
$errors = new WP_Error();
|
961 |
}
|
962 |
|
963 |
+
// allow definition of default variables
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
964 |
$filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
|
965 |
$blogname = $filtered_results['blogname'];
|
966 |
$blog_title = $filtered_results['blog_title'];
|
977 |
<form class="standard-form" id="setupform" method="post" action="">
|
978 |
|
979 |
<input type="hidden" name="stage" value="gimmeanotherblog" />
|
980 |
+
<?php do_action( 'signup_hidden_fields' ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
981 |
|
982 |
<?php bp_blogs_signup_blog($blogname, $blog_title, $errors); ?>
|
983 |
<p>
|
1016 |
if ( !is_subdomain_install() )
|
1017 |
echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span> <input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="63" /><br />';
|
1018 |
else
|
1019 |
+
echo '<input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="63" /> <span class="suffix_address">.' . bp_blogs_get_subdomain_base() . '</span><br />';
|
1020 |
|
1021 |
if ( !is_user_logged_in() ) {
|
1022 |
print '(<strong>' . __( 'Your address will be ' , 'buddypress');
|
1058 |
</p>
|
1059 |
|
1060 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1061 |
do_action('signup_blogform', $errors);
|
1062 |
}
|
1063 |
|
1091 |
$public = (int) $_POST['blog_public'];
|
1092 |
|
1093 |
$meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // depreciated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1094 |
$meta = apply_filters( 'add_signup_meta', $meta );
|
1095 |
|
1096 |
// If this is a subdomain install, set up the site inside the root domain.
|
1137 |
</p>
|
1138 |
|
1139 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
1140 |
do_action('signup_finished');
|
1141 |
}
|
1142 |
|
1145 |
*/
|
1146 |
function bp_create_blog_link() {
|
1147 |
if ( bp_is_my_profile() )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1148 |
echo apply_filters( 'bp_create_blog_link', '<a href="' . bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create/">' . __( 'Create a Site', 'buddypress' ) . '</a>' );
|
1149 |
}
|
1150 |
|
1168 |
</ul>
|
1169 |
|
1170 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
1171 |
do_action( 'bp_blogs_blog_tabs' );
|
1172 |
}
|
1173 |
|
1183 |
<input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />
|
1184 |
</form>';
|
1185 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1186 |
echo apply_filters( 'bp_directory_blogs_search_form', $search_form_html );
|
1187 |
}
|
1188 |
|
1215 |
'component' => 'blogs',
|
1216 |
'link_text' => __( 'Create a Site', 'buddypress' ),
|
1217 |
'link_title' => __( 'Create a Site', 'buddypress' ),
|
1218 |
+
'link_class' => 'button blog-create bp-title-button',
|
1219 |
'link_href' => trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_blogs_root_slug() ) . trailingslashit( 'create' ),
|
1220 |
'wrapper' => false,
|
|
|
1221 |
);
|
1222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1223 |
return bp_get_button( apply_filters( 'bp_get_blog_create_button', $button_args ) );
|
1224 |
}
|
1225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1226 |
/**
|
1227 |
* Output button for visiting a blog in a loop.
|
1228 |
*
|
1269 |
|
1270 |
$button = wp_parse_args( $args, $defaults );
|
1271 |
|
1272 |
+
// Filter and return the HTML button
|
|
|
|
|
|
|
|
|
|
|
|
|
1273 |
return bp_get_button( apply_filters( 'bp_get_blogs_visit_blog_button', $button ) );
|
1274 |
}
|
1275 |
|
1323 |
}
|
1324 |
}
|
1325 |
|
1326 |
+
// Filter and return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1327 |
return apply_filters( 'bp_blogs_get_profile_stats', $r['output'], $r );
|
1328 |
}
|
bp-blogs/bp-blogs-widgets.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Register the widgets for the Blogs component.
|
@@ -53,15 +53,6 @@ class BP_Blogs_Recent_Posts_Widget extends WP_Widget {
|
|
53 |
$title = '<a href="' . trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_blogs_root_slug() ) . '">' . esc_html( $title ) . '</a>';
|
54 |
}
|
55 |
|
56 |
-
/**
|
57 |
-
* Filters the Blogs Recent Posts widget title.
|
58 |
-
*
|
59 |
-
* @since BuddyPress (2.2.0)
|
60 |
-
*
|
61 |
-
* @param string $title The widget title.
|
62 |
-
*/
|
63 |
-
$title = apply_filters( 'widget_title', $instance['title'] );
|
64 |
-
|
65 |
echo $args['before_widget'];
|
66 |
echo $args['before_title'] . $title . $args['after_title'];
|
67 |
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Register the widgets for the Blogs component.
|
53 |
$title = '<a href="' . trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_blogs_root_slug() ) . '">' . esc_html( $title ) . '</a>';
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
echo $args['before_widget'];
|
57 |
echo $args['before_title'] . $title . $args['after_title'];
|
58 |
|
bp-core/admin/bp-core-actions.php
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
*/
|
20 |
|
21 |
// Exit if accessed directly
|
22 |
-
defined( 'ABSPATH' )
|
23 |
|
24 |
/**
|
25 |
* Attach BuddyPress to WordPress
|
19 |
*/
|
20 |
|
21 |
// Exit if accessed directly
|
22 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
23 |
|
24 |
/**
|
25 |
* Attach BuddyPress to WordPress
|
bp-core/admin/bp-core-components.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Renders the Component Setup admin panel.
|
@@ -141,11 +141,11 @@ function bp_core_admin_components_options() {
|
|
141 |
} ?>
|
142 |
|
143 |
<ul class="subsubsub">
|
144 |
-
<li><a href="<?php echo
|
145 |
-
<li><a href="<?php echo
|
146 |
-
<li><a href="<?php echo
|
147 |
-
<li><a href="<?php echo
|
148 |
-
<li><a href="<?php echo
|
149 |
</ul>
|
150 |
|
151 |
<table class="widefat fixed plugins" cellspacing="0">
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Renders the Component Setup admin panel.
|
141 |
} ?>
|
142 |
|
143 |
<ul class="subsubsub">
|
144 |
+
<li><a href="<?php echo add_query_arg( array( 'page' => 'bp-components', 'action' => 'all' ), bp_get_admin_url( $page ) ); ?>" <?php if ( $action === 'all' ) : ?>class="current"<?php endif; ?>><?php printf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $all_count, 'plugins', 'buddypress' ), number_format_i18n( $all_count ) ); ?></a> | </li>
|
145 |
+
<li><a href="<?php echo add_query_arg( array( 'page' => 'bp-components', 'action' => 'active' ), bp_get_admin_url( $page ) ); ?>" <?php if ( $action === 'active' ) : ?>class="current"<?php endif; ?>><?php printf( _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', count( $active_components ), 'buddypress' ), number_format_i18n( count( $active_components ) ) ); ?></a> | </li>
|
146 |
+
<li><a href="<?php echo add_query_arg( array( 'page' => 'bp-components', 'action' => 'inactive' ), bp_get_admin_url( $page ) ); ?>" <?php if ( $action === 'inactive' ) : ?>class="current"<?php endif; ?>><?php printf( _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', count( $inactive_components ), 'buddypress' ), number_format_i18n( count( $inactive_components ) ) ); ?></a> | </li>
|
147 |
+
<li><a href="<?php echo add_query_arg( array( 'page' => 'bp-components', 'action' => 'mustuse' ), bp_get_admin_url( $page ) ); ?>" <?php if ( $action === 'mustuse' ) : ?>class="current"<?php endif; ?>><?php printf( _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', count( $required_components ), 'buddypress' ), number_format_i18n( count( $required_components ) ) ); ?></a> | </li>
|
148 |
+
<li><a href="<?php echo add_query_arg( array( 'page' => 'bp-components', 'action' => 'retired' ), bp_get_admin_url( $page ) ); ?>" <?php if ( $action === 'retired' ) : ?>class="current"<?php endif; ?>><?php printf( _n( 'Retired <span class="count">(%s)</span>', 'Retired <span class="count">(%s)</span>', count( $retired_components ), 'buddypress' ), number_format_i18n( count( $retired_components ) ) ); ?></a></li>
|
149 |
</ul>
|
150 |
|
151 |
<table class="widefat fixed plugins" cellspacing="0">
|
bp-core/admin/bp-core-functions.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/** Menu **********************************************************************/
|
14 |
|
@@ -74,12 +74,11 @@ add_action( bp_core_admin_hook(), 'bp_core_admin_backpat_menu', 999 );
|
|
74 |
* @since BuddyPress (1.6)
|
75 |
*/
|
76 |
function bp_core_modify_admin_menu_highlight() {
|
77 |
-
global $plugin_page, $submenu_file;
|
78 |
|
79 |
// This tweaks the Settings subnav menu to show only one BuddyPress menu item
|
80 |
-
if ( ! in_array( $plugin_page, array( 'bp-activity', 'bp-general-settings', ) ) )
|
81 |
$submenu_file = 'bp-components';
|
82 |
-
}
|
83 |
|
84 |
// Network Admin > Tools
|
85 |
if ( in_array( $plugin_page, array( 'bp-tools', 'available-tools' ) ) ) {
|
@@ -105,7 +104,7 @@ function bp_core_admin_backpat_page() {
|
|
105 |
<h2><?php _e( 'Why have all my BuddyPress menus disappeared?', 'buddypress' ); ?></h2>
|
106 |
|
107 |
<p><?php _e( "Don't worry! We've moved the BuddyPress options into more convenient and easier to find locations. You're seeing this page because you are running a legacy BuddyPress plugin which has not been updated.", 'buddypress' ); ?></p>
|
108 |
-
<p><?php printf( __( 'Components, Pages, Settings, and Forums, have been moved to <a href="%s">Settings > BuddyPress</a>. Profile Fields has been moved into the <a href="%s">Users</a> menu.', 'buddypress' ), esc_url( $settings_url ),
|
109 |
</div>
|
110 |
|
111 |
<?php
|
@@ -119,6 +118,7 @@ function bp_core_admin_backpat_page() {
|
|
119 |
* BuddyPress combines all its messages into a single notice, to avoid a preponderance of yellow
|
120 |
* boxes.
|
121 |
*
|
|
|
122 |
* @since BuddyPress (1.5)
|
123 |
*
|
124 |
* @uses bp_current_user_can() to check current user permissions before showing the notices
|
@@ -137,22 +137,23 @@ function bp_core_print_admin_notices() {
|
|
137 |
return;
|
138 |
}
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
$notice_types[] = $notice['type'];
|
143 |
-
}
|
144 |
-
$notice_types = array_unique( $notice_types );
|
145 |
|
146 |
-
|
147 |
-
|
148 |
-
printf( '<div id="message" class="fade %s">', sanitize_html_class( $type ) );
|
149 |
|
150 |
-
|
151 |
-
printf( '<p>%s</p>', $notice['message'] );
|
152 |
-
}
|
153 |
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
}
|
157 |
add_action( 'admin_notices', 'bp_core_print_admin_notices' );
|
158 |
add_action( 'network_admin_notices', 'bp_core_print_admin_notices' );
|
@@ -164,12 +165,12 @@ add_action( 'network_admin_notices', 'bp_core_print_admin_notices' );
|
|
164 |
* box. It is recommended that you hook this function to admin_init, so that your messages are
|
165 |
* loaded in time.
|
166 |
*
|
|
|
167 |
* @since BuddyPress (1.5)
|
168 |
*
|
169 |
-
* @param string $notice The notice you are adding to the queue
|
170 |
-
* @param string $type The notice type; optional. Usually either "updated" or "error".
|
171 |
*/
|
172 |
-
function bp_core_add_admin_notice( $notice = ''
|
173 |
|
174 |
// Do not add if the notice is empty
|
175 |
if ( empty( $notice ) ) {
|
@@ -182,10 +183,7 @@ function bp_core_add_admin_notice( $notice = '', $type = 'updated' ) {
|
|
182 |
}
|
183 |
|
184 |
// Add the notice
|
185 |
-
buddypress()->admin->notices[] =
|
186 |
-
'message' => $notice,
|
187 |
-
'type' => $type,
|
188 |
-
);
|
189 |
}
|
190 |
|
191 |
/**
|
@@ -240,7 +238,7 @@ function bp_core_activation_notice() {
|
|
240 |
|
241 |
// Add notice if no rewrite rules are enabled
|
242 |
if ( empty( $wp_rewrite->permalink_structure ) ) {
|
243 |
-
bp_core_add_admin_notice( sprintf( __( '<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress' ), admin_url( 'options-permalink.php' ) )
|
244 |
}
|
245 |
|
246 |
// Get BuddyPress instance
|
@@ -276,7 +274,7 @@ function bp_core_activation_notice() {
|
|
276 |
);
|
277 |
}
|
278 |
|
279 |
-
// On the first admin screen after a new installation, this isn't set, so grab it to
|
280 |
if ( empty( $bp->pages->members ) ) {
|
281 |
$bp->pages = bp_core_get_directory_pages();
|
282 |
}
|
@@ -298,7 +296,7 @@ function bp_core_activation_notice() {
|
|
298 |
|
299 |
if ( !empty( $orphaned_components ) ) {
|
300 |
$admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
|
301 |
-
$notice = sprintf( __( 'The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s">Repair</a>', 'buddypress' ),
|
302 |
|
303 |
bp_core_add_admin_notice( $notice );
|
304 |
}
|
@@ -320,7 +318,7 @@ function bp_core_activation_notice() {
|
|
320 |
// If there are duplicates, post a message about them
|
321 |
if ( !empty( $dupe_names ) ) {
|
322 |
$admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
|
323 |
-
$notice = sprintf( __( 'Each BuddyPress Component needs its own WordPress page. The following WordPress Pages have more than one component associated with them: %2$s. <a href="%1$s">Repair</a>', 'buddypress' ),
|
324 |
|
325 |
bp_core_add_admin_notice( $notice );
|
326 |
}
|
@@ -343,17 +341,15 @@ function bp_core_activation_notice() {
|
|
343 |
function bp_do_activation_redirect() {
|
344 |
|
345 |
// Bail if no activation redirect
|
346 |
-
if ( ! get_transient( '_bp_activation_redirect' ) )
|
347 |
return;
|
348 |
-
}
|
349 |
|
350 |
// Delete the redirect transient
|
351 |
delete_transient( '_bp_activation_redirect' );
|
352 |
|
353 |
// Bail if activating from network, or bulk
|
354 |
-
if ( isset( $_GET['activate-multi'] ) )
|
355 |
return;
|
356 |
-
}
|
357 |
|
358 |
$query_args = array( 'page' => 'bp-about' );
|
359 |
if ( get_transient( '_bp_is_new_install' ) ) {
|
@@ -371,32 +367,16 @@ function bp_do_activation_redirect() {
|
|
371 |
* Output the tabs in the admin area
|
372 |
*
|
373 |
* @since BuddyPress (1.5)
|
374 |
-
* @param string $active_tab Name of the tab that is active
|
375 |
*/
|
376 |
function bp_core_admin_tabs( $active_tab = '' ) {
|
|
|
|
|
377 |
$tabs_html = '';
|
378 |
$idle_class = 'nav-tab';
|
379 |
$active_class = 'nav-tab nav-tab-active';
|
380 |
-
$tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab ) );
|
381 |
-
|
382 |
-
// Loop through tabs and build navigation
|
383 |
-
foreach ( array_values( $tabs ) as $tab_data ) {
|
384 |
-
$is_current = (bool) ( $tab_data['name'] == $active_tab );
|
385 |
-
$tab_class = $is_current ? $active_class : $idle_class;
|
386 |
-
$tabs_html .= '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>';
|
387 |
-
}
|
388 |
-
|
389 |
-
echo $tabs_html;
|
390 |
-
do_action( 'bp_admin_tabs' );
|
391 |
-
}
|
392 |
|
393 |
-
|
394 |
-
* Get the data for the tabs in the admin area.
|
395 |
-
*
|
396 |
-
* @since BuddyPress (2.2.0)
|
397 |
-
* @param string $active_tab Name of the tab that is active. Optional.
|
398 |
-
*/
|
399 |
-
function bp_core_get_admin_tabs( $active_tab = '' ) {
|
400 |
$tabs = array(
|
401 |
'0' => array(
|
402 |
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ),
|
@@ -425,13 +405,21 @@ function bp_core_get_admin_tabs( $active_tab = '' ) {
|
|
425 |
);
|
426 |
}
|
427 |
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
}
|
436 |
|
437 |
/** Help **********************************************************************/
|
@@ -448,7 +436,7 @@ function bp_core_add_contextual_help( $screen = '' ) {
|
|
448 |
|
449 |
switch ( $screen->id ) {
|
450 |
|
451 |
-
//
|
452 |
case 'settings_page_bp-components' :
|
453 |
|
454 |
// help tabs
|
@@ -575,25 +563,21 @@ function bp_core_add_contextual_help_content( $tab = '' ) {
|
|
575 |
function bp_admin_separator() {
|
576 |
|
577 |
// Bail if BuddyPress is not network activated and viewing network admin
|
578 |
-
if ( is_network_admin() && ! bp_is_network_activated() )
|
579 |
return;
|
580 |
-
}
|
581 |
|
582 |
// Bail if BuddyPress is network activated and viewing site admin
|
583 |
-
if ( ! is_network_admin() && bp_is_network_activated() )
|
584 |
return;
|
585 |
-
}
|
586 |
|
587 |
// Prevent duplicate separators when no core menu items exist
|
588 |
-
if ( ! bp_current_user_can( 'bp_moderate' ) )
|
589 |
return;
|
590 |
-
}
|
591 |
|
592 |
// Bail if there are no components with admin UI's. Hardcoded for now, until
|
593 |
// there's a real API for determining this later.
|
594 |
-
if ( ! bp_is_active( 'activity' ) && ! bp_is_active( 'groups' ) )
|
595 |
return;
|
596 |
-
}
|
597 |
|
598 |
global $menu;
|
599 |
|
@@ -612,9 +596,8 @@ function bp_admin_separator() {
|
|
612 |
function bp_admin_custom_menu_order( $menu_order = false ) {
|
613 |
|
614 |
// Bail if user cannot see admin pages
|
615 |
-
if ( ! bp_current_user_can( 'bp_moderate' ) )
|
616 |
return $menu_order;
|
617 |
-
}
|
618 |
|
619 |
return true;
|
620 |
}
|
@@ -631,9 +614,8 @@ function bp_admin_custom_menu_order( $menu_order = false ) {
|
|
631 |
function bp_admin_menu_order( $menu_order = array() ) {
|
632 |
|
633 |
// Bail if user cannot see admin pages
|
634 |
-
if ( empty( $menu_order ) || ! bp_current_user_can( 'bp_moderate' ) )
|
635 |
return $menu_order;
|
636 |
-
}
|
637 |
|
638 |
// Initialize our custom order array
|
639 |
$bp_menu_order = array();
|
@@ -645,9 +627,8 @@ function bp_admin_menu_order( $menu_order = array() ) {
|
|
645 |
$custom_menus = (array) apply_filters( 'bp_admin_menu_order', array() );
|
646 |
|
647 |
// Bail if no components have top level admin pages
|
648 |
-
if ( empty( $custom_menus ) )
|
649 |
return $menu_order;
|
650 |
-
}
|
651 |
|
652 |
// Add our separator to beginning of array
|
653 |
array_unshift( $custom_menus, 'separator-buddypress' );
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/** Menu **********************************************************************/
|
14 |
|
74 |
* @since BuddyPress (1.6)
|
75 |
*/
|
76 |
function bp_core_modify_admin_menu_highlight() {
|
77 |
+
global $pagenow, $plugin_page, $submenu_file;
|
78 |
|
79 |
// This tweaks the Settings subnav menu to show only one BuddyPress menu item
|
80 |
+
if ( ! in_array( $plugin_page, array( 'bp-activity', 'bp-general-settings', ) ) )
|
81 |
$submenu_file = 'bp-components';
|
|
|
82 |
|
83 |
// Network Admin > Tools
|
84 |
if ( in_array( $plugin_page, array( 'bp-tools', 'available-tools' ) ) ) {
|
104 |
<h2><?php _e( 'Why have all my BuddyPress menus disappeared?', 'buddypress' ); ?></h2>
|
105 |
|
106 |
<p><?php _e( "Don't worry! We've moved the BuddyPress options into more convenient and easier to find locations. You're seeing this page because you are running a legacy BuddyPress plugin which has not been updated.", 'buddypress' ); ?></p>
|
107 |
+
<p><?php printf( __( 'Components, Pages, Settings, and Forums, have been moved to <a href="%s">Settings > BuddyPress</a>. Profile Fields has been moved into the <a href="%s">Users</a> menu.', 'buddypress' ), esc_url( $settings_url ), bp_get_admin_url( 'users.php?page=bp-profile-setup' ) ); ?></p>
|
108 |
</div>
|
109 |
|
110 |
<?php
|
118 |
* BuddyPress combines all its messages into a single notice, to avoid a preponderance of yellow
|
119 |
* boxes.
|
120 |
*
|
121 |
+
* @package BuddyPress Core
|
122 |
* @since BuddyPress (1.5)
|
123 |
*
|
124 |
* @uses bp_current_user_can() to check current user permissions before showing the notices
|
137 |
return;
|
138 |
}
|
139 |
|
140 |
+
// Get the admin notices
|
141 |
+
$admin_notices = buddypress()->admin->notices;
|
|
|
|
|
|
|
142 |
|
143 |
+
// Show the messages
|
144 |
+
if ( !empty( $admin_notices ) ) : ?>
|
|
|
145 |
|
146 |
+
<div id="message" class="updated fade">
|
|
|
|
|
147 |
|
148 |
+
<?php foreach ( $admin_notices as $notice ) : ?>
|
149 |
+
|
150 |
+
<p><?php echo $notice; ?></p>
|
151 |
+
|
152 |
+
<?php endforeach; ?>
|
153 |
+
|
154 |
+
</div>
|
155 |
+
|
156 |
+
<?php endif;
|
157 |
}
|
158 |
add_action( 'admin_notices', 'bp_core_print_admin_notices' );
|
159 |
add_action( 'network_admin_notices', 'bp_core_print_admin_notices' );
|
165 |
* box. It is recommended that you hook this function to admin_init, so that your messages are
|
166 |
* loaded in time.
|
167 |
*
|
168 |
+
* @package BuddyPress Core
|
169 |
* @since BuddyPress (1.5)
|
170 |
*
|
171 |
+
* @param string $notice The notice you are adding to the queue
|
|
|
172 |
*/
|
173 |
+
function bp_core_add_admin_notice( $notice = '' ) {
|
174 |
|
175 |
// Do not add if the notice is empty
|
176 |
if ( empty( $notice ) ) {
|
183 |
}
|
184 |
|
185 |
// Add the notice
|
186 |
+
buddypress()->admin->notices[] = $notice;
|
|
|
|
|
|
|
187 |
}
|
188 |
|
189 |
/**
|
238 |
|
239 |
// Add notice if no rewrite rules are enabled
|
240 |
if ( empty( $wp_rewrite->permalink_structure ) ) {
|
241 |
+
bp_core_add_admin_notice( sprintf( __( '<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress' ), admin_url( 'options-permalink.php' ) ) );
|
242 |
}
|
243 |
|
244 |
// Get BuddyPress instance
|
274 |
);
|
275 |
}
|
276 |
|
277 |
+
// On the first admin screen after a new installation, this isn't set, so grab it to supress a misleading error message.
|
278 |
if ( empty( $bp->pages->members ) ) {
|
279 |
$bp->pages = bp_core_get_directory_pages();
|
280 |
}
|
296 |
|
297 |
if ( !empty( $orphaned_components ) ) {
|
298 |
$admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
|
299 |
+
$notice = sprintf( __( 'The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s">Repair</a>', 'buddypress' ), $admin_url, '<strong>' . implode( '</strong>, <strong>', $orphaned_components ) . '</strong>' );
|
300 |
|
301 |
bp_core_add_admin_notice( $notice );
|
302 |
}
|
318 |
// If there are duplicates, post a message about them
|
319 |
if ( !empty( $dupe_names ) ) {
|
320 |
$admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
|
321 |
+
$notice = sprintf( __( 'Each BuddyPress Component needs its own WordPress page. The following WordPress Pages have more than one component associated with them: %2$s. <a href="%1$s">Repair</a>', 'buddypress' ), $admin_url, '<strong>' . implode( '</strong>, <strong>', $dupe_names ) . '</strong>' );
|
322 |
|
323 |
bp_core_add_admin_notice( $notice );
|
324 |
}
|
341 |
function bp_do_activation_redirect() {
|
342 |
|
343 |
// Bail if no activation redirect
|
344 |
+
if ( ! get_transient( '_bp_activation_redirect' ) )
|
345 |
return;
|
|
|
346 |
|
347 |
// Delete the redirect transient
|
348 |
delete_transient( '_bp_activation_redirect' );
|
349 |
|
350 |
// Bail if activating from network, or bulk
|
351 |
+
if ( isset( $_GET['activate-multi'] ) )
|
352 |
return;
|
|
|
353 |
|
354 |
$query_args = array( 'page' => 'bp-about' );
|
355 |
if ( get_transient( '_bp_is_new_install' ) ) {
|
367 |
* Output the tabs in the admin area
|
368 |
*
|
369 |
* @since BuddyPress (1.5)
|
370 |
+
* @param string $active_tab Name of the tab that is active
|
371 |
*/
|
372 |
function bp_core_admin_tabs( $active_tab = '' ) {
|
373 |
+
|
374 |
+
// Declare local variables
|
375 |
$tabs_html = '';
|
376 |
$idle_class = 'nav-tab';
|
377 |
$active_class = 'nav-tab nav-tab-active';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
|
379 |
+
// Setup core admin tabs
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
$tabs = array(
|
381 |
'0' => array(
|
382 |
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ),
|
405 |
);
|
406 |
}
|
407 |
|
408 |
+
// Allow the tabs to be filtered
|
409 |
+
$tabs = apply_filters( 'bp_core_admin_tabs', $tabs );
|
410 |
+
|
411 |
+
// Loop through tabs and build navigation
|
412 |
+
foreach ( array_values( $tabs ) as $tab_data ) {
|
413 |
+
$is_current = (bool) ( $tab_data['name'] == $active_tab );
|
414 |
+
$tab_class = $is_current ? $active_class : $idle_class;
|
415 |
+
$tabs_html .= '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>';
|
416 |
+
}
|
417 |
+
|
418 |
+
// Output the tabs
|
419 |
+
echo $tabs_html;
|
420 |
+
|
421 |
+
// Do other fun things
|
422 |
+
do_action( 'bp_admin_tabs' );
|
423 |
}
|
424 |
|
425 |
/** Help **********************************************************************/
|
436 |
|
437 |
switch ( $screen->id ) {
|
438 |
|
439 |
+
// Compontent page
|
440 |
case 'settings_page_bp-components' :
|
441 |
|
442 |
// help tabs
|
563 |
function bp_admin_separator() {
|
564 |
|
565 |
// Bail if BuddyPress is not network activated and viewing network admin
|
566 |
+
if ( is_network_admin() && ! bp_is_network_activated() )
|
567 |
return;
|
|
|
568 |
|
569 |
// Bail if BuddyPress is network activated and viewing site admin
|
570 |
+
if ( ! is_network_admin() && bp_is_network_activated() )
|
571 |
return;
|
|
|
572 |
|
573 |
// Prevent duplicate separators when no core menu items exist
|
574 |
+
if ( ! bp_current_user_can( 'bp_moderate' ) )
|
575 |
return;
|
|
|
576 |
|
577 |
// Bail if there are no components with admin UI's. Hardcoded for now, until
|
578 |
// there's a real API for determining this later.
|
579 |
+
if ( ! bp_is_active( 'activity' ) && ! bp_is_active( 'groups' ) )
|
580 |
return;
|
|
|
581 |
|
582 |
global $menu;
|
583 |
|
596 |
function bp_admin_custom_menu_order( $menu_order = false ) {
|
597 |
|
598 |
// Bail if user cannot see admin pages
|
599 |
+
if ( ! bp_current_user_can( 'bp_moderate' ) )
|
600 |
return $menu_order;
|
|
|
601 |
|
602 |
return true;
|
603 |
}
|
614 |
function bp_admin_menu_order( $menu_order = array() ) {
|
615 |
|
616 |
// Bail if user cannot see admin pages
|
617 |
+
if ( empty( $menu_order ) || ! bp_current_user_can( 'bp_moderate' ) )
|
618 |
return $menu_order;
|
|
|
619 |
|
620 |
// Initialize our custom order array
|
621 |
$bp_menu_order = array();
|
627 |
$custom_menus = (array) apply_filters( 'bp_admin_menu_order', array() );
|
628 |
|
629 |
// Bail if no components have top level admin pages
|
630 |
+
if ( empty( $custom_menus ) )
|
631 |
return $menu_order;
|
|
|
632 |
|
633 |
// Add our separator to beginning of array
|
634 |
array_unshift( $custom_menus, 'separator-buddypress' );
|
bp-core/admin/bp-core-schema.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Get the DB schema to use for BuddyPress components
|
@@ -84,7 +84,7 @@ function bp_core_install( $active_components = false ) {
|
|
84 |
* Install database tables for the Notifications component
|
85 |
*
|
86 |
* @since BuddyPress (1.0.0)
|
87 |
-
*
|
88 |
* @uses bp_core_set_charset()
|
89 |
* @uses bp_core_get_table_prefix()
|
90 |
* @uses dbDelta()
|
@@ -119,7 +119,7 @@ function bp_core_install_notifications() {
|
|
119 |
* Install database tables for the Activity component
|
120 |
*
|
121 |
* @since BuddyPress (1.0.0)
|
122 |
-
*
|
123 |
* @uses bp_core_set_charset()
|
124 |
* @uses bp_core_get_table_prefix()
|
125 |
* @uses dbDelta()
|
@@ -136,7 +136,7 @@ function bp_core_install_activity_streams() {
|
|
136 |
type varchar(75) NOT NULL,
|
137 |
action text NOT NULL,
|
138 |
content longtext NOT NULL,
|
139 |
-
primary_link
|
140 |
item_id bigint(20) NOT NULL,
|
141 |
secondary_item_id bigint(20) DEFAULT NULL,
|
142 |
date_recorded datetime NOT NULL,
|
@@ -172,7 +172,7 @@ function bp_core_install_activity_streams() {
|
|
172 |
* Install database tables for the Notifications component
|
173 |
*
|
174 |
* @since BuddyPress (1.0.0)
|
175 |
-
*
|
176 |
* @uses bp_core_set_charset()
|
177 |
* @uses bp_core_get_table_prefix()
|
178 |
* @uses dbDelta()
|
@@ -200,7 +200,7 @@ function bp_core_install_friends() {
|
|
200 |
* Install database tables for the Groups component
|
201 |
*
|
202 |
* @since BuddyPress (1.0.0)
|
203 |
-
*
|
204 |
* @uses bp_core_set_charset()
|
205 |
* @uses bp_core_get_table_prefix()
|
206 |
* @uses dbDelta()
|
@@ -257,10 +257,10 @@ function bp_core_install_groups() {
|
|
257 |
}
|
258 |
|
259 |
/**
|
260 |
-
* Install database tables for the
|
261 |
*
|
262 |
* @since BuddyPress (1.0.0)
|
263 |
-
*
|
264 |
* @uses bp_core_set_charset()
|
265 |
* @uses bp_core_get_table_prefix()
|
266 |
* @uses dbDelta()
|
@@ -304,15 +304,6 @@ function bp_core_install_private_messaging() {
|
|
304 |
KEY is_active (is_active)
|
305 |
) {$charset_collate};";
|
306 |
|
307 |
-
$sql[] = "CREATE TABLE {$bp_prefix}bp_messages_meta (
|
308 |
-
id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
309 |
-
message_id bigint(20) NOT NULL,
|
310 |
-
meta_key varchar(255) DEFAULT NULL,
|
311 |
-
meta_value longtext DEFAULT NULL,
|
312 |
-
KEY message_id (message_id),
|
313 |
-
KEY meta_key (meta_key)
|
314 |
-
) {$charset_collate};";
|
315 |
-
|
316 |
dbDelta( $sql );
|
317 |
}
|
318 |
|
@@ -320,7 +311,7 @@ function bp_core_install_private_messaging() {
|
|
320 |
* Install database tables for the Profiles component
|
321 |
*
|
322 |
* @since BuddyPress (1.0.0)
|
323 |
-
*
|
324 |
* @uses bp_core_set_charset()
|
325 |
* @uses bp_core_get_table_prefix()
|
326 |
* @uses dbDelta()
|
@@ -410,7 +401,7 @@ function bp_core_install_extended_profiles() {
|
|
410 |
* Install database tables for the Sites component
|
411 |
*
|
412 |
* @since BuddyPress (1.0.0)
|
413 |
-
*
|
414 |
* @uses bp_core_set_charset()
|
415 |
* @uses bp_core_get_table_prefix()
|
416 |
* @uses dbDelta()
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Get the DB schema to use for BuddyPress components
|
84 |
* Install database tables for the Notifications component
|
85 |
*
|
86 |
* @since BuddyPress (1.0.0)
|
87 |
+
*
|
88 |
* @uses bp_core_set_charset()
|
89 |
* @uses bp_core_get_table_prefix()
|
90 |
* @uses dbDelta()
|
119 |
* Install database tables for the Activity component
|
120 |
*
|
121 |
* @since BuddyPress (1.0.0)
|
122 |
+
*
|
123 |
* @uses bp_core_set_charset()
|
124 |
* @uses bp_core_get_table_prefix()
|
125 |
* @uses dbDelta()
|
136 |
type varchar(75) NOT NULL,
|
137 |
action text NOT NULL,
|
138 |
content longtext NOT NULL,
|
139 |
+
primary_link varchar(255) NOT NULL,
|
140 |
item_id bigint(20) NOT NULL,
|
141 |
secondary_item_id bigint(20) DEFAULT NULL,
|
142 |
date_recorded datetime NOT NULL,
|
172 |
* Install database tables for the Notifications component
|
173 |
*
|
174 |
* @since BuddyPress (1.0.0)
|
175 |
+
*
|
176 |
* @uses bp_core_set_charset()
|
177 |
* @uses bp_core_get_table_prefix()
|
178 |
* @uses dbDelta()
|
200 |
* Install database tables for the Groups component
|
201 |
*
|
202 |
* @since BuddyPress (1.0.0)
|
203 |
+
*
|
204 |
* @uses bp_core_set_charset()
|
205 |
* @uses bp_core_get_table_prefix()
|
206 |
* @uses dbDelta()
|
257 |
}
|
258 |
|
259 |
/**
|
260 |
+
* Install database tables for the Messsages component
|
261 |
*
|
262 |
* @since BuddyPress (1.0.0)
|
263 |
+
*
|
264 |
* @uses bp_core_set_charset()
|
265 |
* @uses bp_core_get_table_prefix()
|
266 |
* @uses dbDelta()
|
304 |
KEY is_active (is_active)
|
305 |
) {$charset_collate};";
|
306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
dbDelta( $sql );
|
308 |
}
|
309 |
|
311 |
* Install database tables for the Profiles component
|
312 |
*
|
313 |
* @since BuddyPress (1.0.0)
|
314 |
+
*
|
315 |
* @uses bp_core_set_charset()
|
316 |
* @uses bp_core_get_table_prefix()
|
317 |
* @uses dbDelta()
|
401 |
* Install database tables for the Sites component
|
402 |
*
|
403 |
* @since BuddyPress (1.0.0)
|
404 |
+
*
|
405 |
* @uses bp_core_set_charset()
|
406 |
* @uses bp_core_get_table_prefix()
|
407 |
* @uses dbDelta()
|
bp-core/admin/bp-core-settings.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Main settings section description for the settings page
|
@@ -242,7 +242,7 @@ function bp_core_admin_settings() {
|
|
242 |
|
243 |
<h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Settings', 'buddypress' ) ); ?></h2>
|
244 |
|
245 |
-
<form action="<?php echo
|
246 |
|
247 |
<?php settings_fields( 'buddypress' ); ?>
|
248 |
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Main settings section description for the settings page
|
242 |
|
243 |
<h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Settings', 'buddypress' ) ); ?></h2>
|
244 |
|
245 |
+
<form action="<?php echo $form_action ?>" method="post">
|
246 |
|
247 |
<?php settings_fields( 'buddypress' ); ?>
|
248 |
|
bp-core/admin/bp-core-slugs.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Renders the page mapping admin panel.
|
@@ -101,6 +101,9 @@ function bp_core_admin_slugs_options() {
|
|
101 |
'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false
|
102 |
) ); ?>
|
103 |
|
|
|
|
|
|
|
104 |
<?php if ( !empty( $existing_pages[$name] ) ) : ?>
|
105 |
|
106 |
<a href="<?php echo get_permalink( $existing_pages[$name] ); ?>" class="button-secondary" target="_bp"><?php _e( 'View', 'buddypress' ); ?></a>
|
@@ -161,6 +164,9 @@ function bp_core_admin_slugs_options() {
|
|
161 |
'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false
|
162 |
) ) ?>
|
163 |
|
|
|
|
|
|
|
164 |
<?php if ( !empty( $existing_pages[$name] ) ) : ?>
|
165 |
|
166 |
<a href="<?php echo get_permalink( $existing_pages[$name] ); ?>" class="button-secondary" target="_bp"><?php _e( 'View', 'buddypress' ); ?></a>
|
@@ -191,7 +197,7 @@ function bp_core_admin_slugs_options() {
|
|
191 |
*/
|
192 |
function bp_core_admin_slugs_setup_handler() {
|
193 |
|
194 |
-
if ( isset( $_POST['bp-admin-pages-submit'] ) ) {
|
195 |
if ( !check_admin_referer( 'bp-admin-pages-setup' ) )
|
196 |
return false;
|
197 |
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Renders the page mapping admin panel.
|
101 |
'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false
|
102 |
) ); ?>
|
103 |
|
104 |
+
<a href="<?php echo admin_url( add_query_arg( array( 'post_type' => 'page' ), 'post-new.php' ) ); ?>" class="button-secondary"><?php _e( 'New Page', 'buddypress' ); ?></a>
|
105 |
+
<input class="button-primary" type="submit" name="bp-admin-pages-single" value="<?php esc_attr_e( 'Save', 'buddypress' ) ?>" />
|
106 |
+
|
107 |
<?php if ( !empty( $existing_pages[$name] ) ) : ?>
|
108 |
|
109 |
<a href="<?php echo get_permalink( $existing_pages[$name] ); ?>" class="button-secondary" target="_bp"><?php _e( 'View', 'buddypress' ); ?></a>
|
164 |
'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false
|
165 |
) ) ?>
|
166 |
|
167 |
+
<a href="<?php echo admin_url( add_query_arg( array( 'post_type' => 'page' ), 'post-new.php' ) ); ?>" class="button-secondary"><?php _e( 'New Page', 'buddypress' ); ?></a>
|
168 |
+
<input class="button-primary" type="submit" name="bp-admin-pages-single" value="<?php esc_attr_e( 'Save', 'buddypress' ) ?>" />
|
169 |
+
|
170 |
<?php if ( !empty( $existing_pages[$name] ) ) : ?>
|
171 |
|
172 |
<a href="<?php echo get_permalink( $existing_pages[$name] ); ?>" class="button-secondary" target="_bp"><?php _e( 'View', 'buddypress' ); ?></a>
|
197 |
*/
|
198 |
function bp_core_admin_slugs_setup_handler() {
|
199 |
|
200 |
+
if ( isset( $_POST['bp-admin-pages-submit'] ) || isset( $_POST['bp-admin-pages-single'] ) ) {
|
201 |
if ( !check_admin_referer( 'bp-admin-pages-setup' ) )
|
202 |
return false;
|
203 |
|
bp-core/admin/bp-core-tools.php
CHANGED
@@ -257,7 +257,7 @@ function bp_admin_repair_group_count() {
|
|
257 |
*/
|
258 |
function bp_admin_repair_blog_records() {
|
259 |
|
260 |
-
// Description of this tool,
|
261 |
$statement = __( 'Repopulating Blogs records… %s', 'buddypress' );
|
262 |
|
263 |
// Default to failure text
|
257 |
*/
|
258 |
function bp_admin_repair_blog_records() {
|
259 |
|
260 |
+
// Description of this tool, dispalyed to the user
|
261 |
$statement = __( 'Repopulating Blogs records… %s', 'buddypress' );
|
262 |
|
263 |
// Default to failure text
|
bp-core/admin/css/common-rtl.css
CHANGED
@@ -4,26 +4,6 @@
|
|
4 |
* @since BuddyPress (1.6)
|
5 |
*/
|
6 |
|
7 |
-
/* Welcome Screen
|
8 |
-
------------------------------------------------------------------------------*/
|
9 |
-
|
10 |
-
body.dashboard_page_bp-about span.dashicons,
|
11 |
-
body.index_page_bp-about span.dashicons {
|
12 |
-
float: right;
|
13 |
-
clear: right;
|
14 |
-
margin: 15px 0 0 15px ;
|
15 |
-
height: 90px;
|
16 |
-
width: 90px;
|
17 |
-
background-color: #cccccc;
|
18 |
-
-webkit-border-radius: 50%;
|
19 |
-
border-radius: 50%;
|
20 |
-
border: 1px solid #c1c1c1;
|
21 |
-
font-size: 65px;
|
22 |
-
line-height: 90px;
|
23 |
-
color: #999;
|
24 |
-
text-align: center;
|
25 |
-
}
|
26 |
-
|
27 |
/* User's Lists
|
28 |
------------------------------------------------------------------------------*/
|
29 |
|
4 |
* @since BuddyPress (1.6)
|
5 |
*/
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
/* User's Lists
|
8 |
------------------------------------------------------------------------------*/
|
9 |
|
bp-core/admin/css/common-rtl.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
body.dashboard_page_bp-about span.dashicons,body.index_page_bp-about span.dashicons{float:right;clear:right;margin:15px 0 0 15px;height:90px;width:90px;background-color:#ccc;-webkit-border-radius:50%;border-radius:50%;border:1px solid #c1c1c1;font-size:65px;line-height:90px;color:#999;text-align:center}body.site-users-php th#role,body.users-php th#role,body.users_page_bp-signups th#count_sent{width:10%}body.site-users-php th#email,body.site-users-php th#name,body.users-php th#email,body.users-php th#name,body.users-php th#registered,body.users_page_bp-signups th#date_sent,body.users_page_bp-signups th#email,body.users_page_bp-signups th#name,body.users_page_bp-signups th#registered{width:15%}body.users-php th#blogs,body.users_page_bp-signups th#blogs{width:20%}body.users_page_bp-signups td.count_sent,body.users_page_bp-signups th.column-count_sent{text-align:center}body.branch-3-6 div#icon-buddypress,body.branch-3-7 div#icon-buddypress{background:url(../images/icons32.png) -370px -6px no-repeat}body.branch-3-6 div#icon-buddypress-activity,body.branch-3-7 div#icon-buddypress-activity{background:url(../images/icons32.png) -10px -6px no-repeat}body.branch-3-6 div#icon-buddypress-groups,body.branch-3-7 div#icon-buddypress-groups{background:url(../images/icons32.png) -250px -6px no-repeat}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{background-image:url(../images/menu.png)!important;background-position:-178px -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image{background-position:-178px -2px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image{background-image:url(../images/menu.png);background-position:0 -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image{background-position:0 -2px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image{background-image:url(../images/menu.png);background-position:-61px -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image{background-position:-61px -2px}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}body.branch-3-6 #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,body.branch-3-6 #adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,body.branch-3-7 #adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:""}.settings_page_bp-components td.plugin-title span{float:right;width:18px;height:18px;margin-left:5px}.settings_page_bp-components td.plugin-title span:before{font-family:dashicons;font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.forums td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}body.branch-3-6.settings_page_bp-components tr.activity td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.blogs td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.forums td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.friends td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.groups td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.messages td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.notifications td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.settings td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.xprofile td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.activity td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.blogs td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.forums td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.friends td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.groups td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.messages td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.notifications td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.settings td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:""}body.branch-3-6.settings_page_bp-components td.plugin-title span,body.branch-3-7.settings_page_bp-components td.plugin-title span{background-image:url(../images/menu.png);background-position:-4px -40px;background-repeat:no-repeat}body.branch-3-6.settings_page_bp-components tr.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.active td.plugin-title span{background-position-y:-7px}body.branch-3-6.settings_page_bp-components tr.activity td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.activity td.plugin-title span{background-position:-4px -40px}body.branch-3-6.settings_page_bp-components tr.activity.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.activity.active td.plugin-title span{background-position:-4px -7px}body.branch-3-6.settings_page_bp-components tr.xprofile td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.xprofile td.plugin-title span{background-image:url(../images/menu-wp.png);background-position:-305px -40px}body.branch-3-6.settings_page_bp-components tr.xprofile.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.xprofile.active td.plugin-title span{background-position:-305px -7px}body.branch-3-6.settings_page_bp-components tr.settings td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.settings td.plugin-title span{background-image:url(../images/menu-wp.png);background-position:-334px -40px}body.branch-3-6.settings_page_bp-components tr.settings.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.settings.active td.plugin-title span{background-position:-334px -7px}body.branch-3-6.settings_page_bp-components tr.groups td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.groups td.plugin-title span{background-position:-66px -40px}body.branch-3-6.settings_page_bp-components tr.groups.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.groups.active td.plugin-title span{background-position:-66px -7px}body.branch-3-6.settings_page_bp-components tr.messages td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.messages td.plugin-title span{background-position:-154px -40px}body.branch-3-6.settings_page_bp-components tr.messages.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.messages.active td.plugin-title span{background-position:-154px -7px}body.branch-3-6.settings_page_bp-components tr.forums td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.forums td.plugin-title span{background-image:url(../images/menu-wp.png);background-position:-36px -40px}body.branch-3-6.settings_page_bp-components tr.forums.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.forums.active td.plugin-title span{background-position:-36px -7px}body.branch-3-6.settings_page_bp-components tr.blogs td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.blogs td.plugin-title span{background-position:-125px -40px}body.branch-3-6.settings_page_bp-components tr.blogs.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.blogs.active td.plugin-title span{background-position:-125px -7px}body.branch-3-6.settings_page_bp-components tr.friends td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.friends td.plugin-title span{background-position:-95px -40px}body.branch-3-6.settings_page_bp-components tr.friends.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.friends.active td.plugin-title span{background-position:-95px -7px}body.branch-3-6.settings_page_bp-components tr.core td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.core td.plugin-title span{background-position:-184px -40px}body.branch-3-6.settings_page_bp-components tr.core.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.core.active td.plugin-title span{background-position:-184px -7px}body.branch-3-6.settings_page_bp-components tr.members td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.members td.plugin-title span{background-position:-36px -40px}body.branch-3-6.settings_page_bp-components tr.members.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.members.active td.plugin-title span{background-position:-36px -7px}#bp-admin-component-form .widefat th{display:table-cell;vertical-align:top}.bp-badge{font:400 150px/1 dashicons!important;color:#D84800;display:inline-block}.bp-badge:before{content:"\f448"}.about-wrap .bp-badge{position:absolute;top:0;left:0}@media only screen and (-webkit-min-device-pixel-ratio:1.5){body.branch-3-6 div#icon-buddypress,body.branch-3-6 div#icon-buddypress-activity,body.branch-3-6 div#icon-buddypress-groups,body.branch-3-7 div#icon-buddypress,body.branch-3-7 div#icon-buddypress-activity,body.branch-3-7 div#icon-buddypress-groups{background-image:url(../images/icons64.png);background-size:419px 45px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image{background-image:url(../images/menu-2x.png)!important;background-size:209px 64px}}
|
1 |
+
body.site-users-php th#role,body.users-php th#role,body.users_page_bp-signups th#count_sent{width:10%}body.site-users-php th#email,body.site-users-php th#name,body.users-php th#email,body.users-php th#name,body.users-php th#registered,body.users_page_bp-signups th#date_sent,body.users_page_bp-signups th#email,body.users_page_bp-signups th#name,body.users_page_bp-signups th#registered{width:15%}body.users-php th#blogs,body.users_page_bp-signups th#blogs{width:20%}body.users_page_bp-signups td.count_sent,body.users_page_bp-signups th.column-count_sent{text-align:center}body.branch-3-6 div#icon-buddypress,body.branch-3-7 div#icon-buddypress{background:url(../images/icons32.png) -370px -6px no-repeat}body.branch-3-6 div#icon-buddypress-activity,body.branch-3-7 div#icon-buddypress-activity{background:url(../images/icons32.png) -10px -6px no-repeat}body.branch-3-6 div#icon-buddypress-groups,body.branch-3-7 div#icon-buddypress-groups{background:url(../images/icons32.png) -250px -6px no-repeat}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{background-image:url(../images/menu.png)!important;background-position:-178px -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image{background-position:-178px -2px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image{background-image:url(../images/menu.png);background-position:0 -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image{background-position:0 -2px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image{background-image:url(../images/menu.png);background-position:-61px -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image{background-position:-61px -2px}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}body.branch-3-6 #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,body.branch-3-6 #adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,body.branch-3-7 #adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:""}.settings_page_bp-components td.plugin-title span{float:right;width:18px;height:18px;margin-left:5px}.settings_page_bp-components td.plugin-title span:before{font-family:dashicons;font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.forums td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}body.branch-3-6.settings_page_bp-components tr.activity td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.blogs td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.forums td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.friends td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.groups td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.messages td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.notifications td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.settings td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.xprofile td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.activity td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.blogs td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.forums td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.friends td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.groups td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.messages td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.notifications td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.settings td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:""}body.branch-3-6.settings_page_bp-components td.plugin-title span,body.branch-3-7.settings_page_bp-components td.plugin-title span{background-image:url(../images/menu.png);background-position:-4px -40px;background-repeat:no-repeat}body.branch-3-6.settings_page_bp-components tr.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.active td.plugin-title span{background-position-y:-7px}body.branch-3-6.settings_page_bp-components tr.activity td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.activity td.plugin-title span{background-position:-4px -40px}body.branch-3-6.settings_page_bp-components tr.activity.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.activity.active td.plugin-title span{background-position:-4px -7px}body.branch-3-6.settings_page_bp-components tr.xprofile td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.xprofile td.plugin-title span{background-image:url(../images/menu-wp.png);background-position:-305px -40px}body.branch-3-6.settings_page_bp-components tr.xprofile.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.xprofile.active td.plugin-title span{background-position:-305px -7px}body.branch-3-6.settings_page_bp-components tr.settings td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.settings td.plugin-title span{background-image:url(../images/menu-wp.png);background-position:-334px -40px}body.branch-3-6.settings_page_bp-components tr.settings.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.settings.active td.plugin-title span{background-position:-334px -7px}body.branch-3-6.settings_page_bp-components tr.groups td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.groups td.plugin-title span{background-position:-66px -40px}body.branch-3-6.settings_page_bp-components tr.groups.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.groups.active td.plugin-title span{background-position:-66px -7px}body.branch-3-6.settings_page_bp-components tr.messages td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.messages td.plugin-title span{background-position:-154px -40px}body.branch-3-6.settings_page_bp-components tr.messages.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.messages.active td.plugin-title span{background-position:-154px -7px}body.branch-3-6.settings_page_bp-components tr.forums td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.forums td.plugin-title span{background-image:url(../images/menu-wp.png);background-position:-36px -40px}body.branch-3-6.settings_page_bp-components tr.forums.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.forums.active td.plugin-title span{background-position:-36px -7px}body.branch-3-6.settings_page_bp-components tr.blogs td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.blogs td.plugin-title span{background-position:-125px -40px}body.branch-3-6.settings_page_bp-components tr.blogs.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.blogs.active td.plugin-title span{background-position:-125px -7px}body.branch-3-6.settings_page_bp-components tr.friends td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.friends td.plugin-title span{background-position:-95px -40px}body.branch-3-6.settings_page_bp-components tr.friends.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.friends.active td.plugin-title span{background-position:-95px -7px}body.branch-3-6.settings_page_bp-components tr.core td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.core td.plugin-title span{background-position:-184px -40px}body.branch-3-6.settings_page_bp-components tr.core.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.core.active td.plugin-title span{background-position:-184px -7px}body.branch-3-6.settings_page_bp-components tr.members td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.members td.plugin-title span{background-position:-36px -40px}body.branch-3-6.settings_page_bp-components tr.members.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.members.active td.plugin-title span{background-position:-36px -7px}#bp-admin-component-form .widefat th{display:table-cell;vertical-align:top}.bp-badge{font:400 150px/1 dashicons!important;color:#D84800;display:inline-block}.bp-badge:before{content:"\f448"}.about-wrap .bp-badge{position:absolute;top:0;left:0}@media only screen and (-webkit-min-device-pixel-ratio:1.5){body.branch-3-6 div#icon-buddypress,body.branch-3-6 div#icon-buddypress-activity,body.branch-3-6 div#icon-buddypress-groups,body.branch-3-7 div#icon-buddypress,body.branch-3-7 div#icon-buddypress-activity,body.branch-3-7 div#icon-buddypress-groups{background-image:url(../images/icons64.png);background-size:419px 45px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image{background-image:url(../images/menu-2x.png)!important;background-size:209px 64px}}
|
bp-core/admin/css/common.css
CHANGED
@@ -4,26 +4,6 @@
|
|
4 |
* @since BuddyPress (1.6)
|
5 |
*/
|
6 |
|
7 |
-
/* Welcome Screen
|
8 |
-
------------------------------------------------------------------------------*/
|
9 |
-
|
10 |
-
body.dashboard_page_bp-about span.dashicons,
|
11 |
-
body.index_page_bp-about span.dashicons {
|
12 |
-
float: left;
|
13 |
-
clear: left;
|
14 |
-
margin: 15px 15px 0 0 ;
|
15 |
-
height: 90px;
|
16 |
-
width: 90px;
|
17 |
-
background-color: #cccccc;
|
18 |
-
-webkit-border-radius: 50%;
|
19 |
-
border-radius: 50%;
|
20 |
-
border: 1px solid #c1c1c1;
|
21 |
-
font-size: 65px;
|
22 |
-
line-height: 90px;
|
23 |
-
color: #999;
|
24 |
-
text-align: center;
|
25 |
-
}
|
26 |
-
|
27 |
/* User's Lists
|
28 |
------------------------------------------------------------------------------*/
|
29 |
|
4 |
* @since BuddyPress (1.6)
|
5 |
*/
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
/* User's Lists
|
8 |
------------------------------------------------------------------------------*/
|
9 |
|
bp-core/admin/css/common.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
body.dashboard_page_bp-about span.dashicons,body.index_page_bp-about span.dashicons{float:left;clear:left;margin:15px 15px 0 0;height:90px;width:90px;background-color:#ccc;-webkit-border-radius:50%;border-radius:50%;border:1px solid #c1c1c1;font-size:65px;line-height:90px;color:#999;text-align:center}body.site-users-php th#role,body.users-php th#role,body.users_page_bp-signups th#count_sent{width:10%}body.site-users-php th#email,body.site-users-php th#name,body.users-php th#email,body.users-php th#name,body.users-php th#registered,body.users_page_bp-signups th#date_sent,body.users_page_bp-signups th#email,body.users_page_bp-signups th#name,body.users_page_bp-signups th#registered{width:15%}body.users-php th#blogs,body.users_page_bp-signups th#blogs{width:20%}body.users_page_bp-signups td.count_sent,body.users_page_bp-signups th.column-count_sent{text-align:center}body.branch-3-6 div#icon-buddypress,body.branch-3-7 div#icon-buddypress{background:url(../images/icons32.png) -370px -6px no-repeat}body.branch-3-6 div#icon-buddypress-activity,body.branch-3-7 div#icon-buddypress-activity{background:url(../images/icons32.png) -10px -6px no-repeat}body.branch-3-6 div#icon-buddypress-groups,body.branch-3-7 div#icon-buddypress-groups{background:url(../images/icons32.png) -250px -6px no-repeat}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{background-image:url(../images/menu.png)!important;background-position:-178px -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image{background-position:-178px -2px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image{background-image:url(../images/menu.png);background-position:0 -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image{background-position:0 -2px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image{background-image:url(../images/menu.png);background-position:-61px -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image{background-position:-61px -2px}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}body.branch-3-6 #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,body.branch-3-6 #adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,body.branch-3-7 #adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:""}.settings_page_bp-components td.plugin-title span{float:left;width:18px;height:18px;margin-right:5px}.settings_page_bp-components td.plugin-title span:before{font-family:dashicons;font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.forums td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}body.branch-3-6.settings_page_bp-components tr.activity td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.blogs td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.forums td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.friends td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.groups td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.messages td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.notifications td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.settings td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.xprofile td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.activity td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.blogs td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.forums td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.friends td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.groups td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.messages td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.notifications td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.settings td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:""}body.branch-3-6.settings_page_bp-components td.plugin-title span,body.branch-3-7.settings_page_bp-components td.plugin-title span{background-image:url(../images/menu.png);background-position:-4px -40px;background-repeat:no-repeat}body.branch-3-6.settings_page_bp-components tr.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.active td.plugin-title span{background-position-y:-7px}body.branch-3-6.settings_page_bp-components tr.activity td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.activity td.plugin-title span{background-position:-4px -40px}body.branch-3-6.settings_page_bp-components tr.activity.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.activity.active td.plugin-title span{background-position:-4px -7px}body.branch-3-6.settings_page_bp-components tr.xprofile td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.xprofile td.plugin-title span{background-image:url(../images/menu-wp.png);background-position:-305px -40px}body.branch-3-6.settings_page_bp-components tr.xprofile.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.xprofile.active td.plugin-title span{background-position:-305px -7px}body.branch-3-6.settings_page_bp-components tr.settings td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.settings td.plugin-title span{background-image:url(../images/menu-wp.png);background-position:-334px -40px}body.branch-3-6.settings_page_bp-components tr.settings.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.settings.active td.plugin-title span{background-position:-334px -7px}body.branch-3-6.settings_page_bp-components tr.groups td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.groups td.plugin-title span{background-position:-66px -40px}body.branch-3-6.settings_page_bp-components tr.groups.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.groups.active td.plugin-title span{background-position:-66px -7px}body.branch-3-6.settings_page_bp-components tr.messages td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.messages td.plugin-title span{background-position:-154px -40px}body.branch-3-6.settings_page_bp-components tr.messages.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.messages.active td.plugin-title span{background-position:-154px -7px}body.branch-3-6.settings_page_bp-components tr.forums td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.forums td.plugin-title span{background-image:url(../images/menu-wp.png);background-position:-36px -40px}body.branch-3-6.settings_page_bp-components tr.forums.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.forums.active td.plugin-title span{background-position:-36px -7px}body.branch-3-6.settings_page_bp-components tr.blogs td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.blogs td.plugin-title span{background-position:-125px -40px}body.branch-3-6.settings_page_bp-components tr.blogs.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.blogs.active td.plugin-title span{background-position:-125px -7px}body.branch-3-6.settings_page_bp-components tr.friends td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.friends td.plugin-title span{background-position:-95px -40px}body.branch-3-6.settings_page_bp-components tr.friends.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.friends.active td.plugin-title span{background-position:-95px -7px}body.branch-3-6.settings_page_bp-components tr.core td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.core td.plugin-title span{background-position:-184px -40px}body.branch-3-6.settings_page_bp-components tr.core.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.core.active td.plugin-title span{background-position:-184px -7px}body.branch-3-6.settings_page_bp-components tr.members td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.members td.plugin-title span{background-position:-36px -40px}body.branch-3-6.settings_page_bp-components tr.members.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.members.active td.plugin-title span{background-position:-36px -7px}#bp-admin-component-form .widefat th{display:table-cell;vertical-align:top}.bp-badge{font:400 150px/1 dashicons!important;color:#D84800;display:inline-block}.bp-badge:before{content:"\f448"}.about-wrap .bp-badge{position:absolute;top:0;right:0}@media only screen and (-webkit-min-device-pixel-ratio:1.5){body.branch-3-6 div#icon-buddypress,body.branch-3-6 div#icon-buddypress-activity,body.branch-3-6 div#icon-buddypress-groups,body.branch-3-7 div#icon-buddypress,body.branch-3-7 div#icon-buddypress-activity,body.branch-3-7 div#icon-buddypress-groups{background-image:url(../images/icons64.png);background-size:419px 45px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image{background-image:url(../images/menu-2x.png)!important;background-size:209px 64px}}
|
1 |
+
body.site-users-php th#role,body.users-php th#role,body.users_page_bp-signups th#count_sent{width:10%}body.site-users-php th#email,body.site-users-php th#name,body.users-php th#email,body.users-php th#name,body.users-php th#registered,body.users_page_bp-signups th#date_sent,body.users_page_bp-signups th#email,body.users_page_bp-signups th#name,body.users_page_bp-signups th#registered{width:15%}body.users-php th#blogs,body.users_page_bp-signups th#blogs{width:20%}body.users_page_bp-signups td.count_sent,body.users_page_bp-signups th.column-count_sent{text-align:center}body.branch-3-6 div#icon-buddypress,body.branch-3-7 div#icon-buddypress{background:url(../images/icons32.png) -370px -6px no-repeat}body.branch-3-6 div#icon-buddypress-activity,body.branch-3-7 div#icon-buddypress-activity{background:url(../images/icons32.png) -10px -6px no-repeat}body.branch-3-6 div#icon-buddypress-groups,body.branch-3-7 div#icon-buddypress-groups{background:url(../images/icons32.png) -250px -6px no-repeat}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{background-image:url(../images/menu.png)!important;background-position:-178px -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings:hover .wp-menu-image{background-position:-178px -2px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image{background-image:url(../images/menu.png);background-position:0 -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network:hover .wp-menu-image{background-position:0 -2px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image{background-image:url(../images/menu.png);background-position:-61px -34px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups:hover .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network.current .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network.wp-has-current-submenu .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network:hover .wp-menu-image{background-position:-61px -2px}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}body.branch-3-6 #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,body.branch-3-6 #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,body.branch-3-6 #adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 #adminmenu #toplevel_page_bp-activity .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-groups .wp-menu-image:before,body.branch-3-7 #adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,body.branch-3-7 #adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 #adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:""}.settings_page_bp-components td.plugin-title span{float:left;width:18px;height:18px;margin-right:5px}.settings_page_bp-components td.plugin-title span:before{font-family:dashicons;font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.forums td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}body.branch-3-6.settings_page_bp-components tr.activity td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.blogs td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.forums td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.friends td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.groups td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.messages td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.notifications td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.settings td.plugin-title span:before,body.branch-3-6.settings_page_bp-components tr.xprofile td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.activity td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.blogs td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.forums td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.friends td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.groups td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.messages td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.notifications td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.settings td.plugin-title span:before,body.branch-3-7.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:""}body.branch-3-6.settings_page_bp-components td.plugin-title span,body.branch-3-7.settings_page_bp-components td.plugin-title span{background-image:url(../images/menu.png);background-position:-4px -40px;background-repeat:no-repeat}body.branch-3-6.settings_page_bp-components tr.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.active td.plugin-title span{background-position-y:-7px}body.branch-3-6.settings_page_bp-components tr.activity td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.activity td.plugin-title span{background-position:-4px -40px}body.branch-3-6.settings_page_bp-components tr.activity.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.activity.active td.plugin-title span{background-position:-4px -7px}body.branch-3-6.settings_page_bp-components tr.xprofile td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.xprofile td.plugin-title span{background-image:url(../images/menu-wp.png);background-position:-305px -40px}body.branch-3-6.settings_page_bp-components tr.xprofile.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.xprofile.active td.plugin-title span{background-position:-305px -7px}body.branch-3-6.settings_page_bp-components tr.settings td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.settings td.plugin-title span{background-image:url(../images/menu-wp.png);background-position:-334px -40px}body.branch-3-6.settings_page_bp-components tr.settings.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.settings.active td.plugin-title span{background-position:-334px -7px}body.branch-3-6.settings_page_bp-components tr.groups td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.groups td.plugin-title span{background-position:-66px -40px}body.branch-3-6.settings_page_bp-components tr.groups.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.groups.active td.plugin-title span{background-position:-66px -7px}body.branch-3-6.settings_page_bp-components tr.messages td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.messages td.plugin-title span{background-position:-154px -40px}body.branch-3-6.settings_page_bp-components tr.messages.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.messages.active td.plugin-title span{background-position:-154px -7px}body.branch-3-6.settings_page_bp-components tr.forums td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.forums td.plugin-title span{background-image:url(../images/menu-wp.png);background-position:-36px -40px}body.branch-3-6.settings_page_bp-components tr.forums.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.forums.active td.plugin-title span{background-position:-36px -7px}body.branch-3-6.settings_page_bp-components tr.blogs td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.blogs td.plugin-title span{background-position:-125px -40px}body.branch-3-6.settings_page_bp-components tr.blogs.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.blogs.active td.plugin-title span{background-position:-125px -7px}body.branch-3-6.settings_page_bp-components tr.friends td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.friends td.plugin-title span{background-position:-95px -40px}body.branch-3-6.settings_page_bp-components tr.friends.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.friends.active td.plugin-title span{background-position:-95px -7px}body.branch-3-6.settings_page_bp-components tr.core td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.core td.plugin-title span{background-position:-184px -40px}body.branch-3-6.settings_page_bp-components tr.core.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.core.active td.plugin-title span{background-position:-184px -7px}body.branch-3-6.settings_page_bp-components tr.members td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.members td.plugin-title span{background-position:-36px -40px}body.branch-3-6.settings_page_bp-components tr.members.active td.plugin-title span,body.branch-3-7.settings_page_bp-components tr.members.active td.plugin-title span{background-position:-36px -7px}#bp-admin-component-form .widefat th{display:table-cell;vertical-align:top}.bp-badge{font:400 150px/1 dashicons!important;color:#D84800;display:inline-block}.bp-badge:before{content:"\f448"}.about-wrap .bp-badge{position:absolute;top:0;right:0}@media only screen and (-webkit-min-device-pixel-ratio:1.5){body.branch-3-6 div#icon-buddypress,body.branch-3-6 div#icon-buddypress-activity,body.branch-3-6 div#icon-buddypress-groups,body.branch-3-7 div#icon-buddypress,body.branch-3-7 div#icon-buddypress-activity,body.branch-3-7 div#icon-buddypress-groups{background-image:url(../images/icons64.png);background-size:419px 45px}body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-6 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-activity_network .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-components .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups .wp-menu-image,body.branch-3-7 ul#adminmenu li.toplevel_page_bp-groups_network .wp-menu-image{background-image:url(../images/menu-2x.png)!important;background-size:209px 64px}}
|
bp-core/admin/images/member-types.png
DELETED
Binary file
|
bp-core/admin/images/mentions.gif
ADDED
Binary file
|
bp-core/bp-core-actions.php
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
*/
|
14 |
|
15 |
// Exit if accessed directly
|
16 |
-
defined( 'ABSPATH' )
|
17 |
|
18 |
/**
|
19 |
* Attach BuddyPress to WordPress.
|
@@ -53,7 +53,6 @@ add_action( 'generate_rewrite_rules', 'bp_generate_rewrite_rules', 10 );
|
|
53 |
*/
|
54 |
add_action( 'bp_loaded', 'bp_setup_components', 2 );
|
55 |
add_action( 'bp_loaded', 'bp_include', 4 );
|
56 |
-
add_action( 'bp_loaded', 'bp_setup_cache_groups', 5 );
|
57 |
add_action( 'bp_loaded', 'bp_setup_widgets', 6 );
|
58 |
add_action( 'bp_loaded', 'bp_register_theme_packages', 12 );
|
59 |
add_action( 'bp_loaded', 'bp_register_theme_directory', 14 );
|
@@ -66,7 +65,6 @@ add_action( 'bp_loaded', 'bp_register_theme_directory', 14 );
|
|
66 |
* v---Load order
|
67 |
*/
|
68 |
add_action( 'bp_init', 'bp_core_set_uri_globals', 2 );
|
69 |
-
add_action( 'bp_init', 'bp_register_taxonomies', 3 );
|
70 |
add_action( 'bp_init', 'bp_setup_globals', 4 );
|
71 |
add_action( 'bp_init', 'bp_setup_canonical_stack', 5 );
|
72 |
add_action( 'bp_init', 'bp_setup_nav', 6 );
|
13 |
*/
|
14 |
|
15 |
// Exit if accessed directly
|
16 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
17 |
|
18 |
/**
|
19 |
* Attach BuddyPress to WordPress.
|
53 |
*/
|
54 |
add_action( 'bp_loaded', 'bp_setup_components', 2 );
|
55 |
add_action( 'bp_loaded', 'bp_include', 4 );
|
|
|
56 |
add_action( 'bp_loaded', 'bp_setup_widgets', 6 );
|
57 |
add_action( 'bp_loaded', 'bp_register_theme_packages', 12 );
|
58 |
add_action( 'bp_loaded', 'bp_register_theme_directory', 14 );
|
65 |
* v---Load order
|
66 |
*/
|
67 |
add_action( 'bp_init', 'bp_core_set_uri_globals', 2 );
|
|
|
68 |
add_action( 'bp_init', 'bp_setup_globals', 4 );
|
69 |
add_action( 'bp_init', 'bp_setup_canonical_stack', 5 );
|
70 |
add_action( 'bp_init', 'bp_setup_nav', 6 );
|
bp-core/bp-core-admin.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
if ( !class_exists( 'BP_Admin' ) ) :
|
14 |
/**
|
@@ -187,9 +187,8 @@ class BP_Admin {
|
|
187 |
public function admin_menus() {
|
188 |
|
189 |
// Bail if user cannot moderate
|
190 |
-
if ( ! bp_current_user_can( 'manage_options' ) )
|
191 |
return;
|
192 |
-
}
|
193 |
|
194 |
// About
|
195 |
add_dashboard_page(
|
@@ -351,9 +350,8 @@ class BP_Admin {
|
|
351 |
// Add the main section
|
352 |
add_settings_section( 'bp_groups', __( 'Groups Settings', 'buddypress' ), 'bp_admin_setting_callback_groups_section', 'buddypress' );
|
353 |
|
354 |
-
if ( empty( $avatar_setting ) )
|
355 |
$avatar_setting = 'bp_groups';
|
356 |
-
}
|
357 |
|
358 |
// Allow subscriptions setting
|
359 |
add_settings_field( 'bp_restrict_group_creation', __( 'Group Creation', 'buddypress' ), 'bp_admin_setting_callback_group_creation', 'buddypress', 'bp_groups' );
|
@@ -433,14 +431,13 @@ class BP_Admin {
|
|
433 |
public function modify_plugin_action_links( $links, $file ) {
|
434 |
|
435 |
// Return normal links if not BuddyPress
|
436 |
-
if ( plugin_basename( buddypress()->basename ) != $file )
|
437 |
return $links;
|
438 |
-
}
|
439 |
|
440 |
// Add a few links to the existing links array
|
441 |
return array_merge( $links, array(
|
442 |
-
'settings' => '<a href="' .
|
443 |
-
'about' => '<a href="' .
|
444 |
) );
|
445 |
}
|
446 |
|
@@ -489,15 +486,33 @@ class BP_Admin {
|
|
489 |
* @since BuddyPress (1.7.0)
|
490 |
*/
|
491 |
public function about_screen() {
|
492 |
-
|
|
|
|
|
|
|
|
|
493 |
|
494 |
<div class="wrap about-wrap">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
495 |
|
496 |
-
|
497 |
|
498 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
|
500 |
-
<?php if (
|
501 |
|
502 |
<div id="welcome-panel" class="welcome-panel">
|
503 |
<div class="welcome-panel-content">
|
@@ -506,14 +521,14 @@ class BP_Admin {
|
|
506 |
<div class="welcome-panel-column">
|
507 |
<h4><?php _e( 'Configure Buddypress', 'buddypress' ); ?></h4>
|
508 |
<ul>
|
509 |
-
<li><?php printf(
|
510 |
-
'<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Set Up Components', 'buddypress' ) . '</a>',
|
511 |
); ?></li>
|
512 |
-
<li><?php printf(
|
513 |
-
'<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Assign Components to Pages', 'buddypress' ) . '</a>',
|
514 |
); ?></li>
|
515 |
<li><?php printf(
|
516 |
-
'<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Customize Settings', 'buddypress' ) . '</a>',
|
517 |
); ?></li>
|
518 |
</ul>
|
519 |
<a class="button button-primary button-hero" style="margin-bottom:20px;margin-top:0;" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), $this->settings_page ) ) ); ?>"><?php _e( 'Get Started', 'buddypress' ); ?></a>
|
@@ -522,103 +537,125 @@ class BP_Admin {
|
|
522 |
<h4><?php _e( 'Administration Tools', 'buddypress' ); ?></h4>
|
523 |
<ul>
|
524 |
<?php if ( bp_is_active( 'members' ) ) : ?>
|
525 |
-
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add User Profile Fields', 'buddypress' ) . '</a>',
|
526 |
<?php endif; ?>
|
527 |
-
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Manage User Signups', 'buddypress' ) . '</a>',
|
528 |
<?php if ( bp_is_active( 'activity' ) ) : ?>
|
529 |
-
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Moderate Activity Streams', 'buddypress' ) . '</a>',
|
530 |
<?php endif; ?>
|
531 |
<?php if ( bp_is_active( 'groups' ) ) : ?>
|
532 |
-
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Manage Groups', 'buddypress' ) . '</a>',
|
533 |
<?php endif; ?>
|
534 |
-
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Repair Data', 'buddypress' ) . '</a>',
|
535 |
</li>
|
536 |
</ul>
|
537 |
</div>
|
538 |
<div class="welcome-panel-column welcome-panel-last">
|
539 |
<h4><?php _e( 'Community and Support', 'buddypress' ); ?></h4>
|
540 |
-
<p class="welcome-icon welcome-learn-more" style="margin-right:10px"><?php _e( 'Looking for help? The <a href="http://codex.buddypress.org/">BuddyPress Codex</a> has you covered.', 'buddypress' ) ?></p>
|
541 |
<p class="welcome-icon welcome-learn-more" style="margin-right:10px"><?php _e( 'Can’t find what you need? Stop by <a href="http://buddypress.org/support/">our support forums</a>, where active BuddyPress users and developers are waiting to share tips and more.', 'buddypress' ) ?></p>
|
542 |
</div>
|
543 |
</div>
|
544 |
</div>
|
545 |
</div>
|
546 |
|
547 |
-
<hr />
|
548 |
-
|
549 |
<?php endif; ?>
|
550 |
|
551 |
-
<
|
552 |
-
<h2><?php esc_html_e( 'Member Types', 'buddypress' ); ?></h2>
|
553 |
-
<div class="featured-image">
|
554 |
-
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/member-types.png' ); ?>" alt="<?php esc_attr_e( 'Member types metabox', 'buddypress' ); ?>">
|
555 |
-
</div>
|
556 |
-
|
557 |
-
<div class="feature-section">
|
558 |
-
<h3><?php esc_html_e( 'Native APIs for crafting great new member experiences.', 'buddypress' ); ?></h3>
|
559 |
-
<p><?php esc_html_e( 'Registering member types finally enables a strict separation of different and explicit types of community members.', 'buddypress' ); ?></p>
|
560 |
-
<p><?php esc_html_e( 'This amazing new feature is available to plugin developers starting with BuddyPress 2.2', 'buddypress' ); ?></p>
|
561 |
-
<p><a href="https://codex.buddypress.org/developer/member-types/"><?php esc_html_e( 'Learn more →', 'buddypress' ); ?></a></p>
|
562 |
-
</div>
|
563 |
|
564 |
-
|
565 |
-
|
|
|
|
|
|
|
566 |
|
567 |
<hr />
|
568 |
|
569 |
-
<div class="changelog
|
570 |
-
<h2><?php
|
571 |
|
572 |
-
<div class="feature-section col
|
573 |
-
<div>
|
574 |
-
<
|
575 |
-
<
|
576 |
-
<p><?php esc_html_e( 'Register custom post types so they appear as activity stream items, complete with custom verbiage.', 'buddypress' ); ?></p>
|
577 |
</div>
|
578 |
|
579 |
-
<div class="
|
580 |
-
<
|
581 |
-
<
|
582 |
-
<p><?php esc_html_e( 'The Legacy template pack is now more responsive and accommodating to more WordPress themes.', 'buddypress' ); ?></p>
|
583 |
</div>
|
584 |
|
585 |
-
<div class="
|
586 |
-
<
|
587 |
-
<
|
588 |
-
<p><?php esc_html_e( 'Private message conversations made infinitely more flexible with an additional metadata table.', 'buddypress' ); ?></p>
|
589 |
-
</div>
|
590 |
-
|
591 |
-
<div class="last-feature">
|
592 |
-
<span class=" dashicons dashicons-heart"></span>
|
593 |
-
<h4><?php esc_html_e( 'WordPress 3.6 - 4.1', 'buddypress' ); ?></h4>
|
594 |
-
<p><?php esc_html_e( 'We support a wide range of WordPress versions, even though you should always stay up-to-date.', 'buddypress' ); ?></p>
|
595 |
</div>
|
596 |
</div>
|
597 |
</div>
|
598 |
|
599 |
<hr />
|
600 |
|
601 |
-
<div class="changelog
|
602 |
-
<h2><?php esc_html_e( '
|
603 |
-
|
604 |
<div class="feature-section col two-col">
|
605 |
-
<div>
|
606 |
-
<
|
607 |
-
<p><?php
|
608 |
-
|
609 |
-
|
610 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
611 |
</div>
|
612 |
-
<div class="last-feature">
|
613 |
-
<h4><?php esc_html_e( 'Developer Reference', 'buddypress' ); ?></h4>
|
614 |
-
<p><?php esc_html_e( 'Continued improvements to inline code documentation make it easier for developers to understand how BuddyPress works.', 'buddypress' ); ?></p>
|
615 |
|
616 |
-
|
617 |
-
<p><?php esc_html_e( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
618 |
</div>
|
619 |
</div>
|
620 |
</div>
|
621 |
-
|
622 |
<?php
|
623 |
}
|
624 |
|
@@ -631,15 +668,32 @@ class BP_Admin {
|
|
631 |
* @since BuddyPress (1.7.0)
|
632 |
*/
|
633 |
public function credits_screen() {
|
634 |
-
|
|
|
|
|
|
|
635 |
|
636 |
<div class="wrap about-wrap">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
637 |
|
638 |
-
|
639 |
|
640 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
641 |
|
642 |
-
<p class="about-description"><?php _e( 'BuddyPress is created by a worldwide network of friendly folks
|
643 |
|
644 |
<h4 class="wp-people-group"><?php _e( 'Project Leaders', 'buddypress' ); ?></h4>
|
645 |
<ul class="wp-people-group " id="wp-people-group-project-leaders">
|
@@ -677,20 +731,14 @@ class BP_Admin {
|
|
677 |
<a class="web" href="http://profiles.wordpress.org/mercime">Mercime</a>
|
678 |
<span class="title"><?php _e( 'Navigator', 'buddypress' ); ?></span>
|
679 |
</li>
|
680 |
-
<li class="wp-person" id="wp-person-dcavins">
|
681 |
-
<a href="http://profiles.wordpress.org/dcavins"><img src="http://0.gravatar.com/avatar/a5fa7e83d59cb45ebb616235a176595a?s=60" class="gravatar" alt="David Cavins" /></a>
|
682 |
-
<a class="web" href="http://profiles.wordpress.org/dcavins">David Cavins</a>
|
683 |
-
<span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
|
684 |
-
</li>
|
685 |
-
<li class="wp-person" id="wp-person-tw2113">
|
686 |
-
<a href="http://profiles.wordpress.org/tw2113"><img src="http://0.gravatar.com/avatar/a5d7c934621fa1c025b83ee79bc62366?s=60" class="gravatar" alt="Michael Beckwith" /></a>
|
687 |
-
<a class="web" href="http://profiles.wordpress.org/tw2113">Michael Beckwith</a>
|
688 |
-
<span class="title"><?php _e( 'Core Developer', 'buddypress' ); ?></span>
|
689 |
-
</li>
|
690 |
</ul>
|
691 |
|
692 |
<h4 class="wp-people-group"><?php _e( 'Recent Rockstars', 'buddypress' ); ?></h4>
|
693 |
<ul class="wp-people-group " id="wp-people-group-rockstars">
|
|
|
|
|
|
|
|
|
694 |
<li class="wp-person" id="wp-person-henry-wright">
|
695 |
<a href="http://profiles.wordpress.org/henry.wright"><img src="http://0.gravatar.com/avatar/0da2f1a9340d6af196b870f6c107a248?s=60" class="gravatar" alt="Henry Wright" /></a>
|
696 |
<a class="web" href="http://profiles.wordpress.org/henry.wright">Henry Wright</a>
|
@@ -707,59 +755,53 @@ class BP_Admin {
|
|
707 |
<a href="http://profiles.wordpress.org/netweb"><img src="http://0.gravatar.com/avatar/97e1620b501da675315ba7cfb740e80f?s=60" class="gravatar" alt="Stephen Edgar" /></a>
|
708 |
<a class="web" href="http://profiles.wordpress.org/netweb">Stephen Edgar</a>
|
709 |
</li>
|
710 |
-
<li class="wp-person" id="wp-person-hnla">
|
711 |
-
<a href="http://profiles.wordpress.org/hnla"><img src="http://0.gravatar.com/avatar/3860c955aa3f79f13b92826ae47d07fe?s=60" class="gravatar" alt="Hugo Ashmore" /></a>
|
712 |
-
<a class="web" href="http://profiles.wordpress.org/hnla">Hugo</a>
|
713 |
-
</li>
|
714 |
</ul>
|
715 |
|
716 |
-
<h4 class="wp-people-group"><?php printf(
|
717 |
<p class="wp-credits-list">
|
718 |
-
<a href="https://profiles.wordpress.org/
|
719 |
-
<a href="https://profiles.wordpress.org/
|
|
|
|
|
|
|
|
|
720 |
<a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
|
721 |
-
<a href="https://profiles.wordpress.org/
|
722 |
-
<a href="https://profiles.wordpress.org/
|
723 |
-
<a href="https://profiles.wordpress.org/colabsadmin/">colabsadmin</a>,
|
724 |
-
<a href="https://profiles.wordpress.org/colorful-tones/">Damon Cook (colorful tones)</a>,
|
725 |
<a href="https://profiles.wordpress.org/danbp/">danbp</a>,
|
726 |
<a href="https://profiles.wordpress.org/dcavins/">David Cavins (dcavins)</a>,
|
727 |
-
<a href="https://profiles.wordpress.org/
|
728 |
-
<a href="https://profiles.wordpress.org/
|
729 |
-
<a href="https://profiles.wordpress.org/
|
|
|
730 |
<a href="https://profiles.wordpress.org/hnla/">Hugo (hnla)</a>,
|
731 |
-
<a href="https://profiles.wordpress.org/
|
732 |
-
<a href="https://profiles.wordpress.org/ev3rywh3re/">Jess Planck (ev3rywh3re)</a>,
|
733 |
<a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
|
734 |
-
<a href="https://profiles.wordpress.org/
|
735 |
<a href="https://profiles.wordpress.org/jreeve/">jreeve</a>,
|
736 |
-
<a href="https://profiles.wordpress.org/lakrisgubben/">lakrisgubben</a>,
|
737 |
<a href="https://profiles.wordpress.org/Offereins">Laurens Offereins (Offereins)</a>
|
738 |
<a href="https://profiles.wordpress.org/lenasterg/">lenasterg</a>,
|
739 |
-
<a href="https://profiles.wordpress.org/nofearinc/">Mario Peshev (nofearinc)</a>,
|
740 |
-
<a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
|
741 |
<a href="https://profiles.wordpress.org/mercime/">mercime</a>,
|
742 |
<a href="https://profiles.wordpress.org/tw2113/">Michael Beckwith (tw2113)</a>,
|
743 |
-
<a href="https://profiles.wordpress.org/
|
|
|
744 |
<a href="https://profiles.wordpress.org/sooskriszta/">OC2PS (sooskriszta)</a>,
|
745 |
<a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
|
746 |
-
<a href="https://profiles.wordpress.org/pro120/">pro120</a>,
|
747 |
-
<a href="https://profiles.wordpress.org/psycleuk/">psycleuk</a>,
|
748 |
<a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
|
749 |
-
<a href="https://profiles.wordpress.org/
|
|
|
750 |
<a href="https://profiles.wordpress.org/SGr33n/">Sergio De Falco (SGr33n)</a>,
|
751 |
-
<a href="https://profiles.wordpress.org/
|
752 |
<a href="https://profiles.wordpress.org/slaFFik/">Slava UA (slaFFik)</a>,
|
753 |
-
<a href="https://profiles.wordpress.org/standardspace/">standardspace</a>,
|
754 |
<a href="https://profiles.wordpress.org/netweb/">Stephen Edgar (netweb)</a>,
|
755 |
-
<a href="https://profiles.wordpress.org/
|
756 |
-
<a href="https://profiles.wordpress.org/
|
757 |
-
<a href="https://profiles.wordpress.org/
|
758 |
-
<a href="https://profiles.wordpress.org/
|
759 |
-
<a href="https://profiles.wordpress.org/
|
760 |
-
<a href="https://profiles.wordpress.org/
|
761 |
-
<a href="https://profiles.wordpress.org/
|
762 |
-
<a href="https://profiles.wordpress.org/
|
763 |
</p>
|
764 |
|
765 |
<h4 class="wp-people-group"><?php _e( 'External Libraries', 'buddypress' ); ?></h4>
|
@@ -773,94 +815,6 @@ class BP_Admin {
|
|
773 |
|
774 |
<?php
|
775 |
}
|
776 |
-
|
777 |
-
/**
|
778 |
-
* Output welcome text and badge for What's New and Credits pages
|
779 |
-
*
|
780 |
-
* @since BuddyPress (2.2.0)
|
781 |
-
*/
|
782 |
-
public static function welcome_text() {
|
783 |
-
|
784 |
-
// Switch welcome text based on whether this is a new installation or not
|
785 |
-
$welcome_text = ( self::is_new_install() )
|
786 |
-
? __( 'Thank you for installing BuddyPress! BuddyPress %s gives you the components you need to turn your WordPress powered site into a thriving membership community.', 'buddypress' )
|
787 |
-
: __( 'BuddyPress %s comes with a bunch of great improvements we think you’re really going to like.', 'buddypress' );
|
788 |
-
|
789 |
-
?>
|
790 |
-
|
791 |
-
<h1><?php printf( esc_html__( 'Welcome to BuddyPress %s', 'buddypress' ), self::display_version() ); ?></h1>
|
792 |
-
<div class="about-text">
|
793 |
-
<?php printf( $welcome_text, self::display_version() ); ?>
|
794 |
-
</div>
|
795 |
-
|
796 |
-
<div class="bp-badge"></div>
|
797 |
-
|
798 |
-
<?php
|
799 |
-
}
|
800 |
-
|
801 |
-
/**
|
802 |
-
* Output tab navigation for `What's New` and `Credits` pages
|
803 |
-
*
|
804 |
-
* @since BuddyPress (2.2.0)
|
805 |
-
* @param string $tab
|
806 |
-
*/
|
807 |
-
public static function tab_navigation( $tab = 'whats_new' ) {
|
808 |
-
?>
|
809 |
-
|
810 |
-
<h2 class="nav-tab-wrapper">
|
811 |
-
<a class="nav-tab <?php if ( 'BP_Admin::about_screen' === $tab ) : ?>nav-tab-active<?php endif; ?>" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-about' ), 'index.php' ) ) ); ?>">
|
812 |
-
<?php esc_html_e( 'What’s New', 'buddypress' ); ?>
|
813 |
-
</a><a class="nav-tab <?php if ( 'BP_Admin::credits_screen' === $tab ) : ?>nav-tab-active<?php endif; ?>" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'index.php' ) ) ); ?>">
|
814 |
-
<?php esc_html_e( 'Credits', 'buddypress' ); ?>
|
815 |
-
</a>
|
816 |
-
</h2>
|
817 |
-
|
818 |
-
<?php
|
819 |
-
}
|
820 |
-
|
821 |
-
/** Helpers ***************************************************************/
|
822 |
-
|
823 |
-
/**
|
824 |
-
* Return true/false based on whether a query argument is set
|
825 |
-
*
|
826 |
-
* @see bp_do_activation_redirect()
|
827 |
-
*
|
828 |
-
* @since BuddyPress (2.2.0)
|
829 |
-
* @return bool
|
830 |
-
*/
|
831 |
-
public static function is_new_install() {
|
832 |
-
return (bool) isset( $_GET['is_new_install'] );
|
833 |
-
}
|
834 |
-
|
835 |
-
/**
|
836 |
-
* Return a user-friendly version-number string, for use in translations
|
837 |
-
*
|
838 |
-
* @since BuddyPress (2.2.0)
|
839 |
-
* @return string
|
840 |
-
*/
|
841 |
-
public static function display_version() {
|
842 |
-
|
843 |
-
// Use static variable to prevent recalculations
|
844 |
-
static $display = '';
|
845 |
-
|
846 |
-
// Only calculate on first run
|
847 |
-
if ( '' === $display ) {
|
848 |
-
|
849 |
-
// Get current version
|
850 |
-
$version = bp_get_version();
|
851 |
-
|
852 |
-
// Check for prerelease hyphen
|
853 |
-
$pre = strpos( $version, '-' );
|
854 |
-
|
855 |
-
// Strip prerelease suffix
|
856 |
-
$display = ( false !== $pre )
|
857 |
-
? substr( $version, 0, $pre )
|
858 |
-
: $version;
|
859 |
-
}
|
860 |
-
|
861 |
-
// Done!
|
862 |
-
return $display;
|
863 |
-
}
|
864 |
}
|
865 |
endif; // class_exists check
|
866 |
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
if ( !class_exists( 'BP_Admin' ) ) :
|
14 |
/**
|
187 |
public function admin_menus() {
|
188 |
|
189 |
// Bail if user cannot moderate
|
190 |
+
if ( ! bp_current_user_can( 'manage_options' ) )
|
191 |
return;
|
|
|
192 |
|
193 |
// About
|
194 |
add_dashboard_page(
|
350 |
// Add the main section
|
351 |
add_settings_section( 'bp_groups', __( 'Groups Settings', 'buddypress' ), 'bp_admin_setting_callback_groups_section', 'buddypress' );
|
352 |
|
353 |
+
if ( empty( $avatar_setting ) )
|
354 |
$avatar_setting = 'bp_groups';
|
|
|
355 |
|
356 |
// Allow subscriptions setting
|
357 |
add_settings_field( 'bp_restrict_group_creation', __( 'Group Creation', 'buddypress' ), 'bp_admin_setting_callback_group_creation', 'buddypress', 'bp_groups' );
|
431 |
public function modify_plugin_action_links( $links, $file ) {
|
432 |
|
433 |
// Return normal links if not BuddyPress
|
434 |
+
if ( plugin_basename( buddypress()->basename ) != $file )
|
435 |
return $links;
|
|
|
436 |
|
437 |
// Add a few links to the existing links array
|
438 |
return array_merge( $links, array(
|
439 |
+
'settings' => '<a href="' . add_query_arg( array( 'page' => 'bp-components' ), bp_get_admin_url( $this->settings_page ) ) . '">' . esc_html__( 'Settings', 'buddypress' ) . '</a>',
|
440 |
+
'about' => '<a href="' . add_query_arg( array( 'page' => 'bp-about' ), bp_get_admin_url( 'index.php' ) ) . '">' . esc_html__( 'About', 'buddypress' ) . '</a>'
|
441 |
) );
|
442 |
}
|
443 |
|
486 |
* @since BuddyPress (1.7.0)
|
487 |
*/
|
488 |
public function about_screen() {
|
489 |
+
global $wp_rewrite;
|
490 |
+
|
491 |
+
$is_new_install = ! empty( $_GET['is_new_install'] );
|
492 |
+
$pretty_permalinks_enabled = ! empty( $wp_rewrite->permalink_structure );
|
493 |
+
list( $display_version ) = explode( '-', bp_get_version() ); ?>
|
494 |
|
495 |
<div class="wrap about-wrap">
|
496 |
+
<h1><?php printf( __( 'Welcome to BuddyPress %s', 'buddypress' ), $display_version ); ?></h1>
|
497 |
+
<div class="about-text">
|
498 |
+
<?php if ( $is_new_install ) : ?>
|
499 |
+
<?php printf( __( 'Thank you for installing BuddyPress! BuddyPress %s is our most streamlined and easy-to-use release to date, and we think you’re going to love it.', 'buddypress' ), $display_version ); ?>
|
500 |
+
<?php else : ?>
|
501 |
+
<?php printf( __( 'Howdy. BuddyPress %s is our most streamlined and easy-to-use release to date, and we think you’re going to love it.', 'buddypress' ), $display_version ); ?>
|
502 |
+
<?php endif; ?>
|
503 |
+
</div>
|
504 |
|
505 |
+
<div class="bp-badge"></div>
|
506 |
|
507 |
+
<h2 class="nav-tab-wrapper">
|
508 |
+
<a class="nav-tab nav-tab-active" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-about' ), 'index.php' ) ) ); ?>">
|
509 |
+
<?php _e( 'What’s New', 'buddypress' ); ?>
|
510 |
+
</a><a class="nav-tab" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'index.php' ) ) ); ?>">
|
511 |
+
<?php _e( 'Credits', 'buddypress' ); ?>
|
512 |
+
</a>
|
513 |
+
</h2>
|
514 |
|
515 |
+
<?php if ( $is_new_install ) : ?>
|
516 |
|
517 |
<div id="welcome-panel" class="welcome-panel">
|
518 |
<div class="welcome-panel-content">
|
521 |
<div class="welcome-panel-column">
|
522 |
<h4><?php _e( 'Configure Buddypress', 'buddypress' ); ?></h4>
|
523 |
<ul>
|
524 |
+
<li><?php printf(
|
525 |
+
'<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Set Up Components', 'buddypress' ) . '</a>', bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), $this->settings_page ) )
|
526 |
); ?></li>
|
527 |
+
<li><?php printf(
|
528 |
+
'<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Assign Components to Pages', 'buddypress' ) . '</a>', bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), $this->settings_page ) )
|
529 |
); ?></li>
|
530 |
<li><?php printf(
|
531 |
+
'<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Customize Settings', 'buddypress' ) . '</a>', bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), $this->settings_page ) )
|
532 |
); ?></li>
|
533 |
</ul>
|
534 |
<a class="button button-primary button-hero" style="margin-bottom:20px;margin-top:0;" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), $this->settings_page ) ) ); ?>"><?php _e( 'Get Started', 'buddypress' ); ?></a>
|
537 |
<h4><?php _e( 'Administration Tools', 'buddypress' ); ?></h4>
|
538 |
<ul>
|
539 |
<?php if ( bp_is_active( 'members' ) ) : ?>
|
540 |
+
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add User Profile Fields', 'buddypress' ) . '</a>', bp_get_admin_url( add_query_arg( array( 'page' => 'bp-profile-setup' ), 'users.php' ) ) ); ?></li>
|
541 |
<?php endif; ?>
|
542 |
+
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Manage User Signups', 'buddypress' ) . '</a>', bp_get_admin_url( add_query_arg( array( 'page' => 'bp-signups' ), 'users.php' ) ) ); ?></li>
|
543 |
<?php if ( bp_is_active( 'activity' ) ) : ?>
|
544 |
+
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Moderate Activity Streams', 'buddypress' ) . '</a>', bp_get_admin_url( add_query_arg( array( 'page' => 'bp-activity' ), 'admin.php' ) ) ); ?></li>
|
545 |
<?php endif; ?>
|
546 |
<?php if ( bp_is_active( 'groups' ) ) : ?>
|
547 |
+
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Manage Groups', 'buddypress' ) . '</a>', bp_get_admin_url( add_query_arg( array( 'page' => 'bp-groups' ), 'admin.php' ) ) ); ?></li>
|
548 |
<?php endif; ?>
|
549 |
+
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Repair Data', 'buddypress' ) . '</a>', bp_get_admin_url( add_query_arg( array( 'page' => 'bp-tools' ), 'tools.php' ) ) ); ?>
|
550 |
</li>
|
551 |
</ul>
|
552 |
</div>
|
553 |
<div class="welcome-panel-column welcome-panel-last">
|
554 |
<h4><?php _e( 'Community and Support', 'buddypress' ); ?></h4>
|
555 |
+
<p class="welcome-icon welcome-learn-more" style="margin-right:10px"><?php _e( 'Looking for help? The <a href="http://codex.buddypress.org/">BuddyPress Codex</a> has you covered.', 'buddypress' ) ?></p>
|
556 |
<p class="welcome-icon welcome-learn-more" style="margin-right:10px"><?php _e( 'Can’t find what you need? Stop by <a href="http://buddypress.org/support/">our support forums</a>, where active BuddyPress users and developers are waiting to share tips and more.', 'buddypress' ) ?></p>
|
557 |
</div>
|
558 |
</div>
|
559 |
</div>
|
560 |
</div>
|
561 |
|
|
|
|
|
562 |
<?php endif; ?>
|
563 |
|
564 |
+
<hr />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
|
566 |
+
<div class="changelog">
|
567 |
+
<h2 class="about-headline-callout"><?php _e( 'Revamped @mentions Interface', 'buddypress' ); ?></h2>
|
568 |
+
<p><?php _e( 'Forget the old days of trying to remember someone’s username when you want to @mention them in a conversation! With BuddyPress 2.1, type a <code>@</code> when leaving a status update or commenting on an activity item or blog post, and the new suggestions panel will open.', 'buddypress' ) ?></p>
|
569 |
+
<p style="text-align: center"><img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/mentions.gif' ); ?>" alt="<?php esc_attr_e( 'Demo of at-mentions feature', 'buddypress' ); ?>" style="margin-bottom: 20px"></p>
|
570 |
+
</div>
|
571 |
|
572 |
<hr />
|
573 |
|
574 |
+
<div class="changelog">
|
575 |
+
<h2 class="about-headline-callout"><?php _e( 'Continuous Improvement', 'buddypress' ); ?></h2>
|
576 |
|
577 |
+
<div class="feature-section col three-col">
|
578 |
+
<div class="col-1">
|
579 |
+
<h4><?php esc_html_e( 'New Profile Field Type: URL', 'buddypress' ); ?></h4>
|
580 |
+
<p><?php esc_html_e( 'Built to hold the address of another website, this new field type automatically creates a link to that site.', 'buddypress' ); ?></p>
|
|
|
581 |
</div>
|
582 |
|
583 |
+
<div class="col-2">
|
584 |
+
<h4><?php esc_html_e( 'Awesome Translations', 'buddypress' ); ?></h4>
|
585 |
+
<p><?php esc_html_e( 'BuddyPress supports high-quality translations that are automatically fetched by WordPress. Many thanks to our translation volunteers for making this possible.', 'buddypress' ); ?></p>
|
|
|
586 |
</div>
|
587 |
|
588 |
+
<div class="col-3 last-feature">
|
589 |
+
<h4><?php esc_html_e( 'Performance Improvements', 'buddypress' ); ?></h4>
|
590 |
+
<p><?php _e( 'Like we do with every release, we’ve made further optimizations to increase BuddyPress’ performance and reduce its query overhead.', 'buddypress' ); ?></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
591 |
</div>
|
592 |
</div>
|
593 |
</div>
|
594 |
|
595 |
<hr />
|
596 |
|
597 |
+
<div class="changelog">
|
598 |
+
<h2 class="about-headline-callout"><?php esc_html_e( 'Enhancements for Plugin & Theme Developers', 'buddypress' ); ?></h2>
|
|
|
599 |
<div class="feature-section col two-col">
|
600 |
+
<div class="col-1">
|
601 |
+
<p><?php _e( 'If you’re a plugin developer, or make custom themes, or want to contribute back to the BuddyPress project, here’s what you should know about this release:', 'buddypress' ); ?></p>
|
602 |
+
<p><?php _e( 'If you’ve used BuddyPress for a very long time, you might remember the <em>BuddyBar</em>; it was our toolbar before WordPress had its own toolbar. We started to deprecate it in BuddyPress 1.6. It is now formally deprecated, which means you should not use it for new sites.', 'buddypress' ); ?></p>
|
603 |
+
<p>
|
604 |
+
<?php printf(
|
605 |
+
__( 'The classic <a href="%s">BP Default theme has moved to Github</a>. We moved it because BuddyPress development is now focused on our <a href="%s">theme compatibility</a> templates, which were introduced in BuddyPress 1.7. Don’t worry, BP-Default is still bundled with BuddyPress releases.', 'buddypress' ),
|
606 |
+
esc_url( 'https://github.com/buddypress/BP-Default' ),
|
607 |
+
esc_url( 'http://codex.buddypress.org/themes/theme-compatibility-1-7/a-quick-look-at-1-7-theme-compatibility/' )
|
608 |
+
); ?>
|
609 |
+
</p>
|
610 |
+
<p>
|
611 |
+
<?php
|
612 |
+
/* translators: don't translate the insides of the <code> block */
|
613 |
+
_e( 'In BuddyPress 2.0, we added a new <code>BP_XProfile_Field_Type</code> API for managing profile field types. In this release, we’ve added a new <code>bp_core_get_suggestions</code> API which powers our new @mentions interface. Both are cool, and are worth checking out.', 'buddypress' );
|
614 |
+
?>
|
615 |
+
</p>
|
616 |
</div>
|
|
|
|
|
|
|
617 |
|
618 |
+
<div class="col-2 last-feature">
|
619 |
+
<p><?php esc_html_e( 'Other interesting changes:', 'buddypress' ); ?>
|
620 |
+
|
621 |
+
<ul>
|
622 |
+
<li>
|
623 |
+
<?php
|
624 |
+
/* translators: don't translate the insides of the <code> block */
|
625 |
+
_e( 'In <code>BP_Group_Extension</code>, the <code>visibility</code> and <code>enable_nav_item</code> properties have been phased out in favor of new <code>access</code> and <code>show_tab</code> parameters.', 'buddypress' );
|
626 |
+
?>
|
627 |
+
</li>
|
628 |
+
<li>
|
629 |
+
<?php
|
630 |
+
/* translators: don't translate the insides of the <code> block */
|
631 |
+
_e( 'A new <code>group_activity</code> sort order has been added for Groups queries, to let you query for recently active members.', 'buddypress' );
|
632 |
+
?>
|
633 |
+
</li>
|
634 |
+
<li>
|
635 |
+
<?php
|
636 |
+
/* translators: don't translate the insides of the <code> block */
|
637 |
+
_e( 'Extra CSS classes have been added to Profile Field visibility field elements, allowing greater CSS customization.', 'buddypress' );
|
638 |
+
?>
|
639 |
+
</li>
|
640 |
+
<li>
|
641 |
+
<?php
|
642 |
+
/* translators: don't translate the insides of the <code> block */
|
643 |
+
_e( 'A <code>no_access_url</code> parameter has been added to <code>bp_core_new_subnav_item()</code>. This allows you to set the URL that users are redirected to when they do not have permission to access a sub-navigation item.', 'buddypress' );
|
644 |
+
?>
|
645 |
+
</li>
|
646 |
+
<li>
|
647 |
+
<?php
|
648 |
+
/* translators: don't translate the insides of the <code> block */
|
649 |
+
_e( 'When making searches with <code>BP_User_Query</code>, a new <code>search_wildcard</code> parameter gives you finer control over how the search SQL is constructed.', 'buddypress' );
|
650 |
+
?>
|
651 |
+
</li>
|
652 |
+
|
653 |
+
|
654 |
+
<li><?php printf( __( '<a href="%s">…and lots more!</a>', 'buddypress' ), 'https://codex.buddypress.org/releases/version-2-1' ); ?></li>
|
655 |
+
</ul>
|
656 |
</div>
|
657 |
</div>
|
658 |
</div>
|
|
|
659 |
<?php
|
660 |
}
|
661 |
|
668 |
* @since BuddyPress (1.7.0)
|
669 |
*/
|
670 |
public function credits_screen() {
|
671 |
+
|
672 |
+
$is_new_install = ! empty( $_GET['is_new_install'] );
|
673 |
+
|
674 |
+
list( $display_version ) = explode( '-', bp_get_version() ); ?>
|
675 |
|
676 |
<div class="wrap about-wrap">
|
677 |
+
<h1><?php printf( __( 'Welcome to BuddyPress %s', 'buddypress' ), $display_version ); ?></h1>
|
678 |
+
<div class="about-text">
|
679 |
+
<?php if ( $is_new_install ) : ?>
|
680 |
+
<?php printf( __( 'Thank you for installing BuddyPress! BuddyPress %s is our most streamlined and easy-to-use release to date, and we think you’re going to love it.', 'buddypress' ), $display_version ); ?>
|
681 |
+
<?php else : ?>
|
682 |
+
<?php printf( __( 'Howdy. BuddyPress %s is our most streamlined and easy-to-use release to date, and we think you’re going to love it.', 'buddypress' ), $display_version ); ?>
|
683 |
+
<?php endif; ?>
|
684 |
+
</div>
|
685 |
|
686 |
+
<div class="bp-badge"></div>
|
687 |
|
688 |
+
<h2 class="nav-tab-wrapper">
|
689 |
+
<a class="nav-tab" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-about' ), 'index.php' ) ) ); ?>">
|
690 |
+
<?php _e( 'What’s New', 'buddypress' ); ?>
|
691 |
+
</a><a class="nav-tab nav-tab-active" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'index.php' ) ) ); ?>">
|
692 |
+
<?php _e( 'Credits', 'buddypress' ); ?>
|
693 |
+
</a>
|
694 |
+
</h2>
|
695 |
|
696 |
+
<p class="about-description"><?php _e( 'BuddyPress is created by a worldwide network of friendly folks.', 'buddypress' ); ?></p>
|
697 |
|
698 |
<h4 class="wp-people-group"><?php _e( 'Project Leaders', 'buddypress' ); ?></h4>
|
699 |
<ul class="wp-people-group " id="wp-people-group-project-leaders">
|
731 |
<a class="web" href="http://profiles.wordpress.org/mercime">Mercime</a>
|
732 |
<span class="title"><?php _e( 'Navigator', 'buddypress' ); ?></span>
|
733 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
</ul>
|
735 |
|
736 |
<h4 class="wp-people-group"><?php _e( 'Recent Rockstars', 'buddypress' ); ?></h4>
|
737 |
<ul class="wp-people-group " id="wp-people-group-rockstars">
|
738 |
+
<li class="wp-person" id="wp-person-dcavins">
|
739 |
+
<a href="http://profiles.wordpress.org/dcavins"><img src="http://0.gravatar.com/avatar/a5fa7e83d59cb45ebb616235a176595a?s=60" class="gravatar" alt="David Cavins" /></a>
|
740 |
+
<a class="web" href="http://profiles.wordpress.org/dcavins">David Cavins</a>
|
741 |
+
</li>
|
742 |
<li class="wp-person" id="wp-person-henry-wright">
|
743 |
<a href="http://profiles.wordpress.org/henry.wright"><img src="http://0.gravatar.com/avatar/0da2f1a9340d6af196b870f6c107a248?s=60" class="gravatar" alt="Henry Wright" /></a>
|
744 |
<a class="web" href="http://profiles.wordpress.org/henry.wright">Henry Wright</a>
|
755 |
<a href="http://profiles.wordpress.org/netweb"><img src="http://0.gravatar.com/avatar/97e1620b501da675315ba7cfb740e80f?s=60" class="gravatar" alt="Stephen Edgar" /></a>
|
756 |
<a class="web" href="http://profiles.wordpress.org/netweb">Stephen Edgar</a>
|
757 |
</li>
|
|
|
|
|
|
|
|
|
758 |
</ul>
|
759 |
|
760 |
+
<h4 class="wp-people-group"><?php printf( __( 'Contributors to BuddyPress %s', 'buddypress' ), $display_version ); ?></h4>
|
761 |
<p class="wp-credits-list">
|
762 |
+
<a href="https://profiles.wordpress.org/adamt19/">adamt19</a>,
|
763 |
+
<a href="https://profiles.wordpress.org/Viper007Bond/">Alex Mills (Viper007Bond)</a>,
|
764 |
+
<a href="https://profiles.wordpress.org/allendav/">allendav</a>,
|
765 |
+
<a href="https://profiles.wordpress.org/alternatekev/">alternatekev</a>,
|
766 |
+
<a href="https://profiles.wordpress.org/automattic/">Automattic</a>,
|
767 |
+
<a href="https://profiles.wordpress.org/beaulebens/">Beau Lebens (beaulebens)</a>,
|
768 |
<a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
|
769 |
+
<a href="https://profiles.wordpress.org/williamsba1/">Brad Williams (williamsba1)</a>,
|
770 |
+
<a href="https://profiles.wordpress.org/sbrajesh/">Brajesh Singh (sbrajesh)</a>,
|
|
|
|
|
771 |
<a href="https://profiles.wordpress.org/danbp/">danbp</a>,
|
772 |
<a href="https://profiles.wordpress.org/dcavins/">David Cavins (dcavins)</a>,
|
773 |
+
<a href="https://profiles.wordpress.org/ebellempire/">Erin B. (ebellempire)</a>,
|
774 |
+
<a href="https://profiles.wordpress.org/esroyo/">esroyo</a>,
|
775 |
+
<a href="https://profiles.wordpress.org/godavid33">godavid33</a>,
|
776 |
+
<a href="http://profiles.wordpress.org/henry.wright">Henry Wright (henry.wright)</a>,
|
777 |
<a href="https://profiles.wordpress.org/hnla/">Hugo (hnla)</a>,
|
778 |
+
<a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
|
|
|
779 |
<a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
|
780 |
+
<a href="https://profiles.wordpress.org/jconti/">Jose Conti (jconti)</a>,
|
781 |
<a href="https://profiles.wordpress.org/jreeve/">jreeve</a>,
|
|
|
782 |
<a href="https://profiles.wordpress.org/Offereins">Laurens Offereins (Offereins)</a>
|
783 |
<a href="https://profiles.wordpress.org/lenasterg/">lenasterg</a>,
|
|
|
|
|
784 |
<a href="https://profiles.wordpress.org/mercime/">mercime</a>,
|
785 |
<a href="https://profiles.wordpress.org/tw2113/">Michael Beckwith (tw2113)</a>,
|
786 |
+
<a href="https://profiles.wordpress.org/milesstewart88/">Miles Stewart (milesstewart88)</a>,
|
787 |
+
<a href="https://profiles.wordpress.org/needle/">needle</a>,
|
788 |
<a href="https://profiles.wordpress.org/sooskriszta/">OC2PS (sooskriszta)</a>,
|
789 |
<a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
|
|
|
|
|
790 |
<a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
|
791 |
+
<a href="https://profiles.wordpress.org/rogercoathup/">Roger Coathup (rogercoathup)</a>,
|
792 |
+
<a href="https://profiles.wordpress.org/pollyplummer/">Sarah Gooding (pollyplummer)</a>,
|
793 |
<a href="https://profiles.wordpress.org/SGr33n/">Sergio De Falco (SGr33n)</a>,
|
794 |
+
<a href="https://profiles.wordpress.org/shanebp/">shanebp</a>,
|
795 |
<a href="https://profiles.wordpress.org/slaFFik/">Slava UA (slaFFik)</a>,
|
|
|
796 |
<a href="https://profiles.wordpress.org/netweb/">Stephen Edgar (netweb)</a>,
|
797 |
+
<a href="https://profiles.wordpress.org/karmatosed/">Tammie (karmatosed)</a>,
|
798 |
+
<a href="https://profiles.wordpress.org/tomdxw/">tomdxw</a>,
|
799 |
+
<a href="https://profiles.wordpress.org/treyhunner/">treyhunner</a>,
|
800 |
+
<a href="https://profiles.wordpress.org/ubernaut/">ubernaut</a>,
|
801 |
+
<a href="https://profiles.wordpress.org/wbajzek/">wbajzek</a>,
|
802 |
+
<a href="https://profiles.wordpress.org/WCUADD/">WCUADD</a>,
|
803 |
+
<a href="https://profiles.wordpress.org/wpdennis/">wpdennis</a>,
|
804 |
+
<a href="https://profiles.wordpress.org/wolfhoundjesse/">wolfhoundjesse</a>.
|
805 |
</p>
|
806 |
|
807 |
<h4 class="wp-people-group"><?php _e( 'External Libraries', 'buddypress' ); ?></h4>
|
815 |
|
816 |
<?php
|
817 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
818 |
}
|
819 |
endif; // class_exists check
|
820 |
|
bp-core/bp-core-adminbar.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
-
defined( 'ABSPATH' )
|
14 |
|
15 |
/**
|
16 |
* Add the secondary BuddyPress area to the my-account menu.
|
@@ -96,7 +96,7 @@ function bp_core_load_admin_bar() {
|
|
96 |
add_action( 'init', 'bp_core_load_admin_bar', 9 );
|
97 |
|
98 |
/**
|
99 |
-
* Handle the
|
100 |
*
|
101 |
* This function exists mostly for backwards compatibility reasons, so anyone
|
102 |
* previously unhooking this function can continue to do so. It's hooked to
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
14 |
|
15 |
/**
|
16 |
* Add the secondary BuddyPress area to the my-account menu.
|
96 |
add_action( 'init', 'bp_core_load_admin_bar', 9 );
|
97 |
|
98 |
/**
|
99 |
+
* Handle the enqueuing of toolbar CSS.
|
100 |
*
|
101 |
* This function exists mostly for backwards compatibility reasons, so anyone
|
102 |
* previously unhooking this function can continue to do so. It's hooked to
|
bp-core/bp-core-avatars.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
*/
|
6 |
|
7 |
// Exit if accessed directly
|
8 |
-
defined( 'ABSPATH' )
|
9 |
|
10 |
/***
|
11 |
* Set up the constants we need for avatar support.
|
@@ -174,202 +174,184 @@ add_action( 'bp_setup_globals', 'bp_core_set_avatar_globals' );
|
|
174 |
* @return string Formatted HTML <img> element, or raw avatar URL based on $html arg.
|
175 |
*/
|
176 |
function bp_core_fetch_avatar( $args = '' ) {
|
177 |
-
$bp = buddypress();
|
178 |
|
179 |
// If avatars are disabled for the root site, obey that request and bail
|
180 |
-
if ( !
|
181 |
return;
|
182 |
-
}
|
183 |
|
184 |
global $current_blog;
|
185 |
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
$params = wp_parse_args( $args, array(
|
188 |
'item_id' => false,
|
189 |
-
'object' =>
|
190 |
-
'type' =>
|
191 |
-
'avatar_dir' => false,
|
192 |
-
'width' => false,
|
193 |
-
'height' => false,
|
194 |
-
'class' =>
|
195 |
-
'css_id' => false,
|
196 |
-
'alt' => '',
|
197 |
-
'email' => false,
|
198 |
-
'no_grav' => false,
|
199 |
-
'html' => true,
|
200 |
-
'title' => ''
|
201 |
) );
|
|
|
202 |
|
203 |
/** Set item_id ***********************************************************/
|
204 |
|
205 |
-
if ( empty( $
|
206 |
|
207 |
-
switch ( $
|
208 |
|
209 |
case 'blog' :
|
210 |
-
$
|
211 |
break;
|
212 |
|
213 |
case 'group' :
|
214 |
if ( bp_is_active( 'groups' ) ) {
|
215 |
-
$
|
216 |
} else {
|
217 |
-
$
|
218 |
}
|
219 |
|
220 |
break;
|
221 |
|
222 |
case 'user' :
|
223 |
default :
|
224 |
-
$
|
225 |
break;
|
226 |
}
|
227 |
|
228 |
-
$
|
229 |
|
230 |
-
if ( empty( $
|
231 |
return false;
|
232 |
}
|
233 |
}
|
234 |
|
|
|
|
|
235 |
/** Set avatar_dir ********************************************************/
|
236 |
|
237 |
-
if ( empty( $
|
238 |
|
239 |
-
switch ( $
|
240 |
|
241 |
case 'blog' :
|
242 |
-
$
|
243 |
break;
|
244 |
|
245 |
case 'group' :
|
246 |
if ( bp_is_active( 'groups' ) ) {
|
247 |
-
$
|
248 |
} else {
|
249 |
-
$
|
250 |
}
|
251 |
|
252 |
break;
|
253 |
|
254 |
case 'user' :
|
255 |
default :
|
256 |
-
$
|
257 |
break;
|
258 |
}
|
259 |
|
260 |
-
$
|
261 |
|
262 |
-
if ( empty( $
|
263 |
return false;
|
264 |
}
|
265 |
}
|
266 |
|
267 |
/** <img> alt *************************************************************/
|
268 |
|
269 |
-
if ( false !== strpos( $
|
270 |
|
271 |
-
switch ( $
|
272 |
|
273 |
case 'blog' :
|
274 |
-
$item_name = get_blog_option( $
|
275 |
break;
|
276 |
|
277 |
case 'group' :
|
278 |
-
$item_name = bp_get_group_name( groups_get_group( array( 'group_id' => $
|
279 |
break;
|
280 |
|
281 |
case 'user' :
|
282 |
default :
|
283 |
-
$item_name = bp_core_get_user_displayname( $
|
284 |
break;
|
285 |
}
|
286 |
|
287 |
-
$item_name = apply_filters( 'bp_core_avatar_alt', $item_name, $
|
288 |
-
$
|
289 |
}
|
290 |
|
291 |
/** Sanity Checks *********************************************************/
|
292 |
|
293 |
-
// Get a fallback for the 'alt' parameter
|
294 |
-
if ( empty( $
|
295 |
-
$
|
296 |
-
}
|
297 |
-
$html_alt = ' alt="' . esc_attr( $params['alt'] ) . '"';
|
298 |
|
299 |
-
|
300 |
-
$html_title = '';
|
301 |
-
$params['title'] = apply_filters( 'bp_core_avatar_title', $params['title'], $params['item_id'], $params['object'], $params );
|
302 |
|
303 |
-
|
304 |
-
|
|
|
305 |
}
|
306 |
|
307 |
-
// Set CSS ID
|
308 |
-
$
|
309 |
-
|
310 |
-
|
311 |
-
if ( ! empty( $params['css_id'] ) ) {
|
312 |
-
$html_css_id = ' id="' . esc_attr( $params['css_id'] ) . '"';
|
313 |
}
|
314 |
|
315 |
// Set image width
|
316 |
-
if ( false !== $
|
317 |
-
|
318 |
-
} elseif ( 'thumb' == $
|
319 |
-
$
|
320 |
} else {
|
321 |
-
$
|
322 |
}
|
323 |
-
$html_width = ' width="' . $params['width'] . '"';
|
324 |
|
325 |
// Set image height
|
326 |
-
if ( false !== $
|
327 |
-
|
328 |
-
} elseif ( 'thumb' == $
|
329 |
-
$
|
330 |
} else {
|
331 |
-
$
|
332 |
-
}
|
333 |
-
$html_height = ' height="' . $params['height'] . '"';
|
334 |
-
|
335 |
-
// Create CSS class html string
|
336 |
-
$params['class'] = apply_filters( 'bp_core_avatar_class', $params['class'], $params['item_id'], $params['object'], $params );
|
337 |
-
|
338 |
-
// Use an alias to leave the param unchanged
|
339 |
-
$avatar_classes = $params['class'];
|
340 |
-
if ( ! is_array( $avatar_classes ) ) {
|
341 |
-
$avatar_classes = explode( ' ', $avatar_classes );
|
342 |
}
|
343 |
|
344 |
-
// merge classes
|
345 |
-
$avatar_classes = array_merge( $avatar_classes, array(
|
346 |
-
$params['object'] . '-' . $params['item_id'] . '-avatar',
|
347 |
-
'avatar-' . $params['width'],
|
348 |
-
) );
|
349 |
-
|
350 |
-
// Sanitize each class
|
351 |
-
$avatar_classes = array_map( 'sanitize_html_class', $avatar_classes );
|
352 |
-
|
353 |
-
// populate the class attribute
|
354 |
-
$html_class = ' class="' . join( ' ', $avatar_classes ) . ' photo"';
|
355 |
-
|
356 |
// Set img URL and DIR based on prepopulated constants
|
357 |
$avatar_loc = new stdClass();
|
358 |
$avatar_loc->path = trailingslashit( bp_core_avatar_upload_path() );
|
359 |
$avatar_loc->url = trailingslashit( bp_core_avatar_url() );
|
360 |
|
361 |
-
$avatar_loc->dir = trailingslashit( $
|
362 |
-
$avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url', ( $avatar_loc->url . $avatar_loc->dir . $
|
363 |
-
$avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', ( $avatar_loc->path . $avatar_loc->dir . $
|
|
|
|
|
|
|
364 |
|
365 |
/**
|
366 |
* Look for uploaded avatar first. Use it if it exists.
|
367 |
* Set the file names to search for, to select the full size
|
368 |
* or thumbnail image.
|
369 |
*/
|
370 |
-
$avatar_size = ( 'full' == $
|
371 |
-
$legacy_user_avatar_name = ( 'full' == $
|
372 |
-
$legacy_group_avatar_name = ( 'full' == $
|
373 |
|
374 |
// Check for directory
|
375 |
if ( file_exists( $avatar_folder_dir ) ) {
|
@@ -423,8 +405,8 @@ function bp_core_fetch_avatar( $args = '' ) {
|
|
423 |
if ( isset( $avatar_url ) ) {
|
424 |
|
425 |
// Return it wrapped in an <img> element
|
426 |
-
if ( true === $
|
427 |
-
return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $avatar_url . '"' . $
|
428 |
|
429 |
// ...or only the URL
|
430 |
} else {
|
@@ -435,24 +417,33 @@ function bp_core_fetch_avatar( $args = '' ) {
|
|
435 |
|
436 |
// If no avatars could be found, try to display a gravatar
|
437 |
|
438 |
-
// Skips gravatar check if $
|
439 |
-
if ( ! apply_filters( 'bp_core_fetch_avatar_no_grav', $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
|
441 |
// Set gravatar type
|
442 |
-
if ( empty( $bp->grav_default->{$
|
443 |
$default_grav = 'wavatar';
|
444 |
-
}
|
445 |
-
$default_grav = apply_filters( 'bp_core_mysteryman_src', 'mm', $
|
446 |
} else {
|
447 |
-
$default_grav = $bp->grav_default->{$
|
448 |
}
|
449 |
|
450 |
// Set gravatar object
|
451 |
-
if ( empty( $
|
452 |
-
if ( 'user' == $
|
453 |
-
$
|
454 |
-
}
|
455 |
-
$
|
456 |
}
|
457 |
}
|
458 |
|
@@ -463,8 +454,8 @@ function bp_core_fetch_avatar( $args = '' ) {
|
|
463 |
}
|
464 |
|
465 |
// Filter gravatar vars
|
466 |
-
$
|
467 |
-
$gravatar = apply_filters( 'bp_gravatar_url', $host ) . md5( strtolower( $
|
468 |
|
469 |
// Gravatar rating; http://bit.ly/89QxZA
|
470 |
$rating = get_option( 'avatar_rating' );
|
@@ -474,11 +465,11 @@ function bp_core_fetch_avatar( $args = '' ) {
|
|
474 |
|
475 |
// No avatar was found, and we've been told not to use a gravatar.
|
476 |
} else {
|
477 |
-
$gravatar = apply_filters(
|
478 |
}
|
479 |
|
480 |
-
if ( true === $
|
481 |
-
return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $gravatar . '"' . $
|
482 |
} else {
|
483 |
return apply_filters( 'bp_core_fetch_avatar_url', $gravatar, $params );
|
484 |
}
|
@@ -513,9 +504,9 @@ function bp_core_delete_existing_avatar( $args = '' ) {
|
|
513 |
if ( empty( $item_id ) ) {
|
514 |
if ( 'user' == $object )
|
515 |
$item_id = bp_displayed_user_id();
|
516 |
-
|
517 |
$item_id = buddypress()->groups->current_group->id;
|
518 |
-
|
519 |
$item_id = $current_blog->id;
|
520 |
|
521 |
$item_id = apply_filters( 'bp_core_avatar_item_id', $item_id, $object );
|
@@ -526,9 +517,9 @@ function bp_core_delete_existing_avatar( $args = '' ) {
|
|
526 |
if ( empty( $avatar_dir ) ) {
|
527 |
if ( 'user' == $object )
|
528 |
$avatar_dir = 'avatars';
|
529 |
-
|
530 |
$avatar_dir = 'group-avatars';
|
531 |
-
|
532 |
$avatar_dir = 'blog-avatars';
|
533 |
|
534 |
$avatar_dir = apply_filters( 'bp_core_avatar_dir', $avatar_dir, $object );
|
@@ -593,7 +584,7 @@ function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) {
|
|
593 |
);
|
594 |
|
595 |
if ( ! bp_core_check_avatar_upload( $file ) ) {
|
596 |
-
bp_core_add_message( sprintf( __( 'Your upload failed
|
597 |
return false;
|
598 |
}
|
599 |
|
@@ -714,7 +705,7 @@ function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) {
|
|
714 |
* @type string $avatar_dir Subdirectory where avatar should be stored.
|
715 |
* Default: 'avatars'.
|
716 |
* @type bool|int $item_id ID of the item that the avatar belongs to.
|
717 |
-
* @type bool|string $original_file Absolute
|
718 |
* file.
|
719 |
* @type int $crop_w Crop width. Default: the global 'full' avatar width,
|
720 |
* as retrieved by bp_core_avatar_full_width().
|
@@ -871,7 +862,7 @@ function bp_core_fetch_avatar_filter( $avatar, $user, $size, $default, $alt = ''
|
|
871 |
}
|
872 |
|
873 |
// If passed a number, assume it was a $user_id
|
874 |
-
}
|
875 |
$id = $user;
|
876 |
|
877 |
// If passed a string and that string returns a user, get the $id
|
@@ -1185,7 +1176,7 @@ function bp_core_avatar_default( $type = 'gravatar' ) {
|
|
1185 |
$avatar = BP_AVATAR_DEFAULT;
|
1186 |
|
1187 |
// Use the local default image
|
1188 |
-
}
|
1189 |
$avatar = buddypress()->plugin_url . 'bp-core/images/mystery-man.jpg';
|
1190 |
|
1191 |
// Use Gravatar's mystery man as fallback
|
@@ -1221,7 +1212,7 @@ function bp_core_avatar_default_thumb( $type = 'gravatar' ) {
|
|
1221 |
$avatar = BP_AVATAR_DEFAULT_THUMB;
|
1222 |
|
1223 |
// Use the local default image
|
1224 |
-
}
|
1225 |
$avatar = buddypress()->plugin_url . 'bp-core/images/mystery-man-50.jpg';
|
1226 |
|
1227 |
// Use Gravatar's mystery man as fallback
|
@@ -1237,46 +1228,3 @@ function bp_core_avatar_default_thumb( $type = 'gravatar' ) {
|
|
1237 |
|
1238 |
return apply_filters( 'bp_core_avatar_thumb', $avatar );
|
1239 |
}
|
1240 |
-
|
1241 |
-
/**
|
1242 |
-
* Reset the week parameter of the WordPress main query if needed
|
1243 |
-
*
|
1244 |
-
* When cropping an avatar, a $_POST['w'] var is sent, setting the 'week'
|
1245 |
-
* parameter of the WordPress main query to this posted var. To avoid
|
1246 |
-
* notices, we need to make sure this 'week' query var is reset to 0
|
1247 |
-
*
|
1248 |
-
* @since BuddyPress (2.2.0)
|
1249 |
-
*
|
1250 |
-
* @param WP_Query $posts_query the main query object
|
1251 |
-
* @uses bp_is_group_create()
|
1252 |
-
* @uses bp_is_group_admin_page()
|
1253 |
-
* @uses bp_is_group_admin_screen() to check for a group admin screen
|
1254 |
-
* @uses bp_action_variable() to check for the group's avatar creation step
|
1255 |
-
* @uses bp_is_user_change_avatar() to check for the user's change profile screen
|
1256 |
-
*/
|
1257 |
-
function bp_core_avatar_reset_query( $posts_query = null ) {
|
1258 |
-
$reset_w = false;
|
1259 |
-
|
1260 |
-
// Group's avatar edit screen
|
1261 |
-
if ( bp_is_group_admin_page() ) {
|
1262 |
-
$reset_w = bp_is_group_admin_screen( 'group-avatar' );
|
1263 |
-
|
1264 |
-
// Group's avatar create screen
|
1265 |
-
} elseif ( bp_is_group_create() ) {
|
1266 |
-
/**
|
1267 |
-
* we can't use bp_get_groups_current_create_step()
|
1268 |
-
* as it's not set yet
|
1269 |
-
*/
|
1270 |
-
$reset_w = 'group-avatar' === bp_action_variable( 1 );
|
1271 |
-
|
1272 |
-
// User's change avatar screen
|
1273 |
-
} else {
|
1274 |
-
$reset_w = bp_is_user_change_avatar();
|
1275 |
-
}
|
1276 |
-
|
1277 |
-
// A user or a group is cropping an avatar
|
1278 |
-
if ( true === $reset_w && isset( $_POST['avatar-crop-submit'] ) ) {
|
1279 |
-
$posts_query->set( 'w', 0 );
|
1280 |
-
}
|
1281 |
-
}
|
1282 |
-
add_action( 'bp_parse_query', 'bp_core_avatar_reset_query', 10, 1 );
|
5 |
*/
|
6 |
|
7 |
// Exit if accessed directly
|
8 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
|
10 |
/***
|
11 |
* Set up the constants we need for avatar support.
|
174 |
* @return string Formatted HTML <img> element, or raw avatar URL based on $html arg.
|
175 |
*/
|
176 |
function bp_core_fetch_avatar( $args = '' ) {
|
|
|
177 |
|
178 |
// If avatars are disabled for the root site, obey that request and bail
|
179 |
+
if ( ! buddypress()->avatar->show_avatars )
|
180 |
return;
|
|
|
181 |
|
182 |
global $current_blog;
|
183 |
|
184 |
+
$bp = buddypress();
|
185 |
+
|
186 |
+
// Set a few default variables
|
187 |
+
$def_object = 'user';
|
188 |
+
$def_type = 'thumb';
|
189 |
+
$def_class = 'avatar';
|
190 |
+
|
191 |
+
// Set the default variables array
|
192 |
$params = wp_parse_args( $args, array(
|
193 |
'item_id' => false,
|
194 |
+
'object' => $def_object, // user/group/blog/custom type (if you use filters)
|
195 |
+
'type' => $def_type, // thumb or full
|
196 |
+
'avatar_dir' => false, // Specify a custom avatar directory for your object
|
197 |
+
'width' => false, // Custom width (int)
|
198 |
+
'height' => false, // Custom height (int)
|
199 |
+
'class' => $def_class, // Custom <img> class (string)
|
200 |
+
'css_id' => false, // Custom <img> ID (string)
|
201 |
+
'alt' => '', // Custom <img> alt (string)
|
202 |
+
'email' => false, // Pass the user email (for gravatar) to prevent querying the DB for it
|
203 |
+
'no_grav' => false, // If there is no avatar found, return false instead of a grav?
|
204 |
+
'html' => true, // Wrap the return img URL in <img />
|
205 |
+
'title' => '' // Custom <img> title (string)
|
206 |
) );
|
207 |
+
extract( $params, EXTR_SKIP );
|
208 |
|
209 |
/** Set item_id ***********************************************************/
|
210 |
|
211 |
+
if ( empty( $item_id ) ) {
|
212 |
|
213 |
+
switch ( $object ) {
|
214 |
|
215 |
case 'blog' :
|
216 |
+
$item_id = $current_blog->id;
|
217 |
break;
|
218 |
|
219 |
case 'group' :
|
220 |
if ( bp_is_active( 'groups' ) ) {
|
221 |
+
$item_id = $bp->groups->current_group->id;
|
222 |
} else {
|
223 |
+
$item_id = false;
|
224 |
}
|
225 |
|
226 |
break;
|
227 |
|
228 |
case 'user' :
|
229 |
default :
|
230 |
+
$item_id = bp_displayed_user_id();
|
231 |
break;
|
232 |
}
|
233 |
|
234 |
+
$item_id = apply_filters( 'bp_core_avatar_item_id', $item_id, $object, $params );
|
235 |
|
236 |
+
if ( empty( $item_id ) ) {
|
237 |
return false;
|
238 |
}
|
239 |
}
|
240 |
|
241 |
+
$class = apply_filters( 'bp_core_avatar_class', $class, $item_id, $object, $params );
|
242 |
+
|
243 |
/** Set avatar_dir ********************************************************/
|
244 |
|
245 |
+
if ( empty( $avatar_dir ) ) {
|
246 |
|
247 |
+
switch ( $object ) {
|
248 |
|
249 |
case 'blog' :
|
250 |
+
$avatar_dir = 'blog-avatars';
|
251 |
break;
|
252 |
|
253 |
case 'group' :
|
254 |
if ( bp_is_active( 'groups' ) ) {
|
255 |
+
$avatar_dir = 'group-avatars';
|
256 |
} else {
|
257 |
+
$avatar_dir = false;
|
258 |
}
|
259 |
|
260 |
break;
|
261 |
|
262 |
case 'user' :
|
263 |
default :
|
264 |
+
$avatar_dir = 'avatars';
|
265 |
break;
|
266 |
}
|
267 |
|
268 |
+
$avatar_dir = apply_filters( 'bp_core_avatar_dir', $avatar_dir, $object, $params );
|
269 |
|
270 |
+
if ( empty( $avatar_dir ) ) {
|
271 |
return false;
|
272 |
}
|
273 |
}
|
274 |
|
275 |
/** <img> alt *************************************************************/
|
276 |
|
277 |
+
if ( false !== strpos( $alt, '%s' ) || false !== strpos( $alt, '%1$s' ) ) {
|
278 |
|
279 |
+
switch ( $object ) {
|
280 |
|
281 |
case 'blog' :
|
282 |
+
$item_name = get_blog_option( $item_id, 'blogname' );
|
283 |
break;
|
284 |
|
285 |
case 'group' :
|
286 |
+
$item_name = bp_get_group_name( groups_get_group( array( 'group_id' => $item_id ) ) );
|
287 |
break;
|
288 |
|
289 |
case 'user' :
|
290 |
default :
|
291 |
+
$item_name = bp_core_get_user_displayname( $item_id );
|
292 |
break;
|
293 |
}
|
294 |
|
295 |
+
$item_name = apply_filters( 'bp_core_avatar_alt', $item_name, $item_id, $object, $params );
|
296 |
+
$alt = sprintf( $alt, $item_name );
|
297 |
}
|
298 |
|
299 |
/** Sanity Checks *********************************************************/
|
300 |
|
301 |
+
// Get a fallback for the 'alt' parameter
|
302 |
+
if ( empty( $alt ) )
|
303 |
+
$alt = __( 'Profile Photo', 'buddypress' );
|
|
|
|
|
304 |
|
305 |
+
$html_alt = ' alt="' . esc_attr( $alt ) . '"';
|
|
|
|
|
306 |
|
307 |
+
// Set title tag, if it's been provided
|
308 |
+
if ( !empty( $title ) ) {
|
309 |
+
$title = " title='" . esc_attr( apply_filters( 'bp_core_avatar_title', $title, $item_id, $object, $params ) ) . "'";
|
310 |
}
|
311 |
|
312 |
+
// Set CSS ID if passed
|
313 |
+
if ( !empty( $css_id ) ) {
|
314 |
+
$css_id = ' id="' . esc_attr( $css_id ) . '"';
|
|
|
|
|
|
|
315 |
}
|
316 |
|
317 |
// Set image width
|
318 |
+
if ( false !== $width ) {
|
319 |
+
$html_width = ' width="' . $width . '"';
|
320 |
+
} elseif ( 'thumb' == $type ) {
|
321 |
+
$html_width = ' width="' . bp_core_avatar_thumb_width() . '"';
|
322 |
} else {
|
323 |
+
$html_width = ' width="' . bp_core_avatar_full_width() . '"';
|
324 |
}
|
|
|
325 |
|
326 |
// Set image height
|
327 |
+
if ( false !== $height ) {
|
328 |
+
$html_height = ' height="' . $height . '"';
|
329 |
+
} elseif ( 'thumb' == $type ) {
|
330 |
+
$html_height = ' height="' . bp_core_avatar_thumb_height() . '"';
|
331 |
} else {
|
332 |
+
$html_height = ' height="' . bp_core_avatar_full_height() . '"';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
}
|
334 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
// Set img URL and DIR based on prepopulated constants
|
336 |
$avatar_loc = new stdClass();
|
337 |
$avatar_loc->path = trailingslashit( bp_core_avatar_upload_path() );
|
338 |
$avatar_loc->url = trailingslashit( bp_core_avatar_url() );
|
339 |
|
340 |
+
$avatar_loc->dir = trailingslashit( $avatar_dir );
|
341 |
+
$avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url', ( $avatar_loc->url . $avatar_loc->dir . $item_id ), $item_id, $object, $avatar_dir );
|
342 |
+
$avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', ( $avatar_loc->path . $avatar_loc->dir . $item_id ), $item_id, $object, $avatar_dir );
|
343 |
+
|
344 |
+
// Add an identifying class
|
345 |
+
$class .= ' ' . $object . '-' . $item_id . '-avatar ' . sanitize_html_class( "avatar-$width" ) . ' photo';
|
346 |
|
347 |
/**
|
348 |
* Look for uploaded avatar first. Use it if it exists.
|
349 |
* Set the file names to search for, to select the full size
|
350 |
* or thumbnail image.
|
351 |
*/
|
352 |
+
$avatar_size = ( 'full' == $type ) ? '-bpfull' : '-bpthumb';
|
353 |
+
$legacy_user_avatar_name = ( 'full' == $type ) ? '-avatar2' : '-avatar1';
|
354 |
+
$legacy_group_avatar_name = ( 'full' == $type ) ? '-groupavatar-full' : '-groupavatar-thumb';
|
355 |
|
356 |
// Check for directory
|
357 |
if ( file_exists( $avatar_folder_dir ) ) {
|
405 |
if ( isset( $avatar_url ) ) {
|
406 |
|
407 |
// Return it wrapped in an <img> element
|
408 |
+
if ( true === $html ) {
|
409 |
+
return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $avatar_url . '" class="' . esc_attr( $class ) . '"' . $css_id . $html_width . $html_height . $html_alt . $title . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
|
410 |
|
411 |
// ...or only the URL
|
412 |
} else {
|
417 |
|
418 |
// If no avatars could be found, try to display a gravatar
|
419 |
|
420 |
+
// Skips gravatar check if $no_grav is passed
|
421 |
+
if ( ! apply_filters( 'bp_core_fetch_avatar_no_grav', $no_grav ) ) {
|
422 |
+
|
423 |
+
// Set gravatar size
|
424 |
+
if ( false !== $width ) {
|
425 |
+
$grav_size = $width;
|
426 |
+
} else if ( 'full' == $type ) {
|
427 |
+
$grav_size = bp_core_avatar_full_width();
|
428 |
+
} else if ( 'thumb' == $type ) {
|
429 |
+
$grav_size = bp_core_avatar_thumb_width();
|
430 |
+
}
|
431 |
|
432 |
// Set gravatar type
|
433 |
+
if ( empty( $bp->grav_default->{$object} ) ) {
|
434 |
$default_grav = 'wavatar';
|
435 |
+
} else if ( 'mystery' == $bp->grav_default->{$object} ) {
|
436 |
+
$default_grav = apply_filters( 'bp_core_mysteryman_src', 'mm', $grav_size );
|
437 |
} else {
|
438 |
+
$default_grav = $bp->grav_default->{$object};
|
439 |
}
|
440 |
|
441 |
// Set gravatar object
|
442 |
+
if ( empty( $email ) ) {
|
443 |
+
if ( 'user' == $object ) {
|
444 |
+
$email = bp_core_get_user_email( $item_id );
|
445 |
+
} else if ( 'group' == $object || 'blog' == $object ) {
|
446 |
+
$email = "{$item_id}-{$object}@{bp_get_root_domain()}";
|
447 |
}
|
448 |
}
|
449 |
|
454 |
}
|
455 |
|
456 |
// Filter gravatar vars
|
457 |
+
$email = apply_filters( 'bp_core_gravatar_email', $email, $item_id, $object );
|
458 |
+
$gravatar = apply_filters( 'bp_gravatar_url', $host ) . md5( strtolower( $email ) ) . '?d=' . $default_grav . '&s=' . $grav_size;
|
459 |
|
460 |
// Gravatar rating; http://bit.ly/89QxZA
|
461 |
$rating = get_option( 'avatar_rating' );
|
465 |
|
466 |
// No avatar was found, and we've been told not to use a gravatar.
|
467 |
} else {
|
468 |
+
$gravatar = apply_filters( "bp_core_default_avatar_$object", bp_core_avatar_default( 'local' ), $params );
|
469 |
}
|
470 |
|
471 |
+
if ( true === $html ) {
|
472 |
+
return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $gravatar . '" class="' . esc_attr( $class ) . '"' . $css_id . $html_width . $html_height . $html_alt . $title . ' />', $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );
|
473 |
} else {
|
474 |
return apply_filters( 'bp_core_fetch_avatar_url', $gravatar, $params );
|
475 |
}
|
504 |
if ( empty( $item_id ) ) {
|
505 |
if ( 'user' == $object )
|
506 |
$item_id = bp_displayed_user_id();
|
507 |
+
else if ( 'group' == $object )
|
508 |
$item_id = buddypress()->groups->current_group->id;
|
509 |
+
else if ( 'blog' == $object )
|
510 |
$item_id = $current_blog->id;
|
511 |
|
512 |
$item_id = apply_filters( 'bp_core_avatar_item_id', $item_id, $object );
|
517 |
if ( empty( $avatar_dir ) ) {
|
518 |
if ( 'user' == $object )
|
519 |
$avatar_dir = 'avatars';
|
520 |
+
else if ( 'group' == $object )
|
521 |
$avatar_dir = 'group-avatars';
|
522 |
+
else if ( 'blog' == $object )
|
523 |
$avatar_dir = 'blog-avatars';
|
524 |
|
525 |
$avatar_dir = apply_filters( 'bp_core_avatar_dir', $avatar_dir, $object );
|
584 |
);
|
585 |
|
586 |
if ( ! bp_core_check_avatar_upload( $file ) ) {
|
587 |
+
bp_core_add_message( sprintf( __( 'Your upload failed, please try again. Error was: %s', 'buddypress' ), $uploadErrors[$file['file']['error']] ), 'error' );
|
588 |
return false;
|
589 |
}
|
590 |
|
705 |
* @type string $avatar_dir Subdirectory where avatar should be stored.
|
706 |
* Default: 'avatars'.
|
707 |
* @type bool|int $item_id ID of the item that the avatar belongs to.
|
708 |
+
* @type bool|string $original_file Absolute papth to the original avatar
|
709 |
* file.
|
710 |
* @type int $crop_w Crop width. Default: the global 'full' avatar width,
|
711 |
* as retrieved by bp_core_avatar_full_width().
|
862 |
}
|
863 |
|
864 |
// If passed a number, assume it was a $user_id
|
865 |
+
} else if ( is_numeric( $user ) ) {
|
866 |
$id = $user;
|
867 |
|
868 |
// If passed a string and that string returns a user, get the $id
|
1176 |
$avatar = BP_AVATAR_DEFAULT;
|
1177 |
|
1178 |
// Use the local default image
|
1179 |
+
} else if ( 'local' === $type ) {
|
1180 |
$avatar = buddypress()->plugin_url . 'bp-core/images/mystery-man.jpg';
|
1181 |
|
1182 |
// Use Gravatar's mystery man as fallback
|
1212 |
$avatar = BP_AVATAR_DEFAULT_THUMB;
|
1213 |
|
1214 |
// Use the local default image
|
1215 |
+
} else if ( 'local' === $type ) {
|
1216 |
$avatar = buddypress()->plugin_url . 'bp-core/images/mystery-man-50.jpg';
|
1217 |
|
1218 |
// Use Gravatar's mystery man as fallback
|
1228 |
|
1229 |
return apply_filters( 'bp_core_avatar_thumb', $avatar );
|
1230 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp-core/bp-core-buddybar.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
12 |
-
defined( 'ABSPATH' )
|
13 |
|
14 |
/**
|
15 |
* Add an item to the main BuddyPress navigation array.
|
@@ -253,9 +253,6 @@ add_action( 'admin_head', 'bp_core_sort_nav_items' );
|
|
253 |
* when the nav item is clicked.
|
254 |
* @type string $link Optional. The URL that the subnav item should point
|
255 |
* to. Defaults to a value generated from the $parent_url + $slug.
|
256 |
-
* @type bool $show_in_admin_bar Optional. Whether the nav item should be
|
257 |
-
* added into the group's "Edit" Admin Bar menu for group admins.
|
258 |
-
* Default: false.
|
259 |
* }
|
260 |
* @return bool|null Returns false on failure.
|
261 |
*/
|
@@ -263,18 +260,17 @@ function bp_core_new_subnav_item( $args = '' ) {
|
|
263 |
global $bp;
|
264 |
|
265 |
$r = wp_parse_args( $args, array(
|
266 |
-
'name'
|
267 |
-
'slug'
|
268 |
-
'parent_slug'
|
269 |
-
'parent_url'
|
270 |
-
'item_css_id'
|
271 |
-
'user_has_access'
|
272 |
-
'no_access_url'
|
273 |
-
'site_admin_only'
|
274 |
-
'position'
|
275 |
-
'screen_function'
|
276 |
-
'link'
|
277 |
-
'show_in_admin_bar' => false, // Show the Manage link in the current group's "Edit" Admin Bar menu
|
278 |
) );
|
279 |
|
280 |
extract( $r, EXTR_SKIP );
|
@@ -301,17 +297,15 @@ function bp_core_new_subnav_item( $args = '' ) {
|
|
301 |
$item_css_id = $slug;
|
302 |
|
303 |
$subnav_item = array(
|
304 |
-
'name'
|
305 |
-
'link'
|
306 |
-
'slug'
|
307 |
-
'css_id'
|
308 |
-
'position'
|
309 |
-
'user_has_access'
|
310 |
-
'no_access_url'
|
311 |
-
'screen_function'
|
312 |
-
'show_in_admin_bar' => (bool) $r['show_in_admin_bar'],
|
313 |
);
|
314 |
-
|
315 |
$bp->bp_options_nav[$parent_slug][$slug] = $subnav_item;
|
316 |
|
317 |
/**
|
@@ -391,7 +385,7 @@ function bp_core_maybe_hook_new_subnav_screen_function( $subnav_item ) {
|
|
391 |
|
392 |
// In the case of a user page, we try to assume a
|
393 |
// redirect URL
|
394 |
-
}
|
395 |
|
396 |
// Redirect to the displayed user's default
|
397 |
// component, as long as that component is
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
12 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
13 |
|
14 |
/**
|
15 |
* Add an item to the main BuddyPress navigation array.
|
253 |
* when the nav item is clicked.
|
254 |
* @type string $link Optional. The URL that the subnav item should point
|
255 |
* to. Defaults to a value generated from the $parent_url + $slug.
|
|
|
|
|
|
|
256 |
* }
|
257 |
* @return bool|null Returns false on failure.
|
258 |
*/
|
260 |
global $bp;
|
261 |
|
262 |
$r = wp_parse_args( $args, array(
|
263 |
+
'name' => false, // Display name for the nav item
|
264 |
+
'slug' => false, // URL slug for the nav item
|
265 |
+
'parent_slug' => false, // URL slug of the parent nav item
|
266 |
+
'parent_url' => false, // URL of the parent item
|
267 |
+
'item_css_id' => false, // The CSS ID to apply to the HTML of the nav item
|
268 |
+
'user_has_access' => true, // Can the logged in user see this nav item?
|
269 |
+
'no_access_url' => '',
|
270 |
+
'site_admin_only' => false, // Can only site admins see this nav item?
|
271 |
+
'position' => 90, // Index of where this nav item should be positioned
|
272 |
+
'screen_function' => false, // The name of the function to run when clicked
|
273 |
+
'link' => '' // The link for the subnav item; optional, not usually required.
|
|
|
274 |
) );
|
275 |
|
276 |
extract( $r, EXTR_SKIP );
|
297 |
$item_css_id = $slug;
|
298 |
|
299 |
$subnav_item = array(
|
300 |
+
'name' => $name,
|
301 |
+
'link' => trailingslashit( $link ),
|
302 |
+
'slug' => $slug,
|
303 |
+
'css_id' => $item_css_id,
|
304 |
+
'position' => $position,
|
305 |
+
'user_has_access' => $user_has_access,
|
306 |
+
'no_access_url' => $no_access_url,
|
307 |
+
'screen_function' => &$screen_function
|
|
|
308 |
);
|
|
|
309 |
$bp->bp_options_nav[$parent_slug][$slug] = $subnav_item;
|
310 |
|
311 |
/**
|
385 |
|
386 |
// In the case of a user page, we try to assume a
|
387 |
// redirect URL
|
388 |
+
} else if ( bp_is_user() ) {
|
389 |
|
390 |
// Redirect to the displayed user's default
|
391 |
// component, as long as that component is
|
bp-core/bp-core-cache.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/**
|
13 |
* Prune the WP Super Cache.
|
@@ -26,6 +26,16 @@ function bp_core_clear_cache() {
|
|
26 |
}
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* Clear all cached objects for a user, or those that a user is part of.
|
31 |
*/
|
@@ -63,7 +73,7 @@ function bp_core_clear_directory_pages_cache_page_edit( $post_id ) {
|
|
63 |
return;
|
64 |
}
|
65 |
|
66 |
-
$page_ids = bp_core_get_directory_page_ids(
|
67 |
|
68 |
if ( ! in_array( $post_id, (array) $page_ids ) ) {
|
69 |
return;
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/**
|
13 |
* Prune the WP Super Cache.
|
26 |
}
|
27 |
}
|
28 |
|
29 |
+
/**
|
30 |
+
* Add 'bp' to global group of network wide cachable objects.
|
31 |
+
*/
|
32 |
+
function bp_core_add_global_group() {
|
33 |
+
if ( function_exists( 'wp_cache_add_global_groups' ) ) {
|
34 |
+
wp_cache_add_global_groups( array( 'bp' ) );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
add_action( 'bp_loaded', 'bp_core_add_global_group' );
|
38 |
+
|
39 |
/**
|
40 |
* Clear all cached objects for a user, or those that a user is part of.
|
41 |
*/
|
73 |
return;
|
74 |
}
|
75 |
|
76 |
+
$page_ids = bp_core_get_directory_page_ids();
|
77 |
|
78 |
if ( ! in_array( $post_id, (array) $page_ids ) ) {
|
79 |
return;
|
bp-core/bp-core-caps.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* BuddyPress
|
5 |
*
|
6 |
* @package BuddyPress
|
7 |
* @subpackage Capabilities
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Return an array of roles from the currently loaded blog
|
@@ -16,7 +16,7 @@ defined( 'ABSPATH' ) || exit;
|
|
16 |
* WordPress roles are dynamically flipped when calls to switch_to_blog() and
|
17 |
* restore_current_blog() are made, so we use and trust WordPress core to have
|
18 |
* loaded the correct results for us here. As enhancements are made to
|
19 |
-
*
|
20 |
*
|
21 |
* @since BuddyPress (2.1.0)
|
22 |
*
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* BuddyPress Capabilites.
|
5 |
*
|
6 |
* @package BuddyPress
|
7 |
* @subpackage Capabilities
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Return an array of roles from the currently loaded blog
|
16 |
* WordPress roles are dynamically flipped when calls to switch_to_blog() and
|
17 |
* restore_current_blog() are made, so we use and trust WordPress core to have
|
18 |
* loaded the correct results for us here. As enhancements are made to
|
19 |
+
* WordPresss's RBAC, so should our capability functions here.
|
20 |
*
|
21 |
* @since BuddyPress (2.1.0)
|
22 |
*
|
bp-core/bp-core-catchuri.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
-
defined( 'ABSPATH' )
|
15 |
|
16 |
/**
|
17 |
* Analyze the URI and break it down into BuddyPress-usable chunks.
|
@@ -21,11 +21,11 @@ defined( 'ABSPATH' ) || exit;
|
|
21 |
* URI structures with very little work.
|
22 |
*
|
23 |
* The URIs are broken down as follows:
|
24 |
-
* - http://
|
25 |
-
* - OUTSIDE ROOT: http://
|
26 |
*
|
27 |
* Example:
|
28 |
-
* - http://
|
29 |
* - $bp->current_component: string 'xprofile'
|
30 |
* - $bp->current_action: string 'edit'
|
31 |
* - $bp->action_variables: array ['group', 5]
|
@@ -253,7 +253,7 @@ function bp_core_set_uri_globals() {
|
|
253 |
// Viewing a specific user
|
254 |
if ( !empty( $bp_uri[$uri_offset + 1] ) ) {
|
255 |
|
256 |
-
// Switch the displayed_user based on
|
257 |
if ( bp_is_username_compatibility_mode() ) {
|
258 |
$bp->displayed_user->id = (int) bp_core_get_userid( urldecode( $bp_uri[$uri_offset + 1] ) );
|
259 |
} else {
|
@@ -342,12 +342,34 @@ function bp_core_enable_root_profiles() {
|
|
342 |
function bp_core_load_template( $templates ) {
|
343 |
global $wp_query;
|
344 |
|
345 |
-
//
|
346 |
-
|
347 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
'is_404' => true,
|
349 |
'post_status' => 'publish',
|
350 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
|
352 |
// Set theme compat to false since the reset post function automatically sets
|
353 |
// theme compat to true
|
@@ -371,6 +393,7 @@ function bp_core_load_template( $templates ) {
|
|
371 |
// Filter the template locations so that plugins can alter where they are located
|
372 |
$located_template = apply_filters( 'bp_located_template', $template, $filtered_templates );
|
373 |
if ( !empty( $located_template ) ) {
|
|
|
374 |
// Template was located, lets set this as a valid page and not a 404.
|
375 |
status_header( 200 );
|
376 |
$wp_query->is_page = true;
|
@@ -386,7 +409,7 @@ function bp_core_load_template( $templates ) {
|
|
386 |
// Kill any other output after this.
|
387 |
exit();
|
388 |
|
389 |
-
// No template found, so setup theme
|
390 |
// @todo Some other 404 handling if theme compat doesn't kick in
|
391 |
} else {
|
392 |
|
@@ -441,7 +464,7 @@ add_action( 'bp_template_redirect', 'bp_core_catch_no_access', 1 );
|
|
441 |
* @since BuddyPress (1.5.0)
|
442 |
*
|
443 |
* @param array $args {
|
444 |
-
* @type int $mode Specifies the
|
445 |
* direct to the root domain (home page), which assumes you have a
|
446 |
* log-in form there; 2 directs to wp-login.php. Default: 2.
|
447 |
* @type string $redirect The URL the user will be redirected to after
|
@@ -499,9 +522,8 @@ function bp_core_no_access( $args = '' ) {
|
|
499 |
default :
|
500 |
|
501 |
$url = $root;
|
502 |
-
if ( !empty( $redirect ) )
|
503 |
$url = add_query_arg( 'redirect_to', urlencode( $redirect ), $root );
|
504 |
-
}
|
505 |
|
506 |
if ( !empty( $message ) ) {
|
507 |
bp_core_add_message( $message, 'error' );
|
@@ -648,7 +670,7 @@ function bp_get_canonical_url( $args = array() ) {
|
|
648 |
// Except when the front page is set to the registration page
|
649 |
// and the current user is logged in. In this case we send to
|
650 |
// the members directory to avoid redirect loops
|
651 |
-
}
|
652 |
$bp->canonical_stack['canonical_url'] = apply_filters( 'bp_loggedin_register_page_redirect_to', trailingslashit( bp_get_root_domain() . '/' . bp_get_members_root_slug() ) );
|
653 |
}
|
654 |
}
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
/**
|
17 |
* Analyze the URI and break it down into BuddyPress-usable chunks.
|
21 |
* URI structures with very little work.
|
22 |
*
|
23 |
* The URIs are broken down as follows:
|
24 |
+
* - http:// domain.com / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
|
25 |
+
* - OUTSIDE ROOT: http:// domain.com / sites / buddypress / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
|
26 |
*
|
27 |
* Example:
|
28 |
+
* - http://domain.com/members/andy/profile/edit/group/5/
|
29 |
* - $bp->current_component: string 'xprofile'
|
30 |
* - $bp->current_action: string 'edit'
|
31 |
* - $bp->action_variables: array ['group', 5]
|
253 |
// Viewing a specific user
|
254 |
if ( !empty( $bp_uri[$uri_offset + 1] ) ) {
|
255 |
|
256 |
+
// Switch the displayed_user based on compatbility mode
|
257 |
if ( bp_is_username_compatibility_mode() ) {
|
258 |
$bp->displayed_user->id = (int) bp_core_get_userid( urldecode( $bp_uri[$uri_offset + 1] ) );
|
259 |
} else {
|
342 |
function bp_core_load_template( $templates ) {
|
343 |
global $wp_query;
|
344 |
|
345 |
+
// check if BP page belongs to, or is a child of, a BP directory page
|
346 |
+
$page_id = false;
|
347 |
+
foreach ( (array) buddypress()->pages as $page ) {
|
348 |
+
if ( $page->name == buddypress()->unfiltered_uri[buddypress()->unfiltered_uri_offset] ) {
|
349 |
+
$page_id = $page->id;
|
350 |
+
break;
|
351 |
+
}
|
352 |
+
}
|
353 |
+
|
354 |
+
// Set up reset post args
|
355 |
+
$reset_post_args = array(
|
356 |
'is_404' => true,
|
357 |
'post_status' => 'publish',
|
358 |
+
);
|
359 |
+
|
360 |
+
// BP page exists - fill in the $wp_query->post object
|
361 |
+
//
|
362 |
+
// bp_theme_compat_reset_post() looks at the $wp_query->post object to fill in
|
363 |
+
// the post globals
|
364 |
+
if ( ! empty( $page_id ) ) {
|
365 |
+
$wp_query->post = get_post( $page_id );
|
366 |
+
$reset_post_args['ID'] = $page_id;
|
367 |
+
} else {
|
368 |
+
$reset_post_args['ID'] = 0;
|
369 |
+
}
|
370 |
+
|
371 |
+
// Reset the post
|
372 |
+
bp_theme_compat_reset_post( $reset_post_args );
|
373 |
|
374 |
// Set theme compat to false since the reset post function automatically sets
|
375 |
// theme compat to true
|
393 |
// Filter the template locations so that plugins can alter where they are located
|
394 |
$located_template = apply_filters( 'bp_located_template', $template, $filtered_templates );
|
395 |
if ( !empty( $located_template ) ) {
|
396 |
+
|
397 |
// Template was located, lets set this as a valid page and not a 404.
|
398 |
status_header( 200 );
|
399 |
$wp_query->is_page = true;
|
409 |
// Kill any other output after this.
|
410 |
exit();
|
411 |
|
412 |
+
// No template found, so setup theme compatability
|
413 |
// @todo Some other 404 handling if theme compat doesn't kick in
|
414 |
} else {
|
415 |
|
464 |
* @since BuddyPress (1.5.0)
|
465 |
*
|
466 |
* @param array $args {
|
467 |
+
* @type int $mode Specifies the destintation of the redirect. 1 will
|
468 |
* direct to the root domain (home page), which assumes you have a
|
469 |
* log-in form there; 2 directs to wp-login.php. Default: 2.
|
470 |
* @type string $redirect The URL the user will be redirected to after
|
522 |
default :
|
523 |
|
524 |
$url = $root;
|
525 |
+
if ( !empty( $redirect ) )
|
526 |
$url = add_query_arg( 'redirect_to', urlencode( $redirect ), $root );
|
|
|
527 |
|
528 |
if ( !empty( $message ) ) {
|
529 |
bp_core_add_message( $message, 'error' );
|
670 |
// Except when the front page is set to the registration page
|
671 |
// and the current user is logged in. In this case we send to
|
672 |
// the members directory to avoid redirect loops
|
673 |
+
} else if ( bp_is_register_page() && 'register' == $front_page_component && is_user_logged_in() ) {
|
674 |
$bp->canonical_stack['canonical_url'] = apply_filters( 'bp_loggedin_register_page_redirect_to', trailingslashit( bp_get_root_domain() . '/' . bp_get_members_root_slug() ) );
|
675 |
}
|
676 |
}
|
bp-core/bp-core-classes.php
CHANGED
@@ -7,51 +7,55 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/**
|
13 |
* BuddyPress User Query class.
|
14 |
*
|
15 |
-
* Used for querying users in a BuddyPress context, in situations where
|
16 |
-
* Member directories, the Friends component,
|
|
|
17 |
*
|
18 |
* @since BuddyPress (1.7.0)
|
19 |
*
|
20 |
* @param array $query {
|
21 |
* Query arguments. All items are optional.
|
22 |
-
* @type string
|
23 |
-
*
|
24 |
-
* @type int
|
25 |
-
* @type int
|
26 |
-
* @type int
|
27 |
-
*
|
28 |
-
*
|
29 |
-
*
|
30 |
-
*
|
31 |
-
*
|
32 |
-
* @type
|
33 |
-
*
|
34 |
-
*
|
35 |
-
*
|
36 |
-
*
|
37 |
-
*
|
38 |
-
*
|
39 |
-
*
|
40 |
-
* @type array|string
|
41 |
-
*
|
42 |
-
*
|
43 |
-
*
|
44 |
-
*
|
45 |
-
*
|
46 |
-
*
|
47 |
-
* @type bool
|
48 |
-
*
|
49 |
-
*
|
50 |
-
*
|
51 |
-
*
|
52 |
-
*
|
53 |
-
*
|
54 |
-
*
|
|
|
|
|
|
|
55 |
* }
|
56 |
*/
|
57 |
class BP_User_Query {
|
@@ -110,15 +114,6 @@ class BP_User_Query {
|
|
110 |
*/
|
111 |
public $uid_clauses = array();
|
112 |
|
113 |
-
/**
|
114 |
-
* SQL table where the user ID is being fetched from.
|
115 |
-
*
|
116 |
-
* @since BuddyPress (2.2.0)
|
117 |
-
* @access public
|
118 |
-
* @var string
|
119 |
-
*/
|
120 |
-
public $uid_table = '';
|
121 |
-
|
122 |
/**
|
123 |
* SQL database column name to order by.
|
124 |
*
|
@@ -165,10 +160,8 @@ class BP_User_Query {
|
|
165 |
'include' => false,
|
166 |
'exclude' => false,
|
167 |
'user_ids' => false,
|
168 |
-
'member_type' => '',
|
169 |
'meta_key' => false,
|
170 |
'meta_value' => false,
|
171 |
-
'xprofile_query' => false,
|
172 |
'populate_extras' => true,
|
173 |
'count_total' => 'count_query'
|
174 |
) );
|
@@ -256,8 +249,7 @@ class BP_User_Query {
|
|
256 |
// number of minutes used as an interval
|
257 |
case 'online' :
|
258 |
$this->uid_name = 'user_id';
|
259 |
-
$this->
|
260 |
-
$sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
|
261 |
$sql['where'][] = $wpdb->prepare( "u.component = %s AND u.type = 'last_activity'", buddypress()->members->id );
|
262 |
$sql['where'][] = $wpdb->prepare( "u.date_recorded >= DATE_SUB( UTC_TIMESTAMP(), INTERVAL %d MINUTE )", apply_filters( 'bp_user_query_online_interval', 15 ) );
|
263 |
$sql['orderby'] = "ORDER BY u.date_recorded";
|
@@ -271,14 +263,13 @@ class BP_User_Query {
|
|
271 |
case 'newest' :
|
272 |
case 'random' :
|
273 |
$this->uid_name = 'user_id';
|
274 |
-
$this->
|
275 |
-
$sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
|
276 |
$sql['where'][] = $wpdb->prepare( "u.component = %s AND u.type = 'last_activity'", buddypress()->members->id );
|
277 |
|
278 |
if ( 'newest' == $type ) {
|
279 |
$sql['orderby'] = "ORDER BY u.user_id";
|
280 |
$sql['order'] = "DESC";
|
281 |
-
}
|
282 |
$sql['orderby'] = "ORDER BY rand()";
|
283 |
} else {
|
284 |
$sql['orderby'] = "ORDER BY u.date_recorded";
|
@@ -290,8 +281,7 @@ class BP_User_Query {
|
|
290 |
// 'popular' sorts by the 'total_friend_count' usermeta
|
291 |
case 'popular' :
|
292 |
$this->uid_name = 'user_id';
|
293 |
-
$this->
|
294 |
-
$sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
|
295 |
$sql['where'][] = $wpdb->prepare( "u.meta_key = %s", bp_get_user_meta_key( 'total_friend_count' ) );
|
296 |
$sql['orderby'] = "ORDER BY CONVERT(u.meta_value, SIGNED)";
|
297 |
$sql['order'] = "DESC";
|
@@ -308,8 +298,7 @@ class BP_User_Query {
|
|
308 |
// @todo remove need for bp_is_active() check
|
309 |
if ( ! bp_disable_profile_sync() || ! bp_is_active( 'xprofile' ) ) {
|
310 |
$this->uid_name = 'ID';
|
311 |
-
$this->
|
312 |
-
$sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
|
313 |
$sql['orderby'] = "ORDER BY u.display_name";
|
314 |
$sql['order'] = "ASC";
|
315 |
|
@@ -317,8 +306,7 @@ class BP_User_Query {
|
|
317 |
// the xprofile table
|
318 |
} else {
|
319 |
$this->uid_name = 'user_id';
|
320 |
-
$this->
|
321 |
-
$sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
|
322 |
$sql['where'][] = $wpdb->prepare( "u.field_id = %d", bp_xprofile_fullname_field_id() );
|
323 |
$sql['orderby'] = "ORDER BY u.value";
|
324 |
$sql['order'] = "ASC";
|
@@ -334,8 +322,7 @@ class BP_User_Query {
|
|
334 |
// Any other 'type' falls through
|
335 |
default :
|
336 |
$this->uid_name = 'ID';
|
337 |
-
$this->
|
338 |
-
$sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
|
339 |
|
340 |
// In this case, we assume that a plugin is
|
341 |
// handling order, so we leave those clauses
|
@@ -403,47 +390,6 @@ class BP_User_Query {
|
|
403 |
);
|
404 |
}
|
405 |
|
406 |
-
// Member type.
|
407 |
-
if ( ! empty( $member_type ) ) {
|
408 |
-
$member_types = array();
|
409 |
-
|
410 |
-
if ( ! is_array( $member_type ) ) {
|
411 |
-
$member_type = preg_split( '/[,\s+]/', $member_type );
|
412 |
-
}
|
413 |
-
|
414 |
-
foreach ( $member_type as $mt ) {
|
415 |
-
if ( ! bp_get_member_type_object( $mt ) ) {
|
416 |
-
continue;
|
417 |
-
}
|
418 |
-
|
419 |
-
$member_types[] = $mt;
|
420 |
-
}
|
421 |
-
|
422 |
-
if ( ! empty( $member_types ) ) {
|
423 |
-
$member_type_tq = new WP_Tax_Query( array(
|
424 |
-
array(
|
425 |
-
'taxonomy' => 'bp_member_type',
|
426 |
-
'field' => 'name',
|
427 |
-
'operator' => 'IN',
|
428 |
-
'terms' => $member_types,
|
429 |
-
),
|
430 |
-
) );
|
431 |
-
|
432 |
-
// Switch to the root blog, where member type taxonomies live.
|
433 |
-
switch_to_blog( bp_get_root_blog_id() );
|
434 |
-
|
435 |
-
$member_type_sql_clauses = $member_type_tq->get_sql( 'u', $this->uid_name );
|
436 |
-
restore_current_blog();
|
437 |
-
|
438 |
-
// Grab the first term_relationships clause and convert to a subquery.
|
439 |
-
if ( preg_match( '/' . $wpdb->term_relationships . '\.term_taxonomy_id IN \([0-9, ]+\)/', $member_type_sql_clauses['where'], $matches ) ) {
|
440 |
-
$sql['where']['member_type'] = "u.{$this->uid_name} IN ( SELECT object_id FROM $wpdb->term_relationships WHERE {$matches[0]} )";
|
441 |
-
} elseif ( false !== strpos( $member_type_sql_clauses['where'], '0 = 1' ) ) {
|
442 |
-
$sql['where']['member_type'] = $this->no_results['where'];
|
443 |
-
}
|
444 |
-
}
|
445 |
-
}
|
446 |
-
|
447 |
// 'meta_key', 'meta_value' allow usermeta search
|
448 |
// To avoid global joins, do a separate query
|
449 |
if ( false !== $meta_key ) {
|
@@ -457,8 +403,6 @@ class BP_User_Query {
|
|
457 |
|
458 |
if ( ! empty( $found_user_ids ) ) {
|
459 |
$sql['where'][] = "u.{$this->uid_name} IN (" . implode( ',', wp_parse_id_list( $found_user_ids ) ) . ")";
|
460 |
-
} else {
|
461 |
-
$sql['where'][] = '1 = 0';
|
462 |
}
|
463 |
}
|
464 |
|
@@ -600,6 +544,7 @@ class BP_User_Query {
|
|
600 |
*
|
601 |
* @since BuddyPress (1.7.0)
|
602 |
*
|
|
|
603 |
* @global WPDB $wpdb Global WordPress database access object.
|
604 |
*/
|
605 |
public function populate_extras() {
|
@@ -624,6 +569,8 @@ class BP_User_Query {
|
|
624 |
// Turn user ID's into a query-usable, comma separated value
|
625 |
$user_ids_sql = implode( ',', wp_parse_id_list( $this->user_ids ) );
|
626 |
|
|
|
|
|
627 |
/**
|
628 |
* Use this action to independently populate your own custom extras.
|
629 |
*
|
@@ -661,7 +608,7 @@ class BP_User_Query {
|
|
661 |
$this->results[$uindex]->total_friend_count = 0;
|
662 |
}
|
663 |
|
664 |
-
// Create, prepare, and run the
|
665 |
$user_metas = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, meta_key, meta_value FROM {$wpdb->usermeta} WHERE meta_key IN (%s,%s) AND user_id IN ({$user_ids_sql})", $total_friend_count_key, $bp_latest_update_key ) );
|
666 |
|
667 |
// The $members_template global expects the index key to be different
|
@@ -1599,7 +1546,7 @@ class BP_Date_Query extends WP_Date_Query {
|
|
1599 |
* Destructor.
|
1600 |
*/
|
1601 |
public function __destruct() {
|
1602 |
-
remove_filter( 'date_query_valid_columns', array( $this, 'register_date_column' ) );
|
1603 |
}
|
1604 |
|
1605 |
/**
|
@@ -1829,7 +1776,7 @@ class BP_Core_Notification {
|
|
1829 |
* @global wpdb $wpdb WordPress database object
|
1830 |
* @param string $item_id The item id that they notifications are to be for.
|
1831 |
* @param string $component_name The component that the notifications are to be from.
|
1832 |
-
* @param string $component_action The action that the
|
1833 |
* @param string $secondary_item_id Optional secondary item id that the notifications are to have.
|
1834 |
* @static
|
1835 |
*/
|
@@ -2032,7 +1979,7 @@ class BP_Button {
|
|
2032 |
|
2033 |
// No button if viewing your own profile (and not in
|
2034 |
// a members loop)
|
2035 |
-
}
|
2036 |
return false;
|
2037 |
}
|
2038 |
}
|
@@ -2326,6 +2273,7 @@ class BP_Walker_Nav_Menu extends Walker_Nav_Menu {
|
|
2326 |
if ( empty( $elements ) ) // nothing to walk
|
2327 |
return $output;
|
2328 |
|
|
|
2329 |
$parent_field = $this->db_fields['parent'];
|
2330 |
|
2331 |
// flat display
|
@@ -2424,7 +2372,7 @@ class BP_Walker_Nav_Menu extends Walker_Nav_Menu {
|
|
2424 |
$output .= $indent . '<li' . $id . $class_names . '>';
|
2425 |
|
2426 |
// Add href attribute
|
2427 |
-
$attributes = ! empty( $item->link ) ? ' href="' . esc_url( $item->link ) . '"' : '';
|
2428 |
|
2429 |
// Construct the link
|
2430 |
$item_output = $args->before;
|
@@ -2750,227 +2698,3 @@ class BP_Members_Suggestions extends BP_Suggestions {
|
|
2750 |
return apply_filters( 'bp_members_suggestions_get_suggestions', $results, $this );
|
2751 |
}
|
2752 |
}
|
2753 |
-
|
2754 |
-
/**
|
2755 |
-
* Base class for creating query classes that generate SQL fragments for filtering results based on recursive query params.
|
2756 |
-
*
|
2757 |
-
* @since BuddyPress (2.2.0)
|
2758 |
-
*/
|
2759 |
-
abstract class BP_Recursive_Query {
|
2760 |
-
|
2761 |
-
/**
|
2762 |
-
* Query arguments passed to the constructor.
|
2763 |
-
*
|
2764 |
-
* @since BuddyPress (2.2.0)
|
2765 |
-
* @access public
|
2766 |
-
* @var array
|
2767 |
-
*/
|
2768 |
-
public $queries = array();
|
2769 |
-
|
2770 |
-
/**
|
2771 |
-
* Generate SQL clauses to be appended to a main query.
|
2772 |
-
*
|
2773 |
-
* Extending classes should call this method from within a publicly
|
2774 |
-
* accessible get_sql() method, and manipulate the SQL as necessary.
|
2775 |
-
* For example, {@link BP_XProfile_Query::get_sql()} is merely a wrapper for
|
2776 |
-
* get_sql_clauses(), while {@link BP_Activity_Query::get_sql()} discards
|
2777 |
-
* the empty 'join' clause, and only passes the 'where' clause.
|
2778 |
-
*
|
2779 |
-
* @since BuddyPress (2.2.0)
|
2780 |
-
* @access protected
|
2781 |
-
*
|
2782 |
-
* @param string $primary_table
|
2783 |
-
* @param string $primary_id_column
|
2784 |
-
* @return array
|
2785 |
-
*/
|
2786 |
-
protected function get_sql_clauses() {
|
2787 |
-
$sql = $this->get_sql_for_query( $this->queries );
|
2788 |
-
|
2789 |
-
if ( ! empty( $sql['where'] ) ) {
|
2790 |
-
$sql['where'] = ' AND ' . "\n" . $sql['where'] . "\n";
|
2791 |
-
}
|
2792 |
-
|
2793 |
-
return $sql;
|
2794 |
-
}
|
2795 |
-
|
2796 |
-
/**
|
2797 |
-
* Generate SQL clauses for a single query array.
|
2798 |
-
*
|
2799 |
-
* If nested subqueries are found, this method recurses the tree to
|
2800 |
-
* produce the properly nested SQL.
|
2801 |
-
*
|
2802 |
-
* Subclasses generally do not need to call this method. It is invoked
|
2803 |
-
* automatically from get_sql_clauses().
|
2804 |
-
*
|
2805 |
-
* @since BuddyPress (2.2.0)
|
2806 |
-
* @access protected
|
2807 |
-
*
|
2808 |
-
* @param array $query Query to parse.
|
2809 |
-
* @param int $depth Optional. Number of tree levels deep we
|
2810 |
-
* currently are. Used to calculate indentation.
|
2811 |
-
* @return array
|
2812 |
-
*/
|
2813 |
-
protected function get_sql_for_query( $query, $depth = 0 ) {
|
2814 |
-
$sql_chunks = array(
|
2815 |
-
'join' => array(),
|
2816 |
-
'where' => array(),
|
2817 |
-
);
|
2818 |
-
|
2819 |
-
$sql = array(
|
2820 |
-
'join' => '',
|
2821 |
-
'where' => '',
|
2822 |
-
);
|
2823 |
-
|
2824 |
-
$indent = '';
|
2825 |
-
for ( $i = 0; $i < $depth; $i++ ) {
|
2826 |
-
$indent .= "\t";
|
2827 |
-
}
|
2828 |
-
|
2829 |
-
foreach ( $query as $key => $clause ) {
|
2830 |
-
if ( 'relation' === $key ) {
|
2831 |
-
$relation = $query['relation'];
|
2832 |
-
} elseif ( is_array( $clause ) ) {
|
2833 |
-
// This is a first-order clause
|
2834 |
-
if ( $this->is_first_order_clause( $clause ) ) {
|
2835 |
-
$clause_sql = $this->get_sql_for_clause( $clause, $query );
|
2836 |
-
|
2837 |
-
$where_count = count( $clause_sql['where'] );
|
2838 |
-
if ( ! $where_count ) {
|
2839 |
-
$sql_chunks['where'][] = '';
|
2840 |
-
} elseif ( 1 === $where_count ) {
|
2841 |
-
$sql_chunks['where'][] = $clause_sql['where'][0];
|
2842 |
-
} else {
|
2843 |
-
$sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )';
|
2844 |
-
}
|
2845 |
-
|
2846 |
-
$sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] );
|
2847 |
-
// This is a subquery
|
2848 |
-
} else {
|
2849 |
-
$clause_sql = $this->get_sql_for_query( $clause, $depth + 1 );
|
2850 |
-
|
2851 |
-
$sql_chunks['where'][] = $clause_sql['where'];
|
2852 |
-
$sql_chunks['join'][] = $clause_sql['join'];
|
2853 |
-
}
|
2854 |
-
}
|
2855 |
-
}
|
2856 |
-
|
2857 |
-
// Filter empties
|
2858 |
-
$sql_chunks['join'] = array_filter( $sql_chunks['join'] );
|
2859 |
-
$sql_chunks['where'] = array_filter( $sql_chunks['where'] );
|
2860 |
-
|
2861 |
-
if ( empty( $relation ) ) {
|
2862 |
-
$relation = 'AND';
|
2863 |
-
}
|
2864 |
-
|
2865 |
-
if ( ! empty( $sql_chunks['join'] ) ) {
|
2866 |
-
$sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) );
|
2867 |
-
}
|
2868 |
-
|
2869 |
-
if ( ! empty( $sql_chunks['where'] ) ) {
|
2870 |
-
$sql['where'] = '( ' . "\n\t" . $indent . implode( ' ' . "\n\t" . $indent . $relation . ' ' . "\n\t" . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')' . "\n";
|
2871 |
-
}
|
2872 |
-
|
2873 |
-
return $sql;
|
2874 |
-
}
|
2875 |
-
|
2876 |
-
/**
|
2877 |
-
* Recursive-friendly query sanitizer.
|
2878 |
-
*
|
2879 |
-
* Ensures that each query-level clause has a 'relation' key, and that
|
2880 |
-
* each first-order clause contains all the necessary keys from
|
2881 |
-
* $defaults.
|
2882 |
-
*
|
2883 |
-
* Extend this method if your class uses different sanitizing logic.
|
2884 |
-
*
|
2885 |
-
* @since BuddyPress (2.2.0)
|
2886 |
-
* @access public
|
2887 |
-
*
|
2888 |
-
* @param array $queries Array of query clauses.
|
2889 |
-
* @return array Sanitized array of query clauses.
|
2890 |
-
*/
|
2891 |
-
protected function sanitize_query( $queries ) {
|
2892 |
-
$clean_queries = array();
|
2893 |
-
|
2894 |
-
if ( ! is_array( $queries ) ) {
|
2895 |
-
return $clean_queries;
|
2896 |
-
}
|
2897 |
-
|
2898 |
-
foreach ( $queries as $key => $query ) {
|
2899 |
-
if ( 'relation' === $key ) {
|
2900 |
-
$relation = $query;
|
2901 |
-
|
2902 |
-
} elseif ( ! is_array( $query ) ) {
|
2903 |
-
continue;
|
2904 |
-
|
2905 |
-
// First-order clause.
|
2906 |
-
} elseif ( $this->is_first_order_clause( $query ) ) {
|
2907 |
-
if ( isset( $query['value'] ) && array() === $query['value'] ) {
|
2908 |
-
unset( $query['value'] );
|
2909 |
-
}
|
2910 |
-
|
2911 |
-
$clean_queries[] = $query;
|
2912 |
-
|
2913 |
-
// Otherwise, it's a nested query, so we recurse.
|
2914 |
-
} else {
|
2915 |
-
$cleaned_query = $this->sanitize_query( $query );
|
2916 |
-
|
2917 |
-
if ( ! empty( $cleaned_query ) ) {
|
2918 |
-
$clean_queries[] = $cleaned_query;
|
2919 |
-
}
|
2920 |
-
}
|
2921 |
-
}
|
2922 |
-
|
2923 |
-
if ( empty( $clean_queries ) ) {
|
2924 |
-
return $clean_queries;
|
2925 |
-
}
|
2926 |
-
|
2927 |
-
// Sanitize the 'relation' key provided in the query.
|
2928 |
-
if ( isset( $relation ) && 'OR' === strtoupper( $relation ) ) {
|
2929 |
-
$clean_queries['relation'] = 'OR';
|
2930 |
-
|
2931 |
-
/*
|
2932 |
-
* If there is only a single clause, call the relation 'OR'.
|
2933 |
-
* This value will not actually be used to join clauses, but it
|
2934 |
-
* simplifies the logic around combining key-only queries.
|
2935 |
-
*/
|
2936 |
-
} elseif ( 1 === count( $clean_queries ) ) {
|
2937 |
-
$clean_queries['relation'] = 'OR';
|
2938 |
-
|
2939 |
-
// Default to AND.
|
2940 |
-
} else {
|
2941 |
-
$clean_queries['relation'] = 'AND';
|
2942 |
-
}
|
2943 |
-
|
2944 |
-
return $clean_queries;
|
2945 |
-
}
|
2946 |
-
|
2947 |
-
/**
|
2948 |
-
* Generate JOIN and WHERE clauses for a first-order clause.
|
2949 |
-
*
|
2950 |
-
* Must be overridden in a subclass.
|
2951 |
-
*
|
2952 |
-
* @since BuddyPress (2.2.0)
|
2953 |
-
* @access protected
|
2954 |
-
*
|
2955 |
-
* @param array $clause Array of arguments belonging to the clause.
|
2956 |
-
* @param array $parent_query Parent query to which the clause belongs.
|
2957 |
-
* @return array {
|
2958 |
-
* @type array $join Array of subclauses for the JOIN statement.
|
2959 |
-
* @type array $where Array of subclauses for the WHERE statement.
|
2960 |
-
* }
|
2961 |
-
*/
|
2962 |
-
abstract protected function get_sql_for_clause( $clause, $parent_query );
|
2963 |
-
|
2964 |
-
/**
|
2965 |
-
* Determine whether a clause is first-order.
|
2966 |
-
*
|
2967 |
-
* Must be overridden in a subclass.
|
2968 |
-
*
|
2969 |
-
* @since BuddyPress (2.2.0)
|
2970 |
-
* @access protected
|
2971 |
-
*
|
2972 |
-
* @param array $q Clause to check.
|
2973 |
-
* @return bool
|
2974 |
-
*/
|
2975 |
-
abstract protected function is_first_order_clause( $query );
|
2976 |
-
}
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/**
|
13 |
* BuddyPress User Query class.
|
14 |
*
|
15 |
+
* Used for querying users in a BuddyPress context, in situations where
|
16 |
+
* WP_User_Query won't do the trick: Member directories, the Friends component,
|
17 |
+
* etc.
|
18 |
*
|
19 |
* @since BuddyPress (1.7.0)
|
20 |
*
|
21 |
* @param array $query {
|
22 |
* Query arguments. All items are optional.
|
23 |
+
* @type string $type Determines sort order. Select from 'newest', 'active',
|
24 |
+
* 'online', 'random', 'popular', 'alphabetical'. Default: 'newest'.
|
25 |
+
* @type int $per_page Number of results to return. Default: 0 (no limit).
|
26 |
+
* @type int $page Page offset (together with $per_page). Default: 1.
|
27 |
+
* @type int $user_id ID of a user. If present, and if the friends
|
28 |
+
* component is activated, results will be limited to the friends of
|
29 |
+
* that user. Default: 0.
|
30 |
+
* @type string|bool $search_terms Terms to search by. Search happens
|
31 |
+
* across xprofile fields. Requires XProfile component.
|
32 |
+
* Default: false.
|
33 |
+
* @type string $search_wildcard When searching with $search_terms,
|
34 |
+
* set where wildcards around the term should be positioned.
|
35 |
+
* Default: 'both'. Other values: 'left', 'right'.
|
36 |
+
* @type array|string|bool $include An array or comma-separated list of
|
37 |
+
* user IDs to which query should be limited.
|
38 |
+
* Default: false.
|
39 |
+
* @type array|string|bool $exclude An array or comma-separated list of
|
40 |
+
* user IDs that will be excluded from query results. Default: false.
|
41 |
+
* @type array|string|bool $user_ids An array or comma-separated list of
|
42 |
+
* IDs corresponding to the users that should be returned. When this
|
43 |
+
* parameter is passed, it will override all others; BP User objects
|
44 |
+
* will be constructed using these IDs only. Default: false.
|
45 |
+
* @type string|bool $meta_key Limit results to users that have usermeta
|
46 |
+
* associated with this meta_key. Usually used with $meta_value.
|
47 |
+
* Default: false.
|
48 |
+
* @type string|bool $meta_value When used with $meta_key, limits results
|
49 |
+
* to users whose usermeta value associated with $meta_key matches
|
50 |
+
* $meta_value. Default: false.
|
51 |
+
* @type bool $populate_extras True if you want to fetch extra metadata
|
52 |
+
* about returned users, such as total group and friend counts.
|
53 |
+
* @type string $count_total Determines how BP_User_Query will do a count
|
54 |
+
* of total users matching the other filter criteria. Default value
|
55 |
+
* is 'count_query', which does a separate SELECT COUNT query to
|
56 |
+
* determine the total. 'sql_count_found_rows' uses
|
57 |
+
* SQL_COUNT_FOUND_ROWS and SELECT FOUND_ROWS(). Pass an empty string
|
58 |
+
* to skip the total user count query.
|
59 |
* }
|
60 |
*/
|
61 |
class BP_User_Query {
|
114 |
*/
|
115 |
public $uid_clauses = array();
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
/**
|
118 |
* SQL database column name to order by.
|
119 |
*
|
160 |
'include' => false,
|
161 |
'exclude' => false,
|
162 |
'user_ids' => false,
|
|
|
163 |
'meta_key' => false,
|
164 |
'meta_value' => false,
|
|
|
165 |
'populate_extras' => true,
|
166 |
'count_total' => 'count_query'
|
167 |
) );
|
249 |
// number of minutes used as an interval
|
250 |
case 'online' :
|
251 |
$this->uid_name = 'user_id';
|
252 |
+
$sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$bp->members->table_name_last_activity} u";
|
|
|
253 |
$sql['where'][] = $wpdb->prepare( "u.component = %s AND u.type = 'last_activity'", buddypress()->members->id );
|
254 |
$sql['where'][] = $wpdb->prepare( "u.date_recorded >= DATE_SUB( UTC_TIMESTAMP(), INTERVAL %d MINUTE )", apply_filters( 'bp_user_query_online_interval', 15 ) );
|
255 |
$sql['orderby'] = "ORDER BY u.date_recorded";
|
263 |
case 'newest' :
|
264 |
case 'random' :
|
265 |
$this->uid_name = 'user_id';
|
266 |
+
$sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$bp->members->table_name_last_activity} u";
|
|
|
267 |
$sql['where'][] = $wpdb->prepare( "u.component = %s AND u.type = 'last_activity'", buddypress()->members->id );
|
268 |
|
269 |
if ( 'newest' == $type ) {
|
270 |
$sql['orderby'] = "ORDER BY u.user_id";
|
271 |
$sql['order'] = "DESC";
|
272 |
+
} else if ( 'random' == $type ) {
|
273 |
$sql['orderby'] = "ORDER BY rand()";
|
274 |
} else {
|
275 |
$sql['orderby'] = "ORDER BY u.date_recorded";
|
281 |
// 'popular' sorts by the 'total_friend_count' usermeta
|
282 |
case 'popular' :
|
283 |
$this->uid_name = 'user_id';
|
284 |
+
$sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$wpdb->usermeta} u";
|
|
|
285 |
$sql['where'][] = $wpdb->prepare( "u.meta_key = %s", bp_get_user_meta_key( 'total_friend_count' ) );
|
286 |
$sql['orderby'] = "ORDER BY CONVERT(u.meta_value, SIGNED)";
|
287 |
$sql['order'] = "DESC";
|
298 |
// @todo remove need for bp_is_active() check
|
299 |
if ( ! bp_disable_profile_sync() || ! bp_is_active( 'xprofile' ) ) {
|
300 |
$this->uid_name = 'ID';
|
301 |
+
$sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$wpdb->users} u";
|
|
|
302 |
$sql['orderby'] = "ORDER BY u.display_name";
|
303 |
$sql['order'] = "ASC";
|
304 |
|
306 |
// the xprofile table
|
307 |
} else {
|
308 |
$this->uid_name = 'user_id';
|
309 |
+
$sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$bp->profile->table_name_data} u";
|
|
|
310 |
$sql['where'][] = $wpdb->prepare( "u.field_id = %d", bp_xprofile_fullname_field_id() );
|
311 |
$sql['orderby'] = "ORDER BY u.value";
|
312 |
$sql['order'] = "ASC";
|
322 |
// Any other 'type' falls through
|
323 |
default :
|
324 |
$this->uid_name = 'ID';
|
325 |
+
$sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$wpdb->users} u";
|
|
|
326 |
|
327 |
// In this case, we assume that a plugin is
|
328 |
// handling order, so we leave those clauses
|
390 |
);
|
391 |
}
|
392 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
// 'meta_key', 'meta_value' allow usermeta search
|
394 |
// To avoid global joins, do a separate query
|
395 |
if ( false !== $meta_key ) {
|
403 |
|
404 |
if ( ! empty( $found_user_ids ) ) {
|
405 |
$sql['where'][] = "u.{$this->uid_name} IN (" . implode( ',', wp_parse_id_list( $found_user_ids ) ) . ")";
|
|
|
|
|
406 |
}
|
407 |
}
|
408 |
|
544 |
*
|
545 |
* @since BuddyPress (1.7.0)
|
546 |
*
|
547 |
+
* @global BuddyPress $bp Global BuddyPress settings object.
|
548 |
* @global WPDB $wpdb Global WordPress database access object.
|
549 |
*/
|
550 |
public function populate_extras() {
|
569 |
// Turn user ID's into a query-usable, comma separated value
|
570 |
$user_ids_sql = implode( ',', wp_parse_id_list( $this->user_ids ) );
|
571 |
|
572 |
+
$bp = buddypress();
|
573 |
+
|
574 |
/**
|
575 |
* Use this action to independently populate your own custom extras.
|
576 |
*
|
608 |
$this->results[$uindex]->total_friend_count = 0;
|
609 |
}
|
610 |
|
611 |
+
// Create, prepare, and run the seperate usermeta query
|
612 |
$user_metas = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, meta_key, meta_value FROM {$wpdb->usermeta} WHERE meta_key IN (%s,%s) AND user_id IN ({$user_ids_sql})", $total_friend_count_key, $bp_latest_update_key ) );
|
613 |
|
614 |
// The $members_template global expects the index key to be different
|
1546 |
* Destructor.
|
1547 |
*/
|
1548 |
public function __destruct() {
|
1549 |
+
remove_filter( 'date_query_valid_columns', array( $this, 'register_date_column' ) );
|
1550 |
}
|
1551 |
|
1552 |
/**
|
1776 |
* @global wpdb $wpdb WordPress database object
|
1777 |
* @param string $item_id The item id that they notifications are to be for.
|
1778 |
* @param string $component_name The component that the notifications are to be from.
|
1779 |
+
* @param string $component_action The action that the notificationsa are to be from.
|
1780 |
* @param string $secondary_item_id Optional secondary item id that the notifications are to have.
|
1781 |
* @static
|
1782 |
*/
|
1979 |
|
1980 |
// No button if viewing your own profile (and not in
|
1981 |
// a members loop)
|
1982 |
+
} else if ( bp_is_my_profile() ) {
|
1983 |
return false;
|
1984 |
}
|
1985 |
}
|
2273 |
if ( empty( $elements ) ) // nothing to walk
|
2274 |
return $output;
|
2275 |
|
2276 |
+
$id_field = $this->db_fields['id'];
|
2277 |
$parent_field = $this->db_fields['parent'];
|
2278 |
|
2279 |
// flat display
|
2372 |
$output .= $indent . '<li' . $id . $class_names . '>';
|
2373 |
|
2374 |
// Add href attribute
|
2375 |
+
$attributes = ! empty( $item->link ) ? ' href="' . esc_attr( esc_url( $item->link ) ) . '"' : '';
|
2376 |
|
2377 |
// Construct the link
|
2378 |
$item_output = $args->before;
|
2698 |
return apply_filters( 'bp_members_suggestions_get_suggestions', $results, $this );
|
2699 |
}
|
2700 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp-core/bp-core-component.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
if ( !class_exists( 'BP_Component' ) ) :
|
13 |
/**
|
@@ -356,9 +356,6 @@ class BP_Component {
|
|
356 |
// Setup component title
|
357 |
add_action( 'bp_setup_title', array( $this, 'setup_title' ), 10 );
|
358 |
|
359 |
-
// Setup cache groups
|
360 |
-
add_action( 'bp_setup_cache_groups', array( $this, 'setup_cache_groups' ), 10 );
|
361 |
-
|
362 |
// Register post types
|
363 |
add_action( 'bp_register_post_types', array( $this, 'register_post_types' ), 10 );
|
364 |
|
@@ -474,23 +471,12 @@ class BP_Component {
|
|
474 |
*
|
475 |
* @since BuddyPress (1.5.0)
|
476 |
*
|
477 |
-
* @uses do_action() Calls 'bp_{@link bp_Component::name}
|
478 |
*/
|
479 |
public function setup_title() {
|
480 |
do_action( 'bp_' . $this->id . '_setup_title' );
|
481 |
}
|
482 |
|
483 |
-
/**
|
484 |
-
* Setup component-specific cache groups.
|
485 |
-
*
|
486 |
-
* @since BuddyPress (2.2.0)
|
487 |
-
*
|
488 |
-
* @uses do_action() Calls 'bp_setup_{@link bp_Component::name}_cache_groups'.
|
489 |
-
*/
|
490 |
-
public function setup_cache_groups() {
|
491 |
-
do_action( 'bp_' . $this->id . '_setup_cache_groups' );
|
492 |
-
}
|
493 |
-
|
494 |
/**
|
495 |
* Register global tables for the component, so that it may use WordPress's database API.
|
496 |
*
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
if ( !class_exists( 'BP_Component' ) ) :
|
13 |
/**
|
356 |
// Setup component title
|
357 |
add_action( 'bp_setup_title', array( $this, 'setup_title' ), 10 );
|
358 |
|
|
|
|
|
|
|
359 |
// Register post types
|
360 |
add_action( 'bp_register_post_types', array( $this, 'register_post_types' ), 10 );
|
361 |
|
471 |
*
|
472 |
* @since BuddyPress (1.5.0)
|
473 |
*
|
474 |
+
* @uses do_action() Calls 'bp_{@link bp_Component::name}setup_title'.
|
475 |
*/
|
476 |
public function setup_title() {
|
477 |
do_action( 'bp_' . $this->id . '_setup_title' );
|
478 |
}
|
479 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
/**
|
481 |
* Register global tables for the component, so that it may use WordPress's database API.
|
482 |
*
|
bp-core/bp-core-cssjs.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/**
|
13 |
* Register scripts commonly used by BuddyPress.
|
@@ -125,7 +125,7 @@ function bp_core_add_cropper_inline_js() {
|
|
125 |
$crop_right = $image[0];
|
126 |
|
127 |
// Less than 2x full-width: cropper defaults to full-width
|
128 |
-
}
|
129 |
$padding_w = round( ( $image[0] - $full_width ) / 2 );
|
130 |
$crop_left = $padding_w;
|
131 |
$crop_right = $image[0] - $padding_w;
|
@@ -142,7 +142,7 @@ function bp_core_add_cropper_inline_js() {
|
|
142 |
$crop_bottom = $image[1];
|
143 |
|
144 |
// Less than double full-height: cropper defaults to full-height
|
145 |
-
}
|
146 |
$padding_h = round( ( $image[1] - $full_height ) / 2 );
|
147 |
$crop_top = $padding_h;
|
148 |
$crop_bottom = $image[1] - $padding_h;
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/**
|
13 |
* Register scripts commonly used by BuddyPress.
|
125 |
$crop_right = $image[0];
|
126 |
|
127 |
// Less than 2x full-width: cropper defaults to full-width
|
128 |
+
} else if ( $image[0] < ( $full_width * 2 ) ) {
|
129 |
$padding_w = round( ( $image[0] - $full_width ) / 2 );
|
130 |
$crop_left = $padding_w;
|
131 |
$crop_right = $image[0] - $padding_w;
|
142 |
$crop_bottom = $image[1];
|
143 |
|
144 |
// Less than double full-height: cropper defaults to full-height
|
145 |
+
} else if ( $image[1] < ( $full_height * 2 ) ) {
|
146 |
$padding_h = round( ( $image[1] - $full_height ) / 2 );
|
147 |
$crop_top = $padding_h;
|
148 |
$crop_bottom = $image[1] - $padding_h;
|
bp-core/bp-core-dependency.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
* The following functions are wrappers for hooks, allowing them to be
|
15 |
* manually called and/or piggy-backed on top of other hooks if needed.
|
16 |
*
|
17 |
-
* @todo use anonymous functions when PHP
|
18 |
*/
|
19 |
|
20 |
/**
|
@@ -38,15 +38,6 @@ function bp_setup_canonical_stack() {
|
|
38 |
do_action( 'bp_setup_canonical_stack' );
|
39 |
}
|
40 |
|
41 |
-
/**
|
42 |
-
* Fire the 'bp_register_taxonomies' action, where plugins should register taxonomies.
|
43 |
-
*
|
44 |
-
* @since BuddyPress (2.2.0)
|
45 |
-
*/
|
46 |
-
function bp_register_taxonomies() {
|
47 |
-
do_action( 'bp_register_taxonomies' );
|
48 |
-
}
|
49 |
-
|
50 |
/**
|
51 |
* Fire the 'bp_setup_globals' action, where plugins should initialize global settings.
|
52 |
*/
|
@@ -83,15 +74,6 @@ function bp_setup_widgets() {
|
|
83 |
do_action( 'bp_register_widgets' );
|
84 |
}
|
85 |
|
86 |
-
/**
|
87 |
-
* Fire the 'bp_setup_cache_groups' action, where cache groups are registered.
|
88 |
-
*
|
89 |
-
* @since BuddyPress (2.2.0)
|
90 |
-
*/
|
91 |
-
function bp_setup_cache_groups() {
|
92 |
-
do_action( 'bp_setup_cache_groups' );
|
93 |
-
}
|
94 |
-
|
95 |
/**
|
96 |
* Set up the currently logged-in user.
|
97 |
*
|
@@ -375,24 +357,19 @@ function bp_allowed_themes( $themes ) {
|
|
375 |
function bp_post_request() {
|
376 |
|
377 |
// Bail if not a POST action
|
378 |
-
if ( ! bp_is_post_request() )
|
379 |
return;
|
380 |
-
}
|
381 |
|
382 |
// Bail if no action
|
383 |
-
if ( empty( $_POST['action'] ) )
|
384 |
return;
|
385 |
-
}
|
386 |
-
|
387 |
-
// Sanitize the POST action
|
388 |
-
$action = sanitize_key( $_POST['action'] );
|
389 |
|
390 |
// This dynamic action is probably the one you want to use. It narrows down
|
391 |
// the scope of the 'action' without needing to check it in your function.
|
392 |
-
do_action( 'bp_post_request_' . $action );
|
393 |
|
394 |
// Use this static action if you don't mind checking the 'action' yourself.
|
395 |
-
do_action( 'bp_post_request', $action );
|
396 |
}
|
397 |
|
398 |
/**
|
@@ -404,22 +381,17 @@ function bp_post_request() {
|
|
404 |
function bp_get_request() {
|
405 |
|
406 |
// Bail if not a POST action
|
407 |
-
if ( ! bp_is_get_request() )
|
408 |
return;
|
409 |
-
}
|
410 |
|
411 |
// Bail if no action
|
412 |
-
if ( empty( $_GET['action'] ) )
|
413 |
return;
|
414 |
-
}
|
415 |
-
|
416 |
-
// Sanitize the GET action
|
417 |
-
$action = sanitize_key( $_GET['action'] );
|
418 |
|
419 |
// This dynamic action is probably the one you want to use. It narrows down
|
420 |
// the scope of the 'action' without needing to check it in your function.
|
421 |
-
do_action( 'bp_get_request_' . $action );
|
422 |
|
423 |
// Use this static action if you don't mind checking the 'action' yourself.
|
424 |
-
do_action( 'bp_get_request', $action );
|
425 |
}
|
14 |
* The following functions are wrappers for hooks, allowing them to be
|
15 |
* manually called and/or piggy-backed on top of other hooks if needed.
|
16 |
*
|
17 |
+
* @todo use anonymous functions when PHP minimun requirement allows (5.3)
|
18 |
*/
|
19 |
|
20 |
/**
|
38 |
do_action( 'bp_setup_canonical_stack' );
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
/**
|
42 |
* Fire the 'bp_setup_globals' action, where plugins should initialize global settings.
|
43 |
*/
|
74 |
do_action( 'bp_register_widgets' );
|
75 |
}
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
/**
|
78 |
* Set up the currently logged-in user.
|
79 |
*
|
357 |
function bp_post_request() {
|
358 |
|
359 |
// Bail if not a POST action
|
360 |
+
if ( ! bp_is_post_request() )
|
361 |
return;
|
|
|
362 |
|
363 |
// Bail if no action
|
364 |
+
if ( empty( $_POST['action'] ) )
|
365 |
return;
|
|
|
|
|
|
|
|
|
366 |
|
367 |
// This dynamic action is probably the one you want to use. It narrows down
|
368 |
// the scope of the 'action' without needing to check it in your function.
|
369 |
+
do_action( 'bp_post_request_' . $_POST['action'] );
|
370 |
|
371 |
// Use this static action if you don't mind checking the 'action' yourself.
|
372 |
+
do_action( 'bp_post_request', $_POST['action'] );
|
373 |
}
|
374 |
|
375 |
/**
|
381 |
function bp_get_request() {
|
382 |
|
383 |
// Bail if not a POST action
|
384 |
+
if ( ! bp_is_get_request() )
|
385 |
return;
|
|
|
386 |
|
387 |
// Bail if no action
|
388 |
+
if ( empty( $_GET['action'] ) )
|
389 |
return;
|
|
|
|
|
|
|
|
|
390 |
|
391 |
// This dynamic action is probably the one you want to use. It narrows down
|
392 |
// the scope of the 'action' without needing to check it in your function.
|
393 |
+
do_action( 'bp_get_request_' . $_GET['action'] );
|
394 |
|
395 |
// Use this static action if you don't mind checking the 'action' yourself.
|
396 |
+
do_action( 'bp_get_request', $_GET['action'] );
|
397 |
}
|
bp-core/bp-core-filters.php
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
*/
|
22 |
|
23 |
// Exit if accessed directly
|
24 |
-
defined( 'ABSPATH' )
|
25 |
|
26 |
/**
|
27 |
* Attach BuddyPress to WordPress.
|
@@ -63,7 +63,7 @@ add_filter( 'bp_template_include', 'bp_template_include_theme_supports', 2, 1
|
|
63 |
add_filter( 'bp_template_include', 'bp_template_include_theme_compat', 4, 2 );
|
64 |
|
65 |
// Filter BuddyPress template locations
|
66 |
-
add_filter( 'bp_get_template_stack', 'bp_add_template_stack_locations'
|
67 |
|
68 |
// Turn comments off for BuddyPress pages
|
69 |
add_filter( 'comments_open', 'bp_comments_open', 10, 2 );
|
@@ -139,93 +139,6 @@ function bp_core_exclude_pages_from_nav_menu_admin( $object = null ) {
|
|
139 |
}
|
140 |
add_filter( 'nav_menu_meta_box_object', 'bp_core_exclude_pages_from_nav_menu_admin', 11, 1 );
|
141 |
|
142 |
-
/**
|
143 |
-
* Adds current page CSS classes to the parent BP page in a WP Page Menu.
|
144 |
-
*
|
145 |
-
* Because BuddyPress primarily uses virtual pages, we need a way to highlight
|
146 |
-
* the BP parent page during WP menu generation. This function checks the
|
147 |
-
* current BP component against the current page in the WP menu to see if we
|
148 |
-
* should highlight the WP page.
|
149 |
-
*
|
150 |
-
* @since BuddyPress (2.2.0)
|
151 |
-
*
|
152 |
-
* @param array $retval CSS classes for the current menu page in the menu
|
153 |
-
* @param WP_Post $page The page properties for the current menu item
|
154 |
-
* @return array
|
155 |
-
*/
|
156 |
-
function bp_core_menu_highlight_parent_page( $retval, $page ) {
|
157 |
-
if ( ! is_buddypress() ) {
|
158 |
-
return $retval;
|
159 |
-
}
|
160 |
-
|
161 |
-
$page_id = false;
|
162 |
-
|
163 |
-
// loop against all BP component pages
|
164 |
-
foreach ( (array) buddypress()->pages as $component => $bp_page ) {
|
165 |
-
// handles the majority of components
|
166 |
-
if ( bp_is_current_component( $component ) ) {
|
167 |
-
$page_id = (int) $bp_page->id;
|
168 |
-
}
|
169 |
-
|
170 |
-
// stop if not on a user page
|
171 |
-
if ( ! bp_is_user() && ! empty( $page_id ) ) {
|
172 |
-
break;
|
173 |
-
}
|
174 |
-
|
175 |
-
// members component requires an explicit check due to overlapping components
|
176 |
-
if ( bp_is_user() && 'members' === $component ) {
|
177 |
-
$page_id = (int) $bp_page->id;
|
178 |
-
break;
|
179 |
-
}
|
180 |
-
}
|
181 |
-
|
182 |
-
// duplicate some logic from Walker_Page::start_el() to highlight menu items
|
183 |
-
if ( ! empty( $page_id ) ) {
|
184 |
-
$_bp_page = get_post( $page_id );
|
185 |
-
if ( in_array( $page->ID, $_bp_page->ancestors, true ) ) {
|
186 |
-
$retval[] = 'current_page_ancestor';
|
187 |
-
}
|
188 |
-
if ( $page->ID === $page_id ) {
|
189 |
-
$retval[] = 'current_page_item';
|
190 |
-
} elseif ( $_bp_page && $page->ID === $_bp_page->post_parent ) {
|
191 |
-
$retval[] = 'current_page_parent';
|
192 |
-
}
|
193 |
-
}
|
194 |
-
|
195 |
-
$retval = array_unique( $retval );
|
196 |
-
|
197 |
-
return $retval;
|
198 |
-
}
|
199 |
-
add_filter( 'page_css_class', 'bp_core_menu_highlight_parent_page', 10, 2 );
|
200 |
-
|
201 |
-
/**
|
202 |
-
* Adds current page CSS classes to the parent BP page in a WP Nav Menu.
|
203 |
-
*
|
204 |
-
* When {@link wp_nav_menu()} is used, this function helps to highlight the
|
205 |
-
* current BP parent page during nav menu generation.
|
206 |
-
*
|
207 |
-
* @since BuddyPress (2.2.0)
|
208 |
-
*
|
209 |
-
* @param array $retval CSS classes for the current nav menu item in the menu
|
210 |
-
* @param WP_Post $item The properties for the current nav menu item
|
211 |
-
* @return array
|
212 |
-
*/
|
213 |
-
function bp_core_menu_highlight_nav_menu_item( $retval, $item ) {
|
214 |
-
// If we're not on a BP page or if the current nav item is not a page, stop!
|
215 |
-
if ( ! is_buddypress() || 'page' !== $item->object ) {
|
216 |
-
return $retval;
|
217 |
-
}
|
218 |
-
|
219 |
-
// get the WP page
|
220 |
-
$page = get_post( $item->object_id );
|
221 |
-
|
222 |
-
// see if we should add our highlight CSS classes for the page
|
223 |
-
$retval = bp_core_menu_highlight_parent_page( $retval, $page );
|
224 |
-
|
225 |
-
return $retval;
|
226 |
-
}
|
227 |
-
add_filter( 'nav_menu_css_class', 'bp_core_menu_highlight_nav_menu_item', 10, 2 );
|
228 |
-
|
229 |
/**
|
230 |
* Set "From" name in outgoing email to the site name.
|
231 |
*
|
@@ -462,7 +375,7 @@ function bp_core_activation_signup_user_notification( $user, $user_email, $key,
|
|
462 |
* And the super admin goes in pending accounts to resend it. In this case, as the
|
463 |
* meta['password'] is not set, the activation url must be WordPress one
|
464 |
*/
|
465 |
-
}
|
466 |
$is_hashpass_in_meta = maybe_unserialize( $meta );
|
467 |
|
468 |
if ( empty( $is_hashpass_in_meta['password'] ) ) {
|
@@ -505,19 +418,17 @@ add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_not
|
|
505 |
* @see wp_title()
|
506 |
* @global object $bp BuddyPress global settings.
|
507 |
*
|
508 |
-
* @param
|
509 |
-
* @param
|
510 |
-
* @param
|
511 |
-
*
|
512 |
-
* @return string New page title.
|
513 |
*/
|
514 |
-
function bp_modify_page_title( $title
|
515 |
-
global $bp
|
516 |
|
517 |
// If this is not a BP page, just return the title produced by WP
|
518 |
-
if ( bp_is_blog_page() )
|
519 |
return $title;
|
520 |
-
}
|
521 |
|
522 |
// If this is a 404, let WordPress handle it
|
523 |
if ( is_404() ) {
|
@@ -525,172 +436,79 @@ function bp_modify_page_title( $title = '', $sep = '»', $seplocation = 'ri
|
|
525 |
}
|
526 |
|
527 |
// If this is the front page of the site, return WP's title
|
528 |
-
if ( is_front_page() || is_home() )
|
529 |
return $title;
|
530 |
-
}
|
531 |
|
532 |
-
|
533 |
-
if ( ! is_buddypress() ) {
|
534 |
-
return $title;
|
535 |
-
}
|
536 |
-
|
537 |
-
// Setup an empty title parts array
|
538 |
-
$title_parts = array();
|
539 |
-
|
540 |
-
// Is there a displayed user, and do they have a name?
|
541 |
-
$displayed_user_name = bp_get_displayed_user_fullname();
|
542 |
|
543 |
// Displayed user
|
544 |
-
if (
|
545 |
|
546 |
-
// Get the component's ID to try and get
|
547 |
$component_id = $component_name = bp_current_component();
|
548 |
|
549 |
-
//
|
550 |
-
$
|
|
|
551 |
|
552 |
-
//
|
553 |
-
|
554 |
-
$component_name =
|
555 |
-
|
556 |
-
// Fall back on the component ID
|
557 |
-
} elseif ( ! empty( $bp->{$component_id}->id ) ) {
|
558 |
-
$component_name = ucwords( $bp->{$component_id}->id );
|
559 |
}
|
560 |
|
561 |
-
//
|
562 |
-
|
563 |
-
$component_subnav_name = wp_filter_object_list( $bp->bp_options_nav[ $component_id ], array( 'slug' => bp_current_action() ), 'and', 'name' );
|
564 |
-
|
565 |
-
if ( ! empty( $component_subnav_name ) ) {
|
566 |
-
$component_subnav_name = array_shift( $component_subnav_name );
|
567 |
-
}
|
568 |
-
}
|
569 |
-
|
570 |
-
// If on the user profile's landing page, just use the fullname
|
571 |
-
if ( bp_is_current_component( $bp->default_component ) && ( bp_get_requested_url() === bp_displayed_user_domain() ) ) {
|
572 |
-
$title_parts[] = $displayed_user_name;
|
573 |
-
|
574 |
-
// Use component name on member pages
|
575 |
-
} else {
|
576 |
-
$title_parts = array_merge( $title_parts, array_map( 'strip_tags', array(
|
577 |
-
$displayed_user_name,
|
578 |
-
$component_name,
|
579 |
-
) ) );
|
580 |
-
|
581 |
-
// If we have a subnav name, add it separately for localization
|
582 |
-
if ( ! empty( $component_subnav_name ) ) {
|
583 |
-
$title_parts[] = strip_tags( $component_subnav_name );
|
584 |
-
}
|
585 |
-
}
|
586 |
|
587 |
// A single group
|
588 |
-
} elseif ( bp_is_active( 'groups' ) && !
|
589 |
-
$subnav
|
590 |
-
|
|
|
591 |
|
592 |
// A single item from a component other than groups
|
593 |
} elseif ( bp_is_single_item() ) {
|
594 |
-
|
|
|
595 |
|
596 |
// An index or directory
|
597 |
} elseif ( bp_is_directory() ) {
|
|
|
598 |
$current_component = bp_current_component();
|
599 |
|
600 |
// No current component (when does this happen?)
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
$
|
605 |
-
|
606 |
|
607 |
// Sign up page
|
608 |
} elseif ( bp_is_register_page() ) {
|
609 |
-
$
|
610 |
|
611 |
// Activation page
|
612 |
} elseif ( bp_is_activation_page() ) {
|
613 |
-
$
|
614 |
|
615 |
// Group creation page
|
616 |
} elseif ( bp_is_group_create() ) {
|
617 |
-
$
|
618 |
|
619 |
// Blog creation page
|
620 |
} elseif ( bp_is_create_blog() ) {
|
621 |
-
$
|
622 |
}
|
623 |
|
624 |
-
//
|
625 |
-
$
|
626 |
|
627 |
-
|
628 |
-
if ( 'right' == $seplocation ) {
|
629 |
-
$title_parts = array_reverse( $title_parts );
|
630 |
-
}
|
631 |
-
|
632 |
-
// Get the blog name, so we can check if the original $title included it
|
633 |
-
$blogname = get_bloginfo( 'name', 'display' );
|
634 |
-
|
635 |
-
/**
|
636 |
-
* Are we going to fake 'title-tag' theme functionality?
|
637 |
-
*
|
638 |
-
* @link https://buddypress.trac.wordpress.org/ticket/6107
|
639 |
-
* @see wp_title()
|
640 |
-
*/
|
641 |
-
$title_tag_compatibility = (bool) ( ! empty( $_wp_theme_features['title-tag'] ) || strstr( $title, $blogname ) );
|
642 |
-
|
643 |
-
// Append the site title to title parts if theme supports title tag
|
644 |
-
if ( true === $title_tag_compatibility ) {
|
645 |
-
$title_parts[] = $blogname;
|
646 |
-
|
647 |
-
if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
|
648 |
-
$title_parts[] = sprintf( __( 'Page %s', 'buddypress' ), max( $paged, $page ) );
|
649 |
-
}
|
650 |
-
}
|
651 |
-
|
652 |
-
// Pad the separator with 1 space on each side
|
653 |
-
$prefix = str_pad( $sep, strlen( $sep ) + 2, ' ', STR_PAD_BOTH );
|
654 |
-
|
655 |
-
// Join the parts together
|
656 |
-
$new_title = join( $prefix, array_filter( $title_parts ) );
|
657 |
-
|
658 |
-
// Append the prefix for pre `title-tag` compatibility
|
659 |
-
if ( false === $title_tag_compatibility ) {
|
660 |
-
$new_title = $new_title . $prefix;
|
661 |
-
}
|
662 |
-
|
663 |
-
/**
|
664 |
-
* @param string the BuddyPress page title
|
665 |
-
* @param string $title the original WordPress page title
|
666 |
-
* @param string $sep the title parts separator
|
667 |
-
* @param string $seplocation Location of the separator (left or right).
|
668 |
-
*/
|
669 |
-
return apply_filters( 'bp_modify_page_title', $new_title, $title, $sep, $seplocation );
|
670 |
}
|
671 |
-
add_filter( 'wp_title', 'bp_modify_page_title',
|
672 |
add_filter( 'bp_modify_page_title', 'wptexturize' );
|
673 |
add_filter( 'bp_modify_page_title', 'convert_chars' );
|
674 |
add_filter( 'bp_modify_page_title', 'esc_html' );
|
675 |
|
676 |
-
/**
|
677 |
-
* Strip span tags out of title part strings.
|
678 |
-
*
|
679 |
-
* This is a temporary function for compatibility with WordPress versions
|
680 |
-
* less than 4.0, and should be removed at a later date.
|
681 |
-
*
|
682 |
-
* @param string $title_part
|
683 |
-
* @return string
|
684 |
-
*/
|
685 |
-
function _bp_strip_spans_from_title( $title_part = '' ) {
|
686 |
-
$title = $title_part;
|
687 |
-
$span = strpos( $title, '<span' );
|
688 |
-
if ( false !== $span ) {
|
689 |
-
$title = substr( $title, 0, $span - 1 );
|
690 |
-
}
|
691 |
-
return $title;
|
692 |
-
}
|
693 |
-
|
694 |
/**
|
695 |
* Add BuddyPress-specific items to the wp_nav_menu.
|
696 |
*
|
@@ -706,7 +524,7 @@ function bp_setup_nav_menu_item( $menu_item ) {
|
|
706 |
|
707 |
// We use information stored in the CSS class to determine what kind of
|
708 |
// menu item this is, and how it should be treated
|
709 |
-
preg_match( '/\sbp-(.*)-nav/', implode( ' ', $menu_item->classes), $matches );
|
710 |
|
711 |
// If this isn't a BP menu item, we can stop here
|
712 |
if ( empty( $matches[1] ) ) {
|
@@ -785,25 +603,7 @@ add_filter( 'wp_setup_nav_menu_item', 'bp_setup_nav_menu_item', 10, 1 );
|
|
785 |
* @return string
|
786 |
*/
|
787 |
function bp_filter_metaid_column_name( $q ) {
|
788 |
-
|
789 |
-
* Replace quoted content with __QUOTE__ to avoid false positives.
|
790 |
-
* This regular expression will match nested quotes.
|
791 |
-
*/
|
792 |
-
$quoted_regex = "/'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'/s";
|
793 |
-
preg_match_all( $quoted_regex, $q, $quoted_matches );
|
794 |
-
$q = preg_replace( $quoted_regex, '__QUOTE__', $q );
|
795 |
-
|
796 |
-
$q = str_replace( 'meta_id', 'id', $q );
|
797 |
-
|
798 |
-
// Put quoted content back into the string.
|
799 |
-
if ( ! empty( $quoted_matches[0] ) ) {
|
800 |
-
for ( $i = 0; $i < count( $quoted_matches[0] ); $i++ ) {
|
801 |
-
$quote_pos = strpos( $q, '__QUOTE__' );
|
802 |
-
$q = substr_replace( $q, $quoted_matches[0][ $i ], $quote_pos, 9 );
|
803 |
-
}
|
804 |
-
}
|
805 |
-
|
806 |
-
return $q;
|
807 |
}
|
808 |
|
809 |
/**
|
@@ -811,8 +611,8 @@ function bp_filter_metaid_column_name( $q ) {
|
|
811 |
*
|
812 |
* @since BuddyPress (2.1.0)
|
813 |
*
|
814 |
-
* @param string $
|
815 |
-
* @param int $post_id
|
816 |
* @return mixed Will be a boolean (false) if $post_id is 0. Will be a string (the unchanged edit link)
|
817 |
* otherwise
|
818 |
*/
|
@@ -823,25 +623,3 @@ function bp_core_filter_edit_post_link( $edit_link = '', $post_id = 0 ) {
|
|
823 |
|
824 |
return $edit_link;
|
825 |
}
|
826 |
-
|
827 |
-
/**
|
828 |
-
* Should BuddyPress load the mentions scripts and related assets, including results to prime the
|
829 |
-
* mentions suggestions?
|
830 |
-
*
|
831 |
-
* @param bool $load_mentions True to load mentions assets, false otherwise.
|
832 |
-
* @param bool $mentions_enabled True if mentions are enabled.
|
833 |
-
* @return bool True if mentions scripts should be loaded.
|
834 |
-
* @since BuddyPress (2.2.0)
|
835 |
-
*/
|
836 |
-
function bp_maybe_load_mentions_scripts_for_blog_content( $load_mentions, $mentions_enabled ) {
|
837 |
-
if ( ! $mentions_enabled ) {
|
838 |
-
return $load_mentions;
|
839 |
-
}
|
840 |
-
|
841 |
-
if ( $load_mentions || ( bp_is_blog_page() && is_singular() && comments_open() ) ) {
|
842 |
-
return true;
|
843 |
-
}
|
844 |
-
|
845 |
-
return $load_mentions;
|
846 |
-
}
|
847 |
-
add_filter( 'bp_activity_maybe_load_mentions_scripts', 'bp_maybe_load_mentions_scripts_for_blog_content', 10, 2 );
|
21 |
*/
|
22 |
|
23 |
// Exit if accessed directly
|
24 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
25 |
|
26 |
/**
|
27 |
* Attach BuddyPress to WordPress.
|
63 |
add_filter( 'bp_template_include', 'bp_template_include_theme_compat', 4, 2 );
|
64 |
|
65 |
// Filter BuddyPress template locations
|
66 |
+
add_filter( 'bp_get_template_stack', 'bp_add_template_stack_locations' );
|
67 |
|
68 |
// Turn comments off for BuddyPress pages
|
69 |
add_filter( 'comments_open', 'bp_comments_open', 10, 2 );
|
139 |
}
|
140 |
add_filter( 'nav_menu_meta_box_object', 'bp_core_exclude_pages_from_nav_menu_admin', 11, 1 );
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
/**
|
143 |
* Set "From" name in outgoing email to the site name.
|
144 |
*
|
375 |
* And the super admin goes in pending accounts to resend it. In this case, as the
|
376 |
* meta['password'] is not set, the activation url must be WordPress one
|
377 |
*/
|
378 |
+
} else if ( buddypress()->members->admin->signups_page == get_current_screen()->id ) {
|
379 |
$is_hashpass_in_meta = maybe_unserialize( $meta );
|
380 |
|
381 |
if ( empty( $is_hashpass_in_meta['password'] ) ) {
|
418 |
* @see wp_title()
|
419 |
* @global object $bp BuddyPress global settings.
|
420 |
*
|
421 |
+
* @param string $title Original page title.
|
422 |
+
* @param string $sep How to separate the various items within the page title.
|
423 |
+
* @param string $seplocation Direction to display title.
|
424 |
+
* @return string New page title.
|
|
|
425 |
*/
|
426 |
+
function bp_modify_page_title( $title, $sep, $seplocation ) {
|
427 |
+
global $bp;
|
428 |
|
429 |
// If this is not a BP page, just return the title produced by WP
|
430 |
+
if ( bp_is_blog_page() )
|
431 |
return $title;
|
|
|
432 |
|
433 |
// If this is a 404, let WordPress handle it
|
434 |
if ( is_404() ) {
|
436 |
}
|
437 |
|
438 |
// If this is the front page of the site, return WP's title
|
439 |
+
if ( is_front_page() || is_home() )
|
440 |
return $title;
|
|
|
441 |
|
442 |
+
$title = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
|
444 |
// Displayed user
|
445 |
+
if ( bp_get_displayed_user_fullname() && !is_404() ) {
|
446 |
|
447 |
+
// Get the component's ID to try and get it's name
|
448 |
$component_id = $component_name = bp_current_component();
|
449 |
|
450 |
+
// Use the actual component name
|
451 |
+
if ( !empty( $bp->{$component_id}->name ) ) {
|
452 |
+
$component_name = $bp->{$component_id}->name;
|
453 |
|
454 |
+
// Fall back on the component ID (probably same as current_component)
|
455 |
+
} elseif ( !empty( $bp->{$component_id}->id ) ) {
|
456 |
+
$component_name = $bp->{$component_id}->id;
|
|
|
|
|
|
|
|
|
457 |
}
|
458 |
|
459 |
+
// Construct the page title. 1 = user name, 2 = seperator, 3 = component name
|
460 |
+
$title = strip_tags( sprintf( _x( '%1$s %3$s %2$s', 'Construct the page title. 1 = user name, 2 = component name, 3 = seperator', 'buddypress' ), bp_get_displayed_user_fullname(), ucwords( $component_name ), $sep ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
|
462 |
// A single group
|
463 |
+
} elseif ( bp_is_active( 'groups' ) && !empty( $bp->groups->current_group ) && !empty( $bp->bp_options_nav[$bp->groups->current_group->slug] ) ) {
|
464 |
+
$subnav = isset( $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name'] ) ? $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name'] : '';
|
465 |
+
// translators: "group name | group nav section name"
|
466 |
+
$title = sprintf( __( '%1$s | %2$s', 'buddypress' ), $bp->bp_options_title, $subnav );
|
467 |
|
468 |
// A single item from a component other than groups
|
469 |
} elseif ( bp_is_single_item() ) {
|
470 |
+
// translators: "component item name | component nav section name | root component name"
|
471 |
+
$title = sprintf( __( '%1$s | %2$s | %3$s', 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[bp_current_item()][bp_current_action()]['name'], bp_get_name_from_root_slug( bp_get_root_slug() ) );
|
472 |
|
473 |
// An index or directory
|
474 |
} elseif ( bp_is_directory() ) {
|
475 |
+
|
476 |
$current_component = bp_current_component();
|
477 |
|
478 |
// No current component (when does this happen?)
|
479 |
+
if ( empty( $current_component ) ) {
|
480 |
+
$title = _x( 'Directory', 'component directory title', 'buddypress' );
|
481 |
+
} else {
|
482 |
+
$title = bp_get_directory_title( $current_component );
|
483 |
+
}
|
484 |
|
485 |
// Sign up page
|
486 |
} elseif ( bp_is_register_page() ) {
|
487 |
+
$title = __( 'Create an Account', 'buddypress' );
|
488 |
|
489 |
// Activation page
|
490 |
} elseif ( bp_is_activation_page() ) {
|
491 |
+
$title = __( 'Activate your Account', 'buddypress' );
|
492 |
|
493 |
// Group creation page
|
494 |
} elseif ( bp_is_group_create() ) {
|
495 |
+
$title = __( 'Create a Group', 'buddypress' );
|
496 |
|
497 |
// Blog creation page
|
498 |
} elseif ( bp_is_create_blog() ) {
|
499 |
+
$title = __( 'Create a Site', 'buddypress' );
|
500 |
}
|
501 |
|
502 |
+
// Some BP nav items contain item counts. Remove them
|
503 |
+
$title = preg_replace( '|<span>[0-9]+</span>|', '', $title );
|
504 |
|
505 |
+
return apply_filters( 'bp_modify_page_title', $title . ' ' . $sep . ' ', $title, $sep, $seplocation );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
506 |
}
|
507 |
+
add_filter( 'wp_title', 'bp_modify_page_title', 10, 3 );
|
508 |
add_filter( 'bp_modify_page_title', 'wptexturize' );
|
509 |
add_filter( 'bp_modify_page_title', 'convert_chars' );
|
510 |
add_filter( 'bp_modify_page_title', 'esc_html' );
|
511 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
512 |
/**
|
513 |
* Add BuddyPress-specific items to the wp_nav_menu.
|
514 |
*
|
524 |
|
525 |
// We use information stored in the CSS class to determine what kind of
|
526 |
// menu item this is, and how it should be treated
|
527 |
+
$css_target = preg_match( '/\sbp-(.*)-nav/', implode( ' ', $menu_item->classes), $matches );
|
528 |
|
529 |
// If this isn't a BP menu item, we can stop here
|
530 |
if ( empty( $matches[1] ) ) {
|
603 |
* @return string
|
604 |
*/
|
605 |
function bp_filter_metaid_column_name( $q ) {
|
606 |
+
return str_replace( 'meta_id', 'id', $q );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
607 |
}
|
608 |
|
609 |
/**
|
611 |
*
|
612 |
* @since BuddyPress (2.1.0)
|
613 |
*
|
614 |
+
* @param string $link The edit link.
|
615 |
+
* @param int $post_id Post ID.
|
616 |
* @return mixed Will be a boolean (false) if $post_id is 0. Will be a string (the unchanged edit link)
|
617 |
* otherwise
|
618 |
*/
|
623 |
|
624 |
return $edit_link;
|
625 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp-core/bp-core-functions.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/** Versions ******************************************************************/
|
14 |
|
@@ -93,40 +93,39 @@ function bp_core_get_table_prefix() {
|
|
93 |
}
|
94 |
|
95 |
/**
|
96 |
-
* Sort an array of objects or arrays by a specific key/property.
|
|
|
|
|
|
|
|
|
97 |
*
|
98 |
* The main purpose for this function is so that you can avoid having to create
|
99 |
* your own awkward callback function for usort().
|
100 |
*
|
101 |
-
* @since BuddyPress (
|
102 |
*
|
103 |
-
* @param
|
104 |
-
*
|
105 |
-
* @param
|
106 |
-
* @return array
|
107 |
*/
|
108 |
-
function
|
109 |
usort( $items, create_function( '$a, $b', '
|
110 |
$values = array( 0 => false, 1 => false, );
|
111 |
$func_args = func_get_args();
|
112 |
foreach ( $func_args as $indexi => $index ) {
|
113 |
if ( isset( $index->' . $key . ' ) ) {
|
114 |
$values[ $indexi ] = $index->' . $key . ';
|
115 |
-
}
|
116 |
$values[ $indexi ] = $index["' . $key . '"];
|
117 |
}
|
118 |
}
|
119 |
|
120 |
-
if (
|
121 |
-
|
122 |
-
$cmp = $values[0] - $values[1];
|
123 |
-
} else {
|
124 |
-
$cmp = strcmp( $values[0], $values[1] );
|
125 |
-
}
|
126 |
-
|
127 |
if ( 0 > $cmp ) {
|
128 |
$retval = -1;
|
129 |
-
}
|
130 |
$retval = 1;
|
131 |
} else {
|
132 |
$retval = 0;
|
@@ -140,23 +139,6 @@ function bp_sort_by_key( $items, $key, $type = 'alpha' ) {
|
|
140 |
return $items;
|
141 |
}
|
142 |
|
143 |
-
/**
|
144 |
-
* Sort an array of objects or arrays by alphabetically sorting by a specific key/property.
|
145 |
-
*
|
146 |
-
* For instance, if you have an array of WordPress post objects, you can sort
|
147 |
-
* them by post_name as follows:
|
148 |
-
* $sorted_posts = bp_alpha_sort_by_key( $posts, 'post_name' );
|
149 |
-
*
|
150 |
-
* @since BuddyPress (1.9.0)
|
151 |
-
*
|
152 |
-
* @param array $items The items to be sorted. Its constituent items can be either associative arrays or objects.
|
153 |
-
* @param string|int $key The array index or property name to sort by.
|
154 |
-
* @return array $items The sorted array.
|
155 |
-
*/
|
156 |
-
function bp_alpha_sort_by_key( $items, $key ) {
|
157 |
-
return bp_sort_by_key( $items, $key, 'alpha' );
|
158 |
-
}
|
159 |
-
|
160 |
/**
|
161 |
* Format numbers the BuddyPress way.
|
162 |
*
|
@@ -267,35 +249,6 @@ function bp_parse_args( $args, $defaults = array(), $filter_key = '' ) {
|
|
267 |
return $r;
|
268 |
}
|
269 |
|
270 |
-
/**
|
271 |
-
* Sanitizes a pagination argument based on both the request override and the
|
272 |
-
* original value submitted via a query argument, likely to a template class
|
273 |
-
* responsible for limiting the resultset of a template loop.
|
274 |
-
*
|
275 |
-
* @since BuddyPress (2.2.0)
|
276 |
-
*
|
277 |
-
* @param string $page_arg The $_REQUEST argument to look for
|
278 |
-
* @param int $page The original page value to fall back to
|
279 |
-
* @return int A sanitized integer value, good for pagination
|
280 |
-
*/
|
281 |
-
function bp_sanitize_pagination_arg( $page_arg = '', $page = 1 ) {
|
282 |
-
|
283 |
-
// Check if request overrides exist
|
284 |
-
if ( isset( $_REQUEST[ $page_arg ] ) ) {
|
285 |
-
|
286 |
-
// Get the absolute integer value of the override
|
287 |
-
$int = absint( $_REQUEST[ $page_arg ] );
|
288 |
-
|
289 |
-
// If override is 0, do not use it. This prevents unlimited result sets.
|
290 |
-
// @see https://buddypress.trac.wordpress.org/ticket/5796
|
291 |
-
if ( $int ) {
|
292 |
-
$page = $int;
|
293 |
-
}
|
294 |
-
}
|
295 |
-
|
296 |
-
return intval( $page );
|
297 |
-
}
|
298 |
-
|
299 |
/**
|
300 |
* Sanitize an 'order' parameter for use in building SQL queries.
|
301 |
*
|
@@ -370,7 +323,7 @@ function bp_use_wp_admin_bar() {
|
|
370 |
// Default to true (to avoid loading deprecated BuddyBar code)
|
371 |
$use_admin_bar = true;
|
372 |
|
373 |
-
// Has the WP Toolbar constant been
|
374 |
if ( defined( 'BP_USE_WP_ADMIN_BAR' ) ) {
|
375 |
$use_admin_bar = (bool) BP_USE_WP_ADMIN_BAR;
|
376 |
|
@@ -418,36 +371,17 @@ function bp_core_get_packaged_component_ids() {
|
|
418 |
*
|
419 |
* @since BuddyPress (1.5.0)
|
420 |
*
|
421 |
-
* @param string $status 'active' to return only pages associated with active components, 'all' to return all saved
|
422 |
-
* pages. When running save routines, use 'all' to avoid removing data related to inactive
|
423 |
-
* components. Default: 'active'.
|
424 |
* @return array|string An array of page IDs, keyed by component names, or an
|
425 |
-
*
|
426 |
*/
|
427 |
-
function bp_core_get_directory_page_ids(
|
428 |
$page_ids = bp_get_option( 'bp-pages' );
|
429 |
|
430 |
// Ensure that empty indexes are unset. Should only matter in edge cases
|
431 |
if ( !empty( $page_ids ) && is_array( $page_ids ) ) {
|
432 |
foreach( (array) $page_ids as $component_name => $page_id ) {
|
433 |
if ( empty( $component_name ) || empty( $page_id ) ) {
|
434 |
-
unset( $page_ids[
|
435 |
-
}
|
436 |
-
|
437 |
-
// 'register' and 'activate' do not have components, but should be whitelisted.
|
438 |
-
if ( 'register' === $component_name || 'activate' === $component_name ) {
|
439 |
-
continue;
|
440 |
-
}
|
441 |
-
|
442 |
-
// Trashed pages should not appear in results.
|
443 |
-
if ( 'trash' == get_post_status( $page_id ) ) {
|
444 |
-
unset( $page_ids[ $component_name ] );
|
445 |
-
|
446 |
-
}
|
447 |
-
|
448 |
-
// Remove inactive component pages, if required.
|
449 |
-
if ( 'active' === $status && ! bp_is_active( $component_name ) ) {
|
450 |
-
unset( $page_ids[ $component_name ] );
|
451 |
}
|
452 |
}
|
453 |
}
|
@@ -558,7 +492,7 @@ function bp_core_add_page_mappings( $components, $existing = 'keep' ) {
|
|
558 |
switch_to_blog( bp_get_root_blog_id() );
|
559 |
}
|
560 |
|
561 |
-
$pages = bp_core_get_directory_page_ids(
|
562 |
|
563 |
// Delete any existing pages
|
564 |
if ( 'delete' === $existing ) {
|
@@ -632,34 +566,6 @@ function bp_core_add_page_mappings( $components, $existing = 'keep' ) {
|
|
632 |
}
|
633 |
}
|
634 |
|
635 |
-
/**
|
636 |
-
* Remove the entry from bp_pages when the corresponding WP page is deleted.
|
637 |
-
*
|
638 |
-
* Bails early on multisite installations when not viewing the root site.
|
639 |
-
* @link https://buddypress.trac.wordpress.org/ticket/6226
|
640 |
-
*
|
641 |
-
* @since BuddyPress (2.2.0)
|
642 |
-
*
|
643 |
-
* @param int $post_id Post ID.
|
644 |
-
*/
|
645 |
-
function bp_core_on_directory_page_delete( $post_id ) {
|
646 |
-
|
647 |
-
// Stop if we are not on the main BP root blog
|
648 |
-
if ( ! bp_is_root_blog() ) {
|
649 |
-
return;
|
650 |
-
}
|
651 |
-
|
652 |
-
$page_ids = bp_core_get_directory_page_ids( 'all' );
|
653 |
-
$component_name = array_search( $post_id, $page_ids );
|
654 |
-
|
655 |
-
if ( ! empty( $component_name ) ) {
|
656 |
-
unset( $page_ids[ $component_name ] );
|
657 |
-
}
|
658 |
-
|
659 |
-
bp_core_update_directory_page_ids( $page_ids );
|
660 |
-
}
|
661 |
-
add_action( 'delete_post', 'bp_core_on_directory_page_delete' );
|
662 |
-
|
663 |
/**
|
664 |
* Create a default component slug from a WP page root_slug.
|
665 |
*
|
@@ -755,7 +661,7 @@ function bp_core_create_root_component_page() {
|
|
755 |
) );
|
756 |
}
|
757 |
|
758 |
-
$page_ids = array_merge( (array) $new_page_ids, (array) bp_core_get_directory_page_ids(
|
759 |
bp_core_update_directory_page_ids( $page_ids );
|
760 |
}
|
761 |
|
@@ -805,7 +711,7 @@ function bp_do_register_theme_directory() {
|
|
805 |
/**
|
806 |
* Return the domain for the root blog.
|
807 |
*
|
808 |
-
* eg: http://
|
809 |
*
|
810 |
* @uses get_blog_option() WordPress function to fetch blog meta.
|
811 |
*
|
@@ -873,7 +779,7 @@ function bp_core_get_site_path() {
|
|
873 |
if ( count( $site_path ) < 2 ) {
|
874 |
$site_path = '/';
|
875 |
} else {
|
876 |
-
// Unset the first three segments (http(s)://
|
877 |
unset( $site_path[0] );
|
878 |
unset( $site_path[1] );
|
879 |
unset( $site_path[2] );
|
@@ -1375,7 +1281,7 @@ function bp_use_embed_in_activity() {
|
|
1375 |
}
|
1376 |
|
1377 |
/**
|
1378 |
-
* Are oembeds
|
1379 |
*
|
1380 |
* @since BuddyPress (1.5.0)
|
1381 |
*
|
@@ -1423,7 +1329,7 @@ function bp_use_embed_in_private_messages() {
|
|
1423 |
* @param string $scheme See {@link bp_get_admin_url()}.
|
1424 |
*/
|
1425 |
function bp_admin_url( $path = '', $scheme = 'admin' ) {
|
1426 |
-
echo
|
1427 |
}
|
1428 |
/**
|
1429 |
* Return the correct admin URL based on BuddyPress and WordPress configuration.
|
@@ -1794,23 +1700,17 @@ function bp_is_get_request() {
|
|
1794 |
* @return bool True on success, false on failure.
|
1795 |
*/
|
1796 |
function bp_core_load_buddypress_textdomain() {
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
foreach ( $locations as $location ) {
|
1807 |
-
if ( load_textdomain( 'buddypress', $location . $mofile_custom ) ) {
|
1808 |
-
return true;
|
1809 |
-
}
|
1810 |
-
}
|
1811 |
|
1812 |
-
|
1813 |
-
return load_plugin_textdomain( $domain );
|
1814 |
}
|
1815 |
add_action ( 'bp_core_loaded', 'bp_core_load_buddypress_textdomain' );
|
1816 |
|
@@ -1960,6 +1860,7 @@ function bp_nav_menu_get_loggedin_pages() {
|
|
1960 |
$page_args = array();
|
1961 |
|
1962 |
foreach ( $bp_menu_items as $bp_item ) {
|
|
|
1963 |
|
1964 |
// Remove <span>number</span>
|
1965 |
$item_name = preg_replace( '/([.0-9]+)/', '', $bp_item['name'] );
|
@@ -2098,7 +1999,7 @@ function bp_nav_menu_get_item_url( $slug ) {
|
|
2098 |
* @since BuddyPress (2.1.0)
|
2099 |
*/
|
2100 |
function bp_core_get_suggestions( $args ) {
|
2101 |
-
$args =
|
2102 |
|
2103 |
if ( ! $args['type'] ) {
|
2104 |
return new WP_Error( 'missing_parameter' );
|
@@ -2133,4 +2034,4 @@ function bp_core_get_suggestions( $args ) {
|
|
2133 |
}
|
2134 |
|
2135 |
return apply_filters( 'bp_core_get_suggestions', $retval, $args );
|
2136 |
-
}
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/** Versions ******************************************************************/
|
14 |
|
93 |
}
|
94 |
|
95 |
/**
|
96 |
+
* Sort an array of objects or arrays by alphabetically sorting by a specific key/property.
|
97 |
+
*
|
98 |
+
* For instance, if you have an array of WordPress post objects, you can sort
|
99 |
+
* them by post_name as follows:
|
100 |
+
* $sorted_posts = bp_alpha_sort_by_key( $posts, 'post_name' );
|
101 |
*
|
102 |
* The main purpose for this function is so that you can avoid having to create
|
103 |
* your own awkward callback function for usort().
|
104 |
*
|
105 |
+
* @since BuddyPress (1.9.0)
|
106 |
*
|
107 |
+
* @param array $items The array to be sorted. Its constituent items can be
|
108 |
+
* either associative arrays or objects.
|
109 |
+
* @param string|int $key The array index or property name to sort by.
|
110 |
+
* @return array $items The sorted array.
|
111 |
*/
|
112 |
+
function bp_alpha_sort_by_key( $items, $key ) {
|
113 |
usort( $items, create_function( '$a, $b', '
|
114 |
$values = array( 0 => false, 1 => false, );
|
115 |
$func_args = func_get_args();
|
116 |
foreach ( $func_args as $indexi => $index ) {
|
117 |
if ( isset( $index->' . $key . ' ) ) {
|
118 |
$values[ $indexi ] = $index->' . $key . ';
|
119 |
+
} else if ( isset( $index["' . $key . '"] ) ) {
|
120 |
$values[ $indexi ] = $index["' . $key . '"];
|
121 |
}
|
122 |
}
|
123 |
|
124 |
+
if ( $values[0] && $values[1] ) {
|
125 |
+
$cmp = strcmp( $values[0], $values[1] );
|
|
|
|
|
|
|
|
|
|
|
126 |
if ( 0 > $cmp ) {
|
127 |
$retval = -1;
|
128 |
+
} else if ( 0 < $cmp ) {
|
129 |
$retval = 1;
|
130 |
} else {
|
131 |
$retval = 0;
|
139 |
return $items;
|
140 |
}
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
/**
|
143 |
* Format numbers the BuddyPress way.
|
144 |
*
|
249 |
return $r;
|
250 |
}
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
/**
|
253 |
* Sanitize an 'order' parameter for use in building SQL queries.
|
254 |
*
|
323 |
// Default to true (to avoid loading deprecated BuddyBar code)
|
324 |
$use_admin_bar = true;
|
325 |
|
326 |
+
// Has the WP Toolbar constant been explicity opted into?
|
327 |
if ( defined( 'BP_USE_WP_ADMIN_BAR' ) ) {
|
328 |
$use_admin_bar = (bool) BP_USE_WP_ADMIN_BAR;
|
329 |
|
371 |
*
|
372 |
* @since BuddyPress (1.5.0)
|
373 |
*
|
|
|
|
|
|
|
374 |
* @return array|string An array of page IDs, keyed by component names, or an
|
375 |
+
* empty string if the list is not found.
|
376 |
*/
|
377 |
+
function bp_core_get_directory_page_ids() {
|
378 |
$page_ids = bp_get_option( 'bp-pages' );
|
379 |
|
380 |
// Ensure that empty indexes are unset. Should only matter in edge cases
|
381 |
if ( !empty( $page_ids ) && is_array( $page_ids ) ) {
|
382 |
foreach( (array) $page_ids as $component_name => $page_id ) {
|
383 |
if ( empty( $component_name ) || empty( $page_id ) ) {
|
384 |
+
unset( $page_ids[$component_name] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
}
|
386 |
}
|
387 |
}
|
492 |
switch_to_blog( bp_get_root_blog_id() );
|
493 |
}
|
494 |
|
495 |
+
$pages = bp_core_get_directory_page_ids();
|
496 |
|
497 |
// Delete any existing pages
|
498 |
if ( 'delete' === $existing ) {
|
566 |
}
|
567 |
}
|
568 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
/**
|
570 |
* Create a default component slug from a WP page root_slug.
|
571 |
*
|
661 |
) );
|
662 |
}
|
663 |
|
664 |
+
$page_ids = array_merge( (array) $new_page_ids, (array) bp_core_get_directory_page_ids() );
|
665 |
bp_core_update_directory_page_ids( $page_ids );
|
666 |
}
|
667 |
|
711 |
/**
|
712 |
* Return the domain for the root blog.
|
713 |
*
|
714 |
+
* eg: http://domain.com OR https://domain.com
|
715 |
*
|
716 |
* @uses get_blog_option() WordPress function to fetch blog meta.
|
717 |
*
|
779 |
if ( count( $site_path ) < 2 ) {
|
780 |
$site_path = '/';
|
781 |
} else {
|
782 |
+
// Unset the first three segments (http(s)://domain.com part)
|
783 |
unset( $site_path[0] );
|
784 |
unset( $site_path[1] );
|
785 |
unset( $site_path[2] );
|
1281 |
}
|
1282 |
|
1283 |
/**
|
1284 |
+
* Are oembeds allwoed in activity replies?
|
1285 |
*
|
1286 |
* @since BuddyPress (1.5.0)
|
1287 |
*
|
1329 |
* @param string $scheme See {@link bp_get_admin_url()}.
|
1330 |
*/
|
1331 |
function bp_admin_url( $path = '', $scheme = 'admin' ) {
|
1332 |
+
echo bp_get_admin_url( $path, $scheme );
|
1333 |
}
|
1334 |
/**
|
1335 |
* Return the correct admin URL based on BuddyPress and WordPress configuration.
|
1700 |
* @return bool True on success, false on failure.
|
1701 |
*/
|
1702 |
function bp_core_load_buddypress_textdomain() {
|
1703 |
+
// Try to load via load_plugin_textdomain() first, for future
|
1704 |
+
// wordpress.org translation downloads
|
1705 |
+
if ( load_plugin_textdomain( 'buddypress', false, 'buddypress/bp-languages' ) ) {
|
1706 |
+
return true;
|
1707 |
+
}
|
1708 |
+
|
1709 |
+
// Nothing found in bp-languages, so try to load from WP_LANG_DIR
|
1710 |
+
$locale = apply_filters( 'buddypress_locale', get_locale() );
|
1711 |
+
$mofile = WP_LANG_DIR . '/buddypress-' . $locale . '.mo';
|
|
|
|
|
|
|
|
|
|
|
1712 |
|
1713 |
+
return load_textdomain( 'buddypress', $mofile );
|
|
|
1714 |
}
|
1715 |
add_action ( 'bp_core_loaded', 'bp_core_load_buddypress_textdomain' );
|
1716 |
|
1860 |
$page_args = array();
|
1861 |
|
1862 |
foreach ( $bp_menu_items as $bp_item ) {
|
1863 |
+
$item_name = '';
|
1864 |
|
1865 |
// Remove <span>number</span>
|
1866 |
$item_name = preg_replace( '/([.0-9]+)/', '', $bp_item['name'] );
|
1999 |
* @since BuddyPress (2.1.0)
|
2000 |
*/
|
2001 |
function bp_core_get_suggestions( $args ) {
|
2002 |
+
$args = wp_parse_args( $args );
|
2003 |
|
2004 |
if ( ! $args['type'] ) {
|
2005 |
return new WP_Error( 'missing_parameter' );
|
2034 |
}
|
2035 |
|
2036 |
return apply_filters( 'bp_core_get_suggestions', $retval, $args );
|
2037 |
+
}
|
bp-core/bp-core-loader.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
-
defined( 'ABSPATH' )
|
14 |
|
15 |
class BP_Core extends BP_Component {
|
16 |
|
@@ -34,7 +34,7 @@ class BP_Core extends BP_Component {
|
|
34 |
/**
|
35 |
* Populate the global data needed before BuddyPress can continue.
|
36 |
*
|
37 |
-
* This involves figuring out the currently required,
|
38 |
* and optional components.
|
39 |
*
|
40 |
* @since BuddyPress (1.5.0)
|
@@ -251,21 +251,6 @@ class BP_Core extends BP_Component {
|
|
251 |
parent::setup_nav( $main_nav, $sub_nav );
|
252 |
}
|
253 |
}
|
254 |
-
|
255 |
-
/**
|
256 |
-
* Setup cache groups
|
257 |
-
*
|
258 |
-
* @since BuddyPress (2.2.0)
|
259 |
-
*/
|
260 |
-
public function setup_cache_groups() {
|
261 |
-
|
262 |
-
// Global groups
|
263 |
-
wp_cache_add_global_groups( array(
|
264 |
-
'bp'
|
265 |
-
) );
|
266 |
-
|
267 |
-
parent::setup_cache_groups();
|
268 |
-
}
|
269 |
}
|
270 |
|
271 |
/**
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
14 |
|
15 |
class BP_Core extends BP_Component {
|
16 |
|
34 |
/**
|
35 |
* Populate the global data needed before BuddyPress can continue.
|
36 |
*
|
37 |
+
* This involves figuring out the currently required, active, deactive,
|
38 |
* and optional components.
|
39 |
*
|
40 |
* @since BuddyPress (1.5.0)
|
251 |
parent::setup_nav( $main_nav, $sub_nav );
|
252 |
}
|
253 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
}
|
255 |
|
256 |
/**
|
bp-core/bp-core-moderation.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/** Moderation ****************************************************************/
|
14 |
|
@@ -31,19 +31,16 @@ defined( 'ABSPATH' ) || exit;
|
|
31 |
function bp_core_check_for_flood( $user_id = 0 ) {
|
32 |
|
33 |
// Option disabled. No flood checks.
|
34 |
-
if ( !$throttle_time = bp_get_option( '_bp_throttle_time' ) )
|
35 |
return true;
|
36 |
-
}
|
37 |
|
38 |
// Bail if no user ID passed
|
39 |
-
if ( empty( $user_id ) )
|
40 |
return false;
|
41 |
-
}
|
42 |
|
43 |
$last_posted = get_user_meta( $user_id, '_bp_last_posted', true );
|
44 |
-
if ( isset( $last_posted ) && ( time() < ( $last_posted + $throttle_time ) ) && !current_user_can( 'throttle' ) )
|
45 |
return false;
|
46 |
-
}
|
47 |
|
48 |
return true;
|
49 |
}
|
@@ -64,55 +61,56 @@ function bp_core_check_for_flood( $user_id = 0 ) {
|
|
64 |
*/
|
65 |
function bp_core_check_for_moderation( $user_id = 0, $title = '', $content = '' ) {
|
66 |
|
67 |
-
// Allow for moderation check to be skipped
|
68 |
-
if ( apply_filters( 'bp_bypass_check_for_moderation', false, $user_id, $title, $content ) ) {
|
69 |
-
return true;
|
70 |
-
}
|
71 |
-
|
72 |
// Bail if super admin is author
|
73 |
-
if ( is_super_admin( $user_id ) )
|
74 |
return true;
|
75 |
-
}
|
76 |
|
77 |
// Define local variable(s)
|
78 |
-
$
|
79 |
$match_out = '';
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
/** User Data *************************************************************/
|
82 |
|
83 |
-
if ( !
|
84 |
|
85 |
// Get author data
|
86 |
$user = get_userdata( $user_id );
|
87 |
|
88 |
// If data exists, map it
|
89 |
-
if ( !
|
90 |
-
$
|
91 |
-
$
|
92 |
-
$
|
93 |
}
|
94 |
}
|
95 |
|
96 |
// Current user IP and user agent
|
97 |
-
$
|
98 |
-
$
|
99 |
|
100 |
// Post title and content
|
101 |
-
$
|
102 |
-
$
|
103 |
|
104 |
/** Max Links *************************************************************/
|
105 |
|
106 |
$max_links = get_option( 'comment_max_links' );
|
107 |
-
if ( !
|
108 |
|
109 |
// How many links?
|
110 |
-
$num_links = preg_match_all( '/
|
111 |
|
112 |
// Allow for bumping the max to include the user's URL
|
113 |
-
|
114 |
-
$num_links = apply_filters( 'comment_max_links_url', $num_links, $_post['url'] );
|
115 |
-
}
|
116 |
|
117 |
// Das ist zu viele links!
|
118 |
if ( $num_links >= $max_links ) {
|
@@ -120,42 +118,33 @@ function bp_core_check_for_moderation( $user_id = 0, $title = '', $content = ''
|
|
120 |
}
|
121 |
}
|
122 |
|
123 |
-
/**
|
124 |
-
|
125 |
-
// Get the moderation keys
|
126 |
-
$blacklist = trim( get_option( 'moderation_keys' ) );
|
127 |
-
|
128 |
-
// Bail if blacklist is empty
|
129 |
-
if ( ! empty( $blacklist ) ) {
|
130 |
|
131 |
-
|
132 |
-
|
133 |
|
134 |
-
|
135 |
-
|
136 |
|
137 |
-
|
138 |
-
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
continue;
|
143 |
-
}
|
144 |
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
|
150 |
-
|
151 |
-
|
152 |
|
153 |
-
|
154 |
-
|
155 |
|
156 |
-
|
157 |
-
|
158 |
-
}
|
159 |
}
|
160 |
}
|
161 |
}
|
@@ -180,18 +169,12 @@ function bp_core_check_for_moderation( $user_id = 0, $title = '', $content = ''
|
|
180 |
*/
|
181 |
function bp_core_check_for_blacklist( $user_id = 0, $title = '', $content = '' ) {
|
182 |
|
183 |
-
// Allow for blacklist check to be skipped
|
184 |
-
if ( apply_filters( 'bp_bypass_check_for_blacklist', false, $user_id, $title, $content ) ) {
|
185 |
-
return true;
|
186 |
-
}
|
187 |
-
|
188 |
// Bail if super admin is author
|
189 |
-
if ( is_super_admin( $user_id ) )
|
190 |
return true;
|
191 |
-
}
|
192 |
|
193 |
// Define local variable
|
194 |
-
$
|
195 |
|
196 |
/** Blacklist *************************************************************/
|
197 |
|
@@ -199,33 +182,32 @@ function bp_core_check_for_blacklist( $user_id = 0, $title = '', $content = '' )
|
|
199 |
$blacklist = trim( get_option( 'blacklist_keys' ) );
|
200 |
|
201 |
// Bail if blacklist is empty
|
202 |
-
if ( empty( $blacklist ) )
|
203 |
return true;
|
204 |
-
}
|
205 |
|
206 |
/** User Data *************************************************************/
|
207 |
|
208 |
// Map current user data
|
209 |
-
if ( !
|
210 |
|
211 |
// Get author data
|
212 |
$user = get_userdata( $user_id );
|
213 |
|
214 |
// If data exists, map it
|
215 |
-
if ( !
|
216 |
-
$
|
217 |
-
$
|
218 |
-
$
|
219 |
}
|
220 |
}
|
221 |
|
222 |
// Current user IP and user agent
|
223 |
-
$
|
224 |
-
$
|
225 |
|
226 |
// Post title and content
|
227 |
-
$
|
228 |
-
$
|
229 |
|
230 |
/** Words *****************************************************************/
|
231 |
|
@@ -241,13 +223,12 @@ function bp_core_check_for_blacklist( $user_id = 0, $title = '', $content = '' )
|
|
241 |
// Skip empty lines
|
242 |
if ( empty( $word ) ) { continue; }
|
243 |
|
244 |
-
// Do some escaping magic so that '#' chars in the
|
245 |
-
// spam words don't break things:
|
246 |
$word = preg_quote( $word, '#' );
|
247 |
$pattern = "#$word#i";
|
248 |
|
249 |
// Loop through post data
|
250 |
-
foreach( $
|
251 |
|
252 |
// Check each user data for current word
|
253 |
if ( preg_match( $pattern, $post_data ) ) {
|
@@ -285,11 +266,10 @@ function bp_core_current_user_ip() {
|
|
285 |
function bp_core_current_user_ua() {
|
286 |
|
287 |
// Sanity check the user agent
|
288 |
-
if ( !
|
289 |
$retval = substr( $_SERVER['HTTP_USER_AGENT'], 0, 254 );
|
290 |
-
|
291 |
$retval = '';
|
292 |
-
}
|
293 |
|
294 |
return apply_filters( 'bp_core_current_user_ua', $retval );
|
295 |
}
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/** Moderation ****************************************************************/
|
14 |
|
31 |
function bp_core_check_for_flood( $user_id = 0 ) {
|
32 |
|
33 |
// Option disabled. No flood checks.
|
34 |
+
if ( !$throttle_time = bp_get_option( '_bp_throttle_time' ) )
|
35 |
return true;
|
|
|
36 |
|
37 |
// Bail if no user ID passed
|
38 |
+
if ( empty( $user_id ) )
|
39 |
return false;
|
|
|
40 |
|
41 |
$last_posted = get_user_meta( $user_id, '_bp_last_posted', true );
|
42 |
+
if ( isset( $last_posted ) && ( time() < ( $last_posted + $throttle_time ) ) && !current_user_can( 'throttle' ) )
|
43 |
return false;
|
|
|
44 |
|
45 |
return true;
|
46 |
}
|
61 |
*/
|
62 |
function bp_core_check_for_moderation( $user_id = 0, $title = '', $content = '' ) {
|
63 |
|
|
|
|
|
|
|
|
|
|
|
64 |
// Bail if super admin is author
|
65 |
+
if ( is_super_admin( $user_id ) )
|
66 |
return true;
|
|
|
67 |
|
68 |
// Define local variable(s)
|
69 |
+
$post = array();
|
70 |
$match_out = '';
|
71 |
|
72 |
+
/** Blacklist *************************************************************/
|
73 |
+
|
74 |
+
// Get the moderation keys
|
75 |
+
$blacklist = trim( get_option( 'moderation_keys' ) );
|
76 |
+
|
77 |
+
// Bail if blacklist is empty
|
78 |
+
if ( empty( $blacklist ) )
|
79 |
+
return true;
|
80 |
+
|
81 |
/** User Data *************************************************************/
|
82 |
|
83 |
+
if ( !empty( $user_id ) ) {
|
84 |
|
85 |
// Get author data
|
86 |
$user = get_userdata( $user_id );
|
87 |
|
88 |
// If data exists, map it
|
89 |
+
if ( !empty( $user ) ) {
|
90 |
+
$post['author'] = $user->display_name;
|
91 |
+
$post['email'] = $user->user_email;
|
92 |
+
$post['url'] = $user->user_url;
|
93 |
}
|
94 |
}
|
95 |
|
96 |
// Current user IP and user agent
|
97 |
+
$post['user_ip'] = bp_core_current_user_ip();
|
98 |
+
$post['user_ua'] = bp_core_current_user_ua();
|
99 |
|
100 |
// Post title and content
|
101 |
+
$post['title'] = $title;
|
102 |
+
$post['content'] = $content;
|
103 |
|
104 |
/** Max Links *************************************************************/
|
105 |
|
106 |
$max_links = get_option( 'comment_max_links' );
|
107 |
+
if ( !empty( $max_links ) ) {
|
108 |
|
109 |
// How many links?
|
110 |
+
$num_links = preg_match_all( '/<a [^>]*href/i', $content, $match_out );
|
111 |
|
112 |
// Allow for bumping the max to include the user's URL
|
113 |
+
$num_links = apply_filters( 'comment_max_links_url', $num_links, $post['url'] );
|
|
|
|
|
114 |
|
115 |
// Das ist zu viele links!
|
116 |
if ( $num_links >= $max_links ) {
|
118 |
}
|
119 |
}
|
120 |
|
121 |
+
/** Words *****************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
+
// Get words separated by new lines
|
124 |
+
$words = explode( "\n", $blacklist );
|
125 |
|
126 |
+
// Loop through words
|
127 |
+
foreach ( (array) $words as $word ) {
|
128 |
|
129 |
+
// Trim the whitespace from the word
|
130 |
+
$word = trim( $word );
|
131 |
|
132 |
+
// Skip empty lines
|
133 |
+
if ( empty( $word ) ) { continue; }
|
|
|
|
|
134 |
|
135 |
+
// Do some escaping magic so that '#' chars in the
|
136 |
+
// spam words don't break things:
|
137 |
+
$word = preg_quote( $word, '#' );
|
138 |
+
$pattern = "#$word#i";
|
139 |
|
140 |
+
// Loop through post data
|
141 |
+
foreach( $post as $post_data ) {
|
142 |
|
143 |
+
// Check each user data for current word
|
144 |
+
if ( preg_match( $pattern, $post_data ) ) {
|
145 |
|
146 |
+
// Post does not pass
|
147 |
+
return false;
|
|
|
148 |
}
|
149 |
}
|
150 |
}
|
169 |
*/
|
170 |
function bp_core_check_for_blacklist( $user_id = 0, $title = '', $content = '' ) {
|
171 |
|
|
|
|
|
|
|
|
|
|
|
172 |
// Bail if super admin is author
|
173 |
+
if ( is_super_admin( $user_id ) )
|
174 |
return true;
|
|
|
175 |
|
176 |
// Define local variable
|
177 |
+
$post = array();
|
178 |
|
179 |
/** Blacklist *************************************************************/
|
180 |
|
182 |
$blacklist = trim( get_option( 'blacklist_keys' ) );
|
183 |
|
184 |
// Bail if blacklist is empty
|
185 |
+
if ( empty( $blacklist ) )
|
186 |
return true;
|
|
|
187 |
|
188 |
/** User Data *************************************************************/
|
189 |
|
190 |
// Map current user data
|
191 |
+
if ( !empty( $user_id ) ) {
|
192 |
|
193 |
// Get author data
|
194 |
$user = get_userdata( $user_id );
|
195 |
|
196 |
// If data exists, map it
|
197 |
+
if ( !empty( $user ) ) {
|
198 |
+
$post['author'] = $user->display_name;
|
199 |
+
$post['email'] = $user->user_email;
|
200 |
+
$post['url'] = $user->user_url;
|
201 |
}
|
202 |
}
|
203 |
|
204 |
// Current user IP and user agent
|
205 |
+
$post['user_ip'] = bp_core_current_user_ip();
|
206 |
+
$post['user_ua'] = bp_core_current_user_ua();
|
207 |
|
208 |
// Post title and content
|
209 |
+
$post['title'] = $title;
|
210 |
+
$post['content'] = $content;
|
211 |
|
212 |
/** Words *****************************************************************/
|
213 |
|
223 |
// Skip empty lines
|
224 |
if ( empty( $word ) ) { continue; }
|
225 |
|
226 |
+
// Do some escaping magic so that '#' chars in the spam words don't break things:
|
|
|
227 |
$word = preg_quote( $word, '#' );
|
228 |
$pattern = "#$word#i";
|
229 |
|
230 |
// Loop through post data
|
231 |
+
foreach( $post as $post_data ) {
|
232 |
|
233 |
// Check each user data for current word
|
234 |
if ( preg_match( $pattern, $post_data ) ) {
|
266 |
function bp_core_current_user_ua() {
|
267 |
|
268 |
// Sanity check the user agent
|
269 |
+
if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) )
|
270 |
$retval = substr( $_SERVER['HTTP_USER_AGENT'], 0, 254 );
|
271 |
+
else
|
272 |
$retval = '';
|
|
|
273 |
|
274 |
return apply_filters( 'bp_core_current_user_ua', $retval );
|
275 |
}
|
bp-core/bp-core-options.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Get the default site options and their values.
|
@@ -435,7 +435,7 @@ function bp_core_get_root_options() {
|
|
435 |
/** Active? *******************************************************************/
|
436 |
|
437 |
/**
|
438 |
-
* Is profile
|
439 |
*
|
440 |
* @since BuddyPress (1.6.0)
|
441 |
*
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Get the default site options and their values.
|
435 |
/** Active? *******************************************************************/
|
436 |
|
437 |
/**
|
438 |
+
* Is profile sycing disabled?
|
439 |
*
|
440 |
* @since BuddyPress (1.6.0)
|
441 |
*
|
bp-core/bp-core-taxonomy.php
DELETED
@@ -1,81 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* BuddyPress taxonomy functions.
|
5 |
-
*
|
6 |
-
* Most BuddyPress taxonomy functions are wrappers for their WordPress counterparts.
|
7 |
-
* Because BuddyPress can be activated in various ways in a network environment, we
|
8 |
-
* must switch to the root blog before using the WP functions.
|
9 |
-
*
|
10 |
-
* @since BuddyPress (2.2.0)
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Register our default taxonomies.
|
15 |
-
*
|
16 |
-
* @since BuddyPress (2.2.0)
|
17 |
-
*/
|
18 |
-
function bp_register_default_taxonomies() {
|
19 |
-
// Member Type.
|
20 |
-
register_taxonomy( 'bp_member_type', 'user', array(
|
21 |
-
'public' => false,
|
22 |
-
) );
|
23 |
-
}
|
24 |
-
add_action( 'bp_register_taxonomies', 'bp_register_default_taxonomies' );
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Set taxonomy terms on a BuddyPress object.
|
28 |
-
*
|
29 |
-
* @since BuddyPress (2.2.0)
|
30 |
-
*
|
31 |
-
* @see wp_set_object_terms() for a full description of function and parameters.
|
32 |
-
*
|
33 |
-
* @param int $object_id Object ID.
|
34 |
-
* @param string|array $terms Term or terms to set.
|
35 |
-
* @param string $taxonomy Taxonomy name.
|
36 |
-
* @param bool $append Optional. True to append terms to existing terms. Default: false.
|
37 |
-
* @return array Array of term taxonomy IDs.
|
38 |
-
*/
|
39 |
-
function bp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
|
40 |
-
$is_root_blog = bp_is_root_blog();
|
41 |
-
|
42 |
-
if ( ! $is_root_blog ) {
|
43 |
-
switch_to_blog( bp_get_root_blog_id() );
|
44 |
-
}
|
45 |
-
|
46 |
-
$retval = wp_set_object_terms( $object_id, $terms, $taxonomy, $append );
|
47 |
-
|
48 |
-
if ( ! $is_root_blog ) {
|
49 |
-
restore_current_blog();
|
50 |
-
}
|
51 |
-
|
52 |
-
return $retval;
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Get taxonomy terms for a BuddyPress object.
|
57 |
-
*
|
58 |
-
* @since BuddyPress (2.2.0)
|
59 |
-
*
|
60 |
-
* @see wp_get_object_terms() for a full description of function and parameters.
|
61 |
-
*
|
62 |
-
* @param int|array $object_ids ID or IDs of objects.
|
63 |
-
* @param string|array $taxonomies Name or names of taxonomies to match.
|
64 |
-
* @param array $args See {@see wp_get_object_terms()}.
|
65 |
-
* @return array
|
66 |
-
*/
|
67 |
-
function bp_get_object_terms( $object_ids, $taxonomies, $args = array() ) {
|
68 |
-
$is_root_blog = bp_is_root_blog();
|
69 |
-
|
70 |
-
if ( ! $is_root_blog ) {
|
71 |
-
switch_to_blog( bp_get_root_blog_id() );
|
72 |
-
}
|
73 |
-
|
74 |
-
$retval = wp_get_object_terms( $object_ids, $taxonomies, $args );
|
75 |
-
|
76 |
-
if ( ! $is_root_blog ) {
|
77 |
-
restore_current_blog();
|
78 |
-
}
|
79 |
-
|
80 |
-
return $retval;
|
81 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp-core/bp-core-template-loader.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
-
defined( 'ABSPATH' )
|
16 |
|
17 |
/**
|
18 |
* Get a BuddyPress template part for display in a theme.
|
@@ -36,9 +36,8 @@ function bp_get_template_part( $slug, $name = null ) {
|
|
36 |
|
37 |
// Setup possible parts
|
38 |
$templates = array();
|
39 |
-
if ( isset( $name ) )
|
40 |
$templates[] = $slug . '-' . $name . '.php';
|
41 |
-
}
|
42 |
$templates[] = $slug . '.php';
|
43 |
|
44 |
// Allow template parts to be filtered
|
@@ -74,9 +73,8 @@ function bp_locate_template( $template_names, $load = false, $require_once = tru
|
|
74 |
foreach ( (array) $template_names as $template_name ) {
|
75 |
|
76 |
// Continue if template is empty
|
77 |
-
if ( empty( $template_name ) )
|
78 |
continue;
|
79 |
-
}
|
80 |
|
81 |
// Trim off any slashes from the template name
|
82 |
$template_name = ltrim( $template_name, '/' );
|
@@ -85,9 +83,8 @@ function bp_locate_template( $template_names, $load = false, $require_once = tru
|
|
85 |
foreach ( (array) $template_locations as $template_location ) {
|
86 |
|
87 |
// Continue if $template_location is empty
|
88 |
-
if ( empty( $template_location ) )
|
89 |
continue;
|
90 |
-
}
|
91 |
|
92 |
// Check child theme first
|
93 |
if ( file_exists( trailingslashit( $template_location ) . $template_name ) ) {
|
@@ -274,9 +271,8 @@ function bp_buffer_template_part( $slug, $name = null, $echo = true ) {
|
|
274 |
function bp_get_query_template( $type, $templates = array() ) {
|
275 |
$type = preg_replace( '|[^a-z0-9-]+|', '', $type );
|
276 |
|
277 |
-
if ( empty( $templates ) )
|
278 |
$templates = array( "{$type}.php" );
|
279 |
-
}
|
280 |
|
281 |
// Filter possible templates, try to match one, and set any BuddyPress theme
|
282 |
// compat properties so they can be cross-checked later.
|
@@ -319,11 +315,9 @@ function bp_add_template_stack_locations( $stacks = array() ) {
|
|
319 |
$locations = bp_get_template_locations();
|
320 |
|
321 |
// Loop through locations and stacks and combine
|
322 |
-
foreach ( (array) $stacks as $stack )
|
323 |
-
foreach ( (array) $locations as $custom_location )
|
324 |
$retval[] = untrailingslashit( trailingslashit( $stack ) . $custom_location );
|
325 |
-
}
|
326 |
-
}
|
327 |
|
328 |
return apply_filters( 'bp_add_template_stack_locations', array_unique( $retval ), $stacks );
|
329 |
}
|
@@ -338,19 +332,16 @@ function bp_add_template_stack_locations( $stacks = array() ) {
|
|
338 |
function bp_parse_query( $posts_query ) {
|
339 |
|
340 |
// Bail if $posts_query is not the main loop
|
341 |
-
if ( ! $posts_query->is_main_query() )
|
342 |
return;
|
343 |
-
}
|
344 |
|
345 |
// Bail if filters are suppressed on this query
|
346 |
-
if ( true == $posts_query->get( 'suppress_filters' ) )
|
347 |
return;
|
348 |
-
}
|
349 |
|
350 |
// Bail if in admin
|
351 |
-
if ( is_admin() )
|
352 |
return;
|
353 |
-
}
|
354 |
|
355 |
// Allow BuddyPress components to parse the main query
|
356 |
do_action_ref_array( 'bp_parse_query', array( &$posts_query ) );
|
@@ -378,7 +369,7 @@ function bp_template_include_theme_supports( $template = '' ) {
|
|
378 |
|
379 |
// A BuddyPress template file was located, so override the WordPress
|
380 |
// template and use it to switch off BuddyPress's theme compatibility.
|
381 |
-
if ( !
|
382 |
$template = bp_set_template_included( $new_template );
|
383 |
}
|
384 |
|
@@ -426,9 +417,8 @@ function bp_load_theme_functions() {
|
|
426 |
}
|
427 |
|
428 |
// Do not include on BuddyPress deactivation
|
429 |
-
if ( bp_is_deactivation() )
|
430 |
return;
|
431 |
-
}
|
432 |
|
433 |
// If the $wp_query global is empty (the main query has not been run,
|
434 |
// or has been reset), load_template() will fail at setting certain
|
@@ -452,7 +442,7 @@ function bp_load_theme_functions() {
|
|
452 |
* @return array Array of possible root level wrapper template files.
|
453 |
*/
|
454 |
function bp_get_theme_compat_templates() {
|
455 |
-
|
456 |
'plugin-buddypress.php',
|
457 |
'buddypress.php',
|
458 |
'community.php',
|
@@ -460,5 +450,6 @@ function bp_get_theme_compat_templates() {
|
|
460 |
'page.php',
|
461 |
'single.php',
|
462 |
'index.php'
|
463 |
-
)
|
|
|
464 |
}
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
16 |
|
17 |
/**
|
18 |
* Get a BuddyPress template part for display in a theme.
|
36 |
|
37 |
// Setup possible parts
|
38 |
$templates = array();
|
39 |
+
if ( isset( $name ) )
|
40 |
$templates[] = $slug . '-' . $name . '.php';
|
|
|
41 |
$templates[] = $slug . '.php';
|
42 |
|
43 |
// Allow template parts to be filtered
|
73 |
foreach ( (array) $template_names as $template_name ) {
|
74 |
|
75 |
// Continue if template is empty
|
76 |
+
if ( empty( $template_name ) )
|
77 |
continue;
|
|
|
78 |
|
79 |
// Trim off any slashes from the template name
|
80 |
$template_name = ltrim( $template_name, '/' );
|
83 |
foreach ( (array) $template_locations as $template_location ) {
|
84 |
|
85 |
// Continue if $template_location is empty
|
86 |
+
if ( empty( $template_location ) )
|
87 |
continue;
|
|
|
88 |
|
89 |
// Check child theme first
|
90 |
if ( file_exists( trailingslashit( $template_location ) . $template_name ) ) {
|
271 |
function bp_get_query_template( $type, $templates = array() ) {
|
272 |
$type = preg_replace( '|[^a-z0-9-]+|', '', $type );
|
273 |
|
274 |
+
if ( empty( $templates ) )
|
275 |
$templates = array( "{$type}.php" );
|
|
|
276 |
|
277 |
// Filter possible templates, try to match one, and set any BuddyPress theme
|
278 |
// compat properties so they can be cross-checked later.
|
315 |
$locations = bp_get_template_locations();
|
316 |
|
317 |
// Loop through locations and stacks and combine
|
318 |
+
foreach ( (array) $stacks as $stack )
|
319 |
+
foreach ( (array) $locations as $custom_location )
|
320 |
$retval[] = untrailingslashit( trailingslashit( $stack ) . $custom_location );
|
|
|
|
|
321 |
|
322 |
return apply_filters( 'bp_add_template_stack_locations', array_unique( $retval ), $stacks );
|
323 |
}
|
332 |
function bp_parse_query( $posts_query ) {
|
333 |
|
334 |
// Bail if $posts_query is not the main loop
|
335 |
+
if ( ! $posts_query->is_main_query() )
|
336 |
return;
|
|
|
337 |
|
338 |
// Bail if filters are suppressed on this query
|
339 |
+
if ( true == $posts_query->get( 'suppress_filters' ) )
|
340 |
return;
|
|
|
341 |
|
342 |
// Bail if in admin
|
343 |
+
if ( is_admin() )
|
344 |
return;
|
|
|
345 |
|
346 |
// Allow BuddyPress components to parse the main query
|
347 |
do_action_ref_array( 'bp_parse_query', array( &$posts_query ) );
|
369 |
|
370 |
// A BuddyPress template file was located, so override the WordPress
|
371 |
// template and use it to switch off BuddyPress's theme compatibility.
|
372 |
+
if ( !empty( $new_template ) ) {
|
373 |
$template = bp_set_template_included( $new_template );
|
374 |
}
|
375 |
|
417 |
}
|
418 |
|
419 |
// Do not include on BuddyPress deactivation
|
420 |
+
if ( bp_is_deactivation() )
|
421 |
return;
|
|
|
422 |
|
423 |
// If the $wp_query global is empty (the main query has not been run,
|
424 |
// or has been reset), load_template() will fail at setting certain
|
442 |
* @return array Array of possible root level wrapper template files.
|
443 |
*/
|
444 |
function bp_get_theme_compat_templates() {
|
445 |
+
$templates = array(
|
446 |
'plugin-buddypress.php',
|
447 |
'buddypress.php',
|
448 |
'community.php',
|
450 |
'page.php',
|
451 |
'single.php',
|
452 |
'index.php'
|
453 |
+
);
|
454 |
+
return bp_get_query_template( 'buddypress', $templates );
|
455 |
}
|
bp-core/bp-core-template.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/**
|
13 |
* Output the "options nav", the secondary-level single item navigation menu.
|
@@ -26,13 +26,12 @@ defined( 'ABSPATH' ) || exit;
|
|
26 |
* @uses bp_get_user_nav() Renders the navigation for a profile of a currently
|
27 |
* viewed user.
|
28 |
*/
|
29 |
-
function bp_get_options_nav(
|
30 |
$bp = buddypress();
|
31 |
|
32 |
// If we are looking at a member profile, then the we can use the current
|
33 |
// component as an index. Otherwise we need to use the component's root_slug
|
34 |
$component_index = !empty( $bp->displayed_user ) ? bp_current_component() : bp_get_root_slug( bp_current_component() );
|
35 |
-
$selected_item = bp_current_action();
|
36 |
|
37 |
if ( ! bp_is_single_item() ) {
|
38 |
if ( !isset( $bp->bp_options_nav[$component_index] ) || count( $bp->bp_options_nav[$component_index] ) < 1 ) {
|
@@ -41,17 +40,10 @@ function bp_get_options_nav( $parent_slug = '' ) {
|
|
41 |
$the_index = $component_index;
|
42 |
}
|
43 |
} else {
|
44 |
-
$
|
45 |
-
|
46 |
-
if ( ! empty( $parent_slug ) ) {
|
47 |
-
$current_item = $parent_slug;
|
48 |
-
$selected_item = bp_action_variable( 0 );
|
49 |
-
}
|
50 |
-
|
51 |
-
if ( !isset( $bp->bp_options_nav[$current_item] ) || count( $bp->bp_options_nav[$current_item] ) < 1 ) {
|
52 |
return false;
|
53 |
} else {
|
54 |
-
$the_index =
|
55 |
}
|
56 |
}
|
57 |
|
@@ -62,7 +54,7 @@ function bp_get_options_nav( $parent_slug = '' ) {
|
|
62 |
}
|
63 |
|
64 |
// If the current action or an action variable matches the nav item id, then add a highlight CSS class.
|
65 |
-
if ( $subnav_item['slug'] ==
|
66 |
$selected = ' class="current selected"';
|
67 |
} else {
|
68 |
$selected = '';
|
@@ -72,7 +64,7 @@ function bp_get_options_nav( $parent_slug = '' ) {
|
|
72 |
$list_type = bp_is_group() ? 'groups' : 'personal';
|
73 |
|
74 |
// echo out the final list item
|
75 |
-
echo apply_filters( 'bp_get_options_nav_' . $subnav_item['css_id'], '<li id="' . $subnav_item['css_id'] . '-' . $list_type . '-li" ' . $selected . '><a id="' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>', $subnav_item
|
76 |
}
|
77 |
}
|
78 |
|
@@ -491,80 +483,6 @@ function bp_custom_profile_sidebar_boxes() {
|
|
491 |
do_action( 'bp_custom_profile_sidebar_boxes' );
|
492 |
}
|
493 |
|
494 |
-
/**
|
495 |
-
* Output the attributes for a form field.
|
496 |
-
*
|
497 |
-
* @since BuddyPress (2.2.0)
|
498 |
-
*
|
499 |
-
* @param string $name The field name to output attributes for.
|
500 |
-
* @param array $attributes Array of existing attributes to add.
|
501 |
-
*/
|
502 |
-
function bp_form_field_attributes( $name = '', $attributes = array() ) {
|
503 |
-
echo bp_get_form_field_attributes( $name, $attributes );
|
504 |
-
}
|
505 |
-
/**
|
506 |
-
* Get the attributes for a form field.
|
507 |
-
*
|
508 |
-
* Primarily to add better support for touchscreen devices, but plugin devs
|
509 |
-
* can use the 'bp_get_form_field_extra_attributes' filter for further
|
510 |
-
* manipulation.
|
511 |
-
*
|
512 |
-
* @since BuddyPress (2.2.0)
|
513 |
-
*
|
514 |
-
* @param string $name The field name to get attributes for.
|
515 |
-
* @param array $attributes Array of existing attributes to add.
|
516 |
-
* @return string
|
517 |
-
*/
|
518 |
-
function bp_get_form_field_attributes( $name = '', $attributes = array() ) {
|
519 |
-
$retval = '';
|
520 |
-
|
521 |
-
if ( empty( $attributes ) ) {
|
522 |
-
$attributes = array();
|
523 |
-
}
|
524 |
-
|
525 |
-
$name = strtolower( $name );
|
526 |
-
|
527 |
-
switch ( $name ) {
|
528 |
-
case 'username' :
|
529 |
-
case 'blogname' :
|
530 |
-
$attributes['autocomplete'] = 'off';
|
531 |
-
$attributes['autocapitalize'] = 'none';
|
532 |
-
break;
|
533 |
-
|
534 |
-
case 'email' :
|
535 |
-
if ( wp_is_mobile() ) {
|
536 |
-
$attributes['autocapitalize'] = 'none';
|
537 |
-
}
|
538 |
-
break;
|
539 |
-
|
540 |
-
case 'password' :
|
541 |
-
$attributes['spellcheck'] = 'false';
|
542 |
-
$attributes['autocomplete'] = 'off';
|
543 |
-
|
544 |
-
if ( wp_is_mobile() ) {
|
545 |
-
$attributes['autocorrect'] = 'false';
|
546 |
-
$attributes['autocapitalize'] = 'none';
|
547 |
-
}
|
548 |
-
break;
|
549 |
-
}
|
550 |
-
|
551 |
-
/**
|
552 |
-
* Filter the attributes for a field before rendering output.
|
553 |
-
*
|
554 |
-
* @since BuddyPress (2.2.0)
|
555 |
-
*
|
556 |
-
* @param array $attributes The field attributes
|
557 |
-
* @param string $name The field name
|
558 |
-
*/
|
559 |
-
$attributes = (array) apply_filters( 'bp_get_form_field_attributes', $attributes, $name );
|
560 |
-
|
561 |
-
foreach( $attributes as $attr => $value ) {
|
562 |
-
$retval .= sprintf( ' %s="%s"', sanitize_key( $attr ), esc_attr( $value ) );
|
563 |
-
}
|
564 |
-
|
565 |
-
return $retval;
|
566 |
-
}
|
567 |
-
|
568 |
/**
|
569 |
* Create and output a button.
|
570 |
*
|
@@ -1163,9 +1081,9 @@ function bp_loggedin_user_id() {
|
|
1163 |
* @param string $component Name of the component being checked.
|
1164 |
* @return bool Returns true if the component matches, or else false.
|
1165 |
*/
|
1166 |
-
function bp_is_current_component( $component
|
|
|
1167 |
|
1168 |
-
// Default is no match. We'll check a few places for matches
|
1169 |
$is_current_component = false;
|
1170 |
|
1171 |
// Always return false if a null value is passed to the function
|
@@ -1180,7 +1098,6 @@ function bp_is_current_component( $component = '' ) {
|
|
1180 |
|
1181 |
$bp = buddypress();
|
1182 |
|
1183 |
-
// Only check if BuddyPress found a current_component
|
1184 |
if ( ! empty( $bp->current_component ) ) {
|
1185 |
|
1186 |
// First, check to see whether $component_name and the current
|
@@ -1221,6 +1138,21 @@ function bp_is_current_component( $component = '' ) {
|
|
1221 |
}
|
1222 |
}
|
1223 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1224 |
}
|
1225 |
|
1226 |
return apply_filters( 'bp_is_current_component', $is_current_component, $component );
|
@@ -1369,8 +1301,8 @@ function bp_is_directory() {
|
|
1369 |
/**
|
1370 |
* Check to see if a component's URL should be in the root, not under a member page.
|
1371 |
*
|
1372 |
-
* - Yes ('groups' is root) : http://
|
1373 |
-
* - No ('groups' is not-root): http://
|
1374 |
*
|
1375 |
* This function is on the chopping block. It's currently only used by a few
|
1376 |
* already deprecated functions.
|
@@ -1999,7 +1931,7 @@ function bp_is_group() {
|
|
1999 |
if ( ! empty( $retval ) ) {
|
2000 |
$retval = bp_is_groups_component() && groups_get_current_group();
|
2001 |
}
|
2002 |
-
|
2003 |
return (bool) $retval;
|
2004 |
}
|
2005 |
|
@@ -2428,10 +2360,6 @@ function bp_the_body_class() {
|
|
2428 |
|
2429 |
/** Groups ************************************************************/
|
2430 |
|
2431 |
-
if ( bp_is_group() ) {
|
2432 |
-
$bp_classes[] = 'group-' . groups_get_current_group()->slug;
|
2433 |
-
}
|
2434 |
-
|
2435 |
if ( bp_is_group_leave() ) {
|
2436 |
$bp_classes[] = 'leave-group';
|
2437 |
}
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/**
|
13 |
* Output the "options nav", the secondary-level single item navigation menu.
|
26 |
* @uses bp_get_user_nav() Renders the navigation for a profile of a currently
|
27 |
* viewed user.
|
28 |
*/
|
29 |
+
function bp_get_options_nav() {
|
30 |
$bp = buddypress();
|
31 |
|
32 |
// If we are looking at a member profile, then the we can use the current
|
33 |
// component as an index. Otherwise we need to use the component's root_slug
|
34 |
$component_index = !empty( $bp->displayed_user ) ? bp_current_component() : bp_get_root_slug( bp_current_component() );
|
|
|
35 |
|
36 |
if ( ! bp_is_single_item() ) {
|
37 |
if ( !isset( $bp->bp_options_nav[$component_index] ) || count( $bp->bp_options_nav[$component_index] ) < 1 ) {
|
40 |
$the_index = $component_index;
|
41 |
}
|
42 |
} else {
|
43 |
+
if ( !isset( $bp->bp_options_nav[bp_current_item()] ) || count( $bp->bp_options_nav[bp_current_item()] ) < 1 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
return false;
|
45 |
} else {
|
46 |
+
$the_index = bp_current_item();
|
47 |
}
|
48 |
}
|
49 |
|
54 |
}
|
55 |
|
56 |
// If the current action or an action variable matches the nav item id, then add a highlight CSS class.
|
57 |
+
if ( $subnav_item['slug'] == bp_current_action() ) {
|
58 |
$selected = ' class="current selected"';
|
59 |
} else {
|
60 |
$selected = '';
|
64 |
$list_type = bp_is_group() ? 'groups' : 'personal';
|
65 |
|
66 |
// echo out the final list item
|
67 |
+
echo apply_filters( 'bp_get_options_nav_' . $subnav_item['css_id'], '<li id="' . $subnav_item['css_id'] . '-' . $list_type . '-li" ' . $selected . '><a id="' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>', $subnav_item );
|
68 |
}
|
69 |
}
|
70 |
|
483 |
do_action( 'bp_custom_profile_sidebar_boxes' );
|
484 |
}
|
485 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
/**
|
487 |
* Create and output a button.
|
488 |
*
|
1081 |
* @param string $component Name of the component being checked.
|
1082 |
* @return bool Returns true if the component matches, or else false.
|
1083 |
*/
|
1084 |
+
function bp_is_current_component( $component ) {
|
1085 |
+
global $wp_query;
|
1086 |
|
|
|
1087 |
$is_current_component = false;
|
1088 |
|
1089 |
// Always return false if a null value is passed to the function
|
1098 |
|
1099 |
$bp = buddypress();
|
1100 |
|
|
|
1101 |
if ( ! empty( $bp->current_component ) ) {
|
1102 |
|
1103 |
// First, check to see whether $component_name and the current
|
1138 |
}
|
1139 |
}
|
1140 |
}
|
1141 |
+
|
1142 |
+
// Page template fallback check if $bp->current_component is empty
|
1143 |
+
} elseif ( !is_admin() && is_a( $wp_query, 'WP_Query' ) && is_page() ) {
|
1144 |
+
global $wp_query;
|
1145 |
+
|
1146 |
+
$page = $wp_query->get_queried_object();
|
1147 |
+
if ( isset( $page->ID ) ) {
|
1148 |
+
$custom_fields = get_post_custom_values( '_wp_page_template', $page->ID );
|
1149 |
+
$page_template = $custom_fields[0];
|
1150 |
+
|
1151 |
+
// Component name is in the page template name
|
1152 |
+
if ( !empty( $page_template ) && strstr( strtolower( $page_template ), strtolower( $component ) ) ) {
|
1153 |
+
$is_current_component = true;
|
1154 |
+
}
|
1155 |
+
}
|
1156 |
}
|
1157 |
|
1158 |
return apply_filters( 'bp_is_current_component', $is_current_component, $component );
|
1301 |
/**
|
1302 |
* Check to see if a component's URL should be in the root, not under a member page.
|
1303 |
*
|
1304 |
+
* - Yes ('groups' is root) : http://domain.com/groups/the-group
|
1305 |
+
* - No ('groups' is not-root): http://domain.com/members/andy/groups/the-group
|
1306 |
*
|
1307 |
* This function is on the chopping block. It's currently only used by a few
|
1308 |
* already deprecated functions.
|
1931 |
if ( ! empty( $retval ) ) {
|
1932 |
$retval = bp_is_groups_component() && groups_get_current_group();
|
1933 |
}
|
1934 |
+
|
1935 |
return (bool) $retval;
|
1936 |
}
|
1937 |
|
2360 |
|
2361 |
/** Groups ************************************************************/
|
2362 |
|
|
|
|
|
|
|
|
|
2363 |
if ( bp_is_group_leave() ) {
|
2364 |
$bp_classes[] = 'leave-group';
|
2365 |
}
|
bp-core/bp-core-theme-compatibility.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/** Theme Compat **************************************************************/
|
14 |
|
@@ -68,7 +68,7 @@ class BP_Theme_Compat {
|
|
68 |
/**
|
69 |
* Set up the BuddyPress-specific theme compat methods.
|
70 |
*
|
71 |
-
* Themes
|
72 |
*
|
73 |
* @since BuddyPress (1.7.0)
|
74 |
*/
|
@@ -155,7 +155,7 @@ function bp_setup_theme_compat( $theme = '' ) {
|
|
155 |
* Get the ID of the theme package being used.
|
156 |
*
|
157 |
* This can be filtered or set manually. Tricky theme authors can override the
|
158 |
-
* default and include their own BuddyPress
|
159 |
*
|
160 |
* @since BuddyPress (1.7.0)
|
161 |
*
|
@@ -171,7 +171,7 @@ function bp_get_theme_compat_id() {
|
|
171 |
* Get the name of the theme package being used.
|
172 |
*
|
173 |
* This can be filtered or set manually. Tricky theme authors can override the
|
174 |
-
* default and include their own BuddyPress
|
175 |
*
|
176 |
* @since BuddyPress (1.7.0)
|
177 |
*
|
@@ -187,7 +187,7 @@ function bp_get_theme_compat_name() {
|
|
187 |
* Get the version of the theme package being used.
|
188 |
*
|
189 |
* This can be filtered or set manually. Tricky theme authors can override the
|
190 |
-
* default and include their own BuddyPress
|
191 |
*
|
192 |
* @since BuddyPress (1.7.0)
|
193 |
*
|
@@ -203,7 +203,7 @@ function bp_get_theme_compat_version() {
|
|
203 |
* Get the absolute path of the theme package being used.
|
204 |
*
|
205 |
* or set manually. Tricky theme authors can override the default and include
|
206 |
-
* their own BuddyPress
|
207 |
*
|
208 |
* @since BuddyPress (1.7.0)
|
209 |
*
|
@@ -219,7 +219,7 @@ function bp_get_theme_compat_dir() {
|
|
219 |
* Get the URL of the theme package being used.
|
220 |
*
|
221 |
* This can be filtered, or set manually. Tricky theme authors can override
|
222 |
-
* the default and include their own BuddyPress
|
223 |
* themes.
|
224 |
*
|
225 |
* @since BuddyPress (1.7.0)
|
@@ -286,9 +286,9 @@ function bp_detect_theme_compat_with_current_theme() {
|
|
286 |
if ( in_array( 'bp-default', array( get_template(), get_stylesheet() ) ) ) {
|
287 |
$theme_compat = false;
|
288 |
|
289 |
-
//
|
290 |
// Examples are clones of bp-default
|
291 |
-
}
|
292 |
$theme_compat = false;
|
293 |
}
|
294 |
}
|
@@ -309,9 +309,8 @@ function bp_detect_theme_compat_with_current_theme() {
|
|
309 |
function bp_is_theme_compat_active() {
|
310 |
$bp = buddypress();
|
311 |
|
312 |
-
if ( empty( $bp->theme_compat->active ) )
|
313 |
return false;
|
314 |
-
}
|
315 |
|
316 |
return $bp->theme_compat->active;
|
317 |
}
|
@@ -393,9 +392,8 @@ function bp_set_theme_compat_original_template( $template = '' ) {
|
|
393 |
function bp_is_theme_compat_original_template( $template = '' ) {
|
394 |
$bp = buddypress();
|
395 |
|
396 |
-
if ( empty( $bp->theme_compat->original_template ) )
|
397 |
return false;
|
398 |
-
}
|
399 |
|
400 |
return (bool) ( $bp->theme_compat->original_template == $template );
|
401 |
}
|
@@ -604,9 +602,8 @@ function bp_template_include_theme_compat( $template = '' ) {
|
|
604 |
do_action( 'bp_template_include_reset_dummy_post_data' );
|
605 |
|
606 |
// Bail if the template already matches a BuddyPress template
|
607 |
-
if ( !
|
608 |
return $template;
|
609 |
-
}
|
610 |
|
611 |
/**
|
612 |
* If we are relying on BuddyPress's built in theme compatibility to load
|
@@ -654,9 +651,8 @@ function bp_template_include_theme_compat( $template = '' ) {
|
|
654 |
function bp_replace_the_content( $content = '' ) {
|
655 |
|
656 |
// Bail if not the main loop where theme compat is happening
|
657 |
-
if ( ! bp_do_theme_compat() )
|
658 |
return $content;
|
659 |
-
}
|
660 |
|
661 |
// Set theme compat to false early, to avoid recursion from nested calls to
|
662 |
// the_content() that execute before theme compat has unhooked itself.
|
@@ -666,7 +662,7 @@ function bp_replace_the_content( $content = '' ) {
|
|
666 |
$new_content = apply_filters( 'bp_replace_the_content', $content );
|
667 |
|
668 |
// Juggle the content around and try to prevent unsightly comments
|
669 |
-
if ( !
|
670 |
|
671 |
// Set the content to be the new content
|
672 |
$content = $new_content;
|
@@ -722,7 +718,7 @@ function bp_remove_all_filters( $tag, $priority = false ) {
|
|
722 |
if ( isset( $wp_filter[$tag] ) ) {
|
723 |
|
724 |
// Filters exist in this priority
|
725 |
-
if ( !
|
726 |
|
727 |
// Store filters in a backup
|
728 |
$bp->filters->wp_filter[$tag][$priority] = $wp_filter[$tag][$priority];
|
@@ -778,7 +774,7 @@ function bp_restore_all_filters( $tag, $priority = false ) {
|
|
778 |
if ( isset( $bp->filters->wp_filter[$tag] ) ) {
|
779 |
|
780 |
// Filters exist in this priority
|
781 |
-
if ( !
|
782 |
|
783 |
// Store filters in a backup
|
784 |
$wp_filter[$tag][$priority] = $bp->filters->wp_filter[$tag][$priority];
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/** Theme Compat **************************************************************/
|
14 |
|
68 |
/**
|
69 |
* Set up the BuddyPress-specific theme compat methods.
|
70 |
*
|
71 |
+
* Themes shoud use this method in their constructor.
|
72 |
*
|
73 |
* @since BuddyPress (1.7.0)
|
74 |
*/
|
155 |
* Get the ID of the theme package being used.
|
156 |
*
|
157 |
* This can be filtered or set manually. Tricky theme authors can override the
|
158 |
+
* default and include their own BuddyPress compatability layers for their themes.
|
159 |
*
|
160 |
* @since BuddyPress (1.7.0)
|
161 |
*
|
171 |
* Get the name of the theme package being used.
|
172 |
*
|
173 |
* This can be filtered or set manually. Tricky theme authors can override the
|
174 |
+
* default and include their own BuddyPress compatability layers for their themes.
|
175 |
*
|
176 |
* @since BuddyPress (1.7.0)
|
177 |
*
|
187 |
* Get the version of the theme package being used.
|
188 |
*
|
189 |
* This can be filtered or set manually. Tricky theme authors can override the
|
190 |
+
* default and include their own BuddyPress compatability layers for their themes.
|
191 |
*
|
192 |
* @since BuddyPress (1.7.0)
|
193 |
*
|
203 |
* Get the absolute path of the theme package being used.
|
204 |
*
|
205 |
* or set manually. Tricky theme authors can override the default and include
|
206 |
+
* their own BuddyPress compatability layers for their themes.
|
207 |
*
|
208 |
* @since BuddyPress (1.7.0)
|
209 |
*
|
219 |
* Get the URL of the theme package being used.
|
220 |
*
|
221 |
* This can be filtered, or set manually. Tricky theme authors can override
|
222 |
+
* the default and include their own BuddyPress compatability layers for their
|
223 |
* themes.
|
224 |
*
|
225 |
* @since BuddyPress (1.7.0)
|
286 |
if ( in_array( 'bp-default', array( get_template(), get_stylesheet() ) ) ) {
|
287 |
$theme_compat = false;
|
288 |
|
289 |
+
// Bruteforce check for a BP template
|
290 |
// Examples are clones of bp-default
|
291 |
+
} else if ( locate_template( 'members/members-loop.php', false, false ) ) {
|
292 |
$theme_compat = false;
|
293 |
}
|
294 |
}
|
309 |
function bp_is_theme_compat_active() {
|
310 |
$bp = buddypress();
|
311 |
|
312 |
+
if ( empty( $bp->theme_compat->active ) )
|
313 |
return false;
|
|
|
314 |
|
315 |
return $bp->theme_compat->active;
|
316 |
}
|
392 |
function bp_is_theme_compat_original_template( $template = '' ) {
|
393 |
$bp = buddypress();
|
394 |
|
395 |
+
if ( empty( $bp->theme_compat->original_template ) )
|
396 |
return false;
|
|
|
397 |
|
398 |
return (bool) ( $bp->theme_compat->original_template == $template );
|
399 |
}
|
602 |
do_action( 'bp_template_include_reset_dummy_post_data' );
|
603 |
|
604 |
// Bail if the template already matches a BuddyPress template
|
605 |
+
if ( !empty( buddypress()->theme_compat->found_template ) )
|
606 |
return $template;
|
|
|
607 |
|
608 |
/**
|
609 |
* If we are relying on BuddyPress's built in theme compatibility to load
|
651 |
function bp_replace_the_content( $content = '' ) {
|
652 |
|
653 |
// Bail if not the main loop where theme compat is happening
|
654 |
+
if ( ! bp_do_theme_compat() )
|
655 |
return $content;
|
|
|
656 |
|
657 |
// Set theme compat to false early, to avoid recursion from nested calls to
|
658 |
// the_content() that execute before theme compat has unhooked itself.
|
662 |
$new_content = apply_filters( 'bp_replace_the_content', $content );
|
663 |
|
664 |
// Juggle the content around and try to prevent unsightly comments
|
665 |
+
if ( !empty( $new_content ) && ( $new_content !== $content ) ) {
|
666 |
|
667 |
// Set the content to be the new content
|
668 |
$content = $new_content;
|
718 |
if ( isset( $wp_filter[$tag] ) ) {
|
719 |
|
720 |
// Filters exist in this priority
|
721 |
+
if ( !empty( $priority ) && isset( $wp_filter[$tag][$priority] ) ) {
|
722 |
|
723 |
// Store filters in a backup
|
724 |
$bp->filters->wp_filter[$tag][$priority] = $wp_filter[$tag][$priority];
|
774 |
if ( isset( $bp->filters->wp_filter[$tag] ) ) {
|
775 |
|
776 |
// Filters exist in this priority
|
777 |
+
if ( !empty( $priority ) && isset( $bp->filters->wp_filter[$tag][$priority] ) ) {
|
778 |
|
779 |
// Store filters in a backup
|
780 |
$wp_filter[$tag][$priority] = $bp->filters->wp_filter[$tag][$priority];
|
bp-core/bp-core-update.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Is this a fresh installation of BuddyPress?
|
@@ -241,11 +241,6 @@ function bp_version_updater() {
|
|
241 |
if ( $raw_db_version < 8311 ) {
|
242 |
bp_update_to_2_0_1();
|
243 |
}
|
244 |
-
|
245 |
-
// 2.2
|
246 |
-
if ( $raw_db_version < 9181 ) {
|
247 |
-
bp_update_to_2_2();
|
248 |
-
}
|
249 |
}
|
250 |
|
251 |
/** All done! *************************************************************/
|
@@ -394,80 +389,6 @@ function bp_update_to_2_0_1() {
|
|
394 |
bp_core_maybe_install_signups();
|
395 |
}
|
396 |
|
397 |
-
/**
|
398 |
-
* 2.2.0 update routine.
|
399 |
-
*
|
400 |
-
* - Add messages meta table
|
401 |
-
* - Update the component field of the 'new members' activity type
|
402 |
-
* - Clean up hidden friendship activities
|
403 |
-
*
|
404 |
-
* @since BuddyPress (2.2.0)
|
405 |
-
*/
|
406 |
-
function bp_update_to_2_2() {
|
407 |
-
if ( bp_is_active( 'messages' ) ) {
|
408 |
-
bp_core_install_private_messaging();
|
409 |
-
}
|
410 |
-
|
411 |
-
if ( bp_is_active( 'activity' ) ) {
|
412 |
-
bp_migrate_new_member_activity_component();
|
413 |
-
|
414 |
-
if ( bp_is_active( 'friends' ) ) {
|
415 |
-
bp_cleanup_friendship_activities();
|
416 |
-
}
|
417 |
-
}
|
418 |
-
}
|
419 |
-
|
420 |
-
/**
|
421 |
-
* Updates the component field for new_members type.
|
422 |
-
*
|
423 |
-
* @since BuddyPress (2.2.0)
|
424 |
-
*
|
425 |
-
* @global $wpdb
|
426 |
-
* @uses buddypress()
|
427 |
-
*
|
428 |
-
*/
|
429 |
-
function bp_migrate_new_member_activity_component() {
|
430 |
-
global $wpdb;
|
431 |
-
$bp = buddypress();
|
432 |
-
|
433 |
-
// Update the component for the new_member type
|
434 |
-
$wpdb->update(
|
435 |
-
// Activity table
|
436 |
-
$bp->members->table_name_last_activity,
|
437 |
-
array(
|
438 |
-
'component' => $bp->members->id,
|
439 |
-
),
|
440 |
-
array(
|
441 |
-
'component' => 'xprofile',
|
442 |
-
'type' => 'new_member',
|
443 |
-
),
|
444 |
-
// Data sanitization format
|
445 |
-
array(
|
446 |
-
'%s',
|
447 |
-
),
|
448 |
-
// WHERE sanitization format
|
449 |
-
array(
|
450 |
-
'%s',
|
451 |
-
'%s'
|
452 |
-
)
|
453 |
-
);
|
454 |
-
}
|
455 |
-
|
456 |
-
/**
|
457 |
-
* Remove all hidden friendship activities
|
458 |
-
*
|
459 |
-
* @since BuddyPress (2.2.0)
|
460 |
-
*
|
461 |
-
* @uses bp_activity_delete() to delete the corresponding friendship activities
|
462 |
-
*/
|
463 |
-
function bp_cleanup_friendship_activities() {
|
464 |
-
bp_activity_delete( array(
|
465 |
-
'component' => buddypress()->friends->id,
|
466 |
-
'type' => 'friendship_created',
|
467 |
-
'hide_sitewide' => true,
|
468 |
-
) );
|
469 |
-
}
|
470 |
-
|
471 |
/**
|
472 |
* Redirect user to BP's What's New page on first page load after activation.
|
473 |
*
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Is this a fresh installation of BuddyPress?
|
241 |
if ( $raw_db_version < 8311 ) {
|
242 |
bp_update_to_2_0_1();
|
243 |
}
|
|
|
|
|
|
|
|
|
|
|
244 |
}
|
245 |
|
246 |
/** All done! *************************************************************/
|
389 |
bp_core_maybe_install_signups();
|
390 |
}
|
391 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
/**
|
393 |
* Redirect user to BP's What's New page on first page load after activation.
|
394 |
*
|
bp-core/bp-core-widgets.php
CHANGED
@@ -7,15 +7,16 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/**
|
13 |
* Register bp-core widgets.
|
14 |
-
*
|
15 |
-
* @since BuddyPress (1.0.0)
|
16 |
*/
|
17 |
function bp_core_register_widgets() {
|
18 |
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Login_Widget");') );
|
|
|
|
|
|
|
19 |
}
|
20 |
add_action( 'bp_register_widgets', 'bp_core_register_widgets' );
|
21 |
|
@@ -136,3 +137,440 @@ class BP_Core_Login_Widget extends WP_Widget {
|
|
136 |
<?php
|
137 |
}
|
138 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/**
|
13 |
* Register bp-core widgets.
|
|
|
|
|
14 |
*/
|
15 |
function bp_core_register_widgets() {
|
16 |
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Login_Widget");') );
|
17 |
+
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Members_Widget");') );
|
18 |
+
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Whos_Online_Widget");') );
|
19 |
+
add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Recently_Active_Widget");') );
|
20 |
}
|
21 |
add_action( 'bp_register_widgets', 'bp_core_register_widgets' );
|
22 |
|
137 |
<?php
|
138 |
}
|
139 |
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Members Widget.
|
143 |
+
*/
|
144 |
+
class BP_Core_Members_Widget extends WP_Widget {
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Constructor method.
|
148 |
+
*/
|
149 |
+
function __construct() {
|
150 |
+
$widget_ops = array(
|
151 |
+
'description' => __( 'A dynamic list of recently active, popular, and newest members', 'buddypress' ),
|
152 |
+
'classname' => 'widget_bp_core_members_widget buddypress widget',
|
153 |
+
);
|
154 |
+
parent::__construct( false, $name = _x( '(BuddyPress) Members', 'widget name', 'buddypress' ), $widget_ops );
|
155 |
+
|
156 |
+
if ( is_active_widget( false, false, $this->id_base ) && !is_admin() && !is_network_admin() ) {
|
157 |
+
wp_enqueue_script( 'bp-widget-members' );
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Display the Members widget.
|
163 |
+
*
|
164 |
+
* @see WP_Widget::widget() for description of parameters.
|
165 |
+
*
|
166 |
+
* @param array $args Widget arguments.
|
167 |
+
* @param array $instance Widget settings, as saved by the user.
|
168 |
+
*/
|
169 |
+
function widget( $args, $instance ) {
|
170 |
+
|
171 |
+
extract( $args );
|
172 |
+
|
173 |
+
if ( !$instance['member_default'] )
|
174 |
+
$instance['member_default'] = 'active';
|
175 |
+
|
176 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
177 |
+
|
178 |
+
echo $before_widget;
|
179 |
+
|
180 |
+
$title = $instance['link_title'] ? '<a href="' . trailingslashit( bp_get_root_domain() . '/' . bp_get_members_root_slug() ) . '">' . $title . '</a>' : $title;
|
181 |
+
|
182 |
+
echo $before_title
|
183 |
+
. $title
|
184 |
+
. $after_title;
|
185 |
+
|
186 |
+
$members_args = array(
|
187 |
+
'user_id' => 0,
|
188 |
+
'type' => $instance['member_default'],
|
189 |
+
'per_page' => $instance['max_members'],
|
190 |
+
'max' => $instance['max_members'],
|
191 |
+
'populate_extras' => true,
|
192 |
+
'search_terms' => false,
|
193 |
+
);
|
194 |
+
|
195 |
+
?>
|
196 |
+
|
197 |
+
<?php if ( bp_has_members( $members_args ) ) : ?>
|
198 |
+
<div class="item-options" id="members-list-options">
|
199 |
+
<a href="<?php bp_members_directory_permalink(); ?>" id="newest-members" <?php if ( $instance['member_default'] == 'newest' ) : ?>class="selected"<?php endif; ?>><?php _e( 'Newest', 'buddypress' ) ?></a>
|
200 |
+
| <a href="<?php bp_members_directory_permalink(); ?>" id="recently-active-members" <?php if ( $instance['member_default'] == 'active' ) : ?>class="selected"<?php endif; ?>><?php _e( 'Active', 'buddypress' ) ?></a>
|
201 |
+
|
202 |
+
<?php if ( bp_is_active( 'friends' ) ) : ?>
|
203 |
+
|
204 |
+
| <a href="<?php bp_members_directory_permalink(); ?>" id="popular-members" <?php if ( $instance['member_default'] == 'popular' ) : ?>class="selected"<?php endif; ?>><?php _e( 'Popular', 'buddypress' ) ?></a>
|
205 |
+
|
206 |
+
<?php endif; ?>
|
207 |
+
</div>
|
208 |
+
|
209 |
+
<ul id="members-list" class="item-list">
|
210 |
+
<?php while ( bp_members() ) : bp_the_member(); ?>
|
211 |
+
<li class="vcard">
|
212 |
+
<div class="item-avatar">
|
213 |
+
<a href="<?php bp_member_permalink() ?>" title="<?php bp_member_name() ?>"><?php bp_member_avatar() ?></a>
|
214 |
+
</div>
|
215 |
+
|
216 |
+
<div class="item">
|
217 |
+
<div class="item-title fn"><a href="<?php bp_member_permalink() ?>" title="<?php bp_member_name() ?>"><?php bp_member_name() ?></a></div>
|
218 |
+
<div class="item-meta">
|
219 |
+
<span class="activity">
|
220 |
+
<?php
|
221 |
+
if ( 'newest' == $instance['member_default'] )
|
222 |
+
bp_member_registered();
|
223 |
+
if ( 'active' == $instance['member_default'] )
|
224 |
+
bp_member_last_active();
|
225 |
+
if ( 'popular' == $instance['member_default'] )
|
226 |
+
bp_member_total_friend_count();
|
227 |
+
?>
|
228 |
+
</span>
|
229 |
+
</div>
|
230 |
+
</div>
|
231 |
+
</li>
|
232 |
+
|
233 |
+
<?php endwhile; ?>
|
234 |
+
</ul>
|
235 |
+
<?php wp_nonce_field( 'bp_core_widget_members', '_wpnonce-members' ); ?>
|
236 |
+
<input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo esc_attr( $instance['max_members'] ); ?>" />
|
237 |
+
|
238 |
+
<?php else: ?>
|
239 |
+
|
240 |
+
<div class="widget-error">
|
241 |
+
<?php _e('No one has signed up yet!', 'buddypress') ?>
|
242 |
+
</div>
|
243 |
+
|
244 |
+
<?php endif; ?>
|
245 |
+
|
246 |
+
<?php echo $after_widget; ?>
|
247 |
+
<?php
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Update the Members widget options.
|
252 |
+
*
|
253 |
+
* @param array $new_instance The new instance options.
|
254 |
+
* @param array $old_instance The old instance options.
|
255 |
+
* @return array $instance The parsed options to be saved.
|
256 |
+
*/
|
257 |
+
function update( $new_instance, $old_instance ) {
|
258 |
+
$instance = $old_instance;
|
259 |
+
|
260 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
261 |
+
$instance['max_members'] = strip_tags( $new_instance['max_members'] );
|
262 |
+
$instance['member_default'] = strip_tags( $new_instance['member_default'] );
|
263 |
+
$instance['link_title'] = (bool)$new_instance['link_title'];
|
264 |
+
|
265 |
+
return $instance;
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Output the Members widget options form.
|
270 |
+
*
|
271 |
+
* @param $instance Settings for this widget.
|
272 |
+
*/
|
273 |
+
function form( $instance ) {
|
274 |
+
$defaults = array(
|
275 |
+
'title' => __( 'Members', 'buddypress' ),
|
276 |
+
'max_members' => 5,
|
277 |
+
'member_default' => 'active',
|
278 |
+
'link_title' => false
|
279 |
+
);
|
280 |
+
$instance = wp_parse_args( (array) $instance, $defaults );
|
281 |
+
|
282 |
+
$title = strip_tags( $instance['title'] );
|
283 |
+
$max_members = strip_tags( $instance['max_members'] );
|
284 |
+
$member_default = strip_tags( $instance['member_default'] );
|
285 |
+
$link_title = (bool)$instance['link_title'];
|
286 |
+
?>
|
287 |
+
|
288 |
+
<p><label for="bp-core-widget-title"><?php _e('Title:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" style="width: 100%" /></label></p>
|
289 |
+
|
290 |
+
<p><label for="<?php echo $this->get_field_name('link_title') ?>"><input type="checkbox" name="<?php echo $this->get_field_name('link_title') ?>" value="1" <?php checked( $link_title ) ?> /> <?php _e( 'Link widget title to Members directory', 'buddypress' ) ?></label></p>
|
291 |
+
|
292 |
+
<p><label for="bp-core-widget-members-max"><?php _e('Max members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
|
293 |
+
|
294 |
+
<p>
|
295 |
+
<label for="bp-core-widget-groups-default"><?php _e('Default members to show:', 'buddypress'); ?>
|
296 |
+
<select name="<?php echo $this->get_field_name( 'member_default' ) ?>">
|
297 |
+
<option value="newest" <?php if ( $member_default == 'newest' ) : ?>selected="selected"<?php endif; ?>><?php _e( 'Newest', 'buddypress' ) ?></option>
|
298 |
+
<option value="active" <?php if ( $member_default == 'active' ) : ?>selected="selected"<?php endif; ?>><?php _e( 'Active', 'buddypress' ) ?></option>
|
299 |
+
<option value="popular" <?php if ( $member_default == 'popular' ) : ?>selected="selected"<?php endif; ?>><?php _e( 'Popular', 'buddypress' ) ?></option>
|
300 |
+
</select>
|
301 |
+
</label>
|
302 |
+
</p>
|
303 |
+
|
304 |
+
<?php
|
305 |
+
}
|
306 |
+
}
|
307 |
+
|
308 |
+
/*** WHO'S ONLINE WIDGET *****************/
|
309 |
+
|
310 |
+
class BP_Core_Whos_Online_Widget extends WP_Widget {
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Constructor method.
|
314 |
+
*/
|
315 |
+
function __construct() {
|
316 |
+
$widget_ops = array(
|
317 |
+
'description' => __( 'Profile photos of online users', 'buddypress' ),
|
318 |
+
'classname' => 'widget_bp_core_whos_online_widget buddypress widget',
|
319 |
+
);
|
320 |
+
parent::__construct( false, $name = _x( "(BuddyPress) Who's Online", 'widget name', 'buddypress' ), $widget_ops );
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Display the Who's Online widget.
|
325 |
+
*
|
326 |
+
* @see WP_Widget::widget() for description of parameters.
|
327 |
+
*
|
328 |
+
* @param array $args Widget arguments.
|
329 |
+
* @param array $instance Widget settings, as saved by the user.
|
330 |
+
*/
|
331 |
+
function widget($args, $instance) {
|
332 |
+
|
333 |
+
extract( $args );
|
334 |
+
|
335 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
336 |
+
|
337 |
+
echo $before_widget;
|
338 |
+
echo $before_title
|
339 |
+
. $title
|
340 |
+
. $after_title;
|
341 |
+
|
342 |
+
$members_args = array(
|
343 |
+
'user_id' => 0,
|
344 |
+
'type' => 'online',
|
345 |
+
'per_page' => $instance['max_members'],
|
346 |
+
'max' => $instance['max_members'],
|
347 |
+
'populate_extras' => true,
|
348 |
+
'search_terms' => false,
|
349 |
+
);
|
350 |
+
|
351 |
+
?>
|
352 |
+
|
353 |
+
<?php if ( bp_has_members( $members_args ) ) : ?>
|
354 |
+
<div class="avatar-block">
|
355 |
+
<?php while ( bp_members() ) : bp_the_member(); ?>
|
356 |
+
<div class="item-avatar">
|
357 |
+
<a href="<?php bp_member_permalink() ?>" title="<?php bp_member_name() ?>"><?php bp_member_avatar() ?></a>
|
358 |
+
</div>
|
359 |
+
<?php endwhile; ?>
|
360 |
+
</div>
|
361 |
+
<?php else: ?>
|
362 |
+
|
363 |
+
<div class="widget-error">
|
364 |
+
<?php _e( 'There are no users currently online', 'buddypress' ) ?>
|
365 |
+
</div>
|
366 |
+
|
367 |
+
<?php endif; ?>
|
368 |
+
|
369 |
+
<?php echo $after_widget; ?>
|
370 |
+
<?php
|
371 |
+
}
|
372 |
+
|
373 |
+
/**
|
374 |
+
* Update the Who's Online widget options.
|
375 |
+
*
|
376 |
+
* @param array $new_instance The new instance options.
|
377 |
+
* @param array $old_instance The old instance options.
|
378 |
+
* @return array $instance The parsed options to be saved.
|
379 |
+
*/
|
380 |
+
function update( $new_instance, $old_instance ) {
|
381 |
+
$instance = $old_instance;
|
382 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
383 |
+
$instance['max_members'] = strip_tags( $new_instance['max_members'] );
|
384 |
+
|
385 |
+
return $instance;
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* Output the Who's Online widget options form.
|
390 |
+
*
|
391 |
+
* @param $instance Settings for this widget.
|
392 |
+
*/
|
393 |
+
function form( $instance ) {
|
394 |
+
$defaults = array(
|
395 |
+
'title' => __( "Who's Online", 'buddypress' ),
|
396 |
+
'max_members' => 15
|
397 |
+
);
|
398 |
+
$instance = wp_parse_args( (array) $instance, $defaults );
|
399 |
+
|
400 |
+
$title = strip_tags( $instance['title'] );
|
401 |
+
$max_members = strip_tags( $instance['max_members'] );
|
402 |
+
?>
|
403 |
+
|
404 |
+
<p><label for="bp-core-widget-title"><?php _e('Title:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" style="width: 100%" /></label></p>
|
405 |
+
|
406 |
+
<p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
|
407 |
+
<?php
|
408 |
+
}
|
409 |
+
}
|
410 |
+
|
411 |
+
/*** RECENTLY ACTIVE WIDGET *****************/
|
412 |
+
|
413 |
+
class BP_Core_Recently_Active_Widget extends WP_Widget {
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Constructor method.
|
417 |
+
*/
|
418 |
+
function __construct() {
|
419 |
+
$widget_ops = array(
|
420 |
+
'description' => __( 'Profile photos of recently active members', 'buddypress' ),
|
421 |
+
'classname' => 'widget_bp_core_recently_active_widget buddypress widget',
|
422 |
+
);
|
423 |
+
parent::__construct( false, $name = _x( '(BuddyPress) Recently Active Members', 'widget name', 'buddypress' ), $widget_ops );
|
424 |
+
}
|
425 |
+
|
426 |
+
/**
|
427 |
+
* Display the Recently Active widget.
|
428 |
+
*
|
429 |
+
* @see WP_Widget::widget() for description of parameters.
|
430 |
+
*
|
431 |
+
* @param array $args Widget arguments.
|
432 |
+
* @param array $instance Widget settings, as saved by the user.
|
433 |
+
*/
|
434 |
+
function widget( $args, $instance ) {
|
435 |
+
|
436 |
+
extract( $args );
|
437 |
+
|
438 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
439 |
+
|
440 |
+
echo $before_widget;
|
441 |
+
echo $before_title
|
442 |
+
. $title
|
443 |
+
. $after_title;
|
444 |
+
|
445 |
+
$members_args = array(
|
446 |
+
'user_id' => 0,
|
447 |
+
'type' => 'active',
|
448 |
+
'per_page' => $instance['max_members'],
|
449 |
+
'max' => $instance['max_members'],
|
450 |
+
'populate_extras' => true,
|
451 |
+
'search_terms' => false,
|
452 |
+
);
|
453 |
+
|
454 |
+
?>
|
455 |
+
|
456 |
+
<?php if ( bp_has_members( $members_args ) ) : ?>
|
457 |
+
<div class="avatar-block">
|
458 |
+
<?php while ( bp_members() ) : bp_the_member(); ?>
|
459 |
+
<div class="item-avatar">
|
460 |
+
<a href="<?php bp_member_permalink() ?>" title="<?php bp_member_name() ?>"><?php bp_member_avatar() ?></a>
|
461 |
+
</div>
|
462 |
+
<?php endwhile; ?>
|
463 |
+
</div>
|
464 |
+
<?php else: ?>
|
465 |
+
|
466 |
+
<div class="widget-error">
|
467 |
+
<?php _e( 'There are no recently active members', 'buddypress' ) ?>
|
468 |
+
</div>
|
469 |
+
|
470 |
+
<?php endif; ?>
|
471 |
+
|
472 |
+
<?php echo $after_widget; ?>
|
473 |
+
<?php
|
474 |
+
}
|
475 |
+
|
476 |
+
/**
|
477 |
+
* Update the Recently Active widget options.
|
478 |
+
*
|
479 |
+
* @param array $new_instance The new instance options.
|
480 |
+
* @param array $old_instance The old instance options.
|
481 |
+
* @return array $instance The parsed options to be saved.
|
482 |
+
*/
|
483 |
+
function update( $new_instance, $old_instance ) {
|
484 |
+
$instance = $old_instance;
|
485 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
486 |
+
$instance['max_members'] = strip_tags( $new_instance['max_members'] );
|
487 |
+
|
488 |
+
return $instance;
|
489 |
+
}
|
490 |
+
|
491 |
+
/**
|
492 |
+
* Output the Recently Active widget options form.
|
493 |
+
*
|
494 |
+
* @param $instance Settings for this widget.
|
495 |
+
*/
|
496 |
+
function form( $instance ) {
|
497 |
+
$defaults = array(
|
498 |
+
'title' => __( 'Recently Active Members', 'buddypress' ),
|
499 |
+
'max_members' => 15
|
500 |
+
);
|
501 |
+
$instance = wp_parse_args( (array) $instance, $defaults );
|
502 |
+
|
503 |
+
$title = strip_tags( $instance['title'] );
|
504 |
+
$max_members = strip_tags( $instance['max_members'] );
|
505 |
+
?>
|
506 |
+
|
507 |
+
<p><label for="bp-core-widget-members-title"><?php _e('Title:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" style="width: 100%" /></label></p>
|
508 |
+
|
509 |
+
<p><label for="bp-core-widget-members-max"><?php _e('Max Members to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" /></label></p>
|
510 |
+
<?php
|
511 |
+
}
|
512 |
+
}
|
513 |
+
|
514 |
+
/**
|
515 |
+
* AJAX request handler for Members widgets.
|
516 |
+
*/
|
517 |
+
function bp_core_ajax_widget_members() {
|
518 |
+
|
519 |
+
check_ajax_referer( 'bp_core_widget_members' );
|
520 |
+
|
521 |
+
switch ( $_POST['filter'] ) {
|
522 |
+
case 'newest-members':
|
523 |
+
$type = 'newest';
|
524 |
+
break;
|
525 |
+
|
526 |
+
case 'recently-active-members':
|
527 |
+
$type = 'active';
|
528 |
+
break;
|
529 |
+
|
530 |
+
case 'popular-members':
|
531 |
+
if ( bp_is_active( 'friends' ) )
|
532 |
+
$type = 'popular';
|
533 |
+
else
|
534 |
+
$type = 'active';
|
535 |
+
|
536 |
+
break;
|
537 |
+
}
|
538 |
+
|
539 |
+
$members_args = array(
|
540 |
+
'user_id' => 0,
|
541 |
+
'type' => $type,
|
542 |
+
'per_page' => $_POST['max-members'],
|
543 |
+
'max' => $_POST['max-members'],
|
544 |
+
'populate_extras' => 1,
|
545 |
+
'search_terms' => false,
|
546 |
+
);
|
547 |
+
|
548 |
+
if ( bp_has_members( $members_args ) ) : ?>
|
549 |
+
<?php echo '0[[SPLIT]]'; // return valid result. TODO: remove this. ?>
|
550 |
+
<?php while ( bp_members() ) : bp_the_member(); ?>
|
551 |
+
<li class="vcard">
|
552 |
+
<div class="item-avatar">
|
553 |
+
<a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar() ?></a>
|
554 |
+
</div>
|
555 |
+
|
556 |
+
<div class="item">
|
557 |
+
<div class="item-title fn"><a href="<?php bp_member_permalink() ?>" title="<?php bp_member_name() ?>"><?php bp_member_name() ?></a></div>
|
558 |
+
<?php if ( 'active' == $type ) : ?>
|
559 |
+
<div class="item-meta"><span class="activity"><?php bp_member_last_active() ?></span></div>
|
560 |
+
<?php elseif ( 'newest' == $type ) : ?>
|
561 |
+
<div class="item-meta"><span class="activity"><?php bp_member_registered() ?></span></div>
|
562 |
+
<?php elseif ( bp_is_active( 'friends' ) ) : ?>
|
563 |
+
<div class="item-meta"><span class="activity"><?php bp_member_total_friend_count() ?></span></div>
|
564 |
+
<?php endif; ?>
|
565 |
+
</div>
|
566 |
+
</li>
|
567 |
+
<?php endwhile; ?>
|
568 |
+
|
569 |
+
<?php else: ?>
|
570 |
+
<?php echo "-1[[SPLIT]]<li>"; ?>
|
571 |
+
<?php _e( 'There were no members found, please try another filter.', 'buddypress' ) ?>
|
572 |
+
<?php echo "</li>"; ?>
|
573 |
+
<?php endif;
|
574 |
+
}
|
575 |
+
add_action( 'wp_ajax_widget_members', 'bp_core_ajax_widget_members' );
|
576 |
+
add_action( 'wp_ajax_nopriv_widget_members', 'bp_core_ajax_widget_members' );
|
bp-core/bp-core-wpabstraction.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
-
defined( 'ABSPATH' )
|
14 |
|
15 |
/**
|
16 |
* Parse the WordPress core version number into the major release.
|
@@ -75,7 +75,7 @@ if ( !is_multisite() ) {
|
|
75 |
/**
|
76 |
* @see switch_to_blog()
|
77 |
*/
|
78 |
-
function switch_to_blog(
|
79 |
return bp_get_root_blog_id();
|
80 |
}
|
81 |
}
|
@@ -93,7 +93,7 @@ if ( !is_multisite() ) {
|
|
93 |
/**
|
94 |
* @see get_blogs_of_user()
|
95 |
*/
|
96 |
-
function get_blogs_of_user(
|
97 |
return false;
|
98 |
}
|
99 |
}
|
@@ -102,7 +102,7 @@ if ( !is_multisite() ) {
|
|
102 |
/**
|
103 |
* @see update_blog_status()
|
104 |
*/
|
105 |
-
function update_blog_status(
|
106 |
return true;
|
107 |
}
|
108 |
}
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
14 |
|
15 |
/**
|
16 |
* Parse the WordPress core version number into the major release.
|
75 |
/**
|
76 |
* @see switch_to_blog()
|
77 |
*/
|
78 |
+
function switch_to_blog() {
|
79 |
return bp_get_root_blog_id();
|
80 |
}
|
81 |
}
|
93 |
/**
|
94 |
* @see get_blogs_of_user()
|
95 |
*/
|
96 |
+
function get_blogs_of_user() {
|
97 |
return false;
|
98 |
}
|
99 |
}
|
102 |
/**
|
103 |
* @see update_blog_status()
|
104 |
*/
|
105 |
+
function update_blog_status() {
|
106 |
return true;
|
107 |
}
|
108 |
}
|
bp-core/deprecated/1.5.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/** Loader ********************************************************************/
|
14 |
|
@@ -449,7 +449,7 @@ function bp_is_friend_requests() {
|
|
449 |
|
450 |
/**
|
451 |
* Checks to see if a component's URL should be in the root, not under a member page:
|
452 |
-
* eg: http://
|
453 |
* You should be using bp_is_root_component().
|
454 |
*
|
455 |
* @deprecated BuddyPress (1.5)
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/** Loader ********************************************************************/
|
14 |
|
449 |
|
450 |
/**
|
451 |
* Checks to see if a component's URL should be in the root, not under a member page:
|
452 |
+
* eg: http://domain.com/groups/the-group NOT http://domain.com/members/andy/groups/the-group
|
453 |
* You should be using bp_is_root_component().
|
454 |
*
|
455 |
* @deprecated BuddyPress (1.5)
|
bp-core/deprecated/1.6.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
12 |
-
defined( 'ABSPATH' )
|
13 |
|
14 |
/** Toolbar functions *********************************************************/
|
15 |
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
12 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
13 |
|
14 |
/** Toolbar functions *********************************************************/
|
15 |
|
bp-core/deprecated/1.7.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Output the BuddyPress maintenance mode
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Output the BuddyPress maintenance mode
|
bp-core/deprecated/1.9.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
-
defined( 'ABSPATH' )
|
15 |
|
16 |
/**
|
17 |
* Add a notification for a specific user, from a specific component.
|
@@ -212,7 +212,7 @@ function bp_core_delete_all_notifications_by_type( $item_id, $component_name, $c
|
|
212 |
/**
|
213 |
* Delete all notifications for a user.
|
214 |
*
|
215 |
-
* Used when clearing out all notifications for a user,
|
216 |
*
|
217 |
* @deprecated Deprecated since BuddyPress 1.9.0. Use
|
218 |
* bp_notifications_delete_notifications_from_user() instead.
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
/**
|
17 |
* Add a notification for a specific user, from a specific component.
|
212 |
/**
|
213 |
* Delete all notifications for a user.
|
214 |
*
|
215 |
+
* Used when clearing out all notifications for a user, whene deleted or spammed
|
216 |
*
|
217 |
* @deprecated Deprecated since BuddyPress 1.9.0. Use
|
218 |
* bp_notifications_delete_notifications_from_user() instead.
|
bp-core/deprecated/2.0.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* @deprecated BuddyPress (2.0.0)
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* @deprecated BuddyPress (2.0.0)
|
bp-core/deprecated/2.1.php
CHANGED
@@ -170,7 +170,7 @@ function bp_admin_setting_callback_force_buddybar() {
|
|
170 |
|
171 |
|
172 |
/**
|
173 |
-
* Sanitization for
|
174 |
*
|
175 |
* If upgraded to 1.6 and you chose to keep the BuddyBar, a checkbox asks if you want to switch to
|
176 |
* the WP Toolbar. The option we store is 1 if the BuddyBar is forced on, so we use this function
|
@@ -625,7 +625,7 @@ function bp_blogs_get_subdomain_base() {
|
|
625 |
}
|
626 |
|
627 |
/**
|
628 |
-
*
|
629 |
*
|
630 |
* @since BuddyPress (1.0.0)
|
631 |
* @deprecated BuddyPress (2.1.0)
|
170 |
|
171 |
|
172 |
/**
|
173 |
+
* Sanitization for _bp_force_buddyvar
|
174 |
*
|
175 |
* If upgraded to 1.6 and you chose to keep the BuddyBar, a checkbox asks if you want to switch to
|
176 |
* the WP Toolbar. The option we store is 1 if the BuddyBar is forced on, so we use this function
|
625 |
}
|
626 |
|
627 |
/**
|
628 |
+
* Alledgedly output an avatar upload form, but it hasn't done that since 2009.
|
629 |
*
|
630 |
* @since BuddyPress (1.0.0)
|
631 |
* @deprecated BuddyPress (2.1.0)
|
bp-core/deprecated/2.2.php
DELETED
@@ -1,116 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Deprecated functions
|
4 |
-
*
|
5 |
-
* @package BuddyPress
|
6 |
-
* @subpackage Core
|
7 |
-
* @deprecated 2.2.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Detect a change in post status, and initiate an activity update if necessary.
|
15 |
-
*
|
16 |
-
* Posts get new activity updates when (a) they are being published, and (b)
|
17 |
-
* they have not already been published. This enables proper posting for
|
18 |
-
* regular posts as well as scheduled posts, while preventing post bumping.
|
19 |
-
*
|
20 |
-
* See #4090, #3746, #2546 for background.
|
21 |
-
*
|
22 |
-
* @since BuddyPress (2.0.0)
|
23 |
-
* @deprecated BuddyPress (2.2.0)
|
24 |
-
*
|
25 |
-
* @todo Support untrashing better
|
26 |
-
*
|
27 |
-
* @param string $new_status New status for the post.
|
28 |
-
* @param string $old_status Old status for the post.
|
29 |
-
* @param object $post Post data.
|
30 |
-
*/
|
31 |
-
function bp_blogs_catch_transition_post_status( $new_status, $old_status, $post ) {
|
32 |
-
_deprecated_function( __FUNCTION__, '2.2', 'bp_activity_catch_transition_post_type_status()' );
|
33 |
-
bp_activity_catch_transition_post_type_status( $new_status, $old_status, $post );
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Record a new blog post in the BuddyPress activity stream.
|
38 |
-
*
|
39 |
-
* @deprecated BuddyPress (2.2.0)
|
40 |
-
*
|
41 |
-
* @param int $post_id ID of the post being recorded.
|
42 |
-
* @param object $post The WP post object passed to the 'save_post' action.
|
43 |
-
* @param int $user_id Optional. The user to whom the activity item will be
|
44 |
-
* associated. Defaults to the post_author.
|
45 |
-
* @return bool|null Returns false on failure.
|
46 |
-
*/
|
47 |
-
function bp_blogs_record_post( $post_id, $post, $user_id = 0 ) {
|
48 |
-
_deprecated_function( __FUNCTION__, '2.2', 'bp_activity_post_type_publish()' );
|
49 |
-
bp_activity_post_type_publish( $post_id, $post, $user_id );
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Updates a blog post's corresponding activity entry during a post edit.
|
54 |
-
*
|
55 |
-
* @since BuddyPress (2.0.0)
|
56 |
-
* @deprecated BuddyPress (2.2.0)
|
57 |
-
*
|
58 |
-
* @see bp_blogs_catch_transition_post_status()
|
59 |
-
*
|
60 |
-
* @param WP_Post $post
|
61 |
-
*/
|
62 |
-
function bp_blogs_update_post( $post ) {
|
63 |
-
_deprecated_function( __FUNCTION__, '2.2', 'bp_activity_post_type_update()' );
|
64 |
-
bp_activity_post_type_update( $post );
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Clear cache when a new blog is created.
|
69 |
-
*
|
70 |
-
* @since BuddyPress (1.0.0)
|
71 |
-
* @deprecated BuddyPress (2.2.0)
|
72 |
-
*
|
73 |
-
* @param BP_Blogs_Blog $recorded_blog_obj The recorded blog, passed by
|
74 |
-
* 'bp_blogs_new_blog'.
|
75 |
-
*/
|
76 |
-
function bp_blogs_format_clear_blog_cache( $recorded_blog_obj ) {
|
77 |
-
_deprecated_function( __FUNCTION__, '2.2', 'bp_blogs_clear_blog_object_cache()' );
|
78 |
-
bp_blogs_clear_blog_object_cache( false, $recorded_blog_obj->user_id );
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Format 'new_member' activity actions.
|
83 |
-
*
|
84 |
-
* @since BuddyPress (2.0.0)
|
85 |
-
* @deprecated BuddyPress (2.2.0)
|
86 |
-
*
|
87 |
-
* @param string $action Static activity action.
|
88 |
-
* @param object $activity Activity object.
|
89 |
-
* @return string
|
90 |
-
*/
|
91 |
-
function bp_xprofile_format_activity_action_new_member( $action, $activity ) {
|
92 |
-
_deprecated_function( __FUNCTION__, '2.2', 'bp_members_format_activity_action_new_member()' );
|
93 |
-
|
94 |
-
$action = apply_filters( 'bp_xprofile_format_activity_action_new_member', $action, $activity );
|
95 |
-
return bp_members_format_activity_action_new_member( $action, $activity );
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Add 'bp' to global group of network wide cachable objects.
|
100 |
-
*
|
101 |
-
* @since BuddyPress (1.1)
|
102 |
-
* @deprecated BuddyPress (2.2.0)
|
103 |
-
*/
|
104 |
-
function bp_core_add_global_group() {
|
105 |
-
_deprecated_function( __FUNCTION__, '2.2', 'This function has no replacement' );
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Add a piece of message metadata.
|
110 |
-
*
|
111 |
-
* @deprecated BuddyPress (2.2.2)
|
112 |
-
*/
|
113 |
-
function bp_message_add_meta( $message_id, $meta_key, $meta_value, $unique = false ) {
|
114 |
-
_deprecated_function( __FUNCTION__, '2.3.0', 'bp_messages_add_meta()' );
|
115 |
-
return bp_messages_add_meta( $message_id, $meta_key, $meta_value, $unique );
|
116 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp-core/deprecated/js/autocomplete/jquery.autocomplete.js
CHANGED
@@ -326,7 +326,7 @@ $.Autocompleter = function(input, options) {
|
|
326 |
q: lastWord(term),
|
327 |
limit: options.max,
|
328 |
action: 'messages_autocomplete_results',
|
329 |
-
'cookie':
|
330 |
}, extraParams),
|
331 |
success: function(data) {
|
332 |
var parsed = options.parse && options.parse(data) || parse(data);
|
@@ -361,29 +361,6 @@ $.Autocompleter = function(input, options) {
|
|
361 |
jQuery('#send-to-input').removeClass('loading');
|
362 |
};
|
363 |
|
364 |
-
/* Returns a querystring of BP cookies (cookies beginning with 'bp-') */
|
365 |
-
function getAutocompleteCookies() {
|
366 |
-
var allCookies = document.cookie.split(';'), // get all cookies and split into an array
|
367 |
-
bpCookies = {},
|
368 |
-
cookiePrefix = 'bp-',
|
369 |
-
i, cookie, delimiter, name, value;
|
370 |
-
|
371 |
-
// loop through cookies
|
372 |
-
for (i = 0; i < allCookies.length; i++) {
|
373 |
-
cookie = allCookies[i];
|
374 |
-
delimiter = cookie.indexOf('=');
|
375 |
-
name = jq.trim( unescape( cookie.slice(0, delimiter) ) );
|
376 |
-
value = unescape( cookie.slice(delimiter + 1) );
|
377 |
-
|
378 |
-
// if BP cookie, store it
|
379 |
-
if ( name.indexOf(cookiePrefix) === 0 ) {
|
380 |
-
bpCookies[name] = value;
|
381 |
-
}
|
382 |
-
}
|
383 |
-
|
384 |
-
// returns BP cookies as querystring
|
385 |
-
return encodeURIComponent( jq.param(bpCookies) );
|
386 |
-
}
|
387 |
};
|
388 |
|
389 |
$.Autocompleter.defaults = {
|
@@ -750,4 +727,4 @@ $.Autocompleter.Selection = function(field, start, end) {
|
|
750 |
field.focus();
|
751 |
};
|
752 |
|
753 |
-
})(jQuery);
|
326 |
q: lastWord(term),
|
327 |
limit: options.max,
|
328 |
action: 'messages_autocomplete_results',
|
329 |
+
'cookie': encodeURIComponent(document.cookie)
|
330 |
}, extraParams),
|
331 |
success: function(data) {
|
332 |
var parsed = options.parse && options.parse(data) || parse(data);
|
361 |
jQuery('#send-to-input').removeClass('loading');
|
362 |
};
|
363 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
};
|
365 |
|
366 |
$.Autocompleter.defaults = {
|
727 |
field.focus();
|
728 |
};
|
729 |
|
730 |
+
})(jQuery);
|
bp-core/deprecated/js/autocomplete/jquery.autocomplete.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
-
!function(a){a.fn.extend({autocomplete:function(b,c){var d="string"==typeof b;return c=a.extend({},a.Autocompleter.defaults,{url:d?b:null,data:d?null:b,delay:d?a.Autocompleter.defaults.delay:10,max:c&&!c.scroll?10:150},c),c.highlight=c.highlight||function(a){return a},this.each(function(){new a.Autocompleter(this,c)})},result:function(a){return this.bind("result",a)},search:function(a){return this.trigger("search",[a])},flushCache:function(){return this.trigger("flushCache")},setOptions:function(a){return this.trigger("setOptions",[a])},unautocomplete:function(){return this.trigger("unautocomplete")}}),a.Autocompleter=function(b,c){function d(){var a=
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
+
!function(a){a.fn.extend({autocomplete:function(b,c){var d="string"==typeof b;return c=a.extend({},a.Autocompleter.defaults,{url:d?b:null,data:d?null:b,delay:d?a.Autocompleter.defaults.delay:10,max:c&&!c.scroll?10:150},c),c.highlight=c.highlight||function(a){return a},this.each(function(){new a.Autocompleter(this,c)})},result:function(a){return this.bind("result",a)},search:function(a){return this.trigger("search",[a])},flushCache:function(){return this.trigger("flushCache")},setOptions:function(a){return this.trigger("setOptions",[a])},unautocomplete:function(){return this.trigger("unautocomplete")}}),a.Autocompleter=function(b,c){function d(){var a=w.selected();if(!a)return!1;var b=a.result;if(s=b,c.multiple){var d=f(r.val());d.length>1&&(b=d.slice(0,d.length-1).join(c.multipleSeparator)+c.multipleSeparator+b),b+=c.multipleSeparator}return r.val(b),j(),r.trigger("result",[a.data,a.value]),!0}function e(a,b){if(p==q.DEL)return void w.hide();var d=r.val();(b||d!=s)&&(s=d,d=g(d),d.length>=c.minChars?(r.addClass(c.loadingClass),jQuery("#send-to-input").addClass("loading"),c.matchCase||(d=d.toLowerCase()),l(d,k,j)):(n(),w.hide()))}function f(b){if(!b)return[""];var d=b.split(a.trim(c.multipleSeparator)),e=[];return a.each(d,function(b,c){a.trim(c)&&(e[b]=a.trim(c))}),e}function g(a){if(!c.multiple)return a;var b=f(a);return b[b.length-1]}function h(d,e){c.autoFill&&g(r.val()).toLowerCase()==d.toLowerCase()&&8!=p&&(r.val(r.val()+e.substring(g(s).length)),a.Autocompleter.Selection(b,s.length,s.length+e.length))}function i(){clearTimeout(o),o=setTimeout(j,200)}function j(){w.hide(),clearTimeout(o),n(),c.mustMatch&&r.search(function(a){a||r.val("")})}function k(a,b){if(b&&b.length&&u){n(),w.display(b,a);var c=b[0].value.split(";");b.value=c[0],h(a,b.value),w.show()}else j()}function l(d,e,f){c.matchCase||(d=d.toLowerCase());var h=t.load(d);if(h&&h.length)e(d,h);else if("string"==typeof c.url&&c.url.length>0){var i={};a.each(c.extraParams,function(a,b){i[a]="function"==typeof b?b():b}),a.ajax({mode:"abort",port:"autocomplete"+b.name,dataType:c.dataType,url:c.url,data:a.extend({q:g(d),limit:c.max,action:"messages_autocomplete_results",cookie:encodeURIComponent(document.cookie)},i),success:function(a){var b=c.parse&&c.parse(a)||m(a);t.add(d,b),e(d,b)}})}else f(d)}function m(b){for(var d=[],e=b.split("\n"),f=0;f<e.length;f++){var g=a.trim(e[f]);g&&(g=g.split("|"),d[d.length]={data:g,value:g[0],result:c.formatResult&&c.formatResult(g,g[0])||g[0]})}return d}function n(){r.removeClass(c.loadingClass),jQuery("#send-to-input").removeClass("loading")}var o,p,q={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34},r=a(b).attr("autocomplete","off").addClass(c.inputClass),s="",t=a.Autocompleter.Cache(c),u=0,v={mouseDownOnSelect:!1},w=a.Autocompleter.Select(c,b,d,v);r.keydown(function(b){switch(p=b.keyCode,b.keyCode){case q.UP:b.preventDefault(),w.visible()?w.prev():e(0,!0);break;case q.DOWN:b.preventDefault(),w.visible()?w.next():e(0,!0);break;case q.PAGEUP:b.preventDefault(),w.visible()?w.pageUp():e(0,!0);break;case q.PAGEDOWN:b.preventDefault(),w.visible()?w.pageDown():e(0,!0);break;case c.multiple&&","==a.trim(c.multipleSeparator)&&q.COMMA:case q.TAB:case q.RETURN:d()&&(c.multiple||r.blur(),b.preventDefault(),r.focus());break;case q.ESC:w.hide();break;default:clearTimeout(o),o=setTimeout(e,c.delay)}}).keypress(function(){}).focus(function(){u++}).blur(function(){u=0,v.mouseDownOnSelect||i()}).click(function(){u++>1&&!w.visible()&&e(0,!0)}).bind("search",function(){function b(a,b){var d;if(b&&b.length)for(var e=0;e<b.length;e++)if(b[e].result.toLowerCase()==a.toLowerCase()){d=b[e];break}"function"==typeof c?c(d):r.trigger("result",d&&[d.data,d.value])}var c=arguments.length>1?arguments[1]:null;a.each(f(r.val()),function(a,c){l(c,b,b)})}).bind("flushCache",function(){t.flush()}).bind("setOptions",function(){a.extend(c,arguments[1]),"data"in arguments[1]&&t.populate()}).bind("unautocomplete",function(){w.unbind(),r.unbind()})},a.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:!1,matchSubset:!0,matchContains:!1,cacheLength:10,max:100,mustMatch:!1,extraParams:{},selectFirst:!0,formatItem:function(a){return a[0]},autoFill:!1,width:0,multiple:!1,multipleSeparator:", ",highlight:function(a,b){return a.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")},scroll:!0,scrollHeight:250,attachTo:"body"},a.Autocompleter.Cache=function(b){function c(a,c){b.matchCase||(a=a.toLowerCase());var d=a.indexOf(c);return-1==d?!1:0==d||b.matchContains}function d(a,c){h>b.cacheLength&&f(),g[a]||h++,g[a]=c}function e(){if(!b.data)return!1;var c={},e=0;b.url||(b.cacheLength=1),c[""]=[];for(var f=0,g=b.data.length;g>f;f++){var h=b.data[f];h="string"==typeof h?[h]:h;var i=b.formatItem(h,f+1,b.data.length);if(i!==!1){var j=i.charAt(0).toLowerCase();c[j]||(c[j]=[]);var k={value:i,data:h,result:b.formatResult&&b.formatResult(h)||i};c[j].push(k),e++<b.max&&c[""].push(k)}}a.each(c,function(a,c){b.cacheLength++,d(a,c)})}function f(){g={},h=0}var g={},h=0;return setTimeout(e,25),{flush:f,add:d,populate:e,load:function(d){if(!b.cacheLength||!h)return null;if(!b.url&&b.matchContains){var e=[];for(var f in g)if(f.length>0){var i=g[f];a.each(i,function(a,b){c(b.value,d)&&e.push(b)})}return e}if(g[d])return g[d];if(b.matchSubset)for(var j=d.length-1;j>=b.minChars;j--){var i=g[d.substr(0,j)];if(i){var e=[];return a.each(i,function(a,b){c(b.value,d)&&(e[e.length]=b)}),e}}return null}}},a.Autocompleter.Select=function(b,c,d,e){function f(){s&&(n=a("<div/>").hide().addClass(b.resultsClass).css("position","absolute").appendTo(b.attachTo),o=a("<ul>").appendTo(n).mouseover(function(b){g(b).nodeName&&"LI"==g(b).nodeName.toUpperCase()&&(q=a("li",o).removeClass(p.ACTIVE).index(g(b)),a(g(b)).addClass(p.ACTIVE))}).click(function(b){return a(g(b)).addClass(p.ACTIVE),d(),c.focus(),!1}).mousedown(function(){e.mouseDownOnSelect=!0}).mouseup(function(){e.mouseDownOnSelect=!1}),b.width>0&&n.css("width",b.width),s=!1)}function g(a){for(var b=a.target;b&&"LI"!=b.tagName;)b=b.parentNode;return b?b:[]}function h(a){l.slice(q,q+1).removeClass(),i(a);var c=l.slice(q,q+1).addClass(p.ACTIVE);if(b.scroll){var d=0;l.slice(0,q).each(function(){d+=this.offsetHeight}),d+c[0].offsetHeight-o.scrollTop()>o[0].clientHeight?o.scrollTop(d+c[0].offsetHeight-o.innerHeight()):d<o.scrollTop()&&o.scrollTop(d)}}function i(a){q+=a,0>q?q=l.size()-1:q>=l.size()&&(q=0)}function j(a){return b.max&&b.max<a?b.max:a}function k(){o.empty();for(var c=j(m.length),d=0;c>d;d++)if(m[d]){var e=b.formatItem(m[d].data,d+1,c,m[d].value,r);if(e!==!1){var f=a("<li>").html(b.highlight(e,r)).addClass(d%2==0?"ac_event":"ac_odd").appendTo(o)[0];a.data(f,"ac_data",m[d])}}l=o.find("li"),b.selectFirst&&(l.slice(0,1).addClass(p.ACTIVE),q=0),o.bgiframe()}var l,m,n,o,p={ACTIVE:"ac_over"},q=-1,r="",s=!0;return{display:function(a,b){f(),m=a,r=b,k()},next:function(){h(1)},prev:function(){h(-1)},pageUp:function(){h(0!=q&&0>q-8?-q:-8)},pageDown:function(){h(q!=l.size()-1&&q+8>l.size()?l.size()-1-q:8)},hide:function(){n&&n.hide(),q=-1},visible:function(){return n&&n.is(":visible")},current:function(){return this.visible()&&(l.filter("."+p.ACTIVE)[0]||b.selectFirst&&l[0])},show:function(){var d=a(c).offset();if(n.css({width:"string"==typeof b.width||b.width>0?b.width:a(c).width(),top:d.top+c.offsetHeight,left:d.left}).show(),b.scroll&&(o.scrollTop(0),o.css({maxHeight:b.scrollHeight,overflow:"auto"}),a.browser.msie&&"undefined"==typeof document.body.style.maxHeight)){var e=0;l.each(function(){e+=this.offsetHeight});var f=e>b.scrollHeight;o.css("height",f?b.scrollHeight:e),f||l.width(o.width()-parseInt(l.css("padding-left"))-parseInt(l.css("padding-right")))}},selected:function(){var b=l&&l.filter("."+p.ACTIVE).removeClass(p.ACTIVE);return b&&b.length&&a.data(b[0],"ac_data")},unbind:function(){n&&n.remove()}}},a.Autocompleter.Selection=function(a,b,c){if(a.createTextRange){var d=a.createTextRange();d.collapse(!0),d.moveStart("character",b),d.moveEnd("character",c),d.select()}else a.setSelectionRange?a.setSelectionRange(b,c):a.selectionStart&&(a.selectionStart=b,a.selectionEnd=c);a.focus()}}(jQuery);
|
bp-core/deprecated/js/autocomplete/jquery.autocompletefb.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
jQuery.fn.autoCompletefb=function(a){var b=this,c={ul:b,urlLookup:[""],acOptions:{},foundClass:".friend-tab",inputClass:".send-to-input"};a&&jQuery.extend(c,a);var d={params:c,removeFind:function(a){return d.removeUsername(a),jQuery(a).unbind("click").parent().remove(),jQuery(c.inputClass,b).focus(),b.acfb},removeUsername:function(a){var b=a.parentNode.id.substr(a.parentNode.id.indexOf("-")+1);jQuery("#send-to-usernames").removeClass(b)}};return jQuery(c.foundClass+" img.p").click(function(){d.removeFind(this)}),jQuery(c.inputClass,b).autocomplete(c.urlLookup,c.acOptions),jQuery(c.inputClass,b).result(function(a,e,f){var f=c.foundClass.replace(/\./,""),e=String(e).split(" ("),g=e[1].substr(0,e[1].length-1);if(0===jQuery(c.inputClass).siblings("#un-"+g).length){var h="#link-"+g,i=jQuery(h).attr("href"),j='<li class="'+f+'" id="un-'+g+'"><span><a href="'+i+'">'+e[0]+'</a></span> <span class="p">X</span></li>',k=jQuery(c.inputClass,b).before(j);jQuery("#send-to-usernames").addClass(g),jQuery(".p",k[0].previousSibling).click(function(){d.removeFind(this)})}jQuery(c.inputClass,b).val("")}),jQuery(c.inputClass,b).focus(),d};
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
jQuery.fn.autoCompletefb=function(a){var b=this,c={ul:b,urlLookup:[""],acOptions:{},foundClass:".friend-tab",inputClass:".send-to-input"};a&&jQuery.extend(c,a);var d={params:c,removeFind:function(a){return d.removeUsername(a),jQuery(a).unbind("click").parent().remove(),jQuery(c.inputClass,b).focus(),b.acfb},removeUsername:function(a){var b=a.parentNode.id.substr(a.parentNode.id.indexOf("-")+1);jQuery("#send-to-usernames").removeClass(b)}};return jQuery(c.foundClass+" img.p").click(function(){d.removeFind(this)}),jQuery(c.inputClass,b).autocomplete(c.urlLookup,c.acOptions),jQuery(c.inputClass,b).result(function(a,e,f){var f=c.foundClass.replace(/\./,""),e=String(e).split(" ("),g=e[1].substr(0,e[1].length-1);if(0===jQuery(c.inputClass).siblings("#un-"+g).length){var h="#link-"+g,i=jQuery(h).attr("href"),j='<li class="'+f+'" id="un-'+g+'"><span><a href="'+i+'">'+e[0]+'</a></span> <span class="p">X</span></li>',k=jQuery(c.inputClass,b).before(j);jQuery("#send-to-usernames").addClass(g),jQuery(".p",k[0].previousSibling).click(function(){d.removeFind(this)})}jQuery(c.inputClass,b).val("")}),jQuery(c.inputClass,b).focus(),d};
|
bp-core/deprecated/js/autocomplete/jquery.bgiframe.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
!function(a){function b(a){return a&&a.constructor===Number?a+"px":a}a.fn.bgiframe=a.browser.msie&&/msie 6\.0/i.test(navigator.userAgent)?function(c){c=a.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:!0,src:"javascript:false;"},c);var d='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+c.src+'"style="display:block;position:absolute;z-index:-1;'+(c.opacity!==!1?"filter:Alpha(Opacity='0');":"")+"top:"+("auto"==c.top?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":b(c.top))+";left:"+("auto"==c.left?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":b(c.left))+";width:"+("auto"==c.width?"expression(this.parentNode.offsetWidth+'px')":b(c.width))+";height:"+("auto"==c.height?"expression(this.parentNode.offsetHeight+'px')":b(c.height))+';"/>';return this.each(function(){0===a(this).children("iframe.bgiframe").length&&this.insertBefore(document.createElement(d),this.firstChild)})}:function(){return this},a.fn.bgIframe=a.fn.bgiframe}(jQuery);
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
!function(a){function b(a){return a&&a.constructor===Number?a+"px":a}a.fn.bgiframe=a.browser.msie&&/msie 6\.0/i.test(navigator.userAgent)?function(c){c=a.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:!0,src:"javascript:false;"},c);var d='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+c.src+'"style="display:block;position:absolute;z-index:-1;'+(c.opacity!==!1?"filter:Alpha(Opacity='0');":"")+"top:"+("auto"==c.top?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":b(c.top))+";left:"+("auto"==c.left?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":b(c.left))+";width:"+("auto"==c.width?"expression(this.parentNode.offsetWidth+'px')":b(c.width))+";height:"+("auto"==c.height?"expression(this.parentNode.offsetHeight+'px')":b(c.height))+';"/>';return this.each(function(){0===a(this).children("iframe.bgiframe").length&&this.insertBefore(document.createElement(d),this.firstChild)})}:function(){return this},a.fn.bgIframe=a.fn.bgiframe}(jQuery);
|
bp-core/deprecated/js/autocomplete/jquery.dimensions.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
!function(a){a.dimensions={version:"@VERSION"},a.each(["Height","Width"],function(c,d){a.fn["inner"+d]=function(){if(this[0]){var a="Height"==d?"Top":"Left",c="Height"==d?"Bottom":"Right";return this[d.toLowerCase()]()+b(this,"padding"+a)+b(this,"padding"+c)}},a.fn["outer"+d]=function(c){if(this[0]){var e="Height"==d?"Top":"Left",f="Height"==d?"Bottom":"Right";return c=a.extend({margin:!1},c||{}),this[d.toLowerCase()]()+b(this,"border"+e+"Width")+b(this,"border"+f+"Width")+b(this,"padding"+e)+b(this,"padding"+f)+(c.margin?b(this,"margin"+e)+b(this,"margin"+f):0)}}}),a.each(["Left","Top"],function(b,c){a.fn["scroll"+c]=function(b){return this[0]?void 0!=b?this.each(function(){this==window||this==document?window.scrollTo("Left"==c?b:a(window).scrollLeft(),"Top"==c?b:a(window).scrollTop()):this["scroll"+c]=b}):this[0]==window||this[0]==document?self["Left"==c?"pageXOffset":"pageYOffset"]||a.boxModel&&document.documentElement["scroll"+c]||document.body["scroll"+c]:this[0]["scroll"+c]:void 0}}),a.fn.extend({position:function(){var a,c,d,e,f=this[0];return f&&(d=this.offsetParent(),a=this.offset(),c=d.offset(),a.top-=b(f,"marginTop"),a.left-=b(f,"marginLeft"),c.top+=b(d,"borderTopWidth"),c.left+=b(d,"borderLeftWidth"),e={top:a.top-c.top,left:a.left-c.left}),e},offsetParent:function(){for(var b=this[0].offsetParent;b&&!/^body|html$/i.test(b.tagName)&&"static"==a.css(b,"position");)b=b.offsetParent;return a(b)}});var b=function(b,c){return parseInt(a.css(b.jquery?b[0]:b,c))||0}}(jQuery);
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
!function(a){a.dimensions={version:"@VERSION"},a.each(["Height","Width"],function(c,d){a.fn["inner"+d]=function(){if(this[0]){var a="Height"==d?"Top":"Left",c="Height"==d?"Bottom":"Right";return this[d.toLowerCase()]()+b(this,"padding"+a)+b(this,"padding"+c)}},a.fn["outer"+d]=function(c){if(this[0]){var e="Height"==d?"Top":"Left",f="Height"==d?"Bottom":"Right";return c=a.extend({margin:!1},c||{}),this[d.toLowerCase()]()+b(this,"border"+e+"Width")+b(this,"border"+f+"Width")+b(this,"padding"+e)+b(this,"padding"+f)+(c.margin?b(this,"margin"+e)+b(this,"margin"+f):0)}}}),a.each(["Left","Top"],function(b,c){a.fn["scroll"+c]=function(b){return this[0]?void 0!=b?this.each(function(){this==window||this==document?window.scrollTo("Left"==c?b:a(window).scrollLeft(),"Top"==c?b:a(window).scrollTop()):this["scroll"+c]=b}):this[0]==window||this[0]==document?self["Left"==c?"pageXOffset":"pageYOffset"]||a.boxModel&&document.documentElement["scroll"+c]||document.body["scroll"+c]:this[0]["scroll"+c]:void 0}}),a.fn.extend({position:function(){var a,c,d,e,f=this[0];return f&&(d=this.offsetParent(),a=this.offset(),c=d.offset(),a.top-=b(f,"marginTop"),a.left-=b(f,"marginLeft"),c.top+=b(d,"borderTopWidth"),c.left+=b(d,"borderLeftWidth"),e={top:a.top-c.top,left:a.left-c.left}),e},offsetParent:function(){for(var b=this[0].offsetParent;b&&!/^body|html$/i.test(b.tagName)&&"static"==a.css(b,"position");)b=b.offsetParent;return a(b)}});var b=function(b,c){return parseInt(a.css(b.jquery?b[0]:b,c))||0}}(jQuery);
|
bp-core/deprecated/js/jquery-scroll-to.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(b){return a.isFunction(b)||"object"==typeof b?b:{top:b,left:b}}var c=a.scrollTo=function(b,c,d){return a(window).scrollTo(b,c,d)};return c.defaults={axis:"xy",duration:parseFloat(a.fn.jquery)>=1.3?0:1,limit:!0},c.window=function(){return a(window)._scrollable()},a.fn._scrollable=function(){return this.map(function(){var b=this,c=!b.nodeName||-1!==a.inArray(b.nodeName.toLowerCase(),["iframe","#document","html","body"]);if(!c)return b;var d=(b.contentWindow||b).document||b.ownerDocument||b;return/webkit/i.test(navigator.userAgent)||"BackCompat"===d.compatMode?d.body:d.documentElement})},a.fn.scrollTo=function(d,e,f){return"object"==typeof e&&(f=e,e=0),"function"==typeof f&&(f={onAfter:f}),"max"===d&&(d=9e9),f=a.extend({},c.defaults,f),e=e||f.duration,f.queue=f.queue&&f.axis.length>1,f.queue&&(e/=2),f.offset=b(f.offset),f.over=b(f.over),this._scrollable().each(function(){function g(a){j.animate(l,e,f.easing,a&&function(){a.call(this,k,f)})}if(null!==d){var h,i=this,j=a(i),k=d,l={},m=j.is("html,body");switch(typeof k){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(k)){k=b(k);break}if(k=m?a(k):a(k,this),!k.length)return;case"object":(k.is||k.style)&&(h=(k=a(k)).offset())}var n=a.isFunction(f.offset)&&f.offset(i,k)||f.offset;a.each(f.axis.split(""),function(a,b){var d="x"===b?"Left":"Top",e=d.toLowerCase(),o="scroll"+d,p=i[o],q=c.max(i,b);if(h)l[o]=h[e]+(m?0:p-j.offset()[e]),f.margin&&(l[o]-=parseInt(k.css("margin"+d))||0,l[o]-=parseInt(k.css("border"+d+"Width"))||0),l[o]+=n[e]||0,f.over[e]&&(l[o]+=k["x"===b?"width":"height"]()*f.over[e]);else{var r=k[e];l[o]=r.slice&&"%"===r.slice(-1)?parseFloat(r)/100*q:r}f.limit&&/^\d+$/.test(l[o])&&(l[o]=l[o]<=0?0:Math.min(l[o],q)),!a&&f.queue&&(p!==l[o]&&g(f.onAfterFirst),delete l[o])}),g(f.onAfter)}}).end()},c.max=function(b,c){var d="x"===c?"Width":"Height",e="scroll"+d;if(!a(b).is("html,body"))return b[e]-a(b)[d.toLowerCase()]();var f="client"+d,g=b.ownerDocument.documentElement,h=b.ownerDocument.body;return Math.max(g[e],h[e])-Math.min(g[f],h[f])},c});
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(b){return a.isFunction(b)||"object"==typeof b?b:{top:b,left:b}}var c=a.scrollTo=function(b,c,d){return a(window).scrollTo(b,c,d)};return c.defaults={axis:"xy",duration:parseFloat(a.fn.jquery)>=1.3?0:1,limit:!0},c.window=function(){return a(window)._scrollable()},a.fn._scrollable=function(){return this.map(function(){var b=this,c=!b.nodeName||-1!==a.inArray(b.nodeName.toLowerCase(),["iframe","#document","html","body"]);if(!c)return b;var d=(b.contentWindow||b).document||b.ownerDocument||b;return/webkit/i.test(navigator.userAgent)||"BackCompat"===d.compatMode?d.body:d.documentElement})},a.fn.scrollTo=function(d,e,f){return"object"==typeof e&&(f=e,e=0),"function"==typeof f&&(f={onAfter:f}),"max"===d&&(d=9e9),f=a.extend({},c.defaults,f),e=e||f.duration,f.queue=f.queue&&f.axis.length>1,f.queue&&(e/=2),f.offset=b(f.offset),f.over=b(f.over),this._scrollable().each(function(){function g(a){j.animate(l,e,f.easing,a&&function(){a.call(this,k,f)})}if(null!==d){var h,i=this,j=a(i),k=d,l={},m=j.is("html,body");switch(typeof k){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(k)){k=b(k);break}if(k=m?a(k):a(k,this),!k.length)return;case"object":(k.is||k.style)&&(h=(k=a(k)).offset())}var n=a.isFunction(f.offset)&&f.offset(i,k)||f.offset;a.each(f.axis.split(""),function(a,b){var d="x"===b?"Left":"Top",e=d.toLowerCase(),o="scroll"+d,p=i[o],q=c.max(i,b);if(h)l[o]=h[e]+(m?0:p-j.offset()[e]),f.margin&&(l[o]-=parseInt(k.css("margin"+d))||0,l[o]-=parseInt(k.css("border"+d+"Width"))||0),l[o]+=n[e]||0,f.over[e]&&(l[o]+=k["x"===b?"width":"height"]()*f.over[e]);else{var r=k[e];l[o]=r.slice&&"%"===r.slice(-1)?parseFloat(r)/100*q:r}f.limit&&/^\d+$/.test(l[o])&&(l[o]=l[o]<=0?0:Math.min(l[o],q)),!a&&f.queue&&(p!==l[o]&&g(f.onAfterFirst),delete l[o])}),g(f.onAfter)}}).end()},c.max=function(b,c){var d="x"===c?"Width":"Height",e="scroll"+d;if(!a(b).is("html,body"))return b[e]-a(b)[d.toLowerCase()]();var f="client"+d,g=b.ownerDocument.documentElement,h=b.ownerDocument.body;return Math.max(g[e],h[e])-Math.min(g[f],h[f])},c});
|
bp-core/js/confirm.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
jQuery(document).ready(function(){jQuery("a.confirm").click(function(){return confirm(BP_Confirm.are_you_sure)?!0:!1})});
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
jQuery(document).ready(function(){jQuery("a.confirm").click(function(){return confirm(BP_Confirm.are_you_sure)?!0:!1})});
|
bp-core/js/jquery-cookie.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});
|
bp-core/js/jquery-query.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
function bp_get_querystring(a){var b=location.search.split(a+"=")[1];return b?decodeURIComponent(b.split("&")[0]):null}
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
function bp_get_querystring(a){var b=location.search.split(a+"=")[1];return b?decodeURIComponent(b.split("&")[0]):null}
|
bp-core/js/jquery.atwho.js
CHANGED
@@ -1,25 +1,19 @@
|
|
1 |
-
/*! jquery.atwho - v0.5.
|
2 |
-
* Copyright (c) 2014 chord.luo <chord.luo@gmail.com>;
|
3 |
-
* homepage: http://ichord.github.com/At.js
|
4 |
* Licensed MIT
|
5 |
*/
|
6 |
-
(function (root, factory) {
|
7 |
-
if (typeof define === 'function' && define.amd) {
|
8 |
-
// AMD. Register as an anonymous module.
|
9 |
-
define(["jquery"], function ($) {
|
10 |
-
return (root.returnExportsGlobal = factory($));
|
11 |
-
});
|
12 |
-
} else if (typeof exports === 'object') {
|
13 |
-
// Node. Does not work with strict CommonJS, but
|
14 |
-
// only CommonJS-like enviroments that support module.exports,
|
15 |
-
// like Node.
|
16 |
-
module.exports = factory(require("jquery"));
|
17 |
-
} else {
|
18 |
-
factory(jQuery);
|
19 |
-
}
|
20 |
-
}(this, function ($) {
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
__slice = [].slice;
|
24 |
|
25 |
App = (function() {
|
@@ -28,37 +22,20 @@ App = (function() {
|
|
28 |
this.controllers = {};
|
29 |
this.alias_maps = {};
|
30 |
this.$inputor = $(inputor);
|
|
|
31 |
this.setIframe();
|
32 |
this.listen();
|
33 |
}
|
34 |
|
35 |
-
App.prototype.
|
36 |
-
if ((this.$el = $("#atwho-container", doc)).length === 0) {
|
37 |
-
return $(doc.body).append(this.$el = $("<div id='atwho-container'></div>"));
|
38 |
-
}
|
39 |
-
};
|
40 |
-
|
41 |
-
App.prototype.setIframe = function(iframe, standalone) {
|
42 |
-
var _ref;
|
43 |
-
if (standalone == null) {
|
44 |
-
standalone = false;
|
45 |
-
}
|
46 |
if (iframe) {
|
47 |
this.window = iframe.contentWindow;
|
48 |
this.document = iframe.contentDocument || this.window.document;
|
49 |
-
this.iframe = iframe;
|
50 |
} else {
|
51 |
this.document = document;
|
52 |
this.window = window;
|
53 |
-
this.iframe = null;
|
54 |
-
}
|
55 |
-
if (this.iframeStandalone = standalone) {
|
56 |
-
if ((_ref = this.$el) != null) {
|
57 |
-
_ref.remove();
|
58 |
-
}
|
59 |
-
return this.createContainer(this.document);
|
60 |
-
} else {
|
61 |
-
return this.createContainer(document);
|
62 |
}
|
63 |
};
|
64 |
|
@@ -121,7 +98,8 @@ App = (function() {
|
|
121 |
};
|
122 |
})(this)).on('click.atwhoInner', (function(_this) {
|
123 |
return function(e) {
|
124 |
-
|
|
|
125 |
};
|
126 |
})(this));
|
127 |
};
|
@@ -134,8 +112,7 @@ App = (function() {
|
|
134 |
c.destroy();
|
135 |
delete this.controllers[_];
|
136 |
}
|
137 |
-
this.$inputor.off('.atwhoInner');
|
138 |
-
return this.$el.remove();
|
139 |
};
|
140 |
|
141 |
App.prototype.dispatch = function() {
|
@@ -248,9 +225,7 @@ Controller = (function() {
|
|
248 |
this.pos = 0;
|
249 |
this.cur_rect = null;
|
250 |
this.range = null;
|
251 |
-
|
252 |
-
this.app.$el.append(this.$el = $("<div id='atwho-ground-" + this.id + "'></div>"));
|
253 |
-
}
|
254 |
this.model = new Model(this);
|
255 |
this.view = new View(this);
|
256 |
}
|
@@ -305,14 +280,10 @@ Controller = (function() {
|
|
305 |
};
|
306 |
|
307 |
Controller.prototype.content = function() {
|
308 |
-
var range;
|
309 |
if (this.$inputor.is('textarea, input')) {
|
310 |
return this.$inputor.val();
|
311 |
} else {
|
312 |
-
|
313 |
-
return;
|
314 |
-
}
|
315 |
-
return (range.startContainer.textContent || "").slice(0, range.startOffset);
|
316 |
}
|
317 |
};
|
318 |
|
@@ -342,19 +313,14 @@ Controller = (function() {
|
|
342 |
};
|
343 |
|
344 |
Controller.prototype.rect = function() {
|
345 |
-
var c,
|
346 |
if (!(c = this.$inputor.caret('offset', this.pos - 1, {
|
347 |
iframe: this.app.iframe
|
348 |
}))) {
|
349 |
return;
|
350 |
}
|
351 |
-
if (this.
|
352 |
-
|
353 |
-
c.left += iframe_offset.left;
|
354 |
-
c.top += iframe_offset.top;
|
355 |
-
}
|
356 |
-
if (this.$inputor.is('[contentEditable]')) {
|
357 |
-
c = this.cur_rect || (this.cur_rect = c);
|
358 |
}
|
359 |
scale_bottom = this.app.document.selection ? 0 : 2;
|
360 |
return {
|
@@ -365,20 +331,19 @@ Controller = (function() {
|
|
365 |
};
|
366 |
|
367 |
Controller.prototype.reset_rect = function() {
|
368 |
-
if (this.$inputor.
|
369 |
return this.cur_rect = null;
|
370 |
}
|
371 |
};
|
372 |
|
373 |
Controller.prototype.mark_range = function() {
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
return this.ie8_range = this.app.document.selection.createRange();
|
382 |
}
|
383 |
};
|
384 |
|
@@ -397,15 +362,15 @@ Controller = (function() {
|
|
397 |
};
|
398 |
|
399 |
Controller.prototype.insert = function(content, $li) {
|
400 |
-
var $inputor,
|
401 |
$inputor = this.$inputor;
|
402 |
-
|
403 |
if ($inputor.is('textarea, input')) {
|
404 |
source = $inputor.val();
|
405 |
start_str = source.slice(0, Math.max(this.query.head_pos - this.at.length, 0));
|
406 |
-
text = "" + start_str +
|
407 |
$inputor.val(text);
|
408 |
-
$inputor.caret('pos', start_str.length +
|
409 |
iframe: this.app.iframe
|
410 |
});
|
411 |
} else if (range = this.range) {
|
@@ -413,19 +378,16 @@ Controller = (function() {
|
|
413 |
range.setStart(range.endContainer, Math.max(pos, 0));
|
414 |
range.setEnd(range.endContainer, range.endOffset);
|
415 |
range.deleteContents();
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
range.setEndAfter(node);
|
421 |
-
range.collapse(false);
|
422 |
-
}
|
423 |
sel = this.app.window.getSelection();
|
424 |
sel.removeAllRanges();
|
425 |
sel.addRange(range);
|
426 |
} else if (range = this.ie8_range) {
|
427 |
range.moveStart('character', this.query.end_pos - this.query.head_pos - this.at.length);
|
428 |
-
range.pasteHTML(
|
429 |
range.collapse(false);
|
430 |
range.select();
|
431 |
}
|
@@ -553,10 +515,8 @@ View = (function() {
|
|
553 |
return $menu.on('mouseenter.atwho-view', 'li', function(e) {
|
554 |
$menu.find('.cur').removeClass('cur');
|
555 |
return $(e.currentTarget).addClass('cur');
|
556 |
-
}).on('click
|
557 |
return function(e) {
|
558 |
-
$menu.find('.cur').removeClass('cur');
|
559 |
-
$(e.currentTarget).addClass('cur');
|
560 |
_this.choose(e);
|
561 |
return e.preventDefault();
|
562 |
};
|
@@ -581,14 +541,10 @@ View = (function() {
|
|
581 |
};
|
582 |
|
583 |
View.prototype.reposition = function(rect) {
|
584 |
-
var offset,
|
585 |
-
|
586 |
-
if (rect.bottom + this.$el.height() - $(_window).scrollTop() > $(_window).height()) {
|
587 |
rect.bottom = rect.top - this.$el.height();
|
588 |
}
|
589 |
-
if (rect.left > (overflowOffset = $(_window).width() - this.$el.width() - 5)) {
|
590 |
-
rect.left = overflowOffset;
|
591 |
-
}
|
592 |
offset = {
|
593 |
left: rect.left,
|
594 |
top: rect.bottom
|
@@ -607,10 +563,7 @@ View = (function() {
|
|
607 |
if (!next.length) {
|
608 |
next = this.$el.find('li:first');
|
609 |
}
|
610 |
-
next.addClass('cur');
|
611 |
-
return this.$el.animate({
|
612 |
-
scrollTop: Math.max(0, cur.innerHeight() * (next.index() + 2) - this.$el.height())
|
613 |
-
}, 150);
|
614 |
};
|
615 |
|
616 |
View.prototype.prev = function() {
|
@@ -620,10 +573,7 @@ View = (function() {
|
|
620 |
if (!prev.length) {
|
621 |
prev = this.$el.find('li:last');
|
622 |
}
|
623 |
-
prev.addClass('cur');
|
624 |
-
return this.$el.animate({
|
625 |
-
scrollTop: Math.max(0, cur.innerHeight() * (prev.index() + 2) - this.$el.height())
|
626 |
-
}, 150);
|
627 |
};
|
628 |
|
629 |
View.prototype.show = function() {
|
@@ -635,7 +585,6 @@ View = (function() {
|
|
635 |
this.context.mark_range();
|
636 |
if (!this.visible()) {
|
637 |
this.$el.show();
|
638 |
-
this.$el.scrollTop(0);
|
639 |
this.context.trigger('shown');
|
640 |
}
|
641 |
if (rect = this.context.rect()) {
|
@@ -723,14 +672,12 @@ DEFAULT_CALLBACKS = {
|
|
723 |
return _results;
|
724 |
},
|
725 |
matcher: function(flag, subtext, should_start_with_space) {
|
726 |
-
var match, regexp
|
727 |
flag = flag.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
728 |
if (should_start_with_space) {
|
729 |
flag = '(?:^|\\s)' + flag;
|
730 |
}
|
731 |
-
|
732 |
-
_y = decodeURI("%C3%BF");
|
733 |
-
regexp = new RegExp("" + flag + "([A-Za-z" + _a + "-" + _y + "0-9_\+\-]*)$|" + flag + "([^\\x00-\\xff]*)$", 'gi');
|
734 |
match = regexp.exec(subtext);
|
735 |
if (match) {
|
736 |
return match[2] || match[1];
|
@@ -743,7 +690,7 @@ DEFAULT_CALLBACKS = {
|
|
743 |
_results = [];
|
744 |
for (_i = 0, _len = data.length; _i < _len; _i++) {
|
745 |
item = data[_i];
|
746 |
-
if (~
|
747 |
_results.push(item);
|
748 |
}
|
749 |
}
|
@@ -758,7 +705,7 @@ DEFAULT_CALLBACKS = {
|
|
758 |
_results = [];
|
759 |
for (_i = 0, _len = items.length; _i < _len; _i++) {
|
760 |
item = items[_i];
|
761 |
-
item.atwho_order =
|
762 |
if (item.atwho_order > -1) {
|
763 |
_results.push(item);
|
764 |
}
|
@@ -792,22 +739,22 @@ DEFAULT_CALLBACKS = {
|
|
792 |
return value;
|
793 |
},
|
794 |
inserting_wrapper: function($inputor, content, suffix) {
|
795 |
-
var wrapped_content;
|
796 |
-
|
797 |
if ($inputor.is('textarea, input')) {
|
798 |
-
return '' + content +
|
799 |
} else if ($inputor.attr('contentEditable') === 'true') {
|
800 |
-
|
801 |
if (/firefox/i.test(navigator.userAgent)) {
|
802 |
-
wrapped_content = "<span>" + content +
|
803 |
} else {
|
804 |
-
suffix = "<span contenteditable='false'>" +
|
805 |
wrapped_content = "<span contenteditable='false'>" + content + suffix + "</span>";
|
806 |
}
|
807 |
if (this.app.document.selection) {
|
808 |
wrapped_content = "<span contenteditable='true'>" + content + "</span>";
|
809 |
}
|
810 |
-
return wrapped_content
|
811 |
}
|
812 |
}
|
813 |
};
|
@@ -819,8 +766,8 @@ Api = {
|
|
819 |
return c.model.load(data);
|
820 |
}
|
821 |
},
|
822 |
-
setIframe: function(iframe
|
823 |
-
this.setIframe(iframe
|
824 |
return null;
|
825 |
},
|
826 |
run: function() {
|
@@ -832,11 +779,14 @@ Api = {
|
|
832 |
}
|
833 |
};
|
834 |
|
|
|
|
|
835 |
$.fn.atwho = function(method) {
|
836 |
var result, _args;
|
837 |
_args = arguments;
|
|
|
838 |
result = null;
|
839 |
-
this.filter('textarea, input, [contenteditable=
|
840 |
var $this, app;
|
841 |
if (!(app = ($this = $(this)).data("atwho"))) {
|
842 |
$this.data('atwho', (app = new App(this)));
|
@@ -870,6 +820,5 @@ $.fn.atwho["default"] = {
|
|
870 |
delay: null
|
871 |
};
|
872 |
|
873 |
-
|
874 |
-
|
875 |
-
}));
|
1 |
+
/*! jquery.atwho - v0.5.0 - 2014-07-14
|
2 |
+
* Copyright (c) 2014 chord.luo <chord.luo@gmail.com>;
|
3 |
+
* homepage: http://ichord.github.com/At.js
|
4 |
* Licensed MIT
|
5 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
+
(function() {
|
8 |
+
(function(factory) {
|
9 |
+
if (typeof define === 'function' && define.amd) {
|
10 |
+
return define(['jquery'], factory);
|
11 |
+
} else {
|
12 |
+
return factory(window.jQuery);
|
13 |
+
}
|
14 |
+
})(function($) {
|
15 |
+
|
16 |
+
var $CONTAINER, Api, App, Controller, DEFAULT_CALLBACKS, KEY_CODE, Model, View,
|
17 |
__slice = [].slice;
|
18 |
|
19 |
App = (function() {
|
22 |
this.controllers = {};
|
23 |
this.alias_maps = {};
|
24 |
this.$inputor = $(inputor);
|
25 |
+
this.iframe = null;
|
26 |
this.setIframe();
|
27 |
this.listen();
|
28 |
}
|
29 |
|
30 |
+
App.prototype.setIframe = function(iframe) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
if (iframe) {
|
32 |
this.window = iframe.contentWindow;
|
33 |
this.document = iframe.contentDocument || this.window.document;
|
34 |
+
return this.iframe = iframe;
|
35 |
} else {
|
36 |
this.document = document;
|
37 |
this.window = window;
|
38 |
+
return this.iframe = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
};
|
41 |
|
98 |
};
|
99 |
})(this)).on('click.atwhoInner', (function(_this) {
|
100 |
return function(e) {
|
101 |
+
var _ref;
|
102 |
+
return (_ref = _this.controller()) != null ? _ref.view.hide(e) : void 0;
|
103 |
};
|
104 |
})(this));
|
105 |
};
|
112 |
c.destroy();
|
113 |
delete this.controllers[_];
|
114 |
}
|
115 |
+
return this.$inputor.off('.atwhoInner');
|
|
|
116 |
};
|
117 |
|
118 |
App.prototype.dispatch = function() {
|
225 |
this.pos = 0;
|
226 |
this.cur_rect = null;
|
227 |
this.range = null;
|
228 |
+
$CONTAINER.append(this.$el = $("<div id='atwho-ground-" + this.id + "'></div>"));
|
|
|
|
|
229 |
this.model = new Model(this);
|
230 |
this.view = new View(this);
|
231 |
}
|
280 |
};
|
281 |
|
282 |
Controller.prototype.content = function() {
|
|
|
283 |
if (this.$inputor.is('textarea, input')) {
|
284 |
return this.$inputor.val();
|
285 |
} else {
|
286 |
+
return this.$inputor.text();
|
|
|
|
|
|
|
287 |
}
|
288 |
};
|
289 |
|
313 |
};
|
314 |
|
315 |
Controller.prototype.rect = function() {
|
316 |
+
var c, scale_bottom;
|
317 |
if (!(c = this.$inputor.caret('offset', this.pos - 1, {
|
318 |
iframe: this.app.iframe
|
319 |
}))) {
|
320 |
return;
|
321 |
}
|
322 |
+
if (this.$inputor.attr('contentEditable') === 'true') {
|
323 |
+
c = (this.cur_rect || (this.cur_rect = c)) || c;
|
|
|
|
|
|
|
|
|
|
|
324 |
}
|
325 |
scale_bottom = this.app.document.selection ? 0 : 2;
|
326 |
return {
|
331 |
};
|
332 |
|
333 |
Controller.prototype.reset_rect = function() {
|
334 |
+
if (this.$inputor.attr('contentEditable') === 'true') {
|
335 |
return this.cur_rect = null;
|
336 |
}
|
337 |
};
|
338 |
|
339 |
Controller.prototype.mark_range = function() {
|
340 |
+
if (this.$inputor.attr('contentEditable') === 'true') {
|
341 |
+
if (this.app.window.getSelection) {
|
342 |
+
this.range = this.app.window.getSelection().getRangeAt(0);
|
343 |
+
}
|
344 |
+
if (this.app.document.selection) {
|
345 |
+
return this.ie8_range = this.app.document.selection.createRange();
|
346 |
+
}
|
|
|
347 |
}
|
348 |
};
|
349 |
|
362 |
};
|
363 |
|
364 |
Controller.prototype.insert = function(content, $li) {
|
365 |
+
var $inputor, content_node, pos, range, sel, source, start_str, text, wrapped_content;
|
366 |
$inputor = this.$inputor;
|
367 |
+
wrapped_content = this.callbacks('inserting_wrapper').call(this, $inputor, content, this.get_opt("suffix"));
|
368 |
if ($inputor.is('textarea, input')) {
|
369 |
source = $inputor.val();
|
370 |
start_str = source.slice(0, Math.max(this.query.head_pos - this.at.length, 0));
|
371 |
+
text = "" + start_str + wrapped_content + (source.slice(this.query['end_pos'] || 0));
|
372 |
$inputor.val(text);
|
373 |
+
$inputor.caret('pos', start_str.length + wrapped_content.length, {
|
374 |
iframe: this.app.iframe
|
375 |
});
|
376 |
} else if (range = this.range) {
|
378 |
range.setStart(range.endContainer, Math.max(pos, 0));
|
379 |
range.setEnd(range.endContainer, range.endOffset);
|
380 |
range.deleteContents();
|
381 |
+
content_node = $(wrapped_content, this.app.document)[0];
|
382 |
+
range.insertNode(content_node);
|
383 |
+
range.setEndAfter(content_node);
|
384 |
+
range.collapse(false);
|
|
|
|
|
|
|
385 |
sel = this.app.window.getSelection();
|
386 |
sel.removeAllRanges();
|
387 |
sel.addRange(range);
|
388 |
} else if (range = this.ie8_range) {
|
389 |
range.moveStart('character', this.query.end_pos - this.query.head_pos - this.at.length);
|
390 |
+
range.pasteHTML(wrapped_content);
|
391 |
range.collapse(false);
|
392 |
range.select();
|
393 |
}
|
515 |
return $menu.on('mouseenter.atwho-view', 'li', function(e) {
|
516 |
$menu.find('.cur').removeClass('cur');
|
517 |
return $(e.currentTarget).addClass('cur');
|
518 |
+
}).on('click', (function(_this) {
|
519 |
return function(e) {
|
|
|
|
|
520 |
_this.choose(e);
|
521 |
return e.preventDefault();
|
522 |
};
|
541 |
};
|
542 |
|
543 |
View.prototype.reposition = function(rect) {
|
544 |
+
var offset, _ref;
|
545 |
+
if (rect.bottom + this.$el.height() - $(window).scrollTop() > $(window).height()) {
|
|
|
546 |
rect.bottom = rect.top - this.$el.height();
|
547 |
}
|
|
|
|
|
|
|
548 |
offset = {
|
549 |
left: rect.left,
|
550 |
top: rect.bottom
|
563 |
if (!next.length) {
|
564 |
next = this.$el.find('li:first');
|
565 |
}
|
566 |
+
return next.addClass('cur');
|
|
|
|
|
|
|
567 |
};
|
568 |
|
569 |
View.prototype.prev = function() {
|
573 |
if (!prev.length) {
|
574 |
prev = this.$el.find('li:last');
|
575 |
}
|
576 |
+
return prev.addClass('cur');
|
|
|
|
|
|
|
577 |
};
|
578 |
|
579 |
View.prototype.show = function() {
|
585 |
this.context.mark_range();
|
586 |
if (!this.visible()) {
|
587 |
this.$el.show();
|
|
|
588 |
this.context.trigger('shown');
|
589 |
}
|
590 |
if (rect = this.context.rect()) {
|
672 |
return _results;
|
673 |
},
|
674 |
matcher: function(flag, subtext, should_start_with_space) {
|
675 |
+
var match, regexp;
|
676 |
flag = flag.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
677 |
if (should_start_with_space) {
|
678 |
flag = '(?:^|\\s)' + flag;
|
679 |
}
|
680 |
+
regexp = new RegExp(flag + '([A-Za-z0-9_\+\-]*)$|' + flag + '([^\\x00-\\xff]*)$', 'gi');
|
|
|
|
|
681 |
match = regexp.exec(subtext);
|
682 |
if (match) {
|
683 |
return match[2] || match[1];
|
690 |
_results = [];
|
691 |
for (_i = 0, _len = data.length; _i < _len; _i++) {
|
692 |
item = data[_i];
|
693 |
+
if (~item[search_key].toLowerCase().indexOf(query.toLowerCase())) {
|
694 |
_results.push(item);
|
695 |
}
|
696 |
}
|
705 |
_results = [];
|
706 |
for (_i = 0, _len = items.length; _i < _len; _i++) {
|
707 |
item = items[_i];
|
708 |
+
item.atwho_order = item[search_key].toLowerCase().indexOf(query.toLowerCase());
|
709 |
if (item.atwho_order > -1) {
|
710 |
_results.push(item);
|
711 |
}
|
739 |
return value;
|
740 |
},
|
741 |
inserting_wrapper: function($inputor, content, suffix) {
|
742 |
+
var new_suffix, wrapped_content;
|
743 |
+
new_suffix = suffix === "" ? suffix : suffix || " ";
|
744 |
if ($inputor.is('textarea, input')) {
|
745 |
+
return '' + content + new_suffix;
|
746 |
} else if ($inputor.attr('contentEditable') === 'true') {
|
747 |
+
new_suffix = suffix === "" ? suffix : suffix || " ";
|
748 |
if (/firefox/i.test(navigator.userAgent)) {
|
749 |
+
wrapped_content = "<span>" + content + new_suffix + "</span>";
|
750 |
} else {
|
751 |
+
suffix = "<span contenteditable='false'>" + new_suffix + "<span>";
|
752 |
wrapped_content = "<span contenteditable='false'>" + content + suffix + "</span>";
|
753 |
}
|
754 |
if (this.app.document.selection) {
|
755 |
wrapped_content = "<span contenteditable='true'>" + content + "</span>";
|
756 |
}
|
757 |
+
return wrapped_content;
|
758 |
}
|
759 |
}
|
760 |
};
|
766 |
return c.model.load(data);
|
767 |
}
|
768 |
},
|
769 |
+
setIframe: function(iframe) {
|
770 |
+
this.setIframe(iframe);
|
771 |
return null;
|
772 |
},
|
773 |
run: function() {
|
779 |
}
|
780 |
};
|
781 |
|
782 |
+
$CONTAINER = $("<div id='atwho-container'></div>");
|
783 |
+
|
784 |
$.fn.atwho = function(method) {
|
785 |
var result, _args;
|
786 |
_args = arguments;
|
787 |
+
$('body').append($CONTAINER);
|
788 |
result = null;
|
789 |
+
this.filter('textarea, input, [contenteditable=true]').each(function() {
|
790 |
var $this, app;
|
791 |
if (!(app = ($this = $(this)).data("atwho"))) {
|
792 |
$this.data('atwho', (app = new App(this)));
|
820 |
delay: null
|
821 |
};
|
822 |
|
823 |
+
});
|
824 |
+
}).call(this);
|
|
bp-core/js/jquery.atwho.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
-
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(c){return a.returnExportsGlobal=b(c)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){var b,c,d,e,f,g,h,i=[].slice;c=function(){function b(b){this.current_flag=null,this.controllers={},this.alias_maps={},this.$inputor=a(b),this.setIframe(),this.listen()}return b.prototype.createContainer=function(b){return 0===(this.$el=a("#atwho-container",b)).length?a(b.body).append(this.$el=a("<div id='atwho-container'></div>")):void 0},b.prototype.setIframe=function(a,b){var c;return null==b&&(b=!1),a?(this.window=a.contentWindow,this.document=a.contentDocument||this.window.document,this.iframe=a):(this.document=document,this.window=window,this.iframe=null),(this.iframeStandalone=b)?(null!=(c=this.$el)&&c.remove(),this.createContainer(this.document)):this.createContainer(document)},b.prototype.controller=function(a){var b,c,d,e;if(this.alias_maps[a])c=this.controllers[this.alias_maps[a]];else{e=this.controllers;for(d in e)if(b=e[d],d===a){c=b;break}}return c?c:this.controllers[this.current_flag]},b.prototype.set_context_for=function(a){return this.current_flag=a,this},b.prototype.reg=function(a,b){var c,e;return c=(e=this.controllers)[a]||(e[a]=new d(this,a)),b.alias&&(this.alias_maps[b.alias]=a),c.init(b),this},b.prototype.listen=function(){return this.$inputor.on("keyup.atwhoInner",function(a){return function(b){return a.on_keyup(b)}}(this)).on("keydown.atwhoInner",function(a){return function(b){return a.on_keydown(b)}}(this)).on("scroll.atwhoInner",function(a){return function(b){var c;return null!=(c=a.controller())?c.view.hide(b):void 0}}(this)).on("blur.atwhoInner",function(a){return function(b){var c;return(c=a.controller())?c.view.hide(b,c.get_opt("display_timeout")):void 0}}(this)).on("click.atwhoInner",function(a){return function(){return a.dispatch()}}(this))},b.prototype.shutdown=function(){var a,b,c;c=this.controllers;for(b in c)a=c[b],a.destroy(),delete this.controllers[b];return this.$inputor.off(".atwhoInner"),this.$el.remove()},b.prototype.dispatch=function(){return a.map(this.controllers,function(a){return function(b){var c;return(c=b.get_opt("delay"))?(clearTimeout(a.delayedCallback),a.delayedCallback=setTimeout(function(){return b.look_up()?a.set_context_for(b.at):void 0},c)):b.look_up()?a.set_context_for(b.at):void 0}}(this))},b.prototype.on_keyup=function(b){var c;switch(b.keyCode){case f.ESC:b.preventDefault(),null!=(c=this.controller())&&c.view.hide();break;case f.DOWN:case f.UP:case f.CTRL:a.noop();break;case f.P:case f.N:b.ctrlKey||this.dispatch();break;default:this.dispatch()}},b.prototype.on_keydown=function(b){var c,d;if(c=null!=(d=this.controller())?d.view:void 0,c&&c.visible())switch(b.keyCode){case f.ESC:b.preventDefault(),c.hide(b);break;case f.UP:b.preventDefault(),c.prev();break;case f.DOWN:b.preventDefault(),c.next();break;case f.P:if(!b.ctrlKey)return;b.preventDefault(),c.prev();break;case f.N:if(!b.ctrlKey)return;b.preventDefault(),c.next();break;case f.TAB:case f.ENTER:if(!c.visible())return;b.preventDefault(),c.choose(b);break;default:a.noop()}},b}(),d=function(){function b(b,c){this.app=b,this.at=c,this.$inputor=this.app.$inputor,this.id=this.$inputor[0].id||this.uid(),this.setting=null,this.query=null,this.pos=0,this.cur_rect=null,this.range=null,0===(this.$el=a("#atwho-ground-"+this.id,this.app.$el)).length&&this.app.$el.append(this.$el=a("<div id='atwho-ground-"+this.id+"'></div>")),this.model=new g(this),this.view=new h(this)}return b.prototype.uid=function(){return(Math.random().toString(16)+"000000000").substr(2,8)+(new Date).getTime()},b.prototype.init=function(b){return this.setting=a.extend({},this.setting||a.fn.atwho["default"],b),this.view.init(),this.model.reload(this.setting.data)},b.prototype.destroy=function(){return this.trigger("beforeDestroy"),this.model.destroy(),this.view.destroy(),this.$el.remove()},b.prototype.call_default=function(){var b,c,d;d=arguments[0],b=2<=arguments.length?i.call(arguments,1):[];try{return e[d].apply(this,b)}catch(f){return c=f,a.error(""+c+" Or maybe At.js doesn't have function "+d)}},b.prototype.trigger=function(a,b){var c,d;return null==b&&(b=[]),b.push(this),c=this.get_opt("alias"),d=c?""+a+"-"+c+".atwho":""+a+".atwho",this.$inputor.trigger(d,b)},b.prototype.callbacks=function(a){return this.get_opt("callbacks")[a]||e[a]},b.prototype.get_opt=function(a){var b;try{return this.setting[a]}catch(c){return b=c,null}},b.prototype.content=function(){var a;if(this.$inputor.is("textarea, input"))return this.$inputor.val();if(a=this.mark_range())return(a.startContainer.textContent||"").slice(0,a.startOffset)},b.prototype.catch_query=function(){var a,b,c,d,e,f;return b=this.content(),a=this.$inputor.caret("pos",{iframe:this.app.iframe}),f=b.slice(0,a),d=this.callbacks("matcher").call(this,this.at,f,this.get_opt("start_with_space")),"string"==typeof d&&d.length<=this.get_opt("max_len",20)?(e=a-d.length,c=e+d.length,this.pos=e,d={text:d,head_pos:e,end_pos:c},this.trigger("matched",[this.at,d.text])):(d=null,this.view.hide()),this.query=d},b.prototype.rect=function(){var b,c,d;if(b=this.$inputor.caret("offset",this.pos-1,{iframe:this.app.iframe}))return this.app.iframe&&!this.app.iframeStandalone&&(c=a(this.app.iframe).offset(),b.left+=c.left,b.top+=c.top),this.$inputor.is("[contentEditable]")&&(b=this.cur_rect||(this.cur_rect=b)),d=this.app.document.selection?0:2,{left:b.left,top:b.top,bottom:b.top+b.height+d}},b.prototype.reset_rect=function(){return this.$inputor.is("[contentEditable]")?this.cur_rect=null:void 0},b.prototype.mark_range=function(){var a;if(this.$inputor.is("[contentEditable]"))return this.app.window.getSelection&&(a=this.app.window.getSelection()).rangeCount>0?this.range=a.getRangeAt(0):this.app.document.selection?this.ie8_range=this.app.document.selection.createRange():void 0},b.prototype.insert_content_for=function(b){var c,d,e;return d=b.data("value"),e=this.get_opt("insert_tpl"),this.$inputor.is("textarea, input")||!e?d:(c=a.extend({},b.data("item-data"),{"atwho-data-value":d,"atwho-at":this.at}),this.callbacks("tpl_eval").call(this,e,c))},b.prototype.insert=function(b){var c,d,e,f,g,h,i,j,k,l,m,n;if(c=this.$inputor,k=this.callbacks("inserting_wrapper").call(this,c,b,this.get_opt("suffix")),c.is("textarea, input"))h=c.val(),i=h.slice(0,Math.max(this.query.head_pos-this.at.length,0)),j=""+i+k+h.slice(this.query.end_pos||0),c.val(j),c.caret("pos",i.length+k.length,{iframe:this.app.iframe});else if(f=this.range){for(e=f.startOffset-(this.query.end_pos-this.query.head_pos)-this.at.length,f.setStart(f.endContainer,Math.max(e,0)),f.setEnd(f.endContainer,f.endOffset),f.deleteContents(),n=a(k,this.app.document),l=0,m=n.length;m>l;l++)d=n[l],f.insertNode(d),f.setEndAfter(d),f.collapse(!1);g=this.app.window.getSelection(),g.removeAllRanges(),g.addRange(f)}else(f=this.ie8_range)&&(f.moveStart("character",this.query.end_pos-this.query.head_pos-this.at.length),f.pasteHTML(k),f.collapse(!1),f.select());return c.is(":focus")||c.focus(),c.change()},b.prototype.render_view=function(a){var b;return b=this.get_opt("search_key"),a=this.callbacks("sorter").call(this,this.query.text,a.slice(0,1001),b),this.view.render(a.slice(0,this.get_opt("limit")))},b.prototype.look_up=function(){var b,c;if(b=this.catch_query())return c=function(a){return a&&a.length>0?this.render_view(a):this.view.hide()},this.model.query(b.text,a.proxy(c,this)),b},b}(),g=function(){function b(a){this.context=a,this.at=this.context.at,this.storage=this.context.$inputor}return b.prototype.destroy=function(){return this.storage.data(this.at,null)},b.prototype.saved=function(){return this.fetch()>0},b.prototype.query=function(a,b){var c,d,e;return c=this.fetch(),d=this.context.get_opt("search_key"),c=this.context.callbacks("filter").call(this.context,a,c,d)||[],e=this.context.callbacks("remote_filter"),c.length>0||!e&&0===c.length?b(c):e.call(this.context,a,b)},b.prototype.fetch=function(){return this.storage.data(this.at)||[]},b.prototype.save=function(a){return this.storage.data(this.at,this.context.callbacks("before_save").call(this.context,a||[]))},b.prototype.load=function(a){return!this.saved()&&a?this._load(a):void 0},b.prototype.reload=function(a){return this._load(a)},b.prototype._load=function(b){return"string"==typeof b?a.ajax(b,{dataType:"json"}).done(function(a){return function(b){return a.save(b)}}(this)):this.save(b)},b}(),h=function(){function b(b){this.context=b,this.$el=a("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>"),this.timeout_id=null,this.context.$el.append(this.$el),this.bind_event()}return b.prototype.init=function(){var a;return a=this.context.get_opt("alias")||this.context.at.charCodeAt(0),this.$el.attr({id:"at-view-"+a})},b.prototype.destroy=function(){return this.$el.remove()},b.prototype.bind_event=function(){var b;return b=this.$el.find("ul"),b.on("mouseenter.atwho-view","li",function(c){return b.find(".cur").removeClass("cur"),a(c.currentTarget).addClass("cur")}).on("click.atwho-view","li",function(c){return function(d){return b.find(".cur").removeClass("cur"),a(d.currentTarget).addClass("cur"),c.choose(d),d.preventDefault()}}(this))},b.prototype.visible=function(){return this.$el.is(":visible")},b.prototype.choose=function(a){var b,c;return(b=this.$el.find(".cur")).length&&(c=this.context.insert_content_for(b),this.context.insert(this.context.callbacks("before_insert").call(this.context,c,b),b),this.context.trigger("inserted",[b,a]),this.hide(a)),this.context.get_opt("hide_without_suffix")?this.stop_showing=!0:void 0},b.prototype.reposition=function(b){var c,d,e,f;return f=this.context.app.iframeStandalone?this.context.app.window:window,b.bottom+this.$el.height()-a(f).scrollTop()>a(f).height()&&(b.bottom=b.top-this.$el.height()),b.left>(d=a(f).width()-this.$el.width()-5)&&(b.left=d),c={left:b.left,top:b.bottom},null!=(e=this.context.callbacks("before_reposition"))&&e.call(this.context,c),this.$el.offset(c),this.context.trigger("reposition",[c])},b.prototype.next=function(){var a,b;return a=this.$el.find(".cur").removeClass("cur"),b=a.next(),b.length||(b=this.$el.find("li:first")),b.addClass("cur"),this.$el.animate({scrollTop:Math.max(0,a.innerHeight()*(b.index()+2)-this.$el.height())},150)},b.prototype.prev=function(){var a,b;return a=this.$el.find(".cur").removeClass("cur"),b=a.prev(),b.length||(b=this.$el.find("li:last")),b.addClass("cur"),this.$el.animate({scrollTop:Math.max(0,a.innerHeight()*(b.index()+2)-this.$el.height())},150)},b.prototype.show=function(){var a;return this.stop_showing?void(this.stop_showing=!1):(this.context.mark_range(),this.visible()||(this.$el.show(),this.$el.scrollTop(0),this.context.trigger("shown")),(a=this.context.rect())?this.reposition(a):void 0)},b.prototype.hide=function(a,b){var c;if(this.visible())return isNaN(b)?(this.context.reset_rect(),this.$el.hide(),this.context.trigger("hidden",[a])):(c=function(a){return function(){return a.hide()}}(this),clearTimeout(this.timeout_id),this.timeout_id=setTimeout(c,b))},b.prototype.render=function(b){var c,d,e,f,g,h,i;if(!(a.isArray(b)&&b.length>0))return void this.hide();for(this.$el.find("ul").empty(),d=this.$el.find("ul"),g=this.context.get_opt("tpl"),h=0,i=b.length;i>h;h++)e=b[h],e=a.extend({},e,{"atwho-at":this.context.at}),f=this.context.callbacks("tpl_eval").call(this.context,g,e),c=a(this.context.callbacks("highlighter").call(this.context,f,this.context.query.text)),c.data("item-data",e),d.append(c);return this.show(),this.context.get_opt("highlight_first")?d.find("li:first").addClass("cur"):void 0},b}(),f={DOWN:40,UP:38,ESC:27,TAB:9,ENTER:13,CTRL:17,P:80,N:78},e={before_save:function(b){var c,d,e,f;if(!a.isArray(b))return b;for(f=[],d=0,e=b.length;e>d;d++)c=b[d],f.push(a.isPlainObject(c)?c:{name:c});return f},matcher:function(a,b,c){var d,e,f,g;return a=a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),c&&(a="(?:^|\\s)"+a),f=decodeURI("%C3%80"),g=decodeURI("%C3%BF"),e=new RegExp(""+a+"([A-Za-z"+f+"-"+g+"0-9_+-]*)$|"+a+"([^\\x00-\\xff]*)$","gi"),d=e.exec(b),d?d[2]||d[1]:null},filter:function(a,b,c){var d,e,f,g;for(g=[],e=0,f=b.length;f>e;e++)d=b[e],~new String(d[c]).toLowerCase().indexOf(a.toLowerCase())&&g.push(d);return g},remote_filter:null,sorter:function(a,b,c){var d,e,f,g;if(!a)return b;for(g=[],e=0,f=b.length;f>e;e++)d=b[e],d.atwho_order=new String(d[c]).toLowerCase().indexOf(a.toLowerCase()),d.atwho_order>-1&&g.push(d);return g.sort(function(a,b){return a.atwho_order-b.atwho_order})},tpl_eval:function(a,b){var c;try{return a.replace(/\$\{([^\}]*)\}/g,function(a,c){return b[c]})}catch(d){return c=d,""}},highlighter:function(a,b){var c;return b?(c=new RegExp(">\\s*(\\w*?)("+b.replace("+","\\+")+")(\\w*)\\s*<","ig"),a.replace(c,function(a,b,c,d){return"> "+b+"<strong>"+c+"</strong>"+d+" <"})):a},before_insert:function(a){return a},inserting_wrapper:function(a,b,c){var d;return c=""===c?c:c||" ",a.is("textarea, input")?""+b+c:"true"===a.attr("contentEditable")?(c=" "===c?" ":c,/firefox/i.test(navigator.userAgent)?d="<span>"+b+c+"</span>":(c="<span contenteditable='false'>"+c+"</span>",d="<span contenteditable='false'>"+b+c+"</span>"),this.app.document.selection&&(d="<span contenteditable='true'>"+b+"</span>"),d+"<span></span>"):void 0}},b={load:function(a,b){var c;return(c=this.controller(a))?c.model.load(b):void 0},setIframe:function(a,b){return this.setIframe(a,b),null},run:function(){return this.dispatch()},destroy:function(){return this.shutdown(),this.$inputor.data("atwho",null)}},a.fn.atwho=function(d){var e,f;return f=arguments,e=null,this.filter('textarea, input, [contenteditable=""], [contenteditable=true]').each(function(){var g,h;return(h=(g=a(this)).data("atwho"))||g.data("atwho",h=new c(this)),"object"!=typeof d&&d?b[d]&&h?e=b[d].apply(h,Array.prototype.slice.call(f,1)):a.error("Method "+d+" does not exist on jQuery.caret"):h.reg(d.at,d)}),e||this},a.fn.atwho["default"]={at:void 0,alias:void 0,data:null,tpl:"<li data-value='${atwho-at}${name}'>${name}</li>",insert_tpl:"<span id='${id}'>${atwho-data-value}</span>",callbacks:e,search_key:"name",suffix:void 0,hide_without_suffix:!1,start_with_space:!0,highlight_first:!0,limit:5,max_len:20,display_timeout:300,delay:null}});
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
+
(function(){!function(a){return"function"==typeof define&&define.amd?define(["jquery"],a):a(window.jQuery)}(function(a){var b,c,d,e,f,g,h,i,j=[].slice;d=function(){function b(b){this.current_flag=null,this.controllers={},this.alias_maps={},this.$inputor=a(b),this.iframe=null,this.setIframe(),this.listen()}return b.prototype.setIframe=function(a){return a?(this.window=a.contentWindow,this.document=a.contentDocument||this.window.document,this.iframe=a):(this.document=document,this.window=window,this.iframe=null)},b.prototype.controller=function(a){var b,c,d,e;if(this.alias_maps[a])c=this.controllers[this.alias_maps[a]];else{e=this.controllers;for(d in e)if(b=e[d],d===a){c=b;break}}return c?c:this.controllers[this.current_flag]},b.prototype.set_context_for=function(a){return this.current_flag=a,this},b.prototype.reg=function(a,b){var c,d;return c=(d=this.controllers)[a]||(d[a]=new e(this,a)),b.alias&&(this.alias_maps[b.alias]=a),c.init(b),this},b.prototype.listen=function(){return this.$inputor.on("keyup.atwhoInner",function(a){return function(b){return a.on_keyup(b)}}(this)).on("keydown.atwhoInner",function(a){return function(b){return a.on_keydown(b)}}(this)).on("scroll.atwhoInner",function(a){return function(b){var c;return null!=(c=a.controller())?c.view.hide(b):void 0}}(this)).on("blur.atwhoInner",function(a){return function(b){var c;return(c=a.controller())?c.view.hide(b,c.get_opt("display_timeout")):void 0}}(this)).on("click.atwhoInner",function(a){return function(b){var c;return null!=(c=a.controller())?c.view.hide(b):void 0}}(this))},b.prototype.shutdown=function(){var a,b,c;c=this.controllers;for(b in c)a=c[b],a.destroy(),delete this.controllers[b];return this.$inputor.off(".atwhoInner")},b.prototype.dispatch=function(){return a.map(this.controllers,function(a){return function(b){var c;return(c=b.get_opt("delay"))?(clearTimeout(a.delayedCallback),a.delayedCallback=setTimeout(function(){return b.look_up()?a.set_context_for(b.at):void 0},c)):b.look_up()?a.set_context_for(b.at):void 0}}(this))},b.prototype.on_keyup=function(b){var c;switch(b.keyCode){case g.ESC:b.preventDefault(),null!=(c=this.controller())&&c.view.hide();break;case g.DOWN:case g.UP:case g.CTRL:a.noop();break;case g.P:case g.N:b.ctrlKey||this.dispatch();break;default:this.dispatch()}},b.prototype.on_keydown=function(b){var c,d;if(c=null!=(d=this.controller())?d.view:void 0,c&&c.visible())switch(b.keyCode){case g.ESC:b.preventDefault(),c.hide(b);break;case g.UP:b.preventDefault(),c.prev();break;case g.DOWN:b.preventDefault(),c.next();break;case g.P:if(!b.ctrlKey)return;b.preventDefault(),c.prev();break;case g.N:if(!b.ctrlKey)return;b.preventDefault(),c.next();break;case g.TAB:case g.ENTER:if(!c.visible())return;b.preventDefault(),c.choose(b);break;default:a.noop()}},b}(),e=function(){function c(c,d){this.app=c,this.at=d,this.$inputor=this.app.$inputor,this.id=this.$inputor[0].id||this.uid(),this.setting=null,this.query=null,this.pos=0,this.cur_rect=null,this.range=null,b.append(this.$el=a("<div id='atwho-ground-"+this.id+"'></div>")),this.model=new h(this),this.view=new i(this)}return c.prototype.uid=function(){return(Math.random().toString(16)+"000000000").substr(2,8)+(new Date).getTime()},c.prototype.init=function(b){return this.setting=a.extend({},this.setting||a.fn.atwho["default"],b),this.view.init(),this.model.reload(this.setting.data)},c.prototype.destroy=function(){return this.trigger("beforeDestroy"),this.model.destroy(),this.view.destroy(),this.$el.remove()},c.prototype.call_default=function(){var b,c,d;d=arguments[0],b=2<=arguments.length?j.call(arguments,1):[];try{return f[d].apply(this,b)}catch(e){return c=e,a.error(""+c+" Or maybe At.js doesn't have function "+d)}},c.prototype.trigger=function(a,b){var c,d;return null==b&&(b=[]),b.push(this),c=this.get_opt("alias"),d=c?""+a+"-"+c+".atwho":""+a+".atwho",this.$inputor.trigger(d,b)},c.prototype.callbacks=function(a){return this.get_opt("callbacks")[a]||f[a]},c.prototype.get_opt=function(a){var b;try{return this.setting[a]}catch(c){return b=c,null}},c.prototype.content=function(){return this.$inputor.is("textarea, input")?this.$inputor.val():this.$inputor.text()},c.prototype.catch_query=function(){var a,b,c,d,e,f;return b=this.content(),a=this.$inputor.caret("pos",{iframe:this.app.iframe}),f=b.slice(0,a),d=this.callbacks("matcher").call(this,this.at,f,this.get_opt("start_with_space")),"string"==typeof d&&d.length<=this.get_opt("max_len",20)?(e=a-d.length,c=e+d.length,this.pos=e,d={text:d,head_pos:e,end_pos:c},this.trigger("matched",[this.at,d.text])):(d=null,this.view.hide()),this.query=d},c.prototype.rect=function(){var a,b;if(a=this.$inputor.caret("offset",this.pos-1,{iframe:this.app.iframe}))return"true"===this.$inputor.attr("contentEditable")&&(a=this.cur_rect||(this.cur_rect=a)||a),b=this.app.document.selection?0:2,{left:a.left,top:a.top,bottom:a.top+a.height+b}},c.prototype.reset_rect=function(){return"true"===this.$inputor.attr("contentEditable")?this.cur_rect=null:void 0},c.prototype.mark_range=function(){return"true"===this.$inputor.attr("contentEditable")&&(this.app.window.getSelection&&(this.range=this.app.window.getSelection().getRangeAt(0)),this.app.document.selection)?this.ie8_range=this.app.document.selection.createRange():void 0},c.prototype.insert_content_for=function(b){var c,d,e;return d=b.data("value"),e=this.get_opt("insert_tpl"),this.$inputor.is("textarea, input")||!e?d:(c=a.extend({},b.data("item-data"),{"atwho-data-value":d,"atwho-at":this.at}),this.callbacks("tpl_eval").call(this,e,c))},c.prototype.insert=function(b){var c,d,e,f,g,h,i,j,k;return c=this.$inputor,k=this.callbacks("inserting_wrapper").call(this,c,b,this.get_opt("suffix")),c.is("textarea, input")?(h=c.val(),i=h.slice(0,Math.max(this.query.head_pos-this.at.length,0)),j=""+i+k+h.slice(this.query.end_pos||0),c.val(j),c.caret("pos",i.length+k.length,{iframe:this.app.iframe})):(f=this.range)?(e=f.startOffset-(this.query.end_pos-this.query.head_pos)-this.at.length,f.setStart(f.endContainer,Math.max(e,0)),f.setEnd(f.endContainer,f.endOffset),f.deleteContents(),d=a(k,this.app.document)[0],f.insertNode(d),f.setEndAfter(d),f.collapse(!1),g=this.app.window.getSelection(),g.removeAllRanges(),g.addRange(f)):(f=this.ie8_range)&&(f.moveStart("character",this.query.end_pos-this.query.head_pos-this.at.length),f.pasteHTML(k),f.collapse(!1),f.select()),c.is(":focus")||c.focus(),c.change()},c.prototype.render_view=function(a){var b;return b=this.get_opt("search_key"),a=this.callbacks("sorter").call(this,this.query.text,a.slice(0,1001),b),this.view.render(a.slice(0,this.get_opt("limit")))},c.prototype.look_up=function(){var b,c;if(b=this.catch_query())return c=function(a){return a&&a.length>0?this.render_view(a):this.view.hide()},this.model.query(b.text,a.proxy(c,this)),b},c}(),h=function(){function b(a){this.context=a,this.at=this.context.at,this.storage=this.context.$inputor}return b.prototype.destroy=function(){return this.storage.data(this.at,null)},b.prototype.saved=function(){return this.fetch()>0},b.prototype.query=function(a,b){var c,d,e;return c=this.fetch(),d=this.context.get_opt("search_key"),c=this.context.callbacks("filter").call(this.context,a,c,d)||[],e=this.context.callbacks("remote_filter"),c.length>0||!e&&0===c.length?b(c):e.call(this.context,a,b)},b.prototype.fetch=function(){return this.storage.data(this.at)||[]},b.prototype.save=function(a){return this.storage.data(this.at,this.context.callbacks("before_save").call(this.context,a||[]))},b.prototype.load=function(a){return!this.saved()&&a?this._load(a):void 0},b.prototype.reload=function(a){return this._load(a)},b.prototype._load=function(b){return"string"==typeof b?a.ajax(b,{dataType:"json"}).done(function(a){return function(b){return a.save(b)}}(this)):this.save(b)},b}(),i=function(){function b(b){this.context=b,this.$el=a("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>"),this.timeout_id=null,this.context.$el.append(this.$el),this.bind_event()}return b.prototype.init=function(){var a;return a=this.context.get_opt("alias")||this.context.at.charCodeAt(0),this.$el.attr({id:"at-view-"+a})},b.prototype.destroy=function(){return this.$el.remove()},b.prototype.bind_event=function(){var b;return b=this.$el.find("ul"),b.on("mouseenter.atwho-view","li",function(c){return b.find(".cur").removeClass("cur"),a(c.currentTarget).addClass("cur")}).on("click",function(a){return function(b){return a.choose(b),b.preventDefault()}}(this))},b.prototype.visible=function(){return this.$el.is(":visible")},b.prototype.choose=function(a){var b,c;return(b=this.$el.find(".cur")).length&&(c=this.context.insert_content_for(b),this.context.insert(this.context.callbacks("before_insert").call(this.context,c,b),b),this.context.trigger("inserted",[b,a]),this.hide(a)),this.context.get_opt("hide_without_suffix")?this.stop_showing=!0:void 0},b.prototype.reposition=function(b){var c,d;return b.bottom+this.$el.height()-a(window).scrollTop()>a(window).height()&&(b.bottom=b.top-this.$el.height()),c={left:b.left,top:b.bottom},null!=(d=this.context.callbacks("before_reposition"))&&d.call(this.context,c),this.$el.offset(c),this.context.trigger("reposition",[c])},b.prototype.next=function(){var a,b;return a=this.$el.find(".cur").removeClass("cur"),b=a.next(),b.length||(b=this.$el.find("li:first")),b.addClass("cur")},b.prototype.prev=function(){var a,b;return a=this.$el.find(".cur").removeClass("cur"),b=a.prev(),b.length||(b=this.$el.find("li:last")),b.addClass("cur")},b.prototype.show=function(){var a;return this.stop_showing?void(this.stop_showing=!1):(this.context.mark_range(),this.visible()||(this.$el.show(),this.context.trigger("shown")),(a=this.context.rect())?this.reposition(a):void 0)},b.prototype.hide=function(a,b){var c;if(this.visible())return isNaN(b)?(this.context.reset_rect(),this.$el.hide(),this.context.trigger("hidden",[a])):(c=function(a){return function(){return a.hide()}}(this),clearTimeout(this.timeout_id),this.timeout_id=setTimeout(c,b))},b.prototype.render=function(b){var c,d,e,f,g,h,i;if(!(a.isArray(b)&&b.length>0))return void this.hide();for(this.$el.find("ul").empty(),d=this.$el.find("ul"),g=this.context.get_opt("tpl"),h=0,i=b.length;i>h;h++)e=b[h],e=a.extend({},e,{"atwho-at":this.context.at}),f=this.context.callbacks("tpl_eval").call(this.context,g,e),c=a(this.context.callbacks("highlighter").call(this.context,f,this.context.query.text)),c.data("item-data",e),d.append(c);return this.show(),this.context.get_opt("highlight_first")?d.find("li:first").addClass("cur"):void 0},b}(),g={DOWN:40,UP:38,ESC:27,TAB:9,ENTER:13,CTRL:17,P:80,N:78},f={before_save:function(b){var c,d,e,f;if(!a.isArray(b))return b;for(f=[],d=0,e=b.length;e>d;d++)c=b[d],f.push(a.isPlainObject(c)?c:{name:c});return f},matcher:function(a,b,c){var d,e;return a=a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),c&&(a="(?:^|\\s)"+a),e=new RegExp(a+"([A-Za-z0-9_+-]*)$|"+a+"([^\\x00-\\xff]*)$","gi"),d=e.exec(b),d?d[2]||d[1]:null},filter:function(a,b,c){var d,e,f,g;for(g=[],e=0,f=b.length;f>e;e++)d=b[e],~d[c].toLowerCase().indexOf(a.toLowerCase())&&g.push(d);return g},remote_filter:null,sorter:function(a,b,c){var d,e,f,g;if(!a)return b;for(g=[],e=0,f=b.length;f>e;e++)d=b[e],d.atwho_order=d[c].toLowerCase().indexOf(a.toLowerCase()),d.atwho_order>-1&&g.push(d);return g.sort(function(a,b){return a.atwho_order-b.atwho_order})},tpl_eval:function(a,b){var c;try{return a.replace(/\$\{([^\}]*)\}/g,function(a,c){return b[c]})}catch(d){return c=d,""}},highlighter:function(a,b){var c;return b?(c=new RegExp(">\\s*(\\w*?)("+b.replace("+","\\+")+")(\\w*)\\s*<","ig"),a.replace(c,function(a,b,c,d){return"> "+b+"<strong>"+c+"</strong>"+d+" <"})):a},before_insert:function(a){return a},inserting_wrapper:function(a,b,c){var d,e;return d=""===c?c:c||" ",a.is("textarea, input")?""+b+d:"true"===a.attr("contentEditable")?(d=""===c?c:c||" ",/firefox/i.test(navigator.userAgent)?e="<span>"+b+d+"</span>":(c="<span contenteditable='false'>"+d+"<span>",e="<span contenteditable='false'>"+b+c+"</span>"),this.app.document.selection&&(e="<span contenteditable='true'>"+b+"</span>"),e):void 0}},c={load:function(a,b){var c;return(c=this.controller(a))?c.model.load(b):void 0},setIframe:function(a){return this.setIframe(a),null},run:function(){return this.dispatch()},destroy:function(){return this.shutdown(),this.$inputor.data("atwho",null)}},b=a("<div id='atwho-container'></div>"),a.fn.atwho=function(e){var f,g;return g=arguments,a("body").append(b),f=null,this.filter("textarea, input, [contenteditable=true]").each(function(){var b,h;return(h=(b=a(this)).data("atwho"))||b.data("atwho",h=new d(this)),"object"!=typeof e&&e?c[e]&&h?f=c[e].apply(h,Array.prototype.slice.call(g,1)):a.error("Method "+e+" does not exist on jQuery.caret"):h.reg(e.at,e)}),f||this},a.fn.atwho["default"]={at:void 0,alias:void 0,data:null,tpl:"<li data-value='${atwho-at}${name}'>${name}</li>",insert_tpl:"<span id='${id}'>${atwho-data-value}</span>",callbacks:f,search_key:"name",suffix:void 0,hide_without_suffix:!1,start_with_space:!0,highlight_first:!0,limit:5,max_len:20,display_timeout:300,delay:null}})}).call(this);
|
bp-core/js/jquery.caret.js
CHANGED
@@ -36,16 +36,11 @@
|
|
36 |
};
|
37 |
|
38 |
EditableCaret.prototype.getIEPosition = function() {
|
39 |
-
return
|
40 |
};
|
41 |
|
42 |
EditableCaret.prototype.getPosition = function() {
|
43 |
-
|
44 |
-
offset = this.getOffset();
|
45 |
-
inputor_offset = this.$inputor.offset();
|
46 |
-
offset.left -= inputor_offset.left;
|
47 |
-
offset.top -= inputor_offset.top;
|
48 |
-
return offset;
|
49 |
};
|
50 |
|
51 |
EditableCaret.prototype.getOldIEPos = function() {
|
@@ -84,38 +79,25 @@
|
|
84 |
};
|
85 |
|
86 |
EditableCaret.prototype.getOffset = function(pos) {
|
87 |
-
var clonedRange, offset, range, rect
|
88 |
if (oWindow.getSelection && (range = this.range())) {
|
89 |
-
if (range.endOffset - 1
|
90 |
-
|
91 |
-
clonedRange.setStart(range.endContainer, range.endOffset - 1);
|
92 |
-
clonedRange.setEnd(range.endContainer, range.endOffset);
|
93 |
-
rect = clonedRange.getBoundingClientRect();
|
94 |
-
offset = {
|
95 |
-
height: rect.height,
|
96 |
-
left: rect.left + rect.width,
|
97 |
-
top: rect.top
|
98 |
-
};
|
99 |
-
clonedRange.detach();
|
100 |
-
}
|
101 |
-
if (!offset || (offset != null ? offset.height : void 0) === 0) {
|
102 |
-
clonedRange = range.cloneRange();
|
103 |
-
shadowCaret = $(oDocument.createTextNode("|"));
|
104 |
-
clonedRange.insertNode(shadowCaret[0]);
|
105 |
-
clonedRange.selectNode(shadowCaret[0]);
|
106 |
-
rect = clonedRange.getBoundingClientRect();
|
107 |
-
offset = {
|
108 |
-
height: rect.height,
|
109 |
-
left: rect.left,
|
110 |
-
top: rect.top
|
111 |
-
};
|
112 |
-
shadowCaret.remove();
|
113 |
-
clonedRange.detach();
|
114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
} else if (oDocument.selection) {
|
116 |
offset = this.getOldIEOffset();
|
117 |
}
|
118 |
-
if (offset) {
|
119 |
offset.top += $(oWindow).scrollTop();
|
120 |
offset.left += $(oWindow).scrollLeft();
|
121 |
}
|
@@ -224,7 +206,7 @@
|
|
224 |
var $inputor, at_rect, end_range, format, html, mirror, start_range;
|
225 |
$inputor = this.$inputor;
|
226 |
format = function(value) {
|
227 |
-
return
|
228 |
};
|
229 |
if (pos === void 0) {
|
230 |
pos = this.getPos();
|
@@ -325,8 +307,13 @@
|
|
325 |
}
|
326 |
},
|
327 |
offset: function(pos) {
|
328 |
-
var offset;
|
329 |
offset = this.getOffset(pos);
|
|
|
|
|
|
|
|
|
|
|
330 |
return offset;
|
331 |
}
|
332 |
};
|
36 |
};
|
37 |
|
38 |
EditableCaret.prototype.getIEPosition = function() {
|
39 |
+
return $.noop();
|
40 |
};
|
41 |
|
42 |
EditableCaret.prototype.getPosition = function() {
|
43 |
+
return $.noop();
|
|
|
|
|
|
|
|
|
|
|
44 |
};
|
45 |
|
46 |
EditableCaret.prototype.getOldIEPos = function() {
|
79 |
};
|
80 |
|
81 |
EditableCaret.prototype.getOffset = function(pos) {
|
82 |
+
var clonedRange, offset, range, rect;
|
83 |
if (oWindow.getSelection && (range = this.range())) {
|
84 |
+
if (range.endOffset - 1 < 0) {
|
85 |
+
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
+
clonedRange = range.cloneRange();
|
88 |
+
clonedRange.setStart(range.endContainer, range.endOffset - 1);
|
89 |
+
clonedRange.setEnd(range.endContainer, range.endOffset);
|
90 |
+
rect = clonedRange.getBoundingClientRect();
|
91 |
+
offset = {
|
92 |
+
height: rect.height,
|
93 |
+
left: rect.left + rect.width,
|
94 |
+
top: rect.top
|
95 |
+
};
|
96 |
+
clonedRange.detach();
|
97 |
} else if (oDocument.selection) {
|
98 |
offset = this.getOldIEOffset();
|
99 |
}
|
100 |
+
if (offset && !oFrame) {
|
101 |
offset.top += $(oWindow).scrollTop();
|
102 |
offset.left += $(oWindow).scrollLeft();
|
103 |
}
|
206 |
var $inputor, at_rect, end_range, format, html, mirror, start_range;
|
207 |
$inputor = this.$inputor;
|
208 |
format = function(value) {
|
209 |
+
return value.replace(/</g, '<').replace(/>/g, '>').replace(/`/g, '`').replace(/"/g, '"').replace(/\r\n|\r|\n/g, "<br />");
|
210 |
};
|
211 |
if (pos === void 0) {
|
212 |
pos = this.getPos();
|
307 |
}
|
308 |
},
|
309 |
offset: function(pos) {
|
310 |
+
var iOffset, offset;
|
311 |
offset = this.getOffset(pos);
|
312 |
+
if (oFrame) {
|
313 |
+
iOffset = $(oFrame).offset();
|
314 |
+
offset.top += iOffset.top;
|
315 |
+
offset.left += iOffset.left;
|
316 |
+
}
|
317 |
return offset;
|
318 |
}
|
319 |
};
|
bp-core/js/jquery.caret.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
-
(function(){!function(a){return"function"==typeof define&&define.amd?define(["jquery"],a):a(window.jQuery)}(function(a){"use strict";var b,c,d,e,f,g,h,i,j,k,l;return k="caret",b=function(){function b(a){this.$inputor=a,this.domInputor=this.$inputor[0]}return b.prototype.setPos=function(){return this.domInputor},b.prototype.getIEPosition=function(){return
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
+
(function(){!function(a){return"function"==typeof define&&define.amd?define(["jquery"],a):a(window.jQuery)}(function(a){"use strict";var b,c,d,e,f,g,h,i,j,k,l;return k="caret",b=function(){function b(a){this.$inputor=a,this.domInputor=this.$inputor[0]}return b.prototype.setPos=function(){return this.domInputor},b.prototype.getIEPosition=function(){return a.noop()},b.prototype.getPosition=function(){return a.noop()},b.prototype.getOldIEPos=function(){var a,b;return b=h.selection.createRange(),a=h.body.createTextRange(),a.moveToElementText(this.domInputor),a.setEndPoint("EndToEnd",b),a.text.length},b.prototype.getPos=function(){var a,b,c;return(c=this.range())?(a=c.cloneRange(),a.selectNodeContents(this.domInputor),a.setEnd(c.endContainer,c.endOffset),b=a.toString().length,a.detach(),b):h.selection?this.getOldIEPos():void 0},b.prototype.getOldIEOffset=function(){var a,b;return a=h.selection.createRange().duplicate(),a.moveStart("character",-1),b=a.getBoundingClientRect(),{height:b.bottom-b.top,left:b.left,top:b.top}},b.prototype.getOffset=function(){var b,c,d,e;if(j.getSelection&&(d=this.range())){if(d.endOffset-1<0)return null;b=d.cloneRange(),b.setStart(d.endContainer,d.endOffset-1),b.setEnd(d.endContainer,d.endOffset),e=b.getBoundingClientRect(),c={height:e.height,left:e.left+e.width,top:e.top},b.detach()}else h.selection&&(c=this.getOldIEOffset());return c&&!i&&(c.top+=a(j).scrollTop(),c.left+=a(j).scrollLeft()),c},b.prototype.range=function(){var a;if(j.getSelection)return a=j.getSelection(),a.rangeCount>0?a.getRangeAt(0):null},b}(),c=function(){function b(a){this.$inputor=a,this.domInputor=this.$inputor[0]}return b.prototype.getIEPos=function(){var a,b,c,d,e,f,g;return b=this.domInputor,f=h.selection.createRange(),e=0,f&&f.parentElement()===b&&(d=b.value.replace(/\r\n/g,"\n"),c=d.length,g=b.createTextRange(),g.moveToBookmark(f.getBookmark()),a=b.createTextRange(),a.collapse(!1),e=g.compareEndPoints("StartToEnd",a)>-1?c:-g.moveStart("character",-c)),e},b.prototype.getPos=function(){return h.selection?this.getIEPos():this.domInputor.selectionStart},b.prototype.setPos=function(a){var b,c;return b=this.domInputor,h.selection?(c=b.createTextRange(),c.move("character",a),c.select()):b.setSelectionRange&&b.setSelectionRange(a,a),b},b.prototype.getIEOffset=function(a){var b,c,d,e;return c=this.domInputor.createTextRange(),a||(a=this.getPos()),c.move("character",a),d=c.boundingLeft,e=c.boundingTop,b=c.boundingHeight,{left:d,top:e,height:b}},b.prototype.getOffset=function(b){var c,d,e;return c=this.$inputor,h.selection?(d=this.getIEOffset(b),d.top+=a(j).scrollTop()+c.scrollTop(),d.left+=a(j).scrollLeft()+c.scrollLeft(),d):(d=c.offset(),e=this.getPosition(b),d={left:d.left+e.left-c.scrollLeft(),top:d.top+e.top-c.scrollTop(),height:e.height})},b.prototype.getPosition=function(a){var b,c,e,f,g,h,i;return b=this.$inputor,f=function(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/`/g,"`").replace(/"/g,""").replace(/\r\n|\r|\n/g,"<br />")},void 0===a&&(a=this.getPos()),i=b.val().slice(0,a),e=b.val().slice(a),g="<span style='position: relative; display: inline;'>"+f(i)+"</span>",g+="<span id='caret' style='position: relative; display: inline;'>|</span>",g+="<span style='position: relative; display: inline;'>"+f(e)+"</span>",h=new d(b),c=h.create(g).rect()},b.prototype.getIEPosition=function(a){var b,c,d,e,f;return d=this.getIEOffset(a),c=this.$inputor.offset(),e=d.left-c.left,f=d.top-c.top,b=d.height,{left:e,top:f,height:b}},b}(),d=function(){function b(a){this.$inputor=a}return b.prototype.css_attr=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","boxSizing","fontFamily","fontSize","fontWeight","height","letterSpacing","lineHeight","marginBottom","marginLeft","marginRight","marginTop","outlineWidth","overflow","overflowX","overflowY","paddingBottom","paddingLeft","paddingRight","paddingTop","textAlign","textOverflow","textTransform","whiteSpace","wordBreak","wordWrap"],b.prototype.mirrorCss=function(){var b,c=this;return b={position:"absolute",left:-9999,top:0,zIndex:-2e4},"TEXTAREA"===this.$inputor.prop("tagName")&&this.css_attr.push("width"),a.each(this.css_attr,function(a,d){return b[d]=c.$inputor.css(d)}),b},b.prototype.create=function(b){return this.$mirror=a("<div></div>"),this.$mirror.css(this.mirrorCss()),this.$mirror.html(b),this.$inputor.after(this.$mirror),this},b.prototype.rect=function(){var a,b,c;return a=this.$mirror.find("#caret"),b=a.position(),c={left:b.left,top:b.top,height:a.height()},this.$mirror.remove(),c},b}(),e={contentEditable:function(a){return!(!a[0].contentEditable||"true"!==a[0].contentEditable)}},g={pos:function(a){return a||0===a?this.setPos(a):this.getPos()},position:function(a){return h.selection?this.getIEPosition(a):this.getPosition(a)},offset:function(b){var c,d;return d=this.getOffset(b),i&&(c=a(i).offset(),d.top+=c.top,d.left+=c.left),d}},h=null,j=null,i=null,l=function(a){var b;return(b=null!=a?a.iframe:void 0)?(i=b,j=b.contentWindow,h=b.contentDocument||j.document):(i=void 0,j=window,h=document)},f=function(a){var b;h=a[0].ownerDocument,j=h.defaultView||h.parentWindow;try{return i=j.frameElement}catch(c){b=c}},a.fn.caret=function(d,f,h){var i;return g[d]?(a.isPlainObject(f)?(l(f),f=void 0):l(h),i=e.contentEditable(this)?new b(this):new c(this),g[d].apply(i,[f])):a.error("Method "+d+" does not exist on jQuery.caret")},a.fn.caret.EditableCaret=b,a.fn.caret.InputCaret=c,a.fn.caret.Utils=e,a.fn.caret.apis=g})}).call(this);
|
bp-core/js/widget-members.js
CHANGED
@@ -17,7 +17,7 @@ jQuery(document).ready( function() {
|
|
17 |
function(response)
|
18 |
{
|
19 |
jQuery(link).removeClass('loading');
|
20 |
-
|
21 |
});
|
22 |
|
23 |
return false;
|
@@ -25,7 +25,7 @@ jQuery(document).ready( function() {
|
|
25 |
);
|
26 |
});
|
27 |
|
28 |
-
function
|
29 |
response = response.substr(0, response.length-1);
|
30 |
response = response.split('[[SPLIT]]');
|
31 |
|
17 |
function(response)
|
18 |
{
|
19 |
jQuery(link).removeClass('loading');
|
20 |
+
member_wiget_response(response);
|
21 |
});
|
22 |
|
23 |
return false;
|
25 |
);
|
26 |
});
|
27 |
|
28 |
+
function member_wiget_response(response) {
|
29 |
response = response.substr(0, response.length-1);
|
30 |
response = response.split('[[SPLIT]]');
|
31 |
|
bp-core/js/widget-members.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
-
function
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
+
function member_wiget_response(a){a=a.substr(0,a.length-1),a=a.split("[[SPLIT]]"),"-1"!==a[0]?jQuery(".widget ul#members-list").fadeOut(200,function(){jQuery(".widget ul#members-list").html(a[1]),jQuery(".widget ul#members-list").fadeIn(200)}):jQuery(".widget ul#members-list").fadeOut(200,function(){var b="<p>"+a[1]+"</p>";jQuery(".widget ul#members-list").html(b),jQuery(".widget ul#members-list").fadeIn(200)})}jQuery(document).ready(function(){jQuery(".widget div#members-list-options a").on("click",function(){var a=this;return jQuery(a).addClass("loading"),jQuery(".widget div#members-list-options a").removeClass("selected"),jQuery(this).addClass("selected"),jQuery.post(ajaxurl,{action:"widget_members",cookie:encodeURIComponent(document.cookie),_wpnonce:jQuery("input#_wpnonce-members").val(),"max-members":jQuery("input#members_widget_max").val(),filter:jQuery(this).attr("id")},function(b){jQuery(a).removeClass("loading"),member_wiget_response(b)}),!1})});
|
bp-forums/bp-forums-actions.php
CHANGED
@@ -7,4 +7,4 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
bp-forums/bp-forums-bbpress-sa.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/**
|
13 |
* Bootstrap bbPress 1.x, and manipulate globals to integrate with BuddyPress.
|
@@ -18,7 +18,7 @@ function bp_forums_load_bbpress() {
|
|
18 |
global $wpdb, $wp_roles, $current_user, $wp_users_object;
|
19 |
global $bb, $bbdb, $bb_table_prefix, $bb_current_user;
|
20 |
global $bb_roles, $wp_taxonomy_object, $bb_queries;
|
21 |
-
|
22 |
// Return if we've already run this function.
|
23 |
if ( is_object( $bbdb ) )
|
24 |
return;
|
@@ -86,25 +86,8 @@ function bp_forums_load_bbpress() {
|
|
86 |
bb_init_roles( $bb_roles );
|
87 |
}
|
88 |
|
89 |
-
/**
|
90 |
-
* Fires during the bootstrap setup for bbPress 1.x.
|
91 |
-
*
|
92 |
-
* @since BuddyPress (1.1.0)
|
93 |
-
*/
|
94 |
do_action( 'bb_got_roles' );
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Fires during the bootstrap setup for bbPress 1.x.
|
98 |
-
*
|
99 |
-
* @since BuddyPress (1.1.0)
|
100 |
-
*/
|
101 |
do_action( 'bb_init' );
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Fires during the bootstrap setup for bbPress 1.x.
|
105 |
-
*
|
106 |
-
* @since BuddyPress (1.1.0)
|
107 |
-
*/
|
108 |
do_action( 'init_roles' );
|
109 |
|
110 |
$bb_current_user = $current_user;
|
@@ -141,11 +124,6 @@ function bp_forums_load_bbpress() {
|
|
141 |
bb_update_option( 'uri', BB_URL );
|
142 |
}
|
143 |
|
144 |
-
/**
|
145 |
-
* Fires inside an anonymous function that is run on bbPress shutdown.
|
146 |
-
*
|
147 |
-
* @since BuddyPress (1.1.0)
|
148 |
-
*/
|
149 |
register_shutdown_function( create_function( '', 'do_action("bb_shutdown");' ) );
|
150 |
}
|
151 |
add_action( 'bbpress_init', 'bp_forums_load_bbpress' );
|
@@ -193,7 +171,7 @@ class BP_Forums_BB_Auth {
|
|
193 |
* bbPress needs the DB class to be BPDB, but we want to use WPDB, so we can extend it and use this.
|
194 |
*
|
195 |
* The class is pluggable, so that plugins that swap out WPDB with a custom
|
196 |
-
* database class (such as HyperDB and
|
197 |
* of BPDB which extend the appropriate base class.
|
198 |
*/
|
199 |
if ( ! class_exists( 'BPDB' ) ) :
|
@@ -218,7 +196,7 @@ if ( ! class_exists( 'BPDB' ) ) :
|
|
218 |
/**
|
219 |
* Determine if a database supports a particular feature.
|
220 |
*
|
221 |
-
*
|
222 |
* and WordPress's implementations. In particular, when
|
223 |
* BuddyPress tries to run bbPress' SQL installation script,
|
224 |
* the collation check always failed. The capability is long
|
@@ -361,7 +339,7 @@ function bp_bb_dbDelta($queries, $execute = true) {
|
|
361 |
if ( array_key_exists(strtolower($table), $cqueries) ) {
|
362 |
// Clear the field and index arrays
|
363 |
$cfields = $indices = array();
|
364 |
-
// Get all of the field names in the query from between the
|
365 |
preg_match("|\((.*)\)|ms", $cqueries[strtolower($table)], $match2);
|
366 |
$qryline = trim($match2[1]);
|
367 |
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/**
|
13 |
* Bootstrap bbPress 1.x, and manipulate globals to integrate with BuddyPress.
|
18 |
global $wpdb, $wp_roles, $current_user, $wp_users_object;
|
19 |
global $bb, $bbdb, $bb_table_prefix, $bb_current_user;
|
20 |
global $bb_roles, $wp_taxonomy_object, $bb_queries;
|
21 |
+
|
22 |
// Return if we've already run this function.
|
23 |
if ( is_object( $bbdb ) )
|
24 |
return;
|
86 |
bb_init_roles( $bb_roles );
|
87 |
}
|
88 |
|
|
|
|
|
|
|
|
|
|
|
89 |
do_action( 'bb_got_roles' );
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
do_action( 'bb_init' );
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
do_action( 'init_roles' );
|
92 |
|
93 |
$bb_current_user = $current_user;
|
124 |
bb_update_option( 'uri', BB_URL );
|
125 |
}
|
126 |
|
|
|
|
|
|
|
|
|
|
|
127 |
register_shutdown_function( create_function( '', 'do_action("bb_shutdown");' ) );
|
128 |
}
|
129 |
add_action( 'bbpress_init', 'bp_forums_load_bbpress' );
|
171 |
* bbPress needs the DB class to be BPDB, but we want to use WPDB, so we can extend it and use this.
|
172 |
*
|
173 |
* The class is pluggable, so that plugins that swap out WPDB with a custom
|
174 |
+
* database class (such as HyperDB and SharDB) can provide their own versions
|
175 |
* of BPDB which extend the appropriate base class.
|
176 |
*/
|
177 |
if ( ! class_exists( 'BPDB' ) ) :
|
196 |
/**
|
197 |
* Determine if a database supports a particular feature.
|
198 |
*
|
199 |
+
* Overriden here to work around differences between bbPress's
|
200 |
* and WordPress's implementations. In particular, when
|
201 |
* BuddyPress tries to run bbPress' SQL installation script,
|
202 |
* the collation check always failed. The capability is long
|
339 |
if ( array_key_exists(strtolower($table), $cqueries) ) {
|
340 |
// Clear the field and index arrays
|
341 |
$cfields = $indices = array();
|
342 |
+
// Get all of the field names in the query from between the parens
|
343 |
preg_match("|\((.*)\)|ms", $cqueries[strtolower($table)], $match2);
|
344 |
$qryline = trim($match2[1]);
|
345 |
|
bp-forums/bp-forums-bbpress.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
*/
|
5 |
|
6 |
// Exit if accessed directly
|
7 |
-
defined( 'ABSPATH' )
|
4 |
*/
|
5 |
|
6 |
// Exit if accessed directly
|
7 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
bp-forums/bp-forums-filters.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/* Apply WordPress defined filters */
|
13 |
add_filter( 'bp_forums_bbconfig_location', 'wp_filter_kses', 1 );
|
@@ -83,13 +83,6 @@ function bp_forums_filter_kses( $content ) {
|
|
83 |
$forums_allowedtags['code'] = array();
|
84 |
$forums_allowedtags['blockquote'] = array();
|
85 |
|
86 |
-
/**
|
87 |
-
* Filters the allowed HTML tags for forum posts.
|
88 |
-
*
|
89 |
-
* @since BuddyPress (1.2.0)
|
90 |
-
*
|
91 |
-
* @param array $forums_allowedtags Array of allowed HTML tags.
|
92 |
-
*/
|
93 |
$forums_allowedtags = apply_filters( 'bp_forums_allowed_tags', $forums_allowedtags );
|
94 |
return wp_kses( $content, $forums_allowedtags );
|
95 |
}
|
@@ -106,13 +99,6 @@ function bp_forums_filter_kses( $content ) {
|
|
106 |
function bp_forums_filter_tag_link( $link, $tag, $page, $context ) {
|
107 |
global $bp;
|
108 |
|
109 |
-
/**
|
110 |
-
* Filters the link for a forum topic tags directory.
|
111 |
-
*
|
112 |
-
* @since BuddyPress (1.1.0)
|
113 |
-
*
|
114 |
-
* @param string $value Link for the forum topic tag directory.
|
115 |
-
*/
|
116 |
return apply_filters( 'bp_forums_filter_tag_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/tag/' . $tag . '/' );
|
117 |
}
|
118 |
add_filter( 'bb_get_tag_link', 'bp_forums_filter_tag_link', 10, 4);
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/* Apply WordPress defined filters */
|
13 |
add_filter( 'bp_forums_bbconfig_location', 'wp_filter_kses', 1 );
|
83 |
$forums_allowedtags['code'] = array();
|
84 |
$forums_allowedtags['blockquote'] = array();
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
$forums_allowedtags = apply_filters( 'bp_forums_allowed_tags', $forums_allowedtags );
|
87 |
return wp_kses( $content, $forums_allowedtags );
|
88 |
}
|
99 |
function bp_forums_filter_tag_link( $link, $tag, $page, $context ) {
|
100 |
global $bp;
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
return apply_filters( 'bp_forums_filter_tag_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/tag/' . $tag . '/' );
|
103 |
}
|
104 |
add_filter( 'bb_get_tag_link', 'bp_forums_filter_tag_link', 10, 4);
|
bp-forums/bp-forums-functions.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/** bbPress 2.x ***************************************************************/
|
13 |
|
@@ -79,8 +79,6 @@ function bp_forums_has_directory() {
|
|
79 |
* @return object bbPress forum object.
|
80 |
*/
|
81 |
function bp_forums_get_forum( $forum_id ) {
|
82 |
-
|
83 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
84 |
do_action( 'bbpress_init' );
|
85 |
return bb_get_forum( $forum_id );
|
86 |
}
|
@@ -102,8 +100,6 @@ function bp_forums_get_forum( $forum_id ) {
|
|
102 |
* @return int ID of the newly created forum.
|
103 |
*/
|
104 |
function bp_forums_new_forum( $args = '' ) {
|
105 |
-
|
106 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
107 |
do_action( 'bbpress_init' );
|
108 |
|
109 |
$r = wp_parse_args( $args, array(
|
@@ -133,11 +129,9 @@ function bp_forums_new_forum( $args = '' ) {
|
|
133 |
* @type bool $forum_order Order.
|
134 |
* @type int $forum_is_category Whether the forum is a category. Default: 0.
|
135 |
* }
|
136 |
-
* @return bool
|
137 |
*/
|
138 |
function bp_forums_update_forum( $args = '' ) {
|
139 |
-
|
140 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
141 |
do_action( 'bbpress_init' );
|
142 |
|
143 |
$r = wp_parse_args( $args, array(
|
@@ -163,8 +157,6 @@ function bp_forums_delete_group_forum( $group_id ) {
|
|
163 |
$forum_id = groups_get_groupmeta( $group_id, 'forum_id' );
|
164 |
|
165 |
if ( !empty( $forum_id ) && is_int( $forum_id ) ) {
|
166 |
-
|
167 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
168 |
do_action( 'bbpress_init' );
|
169 |
bb_delete_forum( $forum_id );
|
170 |
}
|
@@ -196,8 +188,6 @@ add_action( 'groups_delete_group', 'bp_forums_delete_group_forum' );
|
|
196 |
* @return array Found topics.
|
197 |
*/
|
198 |
function bp_forums_get_forum_topics( $args = '' ) {
|
199 |
-
|
200 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
201 |
do_action( 'bbpress_init' );
|
202 |
|
203 |
$r = wp_parse_args( $args, array(
|
@@ -240,14 +230,6 @@ function bp_forums_get_forum_topics( $args = '' ) {
|
|
240 |
$topics = array();
|
241 |
}
|
242 |
|
243 |
-
/**
|
244 |
-
* Filters the found forum topics for provided arguments.
|
245 |
-
*
|
246 |
-
* @since BuddyPress (1.1.0)
|
247 |
-
*
|
248 |
-
* @param array $topics Array of found topics. Passed by reference.
|
249 |
-
* @param array $r Array of parsed arguments for query. Passed by reference.
|
250 |
-
*/
|
251 |
return apply_filters_ref_array( 'bp_forums_get_forum_topics', array( &$topics, &$r ) );
|
252 |
}
|
253 |
|
@@ -258,8 +240,6 @@ function bp_forums_get_forum_topics( $args = '' ) {
|
|
258 |
* @return object Details about the topic.
|
259 |
*/
|
260 |
function bp_forums_get_topic_details( $topic_id ) {
|
261 |
-
|
262 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
263 |
do_action( 'bbpress_init' );
|
264 |
|
265 |
$query = new BB_Query( 'topic', 'topic_id=' . $topic_id . '&page=1' /* Page override so bbPress doesn't use the URI */ );
|
@@ -276,8 +256,6 @@ function bp_forums_get_topic_details( $topic_id ) {
|
|
276 |
* @return int|bool ID of the topic (if found), false on failure.
|
277 |
*/
|
278 |
function bp_forums_get_topic_id_from_slug( $topic_slug ) {
|
279 |
-
|
280 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
281 |
do_action( 'bbpress_init' );
|
282 |
|
283 |
if ( empty( $topic_slug ) )
|
@@ -317,7 +295,6 @@ function bp_forums_get_topic_id_from_slug( $topic_slug ) {
|
|
317 |
function bp_forums_new_topic( $args = '' ) {
|
318 |
global $bp;
|
319 |
|
320 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
321 |
do_action( 'bbpress_init' );
|
322 |
|
323 |
$r = wp_parse_args( $args, array(
|
@@ -331,7 +308,7 @@ function bp_forums_new_topic( $args = '' ) {
|
|
331 |
'topic_start_time' => bp_core_current_time(),
|
332 |
'topic_time' => bp_core_current_time(),
|
333 |
'topic_open' => 1,
|
334 |
-
'topic_tags' => false, // accepts array or comma
|
335 |
'forum_id' => 0 // accepts ids or slugs
|
336 |
) );
|
337 |
extract( $r, EXTR_SKIP );
|
@@ -357,13 +334,6 @@ function bp_forums_new_topic( $args = '' ) {
|
|
357 |
if ( !bp_forums_insert_post( array( 'topic_id' => $topic_id, 'post_text' => $topic_text, 'post_time' => $topic_time, 'poster_id' => $topic_poster ) ) )
|
358 |
return false;
|
359 |
|
360 |
-
/**
|
361 |
-
* Fires after a new forum topic has been created.
|
362 |
-
*
|
363 |
-
* @since BuddyPress (1.0.0)
|
364 |
-
*
|
365 |
-
* @param int $topic_id ID of the newly created topic post.
|
366 |
-
*/
|
367 |
do_action( 'bp_forums_new_topic', $topic_id );
|
368 |
|
369 |
return $topic_id;
|
@@ -384,8 +354,6 @@ function bp_forums_new_topic( $args = '' ) {
|
|
384 |
* {@link bp_forums_get_topic_details()}.
|
385 |
*/
|
386 |
function bp_forums_update_topic( $args = '' ) {
|
387 |
-
|
388 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
389 |
do_action( 'bbpress_init' );
|
390 |
|
391 |
$r = wp_parse_args( $args, array(
|
@@ -417,8 +385,6 @@ function bp_forums_update_topic( $args = '' ) {
|
|
417 |
}
|
418 |
|
419 |
function bp_forums_sticky_topic( $args = '' ) {
|
420 |
-
|
421 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
422 |
do_action( 'bbpress_init' );
|
423 |
|
424 |
$r = wp_parse_args( $args, array(
|
@@ -446,8 +412,6 @@ function bp_forums_sticky_topic( $args = '' ) {
|
|
446 |
* @return bool True on success, false on failure.
|
447 |
*/
|
448 |
function bp_forums_openclose_topic( $args = '' ) {
|
449 |
-
|
450 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
451 |
do_action( 'bbpress_init' );
|
452 |
|
453 |
$r = wp_parse_args( $args, array(
|
@@ -473,8 +437,6 @@ function bp_forums_openclose_topic( $args = '' ) {
|
|
473 |
* @return bool True on success, false on failure.
|
474 |
*/
|
475 |
function bp_forums_delete_topic( $args = '' ) {
|
476 |
-
|
477 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
478 |
do_action( 'bbpress_init' );
|
479 |
|
480 |
$r = wp_parse_args( $args, array(
|
@@ -493,7 +455,6 @@ function bp_forums_delete_topic( $args = '' ) {
|
|
493 |
function bp_forums_total_topic_count() {
|
494 |
global $bbdb;
|
495 |
|
496 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
497 |
do_action( 'bbpress_init' );
|
498 |
|
499 |
if ( isset( $bbdb ) ) {
|
@@ -510,13 +471,6 @@ function bp_forums_total_topic_count() {
|
|
510 |
$count = 0;
|
511 |
}
|
512 |
|
513 |
-
/**
|
514 |
-
* Filters the total topic count for the site.
|
515 |
-
*
|
516 |
-
* @since BuddyPress (1.5.0)
|
517 |
-
*
|
518 |
-
* @param int $count Total topic count.
|
519 |
-
*/
|
520 |
return apply_filters( 'bp_forums_total_topic_count', $count );
|
521 |
}
|
522 |
|
@@ -537,8 +491,6 @@ function bp_forums_reply_exists( $text = '', $topic_id = 0, $user_id = 0 ) {
|
|
537 |
$reply_exists = false;
|
538 |
|
539 |
if ( $text && $topic_id && $user_id ) {
|
540 |
-
|
541 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
542 |
do_action( 'bbpress_init' );
|
543 |
|
544 |
$args = array(
|
@@ -560,16 +512,6 @@ function bp_forums_reply_exists( $text = '', $topic_id = 0, $user_id = 0 ) {
|
|
560 |
$reply_exists = (bool) !empty( $query->results );
|
561 |
}
|
562 |
|
563 |
-
/**
|
564 |
-
* Filters whether a user has already left this particular reply on a given post.
|
565 |
-
*
|
566 |
-
* @since BuddyPress (1.6.0)
|
567 |
-
*
|
568 |
-
* @param bool $reply_exists Whether or not a reply exists.
|
569 |
-
* @param string $text The text of the comment.
|
570 |
-
* @param int $topic_id The topic ID.
|
571 |
-
* @param int $user_id The user ID.
|
572 |
-
*/
|
573 |
return (bool) apply_filters( 'bp_forums_reply_exists', $reply_exists, $text, $topic_id, $user_id );
|
574 |
}
|
575 |
/**
|
@@ -597,8 +539,6 @@ function bp_forums_reply_exists( $text = '', $topic_id = 0, $user_id = 0 ) {
|
|
597 |
* @return int $count The topic count.
|
598 |
*/
|
599 |
function bp_forums_total_topic_count_for_user( $user_id = 0, $type = 'active' ) {
|
600 |
-
|
601 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
602 |
do_action( 'bbpress_init' );
|
603 |
|
604 |
if ( !$user_id )
|
@@ -638,8 +578,6 @@ function bp_forums_total_topic_count_for_user( $user_id = 0, $type = 'active' )
|
|
638 |
* @return int $count Topic count.
|
639 |
*/
|
640 |
function bp_forums_total_replied_count_for_user( $user_id = 0, $type = 'active' ) {
|
641 |
-
|
642 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
643 |
do_action( 'bbpress_init' );
|
644 |
|
645 |
if ( !$user_id )
|
@@ -671,14 +609,6 @@ function bp_forums_total_replied_count_for_user( $user_id = 0, $type = 'active'
|
|
671 |
$count = 0;
|
672 |
}
|
673 |
|
674 |
-
/**
|
675 |
-
* Filters the total number of topics replied to by a given user.
|
676 |
-
*
|
677 |
-
* @since BuddyPress (1.5.0)
|
678 |
-
*
|
679 |
-
* @param int $count Total number of topics replied to by a given user.
|
680 |
-
* @param int $user_id The user ID.
|
681 |
-
*/
|
682 |
return apply_filters( 'bp_forums_total_replied_count_for_user', $count, $user_id );
|
683 |
}
|
684 |
|
@@ -763,8 +693,6 @@ function bp_forums_get_topic_extras( $topics ) {
|
|
763 |
* @return array List of posts.
|
764 |
*/
|
765 |
function bp_forums_get_topic_posts( $args = '' ) {
|
766 |
-
|
767 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
768 |
do_action( 'bbpress_init' );
|
769 |
|
770 |
$defaults = array(
|
@@ -789,8 +717,6 @@ function bp_forums_get_topic_posts( $args = '' ) {
|
|
789 |
* @return object Post object.
|
790 |
*/
|
791 |
function bp_forums_get_post( $post_id ) {
|
792 |
-
|
793 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
794 |
do_action( 'bbpress_init' );
|
795 |
return bb_get_post( $post_id );
|
796 |
}
|
@@ -806,8 +732,6 @@ function bp_forums_get_post( $post_id ) {
|
|
806 |
* @return bool True on success, false on failure.
|
807 |
*/
|
808 |
function bp_forums_delete_post( $args = '' ) {
|
809 |
-
|
810 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
811 |
do_action( 'bbpress_init' );
|
812 |
|
813 |
$r = wp_parse_args( $args, array(
|
@@ -839,8 +763,6 @@ function bp_forums_delete_post( $args = '' ) {
|
|
839 |
* @return int|bool ID of the new post on success, false on failure.
|
840 |
*/
|
841 |
function bp_forums_insert_post( $args = '' ) {
|
842 |
-
|
843 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
844 |
do_action( 'bbpress_init' );
|
845 |
|
846 |
$defaults = array(
|
@@ -880,17 +802,8 @@ function bp_forums_insert_post( $args = '' ) {
|
|
880 |
|
881 |
$post_id = bb_insert_post( array( 'post_id' => $post_id, 'topic_id' => $topic_id, 'post_text' => stripslashes( trim( $post_text ) ), 'post_time' => $post_time, 'poster_id' => $poster_id, 'poster_ip' => $poster_ip, 'post_status' => $post_status, 'post_position' => $post_position ) );
|
882 |
|
883 |
-
if ( !empty( $post_id ) )
|
884 |
-
|
885 |
-
/**
|
886 |
-
* Fires if there was a new post created.
|
887 |
-
*
|
888 |
-
* @since BuddyPress (1.0.0)
|
889 |
-
*
|
890 |
-
* @param int $post_id ID of the newly created forum post.
|
891 |
-
*/
|
892 |
do_action( 'bp_forums_new_post', $post_id );
|
893 |
-
}
|
894 |
|
895 |
return $post_id;
|
896 |
}
|
@@ -940,13 +853,6 @@ function bp_forums_get_post_extras( $posts ) {
|
|
940 |
}
|
941 |
}
|
942 |
|
943 |
-
/**
|
944 |
-
* Filters BP-specific details about a set of posts.
|
945 |
-
*
|
946 |
-
* @since BuddyPress (1.5.0)
|
947 |
-
*
|
948 |
-
* @param array $posts Array of posts holding BP-specific details.
|
949 |
-
*/
|
950 |
return apply_filters( 'bp_forums_get_post_extras', $posts );
|
951 |
}
|
952 |
|
@@ -960,7 +866,6 @@ function bp_forums_get_post_extras( $posts ) {
|
|
960 |
function bp_forums_get_forum_topicpost_count( $forum_id ) {
|
961 |
global $wpdb, $bbdb;
|
962 |
|
963 |
-
/** This action is documented in bp-forums/bp-forums-screens */
|
964 |
do_action( 'bbpress_init' );
|
965 |
|
966 |
// Need to find a bbPress function that does this
|
@@ -1000,14 +905,6 @@ add_filter( 'user_has_cap', 'bp_forums_filter_caps' );
|
|
1000 |
* @return int Forum ID.
|
1001 |
*/
|
1002 |
function bp_forums_parent_forum_id() {
|
1003 |
-
|
1004 |
-
/**
|
1005 |
-
* Filters the parent forum ID for the bbPress abstraction layer.
|
1006 |
-
*
|
1007 |
-
* @since BuddyPress (1.5.0)
|
1008 |
-
*
|
1009 |
-
* @param int BP_FORUMS_PARENT_FORUM_ID The Parent forum ID constant.
|
1010 |
-
*/
|
1011 |
return apply_filters( 'bp_forums_parent_forum_id', BP_FORUMS_PARENT_FORUM_ID );
|
1012 |
}
|
1013 |
|
@@ -1023,14 +920,6 @@ function bp_forums_parent_forum_id() {
|
|
1023 |
* directory, otherwise false.
|
1024 |
*/
|
1025 |
function bp_forums_enable_global_directory_stickies() {
|
1026 |
-
|
1027 |
-
/**
|
1028 |
-
* Filters whether or not sticky topics should be broken out of regular topic order.
|
1029 |
-
*
|
1030 |
-
* @since BuddyPress (1.5.0)
|
1031 |
-
*
|
1032 |
-
* @param bool $value Whether or not to break out of topic order.
|
1033 |
-
*/
|
1034 |
return apply_filters( 'bp_forums_enable_global_directory_stickies', defined( 'BP_FORUMS_ENABLE_GLOBAL_DIRECTORY_STICKIES' ) && BP_FORUMS_ENABLE_GLOBAL_DIRECTORY_STICKIES );
|
1035 |
}
|
1036 |
|
@@ -1075,7 +964,7 @@ add_action( 'topic_loop_start', 'bp_forums_embed' );
|
|
1075 |
* Wrapper function for {@link bb_get_postmeta()}.
|
1076 |
*
|
1077 |
* @package BuddyPress_Forums
|
1078 |
-
* @since BuddyPress (1.5
|
1079 |
*/
|
1080 |
function bp_embed_forum_cache( $cache, $id, $cachekey ) {
|
1081 |
return bb_get_postmeta( $id, $cachekey );
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/** bbPress 2.x ***************************************************************/
|
13 |
|
79 |
* @return object bbPress forum object.
|
80 |
*/
|
81 |
function bp_forums_get_forum( $forum_id ) {
|
|
|
|
|
82 |
do_action( 'bbpress_init' );
|
83 |
return bb_get_forum( $forum_id );
|
84 |
}
|
100 |
* @return int ID of the newly created forum.
|
101 |
*/
|
102 |
function bp_forums_new_forum( $args = '' ) {
|
|
|
|
|
103 |
do_action( 'bbpress_init' );
|
104 |
|
105 |
$r = wp_parse_args( $args, array(
|
129 |
* @type bool $forum_order Order.
|
130 |
* @type int $forum_is_category Whether the forum is a category. Default: 0.
|
131 |
* }
|
132 |
+
* @return bool Ttrue on success, false on failure.
|
133 |
*/
|
134 |
function bp_forums_update_forum( $args = '' ) {
|
|
|
|
|
135 |
do_action( 'bbpress_init' );
|
136 |
|
137 |
$r = wp_parse_args( $args, array(
|
157 |
$forum_id = groups_get_groupmeta( $group_id, 'forum_id' );
|
158 |
|
159 |
if ( !empty( $forum_id ) && is_int( $forum_id ) ) {
|
|
|
|
|
160 |
do_action( 'bbpress_init' );
|
161 |
bb_delete_forum( $forum_id );
|
162 |
}
|
188 |
* @return array Found topics.
|
189 |
*/
|
190 |
function bp_forums_get_forum_topics( $args = '' ) {
|
|
|
|
|
191 |
do_action( 'bbpress_init' );
|
192 |
|
193 |
$r = wp_parse_args( $args, array(
|
230 |
$topics = array();
|
231 |
}
|
232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
return apply_filters_ref_array( 'bp_forums_get_forum_topics', array( &$topics, &$r ) );
|
234 |
}
|
235 |
|
240 |
* @return object Details about the topic.
|
241 |
*/
|
242 |
function bp_forums_get_topic_details( $topic_id ) {
|
|
|
|
|
243 |
do_action( 'bbpress_init' );
|
244 |
|
245 |
$query = new BB_Query( 'topic', 'topic_id=' . $topic_id . '&page=1' /* Page override so bbPress doesn't use the URI */ );
|
256 |
* @return int|bool ID of the topic (if found), false on failure.
|
257 |
*/
|
258 |
function bp_forums_get_topic_id_from_slug( $topic_slug ) {
|
|
|
|
|
259 |
do_action( 'bbpress_init' );
|
260 |
|
261 |
if ( empty( $topic_slug ) )
|
295 |
function bp_forums_new_topic( $args = '' ) {
|
296 |
global $bp;
|
297 |
|
|
|
298 |
do_action( 'bbpress_init' );
|
299 |
|
300 |
$r = wp_parse_args( $args, array(
|
308 |
'topic_start_time' => bp_core_current_time(),
|
309 |
'topic_time' => bp_core_current_time(),
|
310 |
'topic_open' => 1,
|
311 |
+
'topic_tags' => false, // accepts array or comma delim
|
312 |
'forum_id' => 0 // accepts ids or slugs
|
313 |
) );
|
314 |
extract( $r, EXTR_SKIP );
|
334 |
if ( !bp_forums_insert_post( array( 'topic_id' => $topic_id, 'post_text' => $topic_text, 'post_time' => $topic_time, 'poster_id' => $topic_poster ) ) )
|
335 |
return false;
|
336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
do_action( 'bp_forums_new_topic', $topic_id );
|
338 |
|
339 |
return $topic_id;
|
354 |
* {@link bp_forums_get_topic_details()}.
|
355 |
*/
|
356 |
function bp_forums_update_topic( $args = '' ) {
|
|
|
|
|
357 |
do_action( 'bbpress_init' );
|
358 |
|
359 |
$r = wp_parse_args( $args, array(
|
385 |
}
|
386 |
|
387 |
function bp_forums_sticky_topic( $args = '' ) {
|
|
|
|
|
388 |
do_action( 'bbpress_init' );
|
389 |
|
390 |
$r = wp_parse_args( $args, array(
|
412 |
* @return bool True on success, false on failure.
|
413 |
*/
|
414 |
function bp_forums_openclose_topic( $args = '' ) {
|
|
|
|
|
415 |
do_action( 'bbpress_init' );
|
416 |
|
417 |
$r = wp_parse_args( $args, array(
|
437 |
* @return bool True on success, false on failure.
|
438 |
*/
|
439 |
function bp_forums_delete_topic( $args = '' ) {
|
|
|
|
|
440 |
do_action( 'bbpress_init' );
|
441 |
|
442 |
$r = wp_parse_args( $args, array(
|
455 |
function bp_forums_total_topic_count() {
|
456 |
global $bbdb;
|
457 |
|
|
|
458 |
do_action( 'bbpress_init' );
|
459 |
|
460 |
if ( isset( $bbdb ) ) {
|
471 |
$count = 0;
|
472 |
}
|
473 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
474 |
return apply_filters( 'bp_forums_total_topic_count', $count );
|
475 |
}
|
476 |
|
491 |
$reply_exists = false;
|
492 |
|
493 |
if ( $text && $topic_id && $user_id ) {
|
|
|
|
|
494 |
do_action( 'bbpress_init' );
|
495 |
|
496 |
$args = array(
|
512 |
$reply_exists = (bool) !empty( $query->results );
|
513 |
}
|
514 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
return (bool) apply_filters( 'bp_forums_reply_exists', $reply_exists, $text, $topic_id, $user_id );
|
516 |
}
|
517 |
/**
|
539 |
* @return int $count The topic count.
|
540 |
*/
|
541 |
function bp_forums_total_topic_count_for_user( $user_id = 0, $type = 'active' ) {
|
|
|
|
|
542 |
do_action( 'bbpress_init' );
|
543 |
|
544 |
if ( !$user_id )
|
578 |
* @return int $count Topic count.
|
579 |
*/
|
580 |
function bp_forums_total_replied_count_for_user( $user_id = 0, $type = 'active' ) {
|
|
|
|
|
581 |
do_action( 'bbpress_init' );
|
582 |
|
583 |
if ( !$user_id )
|
609 |
$count = 0;
|
610 |
}
|
611 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
612 |
return apply_filters( 'bp_forums_total_replied_count_for_user', $count, $user_id );
|
613 |
}
|
614 |
|
693 |
* @return array List of posts.
|
694 |
*/
|
695 |
function bp_forums_get_topic_posts( $args = '' ) {
|
|
|
|
|
696 |
do_action( 'bbpress_init' );
|
697 |
|
698 |
$defaults = array(
|
717 |
* @return object Post object.
|
718 |
*/
|
719 |
function bp_forums_get_post( $post_id ) {
|
|
|
|
|
720 |
do_action( 'bbpress_init' );
|
721 |
return bb_get_post( $post_id );
|
722 |
}
|
732 |
* @return bool True on success, false on failure.
|
733 |
*/
|
734 |
function bp_forums_delete_post( $args = '' ) {
|
|
|
|
|
735 |
do_action( 'bbpress_init' );
|
736 |
|
737 |
$r = wp_parse_args( $args, array(
|
763 |
* @return int|bool ID of the new post on success, false on failure.
|
764 |
*/
|
765 |
function bp_forums_insert_post( $args = '' ) {
|
|
|
|
|
766 |
do_action( 'bbpress_init' );
|
767 |
|
768 |
$defaults = array(
|
802 |
|
803 |
$post_id = bb_insert_post( array( 'post_id' => $post_id, 'topic_id' => $topic_id, 'post_text' => stripslashes( trim( $post_text ) ), 'post_time' => $post_time, 'poster_id' => $poster_id, 'poster_ip' => $poster_ip, 'post_status' => $post_status, 'post_position' => $post_position ) );
|
804 |
|
805 |
+
if ( !empty( $post_id ) )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
806 |
do_action( 'bp_forums_new_post', $post_id );
|
|
|
807 |
|
808 |
return $post_id;
|
809 |
}
|
853 |
}
|
854 |
}
|
855 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
856 |
return apply_filters( 'bp_forums_get_post_extras', $posts );
|
857 |
}
|
858 |
|
866 |
function bp_forums_get_forum_topicpost_count( $forum_id ) {
|
867 |
global $wpdb, $bbdb;
|
868 |
|
|
|
869 |
do_action( 'bbpress_init' );
|
870 |
|
871 |
// Need to find a bbPress function that does this
|
905 |
* @return int Forum ID.
|
906 |
*/
|
907 |
function bp_forums_parent_forum_id() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
908 |
return apply_filters( 'bp_forums_parent_forum_id', BP_FORUMS_PARENT_FORUM_ID );
|
909 |
}
|
910 |
|
920 |
* directory, otherwise false.
|
921 |
*/
|
922 |
function bp_forums_enable_global_directory_stickies() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
923 |
return apply_filters( 'bp_forums_enable_global_directory_stickies', defined( 'BP_FORUMS_ENABLE_GLOBAL_DIRECTORY_STICKIES' ) && BP_FORUMS_ENABLE_GLOBAL_DIRECTORY_STICKIES );
|
924 |
}
|
925 |
|
964 |
* Wrapper function for {@link bb_get_postmeta()}.
|
965 |
*
|
966 |
* @package BuddyPress_Forums
|
967 |
+
* @since BuddyPress (1.5)
|
968 |
*/
|
969 |
function bp_embed_forum_cache( $cache, $id, $cachekey ) {
|
970 |
return bb_get_postmeta( $id, $cachekey );
|
bp-forums/bp-forums-loader.php
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
*/
|
14 |
|
15 |
// Exit if accessed directly
|
16 |
-
defined( 'ABSPATH' )
|
17 |
|
18 |
class BP_Forums_Component extends BP_Component {
|
19 |
|
13 |
*/
|
14 |
|
15 |
// Exit if accessed directly
|
16 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
17 |
|
18 |
class BP_Forums_Component extends BP_Component {
|
19 |
|
bp-forums/bp-forums-screens.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/**
|
13 |
* Load the Forums directory.
|
@@ -28,11 +28,6 @@ function bp_forums_directory_forums_setup() {
|
|
28 |
|
29 |
bp_update_is_directory( true, 'forums' );
|
30 |
|
31 |
-
/**
|
32 |
-
* Fires early in the initialization of bbPress-based areas of BuddyPress.
|
33 |
-
*
|
34 |
-
* @since BuddyPress (1.1.0)
|
35 |
-
*/
|
36 |
do_action( 'bbpress_init' );
|
37 |
|
38 |
// Check to see if the user has posted a new topic from the forums page.
|
@@ -80,20 +75,8 @@ function bp_forums_directory_forums_setup() {
|
|
80 |
}
|
81 |
}
|
82 |
|
83 |
-
/**
|
84 |
-
* Fires right before the loading of the forums directory screen template file.
|
85 |
-
*
|
86 |
-
* @since BuddyPress (1.1.0)
|
87 |
-
*/
|
88 |
do_action( 'bp_forums_directory_forums_setup' );
|
89 |
|
90 |
-
/**
|
91 |
-
* Filters the template to load for the forums directory screen.
|
92 |
-
*
|
93 |
-
* @since BuddyPress (1.1.0)
|
94 |
-
*
|
95 |
-
* @param string $template Path to the forums template to load.
|
96 |
-
*/
|
97 |
bp_core_load_template( apply_filters( 'bp_forums_template_directory_forums_setup', 'forums/index' ) );
|
98 |
}
|
99 |
}
|
@@ -103,21 +86,8 @@ add_action( 'bp_screens', 'bp_forums_directory_forums_setup', 2 );
|
|
103 |
* Load the Topics Started screen.
|
104 |
*/
|
105 |
function bp_member_forums_screen_topics() {
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Fires right before the loading of the forums topics started screen template file.
|
109 |
-
*
|
110 |
-
* @since BuddyPress (1.5.0)
|
111 |
-
*/
|
112 |
do_action( 'bp_member_forums_screen_topics' );
|
113 |
|
114 |
-
/**
|
115 |
-
* Filters the template to load for the forums topics started screen.
|
116 |
-
*
|
117 |
-
* @since BuddyPress (1.5.0)
|
118 |
-
*
|
119 |
-
* @param string $template Path to the forums topics started template to load.
|
120 |
-
*/
|
121 |
bp_core_load_template( apply_filters( 'bp_member_forums_screen_topics', 'members/single/home' ) );
|
122 |
}
|
123 |
|
@@ -125,21 +95,8 @@ function bp_member_forums_screen_topics() {
|
|
125 |
* Load the Replied To screen.
|
126 |
*/
|
127 |
function bp_member_forums_screen_replies() {
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Fires right before the loading of the forums replied to screen template file.
|
131 |
-
*
|
132 |
-
* @since BuddyPress (1.5.0)
|
133 |
-
*/
|
134 |
do_action( 'bp_member_forums_screen_replies' );
|
135 |
|
136 |
-
/**
|
137 |
-
* Filters the template to load for the forums replied to screen.
|
138 |
-
*
|
139 |
-
* @since BuddyPress (1.5.0)
|
140 |
-
*
|
141 |
-
* @param string $template Path to the forums replied to template to load.
|
142 |
-
*/
|
143 |
bp_core_load_template( apply_filters( 'bp_member_forums_screen_replies', 'members/single/home' ) );
|
144 |
}
|
145 |
|
@@ -149,21 +106,8 @@ function bp_member_forums_screen_replies() {
|
|
149 |
* Note that this feature is not fully implemented at the moment.
|
150 |
*/
|
151 |
function bp_member_forums_screen_favorites() {
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Fires right before the loading of the forums favorites screen template file.
|
155 |
-
*
|
156 |
-
* @since BuddyPress (1.5.0)
|
157 |
-
*/
|
158 |
do_action( 'bp_member_forums_screen_favorites' );
|
159 |
|
160 |
-
/**
|
161 |
-
* Filters the template to load for the forums favorites screen.
|
162 |
-
*
|
163 |
-
* @since BuddyPress (1.5.0)
|
164 |
-
*
|
165 |
-
* @param string $template Path to the forums favorites template to load.
|
166 |
-
*/
|
167 |
bp_core_load_template( apply_filters( 'bp_member_forums_screen_favorites', 'members/single/home' ) );
|
168 |
}
|
169 |
|
@@ -175,20 +119,8 @@ function bp_forums_screen_single_forum() {
|
|
175 |
if ( !bp_is_forums_component() || !bp_is_current_action( 'forum' ) || !bp_action_variable( 0 ) )
|
176 |
return false;
|
177 |
|
178 |
-
/**
|
179 |
-
* Fires right before the loading of the forums single forum screen template file.
|
180 |
-
*
|
181 |
-
* @since BuddyPress (1.5.0)
|
182 |
-
*/
|
183 |
do_action( 'bp_forums_screen_single_forum' );
|
184 |
|
185 |
-
/**
|
186 |
-
* Filters the template to load for the forums single forum screen.
|
187 |
-
*
|
188 |
-
* @since BuddyPress (1.5.0)
|
189 |
-
*
|
190 |
-
* @param string $template Path to the forums single forum template to load.
|
191 |
-
*/
|
192 |
bp_core_load_template( apply_filters( 'bp_forums_screen_single_forum', 'forums/single/forum' ) );
|
193 |
}
|
194 |
add_action( 'bp_screens', 'bp_forums_screen_single_forum' );
|
@@ -201,31 +133,19 @@ function bp_forums_screen_single_topic() {
|
|
201 |
if ( !bp_is_forums_component() || !bp_is_current_action( 'topic' ) || !bp_action_variable( 0 ) )
|
202 |
return false;
|
203 |
|
204 |
-
/**
|
205 |
-
* Fires right before the loading of the forums single topic screen template file.
|
206 |
-
*
|
207 |
-
* @since BuddyPress (1.5.0)
|
208 |
-
*/
|
209 |
do_action( 'bp_forums_screen_single_topic' );
|
210 |
|
211 |
-
/**
|
212 |
-
* Filters the template to load for the forums single topic screen.
|
213 |
-
*
|
214 |
-
* @since BuddyPress (1.5.0)
|
215 |
-
*
|
216 |
-
* @param string $template Path to the forums single topic template to load.
|
217 |
-
*/
|
218 |
bp_core_load_template( apply_filters( 'bp_forums_screen_single_topic', 'forums/single/topic' ) );
|
219 |
}
|
220 |
add_action( 'bp_screens', 'bp_forums_screen_single_topic' );
|
221 |
|
222 |
|
223 |
-
/** Theme
|
224 |
|
225 |
/**
|
226 |
* The main theme compat class for legacy BuddyPress forums.
|
227 |
*
|
228 |
-
* This class sets up the necessary theme
|
229 |
* old forum template parts to the_title and the_content areas of a theme.
|
230 |
*
|
231 |
* @since BuddyPress (1.7.0)
|
@@ -242,7 +162,7 @@ class BP_Forum_Legacy_Theme_Compat {
|
|
242 |
}
|
243 |
|
244 |
/**
|
245 |
-
* Are we looking at something that needs old forum theme
|
246 |
*
|
247 |
* @since BuddyPress (1.7.0)
|
248 |
*/
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/**
|
13 |
* Load the Forums directory.
|
28 |
|
29 |
bp_update_is_directory( true, 'forums' );
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
do_action( 'bbpress_init' );
|
32 |
|
33 |
// Check to see if the user has posted a new topic from the forums page.
|
75 |
}
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
|
|
78 |
do_action( 'bp_forums_directory_forums_setup' );
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
bp_core_load_template( apply_filters( 'bp_forums_template_directory_forums_setup', 'forums/index' ) );
|
81 |
}
|
82 |
}
|
86 |
* Load the Topics Started screen.
|
87 |
*/
|
88 |
function bp_member_forums_screen_topics() {
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
do_action( 'bp_member_forums_screen_topics' );
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
bp_core_load_template( apply_filters( 'bp_member_forums_screen_topics', 'members/single/home' ) );
|
92 |
}
|
93 |
|
95 |
* Load the Replied To screen.
|
96 |
*/
|
97 |
function bp_member_forums_screen_replies() {
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
do_action( 'bp_member_forums_screen_replies' );
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
bp_core_load_template( apply_filters( 'bp_member_forums_screen_replies', 'members/single/home' ) );
|
101 |
}
|
102 |
|
106 |
* Note that this feature is not fully implemented at the moment.
|
107 |
*/
|
108 |
function bp_member_forums_screen_favorites() {
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
do_action( 'bp_member_forums_screen_favorites' );
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
bp_core_load_template( apply_filters( 'bp_member_forums_screen_favorites', 'members/single/home' ) );
|
112 |
}
|
113 |
|
119 |
if ( !bp_is_forums_component() || !bp_is_current_action( 'forum' ) || !bp_action_variable( 0 ) )
|
120 |
return false;
|
121 |
|
|
|
|
|
|
|
|
|
|
|
122 |
do_action( 'bp_forums_screen_single_forum' );
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
bp_core_load_template( apply_filters( 'bp_forums_screen_single_forum', 'forums/single/forum' ) );
|
125 |
}
|
126 |
add_action( 'bp_screens', 'bp_forums_screen_single_forum' );
|
133 |
if ( !bp_is_forums_component() || !bp_is_current_action( 'topic' ) || !bp_action_variable( 0 ) )
|
134 |
return false;
|
135 |
|
|
|
|
|
|
|
|
|
|
|
136 |
do_action( 'bp_forums_screen_single_topic' );
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
bp_core_load_template( apply_filters( 'bp_forums_screen_single_topic', 'forums/single/topic' ) );
|
139 |
}
|
140 |
add_action( 'bp_screens', 'bp_forums_screen_single_topic' );
|
141 |
|
142 |
|
143 |
+
/** Theme Compatability *******************************************************/
|
144 |
|
145 |
/**
|
146 |
* The main theme compat class for legacy BuddyPress forums.
|
147 |
*
|
148 |
+
* This class sets up the necessary theme compatability actions to safely output
|
149 |
* old forum template parts to the_title and the_content areas of a theme.
|
150 |
*
|
151 |
* @since BuddyPress (1.7.0)
|
162 |
}
|
163 |
|
164 |
/**
|
165 |
+
* Are we looking at something that needs old forum theme compatability?
|
166 |
*
|
167 |
* @since BuddyPress (1.7.0)
|
168 |
*/
|
bp-forums/bp-forums-template.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/**
|
13 |
* Output the forums component slug.
|
@@ -28,14 +28,6 @@ function bp_forums_slug() {
|
|
28 |
*/
|
29 |
function bp_get_forums_slug() {
|
30 |
global $bp;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Filters the forums component slug.
|
34 |
-
*
|
35 |
-
* @since BuddyPress (1.5.0)
|
36 |
-
*
|
37 |
-
* @param string $slug Forums component slug.
|
38 |
-
*/
|
39 |
return apply_filters( 'bp_get_forums_slug', $bp->forums->slug );
|
40 |
}
|
41 |
|
@@ -58,14 +50,6 @@ function bp_forums_root_slug() {
|
|
58 |
*/
|
59 |
function bp_get_forums_root_slug() {
|
60 |
global $bp;
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Filters the forums component root slug.
|
64 |
-
*
|
65 |
-
* @since BuddyPress (1.5.0)
|
66 |
-
*
|
67 |
-
* @param string $root_slug Forums component root slug.
|
68 |
-
*/
|
69 |
return apply_filters( 'bp_get_forums_root_slug', $bp->forums->root_slug );
|
70 |
}
|
71 |
|
@@ -85,21 +69,13 @@ function bp_forums_directory_permalink() {
|
|
85 |
* @since BuddyPress (1.5.0)
|
86 |
*
|
87 |
* @uses apply_filters()
|
88 |
-
* @uses
|
89 |
* @uses bp_get_root_domain()
|
90 |
* @uses bp_get_forums_root_slug()
|
91 |
*
|
92 |
* @return string The permalink for the forums component directory.
|
93 |
*/
|
94 |
function bp_get_forums_directory_permalink() {
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Filters the permalink for the forum directory.
|
98 |
-
*
|
99 |
-
* @since BuddyPress (1.5.0)
|
100 |
-
*
|
101 |
-
* @param string $value Permalink for the forum directory.
|
102 |
-
*/
|
103 |
return apply_filters( 'bp_get_forums_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() ) );
|
104 |
}
|
105 |
|
@@ -161,7 +137,7 @@ class BP_Forums_Template_Forum {
|
|
161 |
* The page number being requested.
|
162 |
*
|
163 |
* @access public
|
164 |
-
* @var
|
165 |
*/
|
166 |
var $pag_page;
|
167 |
|
@@ -169,7 +145,7 @@ class BP_Forums_Template_Forum {
|
|
169 |
* The number of items being requested per page.
|
170 |
*
|
171 |
* @access public
|
172 |
-
* @var
|
173 |
*/
|
174 |
var $pag_num;
|
175 |
|
@@ -223,7 +199,7 @@ class BP_Forums_Template_Forum {
|
|
223 |
* @param int $user_id The ID of the user to whom topics should be
|
224 |
* limited. Pass false to remove this filter.
|
225 |
* @param int $page The number of the page being requested.
|
226 |
-
* @param int $per_page The number of items being requested
|
227 |
* @param string $no_stickies Requested sticky format.
|
228 |
* @param string $search_terms Filter results by a string.
|
229 |
* @param int $offset Optional. Offset results by a given numeric value.
|
@@ -258,19 +234,6 @@ class BP_Forums_Template_Forum {
|
|
258 |
break;
|
259 |
}
|
260 |
|
261 |
-
/**
|
262 |
-
* Filters the forums template topics.
|
263 |
-
*
|
264 |
-
* @since BuddyPress (1.1.0)
|
265 |
-
*
|
266 |
-
* @param array $topics Array of topics being set for display.
|
267 |
-
* @param string $type The sort order/kind. 'newest',
|
268 |
-
* 'popular', 'unreplied', 'tags'.
|
269 |
-
* @param int $forum_id ID for the current forum.
|
270 |
-
* @param int $per_page The number of the page being requested.
|
271 |
-
* @param int $max The max number of posts to show.
|
272 |
-
* @param string $no_stickies Requested sticky format.
|
273 |
-
*/
|
274 |
$this->topics = apply_filters( 'bp_forums_template_topics', $this->topics, $type, $forum_id, $per_page, $max, $no_stickies );
|
275 |
|
276 |
if ( !(int) $this->topics ) {
|
@@ -318,37 +281,7 @@ class BP_Forums_Template_Forum {
|
|
318 |
}
|
319 |
}
|
320 |
|
321 |
-
/**
|
322 |
-
* Filters the topic count for the forum being displayed.
|
323 |
-
*
|
324 |
-
* @since BuddyPress (1.1.0)
|
325 |
-
*
|
326 |
-
* @param int $topic_count Topic count to be displayed.
|
327 |
-
* @param array $topics Array of topics to be displayed.
|
328 |
-
* @param string $type The sort order/kind. 'newest',
|
329 |
-
* 'popular', 'unreplied', 'tags'.
|
330 |
-
* @param int $forum_id ID for the current forum.
|
331 |
-
* @param int $per_page The number of the page being requested.
|
332 |
-
* @param int $max The max number of posts to show.
|
333 |
-
* @param string $no_stickies Requested sticky format.
|
334 |
-
*/
|
335 |
$this->topic_count = apply_filters_ref_array( 'bp_forums_template_topic_count', array( $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies ) );
|
336 |
-
|
337 |
-
/**
|
338 |
-
* Filters the total topic count for the forum being displayed.
|
339 |
-
*
|
340 |
-
* @since BuddyPress (1.1.0)
|
341 |
-
*
|
342 |
-
* @param int $total_topic_count Total topic count found.
|
343 |
-
* @param int $topic_count Topic count to be displayed.
|
344 |
-
* @param array $topics Array of topics to be displayed.
|
345 |
-
* @param string $type The sort order/kind. 'newest',
|
346 |
-
* 'popular', 'unreplied', 'tags'.
|
347 |
-
* @param int $forum_id ID for the current forum.
|
348 |
-
* @param int $per_page The number of the page being requested.
|
349 |
-
* @param int $max The max number of posts to show.
|
350 |
-
* @param string $no_stickies Requested sticky format.
|
351 |
-
*/
|
352 |
$this->total_topic_count = apply_filters_ref_array( 'bp_forums_template_total_topic_count', array( $this->total_topic_count, $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies ) );
|
353 |
|
354 |
// Fetch extra information for topics, so we don't have to query inside the loop
|
@@ -362,8 +295,7 @@ class BP_Forums_Template_Forum {
|
|
362 |
'current' => $this->pag_page,
|
363 |
'prev_text' => _x( '←', 'Forum topic pagination previous text', 'buddypress' ),
|
364 |
'next_text' => _x( '→', 'Forum topic pagination next text', 'buddypress' ),
|
365 |
-
'mid_size' => 1
|
366 |
-
'add_args' => array(),
|
367 |
) );
|
368 |
}
|
369 |
}
|
@@ -419,12 +351,6 @@ class BP_Forums_Template_Forum {
|
|
419 |
if ( $this->current_topic + 1 < $this->topic_count ) {
|
420 |
return true;
|
421 |
} elseif ( $this->current_topic + 1 == $this->topic_count ) {
|
422 |
-
|
423 |
-
/**
|
424 |
-
* Fires right before the rewinding of user topics.
|
425 |
-
*
|
426 |
-
* @since BuddyPress (1.5.0)
|
427 |
-
*/
|
428 |
do_action('forum_loop_end');
|
429 |
// Do some cleaning up after the loop
|
430 |
$this->rewind_topics();
|
@@ -446,15 +372,8 @@ class BP_Forums_Template_Forum {
|
|
446 |
$this->topic = $this->next_topic();
|
447 |
$this->topic = (object)$this->topic;
|
448 |
|
449 |
-
if ( $this->current_topic == 0 )
|
450 |
-
|
451 |
-
/**
|
452 |
-
* Fires if the current topic item is the first in the topic loop.
|
453 |
-
*
|
454 |
-
* @since BuddyPress (1.5.0)
|
455 |
-
*/
|
456 |
-
do_action( 'forum_loop_start' );
|
457 |
-
}
|
458 |
}
|
459 |
}
|
460 |
|
@@ -648,8 +567,7 @@ function bp_has_forum_topics( $args = '' ) {
|
|
648 |
'current' => $forum_template->pag_page,
|
649 |
'prev_text' => _x( '←', 'Forum topic pagination previous text', 'buddypress' ),
|
650 |
'next_text' => _x( '→', 'Forum topic pagination next text', 'buddypress' ),
|
651 |
-
'mid_size' => 1
|
652 |
-
'add_args' => array(),
|
653 |
) );
|
654 |
|
655 |
} else {
|
@@ -661,14 +579,6 @@ function bp_has_forum_topics( $args = '' ) {
|
|
661 |
$forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, 'all', $search_terms );
|
662 |
}
|
663 |
|
664 |
-
/**
|
665 |
-
* Filters whether or not there are topics to display.
|
666 |
-
*
|
667 |
-
* @since BuddyPress (1.1.0)
|
668 |
-
*
|
669 |
-
* @param bool $value Whether or not there are topics to display.
|
670 |
-
* @param object $forum_template Global $forum_template object.
|
671 |
-
*/
|
672 |
return apply_filters( 'bp_has_topics', $forum_template->has_topics(), $forum_template );
|
673 |
}
|
674 |
|
@@ -710,13 +620,6 @@ function bp_the_topic_id() {
|
|
710 |
function bp_get_the_topic_id() {
|
711 |
global $forum_template;
|
712 |
|
713 |
-
/**
|
714 |
-
* Filters the ID of the current topic in the loop.
|
715 |
-
*
|
716 |
-
* @since BuddyPress (1.0.0)
|
717 |
-
*
|
718 |
-
* @param int $topic_id ID for the current topic.
|
719 |
-
*/
|
720 |
return apply_filters( 'bp_get_the_topic_id', $forum_template->topic->topic_id );
|
721 |
}
|
722 |
|
@@ -734,13 +637,6 @@ function bp_the_topic_title() {
|
|
734 |
function bp_get_the_topic_title() {
|
735 |
global $forum_template;
|
736 |
|
737 |
-
/**
|
738 |
-
* Filters the title of the current topic in the loop.
|
739 |
-
*
|
740 |
-
* @since BuddyPress (1.0.0)
|
741 |
-
*
|
742 |
-
* @param string $topic_title Title for the current topic.
|
743 |
-
*/
|
744 |
return apply_filters( 'bp_get_the_topic_title', stripslashes( $forum_template->topic->topic_title ) );
|
745 |
}
|
746 |
|
@@ -758,13 +654,6 @@ function bp_the_topic_slug() {
|
|
758 |
function bp_get_the_topic_slug() {
|
759 |
global $forum_template;
|
760 |
|
761 |
-
/**
|
762 |
-
* Filters the slug of the current topic in the loop.
|
763 |
-
*
|
764 |
-
* @since BuddyPress (1.0.0)
|
765 |
-
*
|
766 |
-
* @param string $topic_slug Slug for the current topic.
|
767 |
-
*/
|
768 |
return apply_filters( 'bp_get_the_topic_slug', $forum_template->topic->topic_slug );
|
769 |
}
|
770 |
|
@@ -783,14 +672,6 @@ function bp_the_topic_text() {
|
|
783 |
global $forum_template;
|
784 |
|
785 |
$post = bb_get_first_post( (int) $forum_template->topic->topic_id, false );
|
786 |
-
|
787 |
-
/**
|
788 |
-
* Filters the text of the first post in the current topic in the loop.
|
789 |
-
*
|
790 |
-
* @since BuddyPress (1.1.0)
|
791 |
-
*
|
792 |
-
* @param string $post_text Text for the first post in the current topic.
|
793 |
-
*/
|
794 |
return apply_filters( 'bp_get_the_topic_text', esc_attr( $post->post_text ) );
|
795 |
}
|
796 |
|
@@ -808,13 +689,6 @@ function bp_the_topic_poster_id() {
|
|
808 |
function bp_get_the_topic_poster_id() {
|
809 |
global $forum_template;
|
810 |
|
811 |
-
/**
|
812 |
-
* Filters the ID of the user who posted the current topic in the loop.
|
813 |
-
*
|
814 |
-
* @since BuddyPress (1.0.0)
|
815 |
-
*
|
816 |
-
* @param int $topic_poster ID for the user.
|
817 |
-
*/
|
818 |
return apply_filters( 'bp_get_the_topic_poster_id', $forum_template->topic->topic_poster );
|
819 |
}
|
820 |
|
@@ -859,13 +733,6 @@ function bp_the_topic_poster_avatar( $args = '' ) {
|
|
859 |
$r = wp_parse_args( $args, $defaults );
|
860 |
extract( $r, EXTR_SKIP );
|
861 |
|
862 |
-
/**
|
863 |
-
* Filters the avatar for the user who posted the current topic in the loop.
|
864 |
-
*
|
865 |
-
* @since BuddyPress (1.0.0)
|
866 |
-
*
|
867 |
-
* @param string $value HTML for the display of the user's avatar.
|
868 |
-
*/
|
869 |
return apply_filters( 'bp_get_the_topic_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->topic_poster, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) );
|
870 |
}
|
871 |
|
@@ -888,13 +755,6 @@ function bp_the_topic_poster_name() {
|
|
888 |
if ( !$name = bp_core_get_userlink( $poster_id ) )
|
889 |
return __( 'Deleted User', 'buddypress' );
|
890 |
|
891 |
-
/**
|
892 |
-
* Filters the name of the user who posted the current topic in the loop.
|
893 |
-
*
|
894 |
-
* @since BuddyPress (1.0.0)
|
895 |
-
*
|
896 |
-
* @param string $name Name for the user who posted the current topic.
|
897 |
-
*/
|
898 |
return apply_filters( 'bp_get_the_topic_poster_name', $name );
|
899 |
}
|
900 |
|
@@ -914,15 +774,6 @@ function bp_the_topic_object_id() {
|
|
914 |
function bp_get_the_topic_object_id() {
|
915 |
global $forum_template;
|
916 |
|
917 |
-
/**
|
918 |
-
* Filters the ID of the object associated with the current topic in the loop.
|
919 |
-
*
|
920 |
-
* Objects are things like associated groups.
|
921 |
-
*
|
922 |
-
* @since BuddyPress (1.1.0)
|
923 |
-
*
|
924 |
-
* @param int $object_id ID for the object associated with the current topic.
|
925 |
-
*/
|
926 |
return apply_filters( 'bp_get_the_topic_object_id', $forum_template->topic->object_id );
|
927 |
}
|
928 |
|
@@ -948,16 +799,6 @@ function bp_the_topic_object_name() {
|
|
948 |
else
|
949 |
$retval = '';
|
950 |
|
951 |
-
/**
|
952 |
-
* Filters the name of the object associated with the current topic in the loop.
|
953 |
-
*
|
954 |
-
* Objects are things like groups. So this filter would return the
|
955 |
-
* name of the group associated with the forum topic, if it exists.
|
956 |
-
*
|
957 |
-
* @since BuddyPress (1.1.0)
|
958 |
-
*
|
959 |
-
* @param string $retval Name for the object associated with the current topic.
|
960 |
-
*/
|
961 |
return apply_filters( 'bp_get_the_topic_object_name', $retval );
|
962 |
}
|
963 |
|
@@ -978,16 +819,6 @@ function bp_the_topic_object_slug() {
|
|
978 |
function bp_get_the_topic_object_slug() {
|
979 |
global $forum_template;
|
980 |
|
981 |
-
/**
|
982 |
-
* Filters the slug of the object associated with the current topic in the loop.
|
983 |
-
*
|
984 |
-
* Objects are things like groups. So this filter would return the
|
985 |
-
* slug of the group associated with the forum topic, if it exists.
|
986 |
-
*
|
987 |
-
* @since BuddyPress (1.1.0)
|
988 |
-
*
|
989 |
-
* @param string $object_slug Slug for the object associated with the current topic.
|
990 |
-
*/
|
991 |
return apply_filters( 'bp_get_the_topic_object_slug', $forum_template->topic->object_slug );
|
992 |
}
|
993 |
|
@@ -1013,16 +844,6 @@ function bp_the_topic_object_permalink() {
|
|
1013 |
else
|
1014 |
$permalink = '';
|
1015 |
|
1016 |
-
/**
|
1017 |
-
* Filters the permalink of the object associated with the current topic in the loop.
|
1018 |
-
*
|
1019 |
-
* Objects are things like groups. So this filter would return the
|
1020 |
-
* slug of the group associated with the forum topic, if it exists.
|
1021 |
-
*
|
1022 |
-
* @since BuddyPress (1.1.0)
|
1023 |
-
*
|
1024 |
-
* @param string $permalink Permalink for the object associated with the current topic.
|
1025 |
-
*/
|
1026 |
return apply_filters( 'bp_get_the_topic_object_permalink', $permalink );
|
1027 |
}
|
1028 |
|
@@ -1048,13 +869,6 @@ function bp_the_topic_last_poster_name() {
|
|
1048 |
if ( !$domain || $domain == bp_core_get_root_domain() . '/' . bp_get_members_root_slug() . '/' )
|
1049 |
return __( 'Deleted User', 'buddypress' );
|
1050 |
|
1051 |
-
/**
|
1052 |
-
* Filters the linked name of the user who last posted to the current topic in the loop.
|
1053 |
-
*
|
1054 |
-
* @since BuddyPress (1.0.0)
|
1055 |
-
*
|
1056 |
-
* @param string $value HTML link to the profile of the user who last posted.
|
1057 |
-
*/
|
1058 |
return apply_filters( 'bp_get_the_topic_last_poster_name', '<a href="' . $domain . '">' . $forum_template->topic->topic_last_poster_displayname . '</a>' );
|
1059 |
}
|
1060 |
|
@@ -1105,13 +919,6 @@ function bp_the_topic_object_avatar( $args = '' ) {
|
|
1105 |
$r = wp_parse_args( $args, $defaults );
|
1106 |
extract( $r, EXTR_SKIP );
|
1107 |
|
1108 |
-
/**
|
1109 |
-
* Filters the avatar of the object associated with the current topic in the loop.
|
1110 |
-
*
|
1111 |
-
* @since BuddyPress (1.1.0)
|
1112 |
-
*
|
1113 |
-
* @param string $value HTML output for the object associated with the current topic.
|
1114 |
-
*/
|
1115 |
return apply_filters( 'bp_get_the_topic_object_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->object_id, 'type' => $type, 'object' => 'group', 'width' => $width, 'height' => $height, 'alt' => $alt ) ) );
|
1116 |
}
|
1117 |
|
@@ -1156,13 +963,6 @@ function bp_the_topic_last_poster_avatar( $args = '' ) {
|
|
1156 |
$r = wp_parse_args( $args, $defaults );
|
1157 |
extract( $r, EXTR_SKIP );
|
1158 |
|
1159 |
-
/**
|
1160 |
-
* Filters the avatar for the user who last posted to the current topic in the loop.
|
1161 |
-
*
|
1162 |
-
* @since BuddyPress (1.0.0)
|
1163 |
-
*
|
1164 |
-
* @param string $value HTML output for the avatar for the user who last posted.
|
1165 |
-
*/
|
1166 |
return apply_filters( 'bp_get_the_topic_last_poster_avatar', bp_core_fetch_avatar( array( 'email' => $forum_template->topic->topic_last_poster_email, 'item_id' => $forum_template->topic->topic_last_poster, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) );
|
1167 |
}
|
1168 |
|
@@ -1180,13 +980,6 @@ function bp_the_topic_start_time() {
|
|
1180 |
function bp_get_the_topic_start_time() {
|
1181 |
global $forum_template;
|
1182 |
|
1183 |
-
/**
|
1184 |
-
* Filters the start time of the current topic in the loop.
|
1185 |
-
*
|
1186 |
-
* @since BuddyPress (1.0.0)
|
1187 |
-
*
|
1188 |
-
* @param string $topic_start_time Start time for the current topic.
|
1189 |
-
*/
|
1190 |
return apply_filters( 'bp_get_the_topic_start_time', $forum_template->topic->topic_start_time );
|
1191 |
}
|
1192 |
|
@@ -1204,13 +997,6 @@ function bp_the_topic_time() {
|
|
1204 |
function bp_get_the_topic_time() {
|
1205 |
global $forum_template;
|
1206 |
|
1207 |
-
/**
|
1208 |
-
* Filters the topic time of the current topic in the loop.
|
1209 |
-
*
|
1210 |
-
* @since BuddyPress (1.0.0)
|
1211 |
-
*
|
1212 |
-
* @param string $topic_time Topic time for the current topic.
|
1213 |
-
*/
|
1214 |
return apply_filters( 'bp_get_the_topic_time', $forum_template->topic->topic_time );
|
1215 |
}
|
1216 |
|
@@ -1228,13 +1014,6 @@ function bp_the_topic_forum_id() {
|
|
1228 |
function bp_get_the_topic_forum_id() {
|
1229 |
global $forum_template;
|
1230 |
|
1231 |
-
/**
|
1232 |
-
* Filters the ID of the forum associated with the current topic in the loop.
|
1233 |
-
*
|
1234 |
-
* @since BuddyPress (1.0.0)
|
1235 |
-
*
|
1236 |
-
* @param int $forum_id ID of the forum associated with the current topic.
|
1237 |
-
*/
|
1238 |
return apply_filters( 'bp_get_the_topic_forum_id', $forum_template->topic->forum_id );
|
1239 |
}
|
1240 |
|
@@ -1252,13 +1031,6 @@ function bp_the_topic_status() {
|
|
1252 |
function bp_get_the_topic_status() {
|
1253 |
global $forum_template;
|
1254 |
|
1255 |
-
/**
|
1256 |
-
* Filters the status of the current topic in the loop.
|
1257 |
-
*
|
1258 |
-
* @since BuddyPress (1.0.0)
|
1259 |
-
*
|
1260 |
-
* @param string $topic_status Status of the current topic.
|
1261 |
-
*/
|
1262 |
return apply_filters( 'bp_get_the_topic_status', $forum_template->topic->topic_status );
|
1263 |
}
|
1264 |
|
@@ -1276,13 +1048,6 @@ function bp_the_topic_is_topic_open() {
|
|
1276 |
function bp_get_the_topic_is_topic_open() {
|
1277 |
global $forum_template;
|
1278 |
|
1279 |
-
/**
|
1280 |
-
* Filters whether or not the current topic in the loop is open.
|
1281 |
-
*
|
1282 |
-
* @since BuddyPress (1.0.0)
|
1283 |
-
*
|
1284 |
-
* @param string $topic_open Whether or not the current topic is open.
|
1285 |
-
*/
|
1286 |
return apply_filters( 'bp_get_the_topic_is_topic_open', $forum_template->topic->topic_open );
|
1287 |
}
|
1288 |
|
@@ -1300,13 +1065,6 @@ function bp_the_topic_last_post_id() {
|
|
1300 |
function bp_get_the_topic_last_post_id() {
|
1301 |
global $forum_template;
|
1302 |
|
1303 |
-
/**
|
1304 |
-
* Filters the ID of the last post in the current topic in the loop.
|
1305 |
-
*
|
1306 |
-
* @since BuddyPress (1.0.0)
|
1307 |
-
*
|
1308 |
-
* @param int $topic_last_post_id ID for the last post in the current topic.
|
1309 |
-
*/
|
1310 |
return apply_filters( 'bp_get_the_topic_last_post_id', $forum_template->topic->topic_last_post_id );
|
1311 |
}
|
1312 |
|
@@ -1324,13 +1082,6 @@ function bp_the_topic_is_sticky() {
|
|
1324 |
function bp_get_the_topic_is_sticky() {
|
1325 |
global $forum_template;
|
1326 |
|
1327 |
-
/**
|
1328 |
-
* Filters whether or not the current topic in the loop is sticky.
|
1329 |
-
*
|
1330 |
-
* @since BuddyPress (1.0.0)
|
1331 |
-
*
|
1332 |
-
* @param bool $topic_sticky Whether or not the current topic is sticky.
|
1333 |
-
*/
|
1334 |
return apply_filters( 'bp_get_the_topic_is_sticky', $forum_template->topic->topic_sticky );
|
1335 |
}
|
1336 |
|
@@ -1348,21 +1099,10 @@ function bp_the_topic_total_post_count() {
|
|
1348 |
function bp_get_the_topic_total_post_count() {
|
1349 |
global $forum_template;
|
1350 |
|
1351 |
-
if ( $forum_template->topic->topic_posts == 1 )
|
1352 |
-
|
1353 |
-
/**
|
1354 |
-
* Filters a 'x posts' string with the number of posts in the current topic.
|
1355 |
-
*
|
1356 |
-
* @since BuddyPress (1.0.0)
|
1357 |
-
*
|
1358 |
-
* @param string $value 'X posts' string value for the current topic.
|
1359 |
-
*/
|
1360 |
return apply_filters( 'bp_get_the_topic_total_post_count', sprintf( __( '%d post', 'buddypress' ), $forum_template->topic->topic_posts ) );
|
1361 |
-
|
1362 |
-
|
1363 |
-
/** This filter is documented in bp-forums/bp-forums-template.php */
|
1364 |
return apply_filters( 'bp_get_the_topic_total_post_count', sprintf( __( '%d posts', 'buddypress' ), $forum_template->topic->topic_posts ) );
|
1365 |
-
}
|
1366 |
}
|
1367 |
|
1368 |
/**
|
@@ -1379,13 +1119,6 @@ function bp_the_topic_total_posts() {
|
|
1379 |
function bp_get_the_topic_total_posts() {
|
1380 |
global $forum_template;
|
1381 |
|
1382 |
-
/**
|
1383 |
-
* Filters the total number of posts in the current topic in the loop.
|
1384 |
-
*
|
1385 |
-
* @since BuddyPress (1.2.4)
|
1386 |
-
*
|
1387 |
-
* @param int $topic_posts Total number of posts in the current topic.
|
1388 |
-
*/
|
1389 |
return apply_filters( 'bp_get_the_topic_total_posts', $forum_template->topic->topic_posts );
|
1390 |
}
|
1391 |
|
@@ -1403,13 +1136,6 @@ function bp_the_topic_tag_count() {
|
|
1403 |
function bp_get_the_topic_tag_count() {
|
1404 |
global $forum_template;
|
1405 |
|
1406 |
-
/**
|
1407 |
-
* Filters the tag count for the current topic in the loop.
|
1408 |
-
*
|
1409 |
-
* @since BuddyPress (1.0.0)
|
1410 |
-
*
|
1411 |
-
* @param int $tag_count Tag count for the current topic.
|
1412 |
-
*/
|
1413 |
return apply_filters( 'bp_get_the_topic_tag_count', $forum_template->topic->tag_count );
|
1414 |
}
|
1415 |
|
@@ -1444,13 +1170,6 @@ function bp_the_topic_permalink() {
|
|
1444 |
$permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() );
|
1445 |
}
|
1446 |
|
1447 |
-
/**
|
1448 |
-
* Filters the permalink for the current topic in the loop.
|
1449 |
-
*
|
1450 |
-
* @since BuddyPress (1.0.0)
|
1451 |
-
*
|
1452 |
-
* @param string $value Permalink for the current topic in the loop.
|
1453 |
-
*/
|
1454 |
return apply_filters( 'bp_get_the_topic_permalink', trailingslashit( $permalink . 'topic/' . $forum_template->topic->topic_slug ) );
|
1455 |
}
|
1456 |
|
@@ -1470,13 +1189,6 @@ function bp_the_topic_time_since_created() {
|
|
1470 |
function bp_get_the_topic_time_since_created() {
|
1471 |
global $forum_template;
|
1472 |
|
1473 |
-
/**
|
1474 |
-
* Filters a 'time since' string describing when the current topic was created.
|
1475 |
-
*
|
1476 |
-
* @since BuddyPress (1.0.0)
|
1477 |
-
*
|
1478 |
-
* @param string $value 'Time since' value for the current topic.
|
1479 |
-
*/
|
1480 |
return apply_filters( 'bp_get_the_topic_time_since_created', bp_core_time_since( strtotime( $forum_template->topic->topic_start_time ) ) );
|
1481 |
}
|
1482 |
|
@@ -1507,14 +1219,6 @@ function bp_the_topic_latest_post_excerpt( $args = '' ) {
|
|
1507 |
$post = bp_forums_get_post( $forum_template->topic->topic_last_post_id );
|
1508 |
$post = bp_create_excerpt( $post->post_text, $length );
|
1509 |
|
1510 |
-
/**
|
1511 |
-
* Filters an excerpt from the latest post of the current topic in the loop.
|
1512 |
-
*
|
1513 |
-
* @since BuddyPress (1.0.0)
|
1514 |
-
*
|
1515 |
-
* @param string $post Post exceprt for the current topic.
|
1516 |
-
* @param string $length String length to trim excerpt down to.
|
1517 |
-
*/
|
1518 |
return apply_filters( 'bp_get_the_topic_latest_post_excerpt', $post, $length );
|
1519 |
}
|
1520 |
|
@@ -1534,13 +1238,6 @@ function bp_the_topic_time_since_last_post() {
|
|
1534 |
function bp_get_the_topic_time_since_last_post() {
|
1535 |
global $forum_template;
|
1536 |
|
1537 |
-
/**
|
1538 |
-
* Filters a 'time since' string describing when the last post in the current topic was created.
|
1539 |
-
*
|
1540 |
-
* @since BuddyPress (1.0.0)
|
1541 |
-
*
|
1542 |
-
* @param string $value The 'time since' string for the last post in the current topic.
|
1543 |
-
*/
|
1544 |
return apply_filters( 'bp_get_the_topic_time_since_last_post', bp_core_time_since( strtotime( $forum_template->topic->topic_time ) ) );
|
1545 |
}
|
1546 |
|
@@ -1576,7 +1273,7 @@ function bp_the_topic_admin_links( $args = '' ) {
|
|
1576 |
* Return the admin links for the current topic in the loop.
|
1577 |
*
|
1578 |
* @param array $args {
|
1579 |
-
* @type string $
|
1580 |
* links. Default: '|'.
|
1581 |
* }
|
1582 |
* @return HTML string containing the admin links for the current topic.
|
@@ -1585,7 +1282,7 @@ function bp_the_topic_admin_links( $args = '' ) {
|
|
1585 |
global $forum_template;
|
1586 |
|
1587 |
$defaults = array(
|
1588 |
-
'
|
1589 |
);
|
1590 |
|
1591 |
$r = wp_parse_args( $args, $defaults );
|
@@ -1607,7 +1304,7 @@ function bp_the_topic_admin_links( $args = '' ) {
|
|
1607 |
$links[] = '<a class="confirm" id="topic-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete', 'bp_forums_delete_topic' ) . '">' . __( 'Delete Topic', 'buddypress' ) . '</a>';
|
1608 |
}
|
1609 |
|
1610 |
-
return implode( ' ' . $
|
1611 |
}
|
1612 |
|
1613 |
/**
|
@@ -1638,16 +1335,6 @@ function bp_the_topic_css_class() {
|
|
1638 |
if ( !isset( $forum_template->topic->topic_open ) || 0 == (int) $forum_template->topic->topic_open )
|
1639 |
$class .= ' closed';
|
1640 |
|
1641 |
-
/**
|
1642 |
-
* Filters the CSS class for the current topic in the loop.
|
1643 |
-
*
|
1644 |
-
* This class may contain keywords like 'alt', 'sticky', or 'closed',
|
1645 |
-
* based on context.
|
1646 |
-
*
|
1647 |
-
* @since BuddyPress (1.2.4)
|
1648 |
-
*
|
1649 |
-
* @param string $value Concatenated classes for the current topic in the loop.
|
1650 |
-
*/
|
1651 |
return apply_filters( 'bp_get_the_topic_css_class', trim( $class ) );
|
1652 |
}
|
1653 |
|
@@ -1665,13 +1352,6 @@ function bp_my_forum_topics_link() {
|
|
1665 |
function bp_get_my_forum_topics_link() {
|
1666 |
global $bp;
|
1667 |
|
1668 |
-
/**
|
1669 |
-
* Filters the permalink to the 'personal' topics tab.
|
1670 |
-
*
|
1671 |
-
* @since BuddyPress (1.1.0)
|
1672 |
-
*
|
1673 |
-
* @param string $value Permalink to the 'personal' topics tab.
|
1674 |
-
*/
|
1675 |
return apply_filters( 'bp_get_my_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/personal/' );
|
1676 |
}
|
1677 |
|
@@ -1689,13 +1369,6 @@ function bp_unreplied_forum_topics_link() {
|
|
1689 |
function bp_get_unreplied_forum_topics_link() {
|
1690 |
global $bp;
|
1691 |
|
1692 |
-
/**
|
1693 |
-
* Filters the permalink to the 'unreplied' topics tab.
|
1694 |
-
*
|
1695 |
-
* @since BuddyPress (1.1.0)
|
1696 |
-
*
|
1697 |
-
* @param string $value Permalink to the 'unreplied' topics tab.
|
1698 |
-
*/
|
1699 |
return apply_filters( 'bp_get_unreplied_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/unreplied/' );
|
1700 |
}
|
1701 |
|
@@ -1713,13 +1386,6 @@ function bp_popular_forum_topics_link() {
|
|
1713 |
function bp_get_popular_forum_topics_link() {
|
1714 |
global $bp;
|
1715 |
|
1716 |
-
/**
|
1717 |
-
* Filters the permalink to the 'popular' topics tab.
|
1718 |
-
*
|
1719 |
-
* @since BuddyPress (1.1.0)
|
1720 |
-
*
|
1721 |
-
* @param string $value Permalink to the 'popular' topics tab.
|
1722 |
-
*/
|
1723 |
return apply_filters( 'bp_get_popular_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/popular/' );
|
1724 |
}
|
1725 |
|
@@ -1737,13 +1403,6 @@ function bp_newest_forum_topics_link() {
|
|
1737 |
function bp_get_newest_forum_topics_link() {
|
1738 |
global $bp;
|
1739 |
|
1740 |
-
/**
|
1741 |
-
* Filters the link to the forums directory.
|
1742 |
-
*
|
1743 |
-
* @since BuddyPress (1.1.0)
|
1744 |
-
*
|
1745 |
-
* @param string $value Link to the forums directory.
|
1746 |
-
*/
|
1747 |
return apply_filters( 'bp_get_newest_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' );
|
1748 |
}
|
1749 |
|
@@ -1766,15 +1425,6 @@ function bp_forum_topic_type() {
|
|
1766 |
if ( !bp_is_directory() || !bp_current_action() )
|
1767 |
return 'newest';
|
1768 |
|
1769 |
-
/**
|
1770 |
-
* Filters the currently viewed topic list type.
|
1771 |
-
*
|
1772 |
-
* Eg, 'newest', 'popular', etc.
|
1773 |
-
*
|
1774 |
-
* @since BuddyPress (1.1.0)
|
1775 |
-
*
|
1776 |
-
* @param string $value Currently viewed topic list type.
|
1777 |
-
*/
|
1778 |
return apply_filters( 'bp_get_forum_topic_type', bp_current_action() );
|
1779 |
}
|
1780 |
|
@@ -1784,7 +1434,7 @@ function bp_forum_topic_type() {
|
|
1784 |
* @since BuddyPress (1.5.0)
|
1785 |
*/
|
1786 |
function bp_forum_topic_new_reply_link() {
|
1787 |
-
echo
|
1788 |
}
|
1789 |
/**
|
1790 |
* Return the permalink for the New Reply button at the top of forum topics.
|
@@ -1809,13 +1459,7 @@ function bp_forum_topic_new_reply_link() {
|
|
1809 |
), bp_get_the_topic_permalink() );
|
1810 |
}
|
1811 |
|
1812 |
-
|
1813 |
-
* Filters the permalink for the New Reply button at the top of forum topics.
|
1814 |
-
*
|
1815 |
-
* @since BuddyPress (1.5.0)
|
1816 |
-
*
|
1817 |
-
* @param string $value Permalink for the New Reply button.
|
1818 |
-
*/
|
1819 |
return apply_filters( 'bp_get_forum_topic_new_reply_link', $link . '#post-topic-reply', $link );
|
1820 |
}
|
1821 |
|
@@ -1852,13 +1496,6 @@ function bp_forum_pagination() {
|
|
1852 |
function bp_get_forum_pagination() {
|
1853 |
global $forum_template;
|
1854 |
|
1855 |
-
/**
|
1856 |
-
* Filters the pagination links for the current topic list.
|
1857 |
-
*
|
1858 |
-
* @since BuddyPress (1.0.0)
|
1859 |
-
*
|
1860 |
-
* @param string $pag_links HTML pagination links.
|
1861 |
-
*/
|
1862 |
return apply_filters( 'bp_get_forum_pagination', $forum_template->pag_links );
|
1863 |
}
|
1864 |
|
@@ -1887,16 +1524,6 @@ function bp_forum_pagination_count() {
|
|
1887 |
if ( 'tags' == $forum_template->type && !empty( $forum_template->search_terms ) )
|
1888 |
$pag_filter = sprintf( __( ' matching tag "%s"', 'buddypress' ), $forum_template->search_terms );
|
1889 |
|
1890 |
-
/**
|
1891 |
-
* Filters the pagination count for the current topic list.
|
1892 |
-
*
|
1893 |
-
* @since BuddyPress (1.5.0)
|
1894 |
-
*
|
1895 |
-
* @param string $value Pagination count for the current topic list.
|
1896 |
-
* @param string $from_num Low end count in the view.
|
1897 |
-
* @param string $to_num High end count in the view.
|
1898 |
-
* @param string $total Total count of topics found.
|
1899 |
-
*/
|
1900 |
return apply_filters( 'bp_get_forum_pagination_count', sprintf( _n( 'Viewing 1 topic', 'Viewing %1$s - %2$s of %3$s topics', (int) $forum_template->total_topic_count, 'buddypress' ), $from_num, $to_num, $total, $pag_filter ), $from_num, $to_num, $total );
|
1901 |
}
|
1902 |
|
@@ -2108,8 +1735,7 @@ class BP_Forums_Template_Topic {
|
|
2108 |
'current' => $this->pag_page,
|
2109 |
'prev_text' => _x( '←', 'Forum thread pagination previous text', 'buddypress' ),
|
2110 |
'next_text' => _x( '→', 'Forum thread pagination next text', 'buddypress' ),
|
2111 |
-
'mid_size' => 1
|
2112 |
-
'add_args' => array(),
|
2113 |
) );
|
2114 |
|
2115 |
$this->pag->total_pages = ceil( (int) $this->total_post_count / (int) $this->pag_num );
|
@@ -2169,12 +1795,6 @@ class BP_Forums_Template_Topic {
|
|
2169 |
if ( $this->current_post + 1 < $this->post_count ) {
|
2170 |
return true;
|
2171 |
} elseif ( $this->current_post + 1 == $this->post_count ) {
|
2172 |
-
|
2173 |
-
/**
|
2174 |
-
* Fires right before the rewinding of user posts.
|
2175 |
-
*
|
2176 |
-
* @since BuddyPress (1.5.0)
|
2177 |
-
*/
|
2178 |
do_action('topic_loop_end');
|
2179 |
// Do some cleaning up after the loop
|
2180 |
$this->rewind_posts();
|
@@ -2196,15 +1816,8 @@ class BP_Forums_Template_Topic {
|
|
2196 |
$this->post = $this->next_post();
|
2197 |
$this->post = (object)$this->post;
|
2198 |
|
2199 |
-
if ( $this->current_post == 0 )
|
2200 |
-
|
2201 |
-
/**
|
2202 |
-
* Fires if the current post item is the first in the topic loop.
|
2203 |
-
*
|
2204 |
-
* @since BuddyPress (1.5.0)
|
2205 |
-
*/
|
2206 |
-
do_action( 'topic_loop_start' );
|
2207 |
-
}
|
2208 |
}
|
2209 |
}
|
2210 |
|
@@ -2250,14 +1863,6 @@ function bp_has_forum_topic_posts( $args = '' ) {
|
|
2250 |
return false;
|
2251 |
}
|
2252 |
|
2253 |
-
/**
|
2254 |
-
* Filters whether or not there are topics to display.
|
2255 |
-
*
|
2256 |
-
* @since BuddyPress (1.1.0)
|
2257 |
-
*
|
2258 |
-
* @param bool $value Whether or not there are topics.
|
2259 |
-
* @param BP_Forums_Template_Topic $topic_template Topic template global to use when rendering.
|
2260 |
-
*/
|
2261 |
return apply_filters( 'bp_has_topic_posts', $topic_template->has_posts(), $topic_template );
|
2262 |
}
|
2263 |
|
@@ -2295,13 +1900,6 @@ function bp_the_topic_post_id() {
|
|
2295 |
function bp_get_the_topic_post_id() {
|
2296 |
global $topic_template;
|
2297 |
|
2298 |
-
/**
|
2299 |
-
* Filters the ID of the current post in the loop.
|
2300 |
-
*
|
2301 |
-
* @since BuddyPress (1.0.0)
|
2302 |
-
*
|
2303 |
-
* @param int $post_id ID of the current post.
|
2304 |
-
*/
|
2305 |
return apply_filters( 'bp_get_the_topic_post_id', $topic_template->post->post_id );
|
2306 |
}
|
2307 |
|
@@ -2319,13 +1917,6 @@ function bp_the_topic_post_content() {
|
|
2319 |
function bp_get_the_topic_post_content() {
|
2320 |
global $topic_template;
|
2321 |
|
2322 |
-
/**
|
2323 |
-
* Filters the content of the current post in the loop.
|
2324 |
-
*
|
2325 |
-
* @since BuddyPress (1.0.0)
|
2326 |
-
*
|
2327 |
-
* @param string $post_text The content of the current post.
|
2328 |
-
*/
|
2329 |
return apply_filters( 'bp_get_the_topic_post_content', stripslashes( $topic_template->post->post_text ) );
|
2330 |
}
|
2331 |
|
@@ -2358,16 +1949,6 @@ function bp_the_topic_post_css_class() {
|
|
2358 |
if ( 0 == (int) $topic_template->post->post_status )
|
2359 |
$class .= ' open';
|
2360 |
|
2361 |
-
/**
|
2362 |
-
* Filters the CSS class for the current post in the loop.
|
2363 |
-
*
|
2364 |
-
* This class may contain keywords like 'alt', 'deleted', or 'open',
|
2365 |
-
* based on context.
|
2366 |
-
*
|
2367 |
-
* @since BuddyPress (1.2.4)
|
2368 |
-
*
|
2369 |
-
* @param string $value Concatenated classes for the current post in the loop.
|
2370 |
-
*/
|
2371 |
return apply_filters( 'bp_get_the_topic_post_css_class', trim( $class ) );
|
2372 |
}
|
2373 |
|
@@ -2412,13 +1993,6 @@ function bp_the_topic_post_poster_avatar( $args = '' ) {
|
|
2412 |
$r = wp_parse_args( $args, $defaults );
|
2413 |
extract( $r, EXTR_SKIP );
|
2414 |
|
2415 |
-
/**
|
2416 |
-
* Filters the avatar of the user who posted the current post in the loop.
|
2417 |
-
*
|
2418 |
-
* @since BuddyPress (1.0.0)
|
2419 |
-
*
|
2420 |
-
* @param string $value Avatar of the user who posted the current post.
|
2421 |
-
*/
|
2422 |
return apply_filters( 'bp_get_the_topic_post_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $topic_template->post->poster_id, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) );
|
2423 |
}
|
2424 |
|
@@ -2439,13 +2013,6 @@ function bp_the_topic_post_poster_name() {
|
|
2439 |
if ( empty( $topic_template->post->poster_name ) || ( !$link = bp_core_get_user_domain( $topic_template->post->poster_id ) ) )
|
2440 |
return __( 'Deleted User', 'buddypress' );
|
2441 |
|
2442 |
-
/**
|
2443 |
-
* Filters the name of the user who posted the current post in the loop.
|
2444 |
-
*
|
2445 |
-
* @since BuddyPress (1.0.0)
|
2446 |
-
*
|
2447 |
-
* @param string $value HTML link for the poster's name.
|
2448 |
-
*/
|
2449 |
return apply_filters( 'bp_get_the_topic_post_poster_name', '<a href="' . $link . '" title="' . $topic_template->post->poster_name . '">' . $topic_template->post->poster_name . '</a>' );
|
2450 |
}
|
2451 |
|
@@ -2464,13 +2031,6 @@ function bp_the_topic_post_poster_link() {
|
|
2464 |
function bp_get_the_topic_post_poster_link() {
|
2465 |
global $topic_template;
|
2466 |
|
2467 |
-
/**
|
2468 |
-
* Filters a link to the profile of the user who posted the current post.
|
2469 |
-
*
|
2470 |
-
* @since BuddyPress (1.2.1)
|
2471 |
-
*
|
2472 |
-
* @param string $value Link for the current poster's profile.
|
2473 |
-
*/
|
2474 |
return apply_filters( 'bp_the_topic_post_poster_link', bp_core_get_user_domain( $topic_template->post->poster_id ) );
|
2475 |
}
|
2476 |
|
@@ -2490,13 +2050,6 @@ function bp_the_topic_post_time_since() {
|
|
2490 |
function bp_get_the_topic_post_time_since() {
|
2491 |
global $topic_template;
|
2492 |
|
2493 |
-
/**
|
2494 |
-
* Filters the 'since' string describing when the current post in the loop was posted.
|
2495 |
-
*
|
2496 |
-
* @since BuddyPress (1.0.0)
|
2497 |
-
*
|
2498 |
-
* @param string $value The 'since' string.
|
2499 |
-
*/
|
2500 |
return apply_filters( 'bp_get_the_topic_post_time_since', bp_core_time_since( strtotime( $topic_template->post->post_time ) ) );
|
2501 |
}
|
2502 |
|
@@ -2559,13 +2112,6 @@ function bp_the_topic_post_admin_links( $args = '' ) {
|
|
2559 |
$links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'edit/post/' . $topic_template->post->post_id . '/' . $query_vars, 'bp_forums_edit_post' ) . '">' . __( 'Edit', 'buddypress' ) . '</a>';
|
2560 |
$links[] .= '<a class="confirm" id="post-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete/post/' . $topic_template->post->post_id, 'bp_forums_delete_post' ) . '">' . __( 'Delete', 'buddypress' ) . '</a>';
|
2561 |
|
2562 |
-
/**
|
2563 |
-
* Filters the admin links for the current post in the loop.
|
2564 |
-
*
|
2565 |
-
* @since BuddyPress (1.2.7)
|
2566 |
-
*
|
2567 |
-
* @param string $value HTML string containing the admin links for the current post.
|
2568 |
-
*/
|
2569 |
return apply_filters( 'bp_get_the_topic_post_admin_links', implode( $separator, $links ), $links, $r );
|
2570 |
}
|
2571 |
|
@@ -2582,14 +2128,6 @@ function bp_the_topic_post_edit_text() {
|
|
2582 |
*/
|
2583 |
function bp_get_the_topic_post_edit_text() {
|
2584 |
$post = bp_forums_get_post( bp_action_variable( 4 ) );
|
2585 |
-
|
2586 |
-
/**
|
2587 |
-
* Filters the text to edit when editing a post.
|
2588 |
-
*
|
2589 |
-
* @since BuddyPress (1.2.4)
|
2590 |
-
*
|
2591 |
-
* @param string $value The text to edit when editing a post.
|
2592 |
-
*/
|
2593 |
return apply_filters( 'bp_get_the_topic_post_edit_text', esc_attr( $post->post_text ) );
|
2594 |
}
|
2595 |
|
@@ -2607,14 +2145,6 @@ function bp_the_topic_pagination() {
|
|
2607 |
function bp_get_the_topic_pagination() {
|
2608 |
global $topic_template;
|
2609 |
|
2610 |
-
|
2611 |
-
/**
|
2612 |
-
* Filters the pagination links for the current topic page.
|
2613 |
-
*
|
2614 |
-
* @since BuddyPress (1.0.0)
|
2615 |
-
*
|
2616 |
-
* @param string $pag_links HTML pagination links.
|
2617 |
-
*/
|
2618 |
return apply_filters( 'bp_get_the_topic_pagination', $topic_template->pag_links );
|
2619 |
}
|
2620 |
|
@@ -2633,16 +2163,6 @@ function bp_the_topic_pagination_count() {
|
|
2633 |
$to_num = bp_core_number_format( ( $start_num + ( $topic_template->pag_num - 1 ) > $topic_template->total_post_count ) ? $topic_template->total_post_count : $start_num + ( $topic_template->pag_num - 1 ) );
|
2634 |
$total = bp_core_number_format( $topic_template->total_post_count );
|
2635 |
|
2636 |
-
/**
|
2637 |
-
* Filters the pagination count for the current topic page.
|
2638 |
-
*
|
2639 |
-
* @since BuddyPress (1.0.0)
|
2640 |
-
*
|
2641 |
-
* @param string $value Pagination count for the current topic page.
|
2642 |
-
* @param string $from_num Low end count in the view.
|
2643 |
-
* @param string $to_num High end count in the view.
|
2644 |
-
* @param string $total Total count of topics found.
|
2645 |
-
*/
|
2646 |
echo apply_filters( 'bp_the_topic_pagination_count', sprintf( _n( 'Viewing 1 post', 'Viewing %1$s - %2$s of %3$s posts', (int) $topic_template->total_post_count, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total );
|
2647 |
}
|
2648 |
|
@@ -2661,13 +2181,6 @@ function bp_the_topic_is_last_page() {
|
|
2661 |
function bp_get_the_topic_is_last_page() {
|
2662 |
global $topic_template;
|
2663 |
|
2664 |
-
/**
|
2665 |
-
* Filters whether or not a user is on the last page in the current topic.
|
2666 |
-
*
|
2667 |
-
* @since BuddyPress (1.2.0)
|
2668 |
-
*
|
2669 |
-
* @param bool $value Whether or not user is on last page.
|
2670 |
-
*/
|
2671 |
return apply_filters( 'bp_get_the_topic_is_last_page', $topic_template->pag_page == $topic_template->pag->total_pages );
|
2672 |
}
|
2673 |
|
@@ -2683,13 +2196,6 @@ function bp_directory_forums_search_form() {
|
|
2683 |
<input type="submit" id="forums_search_submit" name="forums_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />
|
2684 |
</form>';
|
2685 |
|
2686 |
-
/**
|
2687 |
-
* Filters the forums directory search form.
|
2688 |
-
*
|
2689 |
-
* @since BuddyPress (1.9.0)
|
2690 |
-
*
|
2691 |
-
* @param string HTML search form for the forums directory.
|
2692 |
-
*/
|
2693 |
echo apply_filters( 'bp_directory_forums_search_form', $search_form_html );
|
2694 |
}
|
2695 |
|
@@ -2728,13 +2234,6 @@ function bp_forum_permalink( $forum_id = 0 ) {
|
|
2728 |
return false;
|
2729 |
}
|
2730 |
|
2731 |
-
/**
|
2732 |
-
* Filters the permalink to a given forum.
|
2733 |
-
*
|
2734 |
-
* @since BuddyPress (1.0.0)
|
2735 |
-
*
|
2736 |
-
* @param string $value Peramlink to the given forum.
|
2737 |
-
*/
|
2738 |
return apply_filters( 'bp_get_forum_permalink', trailingslashit( $permalink ) );
|
2739 |
}
|
2740 |
|
@@ -2764,20 +2263,10 @@ function bp_forum_name( $forum_id = 0 ) {
|
|
2764 |
$forum_id = $topic_template->forum_id;
|
2765 |
}
|
2766 |
|
2767 |
-
if ( $forum = bp_forums_get_forum( $forum_id ) )
|
2768 |
-
|
2769 |
-
/**
|
2770 |
-
* Filters the name of a given forum.
|
2771 |
-
*
|
2772 |
-
* @since BuddyPress (1.5.0)
|
2773 |
-
*
|
2774 |
-
* @param string $forum_name Name of the given forum.
|
2775 |
-
* @param string $forum_id ID of the given forum.
|
2776 |
-
*/
|
2777 |
return apply_filters( 'bp_get_forum_name', $forum->forum_name, $forum->forum_id );
|
2778 |
-
|
2779 |
return false;
|
2780 |
-
}
|
2781 |
}
|
2782 |
|
2783 |
/**
|
@@ -2841,14 +2330,6 @@ function bp_forum_topic_tag_list() {
|
|
2841 |
if ( 'string' == $format )
|
2842 |
$tags = implode( ', ', $tags );
|
2843 |
|
2844 |
-
/**
|
2845 |
-
* Filters the current topic's tag list.
|
2846 |
-
*
|
2847 |
-
* @since BuddyPress (1.5.0)
|
2848 |
-
*
|
2849 |
-
* @param string|array $tags List or array of tags for the current topic.
|
2850 |
-
* @param string $format Requested format for the tags.
|
2851 |
-
*/
|
2852 |
return apply_filters( 'bp_forum_topic_tag_list', $tags, $format );
|
2853 |
}
|
2854 |
|
@@ -2867,13 +2348,6 @@ function bp_forum_topic_has_tags() {
|
|
2867 |
if ( !empty( $topic_template->topic_tags ) )
|
2868 |
$has_tags = true;
|
2869 |
|
2870 |
-
/**
|
2871 |
-
* Filters whether or not a forum topic has any tags.
|
2872 |
-
*
|
2873 |
-
* @since BuddyPress (1.5.0)
|
2874 |
-
*
|
2875 |
-
* @param bool $has_tags Whether or not there are any tags.
|
2876 |
-
*/
|
2877 |
return apply_filters( 'bp_forum_topic_has_tags', $has_tags );
|
2878 |
}
|
2879 |
|
@@ -2891,13 +2365,6 @@ function bp_forum_action() {
|
|
2891 |
function bp_get_forum_action() {
|
2892 |
global $topic_template;
|
2893 |
|
2894 |
-
/**
|
2895 |
-
* Filters the url to use in a forum form 'action'.
|
2896 |
-
*
|
2897 |
-
* @since BuddyPress (1.0.0)
|
2898 |
-
*
|
2899 |
-
* @param string $value URL to use in the forum form 'action'.
|
2900 |
-
*/
|
2901 |
return apply_filters( 'bp_get_forum_action', bp_get_root_domain() . esc_attr( $_SERVER['REQUEST_URI'] ) );
|
2902 |
}
|
2903 |
|
@@ -2913,14 +2380,6 @@ function bp_forum_topic_action() {
|
|
2913 |
* @return string URL of the current page, minus query args.
|
2914 |
*/
|
2915 |
function bp_get_forum_topic_action() {
|
2916 |
-
|
2917 |
-
/**
|
2918 |
-
* Filters the url to use in a forum topic form 'action'.
|
2919 |
-
*
|
2920 |
-
* @since BuddyPress (1.0.0)
|
2921 |
-
*
|
2922 |
-
* @param string $value URL to use in the forum topic form 'action'.
|
2923 |
-
*/
|
2924 |
return apply_filters( 'bp_get_forum_topic_action', $_SERVER['REQUEST_URI'] );
|
2925 |
}
|
2926 |
|
@@ -2938,18 +2397,8 @@ function bp_forum_topic_count_for_user( $user_id = 0 ) {
|
|
2938 |
* Return the total topic count for a given user.
|
2939 |
*
|
2940 |
* @param int $user_id See {@link bp_forums_total_topic_count_for_user}.
|
2941 |
-
*
|
2942 |
-
* @return int
|
2943 |
*/
|
2944 |
function bp_get_forum_topic_count_for_user( $user_id = 0 ) {
|
2945 |
-
|
2946 |
-
/**
|
2947 |
-
* Filters the total topic count for a given user.
|
2948 |
-
*
|
2949 |
-
* @since BuddyPress (1.2.0)
|
2950 |
-
*
|
2951 |
-
* @param int $value Total topic count for the given user.
|
2952 |
-
*/
|
2953 |
return apply_filters( 'bp_get_forum_topic_count_for_user', bp_forums_total_topic_count_for_user( $user_id ) );
|
2954 |
}
|
2955 |
|
@@ -2967,17 +2416,7 @@ function bp_forum_topic_count( $user_id = 0 ) {
|
|
2967 |
* Return the total topic count for a given user.
|
2968 |
*
|
2969 |
* @param int $user_id See {@link bp_forums_total_topic_count()}.
|
2970 |
-
*
|
2971 |
-
* @return int
|
2972 |
*/
|
2973 |
function bp_get_forum_topic_count( $user_id = 0 ) {
|
2974 |
-
|
2975 |
-
/**
|
2976 |
-
* Filters the total topic count for a given user.
|
2977 |
-
*
|
2978 |
-
* @since BuddyPress (1.2.0)
|
2979 |
-
*
|
2980 |
-
* @param int $value Total topic count for the given user.
|
2981 |
-
*/
|
2982 |
return apply_filters( 'bp_get_forum_topic_count', bp_forums_total_topic_count( $user_id ) );
|
2983 |
}
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/**
|
13 |
* Output the forums component slug.
|
28 |
*/
|
29 |
function bp_get_forums_slug() {
|
30 |
global $bp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
return apply_filters( 'bp_get_forums_slug', $bp->forums->slug );
|
32 |
}
|
33 |
|
50 |
*/
|
51 |
function bp_get_forums_root_slug() {
|
52 |
global $bp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
return apply_filters( 'bp_get_forums_root_slug', $bp->forums->root_slug );
|
54 |
}
|
55 |
|
69 |
* @since BuddyPress (1.5.0)
|
70 |
*
|
71 |
* @uses apply_filters()
|
72 |
+
* @uses traisingslashit()
|
73 |
* @uses bp_get_root_domain()
|
74 |
* @uses bp_get_forums_root_slug()
|
75 |
*
|
76 |
* @return string The permalink for the forums component directory.
|
77 |
*/
|
78 |
function bp_get_forums_directory_permalink() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
return apply_filters( 'bp_get_forums_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() ) );
|
80 |
}
|
81 |
|
137 |
* The page number being requested.
|
138 |
*
|
139 |
* @access public
|
140 |
+
* @var public
|
141 |
*/
|
142 |
var $pag_page;
|
143 |
|
145 |
* The number of items being requested per page.
|
146 |
*
|
147 |
* @access public
|
148 |
+
* @var public
|
149 |
*/
|
150 |
var $pag_num;
|
151 |
|
199 |
* @param int $user_id The ID of the user to whom topics should be
|
200 |
* limited. Pass false to remove this filter.
|
201 |
* @param int $page The number of the page being requested.
|
202 |
+
* @param int $per_page The number of items being requested perpage.
|
203 |
* @param string $no_stickies Requested sticky format.
|
204 |
* @param string $search_terms Filter results by a string.
|
205 |
* @param int $offset Optional. Offset results by a given numeric value.
|
234 |
break;
|
235 |
}
|
236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
$this->topics = apply_filters( 'bp_forums_template_topics', $this->topics, $type, $forum_id, $per_page, $max, $no_stickies );
|
238 |
|
239 |
if ( !(int) $this->topics ) {
|
281 |
}
|
282 |
}
|
283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
$this->topic_count = apply_filters_ref_array( 'bp_forums_template_topic_count', array( $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
$this->total_topic_count = apply_filters_ref_array( 'bp_forums_template_total_topic_count', array( $this->total_topic_count, $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies ) );
|
286 |
|
287 |
// Fetch extra information for topics, so we don't have to query inside the loop
|
295 |
'current' => $this->pag_page,
|
296 |
'prev_text' => _x( '←', 'Forum topic pagination previous text', 'buddypress' ),
|
297 |
'next_text' => _x( '→', 'Forum topic pagination next text', 'buddypress' ),
|
298 |
+
'mid_size' => 1
|
|
|
299 |
) );
|
300 |
}
|
301 |
}
|
351 |
if ( $this->current_topic + 1 < $this->topic_count ) {
|
352 |
return true;
|
353 |
} elseif ( $this->current_topic + 1 == $this->topic_count ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
do_action('forum_loop_end');
|
355 |
// Do some cleaning up after the loop
|
356 |
$this->rewind_topics();
|
372 |
$this->topic = $this->next_topic();
|
373 |
$this->topic = (object)$this->topic;
|
374 |
|
375 |
+
if ( $this->current_topic == 0 ) // loop has just started
|
376 |
+
do_action('forum_loop_start');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
}
|
378 |
}
|
379 |
|
567 |
'current' => $forum_template->pag_page,
|
568 |
'prev_text' => _x( '←', 'Forum topic pagination previous text', 'buddypress' ),
|
569 |
'next_text' => _x( '→', 'Forum topic pagination next text', 'buddypress' ),
|
570 |
+
'mid_size' => 1
|
|
|
571 |
) );
|
572 |
|
573 |
} else {
|
579 |
$forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, 'all', $search_terms );
|
580 |
}
|
581 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
582 |
return apply_filters( 'bp_has_topics', $forum_template->has_topics(), $forum_template );
|
583 |
}
|
584 |
|
620 |
function bp_get_the_topic_id() {
|
621 |
global $forum_template;
|
622 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
623 |
return apply_filters( 'bp_get_the_topic_id', $forum_template->topic->topic_id );
|
624 |
}
|
625 |
|
637 |
function bp_get_the_topic_title() {
|
638 |
global $forum_template;
|
639 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
640 |
return apply_filters( 'bp_get_the_topic_title', stripslashes( $forum_template->topic->topic_title ) );
|
641 |
}
|
642 |
|
654 |
function bp_get_the_topic_slug() {
|
655 |
global $forum_template;
|
656 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
657 |
return apply_filters( 'bp_get_the_topic_slug', $forum_template->topic->topic_slug );
|
658 |
}
|
659 |
|
672 |
global $forum_template;
|
673 |
|
674 |
$post = bb_get_first_post( (int) $forum_template->topic->topic_id, false );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
675 |
return apply_filters( 'bp_get_the_topic_text', esc_attr( $post->post_text ) );
|
676 |
}
|
677 |
|
689 |
function bp_get_the_topic_poster_id() {
|
690 |
global $forum_template;
|
691 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
692 |
return apply_filters( 'bp_get_the_topic_poster_id', $forum_template->topic->topic_poster );
|
693 |
}
|
694 |
|
733 |
$r = wp_parse_args( $args, $defaults );
|
734 |
extract( $r, EXTR_SKIP );
|
735 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
736 |
return apply_filters( 'bp_get_the_topic_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->topic_poster, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) );
|
737 |
}
|
738 |
|
755 |
if ( !$name = bp_core_get_userlink( $poster_id ) )
|
756 |
return __( 'Deleted User', 'buddypress' );
|
757 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
758 |
return apply_filters( 'bp_get_the_topic_poster_name', $name );
|
759 |
}
|
760 |
|
774 |
function bp_get_the_topic_object_id() {
|
775 |
global $forum_template;
|
776 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
777 |
return apply_filters( 'bp_get_the_topic_object_id', $forum_template->topic->object_id );
|
778 |
}
|
779 |
|
799 |
else
|
800 |
$retval = '';
|
801 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
802 |
return apply_filters( 'bp_get_the_topic_object_name', $retval );
|
803 |
}
|
804 |
|
819 |
function bp_get_the_topic_object_slug() {
|
820 |
global $forum_template;
|
821 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
822 |
return apply_filters( 'bp_get_the_topic_object_slug', $forum_template->topic->object_slug );
|
823 |
}
|
824 |
|
844 |
else
|
845 |
$permalink = '';
|
846 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
847 |
return apply_filters( 'bp_get_the_topic_object_permalink', $permalink );
|
848 |
}
|
849 |
|
869 |
if ( !$domain || $domain == bp_core_get_root_domain() . '/' . bp_get_members_root_slug() . '/' )
|
870 |
return __( 'Deleted User', 'buddypress' );
|
871 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
872 |
return apply_filters( 'bp_get_the_topic_last_poster_name', '<a href="' . $domain . '">' . $forum_template->topic->topic_last_poster_displayname . '</a>' );
|
873 |
}
|
874 |
|
919 |
$r = wp_parse_args( $args, $defaults );
|
920 |
extract( $r, EXTR_SKIP );
|
921 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
922 |
return apply_filters( 'bp_get_the_topic_object_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->object_id, 'type' => $type, 'object' => 'group', 'width' => $width, 'height' => $height, 'alt' => $alt ) ) );
|
923 |
}
|
924 |
|
963 |
$r = wp_parse_args( $args, $defaults );
|
964 |
extract( $r, EXTR_SKIP );
|
965 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
966 |
return apply_filters( 'bp_get_the_topic_last_poster_avatar', bp_core_fetch_avatar( array( 'email' => $forum_template->topic->topic_last_poster_email, 'item_id' => $forum_template->topic->topic_last_poster, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) );
|
967 |
}
|
968 |
|
980 |
function bp_get_the_topic_start_time() {
|
981 |
global $forum_template;
|
982 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
983 |
return apply_filters( 'bp_get_the_topic_start_time', $forum_template->topic->topic_start_time );
|
984 |
}
|
985 |
|
997 |
function bp_get_the_topic_time() {
|
998 |
global $forum_template;
|
999 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1000 |
return apply_filters( 'bp_get_the_topic_time', $forum_template->topic->topic_time );
|
1001 |
}
|
1002 |
|
1014 |
function bp_get_the_topic_forum_id() {
|
1015 |
global $forum_template;
|
1016 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1017 |
return apply_filters( 'bp_get_the_topic_forum_id', $forum_template->topic->forum_id );
|
1018 |
}
|
1019 |
|
1031 |
function bp_get_the_topic_status() {
|
1032 |
global $forum_template;
|
1033 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1034 |
return apply_filters( 'bp_get_the_topic_status', $forum_template->topic->topic_status );
|
1035 |
}
|
1036 |
|
1048 |
function bp_get_the_topic_is_topic_open() {
|
1049 |
global $forum_template;
|
1050 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1051 |
return apply_filters( 'bp_get_the_topic_is_topic_open', $forum_template->topic->topic_open );
|
1052 |
}
|
1053 |
|
1065 |
function bp_get_the_topic_last_post_id() {
|
1066 |
global $forum_template;
|
1067 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1068 |
return apply_filters( 'bp_get_the_topic_last_post_id', $forum_template->topic->topic_last_post_id );
|
1069 |
}
|
1070 |
|
1082 |
function bp_get_the_topic_is_sticky() {
|
1083 |
global $forum_template;
|
1084 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1085 |
return apply_filters( 'bp_get_the_topic_is_sticky', $forum_template->topic->topic_sticky );
|
1086 |
}
|
1087 |
|
1099 |
function bp_get_the_topic_total_post_count() {
|
1100 |
global $forum_template;
|
1101 |
|
1102 |
+
if ( $forum_template->topic->topic_posts == 1 )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1103 |
return apply_filters( 'bp_get_the_topic_total_post_count', sprintf( __( '%d post', 'buddypress' ), $forum_template->topic->topic_posts ) );
|
1104 |
+
else
|
|
|
|
|
1105 |
return apply_filters( 'bp_get_the_topic_total_post_count', sprintf( __( '%d posts', 'buddypress' ), $forum_template->topic->topic_posts ) );
|
|
|
1106 |
}
|
1107 |
|
1108 |
/**
|
1119 |
function bp_get_the_topic_total_posts() {
|
1120 |
global $forum_template;
|
1121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1122 |
return apply_filters( 'bp_get_the_topic_total_posts', $forum_template->topic->topic_posts );
|
1123 |
}
|
1124 |
|
1136 |
function bp_get_the_topic_tag_count() {
|
1137 |
global $forum_template;
|
1138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1139 |
return apply_filters( 'bp_get_the_topic_tag_count', $forum_template->topic->tag_count );
|
1140 |
}
|
1141 |
|
1170 |
$permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() );
|
1171 |
}
|
1172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1173 |
return apply_filters( 'bp_get_the_topic_permalink', trailingslashit( $permalink . 'topic/' . $forum_template->topic->topic_slug ) );
|
1174 |
}
|
1175 |
|
1189 |
function bp_get_the_topic_time_since_created() {
|
1190 |
global $forum_template;
|
1191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1192 |
return apply_filters( 'bp_get_the_topic_time_since_created', bp_core_time_since( strtotime( $forum_template->topic->topic_start_time ) ) );
|
1193 |
}
|
1194 |
|
1219 |
$post = bp_forums_get_post( $forum_template->topic->topic_last_post_id );
|
1220 |
$post = bp_create_excerpt( $post->post_text, $length );
|
1221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1222 |
return apply_filters( 'bp_get_the_topic_latest_post_excerpt', $post, $length );
|
1223 |
}
|
1224 |
|
1238 |
function bp_get_the_topic_time_since_last_post() {
|
1239 |
global $forum_template;
|
1240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1241 |
return apply_filters( 'bp_get_the_topic_time_since_last_post', bp_core_time_since( strtotime( $forum_template->topic->topic_time ) ) );
|
1242 |
}
|
1243 |
|
1273 |
* Return the admin links for the current topic in the loop.
|
1274 |
*
|
1275 |
* @param array $args {
|
1276 |
+
* @type string $seperator The character to use when separating
|
1277 |
* links. Default: '|'.
|
1278 |
* }
|
1279 |
* @return HTML string containing the admin links for the current topic.
|
1282 |
global $forum_template;
|
1283 |
|
1284 |
$defaults = array(
|
1285 |
+
'seperator' => '|'
|
1286 |
);
|
1287 |
|
1288 |
$r = wp_parse_args( $args, $defaults );
|
1304 |
$links[] = '<a class="confirm" id="topic-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete', 'bp_forums_delete_topic' ) . '">' . __( 'Delete Topic', 'buddypress' ) . '</a>';
|
1305 |
}
|
1306 |
|
1307 |
+
return implode( ' ' . $seperator . ' ', (array) $links );
|
1308 |
}
|
1309 |
|
1310 |
/**
|
1335 |
if ( !isset( $forum_template->topic->topic_open ) || 0 == (int) $forum_template->topic->topic_open )
|
1336 |
$class .= ' closed';
|
1337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1338 |
return apply_filters( 'bp_get_the_topic_css_class', trim( $class ) );
|
1339 |
}
|
1340 |
|
1352 |
function bp_get_my_forum_topics_link() {
|
1353 |
global $bp;
|
1354 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1355 |
return apply_filters( 'bp_get_my_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/personal/' );
|
1356 |
}
|
1357 |
|
1369 |
function bp_get_unreplied_forum_topics_link() {
|
1370 |
global $bp;
|
1371 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1372 |
return apply_filters( 'bp_get_unreplied_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/unreplied/' );
|
1373 |
}
|
1374 |
|
1386 |
function bp_get_popular_forum_topics_link() {
|
1387 |
global $bp;
|
1388 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1389 |
return apply_filters( 'bp_get_popular_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/popular/' );
|
1390 |
}
|
1391 |
|
1403 |
function bp_get_newest_forum_topics_link() {
|
1404 |
global $bp;
|
1405 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1406 |
return apply_filters( 'bp_get_newest_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' );
|
1407 |
}
|
1408 |
|
1425 |
if ( !bp_is_directory() || !bp_current_action() )
|
1426 |
return 'newest';
|
1427 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1428 |
return apply_filters( 'bp_get_forum_topic_type', bp_current_action() );
|
1429 |
}
|
1430 |
|
1434 |
* @since BuddyPress (1.5.0)
|
1435 |
*/
|
1436 |
function bp_forum_topic_new_reply_link() {
|
1437 |
+
echo bp_get_forum_topic_new_reply_link();
|
1438 |
}
|
1439 |
/**
|
1440 |
* Return the permalink for the New Reply button at the top of forum topics.
|
1459 |
), bp_get_the_topic_permalink() );
|
1460 |
}
|
1461 |
|
1462 |
+
// Tack on the #post-topic-reply anchor before returning
|
|
|
|
|
|
|
|
|
|
|
|
|
1463 |
return apply_filters( 'bp_get_forum_topic_new_reply_link', $link . '#post-topic-reply', $link );
|
1464 |
}
|
1465 |
|
1496 |
function bp_get_forum_pagination() {
|
1497 |
global $forum_template;
|
1498 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1499 |
return apply_filters( 'bp_get_forum_pagination', $forum_template->pag_links );
|
1500 |
}
|
1501 |
|
1524 |
if ( 'tags' == $forum_template->type && !empty( $forum_template->search_terms ) )
|
1525 |
$pag_filter = sprintf( __( ' matching tag "%s"', 'buddypress' ), $forum_template->search_terms );
|
1526 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1527 |
return apply_filters( 'bp_get_forum_pagination_count', sprintf( _n( 'Viewing 1 topic', 'Viewing %1$s - %2$s of %3$s topics', (int) $forum_template->total_topic_count, 'buddypress' ), $from_num, $to_num, $total, $pag_filter ), $from_num, $to_num, $total );
|
1528 |
}
|
1529 |
|
1735 |
'current' => $this->pag_page,
|
1736 |
'prev_text' => _x( '←', 'Forum thread pagination previous text', 'buddypress' ),
|
1737 |
'next_text' => _x( '→', 'Forum thread pagination next text', 'buddypress' ),
|
1738 |
+
'mid_size' => 1
|
|
|
1739 |
) );
|
1740 |
|
1741 |
$this->pag->total_pages = ceil( (int) $this->total_post_count / (int) $this->pag_num );
|
1795 |
if ( $this->current_post + 1 < $this->post_count ) {
|
1796 |
return true;
|
1797 |
} elseif ( $this->current_post + 1 == $this->post_count ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
1798 |
do_action('topic_loop_end');
|
1799 |
// Do some cleaning up after the loop
|
1800 |
$this->rewind_posts();
|
1816 |
$this->post = $this->next_post();
|
1817 |
$this->post = (object)$this->post;
|
1818 |
|
1819 |
+
if ( $this->current_post == 0 ) // loop has just started
|
1820 |
+
do_action('topic_loop_start');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1821 |
}
|
1822 |
}
|
1823 |
|
1863 |
return false;
|
1864 |
}
|
1865 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1866 |
return apply_filters( 'bp_has_topic_posts', $topic_template->has_posts(), $topic_template );
|
1867 |
}
|
1868 |
|
1900 |
function bp_get_the_topic_post_id() {
|
1901 |
global $topic_template;
|
1902 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1903 |
return apply_filters( 'bp_get_the_topic_post_id', $topic_template->post->post_id );
|
1904 |
}
|
1905 |
|
1917 |
function bp_get_the_topic_post_content() {
|
1918 |
global $topic_template;
|
1919 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1920 |
return apply_filters( 'bp_get_the_topic_post_content', stripslashes( $topic_template->post->post_text ) );
|
1921 |
}
|
1922 |
|
1949 |
if ( 0 == (int) $topic_template->post->post_status )
|
1950 |
$class .= ' open';
|
1951 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1952 |
return apply_filters( 'bp_get_the_topic_post_css_class', trim( $class ) );
|
1953 |
}
|
1954 |
|
1993 |
$r = wp_parse_args( $args, $defaults );
|
1994 |
extract( $r, EXTR_SKIP );
|
1995 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1996 |
return apply_filters( 'bp_get_the_topic_post_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $topic_template->post->poster_id, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) );
|
1997 |
}
|
1998 |
|
2013 |
if ( empty( $topic_template->post->poster_name ) || ( !$link = bp_core_get_user_domain( $topic_template->post->poster_id ) ) )
|
2014 |
return __( 'Deleted User', 'buddypress' );
|
2015 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016 |
return apply_filters( 'bp_get_the_topic_post_poster_name', '<a href="' . $link . '" title="' . $topic_template->post->poster_name . '">' . $topic_template->post->poster_name . '</a>' );
|
2017 |
}
|
2018 |
|
2031 |
function bp_get_the_topic_post_poster_link() {
|
2032 |
global $topic_template;
|
2033 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2034 |
return apply_filters( 'bp_the_topic_post_poster_link', bp_core_get_user_domain( $topic_template->post->poster_id ) );
|
2035 |
}
|
2036 |
|
2050 |
function bp_get_the_topic_post_time_since() {
|
2051 |
global $topic_template;
|
2052 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2053 |
return apply_filters( 'bp_get_the_topic_post_time_since', bp_core_time_since( strtotime( $topic_template->post->post_time ) ) );
|
2054 |
}
|
2055 |
|
2112 |
$links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'edit/post/' . $topic_template->post->post_id . '/' . $query_vars, 'bp_forums_edit_post' ) . '">' . __( 'Edit', 'buddypress' ) . '</a>';
|
2113 |
$links[] .= '<a class="confirm" id="post-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete/post/' . $topic_template->post->post_id, 'bp_forums_delete_post' ) . '">' . __( 'Delete', 'buddypress' ) . '</a>';
|
2114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2115 |
return apply_filters( 'bp_get_the_topic_post_admin_links', implode( $separator, $links ), $links, $r );
|
2116 |
}
|
2117 |
|
2128 |
*/
|
2129 |
function bp_get_the_topic_post_edit_text() {
|
2130 |
$post = bp_forums_get_post( bp_action_variable( 4 ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2131 |
return apply_filters( 'bp_get_the_topic_post_edit_text', esc_attr( $post->post_text ) );
|
2132 |
}
|
2133 |
|
2145 |
function bp_get_the_topic_pagination() {
|
2146 |
global $topic_template;
|
2147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2148 |
return apply_filters( 'bp_get_the_topic_pagination', $topic_template->pag_links );
|
2149 |
}
|
2150 |
|
2163 |
$to_num = bp_core_number_format( ( $start_num + ( $topic_template->pag_num - 1 ) > $topic_template->total_post_count ) ? $topic_template->total_post_count : $start_num + ( $topic_template->pag_num - 1 ) );
|
2164 |
$total = bp_core_number_format( $topic_template->total_post_count );
|
2165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2166 |
echo apply_filters( 'bp_the_topic_pagination_count', sprintf( _n( 'Viewing 1 post', 'Viewing %1$s - %2$s of %3$s posts', (int) $topic_template->total_post_count, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total );
|
2167 |
}
|
2168 |
|
2181 |
function bp_get_the_topic_is_last_page() {
|
2182 |
global $topic_template;
|
2183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2184 |
return apply_filters( 'bp_get_the_topic_is_last_page', $topic_template->pag_page == $topic_template->pag->total_pages );
|
2185 |
}
|
2186 |
|
2196 |
<input type="submit" id="forums_search_submit" name="forums_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />
|
2197 |
</form>';
|
2198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2199 |
echo apply_filters( 'bp_directory_forums_search_form', $search_form_html );
|
2200 |
}
|
2201 |
|
2234 |
return false;
|
2235 |
}
|
2236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2237 |
return apply_filters( 'bp_get_forum_permalink', trailingslashit( $permalink ) );
|
2238 |
}
|
2239 |
|
2263 |
$forum_id = $topic_template->forum_id;
|
2264 |
}
|
2265 |
|
2266 |
+
if ( $forum = bp_forums_get_forum( $forum_id ) )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2267 |
return apply_filters( 'bp_get_forum_name', $forum->forum_name, $forum->forum_id );
|
2268 |
+
else
|
2269 |
return false;
|
|
|
2270 |
}
|
2271 |
|
2272 |
/**
|
2330 |
if ( 'string' == $format )
|
2331 |
$tags = implode( ', ', $tags );
|
2332 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2333 |
return apply_filters( 'bp_forum_topic_tag_list', $tags, $format );
|
2334 |
}
|
2335 |
|
2348 |
if ( !empty( $topic_template->topic_tags ) )
|
2349 |
$has_tags = true;
|
2350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2351 |
return apply_filters( 'bp_forum_topic_has_tags', $has_tags );
|
2352 |
}
|
2353 |
|
2365 |
function bp_get_forum_action() {
|
2366 |
global $topic_template;
|
2367 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2368 |
return apply_filters( 'bp_get_forum_action', bp_get_root_domain() . esc_attr( $_SERVER['REQUEST_URI'] ) );
|
2369 |
}
|
2370 |
|
2380 |
* @return string URL of the current page, minus query args.
|
2381 |
*/
|
2382 |
function bp_get_forum_topic_action() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2383 |
return apply_filters( 'bp_get_forum_topic_action', $_SERVER['REQUEST_URI'] );
|
2384 |
}
|
2385 |
|
2397 |
* Return the total topic count for a given user.
|
2398 |
*
|
2399 |
* @param int $user_id See {@link bp_forums_total_topic_count_for_user}.
|
|
|
|
|
2400 |
*/
|
2401 |
function bp_get_forum_topic_count_for_user( $user_id = 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2402 |
return apply_filters( 'bp_get_forum_topic_count_for_user', bp_forums_total_topic_count_for_user( $user_id ) );
|
2403 |
}
|
2404 |
|
2416 |
* Return the total topic count for a given user.
|
2417 |
*
|
2418 |
* @param int $user_id See {@link bp_forums_total_topic_count()}.
|
|
|
|
|
2419 |
*/
|
2420 |
function bp_get_forum_topic_count( $user_id = 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2421 |
return apply_filters( 'bp_get_forum_topic_count', bp_forums_total_topic_count( $user_id ) );
|
2422 |
}
|
bp-forums/deprecated/1.6.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
-
defined( 'ABSPATH' )
|
16 |
|
17 |
/**
|
18 |
* Outputs the markup for the bb-forums-admin panel
|
@@ -140,7 +140,7 @@ function bp_forums_bbpress_install_wizard() {
|
|
140 |
case 'existing':
|
141 |
if ( isset( $_REQUEST['doinstall'] ) && ( 1 == (int) $_REQUEST['doinstall'] ) ) {
|
142 |
if ( !bp_forums_configure_existing_install() ) {
|
143 |
-
_e( 'The bb-config.php file was not found at that location
|
144 |
} else {
|
145 |
?>
|
146 |
<h3><?php _e( 'Forums were set up correctly using your existing bbPress install!', 'buddypress' ) ?></h3>
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
16 |
|
17 |
/**
|
18 |
* Outputs the markup for the bb-forums-admin panel
|
140 |
case 'existing':
|
141 |
if ( isset( $_REQUEST['doinstall'] ) && ( 1 == (int) $_REQUEST['doinstall'] ) ) {
|
142 |
if ( !bp_forums_configure_existing_install() ) {
|
143 |
+
_e( 'The bb-config.php file was not found at that location, please try again.', 'buddypress' );
|
144 |
} else {
|
145 |
?>
|
146 |
<h3><?php _e( 'Forums were set up correctly using your existing bbPress install!', 'buddypress' ) ?></h3>
|
bp-forums/deprecated/1.7.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
-
defined( 'ABSPATH' )
|
16 |
|
17 |
function bp_forums_add_admin_menu() {
|
18 |
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
16 |
|
17 |
function bp_forums_add_admin_menu() {
|
18 |
|
bp-friends/bp-friends-actions.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
-
defined( 'ABSPATH' )
|
16 |
|
17 |
/**
|
18 |
* Catch and process friendship requests.
|
@@ -40,7 +40,7 @@ function friends_action_add_friend() {
|
|
40 |
bp_core_add_message( __( 'Friendship requested', 'buddypress' ) );
|
41 |
}
|
42 |
|
43 |
-
}
|
44 |
bp_core_add_message( __( 'You are already friends with this user', 'buddypress' ), 'error' );
|
45 |
} else {
|
46 |
bp_core_add_message( __( 'You already have a pending friendship request with this user', 'buddypress' ), 'error' );
|
@@ -78,7 +78,7 @@ function friends_action_remove_friend() {
|
|
78 |
bp_core_add_message( __( 'Friendship canceled', 'buddypress' ) );
|
79 |
}
|
80 |
|
81 |
-
}
|
82 |
bp_core_add_message( __( 'You are not yet friends with this user', 'buddypress' ), 'error' );
|
83 |
} else {
|
84 |
bp_core_add_message( __( 'You have a pending friendship request with this user', 'buddypress' ), 'error' );
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
16 |
|
17 |
/**
|
18 |
* Catch and process friendship requests.
|
40 |
bp_core_add_message( __( 'Friendship requested', 'buddypress' ) );
|
41 |
}
|
42 |
|
43 |
+
} else if ( 'is_friend' == $friendship_status ) {
|
44 |
bp_core_add_message( __( 'You are already friends with this user', 'buddypress' ), 'error' );
|
45 |
} else {
|
46 |
bp_core_add_message( __( 'You already have a pending friendship request with this user', 'buddypress' ), 'error' );
|
78 |
bp_core_add_message( __( 'Friendship canceled', 'buddypress' ) );
|
79 |
}
|
80 |
|
81 |
+
} else if ( 'is_friends' == $friendship_status ) {
|
82 |
bp_core_add_message( __( 'You are not yet friends with this user', 'buddypress' ), 'error' );
|
83 |
} else {
|
84 |
bp_core_add_message( __( 'You have a pending friendship request with this user', 'buddypress' ), 'error' );
|
bp-friends/bp-friends-activity.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
-
defined( 'ABSPATH' )
|
15 |
|
16 |
/**
|
17 |
* Record an activity item related to the Friends component.
|
@@ -113,11 +113,6 @@ function friends_register_activity_actions() {
|
|
113 |
// < BP 1.6 backpat
|
114 |
bp_activity_set_action( $bp->friends->id, 'friends_register_activity_action', __( 'New friendship created', 'buddypress' ) );
|
115 |
|
116 |
-
/**
|
117 |
-
* Fires after all default bp-friends activity actions have been registered.
|
118 |
-
*
|
119 |
-
* @since BuddyPress (1.1.0)
|
120 |
-
*/
|
121 |
do_action( 'friends_register_activity_actions' );
|
122 |
}
|
123 |
add_action( 'bp_register_activity_actions', 'friends_register_activity_actions' );
|
@@ -144,14 +139,6 @@ function bp_friends_format_activity_action_friendship_accepted( $action, $activi
|
|
144 |
$action = apply_filters( 'friends_activity_friendsip_accepted_action', $action, $friendship );
|
145 |
}
|
146 |
|
147 |
-
/**
|
148 |
-
* Filters the 'friendship_accepted' activity action format.
|
149 |
-
*
|
150 |
-
* @since BuddyPress (2.0.0)
|
151 |
-
*
|
152 |
-
* @param string $action String text for the 'friendship_accepted' action.
|
153 |
-
* @param object $activity Activity data.
|
154 |
-
*/
|
155 |
return apply_filters( 'bp_friends_format_activity_action_friendship_accepted', $action, $activity );
|
156 |
}
|
157 |
|
@@ -178,14 +165,6 @@ function bp_friends_format_activity_action_friendship_created( $action, $activit
|
|
178 |
$action = apply_filters( 'friends_activity_friendsip_accepted_action', $action, $friendship );
|
179 |
}
|
180 |
|
181 |
-
/**
|
182 |
-
* Filters the 'friendship_created' activity action format.
|
183 |
-
*
|
184 |
-
* @since BuddyPress (2.0.0)
|
185 |
-
*
|
186 |
-
* @param string $action String text for the 'friendship_created' action.
|
187 |
-
* @param object $activity Activity data.
|
188 |
-
*/
|
189 |
return apply_filters( 'bp_friends_format_activity_action_friendship_created', $action, $activity );
|
190 |
}
|
191 |
|
@@ -227,136 +206,6 @@ function bp_friends_prefetch_activity_object_data( $activities ) {
|
|
227 |
}
|
228 |
add_filter( 'bp_activity_prefetch_object_data', 'bp_friends_prefetch_activity_object_data' );
|
229 |
|
230 |
-
/**
|
231 |
-
* Set up activity arguments for use with the 'friends' scope.
|
232 |
-
*
|
233 |
-
* For details on the syntax, see {@link BP_Activity_Query}.
|
234 |
-
*
|
235 |
-
* @since BuddyPress (2.2.0)
|
236 |
-
*
|
237 |
-
* @param array $retval Empty array by default
|
238 |
-
* @param array $filter Current activity arguments
|
239 |
-
* @return array
|
240 |
-
*/
|
241 |
-
function bp_friends_filter_activity_scope( $retval = array(), $filter = array() ) {
|
242 |
-
|
243 |
-
// Determine the user_id
|
244 |
-
if ( ! empty( $filter['user_id'] ) ) {
|
245 |
-
$user_id = $filter['user_id'];
|
246 |
-
} else {
|
247 |
-
$user_id = bp_displayed_user_id()
|
248 |
-
? bp_displayed_user_id()
|
249 |
-
: bp_loggedin_user_id();
|
250 |
-
}
|
251 |
-
|
252 |
-
// Determine friends of user
|
253 |
-
$friends = friends_get_friend_user_ids( $user_id );
|
254 |
-
if ( empty( $friends ) ) {
|
255 |
-
$friends = array( 0 );
|
256 |
-
}
|
257 |
-
|
258 |
-
$retval = array(
|
259 |
-
'relation' => 'AND',
|
260 |
-
array(
|
261 |
-
'column' => 'user_id',
|
262 |
-
'compare' => 'IN',
|
263 |
-
'value' => (array) $friends
|
264 |
-
),
|
265 |
-
|
266 |
-
// we should only be able to view sitewide activity content for friends
|
267 |
-
array(
|
268 |
-
'column' => 'hide_sitewide',
|
269 |
-
'value' => 0
|
270 |
-
),
|
271 |
-
|
272 |
-
// overrides
|
273 |
-
'override' => array(
|
274 |
-
'filter' => array( 'user_id' => 0 ),
|
275 |
-
'show_hidden' => true
|
276 |
-
),
|
277 |
-
);
|
278 |
-
|
279 |
-
return $retval;
|
280 |
-
}
|
281 |
-
add_filter( 'bp_activity_set_friends_scope_args', 'bp_friends_filter_activity_scope', 10, 2 );
|
282 |
-
|
283 |
-
/**
|
284 |
-
* Set up activity arguments for use with the 'just-me' scope.
|
285 |
-
*
|
286 |
-
* For details on the syntax, see {@link BP_Activity_Query}.
|
287 |
-
*
|
288 |
-
* @since BuddyPress (2.2.0)
|
289 |
-
*
|
290 |
-
* @param array $retval Empty array by default
|
291 |
-
* @param array $filter Current activity arguments
|
292 |
-
* @return array
|
293 |
-
*/
|
294 |
-
function bp_friends_filter_activity_just_me_scope( $retval = array(), $filter = array() ) {
|
295 |
-
|
296 |
-
// Determine the user_id
|
297 |
-
if ( ! empty( $filter['user_id'] ) ) {
|
298 |
-
$user_id = $filter['user_id'];
|
299 |
-
} else {
|
300 |
-
$user_id = bp_displayed_user_id()
|
301 |
-
? bp_displayed_user_id()
|
302 |
-
: bp_loggedin_user_id();
|
303 |
-
}
|
304 |
-
|
305 |
-
// Get the requested action
|
306 |
-
$action = $filter['filter']['action'];
|
307 |
-
|
308 |
-
// Make sure actions are listed in an array
|
309 |
-
if ( ! is_array( $action ) ) {
|
310 |
-
$action = explode( ',', $filter['filter']['action'] );
|
311 |
-
}
|
312 |
-
|
313 |
-
$action = array_flip( array_filter( $action ) );
|
314 |
-
|
315 |
-
/**
|
316 |
-
* If filtering activities for something other than the friendship_created
|
317 |
-
* action return without changing anything
|
318 |
-
*/
|
319 |
-
if ( ! empty( $action ) && ! isset( $action['friendship_created'] ) ) {
|
320 |
-
return $retval;
|
321 |
-
}
|
322 |
-
|
323 |
-
// Juggle existing override value
|
324 |
-
$override = array();
|
325 |
-
if ( ! empty( $retval['override'] ) ) {
|
326 |
-
$override = $retval['override'];
|
327 |
-
unset( $retval['override'] );
|
328 |
-
}
|
329 |
-
|
330 |
-
/**
|
331 |
-
* Else make sure to get the friendship_created action, the user is involved in
|
332 |
-
* - user initiated the friendship
|
333 |
-
* - user has been requested a friendship
|
334 |
-
*/
|
335 |
-
$retval = array(
|
336 |
-
'relation' => 'OR',
|
337 |
-
$retval,
|
338 |
-
array(
|
339 |
-
'relation' => 'AND',
|
340 |
-
array(
|
341 |
-
'column' => 'component',
|
342 |
-
'value' => 'friends',
|
343 |
-
),
|
344 |
-
array(
|
345 |
-
'column' => 'secondary_item_id',
|
346 |
-
'value' => $user_id,
|
347 |
-
),
|
348 |
-
)
|
349 |
-
);
|
350 |
-
|
351 |
-
// Juggle back override value
|
352 |
-
if ( ! empty( $override ) ) {
|
353 |
-
$retval['override'] = $override;
|
354 |
-
}
|
355 |
-
|
356 |
-
return $retval;
|
357 |
-
}
|
358 |
-
add_filter( 'bp_activity_set_just-me_scope_args', 'bp_friends_filter_activity_just_me_scope', 20, 2 );
|
359 |
-
|
360 |
/**
|
361 |
* Add activity stream items when one members accepts another members request
|
362 |
* for virtual friendship.
|
@@ -369,10 +218,16 @@ add_filter( 'bp_activity_set_just-me_scope_args', 'bp_friends_filter_activity_ju
|
|
369 |
* @param object $friendship Optional
|
370 |
*/
|
371 |
function bp_friends_friendship_accepted_activity( $friendship_id, $initiator_user_id, $friend_user_id, $friendship = false ) {
|
|
|
|
|
372 |
if ( ! bp_is_active( 'activity' ) ) {
|
373 |
return;
|
374 |
}
|
375 |
|
|
|
|
|
|
|
|
|
376 |
// Record in activity streams for the initiator
|
377 |
friends_record_activity( array(
|
378 |
'user_id' => $initiator_user_id,
|
@@ -380,5 +235,14 @@ function bp_friends_friendship_accepted_activity( $friendship_id, $initiator_use
|
|
380 |
'item_id' => $friendship_id,
|
381 |
'secondary_item_id' => $friend_user_id
|
382 |
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
}
|
384 |
add_action( 'friends_friendship_accepted', 'bp_friends_friendship_accepted_activity', 10, 4 );
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
/**
|
17 |
* Record an activity item related to the Friends component.
|
113 |
// < BP 1.6 backpat
|
114 |
bp_activity_set_action( $bp->friends->id, 'friends_register_activity_action', __( 'New friendship created', 'buddypress' ) );
|
115 |
|
|
|
|
|
|
|
|
|
|
|
116 |
do_action( 'friends_register_activity_actions' );
|
117 |
}
|
118 |
add_action( 'bp_register_activity_actions', 'friends_register_activity_actions' );
|
139 |
$action = apply_filters( 'friends_activity_friendsip_accepted_action', $action, $friendship );
|
140 |
}
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
return apply_filters( 'bp_friends_format_activity_action_friendship_accepted', $action, $activity );
|
143 |
}
|
144 |
|
165 |
$action = apply_filters( 'friends_activity_friendsip_accepted_action', $action, $friendship );
|
166 |
}
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
return apply_filters( 'bp_friends_format_activity_action_friendship_created', $action, $activity );
|
169 |
}
|
170 |
|
206 |
}
|
207 |
add_filter( 'bp_activity_prefetch_object_data', 'bp_friends_prefetch_activity_object_data' );
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
/**
|
210 |
* Add activity stream items when one members accepts another members request
|
211 |
* for virtual friendship.
|
218 |
* @param object $friendship Optional
|
219 |
*/
|
220 |
function bp_friends_friendship_accepted_activity( $friendship_id, $initiator_user_id, $friend_user_id, $friendship = false ) {
|
221 |
+
|
222 |
+
// Bail if Activity component is not active
|
223 |
if ( ! bp_is_active( 'activity' ) ) {
|
224 |
return;
|
225 |
}
|
226 |
|
227 |
+
// Get links to both members profiles
|
228 |
+
$initiator_link = bp_core_get_userlink( $initiator_user_id );
|
229 |
+
$friend_link = bp_core_get_userlink( $friend_user_id );
|
230 |
+
|
231 |
// Record in activity streams for the initiator
|
232 |
friends_record_activity( array(
|
233 |
'user_id' => $initiator_user_id,
|
235 |
'item_id' => $friendship_id,
|
236 |
'secondary_item_id' => $friend_user_id
|
237 |
) );
|
238 |
+
|
239 |
+
// Record in activity streams for the friend
|
240 |
+
friends_record_activity( array(
|
241 |
+
'user_id' => $friend_user_id,
|
242 |
+
'type' => 'friendship_created',
|
243 |
+
'item_id' => $friendship_id,
|
244 |
+
'secondary_item_id' => $initiator_user_id,
|
245 |
+
'hide_sitewide' => true // We've already got the first entry site wide
|
246 |
+
) );
|
247 |
}
|
248 |
add_action( 'friends_friendship_accepted', 'bp_friends_friendship_accepted_activity', 10, 4 );
|
bp-friends/bp-friends-cache.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
-
defined( 'ABSPATH' )
|
15 |
|
16 |
/**
|
17 |
* Clear friends-related cache for members of a specific friendship.
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
/**
|
17 |
* Clear friends-related cache for members of a specific friendship.
|
bp-friends/bp-friends-classes.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
-
defined( 'ABSPATH' )
|
11 |
|
12 |
/**
|
13 |
* BuddyPress Friendship object.
|
@@ -145,13 +145,6 @@ class BP_Friends_Friendship {
|
|
145 |
$this->is_limited = apply_filters( 'friends_friendship_is_limited_before_save', $this->is_limited, $this->id );
|
146 |
$this->date_created = apply_filters( 'friends_friendship_date_created_before_save', $this->date_created, $this->id );
|
147 |
|
148 |
-
/**
|
149 |
-
* Fires before processing and saving the current friendship request.
|
150 |
-
*
|
151 |
-
* @since BuddyPress (1.0.0)
|
152 |
-
*
|
153 |
-
* @param Object $value Current friendship request object.
|
154 |
-
*/
|
155 |
do_action_ref_array( 'friends_friendship_before_save', array( &$this ) );
|
156 |
|
157 |
// Update
|
@@ -164,13 +157,6 @@ class BP_Friends_Friendship {
|
|
164 |
$this->id = $wpdb->insert_id;
|
165 |
}
|
166 |
|
167 |
-
/**
|
168 |
-
* Fires after processing and saving the current friendship request.
|
169 |
-
*
|
170 |
-
* @since BuddyPress (1.0.0)
|
171 |
-
*
|
172 |
-
* @param Object $value Current friendship request object.
|
173 |
-
*/
|
174 |
do_action( 'friends_friendship_after_save', array( &$this ) );
|
175 |
|
176 |
return $result;
|
@@ -186,7 +172,7 @@ class BP_Friends_Friendship {
|
|
186 |
/**
|
187 |
* Get the IDs of a given user's friends.
|
188 |
*
|
189 |
-
* @param int $user_id ID of the user whose friends are being
|
190 |
* @param bool $friend_requests_only Optional. Whether to fetch
|
191 |
* unaccepted requests only. Default: false.
|
192 |
* @param bool $assoc_arr Optional. True to receive an array of arrays
|
7 |
*/
|
8 |
|
9 |
// Exit if accessed directly
|
10 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
/**
|
13 |
* BuddyPress Friendship object.
|
145 |
$this->is_limited = apply_filters( 'friends_friendship_is_limited_before_save', $this->is_limited, $this->id );
|
146 |
$this->date_created = apply_filters( 'friends_friendship_date_created_before_save', $this->date_created, $this->id );
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
do_action_ref_array( 'friends_friendship_before_save', array( &$this ) );
|
149 |
|
150 |
// Update
|
157 |
$this->id = $wpdb->insert_id;
|
158 |
}
|
159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
do_action( 'friends_friendship_after_save', array( &$this ) );
|
161 |
|
162 |
return $result;
|
172 |
/**
|
173 |
* Get the IDs of a given user's friends.
|
174 |
*
|
175 |
+
* @param int $user_id ID of the user whose friends are being retreived.
|
176 |
* @param bool $friend_requests_only Optional. Whether to fetch
|
177 |
* unaccepted requests only. Default: false.
|
178 |
* @param bool $assoc_arr Optional. True to receive an array of arrays
|
bp-friends/bp-friends-functions.php
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
*/
|
14 |
|
15 |
// Exit if accessed directly
|
16 |
-
defined( 'ABSPATH' )
|
17 |
|
18 |
/**
|
19 |
* Create a new friendship.
|
@@ -59,28 +59,16 @@ function friends_add_friend( $initiator_userid, $friend_userid, $force_accept =
|
|
59 |
|
60 |
// Send notifications
|
61 |
if ( empty( $force_accept ) ) {
|
62 |
-
$action = '
|
63 |
|
64 |
// Update friend totals
|
65 |
} else {
|
66 |
-
$action = '
|
67 |
friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id, 'add' );
|
68 |
}
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
*
|
73 |
-
* This is a variable hook, depending on context.
|
74 |
-
* The two potential hooks are: friends_friendship_requested, friends_friendship_accepted.
|
75 |
-
*
|
76 |
-
* @since BuddyPress (1.0.0)
|
77 |
-
*
|
78 |
-
* @param int $id ID of the pending friendship connection.
|
79 |
-
* @param int $initiator_user_id ID of the friendship initiator.
|
80 |
-
* @param int $friend_user_id ID of the friend user.
|
81 |
-
* @param object $friendship BuddyPress Friendship Object.
|
82 |
-
*/
|
83 |
-
do_action( 'friends_friendship_' . $action, $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id, $friendship );
|
84 |
|
85 |
return true;
|
86 |
}
|
@@ -99,46 +87,18 @@ function friends_remove_friend( $initiator_userid, $friend_userid ) {
|
|
99 |
$friendship_id = BP_Friends_Friendship::get_friendship_id( $initiator_userid, $friend_userid );
|
100 |
$friendship = new BP_Friends_Friendship( $friendship_id );
|
101 |
|
102 |
-
/**
|
103 |
-
* Fires before the deletion of a friendship activity item
|
104 |
-
* for the user who canceled the friendship.
|
105 |
-
*
|
106 |
-
* @since BuddyPress (1.5.0)
|
107 |
-
*
|
108 |
-
* @param int $friendship_id ID of the friendship object, if any, between a pair of users.
|
109 |
-
* @param int $initiator_userid ID of the friendship initiator.
|
110 |
-
* @param int $friend_userid ID of the friend user.
|
111 |
-
*/
|
112 |
do_action( 'friends_before_friendship_delete', $friendship_id, $initiator_userid, $friend_userid );
|
113 |
|
114 |
-
// Remove the activity stream
|
115 |
-
friends_delete_activity( array( 'item_id' => $friendship_id, 'type' => '
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
*
|
120 |
-
* This hook is misleadingly named - the friendship is not yet deleted.
|
121 |
-
* This is your last chance to do something while the friendship exists.
|
122 |
-
*
|
123 |
-
* @since BuddyPress (1.0.0)
|
124 |
-
*
|
125 |
-
* @param int $friendship_id ID of the friendship object, if any, between a pair of users.
|
126 |
-
* @param int $initiator_userid ID of the friendship initiator.
|
127 |
-
* @param int $friend_userid ID of the friend user.
|
128 |
-
*/
|
129 |
do_action( 'friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid );
|
130 |
|
131 |
if ( $friendship->delete() ) {
|
132 |
friends_update_friend_totals( $initiator_userid, $friend_userid, 'remove' );
|
133 |
|
134 |
-
/**
|
135 |
-
* Fires after the friendship connection is removed.
|
136 |
-
*
|
137 |
-
* @since BuddyPress (1.8.0)
|
138 |
-
*
|
139 |
-
* @param int $initiator_userid ID of the friendship initiator.
|
140 |
-
* @param int $friend_userid ID of the friend user.
|
141 |
-
*/
|
142 |
do_action( 'friends_friendship_post_delete', $initiator_userid, $friend_userid );
|
143 |
|
144 |
return true;
|
@@ -157,7 +117,7 @@ function friends_remove_friend( $initiator_userid, $friend_userid ) {
|
|
157 |
*/
|
158 |
function friends_accept_friendship( $friendship_id ) {
|
159 |
|
160 |
-
// Get the
|
161 |
$friendship = new BP_Friends_Friendship( $friendship_id, true, false );
|
162 |
|
163 |
// Accepting friendship
|
@@ -166,16 +126,6 @@ function friends_accept_friendship( $friendship_id ) {
|
|
166 |
// Bump the friendship counts
|
167 |
friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id );
|
168 |
|
169 |
-
/**
|
170 |
-
* Fires after a friendship is accepted.
|
171 |
-
*
|
172 |
-
* @since BuddyPress (1.0.0)
|
173 |
-
*
|
174 |
-
* @param int $id ID of the pending friendship object.
|
175 |
-
* @param int $initiator_user_id ID of the friendship initiator.
|
176 |
-
* @param int $friend_user_id ID of the user requested friendship with.
|
177 |
-
* @param object $friendship BuddyPress Friendship Object.
|
178 |
-
*/
|
179 |
do_action( 'friends_friendship_accepted', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id, $friendship );
|
180 |
|
181 |
return true;
|
@@ -194,15 +144,6 @@ function friends_reject_friendship( $friendship_id ) {
|
|
194 |
$friendship = new BP_Friends_Friendship( $friendship_id, true, false );
|
195 |
|
196 |
if ( empty( $friendship->is_confirmed ) && BP_Friends_Friendship::reject( $friendship_id ) ) {
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Fires after a friendship request is rejected.
|
200 |
-
*
|
201 |
-
* @since BuddyPress (1.0.0)
|
202 |
-
*
|
203 |
-
* @param int $friendship_id ID of the pending friendship.
|
204 |
-
* @param BP_Friends_Friendship $friendships Friendship object. Passed by reference.
|
205 |
-
*/
|
206 |
do_action_ref_array( 'friends_friendship_rejected', array( $friendship_id, &$friendship ) );
|
207 |
return true;
|
208 |
}
|
@@ -227,14 +168,7 @@ function friends_withdraw_friendship( $initiator_userid, $friend_userid ) {
|
|
227 |
// @deprecated Since 1.9
|
228 |
do_action_ref_array( 'friends_friendship_whithdrawn', array( $friendship_id, &$friendship ) );
|
229 |
|
230 |
-
|
231 |
-
* Fires after a friendship request has been withdrawn.
|
232 |
-
*
|
233 |
-
* @since BuddyPress (1.9.0)
|
234 |
-
*
|
235 |
-
* @param int $friendship_id ID of the friendship.
|
236 |
-
* @param BP_Friends_Friendship $friendship Friendship object. Passed by reference.
|
237 |
-
*/
|
238 |
do_action_ref_array( 'friends_friendship_withdrawn', array( $friendship_id, &$friendship ) );
|
239 |
|
240 |
return true;
|
@@ -300,13 +234,6 @@ function friends_get_total_friend_count( $user_id = 0 ) {
|
|
300 |
if ( empty( $count ) )
|
301 |
$count = 0;
|
302 |
|
303 |
-
/**
|
304 |
-
* Filters the total friend count for a given user.
|
305 |
-
*
|
306 |
-
* @since BuddyPress (1.2.0)
|
307 |
-
*
|
308 |
-
* @param int $count Total friend count for a given user.
|
309 |
-
*/
|
310 |
return apply_filters( 'friends_get_total_friend_count', $count );
|
311 |
}
|
312 |
|
@@ -342,7 +269,7 @@ function friends_get_friendship_id( $initiator_user_id, $friend_user_id ) {
|
|
342 |
/**
|
343 |
* Get the IDs of a given user's friends.
|
344 |
*
|
345 |
-
* @param int $user_id ID of the user whose friends are being
|
346 |
* @param bool $friend_requests_only Optional. Whether to fetch unaccepted
|
347 |
* requests only. Default: false.
|
348 |
* @param bool $assoc_arr Optional. True to receive an array of arrays keyed as
|
@@ -388,7 +315,7 @@ function friends_get_friendship_request_user_ids( $user_id ) {
|
|
388 |
*
|
389 |
* @see BP_Core_User::get_users() for a description of return value.
|
390 |
*
|
391 |
-
* @param int $user_id ID of the user whose friends are being
|
392 |
* @param int $per_page Optional. Number of results to return per page.
|
393 |
* Default: 0 (no pagination; show all results).
|
394 |
* @param int $page Optional. Number of the page of results to return.
|
@@ -398,17 +325,6 @@ function friends_get_friendship_request_user_ids( $user_id ) {
|
|
398 |
* @return array See {@link BP_Core_User::get_users()}.
|
399 |
*/
|
400 |
function friends_get_recently_active( $user_id, $per_page = 0, $page = 0, $filter = '' ) {
|
401 |
-
|
402 |
-
/**
|
403 |
-
* Filters a user's most recently active friends.
|
404 |
-
*
|
405 |
-
* @since BuddyPress (1.2.0)
|
406 |
-
*
|
407 |
-
* @param array {
|
408 |
-
* @type int $total_users Total number of users matched by query params.
|
409 |
-
* @type array $paged_users The current page of users matched by query params.
|
410 |
-
* }
|
411 |
-
*/
|
412 |
return apply_filters( 'friends_get_recently_active', BP_Core_User::get_users( 'active', $per_page, $page, $user_id, $filter ) );
|
413 |
}
|
414 |
|
@@ -417,7 +333,7 @@ function friends_get_recently_active( $user_id, $per_page = 0, $page = 0, $filte
|
|
417 |
*
|
418 |
* @see BP_Core_User::get_users() for a description of return value.
|
419 |
*
|
420 |
-
* @param int $user_id ID of the user whose friends are being
|
421 |
* @param int $per_page Optional. Number of results to return per page.
|
422 |
* Default: 0 (no pagination; show all results).
|
423 |
* @param int $page Optional. Number of the page of results to return.
|
@@ -427,17 +343,6 @@ function friends_get_recently_active( $user_id, $per_page = 0, $page = 0, $filte
|
|
427 |
* @return array See {@link BP_Core_User::get_users()}.
|
428 |
*/
|
429 |
function friends_get_alphabetically( $user_id, $per_page = 0, $page = 0, $filter = '' ) {
|
430 |
-
|
431 |
-
/**
|
432 |
-
* Filters a user's friends listed in alphabetical order.
|
433 |
-
*
|
434 |
-
* @since BuddyPress (1.2.0)
|
435 |
-
*
|
436 |
-
* @return array {
|
437 |
-
* @type int $total_users Total number of users matched by query params.
|
438 |
-
* @type array $paged_users The current page of users matched by query params.
|
439 |
-
* }
|
440 |
-
*/
|
441 |
return apply_filters( 'friends_get_alphabetically', BP_Core_User::get_users( 'alphabetical', $per_page, $page, $user_id, $filter ) );
|
442 |
}
|
443 |
|
@@ -446,7 +351,7 @@ function friends_get_alphabetically( $user_id, $per_page = 0, $page = 0, $filter
|
|
446 |
*
|
447 |
* @see BP_Core_User::get_users() for a description of return value.
|
448 |
*
|
449 |
-
* @param int $user_id ID of the user whose friends are being
|
450 |
* @param int $per_page Optional. Number of results to return per page.
|
451 |
* Default: 0 (no pagination; show all results).
|
452 |
* @param int $page Optional. Number of the page of results to return.
|
@@ -456,17 +361,6 @@ function friends_get_alphabetically( $user_id, $per_page = 0, $page = 0, $filter
|
|
456 |
* @return array See {@link BP_Core_User::get_users()}.
|
457 |
*/
|
458 |
function friends_get_newest( $user_id, $per_page = 0, $page = 0, $filter = '' ) {
|
459 |
-
|
460 |
-
/**
|
461 |
-
* Filters a user's friends listed from newest to oldest.
|
462 |
-
*
|
463 |
-
* @since BuddyPress (1.2.0)
|
464 |
-
*
|
465 |
-
* @param array {
|
466 |
-
* @type int $total_users Total number of users matched by query params.
|
467 |
-
* @type array $paged_users The current page of users matched by query params.
|
468 |
-
* }
|
469 |
-
*/
|
470 |
return apply_filters( 'friends_get_newest', BP_Core_User::get_users( 'newest', $per_page, $page, $user_id, $filter ) );
|
471 |
}
|
472 |
|
@@ -508,13 +402,7 @@ function friends_get_friends_invite_list( $user_id = 0, $group_id = 0 ) {
|
|
508 |
// Assume no friends
|
509 |
$friends = array();
|
510 |
|
511 |
-
|
512 |
-
* Filters default arguments for list of friends a user can invite into this group.
|
513 |
-
*
|
514 |
-
* @since BuddyPress (1.5.4)
|
515 |
-
*
|
516 |
-
* @param array $value Array of default parameters for invite list.
|
517 |
-
*/
|
518 |
$args = apply_filters( 'bp_friends_pre_get_invite_list', array(
|
519 |
'user_id' => $user_id,
|
520 |
'type' => 'alphabetical',
|
@@ -561,15 +449,7 @@ function friends_get_friends_invite_list( $user_id = 0, $group_id = 0 ) {
|
|
561 |
if ( empty( $friends ) )
|
562 |
$friends = false;
|
563 |
|
564 |
-
|
565 |
-
* Filters the list of potential friends that can be invited to this group.
|
566 |
-
*
|
567 |
-
* @since BuddyPress (1.5.4)
|
568 |
-
*
|
569 |
-
* @param array|bool $friends Array friends available to invite or false for no friends.
|
570 |
-
* @param int $user_id ID of the user checked for who they can invite.
|
571 |
-
* @param int $group_id ID of the group being checked on.
|
572 |
-
*/
|
573 |
return apply_filters( 'bp_friends_get_invite_list', $friends, $user_id, $group_id );
|
574 |
}
|
575 |
|
@@ -674,13 +554,6 @@ function friends_update_friend_totals( $initiator_user_id, $friend_user_id, $sta
|
|
674 |
*/
|
675 |
function friends_remove_data( $user_id ) {
|
676 |
|
677 |
-
/**
|
678 |
-
* Fires before deletion of friend-related data for a given user.
|
679 |
-
*
|
680 |
-
* @since BuddyPress (1.5.0)
|
681 |
-
*
|
682 |
-
* @param int $user_id ID for the user whose friend data is being removed.
|
683 |
-
*/
|
684 |
do_action( 'friends_before_remove_data', $user_id );
|
685 |
|
686 |
BP_Friends_Friendship::delete_all_for_user( $user_id );
|
@@ -688,13 +561,6 @@ function friends_remove_data( $user_id ) {
|
|
688 |
// Remove usermeta
|
689 |
bp_delete_user_meta( $user_id, 'total_friend_count' );
|
690 |
|
691 |
-
/**
|
692 |
-
* Fires after deletion of friend-related data for a given user.
|
693 |
-
*
|
694 |
-
* @since BuddyPress (1.0.0)
|
695 |
-
*
|
696 |
-
* @param int $user_id ID for the user whose friend data is being removed.
|
697 |
-
*/
|
698 |
do_action( 'friends_remove_data', $user_id );
|
699 |
}
|
700 |
add_action( 'wpmu_delete_user', 'friends_remove_data' );
|
@@ -713,15 +579,6 @@ function bp_friends_prime_mentions_results() {
|
|
713 |
return;
|
714 |
}
|
715 |
|
716 |
-
// Bail out if the site has a ton of users.
|
717 |
-
if ( is_multisite() && wp_is_large_network( 'users' ) ) {
|
718 |
-
return;
|
719 |
-
}
|
720 |
-
|
721 |
-
if ( friends_get_total_friend_count( get_current_user_id() ) > 150 ) {
|
722 |
-
return;
|
723 |
-
}
|
724 |
-
|
725 |
$friends_query = array(
|
726 |
'count_total' => '', // Prevents total count
|
727 |
'populate_extras' => false,
|
@@ -737,12 +594,7 @@ function bp_friends_prime_mentions_results() {
|
|
737 |
$result = new stdClass();
|
738 |
$result->ID = $user->user_nicename;
|
739 |
$result->image = bp_core_fetch_avatar( array( 'html' => false, 'item_id' => $user->ID ) );
|
740 |
-
|
741 |
-
if ( ! empty( $user->display_name ) && ! bp_disable_profile_sync() ) {
|
742 |
-
$result->name = $user->display_name;
|
743 |
-
} else {
|
744 |
-
$result->name = bp_core_get_user_displayname( $user->ID );
|
745 |
-
}
|
746 |
|
747 |
$results[] = $result;
|
748 |
}
|
@@ -751,4 +603,4 @@ function bp_friends_prime_mentions_results() {
|
|
751 |
'friends' => $results,
|
752 |
) );
|
753 |
}
|
754 |
-
add_action( 'bp_activity_mentions_prime_results', 'bp_friends_prime_mentions_results' );
|
13 |
*/
|
14 |
|
15 |
// Exit if accessed directly
|
16 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
17 |
|
18 |
/**
|
19 |
* Create a new friendship.
|
59 |
|
60 |
// Send notifications
|
61 |
if ( empty( $force_accept ) ) {
|
62 |
+
$action = 'friends_friendship_requested';
|
63 |
|
64 |
// Update friend totals
|
65 |
} else {
|
66 |
+
$action = 'friends_friendship_accepted';
|
67 |
friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id, 'add' );
|
68 |
}
|
69 |
|
70 |
+
// Call the above titled action and pass friendship data into it
|
71 |
+
do_action( $action, $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id, $friendship );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
return true;
|
74 |
}
|
87 |
$friendship_id = BP_Friends_Friendship::get_friendship_id( $initiator_userid, $friend_userid );
|
88 |
$friendship = new BP_Friends_Friendship( $friendship_id );
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
do_action( 'friends_before_friendship_delete', $friendship_id, $initiator_userid, $friend_userid );
|
91 |
|
92 |
+
// Remove the activity stream item for the user who canceled the friendship
|
93 |
+
friends_delete_activity( array( 'item_id' => $friendship_id, 'type' => 'friendship_accepted', 'user_id' => bp_displayed_user_id() ) );
|
94 |
+
|
95 |
+
// This hook is misleadingly named - the friendship is not yet deleted.
|
96 |
+
// This is your last chance to do something while the friendship exists
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
do_action( 'friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid );
|
98 |
|
99 |
if ( $friendship->delete() ) {
|
100 |
friends_update_friend_totals( $initiator_userid, $friend_userid, 'remove' );
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
do_action( 'friends_friendship_post_delete', $initiator_userid, $friend_userid );
|
103 |
|
104 |
return true;
|
117 |
*/
|
118 |
function friends_accept_friendship( $friendship_id ) {
|
119 |
|
120 |
+
// Get the friesdhip data
|
121 |
$friendship = new BP_Friends_Friendship( $friendship_id, true, false );
|
122 |
|
123 |
// Accepting friendship
|
126 |
// Bump the friendship counts
|
127 |
friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id );
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
do_action( 'friends_friendship_accepted', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id, $friendship );
|
130 |
|
131 |
return true;
|
144 |
$friendship = new BP_Friends_Friendship( $friendship_id, true, false );
|
145 |
|
146 |
if ( empty( $friendship->is_confirmed ) && BP_Friends_Friendship::reject( $friendship_id ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
do_action_ref_array( 'friends_friendship_rejected', array( $friendship_id, &$friendship ) );
|
148 |
return true;
|
149 |
}
|
168 |
// @deprecated Since 1.9
|
169 |
do_action_ref_array( 'friends_friendship_whithdrawn', array( $friendship_id, &$friendship ) );
|
170 |
|
171 |
+
// @since 1.9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
do_action_ref_array( 'friends_friendship_withdrawn', array( $friendship_id, &$friendship ) );
|
173 |
|
174 |
return true;
|
234 |
if ( empty( $count ) )
|
235 |
$count = 0;
|
236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
return apply_filters( 'friends_get_total_friend_count', $count );
|
238 |
}
|
239 |
|
269 |
/**
|
270 |
* Get the IDs of a given user's friends.
|
271 |
*
|
272 |
+
* @param int $user_id ID of the user whose friends are being retreived.
|
273 |
* @param bool $friend_requests_only Optional. Whether to fetch unaccepted
|
274 |
* requests only. Default: false.
|
275 |
* @param bool $assoc_arr Optional. True to receive an array of arrays keyed as
|
315 |
*
|
316 |
* @see BP_Core_User::get_users() for a description of return value.
|
317 |
*
|
318 |
+
* @param int $user_id ID of the user whose friends are being retreived.
|
319 |
* @param int $per_page Optional. Number of results to return per page.
|
320 |
* Default: 0 (no pagination; show all results).
|
321 |
* @param int $page Optional. Number of the page of results to return.
|
325 |
* @return array See {@link BP_Core_User::get_users()}.
|
326 |
*/
|
327 |
function friends_get_recently_active( $user_id, $per_page = 0, $page = 0, $filter = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
return apply_filters( 'friends_get_recently_active', BP_Core_User::get_users( 'active', $per_page, $page, $user_id, $filter ) );
|
329 |
}
|
330 |
|
333 |
*
|
334 |
* @see BP_Core_User::get_users() for a description of return value.
|
335 |
*
|
336 |
+
* @param int $user_id ID of the user whose friends are being retreived.
|
337 |
* @param int $per_page Optional. Number of results to return per page.
|
338 |
* Default: 0 (no pagination; show all results).
|
339 |
* @param int $page Optional. Number of the page of results to return.
|
343 |
* @return array See {@link BP_Core_User::get_users()}.
|
344 |
*/
|
345 |
function friends_get_alphabetically( $user_id, $per_page = 0, $page = 0, $filter = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
return apply_filters( 'friends_get_alphabetically', BP_Core_User::get_users( 'alphabetical', $per_page, $page, $user_id, $filter ) );
|
347 |
}
|
348 |
|
351 |
*
|
352 |
* @see BP_Core_User::get_users() for a description of return value.
|
353 |
*
|
354 |
+
* @param int $user_id ID of the user whose friends are being retreived.
|
355 |
* @param int $per_page Optional. Number of results to return per page.
|
356 |
* Default: 0 (no pagination; show all results).
|
357 |
* @param int $page Optional. Number of the page of results to return.
|
361 |
* @return array See {@link BP_Core_User::get_users()}.
|
362 |
*/
|
363 |
function friends_get_newest( $user_id, $per_page = 0, $page = 0, $filter = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
return apply_filters( 'friends_get_newest', BP_Core_User::get_users( 'newest', $per_page, $page, $user_id, $filter ) );
|
365 |
}
|
366 |
|
402 |
// Assume no friends
|
403 |
$friends = array();
|
404 |
|
405 |
+
// Default args
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
$args = apply_filters( 'bp_friends_pre_get_invite_list', array(
|
407 |
'user_id' => $user_id,
|
408 |
'type' => 'alphabetical',
|
449 |
if ( empty( $friends ) )
|
450 |
$friends = false;
|
451 |
|
452 |
+
// Allow friends to be filtered
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
return apply_filters( 'bp_friends_get_invite_list', $friends, $user_id, $group_id );
|
454 |
}
|
455 |
|
554 |
*/
|
555 |
function friends_remove_data( $user_id ) {
|
556 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
557 |
do_action( 'friends_before_remove_data', $user_id );
|
558 |
|
559 |
BP_Friends_Friendship::delete_all_for_user( $user_id );
|
561 |
// Remove usermeta
|
562 |
bp_delete_user_meta( $user_id, 'total_friend_count' );
|
563 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
564 |
do_action( 'friends_remove_data', $user_id );
|
565 |
}
|
566 |
add_action( 'wpmu_delete_user', 'friends_remove_data' );
|
579 |
return;
|
580 |
}
|
581 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
582 |
$friends_query = array(
|
583 |
'count_total' => '', // Prevents total count
|
584 |
'populate_extras' => false,
|
594 |
$result = new stdClass();
|
595 |
$result->ID = $user->user_nicename;
|
596 |
$result->image = bp_core_fetch_avatar( array( 'html' => false, 'item_id' => $user->ID ) );
|
597 |
+
$result->name = bp_core_get_user_displayname( $user->ID );
|
|
|
|
|
|
|
|
|
|
|
598 |
|
599 |
$results[] = $result;
|
600 |
}
|
603 |
'friends' => $results,
|
604 |
) );
|
605 |
}
|
606 |
+
add_action( 'bp_activity_mentions_prime_results', 'bp_friends_prime_mentions_results' );
|
bp-friends/bp-friends-loader.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
12 |
-
defined( 'ABSPATH' )
|
13 |
|
14 |
class BP_Friends_Component extends BP_Component {
|
15 |
|
@@ -239,21 +239,6 @@ class BP_Friends_Component extends BP_Component {
|
|
239 |
|
240 |
parent::setup_title();
|
241 |
}
|
242 |
-
|
243 |
-
/**
|
244 |
-
* Setup cache groups
|
245 |
-
*
|
246 |
-
* @since BuddyPress (2.2.0)
|
247 |
-
*/
|
248 |
-
public function setup_cache_groups() {
|
249 |
-
|
250 |
-
// Global groups
|
251 |
-
wp_cache_add_global_groups( array(
|
252 |
-
'bp_friends_requests'
|
253 |
-
) );
|
254 |
-
|
255 |
-
parent::setup_cache_groups();
|
256 |
-
}
|
257 |
}
|
258 |
|
259 |
/**
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
12 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
13 |
|
14 |
class BP_Friends_Component extends BP_Component {
|
15 |
|
239 |
|
240 |
parent::setup_title();
|
241 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
}
|
243 |
|
244 |
/**
|
bp-friends/bp-friends-notifications.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
-
defined( 'ABSPATH' )
|
15 |
|
16 |
/** Emails ********************************************************************/
|
17 |
|
@@ -56,51 +56,13 @@ To view %3$s\'s profile: %4$s
|
|
56 |
$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
|
57 |
}
|
58 |
|
59 |
-
|
60 |
-
* Filters the email address for who is getting the friend request.
|
61 |
-
*
|
62 |
-
* @since BuddyPress (1.2.0)
|
63 |
-
*
|
64 |
-
* @param string $to Email address for who is getting the friend request.
|
65 |
-
*/
|
66 |
$to = apply_filters( 'friends_notification_new_request_to', $to );
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Filters the subject for the friend request email.
|
70 |
-
*
|
71 |
-
* @since BuddyPress (1.2.0)
|
72 |
-
*
|
73 |
-
* @param string $subject Subject line to be used in friend request email.
|
74 |
-
* @param string $initiator_name Name of the person requesting friendship.
|
75 |
-
*/
|
76 |
$subject = apply_filters( 'friends_notification_new_request_subject', $subject, $initiator_name );
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Filters the message for the friend request email.
|
80 |
-
*
|
81 |
-
* @since BuddyPress (1.2.0)
|
82 |
-
*
|
83 |
-
* @param string $message Message to be used in friend request email.
|
84 |
-
* @param string $initiator_name Name of the person requesting friendship.
|
85 |
-
* @param string $initiator_link Profile link of person requesting friendship.
|
86 |
-
* @param string $all_requests_link User's friends request management link.
|
87 |
-
* @param string $settings_link Email recipient's settings management link.
|
88 |
-
*/
|
89 |
$message = apply_filters( 'friends_notification_new_request_message', $message, $initiator_name, $initiator_link, $all_requests_link, $settings_link );
|
90 |
|
91 |
wp_mail( $to, $subject, $message );
|
92 |
|
93 |
-
/**
|
94 |
-
* Fires after the new friend request email is sent.
|
95 |
-
*
|
96 |
-
* @since BuddyPress (1.5.0)
|
97 |
-
*
|
98 |
-
* @param int $friend_id ID of the request recipient.
|
99 |
-
* @param string $subject Text for the friend request subject field.
|
100 |
-
* @param string $message Text for the friend request message field.
|
101 |
-
* @param int $friendship_id ID of the friendship object.
|
102 |
-
* @param int $initiator_id ID of the friendship requester.
|
103 |
-
*/
|
104 |
do_action( 'bp_friends_sent_request_email', $friend_id, $subject, $message, $friendship_id, $initiator_id );
|
105 |
}
|
106 |
add_action( 'friends_friendship_requested', 'friends_notification_new_request', 10, 3 );
|
@@ -143,50 +105,13 @@ To view %2$s\'s profile: %3$s
|
|
143 |
$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
|
144 |
}
|
145 |
|
146 |
-
|
147 |
-
* Filters the email address for whose friend request got accepted.
|
148 |
-
*
|
149 |
-
* @since BuddyPress (1.2.0)
|
150 |
-
*
|
151 |
-
* @param string $to Email address for whose friend request got accepted.
|
152 |
-
*/
|
153 |
$to = apply_filters( 'friends_notification_accepted_request_to', $to );
|
154 |
-
|
155 |
-
/**
|
156 |
-
* Filters the subject for the friend request accepted email.
|
157 |
-
*
|
158 |
-
* @since BuddyPress (1.2.0)
|
159 |
-
*
|
160 |
-
* @param string $subject Subject line to be used in friend request accepted email.
|
161 |
-
* @param string $friend_name Name of the person who accepted the friendship request.
|
162 |
-
*/
|
163 |
$subject = apply_filters( 'friends_notification_accepted_request_subject', $subject, $friend_name );
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Filters the message for the friend request accepted email.
|
167 |
-
*
|
168 |
-
* @since BuddyPress (1.2.0)
|
169 |
-
*
|
170 |
-
* @param string $message Message to be used in friend request email.
|
171 |
-
* @param string $friend_name Name of the person who accepted the friendship request.
|
172 |
-
* @param string $friend_link Profile link of person who accepted the friendship request.
|
173 |
-
* @param string $settings_link Email recipient's settings management link.
|
174 |
-
*/
|
175 |
$message = apply_filters( 'friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link );
|
176 |
|
177 |
wp_mail( $to, $subject, $message );
|
178 |
|
179 |
-
/**
|
180 |
-
* Fires after the friend request accepted email is sent.
|
181 |
-
*
|
182 |
-
* @since BuddyPress (1.5.0)
|
183 |
-
*
|
184 |
-
* @param int $initiator_id ID of the friendship requester.
|
185 |
-
* @param string $subject Text for the friend request subject field.
|
186 |
-
* @param string $message Text for the friend request message field.
|
187 |
-
* @param int $friendship_id ID of the friendship object.
|
188 |
-
* @param int $friend_id ID of the request recipient.
|
189 |
-
*/
|
190 |
do_action( 'bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id );
|
191 |
}
|
192 |
add_action( 'friends_friendship_accepted', 'friends_notification_accepted_request', 10, 3 );
|
@@ -211,16 +136,13 @@ function friends_format_notifications( $action, $item_id, $secondary_item_id, $t
|
|
211 |
case 'friendship_accepted':
|
212 |
$link = trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends' );
|
213 |
|
214 |
-
// $action and $amount are used to generate dynamic filter names.
|
215 |
-
$action = 'accepted';
|
216 |
-
|
217 |
// Set up the string and the filter
|
218 |
if ( (int) $total_items > 1 ) {
|
219 |
$text = sprintf( __( '%d friends accepted your friendship requests', 'buddypress' ), (int) $total_items );
|
220 |
-
$
|
221 |
} else {
|
222 |
$text = sprintf( __( '%s accepted your friendship request', 'buddypress' ), bp_core_get_user_displayname( $item_id ) );
|
223 |
-
$
|
224 |
}
|
225 |
|
226 |
break;
|
@@ -228,15 +150,13 @@ function friends_format_notifications( $action, $item_id, $secondary_item_id, $t
|
|
228 |
case 'friendship_request':
|
229 |
$link = bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/?new';
|
230 |
|
231 |
-
$action = 'request';
|
232 |
-
|
233 |
// Set up the string and the filter
|
234 |
if ( (int) $total_items > 1 ) {
|
235 |
$text = sprintf( __( 'You have %d pending friendship requests', 'buddypress' ), (int) $total_items );
|
236 |
-
$
|
237 |
} else {
|
238 |
$text = sprintf( __( 'You have a friendship request from %s', 'buddypress' ), bp_core_get_user_displayname( $item_id ) );
|
239 |
-
$
|
240 |
}
|
241 |
|
242 |
break;
|
@@ -244,46 +164,14 @@ function friends_format_notifications( $action, $item_id, $secondary_item_id, $t
|
|
244 |
|
245 |
// Return either an HTML link or an array, depending on the requested format
|
246 |
if ( 'string' == $format ) {
|
247 |
-
|
248 |
-
/**
|
249 |
-
* Filters the format of friendship notifications based on type and amount * of notifications pending.
|
250 |
-
*
|
251 |
-
* This is a variable filter that has four possible versions.
|
252 |
-
* The four possible versions are:
|
253 |
-
* - bp_friends_single_friendship_accepted_notification
|
254 |
-
* - bp_friends_multiple_friendship_accepted_notification
|
255 |
-
* - bp_friends_single_friendship_request_notification
|
256 |
-
* - bp_friends_multiple_friendship_request_notification
|
257 |
-
*
|
258 |
-
* @since BuddyPress (1.0.0)
|
259 |
-
*
|
260 |
-
* @param string|array $value Depending on format, an HTML link to new requests profile
|
261 |
-
* tab or array with link and text.
|
262 |
-
* @param int $total_items The total number of messaging-related notifications
|
263 |
-
* waiting for the user.
|
264 |
-
* @param int $item_id The primary item ID.
|
265 |
-
*/
|
266 |
-
$return = apply_filters( 'bp_friends_' . $amount . '_friendship_' . $action . '_notification', '<a href="' . esc_url( $link ) . '">' . esc_html( $text ) . '</a>', (int) $total_items, $item_id );
|
267 |
} else {
|
268 |
-
|
269 |
-
$return = apply_filters( 'bp_friends_' . $amount . '_friendship_' . $action . '_notification', array(
|
270 |
'link' => $link,
|
271 |
'text' => $text
|
272 |
), (int) $total_items, $item_id );
|
273 |
}
|
274 |
|
275 |
-
/**
|
276 |
-
* Fires at the end of the bp-friends notification format callback.
|
277 |
-
*
|
278 |
-
* @since BuddyPress (1.0.0)
|
279 |
-
*
|
280 |
-
* @param string $action The kind of notification being rendered.
|
281 |
-
* @param int $item_id The primary item ID.
|
282 |
-
* @param int $secondary_item_id The secondary item ID.
|
283 |
-
* @param int $total_items The total number of messaging-related notifications
|
284 |
-
* waiting for the user.
|
285 |
-
* @param array|string $return Notification text string or array of link and text.
|
286 |
-
*/
|
287 |
do_action( 'friends_format_notifications', $action, $item_id, $secondary_item_id, $total_items, $return );
|
288 |
|
289 |
return $return;
|
@@ -329,7 +217,7 @@ add_action( 'friends_screen_my_friends', 'bp_friends_mark_friendship_accepted_no
|
|
329 |
* @since BuddyPress (1.9.0)
|
330 |
* @param int $friendship_id The unique ID of the friendship
|
331 |
* @param int $initiator_user_id The friendship initiator user ID
|
332 |
-
* @param int $friend_user_id The friendship request
|
333 |
*/
|
334 |
function bp_friends_friendship_requested_notification( $friendship_id, $initiator_user_id, $friend_user_id ) {
|
335 |
if ( bp_is_active( 'notifications' ) ) {
|
@@ -367,7 +255,7 @@ add_action( 'friends_friendship_rejected', 'bp_friends_mark_friendship_rejected_
|
|
367 |
* @since BuddyPress (1.9.0)
|
368 |
* @param int $friendship_id The unique ID of the friendship
|
369 |
* @param int $initiator_user_id The friendship initiator user ID
|
370 |
-
* @param int $friend_user_id The friendship request
|
371 |
*/
|
372 |
function bp_friends_add_friendship_accepted_notification( $friendship_id, $initiator_user_id, $friend_user_id ) {
|
373 |
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
/** Emails ********************************************************************/
|
17 |
|
56 |
$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
|
57 |
}
|
58 |
|
59 |
+
// Send the message
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
$to = apply_filters( 'friends_notification_new_request_to', $to );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
$subject = apply_filters( 'friends_notification_new_request_subject', $subject, $initiator_name );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
$message = apply_filters( 'friends_notification_new_request_message', $message, $initiator_name, $initiator_link, $all_requests_link, $settings_link );
|
63 |
|
64 |
wp_mail( $to, $subject, $message );
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
do_action( 'bp_friends_sent_request_email', $friend_id, $subject, $message, $friendship_id, $initiator_id );
|
67 |
}
|
68 |
add_action( 'friends_friendship_requested', 'friends_notification_new_request', 10, 3 );
|
105 |
$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
|
106 |
}
|
107 |
|
108 |
+
// Send the message
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
$to = apply_filters( 'friends_notification_accepted_request_to', $to );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
$subject = apply_filters( 'friends_notification_accepted_request_subject', $subject, $friend_name );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
$message = apply_filters( 'friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link );
|
112 |
|
113 |
wp_mail( $to, $subject, $message );
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
do_action( 'bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id );
|
116 |
}
|
117 |
add_action( 'friends_friendship_accepted', 'friends_notification_accepted_request', 10, 3 );
|
136 |
case 'friendship_accepted':
|
137 |
$link = trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends' );
|
138 |
|
|
|
|
|
|
|
139 |
// Set up the string and the filter
|
140 |
if ( (int) $total_items > 1 ) {
|
141 |
$text = sprintf( __( '%d friends accepted your friendship requests', 'buddypress' ), (int) $total_items );
|
142 |
+
$filter = 'bp_friends_multiple_friendship_accepted_notification';
|
143 |
} else {
|
144 |
$text = sprintf( __( '%s accepted your friendship request', 'buddypress' ), bp_core_get_user_displayname( $item_id ) );
|
145 |
+
$filter = 'bp_friends_single_friendship_accepted_notification';
|
146 |
}
|
147 |
|
148 |
break;
|
150 |
case 'friendship_request':
|
151 |
$link = bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/?new';
|
152 |
|
|
|
|
|
153 |
// Set up the string and the filter
|
154 |
if ( (int) $total_items > 1 ) {
|
155 |
$text = sprintf( __( 'You have %d pending friendship requests', 'buddypress' ), (int) $total_items );
|
156 |
+
$filter = 'bp_friends_multiple_friendship_request_notification';
|
157 |
} else {
|
158 |
$text = sprintf( __( 'You have a friendship request from %s', 'buddypress' ), bp_core_get_user_displayname( $item_id ) );
|
159 |
+
$filter = 'bp_friends_single_friendship_request_notification';
|
160 |
}
|
161 |
|
162 |
break;
|
164 |
|
165 |
// Return either an HTML link or an array, depending on the requested format
|
166 |
if ( 'string' == $format ) {
|
167 |
+
$return = apply_filters( $filter, '<a href="' . esc_url( $link ) . '">' . esc_html( $text ) . '</a>', (int) $total_items, $item_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
} else {
|
169 |
+
$return = apply_filters( $filter, array(
|
|
|
170 |
'link' => $link,
|
171 |
'text' => $text
|
172 |
), (int) $total_items, $item_id );
|
173 |
}
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
do_action( 'friends_format_notifications', $action, $item_id, $secondary_item_id, $total_items, $return );
|
176 |
|
177 |
return $return;
|
217 |
* @since BuddyPress (1.9.0)
|
218 |
* @param int $friendship_id The unique ID of the friendship
|
219 |
* @param int $initiator_user_id The friendship initiator user ID
|
220 |
+
* @param int $friend_user_id The friendship request reciever user ID
|
221 |
*/
|
222 |
function bp_friends_friendship_requested_notification( $friendship_id, $initiator_user_id, $friend_user_id ) {
|
223 |
if ( bp_is_active( 'notifications' ) ) {
|
255 |
* @since BuddyPress (1.9.0)
|
256 |
* @param int $friendship_id The unique ID of the friendship
|
257 |
* @param int $initiator_user_id The friendship initiator user ID
|
258 |
+
* @param int $friend_user_id The friendship request reciever user ID
|
259 |
*/
|
260 |
function bp_friends_add_friendship_accepted_notification( $friendship_id, $initiator_user_id, $friend_user_id ) {
|
261 |
|
bp-friends/bp-friends-screens.php
CHANGED
@@ -12,27 +12,15 @@
|
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
-
defined( 'ABSPATH' )
|
16 |
|
17 |
/**
|
18 |
* Catch and process the My Friends page.
|
19 |
*/
|
20 |
function friends_screen_my_friends() {
|
21 |
|
22 |
-
/**
|
23 |
-
* Fires before the loading of template for the My Friends page.
|
24 |
-
*
|
25 |
-
* @since BuddyPress (1.0.0)
|
26 |
-
*/
|
27 |
do_action( 'friends_screen_my_friends' );
|
28 |
|
29 |
-
/**
|
30 |
-
* Filters the template used to display the My Friends page.
|
31 |
-
*
|
32 |
-
* @since BuddyPress (1.0.0)
|
33 |
-
*
|
34 |
-
* @param string $template Path to the my friends template to load.
|
35 |
-
*/
|
36 |
bp_core_load_template( apply_filters( 'friends_template_my_friends', 'members/single/home' ) );
|
37 |
}
|
38 |
|
@@ -74,20 +62,8 @@ function friends_screen_requests() {
|
|
74 |
bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) );
|
75 |
}
|
76 |
|
77 |
-
/**
|
78 |
-
* Fires before the loading of template for the friends requests page.
|
79 |
-
*
|
80 |
-
* @since BuddyPress (1.0.0)
|
81 |
-
*/
|
82 |
do_action( 'friends_screen_requests' );
|
83 |
|
84 |
-
/**
|
85 |
-
* Filters the template used to display the My Friends page.
|
86 |
-
*
|
87 |
-
* @since BuddyPress (1.0.0)
|
88 |
-
*
|
89 |
-
* @param string $template Path to the friends request template to load.
|
90 |
-
*/
|
91 |
bp_core_load_template( apply_filters( 'friends_template_requests', 'members/single/home' ) );
|
92 |
}
|
93 |
|
@@ -126,14 +102,7 @@ function friends_screen_notification_settings() {
|
|
126 |
<td class="no"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="no" <?php checked( $accept_requests, 'no', true ) ?>/></td>
|
127 |
</tr>
|
128 |
|
129 |
-
<?php
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Fires after the last table row on the friends notification screen.
|
133 |
-
*
|
134 |
-
* @since BuddyPress (1.0.0)
|
135 |
-
*/
|
136 |
-
do_action( 'friends_screen_notification_settings' ); ?>
|
137 |
|
138 |
</tbody>
|
139 |
</table>
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
16 |
|
17 |
/**
|
18 |
* Catch and process the My Friends page.
|
19 |
*/
|
20 |
function friends_screen_my_friends() {
|
21 |
|
|
|
|
|
|
|
|
|
|
|
22 |
do_action( 'friends_screen_my_friends' );
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
bp_core_load_template( apply_filters( 'friends_template_my_friends', 'members/single/home' ) );
|
25 |
}
|
26 |
|
62 |
bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) );
|
63 |
}
|
64 |
|
|
|
|
|
|
|
|
|
|
|
65 |
do_action( 'friends_screen_requests' );
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
bp_core_load_template( apply_filters( 'friends_template_requests', 'members/single/home' ) );
|
68 |
}
|
69 |
|
102 |
<td class="no"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="no" <?php checked( $accept_requests, 'no', true ) ?>/></td>
|
103 |
</tr>
|
104 |
|
105 |
+
<?php do_action( 'friends_screen_notification_settings' ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
</tbody>
|
108 |
</table>
|
bp-friends/bp-friends-template.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* Output the friends component slug.
|
@@ -26,14 +26,6 @@ function bp_friends_slug() {
|
|
26 |
* @since BuddyPress (1.5.0)
|
27 |
*/
|
28 |
function bp_get_friends_slug() {
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Filters the friends component slug.
|
32 |
-
*
|
33 |
-
* @since BuddyPress (1.5.0)
|
34 |
-
*
|
35 |
-
* @param string $value Friends component slug.
|
36 |
-
*/
|
37 |
return apply_filters( 'bp_get_friends_slug', buddypress()->friends->slug );
|
38 |
}
|
39 |
|
@@ -53,14 +45,6 @@ function bp_friends_root_slug() {
|
|
53 |
* @since BuddyPress (1.5.0)
|
54 |
*/
|
55 |
function bp_get_friends_root_slug() {
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Filters the friends component root slug.
|
59 |
-
*
|
60 |
-
* @since BuddyPress (1.5.0)
|
61 |
-
*
|
62 |
-
* @param string $value Friends component root slug.
|
63 |
-
*/
|
64 |
return apply_filters( 'bp_get_friends_root_slug', buddypress()->friends->root_slug );
|
65 |
}
|
66 |
|
@@ -228,22 +212,10 @@ function bp_member_total_friend_count() {
|
|
228 |
function bp_get_member_total_friend_count() {
|
229 |
global $members_template;
|
230 |
|
231 |
-
if ( 1 == (int) $members_template->member->total_friend_count )
|
232 |
-
|
233 |
-
/**
|
234 |
-
* Filters text used to denote total friend count.
|
235 |
-
*
|
236 |
-
* @since BuddyPress (1.2.0)
|
237 |
-
*
|
238 |
-
* @param string $value String of the form "x friends".
|
239 |
-
* @param int $value Total friend count for current member in the loop.
|
240 |
-
*/
|
241 |
return apply_filters( 'bp_get_member_total_friend_count', sprintf( __( '%d friend', 'buddypress' ), (int) $members_template->member->total_friend_count ) );
|
242 |
-
|
243 |
-
|
244 |
-
/** This filter is documented in bp-friends/bp-friends-template.php */
|
245 |
return apply_filters( 'bp_get_member_total_friend_count', sprintf( __( '%d friends', 'buddypress' ), (int) $members_template->member->total_friend_count ) );
|
246 |
-
}
|
247 |
}
|
248 |
|
249 |
/**
|
@@ -270,16 +242,9 @@ function bp_potential_friend_id( $user_id = 0 ) {
|
|
270 |
|
271 |
if ( empty( $user_id ) && isset( $friends_template->friendship->friend ) )
|
272 |
$user_id = $friends_template->friendship->friend->id;
|
273 |
-
|
274 |
$user_id = bp_displayed_user_id();
|
275 |
|
276 |
-
/**
|
277 |
-
* Filters the ID of current user in the friend request loop.
|
278 |
-
*
|
279 |
-
* @since BuddyPress (1.2.10)
|
280 |
-
*
|
281 |
-
* @param int $user_id ID of current user in the friend request loop.
|
282 |
-
*/
|
283 |
return apply_filters( 'bp_get_potential_friend_id', (int) $user_id );
|
284 |
}
|
285 |
|
@@ -303,13 +268,6 @@ function bp_is_friend( $user_id = 0 ) {
|
|
303 |
if ( bp_loggedin_user_id() == $user_id )
|
304 |
return false;
|
305 |
|
306 |
-
/**
|
307 |
-
* Filters the status of friendship between logged in user and given user.
|
308 |
-
*
|
309 |
-
* @since BuddyPress (1.2.10)
|
310 |
-
*
|
311 |
-
* @param string $value String status of friendship. Possible values are 'is_friend', 'not_friends', 'pending'.
|
312 |
-
*/
|
313 |
return apply_filters( 'bp_is_friend', friends_check_friendship_status( bp_loggedin_user_id(), $user_id ), $user_id );
|
314 |
}
|
315 |
|
@@ -412,13 +370,7 @@ function bp_add_friend_button( $potential_friend_id = 0, $friend_status = false
|
|
412 |
break;
|
413 |
}
|
414 |
|
415 |
-
|
416 |
-
* Filters the HTML for the add friend button.
|
417 |
-
*
|
418 |
-
* @since BuddyPress (1.1.0)
|
419 |
-
*
|
420 |
-
* @param string $button HTML markup for add friend button.
|
421 |
-
*/
|
422 |
return bp_get_button( apply_filters( 'bp_get_add_friend_button', $button ) );
|
423 |
}
|
424 |
|
@@ -470,13 +422,6 @@ function bp_get_friendship_requests( $user_id = 0 ) {
|
|
470 |
$requests = 0;
|
471 |
}
|
472 |
|
473 |
-
/**
|
474 |
-
* Filters the total pending friendship requests for a user.
|
475 |
-
*
|
476 |
-
* @since BuddyPress (1.2.0)
|
477 |
-
*
|
478 |
-
* @param array|int An array of user IDs if found, or a 0 if none are found.
|
479 |
-
*/
|
480 |
return apply_filters( 'bp_get_friendship_requests', $requests );
|
481 |
}
|
482 |
|
@@ -487,7 +432,7 @@ function bp_friend_friendship_id() {
|
|
487 |
echo bp_get_friend_friendship_id();
|
488 |
}
|
489 |
/**
|
490 |
-
* Return the ID of the
|
491 |
*
|
492 |
* @return int ID of the friendship.
|
493 |
*/
|
@@ -499,13 +444,6 @@ function bp_friend_friendship_id() {
|
|
499 |
wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' );
|
500 |
}
|
501 |
|
502 |
-
/**
|
503 |
-
* Filters the ID of the friendship between the logged in user and the current user in the loop.
|
504 |
-
*
|
505 |
-
* @since BuddyPress (1.2.0)
|
506 |
-
*
|
507 |
-
* @param int $friendship_id ID of the friendship.
|
508 |
-
*/
|
509 |
return apply_filters( 'bp_get_friend_friendship_id', $friendship_id );
|
510 |
}
|
511 |
|
@@ -528,13 +466,6 @@ function bp_friend_accept_request_link() {
|
|
528 |
wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' );
|
529 |
}
|
530 |
|
531 |
-
/**
|
532 |
-
* Filters the URL for accepting the current friendship request in the loop.
|
533 |
-
*
|
534 |
-
* @since BuddyPress (1.0.0)
|
535 |
-
*
|
536 |
-
* @param string $value Accept-friendship URL.
|
537 |
-
*/
|
538 |
return apply_filters( 'bp_get_friend_accept_request_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/accept/' . $friendship_id, 'friends_accept_friendship' ) );
|
539 |
}
|
540 |
|
@@ -557,13 +488,6 @@ function bp_friend_reject_request_link() {
|
|
557 |
wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' );
|
558 |
}
|
559 |
|
560 |
-
/**
|
561 |
-
* Filters the URL for rejecting the current friendship request in the loop.
|
562 |
-
*
|
563 |
-
* @since BuddyPress (1.0.0)
|
564 |
-
*
|
565 |
-
* @param string $value Reject-friendship URL.
|
566 |
-
*/
|
567 |
return apply_filters( 'bp_get_friend_reject_request_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/reject/' . $friendship_id, 'friends_reject_friendship' ) );
|
568 |
}
|
569 |
|
@@ -582,14 +506,6 @@ function bp_total_friend_count( $user_id = 0 ) {
|
|
582 |
* @return int Total friend count.
|
583 |
*/
|
584 |
function bp_get_total_friend_count( $user_id = 0 ) {
|
585 |
-
|
586 |
-
/**
|
587 |
-
* Filters the total friend count for a given user.
|
588 |
-
*
|
589 |
-
* @since BuddyPress (1.2.0)
|
590 |
-
*
|
591 |
-
* @param int $value Total friend count.
|
592 |
-
*/
|
593 |
return apply_filters( 'bp_get_total_friend_count', friends_get_total_friend_count( $user_id ) );
|
594 |
}
|
595 |
add_filter( 'bp_get_total_friend_count', 'bp_core_number_format' );
|
@@ -615,13 +531,6 @@ function bp_friend_total_requests_count( $user_id = 0 ) {
|
|
615 |
if ( empty( $user_id ) )
|
616 |
$user_id = bp_loggedin_user_id();
|
617 |
|
618 |
-
/**
|
619 |
-
* Filters the total friendship request count for a given user.
|
620 |
-
*
|
621 |
-
* @since BuddyPress (1.2.0)
|
622 |
-
*
|
623 |
-
* @param int $value Friendship request count.
|
624 |
-
*/
|
625 |
return apply_filters( 'bp_friend_get_total_requests_count', count( BP_Friends_Friendship::get_friend_user_ids( $user_id, true ) ) );
|
626 |
}
|
627 |
|
@@ -675,13 +584,6 @@ function bp_friends_get_profile_stats( $args = '' ) {
|
|
675 |
}
|
676 |
}
|
677 |
|
678 |
-
|
679 |
-
* Filters the number of friends in user's profile.
|
680 |
-
*
|
681 |
-
* @since BuddyPress (2.0.0)
|
682 |
-
*
|
683 |
-
* @param string $value Formatted string displaying total friends count.
|
684 |
-
* @param array $r Array of arguments for string formatting and output.
|
685 |
-
*/
|
686 |
return apply_filters( 'bp_friends_get_profile_stats', $r['output'], $r );
|
687 |
}
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* Output the friends component slug.
|
26 |
* @since BuddyPress (1.5.0)
|
27 |
*/
|
28 |
function bp_get_friends_slug() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
return apply_filters( 'bp_get_friends_slug', buddypress()->friends->slug );
|
30 |
}
|
31 |
|
45 |
* @since BuddyPress (1.5.0)
|
46 |
*/
|
47 |
function bp_get_friends_root_slug() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
return apply_filters( 'bp_get_friends_root_slug', buddypress()->friends->root_slug );
|
49 |
}
|
50 |
|
212 |
function bp_get_member_total_friend_count() {
|
213 |
global $members_template;
|
214 |
|
215 |
+
if ( 1 == (int) $members_template->member->total_friend_count )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
return apply_filters( 'bp_get_member_total_friend_count', sprintf( __( '%d friend', 'buddypress' ), (int) $members_template->member->total_friend_count ) );
|
217 |
+
else
|
|
|
|
|
218 |
return apply_filters( 'bp_get_member_total_friend_count', sprintf( __( '%d friends', 'buddypress' ), (int) $members_template->member->total_friend_count ) );
|
|
|
219 |
}
|
220 |
|
221 |
/**
|
242 |
|
243 |
if ( empty( $user_id ) && isset( $friends_template->friendship->friend ) )
|
244 |
$user_id = $friends_template->friendship->friend->id;
|
245 |
+
else if ( empty( $user_id ) && !isset( $friends_template->friendship->friend ) )
|
246 |
$user_id = bp_displayed_user_id();
|
247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
return apply_filters( 'bp_get_potential_friend_id', (int) $user_id );
|
249 |
}
|
250 |
|
268 |
if ( bp_loggedin_user_id() == $user_id )
|
269 |
return false;
|
270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
return apply_filters( 'bp_is_friend', friends_check_friendship_status( bp_loggedin_user_id(), $user_id ), $user_id );
|
272 |
}
|
273 |
|
370 |
break;
|
371 |
}
|
372 |
|
373 |
+
// Filter and return the HTML button
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
return bp_get_button( apply_filters( 'bp_get_add_friend_button', $button ) );
|
375 |
}
|
376 |
|
422 |
$requests = 0;
|
423 |
}
|
424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
return apply_filters( 'bp_get_friendship_requests', $requests );
|
426 |
}
|
427 |
|
432 |
echo bp_get_friend_friendship_id();
|
433 |
}
|
434 |
/**
|
435 |
+
* Return the ID of the frinedship between the logged-in user and the current user in the loop.
|
436 |
*
|
437 |
* @return int ID of the friendship.
|
438 |
*/
|
444 |
wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' );
|
445 |
}
|
446 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
return apply_filters( 'bp_get_friend_friendship_id', $friendship_id );
|
448 |
}
|
449 |
|
466 |
wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' );
|
467 |
}
|
468 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
469 |
return apply_filters( 'bp_get_friend_accept_request_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/accept/' . $friendship_id, 'friends_accept_friendship' ) );
|
470 |
}
|
471 |
|
488 |
wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' );
|
489 |
}
|
490 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
491 |
return apply_filters( 'bp_get_friend_reject_request_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/reject/' . $friendship_id, 'friends_reject_friendship' ) );
|
492 |
}
|
493 |
|
506 |
* @return int Total friend count.
|
507 |
*/
|
508 |
function bp_get_total_friend_count( $user_id = 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
509 |
return apply_filters( 'bp_get_total_friend_count', friends_get_total_friend_count( $user_id ) );
|
510 |
}
|
511 |
add_filter( 'bp_get_total_friend_count', 'bp_core_number_format' );
|
531 |
if ( empty( $user_id ) )
|
532 |
$user_id = bp_loggedin_user_id();
|
533 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
534 |
return apply_filters( 'bp_friend_get_total_requests_count', count( BP_Friends_Friendship::get_friend_user_ids( $user_id, true ) ) );
|
535 |
}
|
536 |
|
584 |
}
|
585 |
}
|
586 |
|
587 |
+
// Filter and return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
588 |
return apply_filters( 'bp_friends_get_profile_stats', $r['output'], $r );
|
589 |
}
|
bp-friends/bp-friends-widgets.php
CHANGED
@@ -76,13 +76,6 @@ class BP_Core_Friends_Widget extends WP_Widget {
|
|
76 |
$instance['friend_default'] = 'active';
|
77 |
}
|
78 |
|
79 |
-
/**
|
80 |
-
* Filters the Friends widget title.
|
81 |
-
*
|
82 |
-
* @since BuddyPress (1.8.0)
|
83 |
-
*
|
84 |
-
* @param string $title The widget title.
|
85 |
-
*/
|
86 |
$title = apply_filters( 'widget_title', $instance['title'] );
|
87 |
|
88 |
echo $before_widget;
|
@@ -152,7 +145,7 @@ class BP_Core_Friends_Widget extends WP_Widget {
|
|
152 |
* Process a widget save.
|
153 |
*
|
154 |
* @param array $new_instance The parameters saved by the user.
|
155 |
-
* @param array $old_instance The
|
156 |
* @return array $instance The processed settings to save.
|
157 |
*/
|
158 |
function update( $new_instance, $old_instance ) {
|
76 |
$instance['friend_default'] = 'active';
|
77 |
}
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
$title = apply_filters( 'widget_title', $instance['title'] );
|
80 |
|
81 |
echo $before_widget;
|
145 |
* Process a widget save.
|
146 |
*
|
147 |
* @param array $new_instance The parameters saved by the user.
|
148 |
+
* @param array $old_instance The paramaters as previously saved to the database.
|
149 |
* @return array $instance The processed settings to save.
|
150 |
*/
|
151 |
function update( $new_instance, $old_instance ) {
|
bp-friends/js/widget-friends.js
CHANGED
@@ -17,7 +17,7 @@ jQuery(document).ready( function() {
|
|
17 |
function(response)
|
18 |
{
|
19 |
jQuery(link).removeClass('loading');
|
20 |
-
|
21 |
});
|
22 |
|
23 |
return false;
|
@@ -25,7 +25,7 @@ jQuery(document).ready( function() {
|
|
25 |
);
|
26 |
});
|
27 |
|
28 |
-
function
|
29 |
response = response.substr(0, response.length-1);
|
30 |
response = response.split('[[SPLIT]]');
|
31 |
|
17 |
function(response)
|
18 |
{
|
19 |
jQuery(link).removeClass('loading');
|
20 |
+
friend_wiget_response(response);
|
21 |
});
|
22 |
|
23 |
return false;
|
25 |
);
|
26 |
});
|
27 |
|
28 |
+
function friend_wiget_response(response) {
|
29 |
response = response.substr(0, response.length-1);
|
30 |
response = response.split('[[SPLIT]]');
|
31 |
|
bp-friends/js/widget-friends.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
-
function
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
+
function friend_wiget_response(a){a=a.substr(0,a.length-1),a=a.split("[[SPLIT]]"),"-1"!==a[0]?jQuery(".widget ul#friends-list").fadeOut(200,function(){jQuery(".widget ul#friends-list").html(a[1]),jQuery(".widget ul#friends-list").fadeIn(200)}):jQuery(".widget ul#friends-list").fadeOut(200,function(){var b="<p>"+a[1]+"</p>";jQuery(".widget ul#friends-list").html(b),jQuery(".widget ul#friends-list").fadeIn(200)})}jQuery(document).ready(function(){jQuery(".widget div#friends-list-options a").on("click",function(){var a=this;return jQuery(a).addClass("loading"),jQuery(".widget div#friends-list-options a").removeClass("selected"),jQuery(this).addClass("selected"),jQuery.post(ajaxurl,{action:"widget_friends",cookie:encodeURIComponent(document.cookie),_wpnonce:jQuery("input#_wpnonce-friends").val(),"max-friends":jQuery("input#friends_widget_max").val(),filter:jQuery(this).attr("id")},function(b){jQuery(a).removeClass("loading"),friend_wiget_response(b)}),!1})});
|
bp-groups/admin/js/admin.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
!function(a){function b(b,c){a("#bp-groups-new-members-list").append('<li data-login="'+c.item.value+'"><a href="#" class="bp-groups-remove-new-member">x</a> '+c.item.label+"</li>")}var c="undefined"!=typeof group_id?"&group_id="+group_id:"";a(document).ready(function(){window.warn_on_leave=!1,a(".bp-suggest-user").autocomplete({source:ajaxurl+"?action=bp_group_admin_member_autocomplete"+c,delay:500,minLength:2,position:"undefined"!=typeof isRtl&&isRtl?{my:"right top",at:"right bottom",offset:"0, -1"}:{offset:"0, -1"},open:function(){a(this).addClass("open")},close:function(){a(this).removeClass("open"),a(this).val("")},select:function(a,c){b(a,c)}}),a("#bp-groups-new-members").prop("placeholder",BP_Group_Admin.add_member_placeholder),a("#bp_group_add_members").on("click",".bp-groups-remove-new-member",function(b){b.preventDefault(),a(b.target.parentNode).remove()}),a(document).on("change",'input#bp-groups-name, input#bp-groups-description, select.bp-groups-role, #bp-groups-settings-section-status input[type="radio"]',function(){window.warn_on_leave=!0}),a("input#save").on("click",function(){var b=[];a("#bp-groups-new-members-list li").each(function(){b.push(a(this).data("login"))}),b.length&&a("#bp-groups-new-members").val("").val(b.join(", ")),window.warn_on_leave=!1}),window.onbeforeunload=function(){return window.warn_on_leave?BP_Group_Admin.warn_on_leave:void 0}})}(jQuery);
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
!function(a){function b(b,c){a("#bp-groups-new-members-list").append('<li data-login="'+c.item.value+'"><a href="#" class="bp-groups-remove-new-member">x</a> '+c.item.label+"</li>")}var c="undefined"!=typeof group_id?"&group_id="+group_id:"";a(document).ready(function(){window.warn_on_leave=!1,a(".bp-suggest-user").autocomplete({source:ajaxurl+"?action=bp_group_admin_member_autocomplete"+c,delay:500,minLength:2,position:"undefined"!=typeof isRtl&&isRtl?{my:"right top",at:"right bottom",offset:"0, -1"}:{offset:"0, -1"},open:function(){a(this).addClass("open")},close:function(){a(this).removeClass("open"),a(this).val("")},select:function(a,c){b(a,c)}}),a("#bp-groups-new-members").prop("placeholder",BP_Group_Admin.add_member_placeholder),a("#bp_group_add_members").on("click",".bp-groups-remove-new-member",function(b){b.preventDefault(),a(b.target.parentNode).remove()}),a(document).on("change",'input#bp-groups-name, input#bp-groups-description, select.bp-groups-role, #bp-groups-settings-section-status input[type="radio"]',function(){window.warn_on_leave=!0}),a("input#save").on("click",function(){var b=[];a("#bp-groups-new-members-list li").each(function(){b.push(a(this).data("login"))}),b.length&&a("#bp-groups-new-members").val("").val(b.join(", ")),window.warn_on_leave=!1}),window.onbeforeunload=function(){return window.warn_on_leave?BP_Group_Admin.warn_on_leave:void 0}})}(jQuery);
|
bp-groups/bp-groups-actions.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
-
defined( 'ABSPATH' )
|
16 |
|
17 |
/**
|
18 |
* Protect access to single groups.
|
@@ -34,7 +34,7 @@ function bp_groups_group_access_protection() {
|
|
34 |
$user_has_access = true;
|
35 |
|
36 |
// User doesn't have access, so set up redirect args
|
37 |
-
}
|
38 |
$no_access_args = array(
|
39 |
'message' => __( 'You do not have access to this group.', 'buddypress' ),
|
40 |
'root' => bp_get_group_permalink( $current_group ) . 'home/',
|
@@ -163,7 +163,7 @@ function groups_action_create_group() {
|
|
163 |
$new_group_id = isset( $bp->groups->new_group_id ) ? $bp->groups->new_group_id : 0;
|
164 |
|
165 |
if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => bp_core_current_time(), 'status' => 'public' ) ) ) {
|
166 |
-
bp_core_add_message( __( 'There was an error saving group details
|
167 |
bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/' );
|
168 |
}
|
169 |
}
|
@@ -183,11 +183,11 @@ function groups_action_create_group() {
|
|
183 |
|
184 |
if ( 'private' == $_POST['group-status'] )
|
185 |
$group_status = 'private';
|
186 |
-
|
187 |
$group_status = 'hidden';
|
188 |
|
189 |
if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'status' => $group_status, 'enable_forum' => $group_enable_forum ) ) ) {
|
190 |
-
bp_core_add_message( __( 'There was an error saving group details
|
191 |
bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/' );
|
192 |
}
|
193 |
|
@@ -235,10 +235,7 @@ function groups_action_create_group() {
|
|
235 |
unset( $bp->groups->current_create_step );
|
236 |
unset( $bp->groups->completed_create_steps );
|
237 |
|
238 |
-
|
239 |
-
setcookie( 'bp_completed_create_steps', false, time() - 3600, COOKIEPATH );
|
240 |
-
|
241 |
-
// Once we completed all steps, record the group creation in the activity stream.
|
242 |
groups_record_activity( array(
|
243 |
'type' => 'created_group',
|
244 |
'item_id' => $bp->groups->new_group_id
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
16 |
|
17 |
/**
|
18 |
* Protect access to single groups.
|
34 |
$user_has_access = true;
|
35 |
|
36 |
// User doesn't have access, so set up redirect args
|
37 |
+
} else if ( is_user_logged_in() ) {
|
38 |
$no_access_args = array(
|
39 |
'message' => __( 'You do not have access to this group.', 'buddypress' ),
|
40 |
'root' => bp_get_group_permalink( $current_group ) . 'home/',
|
163 |
$new_group_id = isset( $bp->groups->new_group_id ) ? $bp->groups->new_group_id : 0;
|
164 |
|
165 |
if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => bp_core_current_time(), 'status' => 'public' ) ) ) {
|
166 |
+
bp_core_add_message( __( 'There was an error saving group details, please try again.', 'buddypress' ), 'error' );
|
167 |
bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/' );
|
168 |
}
|
169 |
}
|
183 |
|
184 |
if ( 'private' == $_POST['group-status'] )
|
185 |
$group_status = 'private';
|
186 |
+
else if ( 'hidden' == $_POST['group-status'] )
|
187 |
$group_status = 'hidden';
|
188 |
|
189 |
if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'status' => $group_status, 'enable_forum' => $group_enable_forum ) ) ) {
|
190 |
+
bp_core_add_message( __( 'There was an error saving group details, please try again.', 'buddypress' ), 'error' );
|
191 |
bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/' );
|
192 |
}
|
193 |
|
235 |
unset( $bp->groups->current_create_step );
|
236 |
unset( $bp->groups->completed_create_steps );
|
237 |
|
238 |
+
// Once we compelete all steps, record the group creation in the activity stream.
|
|
|
|
|
|
|
239 |
groups_record_activity( array(
|
240 |
'type' => 'created_group',
|
241 |
'item_id' => $bp->groups->new_group_id
|
bp-groups/bp-groups-activity.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
-
defined( 'ABSPATH' )
|
15 |
|
16 |
/**
|
17 |
* Register activity actions for the Groups component.
|
@@ -43,15 +43,6 @@ function groups_register_activity_actions() {
|
|
43 |
array( 'activity', 'group', 'member', 'member_groups' )
|
44 |
);
|
45 |
|
46 |
-
bp_activity_set_action(
|
47 |
-
$bp->groups->id,
|
48 |
-
'group_details_updated',
|
49 |
-
__( 'Group details edited', 'buddypress' ),
|
50 |
-
'bp_groups_format_activity_action_group_details_updated',
|
51 |
-
__( 'Group Updates', 'buddypress' ),
|
52 |
-
array( 'activity', 'group', 'member', 'member_groups' )
|
53 |
-
);
|
54 |
-
|
55 |
// These actions are for the legacy forums
|
56 |
// Since the bbPress plugin also shares the same 'forums' identifier, we also
|
57 |
// check for the legacy forums loader class to be extra cautious
|
@@ -136,51 +127,6 @@ function bp_groups_format_activity_action_joined_group( $action, $activity ) {
|
|
136 |
return apply_filters( 'bp_groups_format_activity_action_joined_group', $action, $activity );
|
137 |
}
|
138 |
|
139 |
-
/**
|
140 |
-
* Format 'group_details_updated' activity actions.
|
141 |
-
*
|
142 |
-
* @since BuddyPress (2.2.0)
|
143 |
-
*
|
144 |
-
* @param string $action Static activity action.
|
145 |
-
* @param object $activity Activity data object.
|
146 |
-
* @return string
|
147 |
-
*/
|
148 |
-
function bp_groups_format_activity_action_group_details_updated( $action, $activity ) {
|
149 |
-
$user_link = bp_core_get_userlink( $activity->user_id );
|
150 |
-
|
151 |
-
$group = groups_get_group( array(
|
152 |
-
'group_id' => $activity->item_id,
|
153 |
-
'populate_extras' => false,
|
154 |
-
) );
|
155 |
-
$group_link = '<a href="' . esc_url( bp_get_group_permalink( $group ) ) . '">' . esc_html( $group->name ) . '</a>';
|
156 |
-
|
157 |
-
/*
|
158 |
-
* Changed group details are stored in groupmeta, keyed by the activity
|
159 |
-
* timestamp. See {@link bp_groups_group_details_updated_add_activity()}.
|
160 |
-
*/
|
161 |
-
$changed = groups_get_groupmeta( $activity->item_id, 'updated_details_' . $activity->date_recorded );
|
162 |
-
|
163 |
-
// No changed details were found, so use a generic message.
|
164 |
-
if ( empty( $changed ) ) {
|
165 |
-
$action = sprintf( __( '%1$s updated details for the group %2$s', 'buddypress' ), $user_link, $group_link );
|
166 |
-
|
167 |
-
// Name and description changed - to keep things short, don't describe changes in detail.
|
168 |
-
} elseif ( isset( $changed['name'] ) && isset( $changed['description'] ) ) {
|
169 |
-
$action = sprintf( __( '%1$s changed the name and description of the group %2$s', 'buddypress' ), $user_link, $group_link );
|
170 |
-
|
171 |
-
// Name only.
|
172 |
-
} elseif ( ! empty( $changed['name']['old'] ) && ! empty( $changed['name']['new'] ) ) {
|
173 |
-
$action = sprintf( __( '%1$s changed the name of the group %2$s from "%3$s" to "%4$s"', 'buddypress' ), $user_link, $group_link, esc_html( $changed['name']['old'] ), esc_html( $changed['name']['new'] ) );
|
174 |
-
|
175 |
-
// Description only.
|
176 |
-
} elseif ( ! empty( $changed['description']['old'] ) && ! empty( $changed['description']['new'] ) ) {
|
177 |
-
$action = sprintf( __( '%1$s changed the description of the group %2$s from "%3$s" to "%4$s"', 'buddypress' ), $user_link, $group_link, esc_html( $changed['description']['old'] ), esc_html( $changed['description']['new'] ) );
|
178 |
-
|
179 |
-
}
|
180 |
-
|
181 |
-
return apply_filters( 'bp_groups_format_activity_action_joined_group', $action, $activity );
|
182 |
-
}
|
183 |
-
|
184 |
/**
|
185 |
* Fetch data related to groups at the beginning of an activity loop.
|
186 |
*
|
@@ -233,68 +179,6 @@ function bp_groups_prefetch_activity_object_data( $activities ) {
|
|
233 |
}
|
234 |
add_filter( 'bp_activity_prefetch_object_data', 'bp_groups_prefetch_activity_object_data' );
|
235 |
|
236 |
-
/**
|
237 |
-
* Set up activity arguments for use with the 'groups' scope.
|
238 |
-
*
|
239 |
-
* @since BuddyPress (2.2.0)
|
240 |
-
*
|
241 |
-
* @param array $retval Empty array by default
|
242 |
-
* @param array $filter Current activity arguments
|
243 |
-
* @return array
|
244 |
-
*/
|
245 |
-
function bp_groups_filter_activity_scope( $retval = array(), $filter = array() ) {
|
246 |
-
|
247 |
-
// Determine the user_id
|
248 |
-
if ( ! empty( $filter['user_id'] ) ) {
|
249 |
-
$user_id = $filter['user_id'];
|
250 |
-
} else {
|
251 |
-
$user_id = bp_displayed_user_id()
|
252 |
-
? bp_displayed_user_id()
|
253 |
-
: bp_loggedin_user_id();
|
254 |
-
}
|
255 |
-
|
256 |
-
// Determine groups of user
|
257 |
-
$groups = groups_get_user_groups( $user_id );
|
258 |
-
if ( empty( $groups['groups'] ) ) {
|
259 |
-
$groups = array( 'groups' => 0 );
|
260 |
-
}
|
261 |
-
|
262 |
-
// Should we show all items regardless of sitewide visibility?
|
263 |
-
$show_hidden = array();
|
264 |
-
if ( ! empty( $user_id ) && ( $user_id !== bp_loggedin_user_id() ) ) {
|
265 |
-
$show_hidden = array(
|
266 |
-
'column' => 'hide_sitewide',
|
267 |
-
'value' => 0
|
268 |
-
);
|
269 |
-
}
|
270 |
-
|
271 |
-
$retval = array(
|
272 |
-
'relation' => 'AND',
|
273 |
-
array(
|
274 |
-
'relation' => 'AND',
|
275 |
-
array(
|
276 |
-
'column' => 'component',
|
277 |
-
'value' => buddypress()->groups->id
|
278 |
-
),
|
279 |
-
array(
|
280 |
-
'column' => 'item_id',
|
281 |
-
'compare' => 'IN',
|
282 |
-
'value' => (array) $groups['groups']
|
283 |
-
),
|
284 |
-
),
|
285 |
-
$show_hidden,
|
286 |
-
|
287 |
-
// overrides
|
288 |
-
'override' => array(
|
289 |
-
'filter' => array( 'user_id' => 0 ),
|
290 |
-
'show_hidden' => true
|
291 |
-
),
|
292 |
-
);
|
293 |
-
|
294 |
-
return $retval;
|
295 |
-
}
|
296 |
-
add_filter( 'bp_activity_set_groups_scope_args', 'bp_groups_filter_activity_scope', 10, 2 );
|
297 |
-
|
298 |
/**
|
299 |
* Record an activity item related to the Groups component.
|
300 |
*
|
@@ -405,78 +289,6 @@ function bp_groups_membership_accepted_add_activity( $user_id, $group_id ) {
|
|
405 |
}
|
406 |
add_action( 'groups_membership_accepted', 'bp_groups_membership_accepted_add_activity', 10, 2 );
|
407 |
|
408 |
-
/**
|
409 |
-
* Add an activity item when a group's details are updated.
|
410 |
-
*
|
411 |
-
* @since BuddyPress (2.2.0)
|
412 |
-
*
|
413 |
-
* @param int $group_id ID of the group.
|
414 |
-
* @param BP_Groups_Group $old_group Group object before the details had been changed.
|
415 |
-
* @param bool $notify_members True if the admin has opted to notify group members, otherwise false.
|
416 |
-
* @return int|bool The ID of the activity on success. False on error.
|
417 |
-
*/
|
418 |
-
function bp_groups_group_details_updated_add_activity( $group_id, $old_group, $notify_members ) {
|
419 |
-
|
420 |
-
// Bail if Activity is not active.
|
421 |
-
if ( ! bp_is_active( 'activity' ) ) {
|
422 |
-
return false;
|
423 |
-
}
|
424 |
-
|
425 |
-
if ( ! isset( $old_group->name ) || ! isset( $old_group->description ) ) {
|
426 |
-
return false;
|
427 |
-
}
|
428 |
-
|
429 |
-
// If the admin has opted not to notify members, don't post an activity item either
|
430 |
-
if ( empty( $notify_members ) ) {
|
431 |
-
return;
|
432 |
-
}
|
433 |
-
|
434 |
-
$group = groups_get_group( array(
|
435 |
-
'group_id' => $group_id,
|
436 |
-
) );
|
437 |
-
|
438 |
-
/*
|
439 |
-
* Store the changed data, which will be used to generate the activity
|
440 |
-
* action. Since we haven't yet created the activity item, we store the
|
441 |
-
* old group data in groupmeta, keyed by the timestamp that we'll put
|
442 |
-
* on the activity item.
|
443 |
-
*/
|
444 |
-
$changed = array();
|
445 |
-
|
446 |
-
if ( $group->name !== $old_group->name ) {
|
447 |
-
$changed['name'] = array(
|
448 |
-
'old' => $old_group->name,
|
449 |
-
'new' => $group->name,
|
450 |
-
);
|
451 |
-
}
|
452 |
-
|
453 |
-
if ( $group->description !== $old_group->description ) {
|
454 |
-
$changed['description'] = array(
|
455 |
-
'old' => $old_group->description,
|
456 |
-
'new' => $group->description,
|
457 |
-
);
|
458 |
-
}
|
459 |
-
|
460 |
-
// If there are no changes, don't post an activity item.
|
461 |
-
if ( empty( $changed ) ) {
|
462 |
-
return;
|
463 |
-
}
|
464 |
-
|
465 |
-
$time = bp_core_current_time();
|
466 |
-
groups_update_groupmeta( $group_id, 'updated_details_' . $time, $changed );
|
467 |
-
|
468 |
-
// Record in activity streams.
|
469 |
-
return groups_record_activity( array(
|
470 |
-
'type' => 'group_details_updated',
|
471 |
-
'item_id' => $group_id,
|
472 |
-
'user_id' => bp_loggedin_user_id(),
|
473 |
-
'recorded_time' => $time,
|
474 |
-
|
475 |
-
) );
|
476 |
-
|
477 |
-
}
|
478 |
-
add_action( 'groups_details_updated', 'bp_groups_group_details_updated_add_activity', 10, 3 );
|
479 |
-
|
480 |
/**
|
481 |
* Delete all activity items related to a specific group.
|
482 |
*
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
/**
|
17 |
* Register activity actions for the Groups component.
|
43 |
array( 'activity', 'group', 'member', 'member_groups' )
|
44 |
);
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
// These actions are for the legacy forums
|
47 |
// Since the bbPress plugin also shares the same 'forums' identifier, we also
|
48 |
// check for the legacy forums loader class to be extra cautious
|
127 |
return apply_filters( 'bp_groups_format_activity_action_joined_group', $action, $activity );
|
128 |
}
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
/**
|
131 |
* Fetch data related to groups at the beginning of an activity loop.
|
132 |
*
|
179 |
}
|
180 |
add_filter( 'bp_activity_prefetch_object_data', 'bp_groups_prefetch_activity_object_data' );
|
181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
/**
|
183 |
* Record an activity item related to the Groups component.
|
184 |
*
|
289 |
}
|
290 |
add_action( 'groups_membership_accepted', 'bp_groups_membership_accepted_add_activity', 10, 2 );
|
291 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
/**
|
293 |
* Delete all activity items related to a specific group.
|
294 |
*
|
bp-groups/bp-groups-admin.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
-
defined( 'ABSPATH' )
|
15 |
|
16 |
// Include WP's list table class
|
17 |
if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
@@ -102,7 +102,7 @@ function bp_groups_admin_load() {
|
|
102 |
|
103 |
bp_core_redirect( $redirect_to );
|
104 |
|
105 |
-
}
|
106 |
// columns screen option
|
107 |
add_screen_option( 'layout_columns', array( 'default' => 2, 'max' => 2, ) );
|
108 |
|
@@ -211,15 +211,6 @@ function bp_groups_admin_load() {
|
|
211 |
// groups_edit_base_group_details()
|
212 |
if ( !groups_edit_base_group_details( $group_id, $_POST['bp-groups-name'], $_POST['bp-groups-description'], 0 ) ) {
|
213 |
$error = $group_id;
|
214 |
-
|
215 |
-
// using negative integers for different error messages... eek!
|
216 |
-
if ( empty( $_POST['bp-groups-name'] ) && empty( $_POST['bp-groups-description'] ) ) {
|
217 |
-
$error = -3;
|
218 |
-
} elseif ( empty( $_POST['bp-groups-name'] ) ) {
|
219 |
-
$error = -1;
|
220 |
-
} elseif ( empty( $_POST['bp-groups-description'] ) ) {
|
221 |
-
$error = -2;
|
222 |
-
}
|
223 |
}
|
224 |
|
225 |
// Enable discussion forum
|
@@ -317,7 +308,7 @@ function bp_groups_admin_load() {
|
|
317 |
|
318 |
if ( 'admin' == $existing_role || 'mod' == $existing_role ) {
|
319 |
$result = groups_demote_member( $user_id, $group_id );
|
320 |
-
}
|
321 |
$result = groups_unban_member( $user_id, $group_id );
|
322 |
}
|
323 |
|
@@ -415,7 +406,7 @@ function bp_groups_admin_screen_options( $value, $option, $new_value ) {
|
|
415 |
}
|
416 |
|
417 |
/**
|
418 |
-
* Select the
|
419 |
*
|
420 |
* @since BuddyPress (1.7.0)
|
421 |
*/
|
@@ -428,7 +419,7 @@ function bp_groups_admin() {
|
|
428 |
bp_groups_admin_edit();
|
429 |
|
430 |
// Display the group deletion confirmation screen
|
431 |
-
}
|
432 |
bp_groups_admin_delete();
|
433 |
|
434 |
// Otherwise, display the groups index screen
|
@@ -464,25 +455,8 @@ function bp_groups_admin_edit() {
|
|
464 |
}
|
465 |
|
466 |
if ( ! empty( $errors ) ) {
|
467 |
-
|
468 |
-
|
469 |
-
$messages[] = __( 'Group name cannot be empty.', 'buddypress' );
|
470 |
-
break;
|
471 |
-
|
472 |
-
case -2 :
|
473 |
-
$messages[] = __( 'Group description cannot be empty.', 'buddypress' );
|
474 |
-
break;
|
475 |
-
|
476 |
-
case -3 :
|
477 |
-
$messages[] = __( 'Group name and description cannot be empty.', 'buddypress' );
|
478 |
-
break;
|
479 |
-
|
480 |
-
default :
|
481 |
-
$messages[] = __( 'An error occurred when trying to update your group details.', 'buddypress' );
|
482 |
-
break;
|
483 |
-
}
|
484 |
-
|
485 |
-
} elseif ( ! empty( $updated ) ) {
|
486 |
$messages[] = __( 'The group has been updated successfully.', 'buddypress' );
|
487 |
}
|
488 |
|
@@ -535,7 +509,7 @@ function bp_groups_admin_edit() {
|
|
535 |
|
536 |
<?php if ( ! empty( $group ) ) : ?>
|
537 |
|
538 |
-
<form action="<?php echo
|
539 |
<div id="poststuff">
|
540 |
|
541 |
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
@@ -627,8 +601,8 @@ function bp_groups_admin_delete() {
|
|
627 |
|
628 |
<p><strong><?php _e( 'This action cannot be undone.', 'buddypress' ) ?></strong></p>
|
629 |
|
630 |
-
<a class="button-primary" href="<?php echo
|
631 |
-
<a class="button" href="<?php echo
|
632 |
</div>
|
633 |
|
634 |
<?php
|
@@ -916,7 +890,7 @@ function bp_groups_admin_edit_metabox_status( $item ) {
|
|
916 |
<div id="submitcomment" class="submitbox">
|
917 |
<div id="major-publishing-actions">
|
918 |
<div id="delete-action">
|
919 |
-
<a class="submitdelete deletion" href="<?php echo
|
920 |
</div>
|
921 |
|
922 |
<div id="publishing-action">
|
@@ -1078,14 +1052,6 @@ class BP_Groups_List_Table extends WP_List_Table {
|
|
1078 |
*/
|
1079 |
public $group_counts = 0;
|
1080 |
|
1081 |
-
/**
|
1082 |
-
* Multidimensional array of group visibility types and their groups.
|
1083 |
-
*
|
1084 |
-
* @link https://buddypress.trac.wordpress.org/ticket/6277
|
1085 |
-
* @var array
|
1086 |
-
*/
|
1087 |
-
public $group_type_ids = array();
|
1088 |
-
|
1089 |
/**
|
1090 |
* Constructor
|
1091 |
*
|
@@ -1177,7 +1143,7 @@ class BP_Groups_List_Table extends WP_List_Table {
|
|
1177 |
$this->group_counts[ $group_type ] = count( $group_ids );
|
1178 |
}
|
1179 |
|
1180 |
-
// If we're viewing a specific group, flatten all
|
1181 |
if ( $include_id ) {
|
1182 |
$groups = array( (array) groups_get_group( 'group_id=' . $include_id ) );
|
1183 |
} else {
|
@@ -1302,10 +1268,10 @@ class BP_Groups_List_Table extends WP_List_Table {
|
|
1302 |
$url_base = bp_get_admin_url( 'admin.php?page=bp-groups' ); ?>
|
1303 |
|
1304 |
<ul class="subsubsub">
|
1305 |
-
<li class="all"><a href="<?php echo esc_url( $url_base ); ?>" class="<?php if ( 'all' == $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
|
1306 |
-
<li class="public"><a href="<?php echo esc_url( add_query_arg( 'group_status', 'public', $url_base ) ); ?>" class="<?php if ( 'public' == $this->view ) echo 'current'; ?>"><?php printf( _n( 'Public <span class="count">(%s)</span>', 'Public <span class="count">(%s)</span>', $this->group_counts['public'], 'buddypress' ), number_format_i18n( $this->group_counts['public'] ) ); ?></a> |</li>
|
1307 |
-
<li class="private"><a href="<?php echo esc_url( add_query_arg( 'group_status', 'private', $url_base ) ); ?>" class="<?php if ( 'private' == $this->view ) echo 'current'; ?>"><?php printf( _n( 'Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', $this->group_counts['private'], 'buddypress' ), number_format_i18n( $this->group_counts['private'] ) ); ?></a> |</li>
|
1308 |
-
<li class="hidden"><a href="<?php echo esc_url( add_query_arg( 'group_status', 'hidden', $url_base ) ); ?>" class="<?php if ( 'hidden' == $this->view ) echo 'current'; ?>"><?php printf( _n( 'Hidden <span class="count">(%s)</span>', 'Hidden <span class="count">(%s)</span>', $this->group_counts['hidden'], 'buddypress' ), number_format_i18n( $this->group_counts['hidden'] ) ); ?></a></li>
|
1309 |
|
1310 |
<?php do_action( 'bp_groups_list_table_get_views', $url_base, $this->view ); ?>
|
1311 |
</ul>
|
@@ -1525,7 +1491,7 @@ class BP_Groups_List_Table extends WP_List_Table {
|
|
1525 |
}
|
1526 |
|
1527 |
/**
|
1528 |
-
* Allow plugins to add their
|
1529 |
*
|
1530 |
* @since BuddyPress 2.0.0
|
1531 |
*
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
// Include WP's list table class
|
17 |
if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
102 |
|
103 |
bp_core_redirect( $redirect_to );
|
104 |
|
105 |
+
} else if ( 'edit' == $doaction && ! empty( $_GET['gid'] ) ) {
|
106 |
// columns screen option
|
107 |
add_screen_option( 'layout_columns', array( 'default' => 2, 'max' => 2, ) );
|
108 |
|
211 |
// groups_edit_base_group_details()
|
212 |
if ( !groups_edit_base_group_details( $group_id, $_POST['bp-groups-name'], $_POST['bp-groups-description'], 0 ) ) {
|
213 |
$error = $group_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
}
|
215 |
|
216 |
// Enable discussion forum
|
308 |
|
309 |
if ( 'admin' == $existing_role || 'mod' == $existing_role ) {
|
310 |
$result = groups_demote_member( $user_id, $group_id );
|
311 |
+
} else if ( 'banned' == $existing_role ) {
|
312 |
$result = groups_unban_member( $user_id, $group_id );
|
313 |
}
|
314 |
|
406 |
}
|
407 |
|
408 |
/**
|
409 |
+
* Select the appropirate Groups admin screen, and output it.
|
410 |
*
|
411 |
* @since BuddyPress (1.7.0)
|
412 |
*/
|
419 |
bp_groups_admin_edit();
|
420 |
|
421 |
// Display the group deletion confirmation screen
|
422 |
+
} else if ( 'delete' == $doaction && ! empty( $_GET['gid'] ) ) {
|
423 |
bp_groups_admin_delete();
|
424 |
|
425 |
// Otherwise, display the groups index screen
|
455 |
}
|
456 |
|
457 |
if ( ! empty( $errors ) ) {
|
458 |
+
$messages[] = __( 'An error occurred when trying to update your group details.', 'buddypress' );
|
459 |
+
} else if ( ! empty( $updated ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
$messages[] = __( 'The group has been updated successfully.', 'buddypress' );
|
461 |
}
|
462 |
|
509 |
|
510 |
<?php if ( ! empty( $group ) ) : ?>
|
511 |
|
512 |
+
<form action="<?php echo esc_attr( $form_url ); ?>" id="bp-groups-edit-form" method="post">
|
513 |
<div id="poststuff">
|
514 |
|
515 |
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
601 |
|
602 |
<p><strong><?php _e( 'This action cannot be undone.', 'buddypress' ) ?></strong></p>
|
603 |
|
604 |
+
<a class="button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'do_delete', 'gid' => implode( ',', $gids ) ), $base_url ), 'bp-groups-delete' ) ?>"><?php _e( 'Delete Permanently', 'buddypress' ) ?></a>
|
605 |
+
<a class="button" href="<?php echo esc_attr( $base_url ); ?>"><?php _e( 'Cancel', 'buddypress' ) ?></a>
|
606 |
</div>
|
607 |
|
608 |
<?php
|
890 |
<div id="submitcomment" class="submitbox">
|
891 |
<div id="major-publishing-actions">
|
892 |
<div id="delete-action">
|
893 |
+
<a class="submitdelete deletion" href="<?php echo wp_nonce_url( add_query_arg( 'action', 'delete', $base_url ), 'bp-groups-delete' ) ?>"><?php _e( 'Delete Group', 'buddypress' ) ?></a>
|
894 |
</div>
|
895 |
|
896 |
<div id="publishing-action">
|
1052 |
*/
|
1053 |
public $group_counts = 0;
|
1054 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1055 |
/**
|
1056 |
* Constructor
|
1057 |
*
|
1143 |
$this->group_counts[ $group_type ] = count( $group_ids );
|
1144 |
}
|
1145 |
|
1146 |
+
// If we're viewing a specific group, flatten all activites into a single array.
|
1147 |
if ( $include_id ) {
|
1148 |
$groups = array( (array) groups_get_group( 'group_id=' . $include_id ) );
|
1149 |
} else {
|
1268 |
$url_base = bp_get_admin_url( 'admin.php?page=bp-groups' ); ?>
|
1269 |
|
1270 |
<ul class="subsubsub">
|
1271 |
+
<li class="all"><a href="<?php echo esc_attr( esc_url( $url_base ) ); ?>" class="<?php if ( 'all' == $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
|
1272 |
+
<li class="public"><a href="<?php echo esc_attr( esc_url( add_query_arg( 'group_status', 'public', $url_base ) ) ); ?>" class="<?php if ( 'public' == $this->view ) echo 'current'; ?>"><?php printf( _n( 'Public <span class="count">(%s)</span>', 'Public <span class="count">(%s)</span>', $this->group_counts['public'], 'buddypress' ), number_format_i18n( $this->group_counts['public'] ) ); ?></a> |</li>
|
1273 |
+
<li class="private"><a href="<?php echo esc_attr( esc_url( add_query_arg( 'group_status', 'private', $url_base ) ) ); ?>" class="<?php if ( 'private' == $this->view ) echo 'current'; ?>"><?php printf( _n( 'Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', $this->group_counts['private'], 'buddypress' ), number_format_i18n( $this->group_counts['private'] ) ); ?></a> |</li>
|
1274 |
+
<li class="hidden"><a href="<?php echo esc_attr( esc_url( add_query_arg( 'group_status', 'hidden', $url_base ) ) ); ?>" class="<?php if ( 'hidden' == $this->view ) echo 'current'; ?>"><?php printf( _n( 'Hidden <span class="count">(%s)</span>', 'Hidden <span class="count">(%s)</span>', $this->group_counts['hidden'], 'buddypress' ), number_format_i18n( $this->group_counts['hidden'] ) ); ?></a></li>
|
1275 |
|
1276 |
<?php do_action( 'bp_groups_list_table_get_views', $url_base, $this->view ); ?>
|
1277 |
</ul>
|
1491 |
}
|
1492 |
|
1493 |
/**
|
1494 |
+
* Allow plugins to add their costum column.
|
1495 |
*
|
1496 |
* @since BuddyPress 2.0.0
|
1497 |
*
|
bp-groups/bp-groups-adminbar.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
-
defined( 'ABSPATH' )
|
14 |
|
15 |
/**
|
16 |
* Add the Group Admin top-level menu when viewing group pages.
|
@@ -23,18 +23,15 @@ defined( 'ABSPATH' ) || exit;
|
|
23 |
* access to group admin options.
|
24 |
*/
|
25 |
function bp_groups_group_admin_menu() {
|
26 |
-
global $wp_admin_bar;
|
27 |
-
$bp = buddypress();
|
28 |
|
29 |
// Only show if viewing a group
|
30 |
-
if ( !
|
31 |
return false;
|
32 |
-
}
|
33 |
|
34 |
// Only show this menu to group admins and super admins
|
35 |
-
if ( !
|
36 |
return false;
|
37 |
-
}
|
38 |
|
39 |
// Unique ID for the 'Edit Group' menu
|
40 |
$bp->group_admin_menu_id = 'group-admin';
|
@@ -46,39 +43,67 @@ function bp_groups_group_admin_menu() {
|
|
46 |
'href' => bp_get_group_permalink( $bp->groups->current_group )
|
47 |
) );
|
48 |
|
49 |
-
//
|
50 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
//
|
53 |
-
if (
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
-
//
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
if ( $menu['show_in_admin_bar'] ) {
|
67 |
-
$title = sprintf( _x( 'Edit Group %s', 'Group WP Admin Bar manage links', 'buddypress' ), $menu['name'] );
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
81 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
}
|
83 |
add_action( 'admin_bar_menu', 'bp_groups_group_admin_menu', 99 );
|
84 |
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
14 |
|
15 |
/**
|
16 |
* Add the Group Admin top-level menu when viewing group pages.
|
23 |
* access to group admin options.
|
24 |
*/
|
25 |
function bp_groups_group_admin_menu() {
|
26 |
+
global $wp_admin_bar, $bp;
|
|
|
27 |
|
28 |
// Only show if viewing a group
|
29 |
+
if ( !bp_is_group() )
|
30 |
return false;
|
|
|
31 |
|
32 |
// Only show this menu to group admins and super admins
|
33 |
+
if ( !bp_current_user_can( 'bp_moderate' ) && !bp_group_is_admin() )
|
34 |
return false;
|
|
|
35 |
|
36 |
// Unique ID for the 'Edit Group' menu
|
37 |
$bp->group_admin_menu_id = 'group-admin';
|
43 |
'href' => bp_get_group_permalink( $bp->groups->current_group )
|
44 |
) );
|
45 |
|
46 |
+
// Group Admin > Edit details
|
47 |
+
$wp_admin_bar->add_menu( array(
|
48 |
+
'parent' => $bp->group_admin_menu_id,
|
49 |
+
'id' => 'edit-details',
|
50 |
+
'title' => __( 'Edit Details', 'buddypress' ),
|
51 |
+
'href' => bp_get_groups_action_link( 'admin/edit-details' )
|
52 |
+
) );
|
53 |
+
|
54 |
+
// Group Admin > Group settings
|
55 |
+
$wp_admin_bar->add_menu( array(
|
56 |
+
'parent' => $bp->group_admin_menu_id,
|
57 |
+
'id' => 'group-settings',
|
58 |
+
'title' => __( 'Edit Settings', 'buddypress' ),
|
59 |
+
'href' => bp_get_groups_action_link( 'admin/group-settings' )
|
60 |
+
) );
|
61 |
|
62 |
+
// Group Admin > Group avatar
|
63 |
+
if ( !(int)bp_get_option( 'bp-disable-avatar-uploads' ) && $bp->avatar->show_avatars ) {
|
64 |
+
$wp_admin_bar->add_menu( array(
|
65 |
+
'parent' => $bp->group_admin_menu_id,
|
66 |
+
'id' => 'group-avatar',
|
67 |
+
'title' => __( 'Edit Profile Photo', 'buddypress' ),
|
68 |
+
'href' => bp_get_groups_action_link( 'admin/group-avatar' )
|
69 |
+
) );
|
70 |
}
|
71 |
|
72 |
+
// Group Admin > Manage invitations
|
73 |
+
if ( bp_is_active( 'friends' ) ) {
|
74 |
+
$wp_admin_bar->add_menu( array(
|
75 |
+
'parent' => $bp->group_admin_menu_id,
|
76 |
+
'id' => 'manage-invitations',
|
77 |
+
'title' => __( 'Manage Invitations', 'buddypress' ),
|
78 |
+
'href' => bp_get_groups_action_link( 'send-invites' )
|
79 |
+
) );
|
80 |
+
}
|
|
|
|
|
81 |
|
82 |
+
// Group Admin > Manage members
|
83 |
+
$wp_admin_bar->add_menu( array(
|
84 |
+
'parent' => $bp->group_admin_menu_id,
|
85 |
+
'id' => 'manage-members',
|
86 |
+
'title' => __( 'Manage Members', 'buddypress' ),
|
87 |
+
'href' => bp_get_groups_action_link( 'admin/manage-members' )
|
88 |
+
) );
|
89 |
|
90 |
+
// Group Admin > Membership Requests
|
91 |
+
if ( bp_get_group_status( $bp->groups->current_group ) == 'private' ) {
|
92 |
+
$wp_admin_bar->add_menu( array(
|
93 |
+
'parent' => $bp->group_admin_menu_id,
|
94 |
+
'id' => 'membership-requests',
|
95 |
+
'title' => __( 'Membership Requests', 'buddypress' ),
|
96 |
+
'href' => bp_get_groups_action_link( 'admin/membership-requests' )
|
97 |
+
) );
|
98 |
}
|
99 |
+
|
100 |
+
// Delete Group
|
101 |
+
$wp_admin_bar->add_menu( array(
|
102 |
+
'parent' => $bp->group_admin_menu_id,
|
103 |
+
'id' => 'delete-group',
|
104 |
+
'title' => __( 'Delete Group', 'buddypress' ),
|
105 |
+
'href' => bp_get_groups_action_link( 'admin/delete-group' )
|
106 |
+
) );
|
107 |
}
|
108 |
add_action( 'admin_bar_menu', 'bp_groups_group_admin_menu', 99 );
|
109 |
|
bp-groups/bp-groups-cache.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
-
defined( 'ABSPATH' )
|
15 |
|
16 |
/**
|
17 |
* Slurp up metadata for a set of groups.
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
/**
|
17 |
* Slurp up metadata for a set of groups.
|
bp-groups/bp-groups-classes.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/**
|
14 |
* BuddyPress Group object.
|
@@ -781,7 +781,7 @@ class BP_Groups_Group {
|
|
781 |
$paged_groups_sql = apply_filters( 'bp_groups_get_paged_groups_sql', join( ' ', (array) $sql ), $sql, $r );
|
782 |
$paged_groups = $wpdb->get_results( $paged_groups_sql );
|
783 |
|
784 |
-
$total_sql['select'] = "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name} g, {$bp->groups->table_name_groupmeta}
|
785 |
|
786 |
if ( ! empty( $r['user_id'] ) ) {
|
787 |
$total_sql['select'] .= ", {$bp->groups->table_name_members} m";
|
@@ -820,8 +820,9 @@ class BP_Groups_Group {
|
|
820 |
$total_sql['where'][] = "g.id NOT IN ({$exclude})";
|
821 |
}
|
822 |
|
823 |
-
$total_sql['where'][] = "g.id =
|
824 |
-
$total_sql['where'][] = "
|
|
|
825 |
|
826 |
$t_sql = $total_sql['select'];
|
827 |
|
@@ -894,12 +895,12 @@ class BP_Groups_Group {
|
|
894 |
// @todo It may be better in the long run to refactor
|
895 |
// the more general query syntax to accord better with
|
896 |
// BP/WP convention
|
897 |
-
preg_match_all( '/JOIN (
|
898 |
-
preg_match_all( '/ON \((
|
899 |
|
900 |
if ( ! empty( $matches_a[1] ) && ! empty( $matches_b[1] ) ) {
|
901 |
$sql_array['join'] = implode( ',', $matches_a[1] ) . ', ';
|
902 |
-
$sql_array['where'] = $meta_sql['where'] . ' AND ' . implode( ' AND ', $matches_b[1] );
|
903 |
}
|
904 |
}
|
905 |
|
@@ -1295,7 +1296,7 @@ class BP_Groups_Group {
|
|
1295 |
$is_member = '1';
|
1296 |
|
1297 |
// invite_sent means the user has been invited
|
1298 |
-
}
|
1299 |
$is_invited = '1';
|
1300 |
|
1301 |
// User has sent request, but has not been confirmed
|
@@ -1611,7 +1612,7 @@ class BP_Group_Member_Query extends BP_User_Query {
|
|
1611 |
$sql['where'][] = "inviter_id = 0";
|
1612 |
|
1613 |
// The string 'any' matches any non-zero value (inviter_id != 0)
|
1614 |
-
}
|
1615 |
$sql['where'][] = "inviter_id != 0";
|
1616 |
|
1617 |
// Assume that a list of inviter IDs has been passed
|
@@ -2773,26 +2774,24 @@ class BP_Groups_Member {
|
|
2773 |
* of arguments to parent::init() to configure your widget. The config array
|
2774 |
* supports the following values:
|
2775 |
* - 'slug' A unique identifier for your extension. This value will be used
|
2776 |
-
* to build URLs, so make it URL-safe
|
2777 |
* - 'name' A translatable name for your extension. This value is used to
|
2778 |
-
|
2779 |
-
|
2780 |
* - 'visibility' Set to 'public' (default) for your extension (the main tab
|
2781 |
* as well as the widget) to be available to anyone who can access the
|
2782 |
* group, 'private' otherwise.
|
2783 |
* - 'nav_item_position' An integer explaining where the nav item should
|
2784 |
-
* appear in the tab list
|
2785 |
* - 'enable_nav_item' Set to true for your extension's main tab to be
|
2786 |
* available to anyone who can access the group.
|
2787 |
* - 'nav_item_name' The translatable text you want to appear in the nav tab.
|
2788 |
* Defaults to the value of 'name'.
|
2789 |
* - 'display_hook' The WordPress action that the widget_display() method is
|
2790 |
-
* hooked to
|
2791 |
* - 'template_file' The template file that will be used to load the content
|
2792 |
* of your main extension tab. Defaults to 'groups/single/plugins.php'.
|
2793 |
-
* - 'screens' A multi-dimensional array, described below
|
2794 |
-
* - 'access' Which users can visit the plugin's tab.
|
2795 |
-
* - 'show_tab' Which users can see the plugin's navigation tab.
|
2796 |
*
|
2797 |
* BP_Group_Extension uses the concept of "settings screens". There are three
|
2798 |
* contexts for settings screens:
|
@@ -2875,7 +2874,7 @@ class BP_Group_Extension {
|
|
2875 |
public $class_reflection = null;
|
2876 |
|
2877 |
/**
|
2878 |
-
* Parsed configuration
|
2879 |
*
|
2880 |
* @since BuddyPress (1.8.0)
|
2881 |
* @access public
|
@@ -3046,7 +3045,7 @@ class BP_Group_Extension {
|
|
3046 |
*/
|
3047 |
|
3048 |
// The content of the group tab
|
3049 |
-
public function display(
|
3050 |
|
3051 |
// Content displayed in a widget sidebar, if applicable
|
3052 |
public function widget_display() {}
|
@@ -3083,9 +3082,7 @@ class BP_Group_Extension {
|
|
3083 |
* parent::init( $args );
|
3084 |
* }
|
3085 |
*
|
3086 |
-
* @since BuddyPress (1.8
|
3087 |
-
* @since BuddyPress (2.1.0) Added 'access' and 'show_tab' arguments
|
3088 |
-
* to $args.
|
3089 |
* @param array $args {
|
3090 |
* Array of initialization arguments.
|
3091 |
* @type string $slug Unique, URL-safe identifier for your
|
@@ -3112,19 +3109,6 @@ class BP_Group_Extension {
|
|
3112 |
* @type array $screens A multi-dimensional array of configuration
|
3113 |
* information for the extension screens. See docblock of
|
3114 |
* {@link BP_Group_Extension} for more details.
|
3115 |
-
* @type string $access Which users can visit the plugin's tab.
|
3116 |
-
* Possible values: 'anyone', 'loggedin', 'member',
|
3117 |
-
* 'mod', 'admin' or 'noone'
|
3118 |
-
* ('member', 'mod', 'admin' refer to user's role in group.)
|
3119 |
-
* Defaults to 'anyone' for public groups and 'member' for
|
3120 |
-
* private groups.
|
3121 |
-
* @type string $show_tab Which users can see the plugin's navigation
|
3122 |
-
* tab.
|
3123 |
-
* Possible values: 'anyone', 'loggedin', 'member',
|
3124 |
-
* 'mod', 'admin' or 'noone'
|
3125 |
-
* ('member', 'mod', 'admin' refer to user's role in group.)
|
3126 |
-
* Defaults to 'anyone' for public groups and 'member' for
|
3127 |
-
* private groups.
|
3128 |
* }
|
3129 |
*/
|
3130 |
public function init( $args = array() ) {
|
@@ -3326,7 +3310,7 @@ class BP_Group_Extension {
|
|
3326 |
* @since BuddyPress (2.1.0)
|
3327 |
*/
|
3328 |
protected function setup_access_settings() {
|
3329 |
-
// Bail if no
|
3330 |
if ( empty( $this->group_id ) ) {
|
3331 |
return;
|
3332 |
}
|
@@ -3386,7 +3370,7 @@ class BP_Group_Extension {
|
|
3386 |
// constructor. So we always trust this value
|
3387 |
$this->params['show_tab'] = 'noone';
|
3388 |
|
3389 |
-
}
|
3390 |
// If enable_nav_item or visibility is passed,
|
3391 |
// we assume this is a legacy extension.
|
3392 |
// Legacy behavior is that enable_nav_item=true +
|
@@ -3516,22 +3500,10 @@ class BP_Group_Extension {
|
|
3516 |
* Hook the main display method, and loads the template file
|
3517 |
*/
|
3518 |
public function _display_hook() {
|
3519 |
-
add_action( 'bp_template_content', array( &$this, '
|
3520 |
bp_core_load_template( apply_filters( 'bp_core_template_plugin', $this->template_file ) );
|
3521 |
}
|
3522 |
|
3523 |
-
/**
|
3524 |
-
* Call the display() method.
|
3525 |
-
*
|
3526 |
-
* We use this wrapper so that we can pass the group_id to the
|
3527 |
-
* display() callback.
|
3528 |
-
*
|
3529 |
-
* @since BuddyPress (2.1.1)
|
3530 |
-
*/
|
3531 |
-
public function call_display() {
|
3532 |
-
$this->display( $this->group_id );
|
3533 |
-
}
|
3534 |
-
|
3535 |
/**
|
3536 |
* Determine whether the current user should see this nav tab.
|
3537 |
*
|
@@ -3665,10 +3637,6 @@ class BP_Group_Extension {
|
|
3665 |
* @since BuddyPress (1.8.0)
|
3666 |
*/
|
3667 |
protected function setup_edit_hooks() {
|
3668 |
-
// Bail if not in a group
|
3669 |
-
if ( ! bp_is_group() ) {
|
3670 |
-
return;
|
3671 |
-
}
|
3672 |
|
3673 |
// Bail if not an edit screen
|
3674 |
if ( ! $this->is_screen_enabled( 'edit' ) || ! bp_is_item_admin() ) {
|
@@ -3678,28 +3646,15 @@ class BP_Group_Extension {
|
|
3678 |
$screen = $this->screens['edit'];
|
3679 |
|
3680 |
$position = isset( $screen['position'] ) ? (int) $screen['position'] : 10;
|
3681 |
-
$position += 40;
|
3682 |
-
|
3683 |
-
$current_group = groups_get_current_group();
|
3684 |
-
$admin_link = trailingslashit( bp_get_group_permalink( $current_group ) . 'admin' );
|
3685 |
-
|
3686 |
-
$subnav_args = array(
|
3687 |
-
'name' => $screen['name'],
|
3688 |
-
'slug' => $screen['slug'],
|
3689 |
-
'parent_slug' => $current_group->slug . '_manage',
|
3690 |
-
'parent_url' => trailingslashit( bp_get_group_permalink( $current_group ) . 'admin' ),
|
3691 |
-
'user_has_access' => bp_is_item_admin(),
|
3692 |
-
'position' => $position,
|
3693 |
-
'screen_function' => 'groups_screen_group_admin',
|
3694 |
-
);
|
3695 |
-
|
3696 |
-
// Should we add a menu to the Group's WP Admin Bar
|
3697 |
-
if ( ! empty( $screen['show_in_admin_bar'] ) ) {
|
3698 |
-
$subnav_args['show_in_admin_bar'] = true;
|
3699 |
-
}
|
3700 |
|
3701 |
-
// Add the tab
|
3702 |
-
bp_core_new_subnav_item(
|
|
|
|
|
|
|
|
|
|
|
|
|
3703 |
|
3704 |
// Catch the edit screen and forward it to the plugin template
|
3705 |
if ( bp_is_groups_component() && bp_is_current_action( 'admin' ) && bp_is_action_variable( $screen['slug'], 0 ) ) {
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/**
|
14 |
* BuddyPress Group object.
|
781 |
$paged_groups_sql = apply_filters( 'bp_groups_get_paged_groups_sql', join( ' ', (array) $sql ), $sql, $r );
|
782 |
$paged_groups = $wpdb->get_results( $paged_groups_sql );
|
783 |
|
784 |
+
$total_sql['select'] = "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name} g, {$bp->groups->table_name_members} gm1, {$bp->groups->table_name_groupmeta} gm2";
|
785 |
|
786 |
if ( ! empty( $r['user_id'] ) ) {
|
787 |
$total_sql['select'] .= ", {$bp->groups->table_name_members} m";
|
820 |
$total_sql['where'][] = "g.id NOT IN ({$exclude})";
|
821 |
}
|
822 |
|
823 |
+
$total_sql['where'][] = "g.id = gm1.group_id";
|
824 |
+
$total_sql['where'][] = "g.id = gm2.group_id";
|
825 |
+
$total_sql['where'][] = "gm2.meta_key = 'last_activity'";
|
826 |
|
827 |
$t_sql = $total_sql['select'];
|
828 |
|
895 |
// @todo It may be better in the long run to refactor
|
896 |
// the more general query syntax to accord better with
|
897 |
// BP/WP convention
|
898 |
+
preg_match_all( '/INNER JOIN (.*) ON/', $meta_sql['join'], $matches_a );
|
899 |
+
preg_match_all( '/ON \((.*)\)/', $meta_sql['join'], $matches_b );
|
900 |
|
901 |
if ( ! empty( $matches_a[1] ) && ! empty( $matches_b[1] ) ) {
|
902 |
$sql_array['join'] = implode( ',', $matches_a[1] ) . ', ';
|
903 |
+
$sql_array['where'] = $meta_sql['where'] . ' AND ' . implode ( ' AND ', $matches_b[1] );
|
904 |
}
|
905 |
}
|
906 |
|
1296 |
$is_member = '1';
|
1297 |
|
1298 |
// invite_sent means the user has been invited
|
1299 |
+
} else if ( $user_status[ $gid ]->invite_sent ) {
|
1300 |
$is_invited = '1';
|
1301 |
|
1302 |
// User has sent request, but has not been confirmed
|
1612 |
$sql['where'][] = "inviter_id = 0";
|
1613 |
|
1614 |
// The string 'any' matches any non-zero value (inviter_id != 0)
|
1615 |
+
} else if ( 'any' === $inviter_id ) {
|
1616 |
$sql['where'][] = "inviter_id != 0";
|
1617 |
|
1618 |
// Assume that a list of inviter IDs has been passed
|
2774 |
* of arguments to parent::init() to configure your widget. The config array
|
2775 |
* supports the following values:
|
2776 |
* - 'slug' A unique identifier for your extension. This value will be used
|
2777 |
+
* to build URLs, so make it URL-safe
|
2778 |
* - 'name' A translatable name for your extension. This value is used to
|
2779 |
+
populate the navigation tab, as well as the default titles for admin/
|
2780 |
+
edit/create tabs.
|
2781 |
* - 'visibility' Set to 'public' (default) for your extension (the main tab
|
2782 |
* as well as the widget) to be available to anyone who can access the
|
2783 |
* group, 'private' otherwise.
|
2784 |
* - 'nav_item_position' An integer explaining where the nav item should
|
2785 |
+
* appear in the tab list
|
2786 |
* - 'enable_nav_item' Set to true for your extension's main tab to be
|
2787 |
* available to anyone who can access the group.
|
2788 |
* - 'nav_item_name' The translatable text you want to appear in the nav tab.
|
2789 |
* Defaults to the value of 'name'.
|
2790 |
* - 'display_hook' The WordPress action that the widget_display() method is
|
2791 |
+
* hooked to
|
2792 |
* - 'template_file' The template file that will be used to load the content
|
2793 |
* of your main extension tab. Defaults to 'groups/single/plugins.php'.
|
2794 |
+
* - 'screens' A multi-dimensional array, described below
|
|
|
|
|
2795 |
*
|
2796 |
* BP_Group_Extension uses the concept of "settings screens". There are three
|
2797 |
* contexts for settings screens:
|
2874 |
public $class_reflection = null;
|
2875 |
|
2876 |
/**
|
2877 |
+
* Parsed configuration paramaters for the extension.
|
2878 |
*
|
2879 |
* @since BuddyPress (1.8.0)
|
2880 |
* @access public
|
3045 |
*/
|
3046 |
|
3047 |
// The content of the group tab
|
3048 |
+
public function display() {}
|
3049 |
|
3050 |
// Content displayed in a widget sidebar, if applicable
|
3051 |
public function widget_display() {}
|
3082 |
* parent::init( $args );
|
3083 |
* }
|
3084 |
*
|
3085 |
+
* @since BuddyPress (1.8)
|
|
|
|
|
3086 |
* @param array $args {
|
3087 |
* Array of initialization arguments.
|
3088 |
* @type string $slug Unique, URL-safe identifier for your
|
3109 |
* @type array $screens A multi-dimensional array of configuration
|
3110 |
* information for the extension screens. See docblock of
|
3111 |
* {@link BP_Group_Extension} for more details.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3112 |
* }
|
3113 |
*/
|
3114 |
public function init( $args = array() ) {
|
3310 |
* @since BuddyPress (2.1.0)
|
3311 |
*/
|
3312 |
protected function setup_access_settings() {
|
3313 |
+
// Bail if no gruop ID is available
|
3314 |
if ( empty( $this->group_id ) ) {
|
3315 |
return;
|
3316 |
}
|
3370 |
// constructor. So we always trust this value
|
3371 |
$this->params['show_tab'] = 'noone';
|
3372 |
|
3373 |
+
} else if ( isset( $this->params_raw['enable_nav_item'] ) || isset( $this->params_raw['visibility'] ) ) {
|
3374 |
// If enable_nav_item or visibility is passed,
|
3375 |
// we assume this is a legacy extension.
|
3376 |
// Legacy behavior is that enable_nav_item=true +
|
3500 |
* Hook the main display method, and loads the template file
|
3501 |
*/
|
3502 |
public function _display_hook() {
|
3503 |
+
add_action( 'bp_template_content', array( &$this, 'display' ) );
|
3504 |
bp_core_load_template( apply_filters( 'bp_core_template_plugin', $this->template_file ) );
|
3505 |
}
|
3506 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3507 |
/**
|
3508 |
* Determine whether the current user should see this nav tab.
|
3509 |
*
|
3637 |
* @since BuddyPress (1.8.0)
|
3638 |
*/
|
3639 |
protected function setup_edit_hooks() {
|
|
|
|
|
|
|
|
|
3640 |
|
3641 |
// Bail if not an edit screen
|
3642 |
if ( ! $this->is_screen_enabled( 'edit' ) || ! bp_is_item_admin() ) {
|
3646 |
$screen = $this->screens['edit'];
|
3647 |
|
3648 |
$position = isset( $screen['position'] ) ? (int) $screen['position'] : 10;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3649 |
|
3650 |
+
// Add the tab
|
3651 |
+
// @todo BP should be using bp_core_new_subnav_item()
|
3652 |
+
add_action( 'groups_admin_tabs', create_function( '$current, $group_slug',
|
3653 |
+
'$selected = "";
|
3654 |
+
if ( "' . esc_attr( $screen['slug'] ) . '" == $current )
|
3655 |
+
$selected = " class=\"current\"";
|
3656 |
+
echo "<li{$selected}><a href=\"' . trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/{$group_slug}/admin/' . esc_attr( $screen['slug'] ) ) . '\">' . esc_attr( $screen['name'] ) . '</a></li>";'
|
3657 |
+
), $position, 2 );
|
3658 |
|
3659 |
// Catch the edit screen and forward it to the plugin template
|
3660 |
if ( bp_is_groups_component() && bp_is_current_action( 'admin' ) && bp_is_action_variable( $screen['slug'], 0 ) ) {
|
bp-groups/bp-groups-filters.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
// Filter bbPress template locations
|
14 |
|
@@ -233,25 +233,3 @@ function groups_filter_forums_root_page_sql( $sql ) {
|
|
233 |
return apply_filters( 'groups_filter_bbpress_root_page_sql', 't.topic_id' );
|
234 |
}
|
235 |
add_filter( 'get_latest_topics_fields', 'groups_filter_forums_root_page_sql' );
|
236 |
-
|
237 |
-
/**
|
238 |
-
* Should BuddyPress load the mentions scripts and related assets, including results to prime the
|
239 |
-
* mentions suggestions?
|
240 |
-
*
|
241 |
-
* @param bool $load_mentions True to load mentions assets, false otherwise.
|
242 |
-
* @param bool $mentions_enabled True if mentions are enabled.
|
243 |
-
* @return bool True if mentions scripts should be loaded.
|
244 |
-
* @since BuddyPress (2.2.0)
|
245 |
-
*/
|
246 |
-
function bp_groups_maybe_load_mentions_scripts( $load_mentions, $mentions_enabled ) {
|
247 |
-
if ( ! $mentions_enabled ) {
|
248 |
-
return $load_mentions;
|
249 |
-
}
|
250 |
-
|
251 |
-
if ( $load_mentions || ( bp_is_group_activity() || bp_is_group_home() ) ) {
|
252 |
-
return true;
|
253 |
-
}
|
254 |
-
|
255 |
-
return $load_mentions;
|
256 |
-
}
|
257 |
-
add_filter( 'bp_activity_maybe_load_mentions_scripts', 'bp_groups_maybe_load_mentions_scripts', 10, 2 );
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
// Filter bbPress template locations
|
14 |
|
233 |
return apply_filters( 'groups_filter_bbpress_root_page_sql', 't.topic_id' );
|
234 |
}
|
235 |
add_filter( 'get_latest_topics_fields', 'groups_filter_forums_root_page_sql' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp-groups/bp-groups-forums.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*/
|
16 |
|
17 |
// Exit if accessed directly
|
18 |
-
defined( 'ABSPATH' )
|
19 |
|
20 |
/**
|
21 |
* Creates a new forum inside a specific BuddyPress group.
|
15 |
*/
|
16 |
|
17 |
// Exit if accessed directly
|
18 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
19 |
|
20 |
/**
|
21 |
* Creates a new forum inside a specific BuddyPress group.
|
bp-groups/bp-groups-functions.php
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
*/
|
14 |
|
15 |
// Exit if accessed directly
|
16 |
-
defined( 'ABSPATH' )
|
17 |
|
18 |
/**
|
19 |
* Check whether there is a Groups directory page in the $bp global.
|
@@ -120,16 +120,12 @@ function groups_create_group( $args = '' ) {
|
|
120 |
}
|
121 |
|
122 |
// Set creator ID
|
123 |
-
if ( $creator_id ) {
|
124 |
$group->creator_id = (int) $creator_id;
|
125 |
-
}
|
126 |
$group->creator_id = bp_loggedin_user_id();
|
127 |
}
|
128 |
|
129 |
-
if ( ! $group->creator_id ) {
|
130 |
-
return false;
|
131 |
-
}
|
132 |
-
|
133 |
// Validate status
|
134 |
if ( ! groups_is_valid_status( $status ) ) {
|
135 |
return false;
|
@@ -190,9 +186,7 @@ function groups_edit_base_group_details( $group_id, $group_name, $group_desc, $n
|
|
190 |
if ( empty( $group_name ) || empty( $group_desc ) )
|
191 |
return false;
|
192 |
|
193 |
-
$group
|
194 |
-
$old_group = clone $group;
|
195 |
-
|
196 |
$group->name = $group_name;
|
197 |
$group->description = $group_desc;
|
198 |
|
@@ -200,19 +194,10 @@ function groups_edit_base_group_details( $group_id, $group_name, $group_desc, $n
|
|
200 |
return false;
|
201 |
|
202 |
if ( $notify_members ) {
|
203 |
-
groups_notification_group_updated( $group->id
|
204 |
}
|
205 |
|
206 |
-
|
207 |
-
* Fired after a group's details are updated.
|
208 |
-
*
|
209 |
-
* @since BuddyPress (2.2.0)
|
210 |
-
*
|
211 |
-
* @param int $value ID of the group.
|
212 |
-
* @param BP_Groups_Group $old_group Group object, before being modified.
|
213 |
-
* @param bool $notify_members Whether to send an email notification to members about the change.
|
214 |
-
*/
|
215 |
-
do_action( 'groups_details_updated', $group->id, $old_group, $notify_members );
|
216 |
|
217 |
return true;
|
218 |
}
|
@@ -409,7 +394,7 @@ function groups_join_group( $group_id, $user_id = 0 ) {
|
|
409 |
|
410 |
// Check if the user has an outstanding request. If so, delete it.
|
411 |
if ( groups_check_for_membership_request( $user_id, $group_id ) )
|
412 |
-
groups_delete_membership_request(
|
413 |
|
414 |
// User is already a member, just return true
|
415 |
if ( groups_is_user_member( $user_id, $group_id ) )
|
@@ -644,9 +629,7 @@ function groups_get_groups( $args = '' ) {
|
|
644 |
* @return int
|
645 |
*/
|
646 |
function groups_get_total_group_count() {
|
647 |
-
|
648 |
-
|
649 |
-
if ( false === $count ) {
|
650 |
$count = BP_Groups_Group::get_total_group_count();
|
651 |
wp_cache_set( 'bp_total_group_count', $count, 'bp' );
|
652 |
}
|
@@ -686,9 +669,7 @@ function groups_total_groups_for_user( $user_id = 0 ) {
|
|
686 |
if ( empty( $user_id ) )
|
687 |
$user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
|
688 |
|
689 |
-
|
690 |
-
|
691 |
-
if ( false === $count ) {
|
692 |
$count = BP_Groups_Member::total_group_count( $user_id );
|
693 |
wp_cache_set( 'bp_total_groups_for_user_' . $user_id, $count, 'bp' );
|
694 |
}
|
@@ -921,7 +902,7 @@ function groups_invite_user( $args = '' ) {
|
|
921 |
groups_accept_membership_request( $membership_id, $user_id, $group_id );
|
922 |
|
923 |
// Otherwise, create a new invitation
|
924 |
-
}
|
925 |
$invite = new BP_Groups_Member;
|
926 |
$invite->group_id = $group_id;
|
927 |
$invite->user_id = $user_id;
|
@@ -976,7 +957,7 @@ function groups_accept_invite( $user_id, $group_id ) {
|
|
976 |
}
|
977 |
|
978 |
if ( groups_check_for_membership_request( $user_id, $group_id ) ) {
|
979 |
-
groups_delete_membership_request(
|
980 |
}
|
981 |
|
982 |
return true;
|
@@ -1062,14 +1043,6 @@ function groups_send_invites( $user_id, $group_id ) {
|
|
1062 |
do_action( 'groups_send_invites', $group_id, $invited_users );
|
1063 |
}
|
1064 |
|
1065 |
-
/**
|
1066 |
-
* Get IDs of users with outstanding invites to a given group from a specified user.
|
1067 |
-
*
|
1068 |
-
* @param int $user_id ID of the inviting user.
|
1069 |
-
* @param int $group_id ID of the group.
|
1070 |
-
* @return array IDs of users who have been invited to the group by the
|
1071 |
-
* user but have not yet accepted.
|
1072 |
-
*/
|
1073 |
function groups_get_invites_for_group( $user_id, $group_id ) {
|
1074 |
return BP_Groups_Group::get_invites( $user_id, $group_id );
|
1075 |
}
|
@@ -1128,7 +1101,7 @@ function groups_promote_member( $user_id, $group_id, $status ) {
|
|
1128 |
}
|
1129 |
|
1130 |
/**
|
1131 |
-
*
|
1132 |
*
|
1133 |
* @param int $user_id ID of the user.
|
1134 |
* @param int $group_id ID of the group.
|
13 |
*/
|
14 |
|
15 |
// Exit if accessed directly
|
16 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
17 |
|
18 |
/**
|
19 |
* Check whether there is a Groups directory page in the $bp global.
|
120 |
}
|
121 |
|
122 |
// Set creator ID
|
123 |
+
if ( ! empty( $creator_id ) ) {
|
124 |
$group->creator_id = (int) $creator_id;
|
125 |
+
} else {
|
126 |
$group->creator_id = bp_loggedin_user_id();
|
127 |
}
|
128 |
|
|
|
|
|
|
|
|
|
129 |
// Validate status
|
130 |
if ( ! groups_is_valid_status( $status ) ) {
|
131 |
return false;
|
186 |
if ( empty( $group_name ) || empty( $group_desc ) )
|
187 |
return false;
|
188 |
|
189 |
+
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
|
|
|
|
190 |
$group->name = $group_name;
|
191 |
$group->description = $group_desc;
|
192 |
|
194 |
return false;
|
195 |
|
196 |
if ( $notify_members ) {
|
197 |
+
groups_notification_group_updated( $group->id );
|
198 |
}
|
199 |
|
200 |
+
do_action( 'groups_details_updated', $group->id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
return true;
|
203 |
}
|
394 |
|
395 |
// Check if the user has an outstanding request. If so, delete it.
|
396 |
if ( groups_check_for_membership_request( $user_id, $group_id ) )
|
397 |
+
groups_delete_membership_request( $user_id, $group_id );
|
398 |
|
399 |
// User is already a member, just return true
|
400 |
if ( groups_is_user_member( $user_id, $group_id ) )
|
629 |
* @return int
|
630 |
*/
|
631 |
function groups_get_total_group_count() {
|
632 |
+
if ( !$count = wp_cache_get( 'bp_total_group_count', 'bp' ) ) {
|
|
|
|
|
633 |
$count = BP_Groups_Group::get_total_group_count();
|
634 |
wp_cache_set( 'bp_total_group_count', $count, 'bp' );
|
635 |
}
|
669 |
if ( empty( $user_id ) )
|
670 |
$user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
|
671 |
|
672 |
+
if ( !$count = wp_cache_get( 'bp_total_groups_for_user_' . $user_id, 'bp' ) ) {
|
|
|
|
|
673 |
$count = BP_Groups_Member::total_group_count( $user_id );
|
674 |
wp_cache_set( 'bp_total_groups_for_user_' . $user_id, $count, 'bp' );
|
675 |
}
|
902 |
groups_accept_membership_request( $membership_id, $user_id, $group_id );
|
903 |
|
904 |
// Otherwise, create a new invitation
|
905 |
+
} else if ( ! groups_is_user_member( $user_id, $group_id ) && ! groups_check_user_has_invite( $user_id, $group_id, 'all' ) ) {
|
906 |
$invite = new BP_Groups_Member;
|
907 |
$invite->group_id = $group_id;
|
908 |
$invite->user_id = $user_id;
|
957 |
}
|
958 |
|
959 |
if ( groups_check_for_membership_request( $user_id, $group_id ) ) {
|
960 |
+
groups_delete_membership_request( $user_id, $group_id );
|
961 |
}
|
962 |
|
963 |
return true;
|
1043 |
do_action( 'groups_send_invites', $group_id, $invited_users );
|
1044 |
}
|
1045 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1046 |
function groups_get_invites_for_group( $user_id, $group_id ) {
|
1047 |
return BP_Groups_Group::get_invites( $user_id, $group_id );
|
1048 |
}
|
1101 |
}
|
1102 |
|
1103 |
/**
|
1104 |
+
* Demone a user to 'member' status within a group.
|
1105 |
*
|
1106 |
* @param int $user_id ID of the user.
|
1107 |
* @param int $group_id ID of the group.
|
bp-groups/bp-groups-loader.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
-
defined( 'ABSPATH' )
|
16 |
|
17 |
class BP_Groups_Component extends BP_Component {
|
18 |
|
@@ -507,57 +507,6 @@ class BP_Groups_Component extends BP_Component {
|
|
507 |
'item_css_id' => 'admin',
|
508 |
'no_access_url' => $group_link,
|
509 |
);
|
510 |
-
|
511 |
-
$admin_link = trailingslashit( $group_link . 'admin' );
|
512 |
-
|
513 |
-
// Common params to all nav items
|
514 |
-
$default_params = array(
|
515 |
-
'parent_url' => $admin_link,
|
516 |
-
'parent_slug' => $this->current_group->slug . '_manage',
|
517 |
-
'screen_function' => 'groups_screen_group_admin',
|
518 |
-
'user_has_access' => bp_is_item_admin(),
|
519 |
-
'show_in_admin_bar' => true,
|
520 |
-
);
|
521 |
-
|
522 |
-
$sub_nav[] = array_merge( array(
|
523 |
-
'name' => __( 'Details', 'buddypress' ),
|
524 |
-
'slug' => 'edit-details',
|
525 |
-
'position' => 0,
|
526 |
-
), $default_params );
|
527 |
-
|
528 |
-
$sub_nav[] = array_merge( array(
|
529 |
-
'name' => __( 'Settings', 'buddypress' ),
|
530 |
-
'slug' => 'group-settings',
|
531 |
-
'position' => 10,
|
532 |
-
), $default_params );
|
533 |
-
|
534 |
-
if ( ! (int) bp_get_option( 'bp-disable-avatar-uploads' ) && buddypress()->avatar->show_avatars ) {
|
535 |
-
$sub_nav[] = array_merge( array(
|
536 |
-
'name' => __( 'Photo', 'buddypress' ),
|
537 |
-
'slug' => 'group-avatar',
|
538 |
-
'position' => 20,
|
539 |
-
), $default_params );
|
540 |
-
}
|
541 |
-
|
542 |
-
$sub_nav[] = array_merge( array(
|
543 |
-
'name' => __( 'Members', 'buddypress' ),
|
544 |
-
'slug' => 'manage-members',
|
545 |
-
'position' => 30,
|
546 |
-
), $default_params );
|
547 |
-
|
548 |
-
if ( 'private' == $this->current_group->status ) {
|
549 |
-
$sub_nav[] = array_merge( array(
|
550 |
-
'name' => __( 'Requests', 'buddypress' ),
|
551 |
-
'slug' => 'membership-requests',
|
552 |
-
'position' => 40,
|
553 |
-
), $default_params );
|
554 |
-
}
|
555 |
-
|
556 |
-
$sub_nav[] = array_merge( array(
|
557 |
-
'name' => __( 'Delete', 'buddypress' ),
|
558 |
-
'slug' => 'delete-group',
|
559 |
-
'position' => 1000,
|
560 |
-
), $default_params );
|
561 |
}
|
562 |
|
563 |
parent::setup_nav( $main_nav, $sub_nav );
|
@@ -648,7 +597,7 @@ class BP_Groups_Component extends BP_Component {
|
|
648 |
if ( bp_is_my_profile() && !bp_is_single_item() ) {
|
649 |
$bp->bp_options_title = _x( 'Memberships', 'My Groups page <title>', 'buddypress' );
|
650 |
|
651 |
-
}
|
652 |
$bp->bp_options_avatar = bp_core_fetch_avatar( array(
|
653 |
'item_id' => bp_displayed_user_id(),
|
654 |
'type' => 'thumb',
|
@@ -658,7 +607,7 @@ class BP_Groups_Component extends BP_Component {
|
|
658 |
|
659 |
// We are viewing a single group, so set up the
|
660 |
// group navigation menu using the $this->current_group global.
|
661 |
-
}
|
662 |
$bp->bp_options_title = $this->current_group->name;
|
663 |
$bp->bp_options_avatar = bp_core_fetch_avatar( array(
|
664 |
'item_id' => $this->current_group->id,
|
@@ -676,24 +625,6 @@ class BP_Groups_Component extends BP_Component {
|
|
676 |
|
677 |
parent::setup_title();
|
678 |
}
|
679 |
-
|
680 |
-
/**
|
681 |
-
* Setup cache groups
|
682 |
-
*
|
683 |
-
* @since BuddyPress (2.2.0)
|
684 |
-
*/
|
685 |
-
public function setup_cache_groups() {
|
686 |
-
|
687 |
-
// Global groups
|
688 |
-
wp_cache_add_global_groups( array(
|
689 |
-
'bp_groups',
|
690 |
-
'bp_group_admins',
|
691 |
-
'bp_group_invite_count',
|
692 |
-
'group_meta'
|
693 |
-
) );
|
694 |
-
|
695 |
-
parent::setup_cache_groups();
|
696 |
-
}
|
697 |
}
|
698 |
|
699 |
/**
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
16 |
|
17 |
class BP_Groups_Component extends BP_Component {
|
18 |
|
507 |
'item_css_id' => 'admin',
|
508 |
'no_access_url' => $group_link,
|
509 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
}
|
511 |
|
512 |
parent::setup_nav( $main_nav, $sub_nav );
|
597 |
if ( bp_is_my_profile() && !bp_is_single_item() ) {
|
598 |
$bp->bp_options_title = _x( 'Memberships', 'My Groups page <title>', 'buddypress' );
|
599 |
|
600 |
+
} else if ( !bp_is_my_profile() && !bp_is_single_item() ) {
|
601 |
$bp->bp_options_avatar = bp_core_fetch_avatar( array(
|
602 |
'item_id' => bp_displayed_user_id(),
|
603 |
'type' => 'thumb',
|
607 |
|
608 |
// We are viewing a single group, so set up the
|
609 |
// group navigation menu using the $this->current_group global.
|
610 |
+
} else if ( bp_is_single_item() ) {
|
611 |
$bp->bp_options_title = $this->current_group->name;
|
612 |
$bp->bp_options_avatar = bp_core_fetch_avatar( array(
|
613 |
'item_id' => $this->current_group->id,
|
625 |
|
626 |
parent::setup_title();
|
627 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
628 |
}
|
629 |
|
630 |
/**
|
bp-groups/bp-groups-notifications.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
-
defined( 'ABSPATH' )
|
15 |
|
16 |
/** Emails ********************************************************************/
|
17 |
|
@@ -21,46 +21,10 @@ defined( 'ABSPATH' ) || exit;
|
|
21 |
* @since BuddyPress (1.0.0)
|
22 |
*
|
23 |
* @param int $group_id ID of the group.
|
24 |
-
* @param BP_Groups_Group $old_group Group before new details were saved.
|
25 |
*/
|
26 |
-
function groups_notification_group_updated( $group_id = 0
|
27 |
-
|
28 |
-
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
29 |
-
|
30 |
-
if ( $old_group instanceof BP_Groups_Group ) {
|
31 |
-
$changed = array();
|
32 |
-
|
33 |
-
if ( $group->name !== $old_group->name ) {
|
34 |
-
$changed[] = sprintf(
|
35 |
-
_x( '* Name changed from "%s" to "%s"', 'Group update email text', 'buddypress' ),
|
36 |
-
esc_html( $old_group->name ),
|
37 |
-
esc_html( $group->name )
|
38 |
-
);
|
39 |
-
}
|
40 |
-
|
41 |
-
if ( $group->description !== $old_group->description ) {
|
42 |
-
$changed[] = sprintf(
|
43 |
-
_x( '* Description changed from "%s" to "%s"', 'Group update email text', 'buddypress' ),
|
44 |
-
esc_html( $old_group->description ),
|
45 |
-
esc_html( $group->description )
|
46 |
-
);
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Filters the bullet points listing updated items in the email notification after a group is updated.
|
52 |
-
*
|
53 |
-
* @since BuddyPress (2.2.0)
|
54 |
-
*
|
55 |
-
* @param array $changed Array of bullet points.
|
56 |
-
*/
|
57 |
-
$changed = apply_filters( 'groups_notification_group_update_updated_items', $changed );
|
58 |
-
|
59 |
-
$changed_text = '';
|
60 |
-
if ( ! empty( $changed ) ) {
|
61 |
-
$changed_text = "\n\n" . implode( "\n", $changed );
|
62 |
-
}
|
63 |
|
|
|
64 |
$subject = bp_get_email_subject( array( 'text' => __( 'Group Details Updated', 'buddypress' ) ) );
|
65 |
$user_ids = BP_Groups_Member::get_group_member_ids( $group->id );
|
66 |
|
@@ -81,12 +45,12 @@ function groups_notification_group_updated( $group_id = 0, $old_group = null ) {
|
|
81 |
$settings_link = bp_core_get_user_domain( $user_id ) . $settings_slug . '/notifications/';
|
82 |
|
83 |
$message = sprintf( __(
|
84 |
-
'Group details for the group "%1$s" were updated:
|
85 |
|
86 |
-
To view the group: %
|
87 |
|
88 |
---------------------
|
89 |
-
', 'buddypress' ), $group->name, $
|
90 |
|
91 |
$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
|
92 |
|
@@ -147,32 +111,11 @@ function groups_notification_new_membership_request( $requesting_user_id = 0, $a
|
|
147 |
// Link to the group administrator email settings: %s in "disable notifications" part of the email
|
148 |
$settings_link = bp_core_get_user_domain( $admin_id ) . $settings_slug . '/notifications/';
|
149 |
|
150 |
-
// Fetch the message, if there's one to fetch.
|
151 |
-
$membership = new BP_Groups_Member( false, false, $membership_id );
|
152 |
-
|
153 |
// Set up and send the message
|
154 |
$to = $ud->user_email;
|
155 |
$subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group: %s', 'buddypress' ), $group->name ) ) );
|
156 |
|
157 |
-
|
158 |
-
$message = sprintf( __(
|
159 |
-
'%1$s wants to join the group "%2$s".
|
160 |
-
|
161 |
-
Message from %1$s: "%3$s"
|
162 |
-
|
163 |
-
Because you are the administrator of this group, you must either accept or reject the membership request.
|
164 |
-
|
165 |
-
To view all pending membership requests for this group, please visit:
|
166 |
-
%4$s
|
167 |
-
|
168 |
-
To view %5$s\'s profile: %6$s
|
169 |
-
|
170 |
-
---------------------
|
171 |
-
', 'buddypress' ), $requesting_user_name, $group->name, esc_html( $membership->comments ), $group_requests, $requesting_user_name, $profile_link );
|
172 |
-
|
173 |
-
} else {
|
174 |
-
|
175 |
-
$message = sprintf( __(
|
176 |
'%1$s wants to join the group "%2$s".
|
177 |
|
178 |
Because you are the administrator of this group, you must either accept or reject the membership request.
|
@@ -184,7 +127,6 @@ To view %4$s\'s profile: %5$s
|
|
184 |
|
185 |
---------------------
|
186 |
', 'buddypress' ), $requesting_user_name, $group->name, $group_requests, $requesting_user_name, $profile_link );
|
187 |
-
}
|
188 |
|
189 |
// Only show the disable notifications line if the settings component is enabled
|
190 |
if ( bp_is_active( 'settings' ) ) {
|
@@ -451,50 +393,19 @@ function groups_format_notifications( $action, $item_id, $secondary_item_id, $to
|
|
451 |
|
452 |
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
453 |
$group_link = bp_get_group_permalink( $group );
|
454 |
-
$amount = 'single';
|
455 |
|
456 |
// Set up the string and the filter
|
457 |
// Because different values are passed to the filters, we'll return the
|
458 |
// values inline
|
459 |
if ( (int) $total_items > 1 ) {
|
460 |
$text = sprintf( __( '%1$d new membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );
|
461 |
-
$
|
462 |
$notification_link = $group_link . 'admin/membership-requests/?n=1';
|
463 |
|
464 |
if ( 'string' == $format ) {
|
465 |
-
|
466 |
-
* Filters groups multiple new membership request notification for string format.
|
467 |
-
*
|
468 |
-
* This is a dynamic filter that is dependent on item count and action.
|
469 |
-
* Complete filter - bp_groups_multiple_new_membership_requests_notification.
|
470 |
-
*
|
471 |
-
* @since BuddyPress (1.0.0)
|
472 |
-
*
|
473 |
-
* @param string $string HTML anchor tag for request.
|
474 |
-
* @param string $group_link The permalink for the group.
|
475 |
-
* @param int $total_items Total number of membership requests.
|
476 |
-
* @param string $group->name Name of the group.
|
477 |
-
* @param string $text Notification content.
|
478 |
-
* @param string $notification_link The permalink for notification.
|
479 |
-
*/
|
480 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . 's_notification', '<a href="' . $notification_link . '" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . $text . '</a>', $group_link, $total_items, $group->name, $text, $notification_link );
|
481 |
} else {
|
482 |
-
|
483 |
-
* Filters groups multiple new membership request notification for any non-string format.
|
484 |
-
*
|
485 |
-
* This is a dynamic filter that is dependent on item count and action.
|
486 |
-
* Complete filter - bp_groups_multiple_new_membership_requests_notification.
|
487 |
-
*
|
488 |
-
* @since BuddyPress (1.0.0)
|
489 |
-
*
|
490 |
-
* @param array $array Array holding permalink and content for notification.
|
491 |
-
* @param string $group_link The permalink for the group.
|
492 |
-
* @param int $total_items Total number of membership requests.
|
493 |
-
* @param string $group->name Name of the group.
|
494 |
-
* @param string $text Notification content.
|
495 |
-
* @param string $notification_link The permalink for notification.
|
496 |
-
*/
|
497 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . 's_notification', array(
|
498 |
'link' => $notification_link,
|
499 |
'text' => $text
|
500 |
), $group_link, $total_items, $group->name, $text, $notification_link );
|
@@ -502,42 +413,13 @@ function groups_format_notifications( $action, $item_id, $secondary_item_id, $to
|
|
502 |
} else {
|
503 |
$user_fullname = bp_core_get_user_displayname( $requesting_user_id );
|
504 |
$text = sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname );
|
|
|
505 |
$notification_link = $group_link . 'admin/membership-requests/?n=1';
|
506 |
|
507 |
if ( 'string' == $format ) {
|
508 |
-
|
509 |
-
* Filters groups single new membership request notification for string format.
|
510 |
-
*
|
511 |
-
* This is a dynamic filter that is dependent on item count and action.
|
512 |
-
* Complete filter - bp_groups_single_new_membership_request_notification.
|
513 |
-
*
|
514 |
-
* @since BuddyPress (1.0.0)
|
515 |
-
*
|
516 |
-
* @param string $string HTML anchor tag for request.
|
517 |
-
* @param string $group_link The permalink for the group.
|
518 |
-
* @param string $user_fullname Full name of requesting user.
|
519 |
-
* @param string $group->name Name of the group.
|
520 |
-
* @param string $text Notification content.
|
521 |
-
* @param string $notification_link The permalink for notification.
|
522 |
-
*/
|
523 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname ) . '">' . $text . '</a>', $group_link, $user_fullname, $group->name, $text, $notification_link );
|
524 |
} else {
|
525 |
-
|
526 |
-
* Filters groups single new membership request notification for any non-string format.
|
527 |
-
*
|
528 |
-
* This is a dynamic filter that is dependent on item count and action.
|
529 |
-
* Complete filter - bp_groups_single_new_membership_request_notification.
|
530 |
-
*
|
531 |
-
* @since BuddyPress (1.0.0)
|
532 |
-
*
|
533 |
-
* @param array $array Array holding permalink and content for notification.
|
534 |
-
* @param string $group_link The permalink for the group.
|
535 |
-
* @param string $user_fullname Full name of requesting user.
|
536 |
-
* @param string $group->name Name of the group.
|
537 |
-
* @param string $text Notification content.
|
538 |
-
* @param string $notification_link The permalink for notification.
|
539 |
-
*/
|
540 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
|
541 |
'link' => $notification_link,
|
542 |
'text' => $text
|
543 |
), $group_link, $user_fullname, $group->name, $text, $notification_link );
|
@@ -551,41 +433,16 @@ function groups_format_notifications( $action, $item_id, $secondary_item_id, $to
|
|
551 |
|
552 |
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
553 |
$group_link = bp_get_group_permalink( $group );
|
554 |
-
$amount = 'single';
|
555 |
|
556 |
if ( (int) $total_items > 1 ) {
|
557 |
$text = sprintf( __( '%d accepted group membership requests', 'buddypress' ), (int) $total_items, $group->name );
|
558 |
-
$
|
559 |
$notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
|
560 |
|
561 |
if ( 'string' == $format ) {
|
562 |
-
|
563 |
-
* Filters multiple accepted group membership requests notification for string format.
|
564 |
-
* Complete filter - bp_groups_multiple_membership_request_accepted_notification.
|
565 |
-
*
|
566 |
-
* @since BuddyPress (1.0.0)
|
567 |
-
*
|
568 |
-
* @param string $string HTML anchor tag for notification.
|
569 |
-
* @param int $total_items Total number of accepted requests.
|
570 |
-
* @param string $group->name Name of the group.
|
571 |
-
* @param string $text Notification content.
|
572 |
-
* @param string $notification_link The permalink for notification.
|
573 |
-
*/
|
574 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $group->name, $text, $notification_link );
|
575 |
} else {
|
576 |
-
|
577 |
-
* Filters multiple accepted group membership requests notification for non-string format.
|
578 |
-
* Complete filter - bp_groups_multiple_membership_request_accepted_notification.
|
579 |
-
*
|
580 |
-
* @since BuddyPress (1.0.0)
|
581 |
-
*
|
582 |
-
* @param array $array Array holding permalink and content for notification
|
583 |
-
* @param int $total_items Total number of accepted requests.
|
584 |
-
* @param string $group->name Name of the group.
|
585 |
-
* @param string $text Notification content.
|
586 |
-
* @param string $notification_link The permalink for notification.
|
587 |
-
*/
|
588 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
|
589 |
'link' => $notification_link,
|
590 |
'text' => $text
|
591 |
), $total_items, $group->name, $text, $notification_link );
|
@@ -596,32 +453,8 @@ function groups_format_notifications( $action, $item_id, $secondary_item_id, $to
|
|
596 |
$notification_link = $group_link . '?n=1';
|
597 |
|
598 |
if ( 'string' == $format ) {
|
599 |
-
|
600 |
-
* Filters single accepted group membership request notification for string format.
|
601 |
-
* Complete filter - bp_groups_single_membership_request_accepted_notification.
|
602 |
-
*
|
603 |
-
* @since BuddyPress (1.0.0)
|
604 |
-
*
|
605 |
-
* @param string $string HTML anchor tag for notification.
|
606 |
-
* @param string $group_link The permalink for the group.
|
607 |
-
* @param string $group->name Name of the group.
|
608 |
-
* @param string $text Notification content.
|
609 |
-
* @param string $notification_link The permalink for notification.
|
610 |
-
*/
|
611 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
|
612 |
} else {
|
613 |
-
/**
|
614 |
-
* Filters single accepted group membership request notification for non-string format.
|
615 |
-
* Complete filter - bp_groups_single_membership_request_accepted_notification.
|
616 |
-
*
|
617 |
-
* @since BuddyPress (1.0.0)
|
618 |
-
*
|
619 |
-
* @param array $array Array holding permalink and content for notification.
|
620 |
-
* @param string $group_link The permalink for the group.
|
621 |
-
* @param string $group->name Name of the group.
|
622 |
-
* @param string $text Notification content.
|
623 |
-
* @param string $notification_link The permalink for notification.
|
624 |
-
*/
|
625 |
return apply_filters( $filter, array(
|
626 |
'link' => $notification_link,
|
627 |
'text' => $text
|
@@ -636,77 +469,29 @@ function groups_format_notifications( $action, $item_id, $secondary_item_id, $to
|
|
636 |
|
637 |
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
638 |
$group_link = bp_get_group_permalink( $group );
|
639 |
-
$amount = 'single';
|
640 |
|
641 |
if ( (int) $total_items > 1 ) {
|
642 |
$text = sprintf( __( '%d rejected group membership requests', 'buddypress' ), (int) $total_items, $group->name );
|
643 |
-
$
|
644 |
$notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
|
645 |
|
646 |
if ( 'string' == $format ) {
|
647 |
-
|
648 |
-
* Filters multiple rejected group membership requests notification for string format.
|
649 |
-
* Complete filter - bp_groups_multiple_membership_request_rejected_notification.
|
650 |
-
*
|
651 |
-
* @since BuddyPress (1.0.0)
|
652 |
-
*
|
653 |
-
* @param string $string HTML anchor tag for notification.
|
654 |
-
* @param int $total_items Total number of rejected requests.
|
655 |
-
* @param string $group->name Name of the group.
|
656 |
-
* @param string $text Notification content.
|
657 |
-
* @param string $notification_link The permalink for notification.
|
658 |
-
*/
|
659 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $group->name );
|
660 |
} else {
|
661 |
-
|
662 |
-
* Filters multiple rejected group membership requests notification for non-string format.
|
663 |
-
* Complete filter - bp_groups_multiple_membership_request_rejected_notification.
|
664 |
-
*
|
665 |
-
* @since BuddyPress (1.0.0)
|
666 |
-
*
|
667 |
-
* @param array $array Array holding permalink and content for notification.
|
668 |
-
* @param int $total_items Total number of rejected requests.
|
669 |
-
* @param string $group->name Name of the group.
|
670 |
-
* @param string $text Notification content.
|
671 |
-
* @param string $notification_link The permalink for notification.
|
672 |
-
*/
|
673 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
|
674 |
'link' => $notification_link,
|
675 |
'text' => $text
|
676 |
), $total_items, $group->name, $text, $notification_link );
|
677 |
}
|
678 |
} else {
|
679 |
$text = sprintf( __( 'Membership for group "%s" rejected', 'buddypress' ), $group->name );
|
|
|
680 |
$notification_link = $group_link . '?n=1';
|
681 |
|
682 |
if ( 'string' == $format ) {
|
683 |
-
|
684 |
-
* Filters single rejected group membership requests notification for string format.
|
685 |
-
* Complete filter - bp_groups_single_membership_request_rejected_notification.
|
686 |
-
*
|
687 |
-
* @since BuddyPress (1.0.0)
|
688 |
-
*
|
689 |
-
* @param string $string HTML anchor tag for notification.
|
690 |
-
* @param int $group_link The permalink for the group.
|
691 |
-
* @param string $group->name Name of the group.
|
692 |
-
* @param string $text Notification content.
|
693 |
-
* @param string $notification_link The permalink for notification.
|
694 |
-
*/
|
695 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
|
696 |
} else {
|
697 |
-
|
698 |
-
* Filters single rejected group membership requests notification for non-string format.
|
699 |
-
* Complete filter - bp_groups_single_membership_request_rejected_notification.
|
700 |
-
*
|
701 |
-
* @since BuddyPress (1.0.0)
|
702 |
-
*
|
703 |
-
* @param array $array Array holding permalink and content for notification.
|
704 |
-
* @param int $group_link The permalink for the group.
|
705 |
-
* @param string $group->name Name of the group.
|
706 |
-
* @param string $text Notification content.
|
707 |
-
* @param string $notification_link The permalink for notification.
|
708 |
-
*/
|
709 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
|
710 |
'link' => $notification_link,
|
711 |
'text' => $text
|
712 |
), $group_link, $group->name, $text, $notification_link );
|
@@ -720,75 +505,29 @@ function groups_format_notifications( $action, $item_id, $secondary_item_id, $to
|
|
720 |
|
721 |
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
722 |
$group_link = bp_get_group_permalink( $group );
|
723 |
-
$amount = 'single';
|
724 |
|
725 |
if ( (int) $total_items > 1 ) {
|
726 |
$text = sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int) $total_items );
|
727 |
-
$
|
728 |
$notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
|
729 |
|
730 |
if ( 'string' == $format ) {
|
731 |
-
|
732 |
-
* Filters multiple promoted to group admin notification for string format.
|
733 |
-
* Complete filter - bp_groups_multiple_member_promoted_to_admin_notification.
|
734 |
-
*
|
735 |
-
* @since BuddyPress (1.0.0)
|
736 |
-
*
|
737 |
-
* @param string $string HTML anchor tag for notification.
|
738 |
-
* @param int $total_items Total number of rejected requests.
|
739 |
-
* @param string $text Notification content.
|
740 |
-
* @param string $notification_link The permalink for notification.
|
741 |
-
*/
|
742 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $text, $notification_link );
|
743 |
} else {
|
744 |
-
|
745 |
-
* Filters multiple promoted to group admin notification for non-string format.
|
746 |
-
* Complete filter - bp_groups_multiple_member_promoted_to_admin_notification.
|
747 |
-
*
|
748 |
-
* @since BuddyPress (1.0.0)
|
749 |
-
*
|
750 |
-
* @param array $array Array holding permalink and content for notification.
|
751 |
-
* @param int $total_items Total number of rejected requests.
|
752 |
-
* @param string $text Notification content.
|
753 |
-
* @param string $notification_link The permalink for notification.
|
754 |
-
*/
|
755 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
|
756 |
'link' => $notification_link,
|
757 |
'text' => $text
|
758 |
), $total_items, $text, $notification_link );
|
759 |
}
|
760 |
} else {
|
761 |
$text = sprintf( __( 'You were promoted to an admin in the group "%s"', 'buddypress' ), $group->name );
|
|
|
762 |
$notification_link = $group_link . '?n=1';
|
763 |
|
764 |
if ( 'string' == $format ) {
|
765 |
-
|
766 |
-
* Filters single promoted to group admin notification for non-string format.
|
767 |
-
* Complete filter - bp_groups_single_member_promoted_to_admin_notification.
|
768 |
-
*
|
769 |
-
* @since BuddyPress (1.0.0)
|
770 |
-
*
|
771 |
-
* @param string $string HTML anchor tag for notification.
|
772 |
-
* @param int $group_link The permalink for the group.
|
773 |
-
* @param string $group->name Name of the group.
|
774 |
-
* @param string $text Notification content.
|
775 |
-
* @param string $notification_link The permalink for notification.
|
776 |
-
*/
|
777 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
|
778 |
} else {
|
779 |
-
|
780 |
-
* Filters single promoted to group admin notification for non-string format.
|
781 |
-
* Complete filter - bp_groups_single_member_promoted_to_admin_notification.
|
782 |
-
*
|
783 |
-
* @since BuddyPress (1.0.0)
|
784 |
-
*
|
785 |
-
* @param array $array Array holding permalink and content for notification.
|
786 |
-
* @param int $group_link The permalink for the group.
|
787 |
-
* @param string $group->name Name of the group.
|
788 |
-
* @param string $text Notification content.
|
789 |
-
* @param string $notification_link The permalink for notification.
|
790 |
-
*/
|
791 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
|
792 |
'link' => $notification_link,
|
793 |
'text' => $text
|
794 |
), $group_link, $group->name, $text, $notification_link );
|
@@ -802,75 +541,29 @@ function groups_format_notifications( $action, $item_id, $secondary_item_id, $to
|
|
802 |
|
803 |
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
804 |
$group_link = bp_get_group_permalink( $group );
|
805 |
-
$amount = 'single';
|
806 |
|
807 |
if ( (int) $total_items > 1 ) {
|
808 |
$text = sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int) $total_items );
|
809 |
-
$
|
810 |
$notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
|
811 |
|
812 |
if ( 'string' == $format ) {
|
813 |
-
|
814 |
-
* Filters multiple promoted to group mod notification for string format.
|
815 |
-
* Complete filter - bp_groups_multiple_member_promoted_to_mod_notification.
|
816 |
-
*
|
817 |
-
* @since BuddyPress (1.0.0)
|
818 |
-
*
|
819 |
-
* @param string $string HTML anchor tag for notification.
|
820 |
-
* @param int $total_items Total number of rejected requests.
|
821 |
-
* @param string $text Notification content.
|
822 |
-
* @param string $notification_link The permalink for notification.
|
823 |
-
*/
|
824 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $text, $notification_link );
|
825 |
} else {
|
826 |
-
|
827 |
-
* Filters multiple promoted to group mod notification for non-string format.
|
828 |
-
* Complete filter - bp_groups_multiple_member_promoted_to_mod_notification.
|
829 |
-
*
|
830 |
-
* @since 1.0.0
|
831 |
-
*
|
832 |
-
* @param array $array Array holding permalink and content for notification.
|
833 |
-
* @param int $total_items Total number of rejected requests.
|
834 |
-
* @param string $text Notification content.
|
835 |
-
* @param string $notification_link The permalink for notification.
|
836 |
-
*/
|
837 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
|
838 |
'link' => $notification_link,
|
839 |
'text' => $text
|
840 |
), $total_items, $text, $notification_link );
|
841 |
}
|
842 |
} else {
|
843 |
$text = sprintf( __( 'You were promoted to a mod in the group "%s"', 'buddypress' ), $group->name );
|
|
|
844 |
$notification_link = $group_link . '?n=1';
|
845 |
|
846 |
if ( 'string' == $format ) {
|
847 |
-
|
848 |
-
* Filters single promoted to group mod notification for string format.
|
849 |
-
* Complete filter - bp_groups_single_member_promoted_to_mod_notification.
|
850 |
-
*
|
851 |
-
* @since BuddyPress (1.0.0)
|
852 |
-
*
|
853 |
-
* @param string $string HTML anchor tag for notification.
|
854 |
-
* @param int $group_link The permalink for the group.
|
855 |
-
* @param string $group->name Name of the group.
|
856 |
-
* @param string $text Notification content.
|
857 |
-
* @param string $notification_link The permalink for notification.
|
858 |
-
*/
|
859 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
|
860 |
} else {
|
861 |
-
|
862 |
-
* Filters single promoted to group admin notification for non-string format.
|
863 |
-
* Complete filter - bp_groups_single_member_promoted_to_mod_notification.
|
864 |
-
*
|
865 |
-
* @since BuddyPress (1.0.0)
|
866 |
-
*
|
867 |
-
* @param array $array Array holding permalink and content for notification.
|
868 |
-
* @param int $group_link The permalink for the group.
|
869 |
-
* @param string $group->name Name of the group.
|
870 |
-
* @param string $text Notification content.
|
871 |
-
* @param string $notification_link The permalink for notification.
|
872 |
-
*/
|
873 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
|
874 |
'link' => $notification_link,
|
875 |
'text' => $text
|
876 |
), $group_link, $group->name, $text, $notification_link );
|
@@ -883,40 +576,17 @@ function groups_format_notifications( $action, $item_id, $secondary_item_id, $to
|
|
883 |
$group_id = $item_id;
|
884 |
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
885 |
$group_link = bp_get_group_permalink( $group );
|
886 |
-
$amount = 'single';
|
887 |
|
888 |
$notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/?n=1';
|
889 |
|
890 |
if ( (int) $total_items > 1 ) {
|
891 |
$text = sprintf( __( 'You have %d new group invitations', 'buddypress' ), (int) $total_items );
|
892 |
-
$
|
893 |
|
894 |
if ( 'string' == $format ) {
|
895 |
-
|
896 |
-
* Filters multiple group invitation notification for string format.
|
897 |
-
* Complete filter - bp_groups_multiple_group_invite_notification.
|
898 |
-
*
|
899 |
-
* @since BuddyPress (1.0.0)
|
900 |
-
*
|
901 |
-
* @param string $string HTML anchor tag for notification.
|
902 |
-
* @param int $total_items Total number of rejected requests.
|
903 |
-
* @param string $text Notification content.
|
904 |
-
* @param string $notification_link The permalink for notification.
|
905 |
-
*/
|
906 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '" title="' . __( 'Group Invites', 'buddypress' ) . '">' . $text . '</a>', $total_items, $text, $notification_link );
|
907 |
} else {
|
908 |
-
|
909 |
-
* Filters multiple group invitation notification for non-string format.
|
910 |
-
* Complete filter - bp_groups_multiple_group_invite_notification.
|
911 |
-
*
|
912 |
-
* @since BuddyPress (1.0.0)
|
913 |
-
*
|
914 |
-
* @param array $array Array holding permalink and content for notification.
|
915 |
-
* @param int $total_items Total number of rejected requests.
|
916 |
-
* @param string $text Notification content.
|
917 |
-
* @param string $notification_link The permalink for notification.
|
918 |
-
*/
|
919 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
|
920 |
'link' => $notification_link,
|
921 |
'text' => $text
|
922 |
), $total_items, $text, $notification_link );
|
@@ -926,33 +596,9 @@ function groups_format_notifications( $action, $item_id, $secondary_item_id, $to
|
|
926 |
$filter = 'bp_groups_single_group_invite_notification';
|
927 |
|
928 |
if ( 'string' == $format ) {
|
929 |
-
|
930 |
-
* Filters single group invitation notification for string format.
|
931 |
-
* Complete filter - bp_groups_single_group_invite_notification.
|
932 |
-
*
|
933 |
-
* @since BuddyPress (1.0.0)
|
934 |
-
*
|
935 |
-
* @param string $string HTML anchor tag for notification.
|
936 |
-
* @param int $group_link The permalink for the group.
|
937 |
-
* @param string $group->name Name of the group.
|
938 |
-
* @param string $text Notification content.
|
939 |
-
* @param string $notification_link The permalink for notification.
|
940 |
-
*/
|
941 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
|
942 |
} else {
|
943 |
-
|
944 |
-
* Filters single group invitation notification for non-string format.
|
945 |
-
* Complete filter - bp_groups_single_group_invite_notification.
|
946 |
-
*
|
947 |
-
* @since BuddyPress (1.0.0)
|
948 |
-
*
|
949 |
-
* @param array $array Array holding permalink and content for notification.
|
950 |
-
* @param int $group_link The permalink for the group.
|
951 |
-
* @param string $group->name Name of the group.
|
952 |
-
* @param string $text Notification content.
|
953 |
-
* @param string $notification_link The permalink for notification.
|
954 |
-
*/
|
955 |
-
return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', array(
|
956 |
'link' => $notification_link,
|
957 |
'text' => $text
|
958 |
), $group_link, $group->name, $text, $notification_link );
|
11 |
*/
|
12 |
|
13 |
// Exit if accessed directly
|
14 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
/** Emails ********************************************************************/
|
17 |
|
21 |
* @since BuddyPress (1.0.0)
|
22 |
*
|
23 |
* @param int $group_id ID of the group.
|
|
|
24 |
*/
|
25 |
+
function groups_notification_group_updated( $group_id = 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
+
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
28 |
$subject = bp_get_email_subject( array( 'text' => __( 'Group Details Updated', 'buddypress' ) ) );
|
29 |
$user_ids = BP_Groups_Member::get_group_member_ids( $group->id );
|
30 |
|
45 |
$settings_link = bp_core_get_user_domain( $user_id ) . $settings_slug . '/notifications/';
|
46 |
|
47 |
$message = sprintf( __(
|
48 |
+
'Group details for the group "%1$s" were updated:
|
49 |
|
50 |
+
To view the group: %2$s
|
51 |
|
52 |
---------------------
|
53 |
+
', 'buddypress' ), $group->name, $group_link );
|
54 |
|
55 |
$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );
|
56 |
|
111 |
// Link to the group administrator email settings: %s in "disable notifications" part of the email
|
112 |
$settings_link = bp_core_get_user_domain( $admin_id ) . $settings_slug . '/notifications/';
|
113 |
|
|
|
|
|
|
|
114 |
// Set up and send the message
|
115 |
$to = $ud->user_email;
|
116 |
$subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Membership request for group: %s', 'buddypress' ), $group->name ) ) );
|
117 |
|
118 |
+
$message = sprintf( __(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
'%1$s wants to join the group "%2$s".
|
120 |
|
121 |
Because you are the administrator of this group, you must either accept or reject the membership request.
|
127 |
|
128 |
---------------------
|
129 |
', 'buddypress' ), $requesting_user_name, $group->name, $group_requests, $requesting_user_name, $profile_link );
|
|
|
130 |
|
131 |
// Only show the disable notifications line if the settings component is enabled
|
132 |
if ( bp_is_active( 'settings' ) ) {
|
393 |
|
394 |
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
395 |
$group_link = bp_get_group_permalink( $group );
|
|
|
396 |
|
397 |
// Set up the string and the filter
|
398 |
// Because different values are passed to the filters, we'll return the
|
399 |
// values inline
|
400 |
if ( (int) $total_items > 1 ) {
|
401 |
$text = sprintf( __( '%1$d new membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );
|
402 |
+
$filter = 'bp_groups_multiple_new_membership_requests_notification';
|
403 |
$notification_link = $group_link . 'admin/membership-requests/?n=1';
|
404 |
|
405 |
if ( 'string' == $format ) {
|
406 |
+
return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . $text . '</a>', $group_link, $total_items, $group->name, $text, $notification_link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
} else {
|
408 |
+
return apply_filters( $filter, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
'link' => $notification_link,
|
410 |
'text' => $text
|
411 |
), $group_link, $total_items, $group->name, $text, $notification_link );
|
413 |
} else {
|
414 |
$user_fullname = bp_core_get_user_displayname( $requesting_user_id );
|
415 |
$text = sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname );
|
416 |
+
$filter = 'bp_groups_single_new_membership_request_notification';
|
417 |
$notification_link = $group_link . 'admin/membership-requests/?n=1';
|
418 |
|
419 |
if ( 'string' == $format ) {
|
420 |
+
return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname ) . '">' . $text . '</a>', $group_link, $user_fullname, $group->name, $text, $notification_link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
} else {
|
422 |
+
return apply_filters( $filter, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
'link' => $notification_link,
|
424 |
'text' => $text
|
425 |
), $group_link, $user_fullname, $group->name, $text, $notification_link );
|
433 |
|
434 |
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
435 |
$group_link = bp_get_group_permalink( $group );
|
|
|
436 |
|
437 |
if ( (int) $total_items > 1 ) {
|
438 |
$text = sprintf( __( '%d accepted group membership requests', 'buddypress' ), (int) $total_items, $group->name );
|
439 |
+
$filter = 'bp_groups_multiple_membership_request_accepted_notification';
|
440 |
$notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
|
441 |
|
442 |
if ( 'string' == $format ) {
|
443 |
+
return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $group->name, $text, $notification_link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
} else {
|
445 |
+
return apply_filters( $filter, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
'link' => $notification_link,
|
447 |
'text' => $text
|
448 |
), $total_items, $group->name, $text, $notification_link );
|
453 |
$notification_link = $group_link . '?n=1';
|
454 |
|
455 |
if ( 'string' == $format ) {
|
456 |
+
return apply_filters( $filter, '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
return apply_filters( $filter, array(
|
459 |
'link' => $notification_link,
|
460 |
'text' => $text
|
469 |
|
470 |
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
471 |
$group_link = bp_get_group_permalink( $group );
|
|
|
472 |
|
473 |
if ( (int) $total_items > 1 ) {
|
474 |
$text = sprintf( __( '%d rejected group membership requests', 'buddypress' ), (int) $total_items, $group->name );
|
475 |
+
$filter = 'bp_groups_multiple_membership_request_rejected_notification';
|
476 |
$notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
|
477 |
|
478 |
if ( 'string' == $format ) {
|
479 |
+
return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $group->name );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
} else {
|
481 |
+
return apply_filters( $filter, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
'link' => $notification_link,
|
483 |
'text' => $text
|
484 |
), $total_items, $group->name, $text, $notification_link );
|
485 |
}
|
486 |
} else {
|
487 |
$text = sprintf( __( 'Membership for group "%s" rejected', 'buddypress' ), $group->name );
|
488 |
+
$filter = 'bp_groups_single_membership_request_rejected_notification';
|
489 |
$notification_link = $group_link . '?n=1';
|
490 |
|
491 |
if ( 'string' == $format ) {
|
492 |
+
return apply_filters( $filter, '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
} else {
|
494 |
+
return apply_filters( $filter, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
495 |
'link' => $notification_link,
|
496 |
'text' => $text
|
497 |
), $group_link, $group->name, $text, $notification_link );
|
505 |
|
506 |
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
507 |
$group_link = bp_get_group_permalink( $group );
|
|
|
508 |
|
509 |
if ( (int) $total_items > 1 ) {
|
510 |
$text = sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int) $total_items );
|
511 |
+
$filter = 'bp_groups_multiple_member_promoted_to_admin_notification';
|
512 |
$notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
|
513 |
|
514 |
if ( 'string' == $format ) {
|
515 |
+
return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $text, $notification_link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
} else {
|
517 |
+
return apply_filters( $filter, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
'link' => $notification_link,
|
519 |
'text' => $text
|
520 |
), $total_items, $text, $notification_link );
|
521 |
}
|
522 |
} else {
|
523 |
$text = sprintf( __( 'You were promoted to an admin in the group "%s"', 'buddypress' ), $group->name );
|
524 |
+
$filter = 'bp_groups_single_member_promoted_to_admin_notification';
|
525 |
$notification_link = $group_link . '?n=1';
|
526 |
|
527 |
if ( 'string' == $format ) {
|
528 |
+
return apply_filters( $filter, '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
529 |
} else {
|
530 |
+
return apply_filters( $filter, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
'link' => $notification_link,
|
532 |
'text' => $text
|
533 |
), $group_link, $group->name, $text, $notification_link );
|
541 |
|
542 |
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
543 |
$group_link = bp_get_group_permalink( $group );
|
|
|
544 |
|
545 |
if ( (int) $total_items > 1 ) {
|
546 |
$text = sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int) $total_items );
|
547 |
+
$filter = 'bp_groups_multiple_member_promoted_to_mod_notification';
|
548 |
$notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
|
549 |
|
550 |
if ( 'string' == $format ) {
|
551 |
+
return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . __( 'Groups', 'buddypress' ) . '">' . $text . '</a>', $total_items, $text, $notification_link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
552 |
} else {
|
553 |
+
return apply_filters( $filter, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
554 |
'link' => $notification_link,
|
555 |
'text' => $text
|
556 |
), $total_items, $text, $notification_link );
|
557 |
}
|
558 |
} else {
|
559 |
$text = sprintf( __( 'You were promoted to a mod in the group "%s"', 'buddypress' ), $group->name );
|
560 |
+
$filter = 'bp_groups_single_member_promoted_to_mod_notification';
|
561 |
$notification_link = $group_link . '?n=1';
|
562 |
|
563 |
if ( 'string' == $format ) {
|
564 |
+
return apply_filters( $filter, '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
} else {
|
566 |
+
return apply_filters( $filter, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
567 |
'link' => $notification_link,
|
568 |
'text' => $text
|
569 |
), $group_link, $group->name, $text, $notification_link );
|
576 |
$group_id = $item_id;
|
577 |
$group = groups_get_group( array( 'group_id' => $group_id ) );
|
578 |
$group_link = bp_get_group_permalink( $group );
|
|
|
579 |
|
580 |
$notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/?n=1';
|
581 |
|
582 |
if ( (int) $total_items > 1 ) {
|
583 |
$text = sprintf( __( 'You have %d new group invitations', 'buddypress' ), (int) $total_items );
|
584 |
+
$filter = 'bp_groups_multiple_group_invite_notification';
|
585 |
|
586 |
if ( 'string' == $format ) {
|
587 |
+
return apply_filters( $filter, '<a href="' . $notification_link . '" title="' . __( 'Group Invites', 'buddypress' ) . '">' . $text . '</a>', $total_items, $text, $notification_link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
588 |
} else {
|
589 |
+
return apply_filters( $filter, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
590 |
'link' => $notification_link,
|
591 |
'text' => $text
|
592 |
), $total_items, $text, $notification_link );
|
596 |
$filter = 'bp_groups_single_group_invite_notification';
|
597 |
|
598 |
if ( 'string' == $format ) {
|
599 |
+
return apply_filters( $filter, '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
600 |
} else {
|
601 |
+
return apply_filters( $filter, array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
602 |
'link' => $notification_link,
|
603 |
'text' => $text
|
604 |
), $group_link, $group->name, $text, $notification_link );
|
bp-groups/bp-groups-screens.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
-
defined( 'ABSPATH' )
|
16 |
|
17 |
/**
|
18 |
* Handle the display of the Groups directory index.
|
@@ -71,7 +71,7 @@ function groups_screen_group_invites() {
|
|
71 |
|
72 |
bp_core_redirect( $redirect_to );
|
73 |
|
74 |
-
}
|
75 |
// Check the nonce
|
76 |
if ( !check_admin_referer( 'groups_reject_invite' ) )
|
77 |
return false;
|
@@ -179,7 +179,7 @@ function groups_screen_group_forum() {
|
|
179 |
}
|
180 |
|
181 |
// Sticky a topic
|
182 |
-
|
183 |
// Check the nonce
|
184 |
check_admin_referer( 'bp_forums_stick_topic' );
|
185 |
|
@@ -194,7 +194,7 @@ function groups_screen_group_forum() {
|
|
194 |
}
|
195 |
|
196 |
// Un-Sticky a topic
|
197 |
-
|
198 |
// Check the nonce
|
199 |
check_admin_referer( 'bp_forums_unstick_topic' );
|
200 |
|
@@ -209,7 +209,7 @@ function groups_screen_group_forum() {
|
|
209 |
}
|
210 |
|
211 |
// Close a topic
|
212 |
-
|
213 |
// Check the nonce
|
214 |
check_admin_referer( 'bp_forums_close_topic' );
|
215 |
|
@@ -224,7 +224,7 @@ function groups_screen_group_forum() {
|
|
224 |
}
|
225 |
|
226 |
// Open a topic
|
227 |
-
|
228 |
// Check the nonce
|
229 |
check_admin_referer( 'bp_forums_open_topic' );
|
230 |
|
@@ -239,7 +239,7 @@ function groups_screen_group_forum() {
|
|
239 |
}
|
240 |
|
241 |
// Delete a topic
|
242 |
-
|
243 |
// Fetch the topic
|
244 |
$topic = bp_forums_get_topic_details( $topic_id );
|
245 |
|
@@ -264,7 +264,7 @@ function groups_screen_group_forum() {
|
|
264 |
}
|
265 |
|
266 |
// Editing a topic
|
267 |
-
|
268 |
// Fetch the topic
|
269 |
$topic = bp_forums_get_topic_details( $topic_id );
|
270 |
|
@@ -292,7 +292,7 @@ function groups_screen_group_forum() {
|
|
292 |
bp_core_load_template( apply_filters( 'groups_template_group_forum_topic_edit', 'groups/single/home' ) );
|
293 |
|
294 |
// Delete a post
|
295 |
-
}
|
296 |
// Fetch the post
|
297 |
$post = bp_forums_get_post( $post_id );
|
298 |
|
@@ -316,7 +316,7 @@ function groups_screen_group_forum() {
|
|
316 |
bp_core_redirect( wp_get_referer() );
|
317 |
|
318 |
// Editing a post
|
319 |
-
}
|
320 |
|
321 |
// Fetch the post
|
322 |
$post = bp_forums_get_post( $post_id );
|
@@ -379,7 +379,7 @@ function groups_screen_group_forum() {
|
|
379 |
|
380 |
if ( empty( $_POST['topic_title'] ) ) {
|
381 |
$error_message = __( 'Please provide a title for your forum topic.', 'buddypress' );
|
382 |
-
}
|
383 |
$error_message = __( 'Forum posts cannot be empty. Please enter some text.', 'buddypress' );
|
384 |
}
|
385 |
|
@@ -492,10 +492,10 @@ function groups_remove_group_invite() {
|
|
492 |
if ( ! bp_groups_user_can_send_invites( $group_id ) ) {
|
493 |
$message = __( 'You are not allowed to send or remove invites', 'buddypress' );
|
494 |
$error = 'error';
|
495 |
-
}
|
496 |
$message = __( 'The member requested to join the group', 'buddypress' );
|
497 |
$error = 'error';
|
498 |
-
}
|
499 |
$message = __( 'There was an error removing the invite', 'buddypress' );
|
500 |
$error = 'error';
|
501 |
}
|
@@ -524,7 +524,7 @@ function groups_screen_group_request_membership() {
|
|
524 |
if ( groups_accept_invite( bp_loggedin_user_id(), $bp->groups->current_group->id ) )
|
525 |
bp_core_add_message( __( 'Group invite accepted', 'buddypress' ) );
|
526 |
else
|
527 |
-
bp_core_add_message( __( 'There was an error accepting the group invitation
|
528 |
bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
|
529 |
}
|
530 |
|
@@ -536,7 +536,7 @@ function groups_screen_group_request_membership() {
|
|
536 |
return false;
|
537 |
|
538 |
if ( !groups_send_membership_request( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {
|
539 |
-
bp_core_add_message( __( 'There was an error sending your group membership request
|
540 |
} else {
|
541 |
bp_core_add_message( __( 'Your membership request was sent to the group administrator successfully. You will be notified when the group administrator responds to your request.', 'buddypress' ) );
|
542 |
}
|
@@ -596,7 +596,7 @@ function groups_screen_group_admin_edit_details() {
|
|
596 |
$group_notify_members = isset( $_POST['group-notify-members'] ) ? (int) $_POST['group-notify-members'] : 0;
|
597 |
|
598 |
if ( !groups_edit_base_group_details( $_POST['group-id'], $_POST['group-name'], $_POST['group-desc'], $group_notify_members ) ) {
|
599 |
-
bp_core_add_message( __( 'There was an error updating group details
|
600 |
} else {
|
601 |
bp_core_add_message( __( 'Group details were successfully updated.', 'buddypress' ) );
|
602 |
}
|
@@ -643,7 +643,7 @@ function groups_screen_group_admin_settings() {
|
|
643 |
return false;
|
644 |
|
645 |
if ( !groups_edit_group_settings( $_POST['group-id'], $enable_forum, $status, $invite_status ) ) {
|
646 |
-
bp_core_add_message( __( 'There was an error updating group settings
|
647 |
} else {
|
648 |
bp_core_add_message( __( 'Group settings were successfully updated.', 'buddypress' ) );
|
649 |
}
|
@@ -682,7 +682,7 @@ function groups_screen_group_admin_avatar() {
|
|
682 |
if ( bp_core_delete_existing_avatar( array( 'item_id' => $bp->groups->current_group->id, 'object' => 'group' ) ) ) {
|
683 |
bp_core_add_message( __( 'The group profile photo was deleted successfully!', 'buddypress' ) );
|
684 |
} else {
|
685 |
-
bp_core_add_message( __( 'There was a problem deleting the group profile photo
|
686 |
}
|
687 |
}
|
688 |
|
@@ -761,7 +761,7 @@ function groups_screen_group_admin_manage_members() {
|
|
761 |
|
762 |
// Promote a user.
|
763 |
if ( !groups_promote_member( $user_id, $bp->groups->current_group->id, $status ) )
|
764 |
-
bp_core_add_message( __( 'There was an error when promoting that user
|
765 |
else
|
766 |
bp_core_add_message( __( 'User promoted successfully', 'buddypress' ) );
|
767 |
|
@@ -786,7 +786,7 @@ function groups_screen_group_admin_manage_members() {
|
|
786 |
|
787 |
// Demote a user.
|
788 |
elseif ( !groups_demote_member( $user_id, $bp->groups->current_group->id ) )
|
789 |
-
bp_core_add_message( __( 'There was an error when demoting that user
|
790 |
else
|
791 |
bp_core_add_message( __( 'User demoted successfully', 'buddypress' ) );
|
792 |
|
@@ -804,7 +804,7 @@ function groups_screen_group_admin_manage_members() {
|
|
804 |
|
805 |
// Ban a user.
|
806 |
if ( !groups_ban_member( $user_id, $bp->groups->current_group->id ) )
|
807 |
-
bp_core_add_message( __( 'There was an error when banning that user
|
808 |
else
|
809 |
bp_core_add_message( __( 'User banned successfully', 'buddypress' ) );
|
810 |
|
@@ -822,7 +822,7 @@ function groups_screen_group_admin_manage_members() {
|
|
822 |
|
823 |
// Remove a ban for user.
|
824 |
if ( !groups_unban_member( $user_id, $bp->groups->current_group->id ) )
|
825 |
-
bp_core_add_message( __( 'There was an error when unbanning that user
|
826 |
else
|
827 |
bp_core_add_message( __( 'User ban removed successfully', 'buddypress' ) );
|
828 |
|
@@ -840,7 +840,7 @@ function groups_screen_group_admin_manage_members() {
|
|
840 |
|
841 |
// Remove a user.
|
842 |
if ( !groups_remove_member( $user_id, $bp->groups->current_group->id ) )
|
843 |
-
bp_core_add_message( __( 'There was an error removing that user from the group
|
844 |
else
|
845 |
bp_core_add_message( __( 'User removed successfully', 'buddypress' ) );
|
846 |
|
@@ -882,7 +882,7 @@ function groups_screen_group_admin_requests() {
|
|
882 |
|
883 |
// Accept the membership request
|
884 |
if ( !groups_accept_membership_request( $membership_id ) )
|
885 |
-
bp_core_add_message( __( 'There was an error accepting the membership request
|
886 |
else
|
887 |
bp_core_add_message( __( 'Group membership request accepted', 'buddypress' ) );
|
888 |
|
@@ -893,7 +893,7 @@ function groups_screen_group_admin_requests() {
|
|
893 |
|
894 |
// Reject the membership request
|
895 |
if ( !groups_reject_membership_request( $membership_id ) )
|
896 |
-
bp_core_add_message( __( 'There was an error rejecting the membership request
|
897 |
else
|
898 |
bp_core_add_message( __( 'Group membership request rejected', 'buddypress' ) );
|
899 |
}
|
@@ -930,7 +930,7 @@ function groups_screen_group_admin_delete_group() {
|
|
930 |
|
931 |
// Group admin has deleted the group, now do it.
|
932 |
if ( !groups_delete_group( $bp->groups->current_group->id ) ) {
|
933 |
-
bp_core_add_message( __( 'There was an error deleting the group
|
934 |
} else {
|
935 |
bp_core_add_message( __( 'The group was deleted successfully', 'buddypress' ) );
|
936 |
|
@@ -1010,12 +1010,12 @@ function groups_screen_notification_settings() {
|
|
1010 |
}
|
1011 |
add_action( 'bp_notification_settings', 'groups_screen_notification_settings' );
|
1012 |
|
1013 |
-
/** Theme
|
1014 |
|
1015 |
/**
|
1016 |
* The main theme compat class for BuddyPress Groups.
|
1017 |
*
|
1018 |
-
* This class sets up the necessary theme
|
1019 |
* group template parts to the_title and the_content areas of a theme.
|
1020 |
*
|
1021 |
* @since BuddyPress (1.7.0)
|
@@ -1032,7 +1032,7 @@ class BP_Groups_Theme_Compat {
|
|
1032 |
}
|
1033 |
|
1034 |
/**
|
1035 |
-
* Are we looking at something that needs group theme
|
1036 |
*
|
1037 |
* @since BuddyPress (1.7.0)
|
1038 |
*/
|
@@ -1099,9 +1099,12 @@ class BP_Groups_Theme_Compat {
|
|
1099 |
* @since BuddyPress (1.7.0)
|
1100 |
*/
|
1101 |
public function directory_dummy_post() {
|
|
|
|
|
|
|
1102 |
bp_theme_compat_reset_post( array(
|
1103 |
'ID' => 0,
|
1104 |
-
'post_title' =>
|
1105 |
'post_author' => 0,
|
1106 |
'post_date' => 0,
|
1107 |
'post_content' => '',
|
@@ -1219,7 +1222,7 @@ class BP_Groups_Theme_Compat {
|
|
1219 |
public function single_dummy_post() {
|
1220 |
bp_theme_compat_reset_post( array(
|
1221 |
'ID' => 0,
|
1222 |
-
'post_title' => bp_get_current_group_name(),
|
1223 |
'post_author' => 0,
|
1224 |
'post_date' => 0,
|
1225 |
'post_content' => '',
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
16 |
|
17 |
/**
|
18 |
* Handle the display of the Groups directory index.
|
71 |
|
72 |
bp_core_redirect( $redirect_to );
|
73 |
|
74 |
+
} else if ( bp_is_action_variable( 'reject' ) && is_numeric( $group_id ) ) {
|
75 |
// Check the nonce
|
76 |
if ( !check_admin_referer( 'groups_reject_invite' ) )
|
77 |
return false;
|
179 |
}
|
180 |
|
181 |
// Sticky a topic
|
182 |
+
else if ( bp_is_action_variable( 'stick', 2 ) && ( bp_is_item_admin() || bp_is_item_mod() ) ) {
|
183 |
// Check the nonce
|
184 |
check_admin_referer( 'bp_forums_stick_topic' );
|
185 |
|
194 |
}
|
195 |
|
196 |
// Un-Sticky a topic
|
197 |
+
else if ( bp_is_action_variable( 'unstick', 2 ) && ( bp_is_item_admin() || bp_is_item_mod() ) ) {
|
198 |
// Check the nonce
|
199 |
check_admin_referer( 'bp_forums_unstick_topic' );
|
200 |
|
209 |
}
|
210 |
|
211 |
// Close a topic
|
212 |
+
else if ( bp_is_action_variable( 'close', 2 ) && ( bp_is_item_admin() || bp_is_item_mod() ) ) {
|
213 |
// Check the nonce
|
214 |
check_admin_referer( 'bp_forums_close_topic' );
|
215 |
|
224 |
}
|
225 |
|
226 |
// Open a topic
|
227 |
+
else if ( bp_is_action_variable( 'open', 2 ) && ( bp_is_item_admin() || bp_is_item_mod() ) ) {
|
228 |
// Check the nonce
|
229 |
check_admin_referer( 'bp_forums_open_topic' );
|
230 |
|
239 |
}
|
240 |
|
241 |
// Delete a topic
|
242 |
+
else if ( empty( $user_is_banned ) && bp_is_action_variable( 'delete', 2 ) && !bp_action_variable( 3 ) ) {
|
243 |
// Fetch the topic
|
244 |
$topic = bp_forums_get_topic_details( $topic_id );
|
245 |
|
264 |
}
|
265 |
|
266 |
// Editing a topic
|
267 |
+
else if ( empty( $user_is_banned ) && bp_is_action_variable( 'edit', 2 ) && !bp_action_variable( 3 ) ) {
|
268 |
// Fetch the topic
|
269 |
$topic = bp_forums_get_topic_details( $topic_id );
|
270 |
|
292 |
bp_core_load_template( apply_filters( 'groups_template_group_forum_topic_edit', 'groups/single/home' ) );
|
293 |
|
294 |
// Delete a post
|
295 |
+
} else if ( empty( $user_is_banned ) && bp_is_action_variable( 'delete', 2 ) && $post_id = bp_action_variable( 4 ) ) {
|
296 |
// Fetch the post
|
297 |
$post = bp_forums_get_post( $post_id );
|
298 |
|
316 |
bp_core_redirect( wp_get_referer() );
|
317 |
|
318 |
// Editing a post
|
319 |
+
} else if ( empty( $user_is_banned ) && bp_is_action_variable( 'edit', 2 ) && $post_id = bp_action_variable( 4 ) ) {
|
320 |
|
321 |
// Fetch the post
|
322 |
$post = bp_forums_get_post( $post_id );
|
379 |
|
380 |
if ( empty( $_POST['topic_title'] ) ) {
|
381 |
$error_message = __( 'Please provide a title for your forum topic.', 'buddypress' );
|
382 |
+
} else if ( empty( $_POST['topic_text'] ) ) {
|
383 |
$error_message = __( 'Forum posts cannot be empty. Please enter some text.', 'buddypress' );
|
384 |
}
|
385 |
|
492 |
if ( ! bp_groups_user_can_send_invites( $group_id ) ) {
|
493 |
$message = __( 'You are not allowed to send or remove invites', 'buddypress' );
|
494 |
$error = 'error';
|
495 |
+
} else if ( BP_Groups_Member::check_for_membership_request( $friend_id, $group_id ) ) {
|
496 |
$message = __( 'The member requested to join the group', 'buddypress' );
|
497 |
$error = 'error';
|
498 |
+
} else if ( ! groups_uninvite_user( $friend_id, $group_id ) ) {
|
499 |
$message = __( 'There was an error removing the invite', 'buddypress' );
|
500 |
$error = 'error';
|
501 |
}
|
524 |
if ( groups_accept_invite( bp_loggedin_user_id(), $bp->groups->current_group->id ) )
|
525 |
bp_core_add_message( __( 'Group invite accepted', 'buddypress' ) );
|
526 |
else
|
527 |
+
bp_core_add_message( __( 'There was an error accepting the group invitation; please try again.', 'buddypress' ), 'error' );
|
528 |
bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
|
529 |
}
|
530 |
|
536 |
return false;
|
537 |
|
538 |
if ( !groups_send_membership_request( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {
|
539 |
+
bp_core_add_message( __( 'There was an error sending your group membership request; please try again.', 'buddypress' ), 'error' );
|
540 |
} else {
|
541 |
bp_core_add_message( __( 'Your membership request was sent to the group administrator successfully. You will be notified when the group administrator responds to your request.', 'buddypress' ) );
|
542 |
}
|
596 |
$group_notify_members = isset( $_POST['group-notify-members'] ) ? (int) $_POST['group-notify-members'] : 0;
|
597 |
|
598 |
if ( !groups_edit_base_group_details( $_POST['group-id'], $_POST['group-name'], $_POST['group-desc'], $group_notify_members ) ) {
|
599 |
+
bp_core_add_message( __( 'There was an error updating group details; please try again.', 'buddypress' ), 'error' );
|
600 |
} else {
|
601 |
bp_core_add_message( __( 'Group details were successfully updated.', 'buddypress' ) );
|
602 |
}
|
643 |
return false;
|
644 |
|
645 |
if ( !groups_edit_group_settings( $_POST['group-id'], $enable_forum, $status, $invite_status ) ) {
|
646 |
+
bp_core_add_message( __( 'There was an error updating group settings; please try again.', 'buddypress' ), 'error' );
|
647 |
} else {
|
648 |
bp_core_add_message( __( 'Group settings were successfully updated.', 'buddypress' ) );
|
649 |
}
|
682 |
if ( bp_core_delete_existing_avatar( array( 'item_id' => $bp->groups->current_group->id, 'object' => 'group' ) ) ) {
|
683 |
bp_core_add_message( __( 'The group profile photo was deleted successfully!', 'buddypress' ) );
|
684 |
} else {
|
685 |
+
bp_core_add_message( __( 'There was a problem deleting the group profile photo; please try again.', 'buddypress' ), 'error' );
|
686 |
}
|
687 |
}
|
688 |
|
761 |
|
762 |
// Promote a user.
|
763 |
if ( !groups_promote_member( $user_id, $bp->groups->current_group->id, $status ) )
|
764 |
+
bp_core_add_message( __( 'There was an error when promoting that user, please try again', 'buddypress' ), 'error' );
|
765 |
else
|
766 |
bp_core_add_message( __( 'User promoted successfully', 'buddypress' ) );
|
767 |
|
786 |
|
787 |
// Demote a user.
|
788 |
elseif ( !groups_demote_member( $user_id, $bp->groups->current_group->id ) )
|
789 |
+
bp_core_add_message( __( 'There was an error when demoting that user; please try again', 'buddypress' ), 'error' );
|
790 |
else
|
791 |
bp_core_add_message( __( 'User demoted successfully', 'buddypress' ) );
|
792 |
|
804 |
|
805 |
// Ban a user.
|
806 |
if ( !groups_ban_member( $user_id, $bp->groups->current_group->id ) )
|
807 |
+
bp_core_add_message( __( 'There was an error when banning that user; please try again', 'buddypress' ), 'error' );
|
808 |
else
|
809 |
bp_core_add_message( __( 'User banned successfully', 'buddypress' ) );
|
810 |
|
822 |
|
823 |
// Remove a ban for user.
|
824 |
if ( !groups_unban_member( $user_id, $bp->groups->current_group->id ) )
|
825 |
+
bp_core_add_message( __( 'There was an error when unbanning that user, please try again', 'buddypress' ), 'error' );
|
826 |
else
|
827 |
bp_core_add_message( __( 'User ban removed successfully', 'buddypress' ) );
|
828 |
|
840 |
|
841 |
// Remove a user.
|
842 |
if ( !groups_remove_member( $user_id, $bp->groups->current_group->id ) )
|
843 |
+
bp_core_add_message( __( 'There was an error removing that user from the group; please try again', 'buddypress' ), 'error' );
|
844 |
else
|
845 |
bp_core_add_message( __( 'User removed successfully', 'buddypress' ) );
|
846 |
|
882 |
|
883 |
// Accept the membership request
|
884 |
if ( !groups_accept_membership_request( $membership_id ) )
|
885 |
+
bp_core_add_message( __( 'There was an error accepting the membership request; please try again.', 'buddypress' ), 'error' );
|
886 |
else
|
887 |
bp_core_add_message( __( 'Group membership request accepted', 'buddypress' ) );
|
888 |
|
893 |
|
894 |
// Reject the membership request
|
895 |
if ( !groups_reject_membership_request( $membership_id ) )
|
896 |
+
bp_core_add_message( __( 'There was an error rejecting the membership request; please try again.', 'buddypress' ), 'error' );
|
897 |
else
|
898 |
bp_core_add_message( __( 'Group membership request rejected', 'buddypress' ) );
|
899 |
}
|
930 |
|
931 |
// Group admin has deleted the group, now do it.
|
932 |
if ( !groups_delete_group( $bp->groups->current_group->id ) ) {
|
933 |
+
bp_core_add_message( __( 'There was an error deleting the group; please try again.', 'buddypress' ), 'error' );
|
934 |
} else {
|
935 |
bp_core_add_message( __( 'The group was deleted successfully', 'buddypress' ) );
|
936 |
|
1010 |
}
|
1011 |
add_action( 'bp_notification_settings', 'groups_screen_notification_settings' );
|
1012 |
|
1013 |
+
/** Theme Compatability *******************************************************/
|
1014 |
|
1015 |
/**
|
1016 |
* The main theme compat class for BuddyPress Groups.
|
1017 |
*
|
1018 |
+
* This class sets up the necessary theme compatability actions to safely output
|
1019 |
* group template parts to the_title and the_content areas of a theme.
|
1020 |
*
|
1021 |
* @since BuddyPress (1.7.0)
|
1032 |
}
|
1033 |
|
1034 |
/**
|
1035 |
+
* Are we looking at something that needs group theme compatability?
|
1036 |
*
|
1037 |
* @since BuddyPress (1.7.0)
|
1038 |
*/
|
1099 |
* @since BuddyPress (1.7.0)
|
1100 |
*/
|
1101 |
public function directory_dummy_post() {
|
1102 |
+
|
1103 |
+
$title = apply_filters( 'bp_groups_directory_header', bp_get_directory_title( 'groups' ) );
|
1104 |
+
|
1105 |
bp_theme_compat_reset_post( array(
|
1106 |
'ID' => 0,
|
1107 |
+
'post_title' => $title,
|
1108 |
'post_author' => 0,
|
1109 |
'post_date' => 0,
|
1110 |
'post_content' => '',
|
1222 |
public function single_dummy_post() {
|
1223 |
bp_theme_compat_reset_post( array(
|
1224 |
'ID' => 0,
|
1225 |
+
'post_title' => '<a href="' . bp_get_group_permalink( groups_get_current_group() ) . '">' . bp_get_current_group_name() . '</a>',
|
1226 |
'post_author' => 0,
|
1227 |
'post_date' => 0,
|
1228 |
'post_content' => '',
|
bp-groups/bp-groups-template.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
*/
|
6 |
|
7 |
// Exit if accessed directly
|
8 |
-
defined( 'ABSPATH' )
|
9 |
|
10 |
/**
|
11 |
* Output the groups component slug.
|
@@ -206,37 +206,34 @@ class BP_Groups_Template {
|
|
206 |
}
|
207 |
|
208 |
$defaults = array(
|
209 |
-
'
|
210 |
-
'
|
211 |
-
'
|
212 |
-
'max'
|
213 |
-
'
|
214 |
-
'
|
215 |
-
'
|
216 |
-
'
|
217 |
-
'
|
218 |
-
'
|
219 |
-
'
|
220 |
-
'
|
221 |
-
'
|
222 |
-
'meta_query' => false,
|
223 |
-
'populate_extras' => true,
|
224 |
'update_meta_cache' => true,
|
225 |
);
|
226 |
|
227 |
$r = wp_parse_args( $args, $defaults );
|
228 |
extract( $r );
|
229 |
|
230 |
-
$this->
|
231 |
-
$this->
|
232 |
-
$this->pag_num = bp_sanitize_pagination_arg( 'num', $r['per_page'] );
|
233 |
|
234 |
if ( bp_current_user_can( 'bp_moderate' ) || ( is_user_logged_in() && $user_id == bp_loggedin_user_id() ) )
|
235 |
$show_hidden = true;
|
236 |
|
237 |
if ( 'invites' == $type ) {
|
238 |
$this->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->pag_page, $exclude );
|
239 |
-
}
|
240 |
$this->single_group = true;
|
241 |
|
242 |
if ( groups_get_current_group() ) {
|
@@ -282,7 +279,7 @@ class BP_Groups_Template {
|
|
282 |
$this->total_group_count = (int) $this->groups['total'];
|
283 |
$this->group_count = (int) $this->groups['total'];
|
284 |
$this->groups = $this->groups['groups'];
|
285 |
-
}
|
286 |
if ( empty( $group->id ) ) {
|
287 |
$this->total_group_count = 0;
|
288 |
$this->group_count = 0;
|
@@ -313,7 +310,10 @@ class BP_Groups_Template {
|
|
313 |
// Build pagination links
|
314 |
if ( (int) $this->total_group_count && (int) $this->pag_num ) {
|
315 |
$pag_args = array(
|
316 |
-
$
|
|
|
|
|
|
|
317 |
);
|
318 |
|
319 |
if ( defined( 'DOING_AJAX' ) && true === (bool) DOING_AJAX ) {
|
@@ -322,14 +322,8 @@ class BP_Groups_Template {
|
|
322 |
$base = '';
|
323 |
}
|
324 |
|
325 |
-
$add_args = array(
|
326 |
-
'num' => $this->pag_num,
|
327 |
-
'sortby' => $this->sort_by,
|
328 |
-
'order' => $this->order,
|
329 |
-
);
|
330 |
-
|
331 |
if ( ! empty( $search_terms ) ) {
|
332 |
-
$
|
333 |
}
|
334 |
|
335 |
$this->pag_links = paginate_links( array(
|
@@ -339,8 +333,7 @@ class BP_Groups_Template {
|
|
339 |
'current' => $this->pag_page,
|
340 |
'prev_text' => _x( '←', 'Group pagination previous text', 'buddypress' ),
|
341 |
'next_text' => _x( '→', 'Group pagination next text', 'buddypress' ),
|
342 |
-
'mid_size' => 1
|
343 |
-
'add_args' => $add_args,
|
344 |
) );
|
345 |
}
|
346 |
}
|
@@ -430,35 +423,35 @@ class BP_Groups_Template {
|
|
430 |
*
|
431 |
* @param array $args {
|
432 |
* Array of parameters. All items are optional.
|
433 |
-
* @type string $type Shorthand for certain orderby/
|
434 |
* order combinations. 'newest', 'active', 'popular',
|
435 |
* 'alphabetical', 'random'. When present, will override
|
436 |
* orderby and order params. Default: null.
|
437 |
-
* @type string $orderby Property to sort by.
|
438 |
* 'date_created', 'last_activity', 'total_member_count',
|
439 |
* 'name', 'random'. Default: 'date_created'.
|
440 |
-
* @type string $order Sort order. 'ASC' or 'DESC'.
|
441 |
* Default: 'DESC'.
|
442 |
-
* @type int $per_page Number of items to return per page
|
443 |
* of results. Default: null (no limit).
|
444 |
-
* @type int $page Page offset of results to return.
|
445 |
* Default: null (no limit).
|
446 |
-
* @type int $user_id If provided, results will be limited
|
447 |
* to groups of which the specified user is a member. Default:
|
448 |
* null.
|
449 |
-
* @type string $search_terms If provided, only groups
|
450 |
* whose names or descriptions match the search terms will be
|
451 |
* returned. Default: false.
|
452 |
-
* @type array $meta_query An array of meta_query
|
453 |
* conditions. See {@link WP_Meta_Query::queries} for
|
454 |
* description.
|
455 |
-
* @type array|string
|
456 |
* group IDs. Results will be limited to groups within the
|
457 |
* list. Default: false.
|
458 |
* @type bool $populate_extras Whether to fetch additional
|
459 |
* information (such as member count) about groups. Default:
|
460 |
* true.
|
461 |
-
* @type array|string
|
462 |
* group IDs. Results will exclude the listed groups.
|
463 |
* Default: false.
|
464 |
* @type bool $show_hidden Whether to include hidden groups in
|
@@ -713,9 +706,9 @@ function bp_group_type( $group = false ) {
|
|
713 |
|
714 |
if ( 'public' == $group->status ) {
|
715 |
$type = __( "Public Group", "buddypress" );
|
716 |
-
}
|
717 |
$type = __( "Hidden Group", "buddypress" );
|
718 |
-
}
|
719 |
$type = __( "Private Group", "buddypress" );
|
720 |
} else {
|
721 |
$type = ucwords( $group->status ) . ' ' . __( 'Group', 'buddypress' );
|
@@ -1514,15 +1507,6 @@ function bp_group_search_form() {
|
|
1514 |
echo apply_filters( 'bp_group_search_form', $search_form_html );
|
1515 |
}
|
1516 |
|
1517 |
-
/**
|
1518 |
-
* Determine whether the displayed user has no groups.
|
1519 |
-
*
|
1520 |
-
* No longer used in BuddyPress.
|
1521 |
-
*
|
1522 |
-
* @todo Deprecate
|
1523 |
-
*
|
1524 |
-
* @return bool True if the displayed user has no groups, otherwise false.
|
1525 |
-
*/
|
1526 |
function bp_group_show_no_groups_message() {
|
1527 |
if ( !groups_total_groups_for_user( bp_displayed_user_id() ) )
|
1528 |
return true;
|
@@ -1530,15 +1514,6 @@ function bp_group_show_no_groups_message() {
|
|
1530 |
return false;
|
1531 |
}
|
1532 |
|
1533 |
-
/**
|
1534 |
-
* Determine whether the current page is a group activity permalink.
|
1535 |
-
*
|
1536 |
-
* No longer used in BuddyPress.
|
1537 |
-
*
|
1538 |
-
* @todo Deprecate.
|
1539 |
-
*
|
1540 |
-
* @return bool True if this is a group activity permalink, otherwise false.
|
1541 |
-
*/
|
1542 |
function bp_group_is_activity_permalink() {
|
1543 |
|
1544 |
if ( !bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action( bp_get_activity_slug() ) )
|
@@ -1547,34 +1522,18 @@ function bp_group_is_activity_permalink() {
|
|
1547 |
return true;
|
1548 |
}
|
1549 |
|
1550 |
-
/**
|
1551 |
-
* Output the pagination HTML for a group loop.
|
1552 |
-
*/
|
1553 |
function bp_groups_pagination_links() {
|
1554 |
echo bp_get_groups_pagination_links();
|
1555 |
}
|
1556 |
-
/**
|
1557 |
-
* Get the pagination HTML for a group loop.
|
1558 |
-
*
|
1559 |
-
* @return string
|
1560 |
-
*/
|
1561 |
function bp_get_groups_pagination_links() {
|
1562 |
global $groups_template;
|
1563 |
|
1564 |
return apply_filters( 'bp_get_groups_pagination_links', $groups_template->pag_links );
|
1565 |
}
|
1566 |
|
1567 |
-
/**
|
1568 |
-
* Output the "Viewing x-y of z groups" pagination message.
|
1569 |
-
*/
|
1570 |
function bp_groups_pagination_count() {
|
1571 |
echo bp_get_groups_pagination_count();
|
1572 |
}
|
1573 |
-
/**
|
1574 |
-
* Generate the "Viewing x-y of z groups" pagination message.
|
1575 |
-
*
|
1576 |
-
* @return string
|
1577 |
-
*/
|
1578 |
function bp_get_groups_pagination_count() {
|
1579 |
global $groups_template;
|
1580 |
|
@@ -1583,37 +1542,18 @@ function bp_groups_pagination_count() {
|
|
1583 |
$to_num = bp_core_number_format( ( $start_num + ( $groups_template->pag_num - 1 ) > $groups_template->total_group_count ) ? $groups_template->total_group_count : $start_num + ( $groups_template->pag_num - 1 ) );
|
1584 |
$total = bp_core_number_format( $groups_template->total_group_count );
|
1585 |
|
1586 |
-
return apply_filters( 'bp_get_groups_pagination_count', sprintf( _n( 'Viewing 1
|
1587 |
}
|
1588 |
|
1589 |
-
/**
|
1590 |
-
* Determine whether groups auto-join is enabled.
|
1591 |
-
*
|
1592 |
-
* "Auto-join" is the toggle that determines whether users are joined to a
|
1593 |
-
* public group automatically when creating content in that group.
|
1594 |
-
*
|
1595 |
-
* @return bool
|
1596 |
-
*/
|
1597 |
function bp_groups_auto_join() {
|
1598 |
global $bp;
|
1599 |
|
1600 |
return apply_filters( 'bp_groups_auto_join', (bool)$bp->groups->auto_join );
|
1601 |
}
|
1602 |
|
1603 |
-
/**
|
1604 |
-
* Output the total member count for a group.
|
1605 |
-
*
|
1606 |
-
* @param object $group Optional. Group object. Default: current group in loop.
|
1607 |
-
*/
|
1608 |
function bp_group_total_members( $group = false ) {
|
1609 |
echo bp_get_group_total_members( $group );
|
1610 |
}
|
1611 |
-
/**
|
1612 |
-
* Get the total member count for a group.
|
1613 |
-
*
|
1614 |
-
* @param object $group Optional. Group object. Default: current group in loop.
|
1615 |
-
* @return int
|
1616 |
-
*/
|
1617 |
function bp_get_group_total_members( $group = false ) {
|
1618 |
global $groups_template;
|
1619 |
|
@@ -1623,46 +1563,21 @@ function bp_group_total_members( $group = false ) {
|
|
1623 |
return apply_filters( 'bp_get_group_total_members', $group->total_member_count );
|
1624 |
}
|
1625 |
|
1626 |
-
/**
|
1627 |
-
* Output the "x members" count string for a group.
|
1628 |
-
*
|
1629 |
-
* @param object $group Optional. Group object. Default: current group in loop.
|
1630 |
-
*/
|
1631 |
function bp_group_member_count() {
|
1632 |
echo bp_get_group_member_count();
|
1633 |
}
|
1634 |
-
/**
|
1635 |
-
* Generate the "x members" count string for a group.
|
1636 |
-
*
|
1637 |
-
* @param object $group Optional. Group object. Default: current group in loop.
|
1638 |
-
* @return string
|
1639 |
-
*/
|
1640 |
function bp_get_group_member_count() {
|
1641 |
global $groups_template;
|
1642 |
|
1643 |
-
if (
|
1644 |
-
|
1645 |
-
|
1646 |
-
$
|
1647 |
-
}
|
1648 |
-
|
1649 |
-
$count_string = sprintf( _n( '%s member', '%s members', $count, 'buddypress' ), bp_core_number_format( $count ) );
|
1650 |
-
|
1651 |
-
return apply_filters( 'bp_get_group_member_count', $count_string );
|
1652 |
}
|
1653 |
|
1654 |
-
/**
|
1655 |
-
* Output the URL of the Forum page of the current group in the loop.
|
1656 |
-
*/
|
1657 |
function bp_group_forum_permalink() {
|
1658 |
echo bp_get_group_forum_permalink();
|
1659 |
}
|
1660 |
-
/**
|
1661 |
-
* Generate the URL of the Forum page of a group.
|
1662 |
-
*
|
1663 |
-
* @param object $group Optional. Group object. Default: current group in loop.
|
1664 |
-
* @return string
|
1665 |
-
*/
|
1666 |
function bp_get_group_forum_permalink( $group = false ) {
|
1667 |
global $groups_template;
|
1668 |
|
@@ -1672,25 +1587,9 @@ function bp_group_forum_permalink() {
|
|
1672 |
return apply_filters( 'bp_get_group_forum_permalink', bp_get_group_permalink( $group ) . 'forum' );
|
1673 |
}
|
1674 |
|
1675 |
-
/**
|
1676 |
-
* Output the topic count for a group forum.
|
1677 |
-
*
|
1678 |
-
* @param array $args See {@link bp_get_group_forum_topic_count()}.
|
1679 |
-
*/
|
1680 |
function bp_group_forum_topic_count( $args = '' ) {
|
1681 |
echo bp_get_group_forum_topic_count( $args );
|
1682 |
}
|
1683 |
-
/**
|
1684 |
-
* Generate the topic count string for a group forum.
|
1685 |
-
*
|
1686 |
-
* @param array $args {
|
1687 |
-
* Array of arguments.
|
1688 |
-
* @type bool $showtext Optional. If true, result will be formatted
|
1689 |
-
* as "x topics". If false, just a number will be returned.
|
1690 |
-
* Default: false.
|
1691 |
-
* }
|
1692 |
-
* @return string|int
|
1693 |
-
*/
|
1694 |
function bp_get_group_forum_topic_count( $args = '' ) {
|
1695 |
global $groups_template;
|
1696 |
|
@@ -1722,25 +1621,9 @@ function bp_group_forum_topic_count( $args = '' ) {
|
|
1722 |
return apply_filters( 'bp_get_group_forum_topic_count', $total_topics, (bool)$showtext );
|
1723 |
}
|
1724 |
|
1725 |
-
/**
|
1726 |
-
* Output the post count for a group forum.
|
1727 |
-
*
|
1728 |
-
* @param array $args See {@link bp_get_group_forum_post_count()}.
|
1729 |
-
*/
|
1730 |
function bp_group_forum_post_count( $args = '' ) {
|
1731 |
echo bp_get_group_forum_post_count( $args );
|
1732 |
}
|
1733 |
-
/**
|
1734 |
-
* Generate the post count string for a group forum.
|
1735 |
-
*
|
1736 |
-
* @param array $args {
|
1737 |
-
* Array of arguments.
|
1738 |
-
* @type bool $showtext Optional. If true, result will be formatted
|
1739 |
-
* as "x posts". If false, just a number will be returned.
|
1740 |
-
* Default: false.
|
1741 |
-
* }
|
1742 |
-
* @return string|int
|
1743 |
-
*/
|
1744 |
function bp_get_group_forum_post_count( $args = '' ) {
|
1745 |
global $groups_template;
|
1746 |
|
@@ -1772,12 +1655,6 @@ function bp_group_forum_post_count( $args = '' ) {
|
|
1772 |
return apply_filters( 'bp_get_group_forum_post_count', $total_posts, (bool)$showtext );
|
1773 |
}
|
1774 |
|
1775 |
-
/**
|
1776 |
-
* Determine whether forums are enabled for a group.
|
1777 |
-
*
|
1778 |
-
* @param object $group Optional. Group object. Default: current group in loop.
|
1779 |
-
* @return bool
|
1780 |
-
*/
|
1781 |
function bp_group_is_forum_enabled( $group = false ) {
|
1782 |
global $groups_template;
|
1783 |
|
@@ -1790,11 +1667,6 @@ function bp_group_is_forum_enabled( $group = false ) {
|
|
1790 |
return false;
|
1791 |
}
|
1792 |
|
1793 |
-
/**
|
1794 |
-
* Output the 'checked' attribute for the group forums settings UI.
|
1795 |
-
*
|
1796 |
-
* @param object $group Optional. Group object. Default: current group in loop.
|
1797 |
-
*/
|
1798 |
function bp_group_show_forum_setting( $group = false ) {
|
1799 |
global $groups_template;
|
1800 |
|
@@ -1805,12 +1677,6 @@ function bp_group_show_forum_setting( $group = false ) {
|
|
1805 |
echo ' checked="checked"';
|
1806 |
}
|
1807 |
|
1808 |
-
/**
|
1809 |
-
* Output the 'checked' attribute for a given status in the settings UI.
|
1810 |
-
*
|
1811 |
-
* @param string $setting Group status. 'public', 'private', 'hidden'.
|
1812 |
-
* @param object $group Optional. Group object. Default: current group in loop.
|
1813 |
-
*/
|
1814 |
function bp_group_show_status_setting( $setting, $group = false ) {
|
1815 |
global $groups_template;
|
1816 |
|
@@ -1822,13 +1688,12 @@ function bp_group_show_status_setting( $setting, $group = false ) {
|
|
1822 |
}
|
1823 |
|
1824 |
/**
|
1825 |
-
*
|
1826 |
*
|
1827 |
* @since BuddyPress (1.5.0)
|
1828 |
*
|
1829 |
-
* @param string $setting The setting you want to check against ('members',
|
1830 |
-
*
|
1831 |
-
* @param object $group Optional. Group object. Default: current group in loop.
|
1832 |
*/
|
1833 |
function bp_group_show_invite_status_setting( $setting, $group = false ) {
|
1834 |
$group_id = isset( $group->id ) ? $group->id : false;
|
@@ -1840,23 +1705,19 @@ function bp_group_show_invite_status_setting( $setting, $group = false ) {
|
|
1840 |
}
|
1841 |
|
1842 |
/**
|
1843 |
-
* Get the invite status of a group
|
1844 |
*
|
1845 |
-
* 'invite_status' became part of BuddyPress in BP 1.5. In order to provide
|
1846 |
-
*
|
1847 |
-
*
|
1848 |
-
* invitations. Filter 'bp_group_invite_status_fallback' to change this
|
1849 |
-
* fallback behavior.
|
1850 |
*
|
1851 |
* This function can be used either in or out of the loop.
|
1852 |
*
|
1853 |
* @since BuddyPress (1.5.0)
|
1854 |
*
|
1855 |
-
* @param int $group_id
|
1856 |
-
*
|
1857 |
-
*
|
1858 |
-
* returns the group invite status, from among 'members', 'mods', and
|
1859 |
-
* 'admins'.
|
1860 |
*/
|
1861 |
function bp_group_get_invite_status( $group_id = false ) {
|
1862 |
global $bp, $groups_template;
|
@@ -1865,7 +1726,7 @@ function bp_group_get_invite_status( $group_id = false ) {
|
|
1865 |
if ( isset( $bp->groups->current_group->id ) ) {
|
1866 |
// Default to the current group first
|
1867 |
$group_id = $bp->groups->current_group->id;
|
1868 |
-
}
|
1869 |
// Then see if we're in the loop
|
1870 |
$group_id = $groups_template->group->id;
|
1871 |
} else {
|
@@ -1884,70 +1745,57 @@ function bp_group_get_invite_status( $group_id = false ) {
|
|
1884 |
}
|
1885 |
|
1886 |
/**
|
1887 |
-
* Can
|
1888 |
*
|
1889 |
* @since BuddyPress (1.5.0)
|
1890 |
-
* @since BuddyPress (2.2.0) Added the $user_id parameter.
|
1891 |
*
|
1892 |
-
* @param int $group_id The group
|
1893 |
-
* @
|
1894 |
-
* @return bool
|
1895 |
*/
|
1896 |
-
function bp_groups_user_can_send_invites( $group_id =
|
|
|
|
|
1897 |
$can_send_invites = false;
|
1898 |
$invite_status = false;
|
1899 |
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
}
|
1904 |
-
|
1905 |
-
// If $group_id isn't specified, use existing one if available.
|
1906 |
-
if ( ! $group_id ) {
|
1907 |
-
$group_id = bp_get_current_group_id();
|
1908 |
-
}
|
1909 |
-
|
1910 |
-
if ( $user_id ) {
|
1911 |
-
// Users with the 'bp_moderate' cap can always send invitations
|
1912 |
-
if ( user_can( $user_id, 'bp_moderate' ) ) {
|
1913 |
$can_send_invites = true;
|
|
|
1914 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1915 |
$invite_status = bp_group_get_invite_status( $group_id );
|
|
|
|
|
1916 |
|
1917 |
switch ( $invite_status ) {
|
1918 |
case 'admins' :
|
1919 |
-
if ( groups_is_user_admin(
|
1920 |
$can_send_invites = true;
|
1921 |
-
}
|
1922 |
break;
|
1923 |
|
1924 |
case 'mods' :
|
1925 |
-
if ( groups_is_user_mod(
|
1926 |
$can_send_invites = true;
|
1927 |
-
}
|
1928 |
break;
|
1929 |
|
1930 |
case 'members' :
|
1931 |
-
if ( groups_is_user_member(
|
1932 |
$can_send_invites = true;
|
1933 |
-
}
|
1934 |
break;
|
1935 |
}
|
1936 |
}
|
1937 |
}
|
1938 |
|
1939 |
-
|
1940 |
-
* Filters whether a user can send invites in a group.
|
1941 |
-
*
|
1942 |
-
* @since BuddyPress (1.5.0)
|
1943 |
-
* @since BuddyPress (2.2.0) Added the $user_id parameter.
|
1944 |
-
*
|
1945 |
-
* @param bool $can_send_invites Whether the user can send invites
|
1946 |
-
* @param int $group_id The group ID being checked
|
1947 |
-
* @param bool $invite_status The group's current invite status
|
1948 |
-
* @param int $user_id The user ID being checked
|
1949 |
-
*/
|
1950 |
-
return apply_filters( 'bp_groups_user_can_send_invites', $can_send_invites, $group_id, $invite_status, $user_id );
|
1951 |
}
|
1952 |
|
1953 |
/**
|
@@ -2027,13 +1875,6 @@ function bp_group_admin_memberlist( $admin_list = false, $group = false ) {
|
|
2027 |
<?php endif;
|
2028 |
}
|
2029 |
|
2030 |
-
/**
|
2031 |
-
* Generate the HTML for a list of group moderators.
|
2032 |
-
*
|
2033 |
-
* No longer used.
|
2034 |
-
*
|
2035 |
-
* @todo Deprecate.
|
2036 |
-
*/
|
2037 |
function bp_group_mod_memberlist( $admin_list = false, $group = false ) {
|
2038 |
global $groups_template;
|
2039 |
|
@@ -2096,12 +1937,6 @@ function bp_group_mod_memberlist( $admin_list = false, $group = false ) {
|
|
2096 |
<?php }
|
2097 |
}
|
2098 |
|
2099 |
-
/**
|
2100 |
-
* Determine whether a group has moderators.
|
2101 |
-
*
|
2102 |
-
* @param object $group Optional. Group object. Default: current group in loop.
|
2103 |
-
* @return array Info about group admins (user_id + date_modified).
|
2104 |
-
*/
|
2105 |
function bp_group_has_moderators( $group = false ) {
|
2106 |
global $groups_template;
|
2107 |
|
@@ -2111,24 +1946,9 @@ function bp_group_has_moderators( $group = false ) {
|
|
2111 |
return apply_filters( 'bp_group_has_moderators', groups_get_group_mods( $group->id ) );
|
2112 |
}
|
2113 |
|
2114 |
-
/**
|
2115 |
-
* Output a URL for promoting a user to moderator.
|
2116 |
-
*
|
2117 |
-
* @param array $args See {@link bp_get_group_member_promote_mod_link()}.
|
2118 |
-
*/
|
2119 |
function bp_group_member_promote_mod_link( $args = '' ) {
|
2120 |
echo bp_get_group_member_promote_mod_link( $args );
|
2121 |
}
|
2122 |
-
/**
|
2123 |
-
* Generate a URL for promoting a user to moderator.
|
2124 |
-
*
|
2125 |
-
* @param array $args {
|
2126 |
-
* @type int $user_id ID of the member to promote. Default:
|
2127 |
-
* current member in a group member loop.
|
2128 |
-
* @type object $group Group object. Default: current group.
|
2129 |
-
* }
|
2130 |
-
* @return string
|
2131 |
-
*/
|
2132 |
function bp_get_group_member_promote_mod_link( $args = '' ) {
|
2133 |
global $members_template, $groups_template;
|
2134 |
|
@@ -2143,24 +1963,9 @@ function bp_group_member_promote_mod_link( $args = '' ) {
|
|
2143 |
return apply_filters( 'bp_get_group_member_promote_mod_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/promote/mod/' . $user_id, 'groups_promote_member' ) );
|
2144 |
}
|
2145 |
|
2146 |
-
/**
|
2147 |
-
* Output a URL for promoting a user to admin.
|
2148 |
-
*
|
2149 |
-
* @param array $args See {@link bp_get_group_member_promote_admin_link()}.
|
2150 |
-
*/
|
2151 |
function bp_group_member_promote_admin_link( $args = '' ) {
|
2152 |
echo bp_get_group_member_promote_admin_link( $args );
|
2153 |
}
|
2154 |
-
/**
|
2155 |
-
* Generate a URL for promoting a user to admin.
|
2156 |
-
*
|
2157 |
-
* @param array $args {
|
2158 |
-
* @type int $user_id ID of the member to promote. Default:
|
2159 |
-
* current member in a group member loop.
|
2160 |
-
* @type object $group Group object. Default: current group.
|
2161 |
-
* }
|
2162 |
-
* @return string
|
2163 |
-
*/
|
2164 |
function bp_get_group_member_promote_admin_link( $args = '' ) {
|
2165 |
global $members_template, $groups_template;
|
2166 |
|
@@ -2175,12 +1980,6 @@ function bp_group_member_promote_admin_link( $args = '' ) {
|
|
2175 |
return apply_filters( 'bp_get_group_member_promote_admin_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/promote/admin/' . $user_id, 'groups_promote_member' ) );
|
2176 |
}
|
2177 |
|
2178 |
-
/**
|
2179 |
-
* Output a URL for demoting a user to member.
|
2180 |
-
*
|
2181 |
-
* @param int $user_id ID of the member to demote. Default: current member in
|
2182 |
-
* a member loop.
|
2183 |
-
*/
|
2184 |
function bp_group_member_demote_link( $user_id = 0 ) {
|
2185 |
global $members_template;
|
2186 |
|
@@ -2189,14 +1988,6 @@ function bp_group_member_demote_link( $user_id = 0 ) {
|
|
2189 |
|
2190 |
echo bp_get_group_member_demote_link( $user_id );
|
2191 |
}
|
2192 |
-
/**
|
2193 |
-
* Generate a URL for demoting a user to member.
|
2194 |
-
*
|
2195 |
-
* @param int $user_id ID of the member to demote. Default: current
|
2196 |
-
* member in a member loop.
|
2197 |
-
* @param object $group Optional. Group object. Default: current group.
|
2198 |
-
* @return string
|
2199 |
-
*/
|
2200 |
function bp_get_group_member_demote_link( $user_id = 0, $group = false ) {
|
2201 |
global $members_template, $groups_template;
|
2202 |
|
@@ -2209,12 +2000,6 @@ function bp_group_member_demote_link( $user_id = 0 ) {
|
|
2209 |
return apply_filters( 'bp_get_group_member_demote_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/demote/' . $user_id, 'groups_demote_member' ) );
|
2210 |
}
|
2211 |
|
2212 |
-
/**
|
2213 |
-
* Output a URL for banning a member from a group.
|
2214 |
-
*
|
2215 |
-
* @param int $user_id ID of the member to ban. Default: current member in
|
2216 |
-
* a member loop.
|
2217 |
-
*/
|
2218 |
function bp_group_member_ban_link( $user_id = 0 ) {
|
2219 |
global $members_template;
|
2220 |
|
@@ -2223,14 +2008,6 @@ function bp_group_member_ban_link( $user_id = 0 ) {
|
|
2223 |
|
2224 |
echo bp_get_group_member_ban_link( $user_id );
|
2225 |
}
|
2226 |
-
/**
|
2227 |
-
* Generate a URL for banning a member from a group.
|
2228 |
-
*
|
2229 |
-
* @param int $user_id ID of the member to ban. Default: current
|
2230 |
-
* member in a member loop.
|
2231 |
-
* @param object $group Optional. Group object. Default: current group.
|
2232 |
-
* @return string
|
2233 |
-
*/
|
2234 |
function bp_get_group_member_ban_link( $user_id = 0, $group = false ) {
|
2235 |
global $groups_template;
|
2236 |
|
@@ -2240,12 +2017,6 @@ function bp_group_member_ban_link( $user_id = 0 ) {
|
|
2240 |
return apply_filters( 'bp_get_group_member_ban_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/ban/' . $user_id, 'groups_ban_member' ) );
|
2241 |
}
|
2242 |
|
2243 |
-
/**
|
2244 |
-
* Output a URL for unbanning a member from a group.
|
2245 |
-
*
|
2246 |
-
* @param int $user_id ID of the member to unban. Default: current member in
|
2247 |
-
* a member loop.
|
2248 |
-
*/
|
2249 |
function bp_group_member_unban_link( $user_id = 0 ) {
|
2250 |
global $members_template;
|
2251 |
|
@@ -2254,14 +2025,6 @@ function bp_group_member_unban_link( $user_id = 0 ) {
|
|
2254 |
|
2255 |
echo bp_get_group_member_unban_link( $user_id );
|
2256 |
}
|
2257 |
-
/**
|
2258 |
-
* Generate a URL for unbanning a member from a group.
|
2259 |
-
*
|
2260 |
-
* @param int $user_id ID of the member to unban. Default: current
|
2261 |
-
* member in a member loop.
|
2262 |
-
* @param object $group Optional. Group object. Default: current group.
|
2263 |
-
* @return string
|
2264 |
-
*/
|
2265 |
function bp_get_group_member_unban_link( $user_id = 0, $group = false ) {
|
2266 |
global $members_template, $groups_template;
|
2267 |
|
@@ -2274,12 +2037,7 @@ function bp_group_member_unban_link( $user_id = 0 ) {
|
|
2274 |
return apply_filters( 'bp_get_group_member_unban_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/unban/' . $user_id, 'groups_unban_member' ) );
|
2275 |
}
|
2276 |
|
2277 |
-
|
2278 |
-
* Output a URL for removing a member from a group.
|
2279 |
-
*
|
2280 |
-
* @param int $user_id ID of the member to remove. Default: current member in
|
2281 |
-
* a member loop.
|
2282 |
-
*/
|
2283 |
function bp_group_member_remove_link( $user_id = 0 ) {
|
2284 |
global $members_template;
|
2285 |
|
@@ -2288,14 +2046,6 @@ function bp_group_member_remove_link( $user_id = 0 ) {
|
|
2288 |
|
2289 |
echo bp_get_group_member_remove_link( $user_id );
|
2290 |
}
|
2291 |
-
/**
|
2292 |
-
* Generate a URL for removing a member from a group.
|
2293 |
-
*
|
2294 |
-
* @param int $user_id ID of the member to remove. Default: current
|
2295 |
-
* member in a member loop.
|
2296 |
-
* @param object $group Optional. Group object. Default: current group.
|
2297 |
-
* @return string
|
2298 |
-
*/
|
2299 |
function bp_get_group_member_remove_link( $user_id = 0, $group = false ) {
|
2300 |
global $groups_template;
|
2301 |
|
@@ -2305,12 +2055,6 @@ function bp_group_member_remove_link( $user_id = 0 ) {
|
|
2305 |
return apply_filters( 'bp_get_group_member_remove_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/remove/' . $user_id, 'groups_remove_member' ) );
|
2306 |
}
|
2307 |
|
2308 |
-
/**
|
2309 |
-
* HTML admin subnav items for group pages.
|
2310 |
-
*
|
2311 |
-
* @param object $group Optional. Group object. Default: current group in
|
2312 |
-
* the loop.
|
2313 |
-
*/
|
2314 |
function bp_group_admin_tabs( $group = false ) {
|
2315 |
global $groups_template;
|
2316 |
|
@@ -2318,81 +2062,50 @@ function bp_group_admin_tabs( $group = false ) {
|
|
2318 |
$group = ( $groups_template->group ) ? $groups_template->group : groups_get_current_group();
|
2319 |
}
|
2320 |
|
2321 |
-
$
|
2322 |
|
2323 |
-
if (
|
2324 |
-
$css_id = 'membership-requests';
|
2325 |
-
}
|
2326 |
|
2327 |
-
|
2328 |
|
2329 |
-
|
2330 |
|
2331 |
-
|
2332 |
-
|
2333 |
|
2334 |
-
|
2335 |
-
* BackCompat for plugins/themes directly hooking groups_admin_tabs
|
2336 |
-
* without using the Groups Extension API
|
2337 |
-
*
|
2338 |
-
* @param string $subnav_output subnav item output
|
2339 |
-
* @param string $subnav_item subnav item params
|
2340 |
-
* @param string $selected_item current selected tab
|
2341 |
-
* @return string HTML output
|
2342 |
-
*/
|
2343 |
-
function bp_group_admin_tabs_backcompat( $subnav_output = '', $subnav_item = '', $selected_item = '' ) {
|
2344 |
-
if ( ! has_action( 'groups_admin_tabs' ) ) {
|
2345 |
-
return $subnav_output;
|
2346 |
-
}
|
2347 |
|
2348 |
-
|
2349 |
|
2350 |
-
|
2351 |
|
2352 |
-
|
2353 |
|
2354 |
-
$
|
2355 |
-
ob_end_clean();
|
2356 |
|
2357 |
-
if (
|
2358 |
-
|
2359 |
-
$
|
2360 |
-
|
|
|
|
|
|
|
2361 |
|
2362 |
-
|
|
|
|
|
2363 |
}
|
2364 |
|
2365 |
-
/**
|
2366 |
-
* Output the group count for the displayed user.
|
2367 |
-
*/
|
2368 |
function bp_group_total_for_member() {
|
2369 |
echo bp_get_group_total_for_member();
|
2370 |
}
|
2371 |
-
/**
|
2372 |
-
* Get the group count for the displayed user.
|
2373 |
-
*
|
2374 |
-
* @return string
|
2375 |
-
*/
|
2376 |
function bp_get_group_total_for_member() {
|
2377 |
return apply_filters( 'bp_get_group_total_for_member', BP_Groups_Member::total_group_count() );
|
2378 |
}
|
2379 |
|
2380 |
-
/**
|
2381 |
-
* Output the 'action' attribute for a group form.
|
2382 |
-
*
|
2383 |
-
* @param string $page Page slug.
|
2384 |
-
*/
|
2385 |
function bp_group_form_action( $page ) {
|
2386 |
echo bp_get_group_form_action( $page );
|
2387 |
}
|
2388 |
-
/**
|
2389 |
-
* Generate the 'action' attribute for a group form.
|
2390 |
-
*
|
2391 |
-
* @param string $page Page slug.
|
2392 |
-
* @param object $group Optional. Group object. Default: current group
|
2393 |
-
* in the loop.
|
2394 |
-
* @return string
|
2395 |
-
*/
|
2396 |
function bp_get_group_form_action( $page, $group = false ) {
|
2397 |
global $groups_template;
|
2398 |
|
@@ -2402,22 +2115,9 @@ function bp_group_form_action( $page ) {
|
|
2402 |
return apply_filters( 'bp_group_form_action', bp_get_group_permalink( $group ) . $page );
|
2403 |
}
|
2404 |
|
2405 |
-
/**
|
2406 |
-
* Output the 'action' attribute for a group admin form.
|
2407 |
-
*
|
2408 |
-
* @param string $page Optional. Page slug.
|
2409 |
-
*/
|
2410 |
function bp_group_admin_form_action( $page = false ) {
|
2411 |
echo bp_get_group_admin_form_action( $page );
|
2412 |
}
|
2413 |
-
/**
|
2414 |
-
* Generate the 'action' attribute for a group admin form.
|
2415 |
-
*
|
2416 |
-
* @param string $page Optional. Page slug.
|
2417 |
-
* @param object $group Optional. Group object. Default: current group
|
2418 |
-
* in the loop.
|
2419 |
-
* @return string
|
2420 |
-
*/
|
2421 |
function bp_get_group_admin_form_action( $page = false, $group = false ) {
|
2422 |
global $groups_template;
|
2423 |
|
@@ -2430,13 +2130,6 @@ function bp_group_admin_form_action( $page = false ) {
|
|
2430 |
return apply_filters( 'bp_group_admin_form_action', bp_get_group_permalink( $group ) . 'admin/' . $page );
|
2431 |
}
|
2432 |
|
2433 |
-
/**
|
2434 |
-
* Determine whether the logged-in user has requested membership to a group.
|
2435 |
-
*
|
2436 |
-
* @param object $group Optional. Group object. Default: current group in
|
2437 |
-
* the loop.
|
2438 |
-
* @return bool
|
2439 |
-
*/
|
2440 |
function bp_group_has_requested_membership( $group = false ) {
|
2441 |
global $groups_template;
|
2442 |
|
@@ -2450,13 +2143,16 @@ function bp_group_has_requested_membership( $group = false ) {
|
|
2450 |
}
|
2451 |
|
2452 |
/**
|
2453 |
-
*
|
2454 |
*
|
2455 |
-
*
|
2456 |
*
|
2457 |
-
* @
|
2458 |
-
*
|
2459 |
-
* @
|
|
|
|
|
|
|
2460 |
*/
|
2461 |
function bp_group_is_member( $group = false ) {
|
2462 |
global $groups_template;
|
@@ -2474,7 +2170,7 @@ function bp_group_is_member( $group = false ) {
|
|
2474 |
/**
|
2475 |
* Check whether the current user has an outstanding invite to the current group in the loop.
|
2476 |
*
|
2477 |
-
* @param object $group Optional. Group data object.
|
2478 |
* group in the groups loop.
|
2479 |
* @return bool True if the user has an outstanding invite, otherwise false.
|
2480 |
*/
|
@@ -2542,19 +2238,9 @@ function bp_group_is_user_banned( $group = false, $user_id = 0 ) {
|
|
2542 |
return (bool) apply_filters( 'bp_group_is_user_banned', $retval );
|
2543 |
}
|
2544 |
|
2545 |
-
/**
|
2546 |
-
* Output the URL for accepting an invitation to the current group in the loop.
|
2547 |
-
*/
|
2548 |
function bp_group_accept_invite_link() {
|
2549 |
echo bp_get_group_accept_invite_link();
|
2550 |
}
|
2551 |
-
/**
|
2552 |
-
* Generate the URL for accepting an invitation to a group.
|
2553 |
-
*
|
2554 |
-
* @param object $group Optional. Group object. Default: Current group
|
2555 |
-
* in the loop.
|
2556 |
-
* @return string
|
2557 |
-
*/
|
2558 |
function bp_get_group_accept_invite_link( $group = false ) {
|
2559 |
global $groups_template, $bp;
|
2560 |
|
@@ -2564,19 +2250,9 @@ function bp_group_accept_invite_link() {
|
|
2564 |
return apply_filters( 'bp_get_group_accept_invite_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/accept/' . $group->id ), 'groups_accept_invite' ) );
|
2565 |
}
|
2566 |
|
2567 |
-
/**
|
2568 |
-
* Output the URL for accepting an invitation to the current group in the loop.
|
2569 |
-
*/
|
2570 |
function bp_group_reject_invite_link() {
|
2571 |
echo bp_get_group_reject_invite_link();
|
2572 |
}
|
2573 |
-
/**
|
2574 |
-
* Generate the URL for rejecting an invitation to a group.
|
2575 |
-
*
|
2576 |
-
* @param object $group Optional. Group object. Default: Current group
|
2577 |
-
* in the loop.
|
2578 |
-
* @return string
|
2579 |
-
*/
|
2580 |
function bp_get_group_reject_invite_link( $group = false ) {
|
2581 |
global $groups_template, $bp;
|
2582 |
|
@@ -2586,19 +2262,9 @@ function bp_group_reject_invite_link() {
|
|
2586 |
return apply_filters( 'bp_get_group_reject_invite_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/reject/' . $group->id ), 'groups_reject_invite' ) );
|
2587 |
}
|
2588 |
|
2589 |
-
/**
|
2590 |
-
* Output the URL for confirming a request to leave a group.
|
2591 |
-
*/
|
2592 |
function bp_group_leave_confirm_link() {
|
2593 |
echo bp_get_group_leave_confirm_link();
|
2594 |
}
|
2595 |
-
/**
|
2596 |
-
* Generate the URL for confirming a request to leave a group.
|
2597 |
-
*
|
2598 |
-
* @param object $group Optional. Group object. Default: Current group
|
2599 |
-
* in the loop.
|
2600 |
-
* @return string
|
2601 |
-
*/
|
2602 |
function bp_get_group_leave_confirm_link( $group = false ) {
|
2603 |
global $groups_template;
|
2604 |
|
@@ -2608,19 +2274,9 @@ function bp_group_leave_confirm_link() {
|
|
2608 |
return apply_filters( 'bp_group_leave_confirm_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group/yes', 'groups_leave_group' ) );
|
2609 |
}
|
2610 |
|
2611 |
-
/**
|
2612 |
-
* Output the URL for rejecting a request to leave a group.
|
2613 |
-
*/
|
2614 |
function bp_group_leave_reject_link() {
|
2615 |
echo bp_get_group_leave_reject_link();
|
2616 |
}
|
2617 |
-
/**
|
2618 |
-
* Generate the URL for rejecting a request to leave a group.
|
2619 |
-
*
|
2620 |
-
* @param object $group Optional. Group object. Default: Current group
|
2621 |
-
* in the loop.
|
2622 |
-
* @return string
|
2623 |
-
*/
|
2624 |
function bp_get_group_leave_reject_link( $group = false ) {
|
2625 |
global $groups_template;
|
2626 |
|
@@ -2630,19 +2286,9 @@ function bp_group_leave_reject_link() {
|
|
2630 |
return apply_filters( 'bp_get_group_leave_reject_link', bp_get_group_permalink( $group ) );
|
2631 |
}
|
2632 |
|
2633 |
-
/**
|
2634 |
-
* Output the 'action' attribute for a group send invite form.
|
2635 |
-
*/
|
2636 |
function bp_group_send_invite_form_action() {
|
2637 |
echo bp_get_group_send_invite_form_action();
|
2638 |
}
|
2639 |
-
/**
|
2640 |
-
* Output the 'action' attribute for a group send invite form.
|
2641 |
-
*
|
2642 |
-
* @param object $page Optional. Group object. Default: current group
|
2643 |
-
* in the loop.
|
2644 |
-
* @return string
|
2645 |
-
*/
|
2646 |
function bp_get_group_send_invite_form_action( $group = false ) {
|
2647 |
global $groups_template;
|
2648 |
|
@@ -2652,13 +2298,6 @@ function bp_group_send_invite_form_action() {
|
|
2652 |
return apply_filters( 'bp_group_send_invite_form_action', bp_get_group_permalink( $group ) . 'send-invites/send' );
|
2653 |
}
|
2654 |
|
2655 |
-
/**
|
2656 |
-
* Determine whether the current user has friends to invite to a group.
|
2657 |
-
*
|
2658 |
-
* @param object $group Optional. Group object. Default: current group in
|
2659 |
-
* the loop.
|
2660 |
-
* @return bool
|
2661 |
-
*/
|
2662 |
function bp_has_friends_to_invite( $group = false ) {
|
2663 |
global $groups_template;
|
2664 |
|
@@ -2675,12 +2314,12 @@ function bp_has_friends_to_invite( $group = false ) {
|
|
2675 |
}
|
2676 |
|
2677 |
/**
|
2678 |
-
*
|
2679 |
*
|
2680 |
* @since BuddyPress (1.2.7)
|
2681 |
*
|
2682 |
-
* @param BP_Groups_Group|bool $group The BP Groups_Group object if passed,
|
2683 |
-
*
|
2684 |
*/
|
2685 |
function bp_group_new_topic_button( $group = false ) {
|
2686 |
echo bp_get_group_new_topic_button( $group );
|
@@ -2690,9 +2329,13 @@ function bp_group_new_topic_button( $group = false ) {
|
|
2690 |
*
|
2691 |
* @since BuddyPress (1.2.7)
|
2692 |
*
|
2693 |
-
* @param BP_Groups_Group|bool $group The BP Groups_Group object if
|
2694 |
-
*
|
2695 |
-
* @
|
|
|
|
|
|
|
|
|
2696 |
*/
|
2697 |
function bp_get_group_new_topic_button( $group = false ) {
|
2698 |
global $groups_template;
|
@@ -2869,69 +2512,14 @@ function bp_group_create_button() {
|
|
2869 |
'component' => 'groups',
|
2870 |
'link_text' => __( 'Create a Group', 'buddypress' ),
|
2871 |
'link_title' => __( 'Create a Group', 'buddypress' ),
|
2872 |
-
'link_class' => 'group-create
|
2873 |
'link_href' => trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_groups_root_slug() ) . trailingslashit( 'create' ),
|
2874 |
'wrapper' => false,
|
2875 |
-
'block_self' => false,
|
2876 |
);
|
2877 |
|
2878 |
return bp_get_button( apply_filters( 'bp_get_group_create_button', $button_args ) );
|
2879 |
}
|
2880 |
|
2881 |
-
/**
|
2882 |
-
* Output the Create a Group nav item.
|
2883 |
-
*
|
2884 |
-
* @since BuddyPress (2.2.0)
|
2885 |
-
*/
|
2886 |
-
function bp_group_create_nav_item() {
|
2887 |
-
echo bp_get_group_create_nav_item();
|
2888 |
-
}
|
2889 |
-
|
2890 |
-
/**
|
2891 |
-
* Get the Create a Group nav item.
|
2892 |
-
*
|
2893 |
-
* @since BuddyPress (2.2.0)
|
2894 |
-
*
|
2895 |
-
* @return string
|
2896 |
-
*/
|
2897 |
-
function bp_get_group_create_nav_item() {
|
2898 |
-
// Get the create a group button
|
2899 |
-
$create_group_button = bp_get_group_create_button();
|
2900 |
-
|
2901 |
-
// Make sure the button is available
|
2902 |
-
if ( empty( $create_group_button ) ) {
|
2903 |
-
return;
|
2904 |
-
}
|
2905 |
-
|
2906 |
-
$output = '<li id="group-create-nav">' . $create_group_button . '</li>';
|
2907 |
-
|
2908 |
-
return apply_filters( 'bp_get_group_create_nav_item', $output );
|
2909 |
-
}
|
2910 |
-
|
2911 |
-
/**
|
2912 |
-
* Checks if a specific theme is still filtering the Groups directory title
|
2913 |
-
* if so, transform the title button into a Groups directory nav item.
|
2914 |
-
*
|
2915 |
-
* @since BuddyPress (2.2.0)
|
2916 |
-
*
|
2917 |
-
* @uses bp_group_create_nav_item() to output the create a Group nav item
|
2918 |
-
* @return string HTML Output
|
2919 |
-
*/
|
2920 |
-
function bp_group_backcompat_create_nav_item() {
|
2921 |
-
// Bail if the Groups nav item is already used by bp-legacy
|
2922 |
-
if ( has_action( 'bp_groups_directory_group_filter', 'bp_legacy_theme_group_create_nav', 999 ) ) {
|
2923 |
-
return;
|
2924 |
-
}
|
2925 |
-
|
2926 |
-
// Bail if the theme is not filtering the Groups directory title
|
2927 |
-
if ( ! has_filter( 'bp_groups_directory_header' ) ) {
|
2928 |
-
return;
|
2929 |
-
}
|
2930 |
-
|
2931 |
-
bp_group_create_nav_item();
|
2932 |
-
}
|
2933 |
-
add_action( 'bp_groups_directory_group_filter', 'bp_group_backcompat_create_nav_item', 1000 );
|
2934 |
-
|
2935 |
/**
|
2936 |
* Prints a message if the group is not visible to the current user (it is a
|
2937 |
* hidden or private group, and the user does not have access).
|
@@ -2950,7 +2538,7 @@ function bp_group_status_message( $group = null ) {
|
|
2950 |
if ( ! bp_group_has_requested_membership() ) {
|
2951 |
if ( is_user_logged_in() && bp_group_is_invited() ) {
|
2952 |
$message = __( 'You must accept your pending invitation before you can access this private group.', 'buddypress' );
|
2953 |
-
}
|
2954 |
$message = __( 'This is a private group and you must request group membership in order to join.', 'buddypress' );
|
2955 |
} else {
|
2956 |
$message = __( 'This is a private group. To join you must be a registered site member and request group membership.', 'buddypress' );
|
@@ -3058,7 +2646,6 @@ class BP_Groups_Group_Members_Template {
|
|
3058 |
'group_id' => bp_get_current_group_id(),
|
3059 |
'page' => 1,
|
3060 |
'per_page' => 20,
|
3061 |
-
'page_arg' => 'mlpage',
|
3062 |
'max' => false,
|
3063 |
'exclude' => false,
|
3064 |
'exclude_admins_mods' => 1,
|
@@ -3071,9 +2658,8 @@ class BP_Groups_Group_Members_Template {
|
|
3071 |
// @todo No
|
3072 |
extract( $r );
|
3073 |
|
3074 |
-
$this->
|
3075 |
-
$this->
|
3076 |
-
$this->pag_num = bp_sanitize_pagination_arg( 'num', $r['per_page'] );
|
3077 |
|
3078 |
/**
|
3079 |
* Check the current group is the same as the supplied group ID.
|
@@ -3114,14 +2700,13 @@ class BP_Groups_Group_Members_Template {
|
|
3114 |
}
|
3115 |
|
3116 |
$this->pag_links = paginate_links( array(
|
3117 |
-
'base'
|
3118 |
-
'format'
|
3119 |
-
'total'
|
3120 |
-
'current'
|
3121 |
'prev_text' => '←',
|
3122 |
'next_text' => '→',
|
3123 |
-
'mid_size'
|
3124 |
-
'add_args' => array(),
|
3125 |
));
|
3126 |
}
|
3127 |
|
@@ -4095,17 +3680,15 @@ class BP_Groups_Membership_Requests_Template {
|
|
4095 |
}
|
4096 |
|
4097 |
$r = wp_parse_args( $args, array(
|
4098 |
-
'
|
4099 |
'per_page' => 10,
|
4100 |
-
'
|
4101 |
'max' => false,
|
4102 |
'type' => 'first_joined',
|
4103 |
-
'group_id' => bp_get_current_group_id(),
|
4104 |
) );
|
4105 |
|
4106 |
-
$this->
|
4107 |
-
$this->
|
4108 |
-
$this->pag_num = bp_sanitize_pagination_arg( 'num', $r['per_page'] );
|
4109 |
|
4110 |
$mquery = new BP_Group_Member_Query( array(
|
4111 |
'group_id' => $r['group_id'],
|
@@ -4148,14 +3731,13 @@ class BP_Groups_Membership_Requests_Template {
|
|
4148 |
}
|
4149 |
|
4150 |
$this->pag_links = paginate_links( array(
|
4151 |
-
'base'
|
4152 |
-
'format'
|
4153 |
-
'total'
|
4154 |
-
'current'
|
4155 |
'prev_text' => '←',
|
4156 |
'next_text' => '→',
|
4157 |
-
'mid_size'
|
4158 |
-
'add_args' => array(),
|
4159 |
) );
|
4160 |
}
|
4161 |
|
@@ -4365,16 +3947,14 @@ class BP_Groups_Invite_Template {
|
|
4365 |
}
|
4366 |
|
4367 |
$r = wp_parse_args( $args, array(
|
4368 |
-
'page' => 1,
|
4369 |
-
'per_page' => 10,
|
4370 |
-
'page_arg' => 'invitepage',
|
4371 |
'user_id' => bp_loggedin_user_id(),
|
4372 |
'group_id' => bp_get_current_group_id(),
|
|
|
|
|
4373 |
) );
|
4374 |
|
4375 |
-
$this->
|
4376 |
-
$this->pag_page =
|
4377 |
-
$this->pag_num = bp_sanitize_pagination_arg( 'num', $r['per_page'] );
|
4378 |
|
4379 |
$iquery = new BP_Group_Member_Query( array(
|
4380 |
'group_id' => $r['group_id'],
|
@@ -4396,14 +3976,13 @@ class BP_Groups_Invite_Template {
|
|
4396 |
// pag_links
|
4397 |
if ( ! empty( $this->pag_num ) ) {
|
4398 |
$this->pag_links = paginate_links( array(
|
4399 |
-
'base' => add_query_arg(
|
4400 |
'format' => '',
|
4401 |
'total' => ceil( $this->total_invite_count / $this->pag_num ),
|
4402 |
'current' => $this->pag_page,
|
4403 |
'prev_text' => '←',
|
4404 |
'next_text' => '→',
|
4405 |
'mid_size' => 1,
|
4406 |
-
'add_args' => array(),
|
4407 |
) );
|
4408 |
} else {
|
4409 |
$this->pag_links = '';
|
@@ -4475,9 +4054,13 @@ class BP_Groups_Invite_Template {
|
|
4475 |
$this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count( $user_id );
|
4476 |
}
|
4477 |
|
|
|
|
|
|
|
|
|
4478 |
$this->invite->user->total_blogs = null;
|
4479 |
|
4480 |
-
$this->invite->group_id = $group_id; //
|
4481 |
|
4482 |
if ( 0 == $this->current_invite ) // loop has just started
|
4483 |
do_action('loop_start');
|
5 |
*/
|
6 |
|
7 |
// Exit if accessed directly
|
8 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
|
10 |
/**
|
11 |
* Output the groups component slug.
|
206 |
}
|
207 |
|
208 |
$defaults = array(
|
209 |
+
'type' => 'active',
|
210 |
+
'page' => 1,
|
211 |
+
'per_page' => 20,
|
212 |
+
'max' => false,
|
213 |
+
'show_hidden' => false,
|
214 |
+
'page_arg' => 'grpage',
|
215 |
+
'user_id' => 0,
|
216 |
+
'slug' => false,
|
217 |
+
'include' => false,
|
218 |
+
'exclude' => false,
|
219 |
+
'search_terms' => '',
|
220 |
+
'meta_query' => false,
|
221 |
+
'populate_extras' => true,
|
|
|
|
|
222 |
'update_meta_cache' => true,
|
223 |
);
|
224 |
|
225 |
$r = wp_parse_args( $args, $defaults );
|
226 |
extract( $r );
|
227 |
|
228 |
+
$this->pag_page = isset( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : $page;
|
229 |
+
$this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
|
|
|
230 |
|
231 |
if ( bp_current_user_can( 'bp_moderate' ) || ( is_user_logged_in() && $user_id == bp_loggedin_user_id() ) )
|
232 |
$show_hidden = true;
|
233 |
|
234 |
if ( 'invites' == $type ) {
|
235 |
$this->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->pag_page, $exclude );
|
236 |
+
} else if ( 'single-group' == $type ) {
|
237 |
$this->single_group = true;
|
238 |
|
239 |
if ( groups_get_current_group() ) {
|
279 |
$this->total_group_count = (int) $this->groups['total'];
|
280 |
$this->group_count = (int) $this->groups['total'];
|
281 |
$this->groups = $this->groups['groups'];
|
282 |
+
} else if ( 'single-group' == $type ) {
|
283 |
if ( empty( $group->id ) ) {
|
284 |
$this->total_group_count = 0;
|
285 |
$this->group_count = 0;
|
310 |
// Build pagination links
|
311 |
if ( (int) $this->total_group_count && (int) $this->pag_num ) {
|
312 |
$pag_args = array(
|
313 |
+
$page_arg => '%#%',
|
314 |
+
'num' => $this->pag_num,
|
315 |
+
'sortby' => $this->sort_by,
|
316 |
+
'order' => $this->order,
|
317 |
);
|
318 |
|
319 |
if ( defined( 'DOING_AJAX' ) && true === (bool) DOING_AJAX ) {
|
322 |
$base = '';
|
323 |
}
|
324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
if ( ! empty( $search_terms ) ) {
|
326 |
+
$pag_args['s'] = $search_terms;
|
327 |
}
|
328 |
|
329 |
$this->pag_links = paginate_links( array(
|
333 |
'current' => $this->pag_page,
|
334 |
'prev_text' => _x( '←', 'Group pagination previous text', 'buddypress' ),
|
335 |
'next_text' => _x( '→', 'Group pagination next text', 'buddypress' ),
|
336 |
+
'mid_size' => 1
|
|
|
337 |
) );
|
338 |
}
|
339 |
}
|
423 |
*
|
424 |
* @param array $args {
|
425 |
* Array of parameters. All items are optional.
|
426 |
+
* @type string $type Optional. Shorthand for certain orderby/
|
427 |
* order combinations. 'newest', 'active', 'popular',
|
428 |
* 'alphabetical', 'random'. When present, will override
|
429 |
* orderby and order params. Default: null.
|
430 |
+
* @type string $orderby Optional. Property to sort by.
|
431 |
* 'date_created', 'last_activity', 'total_member_count',
|
432 |
* 'name', 'random'. Default: 'date_created'.
|
433 |
+
* @type string $order Optional. Sort order. 'ASC' or 'DESC'.
|
434 |
* Default: 'DESC'.
|
435 |
+
* @type int $per_page Optional. Number of items to return per page
|
436 |
* of results. Default: null (no limit).
|
437 |
+
* @type int $page Optional. Page offset of results to return.
|
438 |
* Default: null (no limit).
|
439 |
+
* @type int $user_id Optional. If provided, results will be limited
|
440 |
* to groups of which the specified user is a member. Default:
|
441 |
* null.
|
442 |
+
* @type string $search_terms Optional. If provided, only groups
|
443 |
* whose names or descriptions match the search terms will be
|
444 |
* returned. Default: false.
|
445 |
+
* @type array $meta_query Optional. An array of meta_query
|
446 |
* conditions. See {@link WP_Meta_Query::queries} for
|
447 |
* description.
|
448 |
+
* @type array|string Optional. Array or comma-separated list of
|
449 |
* group IDs. Results will be limited to groups within the
|
450 |
* list. Default: false.
|
451 |
* @type bool $populate_extras Whether to fetch additional
|
452 |
* information (such as member count) about groups. Default:
|
453 |
* true.
|
454 |
+
* @type array|string Optional. Array or comma-separated list of
|
455 |
* group IDs. Results will exclude the listed groups.
|
456 |
* Default: false.
|
457 |
* @type bool $show_hidden Whether to include hidden groups in
|
706 |
|
707 |
if ( 'public' == $group->status ) {
|
708 |
$type = __( "Public Group", "buddypress" );
|
709 |
+
} else if ( 'hidden' == $group->status ) {
|
710 |
$type = __( "Hidden Group", "buddypress" );
|
711 |
+
} else if ( 'private' == $group->status ) {
|
712 |
$type = __( "Private Group", "buddypress" );
|
713 |
} else {
|
714 |
$type = ucwords( $group->status ) . ' ' . __( 'Group', 'buddypress' );
|
1507 |
echo apply_filters( 'bp_group_search_form', $search_form_html );
|
1508 |
}
|
1509 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1510 |
function bp_group_show_no_groups_message() {
|
1511 |
if ( !groups_total_groups_for_user( bp_displayed_user_id() ) )
|
1512 |
return true;
|
1514 |
return false;
|
1515 |
}
|
1516 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1517 |
function bp_group_is_activity_permalink() {
|
1518 |
|
1519 |
if ( !bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action( bp_get_activity_slug() ) )
|
1522 |
return true;
|
1523 |
}
|
1524 |
|
|
|
|
|
|
|
1525 |
function bp_groups_pagination_links() {
|
1526 |
echo bp_get_groups_pagination_links();
|
1527 |
}
|
|
|
|
|
|
|
|
|
|
|
1528 |
function bp_get_groups_pagination_links() {
|
1529 |
global $groups_template;
|
1530 |
|
1531 |
return apply_filters( 'bp_get_groups_pagination_links', $groups_template->pag_links );
|
1532 |
}
|
1533 |
|
|
|
|
|
|
|
1534 |
function bp_groups_pagination_count() {
|
1535 |
echo bp_get_groups_pagination_count();
|
1536 |
}
|
|
|
|
|
|
|
|
|
|
|
1537 |
function bp_get_groups_pagination_count() {
|
1538 |
global $groups_template;
|
1539 |
|
1542 |
$to_num = bp_core_number_format( ( $start_num + ( $groups_template->pag_num - 1 ) > $groups_template->total_group_count ) ? $groups_template->total_group_count : $start_num + ( $groups_template->pag_num - 1 ) );
|
1543 |
$total = bp_core_number_format( $groups_template->total_group_count );
|
1544 |
|
1545 |
+
return apply_filters( 'bp_get_groups_pagination_count', sprintf( _n( 'Viewing 1', 'Viewing %1$s - %2$s of %3$s groups', $total, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total );
|
1546 |
}
|
1547 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1548 |
function bp_groups_auto_join() {
|
1549 |
global $bp;
|
1550 |
|
1551 |
return apply_filters( 'bp_groups_auto_join', (bool)$bp->groups->auto_join );
|
1552 |
}
|
1553 |
|
|
|
|
|
|
|
|
|
|
|
1554 |
function bp_group_total_members( $group = false ) {
|
1555 |
echo bp_get_group_total_members( $group );
|
1556 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1557 |
function bp_get_group_total_members( $group = false ) {
|
1558 |
global $groups_template;
|
1559 |
|
1563 |
return apply_filters( 'bp_get_group_total_members', $group->total_member_count );
|
1564 |
}
|
1565 |
|
|
|
|
|
|
|
|
|
|
|
1566 |
function bp_group_member_count() {
|
1567 |
echo bp_get_group_member_count();
|
1568 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1569 |
function bp_get_group_member_count() {
|
1570 |
global $groups_template;
|
1571 |
|
1572 |
+
if ( 1 == (int) $groups_template->group->total_member_count )
|
1573 |
+
return apply_filters( 'bp_get_group_member_count', sprintf( __( '%s member', 'buddypress' ), bp_core_number_format( $groups_template->group->total_member_count ) ) );
|
1574 |
+
else
|
1575 |
+
return apply_filters( 'bp_get_group_member_count', sprintf( __( '%s members', 'buddypress' ), bp_core_number_format( $groups_template->group->total_member_count ) ) );
|
|
|
|
|
|
|
|
|
|
|
1576 |
}
|
1577 |
|
|
|
|
|
|
|
1578 |
function bp_group_forum_permalink() {
|
1579 |
echo bp_get_group_forum_permalink();
|
1580 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1581 |
function bp_get_group_forum_permalink( $group = false ) {
|
1582 |
global $groups_template;
|
1583 |
|
1587 |
return apply_filters( 'bp_get_group_forum_permalink', bp_get_group_permalink( $group ) . 'forum' );
|
1588 |
}
|
1589 |
|
|
|
|
|
|
|
|
|
|
|
1590 |
function bp_group_forum_topic_count( $args = '' ) {
|
1591 |
echo bp_get_group_forum_topic_count( $args );
|
1592 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1593 |
function bp_get_group_forum_topic_count( $args = '' ) {
|
1594 |
global $groups_template;
|
1595 |
|
1621 |
return apply_filters( 'bp_get_group_forum_topic_count', $total_topics, (bool)$showtext );
|
1622 |
}
|
1623 |
|
|
|
|
|
|
|
|
|
|
|
1624 |
function bp_group_forum_post_count( $args = '' ) {
|
1625 |
echo bp_get_group_forum_post_count( $args );
|
1626 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1627 |
function bp_get_group_forum_post_count( $args = '' ) {
|
1628 |
global $groups_template;
|
1629 |
|
1655 |
return apply_filters( 'bp_get_group_forum_post_count', $total_posts, (bool)$showtext );
|
1656 |
}
|
1657 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1658 |
function bp_group_is_forum_enabled( $group = false ) {
|
1659 |
global $groups_template;
|
1660 |
|
1667 |
return false;
|
1668 |
}
|
1669 |
|
|
|
|
|
|
|
|
|
|
|
1670 |
function bp_group_show_forum_setting( $group = false ) {
|
1671 |
global $groups_template;
|
1672 |
|
1677 |
echo ' checked="checked"';
|
1678 |
}
|
1679 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1680 |
function bp_group_show_status_setting( $setting, $group = false ) {
|
1681 |
global $groups_template;
|
1682 |
|
1688 |
}
|
1689 |
|
1690 |
/**
|
1691 |
+
* Get the 'checked' value, if needed, for a given invite_status on the group create/admin screens
|
1692 |
*
|
1693 |
* @since BuddyPress (1.5.0)
|
1694 |
*
|
1695 |
+
* @param string $setting The setting you want to check against ('members', 'mods', or 'admins')
|
1696 |
+
* @param BP_Groups_Group $group (optional) The group whose status you want to check
|
|
|
1697 |
*/
|
1698 |
function bp_group_show_invite_status_setting( $setting, $group = false ) {
|
1699 |
$group_id = isset( $group->id ) ? $group->id : false;
|
1705 |
}
|
1706 |
|
1707 |
/**
|
1708 |
+
* Get the invite status of a group
|
1709 |
*
|
1710 |
+
* 'invite_status' became part of BuddyPress in BP 1.5. In order to provide backward compatibility,
|
1711 |
+
* groups without a status set will default to 'members', ie all members in a group can send
|
1712 |
+
* invitations. Filter 'bp_group_invite_status_fallback' to change this fallback behavior.
|
|
|
|
|
1713 |
*
|
1714 |
* This function can be used either in or out of the loop.
|
1715 |
*
|
1716 |
* @since BuddyPress (1.5.0)
|
1717 |
*
|
1718 |
+
* @param int $group_id (optional) The id of the group whose status you want to check
|
1719 |
+
* @return mixed Returns false when no group can be found. Otherwise returns the group invite
|
1720 |
+
* status, from among 'members', 'mods', and 'admins'
|
|
|
|
|
1721 |
*/
|
1722 |
function bp_group_get_invite_status( $group_id = false ) {
|
1723 |
global $bp, $groups_template;
|
1726 |
if ( isset( $bp->groups->current_group->id ) ) {
|
1727 |
// Default to the current group first
|
1728 |
$group_id = $bp->groups->current_group->id;
|
1729 |
+
} else if ( isset( $groups_template->group->id ) ) {
|
1730 |
// Then see if we're in the loop
|
1731 |
$group_id = $groups_template->group->id;
|
1732 |
} else {
|
1745 |
}
|
1746 |
|
1747 |
/**
|
1748 |
+
* Can the logged-in user send invitations in the specified group?
|
1749 |
*
|
1750 |
* @since BuddyPress (1.5.0)
|
|
|
1751 |
*
|
1752 |
+
* @param int $group_id (optional) The id of the group whose status you want to check
|
1753 |
+
* @return bool $can_send_invites
|
|
|
1754 |
*/
|
1755 |
+
function bp_groups_user_can_send_invites( $group_id = false ) {
|
1756 |
+
global $bp;
|
1757 |
+
|
1758 |
$can_send_invites = false;
|
1759 |
$invite_status = false;
|
1760 |
|
1761 |
+
if ( is_user_logged_in() ) {
|
1762 |
+
if ( bp_current_user_can( 'bp_moderate' ) ) {
|
1763 |
+
// Super admins can always send invitations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1764 |
$can_send_invites = true;
|
1765 |
+
|
1766 |
} else {
|
1767 |
+
// If no $group_id is provided, default to the current group id
|
1768 |
+
if ( !$group_id )
|
1769 |
+
$group_id = isset( $bp->groups->current_group->id ) ? $bp->groups->current_group->id : 0;
|
1770 |
+
|
1771 |
+
// If no group has been found, bail
|
1772 |
+
if ( !$group_id )
|
1773 |
+
return false;
|
1774 |
+
|
1775 |
$invite_status = bp_group_get_invite_status( $group_id );
|
1776 |
+
if ( !$invite_status )
|
1777 |
+
return false;
|
1778 |
|
1779 |
switch ( $invite_status ) {
|
1780 |
case 'admins' :
|
1781 |
+
if ( groups_is_user_admin( bp_loggedin_user_id(), $group_id ) )
|
1782 |
$can_send_invites = true;
|
|
|
1783 |
break;
|
1784 |
|
1785 |
case 'mods' :
|
1786 |
+
if ( groups_is_user_mod( bp_loggedin_user_id(), $group_id ) || groups_is_user_admin( bp_loggedin_user_id(), $group_id ) )
|
1787 |
$can_send_invites = true;
|
|
|
1788 |
break;
|
1789 |
|
1790 |
case 'members' :
|
1791 |
+
if ( groups_is_user_member( bp_loggedin_user_id(), $group_id ) )
|
1792 |
$can_send_invites = true;
|
|
|
1793 |
break;
|
1794 |
}
|
1795 |
}
|
1796 |
}
|
1797 |
|
1798 |
+
return apply_filters( 'bp_groups_user_can_send_invites', $can_send_invites, $group_id, $invite_status );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1799 |
}
|
1800 |
|
1801 |
/**
|
1875 |
<?php endif;
|
1876 |
}
|
1877 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1878 |
function bp_group_mod_memberlist( $admin_list = false, $group = false ) {
|
1879 |
global $groups_template;
|
1880 |
|
1937 |
<?php }
|
1938 |
}
|
1939 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1940 |
function bp_group_has_moderators( $group = false ) {
|
1941 |
global $groups_template;
|
1942 |
|
1946 |
return apply_filters( 'bp_group_has_moderators', groups_get_group_mods( $group->id ) );
|
1947 |
}
|
1948 |
|
|
|
|
|
|
|
|
|
|
|
1949 |
function bp_group_member_promote_mod_link( $args = '' ) {
|
1950 |
echo bp_get_group_member_promote_mod_link( $args );
|
1951 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1952 |
function bp_get_group_member_promote_mod_link( $args = '' ) {
|
1953 |
global $members_template, $groups_template;
|
1954 |
|
1963 |
return apply_filters( 'bp_get_group_member_promote_mod_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/promote/mod/' . $user_id, 'groups_promote_member' ) );
|
1964 |
}
|
1965 |
|
|
|
|
|
|
|
|
|
|
|
1966 |
function bp_group_member_promote_admin_link( $args = '' ) {
|
1967 |
echo bp_get_group_member_promote_admin_link( $args );
|
1968 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1969 |
function bp_get_group_member_promote_admin_link( $args = '' ) {
|
1970 |
global $members_template, $groups_template;
|
1971 |
|
1980 |
return apply_filters( 'bp_get_group_member_promote_admin_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/promote/admin/' . $user_id, 'groups_promote_member' ) );
|
1981 |
}
|
1982 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1983 |
function bp_group_member_demote_link( $user_id = 0 ) {
|
1984 |
global $members_template;
|
1985 |
|
1988 |
|
1989 |
echo bp_get_group_member_demote_link( $user_id );
|
1990 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1991 |
function bp_get_group_member_demote_link( $user_id = 0, $group = false ) {
|
1992 |
global $members_template, $groups_template;
|
1993 |
|
2000 |
return apply_filters( 'bp_get_group_member_demote_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/demote/' . $user_id, 'groups_demote_member' ) );
|
2001 |
}
|
2002 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2003 |
function bp_group_member_ban_link( $user_id = 0 ) {
|
2004 |
global $members_template;
|
2005 |
|
2008 |
|
2009 |
echo bp_get_group_member_ban_link( $user_id );
|
2010 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011 |
function bp_get_group_member_ban_link( $user_id = 0, $group = false ) {
|
2012 |
global $groups_template;
|
2013 |
|
2017 |
return apply_filters( 'bp_get_group_member_ban_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/ban/' . $user_id, 'groups_ban_member' ) );
|
2018 |
}
|
2019 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2020 |
function bp_group_member_unban_link( $user_id = 0 ) {
|
2021 |
global $members_template;
|
2022 |
|
2025 |
|
2026 |
echo bp_get_group_member_unban_link( $user_id );
|
2027 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2028 |
function bp_get_group_member_unban_link( $user_id = 0, $group = false ) {
|
2029 |
global $members_template, $groups_template;
|
2030 |
|
2037 |
return apply_filters( 'bp_get_group_member_unban_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/unban/' . $user_id, 'groups_unban_member' ) );
|
2038 |
}
|
2039 |
|
2040 |
+
|
|
|
|
|
|
|
|
|
|
|
2041 |
function bp_group_member_remove_link( $user_id = 0 ) {
|
2042 |
global $members_template;
|
2043 |
|
2046 |
|
2047 |
echo bp_get_group_member_remove_link( $user_id );
|
2048 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2049 |
function bp_get_group_member_remove_link( $user_id = 0, $group = false ) {
|
2050 |
global $groups_template;
|
2051 |
|
2055 |
return apply_filters( 'bp_get_group_member_remove_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'admin/manage-members/remove/' . $user_id, 'groups_remove_member' ) );
|
2056 |
}
|
2057 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2058 |
function bp_group_admin_tabs( $group = false ) {
|
2059 |
global $groups_template;
|
2060 |
|
2062 |
$group = ( $groups_template->group ) ? $groups_template->group : groups_get_current_group();
|
2063 |
}
|
2064 |
|
2065 |
+
$current_tab = bp_get_group_current_admin_tab();
|
2066 |
|
2067 |
+
if ( bp_is_item_admin() ) : ?>
|
|
|
|
|
2068 |
|
2069 |
+
<li<?php if ( 'edit-details' == $current_tab || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/edit-details' ) ?>"><?php _e( 'Details', 'buddypress' ); ?></a></li>
|
2070 |
|
2071 |
+
<?php endif; ?>
|
2072 |
|
2073 |
+
<?php if ( ! bp_is_item_admin() )
|
2074 |
+
return false; ?>
|
2075 |
|
2076 |
+
<li<?php if ( 'group-settings' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/group-settings' ) ?>"><?php _e( 'Settings', 'buddypress' ); ?></a></li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2077 |
|
2078 |
+
<?php if ( !(int)bp_get_option( 'bp-disable-avatar-uploads' ) && buddypress()->avatar->show_avatars ) : ?>
|
2079 |
|
2080 |
+
<li<?php if ( 'group-avatar' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/group-avatar' ) ?>"><?php _e( 'Photo', 'buddypress' ); ?></a></li>
|
2081 |
|
2082 |
+
<?php endif; ?>
|
2083 |
|
2084 |
+
<li<?php if ( 'manage-members' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/manage-members' ) ?>"><?php _e( 'Members', 'buddypress' ); ?></a></li>
|
|
|
2085 |
|
2086 |
+
<?php if ( $groups_template->group->status == 'private' ) : ?>
|
2087 |
+
|
2088 |
+
<li<?php if ( 'membership-requests' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/membership-requests' ) ?>"><?php _e( 'Requests', 'buddypress' ); ?></a></li>
|
2089 |
+
|
2090 |
+
<?php endif; ?>
|
2091 |
+
|
2092 |
+
<?php do_action( 'groups_admin_tabs', $current_tab, $group->slug ) ?>
|
2093 |
|
2094 |
+
<li<?php if ( 'delete-group' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/delete-group' ) ?>"><?php _e( 'Delete', 'buddypress' ); ?></a></li>
|
2095 |
+
|
2096 |
+
<?php
|
2097 |
}
|
2098 |
|
|
|
|
|
|
|
2099 |
function bp_group_total_for_member() {
|
2100 |
echo bp_get_group_total_for_member();
|
2101 |
}
|
|
|
|
|
|
|
|
|
|
|
2102 |
function bp_get_group_total_for_member() {
|
2103 |
return apply_filters( 'bp_get_group_total_for_member', BP_Groups_Member::total_group_count() );
|
2104 |
}
|
2105 |
|
|
|
|
|
|
|
|
|
|
|
2106 |
function bp_group_form_action( $page ) {
|
2107 |
echo bp_get_group_form_action( $page );
|
2108 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2109 |
function bp_get_group_form_action( $page, $group = false ) {
|
2110 |
global $groups_template;
|
2111 |
|
2115 |
return apply_filters( 'bp_group_form_action', bp_get_group_permalink( $group ) . $page );
|
2116 |
}
|
2117 |
|
|
|
|
|
|
|
|
|
|
|
2118 |
function bp_group_admin_form_action( $page = false ) {
|
2119 |
echo bp_get_group_admin_form_action( $page );
|
2120 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2121 |
function bp_get_group_admin_form_action( $page = false, $group = false ) {
|
2122 |
global $groups_template;
|
2123 |
|
2130 |
return apply_filters( 'bp_group_admin_form_action', bp_get_group_permalink( $group ) . 'admin/' . $page );
|
2131 |
}
|
2132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2133 |
function bp_group_has_requested_membership( $group = false ) {
|
2134 |
global $groups_template;
|
2135 |
|
2143 |
}
|
2144 |
|
2145 |
/**
|
2146 |
+
* bp_group_is_member()
|
2147 |
*
|
2148 |
+
* Checks if current user is member of a group.
|
2149 |
*
|
2150 |
+
* @uses bp_current_user_can() Check if current user is super admin
|
2151 |
+
* @uses apply_filters Creates bp_group_is_member filter and passes $is_member
|
2152 |
+
* @usedby groups/activity.php, groups/single/forum/edit.php, groups/single/forum/topic.php to determine template part visibility
|
2153 |
+
* @global object $groups_template Current Group (usually in template loop)
|
2154 |
+
* @param object $group Group to check is_member
|
2155 |
+
* @return bool If user is member of group or not
|
2156 |
*/
|
2157 |
function bp_group_is_member( $group = false ) {
|
2158 |
global $groups_template;
|
2170 |
/**
|
2171 |
* Check whether the current user has an outstanding invite to the current group in the loop.
|
2172 |
*
|
2173 |
+
* @param object $group Optional. Group data object. Defaults to the current
|
2174 |
* group in the groups loop.
|
2175 |
* @return bool True if the user has an outstanding invite, otherwise false.
|
2176 |
*/
|
2238 |
return (bool) apply_filters( 'bp_group_is_user_banned', $retval );
|
2239 |
}
|
2240 |
|
|
|
|
|
|
|
2241 |
function bp_group_accept_invite_link() {
|
2242 |
echo bp_get_group_accept_invite_link();
|
2243 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2244 |
function bp_get_group_accept_invite_link( $group = false ) {
|
2245 |
global $groups_template, $bp;
|
2246 |
|
2250 |
return apply_filters( 'bp_get_group_accept_invite_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/accept/' . $group->id ), 'groups_accept_invite' ) );
|
2251 |
}
|
2252 |
|
|
|
|
|
|
|
2253 |
function bp_group_reject_invite_link() {
|
2254 |
echo bp_get_group_reject_invite_link();
|
2255 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2256 |
function bp_get_group_reject_invite_link( $group = false ) {
|
2257 |
global $groups_template, $bp;
|
2258 |
|
2262 |
return apply_filters( 'bp_get_group_reject_invite_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/reject/' . $group->id ), 'groups_reject_invite' ) );
|
2263 |
}
|
2264 |
|
|
|
|
|
|
|
2265 |
function bp_group_leave_confirm_link() {
|
2266 |
echo bp_get_group_leave_confirm_link();
|
2267 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2268 |
function bp_get_group_leave_confirm_link( $group = false ) {
|
2269 |
global $groups_template;
|
2270 |
|
2274 |
return apply_filters( 'bp_group_leave_confirm_link', wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group/yes', 'groups_leave_group' ) );
|
2275 |
}
|
2276 |
|
|
|
|
|
|
|
2277 |
function bp_group_leave_reject_link() {
|
2278 |
echo bp_get_group_leave_reject_link();
|
2279 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2280 |
function bp_get_group_leave_reject_link( $group = false ) {
|
2281 |
global $groups_template;
|
2282 |
|
2286 |
return apply_filters( 'bp_get_group_leave_reject_link', bp_get_group_permalink( $group ) );
|
2287 |
}
|
2288 |
|
|
|
|
|
|
|
2289 |
function bp_group_send_invite_form_action() {
|
2290 |
echo bp_get_group_send_invite_form_action();
|
2291 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2292 |
function bp_get_group_send_invite_form_action( $group = false ) {
|
2293 |
global $groups_template;
|
2294 |
|
2298 |
return apply_filters( 'bp_group_send_invite_form_action', bp_get_group_permalink( $group ) . 'send-invites/send' );
|
2299 |
}
|
2300 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2301 |
function bp_has_friends_to_invite( $group = false ) {
|
2302 |
global $groups_template;
|
2303 |
|
2314 |
}
|
2315 |
|
2316 |
/**
|
2317 |
+
* Outputs a 'New Topic' button for a group.
|
2318 |
*
|
2319 |
* @since BuddyPress (1.2.7)
|
2320 |
*
|
2321 |
+
* @param BP_Groups_Group|bool $group The BP Groups_Group object if passed, boolean false if not passed.
|
2322 |
+
* @uses bp_get_group_new_topic_button() Returns the 'New Topic' button
|
2323 |
*/
|
2324 |
function bp_group_new_topic_button( $group = false ) {
|
2325 |
echo bp_get_group_new_topic_button( $group );
|
2329 |
*
|
2330 |
* @since BuddyPress (1.2.7)
|
2331 |
*
|
2332 |
+
* @param BP_Groups_Group|bool $group The BP Groups_Group object if passed, boolean false if not passed.
|
2333 |
+
* @uses is_user_logged_in() Is there a user logged in?
|
2334 |
+
* @uses bp_group_is_user_banned() Is the current user banned from the current group?
|
2335 |
+
* @uses bp_is_group_forum() Are we on a group forum page?
|
2336 |
+
* @uses bp_is_group_forum_topic() Are we on a group topic page?
|
2337 |
+
* @uses bp_get_button() Renders a button
|
2338 |
+
* @return string HTML code for the button
|
2339 |
*/
|
2340 |
function bp_get_group_new_topic_button( $group = false ) {
|
2341 |
global $groups_template;
|
2512 |
'component' => 'groups',
|
2513 |
'link_text' => __( 'Create a Group', 'buddypress' ),
|
2514 |
'link_title' => __( 'Create a Group', 'buddypress' ),
|
2515 |
+
'link_class' => 'button group-create bp-title-button',
|
2516 |
'link_href' => trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_groups_root_slug() ) . trailingslashit( 'create' ),
|
2517 |
'wrapper' => false,
|
|
|
2518 |
);
|
2519 |
|
2520 |
return bp_get_button( apply_filters( 'bp_get_group_create_button', $button_args ) );
|
2521 |
}
|
2522 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2523 |
/**
|
2524 |
* Prints a message if the group is not visible to the current user (it is a
|
2525 |
* hidden or private group, and the user does not have access).
|
2538 |
if ( ! bp_group_has_requested_membership() ) {
|
2539 |
if ( is_user_logged_in() && bp_group_is_invited() ) {
|
2540 |
$message = __( 'You must accept your pending invitation before you can access this private group.', 'buddypress' );
|
2541 |
+
} else if ( is_user_logged_in() ) {
|
2542 |
$message = __( 'This is a private group and you must request group membership in order to join.', 'buddypress' );
|
2543 |
} else {
|
2544 |
$message = __( 'This is a private group. To join you must be a registered site member and request group membership.', 'buddypress' );
|
2646 |
'group_id' => bp_get_current_group_id(),
|
2647 |
'page' => 1,
|
2648 |
'per_page' => 20,
|
|
|
2649 |
'max' => false,
|
2650 |
'exclude' => false,
|
2651 |
'exclude_admins_mods' => 1,
|
2658 |
// @todo No
|
2659 |
extract( $r );
|
2660 |
|
2661 |
+
$this->pag_page = isset( $_REQUEST['mlpage'] ) ? intval( $_REQUEST['mlpage'] ) : $r['page'];
|
2662 |
+
$this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
|
|
|
2663 |
|
2664 |
/**
|
2665 |
* Check the current group is the same as the supplied group ID.
|
2700 |
}
|
2701 |
|
2702 |
$this->pag_links = paginate_links( array(
|
2703 |
+
'base' => add_query_arg( array( 'mlpage' => '%#%' ), $base_url ),
|
2704 |
+
'format' => '',
|
2705 |
+
'total' => !empty( $this->pag_num ) ? ceil( $this->total_member_count / $this->pag_num ) : $this->total_member_count,
|
2706 |
+
'current' => $this->pag_page,
|
2707 |
'prev_text' => '←',
|
2708 |
'next_text' => '→',
|
2709 |
+
'mid_size' => 1
|
|
|
2710 |
));
|
2711 |
}
|
2712 |
|
3680 |
}
|
3681 |
|
3682 |
$r = wp_parse_args( $args, array(
|
3683 |
+
'group_id' => bp_get_current_group_id(),
|
3684 |
'per_page' => 10,
|
3685 |
+
'page' => 1,
|
3686 |
'max' => false,
|
3687 |
'type' => 'first_joined',
|
|
|
3688 |
) );
|
3689 |
|
3690 |
+
$this->pag_page = isset( $_REQUEST['mrpage'] ) ? intval( $_REQUEST['mrpage'] ) : $r['page'];
|
3691 |
+
$this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $r['per_page'];
|
|
|
3692 |
|
3693 |
$mquery = new BP_Group_Member_Query( array(
|
3694 |
'group_id' => $r['group_id'],
|
3731 |
}
|
3732 |
|
3733 |
$this->pag_links = paginate_links( array(
|
3734 |
+
'base' => add_query_arg( 'mrpage', '%#%' ),
|
3735 |
+
'format' => '',
|
3736 |
+
'total' => ceil( $this->total_request_count / $this->pag_num ),
|
3737 |
+
'current' => $this->pag_page,
|
3738 |
'prev_text' => '←',
|
3739 |
'next_text' => '→',
|
3740 |
+
'mid_size' => 1
|
|
|
3741 |
) );
|
3742 |
}
|
3743 |
|
3947 |
}
|
3948 |
|
3949 |
$r = wp_parse_args( $args, array(
|
|
|
|
|
|
|
3950 |
'user_id' => bp_loggedin_user_id(),
|
3951 |
'group_id' => bp_get_current_group_id(),
|
3952 |
+
'page' => 1,
|
3953 |
+
'per_page' => 10,
|
3954 |
) );
|
3955 |
|
3956 |
+
$this->pag_num = intval( $r['per_page'] );
|
3957 |
+
$this->pag_page = isset( $_REQUEST['invitepage'] ) ? intval( $_REQUEST['invitepage'] ) : $r['page'];
|
|
|
3958 |
|
3959 |
$iquery = new BP_Group_Member_Query( array(
|
3960 |
'group_id' => $r['group_id'],
|
3976 |
// pag_links
|
3977 |
if ( ! empty( $this->pag_num ) ) {
|
3978 |
$this->pag_links = paginate_links( array(
|
3979 |
+
'base' => add_query_arg( 'invitepage', '%#%' ),
|
3980 |
'format' => '',
|
3981 |
'total' => ceil( $this->total_invite_count / $this->pag_num ),
|
3982 |
'current' => $this->pag_page,
|
3983 |
'prev_text' => '←',
|
3984 |
'next_text' => '→',
|
3985 |
'mid_size' => 1,
|
|
|
3986 |
) );
|
3987 |
} else {
|
3988 |
$this->pag_links = '';
|
4054 |
$this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count( $user_id );
|
4055 |
}
|
4056 |
|
4057 |
+
if ( bp_is_active( 'friends' ) ) {
|
4058 |
+
$this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count( $user_id );
|
4059 |
+
}
|
4060 |
+
|
4061 |
$this->invite->user->total_blogs = null;
|
4062 |
|
4063 |
+
$this->invite->group_id = $group_id; // Globaled in bp_group_has_invites()
|
4064 |
|
4065 |
if ( 0 == $this->current_invite ) // loop has just started
|
4066 |
do_action('loop_start');
|
bp-groups/bp-groups-widgets.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
/* Register widgets for groups component */
|
14 |
function groups_register_widgets() {
|
@@ -92,7 +92,7 @@ class BP_Groups_Widget extends WP_Widget {
|
|
92 |
printf( __( 'created %s', 'buddypress' ), bp_get_group_date_created() );
|
93 |
if ( 'active' == $instance['group_default'] )
|
94 |
printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() );
|
95 |
-
|
96 |
bp_group_member_count();
|
97 |
?>
|
98 |
</span>
|
@@ -202,9 +202,9 @@ function groups_ajax_widget_groups_list() {
|
|
202 |
<?php
|
203 |
if ( 'newest-groups' == $_POST['filter'] ) {
|
204 |
printf( __( 'created %s', 'buddypress' ), bp_get_group_date_created() );
|
205 |
-
}
|
206 |
printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() );
|
207 |
-
}
|
208 |
bp_group_member_count();
|
209 |
}
|
210 |
?>
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
/* Register widgets for groups component */
|
14 |
function groups_register_widgets() {
|
92 |
printf( __( 'created %s', 'buddypress' ), bp_get_group_date_created() );
|
93 |
if ( 'active' == $instance['group_default'] )
|
94 |
printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() );
|
95 |
+
else if ( 'popular' == $instance['group_default'] )
|
96 |
bp_group_member_count();
|
97 |
?>
|
98 |
</span>
|
202 |
<?php
|
203 |
if ( 'newest-groups' == $_POST['filter'] ) {
|
204 |
printf( __( 'created %s', 'buddypress' ), bp_get_group_date_created() );
|
205 |
+
} else if ( 'recently-active-groups' == $_POST['filter'] ) {
|
206 |
printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() );
|
207 |
+
} else if ( 'popular-groups' == $_POST['filter'] ) {
|
208 |
bp_group_member_count();
|
209 |
}
|
210 |
?>
|
bp-groups/js/widget-groups.js
CHANGED
@@ -17,7 +17,7 @@ jQuery(document).ready( function() {
|
|
17 |
function(response)
|
18 |
{
|
19 |
jQuery(link).removeClass('loading');
|
20 |
-
|
21 |
});
|
22 |
|
23 |
return false;
|
@@ -25,7 +25,7 @@ jQuery(document).ready( function() {
|
|
25 |
);
|
26 |
});
|
27 |
|
28 |
-
function
|
29 |
response = response.substr(0, response.length-1);
|
30 |
response = response.split('[[SPLIT]]');
|
31 |
|
17 |
function(response)
|
18 |
{
|
19 |
jQuery(link).removeClass('loading');
|
20 |
+
groups_wiget_response(response);
|
21 |
});
|
22 |
|
23 |
return false;
|
25 |
);
|
26 |
});
|
27 |
|
28 |
+
function groups_wiget_response(response) {
|
29 |
response = response.substr(0, response.length-1);
|
30 |
response = response.split('[[SPLIT]]');
|
31 |
|
bp-groups/js/widget-groups.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
-
function
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
+
function groups_wiget_response(a){a=a.substr(0,a.length-1),a=a.split("[[SPLIT]]"),"-1"!==a[0]?jQuery(".widget ul#groups-list").fadeOut(200,function(){jQuery(".widget ul#groups-list").html(a[1]),jQuery(".widget ul#groups-list").fadeIn(200)}):jQuery(".widget ul#groups-list").fadeOut(200,function(){var b="<p>"+a[1]+"</p>";jQuery(".widget ul#groups-list").html(b),jQuery(".widget ul#groups-list").fadeIn(200)})}jQuery(document).ready(function(){jQuery(".widget div#groups-list-options a").on("click",function(){var a=this;return jQuery(a).addClass("loading"),jQuery(".widget div#groups-list-options a").removeClass("selected"),jQuery(this).addClass("selected"),jQuery.post(ajaxurl,{action:"widget_groups_list",cookie:encodeURIComponent(document.cookie),_wpnonce:jQuery("input#_wpnonce-groups").val(),max_groups:jQuery("input#groups_widget_max").val(),filter:jQuery(this).attr("id")},function(b){jQuery(a).removeClass("loading"),groups_wiget_response(b)}),!1})});
|
bp-loader.php
CHANGED
@@ -11,17 +11,17 @@
|
|
11 |
/**
|
12 |
* Plugin Name: BuddyPress
|
13 |
* Plugin URI: http://buddypress.org
|
14 |
-
* Description:
|
15 |
* Author: The BuddyPress Community
|
16 |
-
* Author URI: http://buddypress.org
|
17 |
-
* Version: 2.
|
18 |
* Text Domain: buddypress
|
19 |
* Domain Path: /bp-languages/
|
20 |
* License: GPLv2 or later (license.txt)
|
21 |
*/
|
22 |
|
23 |
// Exit if accessed directly
|
24 |
-
defined( 'ABSPATH' )
|
25 |
|
26 |
/** Constants *****************************************************************/
|
27 |
|
@@ -178,14 +178,14 @@ class BuddyPress {
|
|
178 |
public function __isset( $key ) { return isset( $this->data[$key] ); }
|
179 |
|
180 |
/**
|
181 |
-
* Magic method for getting BuddyPress
|
182 |
*
|
183 |
* @since BuddyPress (1.7.0)
|
184 |
*/
|
185 |
public function __get( $key ) { return isset( $this->data[$key] ) ? $this->data[$key] : null; }
|
186 |
|
187 |
/**
|
188 |
-
* Magic method for setting BuddyPress
|
189 |
*
|
190 |
* @since BuddyPress (1.7.0)
|
191 |
*/
|
@@ -222,9 +222,8 @@ class BuddyPress {
|
|
222 |
|
223 |
// Place your custom code (actions/filters) in a file called
|
224 |
// '/plugins/bp-custom.php' and it will be loaded before anything else.
|
225 |
-
if ( file_exists( WP_PLUGIN_DIR . '/bp-custom.php' ) )
|
226 |
require( WP_PLUGIN_DIR . '/bp-custom.php' );
|
227 |
-
}
|
228 |
|
229 |
// Path and URL
|
230 |
if ( ! defined( 'BP_PLUGIN_DIR' ) ) {
|
@@ -283,9 +282,8 @@ class BuddyPress {
|
|
283 |
// search requests are loaded
|
284 |
//
|
285 |
// @todo Make this better
|
286 |
-
if ( !
|
287 |
define( 'BP_SEARCH_SLUG', 'search' );
|
288 |
-
}
|
289 |
}
|
290 |
|
291 |
/**
|
@@ -302,8 +300,8 @@ class BuddyPress {
|
|
302 |
|
303 |
/** Versions **********************************************************/
|
304 |
|
305 |
-
$this->version = '2.
|
306 |
-
$this->db_version =
|
307 |
|
308 |
/** Loading ***********************************************************/
|
309 |
|
@@ -367,7 +365,7 @@ class BuddyPress {
|
|
367 |
// Languages
|
368 |
$this->lang_dir = $this->plugin_dir . 'bp-languages';
|
369 |
|
370 |
-
// Templates (theme
|
371 |
$this->themes_dir = $this->plugin_dir . 'bp-templates';
|
372 |
$this->themes_url = $this->plugin_url . 'bp-templates';
|
373 |
|
@@ -397,14 +395,10 @@ class BuddyPress {
|
|
397 |
private function legacy_constants() {
|
398 |
|
399 |
// Define the BuddyPress version
|
400 |
-
if ( !
|
401 |
-
define( 'BP_VERSION', $this->version );
|
402 |
-
}
|
403 |
|
404 |
// Define the database version
|
405 |
-
if ( !
|
406 |
-
define( 'BP_DB_VERSION', $this->db_version );
|
407 |
-
}
|
408 |
}
|
409 |
|
410 |
/**
|
@@ -425,7 +419,7 @@ class BuddyPress {
|
|
425 |
|
426 |
/** Update/Install ****************************************************/
|
427 |
|
428 |
-
// Theme
|
429 |
require( $this->plugin_dir . 'bp-core/bp-core-template-loader.php' );
|
430 |
require( $this->plugin_dir . 'bp-core/bp-core-theme-compatibility.php' );
|
431 |
|
@@ -438,7 +432,6 @@ class BuddyPress {
|
|
438 |
require( $this->plugin_dir . 'bp-core/bp-core-update.php' );
|
439 |
require( $this->plugin_dir . 'bp-core/bp-core-options.php' );
|
440 |
require( $this->plugin_dir . 'bp-core/bp-core-classes.php' );
|
441 |
-
require( $this->plugin_dir . 'bp-core/bp-core-taxonomy.php' );
|
442 |
require( $this->plugin_dir . 'bp-core/bp-core-filters.php' );
|
443 |
require( $this->plugin_dir . 'bp-core/bp-core-avatars.php' );
|
444 |
require( $this->plugin_dir . 'bp-core/bp-core-widgets.php' );
|
@@ -460,7 +453,6 @@ class BuddyPress {
|
|
460 |
require( $this->plugin_dir . 'bp-core/deprecated/1.9.php' );
|
461 |
require( $this->plugin_dir . 'bp-core/deprecated/2.0.php' );
|
462 |
require( $this->plugin_dir . 'bp-core/deprecated/2.1.php' );
|
463 |
-
require( $this->plugin_dir . 'bp-core/deprecated/2.2.php' );
|
464 |
}
|
465 |
}
|
466 |
|
@@ -481,9 +473,8 @@ class BuddyPress {
|
|
481 |
add_action( 'deactivate_' . $this->basename, 'bp_deactivation' );
|
482 |
|
483 |
// If BuddyPress is being deactivated, do not add any actions
|
484 |
-
if ( bp_is_deactivation( $this->basename ) )
|
485 |
return;
|
486 |
-
}
|
487 |
|
488 |
// Array of BuddyPress core actions
|
489 |
$actions = array(
|
@@ -501,11 +492,8 @@ class BuddyPress {
|
|
501 |
);
|
502 |
|
503 |
// Add the actions
|
504 |
-
foreach( $actions as $class_action )
|
505 |
-
|
506 |
-
add_action( 'bp_' . $class_action, array( $this, $class_action ), 5 );
|
507 |
-
}
|
508 |
-
}
|
509 |
|
510 |
// All BuddyPress actions are setup (includes bbp-core-hooks.php)
|
511 |
do_action_ref_array( 'bp_after_setup_actions', array( &$this ) );
|
@@ -590,16 +578,15 @@ class BuddyPress {
|
|
590 |
}
|
591 |
|
592 |
/**
|
593 |
-
* Set up the default BuddyPress theme
|
594 |
*
|
595 |
* @since BuddyPress (1.7.0)
|
596 |
*/
|
597 |
public function setup_theme() {
|
598 |
|
599 |
// Bail if something already has this under control
|
600 |
-
if ( ! empty( $this->theme_compat->theme ) )
|
601 |
return;
|
602 |
-
}
|
603 |
|
604 |
// Setup the theme package to use for compatibility
|
605 |
bp_setup_theme_compat( bp_get_theme_package_id() );
|
11 |
/**
|
12 |
* Plugin Name: BuddyPress
|
13 |
* Plugin URI: http://buddypress.org
|
14 |
+
* Description: Social networking in a box. Build a social network for your company, school, sports team or niche community all based on the power and flexibility of WordPress.
|
15 |
* Author: The BuddyPress Community
|
16 |
+
* Author URI: http://buddypress.org/community/members/
|
17 |
+
* Version: 2.1.4
|
18 |
* Text Domain: buddypress
|
19 |
* Domain Path: /bp-languages/
|
20 |
* License: GPLv2 or later (license.txt)
|
21 |
*/
|
22 |
|
23 |
// Exit if accessed directly
|
24 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
25 |
|
26 |
/** Constants *****************************************************************/
|
27 |
|
178 |
public function __isset( $key ) { return isset( $this->data[$key] ); }
|
179 |
|
180 |
/**
|
181 |
+
* Magic method for getting BuddyPress varibles.
|
182 |
*
|
183 |
* @since BuddyPress (1.7.0)
|
184 |
*/
|
185 |
public function __get( $key ) { return isset( $this->data[$key] ) ? $this->data[$key] : null; }
|
186 |
|
187 |
/**
|
188 |
+
* Magic method for setting BuddyPress varibles.
|
189 |
*
|
190 |
* @since BuddyPress (1.7.0)
|
191 |
*/
|
222 |
|
223 |
// Place your custom code (actions/filters) in a file called
|
224 |
// '/plugins/bp-custom.php' and it will be loaded before anything else.
|
225 |
+
if ( file_exists( WP_PLUGIN_DIR . '/bp-custom.php' ) )
|
226 |
require( WP_PLUGIN_DIR . '/bp-custom.php' );
|
|
|
227 |
|
228 |
// Path and URL
|
229 |
if ( ! defined( 'BP_PLUGIN_DIR' ) ) {
|
282 |
// search requests are loaded
|
283 |
//
|
284 |
// @todo Make this better
|
285 |
+
if ( !defined( 'BP_SEARCH_SLUG' ) )
|
286 |
define( 'BP_SEARCH_SLUG', 'search' );
|
|
|
287 |
}
|
288 |
|
289 |
/**
|
300 |
|
301 |
/** Versions **********************************************************/
|
302 |
|
303 |
+
$this->version = '2.1.4';
|
304 |
+
$this->db_version = 8311;
|
305 |
|
306 |
/** Loading ***********************************************************/
|
307 |
|
365 |
// Languages
|
366 |
$this->lang_dir = $this->plugin_dir . 'bp-languages';
|
367 |
|
368 |
+
// Templates (theme compatability)
|
369 |
$this->themes_dir = $this->plugin_dir . 'bp-templates';
|
370 |
$this->themes_url = $this->plugin_url . 'bp-templates';
|
371 |
|
395 |
private function legacy_constants() {
|
396 |
|
397 |
// Define the BuddyPress version
|
398 |
+
if ( !defined( 'BP_VERSION' ) ) define( 'BP_VERSION', $this->version );
|
|
|
|
|
399 |
|
400 |
// Define the database version
|
401 |
+
if ( !defined( 'BP_DB_VERSION' ) ) define( 'BP_DB_VERSION', $this->db_version );
|
|
|
|
|
402 |
}
|
403 |
|
404 |
/**
|
419 |
|
420 |
/** Update/Install ****************************************************/
|
421 |
|
422 |
+
// Theme compatability
|
423 |
require( $this->plugin_dir . 'bp-core/bp-core-template-loader.php' );
|
424 |
require( $this->plugin_dir . 'bp-core/bp-core-theme-compatibility.php' );
|
425 |
|
432 |
require( $this->plugin_dir . 'bp-core/bp-core-update.php' );
|
433 |
require( $this->plugin_dir . 'bp-core/bp-core-options.php' );
|
434 |
require( $this->plugin_dir . 'bp-core/bp-core-classes.php' );
|
|
|
435 |
require( $this->plugin_dir . 'bp-core/bp-core-filters.php' );
|
436 |
require( $this->plugin_dir . 'bp-core/bp-core-avatars.php' );
|
437 |
require( $this->plugin_dir . 'bp-core/bp-core-widgets.php' );
|
453 |
require( $this->plugin_dir . 'bp-core/deprecated/1.9.php' );
|
454 |
require( $this->plugin_dir . 'bp-core/deprecated/2.0.php' );
|
455 |
require( $this->plugin_dir . 'bp-core/deprecated/2.1.php' );
|
|
|
456 |
}
|
457 |
}
|
458 |
|
473 |
add_action( 'deactivate_' . $this->basename, 'bp_deactivation' );
|
474 |
|
475 |
// If BuddyPress is being deactivated, do not add any actions
|
476 |
+
if ( bp_is_deactivation( $this->basename ) )
|
477 |
return;
|
|
|
478 |
|
479 |
// Array of BuddyPress core actions
|
480 |
$actions = array(
|
492 |
);
|
493 |
|
494 |
// Add the actions
|
495 |
+
foreach( $actions as $class_action )
|
496 |
+
add_action( 'bp_' . $class_action, array( $this, $class_action ), 5 );
|
|
|
|
|
|
|
497 |
|
498 |
// All BuddyPress actions are setup (includes bbp-core-hooks.php)
|
499 |
do_action_ref_array( 'bp_after_setup_actions', array( &$this ) );
|
578 |
}
|
579 |
|
580 |
/**
|
581 |
+
* Set up the default BuddyPress theme compatability location.
|
582 |
*
|
583 |
* @since BuddyPress (1.7.0)
|
584 |
*/
|
585 |
public function setup_theme() {
|
586 |
|
587 |
// Bail if something already has this under control
|
588 |
+
if ( ! empty( $this->theme_compat->theme ) )
|
589 |
return;
|
|
|
590 |
|
591 |
// Setup the theme package to use for compatibility
|
592 |
bp_setup_theme_compat( bp_get_theme_package_id() );
|
bp-members/admin/bp-members-classes.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
-
defined( 'ABSPATH' )
|
12 |
|
13 |
if ( class_exists( 'WP_Users_List_Table') ) :
|
14 |
|
@@ -97,7 +97,7 @@ class BP_Members_List_Table extends WP_Users_List_Table {
|
|
97 |
|
98 |
// Remove the 'current' class from the 'All' link
|
99 |
$views['all'] = str_replace( 'class="current"', '', $views['all'] );
|
100 |
-
$views['registered'] = sprintf( '<a href="%1$s" class="current">%2$s</a>',
|
101 |
|
102 |
return $views;
|
103 |
}
|
@@ -120,14 +120,6 @@ class BP_Members_List_Table extends WP_Users_List_Table {
|
|
120 |
* @since BuddyPress (2.0.0)
|
121 |
*/
|
122 |
public function get_columns() {
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Filters the single site Members signup columns.
|
126 |
-
*
|
127 |
-
* @since BuddyPress (2.0.0)
|
128 |
-
*
|
129 |
-
* @param array $value Array of columns to display.
|
130 |
-
*/
|
131 |
return apply_filters( 'bp_members_signup_columns', array(
|
132 |
'cb' => '<input type="checkbox" />',
|
133 |
'username' => __( 'Username', 'buddypress' ),
|
@@ -285,14 +277,6 @@ class BP_Members_List_Table extends WP_Users_List_Table {
|
|
285 |
$actions['delete'] = sprintf( '<a href="%1$s" class="delete">%2$s</a>', esc_url( $delete_link ), __( 'Delete', 'buddypress' ) );
|
286 |
}
|
287 |
|
288 |
-
/**
|
289 |
-
* Filters the multisite row actions for each user in list.
|
290 |
-
*
|
291 |
-
* @since BuddyPress (2.0.0)
|
292 |
-
*
|
293 |
-
* @param array $actions Array of actions and corresponding links.
|
294 |
-
* @param object $signup_object The signup data object.
|
295 |
-
*/
|
296 |
$actions = apply_filters( 'bp_members_ms_signup_row_actions', $actions, $signup_object );
|
297 |
|
298 |
echo $this->row_actions( $actions );
|
@@ -352,23 +336,14 @@ class BP_Members_List_Table extends WP_Users_List_Table {
|
|
352 |
}
|
353 |
|
354 |
/**
|
355 |
-
* Allow plugins to add their
|
356 |
*
|
357 |
-
* @since BuddyPress
|
358 |
*
|
359 |
* @param object $signup_object The signup data object.
|
360 |
* @param string the column name.
|
361 |
*/
|
362 |
function column_default( $signup_object = null, $column_name = '' ) {
|
363 |
-
|
364 |
-
/**
|
365 |
-
* Filters the single site custom columns for plugins.
|
366 |
-
*
|
367 |
-
* @since BuddyPress (2.1.0)
|
368 |
-
*
|
369 |
-
* @param string $column_name The column name.
|
370 |
-
* @param object $signup_object The signup data object.
|
371 |
-
*/
|
372 |
return apply_filters( 'bp_members_signup_custom_column', '', $column_name, $signup_object );
|
373 |
}
|
374 |
}
|
@@ -462,7 +437,7 @@ class BP_Members_MS_List_Table extends WP_MS_Users_List_Table {
|
|
462 |
|
463 |
// Remove the 'current' class from the 'All' link
|
464 |
$views['all'] = str_replace( 'class="current"', '', $views['all'] );
|
465 |
-
$views['registered'] = sprintf( '<a href="%1$s" class="current">%2$s</a>',
|
466 |
|
467 |
return $views;
|
468 |
}
|
@@ -473,14 +448,6 @@ class BP_Members_MS_List_Table extends WP_MS_Users_List_Table {
|
|
473 |
* @since BuddyPress (2.0.0)
|
474 |
*/
|
475 |
public function get_columns() {
|
476 |
-
|
477 |
-
/**
|
478 |
-
* Filters the multisite Members signup columns.
|
479 |
-
*
|
480 |
-
* @since BuddyPress (2.0.0)
|
481 |
-
*
|
482 |
-
* @param array $value Array of columns to display.
|
483 |
-
*/
|
484 |
return apply_filters( 'bp_members_ms_signup_columns', array(
|
485 |
'cb' => '<input type="checkbox" />',
|
486 |
'username' => __( 'Username', 'buddypress' ),
|
@@ -633,7 +600,6 @@ class BP_Members_MS_List_Table extends WP_MS_Users_List_Table {
|
|
633 |
$actions['delete'] = sprintf( '<a href="%1$s" class="delete">%2$s</a>', esc_url( $delete_link ), __( 'Delete', 'buddypress' ) );
|
634 |
}
|
635 |
|
636 |
-
/** This filter is documented in bp-members/admin/bp-members-classes.php */
|
637 |
$actions = apply_filters( 'bp_members_ms_signup_row_actions', $actions, $signup_object );
|
638 |
|
639 |
echo $this->row_actions( $actions );
|
@@ -707,7 +673,7 @@ class BP_Members_MS_List_Table extends WP_MS_Users_List_Table {
|
|
707 |
}
|
708 |
|
709 |
/**
|
710 |
-
* Allow plugins to add their
|
711 |
*
|
712 |
* @since BuddyPress 2.1.0
|
713 |
*
|
@@ -715,15 +681,6 @@ class BP_Members_MS_List_Table extends WP_MS_Users_List_Table {
|
|
715 |
* @param string the column name.
|
716 |
*/
|
717 |
function column_default( $signup_object = null, $column_name = '' ) {
|
718 |
-
|
719 |
-
/**
|
720 |
-
* Filters the multisite custom columns for plugins.
|
721 |
-
*
|
722 |
-
* @since BuddyPress (2.1.0)
|
723 |
-
*
|
724 |
-
* @param string $column_name The column name.
|
725 |
-
* @param object $signup_object The signup data object.
|
726 |
-
*/
|
727 |
return apply_filters( 'bp_members_ms_signup_custom_column', '', $column_name, $signup_object );
|
728 |
}
|
729 |
}
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
11 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
|
13 |
if ( class_exists( 'WP_Users_List_Table') ) :
|
14 |
|
97 |
|
98 |
// Remove the 'current' class from the 'All' link
|
99 |
$views['all'] = str_replace( 'class="current"', '', $views['all'] );
|
100 |
+
$views['registered'] = sprintf( '<a href="%1$s" class="current">%2$s</a>', add_query_arg( 'page', 'bp-signups', bp_get_admin_url( 'users.php' ) ), sprintf( _x( 'Pending %s', 'signup users', 'buddypress' ), '<span class="count">(' . number_format_i18n( $this->signup_counts ) . ')</span>' ) );
|
101 |
|
102 |
return $views;
|
103 |
}
|
120 |
* @since BuddyPress (2.0.0)
|
121 |
*/
|
122 |
public function get_columns() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
return apply_filters( 'bp_members_signup_columns', array(
|
124 |
'cb' => '<input type="checkbox" />',
|
125 |
'username' => __( 'Username', 'buddypress' ),
|
277 |
$actions['delete'] = sprintf( '<a href="%1$s" class="delete">%2$s</a>', esc_url( $delete_link ), __( 'Delete', 'buddypress' ) );
|
278 |
}
|
279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
$actions = apply_filters( 'bp_members_ms_signup_row_actions', $actions, $signup_object );
|
281 |
|
282 |
echo $this->row_actions( $actions );
|
336 |
}
|
337 |
|
338 |
/**
|
339 |
+
* Allow plugins to add their costum column.
|
340 |
*
|
341 |
+
* @since BuddyPress 2.1.0
|
342 |
*
|
343 |
* @param object $signup_object The signup data object.
|
344 |
* @param string the column name.
|
345 |
*/
|
346 |
function column_default( $signup_object = null, $column_name = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
return apply_filters( 'bp_members_signup_custom_column', '', $column_name, $signup_object );
|
348 |
}
|
349 |
}
|
437 |
|
438 |
// Remove the 'current' class from the 'All' link
|
439 |
$views['all'] = str_replace( 'class="current"', '', $views['all'] );
|
440 |
+
$views['registered'] = sprintf( '<a href="%1$s" class="current">%2$s</a>', add_query_arg( 'page', 'bp-signups', bp_get_admin_url( 'users.php' ) ), sprintf( _x( 'Pending %s', 'signup users', 'buddypress' ), '<span class="count">(' . number_format_i18n( $this->signup_counts ) . ')</span>' ) );
|
441 |
|
442 |
return $views;
|
443 |
}
|
448 |
* @since BuddyPress (2.0.0)
|
449 |
*/
|
450 |
public function get_columns() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
return apply_filters( 'bp_members_ms_signup_columns', array(
|
452 |
'cb' => '<input type="checkbox" />',
|
453 |
'username' => __( 'Username', 'buddypress' ),
|
600 |
$actions['delete'] = sprintf( '<a href="%1$s" class="delete">%2$s</a>', esc_url( $delete_link ), __( 'Delete', 'buddypress' ) );
|
601 |
}
|
602 |
|
|
|
603 |
$actions = apply_filters( 'bp_members_ms_signup_row_actions', $actions, $signup_object );
|
604 |
|
605 |
echo $this->row_actions( $actions );
|
673 |
}
|
674 |
|
675 |
/**
|
676 |
+
* Allow plugins to add their costum column.
|
677 |
*
|
678 |
* @since BuddyPress 2.1.0
|
679 |
*
|
681 |
* @param string the column name.
|
682 |
*/
|
683 |
function column_default( $signup_object = null, $column_name = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
684 |
return apply_filters( 'bp_members_ms_signup_custom_column', '', $column_name, $signup_object );
|
685 |
}
|
686 |
}
|
bp-members/admin/js/admin.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
/*! buddypress - v2.2
|
2 |
function clear(a){if(a=document.getElementById(a)){var b=a.getElementsByTagName("INPUT"),c=a.getElementsByTagName("OPTION"),d=0;if(b)for(d=0;d<b.length;d++)b[d].checked="";if(c)for(d=0;d<c.length;d++)c[d].selected=!1}}!function(a){a(".visibility-toggle-link").on("click",function(b){b.preventDefault(),a(this).parent().hide().siblings(".field-visibility-settings").show()}),a(".field-visibility-settings-close").on("click",function(b){b.preventDefault();var c=a(this).parent(),d=c.find("input:checked").parent().text();c.hide().siblings(".field-visibility-settings-toggle").children(".current-visibility-level").text(d).end().show()})}(jQuery);
|
1 |
+
/*! buddypress - v2.1.2 - 2015-11-11 4:43:05 AM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
function clear(a){if(a=document.getElementById(a)){var b=a.getElementsByTagName("INPUT"),c=a.getElementsByTagName("OPTION"),d=0;if(b)for(d=0;d<b.length;d++)b[d].checked="";if(c)for(d=0;d<c.length;d++)c[d].selected=!1}}!function(a){a(".visibility-toggle-link").on("click",function(b){b.preventDefault(),a(this).parent().hide().siblings(".field-visibility-settings").show()}),a(".field-visibility-settings-close").on("click",function(b){b.preventDefault();var c=a(this).parent(),d=c.find("input:checked").parent().text();c.hide().siblings(".field-visibility-settings-toggle").children(".current-visibility-level").text(d).end().show()})}(jQuery);
|
bp-members/bp-members-actions.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
-
defined( 'ABSPATH' )
|
16 |
|
17 |
/**
|
18 |
* Catch a "Mark as Spammer/Not Spammer" click from the toolbar.
|
@@ -64,7 +64,7 @@ function bp_core_action_set_spammer_status( $user_id = 0 ) {
|
|
64 |
bp_core_redirect( wp_get_referer() );
|
65 |
}
|
66 |
}
|
67 |
-
// Unhooked in BuddyPress (1.6
|
68 |
//add_action( 'bp_actions', 'bp_core_action_set_spammer_status' );
|
69 |
|
70 |
/**
|
@@ -100,13 +100,13 @@ function bp_core_action_delete_user() {
|
|
100 |
bp_core_redirect( bp_loggedin_user_domain() );
|
101 |
}
|
102 |
}
|
103 |
-
// Unhooked in BuddyPress (1.6
|
104 |
//add_action( 'bp_actions', 'bp_core_action_delete_user' );
|
105 |
|
106 |
/**
|
107 |
* Redirect to a random member page when visiting a ?random-member URL.
|
108 |
*
|
109 |
-
* @since BuddyPress (1.0
|
110 |
*/
|
111 |
function bp_core_get_random_member() {
|
112 |
if ( ! isset( $_GET['random-member'] ) )
|
12 |
*/
|
13 |
|
14 |
// Exit if accessed directly
|
15 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
16 |
|
17 |
/**
|
18 |
* Catch a "Mark as Spammer/Not Spammer" click from the toolbar.
|
64 |
bp_core_redirect( wp_get_referer() );
|
65 |
}
|
66 |
}
|
67 |
+
// Unhooked in BuddyPress (1.6) - moved to settings
|
68 |
//add_action( 'bp_actions', 'bp_core_action_set_spammer_status' );
|
69 |
|
70 |
/**
|
100 |
bp_core_redirect( bp_loggedin_user_domain() );
|
101 |
}
|
102 |
}
|
103 |
+
// Unhooked in BuddyPress (1.6) - moved to settings
|
104 |
//add_action( 'bp_actions', 'bp_core_action_delete_user' );
|
105 |
|
106 |
/**
|
107 |
* Redirect to a random member page when visiting a ?random-member URL.
|
108 |
*
|
109 |
+
* @since BuddyPress (1.0)
|
110 |
*/
|
111 |
function bp_core_get_random_member() {
|
112 |
if ( ! isset( $_GET['random-member'] ) )
|
bp-members/bp-members-activity.php
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* BuddyPress Member Activity
|
5 |
-
*
|
6 |
-
* @package BuddyPress
|
7 |
-
* @subpackage MembersActivity
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Register the 'new member' activity type
|
15 |
-
*
|
16 |
-
* @since BuddyPress (2.2.0)
|
17 |
-
*
|
18 |
-
* @uses bp_activity_set_action()
|
19 |
-
* @uses buddypress()
|
20 |
-
*/
|
21 |
-
function bp_members_register_activity_actions() {
|
22 |
-
|
23 |
-
bp_activity_set_action(
|
24 |
-
buddypress()->members->id,
|
25 |
-
'new_member',
|
26 |
-
__( 'New member registered', 'buddypress' ),
|
27 |
-
'bp_members_format_activity_action_new_member',
|
28 |
-
__( 'New Members', 'buddypress' ),
|
29 |
-
array( 'activity' )
|
30 |
-
);
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Fires after the default 'new member' activity types are registered.
|
34 |
-
*
|
35 |
-
* @since BuddyPress (2.2.0)
|
36 |
-
*/
|
37 |
-
do_action( 'bp_members_register_activity_actions' );
|
38 |
-
}
|
39 |
-
add_action( 'bp_register_activity_actions', 'bp_members_register_activity_actions' );
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Format 'new_member' activity actions.
|
43 |
-
*
|
44 |
-
* @since BuddyPress (2.2.0)
|
45 |
-
*
|
46 |
-
* @param string $action Static activity action.
|
47 |
-
* @param object $activity Activity object.
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
function bp_members_format_activity_action_new_member( $action, $activity ) {
|
51 |
-
$userlink = bp_core_get_userlink( $activity->user_id );
|
52 |
-
$action = sprintf( __( '%s became a registered member', 'buddypress' ), $userlink );
|
53 |
-
|
54 |
-
// Legacy filter - pass $user_id instead of $activity
|
55 |
-
if ( has_filter( 'bp_core_activity_registered_member_action' ) ) {
|
56 |
-
$action = apply_filters( 'bp_core_activity_registered_member_action', $action, $activity->user_id );
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Filters the formatted 'new member' activity actions.
|
61 |
-
*
|
62 |
-
* @since BuddyPress (2.2.0)
|
63 |
-
*
|
64 |
-
* @param string $action Static activity action.
|
65 |
-
* @param object $activity Activity object.
|
66 |
-
*/
|
67 |
-
return apply_filters( 'bp_members_format_activity_action_new_member', $action, $activity );
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Create a "became a registered user" activity item when a user activates his account.
|
72 |
-
*
|
73 |
-
* @param array $user Array of userdata passed to bp_core_activated_user hook.
|
74 |
-
*/
|
75 |
-
function bp_core_new_user_activity( $user ) {
|
76 |
-
if ( empty( $user ) ) {
|
77 |
-
return false;
|
78 |
-
}
|
79 |
-
|
80 |
-
if ( is_array( $user ) ) {
|
81 |
-
$user_id = $user['user_id'];
|
82 |
-
} else {
|
83 |
-
$user_id = $user;
|
84 |
-
}
|
85 |
-
|
86 |
-
if ( empty( $user_id ) ) {
|
87 |
-
return false;
|
88 |
-
}
|
89 |
-
|
90 |
-
bp_activity_add( array(
|
91 |
-
'user_id' => $user_id,
|
92 |
-
'component' => buddypress()->members->id,
|
93 |
-
'type' => 'new_member'
|
94 |
-
) );
|
95 |
-
}
|
96 |
-
add_action( 'bp_core_activated_user', 'bp_core_new_user_activity' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp-members/bp-members-admin.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
// Exit if accessed directly
|
4 |
-
defined( 'ABSPATH' )
|
5 |
|
6 |
if ( !class_exists( 'BP_Members_Admin' ) ) :
|
7 |
/**
|
@@ -105,7 +105,7 @@ class BP_Members_Admin {
|
|
105 |
$this->js_url = trailingslashit( $this->admin_url . 'js' ); // Admin CSS URL
|
106 |
|
107 |
// Capability depends on config
|
108 |
-
$this->capability = bp_core_do_network_admin() ? '
|
109 |
|
110 |
// The Edit Profile Screen id
|
111 |
$this->user_page = '';
|
@@ -144,7 +144,7 @@ class BP_Members_Admin {
|
|
144 |
|
145 |
// When BuddyPress is not network activated, only Super Admin can moderate signups
|
146 |
if ( ! empty( $this->subsite_activated ) ) {
|
147 |
-
$this->capability = '
|
148 |
}
|
149 |
}
|
150 |
|
@@ -186,9 +186,6 @@ class BP_Members_Admin {
|
|
186 |
// Add user row actions for single site
|
187 |
add_filter( 'user_row_actions', array( $this, 'row_actions' ), 10, 2 );
|
188 |
|
189 |
-
// Process changes to member type.
|
190 |
-
add_action( 'bp_members_admin_load', array( $this, 'process_member_type_update' ) );
|
191 |
-
|
192 |
/** Signups ***********************************************************/
|
193 |
|
194 |
if ( is_admin() ) {
|
@@ -217,11 +214,17 @@ class BP_Members_Admin {
|
|
217 |
* @return int
|
218 |
*/
|
219 |
private function get_user_id() {
|
220 |
-
|
|
|
|
|
221 |
|
222 |
// We'll need a user ID when not on the user admin
|
223 |
if ( ! empty( $_GET['user_id'] ) ) {
|
224 |
$user_id = $_GET['user_id'];
|
|
|
|
|
|
|
|
|
225 |
}
|
226 |
|
227 |
return intval( $user_id );
|
@@ -305,7 +308,7 @@ class BP_Members_Admin {
|
|
305 |
case 'avatar':
|
306 |
$notice = array(
|
307 |
'class' => 'error',
|
308 |
-
'message' => __( 'There was a problem deleting that
|
309 |
);
|
310 |
break;
|
311 |
case 'ham' :
|
@@ -323,7 +326,7 @@ class BP_Members_Admin {
|
|
323 |
case 1 :
|
324 |
$notice = array(
|
325 |
'class' => 'error',
|
326 |
-
'message' => __( 'An error
|
327 |
);
|
328 |
break;
|
329 |
case 2:
|
@@ -335,7 +338,7 @@ class BP_Members_Admin {
|
|
335 |
case 3:
|
336 |
$notice = array(
|
337 |
'class' => 'error',
|
338 |
-
'message' => __( 'There was a problem updating some of your profile information
|
339 |
);
|
340 |
break;
|
341 |
}
|
@@ -474,7 +477,7 @@ class BP_Members_Admin {
|
|
474 |
$this->is_self_profile = true;
|
475 |
|
476 |
// Is the user attempting to edit their own profile
|
477 |
-
}
|
478 |
$this->is_self_profile = (bool) ( $this->get_user_id() === $this->current_user_id );
|
479 |
}
|
480 |
|
@@ -546,14 +549,6 @@ class BP_Members_Admin {
|
|
546 |
|
547 |
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
548 |
$css = $this->css_url . "admin{$min}.css";
|
549 |
-
|
550 |
-
/**
|
551 |
-
* Filters the CSS URL to enqueue in the Members admin area.
|
552 |
-
*
|
553 |
-
* @since BuddyPress (2.0.0)
|
554 |
-
*
|
555 |
-
* @param string $css URL to the CSS admin file to load.
|
556 |
-
*/
|
557 |
$css = apply_filters( 'bp_members_admin_css', $css );
|
558 |
|
559 |
wp_enqueue_style( 'bp-members-css', $css, array(), bp_get_version() );
|
@@ -563,29 +558,14 @@ class BP_Members_Admin {
|
|
563 |
wp_style_add_data( 'bp-members-css', 'suffix', $min );
|
564 |
}
|
565 |
|
566 |
-
// Only load
|
567 |
if ( get_current_screen()->id == $this->user_page ) {
|
568 |
$js = $this->js_url . "admin{$min}.js";
|
569 |
-
|
570 |
-
/**
|
571 |
-
* Filters the JS URL to enqueue in the Members admin area.
|
572 |
-
*
|
573 |
-
* @since BuddyPress (2.0.0)
|
574 |
-
*
|
575 |
-
* @param string $js URL to the JavaScript admin file to load.
|
576 |
-
*/
|
577 |
$js = apply_filters( 'bp_members_admin_js', $js );
|
578 |
wp_enqueue_script( 'bp-members-js', $js, array( 'jquery' ), bp_get_version(), true );
|
579 |
}
|
580 |
|
581 |
-
|
582 |
-
* Fires after all of the members JavaScript and CSS is enqueued.
|
583 |
-
*
|
584 |
-
* @since BuddyPress (2.0.0)
|
585 |
-
*
|
586 |
-
* @param string $id ID of the current screen.
|
587 |
-
* @param array $screen_id Array of allowed screens to add scripts and styles to.
|
588 |
-
*/
|
589 |
do_action( 'bp_members_admin_enqueue_scripts', get_current_screen()->id, $this->screen_id );
|
590 |
}
|
591 |
|
@@ -602,7 +582,7 @@ class BP_Members_Admin {
|
|
602 |
return;
|
603 |
}
|
604 |
|
605 |
-
// Add the user ID to query
|
606 |
if ( false === $this->is_self_profile ) {
|
607 |
$query_args = array( 'user_id' => $user->ID );
|
608 |
} else {
|
@@ -676,23 +656,10 @@ class BP_Members_Admin {
|
|
676 |
}
|
677 |
}
|
678 |
|
679 |
-
|
680 |
-
* Fires at the start of the signups admin load.
|
681 |
-
*
|
682 |
-
* @since BuddyPress (2.0.0)
|
683 |
-
*
|
684 |
-
* @param string $doaction Current bulk action being processed.
|
685 |
-
* @param array $_REQUEST Current $_REQUEST global.
|
686 |
-
*/
|
687 |
do_action_ref_array( 'bp_members_admin_load', array( $doaction, $_REQUEST ) );
|
688 |
|
689 |
-
|
690 |
-
* Filters the allowed actions for use in the user admin page.
|
691 |
-
*
|
692 |
-
* @since BuddyPress (2.0.0)
|
693 |
-
*
|
694 |
-
* @param array $value Array of allowed actions to use.
|
695 |
-
*/
|
696 |
$allowed_actions = apply_filters( 'bp_members_admin_allowed_actions', array( 'update', 'delete_avatar', 'spam', 'ham' ) );
|
697 |
|
698 |
// Prepare the display of the Community Profile screen
|
@@ -730,15 +697,8 @@ class BP_Members_Admin {
|
|
730 |
$this->stats_metabox->priority = 'core';
|
731 |
|
732 |
/**
|
733 |
-
*
|
734 |
-
*
|
735 |
-
* Plugins should not use this hook, please use 'bp_members_admin_user_metaboxes' instead.
|
736 |
-
*
|
737 |
-
* @since BuddyPress (2.0.0)
|
738 |
-
*
|
739 |
-
* @param int $user_id Current user ID for the screen.
|
740 |
-
* @param string $id Current screen ID.
|
741 |
-
* @param object $stats_metabox Object holding position data for use with the stats metabox.
|
742 |
*/
|
743 |
do_action_ref_array( 'bp_members_admin_xprofile_metabox', array( $user_id, get_current_screen()->id, $this->stats_metabox ) );
|
744 |
|
@@ -759,31 +719,12 @@ class BP_Members_Admin {
|
|
759 |
sanitize_key( $this->stats_metabox->priority )
|
760 |
);
|
761 |
|
762 |
-
// Member Type metabox. Only added if member types have been registered.
|
763 |
-
$member_types = bp_get_member_types();
|
764 |
-
if ( ! empty( $member_types ) ) {
|
765 |
-
add_meta_box(
|
766 |
-
'bp_members_admin_member_type',
|
767 |
-
_x( 'Member Type', 'members user-admin edit screen', 'buddypress' ),
|
768 |
-
array( $this, 'user_admin_member_type_metabox' ),
|
769 |
-
get_current_screen()->id,
|
770 |
-
'side',
|
771 |
-
'core'
|
772 |
-
);
|
773 |
-
}
|
774 |
-
|
775 |
/**
|
776 |
-
*
|
777 |
-
*
|
778 |
-
*
|
779 |
-
*
|
780 |
-
*
|
781 |
-
* by setting it to true.
|
782 |
-
*
|
783 |
-
* @since BuddyPress (2.0.0)
|
784 |
-
*
|
785 |
-
* @param bool $is_self_profile Whether or not it is the current user's profile.
|
786 |
-
* @param int $user_id Current user ID.
|
787 |
*/
|
788 |
do_action( 'bp_members_admin_user_metaboxes', $this->is_self_profile, $user_id );
|
789 |
|
@@ -808,16 +749,6 @@ class BP_Members_Admin {
|
|
808 |
} else {
|
809 |
$this->redirect = $redirect_to;
|
810 |
|
811 |
-
/**
|
812 |
-
* Fires at end of user profile admin load if doaction does not match any available actions.
|
813 |
-
*
|
814 |
-
* @since BuddyPress (2.0.0)
|
815 |
-
*
|
816 |
-
* @param string $doaction Current bulk action being processed.
|
817 |
-
* @param int $user_id Current user ID.
|
818 |
-
* @param array $_REQUEST Current $_REQUEST global.
|
819 |
-
* @param string $redirect Determined redirect url to send user to.
|
820 |
-
*/
|
821 |
do_action_ref_array( 'bp_members_admin_update_user', array( $doaction, $user_id, $_REQUEST, $this->redirect ) );
|
822 |
|
823 |
bp_core_redirect( $this->redirect );
|
@@ -901,6 +832,8 @@ class BP_Members_Admin {
|
|
901 |
<div id="poststuff">
|
902 |
|
903 |
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
|
|
|
|
904 |
|
905 |
<div id="postbox-container-1" class="postbox-container">
|
906 |
<?php do_meta_boxes( get_current_screen()->id, 'side', $user ); ?>
|
@@ -949,7 +882,7 @@ class BP_Members_Admin {
|
|
949 |
return;
|
950 |
}
|
951 |
|
952 |
-
// Bail if user has not been activated yet (how
|
953 |
if ( isset( $user->user_status ) && ( 2 == $user->user_status ) ) : ?>
|
954 |
|
955 |
<p class="not-activated"><?php esc_html_e( 'User account has not yet been activated', 'buddypress' ); ?></p><br/>
|
@@ -1058,15 +991,6 @@ class BP_Members_Admin {
|
|
1058 |
<?php
|
1059 |
// Loading other stats only if user has activated their account
|
1060 |
if ( empty( $user->user_status ) ) {
|
1061 |
-
|
1062 |
-
/**
|
1063 |
-
* Fires in the user stats metabox if the user has activated their account.
|
1064 |
-
*
|
1065 |
-
* @since BuddyPress (2.0.0)
|
1066 |
-
*
|
1067 |
-
* @param array $value Array holding the user ID.
|
1068 |
-
* @param object $user Current displayed user object.
|
1069 |
-
*/
|
1070 |
do_action( 'bp_members_admin_user_stats', array( 'user_id' => $user->ID ), $user );
|
1071 |
}
|
1072 |
?>
|
@@ -1075,72 +999,6 @@ class BP_Members_Admin {
|
|
1075 |
<?php
|
1076 |
}
|
1077 |
|
1078 |
-
/**
|
1079 |
-
* Render the Member Type metabox.
|
1080 |
-
*
|
1081 |
-
* @since BuddyPress (2.2.0)
|
1082 |
-
* @access public
|
1083 |
-
*
|
1084 |
-
* @param WP_User $user The WP_User object to be edited.
|
1085 |
-
*/
|
1086 |
-
public function user_admin_member_type_metabox( $user = null ) {
|
1087 |
-
|
1088 |
-
// Bail if no user ID.
|
1089 |
-
if ( empty( $user->ID ) ) {
|
1090 |
-
return;
|
1091 |
-
}
|
1092 |
-
|
1093 |
-
$types = bp_get_member_types( array(), 'objects' );
|
1094 |
-
$current_type = bp_get_member_type( $user->ID );
|
1095 |
-
?>
|
1096 |
-
|
1097 |
-
<select name="bp-members-profile-member-type">
|
1098 |
-
<option value="" <?php selected( '', $current_type ); ?>><?php /* translators: no option picked in select box */ esc_attr_e( '----', 'buddypress' ) ?></option>
|
1099 |
-
<?php foreach ( $types as $type ) : ?>
|
1100 |
-
<option value="<?php echo esc_attr( $type->name ) ?>" <?php selected( $type->name, $current_type ) ?>><?php echo esc_html( $type->labels['singular_name'] ) ?></option>
|
1101 |
-
<?php endforeach; ?>
|
1102 |
-
</select>
|
1103 |
-
|
1104 |
-
<?php
|
1105 |
-
|
1106 |
-
wp_nonce_field( 'bp-member-type-change-' . $user->ID, 'bp-member-type-nonce' );
|
1107 |
-
}
|
1108 |
-
|
1109 |
-
/**
|
1110 |
-
* Process changes from the Member Type metabox.
|
1111 |
-
*
|
1112 |
-
* @since BuddyPress (2.2.0)
|
1113 |
-
* @access public
|
1114 |
-
*/
|
1115 |
-
public function process_member_type_update() {
|
1116 |
-
if ( ! isset( $_POST['bp-member-type-nonce'] ) || ! isset( $_POST['bp-members-profile-member-type'] ) ) {
|
1117 |
-
return;
|
1118 |
-
}
|
1119 |
-
|
1120 |
-
$user_id = $this->get_user_id();
|
1121 |
-
|
1122 |
-
check_admin_referer( 'bp-member-type-change-' . $user_id, 'bp-member-type-nonce' );
|
1123 |
-
|
1124 |
-
// Permission check.
|
1125 |
-
if ( ! current_user_can( 'bp_moderate' ) && $user_id != bp_loggedin_user_id() ) {
|
1126 |
-
return;
|
1127 |
-
}
|
1128 |
-
|
1129 |
-
// Member type string must either reference a valid member type, or be empty.
|
1130 |
-
$member_type = stripslashes( $_POST['bp-members-profile-member-type'] );
|
1131 |
-
if ( ! empty( $member_type ) && ! bp_get_member_type_object( $member_type ) ) {
|
1132 |
-
return;
|
1133 |
-
}
|
1134 |
-
|
1135 |
-
/*
|
1136 |
-
* If an invalid member type is passed, someone's doing something
|
1137 |
-
* fishy with the POST request, so we can fail silently.
|
1138 |
-
*/
|
1139 |
-
if ( bp_set_member_type( $user_id, $member_type ) ) {
|
1140 |
-
// @todo Success messages can't be posted because other stuff happens on the page load.
|
1141 |
-
}
|
1142 |
-
}
|
1143 |
-
|
1144 |
/**
|
1145 |
* Add a link to Profile in Users listing row actions.
|
1146 |
*
|
@@ -1174,7 +1032,7 @@ class BP_Members_Admin {
|
|
1174 |
|
1175 |
// Add query args and setup the Extended link
|
1176 |
$edit_profile = add_query_arg( $args, $this->edit_profile_url );
|
1177 |
-
$edit_profile_link = sprintf( '<a href="%1$s">%2$s</a>',
|
1178 |
|
1179 |
/**
|
1180 |
* Check the edit action is available
|
@@ -1329,7 +1187,7 @@ class BP_Members_Admin {
|
|
1329 |
$url = add_query_arg( 'page', 'bp-signups', bp_get_admin_url( 'users.php' ) );
|
1330 |
$text = sprintf( _x( 'Pending %s', 'signup users', 'buddypress' ), '<span class="count">(' . number_format_i18n( $signups ) . ')</span>' );
|
1331 |
|
1332 |
-
$views['registered'] = sprintf( '<a href="%1$s" class="%2$s">%3$s</a>',
|
1333 |
|
1334 |
return $views;
|
1335 |
}
|
@@ -1374,23 +1232,10 @@ class BP_Members_Admin {
|
|
1374 |
$redirect_to = remove_query_arg( array( 'action', 'error', 'updated', 'activated', 'notactivated', 'deleted', 'notdeleted', 'resent', 'notresent', 'do_delete', 'do_resend', 'do_activate', '_wpnonce', 'signup_ids' ), $_SERVER['REQUEST_URI'] );
|
1375 |
$doaction = bp_admin_list_table_current_bulk_action();
|
1376 |
|
1377 |
-
|
1378 |
-
* Fires at the start of the signups admin load.
|
1379 |
-
*
|
1380 |
-
* @since BuddyPress (2.0.0)
|
1381 |
-
*
|
1382 |
-
* @param string $doaction Current bulk action being processed.
|
1383 |
-
* @param array $_REQUEST Current $_REQUEST global.
|
1384 |
-
*/
|
1385 |
do_action( 'bp_signups_admin_load', $doaction, $_REQUEST );
|
1386 |
|
1387 |
-
|
1388 |
-
* Filters the allowed actions for use in the user signups admin page.
|
1389 |
-
*
|
1390 |
-
* @since BuddyPress (2.0.0)
|
1391 |
-
*
|
1392 |
-
* @param array $value Array of allowed actions to use.
|
1393 |
-
*/
|
1394 |
$allowed_actions = apply_filters( 'bp_signups_admin_allowed_actions', array( 'do_delete', 'do_activate', 'do_resend' ) );
|
1395 |
|
1396 |
// Prepare the display of the Community Profile screen
|
@@ -1409,7 +1254,7 @@ class BP_Members_Admin {
|
|
1409 |
'id' => 'bp-signups-overview',
|
1410 |
'title' => __( 'Overview', 'buddypress' ),
|
1411 |
'content' =>
|
1412 |
-
'<p>' . __( 'This is the
|
1413 |
'<p>' . __( 'From the screen options, you can customize the displayed columns and the pagination of this screen.', 'buddypress' ) . '</p>' .
|
1414 |
'<p>' . __( 'You can reorder the list of your pending accounts by clicking on the Username, Email or Registered column headers.', 'buddypress' ) . '</p>' .
|
1415 |
'<p>' . __( 'Using the search form, you can find pending accounts more easily. The Username and Email fields will be included in the search.', 'buddypress' ) . '</p>'
|
@@ -1464,7 +1309,7 @@ class BP_Members_Admin {
|
|
1464 |
bp_core_redirect( $redirect_to );
|
1465 |
|
1466 |
// Handle activated accounts
|
1467 |
-
}
|
1468 |
|
1469 |
// nonce check
|
1470 |
check_admin_referer( 'signups_activate' );
|
@@ -1491,7 +1336,7 @@ class BP_Members_Admin {
|
|
1491 |
bp_core_redirect( $redirect_to );
|
1492 |
|
1493 |
// Handle sign-ups delete
|
1494 |
-
}
|
1495 |
|
1496 |
// nonce check
|
1497 |
check_admin_referer( 'signups_delete' );
|
@@ -1521,15 +1366,6 @@ class BP_Members_Admin {
|
|
1521 |
} else {
|
1522 |
$this->redirect = $redirect_to;
|
1523 |
|
1524 |
-
/**
|
1525 |
-
* Fires at end of signups admin load if doaction does not match any actions.
|
1526 |
-
*
|
1527 |
-
* @since BuddyPress (2.0.0)
|
1528 |
-
*
|
1529 |
-
* @param string $doaction Current bulk action being processed.
|
1530 |
-
* @param array $_REQUEST Current $_REQUEST global.
|
1531 |
-
* @param string $redirect Determined redirect url to send user to.
|
1532 |
-
*/
|
1533 |
do_action( 'bp_members_admin_update_signups', $doaction, $_REQUEST, $this->redirect );
|
1534 |
|
1535 |
bp_core_redirect( $this->redirect );
|
@@ -1688,21 +1524,21 @@ class BP_Members_Admin {
|
|
1688 |
case 'do_resend':
|
1689 |
$notice = array(
|
1690 |
'class' => 'error',
|
1691 |
-
'message' => esc_html__( 'There was a problem sending the activation emails
|
1692 |
);
|
1693 |
break;
|
1694 |
|
1695 |
case 'do_activate':
|
1696 |
$notice = array(
|
1697 |
'class' => 'error',
|
1698 |
-
'message' => esc_html__( 'There was a problem activating accounts
|
1699 |
);
|
1700 |
break;
|
1701 |
|
1702 |
case 'do_delete':
|
1703 |
$notice = array(
|
1704 |
'class' => 'error',
|
1705 |
-
'message' => esc_html__( 'There was a problem deleting sign-ups
|
1706 |
);
|
1707 |
break;
|
1708 |
}
|
@@ -1861,7 +1697,7 @@ class BP_Members_Admin {
|
|
1861 |
* @param string $action Delete, activate, or resend activation link.
|
1862 |
*/
|
1863 |
public function signups_admin_manage( $action = '' ) {
|
1864 |
-
if ( !
|
1865 |
die( '-1' );
|
1866 |
}
|
1867 |
|
@@ -1869,7 +1705,7 @@ class BP_Members_Admin {
|
|
1869 |
$ids = false;
|
1870 |
if ( ! empty( $_POST['allsignups'] ) ) {
|
1871 |
$ids = wp_parse_id_list( $_POST['allsignups'] );
|
1872 |
-
}
|
1873 |
$ids = absint( $_GET['signup_id'] );
|
1874 |
}
|
1875 |
|
1 |
<?php
|
2 |
|
3 |
// Exit if accessed directly
|
4 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
5 |
|
6 |
if ( !class_exists( 'BP_Members_Admin' ) ) :
|
7 |
/**
|
105 |
$this->js_url = trailingslashit( $this->admin_url . 'js' ); // Admin CSS URL
|
106 |
|
107 |
// Capability depends on config
|
108 |
+
$this->capability = bp_core_do_network_admin() ? 'manage_network_options' : 'manage_options';
|
109 |
|
110 |
// The Edit Profile Screen id
|
111 |
$this->user_page = '';
|
144 |
|
145 |
// When BuddyPress is not network activated, only Super Admin can moderate signups
|
146 |
if ( ! empty( $this->subsite_activated ) ) {
|
147 |
+
$this->capability = 'manage_network_options';
|
148 |
}
|
149 |
}
|
150 |
|
186 |
// Add user row actions for single site
|
187 |
add_filter( 'user_row_actions', array( $this, 'row_actions' ), 10, 2 );
|
188 |
|
|
|
|
|
|
|
189 |
/** Signups ***********************************************************/
|
190 |
|
191 |
if ( is_admin() ) {
|
214 |
* @return int
|
215 |
*/
|
216 |
private function get_user_id() {
|
217 |
+
|
218 |
+
// No user ID to start
|
219 |
+
$user_id = 0;
|
220 |
|
221 |
// We'll need a user ID when not on the user admin
|
222 |
if ( ! empty( $_GET['user_id'] ) ) {
|
223 |
$user_id = $_GET['user_id'];
|
224 |
+
|
225 |
+
// Assume the current user ID
|
226 |
+
} else {
|
227 |
+
$user_id = get_current_user_id();
|
228 |
}
|
229 |
|
230 |
return intval( $user_id );
|
308 |
case 'avatar':
|
309 |
$notice = array(
|
310 |
'class' => 'error',
|
311 |
+
'message' => __( 'There was a problem deleting that avatar, please try again.', 'buddypress' )
|
312 |
);
|
313 |
break;
|
314 |
case 'ham' :
|
326 |
case 1 :
|
327 |
$notice = array(
|
328 |
'class' => 'error',
|
329 |
+
'message' => __( 'An error occured while trying to update the profile.', 'buddypress' )
|
330 |
);
|
331 |
break;
|
332 |
case 2:
|
338 |
case 3:
|
339 |
$notice = array(
|
340 |
'class' => 'error',
|
341 |
+
'message' => __( 'There was a problem updating some of your profile information, please try again.', 'buddypress' )
|
342 |
);
|
343 |
break;
|
344 |
}
|
477 |
$this->is_self_profile = true;
|
478 |
|
479 |
// Is the user attempting to edit their own profile
|
480 |
+
} else {
|
481 |
$this->is_self_profile = (bool) ( $this->get_user_id() === $this->current_user_id );
|
482 |
}
|
483 |
|
549 |
|
550 |
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
551 |
$css = $this->css_url . "admin{$min}.css";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
552 |
$css = apply_filters( 'bp_members_admin_css', $css );
|
553 |
|
554 |
wp_enqueue_style( 'bp-members-css', $css, array(), bp_get_version() );
|
558 |
wp_style_add_data( 'bp-members-css', 'suffix', $min );
|
559 |
}
|
560 |
|
561 |
+
// Only load javascript for BuddyPress profile
|
562 |
if ( get_current_screen()->id == $this->user_page ) {
|
563 |
$js = $this->js_url . "admin{$min}.js";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
564 |
$js = apply_filters( 'bp_members_admin_js', $js );
|
565 |
wp_enqueue_script( 'bp-members-js', $js, array( 'jquery' ), bp_get_version(), true );
|
566 |
}
|
567 |
|
568 |
+
// Plugins may want to hook here to load some css/js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
do_action( 'bp_members_admin_enqueue_scripts', get_current_screen()->id, $this->screen_id );
|
570 |
}
|
571 |
|
582 |
return;
|
583 |
}
|
584 |
|
585 |
+
// Add the user ID to query agruments when not editing yourself
|
586 |
if ( false === $this->is_self_profile ) {
|
587 |
$query_args = array( 'user_id' => $user->ID );
|
588 |
} else {
|
656 |
}
|
657 |
}
|
658 |
|
659 |
+
// Call an action for plugins to hook in early
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
660 |
do_action_ref_array( 'bp_members_admin_load', array( $doaction, $_REQUEST ) );
|
661 |
|
662 |
+
// Allowed actions
|
|
|
|
|
|
|
|
|
|
|
|
|
663 |
$allowed_actions = apply_filters( 'bp_members_admin_allowed_actions', array( 'update', 'delete_avatar', 'spam', 'ham' ) );
|
664 |
|
665 |
// Prepare the display of the Community Profile screen
|
697 |
$this->stats_metabox->priority = 'core';
|
698 |
|
699 |
/**
|
700 |
+
* xProfile Hooks to load the profile fields if component is active
|
701 |
+
* Plugins should not use this hook, please use 'bp_members_admin_user_metaboxes' instead
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
702 |
*/
|
703 |
do_action_ref_array( 'bp_members_admin_xprofile_metabox', array( $user_id, get_current_screen()->id, $this->stats_metabox ) );
|
704 |
|
719 |
sanitize_key( $this->stats_metabox->priority )
|
720 |
);
|
721 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
722 |
/**
|
723 |
+
* Custom metabox ?
|
724 |
+
* Plugins can restrict metabox to "bp_moderate" admins checking
|
725 |
+
* the first argument ($this->is_self_profile) is false in their hook
|
726 |
+
* They can also restruct their metabox to self profile editing
|
727 |
+
* by cheking it set to true.
|
|
|
|
|
|
|
|
|
|
|
|
|
728 |
*/
|
729 |
do_action( 'bp_members_admin_user_metaboxes', $this->is_self_profile, $user_id );
|
730 |
|
749 |
} else {
|
750 |
$this->redirect = $redirect_to;
|
751 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
752 |
do_action_ref_array( 'bp_members_admin_update_user', array( $doaction, $user_id, $_REQUEST, $this->redirect ) );
|
753 |
|
754 |
bp_core_redirect( $this->redirect );
|
832 |
<div id="poststuff">
|
833 |
|
834 |
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
835 |
+
<div id="post-body-content">
|
836 |
+
</div><!-- #post-body-content -->
|
837 |
|
838 |
<div id="postbox-container-1" class="postbox-container">
|
839 |
<?php do_meta_boxes( get_current_screen()->id, 'side', $user ); ?>
|
882 |
return;
|
883 |
}
|
884 |
|
885 |
+
// Bail if user has not been activated yet (how didy ou get here?)
|
886 |
if ( isset( $user->user_status ) && ( 2 == $user->user_status ) ) : ?>
|
887 |
|
888 |
<p class="not-activated"><?php esc_html_e( 'User account has not yet been activated', 'buddypress' ); ?></p><br/>
|
991 |
<?php
|
992 |
// Loading other stats only if user has activated their account
|
993 |
if ( empty( $user->user_status ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
994 |
do_action( 'bp_members_admin_user_stats', array( 'user_id' => $user->ID ), $user );
|
995 |
}
|
996 |
?>
|
999 |
<?php
|
1000 |
}
|
1001 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1002 |
/**
|
1003 |
* Add a link to Profile in Users listing row actions.
|
1004 |
*
|
1032 |
|
1033 |
// Add query args and setup the Extended link
|
1034 |
$edit_profile = add_query_arg( $args, $this->edit_profile_url );
|
1035 |
+
$edit_profile_link = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $edit_profile ), esc_html__( 'Extended', 'buddypress' ) );
|
1036 |
|
1037 |
/**
|
1038 |
* Check the edit action is available
|
1187 |
$url = add_query_arg( 'page', 'bp-signups', bp_get_admin_url( 'users.php' ) );
|
1188 |
$text = sprintf( _x( 'Pending %s', 'signup users', 'buddypress' ), '<span class="count">(' . number_format_i18n( $signups ) . ')</span>' );
|
1189 |
|
1190 |
+
$views['registered'] = sprintf( '<a href="%1$s" class="%2$s">%3$s</a>', $url, $class, $text );
|
1191 |
|
1192 |
return $views;
|
1193 |
}
|
1232 |
$redirect_to = remove_query_arg( array( 'action', 'error', 'updated', 'activated', 'notactivated', 'deleted', 'notdeleted', 'resent', 'notresent', 'do_delete', 'do_resend', 'do_activate', '_wpnonce', 'signup_ids' ), $_SERVER['REQUEST_URI'] );
|
1233 |
$doaction = bp_admin_list_table_current_bulk_action();
|
1234 |
|
1235 |
+
// Call an action for plugins to hook in early
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1236 |
do_action( 'bp_signups_admin_load', $doaction, $_REQUEST );
|
1237 |
|
1238 |
+
// Allowed actions
|
|
|
|
|
|
|
|
|
|
|
|
|
1239 |
$allowed_actions = apply_filters( 'bp_signups_admin_allowed_actions', array( 'do_delete', 'do_activate', 'do_resend' ) );
|
1240 |
|
1241 |
// Prepare the display of the Community Profile screen
|
1254 |
'id' => 'bp-signups-overview',
|
1255 |
'title' => __( 'Overview', 'buddypress' ),
|
1256 |
'content' =>
|
1257 |
+
'<p>' . __( 'This is the admininistration screen for pending accounts on your site.', 'buddypress' ) . '</p>' .
|
1258 |
'<p>' . __( 'From the screen options, you can customize the displayed columns and the pagination of this screen.', 'buddypress' ) . '</p>' .
|
1259 |
'<p>' . __( 'You can reorder the list of your pending accounts by clicking on the Username, Email or Registered column headers.', 'buddypress' ) . '</p>' .
|
1260 |
'<p>' . __( 'Using the search form, you can find pending accounts more easily. The Username and Email fields will be included in the search.', 'buddypress' ) . '</p>'
|
1309 |
bp_core_redirect( $redirect_to );
|
1310 |
|
1311 |
// Handle activated accounts
|
1312 |
+
} else if ( 'do_activate' == $doaction ) {
|
1313 |
|
1314 |
// nonce check
|
1315 |
check_admin_referer( 'signups_activate' );
|
1336 |
bp_core_redirect( $redirect_to );
|
1337 |
|
1338 |
// Handle sign-ups delete
|
1339 |
+
} else if ( 'do_delete' == $doaction ) {
|
1340 |
|
1341 |
// nonce check
|
1342 |
check_admin_referer( 'signups_delete' );
|
1366 |
} else {
|
1367 |
$this->redirect = $redirect_to;
|
1368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1369 |
do_action( 'bp_members_admin_update_signups', $doaction, $_REQUEST, $this->redirect );
|
1370 |
|
1371 |
bp_core_redirect( $this->redirect );
|
1524 |
case 'do_resend':
|
1525 |
$notice = array(
|
1526 |
'class' => 'error',
|
1527 |
+
'message' => esc_html__( 'There was a problem sending the activation emails, please try again.', 'buddypress' ),
|
1528 |
);
|
1529 |
break;
|
1530 |
|
1531 |
case 'do_activate':
|
1532 |
$notice = array(
|
1533 |
'class' => 'error',
|
1534 |
+
'message' => esc_html__( 'There was a problem activating accounts, please try again.', 'buddypress' ),
|
1535 |
);
|
1536 |
break;
|
1537 |
|
1538 |
case 'do_delete':
|
1539 |
$notice = array(
|
1540 |
'class' => 'error',
|
1541 |
+
'message' => esc_html__( 'There was a problem deleting sign-ups, please try again.', 'buddypress' ),
|
1542 |
);
|
1543 |
break;
|
1544 |
}
|
1697 |
* @param string $action Delete, activate, or resend activation link.
|
1698 |
*/
|
1699 |
public function signups_admin_manage( $action = '' ) {
|
1700 |
+
if ( ! is_super_admin() || empty( $action ) ) {
|
1701 |
die( '-1' );
|
1702 |
}
|
1703 |
|
1705 |
$ids = false;
|
1706 |
if ( ! empty( $_POST['allsignups'] ) ) {
|
1707 |
$ids = wp_parse_id_list( $_POST['allsignups'] );
|
1708 |
+
} else if ( ! empty( $_GET['signup_id'] ) ) {
|
1709 |
$ids = absint( $_GET['signup_id'] );
|
1710 |
}
|
1711 |
|
bp-members/bp-members-adminbar.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
-
defined( 'ABSPATH' )
|
14 |
|
15 |
/**
|
16 |
* Add the "My Account" menu and all submenus.
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
14 |
|
15 |
/**
|
16 |
* Add the "My Account" menu and all submenus.
|
bp-members/bp-members-cache.php
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Caching functions specific to BuddyPress Members.
|
5 |
-
*
|
6 |
-
* @since BuddyPress (2.2.0)
|
7 |
-
*/
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Pre-fetch member type data when initializing a Members loop.
|
11 |
-
*
|
12 |
-
* @since BuddyPress (2.2.0)
|
13 |
-
*
|
14 |
-
* @param BP_User_Query $bp_user_query BP_User_Query object.
|
15 |
-
*/
|
16 |
-
function bp_members_prefetch_member_type( BP_User_Query $bp_user_query ) {
|
17 |
-
$uncached_member_ids = bp_get_non_cached_ids( $bp_user_query->user_ids, 'bp_member_member_type' );
|
18 |
-
|
19 |
-
$member_types = bp_get_object_terms( $uncached_member_ids, 'bp_member_type', array(
|
20 |
-
'fields' => 'all_with_object_id',
|
21 |
-
) );
|
22 |
-
|
23 |
-
// Rekey by user ID.
|
24 |
-
$keyed_member_types = array();
|
25 |
-
foreach ( $member_types as $member_type ) {
|
26 |
-
if ( ! isset( $keyed_member_types[ $member_type->object_id ] ) ) {
|
27 |
-
$keyed_member_types[ $member_type->object_id ] = array();
|
28 |
-
}
|
29 |
-
|
30 |
-
$keyed_member_types[ $member_type->object_id ][] = $member_type->name;
|
31 |
-
}
|
32 |
-
|
33 |
-
$cached_member_ids = array();
|
34 |
-
foreach ( $keyed_member_types as $user_id => $user_member_types ) {
|
35 |
-
wp_cache_set( $user_id, $user_member_types, 'bp_member_member_type' );
|
36 |
-
$cached_member_ids[] = $user_id;
|
37 |
-
}
|
38 |
-
|
39 |
-
// Cache an empty value for users with no type.
|
40 |
-
foreach ( array_diff( $uncached_member_ids, $cached_member_ids ) as $no_type_id ) {
|
41 |
-
wp_cache_set( $no_type_id, '', 'bp_member_member_type' );
|
42 |
-
}
|
43 |
-
}
|
44 |
-
add_action( 'bp_user_query_populate_extras', 'bp_members_prefetch_member_type' );
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Clear the member_type cache for a user.
|
48 |
-
*
|
49 |
-
* Called when the user is deleted or marked as spam.
|
50 |
-
*
|
51 |
-
* @since BuddyPres (2.2.0)
|
52 |
-
*
|
53 |
-
* @param int $user_id ID of the deleted user.
|
54 |
-
*/
|
55 |
-
function bp_members_clear_member_type_cache( $user_id ) {
|
56 |
-
wp_cache_delete( $user_id, 'bp_member_member_type' );
|
57 |
-
}
|
58 |
-
add_action( 'wpmu_delete_user', 'bp_members_clear_member_type_cache' );
|
59 |
-
add_action( 'delete_user', 'bp_members_clear_member_type_cache' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bp-members/bp-members-classes.php
CHANGED
@@ -175,16 +175,6 @@ class BP_Signup {
|
|
175 |
// Implode WHERE clauses
|
176 |
$sql['where'] = 'WHERE ' . implode( ' AND ', $sql['where'] );
|
177 |
|
178 |
-
/**
|
179 |
-
* Filters the Signups paged query.
|
180 |
-
*
|
181 |
-
* @since BuddyPress (2.0.0)
|
182 |
-
*
|
183 |
-
* @param string $value SQL statement.
|
184 |
-
* @param array $sql Array of SQL statement parts.
|
185 |
-
* @param array $args Array of original arguments for get() method.
|
186 |
-
* @param array $r Array of parsed arguments for get() method.
|
187 |
-
*/
|
188 |
$paged_signups = $wpdb->get_results( apply_filters( 'bp_members_signups_paged_query', join( ' ', $sql ), $sql, $args, $r ) );
|
189 |
|
190 |
if ( empty( $paged_signups ) ) {
|
@@ -235,17 +225,6 @@ class BP_Signup {
|
|
235 |
|
236 |
unset( $sql['limit'] );
|
237 |
$sql['select'] = preg_replace( "/SELECT.*?FROM/", "SELECT COUNT(*) FROM", $sql['select'] );
|
238 |
-
|
239 |
-
/**
|
240 |
-
* Filters the Signups count query.
|
241 |
-
*
|
242 |
-
* @since BuddyPress (2.0.0)
|
243 |
-
*
|
244 |
-
* @param string $value SQL statement.
|
245 |
-
* @param array $sql Array of SQL statement parts.
|
246 |
-
* @param array $args Array of original arguments for get() method.
|
247 |
-
* @param array $r Array of parsed arguments for get() method.
|
248 |
-
*/
|
249 |
$total_signups = $wpdb->get_var( apply_filters( 'bp_members_signups_count_query', join( ' ', $sql ), $sql, $args, $r ) );
|
250 |
|
251 |
return array( 'signups' => $paged_signups, 'total' => $total_signups );
|
@@ -291,13 +270,6 @@ class BP_Signup {
|
|
291 |
$retval = false;
|
292 |
}
|
293 |
|
294 |
-
/**
|
295 |
-
* Filters the result of a signup addition.
|
296 |
-
*
|
297 |
-
* @since BuddyPress (2.0.0)
|
298 |
-
*
|
299 |
-
* @param int|bool $retval Newly added user ID on success, false on failure.
|
300 |
-
*/
|
301 |
return apply_filters( 'bp_core_signups_add', $retval );
|
302 |
}
|
303 |
|
@@ -322,6 +294,8 @@ class BP_Signup {
|
|
322 |
public static function add_backcompat( $user_login = '', $user_password = '', $user_email = '', $usermeta = array() ) {
|
323 |
global $wpdb;
|
324 |
|
|
|
|
|
325 |
$user_id = wp_insert_user( array(
|
326 |
'user_login' => $user_login,
|
327 |
'user_pass' => $user_password,
|
@@ -330,7 +304,8 @@ class BP_Signup {
|
|
330 |
) );
|
331 |
|
332 |
if ( is_wp_error( $user_id ) || empty( $user_id ) ) {
|
333 |
-
|
|
|
334 |
}
|
335 |
|
336 |
// Update the user status to '2', ie "not activated"
|
@@ -363,13 +338,6 @@ class BP_Signup {
|
|
363 |
}
|
364 |
}
|
365 |
|
366 |
-
/**
|
367 |
-
* Filters the user ID for the backcompat functionality.
|
368 |
-
*
|
369 |
-
* @since BuddyPress (2.0.0)
|
370 |
-
*
|
371 |
-
* @param int $user_id User ID being registered.
|
372 |
-
*/
|
373 |
return apply_filters( 'bp_core_signups_add_backcompat', $user_id );
|
374 |
}
|
375 |
|
@@ -390,13 +358,6 @@ class BP_Signup {
|
|
390 |
|
391 |
$user_status = $wpdb->get_var( $wpdb->prepare( "SELECT user_status FROM {$wpdb->users} WHERE ID = %d", $user_id ) );
|
392 |
|
393 |
-
/**
|
394 |
-
* Filters the user status of a provided user ID.
|
395 |
-
*
|
396 |
-
* @since BuddyPress (2.0.0)
|
397 |
-
*
|
398 |
-
* @param int $value User status of the provided user ID.
|
399 |
-
*/
|
400 |
return apply_filters( 'bp_core_signups_check_user_status', intval( $user_status ) );
|
401 |
}
|
402 |
|
@@ -436,13 +397,6 @@ class BP_Signup {
|
|
436 |
)
|
437 |
);
|
438 |
|
439 |
-
/**
|
440 |
-
* Filters the status of the activated user.
|
441 |
-
*
|
442 |
-
* @since BuddyPress (2.0.0)
|
443 |
-
*
|
444 |
-
* @param bool $activated Whether or not the activation was successful.
|
445 |
-
*/
|
446 |
return apply_filters( 'bp_core_signups_validate', $activated );
|
447 |
}
|
448 |
|
@@ -459,13 +413,6 @@ class BP_Signup {
|
|
459 |
$signups_table = buddypress()->members->table_name_signups;
|
460 |
$count_signups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) AS total FROM {$signups_table} WHERE active = %d", 0 ) );
|
461 |
|
462 |
-
/**
|
463 |
-
* Filters the total inactive signups.
|
464 |
-
*
|
465 |
-
* @since BuddyPress (2.0.0)
|
466 |
-
*
|
467 |
-
* @param int $count_signups How many total signups there are.
|
468 |
-
*/
|
469 |
return apply_filters( 'bp_core_signups_count', (int) $count_signups );
|
470 |
}
|
471 |
|
@@ -516,13 +463,6 @@ class BP_Signup {
|
|
516 |
)
|
517 |
);
|
518 |
|
519 |
-
/**
|
520 |
-
* Filters the signup ID which received a meta update.
|
521 |
-
*
|
522 |
-
* @since BuddyPress (2.0.0)
|
523 |
-
*
|
524 |
-
* @param int $value The signup ID.
|
525 |
-
*/
|
526 |
return apply_filters( 'bp_core_signups_update', $r['signup_id'] );
|
527 |
}
|
528 |
|
@@ -549,13 +489,6 @@ class BP_Signup {
|
|
549 |
|
550 |
$result = array();
|
551 |
|
552 |
-
/**
|
553 |
-
* Fires before activation emails are resent.
|
554 |
-
*
|
555 |
-
* @since BuddyPress (2.0.0)
|
556 |
-
*
|
557 |
-
* @param array $signup_ids Array of IDs to resend activation emails to.
|
558 |
-
*/
|
559 |
do_action( 'bp_core_signup_before_resend', $signup_ids );
|
560 |
|
561 |
foreach ( $signups as $signup ) {
|
@@ -577,7 +510,7 @@ class BP_Signup {
|
|
577 |
// Status is not 2, so user's account has been activated
|
578 |
$result['errors'][ $signup->signup_id ] = array( $signup->user_login, esc_html__( 'the sign-up has already been activated.', 'buddypress' ) );
|
579 |
|
580 |
-
//
|
581 |
self::validate( $signup->activation_key );
|
582 |
|
583 |
continue;
|
@@ -595,23 +528,8 @@ class BP_Signup {
|
|
595 |
) );
|
596 |
}
|
597 |
|
598 |
-
/**
|
599 |
-
* Fires after activation emails are resent.
|
600 |
-
*
|
601 |
-
* @since BuddyPress (2.0.0)
|
602 |
-
*
|
603 |
-
* @param array $signup_ids Array of IDs to resend activation emails to.
|
604 |
-
* @param array $result Updated metadata related to activation emails.
|
605 |
-
*/
|
606 |
do_action( 'bp_core_signup_after_resend', $signup_ids, $result );
|
607 |
|
608 |
-
/**
|
609 |
-
* Filters the result of the metadata for signup activation email resends.
|
610 |
-
*
|
611 |
-
* @since BuddyPress (2.0.0)
|
612 |
-
*
|
613 |
-
* @param array $result Updated metadata related to activation emails.
|
614 |
-
*/
|
615 |
return apply_filters( 'bp_core_signup_resend', $result );
|
616 |
}
|
617 |
|
@@ -638,13 +556,6 @@ class BP_Signup {
|
|
638 |
|
639 |
$result = array();
|
640 |
|
641 |
-
/**
|
642 |
-
* Fires before activation of user accounts.
|
643 |
-
*
|
644 |
-
* @since BuddyPress (2.0.0)
|
645 |
-
*
|
646 |
-
* @param array $signup_ids Array of IDs to activate.
|
647 |
-
*/
|
648 |
do_action( 'bp_core_signup_before_activate', $signup_ids );
|
649 |
|
650 |
foreach ( $signups as $signup ) {
|
@@ -664,7 +575,7 @@ class BP_Signup {
|
|
664 |
// Status is not 2, so user's account has been activated
|
665 |
$result['errors'][ $signup->signup_id ] = array( $signup->user_login, esc_html__( 'the sign-up has already been activated.', 'buddypress' ) );
|
666 |
|
667 |
-
//
|
668 |
self::validate( $signup->activation_key );
|
669 |
|
670 |
// we have a user id, account is not active, let's delete it
|
@@ -677,23 +588,8 @@ class BP_Signup {
|
|
677 |
}
|
678 |
}
|
679 |
|
680 |
-
/**
|
681 |
-
* Fires after activation of user accounts.
|
682 |
-
*
|
683 |
-
* @since BuddyPress (2.0.0)
|
684 |
-
*
|
685 |
-
* @param array $signup_ids Array of IDs activated activate.
|
686 |
-
* @param array $result Array of data for activated accounts.
|
687 |
-
*/
|
688 |
do_action( 'bp_core_signup_after_activate', $signup_ids, $result );
|
689 |
|
690 |
-
/**
|
691 |
-
* Filters the result of the metadata after user activation.
|
692 |
-
*
|
693 |
-
* @since BuddyPress (2.0.0)
|
694 |
-
*
|
695 |
-
* @param array $result Updated metadata related to user activation.
|
696 |
-
*/
|
697 |
return apply_filters( 'bp_core_signup_activate', $result );
|
698 |
}
|
699 |
|
@@ -722,13 +618,6 @@ class BP_Signup {
|
|
722 |
|
723 |
$result = array();
|
724 |
|
725 |
-
/**
|
726 |
-
* Fires before deletion of pending accounts.
|
727 |
-
*
|
728 |
-
* @since BuddyPress (2.0.0)
|
729 |
-
*
|
730 |
-
* @param array $signup_ids Array of pending IDs to delete.
|
731 |
-
*/
|
732 |
do_action( 'bp_core_signup_before_delete', $signup_ids );
|
733 |
|
734 |
foreach ( $signups as $signup ) {
|
@@ -741,7 +630,7 @@ class BP_Signup {
|
|
741 |
// Status is not 2, so user's account has been activated
|
742 |
$result['errors'][ $signup->signup_id ] = array( $signup->user_login, esc_html__( 'the sign-up has already been activated.', 'buddypress' ) );
|
743 |
|
744 |
-
//
|
745 |
self::validate( $signup->activation_key );
|
746 |
|
747 |
// we have a user id, account is not active, let's delete it
|
@@ -764,23 +653,8 @@ class BP_Signup {
|
|
764 |
}
|
765 |
}
|
766 |
|
767 |
-
/**
|
768 |
-
* Fires after deletion of pending accounts.
|
769 |
-
*
|
770 |
-
* @since BuddyPress (2.0.0)
|
771 |
-
*
|
772 |
-
* @param array $signup_ids Array of pending IDs to delete.
|
773 |
-
* @param array $result Array of data for deleted accounts.
|
774 |
-
*/
|
775 |
do_action( 'bp_core_signup_after_delete', $signup_ids, $result );
|
776 |
|
777 |
-
/**
|
778 |
-
* Filters the result of the metadata for deleted pending accounts.
|
779 |
-
*
|
780 |
-
* @since BuddyPress (2.0.0)
|
781 |
-
*
|
782 |
-
* @param array $result Updated metadata related to deleted pending accounts.
|
783 |
-
*/
|
784 |
return apply_filters( 'bp_core_signup_delete', $result );
|
785 |
}
|
786 |
}
|
175 |
// Implode WHERE clauses
|
176 |
$sql['where'] = 'WHERE ' . implode( ' AND ', $sql['where'] );
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
$paged_signups = $wpdb->get_results( apply_filters( 'bp_members_signups_paged_query', join( ' ', $sql ), $sql, $args, $r ) );
|
179 |
|
180 |
if ( empty( $paged_signups ) ) {
|
225 |
|
226 |
unset( $sql['limit'] );
|
227 |
$sql['select'] = preg_replace( "/SELECT.*?FROM/", "SELECT COUNT(*) FROM", $sql['select'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
$total_signups = $wpdb->get_var( apply_filters( 'bp_members_signups_count_query', join( ' ', $sql ), $sql, $args, $r ) );
|
229 |
|
230 |
return array( 'signups' => $paged_signups, 'total' => $total_signups );
|
270 |
$retval = false;
|
271 |
}
|
272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
return apply_filters( 'bp_core_signups_add', $retval );
|
274 |
}
|
275 |
|
294 |
public static function add_backcompat( $user_login = '', $user_password = '', $user_email = '', $usermeta = array() ) {
|
295 |
global $wpdb;
|
296 |
|
297 |
+
$errors = new WP_Error();
|
298 |
+
|
299 |
$user_id = wp_insert_user( array(
|
300 |
'user_login' => $user_login,
|
301 |
'user_pass' => $user_password,
|
304 |
) );
|
305 |
|
306 |
if ( is_wp_error( $user_id ) || empty( $user_id ) ) {
|
307 |
+
$errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn’t register you. Please contact the <a href="mailto:%s">webmaster</a>.', 'buddypress' ), bp_get_option( 'admin_email' ) ) );
|
308 |
+
return $errors;
|
309 |
}
|
310 |
|
311 |
// Update the user status to '2', ie "not activated"
|
338 |
}
|
339 |
}
|
340 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
return apply_filters( 'bp_core_signups_add_backcompat', $user_id );
|
342 |
}
|
343 |
|
358 |
|
359 |
$user_status = $wpdb->get_var( $wpdb->prepare( "SELECT user_status FROM {$wpdb->users} WHERE ID = %d", $user_id ) );
|
360 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
return apply_filters( 'bp_core_signups_check_user_status', intval( $user_status ) );
|
362 |
}
|
363 |
|
397 |
)
|
398 |
);
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
return apply_filters( 'bp_core_signups_validate', $activated );
|
401 |
}
|
402 |
|
413 |
$signups_table = buddypress()->members->table_name_signups;
|
414 |
$count_signups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) AS total FROM {$signups_table} WHERE active = %d", 0 ) );
|
415 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
416 |
return apply_filters( 'bp_core_signups_count', (int) $count_signups );
|
417 |
}
|
418 |
|
463 |
)
|
464 |
);
|
465 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
return apply_filters( 'bp_core_signups_update', $r['signup_id'] );
|
467 |
}
|
468 |
|
489 |
|
490 |
$result = array();
|
491 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
do_action( 'bp_core_signup_before_resend', $signup_ids );
|
493 |
|
494 |
foreach ( $signups as $signup ) {
|
510 |
// Status is not 2, so user's account has been activated
|
511 |
$result['errors'][ $signup->signup_id ] = array( $signup->user_login, esc_html__( 'the sign-up has already been activated.', 'buddypress' ) );
|
512 |
|
513 |
+
// repare signups table
|
514 |
self::validate( $signup->activation_key );
|
515 |
|
516 |
continue;
|
528 |
) );
|
529 |
}
|
530 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
do_action( 'bp_core_signup_after_resend', $signup_ids, $result );
|
532 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
533 |
return apply_filters( 'bp_core_signup_resend', $result );
|
534 |
}
|
535 |
|
556 |
|
557 |
$result = array();
|
558 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
do_action( 'bp_core_signup_before_activate', $signup_ids );
|
560 |
|
561 |
foreach ( $signups as $signup ) {
|
575 |
// Status is not 2, so user's account has been activated
|
576 |
$result['errors'][ $signup->signup_id ] = array( $signup->user_login, esc_html__( 'the sign-up has already been activated.', 'buddypress' ) );
|
577 |
|
578 |
+
// repare signups table
|
579 |
self::validate( $signup->activation_key );
|
580 |
|
581 |
// we have a user id, account is not active, let's delete it
|
588 |
}
|
589 |
}
|
590 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
591 |
do_action( 'bp_core_signup_after_activate', $signup_ids, $result );
|
592 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
593 |
return apply_filters( 'bp_core_signup_activate', $result );
|
594 |
}
|
595 |
|
618 |
|
619 |
$result = array();
|
620 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
621 |
do_action( 'bp_core_signup_before_delete', $signup_ids );
|
622 |
|
623 |
foreach ( $signups as $signup ) {
|
630 |
// Status is not 2, so user's account has been activated
|
631 |
$result['errors'][ $signup->signup_id ] = array( $signup->user_login, esc_html__( 'the sign-up has already been activated.', 'buddypress' ) );
|
632 |
|
633 |
+
// repare signups table
|
634 |
self::validate( $signup->activation_key );
|
635 |
|
636 |
// we have a user id, account is not active, let's delete it
|
653 |
}
|
654 |
}
|
655 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
656 |
do_action( 'bp_core_signup_after_delete', $signup_ids, $result );
|
657 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
658 |
return apply_filters( 'bp_core_signup_delete', $result );
|
659 |
}
|
660 |
}
|
bp-members/bp-members-filters.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
-
defined( 'ABSPATH' )
|
14 |
|
15 |
/**
|
16 |
* Escape commonly used fullname output functions.
|
@@ -111,15 +111,6 @@ function bp_members_edit_profile_url( $url, $user_id, $scheme = 'admin' ) {
|
|
111 |
$profile_link = $url;
|
112 |
}
|
113 |
|
114 |
-
/**
|
115 |
-
* Filters the user profile URL to point to BuddyPress profile edit.
|
116 |
-
*
|
117 |
-
* @since BuddyPress (1.5.2)
|
118 |
-
*
|
119 |
-
* @param string $url WP profile edit URL.
|
120 |
-
* @param int $user_id ID of the user.
|
121 |
-
* @param string $scheme Scheme to use.
|
122 |
-
*/
|
123 |
return apply_filters( 'bp_members_edit_profile_url', $profile_link, $url, $user_id, $scheme );
|
124 |
}
|
125 |
add_filter( 'edit_profile_url', 'bp_members_edit_profile_url', 10, 3 );
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
14 |
|
15 |
/**
|
16 |
* Escape commonly used fullname output functions.
|
111 |
$profile_link = $url;
|
112 |
}
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
return apply_filters( 'bp_members_edit_profile_url', $profile_link, $url, $user_id, $scheme );
|
115 |
}
|
116 |
add_filter( 'edit_profile_url', 'bp_members_edit_profile_url', 10, 3 );
|
bp-members/bp-members-functions.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
-
defined( 'ABSPATH' )
|
14 |
|
15 |
/**
|
16 |
* Check for the existence of a Members directory page.
|
@@ -78,18 +78,19 @@ add_action( 'bp_setup_globals', 'bp_core_define_slugs', 11 );
|
|
78 |
* @param array $args {
|
79 |
* Array of arguments. All are optional. See {@link BP_User_Query} for
|
80 |
* a more complete description of arguments.
|
81 |
-
* @type string
|
82 |
-
* @type int
|
83 |
-
* @type mixed
|
84 |
-
* @type string
|
85 |
-
* @type string
|
86 |
-
* @type string
|
87 |
-
*
|
88 |
* @type mixed $include Limit results by user IDs. Default: false.
|
89 |
-
* @type int
|
90 |
-
* @type int
|
91 |
-
* @type bool
|
92 |
-
* @type string|bool
|
|
|
93 |
* }
|
94 |
* @return array
|
95 |
*/
|
@@ -103,7 +104,6 @@ function bp_core_get_users( $args = '' ) {
|
|
103 |
'search_terms' => false, // Limit to users that match these search terms
|
104 |
'meta_key' => false, // Limit to users who have this piece of usermeta
|
105 |
'meta_value' => false, // With meta_key, limit to users where usermeta matches this value
|
106 |
-
'member_type' => '',
|
107 |
'include' => false, // Pass comma separated list of user_ids to limit to only these users
|
108 |
'per_page' => 20, // The number of results to return per page
|
109 |
'page' => 1, // The page to return if limiting per page
|
@@ -139,19 +139,11 @@ function bp_core_get_users( $args = '' ) {
|
|
139 |
);
|
140 |
}
|
141 |
|
142 |
-
/**
|
143 |
-
* Filters the results of the user query.
|
144 |
-
*
|
145 |
-
* @since BuddyPress (1.2.0)
|
146 |
-
*
|
147 |
-
* @param array $retval Array of users for the current query.
|
148 |
-
* @param array $r Array of parsed query arguments.
|
149 |
-
*/
|
150 |
return apply_filters( 'bp_core_get_users', $retval, $r );
|
151 |
}
|
152 |
|
153 |
/**
|
154 |
-
* Return the domain for the passed user: e.g. http://
|
155 |
*
|
156 |
* @param int $user_id The ID of the user.
|
157 |
* @param string $user_nicename Optional. user_nicename of the user.
|
@@ -176,16 +168,6 @@ function bp_core_get_user_domain( $user_id = 0, $user_nicename = false, $user_lo
|
|
176 |
// Use the 'bp_core_get_user_domain' filter instead.
|
177 |
$domain = apply_filters( 'bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login );
|
178 |
|
179 |
-
/**
|
180 |
-
* Filters the domain for the passed user.
|
181 |
-
*
|
182 |
-
* @since BuddyPress (1.0.1)
|
183 |
-
*
|
184 |
-
* @param string $domain Domain for the passed user.
|
185 |
-
* @param int $user_id ID of the passed user.
|
186 |
-
* @param string $user_nicename User nicename of the passed user.
|
187 |
-
* @param string $user_login User login of the passed user.
|
188 |
-
*/
|
189 |
return apply_filters( 'bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login );
|
190 |
}
|
191 |
|
@@ -204,14 +186,6 @@ function bp_core_get_core_userdata( $user_id = 0 ) {
|
|
204 |
$userdata = BP_Core_User::get_core_userdata( $user_id );
|
205 |
wp_cache_set( 'bp_core_userdata_' . $user_id, $userdata, 'bp' );
|
206 |
}
|
207 |
-
|
208 |
-
/**
|
209 |
-
* Filters the userdata for a passed user.
|
210 |
-
*
|
211 |
-
* @since BuddyPress (1.2.0)
|
212 |
-
*
|
213 |
-
* @param array $userdata Array of user data for a passed user.
|
214 |
-
*/
|
215 |
return apply_filters( 'bp_core_get_core_userdata', $userdata );
|
216 |
}
|
217 |
|
@@ -244,14 +218,6 @@ function bp_core_get_userid( $username = '' ) {
|
|
244 |
|
245 |
$user = get_user_by( 'login', $username );
|
246 |
|
247 |
-
/**
|
248 |
-
* Filters the ID of a user, based on user_login.
|
249 |
-
*
|
250 |
-
* @since BuddyPress (1.0.1)
|
251 |
-
*
|
252 |
-
* @param int|null $value ID of the user or null.
|
253 |
-
* @param string $username User login to check.
|
254 |
-
*/
|
255 |
return apply_filters( 'bp_core_get_userid', ! empty( $user->ID ) ? $user->ID : NULL, $username );
|
256 |
}
|
257 |
|
@@ -270,14 +236,6 @@ function bp_core_get_userid_from_nicename( $user_nicename = '' ) {
|
|
270 |
|
271 |
$user = get_user_by( 'slug', $user_nicename );
|
272 |
|
273 |
-
/**
|
274 |
-
* Filters the user ID based on user_nicename.
|
275 |
-
*
|
276 |
-
* @since BuddyPress (1.2.3)
|
277 |
-
*
|
278 |
-
* @param int|null $value ID of the user or null.
|
279 |
-
* @param string $user_nicename User nicename to check.
|
280 |
-
*/
|
281 |
return apply_filters( 'bp_core_get_userid_from_nicename', ! empty( $user->ID ) ? $user->ID : NULL, $user_nicename );
|
282 |
}
|
283 |
|
@@ -352,13 +310,6 @@ function bp_core_get_username( $user_id = 0, $user_nicename = false, $user_login
|
|
352 |
// wp_cache_delete( 'bp_user_username_' . $user_id );
|
353 |
}
|
354 |
|
355 |
-
/**
|
356 |
-
* Filters the username based on originally provided user ID.
|
357 |
-
*
|
358 |
-
* @since BuddyPress (1.0.1)
|
359 |
-
*
|
360 |
-
* @param string $username Username determined by user ID.
|
361 |
-
*/
|
362 |
return apply_filters( 'bp_core_get_username', $username );
|
363 |
}
|
364 |
|
@@ -416,13 +367,6 @@ function bp_members_get_user_nicename( $user_id ) {
|
|
416 |
wp_cache_set( 'bp_members_user_nicename_' . $user_id, $user_nicename, 'bp' );
|
417 |
}
|
418 |
|
419 |
-
/**
|
420 |
-
* F
|
10 |
*/
|
11 |
|
12 |
// Exit if accessed directly
|
13 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
14 |
|
15 |
/**
|
16 |
* Check for the existence of a Members directory page.
|
78 |
* @param array $args {
|
79 |
* Array of arguments. All are optional. See {@link BP_User_Query} for
|
80 |
* a more complete description of arguments.
|
81 |
+
* @type string $type Sort order. Default: 'active'.
|
82 |
+
* @type int $user_id Limit results to friends of a user. Default: false.
|
83 |
+
* @type mixed $exclude IDs to exclude from results. Default: false.
|
84 |
+
* @type string $search_terms Limit to users matching search terms. Default: false.
|
85 |
+
* @type string $meta_key Limit to users with a meta_key. Default: false.
|
86 |
+
* @type string $meta_value Limit to users with a meta_value (with
|
87 |
+
* meta_key). Default: false.
|
88 |
* @type mixed $include Limit results by user IDs. Default: false.
|
89 |
+
* @type int $per_page Results per page. Default: 20.
|
90 |
+
* @type int $page Page of results. Default: 1.
|
91 |
+
* @type bool $populate_extras Fetch optional extras. Default: true.
|
92 |
+
* @type string|bool $count_total How to do total user count.
|
93 |
+
* Default: 'count_query'.
|
94 |
* }
|
95 |
* @return array
|
96 |
*/
|
104 |
'search_terms' => false, // Limit to users that match these search terms
|
105 |
'meta_key' => false, // Limit to users who have this piece of usermeta
|
106 |
'meta_value' => false, // With meta_key, limit to users where usermeta matches this value
|
|
|
107 |
'include' => false, // Pass comma separated list of user_ids to limit to only these users
|
108 |
'per_page' => 20, // The number of results to return per page
|
109 |
'page' => 1, // The page to return if limiting per page
|
139 |
);
|
140 |
}
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
return apply_filters( 'bp_core_get_users', $retval, $r );
|
143 |
}
|
144 |
|
145 |
/**
|
146 |
+
* Return the domain for the passed user: e.g. http://domain.com/members/andy/.
|
147 |
*
|
148 |
* @param int $user_id The ID of the user.
|
149 |
* @param string $user_nicename Optional. user_nicename of the user.
|
168 |
// Use the 'bp_core_get_user_domain' filter instead.
|
169 |
$domain = apply_filters( 'bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login );
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
return apply_filters( 'bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login );
|
172 |
}
|
173 |
|
186 |
$userdata = BP_Core_User::get_core_userdata( $user_id );
|
187 |
wp_cache_set( 'bp_core_userdata_' . $user_id, $userdata, 'bp' );
|
188 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
return apply_filters( 'bp_core_get_core_userdata', $userdata );
|
190 |
}
|
191 |
|
218 |
|
219 |
$user = get_user_by( 'login', $username );
|
220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
return apply_filters( 'bp_core_get_userid', ! empty( $user->ID ) ? $user->ID : NULL, $username );
|
222 |
}
|
223 |
|
236 |
|
237 |
$user = get_user_by( 'slug', $user_nicename );
|
238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
return apply_filters( 'bp_core_get_userid_from_nicename', ! empty( $user->ID ) ? $user->ID : NULL, $user_nicename );
|
240 |
}
|
241 |
|
310 |
// wp_cache_delete( 'bp_user_username_' . $user_id );
|
311 |
}
|
312 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
return apply_filters( 'bp_core_get_username', $username );
|
314 |
}
|
315 |
|
367 |
wp_cache_set( 'bp_members_user_nicename_' . $user_id, $user_nicename, 'bp' );
|
368 |
}
|
369 |
|
|
|
|