Version Description
= 2.5.1 = See: https://codex.buddypress.org/releases/version-2-5-1/
= 2.5 = See: https://codex.buddypress.org/releases/version-2-5-0/
= 2.4.3 = See: https://codex.buddypress.org/releases/version-2-4-3/
= 2.4.2 = See: https://codex.buddypress.org/releases/version-2-4-2/
= 2.4.1 = See: https://codex.buddypress.org/releases/version-2-4-1/
= 2.4 = See: https://codex.buddypress.org/releases/version-2-4-0/
= 2.3.5 = See: https://codex.buddypress.org/releases/version-2-3-5/
= 2.3.4 = See: https://codex.buddypress.org/releases/version-2-3-4/
= 2.3.3 = See: https://codex.buddypress.org/releases/version-2-3-3/
= 2.3.2 = See: https://codex.buddypress.org/releases/version-2-3-2/
= 2.3.1 = See: https://codex.buddypress.org/releases/version-2-3-1/
= 2.3.0 = See: https://codex.buddypress.org/releases/version-2-3-0/
= 2.2.3.1 = See: https://codex.buddypress.org/releases/version-2-2-3-1/
= 2.2.3 = See: https://codex.buddypress.org/releases/version-2-2-3/
= 2.2.2.1 = See: https://codex.buddypress.org/releases/version-2-2-2-1/
= 2.2.2 = See: https://codex.buddypress.org/releases/version-2-2-2/
= 2.2.1 = See: https://codex.buddypress.org/releases/version-2-2-1/
= 2.2 = See: https://codex.buddypress.org/releases/version-2-2/
= 2.1 = See: https://codex.buddypress.org/releases/version-2-1/
= 2.0.3 = See: https://codex.buddypress.org/releases/version-2-0-3/
= 2.0.2 = See: https://codex.buddypress.org/releases/version-2-0-2/
= 2.0.1 = See: https://codex.buddypress.org/releases/version-2-0-1/
= 2.0 = See: https://codex.buddypress.org/releases/version-2-0/
= 1.9.2 = See: https://codex.buddypress.org/releases/version-1-9-2/
= 1.9.1 = See: https://codex.buddypress.org/releases/version-1-9-1/
= 1.9 = See: https://codex.buddypress.org/releases/version-1-9/
= 1.8.1 = See: https://codex.buddypress.org/releases/version-1-8-1/
= 1.8 = See: https://codex.buddypress.org/releases/version-1-8/
= 1.7.3 = See: https://codex.buddypress.org/releases/version-1-7-3/
= 1.7.2 = See: https://codex.buddypress.org/releases/version-1-7-2/
= 1.7.1 = See: https://codex.buddypress.org/releases/version-1-7-1/
= 1.7 = See: https://codex.buddypress.org/releases/version-1-7/
= 1.6.5 = See: https://codex.buddypress.org/releases/version-1-6-5/
= 1.6.4 = See: https://codex.buddypress.org/releases/version-1-6-4/
= 1.6.3 = See: https://codex.buddypress.org/releases/version-1-6-3/
= 1.6.2 = Compatibility with WordPress 3.5
= 1.6.1 = Fixes 4 bugs
= 1.6 = See: https://codex.buddypress.org/releases/version-1-6/
= 1.5 = See: https://codex.buddypress.org/releases/version-1-5/
= 1.2.9 = Compatibility with WordPress 3.2
= 1.2.8 = Compatibility with WordPress 3.1
= 1.2.7 = Fixes over 10 bugs.
Release Info
Developer | dcavins |
Plugin | BuddyPress |
Version | 2.6.0-rc1 |
Comparing to | |
See all releases |
Code changes from version 2.5.3 to 2.6.0-rc1
- bp-activity/admin/js/admin.min.js +0 -1
- bp-activity/bp-activity-actions.php +0 -102
- bp-activity/bp-activity-admin.php +40 -10
- bp-activity/bp-activity-adminbar.php +47 -0
- bp-activity/bp-activity-akismet.php +3 -1
- bp-activity/bp-activity-classes.php +5 -0
- bp-activity/bp-activity-embeds.php +352 -0
- bp-activity/bp-activity-filters.php +39 -31
- bp-activity/bp-activity-functions.php +109 -160
- bp-activity/bp-activity-loader.php +3 -1
- bp-activity/bp-activity-notifications.php +180 -92
- bp-activity/bp-activity-screens.php +25 -63
- bp-activity/bp-activity-template.php +27 -268
- bp-activity/classes/class-bp-activity-activity.php +60 -8
- bp-activity/classes/class-bp-activity-component.php +16 -16
- bp-activity/classes/class-bp-activity-list-table.php +17 -7
- bp-activity/classes/class-bp-activity-oembed-extension.php +329 -0
- bp-activity/css/mentions-rtl.css +2 -3
- bp-activity/css/mentions-rtl.min.css +1 -1
- bp-activity/css/mentions.css +3 -3
- bp-activity/css/mentions.min.css +1 -1
- bp-activity/js/mentions.js +1 -1
- bp-activity/js/mentions.min.js +1 -2
- bp-blogs/bp-blogs-activity.php +125 -1
- bp-blogs/bp-blogs-filters.php +0 -1
- bp-blogs/bp-blogs-functions.php +118 -148
- bp-blogs/bp-blogs-loader.php +3 -1
- bp-blogs/bp-blogs-screens.php +3 -1
- bp-blogs/bp-blogs-template.php +34 -22
- bp-blogs/bp-blogs-widgets.php +3 -1
- bp-blogs/classes/class-bp-blogs-component.php +13 -2
- bp-blogs/classes/class-bp-blogs-recent-posts-widget.php +3 -2
- bp-core/admin/bp-core-admin-actions.php +0 -9
- bp-core/admin/bp-core-admin-components.php +27 -94
- bp-core/admin/bp-core-admin-functions.php +26 -18
- bp-core/admin/bp-core-admin-schema.php +0 -22
- bp-core/admin/bp-core-admin-settings.php +0 -16
- bp-core/admin/bp-core-admin-slugs.php +0 -1
- bp-core/admin/bp-core-admin-tools.php +25 -1
- bp-core/admin/css/common-rtl.css +169 -78
- bp-core/admin/css/common-rtl.min.css +1 -1
- bp-core/admin/css/common.css +169 -78
- bp-core/admin/css/common.min.css +1 -1
- bp-core/admin/images/activity-embeds.png +0 -0
- bp-core/admin/images/autolink-feature.png +0 -0
- bp-core/admin/images/bp-emails-feature.png +0 -0
- bp-core/admin/images/default-themes.png +0 -0
- bp-core/admin/images/emoji-feature.png +0 -0
- bp-core/admin/images/group-type-pop.png +0 -0
- bp-core/admin/images/new-nav-api.png +0 -0
- bp-core/admin/images/post-type.png +0 -0
- bp-core/admin/images/twentytwelve.png +0 -0
- bp-core/admin/images/user-frontpage.png +0 -0
- bp-core/admin/js/customizer-controls.min.js +0 -1
- bp-core/admin/js/customizer-receiver-emails.min.js +0 -1
- bp-core/bp-core-actions.php +2 -0
- bp-core/bp-core-admin.php +3 -2
- bp-core/bp-core-adminbar.php +0 -11
- bp-core/bp-core-attachments.php +1 -1
- bp-core/bp-core-avatars.php +58 -28
- bp-core/bp-core-buddybar.php +224 -158
- bp-core/bp-core-caps.php +0 -17
- bp-core/bp-core-catchuri.php +71 -7
- bp-core/bp-core-classes.php +8 -0
- bp-core/bp-core-component.php +3 -1
- bp-core/bp-core-cssjs.php +0 -2
- bp-core/bp-core-customizer-email.php +6 -4
- bp-core/bp-core-dependency.php +50 -29
- bp-core/bp-core-filters.php +0 -6
- bp-core/bp-core-functions.php +164 -64
- bp-core/bp-core-loader.php +4 -1
- bp-core/bp-core-moderation.php +28 -27
- bp-core/bp-core-options.php +0 -40
- bp-core/bp-core-taxonomy.php +55 -17
- bp-core/bp-core-template-loader.php +59 -15
- bp-core/bp-core-template.php +144 -106
- bp-core/bp-core-theme-compatibility.php +7 -31
- bp-core/bp-core-update.php +0 -18
- bp-core/bp-core-widgets.php +3 -1
- bp-core/classes/class-bp-admin.php +127 -61
- bp-core/classes/class-bp-attachment-avatar.php +0 -17
- bp-core/classes/class-bp-attachment.php +0 -14
- bp-core/classes/class-bp-component.php +2 -16
- bp-core/classes/class-bp-core-bp-nav-backcompat.php +270 -0
- bp-core/classes/class-bp-core-bp-options-nav-backcompat.php +138 -0
- bp-core/classes/class-bp-core-login-widget.php +3 -2
- bp-core/classes/class-bp-core-nav-item.php +34 -0
- bp-core/classes/class-bp-core-nav.php +402 -0
- bp-core/classes/class-bp-core-oembed-extension.php +616 -0
- bp-core/classes/class-bp-core-user.php +1 -13
- bp-core/classes/class-bp-core.php +6 -1
- bp-core/classes/class-bp-email-recipient.php +36 -13
- bp-core/classes/class-bp-embed.php +0 -9
- bp-core/classes/class-bp-user-query.php +3 -2
- bp-core/classes/class-bp-walker-category-checklist.php +1 -1
- bp-core/css/avatar-rtl.css +1 -1
- bp-core/css/avatar-rtl.min.css +1 -1
- bp-core/css/avatar.css +1 -1
- bp-core/css/avatar.min.css +1 -1
- bp-core/css/buddybar-rtl.css +3 -3
- bp-core/css/buddybar-rtl.min.css +1 -1
- bp-core/deprecated/1.2.php +0 -2
- bp-core/deprecated/1.7.php +0 -1
- bp-core/deprecated/2.6.php +50 -0
- bp-core/images/mystery-group-50.png +0 -0
- bp-core/images/mystery-group.png +0 -0
- bp-core/js/avatar.min.js +0 -1
- bp-core/js/bp-plupload.min.js +0 -1
- bp-core/js/confirm.min.js +0 -1
- bp-core/js/cover-image.min.js +0 -1
- bp-core/js/jquery-cookie.min.js +0 -1
- bp-core/js/jquery-query.min.js +0 -1
- bp-core/js/jquery-scroll-to.min.js +0 -1
- bp-core/js/jquery.atwho.min.js +0 -1
- bp-core/js/jquery.caret.min.js +0 -1
- bp-core/js/webcam.min.js +0 -1
- bp-core/js/widget-members.js +12 -1
- bp-core/js/widget-members.min.js +1 -2
- bp-forums/bp-forums-bbpress-sa.php +35 -0
- bp-forums/bp-forums-filters.php +12 -0
- bp-forums/bp-forums-functions.php +50 -0
- bp-forums/bp-forums-loader.php +11 -0
- bp-forums/bp-forums-screens.php +12 -0
- bp-forums/bp-forums-template.php +306 -9
- bp-forums/deprecated/1.6.php +12 -6
- bp-friends/bp-friends-activity.php +1 -1
- bp-friends/bp-friends-loader.php +3 -1
- bp-friends/bp-friends-notifications.php +1 -3
- bp-friends/bp-friends-screens.php +16 -4
- bp-friends/bp-friends-template.php +20 -14
- bp-friends/bp-friends-widgets.php +3 -1
- bp-friends/classes/class-bp-core-friends-widget.php +16 -5
- bp-friends/classes/class-bp-friends-component.php +28 -6
- bp-friends/classes/class-bp-friends-friendship.php +13 -9
- bp-friends/js/widget-friends.js +12 -1
- bp-friends/js/widget-friends.min.js +1 -2
- bp-groups/admin/js/admin.min.js +0 -1
- bp-groups/bp-groups-actions.php +21 -6
- bp-groups/bp-groups-activity.php +2 -1
- bp-groups/bp-groups-admin.php +113 -10
- bp-groups/bp-groups-adminbar.php +9 -9
- bp-groups/bp-groups-cache.php +41 -0
- bp-groups/bp-groups-filters.php +28 -1
- bp-groups/bp-groups-functions.php +592 -48
- bp-groups/bp-groups-loader.php +3 -1
- bp-groups/bp-groups-screens.php +54 -11
- bp-groups/bp-groups-template.php +95 -110
- bp-groups/bp-groups-widgets.php +3 -1
- bp-groups/classes/class-bp-group-extension.php +3 -3
- bp-groups/classes/class-bp-groups-component.php +63 -10
- bp-groups/classes/class-bp-groups-group.php +148 -107
- bp-groups/classes/class-bp-groups-list-table.php +13 -6
- bp-groups/classes/class-bp-groups-member.php +45 -0
- bp-groups/classes/class-bp-groups-template.php +35 -29
- bp-groups/classes/class-bp-groups-widget.php +15 -5
- bp-groups/js/widget-groups.js +12 -1
- bp-groups/js/widget-groups.min.js +1 -2
- bp-loader.php +128 -21
- bp-members/admin/css/admin-rtl.css +98 -8
- bp-members/admin/css/admin-rtl.min.css +1 -1
- bp-members/admin/css/admin.css +98 -8
- bp-members/admin/css/admin.min.css +1 -1
- bp-members/admin/js/admin.min.js +0 -1
- bp-members/bp-members-actions.php +4 -0
- bp-members/bp-members-activity.php +2 -2
- bp-members/bp-members-admin.php +3 -1
- bp-members/bp-members-adminbar.php +2 -2
- bp-members/bp-members-cache.php +1 -1
- bp-members/bp-members-filters.php +1 -1
- bp-members/bp-members-functions.php +94 -11
- bp-members/bp-members-loader.php +5 -1
- bp-members/bp-members-screens.php +14 -4
- bp-members/bp-members-template.php +332 -38
- bp-members/bp-members-widgets.php +5 -3
- bp-members/classes/class-bp-core-members-template.php +25 -0
- bp-members/classes/class-bp-core-members-widget.php +22 -7
- bp-members/classes/class-bp-core-recently-active-widget.php +11 -3
- bp-members/classes/class-bp-core-whos-online-widget.php +11 -3
- bp-members/classes/class-bp-members-admin.php +23 -8
- bp-members/classes/class-bp-members-component.php +116 -28
- bp-members/classes/class-bp-members-list-table.php +12 -9
- bp-members/classes/class-bp-members-ms-list-table.php +11 -8
- bp-members/classes/class-bp-signup.php +10 -0
- bp-messages/bp-messages-functions.php +6 -6
- bp-messages/bp-messages-loader.php +3 -1
- bp-messages/bp-messages-notifications.php +64 -21
- bp-messages/bp-messages-screens.php +12 -3
- bp-messages/bp-messages-template.php +30 -19
- bp-messages/bp-messages-widgets.php +3 -1
- bp-messages/classes/class-bp-messages-component.php +23 -4
- bp-messages/classes/class-bp-messages-sitewide-notices-widget.php +3 -2
- bp-messages/css/autocomplete/jquery.autocompletefb-rtl.css +2 -2
- bp-messages/css/autocomplete/jquery.autocompletefb-rtl.min.css +1 -1
- bp-messages/js/autocomplete/jquery.autocomplete.js +2 -1
- bp-messages/js/autocomplete/jquery.autocomplete.min.js +1 -2
- bp-messages/js/autocomplete/jquery.autocompletefb.js +1 -1
- bp-messages/js/autocomplete/jquery.autocompletefb.min.js +1 -2
- bp-messages/js/autocomplete/jquery.bgiframe.min.js +0 -1
- bp-messages/js/autocomplete/jquery.dimensions.min.js +0 -1
- bp-notifications/bp-notifications-functions.php +33 -14
- bp-notifications/bp-notifications-loader.php +3 -1
- bp-notifications/bp-notifications-template.php +204 -102
- bp-notifications/classes/class-bp-notifications-component.php +29 -4
- bp-notifications/classes/class-bp-notifications-notification.php +12 -1
- bp-settings/bp-settings-loader.php +3 -1
- bp-settings/bp-settings-template.php +8 -7
- bp-templates/bp-legacy/buddypress-functions.php +35 -62
- bp-templates/bp-legacy/buddypress/activity/entry.php +4 -1
- bp-templates/bp-legacy/buddypress/activity/post-form.php +8 -2
- bp-templates/bp-legacy/buddypress/assets/_attachments/uploader.php +4 -1
- bp-templates/bp-legacy/buddypress/assets/embeds/activity.php +11 -0
- bp-templates/bp-legacy/buddypress/assets/embeds/footer.php +9 -0
- bp-templates/bp-legacy/buddypress/assets/embeds/header-activity.php +26 -0
- bp-templates/bp-legacy/buddypress/assets/embeds/header.php +18 -0
- bp-templates/bp-legacy/buddypress/groups/create.php +4 -1
- bp-templates/bp-legacy/buddypress/groups/single/admin.php +20 -1
- bp-templates/bp-legacy/buddypress/groups/single/forum/edit.php +4 -1
- bp-templates/bp-legacy/buddypress/groups/single/forum/topic.php +4 -1
- bp-templates/bp-legacy/buddypress/groups/single/group-header.php +1 -1
- bp-templates/bp-legacy/buddypress/groups/single/requests-loop.php +22 -13
- bp-templates/bp-legacy/buddypress/members/single/home.php +4 -1
- bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php +12 -3
- bp-templates/bp-legacy/buddypress/members/single/messages/single.php +5 -2
- bp-templates/bp-legacy/buddypress/members/single/notifications/notifications-loop.php +8 -2
- bp-templates/bp-legacy/buddypress/members/single/profile/change-avatar.php +4 -1
- bp-templates/bp-legacy/buddypress/members/single/settings/general.php +4 -1
- bp-templates/bp-legacy/css/buddypress-rtl.css +14 -3
- bp-templates/bp-legacy/css/buddypress-rtl.min.css +1 -1
@@ -1,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM 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"),"undefined"!=typeof postboxes&&postboxes.add_postbox_toggles(bp_activity_admin_vars.page)})}(jQuery);
|
Â
|
|
1 |
Â
!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"),"undefined"!=typeof postboxes&&postboxes.add_postbox_toggles(bp_activity_admin_vars.page)})}(jQuery);
|
@@ -17,7 +17,6 @@ defined( 'ABSPATH' ) || exit;
|
|
17 |
Â
*
|
18 |
Â
* @since 1.2.0
|
19 |
Â
*
|
20 |
-
* @uses do_action() To call 'bp_register_activity_actions' hook.
|
21 |
Â
*/
|
22 |
Â
function bp_register_activity_actions() {
|
23 |
Â
|
@@ -35,18 +34,6 @@ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
|
|
35 |
Â
*
|
36 |
Â
* @since 1.2.0
|
37 |
Â
*
|
38 |
-
* @uses bp_is_activity_component()
|
39 |
-
* @uses bp_is_current_action()
|
40 |
-
* @uses bp_action_variable()
|
41 |
-
* @uses bp_activity_get_specific()
|
42 |
-
* @uses bp_is_active()
|
43 |
-
* @uses bp_core_get_user_domain()
|
44 |
-
* @uses groups_get_group()
|
45 |
-
* @uses bp_get_group_permalink()
|
46 |
-
* @uses apply_filters_ref_array() To call the 'bp_activity_permalink_redirect_url' hook.
|
47 |
-
* @uses bp_core_redirect()
|
48 |
-
* @uses bp_get_root_domain()
|
49 |
-
*
|
50 |
Â
* @return bool False on failure.
|
51 |
Â
*/
|
52 |
Â
function bp_activity_action_permalink_router() {
|
@@ -122,17 +109,6 @@ add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
|
|
122 |
Â
*
|
123 |
Â
* @since 1.1.0
|
124 |
Â
*
|
125 |
-
* @uses bp_is_activity_component()
|
126 |
-
* @uses bp_is_current_action()
|
127 |
-
* @uses bp_action_variable()
|
128 |
-
* @uses check_admin_referer()
|
129 |
-
* @uses bp_activity_user_can_delete()
|
130 |
-
* @uses do_action() Calls 'bp_activity_before_action_delete_activity' hook to allow actions to be taken before the activity is deleted.
|
131 |
-
* @uses bp_activity_delete()
|
132 |
-
* @uses bp_core_add_message()
|
133 |
-
* @uses do_action() Calls 'bp_activity_action_delete_activity' hook to allow actions to be taken after the activity is deleted.
|
134 |
-
* @uses bp_core_redirect()
|
135 |
-
*
|
136 |
Â
* @param int $activity_id Activity id to be deleted. Defaults to 0.
|
137 |
Â
* @return bool False on failure.
|
138 |
Â
*/
|
@@ -267,20 +243,6 @@ add_action( 'bp_actions', 'bp_activity_action_spam_activity' );
|
|
267 |
Â
*
|
268 |
Â
* @since 1.2.0
|
269 |
Â
*
|
270 |
-
* @uses is_user_logged_in()
|
271 |
-
* @uses bp_is_activity_component()
|
272 |
-
* @uses bp_is_current_action()
|
273 |
-
* @uses check_admin_referer()
|
274 |
-
* @uses apply_filters() To call 'bp_activity_post_update_content' hook.
|
275 |
-
* @uses apply_filters() To call 'bp_activity_post_update_object' hook.
|
276 |
-
* @uses apply_filters() To call 'bp_activity_post_update_item_id' hook.
|
277 |
-
* @uses bp_core_add_message()
|
278 |
-
* @uses bp_core_redirect()
|
279 |
-
* @uses bp_activity_post_update()
|
280 |
-
* @uses groups_post_update()
|
281 |
-
* @uses bp_core_redirect()
|
282 |
-
* @uses apply_filters() To call 'bp_activity_custom_update' hook.
|
283 |
-
*
|
284 |
Â
* @return bool False on failure.
|
285 |
Â
*/
|
286 |
Â
function bp_activity_action_post_update() {
|
@@ -371,17 +333,6 @@ add_action( 'bp_actions', 'bp_activity_action_post_update' );
|
|
371 |
Â
*
|
372 |
Â
* @since 1.2.0
|
373 |
Â
*
|
374 |
-
* @uses is_user_logged_in()
|
375 |
-
* @uses bp_is_activity_component()
|
376 |
-
* @uses bp_is_current_action()
|
377 |
-
* @uses check_admin_referer()
|
378 |
-
* @uses apply_filters() To call 'bp_activity_post_comment_activity_id' hook.
|
379 |
-
* @uses apply_filters() To call 'bp_activity_post_comment_content' hook.
|
380 |
-
* @uses bp_core_add_message()
|
381 |
-
* @uses bp_core_redirect()
|
382 |
-
* @uses bp_activity_new_comment()
|
383 |
-
* @uses wp_get_referer()
|
384 |
-
*
|
385 |
Â
* @return bool False on failure.
|
386 |
Â
*/
|
387 |
Â
function bp_activity_action_post_comment() {
|
@@ -435,16 +386,6 @@ add_action( 'bp_actions', 'bp_activity_action_post_comment' );
|
|
435 |
Â
*
|
436 |
Â
* @since 1.2.0
|
437 |
Â
*
|
438 |
-
* @uses is_user_logged_in()
|
439 |
-
* @uses bp_is_activity_component()
|
440 |
-
* @uses bp_is_current_action()
|
441 |
-
* @uses check_admin_referer()
|
442 |
-
* @uses bp_activity_add_user_favorite()
|
443 |
-
* @uses bp_action_variable()
|
444 |
-
* @uses bp_core_add_message()
|
445 |
-
* @uses bp_core_redirect()
|
446 |
-
* @uses wp_get_referer()
|
447 |
-
*
|
448 |
Â
* @return bool False on failure.
|
449 |
Â
*/
|
450 |
Â
function bp_activity_action_mark_favorite() {
|
@@ -469,16 +410,6 @@ add_action( 'bp_actions', 'bp_activity_action_mark_favorite' );
|
|
469 |
Â
*
|
470 |
Â
* @since 1.2.0
|
471 |
Â
*
|
472 |
-
* @uses is_user_logged_in()
|
473 |
-
* @uses bp_is_activity_component()
|
474 |
-
* @uses bp_is_current_action()
|
475 |
-
* @uses check_admin_referer()
|
476 |
-
* @uses bp_activity_remove_user_favorite()
|
477 |
-
* @uses bp_action_variable()
|
478 |
-
* @uses bp_core_add_message()
|
479 |
-
* @uses bp_core_redirect()
|
480 |
-
* @uses wp_get_referer()
|
481 |
-
*
|
482 |
Â
* @return bool False on failure.
|
483 |
Â
*/
|
484 |
Â
function bp_activity_action_remove_favorite() {
|
@@ -503,11 +434,6 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
|
|
503 |
Â
*
|
504 |
Â
* @since 1.0.0
|
505 |
Â
*
|
506 |
-
* @uses bp_is_activity_component()
|
507 |
-
* @uses bp_is_current_action()
|
508 |
-
* @uses bp_is_user()
|
509 |
-
* @uses status_header()
|
510 |
-
*
|
511 |
Â
* @return bool False on failure.
|
512 |
Â
*/
|
513 |
Â
function bp_activity_action_sitewide_feed() {
|
@@ -535,10 +461,6 @@ add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
|
|
535 |
Â
*
|
536 |
Â
* @since 1.0.0
|
537 |
Â
*
|
538 |
-
* @uses bp_is_user_activity()
|
539 |
-
* @uses bp_is_current_action()
|
540 |
-
* @uses status_header()
|
541 |
-
*
|
542 |
Â
* @return bool False on failure.
|
543 |
Â
*/
|
544 |
Â
function bp_activity_action_personal_feed() {
|
@@ -565,13 +487,6 @@ add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
|
|
565 |
Â
*
|
566 |
Â
* @since 1.0.0
|
567 |
Â
*
|
568 |
-
* @uses bp_is_active()
|
569 |
-
* @uses bp_is_user_activity()
|
570 |
-
* @uses bp_is_current_action()
|
571 |
-
* @uses bp_get_friends_slug()
|
572 |
-
* @uses bp_is_action_variable()
|
573 |
-
* @uses status_header()
|
574 |
-
*
|
575 |
Â
* @return bool False on failure.
|
576 |
Â
*/
|
577 |
Â
function bp_activity_action_friends_feed() {
|
@@ -598,13 +513,6 @@ add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
|
|
598 |
Â
*
|
599 |
Â
* @since 1.2.0
|
600 |
Â
*
|
601 |
-
* @uses bp_is_active()
|
602 |
-
* @uses bp_is_user_activity()
|
603 |
-
* @uses bp_is_current_action()
|
604 |
-
* @uses bp_get_groups_slug()
|
605 |
-
* @uses bp_is_action_variable()
|
606 |
-
* @uses status_header()
|
607 |
-
*
|
608 |
Â
* @return bool False on failure.
|
609 |
Â
*/
|
610 |
Â
function bp_activity_action_my_groups_feed() {
|
@@ -639,11 +547,6 @@ add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
|
|
639 |
Â
*
|
640 |
Â
* @since 1.2.0
|
641 |
Â
*
|
642 |
-
* @uses bp_is_user_activity()
|
643 |
-
* @uses bp_is_current_action()
|
644 |
-
* @uses bp_is_action_variable()
|
645 |
-
* @uses status_header()
|
646 |
-
*
|
647 |
Â
* @return bool False on failure.
|
648 |
Â
*/
|
649 |
Â
function bp_activity_action_mentions_feed() {
|
@@ -676,11 +579,6 @@ add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
|
|
676 |
Â
*
|
677 |
Â
* @since 1.2.0
|
678 |
Â
*
|
679 |
-
* @uses bp_is_user_activity()
|
680 |
-
* @uses bp_is_current_action()
|
681 |
-
* @uses bp_is_action_variable()
|
682 |
-
* @uses status_header()
|
683 |
-
*
|
684 |
Â
* @return bool False on failure.
|
685 |
Â
*/
|
686 |
Â
function bp_activity_action_favorites_feed() {
|
17 |
Â
*
|
18 |
Â
* @since 1.2.0
|
19 |
Â
*
|
Â
|
|
20 |
Â
*/
|
21 |
Â
function bp_register_activity_actions() {
|
22 |
Â
|
34 |
Â
*
|
35 |
Â
* @since 1.2.0
|
36 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
37 |
Â
* @return bool False on failure.
|
38 |
Â
*/
|
39 |
Â
function bp_activity_action_permalink_router() {
|
109 |
Â
*
|
110 |
Â
* @since 1.1.0
|
111 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
112 |
Â
* @param int $activity_id Activity id to be deleted. Defaults to 0.
|
113 |
Â
* @return bool False on failure.
|
114 |
Â
*/
|
243 |
Â
*
|
244 |
Â
* @since 1.2.0
|
245 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
246 |
Â
* @return bool False on failure.
|
247 |
Â
*/
|
248 |
Â
function bp_activity_action_post_update() {
|
333 |
Â
*
|
334 |
Â
* @since 1.2.0
|
335 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
336 |
Â
* @return bool False on failure.
|
337 |
Â
*/
|
338 |
Â
function bp_activity_action_post_comment() {
|
386 |
Â
*
|
387 |
Â
* @since 1.2.0
|
388 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
389 |
Â
* @return bool False on failure.
|
390 |
Â
*/
|
391 |
Â
function bp_activity_action_mark_favorite() {
|
410 |
Â
*
|
411 |
Â
* @since 1.2.0
|
412 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
413 |
Â
* @return bool False on failure.
|
414 |
Â
*/
|
415 |
Â
function bp_activity_action_remove_favorite() {
|
434 |
Â
*
|
435 |
Â
* @since 1.0.0
|
436 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
437 |
Â
* @return bool False on failure.
|
438 |
Â
*/
|
439 |
Â
function bp_activity_action_sitewide_feed() {
|
461 |
Â
*
|
462 |
Â
* @since 1.0.0
|
463 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
464 |
Â
* @return bool False on failure.
|
465 |
Â
*/
|
466 |
Â
function bp_activity_action_personal_feed() {
|
487 |
Â
*
|
488 |
Â
* @since 1.0.0
|
489 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
490 |
Â
* @return bool False on failure.
|
491 |
Â
*/
|
492 |
Â
function bp_activity_action_friends_feed() {
|
513 |
Â
*
|
514 |
Â
* @since 1.2.0
|
515 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
516 |
Â
* @return bool False on failure.
|
517 |
Â
*/
|
518 |
Â
function bp_activity_action_my_groups_feed() {
|
547 |
Â
*
|
548 |
Â
* @since 1.2.0
|
549 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
550 |
Â
* @return bool False on failure.
|
551 |
Â
*/
|
552 |
Â
function bp_activity_action_mentions_feed() {
|
579 |
Â
*
|
580 |
Â
* @since 1.2.0
|
581 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
582 |
Â
* @return bool False on failure.
|
583 |
Â
*/
|
584 |
Â
function bp_activity_action_favorites_feed() {
|
@@ -16,7 +16,9 @@ defined( 'ABSPATH' ) || exit;
|
|
16 |
Â
// Include WP's list table class.
|
17 |
Â
if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
18 |
Â
|
19 |
-
|
Â
|
|
Â
|
|
20 |
Â
|
21 |
Â
// Per_page screen option. Has to be hooked in extremely early.
|
22 |
Â
if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-activity' == $_REQUEST['page'] )
|
@@ -299,6 +301,7 @@ function bp_activity_admin_load() {
|
|
299 |
Â
// Add accessible hidden heading and text for Activity screen pagination.
|
300 |
Â
if ( bp_get_major_wp_version() >= 4.4 ) {
|
301 |
Â
get_current_screen()->set_screen_reader_content( array(
|
Â
|
|
302 |
Â
'heading_pagination' => __( 'Activity list navigation', 'buddypress' ),
|
303 |
Â
) );
|
304 |
Â
}
|
@@ -576,9 +579,9 @@ function bp_activity_admin_load() {
|
|
576 |
Â
|
577 |
Â
// If an error occurred, pass back the activity ID that failed.
|
578 |
Â
if ( $error )
|
579 |
-
$redirect_to = add_query_arg( 'error',
|
580 |
Â
else
|
581 |
-
$redirect_to = add_query_arg( 'updated',
|
582 |
Â
|
583 |
Â
/**
|
584 |
Â
* Filters URL to redirect to after saving.
|
@@ -674,6 +677,10 @@ function bp_activity_admin_edit() {
|
|
674 |
Â
<div id="bp_activity_action" class="postbox">
|
675 |
Â
<h2><?php _e( 'Action', 'buddypress' ); ?></h2>
|
676 |
Â
<div class="inside">
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
677 |
Â
<?php wp_editor( stripslashes( $activity->action ), 'bp-activities-action', array( 'media_buttons' => false, 'textarea_rows' => 7, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
|
678 |
Â
</div>
|
679 |
Â
</div>
|
@@ -681,6 +688,10 @@ function bp_activity_admin_edit() {
|
|
681 |
Â
<div id="bp_activity_content" class="postbox">
|
682 |
Â
<h2><?php _e( 'Content', 'buddypress' ); ?></h2>
|
683 |
Â
<div class="inside">
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
684 |
Â
<?php wp_editor( stripslashes( $activity->content ), 'bp-activities-content', array( 'media_buttons' => false, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
|
685 |
Â
</div>
|
686 |
Â
</div>
|
@@ -704,10 +715,16 @@ function bp_activity_admin_edit() {
|
|
704 |
Â
</form>
|
705 |
Â
|
706 |
Â
<?php else : ?>
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
711 |
Â
<?php endif; ?>
|
712 |
Â
|
713 |
Â
</div><!-- .wrap -->
|
@@ -781,7 +798,10 @@ function bp_activity_admin_edit_metabox_status( $item ) {
|
|
781 |
Â
function bp_activity_admin_edit_metabox_link( $item ) {
|
782 |
Â
?>
|
783 |
Â
|
784 |
-
<label class="screen-reader-text" for="bp-activities-link"><?php
|
Â
|
|
Â
|
|
Â
|
|
785 |
Â
<input type="url" name="bp-activities-link" id="bp-activities-link" value="<?php echo esc_url( $item->primary_link ); ?>" aria-describedby="bp-activities-link-description" />
|
786 |
Â
<p id="bp-activities-link-description"><?php _e( 'Activity generated by posts and comments, forum topics and replies, and some plugins, uses the link field for a permalink back to the content item.', 'buddypress' ); ?></p>
|
787 |
Â
|
@@ -798,7 +818,10 @@ function bp_activity_admin_edit_metabox_link( $item ) {
|
|
798 |
Â
function bp_activity_admin_edit_metabox_userid( $item ) {
|
799 |
Â
?>
|
800 |
Â
|
801 |
-
<label class="screen-reader-text" for="bp-activities-userid"><?php
|
Â
|
|
Â
|
|
Â
|
|
802 |
Â
<input type="number" name="bp-activities-userid" id="bp-activities-userid" value="<?php echo esc_attr( $item->user_id ); ?>" min="1" />
|
803 |
Â
|
804 |
Â
<?php
|
@@ -873,7 +896,10 @@ function bp_activity_admin_edit_metabox_type( $item ) {
|
|
873 |
Â
|
874 |
Â
?>
|
875 |
Â
|
876 |
-
<label for="bp-activities-type" class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
877 |
Â
<select name="bp-activities-type" id="bp-activities-type">
|
878 |
Â
<?php foreach ( $actions as $k => $v ) : ?>
|
879 |
Â
<option value="<?php echo esc_attr( $k ); ?>" <?php selected( $k, $selected ); ?>><?php echo esc_html( $v ); ?></option>
|
@@ -1016,6 +1042,10 @@ function bp_activity_admin_index() {
|
|
1016 |
Â
<form method="get" action="">
|
1017 |
Â
|
1018 |
Â
<h3 id="bp-replyhead"><?php _e( 'Reply to Activity', 'buddypress' ); ?></h3>
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1019 |
Â
<?php wp_editor( '', 'bp-activities', array( 'dfw' => false, 'media_buttons' => false, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ), 'tinymce' => false, ) ); ?>
|
1020 |
Â
|
1021 |
Â
<p id="bp-replysubmit" class="submit">
|
16 |
Â
// Include WP's list table class.
|
17 |
Â
if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
18 |
Â
|
19 |
+
if ( ! buddypress()->do_autoload ) {
|
20 |
+
require dirname( __FILE__ ) . '/classes/class-bp-activity-list-table.php';
|
21 |
+
}
|
22 |
Â
|
23 |
Â
// Per_page screen option. Has to be hooked in extremely early.
|
24 |
Â
if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-activity' == $_REQUEST['page'] )
|
301 |
Â
// Add accessible hidden heading and text for Activity screen pagination.
|
302 |
Â
if ( bp_get_major_wp_version() >= 4.4 ) {
|
303 |
Â
get_current_screen()->set_screen_reader_content( array(
|
304 |
+
/* translators: accessibility text */
|
305 |
Â
'heading_pagination' => __( 'Activity list navigation', 'buddypress' ),
|
306 |
Â
) );
|
307 |
Â
}
|
579 |
Â
|
580 |
Â
// If an error occurred, pass back the activity ID that failed.
|
581 |
Â
if ( $error )
|
582 |
+
$redirect_to = add_query_arg( 'error', $error, $redirect_to );
|
583 |
Â
else
|
584 |
+
$redirect_to = add_query_arg( 'updated', $activity->id, $redirect_to );
|
585 |
Â
|
586 |
Â
/**
|
587 |
Â
* Filters URL to redirect to after saving.
|
677 |
Â
<div id="bp_activity_action" class="postbox">
|
678 |
Â
<h2><?php _e( 'Action', 'buddypress' ); ?></h2>
|
679 |
Â
<div class="inside">
|
680 |
+
<label for="bp-activities-action" class="screen-reader-text"><?php
|
681 |
+
/* translators: accessibility text */
|
682 |
+
_e( 'Edit activity action', 'buddypress' );
|
683 |
+
?></label>
|
684 |
Â
<?php wp_editor( stripslashes( $activity->action ), 'bp-activities-action', array( 'media_buttons' => false, 'textarea_rows' => 7, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
|
685 |
Â
</div>
|
686 |
Â
</div>
|
688 |
Â
<div id="bp_activity_content" class="postbox">
|
689 |
Â
<h2><?php _e( 'Content', 'buddypress' ); ?></h2>
|
690 |
Â
<div class="inside">
|
691 |
+
<label for="bp-activities-content" class="screen-reader-text"><?php
|
692 |
+
/* translators: accessibility text */
|
693 |
+
_e( 'Edit activity content', 'buddypress' );
|
694 |
+
?></label>
|
695 |
Â
<?php wp_editor( stripslashes( $activity->content ), 'bp-activities-content', array( 'media_buttons' => false, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
|
696 |
Â
</div>
|
697 |
Â
</div>
|
715 |
Â
</form>
|
716 |
Â
|
717 |
Â
<?php else : ?>
|
718 |
+
|
719 |
+
<p><?php
|
720 |
+
printf(
|
721 |
+
'%1$s <a href="%2$s">%3$s</a>',
|
722 |
+
__( 'No activity found with this ID.', 'buddypress' ),
|
723 |
+
esc_url( bp_get_admin_url( 'admin.php?page=bp-activity' ) ),
|
724 |
+
__( 'Go back and try again.', 'buddypress' )
|
725 |
+
);
|
726 |
+
?></p>
|
727 |
+
|
728 |
Â
<?php endif; ?>
|
729 |
Â
|
730 |
Â
</div><!-- .wrap -->
|
798 |
Â
function bp_activity_admin_edit_metabox_link( $item ) {
|
799 |
Â
?>
|
800 |
Â
|
801 |
+
<label class="screen-reader-text" for="bp-activities-link"><?php
|
802 |
+
/* translators: accessibility text */
|
803 |
+
_e( 'Link', 'buddypress' );
|
804 |
+
?></label>
|
805 |
Â
<input type="url" name="bp-activities-link" id="bp-activities-link" value="<?php echo esc_url( $item->primary_link ); ?>" aria-describedby="bp-activities-link-description" />
|
806 |
Â
<p id="bp-activities-link-description"><?php _e( 'Activity generated by posts and comments, forum topics and replies, and some plugins, uses the link field for a permalink back to the content item.', 'buddypress' ); ?></p>
|
807 |
Â
|
818 |
Â
function bp_activity_admin_edit_metabox_userid( $item ) {
|
819 |
Â
?>
|
820 |
Â
|
821 |
+
<label class="screen-reader-text" for="bp-activities-userid"><?php
|
822 |
+
/* translators: accessibility text */
|
823 |
+
_e( 'Author ID', 'buddypress' );
|
824 |
+
?></label>
|
825 |
Â
<input type="number" name="bp-activities-userid" id="bp-activities-userid" value="<?php echo esc_attr( $item->user_id ); ?>" min="1" />
|
826 |
Â
|
827 |
Â
<?php
|
896 |
Â
|
897 |
Â
?>
|
898 |
Â
|
899 |
+
<label for="bp-activities-type" class="screen-reader-text"><?php
|
900 |
+
/* translators: accessibility text */
|
901 |
+
esc_html_e( 'Select activity type', 'buddypress' );
|
902 |
+
?></label>
|
903 |
Â
<select name="bp-activities-type" id="bp-activities-type">
|
904 |
Â
<?php foreach ( $actions as $k => $v ) : ?>
|
905 |
Â
<option value="<?php echo esc_attr( $k ); ?>" <?php selected( $k, $selected ); ?>><?php echo esc_html( $v ); ?></option>
|
1042 |
Â
<form method="get" action="">
|
1043 |
Â
|
1044 |
Â
<h3 id="bp-replyhead"><?php _e( 'Reply to Activity', 'buddypress' ); ?></h3>
|
1045 |
+
<label for="bp-activities" class="screen-reader-text"><?php
|
1046 |
+
/* translators: accessibility text */
|
1047 |
+
_e( 'Reply', 'buddypress' );
|
1048 |
+
?></label>
|
1049 |
Â
<?php wp_editor( '', 'bp-activities', array( 'dfw' => false, 'media_buttons' => false, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ), 'tinymce' => false, ) ); ?>
|
1050 |
Â
|
1051 |
Â
<p id="bp-replysubmit" class="submit">
|
@@ -0,0 +1,47 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BuddyPress Activity Toolbar.
|
4 |
+
*
|
5 |
+
* Handles the activity functions related to the WordPress Toolbar.
|
6 |
+
*
|
7 |
+
* @package BuddyPress
|
8 |
+
* @subpackage Activity
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly.
|
12 |
+
defined( 'ABSPATH' ) || exit;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Add the Activity top-level menu link when viewing single activity item.
|
16 |
+
*
|
17 |
+
* @since 2.6.0
|
18 |
+
*
|
19 |
+
* @return null Null if user does not have access to editing functionality.
|
20 |
+
*/
|
21 |
+
function bp_activity_admin_menu() {
|
22 |
+
global $wp_admin_bar;
|
23 |
+
|
24 |
+
// Only show if viewing a single activity item.
|
25 |
+
if ( ! bp_is_single_activity() ) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
|
29 |
+
// Only show this menu to super admins
|
30 |
+
if ( ! bp_current_user_can( 'bp_moderate' ) ) {
|
31 |
+
return;
|
32 |
+
}
|
33 |
+
|
34 |
+
$activity_edit_link = add_query_arg( array(
|
35 |
+
'page' => 'bp-activity',
|
36 |
+
'aid' => bp_current_action(),
|
37 |
+
'action' => 'edit'
|
38 |
+
), bp_get_admin_url( 'admin.php' ) );
|
39 |
+
|
40 |
+
// Add the top-level Edit Activity button.
|
41 |
+
$wp_admin_bar->add_menu( array(
|
42 |
+
'id' => 'activity-admin',
|
43 |
+
'title' => __( 'Edit Activity', 'buddypress' ),
|
44 |
+
'href' => esc_url( $activity_edit_link ),
|
45 |
+
) );
|
46 |
+
}
|
47 |
+
add_action( 'admin_bar_menu', 'bp_activity_admin_menu', 99 );
|
@@ -10,7 +10,9 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Delete old spam activity meta data.
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-akismet.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Delete old spam activity meta data.
|
@@ -13,3 +13,8 @@ defined( 'ABSPATH' ) || exit;
|
|
13 |
Â
require dirname( __FILE__ ) . '/classes/class-bp-activity-activity.php';
|
14 |
Â
require dirname( __FILE__ ) . '/classes/class-bp-activity-feed.php';
|
15 |
Â
require dirname( __FILE__ ) . '/classes/class-bp-activity-query.php';
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
13 |
Â
require dirname( __FILE__ ) . '/classes/class-bp-activity-activity.php';
|
14 |
Â
require dirname( __FILE__ ) . '/classes/class-bp-activity-feed.php';
|
15 |
Â
require dirname( __FILE__ ) . '/classes/class-bp-activity-query.php';
|
16 |
+
|
17 |
+
// Embeds - only applicable for WP 4.5+
|
18 |
+
if ( version_compare( $GLOBALS['wp_version'], '4.5', '>=' ) && bp_is_active( 'activity', 'embeds' ) ) {
|
19 |
+
require dirname( __FILE__ ) . '/classes/class-bp-activity-oembed-extension.php';
|
20 |
+
}
|
@@ -0,0 +1,352 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Functions related to embedding single activity items externally.
|
4 |
+
*
|
5 |
+
* Relies on WordPress 4.5.
|
6 |
+
*
|
7 |
+
* @since 2.6.0
|
8 |
+
*
|
9 |
+
* @package BuddyPress
|
10 |
+
* @subpackage ActivityEmbeds
|
11 |
+
*/
|
12 |
+
|
13 |
+
// Exit if accessed directly.
|
14 |
+
defined( 'ABSPATH' ) || exit;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Loads our activity oEmbed component.
|
18 |
+
*
|
19 |
+
* @since 2.6.0
|
20 |
+
*/
|
21 |
+
function bp_activity_setup_oembed() {
|
22 |
+
if ( version_compare( $GLOBALS['wp_version'], '4.5', '>=' ) && bp_is_active( 'activity', 'embeds' ) ) {
|
23 |
+
buddypress()->activity->oembed = new BP_Activity_oEmbed_Extension;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
add_action( 'bp_loaded', 'bp_activity_setup_oembed' );
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Catch links in embed excerpt so top.location.href can be added.
|
30 |
+
*
|
31 |
+
* Due to <iframe sandbox="allow-top-navigation">, links in embeds can only be
|
32 |
+
* clicked if invoked with top.location.href via JS.
|
33 |
+
*
|
34 |
+
* @since 2.6.0
|
35 |
+
*
|
36 |
+
* @param string $text Embed excerpt
|
37 |
+
* @return string
|
38 |
+
*/
|
39 |
+
function bp_activity_embed_excerpt_onclick_location_filter( $text ) {
|
40 |
+
return preg_replace_callback( '/<a\s+[^>]*href=\"([^\"]*)\"/iU', 'bp_activity_embed_excerpt_onclick_location_filter_callback', $text );
|
41 |
+
}
|
42 |
+
/**
|
43 |
+
* Add onclick="top.location.href" to a link.
|
44 |
+
*
|
45 |
+
* @since 2.6.0
|
46 |
+
*
|
47 |
+
* @param array $matches Items matched by bp_activity_embed_excerpt_onclick_location_filter().
|
48 |
+
* @return string
|
49 |
+
*/
|
50 |
+
function bp_activity_embed_excerpt_onclick_location_filter_callback( $matches ) {
|
51 |
+
return sprintf( '<a href="%1$s" onclick="top.location.href=\'%1$s\'"', $matches[1] );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Add inline styles for BP activity embeds.
|
56 |
+
*
|
57 |
+
* @since 2.6.0
|
58 |
+
*/
|
59 |
+
function bp_activity_embed_add_inline_styles() {
|
60 |
+
if ( false === bp_is_single_activity() ) {
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
|
64 |
+
$min = bp_core_get_minified_asset_suffix();
|
65 |
+
|
66 |
+
if ( is_rtl() ) {
|
67 |
+
$css = bp_locate_template_asset( "css/embeds-activity-rtl{$min}.css" );
|
68 |
+
} else {
|
69 |
+
$css = bp_locate_template_asset( "css/embeds-activity{$min}.css" );
|
70 |
+
}
|
71 |
+
|
72 |
+
// Bail if file wasn't found.
|
73 |
+
if ( false === $css ) {
|
74 |
+
return;
|
75 |
+
}
|
76 |
+
|
77 |
+
// Grab contents of CSS file and do some rudimentary CSS protection.
|
78 |
+
$css = file_get_contents( $css['file'] );
|
79 |
+
$css = wp_kses( $css, array( "\'", '\"' ) );
|
80 |
+
|
81 |
+
printf( '<style type="text/css">%s</style>', $css );
|
82 |
+
}
|
83 |
+
add_action( 'embed_head', 'bp_activity_embed_add_inline_styles', 20 );
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Query for the activity item on the activity embed template.
|
87 |
+
*
|
88 |
+
* Basically a wrapper for {@link bp_has_activities()}, but allows us to
|
89 |
+
* use the activity loop without requerying for it again.
|
90 |
+
*
|
91 |
+
* @since 2.6.0
|
92 |
+
*
|
93 |
+
* @param int $activity_id The activity ID.
|
94 |
+
* @return bool
|
95 |
+
*/
|
96 |
+
function bp_activity_embed_has_activity( $activity_id = 0 ) {
|
97 |
+
global $activities_template;
|
98 |
+
|
99 |
+
if ( empty( $activity_id ) ) {
|
100 |
+
return false;
|
101 |
+
}
|
102 |
+
|
103 |
+
if ( ! empty( $activities_template->activities ) ) {
|
104 |
+
$activity = (array) $activities_template->activities;
|
105 |
+
$activity = reset( $activity );
|
106 |
+
|
107 |
+
// No need to requery if we already got the embed activity
|
108 |
+
if ( (int) $activity_id === $activity->id ) {
|
109 |
+
return $activities_template->has_activities();
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
return bp_has_activities( array(
|
114 |
+
'display_comments' => 'threaded',
|
115 |
+
'show_hidden' => true,
|
116 |
+
'include' => (int) $activity_id,
|
117 |
+
) );
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Outputs excerpt for an activity embed item.
|
122 |
+
*
|
123 |
+
* @since 2.6.0
|
124 |
+
*/
|
125 |
+
function bp_activity_embed_excerpt( $content = '' ) {
|
126 |
+
echo bp_activity_get_embed_excerpt( $content = '' );
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Generates excerpt for an activity embed item.
|
131 |
+
*
|
132 |
+
* @since 2.6.0
|
133 |
+
*
|
134 |
+
* @param string $content The content to generate an excerpt for.
|
135 |
+
* @return string
|
136 |
+
*/
|
137 |
+
function bp_activity_get_embed_excerpt( $content = '' ) {
|
138 |
+
if ( empty( $content ) && ! empty( $GLOBALS['activities_template']->in_the_loop ) ) {
|
139 |
+
$content = $GLOBALS['activities_template']->activity->content;
|
140 |
+
}
|
141 |
+
|
142 |
+
/*
|
143 |
+
* bp_activity_truncate_entry() includes the 'Read More' link, which is why
|
144 |
+
* we're using this instead of bp_create_excerpt().
|
145 |
+
*/
|
146 |
+
$content = html_entity_decode( $content );
|
147 |
+
$content = bp_activity_truncate_entry( $content, array(
|
148 |
+
'html' => false,
|
149 |
+
'filter_shortcodes' => true,
|
150 |
+
'strip_tags' => true,
|
151 |
+
'force_truncate' => true
|
152 |
+
) );
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Filter the activity embed excerpt.
|
156 |
+
*
|
157 |
+
* @since 2.6.0
|
158 |
+
*
|
159 |
+
* @var string $content Embed Excerpt.
|
160 |
+
* @var string $unmodified_content Unmodified activity content.
|
161 |
+
*/
|
162 |
+
return apply_filters( 'bp_activity_get_embed_excerpt', $content, $GLOBALS['activities_template']->activity->content );
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Outputs the first embedded item in the activity oEmbed template.
|
167 |
+
*
|
168 |
+
* @since 2.6.0
|
169 |
+
*/
|
170 |
+
function bp_activity_embed_media() {
|
171 |
+
// Bail if oEmbed request explicitly hides media.
|
172 |
+
if ( isset( $_GET['hide_media'] ) && true == wp_validate_boolean( $_GET['hide_media'] ) ) {
|
173 |
+
/**
|
174 |
+
* Do something after media is rendered for an activity oEmbed item.
|
175 |
+
*
|
176 |
+
* @since 2.6.0
|
177 |
+
*/
|
178 |
+
do_action( 'bp_activity_embed_after_media' );
|
179 |
+
|
180 |
+
return;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Should we display media in the oEmbed template?
|
185 |
+
*
|
186 |
+
* @since 2.6.0
|
187 |
+
*
|
188 |
+
* @param bool $retval Defaults to true.
|
189 |
+
*/
|
190 |
+
$allow_media = apply_filters( 'bp_activity_embed_display_media', true );
|
191 |
+
|
192 |
+
// Find oEmbeds from only WP registered providers.
|
193 |
+
bp_remove_all_filters( 'oembed_providers' );
|
194 |
+
$media = bp_core_extract_media_from_content( $GLOBALS['activities_template']->activity->content, 'embeds' );
|
195 |
+
bp_restore_all_filters( 'oembed_providers' );
|
196 |
+
|
197 |
+
// oEmbeds have precedence over inline video / audio.
|
198 |
+
if ( isset( $media['embeds'] ) && true === $allow_media ) {
|
199 |
+
// Autoembed first URL.
|
200 |
+
$oembed_defaults = wp_embed_defaults();
|
201 |
+
$oembed_args = array(
|
202 |
+
'width' => $oembed_defaults['width'],
|
203 |
+
'height' => $oembed_defaults['height'],
|
204 |
+
'discover' => true
|
205 |
+
);
|
206 |
+
$url = $media['embeds'][0]['url'];
|
207 |
+
$cachekey = '_oembed_response_' . md5( $url . serialize( $oembed_args ) );
|
208 |
+
|
209 |
+
// Try to fetch oEmbed response from meta.
|
210 |
+
$oembed = bp_activity_get_meta( bp_get_activity_id(), $cachekey );
|
211 |
+
|
212 |
+
// No cache, so fetch full oEmbed response now!
|
213 |
+
if ( '' === $oembed ) {
|
214 |
+
$o = _wp_oembed_get_object();
|
215 |
+
$oembed = $o->fetch( $o->get_provider( $url, $oembed_args ), $url, $oembed_args );
|
216 |
+
|
217 |
+
// Cache oEmbed response.
|
218 |
+
bp_activity_update_meta( bp_get_activity_id(), $cachekey, $oembed );
|
219 |
+
}
|
220 |
+
|
221 |
+
$content = '';
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Filters the default embed display max width.
|
225 |
+
*
|
226 |
+
* This is used if the oEmbed response does not return a thumbnail width.
|
227 |
+
*
|
228 |
+
* @since 2.6.0
|
229 |
+
*
|
230 |
+
* @param int $width.
|
231 |
+
*/
|
232 |
+
$width = (int) apply_filters( 'bp_activity_embed_display_media_width', 550 );
|
233 |
+
|
234 |
+
// Set thumbnail.
|
235 |
+
if ( 'photo' === $oembed->type ) {
|
236 |
+
$thumbnail = $oembed->url;
|
237 |
+
} elseif ( isset( $oembed->thumbnail_url ) ) {
|
238 |
+
$thumbnail = $oembed->thumbnail_url;
|
239 |
+
|
240 |
+
/* Non-oEmbed standard attributes */
|
241 |
+
// Mixcloud
|
242 |
+
} elseif ( isset( $oembed->image ) ) {
|
243 |
+
$thumbnail = $oembed->image;
|
244 |
+
// ReverbNation
|
245 |
+
} elseif ( isset( $oembed->{'thumbnail-url'} ) ) {
|
246 |
+
$thumbnail = $oembed->{'thumbnail-url'};
|
247 |
+
}
|
248 |
+
|
249 |
+
// Display thumb and related oEmbed meta.
|
250 |
+
if ( true === isset ( $thumbnail ) ) {
|
251 |
+
$play_icon = $caption = '';
|
252 |
+
|
253 |
+
// Add play icon for non-photos.
|
254 |
+
if ( 'photo' !== $oembed->type ) {
|
255 |
+
/**
|
256 |
+
* ion-play icon from Ionicons.
|
257 |
+
*
|
258 |
+
* @link http://ionicons.com/
|
259 |
+
* @license MIT
|
260 |
+
*/
|
261 |
+
$play_icon = <<<EOD
|
262 |
+
<svg id="Layer_1" style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M405.2,232.9L126.8,67.2c-3.4-2-6.9-3.2-10.9-3.2c-10.9,0-19.8,9-19.8,20H96v344h0.1c0,11,8.9,20,19.8,20 c4.1,0,7.5-1.4,11.2-3.4l278.1-165.5c6.6-5.5,10.8-13.8,10.8-23.1C416,246.7,411.8,238.5,405.2,232.9z"/></svg>
|
263 |
+
EOD;
|
264 |
+
|
265 |
+
$play_icon = sprintf( '<a rel="nofollow" class="play-btn" href="%1$s" onclick="top.location.href=\'%1$s\'">%2$s</a>', esc_url( $url ), $play_icon );
|
266 |
+
}
|
267 |
+
|
268 |
+
// Thumb width
|
269 |
+
$thumb_width = isset( $oembed->thumbnail_width ) && 'photo' !== $oembed->type && (int) $oembed->thumbnail_width < 550 ? (int) $oembed->thumbnail_width : $width;
|
270 |
+
|
271 |
+
$float_width = 350;
|
272 |
+
|
273 |
+
// Set up thumb.
|
274 |
+
$content = sprintf( '<div class="thumb" style="max-width:%1$spx">%2$s<a href="%3$s" rel="nofollow" onclick="top.location.href=\'%3$s\'"><img src="%4$s" /></a></div>', $thumb_width, $play_icon, esc_url( $url ), esc_url( $thumbnail ) );
|
275 |
+
|
276 |
+
// Show title.
|
277 |
+
if ( isset( $oembed->title ) ) {
|
278 |
+
$caption .= sprintf( '<p class="caption-title"><strong>%s</strong></p>', apply_filters( 'single_post_title', $oembed->title ) );
|
279 |
+
}
|
280 |
+
|
281 |
+
// Show description (non-oEmbed standard)
|
282 |
+
if ( isset( $oembed->description ) ) {
|
283 |
+
$caption .= sprintf( '<div class="caption-description">%s</div>', apply_filters( 'bp_activity_get_embed_excerpt', $oembed->description ) );
|
284 |
+
}
|
285 |
+
|
286 |
+
// Show author info.
|
287 |
+
if ( isset( $oembed->provider_name ) && isset( $oembed->author_name ) ) {
|
288 |
+
/* translators: By [oEmbed author] on [oEmbed provider]. eg. By BuddyPress on YouTube. */
|
289 |
+
$anchor_text = sprintf( __( 'By %1$s on %2$s', 'buddypress' ), $oembed->author_name, $oembed->provider_name );
|
290 |
+
|
291 |
+
} elseif ( isset( $oembed->provider_name ) ) {
|
292 |
+
$anchor_text = sprintf( __( 'View on %s', 'buddypress' ), $oembed->provider_name );
|
293 |
+
}
|
294 |
+
|
295 |
+
if ( true === isset( $anchor_text ) ) {
|
296 |
+
$caption .= sprintf( '<a rel="nofollow" href="%1$s" onclick="top.location.href=\'%1$s\'">%2$s</a>', esc_url( $url ), apply_filters( 'the_title', $anchor_text ) );
|
297 |
+
}
|
298 |
+
|
299 |
+
// Set up caption.
|
300 |
+
if ( '' !== $caption ) {
|
301 |
+
$css_class = isset( $oembed->provider_name ) ? sprintf( ' provider-%s', sanitize_html_class( strtolower( $oembed->provider_name ) ) ) : '';
|
302 |
+
$caption = sprintf( '<div class="caption%1$s" style="width:%2$s">%3$s</div>',
|
303 |
+
$css_class,
|
304 |
+
$thumb_width > $float_width ? 100 . '%' : round( ( $width - (int) $thumb_width ) / $width * 100 ) . '%',
|
305 |
+
$caption
|
306 |
+
);
|
307 |
+
|
308 |
+
$content .= $caption;
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
// Print rich content.
|
313 |
+
if ( '' !== $content ) {
|
314 |
+
printf( '<div class="bp-activity-embed-display-media %s" style="max-width:%spx">%s</div>',
|
315 |
+
$thumb_width < $float_width ? 'two-col' : 'one-col',
|
316 |
+
$thumb_width < $float_width ? $width : $thumb_width,
|
317 |
+
$content
|
318 |
+
);
|
319 |
+
}
|
320 |
+
|
321 |
+
// Video / audio.
|
322 |
+
} elseif ( true === $allow_media ) {
|
323 |
+
// Call BP_Embed if it hasn't already loaded.
|
324 |
+
bp_embed_init();
|
325 |
+
|
326 |
+
// Run shortcode and embed routine.
|
327 |
+
$content = buddypress()->embed->run_shortcode( $GLOBALS['activities_template']->activity->content );
|
328 |
+
$content = buddypress()->embed->autoembed( $content );
|
329 |
+
|
330 |
+
// Try to find inline video / audio.
|
331 |
+
$media = bp_core_extract_media_from_content( $content, 96 );
|
332 |
+
|
333 |
+
// Video takes precedence. HTML5-only.
|
334 |
+
if ( isset( $media['videos'] ) && 'shortcodes' === $media['videos'][0]['source'] ) {
|
335 |
+
printf( '<video controls preload="metadata"><source src="%1$s"><p>%2$s</p></video>',
|
336 |
+
esc_url( $media['videos'][0]['url'] ),
|
337 |
+
esc_html__( 'Your browser does not support HTML5 video', 'buddypress' )
|
338 |
+
);
|
339 |
+
|
340 |
+
// No video? Try audio. HTML5-only.
|
341 |
+
} elseif ( isset( $media['audio'] ) && 'shortcodes' === $media['audio'][0]['source'] ) {
|
342 |
+
printf( '<audio controls preload="metadata"><source src="%1$s"><p>%2$s</p></audio>',
|
343 |
+
esc_url( $media['audio'][0]['url'] ),
|
344 |
+
esc_html__( 'Your browser does not support HTML5 audio', 'buddypress' )
|
345 |
+
);
|
346 |
+
}
|
347 |
+
|
348 |
+
}
|
349 |
+
|
350 |
+
/** This hook is documented in /bp-activity/bp-activity-embeds.php */
|
351 |
+
do_action( 'bp_activity_embed_after_media' );
|
352 |
+
}
|
@@ -43,6 +43,7 @@ add_filter( 'bp_get_activity_content', 'wptexturize' );
|
|
43 |
Â
add_filter( 'bp_get_activity_parent_content', 'wptexturize' );
|
44 |
Â
add_filter( 'bp_get_activity_latest_update', 'wptexturize' );
|
45 |
Â
add_filter( 'bp_get_activity_latest_update_excerpt', 'wptexturize' );
|
Â
|
|
46 |
Â
|
47 |
Â
add_filter( 'bp_get_activity_action', 'convert_smilies' );
|
48 |
Â
add_filter( 'bp_get_activity_content_body', 'convert_smilies' );
|
@@ -50,6 +51,7 @@ add_filter( 'bp_get_activity_content', 'convert_smilies' );
|
|
50 |
Â
add_filter( 'bp_get_activity_parent_content', 'convert_smilies' );
|
51 |
Â
add_filter( 'bp_get_activity_latest_update', 'convert_smilies' );
|
52 |
Â
add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_smilies' );
|
Â
|
|
53 |
Â
|
54 |
Â
add_filter( 'bp_get_activity_action', 'convert_chars' );
|
55 |
Â
add_filter( 'bp_get_activity_content_body', 'convert_chars' );
|
@@ -57,11 +59,13 @@ add_filter( 'bp_get_activity_content', 'convert_chars' );
|
|
57 |
Â
add_filter( 'bp_get_activity_parent_content', 'convert_chars' );
|
58 |
Â
add_filter( 'bp_get_activity_latest_update', 'convert_chars' );
|
59 |
Â
add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_chars' );
|
Â
|
|
60 |
Â
|
61 |
Â
add_filter( 'bp_get_activity_action', 'wpautop' );
|
62 |
Â
add_filter( 'bp_get_activity_content_body', 'wpautop' );
|
63 |
Â
add_filter( 'bp_get_activity_content', 'wpautop' );
|
64 |
Â
add_filter( 'bp_get_activity_feed_item_description', 'wpautop' );
|
Â
|
|
65 |
Â
|
66 |
Â
add_filter( 'bp_get_activity_action', 'make_clickable', 9 );
|
67 |
Â
add_filter( 'bp_get_activity_content_body', 'make_clickable', 9 );
|
@@ -70,6 +74,7 @@ add_filter( 'bp_get_activity_parent_content', 'make_clickable', 9 );
|
|
70 |
Â
add_filter( 'bp_get_activity_latest_update', 'make_clickable', 9 );
|
71 |
Â
add_filter( 'bp_get_activity_latest_update_excerpt', 'make_clickable', 9 );
|
72 |
Â
add_filter( 'bp_get_activity_feed_item_description', 'make_clickable', 9 );
|
Â
|
|
73 |
Â
|
74 |
Â
add_filter( 'bp_acomment_name', 'stripslashes_deep', 5 );
|
75 |
Â
add_filter( 'bp_get_activity_action', 'stripslashes_deep', 5 );
|
@@ -94,6 +99,7 @@ add_filter( 'pre_comment_content', 'bp_activity_at_name_filter
|
|
94 |
Â
add_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_name_filter' );
|
95 |
Â
add_filter( 'group_forum_post_text_before_save', 'bp_activity_at_name_filter' );
|
96 |
Â
add_filter( 'the_content', 'bp_activity_at_name_filter' );
|
Â
|
|
97 |
Â
|
98 |
Â
add_filter( 'bp_get_activity_parent_content', 'bp_create_excerpt' );
|
99 |
Â
|
@@ -103,6 +109,8 @@ add_filter( 'bp_get_activity_content', 'bp_activity_truncate_entry', 5 );
|
|
103 |
Â
add_filter( 'bp_get_total_favorite_count_for_user', 'bp_core_number_format' );
|
104 |
Â
add_filter( 'bp_get_total_mention_count_for_user', 'bp_core_number_format' );
|
105 |
Â
|
Â
|
|
Â
|
|
106 |
Â
/* Actions *******************************************************************/
|
107 |
Â
|
108 |
Â
// At-name filter.
|
@@ -147,13 +155,19 @@ function bp_activity_get_moderated_activity_types() {
|
|
147 |
Â
function bp_activity_check_moderation_keys( $activity ) {
|
148 |
Â
|
149 |
Â
// Only check specific types of activity updates.
|
150 |
-
if ( !in_array( $activity->type, bp_activity_get_moderated_activity_types() ) )
|
151 |
Â
return;
|
Â
|
|
152 |
Â
|
153 |
-
//
|
154 |
Â
// @todo This is temporary until some kind of moderation is built.
|
155 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
156 |
Â
$activity->component = false;
|
Â
|
|
157 |
Â
}
|
158 |
Â
|
159 |
Â
/**
|
@@ -166,12 +180,19 @@ function bp_activity_check_moderation_keys( $activity ) {
|
|
166 |
Â
function bp_activity_check_blacklist_keys( $activity ) {
|
167 |
Â
|
168 |
Â
// Only check specific types of activity updates.
|
169 |
-
if ( ! in_array( $activity->type, bp_activity_get_moderated_activity_types() ) )
|
170 |
Â
return;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
171 |
Â
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
Â
}
|
176 |
Â
|
177 |
Â
/**
|
@@ -179,9 +200,6 @@ function bp_activity_check_blacklist_keys( $activity ) {
|
|
179 |
Â
*
|
180 |
Â
* @since 1.1.0
|
181 |
Â
*
|
182 |
-
* @uses apply_filters() To call the 'bp_activity_allowed_tags' hook.
|
183 |
-
* @uses wp_kses()
|
184 |
-
*
|
185 |
Â
* @param string $content The activity content.
|
186 |
Â
* @return string $content Filtered activity content.
|
187 |
Â
*/
|
@@ -282,8 +300,6 @@ function bp_activity_at_name_filter( $content, $activity_id = 0 ) {
|
|
282 |
Â
*
|
283 |
Â
* @since 1.5.0
|
284 |
Â
*
|
285 |
-
* @uses bp_activity_find_mentions()
|
286 |
-
*
|
287 |
Â
* @param BP_Activity_Activity $activity Activity Object.
|
288 |
Â
*/
|
289 |
Â
function bp_activity_at_name_filter_updates( $activity ) {
|
@@ -319,9 +335,6 @@ function bp_activity_at_name_filter_updates( $activity ) {
|
|
319 |
Â
*
|
320 |
Â
* @since 1.7.0
|
321 |
Â
*
|
322 |
-
* @uses bp_activity_at_message_notification()
|
323 |
-
* @uses bp_activity_update_mention_count_for_user()
|
324 |
-
*
|
325 |
Â
* @param BP_Activity_Activity $activity The BP_Activity_Activity object.
|
326 |
Â
*/
|
327 |
Â
function bp_activity_at_name_send_emails( $activity ) {
|
@@ -395,19 +408,16 @@ function bp_activity_make_nofollow_filter( $text ) {
|
|
395 |
Â
* This method can only be used inside the Activity loop.
|
396 |
Â
*
|
397 |
Â
* @since 1.5.0
|
398 |
-
*
|
399 |
-
* @uses bp_is_single_activity()
|
400 |
-
* @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook.
|
401 |
-
* @uses apply_filters() To call the 'bp_activity_excerpt_length' hook.
|
402 |
-
* @uses bp_create_excerpt()
|
403 |
-
* @uses bp_get_activity_id()
|
404 |
-
* @uses bp_get_activity_thread_permalink()
|
405 |
-
* @uses apply_filters() To call the 'bp_activity_truncate_entry' hook.
|
406 |
Â
*
|
407 |
Â
* @param string $text The original activity entry text.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
408 |
Â
* @return string $excerpt The truncated text.
|
409 |
Â
*/
|
410 |
-
function bp_activity_truncate_entry( $text ) {
|
411 |
Â
global $activities_template;
|
412 |
Â
|
413 |
Â
/**
|
@@ -423,7 +433,7 @@ function bp_activity_truncate_entry( $text ) {
|
|
423 |
Â
);
|
424 |
Â
|
425 |
Â
// The full text of the activity update should always show on the single activity screen.
|
426 |
-
if ( ! $maybe_truncate_text || bp_is_single_activity() ) {
|
427 |
Â
return $text;
|
428 |
Â
}
|
429 |
Â
|
@@ -445,15 +455,17 @@ function bp_activity_truncate_entry( $text ) {
|
|
445 |
Â
*/
|
446 |
Â
$excerpt_length = apply_filters( 'bp_activity_excerpt_length', 358 );
|
447 |
Â
|
Â
|
|
Â
|
|
448 |
Â
// Run the text through the excerpt function. If it's too short, the original text will be returned.
|
449 |
-
$excerpt = bp_create_excerpt( $text, $excerpt_length,
|
450 |
Â
|
451 |
Â
/*
|
452 |
Â
* If the text returned by bp_create_excerpt() is different from the original text (ie it's
|
453 |
Â
* been truncated), add the "Read More" link. Note that bp_create_excerpt() is stripping
|
454 |
Â
* shortcodes, so we have strip them from the $text before the comparison.
|
455 |
Â
*/
|
456 |
-
if ( $excerpt
|
457 |
Â
$id = !empty( $activities_template->activity->current_comment->id ) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id();
|
458 |
Â
|
459 |
Â
$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 );
|
@@ -476,8 +488,6 @@ function bp_activity_truncate_entry( $text ) {
|
|
476 |
Â
*
|
477 |
Â
* @since 2.0.0
|
478 |
Â
*
|
479 |
-
* @uses bp_activity_do_heartbeat() to check if heartbeat is required.
|
480 |
-
*
|
481 |
Â
* @param array $js_handles The original dependencies.
|
482 |
Â
* @return array $js_handles The new dependencies.
|
483 |
Â
*/
|
@@ -543,8 +553,6 @@ add_filter( 'bp_get_activity_css_class', 'bp_activity_timestamp_class', 9, 1 );
|
|
543 |
Â
*
|
544 |
Â
* @since 2.0.0
|
545 |
Â
*
|
546 |
-
* @uses bp_activity_get_last_updated() to get the recorded date of the last activity.
|
547 |
-
*
|
548 |
Â
* @param array $response Array containing Heartbeat API response.
|
549 |
Â
* @param array $data Array containing data for Heartbeat API response.
|
550 |
Â
* @return array $response
|
43 |
Â
add_filter( 'bp_get_activity_parent_content', 'wptexturize' );
|
44 |
Â
add_filter( 'bp_get_activity_latest_update', 'wptexturize' );
|
45 |
Â
add_filter( 'bp_get_activity_latest_update_excerpt', 'wptexturize' );
|
46 |
+
add_filter( 'bp_activity_get_embed_excerpt', 'wptexturize' );
|
47 |
Â
|
48 |
Â
add_filter( 'bp_get_activity_action', 'convert_smilies' );
|
49 |
Â
add_filter( 'bp_get_activity_content_body', 'convert_smilies' );
|
51 |
Â
add_filter( 'bp_get_activity_parent_content', 'convert_smilies' );
|
52 |
Â
add_filter( 'bp_get_activity_latest_update', 'convert_smilies' );
|
53 |
Â
add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_smilies' );
|
54 |
+
add_filter( 'bp_activity_get_embed_excerpt', 'convert_smilies' );
|
55 |
Â
|
56 |
Â
add_filter( 'bp_get_activity_action', 'convert_chars' );
|
57 |
Â
add_filter( 'bp_get_activity_content_body', 'convert_chars' );
|
59 |
Â
add_filter( 'bp_get_activity_parent_content', 'convert_chars' );
|
60 |
Â
add_filter( 'bp_get_activity_latest_update', 'convert_chars' );
|
61 |
Â
add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_chars' );
|
62 |
+
add_filter( 'bp_activity_get_embed_excerpt', 'convert_chars' );
|
63 |
Â
|
64 |
Â
add_filter( 'bp_get_activity_action', 'wpautop' );
|
65 |
Â
add_filter( 'bp_get_activity_content_body', 'wpautop' );
|
66 |
Â
add_filter( 'bp_get_activity_content', 'wpautop' );
|
67 |
Â
add_filter( 'bp_get_activity_feed_item_description', 'wpautop' );
|
68 |
+
add_filter( 'bp_activity_get_embed_excerpt', 'wpautop' );
|
69 |
Â
|
70 |
Â
add_filter( 'bp_get_activity_action', 'make_clickable', 9 );
|
71 |
Â
add_filter( 'bp_get_activity_content_body', 'make_clickable', 9 );
|
74 |
Â
add_filter( 'bp_get_activity_latest_update', 'make_clickable', 9 );
|
75 |
Â
add_filter( 'bp_get_activity_latest_update_excerpt', 'make_clickable', 9 );
|
76 |
Â
add_filter( 'bp_get_activity_feed_item_description', 'make_clickable', 9 );
|
77 |
+
add_filter( 'bp_activity_get_embed_excerpt', 'make_clickable', 9 );
|
78 |
Â
|
79 |
Â
add_filter( 'bp_acomment_name', 'stripslashes_deep', 5 );
|
80 |
Â
add_filter( 'bp_get_activity_action', 'stripslashes_deep', 5 );
|
99 |
Â
add_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_name_filter' );
|
100 |
Â
add_filter( 'group_forum_post_text_before_save', 'bp_activity_at_name_filter' );
|
101 |
Â
add_filter( 'the_content', 'bp_activity_at_name_filter' );
|
102 |
+
add_filter( 'bp_activity_get_embed_excerpt', 'bp_activity_at_name_filter' );
|
103 |
Â
|
104 |
Â
add_filter( 'bp_get_activity_parent_content', 'bp_create_excerpt' );
|
105 |
Â
|
109 |
Â
add_filter( 'bp_get_total_favorite_count_for_user', 'bp_core_number_format' );
|
110 |
Â
add_filter( 'bp_get_total_mention_count_for_user', 'bp_core_number_format' );
|
111 |
Â
|
112 |
+
add_filter( 'bp_activity_get_embed_excerpt', 'bp_activity_embed_excerpt_onclick_location_filter', 9 );
|
113 |
+
|
114 |
Â
/* Actions *******************************************************************/
|
115 |
Â
|
116 |
Â
// At-name filter.
|
155 |
Â
function bp_activity_check_moderation_keys( $activity ) {
|
156 |
Â
|
157 |
Â
// Only check specific types of activity updates.
|
158 |
+
if ( ! in_array( $activity->type, bp_activity_get_moderated_activity_types() ) ) {
|
159 |
Â
return;
|
160 |
+
}
|
161 |
Â
|
162 |
+
// Send back the error so activity update fails.
|
163 |
Â
// @todo This is temporary until some kind of moderation is built.
|
164 |
+
$moderate = bp_core_check_for_moderation( $activity->user_id, '', $activity->content, 'wp_error' );
|
165 |
+
if ( is_wp_error( $moderate ) ) {
|
166 |
+
$activity->errors = $moderate;
|
167 |
+
|
168 |
+
// Backpat.
|
169 |
Â
$activity->component = false;
|
170 |
+
}
|
171 |
Â
}
|
172 |
Â
|
173 |
Â
/**
|
180 |
Â
function bp_activity_check_blacklist_keys( $activity ) {
|
181 |
Â
|
182 |
Â
// Only check specific types of activity updates.
|
183 |
+
if ( ! in_array( $activity->type, bp_activity_get_moderated_activity_types() ) ) {
|
184 |
Â
return;
|
185 |
+
}
|
186 |
+
|
187 |
+
// Send back the error so activity update fails.
|
188 |
+
// @todo This is temporary until some kind of trash status is built.
|
189 |
+
$blacklist = bp_core_check_for_blacklist( $activity->user_id, '', $activity->content, 'wp_error' );
|
190 |
+
if ( is_wp_error( $blacklist ) ) {
|
191 |
+
$activity->errors = $blacklist;
|
192 |
Â
|
193 |
+
// Backpat.
|
194 |
+
$activity->component = false;
|
195 |
+
}
|
196 |
Â
}
|
197 |
Â
|
198 |
Â
/**
|
200 |
Â
*
|
201 |
Â
* @since 1.1.0
|
202 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
203 |
Â
* @param string $content The activity content.
|
204 |
Â
* @return string $content Filtered activity content.
|
205 |
Â
*/
|
300 |
Â
*
|
301 |
Â
* @since 1.5.0
|
302 |
Â
*
|
Â
|
|
Â
|
|
303 |
Â
* @param BP_Activity_Activity $activity Activity Object.
|
304 |
Â
*/
|
305 |
Â
function bp_activity_at_name_filter_updates( $activity ) {
|
335 |
Â
*
|
336 |
Â
* @since 1.7.0
|
337 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
338 |
Â
* @param BP_Activity_Activity $activity The BP_Activity_Activity object.
|
339 |
Â
*/
|
340 |
Â
function bp_activity_at_name_send_emails( $activity ) {
|
408 |
Â
* This method can only be used inside the Activity loop.
|
409 |
Â
*
|
410 |
Â
* @since 1.5.0
|
411 |
+
* @since 2.6.0 Added $args parameter.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
412 |
Â
*
|
413 |
Â
* @param string $text The original activity entry text.
|
414 |
+
* @param array $args {
|
415 |
+
* Optional parameters. See $options argument of {@link bp_create_excerpt()}
|
416 |
+
* for all available parameters.
|
417 |
+
* }
|
418 |
Â
* @return string $excerpt The truncated text.
|
419 |
Â
*/
|
420 |
+
function bp_activity_truncate_entry( $text, $args = array() ) {
|
421 |
Â
global $activities_template;
|
422 |
Â
|
423 |
Â
/**
|
433 |
Â
);
|
434 |
Â
|
435 |
Â
// The full text of the activity update should always show on the single activity screen.
|
436 |
+
if ( empty( $args['force_truncate'] ) && ( ! $maybe_truncate_text || bp_is_single_activity() ) ) {
|
437 |
Â
return $text;
|
438 |
Â
}
|
439 |
Â
|
455 |
Â
*/
|
456 |
Â
$excerpt_length = apply_filters( 'bp_activity_excerpt_length', 358 );
|
457 |
Â
|
458 |
+
$args = wp_parse_args( $args, array( 'ending' => __( '…', 'buddypress' ) ) );
|
459 |
+
|
460 |
Â
// Run the text through the excerpt function. If it's too short, the original text will be returned.
|
461 |
+
$excerpt = bp_create_excerpt( $text, $excerpt_length, $args );
|
462 |
Â
|
463 |
Â
/*
|
464 |
Â
* If the text returned by bp_create_excerpt() is different from the original text (ie it's
|
465 |
Â
* been truncated), add the "Read More" link. Note that bp_create_excerpt() is stripping
|
466 |
Â
* shortcodes, so we have strip them from the $text before the comparison.
|
467 |
Â
*/
|
468 |
+
if ( strlen( $excerpt ) < strlen( strip_shortcodes( $text ) ) ) {
|
469 |
Â
$id = !empty( $activities_template->activity->current_comment->id ) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id();
|
470 |
Â
|
471 |
Â
$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 );
|
488 |
Â
*
|
489 |
Â
* @since 2.0.0
|
490 |
Â
*
|
Â
|
|
Â
|
|
491 |
Â
* @param array $js_handles The original dependencies.
|
492 |
Â
* @return array $js_handles The new dependencies.
|
493 |
Â
*/
|
553 |
Â
*
|
554 |
Â
* @since 2.0.0
|
555 |
Â
*
|
Â
|
|
Â
|
|
556 |
Â
* @param array $response Array containing Heartbeat API response.
|
557 |
Â
* @param array $data Array containing data for Heartbeat API response.
|
558 |
Â
* @return array $response
|
@@ -40,8 +40,6 @@ function bp_activity_has_directory() {
|
|
40 |
Â
*
|
41 |
Â
* @since 1.8.0
|
42 |
Â
*
|
43 |
-
* @uses apply_filters() To call 'bp_activity_do_mentions' hook.
|
44 |
-
*
|
45 |
Â
* @return bool $retval True to enable mentions, false to disable.
|
46 |
Â
*/
|
47 |
Â
function bp_activity_do_mentions() {
|
@@ -133,8 +131,6 @@ function bp_activity_find_mentions( $content ) {
|
|
133 |
Â
*
|
134 |
Â
* @since 1.5.0
|
135 |
Â
*
|
136 |
-
* @uses bp_delete_user_meta()
|
137 |
-
*
|
138 |
Â
* @param int $user_id The id of the user whose unread mentions are being reset.
|
139 |
Â
*/
|
140 |
Â
function bp_activity_clear_new_mentions( $user_id ) {
|
@@ -161,9 +157,6 @@ function bp_activity_clear_new_mentions( $user_id ) {
|
|
161 |
Â
*
|
162 |
Â
* @since 1.5.0
|
163 |
Â
*
|
164 |
-
* @uses bp_activity_find_mentions()
|
165 |
-
* @uses bp_activity_update_mention_count_for_user()
|
166 |
-
*
|
167 |
Â
* @param int $activity_id The unique id for the activity item.
|
168 |
Â
* @param string $action Can be 'delete' or 'add'. Defaults to 'add'.
|
169 |
Â
* @return bool
|
@@ -176,7 +169,7 @@ function bp_activity_adjust_mention_count( $activity_id = 0, $action = 'add' ) {
|
|
176 |
Â
}
|
177 |
Â
|
178 |
Â
// Get activity object.
|
179 |
-
$activity = new BP_Activity_Activity(
|
180 |
Â
|
181 |
Â
// Try to find mentions.
|
182 |
Â
$usernames = bp_activity_find_mentions( strip_tags( $activity->content ) );
|
@@ -200,9 +193,6 @@ function bp_activity_adjust_mention_count( $activity_id = 0, $action = 'add' ) {
|
|
200 |
Â
*
|
201 |
Â
* @since 1.7.0
|
202 |
Â
*
|
203 |
-
* @uses bp_get_user_meta()
|
204 |
-
* @uses bp_update_user_meta()
|
205 |
-
*
|
206 |
Â
* @param int $user_id The user ID.
|
207 |
Â
* @param int $activity_id The unique ID for the activity item.
|
208 |
Â
* @param string $action 'delete' or 'add'. Default: 'add'.
|
@@ -787,8 +777,6 @@ function bp_activity_get_actions() {
|
|
787 |
Â
*
|
788 |
Â
* @since 1.1.0
|
789 |
Â
*
|
790 |
-
* @uses apply_filters() To call the 'bp_activity_get_action' hook.
|
791 |
-
*
|
792 |
Â
* @param string $component_id The unique string ID of the component.
|
793 |
Â
* @param string $key The action key.
|
794 |
Â
* @return string|bool Action value if found, otherwise false.
|
@@ -858,9 +846,6 @@ function bp_activity_get_types() {
|
|
858 |
Â
*
|
859 |
Â
* @since 1.2.0
|
860 |
Â
*
|
861 |
-
* @uses bp_get_user_meta()
|
862 |
-
* @uses apply_filters() To call the 'bp_activity_get_user_favorites' hook.
|
863 |
-
*
|
864 |
Â
* @param int $user_id ID of the user whose favorites are being queried.
|
865 |
Â
* @return array IDs of the user's favorite activity items.
|
866 |
Â
*/
|
@@ -889,14 +874,6 @@ function bp_activity_get_user_favorites( $user_id = 0 ) {
|
|
889 |
Â
*
|
890 |
Â
* @since 1.2.0
|
891 |
Â
*
|
892 |
-
* @uses is_user_logged_in()
|
893 |
-
* @uses bp_get_user_meta()
|
894 |
-
* @uses bp_activity_get_meta()
|
895 |
-
* @uses bp_update_user_meta()
|
896 |
-
* @uses bp_activity_update_meta()
|
897 |
-
* @uses do_action() To call the 'bp_activity_add_user_favorite' hook.
|
898 |
-
* @uses do_action() To call the 'bp_activity_add_user_favorite_fail' hook.
|
899 |
-
*
|
900 |
Â
* @param int $activity_id ID of the activity item being favorited.
|
901 |
Â
* @param int $user_id ID of the user favoriting the activity item.
|
902 |
Â
* @return bool True on success, false on failure.
|
@@ -971,13 +948,6 @@ function bp_activity_add_user_favorite( $activity_id, $user_id = 0 ) {
|
|
971 |
Â
*
|
972 |
Â
* @since 1.2.0
|
973 |
Â
*
|
974 |
-
* @uses is_user_logged_in()
|
975 |
-
* @uses bp_get_user_meta()
|
976 |
-
* @uses bp_activity_get_meta()
|
977 |
-
* @uses bp_activity_update_meta()
|
978 |
-
* @uses bp_update_user_meta()
|
979 |
-
* @uses do_action() To call the 'bp_activity_remove_user_favorite' hook.
|
980 |
-
*
|
981 |
Â
* @param int $activity_id ID of the activity item being unfavorited.
|
982 |
Â
* @param int $user_id ID of the user unfavoriting the activity item.
|
983 |
Â
* @return bool True on success, false on failure.
|
@@ -1050,9 +1020,6 @@ function bp_activity_remove_user_favorite( $activity_id, $user_id = 0 ) {
|
|
1050 |
Â
*
|
1051 |
Â
* @since 1.1.0
|
1052 |
Â
*
|
1053 |
-
* @uses BP_Activity_Activity::check_exists_by_content() {@link BP_Activity_Activity}
|
1054 |
-
* @uses apply_filters() To call the 'bp_activity_check_exists_by_content' hook.
|
1055 |
-
*
|
1056 |
Â
* @param string $content The content to filter by.
|
1057 |
Â
* @return int|null The ID of the located activity item. Null if none is found.
|
1058 |
Â
*/
|
@@ -1063,7 +1030,7 @@ function bp_activity_check_exists_by_content( $content ) {
|
|
1063 |
Â
*
|
1064 |
Â
* @since 1.1.0
|
1065 |
Â
*
|
1066 |
-
* @param BP_Activity_Activity $
|
1067 |
Â
*/
|
1068 |
Â
return apply_filters( 'bp_activity_check_exists_by_content', BP_Activity_Activity::check_exists_by_content( $content ) );
|
1069 |
Â
}
|
@@ -1073,9 +1040,6 @@ function bp_activity_check_exists_by_content( $content ) {
|
|
1073 |
Â
*
|
1074 |
Â
* @since 1.0.0
|
1075 |
Â
*
|
1076 |
-
* @uses BP_Activity_Activity::get_last_updated() {@link BP_Activity_Activity}
|
1077 |
-
* @uses apply_filters() To call the 'bp_activity_get_last_updated' hook.
|
1078 |
-
*
|
1079 |
Â
* @return string Date last updated.
|
1080 |
Â
*/
|
1081 |
Â
function bp_activity_get_last_updated() {
|
@@ -1095,8 +1059,6 @@ function bp_activity_get_last_updated() {
|
|
1095 |
Â
*
|
1096 |
Â
* @since 1.2.0
|
1097 |
Â
*
|
1098 |
-
* @uses BP_Activity_Activity::total_favorite_count() {@link BP_Activity_Activity}
|
1099 |
-
*
|
1100 |
Â
* @param int $user_id ID of the user whose favorite count is being requested.
|
1101 |
Â
* @return int Total favorite count for the user.
|
1102 |
Â
*/
|
@@ -1160,8 +1122,6 @@ function bp_activity_delete_meta( $activity_id, $meta_key = '', $meta_value = ''
|
|
1160 |
Â
*
|
1161 |
Â
* @since 1.2.0
|
1162 |
Â
*
|
1163 |
-
* @uses apply_filters() To call the 'bp_activity_get_meta' hook.
|
1164 |
-
*
|
1165 |
Â
* @param int $activity_id ID of the activity item whose metadata is being requested.
|
1166 |
Â
* @param string $meta_key Optional. If present, only the metadata matching
|
1167 |
Â
* that meta key will be returned. Otherwise, all metadata for the
|
@@ -1239,12 +1199,6 @@ function bp_activity_add_meta( $activity_id, $meta_key, $meta_value, $unique = f
|
|
1239 |
Â
*
|
1240 |
Â
* @since 1.5.0
|
1241 |
Â
*
|
1242 |
-
* @uses is_user_logged_in()
|
1243 |
-
* @uses bp_activity_delete()
|
1244 |
-
* @uses bp_delete_user_meta()
|
1245 |
-
* @uses do_action() To call the 'bp_activity_remove_data' hook.
|
1246 |
-
* @uses do_action() To call the 'bp_activity_remove_all_user_data' hook.
|
1247 |
-
*
|
1248 |
Â
* @param int $user_id ID of the user whose activity is being deleted.
|
1249 |
Â
* @return bool
|
1250 |
Â
*/
|
@@ -1671,11 +1625,6 @@ function bp_activity_format_activity_action_custom_post_type_comment( $action, $
|
|
1671 |
Â
*
|
1672 |
Â
* @see BP_Activity_Activity::get() For more information on accepted arguments
|
1673 |
Â
* and the format of the returned value.
|
1674 |
-
* @uses wp_parse_args()
|
1675 |
-
* @uses wp_cache_get()
|
1676 |
-
* @uses wp_cache_set()
|
1677 |
-
* @uses BP_Activity_Activity::get() {@link BP_Activity_Activity}
|
1678 |
-
* @uses apply_filters_ref_array() To call the 'bp_activity_get' hook.
|
1679 |
Â
*
|
1680 |
Â
* @param array|string $args See BP_Activity_Activity::get() for description.
|
1681 |
Â
* @return array $activity See BP_Activity_Activity::get() for description.
|
@@ -1782,9 +1731,6 @@ function bp_activity_get( $args = '' ) {
|
|
1782 |
Â
* @since 1.2.0
|
1783 |
Â
*
|
1784 |
Â
* @see BP_Activity_Activity::get() For more information on accepted arguments.
|
1785 |
-
* @uses wp_parse_args()
|
1786 |
-
* @uses apply_filters() To call the 'bp_activity_get_specific' hook.
|
1787 |
-
* @uses BP_Activity_Activity::get() {@link BP_Activity_Activity}
|
1788 |
Â
*
|
1789 |
Â
* @param array|string $args {
|
1790 |
Â
* All arguments and defaults are shared with BP_Activity_Activity::get(),
|
@@ -1836,12 +1782,7 @@ function bp_activity_get_specific( $args = '' ) {
|
|
1836 |
Â
* Add an activity item.
|
1837 |
Â
*
|
1838 |
Â
* @since 1.1.0
|
1839 |
-
*
|
1840 |
-
* @uses wp_parse_args()
|
1841 |
-
* @uses BP_Activity_Activity::save() {@link BP_Activity_Activity}
|
1842 |
-
* @uses BP_Activity_Activity::rebuild_activity_comment_tree() {@link BP_Activity_Activity}
|
1843 |
-
* @uses wp_cache_delete()
|
1844 |
-
* @uses do_action() To call the 'bp_activity_add' hook.
|
1845 |
Â
*
|
1846 |
Â
* @param array|string $args {
|
1847 |
Â
* An array of arguments.
|
@@ -1873,6 +1814,7 @@ function bp_activity_get_specific( $args = '' ) {
|
|
1873 |
Â
* @type bool $hide_sitewide Should the item be hidden on sitewide streams?
|
1874 |
Â
* Default: false.
|
1875 |
Â
* @type bool $is_spam Should the item be marked as spam? Default: false.
|
Â
|
|
1876 |
Â
* }
|
1877 |
Â
* @return int|bool The ID of the activity on success. False on error.
|
1878 |
Â
*/
|
@@ -1891,6 +1833,7 @@ function bp_activity_add( $args = '' ) {
|
|
1891 |
Â
'recorded_time' => bp_core_current_time(), // The GMT time that this activity was recorded.
|
1892 |
Â
'hide_sitewide' => false, // Should this be hidden on the sitewide activity stream?
|
1893 |
Â
'is_spam' => false, // Is this activity item to be marked as spam?
|
Â
|
|
1894 |
Â
), 'activity_add' );
|
1895 |
Â
|
1896 |
Â
// Make sure we are backwards compatible.
|
@@ -1914,11 +1857,16 @@ function bp_activity_add( $args = '' ) {
|
|
1914 |
Â
$activity->date_recorded = $r['recorded_time'];
|
1915 |
Â
$activity->hide_sitewide = $r['hide_sitewide'];
|
1916 |
Â
$activity->is_spam = $r['is_spam'];
|
Â
|
|
1917 |
Â
$activity->action = ! empty( $r['action'] )
|
1918 |
-
|
1919 |
-
|
1920 |
Â
|
1921 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1922 |
Â
return false;
|
1923 |
Â
}
|
1924 |
Â
|
@@ -1949,17 +1897,6 @@ function bp_activity_add( $args = '' ) {
|
|
1949 |
Â
*
|
1950 |
Â
* @since 1.2.0
|
1951 |
Â
*
|
1952 |
-
* @uses wp_parse_args()
|
1953 |
-
* @uses bp_is_user_inactive()
|
1954 |
-
* @uses bp_core_get_userlink()
|
1955 |
-
* @uses bp_activity_add()
|
1956 |
-
* @uses apply_filters() To call the 'bp_activity_new_update_action' hook.
|
1957 |
-
* @uses apply_filters() To call the 'bp_activity_new_update_content' hook.
|
1958 |
-
* @uses apply_filters() To call the 'bp_activity_new_update_primary_link' hook.
|
1959 |
-
* @uses bp_update_user_meta()
|
1960 |
-
* @uses wp_filter_kses()
|
1961 |
-
* @uses do_action() To call the 'bp_activity_posted_update' hook.
|
1962 |
-
*
|
1963 |
Â
* @param array|string $args {
|
1964 |
Â
* @type string $content The content of the activity update.
|
1965 |
Â
* @type int $user_id Optional. Defaults to the logged-in user.
|
@@ -1969,8 +1906,9 @@ function bp_activity_add( $args = '' ) {
|
|
1969 |
Â
function bp_activity_post_update( $args = '' ) {
|
1970 |
Â
|
1971 |
Â
$r = wp_parse_args( $args, array(
|
1972 |
-
'content'
|
1973 |
-
'user_id'
|
Â
|
|
1974 |
Â
) );
|
1975 |
Â
|
1976 |
Â
if ( empty( $r['content'] ) || !strlen( trim( $r['content'] ) ) ) {
|
@@ -2010,8 +1948,14 @@ function bp_activity_post_update( $args = '' ) {
|
|
2010 |
Â
'primary_link' => $add_primary_link,
|
2011 |
Â
'component' => buddypress()->activity->id,
|
2012 |
Â
'type' => 'activity_update',
|
Â
|
|
2013 |
Â
) );
|
2014 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2015 |
Â
/**
|
2016 |
Â
* Filters the latest update content for the activity item.
|
2017 |
Â
*
|
@@ -2304,10 +2248,9 @@ function bp_activity_post_type_unpublish( $post_id = 0, $post = null ) {
|
|
2304 |
Â
*
|
2305 |
Â
* @since 2.5.0
|
2306 |
Â
*
|
2307 |
-
* @param int
|
2308 |
-
* @param bool
|
2309 |
-
* @param object $activity_post_object
|
2310 |
-
*
|
2311 |
Â
* @return int|bool The ID of the activity on success. False on error.
|
2312 |
Â
*/
|
2313 |
Â
function bp_activity_post_type_comment( $comment_id = 0, $is_approved = true, $activity_post_object = null ) {
|
@@ -2497,9 +2440,8 @@ add_action( 'edit_comment', 'bp_activity_post_type_comment', 10 );
|
|
2497 |
Â
*
|
2498 |
Â
* @since 2.5.0
|
2499 |
Â
*
|
2500 |
-
* @param int
|
2501 |
-
* @param object $activity_post_object The post type tracking args object.
|
2502 |
-
*
|
2503 |
Â
* @return bool True on success. False on error.
|
2504 |
Â
*/
|
2505 |
Â
function bp_activity_post_type_remove_comment( $comment_id = 0, $activity_post_object = null ) {
|
@@ -2564,15 +2506,10 @@ add_action( 'delete_comment', 'bp_activity_post_type_remove_comment', 10, 1 );
|
|
2564 |
Â
* @since 1.2.0
|
2565 |
Â
* @since 2.5.0 Add a new possible parameter $skip_notification for the array of arguments.
|
2566 |
Â
* Add the $primary_link parameter for the array of arguments.
|
2567 |
-
*
|
2568 |
-
* @uses wp_parse_args()
|
2569 |
-
* @uses bp_activity_add()
|
2570 |
-
* @uses apply_filters() To call the 'bp_activity_comment_action' hook.
|
2571 |
-
* @uses apply_filters() To call the 'bp_activity_comment_content' hook.
|
2572 |
-
* @uses wp_cache_delete()
|
2573 |
-
* @uses do_action() To call the 'bp_activity_comment_posted' hook.
|
2574 |
Â
*
|
2575 |
Â
* @param array|string $args {
|
Â
|
|
2576 |
Â
* @type int $id Optional. Pass an ID to update an existing comment.
|
2577 |
Â
* @type string $content The content of the comment.
|
2578 |
Â
* @type int $user_id Optional. The ID of the user making the comment.
|
@@ -2586,17 +2523,12 @@ add_action( 'delete_comment', 'bp_activity_post_type_remove_comment', 10, 1 );
|
|
2586 |
Â
* Defaults to an empty string.
|
2587 |
Â
* @type bool $skip_notification Optional. false to send a comment notification, false otherwise.
|
2588 |
Â
* Defaults to false.
|
Â
|
|
2589 |
Â
* }
|
2590 |
Â
* @return int|bool The ID of the comment on success, otherwise false.
|
2591 |
Â
*/
|
2592 |
Â
function bp_activity_new_comment( $args = '' ) {
|
2593 |
-
$bp
|
2594 |
-
$errors = new WP_Error();
|
2595 |
-
$feedback = __( 'There was an error posting your reply. Please try again.', 'buddypress' );
|
2596 |
-
|
2597 |
-
if ( empty( $bp->activity->errors ) ) {
|
2598 |
-
$bp->activity->errors = array();
|
2599 |
-
}
|
2600 |
Â
|
2601 |
Â
$r = wp_parse_args( $args, array(
|
2602 |
Â
'id' => false,
|
@@ -2606,14 +2538,31 @@ function bp_activity_new_comment( $args = '' ) {
|
|
2606 |
Â
'parent_id' => false, // ID of a parent comment (optional).
|
2607 |
Â
'primary_link' => '',
|
2608 |
Â
'skip_notification' => false,
|
Â
|
|
2609 |
Â
) );
|
2610 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2611 |
Â
// Bail if missing necessary data.
|
2612 |
Â
if ( empty( $r['content'] ) || empty( $r['user_id'] ) || empty( $r['activity_id'] ) ) {
|
2613 |
-
$
|
2614 |
-
$bp->activity->errors['new_comment'] = $errors;
|
2615 |
Â
|
2616 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2617 |
Â
}
|
2618 |
Â
|
2619 |
Â
// Maybe set current activity ID as the parent.
|
@@ -2628,14 +2577,21 @@ function bp_activity_new_comment( $args = '' ) {
|
|
2628 |
Â
|
2629 |
Â
// Bail if the parent activity does not exist.
|
2630 |
Â
if ( empty( $activity->date_recorded ) ) {
|
2631 |
-
$
|
2632 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2633 |
Â
|
2634 |
-
return false;
|
2635 |
Â
}
|
2636 |
Â
|
2637 |
Â
// Check to see if the parent activity is hidden, and if so, hide this comment publicly.
|
2638 |
-
$is_hidden =
|
2639 |
Â
|
2640 |
Â
/**
|
2641 |
Â
* Filters the content of a new comment.
|
@@ -2656,9 +2612,15 @@ function bp_activity_new_comment( $args = '' ) {
|
|
2656 |
Â
'user_id' => $r['user_id'],
|
2657 |
Â
'item_id' => $activity_id,
|
2658 |
Â
'secondary_item_id' => $r['parent_id'],
|
2659 |
-
'hide_sitewide' => $is_hidden
|
Â
|
|
2660 |
Â
) );
|
2661 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2662 |
Â
// Comment caches are stored only with the top-level item.
|
2663 |
Â
wp_cache_delete( $activity_id, 'bp_activity_comments' );
|
2664 |
Â
|
@@ -2698,8 +2660,15 @@ function bp_activity_new_comment( $args = '' ) {
|
|
2698 |
Â
}
|
2699 |
Â
|
2700 |
Â
if ( empty( $comment_id ) ) {
|
2701 |
-
$
|
2702 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2703 |
Â
}
|
2704 |
Â
|
2705 |
Â
return $comment_id;
|
@@ -2711,9 +2680,6 @@ function bp_activity_new_comment( $args = '' ) {
|
|
2711 |
Â
* @since 1.2.0
|
2712 |
Â
*
|
2713 |
Â
* @see BP_Activity_Activity::get() For more information on accepted arguments.
|
2714 |
-
* @uses wp_parse_args()
|
2715 |
-
* @uses apply_filters() To call the 'bp_activity_get_activity_id' hook.
|
2716 |
-
* @uses BP_Activity_Activity::save() {@link BP_Activity_Activity}
|
2717 |
Â
*
|
2718 |
Â
* @param array|string $args See BP_Activity_Activity::get() for description.
|
2719 |
Â
* @return int $activity_id The ID of the activity item found.
|
@@ -2769,15 +2735,6 @@ function bp_activity_get_activity_id( $args = '' ) {
|
|
2769 |
Â
* @since 1.0.0
|
2770 |
Â
*
|
2771 |
Â
* @see BP_Activity_Activity::get() For more information on accepted arguments.
|
2772 |
-
* @uses wp_parse_args()
|
2773 |
-
* @uses bp_activity_adjust_mention_count()
|
2774 |
-
* @uses BP_Activity_Activity::delete() {@link BP_Activity_Activity}
|
2775 |
-
* @uses do_action() To call the 'bp_before_activity_delete' hook.
|
2776 |
-
* @uses bp_get_user_meta()
|
2777 |
-
* @uses bp_delete_user_meta()
|
2778 |
-
* @uses do_action() To call the 'bp_activity_delete' hook.
|
2779 |
-
* @uses do_action() To call the 'bp_activity_deleted_activities' hook.
|
2780 |
-
* @uses wp_cache_delete()
|
2781 |
Â
*
|
2782 |
Â
* @param array|string $args To delete specific activity items, use
|
2783 |
Â
* $args = array( 'id' => $ids ); Otherwise, to use
|
@@ -2863,8 +2820,6 @@ function bp_activity_delete( $args = '' ) {
|
|
2863 |
Â
* @since 1.1.0
|
2864 |
Â
* @deprecated 1.2.0
|
2865 |
Â
*
|
2866 |
-
* @uses wp_parse_args()
|
2867 |
-
* @uses bp_activity_delete()
|
2868 |
Â
*
|
2869 |
Â
* @param array|string $args See BP_Activity_Activity::get for a
|
2870 |
Â
* description of accepted arguments.
|
@@ -2888,7 +2843,6 @@ function bp_activity_delete( $args = '' ) {
|
|
2888 |
Â
*
|
2889 |
Â
* @since 1.1.0
|
2890 |
Â
*
|
2891 |
-
* @uses bp_activity_delete()
|
2892 |
Â
*
|
2893 |
Â
* @param int $activity_id ID of the activity item to be deleted.
|
2894 |
Â
* @return bool True on success, false on failure.
|
@@ -2905,7 +2859,6 @@ function bp_activity_delete( $args = '' ) {
|
|
2905 |
Â
* @since 1.1.0
|
2906 |
Â
* @deprecated 1.2.0
|
2907 |
Â
*
|
2908 |
-
* @uses bp_activity_delete()
|
2909 |
Â
*
|
2910 |
Â
* @param int $user_id The user id.
|
2911 |
Â
* @param string $content The activity id.
|
@@ -2930,7 +2883,6 @@ function bp_activity_delete( $args = '' ) {
|
|
2930 |
Â
* @since 1.1.0
|
2931 |
Â
* @deprecated 1.2.0
|
2932 |
Â
*
|
2933 |
-
* @uses bp_activity_delete()
|
2934 |
Â
*
|
2935 |
Â
* @param int $user_id The user id.
|
2936 |
Â
* @param string $component The activity component.
|
@@ -2948,11 +2900,6 @@ function bp_activity_delete( $args = '' ) {
|
|
2948 |
Â
*
|
2949 |
Â
* @since 1.2.0
|
2950 |
Â
*
|
2951 |
-
* @uses apply_filters() To call the 'bp_activity_delete_comment_pre' hook.
|
2952 |
-
* @uses bp_activity_delete_children()
|
2953 |
-
* @uses bp_activity_delete()
|
2954 |
-
* @uses BP_Activity_Activity::rebuild_activity_comment_tree() {@link BP_Activity_Activity}
|
2955 |
-
* @uses do_action() To call the 'bp_activity_delete_comment' hook.
|
2956 |
Â
* @todo Why is an activity id required? We could look this up.
|
2957 |
Â
* @todo Why do we encourage users to call this function directly? We could just
|
2958 |
Â
* as easily examine the activity type in bp_activity_delete() and then
|
@@ -3018,9 +2965,6 @@ function bp_activity_delete_comment( $activity_id, $comment_id ) {
|
|
3018 |
Â
*
|
3019 |
Â
* @since 1.2.0
|
3020 |
Â
*
|
3021 |
-
* @uses BP_Activity_Activity::get_child_comments() {@link BP_Activity_Activity}
|
3022 |
-
* @uses bp_activity_delete_children()
|
3023 |
-
* @uses bp_activity_delete()
|
3024 |
Â
*
|
3025 |
Â
* @param int $activity_id The ID of the "root" activity, ie the
|
3026 |
Â
* comment's oldest ancestor.
|
@@ -3056,10 +3000,6 @@ function bp_activity_delete_comment( $activity_id, $comment_id ) {
|
|
3056 |
Â
*
|
3057 |
Â
* @since 1.2.0
|
3058 |
Â
*
|
3059 |
-
* @uses bp_get_root_domain()
|
3060 |
-
* @uses bp_get_activity_root_slug()
|
3061 |
-
* @uses apply_filters_ref_array() To call the 'bp_activity_get_permalink' hook.
|
3062 |
-
*
|
3063 |
Â
* @param int $activity_id The unique id of the activity object.
|
3064 |
Â
* @param object|bool $activity_obj Optional. The activity object.
|
3065 |
Â
* @return string $link Permalink for the activity item.
|
@@ -3111,8 +3051,6 @@ function bp_activity_get_permalink( $activity_id, $activity_obj = false ) {
|
|
3111 |
Â
*
|
3112 |
Â
* @since 1.2.0
|
3113 |
Â
*
|
3114 |
-
* @uses BP_Activity_Activity::hide_all_for_user() {@link BP_Activity_Activity}
|
3115 |
-
*
|
3116 |
Â
* @param int $user_id The ID of the user whose activity is being hidden.
|
3117 |
Â
* @return bool True on success, false on failure.
|
3118 |
Â
*/
|
@@ -3134,9 +3072,6 @@ function bp_activity_hide_user_activity( $user_id ) {
|
|
3134 |
Â
*
|
3135 |
Â
* @since 1.2.0
|
3136 |
Â
*
|
3137 |
-
* @uses esc_attr()
|
3138 |
-
* @uses apply_filters() To call the 'bp_activity_thumbnail_content_images' hook.
|
3139 |
-
*
|
3140 |
Â
* @param string $content The content of the activity item.
|
3141 |
Â
* @param string|bool $link Optional. The unescaped URL that the image should link
|
3142 |
Â
* to. If absent, the image will not be a link.
|
@@ -3339,8 +3274,12 @@ function bp_activity_create_summary( $content, $activity ) {
|
|
3339 |
Â
}
|
3340 |
Â
|
3341 |
Â
// Generate a text excerpt for this activity item (and remove any oEmbeds URLs).
|
3342 |
-
$summary =
|
3343 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3344 |
Â
|
3345 |
Â
if ( $use_media_type === 'embeds' ) {
|
3346 |
Â
$summary .= PHP_EOL . PHP_EOL . $extracted_media['url'];
|
@@ -3387,6 +3326,8 @@ function bp_activity_user_can_mark_spam() {
|
|
3387 |
Â
*
|
3388 |
Â
* @since 1.6.0
|
3389 |
Â
*
|
Â
|
|
Â
|
|
3390 |
Â
* @param BP_Activity_Activity $activity The activity item to be spammed.
|
3391 |
Â
* @param string $source Optional. Default is "by_a_person" (ie, a person has
|
3392 |
Â
* manually marked the activity as spam). BP core also
|
@@ -3495,17 +3436,31 @@ function bp_activity_mark_as_ham( &$activity, $source = 'by_a_person' ) {
|
|
3495 |
Â
* @see bp_embed_activity_cache()
|
3496 |
Â
* @see bp_embed_activity_save_cache()
|
3497 |
Â
*
|
3498 |
-
* @uses add_filter() To attach 'bp_get_activity_id' to 'embed_post_id'.
|
3499 |
-
* @uses add_filter() To attach 'bp_embed_activity_cache' to 'bp_embed_get_cache'.
|
3500 |
-
* @uses add_action() To attach 'bp_embed_activity_save_cache' to 'bp_embed_update_cache'.
|
3501 |
Â
*/
|
3502 |
Â
function bp_activity_embed() {
|
3503 |
Â
add_filter( 'embed_post_id', 'bp_get_activity_id' );
|
Â
|
|
3504 |
Â
add_filter( 'bp_embed_get_cache', 'bp_embed_activity_cache', 10, 3 );
|
3505 |
Â
add_action( 'bp_embed_update_cache', 'bp_embed_activity_save_cache', 10, 3 );
|
3506 |
Â
}
|
3507 |
Â
add_action( 'activity_loop_start', 'bp_activity_embed' );
|
3508 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3509 |
Â
/**
|
3510 |
Â
* Set up activity oEmbed cache while recursing through activity comments.
|
3511 |
Â
*
|
@@ -3520,9 +3475,6 @@ add_action( 'activity_loop_start', 'bp_activity_embed' );
|
|
3520 |
Â
* @see bp_embed_activity_cache()
|
3521 |
Â
* @see bp_embed_activity_save_cache()
|
3522 |
Â
*
|
3523 |
-
* @uses add_filter() To attach 'bp_get_activity_comment_id' to 'embed_post_id'.
|
3524 |
-
* @uses add_filter() To attach 'bp_embed_activity_cache' to 'bp_embed_get_cache'.
|
3525 |
-
* @uses add_action() To attach 'bp_embed_activity_save_cache' to 'bp_embed_update_cache'.
|
3526 |
Â
*/
|
3527 |
Â
function bp_activity_comment_embed() {
|
3528 |
Â
add_filter( 'embed_post_id', 'bp_get_activity_comment_id' );
|
@@ -3537,9 +3489,6 @@ add_action( 'bp_before_activity_comment', 'bp_activity_comment_embed' );
|
|
3537 |
Â
* @since 1.5.0
|
3538 |
Â
*
|
3539 |
Â
* @see BP_Embed
|
3540 |
-
* @uses add_filter() To attach create_function() to 'embed_post_id'.
|
3541 |
-
* @uses add_filter() To attach 'bp_embed_activity_cache' to 'bp_embed_get_cache'.
|
3542 |
-
* @uses add_action() To attach 'bp_embed_activity_save_cache' to 'bp_embed_update_cache'.
|
3543 |
Â
*
|
3544 |
Â
* @param object $activity The activity that is being expanded.
|
3545 |
Â
*/
|
@@ -3562,7 +3511,6 @@ add_action( 'bp_legacy_theme_get_single_activity_content', 'bp_dtheme_embed_read
|
|
3562 |
Â
* @since 1.5.0
|
3563 |
Â
*
|
3564 |
Â
* @see bp_activity_comment_embed()
|
3565 |
-
* @uses remove_filter() To remove 'bp_get_activity_comment_id' from 'embed_post_id'.
|
3566 |
Â
*/
|
3567 |
Â
function bp_activity_comment_embed_after_recurse() {
|
3568 |
Â
remove_filter( 'embed_post_id', 'bp_get_activity_comment_id' );
|
@@ -3577,7 +3525,6 @@ add_action( 'bp_after_activity_comment', 'bp_activity_comment_embed_after_recurs
|
|
3577 |
Â
* @since 1.5.0
|
3578 |
Â
*
|
3579 |
Â
* @see BP_Embed::parse_oembed()
|
3580 |
-
* @uses bp_activity_get_meta()
|
3581 |
Â
*
|
3582 |
Â
* @param string $cache An empty string passed by BP_Embed::parse_oembed() for
|
3583 |
Â
* functions like this one to filter.
|
@@ -3597,7 +3544,6 @@ function bp_embed_activity_cache( $cache, $id, $cachekey ) {
|
|
3597 |
Â
* @since 1.5.0
|
3598 |
Â
*
|
3599 |
Â
* @see BP_Embed::parse_oembed()
|
3600 |
-
* @uses bp_activity_update_meta()
|
3601 |
Â
*
|
3602 |
Â
* @param string $cache An empty string passed by BP_Embed::parse_oembed() for
|
3603 |
Â
* functions like this one to filter.
|
@@ -3606,6 +3552,12 @@ function bp_embed_activity_cache( $cache, $id, $cachekey ) {
|
|
3606 |
Â
*/
|
3607 |
Â
function bp_embed_activity_save_cache( $cache, $cachekey, $id ) {
|
3608 |
Â
bp_activity_update_meta( $id, $cachekey, $cache );
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3609 |
Â
}
|
3610 |
Â
|
3611 |
Â
/**
|
@@ -3613,10 +3565,7 @@ function bp_embed_activity_save_cache( $cache, $cachekey, $id ) {
|
|
3613 |
Â
*
|
3614 |
Â
* @since 2.0.0
|
3615 |
Â
*
|
3616 |
-
* @uses bp_is_activity_heartbeat_active() to check if heartbeat setting is on.
|
3617 |
-
* @uses bp_is_activity_directory() to check if the current page is the activity
|
3618 |
Â
* directory.
|
3619 |
-
* @uses bp_is_group_activity() to check if on a single group, the current page
|
3620 |
Â
* is the group activities.
|
3621 |
Â
*
|
3622 |
Â
* @return bool True if activity heartbeat is enabled, otherwise false.
|
40 |
Â
*
|
41 |
Â
* @since 1.8.0
|
42 |
Â
*
|
Â
|
|
Â
|
|
43 |
Â
* @return bool $retval True to enable mentions, false to disable.
|
44 |
Â
*/
|
45 |
Â
function bp_activity_do_mentions() {
|
131 |
Â
*
|
132 |
Â
* @since 1.5.0
|
133 |
Â
*
|
Â
|
|
Â
|
|
134 |
Â
* @param int $user_id The id of the user whose unread mentions are being reset.
|
135 |
Â
*/
|
136 |
Â
function bp_activity_clear_new_mentions( $user_id ) {
|
157 |
Â
*
|
158 |
Â
* @since 1.5.0
|
159 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
160 |
Â
* @param int $activity_id The unique id for the activity item.
|
161 |
Â
* @param string $action Can be 'delete' or 'add'. Defaults to 'add'.
|
162 |
Â
* @return bool
|
169 |
Â
}
|
170 |
Â
|
171 |
Â
// Get activity object.
|
172 |
+
$activity = new BP_Activity_Activity( $activity_id );
|
173 |
Â
|
174 |
Â
// Try to find mentions.
|
175 |
Â
$usernames = bp_activity_find_mentions( strip_tags( $activity->content ) );
|
193 |
Â
*
|
194 |
Â
* @since 1.7.0
|
195 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
196 |
Â
* @param int $user_id The user ID.
|
197 |
Â
* @param int $activity_id The unique ID for the activity item.
|
198 |
Â
* @param string $action 'delete' or 'add'. Default: 'add'.
|
777 |
Â
*
|
778 |
Â
* @since 1.1.0
|
779 |
Â
*
|
Â
|
|
Â
|
|
780 |
Â
* @param string $component_id The unique string ID of the component.
|
781 |
Â
* @param string $key The action key.
|
782 |
Â
* @return string|bool Action value if found, otherwise false.
|
846 |
Â
*
|
847 |
Â
* @since 1.2.0
|
848 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
849 |
Â
* @param int $user_id ID of the user whose favorites are being queried.
|
850 |
Â
* @return array IDs of the user's favorite activity items.
|
851 |
Â
*/
|
874 |
Â
*
|
875 |
Â
* @since 1.2.0
|
876 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
877 |
Â
* @param int $activity_id ID of the activity item being favorited.
|
878 |
Â
* @param int $user_id ID of the user favoriting the activity item.
|
879 |
Â
* @return bool True on success, false on failure.
|
948 |
Â
*
|
949 |
Â
* @since 1.2.0
|
950 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
951 |
Â
* @param int $activity_id ID of the activity item being unfavorited.
|
952 |
Â
* @param int $user_id ID of the user unfavoriting the activity item.
|
953 |
Â
* @return bool True on success, false on failure.
|
1020 |
Â
*
|
1021 |
Â
* @since 1.1.0
|
1022 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
1023 |
Â
* @param string $content The content to filter by.
|
1024 |
Â
* @return int|null The ID of the located activity item. Null if none is found.
|
1025 |
Â
*/
|
1030 |
Â
*
|
1031 |
Â
* @since 1.1.0
|
1032 |
Â
*
|
1033 |
+
* @param BP_Activity_Activity $value ID of the activity if found, else null.
|
1034 |
Â
*/
|
1035 |
Â
return apply_filters( 'bp_activity_check_exists_by_content', BP_Activity_Activity::check_exists_by_content( $content ) );
|
1036 |
Â
}
|
1040 |
Â
*
|
1041 |
Â
* @since 1.0.0
|
1042 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
1043 |
Â
* @return string Date last updated.
|
1044 |
Â
*/
|
1045 |
Â
function bp_activity_get_last_updated() {
|
1059 |
Â
*
|
1060 |
Â
* @since 1.2.0
|
1061 |
Â
*
|
Â
|
|
Â
|
|
1062 |
Â
* @param int $user_id ID of the user whose favorite count is being requested.
|
1063 |
Â
* @return int Total favorite count for the user.
|
1064 |
Â
*/
|
1122 |
Â
*
|
1123 |
Â
* @since 1.2.0
|
1124 |
Â
*
|
Â
|
|
Â
|
|
1125 |
Â
* @param int $activity_id ID of the activity item whose metadata is being requested.
|
1126 |
Â
* @param string $meta_key Optional. If present, only the metadata matching
|
1127 |
Â
* that meta key will be returned. Otherwise, all metadata for the
|
1199 |
Â
*
|
1200 |
Â
* @since 1.5.0
|
1201 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1202 |
Â
* @param int $user_id ID of the user whose activity is being deleted.
|
1203 |
Â
* @return bool
|
1204 |
Â
*/
|
1625 |
Â
*
|
1626 |
Â
* @see BP_Activity_Activity::get() For more information on accepted arguments
|
1627 |
Â
* and the format of the returned value.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1628 |
Â
*
|
1629 |
Â
* @param array|string $args See BP_Activity_Activity::get() for description.
|
1630 |
Â
* @return array $activity See BP_Activity_Activity::get() for description.
|
1731 |
Â
* @since 1.2.0
|
1732 |
Â
*
|
1733 |
Â
* @see BP_Activity_Activity::get() For more information on accepted arguments.
|
Â
|
|
Â
|
|
Â
|
|
1734 |
Â
*
|
1735 |
Â
* @param array|string $args {
|
1736 |
Â
* All arguments and defaults are shared with BP_Activity_Activity::get(),
|
1782 |
Â
* Add an activity item.
|
1783 |
Â
*
|
1784 |
Â
* @since 1.1.0
|
1785 |
+
* @since 2.6.0 Added 'error_type' parameter to $args.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1786 |
Â
*
|
1787 |
Â
* @param array|string $args {
|
1788 |
Â
* An array of arguments.
|
1814 |
Â
* @type bool $hide_sitewide Should the item be hidden on sitewide streams?
|
1815 |
Â
* Default: false.
|
1816 |
Â
* @type bool $is_spam Should the item be marked as spam? Default: false.
|
1817 |
+
* @type string $error_type Optional. Error type. Either 'bool' or 'wp_error'. Default: 'bool'.
|
1818 |
Â
* }
|
1819 |
Â
* @return int|bool The ID of the activity on success. False on error.
|
1820 |
Â
*/
|
1833 |
Â
'recorded_time' => bp_core_current_time(), // The GMT time that this activity was recorded.
|
1834 |
Â
'hide_sitewide' => false, // Should this be hidden on the sitewide activity stream?
|
1835 |
Â
'is_spam' => false, // Is this activity item to be marked as spam?
|
1836 |
+
'error_type' => 'bool'
|
1837 |
Â
), 'activity_add' );
|
1838 |
Â
|
1839 |
Â
// Make sure we are backwards compatible.
|
1857 |
Â
$activity->date_recorded = $r['recorded_time'];
|
1858 |
Â
$activity->hide_sitewide = $r['hide_sitewide'];
|
1859 |
Â
$activity->is_spam = $r['is_spam'];
|
1860 |
+
$activity->error_type = $r['error_type'];
|
1861 |
Â
$activity->action = ! empty( $r['action'] )
|
1862 |
+
? $r['action']
|
1863 |
+
: bp_activity_generate_action_string( $activity );
|
1864 |
Â
|
1865 |
+
$save = $activity->save();
|
1866 |
+
|
1867 |
+
if ( 'wp_error' === $r['error_type'] && is_wp_error( $save ) ) {
|
1868 |
+
return $save;
|
1869 |
+
} elseif ('bool' === $r['error_type'] && false === $save ) {
|
1870 |
Â
return false;
|
1871 |
Â
}
|
1872 |
Â
|
1897 |
Â
*
|
1898 |
Â
* @since 1.2.0
|
1899 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1900 |
Â
* @param array|string $args {
|
1901 |
Â
* @type string $content The content of the activity update.
|
1902 |
Â
* @type int $user_id Optional. Defaults to the logged-in user.
|
1906 |
Â
function bp_activity_post_update( $args = '' ) {
|
1907 |
Â
|
1908 |
Â
$r = wp_parse_args( $args, array(
|
1909 |
+
'content' => false,
|
1910 |
+
'user_id' => bp_loggedin_user_id(),
|
1911 |
+
'error_type' => 'bool',
|
1912 |
Â
) );
|
1913 |
Â
|
1914 |
Â
if ( empty( $r['content'] ) || !strlen( trim( $r['content'] ) ) ) {
|
1948 |
Â
'primary_link' => $add_primary_link,
|
1949 |
Â
'component' => buddypress()->activity->id,
|
1950 |
Â
'type' => 'activity_update',
|
1951 |
+
'error_type' => $r['error_type']
|
1952 |
Â
) );
|
1953 |
Â
|
1954 |
+
// Bail on failure.
|
1955 |
+
if ( false === $activity_id || is_wp_error( $activity_id ) ) {
|
1956 |
+
return $activity_id;
|
1957 |
+
}
|
1958 |
+
|
1959 |
Â
/**
|
1960 |
Â
* Filters the latest update content for the activity item.
|
1961 |
Â
*
|
2248 |
Â
*
|
2249 |
Â
* @since 2.5.0
|
2250 |
Â
*
|
2251 |
+
* @param int $comment_id ID of the comment.
|
2252 |
+
* @param bool $is_approved Whether the comment is approved or not.
|
2253 |
+
* @param object|null $activity_post_object The post type tracking args object.
|
Â
|
|
2254 |
Â
* @return int|bool The ID of the activity on success. False on error.
|
2255 |
Â
*/
|
2256 |
Â
function bp_activity_post_type_comment( $comment_id = 0, $is_approved = true, $activity_post_object = null ) {
|
2440 |
Â
*
|
2441 |
Â
* @since 2.5.0
|
2442 |
Â
*
|
2443 |
+
* @param int $comment_id ID of the comment.
|
2444 |
+
* @param object|null $activity_post_object The post type tracking args object.
|
Â
|
|
2445 |
Â
* @return bool True on success. False on error.
|
2446 |
Â
*/
|
2447 |
Â
function bp_activity_post_type_remove_comment( $comment_id = 0, $activity_post_object = null ) {
|
2506 |
Â
* @since 1.2.0
|
2507 |
Â
* @since 2.5.0 Add a new possible parameter $skip_notification for the array of arguments.
|
2508 |
Â
* Add the $primary_link parameter for the array of arguments.
|
2509 |
+
* @since 2.6.0 Added 'error_type' parameter to $args.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2510 |
Â
*
|
2511 |
Â
* @param array|string $args {
|
2512 |
+
* An array of arguments.
|
2513 |
Â
* @type int $id Optional. Pass an ID to update an existing comment.
|
2514 |
Â
* @type string $content The content of the comment.
|
2515 |
Â
* @type int $user_id Optional. The ID of the user making the comment.
|
2523 |
Â
* Defaults to an empty string.
|
2524 |
Â
* @type bool $skip_notification Optional. false to send a comment notification, false otherwise.
|
2525 |
Â
* Defaults to false.
|
2526 |
+
* @type string $error_type Optional. Error type. Either 'bool' or 'wp_error'. Default: 'bool'.
|
2527 |
Â
* }
|
2528 |
Â
* @return int|bool The ID of the comment on success, otherwise false.
|
2529 |
Â
*/
|
2530 |
Â
function bp_activity_new_comment( $args = '' ) {
|
2531 |
+
$bp = buddypress();
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2532 |
Â
|
2533 |
Â
$r = wp_parse_args( $args, array(
|
2534 |
Â
'id' => false,
|
2538 |
Â
'parent_id' => false, // ID of a parent comment (optional).
|
2539 |
Â
'primary_link' => '',
|
2540 |
Â
'skip_notification' => false,
|
2541 |
+
'error_type' => 'bool'
|
2542 |
Â
) );
|
2543 |
Â
|
2544 |
+
// Error type is boolean; need to initialize some variables for backpat.
|
2545 |
+
if ( 'bool' === $r['error_type'] ) {
|
2546 |
+
if ( empty( $bp->activity->errors ) ) {
|
2547 |
+
$bp->activity->errors = array();
|
2548 |
+
}
|
2549 |
+
}
|
2550 |
+
|
2551 |
+
// Default error message.
|
2552 |
+
$feedback = __( 'There was an error posting your reply. Please try again.', 'buddypress' );
|
2553 |
+
|
2554 |
Â
// Bail if missing necessary data.
|
2555 |
Â
if ( empty( $r['content'] ) || empty( $r['user_id'] ) || empty( $r['activity_id'] ) ) {
|
2556 |
+
$error = new WP_Error( 'missing_data', $feedback );
|
Â
|
|
2557 |
Â
|
2558 |
+
if ( 'wp_error' === $r['error_type'] ) {
|
2559 |
+
return $error;
|
2560 |
+
|
2561 |
+
// Backpat.
|
2562 |
+
} else {
|
2563 |
+
$bp->activity->errors['new_comment'] = $error;
|
2564 |
+
return false;
|
2565 |
+
}
|
2566 |
Â
}
|
2567 |
Â
|
2568 |
Â
// Maybe set current activity ID as the parent.
|
2577 |
Â
|
2578 |
Â
// Bail if the parent activity does not exist.
|
2579 |
Â
if ( empty( $activity->date_recorded ) ) {
|
2580 |
+
$error = new WP_Error( 'missing_activity', __( 'The item you were replying to no longer exists.', 'buddypress' ) );
|
2581 |
+
|
2582 |
+
if ( 'wp_error' === $r['error_type'] ) {
|
2583 |
+
return $error;
|
2584 |
+
|
2585 |
+
// Backpat.
|
2586 |
+
} else {
|
2587 |
+
$bp->activity->errors['new_comment'] = $error;
|
2588 |
+
return false;
|
2589 |
+
}
|
2590 |
Â
|
Â
|
|
2591 |
Â
}
|
2592 |
Â
|
2593 |
Â
// Check to see if the parent activity is hidden, and if so, hide this comment publicly.
|
2594 |
+
$is_hidden = $activity->hide_sitewide ? 1 : 0;
|
2595 |
Â
|
2596 |
Â
/**
|
2597 |
Â
* Filters the content of a new comment.
|
2612 |
Â
'user_id' => $r['user_id'],
|
2613 |
Â
'item_id' => $activity_id,
|
2614 |
Â
'secondary_item_id' => $r['parent_id'],
|
2615 |
+
'hide_sitewide' => $is_hidden,
|
2616 |
+
'error_type' => $r['error_type']
|
2617 |
Â
) );
|
2618 |
Â
|
2619 |
+
// Bail on failure.
|
2620 |
+
if ( false === $comment_id || is_wp_error( $comment_id ) ) {
|
2621 |
+
return $comment_id;
|
2622 |
+
}
|
2623 |
+
|
2624 |
Â
// Comment caches are stored only with the top-level item.
|
2625 |
Â
wp_cache_delete( $activity_id, 'bp_activity_comments' );
|
2626 |
Â
|
2660 |
Â
}
|
2661 |
Â
|
2662 |
Â
if ( empty( $comment_id ) ) {
|
2663 |
+
$error = new WP_Error( 'comment_failed', $feedback );
|
2664 |
+
|
2665 |
+
if ( 'wp_error' === $r['error_type'] ) {
|
2666 |
+
return $error;
|
2667 |
+
|
2668 |
+
// Backpat.
|
2669 |
+
} else {
|
2670 |
+
$bp->activity->errors['new_comment'] = $error;
|
2671 |
+
}
|
2672 |
Â
}
|
2673 |
Â
|
2674 |
Â
return $comment_id;
|
2680 |
Â
* @since 1.2.0
|
2681 |
Â
*
|
2682 |
Â
* @see BP_Activity_Activity::get() For more information on accepted arguments.
|
Â
|
|
Â
|
|
Â
|
|
2683 |
Â
*
|
2684 |
Â
* @param array|string $args See BP_Activity_Activity::get() for description.
|
2685 |
Â
* @return int $activity_id The ID of the activity item found.
|
2735 |
Â
* @since 1.0.0
|
2736 |
Â
*
|
2737 |
Â
* @see BP_Activity_Activity::get() For more information on accepted arguments.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2738 |
Â
*
|
2739 |
Â
* @param array|string $args To delete specific activity items, use
|
2740 |
Â
* $args = array( 'id' => $ids ); Otherwise, to use
|
2820 |
Â
* @since 1.1.0
|
2821 |
Â
* @deprecated 1.2.0
|
2822 |
Â
*
|
Â
|
|
Â
|
|
2823 |
Â
*
|
2824 |
Â
* @param array|string $args See BP_Activity_Activity::get for a
|
2825 |
Â
* description of accepted arguments.
|
2843 |
Â
*
|
2844 |
Â
* @since 1.1.0
|
2845 |
Â
*
|
Â
|
|
2846 |
Â
*
|
2847 |
Â
* @param int $activity_id ID of the activity item to be deleted.
|
2848 |
Â
* @return bool True on success, false on failure.
|
2859 |
Â
* @since 1.1.0
|
2860 |
Â
* @deprecated 1.2.0
|
2861 |
Â
*
|
Â
|
|
2862 |
Â
*
|
2863 |
Â
* @param int $user_id The user id.
|
2864 |
Â
* @param string $content The activity id.
|
2883 |
Â
* @since 1.1.0
|
2884 |
Â
* @deprecated 1.2.0
|
2885 |
Â
*
|
Â
|
|
2886 |
Â
*
|
2887 |
Â
* @param int $user_id The user id.
|
2888 |
Â
* @param string $component The activity component.
|
2900 |
Â
*
|
2901 |
Â
* @since 1.2.0
|
2902 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2903 |
Â
* @todo Why is an activity id required? We could look this up.
|
2904 |
Â
* @todo Why do we encourage users to call this function directly? We could just
|
2905 |
Â
* as easily examine the activity type in bp_activity_delete() and then
|
2965 |
Â
*
|
2966 |
Â
* @since 1.2.0
|
2967 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
2968 |
Â
*
|
2969 |
Â
* @param int $activity_id The ID of the "root" activity, ie the
|
2970 |
Â
* comment's oldest ancestor.
|
3000 |
Â
*
|
3001 |
Â
* @since 1.2.0
|
3002 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3003 |
Â
* @param int $activity_id The unique id of the activity object.
|
3004 |
Â
* @param object|bool $activity_obj Optional. The activity object.
|
3005 |
Â
* @return string $link Permalink for the activity item.
|
3051 |
Â
*
|
3052 |
Â
* @since 1.2.0
|
3053 |
Â
*
|
Â
|
|
Â
|
|
3054 |
Â
* @param int $user_id The ID of the user whose activity is being hidden.
|
3055 |
Â
* @return bool True on success, false on failure.
|
3056 |
Â
*/
|
3072 |
Â
*
|
3073 |
Â
* @since 1.2.0
|
3074 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
3075 |
Â
* @param string $content The content of the activity item.
|
3076 |
Â
* @param string|bool $link Optional. The unescaped URL that the image should link
|
3077 |
Â
* to. If absent, the image will not be a link.
|
3274 |
Â
}
|
3275 |
Â
|
3276 |
Â
// Generate a text excerpt for this activity item (and remove any oEmbeds URLs).
|
3277 |
+
$summary = bp_create_excerpt( html_entity_decode( $content ), 225, array(
|
3278 |
+
'html' => false,
|
3279 |
+
'filter_shortcodes' => true,
|
3280 |
+
'strip_tags' => true,
|
3281 |
+
'remove_links' => true
|
3282 |
+
) );
|
3283 |
Â
|
3284 |
Â
if ( $use_media_type === 'embeds' ) {
|
3285 |
Â
$summary .= PHP_EOL . PHP_EOL . $extracted_media['url'];
|
3326 |
Â
*
|
3327 |
Â
* @since 1.6.0
|
3328 |
Â
*
|
3329 |
+
* @todo We should probably save $source to activity meta.
|
3330 |
+
*
|
3331 |
Â
* @param BP_Activity_Activity $activity The activity item to be spammed.
|
3332 |
Â
* @param string $source Optional. Default is "by_a_person" (ie, a person has
|
3333 |
Â
* manually marked the activity as spam). BP core also
|
3436 |
Â
* @see bp_embed_activity_cache()
|
3437 |
Â
* @see bp_embed_activity_save_cache()
|
3438 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
3439 |
Â
*/
|
3440 |
Â
function bp_activity_embed() {
|
3441 |
Â
add_filter( 'embed_post_id', 'bp_get_activity_id' );
|
3442 |
+
add_filter( 'oembed_dataparse', 'bp_activity_oembed_dataparse', 10, 2 );
|
3443 |
Â
add_filter( 'bp_embed_get_cache', 'bp_embed_activity_cache', 10, 3 );
|
3444 |
Â
add_action( 'bp_embed_update_cache', 'bp_embed_activity_save_cache', 10, 3 );
|
3445 |
Â
}
|
3446 |
Â
add_action( 'activity_loop_start', 'bp_activity_embed' );
|
3447 |
Â
|
3448 |
+
/**
|
3449 |
+
* Cache full oEmbed response from oEmbed.
|
3450 |
+
*
|
3451 |
+
* @since 2.6.0
|
3452 |
+
*
|
3453 |
+
* @param string $retval Current oEmbed result.
|
3454 |
+
* @param object $data Full oEmbed response.
|
3455 |
+
* @param string $url URL used for the oEmbed request.
|
3456 |
+
* @return string
|
3457 |
+
*/
|
3458 |
+
function bp_activity_oembed_dataparse( $retval, $data ) {
|
3459 |
+
buddypress()->activity->oembed_response = $data;
|
3460 |
+
|
3461 |
+
return $retval;
|
3462 |
+
}
|
3463 |
+
|
3464 |
Â
/**
|
3465 |
Â
* Set up activity oEmbed cache while recursing through activity comments.
|
3466 |
Â
*
|
3475 |
Â
* @see bp_embed_activity_cache()
|
3476 |
Â
* @see bp_embed_activity_save_cache()
|
3477 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
3478 |
Â
*/
|
3479 |
Â
function bp_activity_comment_embed() {
|
3480 |
Â
add_filter( 'embed_post_id', 'bp_get_activity_comment_id' );
|
3489 |
Â
* @since 1.5.0
|
3490 |
Â
*
|
3491 |
Â
* @see BP_Embed
|
Â
|
|
Â
|
|
Â
|
|
3492 |
Â
*
|
3493 |
Â
* @param object $activity The activity that is being expanded.
|
3494 |
Â
*/
|
3511 |
Â
* @since 1.5.0
|
3512 |
Â
*
|
3513 |
Â
* @see bp_activity_comment_embed()
|
Â
|
|
3514 |
Â
*/
|
3515 |
Â
function bp_activity_comment_embed_after_recurse() {
|
3516 |
Â
remove_filter( 'embed_post_id', 'bp_get_activity_comment_id' );
|
3525 |
Â
* @since 1.5.0
|
3526 |
Â
*
|
3527 |
Â
* @see BP_Embed::parse_oembed()
|
Â
|
|
3528 |
Â
*
|
3529 |
Â
* @param string $cache An empty string passed by BP_Embed::parse_oembed() for
|
3530 |
Â
* functions like this one to filter.
|
3544 |
Â
* @since 1.5.0
|
3545 |
Â
*
|
3546 |
Â
* @see BP_Embed::parse_oembed()
|
Â
|
|
3547 |
Â
*
|
3548 |
Â
* @param string $cache An empty string passed by BP_Embed::parse_oembed() for
|
3549 |
Â
* functions like this one to filter.
|
3552 |
Â
*/
|
3553 |
Â
function bp_embed_activity_save_cache( $cache, $cachekey, $id ) {
|
3554 |
Â
bp_activity_update_meta( $id, $cachekey, $cache );
|
3555 |
+
|
3556 |
+
// Cache full oEmbed response.
|
3557 |
+
if ( true === isset( buddypress()->activity->oembed_response ) ) {
|
3558 |
+
$cachekey = str_replace( '_oembed', '_oembed_response', $cachekey );
|
3559 |
+
bp_activity_update_meta( $id, $cachekey, buddypress()->activity->oembed_response );
|
3560 |
+
}
|
3561 |
Â
}
|
3562 |
Â
|
3563 |
Â
/**
|
3565 |
Â
*
|
3566 |
Â
* @since 2.0.0
|
3567 |
Â
*
|
Â
|
|
Â
|
|
3568 |
Â
* directory.
|
Â
|
|
3569 |
Â
* is the group activities.
|
3570 |
Â
*
|
3571 |
Â
* @return bool True if activity heartbeat is enabled, otherwise false.
|
@@ -12,7 +12,9 @@
|
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
-
|
Â
|
|
Â
|
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Bootstrap the Activity component.
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
+
if ( ! buddypress()->do_autoload ) {
|
16 |
+
require dirname( __FILE__ ) . '/classes/class-bp-activity-component.php';
|
17 |
+
}
|
18 |
Â
|
19 |
Â
/**
|
20 |
Â
* Bootstrap the Activity component.
|
@@ -17,25 +17,6 @@ defined( 'ABSPATH' ) || exit;
|
|
17 |
Â
*
|
18 |
Â
* @since 1.2.0
|
19 |
Â
*
|
20 |
-
* @uses bp_notifications_add_notification()
|
21 |
-
* @uses bp_get_user_meta()
|
22 |
-
* @uses bp_core_get_user_displayname()
|
23 |
-
* @uses bp_activity_get_permalink()
|
24 |
-
* @uses bp_core_get_user_domain()
|
25 |
-
* @uses bp_get_settings_slug()
|
26 |
-
* @uses bp_activity_filter_kses()
|
27 |
-
* @uses bp_core_get_core_userdata()
|
28 |
-
* @uses wp_specialchars_decode()
|
29 |
-
* @uses get_blog_option()
|
30 |
-
* @uses bp_is_active()
|
31 |
-
* @uses bp_is_group()
|
32 |
-
* @uses bp_get_current_group_name()
|
33 |
-
* @uses apply_filters() To call the 'bp_activity_at_message_notification_to' hook.
|
34 |
-
* @uses apply_filters() To call the 'bp_activity_at_message_notification_subject' hook.
|
35 |
-
* @uses apply_filters() To call the 'bp_activity_at_message_notification_message' hook.
|
36 |
-
* @uses wp_mail()
|
37 |
-
* @uses do_action() To call the 'bp_activity_sent_mention_email' hook.
|
38 |
-
*
|
39 |
Â
* @param int $activity_id The ID of the activity update.
|
40 |
Â
* @param int $receiver_user_id The ID of the user who is receiving the update.
|
41 |
Â
*/
|
@@ -108,26 +89,6 @@ function bp_activity_at_message_notification( $activity_id, $receiver_user_id )
|
|
108 |
Â
* @since 1.2.0
|
109 |
Â
* @since 2.5.0 Updated to use new email APIs.
|
110 |
Â
*
|
111 |
-
* @uses bp_get_user_meta()
|
112 |
-
* @uses bp_core_get_user_displayname()
|
113 |
-
* @uses bp_activity_get_permalink()
|
114 |
-
* @uses bp_core_get_user_domain()
|
115 |
-
* @uses bp_get_settings_slug()
|
116 |
-
* @uses bp_activity_filter_kses()
|
117 |
-
* @uses bp_core_get_core_userdata()
|
118 |
-
* @uses wp_specialchars_decode()
|
119 |
-
* @uses get_blog_option()
|
120 |
-
* @uses bp_get_root_blog_id()
|
121 |
-
* @uses apply_filters() To call the 'bp_activity_new_comment_notification_to' hook.
|
122 |
-
* @uses apply_filters() To call the 'bp_activity_new_comment_notification_subject' hook.
|
123 |
-
* @uses apply_filters() To call the 'bp_activity_new_comment_notification_message' hook.
|
124 |
-
* @uses wp_mail()
|
125 |
-
* @uses do_action() To call the 'bp_activity_sent_reply_to_update_email' hook.
|
126 |
-
* @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_to' hook.
|
127 |
-
* @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_subject' hook.
|
128 |
-
* @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_message' hook.
|
129 |
-
* @uses do_action() To call the 'bp_activity_sent_reply_to_reply_email' hook.
|
130 |
-
*
|
131 |
Â
* @param int $comment_id The comment id.
|
132 |
Â
* @param int $commenter_id The ID of the user who posted the comment.
|
133 |
Â
* @param array $params {@link bp_activity_new_comment()}.
|
@@ -148,19 +109,35 @@ function bp_activity_new_comment_notification( $comment_id = 0, $commenter_id =
|
|
148 |
Â
add_filter( 'bp_get_activity_content_body', 'wpautop' );
|
149 |
Â
add_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
|
150 |
Â
|
151 |
-
if ( $original_activity->user_id != $commenter_id
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
'
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
162 |
Â
|
163 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
164 |
Â
}
|
165 |
Â
|
166 |
Â
|
@@ -174,19 +151,35 @@ function bp_activity_new_comment_notification( $comment_id = 0, $commenter_id =
|
|
174 |
Â
|
175 |
Â
$parent_comment = new BP_Activity_Activity( $params['parent_id'] );
|
176 |
Â
|
177 |
-
if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
'
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
188 |
Â
|
189 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
190 |
Â
}
|
191 |
Â
}
|
192 |
Â
|
@@ -210,13 +203,6 @@ add_action( 'bp_activity_comment_posted', 'bp_activity_new_comment_notification_
|
|
210 |
Â
*
|
211 |
Â
* @since 1.5.0
|
212 |
Â
*
|
213 |
-
* @uses bp_loggedin_user_domain()
|
214 |
-
* @uses bp_get_activity_slug()
|
215 |
-
* @uses bp_core_get_user_displayname()
|
216 |
-
* @uses apply_filters() To call the 'bp_activity_multiple_at_mentions_notification' hook.
|
217 |
-
* @uses apply_filters() To call the 'bp_activity_single_at_mentions_notification' hook.
|
218 |
-
* @uses do_action() To call 'activity_format_notifications' hook.
|
219 |
-
*
|
220 |
Â
* @param string $action The type of activity item. Just 'new_at_mention' for now.
|
221 |
Â
* @param int $item_id The activity ID.
|
222 |
Â
* @param int $secondary_item_id In the case of at-mentions, this is the mentioner's ID.
|
@@ -225,64 +211,99 @@ add_action( 'bp_activity_comment_posted', 'bp_activity_new_comment_notification_
|
|
225 |
Â
* @return string $return Formatted @mention notification.
|
226 |
Â
*/
|
227 |
Â
function bp_activity_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
228 |
Â
|
229 |
Â
switch ( $action ) {
|
230 |
Â
case 'new_at_mention':
|
231 |
-
$
|
232 |
-
$
|
233 |
-
$
|
234 |
-
$
|
235 |
-
$amount = 'single';
|
236 |
Â
|
237 |
Â
if ( (int) $total_items > 1 ) {
|
238 |
Â
$text = sprintf( __( 'You have %1$d new mentions', 'buddypress' ), (int) $total_items );
|
239 |
Â
$amount = 'multiple';
|
240 |
Â
} else {
|
241 |
-
$user_fullname = bp_core_get_user_displayname( $poster_user_id );
|
242 |
Â
$text = sprintf( __( '%1$s mentioned you', 'buddypress' ), $user_fullname );
|
243 |
Â
}
|
244 |
Â
break;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
245 |
Â
}
|
246 |
Â
|
247 |
Â
if ( 'string' == $format ) {
|
248 |
Â
|
249 |
Â
/**
|
250 |
-
* Filters the
|
251 |
Â
*
|
252 |
Â
* This is a variable filter that is dependent on how many items
|
253 |
Â
* need notified about. The two possible hooks are bp_activity_single_at_mentions_notification
|
254 |
Â
* or bp_activity_multiple_at_mentions_notification.
|
255 |
Â
*
|
256 |
Â
* @since 1.5.0
|
Â
|
|
257 |
Â
*
|
258 |
-
* @param string $string HTML anchor tag for the
|
259 |
-
* @param string $
|
260 |
Â
* @param int $total_items How many items being notified about.
|
261 |
Â
* @param int $activity_id ID of the activity item being formatted.
|
262 |
-
* @param int $
|
263 |
Â
*/
|
264 |
-
$return = apply_filters( 'bp_activity_' . $amount . '
|
265 |
Â
} else {
|
266 |
Â
|
267 |
Â
/**
|
268 |
-
* Filters the
|
269 |
Â
*
|
270 |
Â
* This is a variable filter that is dependent on how many items need notified about.
|
271 |
Â
* The two possible hooks are bp_activity_single_at_mentions_notification
|
272 |
Â
* or bp_activity_multiple_at_mentions_notification.
|
273 |
Â
*
|
274 |
Â
* @since 1.5.0
|
Â
|
|
275 |
Â
*
|
276 |
-
* @param array $array Array holding the content and permalink for the
|
277 |
-
* @param string $
|
278 |
Â
* @param int $total_items How many items being notified about.
|
279 |
Â
* @param int $activity_id ID of the activity item being formatted.
|
280 |
-
* @param int $
|
281 |
Â
*/
|
282 |
-
$return = apply_filters( 'bp_activity_' . $amount . '
|
283 |
Â
'text' => $text,
|
284 |
-
'link' => $
|
285 |
-
), $
|
286 |
Â
}
|
287 |
Â
|
288 |
Â
/**
|
@@ -292,7 +313,7 @@ function bp_activity_format_notifications( $action, $item_id, $secondary_item_id
|
|
292 |
Â
*
|
293 |
Â
* @param string $action The type of activity item.
|
294 |
Â
* @param int $item_id The activity ID.
|
295 |
-
* @param int $secondary_item_id
|
296 |
Â
* @param int $total_items Total amount of items to format.
|
297 |
Â
*/
|
298 |
Â
do_action( 'activity_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
|
@@ -331,6 +352,54 @@ function bp_activity_at_mention_add_notification( $activity, $subject, $message,
|
|
331 |
Â
}
|
332 |
Â
add_action( 'bp_activity_sent_mention_email', 'bp_activity_at_mention_add_notification', 10, 5 );
|
333 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
334 |
Â
/**
|
335 |
Â
* Mark at-mention notifications as read when users visit their Mentions page.
|
336 |
Â
*
|
@@ -338,7 +407,6 @@ add_action( 'bp_activity_sent_mention_email', 'bp_activity_at_mention_add_notifi
|
|
338 |
Â
* @since 2.5.0 Add the $user_id parameter
|
339 |
Â
*
|
340 |
Â
* @param int $user_id The id of the user whose notifications are marked as read.
|
341 |
-
* @uses bp_notifications_mark_all_notifications_by_type()
|
342 |
Â
*/
|
343 |
Â
function bp_activity_remove_screen_notifications( $user_id = 0 ) {
|
344 |
Â
if ( ! bp_is_active( 'notifications' ) ) {
|
@@ -358,6 +426,7 @@ add_action( 'bp_activity_clear_new_mentions', 'bp_activity_remove_screen_notific
|
|
358 |
Â
* Mark at-mention notification as read when user visits the activity with the mention.
|
359 |
Â
*
|
360 |
Â
* @since 2.0.0
|
Â
|
|
361 |
Â
*
|
362 |
Â
* @param BP_Activity_Activity $activity Activity object.
|
363 |
Â
*/
|
@@ -370,8 +439,27 @@ function bp_activity_remove_screen_notifications_single_activity_permalink( $act
|
|
370 |
Â
return;
|
371 |
Â
}
|
372 |
Â
|
373 |
-
|
374 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
375 |
Â
}
|
376 |
Â
add_action( 'bp_activity_screen_single_activity_permalink', 'bp_activity_remove_screen_notifications_single_activity_permalink' );
|
377 |
Â
|
17 |
Â
*
|
18 |
Â
* @since 1.2.0
|
19 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
20 |
Â
* @param int $activity_id The ID of the activity update.
|
21 |
Â
* @param int $receiver_user_id The ID of the user who is receiving the update.
|
22 |
Â
*/
|
89 |
Â
* @since 1.2.0
|
90 |
Â
* @since 2.5.0 Updated to use new email APIs.
|
91 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
92 |
Â
* @param int $comment_id The comment id.
|
93 |
Â
* @param int $commenter_id The ID of the user who posted the comment.
|
94 |
Â
* @param array $params {@link bp_activity_new_comment()}.
|
109 |
Â
add_filter( 'bp_get_activity_content_body', 'wpautop' );
|
110 |
Â
add_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
|
111 |
Â
|
112 |
+
if ( $original_activity->user_id != $commenter_id ) {
|
113 |
+
|
114 |
+
// Send an email if the user hasn't opted-out.
|
115 |
+
if ( 'no' != bp_get_user_meta( $original_activity->user_id, 'notification_activity_new_reply', true ) ) {
|
116 |
+
$args = array(
|
117 |
+
'tokens' => array(
|
118 |
+
'comment.id' => $comment_id,
|
119 |
+
'commenter.id' => $commenter_id,
|
120 |
+
'usermessage' => wp_strip_all_tags( $content ),
|
121 |
+
'original_activity.user_id' => $original_activity->user_id,
|
122 |
+
'poster.name' => $poster_name,
|
123 |
+
'thread.url' => esc_url( $thread_link ),
|
124 |
+
),
|
125 |
+
);
|
126 |
+
|
127 |
+
bp_send_email( 'activity-comment', $original_activity->user_id, $args );
|
128 |
+
}
|
129 |
Â
|
130 |
+
/**
|
131 |
+
* Fires at the point that notifications should be sent for activity comments.
|
132 |
+
*
|
133 |
+
* @since 2.6.0
|
134 |
+
*
|
135 |
+
* @param BP_Activity_Activity $original_activity The original activity.
|
136 |
+
* @param int $comment_id ID for the newly received comment.
|
137 |
+
* @param int $commenter_id ID of the user who made the comment.
|
138 |
+
* @param array $params Arguments used with the original activity comment.
|
139 |
+
*/
|
140 |
+
do_action( 'bp_activity_sent_reply_to_update_notification', $original_activity, $comment_id, $commenter_id, $params );
|
141 |
Â
}
|
142 |
Â
|
143 |
Â
|
151 |
Â
|
152 |
Â
$parent_comment = new BP_Activity_Activity( $params['parent_id'] );
|
153 |
Â
|
154 |
+
if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id ) {
|
155 |
+
|
156 |
+
// Send an email if the user hasn't opted-out.
|
157 |
+
if ( 'no' != bp_get_user_meta( $parent_comment->user_id, 'notification_activity_new_reply', true ) ) {
|
158 |
+
$args = array(
|
159 |
+
'tokens' => array(
|
160 |
+
'comment.id' => $comment_id,
|
161 |
+
'commenter.id' => $commenter_id,
|
162 |
+
'usermessage' => wp_strip_all_tags( $content ),
|
163 |
+
'parent-comment-user.id' => $parent_comment->user_id,
|
164 |
+
'poster.name' => $poster_name,
|
165 |
+
'thread.url' => esc_url( $thread_link ),
|
166 |
+
),
|
167 |
+
);
|
168 |
+
|
169 |
+
bp_send_email( 'activity-comment-author', $parent_comment->user_id, $args );
|
170 |
+
}
|
171 |
Â
|
172 |
+
/**
|
173 |
+
* Fires at the point that notifications should be sent for comments on activity replies.
|
174 |
+
*
|
175 |
+
* @since 2.6.0
|
176 |
+
*
|
177 |
+
* @param BP_Activity_Activity $parent_comment The parent activity.
|
178 |
+
* @param int $comment_id ID for the newly received comment.
|
179 |
+
* @param int $commenter_id ID of the user who made the comment.
|
180 |
+
* @param array $params Arguments used with the original activity comment.
|
181 |
+
*/
|
182 |
+
do_action( 'bp_activity_sent_reply_to_reply_notification', $parent_comment, $comment_id, $commenter_id, $params );
|
183 |
Â
}
|
184 |
Â
}
|
185 |
Â
|
203 |
Â
*
|
204 |
Â
* @since 1.5.0
|
205 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
206 |
Â
* @param string $action The type of activity item. Just 'new_at_mention' for now.
|
207 |
Â
* @param int $item_id The activity ID.
|
208 |
Â
* @param int $secondary_item_id In the case of at-mentions, this is the mentioner's ID.
|
211 |
Â
* @return string $return Formatted @mention notification.
|
212 |
Â
*/
|
213 |
Â
function bp_activity_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
|
214 |
+
$action_filter = $action;
|
215 |
+
$return = false;
|
216 |
+
$activity_id = $item_id;
|
217 |
+
$user_id = $secondary_item_id;
|
218 |
+
$user_fullname = bp_core_get_user_displayname( $user_id );
|
219 |
Â
|
220 |
Â
switch ( $action ) {
|
221 |
Â
case 'new_at_mention':
|
222 |
+
$action_filter = 'at_mentions';
|
223 |
+
$link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/';
|
224 |
+
$title = sprintf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() );
|
225 |
+
$amount = 'single';
|
Â
|
|
226 |
Â
|
227 |
Â
if ( (int) $total_items > 1 ) {
|
228 |
Â
$text = sprintf( __( 'You have %1$d new mentions', 'buddypress' ), (int) $total_items );
|
229 |
Â
$amount = 'multiple';
|
230 |
Â
} else {
|
Â
|
|
231 |
Â
$text = sprintf( __( '%1$s mentioned you', 'buddypress' ), $user_fullname );
|
232 |
Â
}
|
233 |
Â
break;
|
234 |
+
|
235 |
+
case 'update_reply':
|
236 |
+
$link = bp_get_notifications_permalink();
|
237 |
+
$title = __( 'New Activity reply', 'buddypress' );
|
238 |
+
$amount = 'single';
|
239 |
+
|
240 |
+
if ( (int) $total_items > 1 ) {
|
241 |
+
$link = add_query_arg( 'type', $action, $link );
|
242 |
+
$text = sprintf( __( 'You have %1$d new replies', 'buddypress' ), (int) $total_items );
|
243 |
+
$amount = 'multiple';
|
244 |
+
} else {
|
245 |
+
$link = bp_activity_get_permalink( $activity_id );
|
246 |
+
$text = sprintf( __( '%1$s commented on one of your updates', 'buddypress' ), $user_fullname );
|
247 |
+
}
|
248 |
+
break;
|
249 |
+
|
250 |
+
case 'comment_reply':
|
251 |
+
$link = bp_get_notifications_permalink();
|
252 |
+
$title = __( 'New Activity comment reply', 'buddypress' );
|
253 |
+
$amount = 'single';
|
254 |
+
|
255 |
+
if ( (int) $total_items > 1 ) {
|
256 |
+
$link = add_query_arg( 'type', $action, $link );
|
257 |
+
$text = sprintf( __( 'You have %1$d new comment replies', 'buddypress' ), (int) $total_items );
|
258 |
+
$amount = 'multiple';
|
259 |
+
} else {
|
260 |
+
$link = bp_activity_get_permalink( $activity_id );
|
261 |
+
$text = sprintf( __( '%1$s replied to one your activity comments', 'buddypress' ), $user_fullname );
|
262 |
+
}
|
263 |
+
break;
|
264 |
Â
}
|
265 |
Â
|
266 |
Â
if ( 'string' == $format ) {
|
267 |
Â
|
268 |
Â
/**
|
269 |
+
* Filters the activity notification for the string format.
|
270 |
Â
*
|
271 |
Â
* This is a variable filter that is dependent on how many items
|
272 |
Â
* need notified about. The two possible hooks are bp_activity_single_at_mentions_notification
|
273 |
Â
* or bp_activity_multiple_at_mentions_notification.
|
274 |
Â
*
|
275 |
Â
* @since 1.5.0
|
276 |
+
* @since 2.6.0 use the $action_filter as a new dynamic portion of the filter name.
|
277 |
Â
*
|
278 |
+
* @param string $string HTML anchor tag for the interaction.
|
279 |
+
* @param string $link The permalink for the interaction.
|
280 |
Â
* @param int $total_items How many items being notified about.
|
281 |
Â
* @param int $activity_id ID of the activity item being formatted.
|
282 |
+
* @param int $user_id ID of the user who inited the interaction.
|
283 |
Â
*/
|
284 |
+
$return = apply_filters( 'bp_activity_' . $amount . '_' . $action_filter . '_notification', '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $text ) . '</a>', $link, (int) $total_items, $activity_id, $user_id );
|
285 |
Â
} else {
|
286 |
Â
|
287 |
Â
/**
|
288 |
+
* Filters the activity notification for any non-string format.
|
289 |
Â
*
|
290 |
Â
* This is a variable filter that is dependent on how many items need notified about.
|
291 |
Â
* The two possible hooks are bp_activity_single_at_mentions_notification
|
292 |
Â
* or bp_activity_multiple_at_mentions_notification.
|
293 |
Â
*
|
294 |
Â
* @since 1.5.0
|
295 |
+
* @since 2.6.0 use the $action_filter as a new dynamic portion of the filter name.
|
296 |
Â
*
|
297 |
+
* @param array $array Array holding the content and permalink for the interaction notification.
|
298 |
+
* @param string $link The permalink for the interaction.
|
299 |
Â
* @param int $total_items How many items being notified about.
|
300 |
Â
* @param int $activity_id ID of the activity item being formatted.
|
301 |
+
* @param int $user_id ID of the user who inited the interaction.
|
302 |
Â
*/
|
303 |
+
$return = apply_filters( 'bp_activity_' . $amount . '_' . $action_filter . '_notification', array(
|
304 |
Â
'text' => $text,
|
305 |
+
'link' => $link
|
306 |
+
), $link, (int) $total_items, $activity_id, $user_id );
|
307 |
Â
}
|
308 |
Â
|
309 |
Â
/**
|
313 |
Â
*
|
314 |
Â
* @param string $action The type of activity item.
|
315 |
Â
* @param int $item_id The activity ID.
|
316 |
+
* @param int $secondary_item_id The user ID who inited the interaction.
|
317 |
Â
* @param int $total_items Total amount of items to format.
|
318 |
Â
*/
|
319 |
Â
do_action( 'activity_format_notifications', $action, $item_id, $secondary_item_id, $total_items );
|
352 |
Â
}
|
353 |
Â
add_action( 'bp_activity_sent_mention_email', 'bp_activity_at_mention_add_notification', 10, 5 );
|
354 |
Â
|
355 |
+
/**
|
356 |
+
* Notify a member one of their activity received a reply.
|
357 |
+
*
|
358 |
+
* @since 2.6.0
|
359 |
+
*
|
360 |
+
* @param BP_Activity_Activity $activity The original activity.
|
361 |
+
* @param int $comment_id ID for the newly received comment.
|
362 |
+
* @param int $commenter_id ID of the user who made the comment.
|
363 |
+
*/
|
364 |
+
function bp_activity_update_reply_add_notification( $activity, $comment_id, $commenter_id ) {
|
365 |
+
if ( bp_is_active( 'notifications' ) ) {
|
366 |
+
bp_notifications_add_notification( array(
|
367 |
+
'user_id' => $activity->user_id,
|
368 |
+
'item_id' => $activity->id,
|
369 |
+
'secondary_item_id' => $commenter_id,
|
370 |
+
'component_name' => buddypress()->activity->id,
|
371 |
+
'component_action' => 'update_reply',
|
372 |
+
'date_notified' => bp_core_current_time(),
|
373 |
+
'is_new' => 1,
|
374 |
+
) );
|
375 |
+
}
|
376 |
+
}
|
377 |
+
add_action( 'bp_activity_sent_reply_to_update_notification', 'bp_activity_update_reply_add_notification', 10, 3 );
|
378 |
+
|
379 |
+
/**
|
380 |
+
* Notify a member one of their activity comment received a reply.
|
381 |
+
*
|
382 |
+
* @since 2.6.0
|
383 |
+
*
|
384 |
+
* @param BP_Activity_Activity $activity_comment The parent activity.
|
385 |
+
* @param int $comment_id ID for the newly received comment.
|
386 |
+
* @param int $commenter_id ID of the user who made the comment.
|
387 |
+
*/
|
388 |
+
function bp_activity_comment_reply_add_notification( $activity_comment, $comment_id, $commenter_id ) {
|
389 |
+
if ( bp_is_active( 'notifications' ) ) {
|
390 |
+
bp_notifications_add_notification( array(
|
391 |
+
'user_id' => $activity_comment->user_id,
|
392 |
+
'item_id' => $activity_comment->item_id,
|
393 |
+
'secondary_item_id' => $commenter_id,
|
394 |
+
'component_name' => buddypress()->activity->id,
|
395 |
+
'component_action' => 'comment_reply',
|
396 |
+
'date_notified' => bp_core_current_time(),
|
397 |
+
'is_new' => 1,
|
398 |
+
) );
|
399 |
+
}
|
400 |
+
}
|
401 |
+
add_action( 'bp_activity_sent_reply_to_reply_notification', 'bp_activity_comment_reply_add_notification', 10, 3 );
|
402 |
+
|
403 |
Â
/**
|
404 |
Â
* Mark at-mention notifications as read when users visit their Mentions page.
|
405 |
Â
*
|
407 |
Â
* @since 2.5.0 Add the $user_id parameter
|
408 |
Â
*
|
409 |
Â
* @param int $user_id The id of the user whose notifications are marked as read.
|
Â
|
|
410 |
Â
*/
|
411 |
Â
function bp_activity_remove_screen_notifications( $user_id = 0 ) {
|
412 |
Â
if ( ! bp_is_active( 'notifications' ) ) {
|
426 |
Â
* Mark at-mention notification as read when user visits the activity with the mention.
|
427 |
Â
*
|
428 |
Â
* @since 2.0.0
|
429 |
+
* @since 2.6.0 Mark notifications for 'update_reply' and 'comment_reply' actions
|
430 |
Â
*
|
431 |
Â
* @param BP_Activity_Activity $activity Activity object.
|
432 |
Â
*/
|
439 |
Â
return;
|
440 |
Â
}
|
441 |
Â
|
442 |
+
/**
|
443 |
+
* Filter here to add the notification actions to mark as read
|
444 |
+
* when the single activity is displayed.
|
445 |
+
*
|
446 |
+
* @since 2.6.0
|
447 |
+
*
|
448 |
+
* @param array $value List of notification actions to mark as read.
|
449 |
+
*/
|
450 |
+
$notification_actions = apply_filters( 'bp_activity_notification_actions_single_activity', array(
|
451 |
+
'new_at_mention',
|
452 |
+
'update_reply',
|
453 |
+
'comment_reply',
|
454 |
+
) );
|
455 |
+
|
456 |
+
$user_id = bp_loggedin_user_id();
|
457 |
+
$component = buddypress()->activity->id;
|
458 |
+
|
459 |
+
foreach ( $notification_actions as $action ) {
|
460 |
+
// Mark as read any notifications for the current user related to this activity item.
|
461 |
+
bp_notifications_mark_notifications_by_item_id( $user_id, $activity->id, $component, $action );
|
462 |
+
}
|
463 |
Â
}
|
464 |
Â
add_action( 'bp_activity_screen_single_activity_permalink', 'bp_activity_remove_screen_notifications_single_activity_permalink' );
|
465 |
Â
|
@@ -14,20 +14,15 @@
|
|
14 |
Â
// Exit if accessed directly.
|
15 |
Â
defined( 'ABSPATH' ) || exit;
|
16 |
Â
|
17 |
-
|
Â
|
|
Â
|
|
18 |
Â
|
19 |
Â
/**
|
20 |
Â
* Load the Activity directory.
|
21 |
Â
*
|
22 |
Â
* @since 1.5.0
|
23 |
Â
*
|
24 |
-
* @uses bp_displayed_user_id()
|
25 |
-
* @uses bp_is_activity_component()
|
26 |
-
* @uses bp_current_action()
|
27 |
-
* @uses bp_update_is_directory()
|
28 |
-
* @uses do_action() To call the 'bp_activity_screen_index' hook.
|
29 |
-
* @uses bp_core_load_template()
|
30 |
-
* @uses apply_filters() To call the 'bp_activity_screen_index' hook.
|
31 |
Â
*/
|
32 |
Â
function bp_activity_screen_index() {
|
33 |
Â
if ( bp_is_activity_directory() ) {
|
@@ -57,9 +52,6 @@ add_action( 'bp_screens', 'bp_activity_screen_index' );
|
|
57 |
Â
*
|
58 |
Â
* @since 1.0.0
|
59 |
Â
*
|
60 |
-
* @uses do_action() To call the 'bp_activity_screen_my_activity' hook.
|
61 |
-
* @uses bp_core_load_template()
|
62 |
-
* @uses apply_filters() To call the 'bp_activity_template_my_activity' hook.
|
63 |
Â
*/
|
64 |
Â
function bp_activity_screen_my_activity() {
|
65 |
Â
|
@@ -85,12 +77,6 @@ function bp_activity_screen_my_activity() {
|
|
85 |
Â
*
|
86 |
Â
* @since 1.0.0
|
87 |
Â
*
|
88 |
-
* @uses bp_is_active()
|
89 |
-
* @uses bp_update_is_item_admin()
|
90 |
-
* @uses bp_current_user_can()
|
91 |
-
* @uses do_action() To call the 'bp_activity_screen_friends' hook.
|
92 |
-
* @uses bp_core_load_template()
|
93 |
-
* @uses apply_filters() To call the 'bp_activity_template_friends_activity' hook.
|
94 |
Â
*/
|
95 |
Â
function bp_activity_screen_friends() {
|
96 |
Â
if ( !bp_is_active( 'friends' ) )
|
@@ -120,12 +106,6 @@ function bp_activity_screen_friends() {
|
|
120 |
Â
*
|
121 |
Â
* @since 1.2.0
|
122 |
Â
*
|
123 |
-
* @uses bp_is_active()
|
124 |
-
* @uses bp_update_is_item_admin()
|
125 |
-
* @uses bp_current_user_can()
|
126 |
-
* @uses do_action() To call the 'bp_activity_screen_groups' hook.
|
127 |
-
* @uses bp_core_load_template()
|
128 |
-
* @uses apply_filters() To call the 'bp_activity_template_groups_activity' hook.
|
129 |
Â
*/
|
130 |
Â
function bp_activity_screen_groups() {
|
131 |
Â
if ( !bp_is_active( 'groups' ) )
|
@@ -155,11 +135,6 @@ function bp_activity_screen_groups() {
|
|
155 |
Â
*
|
156 |
Â
* @since 1.2.0
|
157 |
Â
*
|
158 |
-
* @uses bp_update_is_item_admin()
|
159 |
-
* @uses bp_current_user_can()
|
160 |
-
* @uses do_action() To call the 'bp_activity_screen_favorites' hook.
|
161 |
-
* @uses bp_core_load_template()
|
162 |
-
* @uses apply_filters() To call the 'bp_activity_template_favorite_activity' hook.
|
163 |
Â
*/
|
164 |
Â
function bp_activity_screen_favorites() {
|
165 |
Â
bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
|
@@ -186,11 +161,6 @@ function bp_activity_screen_favorites() {
|
|
186 |
Â
*
|
187 |
Â
* @since 1.2.0
|
188 |
Â
*
|
189 |
-
* @uses bp_update_is_item_admin()
|
190 |
-
* @uses bp_current_user_can()
|
191 |
-
* @uses do_action() To call the 'bp_activity_screen_mentions' hook.
|
192 |
-
* @uses bp_core_load_template()
|
193 |
-
* @uses apply_filters() To call the 'bp_activity_template_mention_activity' hook.
|
194 |
Â
*/
|
195 |
Â
function bp_activity_screen_mentions() {
|
196 |
Â
bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
|
@@ -217,9 +187,6 @@ function bp_activity_screen_mentions() {
|
|
217 |
Â
*
|
218 |
Â
* @since 1.5.0
|
219 |
Â
*
|
220 |
-
* @uses bp_is_my_profile()
|
221 |
-
* @uses bp_activity_clear_new_mentions()
|
222 |
-
* @uses bp_loggedin_user_id()
|
223 |
Â
*/
|
224 |
Â
function bp_activity_reset_my_new_mentions() {
|
225 |
Â
if ( bp_is_my_profile() )
|
@@ -232,25 +199,6 @@ add_action( 'bp_activity_screen_mentions', 'bp_activity_reset_my_new_mentions' )
|
|
232 |
Â
*
|
233 |
Â
* @since 1.2.0
|
234 |
Â
*
|
235 |
-
* @uses bp_is_activity_component()
|
236 |
-
* @uses bp_activity_get_specific()
|
237 |
-
* @uses bp_current_action()
|
238 |
-
* @uses bp_action_variables()
|
239 |
-
* @uses bp_do_404()
|
240 |
-
* @uses bp_is_active()
|
241 |
-
* @uses groups_get_group()
|
242 |
-
* @uses groups_is_user_member()
|
243 |
-
* @uses apply_filters_ref_array() To call the 'bp_activity_permalink_access' hook.
|
244 |
-
* @uses do_action() To call the 'bp_activity_screen_single_activity_permalink' hook.
|
245 |
-
* @uses bp_core_add_message()
|
246 |
-
* @uses is_user_logged_in()
|
247 |
-
* @uses bp_core_redirect()
|
248 |
-
* @uses site_url()
|
249 |
-
* @uses esc_url()
|
250 |
-
* @uses bp_get_root_domain()
|
251 |
-
* @uses bp_get_activity_root_slug()
|
252 |
-
* @uses bp_core_load_template()
|
253 |
-
* @uses apply_filters() To call the 'bp_activity_template_profile_activity_permalink' hook.
|
254 |
Â
*/
|
255 |
Â
function bp_activity_screen_single_activity_permalink() {
|
256 |
Â
$bp = buddypress();
|
@@ -301,6 +249,11 @@ function bp_activity_screen_single_activity_permalink() {
|
|
301 |
Â
}
|
302 |
Â
}
|
303 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
304 |
Â
/**
|
305 |
Â
* Filters the access permission for a single activity view.
|
306 |
Â
*
|
@@ -333,7 +286,7 @@ function bp_activity_screen_single_activity_permalink() {
|
|
333 |
Â
} else {
|
334 |
Â
$url = sprintf(
|
335 |
Â
site_url( 'wp-login.php?redirect_to=%s' ),
|
336 |
-
urlencode( esc_url_raw( bp_activity_get_permalink(
|
337 |
Â
);
|
338 |
Â
}
|
339 |
Â
|
@@ -356,9 +309,6 @@ add_action( 'bp_screens', 'bp_activity_screen_single_activity_permalink' );
|
|
356 |
Â
*
|
357 |
Â
* @since 1.2.0
|
358 |
Â
*
|
359 |
-
* @uses bp_get_user_meta()
|
360 |
-
* @uses bp_core_get_username()
|
361 |
-
* @uses do_action() To call the 'bp_activity_screen_notification_settings' hook.
|
362 |
Â
*/
|
363 |
Â
function bp_activity_screen_notification_settings() {
|
364 |
Â
|
@@ -389,16 +339,28 @@ function bp_activity_screen_notification_settings() {
|
|
389 |
Â
<tr id="activity-notification-settings-mentions">
|
390 |
Â
<td> </td>
|
391 |
Â
<td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( bp_displayed_user_id() ) ) ?></td>
|
392 |
-
<td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" id="notification-activity-new-mention-yes" value="yes" <?php checked( $mention, 'yes', true ) ?>/><label for="notification-activity-new-mention-yes" class="bp-screen-reader-text"><?php
|
393 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
394 |
Â
</tr>
|
395 |
Â
<?php endif; ?>
|
396 |
Â
|
397 |
Â
<tr id="activity-notification-settings-replies">
|
398 |
Â
<td> </td>
|
399 |
Â
<td><?php _e( "A member replies to an update or comment you've posted", 'buddypress' ) ?></td>
|
400 |
-
<td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" id="notification-activity-new-reply-yes" value="yes" <?php checked( $reply, 'yes', true ) ?>/><label for="notification-activity-new-reply-yes" class="bp-screen-reader-text"><?php
|
401 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
402 |
Â
</tr>
|
403 |
Â
|
404 |
Â
<?php
|
14 |
Â
// Exit if accessed directly.
|
15 |
Â
defined( 'ABSPATH' ) || exit;
|
16 |
Â
|
17 |
+
if ( ! buddypress()->do_autoload ) {
|
18 |
+
require dirname( __FILE__ ) . '/classes/class-bp-activity-theme-compat.php';
|
19 |
+
}
|
20 |
Â
|
21 |
Â
/**
|
22 |
Â
* Load the Activity directory.
|
23 |
Â
*
|
24 |
Â
* @since 1.5.0
|
25 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
26 |
Â
*/
|
27 |
Â
function bp_activity_screen_index() {
|
28 |
Â
if ( bp_is_activity_directory() ) {
|
52 |
Â
*
|
53 |
Â
* @since 1.0.0
|
54 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
55 |
Â
*/
|
56 |
Â
function bp_activity_screen_my_activity() {
|
57 |
Â
|
77 |
Â
*
|
78 |
Â
* @since 1.0.0
|
79 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
80 |
Â
*/
|
81 |
Â
function bp_activity_screen_friends() {
|
82 |
Â
if ( !bp_is_active( 'friends' ) )
|
106 |
Â
*
|
107 |
Â
* @since 1.2.0
|
108 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
109 |
Â
*/
|
110 |
Â
function bp_activity_screen_groups() {
|
111 |
Â
if ( !bp_is_active( 'groups' ) )
|
135 |
Â
*
|
136 |
Â
* @since 1.2.0
|
137 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
138 |
Â
*/
|
139 |
Â
function bp_activity_screen_favorites() {
|
140 |
Â
bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
|
161 |
Â
*
|
162 |
Â
* @since 1.2.0
|
163 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
164 |
Â
*/
|
165 |
Â
function bp_activity_screen_mentions() {
|
166 |
Â
bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' );
|
187 |
Â
*
|
188 |
Â
* @since 1.5.0
|
189 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
190 |
Â
*/
|
191 |
Â
function bp_activity_reset_my_new_mentions() {
|
192 |
Â
if ( bp_is_my_profile() )
|
199 |
Â
*
|
200 |
Â
* @since 1.2.0
|
201 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
202 |
Â
*/
|
203 |
Â
function bp_activity_screen_single_activity_permalink() {
|
204 |
Â
$bp = buddypress();
|
249 |
Â
}
|
250 |
Â
}
|
251 |
Â
|
252 |
+
// If activity author does not match displayed user, block access.
|
253 |
+
if ( true === $has_access && bp_displayed_user_id() !== $activity->user_id ) {
|
254 |
+
$has_access = false;
|
255 |
+
}
|
256 |
+
|
257 |
Â
/**
|
258 |
Â
* Filters the access permission for a single activity view.
|
259 |
Â
*
|
286 |
Â
} else {
|
287 |
Â
$url = sprintf(
|
288 |
Â
site_url( 'wp-login.php?redirect_to=%s' ),
|
289 |
+
urlencode( esc_url_raw( bp_activity_get_permalink( bp_current_action() ) ) )
|
290 |
Â
);
|
291 |
Â
}
|
292 |
Â
|
309 |
Â
*
|
310 |
Â
* @since 1.2.0
|
311 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
312 |
Â
*/
|
313 |
Â
function bp_activity_screen_notification_settings() {
|
314 |
Â
|
339 |
Â
<tr id="activity-notification-settings-mentions">
|
340 |
Â
<td> </td>
|
341 |
Â
<td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( bp_displayed_user_id() ) ) ?></td>
|
342 |
+
<td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" id="notification-activity-new-mention-yes" value="yes" <?php checked( $mention, 'yes', true ) ?>/><label for="notification-activity-new-mention-yes" class="bp-screen-reader-text"><?php
|
343 |
+
/* translators: accessibility text */
|
344 |
+
_e( 'Yes, send email', 'buddypress' );
|
345 |
+
?></label></td>
|
346 |
+
<td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" id="notification-activity-new-mention-no" value="no" <?php checked( $mention, 'no', true ) ?>/><label for="notification-activity-new-mention-no" class="bp-screen-reader-text"><?php
|
347 |
+
/* translators: accessibility text */
|
348 |
+
_e( 'No, do not send email', 'buddypress' );
|
349 |
+
?></label></td>
|
350 |
Â
</tr>
|
351 |
Â
<?php endif; ?>
|
352 |
Â
|
353 |
Â
<tr id="activity-notification-settings-replies">
|
354 |
Â
<td> </td>
|
355 |
Â
<td><?php _e( "A member replies to an update or comment you've posted", 'buddypress' ) ?></td>
|
356 |
+
<td class="yes"><input type="radio" name="notifications[notification_activity_new_reply]" id="notification-activity-new-reply-yes" value="yes" <?php checked( $reply, 'yes', true ) ?>/><label for="notification-activity-new-reply-yes" class="bp-screen-reader-text"><?php
|
357 |
+
/* translators: accessibility text */
|
358 |
+
_e( 'Yes, send email', 'buddypress' );
|
359 |
+
?></label></td>
|
360 |
+
<td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" id="notification-activity-new-reply-no" value="no" <?php checked( $reply, 'no', true ) ?>/><label for="notification-activity-new-reply-no" class="bp-screen-reader-text"><?php
|
361 |
+
/* translators: accessibility text */
|
362 |
+
_e( 'No, do not send email', 'buddypress' );
|
363 |
+
?></label></td>
|
364 |
Â
</tr>
|
365 |
Â
|
366 |
Â
<?php
|
@@ -10,14 +10,15 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Output the activity component slug.
|
17 |
Â
*
|
18 |
Â
* @since 1.5.0
|
19 |
Â
*
|
20 |
-
* @uses bp_get_activity_slug()
|
21 |
Â
*/
|
22 |
Â
function bp_activity_slug() {
|
23 |
Â
echo bp_get_activity_slug();
|
@@ -27,7 +28,6 @@ function bp_activity_slug() {
|
|
27 |
Â
*
|
28 |
Â
* @since 1.5.0
|
29 |
Â
*
|
30 |
-
* @uses apply_filters() To call the 'bp_get_activity_slug' hook.
|
31 |
Â
*
|
32 |
Â
* @return string The activity component slug.
|
33 |
Â
*/
|
@@ -48,7 +48,6 @@ function bp_activity_slug() {
|
|
48 |
Â
*
|
49 |
Â
* @since 1.5.0
|
50 |
Â
*
|
51 |
-
* @uses bp_get_activity_root_slug()
|
52 |
Â
*/
|
53 |
Â
function bp_activity_root_slug() {
|
54 |
Â
echo bp_get_activity_root_slug();
|
@@ -58,7 +57,6 @@ function bp_activity_root_slug() {
|
|
58 |
Â
*
|
59 |
Â
* @since 1.5.0
|
60 |
Â
*
|
61 |
-
* @uses apply_filters() To call the 'bp_get_activity_root_slug' hook.
|
62 |
Â
*
|
63 |
Â
* @return string The activity component root slug.
|
64 |
Â
*/
|
@@ -79,7 +77,6 @@ function bp_activity_root_slug() {
|
|
79 |
Â
*
|
80 |
Â
* @since 1.5.0
|
81 |
Â
*
|
82 |
-
* @uses bp_get_activity_directory_permalink()
|
83 |
Â
*/
|
84 |
Â
function bp_activity_directory_permalink() {
|
85 |
Â
echo esc_url( bp_get_activity_directory_permalink() );
|
@@ -89,10 +86,6 @@ function bp_activity_directory_permalink() {
|
|
89 |
Â
*
|
90 |
Â
* @since 1.5.0
|
91 |
Â
*
|
92 |
-
* @uses trailingslashit()
|
93 |
-
* @uses bp_get_root_domain()
|
94 |
-
* @uses bp_get_activity_root_slug()
|
95 |
-
* @uses apply_filters() To call the 'bp_get_activity_directory_permalink' hook.
|
96 |
Â
*
|
97 |
Â
* @return string Activity directory permalink.
|
98 |
Â
*/
|
@@ -119,17 +112,6 @@ function bp_activity_directory_permalink() {
|
|
119 |
Â
* @since 2.4.0 Introduced the `$fields` parameter.
|
120 |
Â
*
|
121 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
122 |
-
* @uses groups_is_user_member()
|
123 |
-
* @uses bp_current_action()
|
124 |
-
* @uses bp_is_current_action()
|
125 |
-
* @uses bp_get_activity_slug()
|
126 |
-
* @uses bp_action_variable()
|
127 |
-
* @uses wp_parse_args()
|
128 |
-
* @uses bp_is_active()
|
129 |
-
* @uses friends_get_friend_user_ids()
|
130 |
-
* @uses groups_get_user_groups()
|
131 |
-
* @uses bp_activity_get_user_favorites()
|
132 |
-
* @uses apply_filters() To call the 'bp_has_activities' hook.
|
133 |
Â
*
|
134 |
Â
* @param array|string $args {
|
135 |
Â
* Arguments for limiting the contents of the activity loop. Most arguments
|
@@ -388,7 +370,6 @@ function bp_has_activities( $args = '' ) {
|
|
388 |
Â
* @since 1.0.0
|
389 |
Â
*
|
390 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
391 |
-
* @uses BP_Activity_Template::user_activities() {@link BP_Activity_Template::user_activities()}
|
392 |
Â
*
|
393 |
Â
* @return bool Returns true when activities are found.
|
394 |
Â
*/
|
@@ -403,7 +384,6 @@ function bp_activities() {
|
|
403 |
Â
* @since 1.0.0
|
404 |
Â
*
|
405 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
406 |
-
* @uses BP_Activity_Template::the_activity() {@link BP_Activity_Template::the_activity()}
|
407 |
Â
*
|
408 |
Â
* @return object The current activity within the loop.
|
409 |
Â
*/
|
@@ -451,7 +431,6 @@ function bp_activity_load_more_link() {
|
|
451 |
Â
* @since 1.0.0
|
452 |
Â
*
|
453 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
454 |
-
* @uses BP_Activity_Template::the_activity() {@link BP_Activity_Template::the_activity()}
|
455 |
Â
*/
|
456 |
Â
function bp_activity_pagination_count() {
|
457 |
Â
echo bp_get_activity_pagination_count();
|
@@ -463,7 +442,6 @@ function bp_activity_pagination_count() {
|
|
463 |
Â
* @since 1.2.0
|
464 |
Â
*
|
465 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
466 |
-
* @uses bp_core_number_format()
|
467 |
Â
*
|
468 |
Â
* @return string The pagination text.
|
469 |
Â
*/
|
@@ -489,7 +467,6 @@ function bp_activity_pagination_count() {
|
|
489 |
Â
*
|
490 |
Â
* @since 1.0.0
|
491 |
Â
*
|
492 |
-
* @uses bp_get_activity_pagination_links()
|
493 |
Â
*/
|
494 |
Â
function bp_activity_pagination_links() {
|
495 |
Â
echo bp_get_activity_pagination_links();
|
@@ -501,7 +478,6 @@ function bp_activity_pagination_links() {
|
|
501 |
Â
* @since 1.0.0
|
502 |
Â
*
|
503 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
504 |
-
* @uses apply_filters() To call the 'bp_get_activity_pagination_links' hook.
|
505 |
Â
*
|
506 |
Â
* @return string The pagination links.
|
507 |
Â
*/
|
@@ -524,7 +500,6 @@ function bp_activity_pagination_links() {
|
|
524 |
Â
* @since 1.5.0
|
525 |
Â
*
|
526 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
527 |
-
* @uses apply_filters() To call the 'bp_activity_has_more_items' hook.
|
528 |
Â
*
|
529 |
Â
* @return bool $has_more_items True if more items, false if not.
|
530 |
Â
*/
|
@@ -558,7 +533,6 @@ function bp_activity_has_more_items() {
|
|
558 |
Â
*
|
559 |
Â
* @since 1.2.0
|
560 |
Â
*
|
561 |
-
* @uses bp_get_activity_count()
|
562 |
Â
*/
|
563 |
Â
function bp_activity_count() {
|
564 |
Â
echo bp_get_activity_count();
|
@@ -570,7 +544,6 @@ function bp_activity_count() {
|
|
570 |
Â
* @since 1.2.0
|
571 |
Â
*
|
572 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
573 |
-
* @uses apply_filters() To call the 'bp_get_activity_count' hook.
|
574 |
Â
*
|
575 |
Â
* @return int The activity count.
|
576 |
Â
*/
|
@@ -592,7 +565,6 @@ function bp_activity_count() {
|
|
592 |
Â
*
|
593 |
Â
* @since 1.2.0
|
594 |
Â
*
|
595 |
-
* @uses bp_get_activity_per_page()
|
596 |
Â
*/
|
597 |
Â
function bp_activity_per_page() {
|
598 |
Â
echo bp_get_activity_per_page();
|
@@ -604,7 +576,6 @@ function bp_activity_per_page() {
|
|
604 |
Â
* @since 1.2.0
|
605 |
Â
*
|
606 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
607 |
-
* @uses apply_filters() To call the 'bp_get_activity_per_page' hook.
|
608 |
Â
*
|
609 |
Â
* @return int The activities per page.
|
610 |
Â
*/
|
@@ -626,7 +597,6 @@ function bp_activity_per_page() {
|
|
626 |
Â
*
|
627 |
Â
* @since 1.0.0
|
628 |
Â
*
|
629 |
-
* @uses bp_get_activities_title()
|
630 |
Â
* @todo Deprecate.
|
631 |
Â
*/
|
632 |
Â
function bp_activities_title() {
|
@@ -639,7 +609,6 @@ function bp_activities_title() {
|
|
639 |
Â
* @since 1.0.0
|
640 |
Â
*
|
641 |
Â
* @global string $bp_activity_title
|
642 |
-
* @uses apply_filters() To call the 'bp_get_activities_title' hook.
|
643 |
Â
* @todo Deprecate.
|
644 |
Â
*
|
645 |
Â
* @return string The activities title.
|
@@ -662,7 +631,6 @@ function bp_activities_title() {
|
|
662 |
Â
*
|
663 |
Â
* @since 1.0.0
|
664 |
Â
*
|
665 |
-
* @uses bp_get_activities_no_activity()
|
666 |
Â
* @todo Deprecate.
|
667 |
Â
*/
|
668 |
Â
function bp_activities_no_activity() {
|
@@ -675,7 +643,6 @@ function bp_activities_no_activity() {
|
|
675 |
Â
* @since 1.0.0
|
676 |
Â
*
|
677 |
Â
* @global string $bp_activity_no_activity
|
678 |
-
* @uses apply_filters() To call the 'bp_get_activities_no_activity' hook.
|
679 |
Â
* @todo Deprecate.
|
680 |
Â
*
|
681 |
Â
* @return string
|
@@ -698,7 +665,6 @@ function bp_activities_no_activity() {
|
|
698 |
Â
*
|
699 |
Â
* @since 1.2.0
|
700 |
Â
*
|
701 |
-
* @uses bp_get_activity_id()
|
702 |
Â
*/
|
703 |
Â
function bp_activity_id() {
|
704 |
Â
echo bp_get_activity_id();
|
@@ -710,7 +676,6 @@ function bp_activity_id() {
|
|
710 |
Â
* @since 1.2.0
|
711 |
Â
*
|
712 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
713 |
-
* @uses apply_filters() To call the 'bp_get_activity_id' hook.
|
714 |
Â
*
|
715 |
Â
* @return int The activity ID.
|
716 |
Â
*/
|
@@ -732,7 +697,6 @@ function bp_activity_id() {
|
|
732 |
Â
*
|
733 |
Â
* @since 1.2.0
|
734 |
Â
*
|
735 |
-
* @uses bp_get_activity_item_id()
|
736 |
Â
*/
|
737 |
Â
function bp_activity_item_id() {
|
738 |
Â
echo bp_get_activity_item_id();
|
@@ -744,7 +708,6 @@ function bp_activity_item_id() {
|
|
744 |
Â
* @since 1.2.0
|
745 |
Â
*
|
746 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
747 |
-
* @uses apply_filters() To call the 'bp_get_activity_item_id' hook.
|
748 |
Â
*
|
749 |
Â
* @return int The activity item ID.
|
750 |
Â
*/
|
@@ -766,7 +729,6 @@ function bp_activity_item_id() {
|
|
766 |
Â
*
|
767 |
Â
* @since 1.2.0
|
768 |
Â
*
|
769 |
-
* @uses bp_get_activity_secondary_item_id()
|
770 |
Â
*/
|
771 |
Â
function bp_activity_secondary_item_id() {
|
772 |
Â
echo bp_get_activity_secondary_item_id();
|
@@ -778,7 +740,6 @@ function bp_activity_secondary_item_id() {
|
|
778 |
Â
* @since 1.2.0
|
779 |
Â
*
|
780 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
781 |
-
* @uses apply_filters() To call the 'bp_get_activity_secondary_item_id' hook.
|
782 |
Â
*
|
783 |
Â
* @return int The activity secondary item ID.
|
784 |
Â
*/
|
@@ -800,7 +761,6 @@ function bp_activity_secondary_item_id() {
|
|
800 |
Â
*
|
801 |
Â
* @since 1.2.0
|
802 |
Â
*
|
803 |
-
* @uses bp_get_activity_date_recorded()
|
804 |
Â
*/
|
805 |
Â
function bp_activity_date_recorded() {
|
806 |
Â
echo bp_get_activity_date_recorded();
|
@@ -812,7 +772,6 @@ function bp_activity_date_recorded() {
|
|
812 |
Â
* @since 1.2.0
|
813 |
Â
*
|
814 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
815 |
-
* @uses apply_filters() To call the 'bp_get_activity_date_recorded' hook.
|
816 |
Â
*
|
817 |
Â
* @return string The date the activity was recorded.
|
818 |
Â
*/
|
@@ -834,7 +793,6 @@ function bp_activity_date_recorded() {
|
|
834 |
Â
*
|
835 |
Â
* @since 2.1.0
|
836 |
Â
*
|
837 |
-
* @uses bp_get_activity_member_display_name()
|
838 |
Â
*/
|
839 |
Â
function bp_activity_member_display_name() {
|
840 |
Â
echo bp_get_activity_member_display_name();
|
@@ -846,7 +804,6 @@ function bp_activity_member_display_name() {
|
|
846 |
Â
* @since 2.1.0
|
847 |
Â
*
|
848 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
849 |
-
* @uses apply_filters() To call the 'bp_get_activity_member_display_name' hook.
|
850 |
Â
*
|
851 |
Â
* @return string The date the activity was recorded.
|
852 |
Â
*/
|
@@ -872,7 +829,6 @@ function bp_activity_member_display_name() {
|
|
872 |
Â
*
|
873 |
Â
* @since 1.2.0
|
874 |
Â
*
|
875 |
-
* @uses bp_get_activity_object_name()
|
876 |
Â
*/
|
877 |
Â
function bp_activity_object_name() {
|
878 |
Â
echo bp_get_activity_object_name();
|
@@ -884,7 +840,6 @@ function bp_activity_object_name() {
|
|
884 |
Â
* @since 1.2.0
|
885 |
Â
*
|
886 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
887 |
-
* @uses apply_filters() To call the 'bp_get_activity_object_name' hook.
|
888 |
Â
*
|
889 |
Â
* @return string The activity object name.
|
890 |
Â
*/
|
@@ -906,7 +861,6 @@ function bp_activity_object_name() {
|
|
906 |
Â
*
|
907 |
Â
* @since 1.2.0
|
908 |
Â
*
|
909 |
-
* @uses bp_get_activity_type()
|
910 |
Â
*/
|
911 |
Â
function bp_activity_type() {
|
912 |
Â
echo bp_get_activity_type();
|
@@ -918,7 +872,6 @@ function bp_activity_type() {
|
|
918 |
Â
* @since 1.2.0
|
919 |
Â
*
|
920 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
921 |
-
* @uses apply_filters() To call the 'bp_get_activity_type' hook.
|
922 |
Â
*
|
923 |
Â
* @return string The activity type.
|
924 |
Â
*/
|
@@ -946,7 +899,6 @@ function bp_activity_type() {
|
|
946 |
Â
* @todo Properly deprecate in favor of bp_activity_type() and
|
947 |
Â
* remove redundant echo
|
948 |
Â
*
|
949 |
-
* @uses bp_activity_type()
|
950 |
Â
*/
|
951 |
Â
function bp_activity_action_name() { echo bp_activity_type(); }
|
952 |
Â
|
@@ -960,7 +912,6 @@ function bp_activity_type() {
|
|
960 |
Â
*
|
961 |
Â
* @todo Properly deprecate in favor of bp_get_activity_type().
|
962 |
Â
*
|
963 |
-
* @uses bp_get_activity_type()
|
964 |
Â
*
|
965 |
Â
* @return string The activity type.
|
966 |
Â
*/
|
@@ -971,7 +922,6 @@ function bp_activity_type() {
|
|
971 |
Â
*
|
972 |
Â
* @since 1.1.0
|
973 |
Â
*
|
974 |
-
* @uses bp_get_activity_user_id()
|
975 |
Â
*/
|
976 |
Â
function bp_activity_user_id() {
|
977 |
Â
echo bp_get_activity_user_id();
|
@@ -983,7 +933,6 @@ function bp_activity_user_id() {
|
|
983 |
Â
* @since 1.1.0
|
984 |
Â
*
|
985 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
986 |
-
* @uses apply_filters() To call the 'bp_get_activity_user_id' hook.
|
987 |
Â
*
|
988 |
Â
* @return int The activity user ID.
|
989 |
Â
*/
|
@@ -1005,7 +954,6 @@ function bp_activity_user_id() {
|
|
1005 |
Â
*
|
1006 |
Â
* @since 1.2.0
|
1007 |
Â
*
|
1008 |
-
* @uses bp_get_activity_user_link()
|
1009 |
Â
*/
|
1010 |
Â
function bp_activity_user_link() {
|
1011 |
Â
echo bp_get_activity_user_link();
|
@@ -1017,8 +965,6 @@ function bp_activity_user_link() {
|
|
1017 |
Â
* @since 1.2.0
|
1018 |
Â
*
|
1019 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1020 |
-
* @uses bp_core_get_user_domain()
|
1021 |
-
* @uses apply_filters() To call the 'bp_get_activity_user_link' hook.
|
1022 |
Â
*
|
1023 |
Â
* @return string $link The activity user link.
|
1024 |
Â
*/
|
@@ -1047,7 +993,6 @@ function bp_activity_user_link() {
|
|
1047 |
Â
* @since 1.1.0
|
1048 |
Â
*
|
1049 |
Â
* @see bp_get_activity_avatar() for description of arguments.
|
1050 |
-
* @uses bp_get_activity_avatar()
|
1051 |
Â
*
|
1052 |
Â
* @param array|string $args See {@link bp_get_activity_avatar()} for description.
|
1053 |
Â
*/
|
@@ -1061,12 +1006,6 @@ function bp_activity_avatar( $args = '' ) {
|
|
1061 |
Â
*
|
1062 |
Â
* @see bp_core_fetch_avatar() For a description of the arguments.
|
1063 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1064 |
-
* @uses bp_is_single_activity()
|
1065 |
-
* @uses wp_parse_args()
|
1066 |
-
* @uses apply_filters() To call the 'bp_get_activity_avatar_object_' . $current_activity_item->component hook.
|
1067 |
-
* @uses apply_filters() To call the 'bp_get_activity_avatar_item_id' hook.
|
1068 |
-
* @uses bp_core_fetch_avatar()
|
1069 |
-
* @uses apply_filters() To call the 'bp_get_activity_avatar' hook.
|
1070 |
Â
*
|
1071 |
Â
* @param array|string $args {
|
1072 |
Â
* Arguments are listed here with an explanation of their defaults.
|
@@ -1162,7 +1101,7 @@ function bp_activity_avatar( $args = '' ) {
|
|
1162 |
Â
*
|
1163 |
Â
* @since 1.1.3
|
1164 |
Â
*
|
1165 |
-
* @param array $value
|
1166 |
Â
*/
|
1167 |
Â
return apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array(
|
1168 |
Â
'item_id' => $item_id,
|
@@ -1182,7 +1121,6 @@ function bp_activity_avatar( $args = '' ) {
|
|
1182 |
Â
* @since 1.2.0
|
1183 |
Â
*
|
1184 |
Â
* @see bp_get_activity_secondary_avatar() for description of arguments.
|
1185 |
-
* @uses bp_get_activity_secondary_avatar()
|
1186 |
Â
*
|
1187 |
Â
* @param array|string $args See {@link bp_get_activity_secondary_avatar} for description.
|
1188 |
Â
*/
|
@@ -1197,12 +1135,6 @@ function bp_activity_secondary_avatar( $args = '' ) {
|
|
1197 |
Â
*
|
1198 |
Â
* @see bp_core_fetch_avatar() for description of arguments.
|
1199 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1200 |
-
* @uses wp_parse_args()
|
1201 |
-
* @uses get_blog_option()
|
1202 |
-
* @uses apply_filters() To call the 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component hook.
|
1203 |
-
* @uses apply_filters() To call the 'bp_get_activity_secondary_avatar_item_id' hook.
|
1204 |
-
* @uses bp_core_fetch_avatar()
|
1205 |
-
* @uses apply_filters() To call the 'bp_get_activity_secondary_avatar' hook.
|
1206 |
Â
*
|
1207 |
Â
* @param array|string $args {
|
1208 |
Â
* For a complete description of arguments, see {@link bp_core_fetch_avatar()}.
|
@@ -1373,7 +1305,6 @@ function bp_activity_secondary_avatar( $args = '' ) {
|
|
1373 |
Â
* @since 1.2.0
|
1374 |
Â
*
|
1375 |
Â
* @param array $args See bp_get_activity_action().
|
1376 |
-
* @uses bp_get_activity_action()
|
1377 |
Â
*/
|
1378 |
Â
function bp_activity_action( $args = array() ) {
|
1379 |
Â
echo bp_get_activity_action( $args );
|
@@ -1385,9 +1316,6 @@ function bp_activity_action( $args = array() ) {
|
|
1385 |
Â
* @since 1.2.0
|
1386 |
Â
*
|
1387 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1388 |
-
* @uses apply_filters_ref_array() To call the 'bp_get_activity_action_pre_meta' hook.
|
1389 |
-
* @uses bp_insert_activity_meta()
|
1390 |
-
* @uses apply_filters_ref_array() To call the 'bp_get_activity_action' hook.
|
1391 |
Â
*
|
1392 |
Â
* @param array $args {
|
1393 |
Â
* @type bool $no_timestamp Whether to exclude the timestamp.
|
@@ -1439,7 +1367,6 @@ function bp_activity_action( $args = array() ) {
|
|
1439 |
Â
*
|
1440 |
Â
* @since 1.2.0
|
1441 |
Â
*
|
1442 |
-
* @uses bp_get_activity_content_body()
|
1443 |
Â
*/
|
1444 |
Â
function bp_activity_content_body() {
|
1445 |
Â
echo bp_get_activity_content_body();
|
@@ -1451,8 +1378,6 @@ function bp_activity_content_body() {
|
|
1451 |
Â
* @since 1.2.0
|
1452 |
Â
*
|
1453 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1454 |
-
* @uses bp_insert_activity_meta()
|
1455 |
-
* @uses apply_filters_ref_array() To call the 'bp_get_activity_content_body' hook.
|
1456 |
Â
*
|
1457 |
Â
* @return string The activity content body.
|
1458 |
Â
*/
|
@@ -1501,7 +1426,6 @@ function bp_activity_has_content() {
|
|
1501 |
Â
*
|
1502 |
Â
* @todo properly deprecate this function.
|
1503 |
Â
*
|
1504 |
-
* @uses bp_get_activity_content()
|
1505 |
Â
*/
|
1506 |
Â
function bp_activity_content() {
|
1507 |
Â
echo bp_get_activity_content();
|
@@ -1515,9 +1439,6 @@ function bp_activity_content() {
|
|
1515 |
Â
*
|
1516 |
Â
* @todo properly deprecate this function.
|
1517 |
Â
*
|
1518 |
-
* @uses bp_get_activity_action()
|
1519 |
-
* @uses bp_get_activity_content_body()
|
1520 |
-
* @uses apply_filters() To call the 'bp_get_activity_content' hook.
|
1521 |
Â
*
|
1522 |
Â
* @return string The activity content.
|
1523 |
Â
*/
|
@@ -1542,13 +1463,6 @@ function bp_activity_content() {
|
|
1542 |
Â
* @since 1.2.0
|
1543 |
Â
*
|
1544 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1545 |
-
* @uses bp_core_time_since()
|
1546 |
-
* @uses apply_filters_ref_array() To call the 'bp_activity_time_since' hook.
|
1547 |
-
* @uses bp_is_single_activity()
|
1548 |
-
* @uses bp_activity_get_permalink()
|
1549 |
-
* @uses esc_attr__()
|
1550 |
-
* @uses apply_filters_ref_array() To call the 'bp_activity_permalink' hook.
|
1551 |
-
* @uses apply_filters() To call the 'bp_insert_activity_meta' hook.
|
1552 |
Â
*
|
1553 |
Â
* @param string $content The activity content.
|
1554 |
Â
* @return string The activity content with the metadata string attached.
|
@@ -1618,7 +1532,6 @@ function bp_insert_activity_meta( $content = '' ) {
|
|
1618 |
Â
* @since 1.2.0
|
1619 |
Â
*
|
1620 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1621 |
-
* @uses apply_filters() To call the 'bp_activity_user_can_delete' hook.
|
1622 |
Â
*
|
1623 |
Â
* @param object|bool $activity Optional. Falls back on the current item in the loop.
|
1624 |
Â
* @return bool True if can delete, false otherwise.
|
@@ -1650,7 +1563,7 @@ function bp_activity_user_can_delete( $activity = false ) {
|
|
1650 |
Â
// Users are allowed to delete their own activity. This is actually
|
1651 |
Â
// quite powerful, because doing so also deletes all comments to that
|
1652 |
Â
// activity item. We should revisit this eventually.
|
1653 |
-
if ( isset( $activity->user_id ) && (
|
1654 |
Â
$can_delete = true;
|
1655 |
Â
}
|
1656 |
Â
|
@@ -1677,7 +1590,6 @@ function bp_activity_user_can_delete( $activity = false ) {
|
|
1677 |
Â
* @since 1.2.0
|
1678 |
Â
*
|
1679 |
Â
* @see bp_get_activity_parent_content() for a description of arguments.
|
1680 |
-
* @uses bp_get_activity_parent_content()
|
1681 |
Â
*
|
1682 |
Â
* @param array|string $args See {@link bp_get_activity_parent_content} for description.
|
1683 |
Â
*/
|
@@ -1691,7 +1603,6 @@ function bp_activity_parent_content( $args = '' ) {
|
|
1691 |
Â
* @since 1.2.0
|
1692 |
Â
*
|
1693 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1694 |
-
* @uses apply_filters() To call the 'bp_get_activity_parent_content' hook.
|
1695 |
Â
*
|
1696 |
Â
* @param string $args Unused. Left over from an earlier implementation.
|
1697 |
Â
* @return mixed False on failure, otherwise the activity parent content.
|
@@ -1705,7 +1616,7 @@ function bp_activity_parent_content( $args = '' ) {
|
|
1705 |
Â
}
|
1706 |
Â
|
1707 |
Â
// Get the ID of the parent activity content.
|
1708 |
-
$parent_id =
|
1709 |
Â
|
1710 |
Â
// Bail if no parent content.
|
1711 |
Â
if ( empty( $activities_template->activity_parents[ $parent_id ] ) ) {
|
@@ -1769,7 +1680,7 @@ function bp_activity_parent_user_id() {
|
|
1769 |
Â
}
|
1770 |
Â
|
1771 |
Â
// Get the ID of the parent activity content.
|
1772 |
-
$parent_id =
|
1773 |
Â
|
1774 |
Â
// Bail if no parent item.
|
1775 |
Â
if ( empty( $activities_template->activity_parents[ $parent_id ] ) ) {
|
@@ -1798,7 +1709,6 @@ function bp_activity_parent_user_id() {
|
|
1798 |
Â
*
|
1799 |
Â
* @since 1.2.0
|
1800 |
Â
*
|
1801 |
-
* @uses bp_get_activity_is_favorite()
|
1802 |
Â
*/
|
1803 |
Â
function bp_activity_is_favorite() {
|
1804 |
Â
echo bp_get_activity_is_favorite();
|
@@ -1810,7 +1720,6 @@ function bp_activity_is_favorite() {
|
|
1810 |
Â
* @since 1.2.0
|
1811 |
Â
*
|
1812 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1813 |
-
* @uses apply_filters() To call the 'bp_get_activity_is_favorite' hook.
|
1814 |
Â
*
|
1815 |
Â
* @return bool True if user favorite, false otherwise.
|
1816 |
Â
*/
|
@@ -1850,7 +1759,6 @@ function bp_activity_comments( $args = '' ) {
|
|
1850 |
Â
* this function can probably be streamlined or removed.
|
1851 |
Â
*
|
1852 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1853 |
-
* @uses bp_activity_recurse_comments()
|
1854 |
Â
*
|
1855 |
Â
* @param string $args Unused. Left over from an earlier implementation.
|
1856 |
Â
* @return bool
|
@@ -1874,7 +1782,6 @@ function bp_activity_comments( $args = '' ) {
|
|
1874 |
Â
* @since 1.2.0
|
1875 |
Â
*
|
1876 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1877 |
-
* @uses locate_template()
|
1878 |
Â
*
|
1879 |
Â
* @param object $comment The activity object currently being recursed.
|
1880 |
Â
* @return bool|string
|
@@ -1934,7 +1841,6 @@ function bp_activity_comments( $args = '' ) {
|
|
1934 |
Â
* @since 1.5.0
|
1935 |
Â
*
|
1936 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1937 |
-
* @uses apply_filters() To call the 'bp_activity_current_comment' hook.
|
1938 |
Â
*
|
1939 |
Â
* @return object|bool $current_comment The activity comment currently being
|
1940 |
Â
* displayed. False on failure.
|
@@ -1962,7 +1868,6 @@ function bp_activity_current_comment() {
|
|
1962 |
Â
*
|
1963 |
Â
* @since 1.5.0
|
1964 |
Â
*
|
1965 |
-
* @uses bp_get_activity_comment_id()
|
1966 |
Â
*/
|
1967 |
Â
function bp_activity_comment_id() {
|
1968 |
Â
echo bp_get_activity_comment_id();
|
@@ -1974,7 +1879,6 @@ function bp_activity_comment_id() {
|
|
1974 |
Â
* @since 1.5.0
|
1975 |
Â
*
|
1976 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
1977 |
-
* @uses apply_filters() To call the 'bp_activity_comment_id' hook.
|
1978 |
Â
*
|
1979 |
Â
* @return int|bool $comment_id The ID of the activity comment currently
|
1980 |
Â
* being displayed, false if none is found.
|
@@ -1999,7 +1903,6 @@ function bp_activity_comment_id() {
|
|
1999 |
Â
*
|
2000 |
Â
* @since 1.5.0
|
2001 |
Â
*
|
2002 |
-
* @uses bp_get_activity_comment_user_id()
|
2003 |
Â
*/
|
2004 |
Â
function bp_activity_comment_user_id() {
|
2005 |
Â
echo bp_get_activity_comment_user_id();
|
@@ -2011,7 +1914,6 @@ function bp_activity_comment_user_id() {
|
|
2011 |
Â
* @since 1.5.0
|
2012 |
Â
*
|
2013 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
2014 |
-
* @uses apply_filters() To call the 'bp_activity_comment_user_id' hook.
|
2015 |
Â
*
|
2016 |
Â
* @return int|bool $user_id The user_id of the author of the displayed
|
2017 |
Â
* activity comment. False on failure.
|
@@ -2036,7 +1938,6 @@ function bp_activity_comment_user_id() {
|
|
2036 |
Â
*
|
2037 |
Â
* @since 1.5.0
|
2038 |
Â
*
|
2039 |
-
* @uses bp_get_activity_comment_user_link()
|
2040 |
Â
*/
|
2041 |
Â
function bp_activity_comment_user_link() {
|
2042 |
Â
echo bp_get_activity_comment_user_link();
|
@@ -2047,9 +1948,6 @@ function bp_activity_comment_user_link() {
|
|
2047 |
Â
*
|
2048 |
Â
* @since 1.5.0
|
2049 |
Â
*
|
2050 |
-
* @uses bp_core_get_user_domain()
|
2051 |
-
* @uses bp_get_activity_comment_user_id()
|
2052 |
-
* @uses apply_filters() To call the 'bp_activity_comment_user_link' hook.
|
2053 |
Â
*
|
2054 |
Â
* @return string $user_link The URL of the activity comment author's profile.
|
2055 |
Â
*/
|
@@ -2071,7 +1969,6 @@ function bp_activity_comment_user_link() {
|
|
2071 |
Â
*
|
2072 |
Â
* @since 1.5.0
|
2073 |
Â
*
|
2074 |
-
* @uses bp_get_activity_comment_name()
|
2075 |
Â
*/
|
2076 |
Â
function bp_activity_comment_name() {
|
2077 |
Â
echo bp_get_activity_comment_name();
|
@@ -2086,8 +1983,6 @@ function bp_activity_comment_name() {
|
|
2086 |
Â
* @since 1.5.0
|
2087 |
Â
*
|
2088 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
2089 |
-
* @uses apply_filters() To call the 'bp_acomment_name' hook.
|
2090 |
-
* @uses apply_filters() To call the 'bp_activity_comment_name' hook.
|
2091 |
Â
*
|
2092 |
Â
* @return string $name The full name of the activity comment author.
|
2093 |
Â
*/
|
@@ -2116,7 +2011,6 @@ function bp_activity_comment_name() {
|
|
2116 |
Â
*
|
2117 |
Â
* @since 1.5.0
|
2118 |
Â
*
|
2119 |
-
* @uses bp_get_activity_comment_date_recorded()
|
2120 |
Â
*/
|
2121 |
Â
function bp_activity_comment_date_recorded() {
|
2122 |
Â
echo bp_get_activity_comment_date_recorded();
|
@@ -2127,8 +2021,6 @@ function bp_activity_comment_date_recorded() {
|
|
2127 |
Â
*
|
2128 |
Â
* @since 1.5.0
|
2129 |
Â
*
|
2130 |
-
* @uses bp_core_time_since()
|
2131 |
-
* @uses apply_filters() To call the 'bp_activity_comment_date_recorded' hook.
|
2132 |
Â
*
|
2133 |
Â
* @return string|bool $date_recorded Time since the activity was recorded,
|
2134 |
Â
* in the form "%s ago". False on failure.
|
@@ -2150,7 +2042,6 @@ function bp_activity_comment_date_recorded() {
|
|
2150 |
Â
*
|
2151 |
Â
* @since 2.3.0
|
2152 |
Â
*
|
2153 |
-
* @uses bp_get_activity_comment_date_recorded()
|
2154 |
Â
*/
|
2155 |
Â
function bp_activity_comment_date_recorded_raw() {
|
2156 |
Â
echo bp_get_activity_comment_date_recorded_raw();
|
@@ -2162,8 +2053,6 @@ function bp_activity_comment_date_recorded_raw() {
|
|
2162 |
Â
* @since 2.3.0
|
2163 |
Â
*
|
2164 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
2165 |
-
* @uses bp_core_time_since()
|
2166 |
-
* @uses apply_filters() To call the 'bp_activity_comment_date_recorded' hook.
|
2167 |
Â
*
|
2168 |
Â
* @return string|bool $date_recorded Time since the activity was recorded,
|
2169 |
Â
* in the form "%s ago". False on failure.
|
@@ -2186,7 +2075,6 @@ function bp_activity_comment_date_recorded_raw() {
|
|
2186 |
Â
*
|
2187 |
Â
* @since 1.5.0
|
2188 |
Â
*
|
2189 |
-
* @uses bp_get_activity_comment_delete_link()
|
2190 |
Â
*/
|
2191 |
Â
function bp_activity_comment_delete_link() {
|
2192 |
Â
echo bp_get_activity_comment_delete_link();
|
@@ -2197,11 +2085,6 @@ function bp_activity_comment_delete_link() {
|
|
2197 |
Â
*
|
2198 |
Â
* @since 1.5.0
|
2199 |
Â
*
|
2200 |
-
* @uses wp_nonce_url()
|
2201 |
-
* @uses bp_get_root_domain()
|
2202 |
-
* @uses bp_get_activity_slug()
|
2203 |
-
* @uses bp_get_activity_comment_id()
|
2204 |
-
* @uses apply_filters() To call the 'bp_activity_comment_delete_link' hook.
|
2205 |
Â
*
|
2206 |
Â
* @return string $link The nonced URL for deleting the current
|
2207 |
Â
* activity comment.
|
@@ -2224,7 +2107,6 @@ function bp_activity_comment_delete_link() {
|
|
2224 |
Â
*
|
2225 |
Â
* @since 1.5.0
|
2226 |
Â
*
|
2227 |
-
* @uses bp_get_activity_comment_content()
|
2228 |
Â
*/
|
2229 |
Â
function bp_activity_comment_content() {
|
2230 |
Â
echo bp_get_activity_comment_content();
|
@@ -2241,8 +2123,6 @@ function bp_activity_comment_content() {
|
|
2241 |
Â
* @since 1.5.0
|
2242 |
Â
*
|
2243 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
2244 |
-
* @uses apply_filters() To call the 'bp_get_activity_content' hook.
|
2245 |
-
* @uses apply_filters() To call the 'bp_activity_comment_content' hook.
|
2246 |
Â
*
|
2247 |
Â
* @return string $content The content of the current activity comment.
|
2248 |
Â
*/
|
@@ -2267,7 +2147,6 @@ function bp_activity_comment_content() {
|
|
2267 |
Â
*
|
2268 |
Â
* @since 1.2.0
|
2269 |
Â
*
|
2270 |
-
* @uses bp_activity_get_comment_count()
|
2271 |
Â
*/
|
2272 |
Â
function bp_activity_comment_count() {
|
2273 |
Â
echo bp_activity_get_comment_count();
|
@@ -2279,8 +2158,6 @@ function bp_activity_comment_count() {
|
|
2279 |
Â
* @since 1.2.0
|
2280 |
Â
*
|
2281 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
2282 |
-
* @uses bp_activity_recurse_comment_count()
|
2283 |
-
* @uses apply_filters() To call the 'bp_activity_get_comment_count' hook.
|
2284 |
Â
*
|
2285 |
Â
* @param array|null $deprecated Deprecated.
|
2286 |
Â
* @return int $count The activity comment count.
|
@@ -2316,8 +2193,6 @@ function bp_activity_comment_count() {
|
|
2316 |
Â
*
|
2317 |
Â
* @since 1.2.0
|
2318 |
Â
*
|
2319 |
-
* @uses bp_activity_recurse_comment_count()
|
2320 |
-
* @uses apply_filters() To call the 'bp_activity_recurse_comment_count' hook.
|
2321 |
Â
*
|
2322 |
Â
* @param object $comment Activity comment object.
|
2323 |
Â
* @param int $count The current iteration count.
|
@@ -2381,7 +2256,6 @@ function bp_activity_comment_depth() {
|
|
2381 |
Â
*
|
2382 |
Â
* @since 1.2.0
|
2383 |
Â
*
|
2384 |
-
* @uses bp_get_activity_comment_link()
|
2385 |
Â
*/
|
2386 |
Â
function bp_activity_comment_link() {
|
2387 |
Â
echo bp_get_activity_comment_link();
|
@@ -2393,7 +2267,6 @@ function bp_activity_comment_link() {
|
|
2393 |
Â
* @since 1.2.0
|
2394 |
Â
*
|
2395 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
2396 |
-
* @uses apply_filters() To call the 'bp_get_activity_comment_link' hook.
|
2397 |
Â
*
|
2398 |
Â
* @return string The activity comment link.
|
2399 |
Â
*/
|
@@ -2415,7 +2288,6 @@ function bp_activity_comment_link() {
|
|
2415 |
Â
*
|
2416 |
Â
* @since 1.2.0
|
2417 |
Â
*
|
2418 |
-
* @uses bp_get_activity_comment_form_nojs_display()
|
2419 |
Â
*/
|
2420 |
Â
function bp_activity_comment_form_nojs_display() {
|
2421 |
Â
echo bp_get_activity_comment_form_nojs_display();
|
@@ -2446,7 +2318,6 @@ function bp_activity_comment_form_nojs_display() {
|
|
2446 |
Â
*
|
2447 |
Â
* @since 1.2.0
|
2448 |
Â
*
|
2449 |
-
* @uses bp_get_activity_comment_form_action()
|
2450 |
Â
*/
|
2451 |
Â
function bp_activity_comment_form_action() {
|
2452 |
Â
echo bp_get_activity_comment_form_action();
|
@@ -2457,9 +2328,6 @@ function bp_activity_comment_form_action() {
|
|
2457 |
Â
*
|
2458 |
Â
* @since 1.2.0
|
2459 |
Â
*
|
2460 |
-
* @uses home_url()
|
2461 |
-
* @uses bp_get_activity_root_slug()
|
2462 |
-
* @uses apply_filters() To call the 'bp_get_activity_comment_form_action' hook.
|
2463 |
Â
*
|
2464 |
Â
* @return string The activity comment form action.
|
2465 |
Â
*/
|
@@ -2480,7 +2348,6 @@ function bp_activity_comment_form_action() {
|
|
2480 |
Â
*
|
2481 |
Â
* @since 1.2.0
|
2482 |
Â
*
|
2483 |
-
* @uses bp_get_activity_permalink_id()
|
2484 |
Â
*/
|
2485 |
Â
function bp_activity_permalink_id() {
|
2486 |
Â
echo bp_get_activity_permalink_id();
|
@@ -2491,7 +2358,6 @@ function bp_activity_permalink_id() {
|
|
2491 |
Â
*
|
2492 |
Â
* @since 1.2.0
|
2493 |
Â
*
|
2494 |
-
* @uses apply_filters() To call the 'bp_get_activity_permalink_id' hook.
|
2495 |
Â
*
|
2496 |
Â
* @return string The activity permalink ID.
|
2497 |
Â
*/
|
@@ -2512,10 +2378,9 @@ function bp_activity_permalink_id() {
|
|
2512 |
Â
*
|
2513 |
Â
* @since 1.2.0
|
2514 |
Â
*
|
2515 |
-
* @uses bp_get_activity_permalink_id()
|
2516 |
Â
*/
|
2517 |
Â
function bp_activity_thread_permalink() {
|
2518 |
-
echo bp_get_activity_thread_permalink();
|
2519 |
Â
}
|
2520 |
Â
|
2521 |
Â
/**
|
@@ -2523,8 +2388,6 @@ function bp_activity_thread_permalink() {
|
|
2523 |
Â
*
|
2524 |
Â
* @since 1.2.0
|
2525 |
Â
*
|
2526 |
-
* @uses bp_activity_get_permalink()
|
2527 |
-
* @uses apply_filters() To call the 'bp_get_activity_thread_permalink' hook.
|
2528 |
Â
*
|
2529 |
Â
* @return string $link The activity thread permalink.
|
2530 |
Â
*/
|
@@ -2548,18 +2411,15 @@ function bp_activity_thread_permalink() {
|
|
2548 |
Â
*
|
2549 |
Â
* @since 1.8.0
|
2550 |
Â
*
|
2551 |
-
* @uses bp_get_activity_permalink_id()
|
2552 |
Â
*/
|
2553 |
Â
function bp_activity_comment_permalink() {
|
2554 |
-
echo bp_get_activity_comment_permalink();
|
2555 |
Â
}
|
2556 |
Â
/**
|
2557 |
Â
* Return the activity comment permalink.
|
2558 |
Â
*
|
2559 |
Â
* @since 1.8.0
|
2560 |
Â
*
|
2561 |
-
* @uses bp_activity_get_permalink()
|
2562 |
-
* @uses apply_filters() To call the 'bp_get_activity_comment_permalink' hook.
|
2563 |
Â
*
|
2564 |
Â
* @return string $link The activity comment permalink.
|
2565 |
Â
*/
|
@@ -2595,7 +2455,6 @@ function bp_activity_comment_permalink() {
|
|
2595 |
Â
*
|
2596 |
Â
* @since 1.2.0
|
2597 |
Â
*
|
2598 |
-
* @uses bp_get_activity_favorite_link()
|
2599 |
Â
*/
|
2600 |
Â
function bp_activity_favorite_link() {
|
2601 |
Â
echo bp_get_activity_favorite_link();
|
@@ -2607,10 +2466,6 @@ function bp_activity_favorite_link() {
|
|
2607 |
Â
* @since 1.2.0
|
2608 |
Â
*
|
2609 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
2610 |
-
* @uses wp_nonce_url()
|
2611 |
-
* @uses home_url()
|
2612 |
-
* @uses bp_get_activity_root_slug()
|
2613 |
-
* @uses apply_filters() To call the 'bp_get_activity_favorite_link' hook.
|
2614 |
Â
*
|
2615 |
Â
* @return string The activity favorite link.
|
2616 |
Â
*/
|
@@ -2632,7 +2487,6 @@ function bp_activity_favorite_link() {
|
|
2632 |
Â
*
|
2633 |
Â
* @since 1.2.0
|
2634 |
Â
*
|
2635 |
-
* @uses bp_get_activity_unfavorite_link()
|
2636 |
Â
*/
|
2637 |
Â
function bp_activity_unfavorite_link() {
|
2638 |
Â
echo bp_get_activity_unfavorite_link();
|
@@ -2644,10 +2498,6 @@ function bp_activity_unfavorite_link() {
|
|
2644 |
Â
* @since 1.2.0
|
2645 |
Â
*
|
2646 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
2647 |
-
* @uses wp_nonce_url()
|
2648 |
-
* @uses home_url()
|
2649 |
-
* @uses bp_get_activity_root_slug()
|
2650 |
-
* @uses apply_filters() To call the 'bp_get_activity_unfavorite_link' hook.
|
2651 |
Â
*
|
2652 |
Â
* @return string The activity unfavorite link.
|
2653 |
Â
*/
|
@@ -2669,7 +2519,6 @@ function bp_activity_unfavorite_link() {
|
|
2669 |
Â
*
|
2670 |
Â
* @since 1.0.0
|
2671 |
Â
*
|
2672 |
-
* @uses bp_get_activity_css_class()
|
2673 |
Â
*/
|
2674 |
Â
function bp_activity_css_class() {
|
2675 |
Â
echo bp_get_activity_css_class();
|
@@ -2681,10 +2530,6 @@ function bp_activity_css_class() {
|
|
2681 |
Â
* @since 1.0.0
|
2682 |
Â
*
|
2683 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
2684 |
-
* @uses apply_filters() To call the 'bp_activity_mini_activity_types' hook.
|
2685 |
-
* @uses bp_activity_get_comment_count()
|
2686 |
-
* @uses bp_activity_can_comment()
|
2687 |
-
* @uses apply_filters() To call the 'bp_get_activity_css_class' hook.
|
2688 |
Â
*
|
2689 |
Â
* @return string The activity item's CSS class.
|
2690 |
Â
*/
|
@@ -2732,7 +2577,6 @@ function bp_activity_css_class() {
|
|
2732 |
Â
*
|
2733 |
Â
* @since 1.1.0
|
2734 |
Â
*
|
2735 |
-
* @uses bp_get_activity_delete_link()
|
2736 |
Â
*/
|
2737 |
Â
function bp_activity_delete_link() {
|
2738 |
Â
echo bp_get_activity_delete_link();
|
@@ -2744,13 +2588,6 @@ function bp_activity_delete_link() {
|
|
2744 |
Â
* @since 1.1.0
|
2745 |
Â
*
|
2746 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
2747 |
-
* @uses bp_get_root_domain()
|
2748 |
-
* @uses bp_get_activity_root_slug()
|
2749 |
-
* @uses bp_is_activity_component()
|
2750 |
-
* @uses bp_current_action()
|
2751 |
-
* @uses wp_get_referer()
|
2752 |
-
* @uses wp_nonce_url()
|
2753 |
-
* @uses apply_filters() To call the 'bp_get_activity_delete_link' hook.
|
2754 |
Â
*
|
2755 |
Â
* @return string $link Activity delete link. Contains $redirect_to arg
|
2756 |
Â
* if on single activity page.
|
@@ -2782,7 +2619,6 @@ function bp_activity_delete_link() {
|
|
2782 |
Â
*
|
2783 |
Â
* @since 2.1.0
|
2784 |
Â
*
|
2785 |
-
* @uses bp_get_activity_delete_link()
|
2786 |
Â
*/
|
2787 |
Â
function bp_activity_delete_url() {
|
2788 |
Â
echo esc_url( bp_get_activity_delete_url() );
|
@@ -2793,14 +2629,6 @@ function bp_activity_delete_url() {
|
|
2793 |
Â
* @since 2.1.0
|
2794 |
Â
*
|
2795 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
2796 |
-
* @uses bp_get_root_domain()
|
2797 |
-
* @uses bp_get_activity_root_slug()
|
2798 |
-
* @uses bp_is_activity_component()
|
2799 |
-
* @uses bp_current_action()
|
2800 |
-
* @uses add_query_arg()
|
2801 |
-
* @uses wp_get_referer()
|
2802 |
-
* @uses wp_nonce_url()
|
2803 |
-
* @uses apply_filters() To call the 'bp_get_activity_delete_link' hook.
|
2804 |
Â
*
|
2805 |
Â
* @return string $link Activity delete link. Contains $redirect_to arg
|
2806 |
Â
* if on single activity page.
|
@@ -2833,7 +2661,6 @@ function bp_activity_delete_url() {
|
|
2833 |
Â
* @since 1.2.0
|
2834 |
Â
*
|
2835 |
Â
* @see bp_get_activity_latest_update() for description of parameters.
|
2836 |
-
* @uses bp_get_activity_latest_update()
|
2837 |
Â
*
|
2838 |
Â
* @param int $user_id See {@link bp_get_activity_latest_update()} for description.
|
2839 |
Â
*/
|
@@ -2846,14 +2673,6 @@ function bp_activity_latest_update( $user_id = 0 ) {
|
|
2846 |
Â
*
|
2847 |
Â
* @since 1.2.0
|
2848 |
Â
*
|
2849 |
-
* @uses bp_is_user_inactive()
|
2850 |
-
* @uses bp_core_is_user_deleted()
|
2851 |
-
* @uses bp_get_user_meta()
|
2852 |
-
* @uses apply_filters() To call the 'bp_get_activity_latest_update_excerpt' hook.
|
2853 |
-
* @uses bp_create_excerpt()
|
2854 |
-
* @uses bp_get_root_domain()
|
2855 |
-
* @uses bp_get_activity_root_slug()
|
2856 |
-
* @uses apply_filters() To call the 'bp_get_activity_latest_update' hook.
|
2857 |
Â
*
|
2858 |
Â
* @param int $user_id If empty, will fall back on displayed user.
|
2859 |
Â
* @return string|bool $latest_update The activity latest update link.
|
@@ -2877,10 +2696,12 @@ function bp_activity_latest_update( $user_id = 0 ) {
|
|
2877 |
Â
* Filters the latest update excerpt.
|
2878 |
Â
*
|
2879 |
Â
* @since 1.2.10
|
Â
|
|
2880 |
Â
*
|
2881 |
-
* @param string $value
|
Â
|
|
2882 |
Â
*/
|
2883 |
-
$latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 358 ) ) ) );
|
2884 |
Â
|
2885 |
Â
$latest_update = sprintf(
|
2886 |
Â
'%s <a href="%s">%s</a>',
|
@@ -2893,10 +2714,12 @@ function bp_activity_latest_update( $user_id = 0 ) {
|
|
2893 |
Â
* Filters the latest update excerpt with view link appended to the end.
|
2894 |
Â
*
|
2895 |
Â
* @since 1.2.0
|
Â
|
|
2896 |
Â
*
|
2897 |
Â
* @param string $latest_update The latest update with "view" link appended to it.
|
Â
|
|
2898 |
Â
*/
|
2899 |
-
return apply_filters( 'bp_get_activity_latest_update', $latest_update );
|
2900 |
Â
}
|
2901 |
Â
|
2902 |
Â
/**
|
@@ -2905,7 +2728,6 @@ function bp_activity_latest_update( $user_id = 0 ) {
|
|
2905 |
Â
* @since 1.1.0
|
2906 |
Â
*
|
2907 |
Â
* @see bp_get_activity_filter_links() for description of parameters.
|
2908 |
-
* @uses bp_get_activity_filter_links()
|
2909 |
Â
*
|
2910 |
Â
* @param array|bool $args See {@link bp_get_activity_filter_links()} for description.
|
2911 |
Â
*/
|
@@ -2918,13 +2740,6 @@ function bp_activity_filter_links( $args = false ) {
|
|
2918 |
Â
*
|
2919 |
Â
* @since 1.1.0
|
2920 |
Â
*
|
2921 |
-
* @uses wp_parse_args()
|
2922 |
-
* @uses BP_Activity_Activity::get_recorded_components() {@link BP_Activity_Activity}
|
2923 |
-
* @uses esc_attr()
|
2924 |
-
* @uses add_query_arg()
|
2925 |
-
* @uses remove_query_arg()
|
2926 |
-
* @uses apply_filters() To call the 'bp_get_activity_filter_link_href' hook.
|
2927 |
-
* @uses apply_filters() To call the 'bp_get_activity_filter_links' hook.
|
2928 |
Â
*
|
2929 |
Â
* @param array|bool $args {
|
2930 |
Â
* @type string $style The type of markup to use for the links.
|
@@ -3008,10 +2823,12 @@ function bp_activity_filter_links( $args = false ) {
|
|
3008 |
Â
* Filters all of the constructed filter links.
|
3009 |
Â
*
|
3010 |
Â
* @since 1.1.0
|
Â
|
|
3011 |
Â
*
|
3012 |
Â
* @param string $value All of the links to be displayed to the user.
|
Â
|
|
3013 |
Â
*/
|
3014 |
-
return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
|
3015 |
Â
}
|
3016 |
Â
|
3017 |
Â
/**
|
@@ -3020,8 +2837,6 @@ function bp_activity_filter_links( $args = false ) {
|
|
3020 |
Â
* @since 1.2.0
|
3021 |
Â
*
|
3022 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
3023 |
-
* @uses bp_get_activity_action_name()
|
3024 |
-
* @uses apply_filters() To call the 'bp_activity_can_comment' hook.
|
3025 |
Â
*
|
3026 |
Â
* @return bool $can_comment True if item can receive comments.
|
3027 |
Â
*/
|
@@ -3106,8 +2921,6 @@ function bp_activity_can_comment_reply( $comment = false ) {
|
|
3106 |
Â
*
|
3107 |
Â
* @since 1.5.0
|
3108 |
Â
*
|
3109 |
-
* @uses apply_filters() To call the 'bp_activity_can_favorite' hook.
|
3110 |
-
*
|
3111 |
Â
* @return bool True if comment can receive comments.
|
3112 |
Â
*/
|
3113 |
Â
function bp_activity_can_favorite() {
|
@@ -3128,7 +2941,6 @@ function bp_activity_can_favorite() {
|
|
3128 |
Â
* @since 1.2.0
|
3129 |
Â
*
|
3130 |
Â
* @see bp_get_total_favorite_count_for_user() for description of parameters.
|
3131 |
-
* @uses bp_get_total_favorite_count_for_user()
|
3132 |
Â
*
|
3133 |
Â
* @param int $user_id See {@link bp_get_total_favorite_count_for_user()}.
|
3134 |
Â
*/
|
@@ -3141,8 +2953,6 @@ function bp_total_favorite_count_for_user( $user_id = 0 ) {
|
|
3141 |
Â
*
|
3142 |
Â
* @since 1.2.0
|
3143 |
Â
*
|
3144 |
-
* @uses bp_activity_total_favorites_for_user()
|
3145 |
-
* @uses apply_filters() To call the 'bp_get_total_favorite_count_for_user' hook.
|
3146 |
Â
*
|
3147 |
Â
* @param int $user_id ID of user being queried. Default: displayed user ID.
|
3148 |
Â
* @return int The total favorite count for the specified user.
|
@@ -3166,10 +2976,12 @@ function bp_total_favorite_count_for_user( $user_id = 0 ) {
|
|
3166 |
Â
* Filters the total favorite count for a user.
|
3167 |
Â
*
|
3168 |
Â
* @since 1.2.0
|
Â
|
|
3169 |
Â
*
|
3170 |
-
* @param int|bool $retval
|
Â
|
|
3171 |
Â
*/
|
3172 |
-
return apply_filters( 'bp_get_total_favorite_count_for_user', $retval );
|
3173 |
Â
}
|
3174 |
Â
|
3175 |
Â
|
@@ -3179,7 +2991,6 @@ function bp_total_favorite_count_for_user( $user_id = 0 ) {
|
|
3179 |
Â
* @since 1.2.0
|
3180 |
Â
*
|
3181 |
Â
* @see bp_get_total_mention_count_for_user() for description of parameters.
|
3182 |
-
* @uses bp_get_total_favorite_count_for_user()
|
3183 |
Â
*
|
3184 |
Â
* @param int $user_id See {@link bp_get_total_mention_count_for_user()}.
|
3185 |
Â
*/
|
@@ -3192,8 +3003,6 @@ function bp_total_mention_count_for_user( $user_id = 0 ) {
|
|
3192 |
Â
*
|
3193 |
Â
* @since 1.2.0
|
3194 |
Â
*
|
3195 |
-
* @uses bp_get_user_meta()
|
3196 |
-
* @uses apply_filters() To call the 'bp_get_total_mention_count_for_user' hook.
|
3197 |
Â
*
|
3198 |
Â
* @param int $user_id ID of user being queried. Default: displayed user ID.
|
3199 |
Â
* @return int The total mention count for the specified user.
|
@@ -3214,10 +3023,12 @@ function bp_total_mention_count_for_user( $user_id = 0 ) {
|
|
3214 |
Â
* Filters the total mention count for a user.
|
3215 |
Â
*
|
3216 |
Â
* @since 1.2.0
|
Â
|
|
3217 |
Â
*
|
3218 |
-
* @param int|bool $retval
|
Â
|
|
3219 |
Â
*/
|
3220 |
-
return apply_filters( 'bp_get_total_mention_count_for_user', $retval );
|
3221 |
Â
}
|
3222 |
Â
|
3223 |
Â
/**
|
@@ -3225,7 +3036,6 @@ function bp_total_mention_count_for_user( $user_id = 0 ) {
|
|
3225 |
Â
*
|
3226 |
Â
* @since 1.2.0
|
3227 |
Â
*
|
3228 |
-
* @uses bp_get_send_public_message_link()
|
3229 |
Â
*/
|
3230 |
Â
function bp_send_public_message_link() {
|
3231 |
Â
echo esc_url( bp_get_send_public_message_link() );
|
@@ -3236,12 +3046,6 @@ function bp_send_public_message_link() {
|
|
3236 |
Â
*
|
3237 |
Â
* @since 1.2.0
|
3238 |
Â
*
|
3239 |
-
* @uses is_user_logged_in()
|
3240 |
-
* @uses bp_is_my_profile()
|
3241 |
-
* @uses bp_is_user()
|
3242 |
-
* @uses wp_nonce_url()
|
3243 |
-
* @uses bp_get_activity_directory_permalink()
|
3244 |
-
* @uses apply_filters() To call the 'bp_get_send_public_message_link' hook.
|
3245 |
Â
*
|
3246 |
Â
* @return string The public message link for the displayed user.
|
3247 |
Â
*/
|
@@ -3299,7 +3103,6 @@ function bp_activity_recurse_comments_activity_ids( $activity = array(), $activi
|
|
3299 |
Â
* @since 1.2.0
|
3300 |
Â
*
|
3301 |
Â
* @see bp_get_mentioned_user_display_name() for description of parameters.
|
3302 |
-
* @uses bp_get_mentioned_user_display_name()
|
3303 |
Â
*
|
3304 |
Â
* @param int|string|bool $user_id_or_username See {@link bp_get_mentioned_user_display_name()}.
|
3305 |
Â
*/
|
@@ -3312,8 +3115,6 @@ function bp_mentioned_user_display_name( $user_id_or_username = false ) {
|
|
3312 |
Â
*
|
3313 |
Â
* @since 1.2.0
|
3314 |
Â
*
|
3315 |
-
* @uses bp_core_get_user_displayname()
|
3316 |
-
* @uses apply_filters() To call the 'bp_get_mentioned_user_display_name' hook.
|
3317 |
Â
*
|
3318 |
Â
* @param int|string|bool $user_id_or_username User ID or username.
|
3319 |
Â
* @return string The mentioned user's display name.
|
@@ -3345,7 +3146,6 @@ function bp_mentioned_user_display_name( $user_id_or_username = false ) {
|
|
3345 |
Â
* @since 1.2.0
|
3346 |
Â
*
|
3347 |
Â
* @see bp_get_send_public_message_button() for description of parameters.
|
3348 |
-
* @uses bp_get_send_public_message_button()
|
3349 |
Â
*
|
3350 |
Â
* @param array|string $args See {@link bp_get_send_public_message_button()}.
|
3351 |
Â
*/
|
@@ -3358,10 +3158,6 @@ function bp_send_public_message_button( $args = '' ) {
|
|
3358 |
Â
*
|
3359 |
Â
* @since 1.2.0
|
3360 |
Â
*
|
3361 |
-
* @uses bp_get_send_public_message_link()
|
3362 |
-
* @uses wp_parse_args()
|
3363 |
-
* @uses bp_get_button()
|
3364 |
-
* @uses apply_filters() To call the 'bp_get_send_public_message_button' hook.
|
3365 |
Â
*
|
3366 |
Â
* @param array|string $args {
|
3367 |
Â
* All arguments are optional. See {@link BP_Button} for complete
|
@@ -3409,7 +3205,6 @@ function bp_send_public_message_button( $args = '' ) {
|
|
3409 |
Â
*
|
3410 |
Â
* @since 1.2.0
|
3411 |
Â
*
|
3412 |
-
* @uses bp_get_activity_post_form_action()
|
3413 |
Â
*/
|
3414 |
Â
function bp_activity_post_form_action() {
|
3415 |
Â
echo bp_get_activity_post_form_action();
|
@@ -3420,9 +3215,6 @@ function bp_activity_post_form_action() {
|
|
3420 |
Â
*
|
3421 |
Â
* @since 1.2.0
|
3422 |
Â
*
|
3423 |
-
* @uses home_url()
|
3424 |
-
* @uses bp_get_activity_root_slug()
|
3425 |
-
* @uses apply_filters() To call the 'bp_get_activity_post_form_action' hook.
|
3426 |
Â
*
|
3427 |
Â
* @return string The activity post form action.
|
3428 |
Â
*/
|
@@ -3675,7 +3467,6 @@ function bp_activity_types_list( $output = 'select', $args = '' ) {
|
|
3675 |
Â
*
|
3676 |
Â
* @since 1.0.0
|
3677 |
Â
*
|
3678 |
-
* @uses bp_get_sitewide_activity_feed_link()
|
3679 |
Â
*/
|
3680 |
Â
function bp_sitewide_activity_feed_link() {
|
3681 |
Â
echo bp_get_sitewide_activity_feed_link();
|
@@ -3686,9 +3477,6 @@ function bp_sitewide_activity_feed_link() {
|
|
3686 |
Â
*
|
3687 |
Â
* @since 1.0.0
|
3688 |
Â
*
|
3689 |
-
* @uses home_url()
|
3690 |
-
* @uses bp_get_activity_root_slug()
|
3691 |
-
* @uses apply_filters() To call the 'bp_get_sitewide_activity_feed_link' hook.
|
3692 |
Â
*
|
3693 |
Â
* @return string The sitewide activity feed link.
|
3694 |
Â
*/
|
@@ -3709,7 +3497,6 @@ function bp_sitewide_activity_feed_link() {
|
|
3709 |
Â
*
|
3710 |
Â
* @since 1.2.0
|
3711 |
Â
*
|
3712 |
-
* @uses bp_get_member_activity_feed_link()
|
3713 |
Â
*/
|
3714 |
Â
function bp_member_activity_feed_link() {
|
3715 |
Â
echo bp_get_member_activity_feed_link();
|
@@ -3723,7 +3510,6 @@ function bp_member_activity_feed_link() {
|
|
3723 |
Â
*
|
3724 |
Â
* @todo properly deprecate in favor of bp_member_activity_feed_link().
|
3725 |
Â
*
|
3726 |
-
* @uses bp_get_member_activity_feed_link()
|
3727 |
Â
*/
|
3728 |
Â
function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link(); }
|
3729 |
Â
|
@@ -3732,14 +3518,6 @@ function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link
|
|
3732 |
Â
*
|
3733 |
Â
* @since 1.2.0
|
3734 |
Â
*
|
3735 |
-
* @uses bp_is_profile_component()
|
3736 |
-
* @uses bp_is_current_action()
|
3737 |
-
* @uses bp_displayed_user_domain()
|
3738 |
-
* @uses bp_get_activity_slug()
|
3739 |
-
* @uses bp_is_active()
|
3740 |
-
* @uses bp_get_friends_slug()
|
3741 |
-
* @uses bp_get_groups_slug()
|
3742 |
-
* @uses apply_filters() To call the 'bp_get_activities_member_rss_link' hook.
|
3743 |
Â
*
|
3744 |
Â
* @return string $link The member activity feed link.
|
3745 |
Â
*/
|
@@ -3788,7 +3566,6 @@ function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link
|
|
3788 |
Â
*
|
3789 |
Â
* @todo properly deprecate in favor of bp_get_member_activity_feed_link().
|
3790 |
Â
*
|
3791 |
-
* @uses bp_get_member_activity_feed_link()
|
3792 |
Â
*
|
3793 |
Â
* @return string The member activity feed link.
|
3794 |
Â
*/
|
@@ -3802,7 +3579,6 @@ function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link
|
|
3802 |
Â
*
|
3803 |
Â
* @since 1.0.0
|
3804 |
Â
*
|
3805 |
-
* @uses bp_activity_feed_item_guid()
|
3806 |
Â
*/
|
3807 |
Â
function bp_activity_feed_item_guid() {
|
3808 |
Â
echo bp_get_activity_feed_item_guid();
|
@@ -3814,7 +3590,6 @@ function bp_activity_feed_item_guid() {
|
|
3814 |
Â
* @since 1.2.0
|
3815 |
Â
*
|
3816 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
3817 |
-
* @uses apply_filters() To call the 'bp_get_activity_feed_item_guid' hook.
|
3818 |
Â
*
|
3819 |
Â
* @return string The activity feed item guid.
|
3820 |
Â
*/
|
@@ -3836,7 +3611,6 @@ function bp_activity_feed_item_guid() {
|
|
3836 |
Â
*
|
3837 |
Â
* @since 1.0.0
|
3838 |
Â
*
|
3839 |
-
* @uses bp_get_activity_feed_item_title()
|
3840 |
Â
*/
|
3841 |
Â
function bp_activity_feed_item_title() {
|
3842 |
Â
echo bp_get_activity_feed_item_title();
|
@@ -3848,10 +3622,6 @@ function bp_activity_feed_item_title() {
|
|
3848 |
Â
* @since 1.0.0
|
3849 |
Â
*
|
3850 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
3851 |
-
* @uses ent2ncr()
|
3852 |
-
* @uses convert_chars()
|
3853 |
-
* @uses bp_create_excerpt()
|
3854 |
-
* @uses apply_filters() To call the 'bp_get_activity_feed_item_title' hook.
|
3855 |
Â
*
|
3856 |
Â
* @return string $title The activity feed item title.
|
3857 |
Â
*/
|
@@ -3890,7 +3660,6 @@ function bp_activity_feed_item_title() {
|
|
3890 |
Â
*
|
3891 |
Â
* @since 1.0.0
|
3892 |
Â
*
|
3893 |
-
* @uses bp_get_activity_feed_item_link()
|
3894 |
Â
*/
|
3895 |
Â
function bp_activity_feed_item_link() {
|
3896 |
Â
echo bp_get_activity_feed_item_link();
|
@@ -3902,7 +3671,6 @@ function bp_activity_feed_item_link() {
|
|
3902 |
Â
* @since 1.0.0
|
3903 |
Â
*
|
3904 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
3905 |
-
* @uses apply_filters() To call the 'bp_get_activity_feed_item_link' hook.
|
3906 |
Â
*
|
3907 |
Â
* @return string The activity feed item link.
|
3908 |
Â
*/
|
@@ -3928,7 +3696,6 @@ function bp_activity_feed_item_link() {
|
|
3928 |
Â
*
|
3929 |
Â
* @since 1.0.0
|
3930 |
Â
*
|
3931 |
-
* @uses bp_get_activity_feed_item_date()
|
3932 |
Â
*/
|
3933 |
Â
function bp_activity_feed_item_date() {
|
3934 |
Â
echo bp_get_activity_feed_item_date();
|
@@ -3940,7 +3707,6 @@ function bp_activity_feed_item_date() {
|
|
3940 |
Â
* @since 1.0.0
|
3941 |
Â
*
|
3942 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
3943 |
-
* @uses apply_filters() To call the 'bp_get_activity_feed_item_date' hook.
|
3944 |
Â
*
|
3945 |
Â
* @return string The activity feed item date.
|
3946 |
Â
*/
|
@@ -3966,7 +3732,6 @@ function bp_activity_feed_item_date() {
|
|
3966 |
Â
*
|
3967 |
Â
* @since 1.0.0
|
3968 |
Â
*
|
3969 |
-
* @uses bp_get_activity_feed_item_description()
|
3970 |
Â
*/
|
3971 |
Â
function bp_activity_feed_item_description() {
|
3972 |
Â
echo bp_get_activity_feed_item_description();
|
@@ -3978,9 +3743,6 @@ function bp_activity_feed_item_description() {
|
|
3978 |
Â
* @since 1.0.0
|
3979 |
Â
*
|
3980 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
3981 |
-
* @uses ent2ncr()
|
3982 |
-
* @uses convert_chars()
|
3983 |
-
* @uses apply_filters() To call the 'bp_get_activity_feed_item_description' hook.
|
3984 |
Â
*
|
3985 |
Â
* @return string The activity feed item description.
|
3986 |
Â
*/
|
@@ -4012,8 +3774,6 @@ function bp_activity_feed_item_description() {
|
|
4012 |
Â
*
|
4013 |
Â
* @since 1.5.0
|
4014 |
Â
*
|
4015 |
-
* @uses bloginfo()
|
4016 |
-
* @uses bp_sitewide_activity_feed_link()
|
4017 |
Â
*/
|
4018 |
Â
function bp_activity_sitewide_feed() {
|
4019 |
Â
?>
|
@@ -4031,7 +3791,6 @@ add_action( 'bp_head', 'bp_activity_sitewide_feed' );
|
|
4031 |
Â
*
|
4032 |
Â
* @param string $context The current context. 'activity', 'member',
|
4033 |
Â
* 'member_groups', 'group'.
|
4034 |
-
* @uses bp_get_activity_show_filters()
|
4035 |
Â
*/
|
4036 |
Â
function bp_activity_show_filters( $context = '' ) {
|
4037 |
Â
echo bp_get_activity_show_filters( $context );
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-activity-template.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Output the activity component slug.
|
19 |
Â
*
|
20 |
Â
* @since 1.5.0
|
21 |
Â
*
|
Â
|
|
22 |
Â
*/
|
23 |
Â
function bp_activity_slug() {
|
24 |
Â
echo bp_get_activity_slug();
|
28 |
Â
*
|
29 |
Â
* @since 1.5.0
|
30 |
Â
*
|
Â
|
|
31 |
Â
*
|
32 |
Â
* @return string The activity component slug.
|
33 |
Â
*/
|
48 |
Â
*
|
49 |
Â
* @since 1.5.0
|
50 |
Â
*
|
Â
|
|
51 |
Â
*/
|
52 |
Â
function bp_activity_root_slug() {
|
53 |
Â
echo bp_get_activity_root_slug();
|
57 |
Â
*
|
58 |
Â
* @since 1.5.0
|
59 |
Â
*
|
Â
|
|
60 |
Â
*
|
61 |
Â
* @return string The activity component root slug.
|
62 |
Â
*/
|
77 |
Â
*
|
78 |
Â
* @since 1.5.0
|
79 |
Â
*
|
Â
|
|
80 |
Â
*/
|
81 |
Â
function bp_activity_directory_permalink() {
|
82 |
Â
echo esc_url( bp_get_activity_directory_permalink() );
|
86 |
Â
*
|
87 |
Â
* @since 1.5.0
|
88 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
89 |
Â
*
|
90 |
Â
* @return string Activity directory permalink.
|
91 |
Â
*/
|
112 |
Â
* @since 2.4.0 Introduced the `$fields` parameter.
|
113 |
Â
*
|
114 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
115 |
Â
*
|
116 |
Â
* @param array|string $args {
|
117 |
Â
* Arguments for limiting the contents of the activity loop. Most arguments
|
370 |
Â
* @since 1.0.0
|
371 |
Â
*
|
372 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
373 |
Â
*
|
374 |
Â
* @return bool Returns true when activities are found.
|
375 |
Â
*/
|
384 |
Â
* @since 1.0.0
|
385 |
Â
*
|
386 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
387 |
Â
*
|
388 |
Â
* @return object The current activity within the loop.
|
389 |
Â
*/
|
431 |
Â
* @since 1.0.0
|
432 |
Â
*
|
433 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
434 |
Â
*/
|
435 |
Â
function bp_activity_pagination_count() {
|
436 |
Â
echo bp_get_activity_pagination_count();
|
442 |
Â
* @since 1.2.0
|
443 |
Â
*
|
444 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
445 |
Â
*
|
446 |
Â
* @return string The pagination text.
|
447 |
Â
*/
|
467 |
Â
*
|
468 |
Â
* @since 1.0.0
|
469 |
Â
*
|
Â
|
|
470 |
Â
*/
|
471 |
Â
function bp_activity_pagination_links() {
|
472 |
Â
echo bp_get_activity_pagination_links();
|
478 |
Â
* @since 1.0.0
|
479 |
Â
*
|
480 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
481 |
Â
*
|
482 |
Â
* @return string The pagination links.
|
483 |
Â
*/
|
500 |
Â
* @since 1.5.0
|
501 |
Â
*
|
502 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
503 |
Â
*
|
504 |
Â
* @return bool $has_more_items True if more items, false if not.
|
505 |
Â
*/
|
533 |
Â
*
|
534 |
Â
* @since 1.2.0
|
535 |
Â
*
|
Â
|
|
536 |
Â
*/
|
537 |
Â
function bp_activity_count() {
|
538 |
Â
echo bp_get_activity_count();
|
544 |
Â
* @since 1.2.0
|
545 |
Â
*
|
546 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
547 |
Â
*
|
548 |
Â
* @return int The activity count.
|
549 |
Â
*/
|
565 |
Â
*
|
566 |
Â
* @since 1.2.0
|
567 |
Â
*
|
Â
|
|
568 |
Â
*/
|
569 |
Â
function bp_activity_per_page() {
|
570 |
Â
echo bp_get_activity_per_page();
|
576 |
Â
* @since 1.2.0
|
577 |
Â
*
|
578 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
579 |
Â
*
|
580 |
Â
* @return int The activities per page.
|
581 |
Â
*/
|
597 |
Â
*
|
598 |
Â
* @since 1.0.0
|
599 |
Â
*
|
Â
|
|
600 |
Â
* @todo Deprecate.
|
601 |
Â
*/
|
602 |
Â
function bp_activities_title() {
|
609 |
Â
* @since 1.0.0
|
610 |
Â
*
|
611 |
Â
* @global string $bp_activity_title
|
Â
|
|
612 |
Â
* @todo Deprecate.
|
613 |
Â
*
|
614 |
Â
* @return string The activities title.
|
631 |
Â
*
|
632 |
Â
* @since 1.0.0
|
633 |
Â
*
|
Â
|
|
634 |
Â
* @todo Deprecate.
|
635 |
Â
*/
|
636 |
Â
function bp_activities_no_activity() {
|
643 |
Â
* @since 1.0.0
|
644 |
Â
*
|
645 |
Â
* @global string $bp_activity_no_activity
|
Â
|
|
646 |
Â
* @todo Deprecate.
|
647 |
Â
*
|
648 |
Â
* @return string
|
665 |
Â
*
|
666 |
Â
* @since 1.2.0
|
667 |
Â
*
|
Â
|
|
668 |
Â
*/
|
669 |
Â
function bp_activity_id() {
|
670 |
Â
echo bp_get_activity_id();
|
676 |
Â
* @since 1.2.0
|
677 |
Â
*
|
678 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
679 |
Â
*
|
680 |
Â
* @return int The activity ID.
|
681 |
Â
*/
|
697 |
Â
*
|
698 |
Â
* @since 1.2.0
|
699 |
Â
*
|
Â
|
|
700 |
Â
*/
|
701 |
Â
function bp_activity_item_id() {
|
702 |
Â
echo bp_get_activity_item_id();
|
708 |
Â
* @since 1.2.0
|
709 |
Â
*
|
710 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
711 |
Â
*
|
712 |
Â
* @return int The activity item ID.
|
713 |
Â
*/
|
729 |
Â
*
|
730 |
Â
* @since 1.2.0
|
731 |
Â
*
|
Â
|
|
732 |
Â
*/
|
733 |
Â
function bp_activity_secondary_item_id() {
|
734 |
Â
echo bp_get_activity_secondary_item_id();
|
740 |
Â
* @since 1.2.0
|
741 |
Â
*
|
742 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
743 |
Â
*
|
744 |
Â
* @return int The activity secondary item ID.
|
745 |
Â
*/
|
761 |
Â
*
|
762 |
Â
* @since 1.2.0
|
763 |
Â
*
|
Â
|
|
764 |
Â
*/
|
765 |
Â
function bp_activity_date_recorded() {
|
766 |
Â
echo bp_get_activity_date_recorded();
|
772 |
Â
* @since 1.2.0
|
773 |
Â
*
|
774 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
775 |
Â
*
|
776 |
Â
* @return string The date the activity was recorded.
|
777 |
Â
*/
|
793 |
Â
*
|
794 |
Â
* @since 2.1.0
|
795 |
Â
*
|
Â
|
|
796 |
Â
*/
|
797 |
Â
function bp_activity_member_display_name() {
|
798 |
Â
echo bp_get_activity_member_display_name();
|
804 |
Â
* @since 2.1.0
|
805 |
Â
*
|
806 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
807 |
Â
*
|
808 |
Â
* @return string The date the activity was recorded.
|
809 |
Â
*/
|
829 |
Â
*
|
830 |
Â
* @since 1.2.0
|
831 |
Â
*
|
Â
|
|
832 |
Â
*/
|
833 |
Â
function bp_activity_object_name() {
|
834 |
Â
echo bp_get_activity_object_name();
|
840 |
Â
* @since 1.2.0
|
841 |
Â
*
|
842 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
843 |
Â
*
|
844 |
Â
* @return string The activity object name.
|
845 |
Â
*/
|
861 |
Â
*
|
862 |
Â
* @since 1.2.0
|
863 |
Â
*
|
Â
|
|
864 |
Â
*/
|
865 |
Â
function bp_activity_type() {
|
866 |
Â
echo bp_get_activity_type();
|
872 |
Â
* @since 1.2.0
|
873 |
Â
*
|
874 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
875 |
Â
*
|
876 |
Â
* @return string The activity type.
|
877 |
Â
*/
|
899 |
Â
* @todo Properly deprecate in favor of bp_activity_type() and
|
900 |
Â
* remove redundant echo
|
901 |
Â
*
|
Â
|
|
902 |
Â
*/
|
903 |
Â
function bp_activity_action_name() { echo bp_activity_type(); }
|
904 |
Â
|
912 |
Â
*
|
913 |
Â
* @todo Properly deprecate in favor of bp_get_activity_type().
|
914 |
Â
*
|
Â
|
|
915 |
Â
*
|
916 |
Â
* @return string The activity type.
|
917 |
Â
*/
|
922 |
Â
*
|
923 |
Â
* @since 1.1.0
|
924 |
Â
*
|
Â
|
|
925 |
Â
*/
|
926 |
Â
function bp_activity_user_id() {
|
927 |
Â
echo bp_get_activity_user_id();
|
933 |
Â
* @since 1.1.0
|
934 |
Â
*
|
935 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
936 |
Â
*
|
937 |
Â
* @return int The activity user ID.
|
938 |
Â
*/
|
954 |
Â
*
|
955 |
Â
* @since 1.2.0
|
956 |
Â
*
|
Â
|
|
957 |
Â
*/
|
958 |
Â
function bp_activity_user_link() {
|
959 |
Â
echo bp_get_activity_user_link();
|
965 |
Â
* @since 1.2.0
|
966 |
Â
*
|
967 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
968 |
Â
*
|
969 |
Â
* @return string $link The activity user link.
|
970 |
Â
*/
|
993 |
Â
* @since 1.1.0
|
994 |
Â
*
|
995 |
Â
* @see bp_get_activity_avatar() for description of arguments.
|
Â
|
|
996 |
Â
*
|
997 |
Â
* @param array|string $args See {@link bp_get_activity_avatar()} for description.
|
998 |
Â
*/
|
1006 |
Â
*
|
1007 |
Â
* @see bp_core_fetch_avatar() For a description of the arguments.
|
1008 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1009 |
Â
*
|
1010 |
Â
* @param array|string $args {
|
1011 |
Â
* Arguments are listed here with an explanation of their defaults.
|
1101 |
Â
*
|
1102 |
Â
* @since 1.1.3
|
1103 |
Â
*
|
1104 |
+
* @param array $value HTML image element containing the activity avatar.
|
1105 |
Â
*/
|
1106 |
Â
return apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array(
|
1107 |
Â
'item_id' => $item_id,
|
1121 |
Â
* @since 1.2.0
|
1122 |
Â
*
|
1123 |
Â
* @see bp_get_activity_secondary_avatar() for description of arguments.
|
Â
|
|
1124 |
Â
*
|
1125 |
Â
* @param array|string $args See {@link bp_get_activity_secondary_avatar} for description.
|
1126 |
Â
*/
|
1135 |
Â
*
|
1136 |
Â
* @see bp_core_fetch_avatar() for description of arguments.
|
1137 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1138 |
Â
*
|
1139 |
Â
* @param array|string $args {
|
1140 |
Â
* For a complete description of arguments, see {@link bp_core_fetch_avatar()}.
|
1305 |
Â
* @since 1.2.0
|
1306 |
Â
*
|
1307 |
Â
* @param array $args See bp_get_activity_action().
|
Â
|
|
1308 |
Â
*/
|
1309 |
Â
function bp_activity_action( $args = array() ) {
|
1310 |
Â
echo bp_get_activity_action( $args );
|
1316 |
Â
* @since 1.2.0
|
1317 |
Â
*
|
1318 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
Â
|
|
1319 |
Â
*
|
1320 |
Â
* @param array $args {
|
1321 |
Â
* @type bool $no_timestamp Whether to exclude the timestamp.
|
1367 |
Â
*
|
1368 |
Â
* @since 1.2.0
|
1369 |
Â
*
|
Â
|
|
1370 |
Â
*/
|
1371 |
Â
function bp_activity_content_body() {
|
1372 |
Â
echo bp_get_activity_content_body();
|
1378 |
Â
* @since 1.2.0
|
1379 |
Â
*
|
1380 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
1381 |
Â
*
|
1382 |
Â
* @return string The activity content body.
|
1383 |
Â
*/
|
1426 |
Â
*
|
1427 |
Â
* @todo properly deprecate this function.
|
1428 |
Â
*
|
Â
|
|
1429 |
Â
*/
|
1430 |
Â
function bp_activity_content() {
|
1431 |
Â
echo bp_get_activity_content();
|
1439 |
Â
*
|
1440 |
Â
* @todo properly deprecate this function.
|
1441 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
1442 |
Â
*
|
1443 |
Â
* @return string The activity content.
|
1444 |
Â
*/
|
1463 |
Â
* @since 1.2.0
|
1464 |
Â
*
|
1465 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1466 |
Â
*
|
1467 |
Â
* @param string $content The activity content.
|
1468 |
Â
* @return string The activity content with the metadata string attached.
|
1532 |
Â
* @since 1.2.0
|
1533 |
Â
*
|
1534 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
1535 |
Â
*
|
1536 |
Â
* @param object|bool $activity Optional. Falls back on the current item in the loop.
|
1537 |
Â
* @return bool True if can delete, false otherwise.
|
1563 |
Â
// Users are allowed to delete their own activity. This is actually
|
1564 |
Â
// quite powerful, because doing so also deletes all comments to that
|
1565 |
Â
// activity item. We should revisit this eventually.
|
1566 |
+
if ( isset( $activity->user_id ) && ( $activity->user_id === bp_loggedin_user_id() ) ) {
|
1567 |
Â
$can_delete = true;
|
1568 |
Â
}
|
1569 |
Â
|
1590 |
Â
* @since 1.2.0
|
1591 |
Â
*
|
1592 |
Â
* @see bp_get_activity_parent_content() for a description of arguments.
|
Â
|
|
1593 |
Â
*
|
1594 |
Â
* @param array|string $args See {@link bp_get_activity_parent_content} for description.
|
1595 |
Â
*/
|
1603 |
Â
* @since 1.2.0
|
1604 |
Â
*
|
1605 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
1606 |
Â
*
|
1607 |
Â
* @param string $args Unused. Left over from an earlier implementation.
|
1608 |
Â
* @return mixed False on failure, otherwise the activity parent content.
|
1616 |
Â
}
|
1617 |
Â
|
1618 |
Â
// Get the ID of the parent activity content.
|
1619 |
+
$parent_id = $activities_template->activity->item_id;
|
1620 |
Â
|
1621 |
Â
// Bail if no parent content.
|
1622 |
Â
if ( empty( $activities_template->activity_parents[ $parent_id ] ) ) {
|
1680 |
Â
}
|
1681 |
Â
|
1682 |
Â
// Get the ID of the parent activity content.
|
1683 |
+
$parent_id = $activities_template->activity->item_id;
|
1684 |
Â
|
1685 |
Â
// Bail if no parent item.
|
1686 |
Â
if ( empty( $activities_template->activity_parents[ $parent_id ] ) ) {
|
1709 |
Â
*
|
1710 |
Â
* @since 1.2.0
|
1711 |
Â
*
|
Â
|
|
1712 |
Â
*/
|
1713 |
Â
function bp_activity_is_favorite() {
|
1714 |
Â
echo bp_get_activity_is_favorite();
|
1720 |
Â
* @since 1.2.0
|
1721 |
Â
*
|
1722 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
1723 |
Â
*
|
1724 |
Â
* @return bool True if user favorite, false otherwise.
|
1725 |
Â
*/
|
1759 |
Â
* this function can probably be streamlined or removed.
|
1760 |
Â
*
|
1761 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
1762 |
Â
*
|
1763 |
Â
* @param string $args Unused. Left over from an earlier implementation.
|
1764 |
Â
* @return bool
|
1782 |
Â
* @since 1.2.0
|
1783 |
Â
*
|
1784 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
1785 |
Â
*
|
1786 |
Â
* @param object $comment The activity object currently being recursed.
|
1787 |
Â
* @return bool|string
|
1841 |
Â
* @since 1.5.0
|
1842 |
Â
*
|
1843 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
1844 |
Â
*
|
1845 |
Â
* @return object|bool $current_comment The activity comment currently being
|
1846 |
Â
* displayed. False on failure.
|
1868 |
Â
*
|
1869 |
Â
* @since 1.5.0
|
1870 |
Â
*
|
Â
|
|
1871 |
Â
*/
|
1872 |
Â
function bp_activity_comment_id() {
|
1873 |
Â
echo bp_get_activity_comment_id();
|
1879 |
Â
* @since 1.5.0
|
1880 |
Â
*
|
1881 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
1882 |
Â
*
|
1883 |
Â
* @return int|bool $comment_id The ID of the activity comment currently
|
1884 |
Â
* being displayed, false if none is found.
|
1903 |
Â
*
|
1904 |
Â
* @since 1.5.0
|
1905 |
Â
*
|
Â
|
|
1906 |
Â
*/
|
1907 |
Â
function bp_activity_comment_user_id() {
|
1908 |
Â
echo bp_get_activity_comment_user_id();
|
1914 |
Â
* @since 1.5.0
|
1915 |
Â
*
|
1916 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
1917 |
Â
*
|
1918 |
Â
* @return int|bool $user_id The user_id of the author of the displayed
|
1919 |
Â
* activity comment. False on failure.
|
1938 |
Â
*
|
1939 |
Â
* @since 1.5.0
|
1940 |
Â
*
|
Â
|
|
1941 |
Â
*/
|
1942 |
Â
function bp_activity_comment_user_link() {
|
1943 |
Â
echo bp_get_activity_comment_user_link();
|
1948 |
Â
*
|
1949 |
Â
* @since 1.5.0
|
1950 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
1951 |
Â
*
|
1952 |
Â
* @return string $user_link The URL of the activity comment author's profile.
|
1953 |
Â
*/
|
1969 |
Â
*
|
1970 |
Â
* @since 1.5.0
|
1971 |
Â
*
|
Â
|
|
1972 |
Â
*/
|
1973 |
Â
function bp_activity_comment_name() {
|
1974 |
Â
echo bp_get_activity_comment_name();
|
1983 |
Â
* @since 1.5.0
|
1984 |
Â
*
|
1985 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
1986 |
Â
*
|
1987 |
Â
* @return string $name The full name of the activity comment author.
|
1988 |
Â
*/
|
2011 |
Â
*
|
2012 |
Â
* @since 1.5.0
|
2013 |
Â
*
|
Â
|
|
2014 |
Â
*/
|
2015 |
Â
function bp_activity_comment_date_recorded() {
|
2016 |
Â
echo bp_get_activity_comment_date_recorded();
|
2021 |
Â
*
|
2022 |
Â
* @since 1.5.0
|
2023 |
Â
*
|
Â
|
|
Â
|
|
2024 |
Â
*
|
2025 |
Â
* @return string|bool $date_recorded Time since the activity was recorded,
|
2026 |
Â
* in the form "%s ago". False on failure.
|
2042 |
Â
*
|
2043 |
Â
* @since 2.3.0
|
2044 |
Â
*
|
Â
|
|
2045 |
Â
*/
|
2046 |
Â
function bp_activity_comment_date_recorded_raw() {
|
2047 |
Â
echo bp_get_activity_comment_date_recorded_raw();
|
2053 |
Â
* @since 2.3.0
|
2054 |
Â
*
|
2055 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
2056 |
Â
*
|
2057 |
Â
* @return string|bool $date_recorded Time since the activity was recorded,
|
2058 |
Â
* in the form "%s ago". False on failure.
|
2075 |
Â
*
|
2076 |
Â
* @since 1.5.0
|
2077 |
Â
*
|
Â
|
|
2078 |
Â
*/
|
2079 |
Â
function bp_activity_comment_delete_link() {
|
2080 |
Â
echo bp_get_activity_comment_delete_link();
|
2085 |
Â
*
|
2086 |
Â
* @since 1.5.0
|
2087 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2088 |
Â
*
|
2089 |
Â
* @return string $link The nonced URL for deleting the current
|
2090 |
Â
* activity comment.
|
2107 |
Â
*
|
2108 |
Â
* @since 1.5.0
|
2109 |
Â
*
|
Â
|
|
2110 |
Â
*/
|
2111 |
Â
function bp_activity_comment_content() {
|
2112 |
Â
echo bp_get_activity_comment_content();
|
2123 |
Â
* @since 1.5.0
|
2124 |
Â
*
|
2125 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
2126 |
Â
*
|
2127 |
Â
* @return string $content The content of the current activity comment.
|
2128 |
Â
*/
|
2147 |
Â
*
|
2148 |
Â
* @since 1.2.0
|
2149 |
Â
*
|
Â
|
|
2150 |
Â
*/
|
2151 |
Â
function bp_activity_comment_count() {
|
2152 |
Â
echo bp_activity_get_comment_count();
|
2158 |
Â
* @since 1.2.0
|
2159 |
Â
*
|
2160 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
2161 |
Â
*
|
2162 |
Â
* @param array|null $deprecated Deprecated.
|
2163 |
Â
* @return int $count The activity comment count.
|
2193 |
Â
*
|
2194 |
Â
* @since 1.2.0
|
2195 |
Â
*
|
Â
|
|
Â
|
|
2196 |
Â
*
|
2197 |
Â
* @param object $comment Activity comment object.
|
2198 |
Â
* @param int $count The current iteration count.
|
2256 |
Â
*
|
2257 |
Â
* @since 1.2.0
|
2258 |
Â
*
|
Â
|
|
2259 |
Â
*/
|
2260 |
Â
function bp_activity_comment_link() {
|
2261 |
Â
echo bp_get_activity_comment_link();
|
2267 |
Â
* @since 1.2.0
|
2268 |
Â
*
|
2269 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
2270 |
Â
*
|
2271 |
Â
* @return string The activity comment link.
|
2272 |
Â
*/
|
2288 |
Â
*
|
2289 |
Â
* @since 1.2.0
|
2290 |
Â
*
|
Â
|
|
2291 |
Â
*/
|
2292 |
Â
function bp_activity_comment_form_nojs_display() {
|
2293 |
Â
echo bp_get_activity_comment_form_nojs_display();
|
2318 |
Â
*
|
2319 |
Â
* @since 1.2.0
|
2320 |
Â
*
|
Â
|
|
2321 |
Â
*/
|
2322 |
Â
function bp_activity_comment_form_action() {
|
2323 |
Â
echo bp_get_activity_comment_form_action();
|
2328 |
Â
*
|
2329 |
Â
* @since 1.2.0
|
2330 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
2331 |
Â
*
|
2332 |
Â
* @return string The activity comment form action.
|
2333 |
Â
*/
|
2348 |
Â
*
|
2349 |
Â
* @since 1.2.0
|
2350 |
Â
*
|
Â
|
|
2351 |
Â
*/
|
2352 |
Â
function bp_activity_permalink_id() {
|
2353 |
Â
echo bp_get_activity_permalink_id();
|
2358 |
Â
*
|
2359 |
Â
* @since 1.2.0
|
2360 |
Â
*
|
Â
|
|
2361 |
Â
*
|
2362 |
Â
* @return string The activity permalink ID.
|
2363 |
Â
*/
|
2378 |
Â
*
|
2379 |
Â
* @since 1.2.0
|
2380 |
Â
*
|
Â
|
|
2381 |
Â
*/
|
2382 |
Â
function bp_activity_thread_permalink() {
|
2383 |
+
echo esc_url( bp_get_activity_thread_permalink() );
|
2384 |
Â
}
|
2385 |
Â
|
2386 |
Â
/**
|
2388 |
Â
*
|
2389 |
Â
* @since 1.2.0
|
2390 |
Â
*
|
Â
|
|
Â
|
|
2391 |
Â
*
|
2392 |
Â
* @return string $link The activity thread permalink.
|
2393 |
Â
*/
|
2411 |
Â
*
|
2412 |
Â
* @since 1.8.0
|
2413 |
Â
*
|
Â
|
|
2414 |
Â
*/
|
2415 |
Â
function bp_activity_comment_permalink() {
|
2416 |
+
echo esc_url( bp_get_activity_comment_permalink() );
|
2417 |
Â
}
|
2418 |
Â
/**
|
2419 |
Â
* Return the activity comment permalink.
|
2420 |
Â
*
|
2421 |
Â
* @since 1.8.0
|
2422 |
Â
*
|
Â
|
|
Â
|
|
2423 |
Â
*
|
2424 |
Â
* @return string $link The activity comment permalink.
|
2425 |
Â
*/
|
2455 |
Â
*
|
2456 |
Â
* @since 1.2.0
|
2457 |
Â
*
|
Â
|
|
2458 |
Â
*/
|
2459 |
Â
function bp_activity_favorite_link() {
|
2460 |
Â
echo bp_get_activity_favorite_link();
|
2466 |
Â
* @since 1.2.0
|
2467 |
Â
*
|
2468 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2469 |
Â
*
|
2470 |
Â
* @return string The activity favorite link.
|
2471 |
Â
*/
|
2487 |
Â
*
|
2488 |
Â
* @since 1.2.0
|
2489 |
Â
*
|
Â
|
|
2490 |
Â
*/
|
2491 |
Â
function bp_activity_unfavorite_link() {
|
2492 |
Â
echo bp_get_activity_unfavorite_link();
|
2498 |
Â
* @since 1.2.0
|
2499 |
Â
*
|
2500 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2501 |
Â
*
|
2502 |
Â
* @return string The activity unfavorite link.
|
2503 |
Â
*/
|
2519 |
Â
*
|
2520 |
Â
* @since 1.0.0
|
2521 |
Â
*
|
Â
|
|
2522 |
Â
*/
|
2523 |
Â
function bp_activity_css_class() {
|
2524 |
Â
echo bp_get_activity_css_class();
|
2530 |
Â
* @since 1.0.0
|
2531 |
Â
*
|
2532 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2533 |
Â
*
|
2534 |
Â
* @return string The activity item's CSS class.
|
2535 |
Â
*/
|
2577 |
Â
*
|
2578 |
Â
* @since 1.1.0
|
2579 |
Â
*
|
Â
|
|
2580 |
Â
*/
|
2581 |
Â
function bp_activity_delete_link() {
|
2582 |
Â
echo bp_get_activity_delete_link();
|
2588 |
Â
* @since 1.1.0
|
2589 |
Â
*
|
2590 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2591 |
Â
*
|
2592 |
Â
* @return string $link Activity delete link. Contains $redirect_to arg
|
2593 |
Â
* if on single activity page.
|
2619 |
Â
*
|
2620 |
Â
* @since 2.1.0
|
2621 |
Â
*
|
Â
|
|
2622 |
Â
*/
|
2623 |
Â
function bp_activity_delete_url() {
|
2624 |
Â
echo esc_url( bp_get_activity_delete_url() );
|
2629 |
Â
* @since 2.1.0
|
2630 |
Â
*
|
2631 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2632 |
Â
*
|
2633 |
Â
* @return string $link Activity delete link. Contains $redirect_to arg
|
2634 |
Â
* if on single activity page.
|
2661 |
Â
* @since 1.2.0
|
2662 |
Â
*
|
2663 |
Â
* @see bp_get_activity_latest_update() for description of parameters.
|
Â
|
|
2664 |
Â
*
|
2665 |
Â
* @param int $user_id See {@link bp_get_activity_latest_update()} for description.
|
2666 |
Â
*/
|
2673 |
Â
*
|
2674 |
Â
* @since 1.2.0
|
2675 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2676 |
Â
*
|
2677 |
Â
* @param int $user_id If empty, will fall back on displayed user.
|
2678 |
Â
* @return string|bool $latest_update The activity latest update link.
|
2696 |
Â
* Filters the latest update excerpt.
|
2697 |
Â
*
|
2698 |
Â
* @since 1.2.10
|
2699 |
+
* @since 2.6.0 Added the `$user_id` parameter.
|
2700 |
Â
*
|
2701 |
+
* @param string $value The excerpt for the latest update.
|
2702 |
+
* @param int $user_id ID of the queried user.
|
2703 |
Â
*/
|
2704 |
+
$latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 358 ) ) ), $user_id );
|
2705 |
Â
|
2706 |
Â
$latest_update = sprintf(
|
2707 |
Â
'%s <a href="%s">%s</a>',
|
2714 |
Â
* Filters the latest update excerpt with view link appended to the end.
|
2715 |
Â
*
|
2716 |
Â
* @since 1.2.0
|
2717 |
+
* @since 2.6.0 Added the `$user_id` parameter.
|
2718 |
Â
*
|
2719 |
Â
* @param string $latest_update The latest update with "view" link appended to it.
|
2720 |
+
* @param int $user_id ID of the queried user.
|
2721 |
Â
*/
|
2722 |
+
return apply_filters( 'bp_get_activity_latest_update', $latest_update, $user_id );
|
2723 |
Â
}
|
2724 |
Â
|
2725 |
Â
/**
|
2728 |
Â
* @since 1.1.0
|
2729 |
Â
*
|
2730 |
Â
* @see bp_get_activity_filter_links() for description of parameters.
|
Â
|
|
2731 |
Â
*
|
2732 |
Â
* @param array|bool $args See {@link bp_get_activity_filter_links()} for description.
|
2733 |
Â
*/
|
2740 |
Â
*
|
2741 |
Â
* @since 1.1.0
|
2742 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2743 |
Â
*
|
2744 |
Â
* @param array|bool $args {
|
2745 |
Â
* @type string $style The type of markup to use for the links.
|
2823 |
Â
* Filters all of the constructed filter links.
|
2824 |
Â
*
|
2825 |
Â
* @since 1.1.0
|
2826 |
+
* @since 2.6.0 Added the `$r` parameter.
|
2827 |
Â
*
|
2828 |
Â
* @param string $value All of the links to be displayed to the user.
|
2829 |
+
* @param array $r Array of parsed arguments.
|
2830 |
Â
*/
|
2831 |
+
return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ), $r );
|
2832 |
Â
}
|
2833 |
Â
|
2834 |
Â
/**
|
2837 |
Â
* @since 1.2.0
|
2838 |
Â
*
|
2839 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
2840 |
Â
*
|
2841 |
Â
* @return bool $can_comment True if item can receive comments.
|
2842 |
Â
*/
|
2921 |
Â
*
|
2922 |
Â
* @since 1.5.0
|
2923 |
Â
*
|
Â
|
|
Â
|
|
2924 |
Â
* @return bool True if comment can receive comments.
|
2925 |
Â
*/
|
2926 |
Â
function bp_activity_can_favorite() {
|
2941 |
Â
* @since 1.2.0
|
2942 |
Â
*
|
2943 |
Â
* @see bp_get_total_favorite_count_for_user() for description of parameters.
|
Â
|
|
2944 |
Â
*
|
2945 |
Â
* @param int $user_id See {@link bp_get_total_favorite_count_for_user()}.
|
2946 |
Â
*/
|
2953 |
Â
*
|
2954 |
Â
* @since 1.2.0
|
2955 |
Â
*
|
Â
|
|
Â
|
|
2956 |
Â
*
|
2957 |
Â
* @param int $user_id ID of user being queried. Default: displayed user ID.
|
2958 |
Â
* @return int The total favorite count for the specified user.
|
2976 |
Â
* Filters the total favorite count for a user.
|
2977 |
Â
*
|
2978 |
Â
* @since 1.2.0
|
2979 |
+
* @since 2.6.0 Added the `$user_id` parameter.
|
2980 |
Â
*
|
2981 |
+
* @param int|bool $retval Total favorite count for a user. False on no favorites.
|
2982 |
+
* @param int $user_id ID of the queried user.
|
2983 |
Â
*/
|
2984 |
+
return apply_filters( 'bp_get_total_favorite_count_for_user', $retval, $user_id );
|
2985 |
Â
}
|
2986 |
Â
|
2987 |
Â
|
2991 |
Â
* @since 1.2.0
|
2992 |
Â
*
|
2993 |
Â
* @see bp_get_total_mention_count_for_user() for description of parameters.
|
Â
|
|
2994 |
Â
*
|
2995 |
Â
* @param int $user_id See {@link bp_get_total_mention_count_for_user()}.
|
2996 |
Â
*/
|
3003 |
Â
*
|
3004 |
Â
* @since 1.2.0
|
3005 |
Â
*
|
Â
|
|
Â
|
|
3006 |
Â
*
|
3007 |
Â
* @param int $user_id ID of user being queried. Default: displayed user ID.
|
3008 |
Â
* @return int The total mention count for the specified user.
|
3023 |
Â
* Filters the total mention count for a user.
|
3024 |
Â
*
|
3025 |
Â
* @since 1.2.0
|
3026 |
+
* @since 2.6.0 Added the `$user_id` parameter.
|
3027 |
Â
*
|
3028 |
+
* @param int|bool $retval Total mention count for a user. False on no mentions.
|
3029 |
+
* @param int $user_id ID of the queried user.
|
3030 |
Â
*/
|
3031 |
+
return apply_filters( 'bp_get_total_mention_count_for_user', $retval, $user_id );
|
3032 |
Â
}
|
3033 |
Â
|
3034 |
Â
/**
|
3036 |
Â
*
|
3037 |
Â
* @since 1.2.0
|
3038 |
Â
*
|
Â
|
|
3039 |
Â
*/
|
3040 |
Â
function bp_send_public_message_link() {
|
3041 |
Â
echo esc_url( bp_get_send_public_message_link() );
|
3046 |
Â
*
|
3047 |
Â
* @since 1.2.0
|
3048 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3049 |
Â
*
|
3050 |
Â
* @return string The public message link for the displayed user.
|
3051 |
Â
*/
|
3103 |
Â
* @since 1.2.0
|
3104 |
Â
*
|
3105 |
Â
* @see bp_get_mentioned_user_display_name() for description of parameters.
|
Â
|
|
3106 |
Â
*
|
3107 |
Â
* @param int|string|bool $user_id_or_username See {@link bp_get_mentioned_user_display_name()}.
|
3108 |
Â
*/
|
3115 |
Â
*
|
3116 |
Â
* @since 1.2.0
|
3117 |
Â
*
|
Â
|
|
Â
|
|
3118 |
Â
*
|
3119 |
Â
* @param int|string|bool $user_id_or_username User ID or username.
|
3120 |
Â
* @return string The mentioned user's display name.
|
3146 |
Â
* @since 1.2.0
|
3147 |
Â
*
|
3148 |
Â
* @see bp_get_send_public_message_button() for description of parameters.
|
Â
|
|
3149 |
Â
*
|
3150 |
Â
* @param array|string $args See {@link bp_get_send_public_message_button()}.
|
3151 |
Â
*/
|
3158 |
Â
*
|
3159 |
Â
* @since 1.2.0
|
3160 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3161 |
Â
*
|
3162 |
Â
* @param array|string $args {
|
3163 |
Â
* All arguments are optional. See {@link BP_Button} for complete
|
3205 |
Â
*
|
3206 |
Â
* @since 1.2.0
|
3207 |
Â
*
|
Â
|
|
3208 |
Â
*/
|
3209 |
Â
function bp_activity_post_form_action() {
|
3210 |
Â
echo bp_get_activity_post_form_action();
|
3215 |
Â
*
|
3216 |
Â
* @since 1.2.0
|
3217 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
3218 |
Â
*
|
3219 |
Â
* @return string The activity post form action.
|
3220 |
Â
*/
|
3467 |
Â
*
|
3468 |
Â
* @since 1.0.0
|
3469 |
Â
*
|
Â
|
|
3470 |
Â
*/
|
3471 |
Â
function bp_sitewide_activity_feed_link() {
|
3472 |
Â
echo bp_get_sitewide_activity_feed_link();
|
3477 |
Â
*
|
3478 |
Â
* @since 1.0.0
|
3479 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
3480 |
Â
*
|
3481 |
Â
* @return string The sitewide activity feed link.
|
3482 |
Â
*/
|
3497 |
Â
*
|
3498 |
Â
* @since 1.2.0
|
3499 |
Â
*
|
Â
|
|
3500 |
Â
*/
|
3501 |
Â
function bp_member_activity_feed_link() {
|
3502 |
Â
echo bp_get_member_activity_feed_link();
|
3510 |
Â
*
|
3511 |
Â
* @todo properly deprecate in favor of bp_member_activity_feed_link().
|
3512 |
Â
*
|
Â
|
|
3513 |
Â
*/
|
3514 |
Â
function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link(); }
|
3515 |
Â
|
3518 |
Â
*
|
3519 |
Â
* @since 1.2.0
|
3520 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3521 |
Â
*
|
3522 |
Â
* @return string $link The member activity feed link.
|
3523 |
Â
*/
|
3566 |
Â
*
|
3567 |
Â
* @todo properly deprecate in favor of bp_get_member_activity_feed_link().
|
3568 |
Â
*
|
Â
|
|
3569 |
Â
*
|
3570 |
Â
* @return string The member activity feed link.
|
3571 |
Â
*/
|
3579 |
Â
*
|
3580 |
Â
* @since 1.0.0
|
3581 |
Â
*
|
Â
|
|
3582 |
Â
*/
|
3583 |
Â
function bp_activity_feed_item_guid() {
|
3584 |
Â
echo bp_get_activity_feed_item_guid();
|
3590 |
Â
* @since 1.2.0
|
3591 |
Â
*
|
3592 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
3593 |
Â
*
|
3594 |
Â
* @return string The activity feed item guid.
|
3595 |
Â
*/
|
3611 |
Â
*
|
3612 |
Â
* @since 1.0.0
|
3613 |
Â
*
|
Â
|
|
3614 |
Â
*/
|
3615 |
Â
function bp_activity_feed_item_title() {
|
3616 |
Â
echo bp_get_activity_feed_item_title();
|
3622 |
Â
* @since 1.0.0
|
3623 |
Â
*
|
3624 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3625 |
Â
*
|
3626 |
Â
* @return string $title The activity feed item title.
|
3627 |
Â
*/
|
3660 |
Â
*
|
3661 |
Â
* @since 1.0.0
|
3662 |
Â
*
|
Â
|
|
3663 |
Â
*/
|
3664 |
Â
function bp_activity_feed_item_link() {
|
3665 |
Â
echo bp_get_activity_feed_item_link();
|
3671 |
Â
* @since 1.0.0
|
3672 |
Â
*
|
3673 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
3674 |
Â
*
|
3675 |
Â
* @return string The activity feed item link.
|
3676 |
Â
*/
|
3696 |
Â
*
|
3697 |
Â
* @since 1.0.0
|
3698 |
Â
*
|
Â
|
|
3699 |
Â
*/
|
3700 |
Â
function bp_activity_feed_item_date() {
|
3701 |
Â
echo bp_get_activity_feed_item_date();
|
3707 |
Â
* @since 1.0.0
|
3708 |
Â
*
|
3709 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
3710 |
Â
*
|
3711 |
Â
* @return string The activity feed item date.
|
3712 |
Â
*/
|
3732 |
Â
*
|
3733 |
Â
* @since 1.0.0
|
3734 |
Â
*
|
Â
|
|
3735 |
Â
*/
|
3736 |
Â
function bp_activity_feed_item_description() {
|
3737 |
Â
echo bp_get_activity_feed_item_description();
|
3743 |
Â
* @since 1.0.0
|
3744 |
Â
*
|
3745 |
Â
* @global object $activities_template {@link BP_Activity_Template}
|
Â
|
|
Â
|
|
Â
|
|
3746 |
Â
*
|
3747 |
Â
* @return string The activity feed item description.
|
3748 |
Â
*/
|
3774 |
Â
*
|
3775 |
Â
* @since 1.5.0
|
3776 |
Â
*
|
Â
|
|
Â
|
|
3777 |
Â
*/
|
3778 |
Â
function bp_activity_sitewide_feed() {
|
3779 |
Â
?>
|
3791 |
Â
*
|
3792 |
Â
* @param string $context The current context. 'activity', 'member',
|
3793 |
Â
* 'member_groups', 'group'.
|
Â
|
|
3794 |
Â
*/
|
3795 |
Â
function bp_activity_show_filters( $context = '' ) {
|
3796 |
Â
echo bp_get_activity_show_filters( $context );
|
@@ -107,7 +107,7 @@ class BP_Activity_Activity {
|
|
107 |
Â
* @since 1.1.0
|
108 |
Â
* @var int
|
109 |
Â
*/
|
110 |
-
var $hide_sitewide =
|
111 |
Â
|
112 |
Â
/**
|
113 |
Â
* Node boundary start for activity or activity comment.
|
@@ -133,6 +133,24 @@ class BP_Activity_Activity {
|
|
133 |
Â
*/
|
134 |
Â
var $is_spam;
|
135 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
136 |
Â
/**
|
137 |
Â
* Constructor method.
|
138 |
Â
*
|
@@ -141,8 +159,11 @@ class BP_Activity_Activity {
|
|
141 |
Â
* @param int|bool $id Optional. The ID of a specific activity item.
|
142 |
Â
*/
|
143 |
Â
public function __construct( $id = false ) {
|
Â
|
|
Â
|
|
Â
|
|
144 |
Â
if ( !empty( $id ) ) {
|
145 |
-
$this->id = $id;
|
146 |
Â
$this->populate();
|
147 |
Â
}
|
148 |
Â
}
|
@@ -175,10 +196,10 @@ class BP_Activity_Activity {
|
|
175 |
Â
$this->action = $row->action;
|
176 |
Â
$this->content = $row->content;
|
177 |
Â
$this->date_recorded = $row->date_recorded;
|
178 |
-
$this->hide_sitewide = $row->hide_sitewide;
|
179 |
Â
$this->mptt_left = (int) $row->mptt_left;
|
180 |
Â
$this->mptt_right = (int) $row->mptt_right;
|
181 |
-
$this->is_spam = $row->is_spam;
|
182 |
Â
}
|
183 |
Â
|
184 |
Â
// Generate dynamic 'action' when possible.
|
@@ -235,8 +256,22 @@ class BP_Activity_Activity {
|
|
235 |
Â
*/
|
236 |
Â
do_action_ref_array( 'bp_activity_before_save', array( &$this ) );
|
237 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
238 |
Â
if ( empty( $this->component ) || empty( $this->type ) ) {
|
239 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
240 |
Â
}
|
241 |
Â
|
242 |
Â
if ( empty( $this->primary_link ) ) {
|
@@ -708,7 +743,20 @@ class BP_Activity_Activity {
|
|
708 |
Â
|
709 |
Â
// Now fetch data from the cache.
|
710 |
Â
foreach ( $activity_ids as $activity_id ) {
|
711 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
712 |
Â
}
|
713 |
Â
|
714 |
Â
// Then fetch user data.
|
@@ -1071,7 +1119,9 @@ class BP_Activity_Activity {
|
|
1071 |
Â
|
1072 |
Â
if ( ! empty( $where_args ) ) {
|
1073 |
Â
$where_sql = 'WHERE ' . join( ' AND ', $where_args );
|
1074 |
-
|
Â
|
|
Â
|
|
1075 |
Â
}
|
1076 |
Â
|
1077 |
Â
return false;
|
@@ -1763,7 +1813,9 @@ class BP_Activity_Activity {
|
|
1763 |
Â
|
1764 |
Â
$bp = buddypress();
|
1765 |
Â
|
1766 |
-
|
Â
|
|
Â
|
|
1767 |
Â
}
|
1768 |
Â
|
1769 |
Â
/**
|
107 |
Â
* @since 1.1.0
|
108 |
Â
* @var int
|
109 |
Â
*/
|
110 |
+
var $hide_sitewide = 0;
|
111 |
Â
|
112 |
Â
/**
|
113 |
Â
* Node boundary start for activity or activity comment.
|
133 |
Â
*/
|
134 |
Â
var $is_spam;
|
135 |
Â
|
136 |
+
/**
|
137 |
+
* Error holder.
|
138 |
+
*
|
139 |
+
* @since 2.6.0
|
140 |
+
*
|
141 |
+
* @var WP_Error
|
142 |
+
*/
|
143 |
+
public $errors;
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Error type to return. Either 'bool' or 'wp_error'.
|
147 |
+
*
|
148 |
+
* @since 2.6.0
|
149 |
+
*
|
150 |
+
* @var string
|
151 |
+
*/
|
152 |
+
public $error_type = 'bool';
|
153 |
+
|
154 |
Â
/**
|
155 |
Â
* Constructor method.
|
156 |
Â
*
|
159 |
Â
* @param int|bool $id Optional. The ID of a specific activity item.
|
160 |
Â
*/
|
161 |
Â
public function __construct( $id = false ) {
|
162 |
+
// Instantiate errors object.
|
163 |
+
$this->errors = new WP_Error;
|
164 |
+
|
165 |
Â
if ( !empty( $id ) ) {
|
166 |
+
$this->id = (int) $id;
|
167 |
Â
$this->populate();
|
168 |
Â
}
|
169 |
Â
}
|
196 |
Â
$this->action = $row->action;
|
197 |
Â
$this->content = $row->content;
|
198 |
Â
$this->date_recorded = $row->date_recorded;
|
199 |
+
$this->hide_sitewide = (int) $row->hide_sitewide;
|
200 |
Â
$this->mptt_left = (int) $row->mptt_left;
|
201 |
Â
$this->mptt_right = (int) $row->mptt_right;
|
202 |
+
$this->is_spam = (int) $row->is_spam;
|
203 |
Â
}
|
204 |
Â
|
205 |
Â
// Generate dynamic 'action' when possible.
|
256 |
Â
*/
|
257 |
Â
do_action_ref_array( 'bp_activity_before_save', array( &$this ) );
|
258 |
Â
|
259 |
+
if ( 'wp_error' === $this->error_type && $this->errors->get_error_code() ) {
|
260 |
+
return $this->errors;
|
261 |
+
}
|
262 |
+
|
263 |
Â
if ( empty( $this->component ) || empty( $this->type ) ) {
|
264 |
+
if ( 'bool' === $this->error_type ) {
|
265 |
+
return false;
|
266 |
+
} else {
|
267 |
+
if ( empty( $this->component ) ) {
|
268 |
+
$this->errors->add( 'bp_activity_missing_component' );
|
269 |
+
} else {
|
270 |
+
$this->errors->add( 'bp_activity_missing_type' );
|
271 |
+
}
|
272 |
+
|
273 |
+
return $this->errors;
|
274 |
+
}
|
275 |
Â
}
|
276 |
Â
|
277 |
Â
if ( empty( $this->primary_link ) ) {
|
743 |
Â
|
744 |
Â
// Now fetch data from the cache.
|
745 |
Â
foreach ( $activity_ids as $activity_id ) {
|
746 |
+
// Integer casting.
|
747 |
+
$activity = wp_cache_get( $activity_id, 'bp_activity' );
|
748 |
+
if ( ! empty( $activity ) ) {
|
749 |
+
$activity->id = (int) $activity->id;
|
750 |
+
$activity->user_id = (int) $activity->user_id;
|
751 |
+
$activity->item_id = (int) $activity->item_id;
|
752 |
+
$activity->secondary_item_id = (int) $activity->secondary_item_id;
|
753 |
+
$activity->hide_sitewide = (int) $activity->hide_sitewide;
|
754 |
+
$activity->mptt_left = (int) $activity->mptt_left;
|
755 |
+
$activity->mptt_right = (int) $activity->mptt_right;
|
756 |
+
$activity->is_spam = (int) $activity->is_spam;
|
757 |
+
}
|
758 |
+
|
759 |
+
$activities[] = $activity;
|
760 |
Â
}
|
761 |
Â
|
762 |
Â
// Then fetch user data.
|
1119 |
Â
|
1120 |
Â
if ( ! empty( $where_args ) ) {
|
1121 |
Â
$where_sql = 'WHERE ' . join( ' AND ', $where_args );
|
1122 |
+
$result = $wpdb->get_var( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" );
|
1123 |
+
|
1124 |
+
return is_numeric( $result ) ? (int) $result : false;
|
1125 |
Â
}
|
1126 |
Â
|
1127 |
Â
return false;
|
1813 |
Â
|
1814 |
Â
$bp = buddypress();
|
1815 |
Â
|
1816 |
+
$result = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE content = %s", $content ) );
|
1817 |
+
|
1818 |
+
return is_numeric( $result ) ? (int) $result : false;
|
1819 |
Â
}
|
1820 |
Â
|
1821 |
Â
/**
|
@@ -32,6 +32,7 @@ class BP_Activity_Component extends BP_Component {
|
|
32 |
Â
array(
|
33 |
Â
'adminbar_myaccount_order' => 10,
|
34 |
Â
'search_query_arg' => 'activity_search',
|
Â
|
|
35 |
Â
)
|
36 |
Â
);
|
37 |
Â
}
|
@@ -53,13 +54,17 @@ class BP_Activity_Component extends BP_Component {
|
|
53 |
Â
'actions',
|
54 |
Â
'screens',
|
55 |
Â
'filters',
|
56 |
-
'
|
57 |
Â
'template',
|
58 |
Â
'functions',
|
59 |
Â
'notifications',
|
60 |
Â
'cache'
|
61 |
Â
);
|
62 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
63 |
Â
// Load Akismet support if Akismet is configured.
|
64 |
Â
$akismet_key = bp_get_option( 'wordpress_api_key' );
|
65 |
Â
|
@@ -68,6 +73,11 @@ class BP_Activity_Component extends BP_Component {
|
|
68 |
Â
$includes[] = 'akismet';
|
69 |
Â
}
|
70 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
71 |
Â
if ( is_admin() ) {
|
72 |
Â
$includes[] = 'admin';
|
73 |
Â
}
|
@@ -128,10 +138,6 @@ class BP_Activity_Component extends BP_Component {
|
|
128 |
Â
* @since 1.5.0
|
129 |
Â
*
|
130 |
Â
* @see BP_Component::setup_nav() for a description of arguments.
|
131 |
-
* @uses bp_is_active()
|
132 |
-
* @uses is_user_logged_in()
|
133 |
-
* @uses bp_get_friends_slug()
|
134 |
-
* @uses bp_get_groups_slug()
|
135 |
Â
*
|
136 |
Â
* @param array $main_nav Optional. See BP_Component::setup_nav() for description.
|
137 |
Â
* @param array $sub_nav Optional. See BP_Component::setup_nav() for description.
|
@@ -237,13 +243,6 @@ class BP_Activity_Component extends BP_Component {
|
|
237 |
Â
*
|
238 |
Â
* @see BP_Component::setup_nav() for a description of the $wp_admin_nav
|
239 |
Â
* parameter array.
|
240 |
-
* @uses is_user_logged_in()
|
241 |
-
* @uses trailingslashit()
|
242 |
-
* @uses bp_get_total_mention_count_for_user()
|
243 |
-
* @uses bp_loggedin_user_id()
|
244 |
-
* @uses bp_is_active()
|
245 |
-
* @uses bp_get_friends_slug()
|
246 |
-
* @uses bp_get_groups_slug()
|
247 |
Â
*
|
248 |
Â
* @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a
|
249 |
Â
* description.
|
@@ -260,7 +259,11 @@ class BP_Activity_Component extends BP_Component {
|
|
260 |
Â
if ( bp_activity_do_mentions() ) {
|
261 |
Â
$count = bp_get_total_mention_count_for_user( bp_loggedin_user_id() );
|
262 |
Â
if ( !empty( $count ) ) {
|
263 |
-
$title = sprintf(
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
264 |
Â
} else {
|
265 |
Â
$title = _x( 'Mentions', 'Toolbar Mention logged in user', 'buddypress' );
|
266 |
Â
}
|
@@ -336,9 +339,6 @@ class BP_Activity_Component extends BP_Component {
|
|
336 |
Â
*
|
337 |
Â
* @since 1.5.0
|
338 |
Â
*
|
339 |
-
* @uses bp_is_activity_component()
|
340 |
-
* @uses bp_is_my_profile()
|
341 |
-
* @uses bp_core_fetch_avatar()
|
342 |
Â
*/
|
343 |
Â
public function setup_title() {
|
344 |
Â
|
32 |
Â
array(
|
33 |
Â
'adminbar_myaccount_order' => 10,
|
34 |
Â
'search_query_arg' => 'activity_search',
|
35 |
+
'features' => array( 'embeds' )
|
36 |
Â
)
|
37 |
Â
);
|
38 |
Â
}
|
54 |
Â
'actions',
|
55 |
Â
'screens',
|
56 |
Â
'filters',
|
57 |
+
'adminbar',
|
58 |
Â
'template',
|
59 |
Â
'functions',
|
60 |
Â
'notifications',
|
61 |
Â
'cache'
|
62 |
Â
);
|
63 |
Â
|
64 |
+
if ( ! buddypress()->do_autoload ) {
|
65 |
+
$includes[] = 'classes';
|
66 |
+
}
|
67 |
+
|
68 |
Â
// Load Akismet support if Akismet is configured.
|
69 |
Â
$akismet_key = bp_get_option( 'wordpress_api_key' );
|
70 |
Â
|
73 |
Â
$includes[] = 'akismet';
|
74 |
Â
}
|
75 |
Â
|
76 |
+
// Embeds - only applicable for WP 4.5+
|
77 |
+
if ( version_compare( $GLOBALS['wp_version'], '4.5', '>=' ) && bp_is_active( $this->id, 'embeds' ) ) {
|
78 |
+
$includes[] = 'embeds';
|
79 |
+
}
|
80 |
+
|
81 |
Â
if ( is_admin() ) {
|
82 |
Â
$includes[] = 'admin';
|
83 |
Â
}
|
138 |
Â
* @since 1.5.0
|
139 |
Â
*
|
140 |
Â
* @see BP_Component::setup_nav() for a description of arguments.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
141 |
Â
*
|
142 |
Â
* @param array $main_nav Optional. See BP_Component::setup_nav() for description.
|
143 |
Â
* @param array $sub_nav Optional. See BP_Component::setup_nav() for description.
|
243 |
Â
*
|
244 |
Â
* @see BP_Component::setup_nav() for a description of the $wp_admin_nav
|
245 |
Â
* parameter array.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
246 |
Â
*
|
247 |
Â
* @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a
|
248 |
Â
* description.
|
259 |
Â
if ( bp_activity_do_mentions() ) {
|
260 |
Â
$count = bp_get_total_mention_count_for_user( bp_loggedin_user_id() );
|
261 |
Â
if ( !empty( $count ) ) {
|
262 |
+
$title = sprintf(
|
263 |
+
/* translators: %s: Unread mention count for the current user */
|
264 |
+
_x( 'Mentions %s', 'Toolbar Mention logged in user', 'buddypress' ),
|
265 |
+
'<span class="count">' . bp_core_number_format( $count ) . '</span>'
|
266 |
+
);
|
267 |
Â
} else {
|
268 |
Â
$title = _x( 'Mentions', 'Toolbar Mention logged in user', 'buddypress' );
|
269 |
Â
}
|
339 |
Â
*
|
340 |
Â
* @since 1.5.0
|
341 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
342 |
Â
*/
|
343 |
Â
public function setup_title() {
|
344 |
Â
|
@@ -243,7 +243,10 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
243 |
Â
function display() {
|
244 |
Â
$this->display_tablenav( 'top' ); ?>
|
245 |
Â
|
246 |
-
<h2 class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
247 |
Â
|
248 |
Â
<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
|
249 |
Â
<thead>
|
@@ -252,15 +255,15 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
252 |
Â
</tr>
|
253 |
Â
</thead>
|
254 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
255 |
Â
<tfoot>
|
256 |
Â
<tr>
|
257 |
Â
<?php $this->print_column_headers( false ); ?>
|
258 |
Â
</tr>
|
259 |
Â
</tfoot>
|
260 |
-
|
261 |
-
<tbody id="the-comment-list">
|
262 |
-
<?php $this->display_rows_or_placeholder(); ?>
|
263 |
-
</tbody>
|
264 |
Â
</table>
|
265 |
Â
<?php
|
266 |
Â
|
@@ -304,7 +307,10 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
304 |
Â
function get_views() {
|
305 |
Â
$url_base = add_query_arg( array( 'page' => 'bp-activity' ), bp_get_admin_url( 'admin.php' ) ); ?>
|
306 |
Â
|
307 |
-
<h2 class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
308 |
Â
|
309 |
Â
<ul class="subsubsub">
|
310 |
Â
<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>
|
@@ -414,7 +420,10 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
414 |
Â
$activity_actions = bp_activity_get_actions(); ?>
|
415 |
Â
|
416 |
Â
<div class="alignleft actions">
|
417 |
-
<label for="activity-type" class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
418 |
Â
<select name="activity_type" id="activity-type">
|
419 |
Â
<option value="" <?php selected( ! $selected ); ?>><?php _e( 'View all actions', 'buddypress' ); ?></option>
|
420 |
Â
|
@@ -488,6 +497,7 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
488 |
Â
* @param array $item A singular item (one full row).
|
489 |
Â
*/
|
490 |
Â
function column_cb( $item ) {
|
Â
|
|
491 |
Â
printf( '<label class="screen-reader-text" for="aid-%1$d">' . __( 'Select activity item %1$d', 'buddypress' ) . '</label><input type="checkbox" name="aid[]" value="%1$d" id="aid-%1$d" />', $item['id'] );
|
492 |
Â
}
|
493 |
Â
|
243 |
Â
function display() {
|
244 |
Â
$this->display_tablenav( 'top' ); ?>
|
245 |
Â
|
246 |
+
<h2 class="screen-reader-text"><?php
|
247 |
+
/* translators: accessibility text */
|
248 |
+
_e( 'Activities list', 'buddypress' );
|
249 |
+
?></h2>
|
250 |
Â
|
251 |
Â
<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
|
252 |
Â
<thead>
|
255 |
Â
</tr>
|
256 |
Â
</thead>
|
257 |
Â
|
258 |
+
<tbody id="the-comment-list">
|
259 |
+
<?php $this->display_rows_or_placeholder(); ?>
|
260 |
+
</tbody>
|
261 |
+
|
262 |
Â
<tfoot>
|
263 |
Â
<tr>
|
264 |
Â
<?php $this->print_column_headers( false ); ?>
|
265 |
Â
</tr>
|
266 |
Â
</tfoot>
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
267 |
Â
</table>
|
268 |
Â
<?php
|
269 |
Â
|
307 |
Â
function get_views() {
|
308 |
Â
$url_base = add_query_arg( array( 'page' => 'bp-activity' ), bp_get_admin_url( 'admin.php' ) ); ?>
|
309 |
Â
|
310 |
+
<h2 class="screen-reader-text"><?php
|
311 |
+
/* translators: accessibility text */
|
312 |
+
_e( 'Filter activities list', 'buddypress' );
|
313 |
+
?></h2>
|
314 |
Â
|
315 |
Â
<ul class="subsubsub">
|
316 |
Â
<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>
|
420 |
Â
$activity_actions = bp_activity_get_actions(); ?>
|
421 |
Â
|
422 |
Â
<div class="alignleft actions">
|
423 |
+
<label for="activity-type" class="screen-reader-text"><?php
|
424 |
+
/* translators: accessibility text */
|
425 |
+
_e( 'Filter by activity type', 'buddypress' );
|
426 |
+
?></label>
|
427 |
Â
<select name="activity_type" id="activity-type">
|
428 |
Â
<option value="" <?php selected( ! $selected ); ?>><?php _e( 'View all actions', 'buddypress' ); ?></option>
|
429 |
Â
|
497 |
Â
* @param array $item A singular item (one full row).
|
498 |
Â
*/
|
499 |
Â
function column_cb( $item ) {
|
500 |
+
/* translators: accessibility text */
|
501 |
Â
printf( '<label class="screen-reader-text" for="aid-%1$d">' . __( 'Select activity item %1$d', 'buddypress' ) . '</label><input type="checkbox" name="aid[]" value="%1$d" id="aid-%1$d" />', $item['id'] );
|
502 |
Â
}
|
503 |
Â
|
@@ -0,0 +1,329 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BuddyPress Activity Classes.
|
4 |
+
*
|
5 |
+
* @package BuddyPress
|
6 |
+
* @subpackage Embeds
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Exit if accessed directly.
|
10 |
+
defined( 'ABSPATH' ) || exit;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* oEmbed handler to respond and render single activity items.
|
14 |
+
*
|
15 |
+
* @since 2.6.0
|
16 |
+
*/
|
17 |
+
class BP_Activity_oEmbed_Extension extends BP_Core_oEmbed_Extension {
|
18 |
+
/**
|
19 |
+
* Custom oEmbed slug endpoint.
|
20 |
+
*
|
21 |
+
* @since 2.6.0
|
22 |
+
*
|
23 |
+
* @var string
|
24 |
+
*/
|
25 |
+
public $slug_endpoint = 'activity';
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Custom hooks.
|
29 |
+
*
|
30 |
+
* @since 2.6.0
|
31 |
+
*/
|
32 |
+
protected function custom_hooks() {
|
33 |
+
add_action( 'oembed_dataparse', array( $this, 'use_custom_iframe_sandbox_attribute' ), 20, 3 );
|
34 |
+
add_action( 'embed_content_meta', array( $this, 'embed_comments_button' ), 5 );
|
35 |
+
add_action( 'get_template_part_assets/embeds/header', array( $this, 'on_activity_header' ), 10, 2 );
|
36 |
+
|
37 |
+
add_filter( 'bp_activity_embed_html', array( $this, 'modify_iframe' ) );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Add custom endpoint arguments.
|
42 |
+
*
|
43 |
+
* Currently, includes 'hide_media'.
|
44 |
+
*
|
45 |
+
* @since 2.6.0
|
46 |
+
*
|
47 |
+
* @return array
|
48 |
+
*/
|
49 |
+
protected function set_route_args() {
|
50 |
+
return array(
|
51 |
+
'hide_media' => array(
|
52 |
+
'default' => false,
|
53 |
+
'sanitize_callback' => 'wp_validate_boolean'
|
54 |
+
)
|
55 |
+
);
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Output our custom embed template part.
|
60 |
+
*
|
61 |
+
* @since 2.6.0
|
62 |
+
*/
|
63 |
+
protected function content() {
|
64 |
+
bp_get_asset_template_part( 'embeds/activity' );
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Check if we're on our single activity page.
|
69 |
+
*
|
70 |
+
* @since 2.6.0
|
71 |
+
*
|
72 |
+
* @return bool
|
73 |
+
*/
|
74 |
+
protected function is_page() {
|
75 |
+
return bp_is_single_activity();
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Validates the URL to determine if the activity item is valid.
|
80 |
+
*
|
81 |
+
* @since 2.6.0
|
82 |
+
*
|
83 |
+
* @param string $url The URL to check.
|
84 |
+
* @return int|bool Activity ID on success; boolean false on failure.
|
85 |
+
*/
|
86 |
+
protected function validate_url_to_item_id( $url ) {
|
87 |
+
if ( bp_core_enable_root_profiles() ) {
|
88 |
+
$domain = bp_get_root_domain();
|
89 |
+
} else {
|
90 |
+
$domain = bp_get_members_directory_permalink();
|
91 |
+
}
|
92 |
+
|
93 |
+
// Check the URL to see if this is a single activity URL.
|
94 |
+
if ( 0 !== strpos( $url, $domain ) ) {
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
|
98 |
+
// Check for activity slug.
|
99 |
+
if ( false === strpos( $url, '/' . bp_get_activity_slug() . '/' ) ) {
|
100 |
+
return false;
|
101 |
+
}
|
102 |
+
|
103 |
+
// Do more checks.
|
104 |
+
$url = trim( untrailingslashit( $url ) );
|
105 |
+
|
106 |
+
// Grab the activity ID.
|
107 |
+
$activity_id = (int) substr(
|
108 |
+
$url,
|
109 |
+
strrpos( $url, '/' ) + 1
|
110 |
+
);
|
111 |
+
|
112 |
+
if ( ! empty( $activity_id ) ) {
|
113 |
+
// Check if activity item still exists.
|
114 |
+
$activity = new BP_Activity_Activity( $activity_id );
|
115 |
+
|
116 |
+
// Okay, we're good to go!
|
117 |
+
if ( ! empty( $activity->component ) && 0 === (int) $activity->is_spam ) {
|
118 |
+
return $activity_id;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
return false;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Sets the oEmbed response data for our activity item.
|
127 |
+
*
|
128 |
+
* @since 2.6.0
|
129 |
+
*
|
130 |
+
* @param int $item_id The activity ID.
|
131 |
+
* @return array
|
132 |
+
*/
|
133 |
+
protected function set_oembed_response_data( $item_id ) {
|
134 |
+
$activity = new BP_Activity_Activity( $item_id );
|
135 |
+
|
136 |
+
return array(
|
137 |
+
'content' => $activity->content,
|
138 |
+
'title' => __( 'Activity', 'buddypress' ),
|
139 |
+
'author_name' => bp_core_get_user_displayname( $activity->user_id ),
|
140 |
+
'author_url' => bp_core_get_user_domain( $activity->user_id ),
|
141 |
+
|
142 |
+
// Custom identifier.
|
143 |
+
'x_buddypress' => 'activity'
|
144 |
+
);
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Sets a custom <blockquote> for our oEmbed fallback HTML.
|
149 |
+
*
|
150 |
+
* @since 2.6.0
|
151 |
+
*
|
152 |
+
* @param int $item_id The activity ID.
|
153 |
+
* @return string
|
154 |
+
*/
|
155 |
+
protected function set_fallback_html( $item_id ) {
|
156 |
+
$activity = new BP_Activity_Activity( $item_id );
|
157 |
+
$mentionname = bp_activity_do_mentions() ? ' (@' . bp_activity_get_user_mentionname( $activity->user_id ) . ')' : '';
|
158 |
+
$date = date_i18n( get_option( 'date_format' ), strtotime( $activity->date_recorded ) );
|
159 |
+
|
160 |
+
// Make sure we can use some activity functions that depend on the loop.
|
161 |
+
$GLOBALS['activities_template'] = new stdClass;
|
162 |
+
$GLOBALS['activities_template']->activity = $activity;
|
163 |
+
|
164 |
+
// 'wp-embedded-content' CSS class is necessary due to how the embed JS works.
|
165 |
+
$blockquote = sprintf( '<blockquote class="wp-embedded-content bp-activity-item">%1$s%2$s %3$s</blockquote>',
|
166 |
+
bp_activity_get_embed_excerpt( $activity->content ),
|
167 |
+
'- ' . bp_core_get_user_displayname( $activity->user_id ) . $mentionname,
|
168 |
+
'<a href="' . esc_url( bp_activity_get_permalink( $item_id ) ) . '">' . $date . '</a>'
|
169 |
+
);
|
170 |
+
|
171 |
+
// Clean up.
|
172 |
+
unset( $GLOBALS['activities_template'] );
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Filters the fallback HTML used when embedding a BP activity item.
|
176 |
+
*
|
177 |
+
* @since 2.6.0
|
178 |
+
*
|
179 |
+
* @param string $blockquote Current fallback HTML
|
180 |
+
* @param BP_Activity_Activity $activity Activity object
|
181 |
+
*/
|
182 |
+
return apply_filters( 'bp_activity_embed_fallback_html', $blockquote, $activity );
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Sets a custom <iframe> title for our oEmbed item.
|
187 |
+
*
|
188 |
+
* @since 2.6.0
|
189 |
+
*
|
190 |
+
* @param int $item_id The activity ID
|
191 |
+
* @return string
|
192 |
+
*/
|
193 |
+
protected function set_iframe_title( $item_id ) {
|
194 |
+
return __( 'Embedded Activity Item', 'buddypress' );
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Use our custom <iframe> sandbox attribute in our oEmbed response.
|
199 |
+
*
|
200 |
+
* WordPress sets the <iframe> sandbox attribute to 'allow-scripts' regardless
|
201 |
+
* of whatever the oEmbed response is in {@link wp_filter_oembed_result()}. We
|
202 |
+
* need to add back our custom sandbox value so links will work.
|
203 |
+
*
|
204 |
+
* @since 2.6.0
|
205 |
+
*
|
206 |
+
* @see BP_Activity_Component::modify_iframe() where our custom sandbox value is set.
|
207 |
+
*
|
208 |
+
* @param string $result The oEmbed HTML result.
|
209 |
+
* @param object $data A data object result from an oEmbed provider.
|
210 |
+
* @param string $url The URL of the content to be embedded.
|
211 |
+
* @return string
|
212 |
+
*/
|
213 |
+
public function use_custom_iframe_sandbox_attribute( $result, $data, $url ) {
|
214 |
+
// Make sure we are on a BuddyPress activity oEmbed request.
|
215 |
+
if ( false === isset( $data->x_buddypress ) || 'activity' !== $data->x_buddypress ) {
|
216 |
+
return $result;
|
217 |
+
}
|
218 |
+
|
219 |
+
// Get unfiltered sandbox attribute from our own oEmbed response.
|
220 |
+
$sandbox_pos = strpos( $data->html, 'sandbox=' ) + 9;
|
221 |
+
$sandbox = substr( $data->html, $sandbox_pos, strpos( $data->html, '"', $sandbox_pos ) - $sandbox_pos );
|
222 |
+
|
223 |
+
// Replace only if our sandbox attribute contains 'allow-top-navigation'.
|
224 |
+
if ( false !== strpos( $sandbox, 'allow-top-navigation' ) ) {
|
225 |
+
$result = str_replace( ' sandbox="allow-scripts"', " sandbox=\"{$sandbox}\"", $result );
|
226 |
+
|
227 |
+
// Also remove 'security' attribute; this is only used for IE < 10.
|
228 |
+
$result = str_replace( 'security="restricted"', "", $result );
|
229 |
+
}
|
230 |
+
|
231 |
+
return $result;
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Modify various IFRAME-related items if embeds are allowed.
|
236 |
+
*
|
237 |
+
* HTML modified:
|
238 |
+
* - Add sandbox="allow-top-navigation" attribute. This allows links to work
|
239 |
+
* within the iframe sandbox attribute.
|
240 |
+
*
|
241 |
+
* JS modified:
|
242 |
+
* - Remove IFRAME height restriction of 1000px. Fixes long embed items being
|
243 |
+
* truncated.
|
244 |
+
*
|
245 |
+
* @since 2.6.0
|
246 |
+
*
|
247 |
+
* @param string $retval Current embed HTML.
|
248 |
+
* @return string
|
249 |
+
*/
|
250 |
+
public function modify_iframe( $retval ) {
|
251 |
+
// Add 'allow-top-navigation' to allow links to be clicked.
|
252 |
+
$retval = str_replace( 'sandbox="', 'sandbox="allow-top-navigation ', $retval );
|
253 |
+
|
254 |
+
// See /wp-includes/js/wp-embed.js.
|
255 |
+
if ( SCRIPT_DEBUG ) {
|
256 |
+
// Removes WP's hardcoded IFRAME height restriction.
|
257 |
+
$retval = str_replace( 'height = 1000;', 'height = height;', $retval );
|
258 |
+
|
259 |
+
// This is for the WP build minified version.
|
260 |
+
} else {
|
261 |
+
$retval = str_replace( 'g=1e3', 'g=g', $retval );
|
262 |
+
}
|
263 |
+
|
264 |
+
return $retval;
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Do stuff when our oEmbed activity header template part is loading.
|
269 |
+
*
|
270 |
+
* Currently, removes wpautop() from the bp_activity_action() function.
|
271 |
+
*
|
272 |
+
* @since 2.6.0
|
273 |
+
*
|
274 |
+
* @param string $slug Template part slug requested.
|
275 |
+
* @param string $name Template part name requested.
|
276 |
+
*/
|
277 |
+
public function on_activity_header( $slug, $name ) {
|
278 |
+
if ( false === $this->is_page() || 'activity' !== $name ) {
|
279 |
+
return;
|
280 |
+
}
|
281 |
+
|
282 |
+
remove_filter( 'bp_get_activity_action', 'wpautop' );
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Prints the markup for the activity embed comments button.
|
287 |
+
*
|
288 |
+
* Basically a copy of {@link print_embed_comments_button()}, but modified for
|
289 |
+
* the BP activity component.
|
290 |
+
*
|
291 |
+
* @since 2.6.0
|
292 |
+
*/
|
293 |
+
public function embed_comments_button() {
|
294 |
+
if ( ! did_action( 'bp_embed_content' ) || ! bp_is_single_activity() ) {
|
295 |
+
return;
|
296 |
+
}
|
297 |
+
|
298 |
+
// Make sure our custom permalink shows up in the 'WordPress Embed' block.
|
299 |
+
add_filter( 'the_permalink', array( $this, 'filter_embed_url' ) );
|
300 |
+
|
301 |
+
// Only show comment bubble if we have some activity comments.
|
302 |
+
$count = bp_activity_get_comment_count();
|
303 |
+
if ( empty( $count ) ) {
|
304 |
+
return;
|
305 |
+
}
|
306 |
+
?>
|
307 |
+
|
308 |
+
<div class="wp-embed-comments">
|
309 |
+
<a href="<?php bp_activity_thread_permalink(); ?>">
|
310 |
+
<span class="dashicons dashicons-admin-comments"></span>
|
311 |
+
<?php
|
312 |
+
printf(
|
313 |
+
_n(
|
314 |
+
/* translators: accessibility text */
|
315 |
+
'%s <span class="screen-reader-text">Comment</span>',
|
316 |
+
/* translators: accessibility text */
|
317 |
+
'%s <span class="screen-reader-text">Comments</span>',
|
318 |
+
$count,
|
319 |
+
'buddypress'
|
320 |
+
),
|
321 |
+
number_format_i18n( $count )
|
322 |
+
);
|
323 |
+
?>
|
324 |
+
</a>
|
325 |
+
</div>
|
326 |
+
|
327 |
+
<?php
|
328 |
+
}
|
329 |
+
}
|
@@ -11,9 +11,8 @@
|
|
11 |
Â
top: 0;
|
12 |
Â
z-index: 1000; /* >999 for wp-admin */
|
13 |
Â
}
|
14 |
-
/* @noflip */
|
15 |
Â
.atwho-view {
|
16 |
-
left: 0;
|
17 |
Â
}
|
18 |
Â
.atwho-view ul {
|
19 |
Â
background: #FFF;
|
@@ -42,7 +41,7 @@
|
|
42 |
Â
}
|
43 |
Â
.atwho-view strong {
|
44 |
Â
background: #EFEFEF;
|
45 |
-
font: bold;
|
46 |
Â
}
|
47 |
Â
.atwho-view .username strong {
|
48 |
Â
color: #D54E21;
|
11 |
Â
top: 0;
|
12 |
Â
z-index: 1000; /* >999 for wp-admin */
|
13 |
Â
}
|
Â
|
|
14 |
Â
.atwho-view {
|
15 |
+
left: 0;
|
16 |
Â
}
|
17 |
Â
.atwho-view ul {
|
18 |
Â
background: #FFF;
|
41 |
Â
}
|
42 |
Â
.atwho-view strong {
|
43 |
Â
background: #EFEFEF;
|
44 |
+
font-weight: bold;
|
45 |
Â
}
|
46 |
Â
.atwho-view .username strong {
|
47 |
Â
color: #D54E21;
|
@@ -1 +1 @@
|
|
1 |
-
.atwho-view{background:rgba(204,204,204,.8);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{background:#FFF;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}}@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}.atwho-view{border-radius:0;height:100%;right:0!important;width:100%}.atwho-view ul li .username{display:inline-block;margin:-10px 0 0;padding:10px 0}.atwho-view ul li small{display:inline-block;margin-right:20px}}
|
1 |
+
.atwho-view{background:rgba(204,204,204,.8);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{background:#FFF;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-weight: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}}@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}.atwho-view{border-radius:0;height:100%;right:0!important;width:100%}.atwho-view ul li .username{display:inline-block;margin:-10px 0 0;padding:10px 0}.atwho-view ul li small{display:inline-block;margin-right:20px}}
|
@@ -11,9 +11,9 @@
|
|
11 |
Â
top: 0;
|
12 |
Â
z-index: 1000; /* >999 for wp-admin */
|
13 |
Â
}
|
14 |
-
/*
|
15 |
Â
.atwho-view {
|
16 |
-
left: 0;
|
17 |
Â
}
|
18 |
Â
.atwho-view ul {
|
19 |
Â
background: #FFF;
|
@@ -42,7 +42,7 @@
|
|
42 |
Â
}
|
43 |
Â
.atwho-view strong {
|
44 |
Â
background: #EFEFEF;
|
45 |
-
font: bold;
|
46 |
Â
}
|
47 |
Â
.atwho-view .username strong {
|
48 |
Â
color: #D54E21;
|
11 |
Â
top: 0;
|
12 |
Â
z-index: 1000; /* >999 for wp-admin */
|
13 |
Â
}
|
14 |
+
/* rtl:ignore */
|
15 |
Â
.atwho-view {
|
16 |
+
left: 0;
|
17 |
Â
}
|
18 |
Â
.atwho-view ul {
|
19 |
Â
background: #FFF;
|
42 |
Â
}
|
43 |
Â
.atwho-view strong {
|
44 |
Â
background: #EFEFEF;
|
45 |
+
font-weight: bold;
|
46 |
Â
}
|
47 |
Â
.atwho-view .username strong {
|
48 |
Â
color: #D54E21;
|
@@ -1 +1 @@
|
|
1 |
-
.atwho-view{background:rgba(204,204,204,.8);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{background:#FFF;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}}@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}.atwho-view{border-radius:0;height:100%;left:0!important;width:100%}.atwho-view ul li .username{display:inline-block;margin:-10px 0 0;padding:10px 0}.atwho-view ul li small{display:inline-block;margin-left:20px}}
|
1 |
+
.atwho-view{background:rgba(204,204,204,.8);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{background:#FFF;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-weight: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}}@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}.atwho-view{border-radius:0;height:100%;left:0!important;width:100%}.atwho-view ul li .username{display:inline-block;margin:-10px 0 0;padding:10px 0}.atwho-view ul li small{display:inline-block;margin-left:20px}}
|
@@ -248,7 +248,7 @@ window.bp = window.bp || {};
|
|
248 |
Â
return;
|
249 |
Â
} else {
|
250 |
Â
$( window.tinyMCE.activeEditor.contentDocument.activeElement )
|
251 |
-
.atwho( 'setIframe', $( '
|
252 |
Â
.bp_mentions( bp.mentions.users );
|
253 |
Â
}
|
254 |
Â
};
|
248 |
Â
return;
|
249 |
Â
} else {
|
250 |
Â
$( window.tinyMCE.activeEditor.contentDocument.activeElement )
|
251 |
+
.atwho( 'setIframe', $( '.wp-editor-wrap iframe' )[0] )
|
252 |
Â
.bp_mentions( bp.mentions.users );
|
253 |
Â
}
|
254 |
Â
};
|
@@ -1,2 +1 @@
|
|
1 |
-
|
2 |
-
window.bp=window.bp||{},function(a,b,c){var d,e=[];a.mentions=a.mentions||{},a.mentions.users=window.bp.mentions.users||[],"object"==typeof window.BP_Suggestions&&(a.mentions.users=window.BP_Suggestions.friends||a.mentions.users),b.fn.bp_mentions=function(a){b.isArray(a)&&(a={data:a});var c={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(a){var c,d,e,f,g=b("#atwho-ground-"+this.id+" .atwho-view"),h=b("body"),i=this.$inputor.data("atwho");"undefined"!==i&&"undefined"!==i.iframe&&null!==i.iframe?(c=this.$inputor.caret("offset",{iframe:i.iframe}),e=b(i.iframe).offset(),"undefined"!==e&&(c.left+=e.left,c.top+=e.top)):c=this.$inputor.caret("offset"),c.left>h.width()/2?(g.addClass("right"),f=c.left-a.left-this.view.$el.width()):(g.removeClass("right"),f=c.left-a.left+1),h.width()<=400&&b(document).scrollTop(c.top-6),d=parseInt(this.$inputor.css("line-height").substr(0,this.$inputor.css("line-height").length-2),10),(!d||5>d)&&(d=19),a.top=c.top+d,a.left+=f},inserting_wrapper:function(a,b,c){return""+b+c}}},f={callbacks:{remote_filter:function(a,c){var f=b(this),g={};return d=e[a],"object"==typeof d?void c(d):(f.xhr&&f.xhr.abort(),g={action:"bp_get_suggestions",term:a,type:"members"},b.isNumeric(this.$inputor.data("suggestions-group-id"))&&(g["group-id"]=parseInt(this.$inputor.data("suggestions-group-id"),10)),void(f.xhr=b.getJSON(ajaxurl,g).done(function(d){if(d.success){var f=b.map(d.data,function(a){return a.search=a.search||a.ID+" "+a.name,a});e[a]=f,c(f)}})))}},data:b.map(a.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=b.extend(!0,{},c,f,a);return b.fn.atwho.call(this,g)},b(document).ready(function(){b(".bp-suggestions, #comments form textarea, .wp-editor-area").bp_mentions(a.mentions.users)}),a.mentions.tinyMCEinit=function(){"undefined"!=typeof window.tinyMCE&&null!==window.tinyMCE.activeEditor&&"undefined"!=typeof window.tinyMCE.activeEditor&&b(window.tinyMCE.activeEditor.contentDocument.activeElement).atwho("setIframe",b("#content_ifr")[0]).bp_mentions(a.mentions.users)}}(bp,jQuery);
|
1 |
+
window.bp=window.bp||{},function(a,b,c){var d,e=[];a.mentions=a.mentions||{},a.mentions.users=window.bp.mentions.users||[],"object"==typeof window.BP_Suggestions&&(a.mentions.users=window.BP_Suggestions.friends||a.mentions.users),b.fn.bp_mentions=function(a){b.isArray(a)&&(a={data:a});var c={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(a){var c,d,e,f,g=b("#atwho-ground-"+this.id+" .atwho-view"),h=b("body"),i=this.$inputor.data("atwho");"undefined"!==i&&"undefined"!==i.iframe&&null!==i.iframe?(c=this.$inputor.caret("offset",{iframe:i.iframe}),e=b(i.iframe).offset(),"undefined"!==e&&(c.left+=e.left,c.top+=e.top)):c=this.$inputor.caret("offset"),c.left>h.width()/2?(g.addClass("right"),f=c.left-a.left-this.view.$el.width()):(g.removeClass("right"),f=c.left-a.left+1),h.width()<=400&&b(document).scrollTop(c.top-6),d=parseInt(this.$inputor.css("line-height").substr(0,this.$inputor.css("line-height").length-2),10),(!d||5>d)&&(d=19),a.top=c.top+d,a.left+=f},inserting_wrapper:function(a,b,c){return""+b+c}}},f={callbacks:{remote_filter:function(a,c){var f=b(this),g={};return d=e[a],"object"==typeof d?void c(d):(f.xhr&&f.xhr.abort(),g={action:"bp_get_suggestions",term:a,type:"members"},b.isNumeric(this.$inputor.data("suggestions-group-id"))&&(g["group-id"]=parseInt(this.$inputor.data("suggestions-group-id"),10)),void(f.xhr=b.getJSON(ajaxurl,g).done(function(d){if(d.success){var f=b.map(d.data,function(a){return a.search=a.search||a.ID+" "+a.name,a});e[a]=f,c(f)}})))}},data:b.map(a.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=b.extend(!0,{},c,f,a);return b.fn.atwho.call(this,g)},b(document).ready(function(){b(".bp-suggestions, #comments form textarea, .wp-editor-area").bp_mentions(a.mentions.users)}),a.mentions.tinyMCEinit=function(){"undefined"!=typeof window.tinyMCE&&null!==window.tinyMCE.activeEditor&&"undefined"!=typeof window.tinyMCE.activeEditor&&b(window.tinyMCE.activeEditor.contentDocument.activeElement).atwho("setIframe",b(".wp-editor-wrap iframe")[0]).bp_mentions(a.mentions.users)}}(bp,jQuery);
|
Â
|
@@ -606,6 +606,124 @@ function bp_blogs_comments_open( $activity ) {
|
|
606 |
Â
return $open;
|
607 |
Â
}
|
608 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
609 |
Â
/** POST COMMENT SYNCHRONIZATION ****************************************/
|
610 |
Â
|
611 |
Â
/**
|
@@ -633,6 +751,12 @@ function bp_blogs_sync_add_from_activity_comment( $comment_id, $params, $parent_
|
|
633 |
Â
return;
|
634 |
Â
}
|
635 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
636 |
Â
// Get userdata.
|
637 |
Â
if ( $params['user_id'] == bp_loggedin_user_id() ) {
|
638 |
Â
$user = buddypress()->loggedin_user->userdata;
|
@@ -830,7 +954,7 @@ function bp_blogs_sync_activity_edit_to_post_comment( BP_Activity_Activity $acti
|
|
830 |
Â
remove_action( 'transition_comment_status', 'bp_activity_transition_post_type_comment_status', 10, 3 );
|
831 |
Â
remove_action( 'bp_activity_post_type_comment', 'bp_blogs_comment_sync_activity_comment', 10, 4 );
|
832 |
Â
|
833 |
-
if ( 1 ===
|
834 |
Â
wp_spam_comment( $post_comment_id );
|
835 |
Â
} elseif ( ! $activity->is_spam ) {
|
836 |
Â
if ( 'spam' === $post_comment_status ) {
|
606 |
Â
return $open;
|
607 |
Â
}
|
608 |
Â
|
609 |
+
/** SITE TRACKING *******************************************************/
|
610 |
+
|
611 |
+
/**
|
612 |
+
* Add an activity entry for a newly-created site.
|
613 |
+
*
|
614 |
+
* Hooked to the 'bp_blogs_new_blog' action.
|
615 |
+
*
|
616 |
+
* @since 2.6.0
|
617 |
+
*
|
618 |
+
* @param BP_Blogs_Blog $recorded_blog Current site being recorded. Passed by reference.
|
619 |
+
* @param bool $is_private Whether the current site being recorded is private.
|
620 |
+
* @param bool $is_recorded Whether the current site was recorded.
|
621 |
+
*/
|
622 |
+
function bp_blogs_record_activity_on_site_creation( $recorded_blog, $is_private, $is_recorded, $no_activity ) {
|
623 |
+
// Only record this activity if the blog is public.
|
624 |
+
if ( ! $is_private && ! $no_activity && bp_blogs_is_blog_trackable( $recorded_blog->blog_id, $recorded_blog->user_id ) ) {
|
625 |
+
bp_blogs_record_activity( array(
|
626 |
+
'user_id' => $recorded_blog->user_id,
|
627 |
+
'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', bp_blogs_get_blogmeta( $recorded_blog->blog_id, 'url' ), $recorded_blog->blog_id ),
|
628 |
+
'type' => 'new_blog',
|
629 |
+
'item_id' => $recorded_blog->blog_id
|
630 |
+
) );
|
631 |
+
}
|
632 |
+
}
|
633 |
+
add_action( 'bp_blogs_new_blog', 'bp_blogs_record_activity_on_site_creation', 10, 4 );
|
634 |
+
|
635 |
+
/**
|
636 |
+
* Deletes the 'new_blog' activity entry when a site is deleted.
|
637 |
+
*
|
638 |
+
* @since 2.6.0
|
639 |
+
*
|
640 |
+
* @param int $blog_id Site ID.
|
641 |
+
*/
|
642 |
+
function bp_blogs_delete_new_blog_activity_for_site( $blog_id ) {
|
643 |
+
bp_blogs_delete_activity( array(
|
644 |
+
'item_id' => $blog_id,
|
645 |
+
'component' => buddypress()->blogs->id,
|
646 |
+
'type' => 'new_blog'
|
647 |
+
) );
|
648 |
+
}
|
649 |
+
add_action( 'bp_blogs_remove_blog', 'bp_blogs_delete_new_blog_activity_for_site' );
|
650 |
+
add_action( 'bp_blogs_remove_blog_for_user', 'bp_blogs_delete_new_blog_activity_for_site' );
|
651 |
+
|
652 |
+
/**
|
653 |
+
* Delete all 'blogs' activity items for a site when the site is deleted.
|
654 |
+
*
|
655 |
+
* @since 2.6.0
|
656 |
+
*
|
657 |
+
* @param int $blog_id Site ID.
|
658 |
+
*/
|
659 |
+
function bp_blogs_delete_activity_for_site( $blog_id ) {
|
660 |
+
bp_blogs_delete_activity( array(
|
661 |
+
'item_id' => $blog_id,
|
662 |
+
'component' => buddypress()->blogs->id,
|
663 |
+
'type' => false
|
664 |
+
) );
|
665 |
+
}
|
666 |
+
add_action( 'bp_blogs_remove_data_for_blog', 'bp_blogs_delete_activity_for_site' );
|
667 |
+
|
668 |
+
/**
|
669 |
+
* Remove a blog post activity item from the activity stream.
|
670 |
+
*
|
671 |
+
* @since 1.0.0
|
672 |
+
*
|
673 |
+
* @param int $post_id ID of the post to be removed.
|
674 |
+
* @param int $blog_id Optional. Defaults to current blog ID.
|
675 |
+
* @param int $user_id Optional. Defaults to the logged-in user ID. This param
|
676 |
+
* is currently unused in the function (but is passed to hooks).
|
677 |
+
* @return bool
|
678 |
+
*/
|
679 |
+
function bp_blogs_remove_post( $post_id, $blog_id = 0, $user_id = 0 ) {
|
680 |
+
global $wpdb;
|
681 |
+
|
682 |
+
if ( empty( $wpdb->blogid ) ) {
|
683 |
+
return false;
|
684 |
+
}
|
685 |
+
|
686 |
+
$post_id = (int) $post_id;
|
687 |
+
|
688 |
+
if ( ! $blog_id ) {
|
689 |
+
$blog_id = (int) $wpdb->blogid;
|
690 |
+
}
|
691 |
+
|
692 |
+
if ( ! $user_id ) {
|
693 |
+
$user_id = bp_loggedin_user_id();
|
694 |
+
}
|
695 |
+
|
696 |
+
/**
|
697 |
+
* Fires before removal of a blog post activity item from the activity stream.
|
698 |
+
*
|
699 |
+
* @since 1.5.0
|
700 |
+
*
|
701 |
+
* @param int $blog_id ID of the blog associated with the post that was removed.
|
702 |
+
* @param int $post_id ID of the post that was removed.
|
703 |
+
* @param int $user_id ID of the user having the blog removed for.
|
704 |
+
*/
|
705 |
+
do_action( 'bp_blogs_before_remove_post', $blog_id, $post_id, $user_id );
|
706 |
+
|
707 |
+
bp_blogs_delete_activity( array(
|
708 |
+
'item_id' => $blog_id,
|
709 |
+
'secondary_item_id' => $post_id,
|
710 |
+
'component' => buddypress()->blogs->id,
|
711 |
+
'type' => 'new_blog_post'
|
712 |
+
) );
|
713 |
+
|
714 |
+
/**
|
715 |
+
* Fires after removal of a blog post activity item from the activity stream.
|
716 |
+
*
|
717 |
+
* @since 1.0.0
|
718 |
+
*
|
719 |
+
* @param int $blog_id ID of the blog associated with the post that was removed.
|
720 |
+
* @param int $post_id ID of the post that was removed.
|
721 |
+
* @param int $user_id ID of the user having the blog removed for.
|
722 |
+
*/
|
723 |
+
do_action( 'bp_blogs_remove_post', $blog_id, $post_id, $user_id );
|
724 |
+
}
|
725 |
+
add_action( 'delete_post', 'bp_blogs_remove_post' );
|
726 |
+
|
727 |
Â
/** POST COMMENT SYNCHRONIZATION ****************************************/
|
728 |
Â
|
729 |
Â
/**
|
751 |
Â
return;
|
752 |
Â
}
|
753 |
Â
|
754 |
+
// Do not sync if the activity comment was marked as spam.
|
755 |
+
$activity = new BP_Activity_Activity( $comment_id );
|
756 |
+
if ( $activity->is_spam ) {
|
757 |
+
return;
|
758 |
+
}
|
759 |
+
|
760 |
Â
// Get userdata.
|
761 |
Â
if ( $params['user_id'] == bp_loggedin_user_id() ) {
|
762 |
Â
$user = buddypress()->loggedin_user->userdata;
|
954 |
Â
remove_action( 'transition_comment_status', 'bp_activity_transition_post_type_comment_status', 10, 3 );
|
955 |
Â
remove_action( 'bp_activity_post_type_comment', 'bp_blogs_comment_sync_activity_comment', 10, 4 );
|
956 |
Â
|
957 |
+
if ( 1 === $activity->is_spam && 'spam' !== $post_comment_status ) {
|
958 |
Â
wp_spam_comment( $post_comment_id );
|
959 |
Â
} elseif ( ! $activity->is_spam ) {
|
960 |
Â
if ( 'spam' === $post_comment_status ) {
|
@@ -25,7 +25,6 @@ add_filter( 'bp_blog_latest_post_content', 'prepend_attachment' );
|
|
25 |
Â
*
|
26 |
Â
* @since 1.6.0
|
27 |
Â
*
|
28 |
-
* @uses apply_filters() Filter 'bp_blogs_creation_location' to alter the
|
29 |
Â
* returned value.
|
30 |
Â
*
|
31 |
Â
* @param string $url The original URL (points to wp-signup.php by default).
|
25 |
Â
*
|
26 |
Â
* @since 1.6.0
|
27 |
Â
*
|
Â
|
|
28 |
Â
* returned value.
|
29 |
Â
*
|
30 |
Â
* @param string $url The original URL (points to wp-signup.php by default).
|
@@ -72,68 +72,108 @@ function bp_blogs_get_blogs( $args = '' ) {
|
|
72 |
Â
/**
|
73 |
Â
* Populate the BP blogs table with existing blogs.
|
74 |
Â
*
|
75 |
-
*
|
Â
|
|
76 |
Â
*
|
77 |
-
* @
|
78 |
-
* @
|
79 |
-
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
80 |
Â
*
|
81 |
Â
* @return bool
|
82 |
Â
*/
|
83 |
-
function bp_blogs_record_existing_blogs() {
|
84 |
Â
global $wpdb;
|
85 |
Â
|
86 |
Â
// Query for all sites in network.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
87 |
Â
if ( is_multisite() ) {
|
Â
|
|
Â
|
|
88 |
Â
|
89 |
-
//
|
90 |
-
if (
|
91 |
-
$
|
Â
|
|
92 |
Â
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
}
|
Â
|
|
97 |
Â
|
98 |
-
|
99 |
-
|
100 |
-
|
Â
|
|
Â
|
|
Â
|
|
101 |
Â
}
|
102 |
Â
|
Â
|
|
Â
|
|
103 |
Â
// Record a single site.
|
104 |
Â
} else {
|
105 |
-
|
106 |
-
|
107 |
Â
|
108 |
-
|
109 |
-
|
110 |
-
|
Â
|
|
Â
|
|
111 |
Â
}
|
112 |
Â
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
return false;
|
120 |
-
}
|
121 |
Â
|
122 |
-
// Truncate user blogsmeta table.
|
123 |
-
$truncate = $wpdb->query( "TRUNCATE {$bp->blogs->table_name_blogmeta}" );
|
124 |
-
if ( is_wp_error( $truncate ) ) {
|
125 |
Â
return false;
|
126 |
Â
}
|
127 |
Â
|
128 |
Â
// Loop through users of blogs and record the relationship.
|
129 |
-
foreach ( (array) $
|
130 |
Â
|
131 |
Â
// Ensure that the cache is clear after the table TRUNCATE above.
|
132 |
-
wp_cache_delete( $blog_id, 'blog_meta' );
|
133 |
Â
|
134 |
Â
// Get all users.
|
135 |
Â
$users = get_users( array(
|
136 |
-
'blog_id' => $blog_id
|
Â
|
|
137 |
Â
) );
|
138 |
Â
|
139 |
Â
// Continue on if no users exist for this site (how did this happen?).
|
@@ -142,8 +182,42 @@ function bp_blogs_record_existing_blogs() {
|
|
142 |
Â
}
|
143 |
Â
|
144 |
Â
// Loop through users and record their relationship to this blog.
|
145 |
-
foreach ( (array) $users as $
|
146 |
-
bp_blogs_add_user_to_blog( $
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
147 |
Â
}
|
148 |
Â
}
|
149 |
Â
|
@@ -166,8 +240,6 @@ function bp_blogs_record_existing_blogs() {
|
|
166 |
Â
*
|
167 |
Â
* @since 1.7.0
|
168 |
Â
*
|
169 |
-
* @uses apply_filters()
|
170 |
-
*
|
171 |
Â
* @param int $blog_id ID of the blog being checked.
|
172 |
Â
* @param int $user_id Optional. ID of the user for whom access is being checked.
|
173 |
Â
* @return bool True if blog is recordable, otherwise false.
|
@@ -197,9 +269,6 @@ function bp_blogs_is_blog_recordable( $blog_id, $user_id = 0 ) {
|
|
197 |
Â
*
|
198 |
Â
* @since 1.7.0
|
199 |
Â
*
|
200 |
-
* @uses bp_blogs_is_blog_recordable
|
201 |
-
* @uses apply_filters()
|
202 |
-
*
|
203 |
Â
* @param int $blog_id ID of the blog being checked.
|
204 |
Â
* @param int $user_id Optional. ID of the user for whom access is being checked.
|
205 |
Â
* @return bool True if blog is trackable, otherwise false.
|
@@ -226,8 +295,6 @@ function bp_blogs_is_blog_trackable( $blog_id, $user_id = 0 ) {
|
|
226 |
Â
*
|
227 |
Â
* @since 1.0.0
|
228 |
Â
*
|
229 |
-
* @uses BP_Blogs_Blog
|
230 |
-
*
|
231 |
Â
* @param int $blog_id ID of the blog being recorded.
|
232 |
Â
* @param int $user_id ID of the user for whom the blog is being recorded.
|
233 |
Â
* @param bool $no_activity Optional. Whether to skip recording an activity
|
@@ -279,28 +346,18 @@ function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) {
|
|
279 |
Â
$is_private = !empty( $_POST['blog_public'] ) && (int) $_POST['blog_public'] ? false : true;
|
280 |
Â
$is_private = !apply_filters( 'bp_is_new_blog_public', !$is_private );
|
281 |
Â
|
282 |
-
// Only record this activity if the activity component is active and the blog is public.
|
283 |
-
if ( bp_is_active( 'activity' ) && !$is_private && !$no_activity && bp_blogs_is_blog_trackable( $blog_id, $user_id ) ) {
|
284 |
-
|
285 |
-
// Record this in activity streams.
|
286 |
-
bp_blogs_record_activity( array(
|
287 |
-
'user_id' => $recorded_blog->user_id,
|
288 |
-
'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', $url, $recorded_blog->blog_id ),
|
289 |
-
'type' => 'new_blog',
|
290 |
-
'item_id' => $recorded_blog->blog_id
|
291 |
-
) );
|
292 |
-
}
|
293 |
-
|
294 |
Â
/**
|
295 |
Â
* Fires after BuddyPress has been made aware of a new site for activity tracking.
|
296 |
Â
*
|
297 |
Â
* @since 1.0.0
|
Â
|
|
298 |
Â
*
|
299 |
Â
* @param BP_Blogs_Blog $recorded_blog Current blog being recorded. Passed by reference.
|
300 |
Â
* @param bool $is_private Whether or not the current blog being recorded is private.
|
301 |
Â
* @param bool $is_recorded Whether or not the current blog was recorded.
|
Â
|
|
302 |
Â
*/
|
303 |
-
do_action_ref_array( 'bp_blogs_new_blog', array( &$recorded_blog, $is_private, $is_recorded ) );
|
304 |
Â
}
|
305 |
Â
add_action( 'wpmu_new_blog', 'bp_blogs_record_blog', 10, 2 );
|
306 |
Â
|
@@ -563,11 +620,11 @@ add_action( 'bp_activity_post_type_updated', 'bp_blogs_update_post_activity_meta
|
|
563 |
Â
*
|
564 |
Â
* @since 2.5.0
|
565 |
Â
*
|
566 |
-
* @param int|bool
|
567 |
-
* @param WP_Comment $comment The comment object.
|
568 |
-
* @param array
|
569 |
-
* @param object $activity_post_object The post type tracking args object.
|
570 |
-
* @return int|bool
|
571 |
Â
*/
|
572 |
Â
function bp_blogs_comment_sync_activity_comment( &$activity_id, $comment = null, $activity_args = array(), $activity_post_object = null ) {
|
573 |
Â
if ( empty( $activity_args ) || empty( $comment->post->ID ) || empty( $activity_post_object->comment_action_id ) ) {
|
@@ -815,19 +872,6 @@ function bp_blogs_remove_blog( $blog_id ) {
|
|
815 |
Â
|
816 |
Â
BP_Blogs_Blog::delete_blog_for_all( $blog_id );
|
817 |
Â
|
818 |
-
/**
|
819 |
-
* Delete activity stream item only if the Activity component is active
|
820 |
-
*
|
821 |
-
* @see https://buddypress.trac.wordpress.org/ticket/6937
|
822 |
-
*/
|
823 |
-
if ( bp_is_active( 'activity' ) ) {
|
824 |
-
bp_blogs_delete_activity( array(
|
825 |
-
'item_id' => $blog_id,
|
826 |
-
'component' => buddypress()->blogs->id,
|
827 |
-
'type' => 'new_blog'
|
828 |
-
) );
|
829 |
-
}
|
830 |
-
|
831 |
Â
/**
|
832 |
Â
* Fires after a "blog created" item has been removed from blogs
|
833 |
Â
* tracker and activity stream.
|
@@ -888,67 +932,6 @@ function bp_blogs_remove_blog_for_user( $user_id, $blog_id ) {
|
|
888 |
Â
}
|
889 |
Â
add_action( 'remove_user_from_blog', 'bp_blogs_remove_blog_for_user', 10, 2 );
|
890 |
Â
|
891 |
-
/**
|
892 |
-
* Remove a blog post activity item from the activity stream.
|
893 |
-
*
|
894 |
-
* @param int $post_id ID of the post to be removed.
|
895 |
-
* @param int $blog_id Optional. Defaults to current blog ID.
|
896 |
-
* @param int $user_id Optional. Defaults to the logged-in user ID. This param
|
897 |
-
* is currently unused in the function (but is passed to hooks).
|
898 |
-
* @return bool
|
899 |
-
*/
|
900 |
-
function bp_blogs_remove_post( $post_id, $blog_id = 0, $user_id = 0 ) {
|
901 |
-
global $wpdb;
|
902 |
-
|
903 |
-
if ( empty( $wpdb->blogid ) )
|
904 |
-
return false;
|
905 |
-
|
906 |
-
$post_id = (int) $post_id;
|
907 |
-
|
908 |
-
if ( !$blog_id )
|
909 |
-
$blog_id = (int) $wpdb->blogid;
|
910 |
-
|
911 |
-
if ( !$user_id )
|
912 |
-
$user_id = bp_loggedin_user_id();
|
913 |
-
|
914 |
-
/**
|
915 |
-
* Fires before removal of a blog post activity item from the activity stream.
|
916 |
-
*
|
917 |
-
* @since 1.5.0
|
918 |
-
*
|
919 |
-
* @param int $blog_id ID of the blog associated with the post that was removed.
|
920 |
-
* @param int $post_id ID of the post that was removed.
|
921 |
-
* @param int $user_id ID of the user having the blog removed for.
|
922 |
-
*/
|
923 |
-
do_action( 'bp_blogs_before_remove_post', $blog_id, $post_id, $user_id );
|
924 |
-
|
925 |
-
/**
|
926 |
-
* Delete activity stream item only if the Activity component is active
|
927 |
-
*
|
928 |
-
* @see https://buddypress.trac.wordpress.org/ticket/6937
|
929 |
-
*/
|
930 |
-
if ( bp_is_active( 'activity' ) ) {
|
931 |
-
bp_blogs_delete_activity( array(
|
932 |
-
'item_id' => $blog_id,
|
933 |
-
'secondary_item_id' => $post_id,
|
934 |
-
'component' => buddypress()->blogs->id,
|
935 |
-
'type' => 'new_blog_post'
|
936 |
-
) );
|
937 |
-
}
|
938 |
-
|
939 |
-
/**
|
940 |
-
* Fires after removal of a blog post activity item from the activity stream.
|
941 |
-
*
|
942 |
-
* @since 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' );
|
951 |
-
|
952 |
Â
/**
|
953 |
Â
* Remove a synced activity comment from the activity stream.
|
954 |
Â
*
|
@@ -1126,19 +1109,6 @@ function bp_blogs_remove_data_for_blog( $blog_id ) {
|
|
1126 |
Â
// If this is regular blog, delete all data for that blog.
|
1127 |
Â
BP_Blogs_Blog::delete_blog_for_all( $blog_id );
|
1128 |
Â
|
1129 |
-
/**
|
1130 |
-
* Delete activity stream item only if the Activity component is active
|
1131 |
-
*
|
1132 |
-
* @see https://buddypress.trac.wordpress.org/ticket/6937
|
1133 |
-
*/
|
1134 |
-
if ( bp_is_active( 'activity' ) ) {
|
1135 |
-
bp_blogs_delete_activity( array(
|
1136 |
-
'item_id' => $blog_id,
|
1137 |
-
'component' => buddypress()->blogs->id,
|
1138 |
-
'type' => false
|
1139 |
-
) );
|
1140 |
-
}
|
1141 |
-
|
1142 |
Â
/**
|
1143 |
Â
* Fires after all data related to a given blog has been removed from blogs tracker
|
1144 |
Â
* and activity stream.
|
72 |
Â
/**
|
73 |
Â
* Populate the BP blogs table with existing blogs.
|
74 |
Â
*
|
75 |
+
* Warning: By default, this will remove all existing records from the BP
|
76 |
+
* blogs and blogmeta tables before re-populating the tables.
|
77 |
Â
*
|
78 |
+
* @since 1.0.0
|
79 |
+
* @since 2.6.0 Accepts $args as a parameter.
|
80 |
+
*
|
81 |
+
* @param array $args {
|
82 |
+
* Array of arguments.
|
83 |
+
* @type int $offset The offset to use.
|
84 |
+
* @type int $limit The number of blogs to record at one time.
|
85 |
+
* @type array $blog_ids Blog IDs to record. If empty, all blogs will be recorded.
|
86 |
+
* @type array $site_id The network site ID to use.
|
87 |
+
* }
|
88 |
Â
*
|
89 |
Â
* @return bool
|
90 |
Â
*/
|
91 |
+
function bp_blogs_record_existing_blogs( $args = array() ) {
|
92 |
Â
global $wpdb;
|
93 |
Â
|
94 |
Â
// Query for all sites in network.
|
95 |
+
$r = bp_parse_args( $args, array(
|
96 |
+
'offset' => false === bp_get_option( '_bp_record_blogs_offset' ) ? 0 : bp_get_option( '_bp_record_blogs_offset' ),
|
97 |
+
'limit' => 50,
|
98 |
+
'blog_ids' => array(),
|
99 |
+
'site_id' => $wpdb->siteid
|
100 |
+
), 'record_existing_blogs' );
|
101 |
+
|
102 |
+
// Truncate all BP blogs tables if starting fresh
|
103 |
+
if ( empty( $r['offset'] ) && empty( $r['blog_ids'] ) ) {
|
104 |
+
$bp = buddypress();
|
105 |
+
|
106 |
+
// Truncate user blogs table
|
107 |
+
$truncate = $wpdb->query( "TRUNCATE {$bp->blogs->table_name}" );
|
108 |
+
if ( is_wp_error( $truncate ) ) {
|
109 |
+
return false;
|
110 |
+
}
|
111 |
+
|
112 |
+
// Truncate user blogmeta table
|
113 |
+
$truncate = $wpdb->query( "TRUNCATE {$bp->blogs->table_name_blogmeta}" );
|
114 |
+
if ( is_wp_error( $truncate ) ) {
|
115 |
+
return false;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
// Multisite
|
120 |
Â
if ( is_multisite() ) {
|
121 |
+
$sql = array();
|
122 |
+
$sql['select'] = $wpdb->prepare( "SELECT blog_id, last_updated FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0 AND site_id = %d", $r['site_id'] );
|
123 |
Â
|
124 |
+
// Omit root blog if large network
|
125 |
+
if ( wp_is_large_network( 'users' ) ) {
|
126 |
+
$sql['omit_root_blog'] = $wpdb->prepare( "AND blog_id != %d", bp_get_root_blog_id() );
|
127 |
+
}
|
128 |
Â
|
129 |
+
// Filter by selected blog IDs
|
130 |
+
if ( ! empty( $r['blog_ids'] ) ) {
|
131 |
+
$in = implode( ',', wp_parse_id_list( $r['blog_ids'] ) );
|
132 |
+
$sql['in'] = "AND blog_id IN ({$in})";
|
133 |
+
}
|
134 |
Â
|
135 |
+
$sql['orderby'] = 'ORDER BY blog_id ASC';
|
136 |
+
|
137 |
+
$sql['limit'] = $wpdb->prepare( "LIMIT %d", $r['limit'] );
|
138 |
+
|
139 |
+
if ( ! empty( $r['offset'] ) ) {
|
140 |
+
$sql['offset'] = $wpdb->prepare( "OFFSET %d", $r['offset'] );
|
141 |
Â
}
|
142 |
Â
|
143 |
+
$blogs = $wpdb->get_results( implode( ' ', $sql ) );
|
144 |
+
|
145 |
Â
// Record a single site.
|
146 |
Â
} else {
|
147 |
+
// Just record blog for the current user only.
|
148 |
+
$record = bp_blogs_record_blog( $wpdb->blogid, get_current_user_id(), true );
|
149 |
Â
|
150 |
+
if ( false === $record ) {
|
151 |
+
return false;
|
152 |
+
} else {
|
153 |
+
return true;
|
154 |
+
}
|
155 |
Â
}
|
156 |
Â
|
157 |
+
// Bail if there are no blogs
|
158 |
+
if ( empty( $blogs ) ) {
|
159 |
+
// Make sure we remove our offset marker
|
160 |
+
if ( is_multisite() ) {
|
161 |
+
bp_delete_option( '_bp_record_blogs_offset' );
|
162 |
+
}
|
Â
|
|
Â
|
|
163 |
Â
|
Â
|
|
Â
|
|
Â
|
|
164 |
Â
return false;
|
165 |
Â
}
|
166 |
Â
|
167 |
Â
// Loop through users of blogs and record the relationship.
|
168 |
+
foreach ( (array) $blogs as $blog ) {
|
169 |
Â
|
170 |
Â
// Ensure that the cache is clear after the table TRUNCATE above.
|
171 |
+
wp_cache_delete( $blog->blog_id, 'blog_meta' );
|
172 |
Â
|
173 |
Â
// Get all users.
|
174 |
Â
$users = get_users( array(
|
175 |
+
'blog_id' => $blog->blog_id,
|
176 |
+
'fields' => 'ID'
|
177 |
Â
) );
|
178 |
Â
|
179 |
Â
// Continue on if no users exist for this site (how did this happen?).
|
182 |
Â
}
|
183 |
Â
|
184 |
Â
// Loop through users and record their relationship to this blog.
|
185 |
+
foreach ( (array) $users as $user_id ) {
|
186 |
+
bp_blogs_add_user_to_blog( $user_id, false, $blog->blog_id );
|
187 |
+
|
188 |
+
// Clear cache
|
189 |
+
bp_blogs_clear_blog_object_cache( $blog->blog_id, $user_id );
|
190 |
+
}
|
191 |
+
|
192 |
+
// Update blog last activity timestamp
|
193 |
+
if ( ! empty( $blog->last_updated ) && false !== strtotime( $blog->last_updated ) ) {
|
194 |
+
bp_blogs_update_blogmeta( $blog->blog_id, 'last_activity', $blog->last_updated );
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
// See if we need to do this again
|
199 |
+
if ( is_multisite() && empty( $r['blog_ids'] ) ) {
|
200 |
+
$sql['offset'] = $wpdb->prepare( " OFFSET %d", $r['limit'] + $r['offset'] );
|
201 |
+
|
202 |
+
// Check if there are more blogs to record
|
203 |
+
$blog_ids = $wpdb->get_results( implode( ' ', $sql ) );
|
204 |
+
|
205 |
+
// We have more blogs; record offset and re-run function
|
206 |
+
if ( ! empty( $blog_ids ) ) {
|
207 |
+
bp_update_option( '_bp_record_blogs_offset', $r['limit'] + $r['offset'] );
|
208 |
+
bp_blogs_record_existing_blogs( array(
|
209 |
+
'offset' => $r['limit'] + $r['offset'],
|
210 |
+
'limit' => $r['limit'],
|
211 |
+
'blog_ids' => $r['blog_ids'],
|
212 |
+
'site_id' => $r['site_id']
|
213 |
+
) );
|
214 |
+
|
215 |
+
// Bail since we have more blogs to record.
|
216 |
+
return;
|
217 |
+
|
218 |
+
// No more blogs; delete offset marker
|
219 |
+
} else {
|
220 |
+
bp_delete_option( '_bp_record_blogs_offset' );
|
221 |
Â
}
|
222 |
Â
}
|
223 |
Â
|
240 |
Â
*
|
241 |
Â
* @since 1.7.0
|
242 |
Â
*
|
Â
|
|
Â
|
|
243 |
Â
* @param int $blog_id ID of the blog being checked.
|
244 |
Â
* @param int $user_id Optional. ID of the user for whom access is being checked.
|
245 |
Â
* @return bool True if blog is recordable, otherwise false.
|
269 |
Â
*
|
270 |
Â
* @since 1.7.0
|
271 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
272 |
Â
* @param int $blog_id ID of the blog being checked.
|
273 |
Â
* @param int $user_id Optional. ID of the user for whom access is being checked.
|
274 |
Â
* @return bool True if blog is trackable, otherwise false.
|
295 |
Â
*
|
296 |
Â
* @since 1.0.0
|
297 |
Â
*
|
Â
|
|
Â
|
|
298 |
Â
* @param int $blog_id ID of the blog being recorded.
|
299 |
Â
* @param int $user_id ID of the user for whom the blog is being recorded.
|
300 |
Â
* @param bool $no_activity Optional. Whether to skip recording an activity
|
346 |
Â
$is_private = !empty( $_POST['blog_public'] ) && (int) $_POST['blog_public'] ? false : true;
|
347 |
Â
$is_private = !apply_filters( 'bp_is_new_blog_public', !$is_private );
|
348 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
349 |
Â
/**
|
350 |
Â
* Fires after BuddyPress has been made aware of a new site for activity tracking.
|
351 |
Â
*
|
352 |
Â
* @since 1.0.0
|
353 |
+
* @since 2.6.0 Added $no_activity as a parameter.
|
354 |
Â
*
|
355 |
Â
* @param BP_Blogs_Blog $recorded_blog Current blog being recorded. Passed by reference.
|
356 |
Â
* @param bool $is_private Whether or not the current blog being recorded is private.
|
357 |
Â
* @param bool $is_recorded Whether or not the current blog was recorded.
|
358 |
+
* @param bool $no_activity Whether to skip recording an activity item for this blog creation.
|
359 |
Â
*/
|
360 |
+
do_action_ref_array( 'bp_blogs_new_blog', array( &$recorded_blog, $is_private, $is_recorded, $no_activity ) );
|
361 |
Â
}
|
362 |
Â
add_action( 'wpmu_new_blog', 'bp_blogs_record_blog', 10, 2 );
|
363 |
Â
|
620 |
Â
*
|
621 |
Â
* @since 2.5.0
|
622 |
Â
*
|
623 |
+
* @param int|bool $activity_id ID of recorded activity, or false if sync is active.
|
624 |
+
* @param WP_Comment|null $comment The comment object.
|
625 |
+
* @param array $activity_args Array of activity arguments.
|
626 |
+
* @param object|null $activity_post_object The post type tracking args object.
|
627 |
+
* @return int|bool Returns false if no activity, the activity id otherwise.
|
628 |
Â
*/
|
629 |
Â
function bp_blogs_comment_sync_activity_comment( &$activity_id, $comment = null, $activity_args = array(), $activity_post_object = null ) {
|
630 |
Â
if ( empty( $activity_args ) || empty( $comment->post->ID ) || empty( $activity_post_object->comment_action_id ) ) {
|
872 |
Â
|
873 |
Â
BP_Blogs_Blog::delete_blog_for_all( $blog_id );
|
874 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
875 |
Â
/**
|
876 |
Â
* Fires after a "blog created" item has been removed from blogs
|
877 |
Â
* tracker and activity stream.
|
932 |
Â
}
|
933 |
Â
add_action( 'remove_user_from_blog', 'bp_blogs_remove_blog_for_user', 10, 2 );
|
934 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
935 |
Â
/**
|
936 |
Â
* Remove a synced activity comment from the activity stream.
|
937 |
Â
*
|
1109 |
Â
// If this is regular blog, delete all data for that blog.
|
1110 |
Â
BP_Blogs_Blog::delete_blog_for_all( $blog_id );
|
1111 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1112 |
Â
/**
|
1113 |
Â
* Fires after all data related to a given blog has been removed from blogs tracker
|
1114 |
Â
* and activity stream.
|
@@ -14,7 +14,9 @@
|
|
14 |
Â
// Exit if accessed directly.
|
15 |
Â
defined( 'ABSPATH' ) || exit;
|
16 |
Â
|
17 |
-
|
Â
|
|
Â
|
|
18 |
Â
|
19 |
Â
/**
|
20 |
Â
* Set up the bp-blogs component.
|
14 |
Â
// Exit if accessed directly.
|
15 |
Â
defined( 'ABSPATH' ) || exit;
|
16 |
Â
|
17 |
+
if ( ! buddypress()->do_autoload ) {
|
18 |
+
require dirname( __FILE__ ) . '/classes/class-bp-blogs-component.php';
|
19 |
+
}
|
20 |
Â
|
21 |
Â
/**
|
22 |
Â
* Set up the bp-blogs component.
|
@@ -10,7 +10,9 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Load the "My Blogs" screen.
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-blogs-theme-compat.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Load the "My Blogs" screen.
|
@@ -10,14 +10,15 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Output the blogs component slug.
|
17 |
Â
*
|
18 |
Â
* @since 1.5.0
|
19 |
Â
*
|
20 |
-
* @uses bp_get_blogs_slug()
|
21 |
Â
*/
|
22 |
Â
function bp_blogs_slug() {
|
23 |
Â
echo bp_get_blogs_slug();
|
@@ -46,7 +47,6 @@ function bp_blogs_slug() {
|
|
46 |
Â
*
|
47 |
Â
* @since 1.5.0
|
48 |
Â
*
|
49 |
-
* @uses bp_get_blogs_root_slug()
|
50 |
Â
*/
|
51 |
Â
function bp_blogs_root_slug() {
|
52 |
Â
echo bp_get_blogs_root_slug();
|
@@ -75,7 +75,6 @@ function bp_blogs_root_slug() {
|
|
75 |
Â
*
|
76 |
Â
* @since 1.5.0
|
77 |
Â
*
|
78 |
-
* @uses bp_get_blogs_directory_permalink()
|
79 |
Â
*/
|
80 |
Â
function bp_blogs_directory_permalink() {
|
81 |
Â
echo esc_url( bp_get_blogs_directory_permalink() );
|
@@ -85,10 +84,6 @@ function bp_blogs_directory_permalink() {
|
|
85 |
Â
*
|
86 |
Â
* @since 1.5.0
|
87 |
Â
*
|
88 |
-
* @uses apply_filters()
|
89 |
-
* @uses trailingslashit()
|
90 |
-
* @uses bp_get_root_domain()
|
91 |
-
* @uses bp_get_blogs_root_slug()
|
92 |
Â
*
|
93 |
Â
* @return string The URL of the Blogs directory.
|
94 |
Â
*/
|
@@ -629,10 +624,12 @@ function bp_blog_latest_post( $args = array() ) {
|
|
629 |
Â
* Filters the HTML markup result for the latest blog post in loop.
|
630 |
Â
*
|
631 |
Â
* @since 1.2.0
|
Â
|
|
632 |
Â
*
|
633 |
Â
* @param string $retval HTML markup for the latest post.
|
Â
|
|
634 |
Â
*/
|
635 |
-
return apply_filters( 'bp_get_blog_latest_post', $retval );
|
636 |
Â
}
|
637 |
Â
|
638 |
Â
/**
|
@@ -714,7 +711,6 @@ function bp_blog_latest_post_permalink() {
|
|
714 |
Â
*
|
715 |
Â
* @since 1.7.0
|
716 |
Â
*
|
717 |
-
* @uses bp_get_blog_latest_post_content()
|
718 |
Â
*/
|
719 |
Â
function bp_blog_latest_post_content() {
|
720 |
Â
echo bp_get_blog_latest_post_content();
|
@@ -874,10 +870,12 @@ function bp_total_blog_count_for_user( $user_id = 0 ) {
|
|
874 |
Â
* Filters the total number of blogs for a given user.
|
875 |
Â
*
|
876 |
Â
* @since 1.2.0
|
Â
|
|
877 |
Â
*
|
878 |
-
* @param int $value
|
Â
|
|
879 |
Â
*/
|
880 |
-
return apply_filters( 'bp_get_total_blog_count_for_user', bp_blogs_total_blogs_for_user( $user_id ) );
|
881 |
Â
}
|
882 |
Â
add_filter( 'bp_get_total_blog_count_for_user', 'bp_core_number_format' );
|
883 |
Â
|
@@ -1108,8 +1106,8 @@ function bp_blogs_validate_blog_signup() {
|
|
1108 |
Â
if ( is_subdomain_install() )
|
1109 |
Â
$domain = $blogname . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
|
1110 |
Â
|
1111 |
-
wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
|
1112 |
-
bp_blogs_confirm_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta);
|
1113 |
Â
return true;
|
1114 |
Â
}
|
1115 |
Â
|
@@ -1131,20 +1129,38 @@ function bp_blogs_validate_blog_form() {
|
|
1131 |
Â
/**
|
1132 |
Â
* Display a message after successful blog registration.
|
1133 |
Â
*
|
Â
|
|
Â
|
|
1134 |
Â
* @param string $domain The new blog's domain.
|
1135 |
Â
* @param string $path The new blog's path.
|
1136 |
Â
* @param string $blog_title The new blog's title.
|
1137 |
Â
* @param string $user_name The user name of the user who created the blog. Unused.
|
1138 |
Â
* @param string $user_email The email of the user who created the blog. Unused.
|
1139 |
Â
* @param string|array $meta Meta values associated with the new blog. Unused.
|
Â
|
|
1140 |
Â
*/
|
1141 |
-
function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = '' ) {
|
1142 |
-
$
|
1143 |
-
$blog_url
|
Â
|
|
Â
|
|
1144 |
Â
|
Â
|
|
1145 |
Â
<p><?php _e( 'Congratulations! You have successfully registered a new site.', 'buddypress' ) ?></p>
|
1146 |
Â
<p>
|
1147 |
-
<?php printf(
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1148 |
Â
</p>
|
1149 |
Â
|
1150 |
Â
<?php
|
@@ -1317,8 +1333,6 @@ function bp_blog_create_nav_item() {
|
|
1317 |
Â
*
|
1318 |
Â
* @since 2.2.0
|
1319 |
Â
*
|
1320 |
-
* @uses bp_blog_create_nav_item() to output the Create a Site nav item.
|
1321 |
-
*
|
1322 |
Â
* @return string HTML Output
|
1323 |
Â
*/
|
1324 |
Â
function bp_blog_backcompat_create_nav_item() {
|
@@ -1399,8 +1413,6 @@ function bp_blogs_visit_blog_button( $args = '' ) {
|
|
1399 |
Â
*
|
1400 |
Â
* @since 2.0.0
|
1401 |
Â
*
|
1402 |
-
* @uses bp_blogs_admin_get_profile_stats() to get the stats.
|
1403 |
-
*
|
1404 |
Â
* @param array|string $args Before|after|user_id.
|
1405 |
Â
*/
|
1406 |
Â
function bp_blogs_profile_stats( $args = '' ) {
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-blogs-template.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Output the blogs component slug.
|
19 |
Â
*
|
20 |
Â
* @since 1.5.0
|
21 |
Â
*
|
Â
|
|
22 |
Â
*/
|
23 |
Â
function bp_blogs_slug() {
|
24 |
Â
echo bp_get_blogs_slug();
|
47 |
Â
*
|
48 |
Â
* @since 1.5.0
|
49 |
Â
*
|
Â
|
|
50 |
Â
*/
|
51 |
Â
function bp_blogs_root_slug() {
|
52 |
Â
echo bp_get_blogs_root_slug();
|
75 |
Â
*
|
76 |
Â
* @since 1.5.0
|
77 |
Â
*
|
Â
|
|
78 |
Â
*/
|
79 |
Â
function bp_blogs_directory_permalink() {
|
80 |
Â
echo esc_url( bp_get_blogs_directory_permalink() );
|
84 |
Â
*
|
85 |
Â
* @since 1.5.0
|
86 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
87 |
Â
*
|
88 |
Â
* @return string The URL of the Blogs directory.
|
89 |
Â
*/
|
624 |
Â
* Filters the HTML markup result for the latest blog post in loop.
|
625 |
Â
*
|
626 |
Â
* @since 1.2.0
|
627 |
+
* @since 2.6.0 Added the `$r` parameter.
|
628 |
Â
*
|
629 |
Â
* @param string $retval HTML markup for the latest post.
|
630 |
+
* @param array $r Array of parsed arguments.
|
631 |
Â
*/
|
632 |
+
return apply_filters( 'bp_get_blog_latest_post', $retval, $r );
|
633 |
Â
}
|
634 |
Â
|
635 |
Â
/**
|
711 |
Â
*
|
712 |
Â
* @since 1.7.0
|
713 |
Â
*
|
Â
|
|
714 |
Â
*/
|
715 |
Â
function bp_blog_latest_post_content() {
|
716 |
Â
echo bp_get_blog_latest_post_content();
|
870 |
Â
* Filters the total number of blogs for a given user.
|
871 |
Â
*
|
872 |
Â
* @since 1.2.0
|
873 |
+
* @since 2.6.0 Added the `$user_id` parameter.
|
874 |
Â
*
|
875 |
+
* @param int $value Total number of blogs for a given user.
|
876 |
+
* @param int $user_id ID of the queried user.
|
877 |
Â
*/
|
878 |
+
return apply_filters( 'bp_get_total_blog_count_for_user', bp_blogs_total_blogs_for_user( $user_id ), $user_id );
|
879 |
Â
}
|
880 |
Â
add_filter( 'bp_get_total_blog_count_for_user', 'bp_core_number_format' );
|
881 |
Â
|
1106 |
Â
if ( is_subdomain_install() )
|
1107 |
Â
$domain = $blogname . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
|
1108 |
Â
|
1109 |
+
$blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
|
1110 |
+
bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id );
|
1111 |
Â
return true;
|
1112 |
Â
}
|
1113 |
Â
|
1129 |
Â
/**
|
1130 |
Â
* Display a message after successful blog registration.
|
1131 |
Â
*
|
1132 |
+
* @since 2.6.0 Introduced `$blog_id` parameter.
|
1133 |
+
*
|
1134 |
Â
* @param string $domain The new blog's domain.
|
1135 |
Â
* @param string $path The new blog's path.
|
1136 |
Â
* @param string $blog_title The new blog's title.
|
1137 |
Â
* @param string $user_name The user name of the user who created the blog. Unused.
|
1138 |
Â
* @param string $user_email The email of the user who created the blog. Unused.
|
1139 |
Â
* @param string|array $meta Meta values associated with the new blog. Unused.
|
1140 |
+
* @param int|null $blog_id ID of the newly created blog.
|
1141 |
Â
*/
|
1142 |
+
function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = '', $blog_id = null ) {
|
1143 |
+
switch_to_blog( $blog_id );
|
1144 |
+
$blog_url = set_url_scheme( home_url() );
|
1145 |
+
$login_url = set_url_scheme( wp_login_url() );
|
1146 |
+
restore_current_blog();
|
1147 |
Â
|
1148 |
+
?>
|
1149 |
Â
<p><?php _e( 'Congratulations! You have successfully registered a new site.', 'buddypress' ) ?></p>
|
1150 |
Â
<p>
|
1151 |
+
<?php printf(
|
1152 |
+
'%s %s',
|
1153 |
+
sprintf(
|
1154 |
+
__( '%s is your new site.', 'buddypress' ),
|
1155 |
+
sprintf( '<a href="%s">%s</a>', esc_url( $blog_url ), esc_url( $blog_url ) )
|
1156 |
+
),
|
1157 |
+
sprintf(
|
1158 |
+
/* translators: 1: Login URL, 2: User name */
|
1159 |
+
__( '<a href="%1$s">Log in</a> as "%2$s" using your existing password.', 'buddypress' ),
|
1160 |
+
esc_url( $login_url ),
|
1161 |
+
esc_html( $user_name )
|
1162 |
+
)
|
1163 |
+
); ?>
|
1164 |
Â
</p>
|
1165 |
Â
|
1166 |
Â
<?php
|
1333 |
Â
*
|
1334 |
Â
* @since 2.2.0
|
1335 |
Â
*
|
Â
|
|
Â
|
|
1336 |
Â
* @return string HTML Output
|
1337 |
Â
*/
|
1338 |
Â
function bp_blog_backcompat_create_nav_item() {
|
1413 |
Â
*
|
1414 |
Â
* @since 2.0.0
|
1415 |
Â
*
|
Â
|
|
Â
|
|
1416 |
Â
* @param array|string $args Before|after|user_id.
|
1417 |
Â
*/
|
1418 |
Â
function bp_blogs_profile_stats( $args = '' ) {
|
@@ -10,7 +10,9 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Register the widgets for the Blogs component.
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-blogs-recent-posts-widget.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Register the widgets for the Blogs component.
|
@@ -122,12 +122,15 @@ class BP_Blogs_Component extends BP_Component {
|
|
122 |
Â
'cache',
|
123 |
Â
'actions',
|
124 |
Â
'screens',
|
125 |
-
'classes',
|
126 |
Â
'template',
|
127 |
Â
'filters',
|
128 |
Â
'functions',
|
129 |
Â
);
|
130 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
131 |
Â
if ( bp_is_active( 'activity' ) ) {
|
132 |
Â
$includes[] = 'activity';
|
133 |
Â
}
|
@@ -176,7 +179,15 @@ class BP_Blogs_Component extends BP_Component {
|
|
176 |
Â
// Add 'Sites' to the main navigation.
|
177 |
Â
$count = (int) bp_get_total_blog_count_for_user();
|
178 |
Â
$class = ( 0 === $count ) ? 'no-count' : 'count';
|
179 |
-
$nav_text = sprintf(
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
180 |
Â
$main_nav = array(
|
181 |
Â
'name' => $nav_text,
|
182 |
Â
'slug' => $slug,
|
122 |
Â
'cache',
|
123 |
Â
'actions',
|
124 |
Â
'screens',
|
Â
|
|
125 |
Â
'template',
|
126 |
Â
'filters',
|
127 |
Â
'functions',
|
128 |
Â
);
|
129 |
Â
|
130 |
+
if ( ! buddypress()->do_autoload ) {
|
131 |
+
$includes[] = 'classes';
|
132 |
+
}
|
133 |
+
|
134 |
Â
if ( bp_is_active( 'activity' ) ) {
|
135 |
Â
$includes[] = 'activity';
|
136 |
Â
}
|
179 |
Â
// Add 'Sites' to the main navigation.
|
180 |
Â
$count = (int) bp_get_total_blog_count_for_user();
|
181 |
Â
$class = ( 0 === $count ) ? 'no-count' : 'count';
|
182 |
+
$nav_text = sprintf(
|
183 |
+
/* translators: %s: Site count for the current user */
|
184 |
+
__( 'Sites %s', 'buddypress' ),
|
185 |
+
sprintf(
|
186 |
+
'<span class="%s">%s</span>',
|
187 |
+
esc_attr( $class ),
|
188 |
+
bp_core_number_format( $count )
|
189 |
+
)
|
190 |
+
);
|
191 |
Â
$main_nav = array(
|
192 |
Â
'name' => $nav_text,
|
193 |
Â
'slug' => $slug,
|
@@ -20,8 +20,9 @@ class BP_Blogs_Recent_Posts_Widget extends WP_Widget {
|
|
20 |
Â
*/
|
21 |
Â
public function __construct() {
|
22 |
Â
$widget_ops = array(
|
23 |
-
'description'
|
24 |
-
'classname'
|
Â
|
|
25 |
Â
);
|
26 |
Â
parent::__construct( false, $name = _x( '(BuddyPress) Recent Networkwide Posts', 'widget name', 'buddypress' ), $widget_ops );
|
27 |
Â
}
|
20 |
Â
*/
|
21 |
Â
public function __construct() {
|
22 |
Â
$widget_ops = array(
|
23 |
+
'description' => __( 'A list of recently published posts from across your network.', 'buddypress' ),
|
24 |
+
'classname' => 'widget_bp_blogs_widget buddypress widget',
|
25 |
+
'customize_selective_refresh' => true,
|
26 |
Â
);
|
27 |
Â
parent::__construct( false, $name = _x( '(BuddyPress) Recent Networkwide Posts', 'widget name', 'buddypress' ), $widget_ops );
|
28 |
Â
}
|
@@ -106,7 +106,6 @@ function bp_new_site( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
|
|
106 |
Â
*
|
107 |
Â
* @since 1.7.0
|
108 |
Â
*
|
109 |
-
* @uses do_action() Calls 'bp_admin_init'.
|
110 |
Â
*/
|
111 |
Â
function bp_admin_init() {
|
112 |
Â
|
@@ -123,7 +122,6 @@ function bp_admin_init() {
|
|
123 |
Â
*
|
124 |
Â
* @since 1.7.0
|
125 |
Â
*
|
126 |
-
* @uses do_action() Calls 'bp_admin_menu'.
|
127 |
Â
*/
|
128 |
Â
function bp_admin_menu() {
|
129 |
Â
|
@@ -140,7 +138,6 @@ function bp_admin_menu() {
|
|
140 |
Â
*
|
141 |
Â
* @since 1.7.0
|
142 |
Â
*
|
143 |
-
* @uses do_action() Calls 'bp_admin_head'.
|
144 |
Â
*/
|
145 |
Â
function bp_admin_head() {
|
146 |
Â
|
@@ -157,7 +154,6 @@ function bp_admin_head() {
|
|
157 |
Â
*
|
158 |
Â
* @since 1.7.0
|
159 |
Â
*
|
160 |
-
* @uses do_action() Calls 'bp_admin_notices'.
|
161 |
Â
*/
|
162 |
Â
function bp_admin_notices() {
|
163 |
Â
|
@@ -174,8 +170,6 @@ function bp_admin_notices() {
|
|
174 |
Â
*
|
175 |
Â
* @since 1.7.0
|
176 |
Â
*
|
177 |
-
* @uses do_action() Calls 'bp_admin_enqueue_scripts'.
|
178 |
-
*
|
179 |
Â
* @param string $hook_suffix The current admin page, passed to
|
180 |
Â
* 'admin_enqueue_scripts'.
|
181 |
Â
*/
|
@@ -196,7 +190,6 @@ function bp_admin_enqueue_scripts( $hook_suffix = '' ) {
|
|
196 |
Â
*
|
197 |
Â
* @since 1.7.0
|
198 |
Â
*
|
199 |
-
* @uses do_action() Calls 'bp_admin_notices'.
|
200 |
Â
*/
|
201 |
Â
function bp_register_importers() {
|
202 |
Â
|
@@ -215,7 +208,6 @@ function bp_register_importers() {
|
|
215 |
Â
*
|
216 |
Â
* @since 1.7.0
|
217 |
Â
*
|
218 |
-
* @uses do_action() Calls 'bp_admin_notices'.
|
219 |
Â
*/
|
220 |
Â
function bp_register_admin_style() {
|
221 |
Â
|
@@ -232,7 +224,6 @@ function bp_register_admin_style() {
|
|
232 |
Â
*
|
233 |
Â
* @since 1.7.0
|
234 |
Â
*
|
235 |
-
* @uses do_action() Calls 'bp_register_admin_settings'.
|
236 |
Â
*/
|
237 |
Â
function bp_register_admin_settings() {
|
238 |
Â
|
106 |
Â
*
|
107 |
Â
* @since 1.7.0
|
108 |
Â
*
|
Â
|
|
109 |
Â
*/
|
110 |
Â
function bp_admin_init() {
|
111 |
Â
|
122 |
Â
*
|
123 |
Â
* @since 1.7.0
|
124 |
Â
*
|
Â
|
|
125 |
Â
*/
|
126 |
Â
function bp_admin_menu() {
|
127 |
Â
|
138 |
Â
*
|
139 |
Â
* @since 1.7.0
|
140 |
Â
*
|
Â
|
|
141 |
Â
*/
|
142 |
Â
function bp_admin_head() {
|
143 |
Â
|
154 |
Â
*
|
155 |
Â
* @since 1.7.0
|
156 |
Â
*
|
Â
|
|
157 |
Â
*/
|
158 |
Â
function bp_admin_notices() {
|
159 |
Â
|
170 |
Â
*
|
171 |
Â
* @since 1.7.0
|
172 |
Â
*
|
Â
|
|
Â
|
|
173 |
Â
* @param string $hook_suffix The current admin page, passed to
|
174 |
Â
* 'admin_enqueue_scripts'.
|
175 |
Â
*/
|
190 |
Â
*
|
191 |
Â
* @since 1.7.0
|
192 |
Â
*
|
Â
|
|
193 |
Â
*/
|
194 |
Â
function bp_register_importers() {
|
195 |
Â
|
208 |
Â
*
|
209 |
Â
* @since 1.7.0
|
210 |
Â
*
|
Â
|
|
211 |
Â
*/
|
212 |
Â
function bp_register_admin_style() {
|
213 |
Â
|
224 |
Â
*
|
225 |
Â
* @since 1.7.0
|
226 |
Â
*
|
Â
|
|
227 |
Â
*/
|
228 |
Â
function bp_register_admin_settings() {
|
229 |
Â
|
@@ -15,7 +15,6 @@ defined( 'ABSPATH' ) || exit;
|
|
15 |
Â
*
|
16 |
Â
* @since 1.6.0
|
17 |
Â
*
|
18 |
-
* @uses bp_core_admin_component_options()
|
19 |
Â
*/
|
20 |
Â
function bp_core_admin_components_settings() {
|
21 |
Â
?>
|
@@ -150,7 +149,10 @@ function bp_core_admin_components_options() {
|
|
150 |
Â
break;
|
151 |
Â
} ?>
|
152 |
Â
|
153 |
-
<h3 class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
154 |
Â
|
155 |
Â
<ul class="subsubsub">
|
156 |
Â
<li><a href="<?php echo esc_url( 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>
|
@@ -160,12 +162,18 @@ function bp_core_admin_components_options() {
|
|
160 |
Â
<li><a href="<?php echo esc_url( 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>
|
161 |
Â
</ul>
|
162 |
Â
|
163 |
-
<h3 class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
164 |
Â
|
165 |
Â
<table class="wp-list-table widefat plugins">
|
166 |
Â
<thead>
|
167 |
Â
<tr>
|
168 |
-
<td id="cb" class="manage-column column-cb check-column"><input id="cb-select-all-1" type="checkbox" disabled><label class="screen-reader-text" for="cb-select-all-1"><?php
|
Â
|
|
Â
|
|
Â
|
|
169 |
Â
<th scope="col" id="name" class="manage-column column-title column-primary"><?php _e( 'Component', 'buddypress' ); ?></th>
|
170 |
Â
<th scope="col" id="description" class="manage-column column-description"><?php _e( 'Description', 'buddypress' ); ?></th>
|
171 |
Â
</tr>
|
@@ -188,17 +196,21 @@ function bp_core_admin_components_options() {
|
|
188 |
Â
|
189 |
Â
<?php if ( !in_array( $name, array( 'core', 'members' ) ) ) : ?>
|
190 |
Â
|
191 |
-
<input type="checkbox" id="<?php echo esc_attr( "bp_components[$name]" ); ?>" name="<?php echo esc_attr( "bp_components[$name]" ); ?>" value="1"<?php checked( isset( $active_components[esc_attr( $name )] ) ); ?> /><label for="<?php echo esc_attr( "bp_components[$name]" ); ?>" class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
192 |
Â
|
193 |
Â
<?php else : ?>
|
194 |
Â
|
195 |
-
<input type="checkbox" id="<?php echo esc_attr( "bp_components[$name]" ); ?>" name="<?php echo esc_attr( "bp_components[$name]" ); ?>" value="1" checked="checked" disabled><label for="<?php echo esc_attr( "bp_components[$name]" ); ?>" class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
196 |
Â
|
197 |
Â
<?php endif; ?>
|
198 |
Â
|
199 |
Â
</th>
|
200 |
Â
<td class="plugin-title column-primary">
|
201 |
-
<span></span>
|
202 |
Â
<strong><?php echo esc_html( $labels['title'] ); ?></strong>
|
203 |
Â
</td>
|
204 |
Â
|
@@ -224,7 +236,10 @@ function bp_core_admin_components_options() {
|
|
224 |
Â
|
225 |
Â
<tfoot>
|
226 |
Â
<tr>
|
227 |
-
<td class="manage-column column-cb check-column"><input id="cb-select-all-2" type="checkbox" disabled><label class="screen-reader-text" for="cb-select-all-2"><?php
|
Â
|
|
Â
|
|
Â
|
|
228 |
Â
<th class="manage-column column-title column-primary"><?php _e( 'Component', 'buddypress' ); ?></th>
|
229 |
Â
<th class="manage-column column-description"><?php _e( 'Description', 'buddypress' ); ?></th>
|
230 |
Â
</tr>
|
@@ -340,100 +355,18 @@ function bp_core_admin_get_active_components_from_submitted_settings( $submitted
|
|
340 |
Â
}
|
341 |
Â
|
342 |
Â
/**
|
343 |
-
* Return a list of component information
|
344 |
Â
*
|
345 |
Â
* We use this information both to build the markup for the admin screens, as
|
346 |
Â
* well as to do some processing on settings data submitted from those screens.
|
347 |
Â
*
|
348 |
Â
* @since 1.7.0
|
349 |
Â
*
|
350 |
-
* @param string $type 'all', 'optional', 'retired', 'required'.
|
351 |
-
* @return array
|
352 |
Â
*/
|
353 |
Â
function bp_core_admin_get_components( $type = 'all' ) {
|
354 |
-
|
355 |
-
// Required components.
|
356 |
-
$required_components = array(
|
357 |
-
'core' => array(
|
358 |
-
'title' => __( 'BuddyPress Core', 'buddypress' ),
|
359 |
-
'description' => __( 'It‘s what makes <del>time travel</del> BuddyPress possible!', 'buddypress' )
|
360 |
-
),
|
361 |
-
'members' => array(
|
362 |
-
'title' => __( 'Community Members', 'buddypress' ),
|
363 |
-
'description' => __( 'Everything in a BuddyPress community revolves around its members.', 'buddypress' )
|
364 |
-
),
|
365 |
-
);
|
366 |
-
|
367 |
-
// Retired components.
|
368 |
-
$retired_components = array(
|
369 |
-
'forums' => array(
|
370 |
-
'title' => __( 'Group Forums', 'buddypress' ),
|
371 |
-
'description' => sprintf( __( 'BuddyPress Forums are retired. Use %s.', 'buddypress' ), '<a href="https://bbpress.org/">bbPress</a>' )
|
372 |
-
),
|
373 |
-
);
|
374 |
-
|
375 |
-
// Optional core components.
|
376 |
-
$optional_components = array(
|
377 |
-
'xprofile' => array(
|
378 |
-
'title' => __( 'Extended Profiles', 'buddypress' ),
|
379 |
-
'description' => __( 'Customize your community with fully editable profile fields that allow your users to describe themselves.', 'buddypress' )
|
380 |
-
),
|
381 |
-
'settings' => array(
|
382 |
-
'title' => __( 'Account Settings', 'buddypress' ),
|
383 |
-
'description' => __( 'Allow your users to modify their account and notification settings directly from within their profiles.', 'buddypress' )
|
384 |
-
),
|
385 |
-
'friends' => array(
|
386 |
-
'title' => __( 'Friend Connections', 'buddypress' ),
|
387 |
-
'description' => __( 'Let your users make connections so they can track the activity of others and focus on the people they care about the most.', 'buddypress' )
|
388 |
-
),
|
389 |
-
'messages' => array(
|
390 |
-
'title' => __( 'Private Messaging', 'buddypress' ),
|
391 |
-
'description' => __( 'Allow your users to talk to each other directly and in private. Not just limited to one-on-one discussions, messages can be sent between any number of members.', 'buddypress' )
|
392 |
-
),
|
393 |
-
'activity' => array(
|
394 |
-
'title' => __( 'Activity Streams', 'buddypress' ),
|
395 |
-
'description' => __( 'Global, personal, and group activity streams with threaded commenting, direct posting, favoriting, and @mentions, all with full RSS feed and email notification support.', 'buddypress' )
|
396 |
-
),
|
397 |
-
'notifications' => array(
|
398 |
-
'title' => __( 'Notifications', 'buddypress' ),
|
399 |
-
'description' => __( 'Notify members of relevant activity with a toolbar bubble and/or via email, and allow them to customize their notification settings.', 'buddypress' )
|
400 |
-
),
|
401 |
-
'groups' => array(
|
402 |
-
'title' => __( 'User Groups', 'buddypress' ),
|
403 |
-
'description' => __( 'Groups allow your users to organize themselves into specific public, private or hidden sections with separate activity streams and member listings.', 'buddypress' )
|
404 |
-
),
|
405 |
-
'forums' => array(
|
406 |
-
'title' => __( 'Group Forums (Legacy)', 'buddypress' ),
|
407 |
-
'description' => __( 'Group forums allow for focused, bulletin-board style conversations.', 'buddypress' )
|
408 |
-
),
|
409 |
-
'blogs' => array(
|
410 |
-
'title' => __( 'Site Tracking', 'buddypress' ),
|
411 |
-
'description' => __( 'Record activity for new posts and comments from your site.', 'buddypress' )
|
412 |
-
)
|
413 |
-
);
|
414 |
-
|
415 |
-
|
416 |
-
// Add blogs tracking if multisite.
|
417 |
-
if ( is_multisite() ) {
|
418 |
-
$optional_components['blogs']['description'] = __( 'Record activity for new sites, posts, and comments across your network.', 'buddypress' );
|
419 |
-
}
|
420 |
-
|
421 |
-
switch ( $type ) {
|
422 |
-
case 'required' :
|
423 |
-
$components = $required_components;
|
424 |
-
break;
|
425 |
-
case 'optional' :
|
426 |
-
$components = $optional_components;
|
427 |
-
break;
|
428 |
-
case 'retired' :
|
429 |
-
$components = $retired_components;
|
430 |
-
break;
|
431 |
-
case 'all' :
|
432 |
-
default :
|
433 |
-
$components = array_merge( $required_components, $optional_components, $retired_components );
|
434 |
-
break;
|
435 |
-
|
436 |
-
}
|
437 |
Â
|
438 |
Â
/**
|
439 |
Â
* Filters the list of component information.
|
15 |
Â
*
|
16 |
Â
* @since 1.6.0
|
17 |
Â
*
|
Â
|
|
18 |
Â
*/
|
19 |
Â
function bp_core_admin_components_settings() {
|
20 |
Â
?>
|
149 |
Â
break;
|
150 |
Â
} ?>
|
151 |
Â
|
152 |
+
<h3 class="screen-reader-text"><?php
|
153 |
+
/* translators: accessibility text */
|
154 |
+
_e( 'Filter components list', 'buddypress' );
|
155 |
+
?></h3>
|
156 |
Â
|
157 |
Â
<ul class="subsubsub">
|
158 |
Â
<li><a href="<?php echo esc_url( 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>
|
162 |
Â
<li><a href="<?php echo esc_url( 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>
|
163 |
Â
</ul>
|
164 |
Â
|
165 |
+
<h3 class="screen-reader-text"><?php
|
166 |
+
/* translators: accessibility text */
|
167 |
+
_e( 'Components list', 'buddypress' );
|
168 |
+
?></h3>
|
169 |
Â
|
170 |
Â
<table class="wp-list-table widefat plugins">
|
171 |
Â
<thead>
|
172 |
Â
<tr>
|
173 |
+
<td id="cb" class="manage-column column-cb check-column"><input id="cb-select-all-1" type="checkbox" disabled><label class="screen-reader-text" for="cb-select-all-1"><?php
|
174 |
+
/* translators: accessibility text */
|
175 |
+
_e( 'Bulk selection is disabled', 'buddypress' );
|
176 |
+
?></label></td>
|
177 |
Â
<th scope="col" id="name" class="manage-column column-title column-primary"><?php _e( 'Component', 'buddypress' ); ?></th>
|
178 |
Â
<th scope="col" id="description" class="manage-column column-description"><?php _e( 'Description', 'buddypress' ); ?></th>
|
179 |
Â
</tr>
|
196 |
Â
|
197 |
Â
<?php if ( !in_array( $name, array( 'core', 'members' ) ) ) : ?>
|
198 |
Â
|
199 |
+
<input type="checkbox" id="<?php echo esc_attr( "bp_components[$name]" ); ?>" name="<?php echo esc_attr( "bp_components[$name]" ); ?>" value="1"<?php checked( isset( $active_components[esc_attr( $name )] ) ); ?> /><label for="<?php echo esc_attr( "bp_components[$name]" ); ?>" class="screen-reader-text"><?php
|
200 |
+
/* translators: accessibility text */
|
201 |
+
printf( __( 'Select %s', 'buddypress' ), esc_html( $labels['title'] ) ); ?></label>
|
202 |
Â
|
203 |
Â
<?php else : ?>
|
204 |
Â
|
205 |
+
<input type="checkbox" id="<?php echo esc_attr( "bp_components[$name]" ); ?>" name="<?php echo esc_attr( "bp_components[$name]" ); ?>" value="1" checked="checked" disabled><label for="<?php echo esc_attr( "bp_components[$name]" ); ?>" class="screen-reader-text"><?php
|
206 |
+
/* translators: accessibility text */
|
207 |
+
printf( __( '%s is a required component', 'buddypress' ), esc_html( $labels['title'] ) ); ?></label>
|
208 |
Â
|
209 |
Â
<?php endif; ?>
|
210 |
Â
|
211 |
Â
</th>
|
212 |
Â
<td class="plugin-title column-primary">
|
213 |
+
<span aria-hidden="true"></span>
|
214 |
Â
<strong><?php echo esc_html( $labels['title'] ); ?></strong>
|
215 |
Â
</td>
|
216 |
Â
|
236 |
Â
|
237 |
Â
<tfoot>
|
238 |
Â
<tr>
|
239 |
+
<td class="manage-column column-cb check-column"><input id="cb-select-all-2" type="checkbox" disabled><label class="screen-reader-text" for="cb-select-all-2"><?php
|
240 |
+
/* translators: accessibility text */
|
241 |
+
_e( 'Bulk selection is disabled', 'buddypress' );
|
242 |
+
?></label></td>
|
243 |
Â
<th class="manage-column column-title column-primary"><?php _e( 'Component', 'buddypress' ); ?></th>
|
244 |
Â
<th class="manage-column column-description"><?php _e( 'Description', 'buddypress' ); ?></th>
|
245 |
Â
</tr>
|
355 |
Â
}
|
356 |
Â
|
357 |
Â
/**
|
358 |
+
* Return a list of component information.
|
359 |
Â
*
|
360 |
Â
* We use this information both to build the markup for the admin screens, as
|
361 |
Â
* well as to do some processing on settings data submitted from those screens.
|
362 |
Â
*
|
363 |
Â
* @since 1.7.0
|
364 |
Â
*
|
365 |
+
* @param string $type Optional; component type to fetch. Default value is 'all', or 'optional', 'retired', 'required'.
|
366 |
+
* @return array Requested components' data.
|
367 |
Â
*/
|
368 |
Â
function bp_core_admin_get_components( $type = 'all' ) {
|
369 |
+
$components = bp_core_get_components( $type );
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
370 |
Â
|
371 |
Â
/**
|
372 |
Â
* Filters the list of component information.
|
@@ -15,7 +15,6 @@ defined( 'ABSPATH' ) || exit;
|
|
15 |
Â
/**
|
16 |
Â
* Initializes the wp-admin area "BuddyPress" menus and sub menus.
|
17 |
Â
*
|
18 |
-
* @uses bp_current_user_can() returns true if the current user is a site admin, false if not.
|
19 |
Â
*/
|
20 |
Â
function bp_core_admin_menu_init() {
|
21 |
Â
add_action( bp_core_admin_hook(), 'bp_core_add_admin_menu', 9 );
|
@@ -123,8 +122,6 @@ function bp_core_admin_backpat_page() {
|
|
123 |
Â
*
|
124 |
Â
* @since 1.5.0
|
125 |
Â
*
|
126 |
-
* @uses bp_current_user_can() to check current user permissions before showing the notices.
|
127 |
-
* @uses bp_is_root_blog()
|
128 |
Â
*/
|
129 |
Â
function bp_core_print_admin_notices() {
|
130 |
Â
|
@@ -302,7 +299,15 @@ function bp_core_activation_notice() {
|
|
302 |
Â
|
303 |
Â
if ( !empty( $orphaned_components ) ) {
|
304 |
Â
$admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
|
305 |
-
$notice = sprintf(
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
306 |
Â
|
307 |
Â
bp_core_add_admin_notice( $notice );
|
308 |
Â
}
|
@@ -324,7 +329,15 @@ function bp_core_activation_notice() {
|
|
324 |
Â
// If there are duplicates, post a message about them.
|
325 |
Â
if ( !empty( $dupe_names ) ) {
|
326 |
Â
$admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
|
327 |
-
$notice = sprintf(
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
328 |
Â
|
329 |
Â
bp_core_add_admin_notice( $notice );
|
330 |
Â
}
|
@@ -337,12 +350,6 @@ function bp_core_activation_notice() {
|
|
337 |
Â
*
|
338 |
Â
* @internal Used internally to redirect BuddyPress to the about page on activation.
|
339 |
Â
*
|
340 |
-
* @uses get_transient() To see if transient to redirect exists.
|
341 |
-
* @uses delete_transient() To delete the transient if it exists.
|
342 |
-
* @uses is_network_admin() To bail if being network activated.
|
343 |
-
* @uses wp_safe_redirect() To redirect.
|
344 |
-
* @uses add_query_arg() To help build the URL to redirect to.
|
345 |
-
* @uses admin_url() To get the admin URL to index.php.
|
346 |
Â
*/
|
347 |
Â
function bp_do_activation_redirect() {
|
348 |
Â
|
@@ -548,7 +555,10 @@ function bp_core_add_contextual_help( $screen = '' ) {
|
|
548 |
Â
break;
|
549 |
Â
}
|
550 |
Â
}
|
551 |
-
add_action( '
|
Â
|
|
Â
|
|
Â
|
|
552 |
Â
|
553 |
Â
/**
|
554 |
Â
* Renders contextual help content to contextual help tabs.
|
@@ -597,7 +607,6 @@ function bp_core_add_contextual_help_content( $tab = '' ) {
|
|
597 |
Â
*
|
598 |
Â
* @since 1.7.0
|
599 |
Â
*
|
600 |
-
* @uses bp_current_user_can() To check users capability on root blog.
|
601 |
Â
*/
|
602 |
Â
function bp_admin_separator() {
|
603 |
Â
|
@@ -632,8 +641,6 @@ function bp_admin_separator() {
|
|
632 |
Â
*
|
633 |
Â
* @since 1.7.0
|
634 |
Â
*
|
635 |
-
* @uses bp_current_user_can() To check users capability on root blog.
|
636 |
-
*
|
637 |
Â
* @param bool $menu_order Menu order.
|
638 |
Â
* @return bool Always true.
|
639 |
Â
*/
|
@@ -652,8 +659,6 @@ function bp_admin_custom_menu_order( $menu_order = false ) {
|
|
652 |
Â
*
|
653 |
Â
* @since 1.7.0
|
654 |
Â
*
|
655 |
-
* @uses bp_current_user_can() To check users capability on root blog.
|
656 |
-
*
|
657 |
Â
* @param array $menu_order Menu Order.
|
658 |
Â
* @return array Modified menu order.
|
659 |
Â
*/
|
@@ -928,7 +933,10 @@ add_action( 'add_meta_boxes_' . bp_get_email_post_type(), 'bp_email_custom_metab
|
|
928 |
Â
function bp_email_plaintext_metabox( $post ) {
|
929 |
Â
?>
|
930 |
Â
|
931 |
-
<label class="screen-reader-text" for="excerpt"><?php
|
Â
|
|
Â
|
|
Â
|
|
932 |
Â
|
933 |
Â
<p><?php _e( 'Most email clients support HTML email. However, some people prefer to receive plain text email. Enter a plain text alternative version of your email here.', 'buddypress' ); ?></p>
|
934 |
Â
|
15 |
Â
/**
|
16 |
Â
* Initializes the wp-admin area "BuddyPress" menus and sub menus.
|
17 |
Â
*
|
Â
|
|
18 |
Â
*/
|
19 |
Â
function bp_core_admin_menu_init() {
|
20 |
Â
add_action( bp_core_admin_hook(), 'bp_core_add_admin_menu', 9 );
|
122 |
Â
*
|
123 |
Â
* @since 1.5.0
|
124 |
Â
*
|
Â
|
|
Â
|
|
125 |
Â
*/
|
126 |
Â
function bp_core_print_admin_notices() {
|
127 |
Â
|
299 |
Â
|
300 |
Â
if ( !empty( $orphaned_components ) ) {
|
301 |
Â
$admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
|
302 |
+
$notice = sprintf(
|
303 |
+
'%1$s <a href="%2$s">%3$s</a>',
|
304 |
+
sprintf(
|
305 |
+
__( 'The following active BuddyPress Components do not have associated WordPress Pages: %s.', 'buddypress' ),
|
306 |
+
'<strong>' . implode( '</strong>, <strong>', array_map( 'esc_html', $orphaned_components ) ) . '</strong>'
|
307 |
+
),
|
308 |
+
esc_url( $admin_url ),
|
309 |
+
__( 'Repair', 'buddypress' )
|
310 |
+
);
|
311 |
Â
|
312 |
Â
bp_core_add_admin_notice( $notice );
|
313 |
Â
}
|
329 |
Â
// If there are duplicates, post a message about them.
|
330 |
Â
if ( !empty( $dupe_names ) ) {
|
331 |
Â
$admin_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) );
|
332 |
+
$notice = sprintf(
|
333 |
+
'%1$s <a href="%2$s">%3$s</a>',
|
334 |
+
sprintf(
|
335 |
+
__( 'Each BuddyPress Component needs its own WordPress page. The following WordPress Pages have more than one component associated with them: %s.', 'buddypress' ),
|
336 |
+
'<strong>' . implode( '</strong>, <strong>', array_map( 'esc_html', $dupe_names ) ) . '</strong>'
|
337 |
+
),
|
338 |
+
esc_url( $admin_url ),
|
339 |
+
__( 'Repair', 'buddypress' )
|
340 |
+
);
|
341 |
Â
|
342 |
Â
bp_core_add_admin_notice( $notice );
|
343 |
Â
}
|
350 |
Â
*
|
351 |
Â
* @internal Used internally to redirect BuddyPress to the about page on activation.
|
352 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
353 |
Â
*/
|
354 |
Â
function bp_do_activation_redirect() {
|
355 |
Â
|
555 |
Â
break;
|
556 |
Â
}
|
557 |
Â
}
|
558 |
+
add_action( 'load-settings_page_bp-components', 'bp_core_add_contextual_help' );
|
559 |
+
add_action( 'load-settings_page_bp-page-settings', 'bp_core_add_contextual_help' );
|
560 |
+
add_action( 'load-settings_page_bp-settings', 'bp_core_add_contextual_help' );
|
561 |
+
add_action( 'load-users_page_bp-profile-setup', 'bp_core_add_contextual_help' );
|
562 |
Â
|
563 |
Â
/**
|
564 |
Â
* Renders contextual help content to contextual help tabs.
|
607 |
Â
*
|
608 |
Â
* @since 1.7.0
|
609 |
Â
*
|
Â
|
|
610 |
Â
*/
|
611 |
Â
function bp_admin_separator() {
|
612 |
Â
|
641 |
Â
*
|
642 |
Â
* @since 1.7.0
|
643 |
Â
*
|
Â
|
|
Â
|
|
644 |
Â
* @param bool $menu_order Menu order.
|
645 |
Â
* @return bool Always true.
|
646 |
Â
*/
|
659 |
Â
*
|
660 |
Â
* @since 1.7.0
|
661 |
Â
*
|
Â
|
|
Â
|
|
662 |
Â
* @param array $menu_order Menu Order.
|
663 |
Â
* @return array Modified menu order.
|
664 |
Â
*/
|
933 |
Â
function bp_email_plaintext_metabox( $post ) {
|
934 |
Â
?>
|
935 |
Â
|
936 |
+
<label class="screen-reader-text" for="excerpt"><?php
|
937 |
+
/* translators: accessibility text */
|
938 |
+
_e( 'Plain text email content', 'buddypress' );
|
939 |
+
?></label><textarea rows="5" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea>
|
940 |
Â
|
941 |
Â
<p><?php _e( 'Most email clients support HTML email. However, some people prefer to receive plain text email. Enter a plain text alternative version of your email here.', 'buddypress' ); ?></p>
|
942 |
Â
|
@@ -90,9 +90,6 @@ function bp_core_install( $active_components = false ) {
|
|
90 |
Â
*
|
91 |
Â
* @since 1.0.0
|
92 |
Â
*
|
93 |
-
* @uses bp_core_set_charset()
|
94 |
-
* @uses bp_core_get_table_prefix()
|
95 |
-
* @uses dbDelta()
|
96 |
Â
*/
|
97 |
Â
function bp_core_install_notifications() {
|
98 |
Â
$sql = array();
|
@@ -134,9 +131,6 @@ function bp_core_install_notifications() {
|
|
134 |
Â
*
|
135 |
Â
* @since 1.0.0
|
136 |
Â
*
|
137 |
-
* @uses bp_core_set_charset()
|
138 |
-
* @uses bp_core_get_table_prefix()
|
139 |
-
* @uses dbDelta()
|
140 |
Â
*/
|
141 |
Â
function bp_core_install_activity_streams() {
|
142 |
Â
$sql = array();
|
@@ -187,9 +181,6 @@ function bp_core_install_activity_streams() {
|
|
187 |
Â
*
|
188 |
Â
* @since 1.0.0
|
189 |
Â
*
|
190 |
-
* @uses bp_core_set_charset()
|
191 |
-
* @uses bp_core_get_table_prefix()
|
192 |
-
* @uses dbDelta()
|
193 |
Â
*/
|
194 |
Â
function bp_core_install_friends() {
|
195 |
Â
$sql = array();
|
@@ -215,9 +206,6 @@ function bp_core_install_friends() {
|
|
215 |
Â
*
|
216 |
Â
* @since 1.0.0
|
217 |
Â
*
|
218 |
-
* @uses bp_core_set_charset()
|
219 |
-
* @uses bp_core_get_table_prefix()
|
220 |
-
* @uses dbDelta()
|
221 |
Â
*/
|
222 |
Â
function bp_core_install_groups() {
|
223 |
Â
$sql = array();
|
@@ -275,9 +263,6 @@ function bp_core_install_groups() {
|
|
275 |
Â
*
|
276 |
Â
* @since 1.0.0
|
277 |
Â
*
|
278 |
-
* @uses bp_core_set_charset()
|
279 |
-
* @uses bp_core_get_table_prefix()
|
280 |
-
* @uses dbDelta()
|
281 |
Â
*/
|
282 |
Â
function bp_core_install_private_messaging() {
|
283 |
Â
$sql = array();
|
@@ -335,9 +320,6 @@ function bp_core_install_private_messaging() {
|
|
335 |
Â
*
|
336 |
Â
* @since 1.0.0
|
337 |
Â
*
|
338 |
-
* @uses bp_core_set_charset()
|
339 |
-
* @uses bp_core_get_table_prefix()
|
340 |
-
* @uses dbDelta()
|
341 |
Â
*/
|
342 |
Â
function bp_core_install_extended_profiles() {
|
343 |
Â
global $wpdb;
|
@@ -425,9 +407,6 @@ function bp_core_install_extended_profiles() {
|
|
425 |
Â
*
|
426 |
Â
* @since 1.0.0
|
427 |
Â
*
|
428 |
-
* @uses bp_core_set_charset()
|
429 |
-
* @uses bp_core_get_table_prefix()
|
430 |
-
* @uses dbDelta()
|
431 |
Â
*/
|
432 |
Â
function bp_core_install_blog_tracking() {
|
433 |
Â
$sql = array();
|
@@ -462,7 +441,6 @@ function bp_core_install_blog_tracking() {
|
|
462 |
Â
* @since 2.0.0
|
463 |
Â
*
|
464 |
Â
* @global $wpdb
|
465 |
-
* @uses wp_get_db_schema() to get WordPress ms_global schema
|
466 |
Â
*/
|
467 |
Â
function bp_core_install_signups() {
|
468 |
Â
global $wpdb;
|
90 |
Â
*
|
91 |
Â
* @since 1.0.0
|
92 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
93 |
Â
*/
|
94 |
Â
function bp_core_install_notifications() {
|
95 |
Â
$sql = array();
|
131 |
Â
*
|
132 |
Â
* @since 1.0.0
|
133 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
134 |
Â
*/
|
135 |
Â
function bp_core_install_activity_streams() {
|
136 |
Â
$sql = array();
|
181 |
Â
*
|
182 |
Â
* @since 1.0.0
|
183 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
184 |
Â
*/
|
185 |
Â
function bp_core_install_friends() {
|
186 |
Â
$sql = array();
|
206 |
Â
*
|
207 |
Â
* @since 1.0.0
|
208 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
209 |
Â
*/
|
210 |
Â
function bp_core_install_groups() {
|
211 |
Â
$sql = array();
|
263 |
Â
*
|
264 |
Â
* @since 1.0.0
|
265 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
266 |
Â
*/
|
267 |
Â
function bp_core_install_private_messaging() {
|
268 |
Â
$sql = array();
|
320 |
Â
*
|
321 |
Â
* @since 1.0.0
|
322 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
323 |
Â
*/
|
324 |
Â
function bp_core_install_extended_profiles() {
|
325 |
Â
global $wpdb;
|
407 |
Â
*
|
408 |
Â
* @since 1.0.0
|
409 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
410 |
Â
*/
|
411 |
Â
function bp_core_install_blog_tracking() {
|
412 |
Â
$sql = array();
|
441 |
Â
* @since 2.0.0
|
442 |
Â
*
|
443 |
Â
* @global $wpdb
|
Â
|
|
444 |
Â
*/
|
445 |
Â
function bp_core_install_signups() {
|
446 |
Â
global $wpdb;
|
@@ -22,7 +22,6 @@ function bp_admin_setting_callback_main_section() { }
|
|
22 |
Â
*
|
23 |
Â
* @since 1.6.0
|
24 |
Â
*
|
25 |
-
* @uses bp_form_option() To output the option value.
|
26 |
Â
*/
|
27 |
Â
function bp_admin_setting_callback_admin_bar() {
|
28 |
Â
?>
|
@@ -38,7 +37,6 @@ function bp_admin_setting_callback_admin_bar() {
|
|
38 |
Â
*
|
39 |
Â
* @since 1.6.0
|
40 |
Â
*
|
41 |
-
* @uses checked() To display the checked attribute.
|
42 |
Â
*/
|
43 |
Â
function bp_admin_setting_callback_account_deletion() {
|
44 |
Â
?>
|
@@ -63,7 +61,6 @@ function bp_admin_setting_callback_activity_section() { }
|
|
63 |
Â
*
|
64 |
Â
* @since 1.6.0
|
65 |
Â
*
|
66 |
-
* @uses checked() To display the checked attribute.
|
67 |
Â
*/
|
68 |
Â
function bp_admin_setting_callback_activity_akismet() {
|
69 |
Â
?>
|
@@ -132,7 +129,6 @@ function bp_admin_setting_callback_xprofile_section() { }
|
|
132 |
Â
*
|
133 |
Â
* @since 1.6.0
|
134 |
Â
*
|
135 |
-
* @uses bp_form_option() To output the option value.
|
136 |
Â
*/
|
137 |
Â
function bp_admin_setting_callback_profile_sync() {
|
138 |
Â
?>
|
@@ -148,7 +144,6 @@ function bp_admin_setting_callback_profile_sync() {
|
|
148 |
Â
*
|
149 |
Â
* @since 1.6.0
|
150 |
Â
*
|
151 |
-
* @uses checked() To display the checked attribute.
|
152 |
Â
*/
|
153 |
Â
function bp_admin_setting_callback_avatar_uploads() {
|
154 |
Â
?>
|
@@ -185,7 +180,6 @@ function bp_admin_setting_callback_groups_section() { }
|
|
185 |
Â
*
|
186 |
Â
* @since 1.6.0
|
187 |
Â
*
|
188 |
-
* @uses checked() To display the checked attribute.
|
189 |
Â
*/
|
190 |
Â
function bp_admin_setting_callback_group_creation() {
|
191 |
Â
?>
|
@@ -235,9 +229,6 @@ function bp_admin_setting_callback_bbpress_section() { }
|
|
235 |
Â
*
|
236 |
Â
* @since 1.6.0
|
237 |
Â
*
|
238 |
-
* @uses checked() To display the checked attribute.
|
239 |
-
* @uses bp_get_option() To get the config location.
|
240 |
-
* @uses bp_form_option() To get the sanitized form option.
|
241 |
Â
*/
|
242 |
Â
function bp_admin_setting_callback_bbpress_configuration() {
|
243 |
Â
|
@@ -265,8 +256,6 @@ function bp_admin_setting_callback_bbpress_configuration() {
|
|
265 |
Â
*
|
266 |
Â
* @since 1.6.0
|
267 |
Â
*
|
268 |
-
* @uses settings_fields() To output the hidden fields for the form.
|
269 |
-
* @uses do_settings_sections() To output the settings sections.
|
270 |
Â
*/
|
271 |
Â
function bp_core_admin_settings() {
|
272 |
Â
|
@@ -350,8 +339,6 @@ add_action( 'bp_admin_init', 'bp_core_admin_settings_save', 100 );
|
|
350 |
Â
*
|
351 |
Â
* @since 1.6.0
|
352 |
Â
*
|
353 |
-
* @uses bp_get_bp_form_option()
|
354 |
-
*
|
355 |
Â
* @param string $option Form option to echo.
|
356 |
Â
* @param string $default Form option default.
|
357 |
Â
* @param bool $slug Form option slug.
|
@@ -364,9 +351,6 @@ function bp_form_option( $option, $default = '' , $slug = false ) {
|
|
364 |
Â
*
|
365 |
Â
* @since 1.6.0
|
366 |
Â
*
|
367 |
-
* @uses bp_get_option()
|
368 |
-
* @uses esc_attr()
|
369 |
-
* @uses apply_filters()
|
370 |
Â
*
|
371 |
Â
* @param string $option Form option to return.
|
372 |
Â
* @param string $default Form option default.
|
22 |
Â
*
|
23 |
Â
* @since 1.6.0
|
24 |
Â
*
|
Â
|
|
25 |
Â
*/
|
26 |
Â
function bp_admin_setting_callback_admin_bar() {
|
27 |
Â
?>
|
37 |
Â
*
|
38 |
Â
* @since 1.6.0
|
39 |
Â
*
|
Â
|
|
40 |
Â
*/
|
41 |
Â
function bp_admin_setting_callback_account_deletion() {
|
42 |
Â
?>
|
61 |
Â
*
|
62 |
Â
* @since 1.6.0
|
63 |
Â
*
|
Â
|
|
64 |
Â
*/
|
65 |
Â
function bp_admin_setting_callback_activity_akismet() {
|
66 |
Â
?>
|
129 |
Â
*
|
130 |
Â
* @since 1.6.0
|
131 |
Â
*
|
Â
|
|
132 |
Â
*/
|
133 |
Â
function bp_admin_setting_callback_profile_sync() {
|
134 |
Â
?>
|
144 |
Â
*
|
145 |
Â
* @since 1.6.0
|
146 |
Â
*
|
Â
|
|
147 |
Â
*/
|
148 |
Â
function bp_admin_setting_callback_avatar_uploads() {
|
149 |
Â
?>
|
180 |
Â
*
|
181 |
Â
* @since 1.6.0
|
182 |
Â
*
|
Â
|
|
183 |
Â
*/
|
184 |
Â
function bp_admin_setting_callback_group_creation() {
|
185 |
Â
?>
|
229 |
Â
*
|
230 |
Â
* @since 1.6.0
|
231 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
232 |
Â
*/
|
233 |
Â
function bp_admin_setting_callback_bbpress_configuration() {
|
234 |
Â
|
256 |
Â
*
|
257 |
Â
* @since 1.6.0
|
258 |
Â
*
|
Â
|
|
Â
|
|
259 |
Â
*/
|
260 |
Â
function bp_core_admin_settings() {
|
261 |
Â
|
339 |
Â
*
|
340 |
Â
* @since 1.6.0
|
341 |
Â
*
|
Â
|
|
Â
|
|
342 |
Â
* @param string $option Form option to echo.
|
343 |
Â
* @param string $default Form option default.
|
344 |
Â
* @param bool $slug Form option slug.
|
351 |
Â
*
|
352 |
Â
* @since 1.6.0
|
353 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
354 |
Â
*
|
355 |
Â
* @param string $option Form option to return.
|
356 |
Â
* @param string $default Form option default.
|
@@ -15,7 +15,6 @@ defined( 'ABSPATH' ) || exit;
|
|
15 |
Â
*
|
16 |
Â
* @since 1.6.0
|
17 |
Â
* @todo Use settings API
|
18 |
-
* @uses bp_core_admin_component_options()
|
19 |
Â
*/
|
20 |
Â
function bp_core_admin_slugs_settings() {
|
21 |
Â
?>
|
15 |
Â
*
|
16 |
Â
* @since 1.6.0
|
17 |
Â
* @todo Use settings API
|
Â
|
|
18 |
Â
*/
|
19 |
Â
function bp_core_admin_slugs_settings() {
|
20 |
Â
?>
|
@@ -34,7 +34,10 @@ function bp_core_admin_tools() {
|
|
34 |
Â
<th scope="row"><?php esc_html_e( 'Repair tools', 'buddypress' ) ?></th>
|
35 |
Â
<td>
|
36 |
Â
<fieldset>
|
37 |
-
<legend class="screen-reader-text"><span><?php
|
Â
|
|
Â
|
|
Â
|
|
38 |
Â
|
39 |
Â
<?php foreach ( bp_admin_repair_list() as $item ) : ?>
|
40 |
Â
|
@@ -473,3 +476,24 @@ function bp_admin_reinstall_emails() {
|
|
473 |
Â
|
474 |
Â
return array( 0, __( 'Emails have been successfully reinstalled.', 'buddypress' ) );
|
475 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
34 |
Â
<th scope="row"><?php esc_html_e( 'Repair tools', 'buddypress' ) ?></th>
|
35 |
Â
<td>
|
36 |
Â
<fieldset>
|
37 |
+
<legend class="screen-reader-text"><span><?php
|
38 |
+
/* translators: accessibility text */
|
39 |
+
esc_html_e( 'Repair', 'buddypress' );
|
40 |
+
?></span></legend>
|
41 |
Â
|
42 |
Â
<?php foreach ( bp_admin_repair_list() as $item ) : ?>
|
43 |
Â
|
476 |
Â
|
477 |
Â
return array( 0, __( 'Emails have been successfully reinstalled.', 'buddypress' ) );
|
478 |
Â
}
|
479 |
+
|
480 |
+
/**
|
481 |
+
* Add notice on the "Tools > BuddyPress" page if more sites need recording.
|
482 |
+
*
|
483 |
+
* This notice only shows up in the network admin dashboard.
|
484 |
+
*
|
485 |
+
* @since 2.6.0
|
486 |
+
*/
|
487 |
+
function bp_core_admin_notice_repopulate_blogs_resume() {
|
488 |
+
$screen = get_current_screen();
|
489 |
+
if ( 'tools_page_bp-tools-network' !== $screen->id ) {
|
490 |
+
return;
|
491 |
+
}
|
492 |
+
|
493 |
+
if ( '' === bp_get_option( '_bp_record_blogs_offset' ) ) {
|
494 |
+
return;
|
495 |
+
}
|
496 |
+
|
497 |
+
echo '<div class="error"><p>' . __( 'It looks like you have more sites to record. Resume recording by checking the "Repopulate site tracking records" option.', 'buddypress' ) . '</p></div>';
|
498 |
+
}
|
499 |
+
add_action( 'network_admin_notices', 'bp_core_admin_notice_repopulate_blogs_resume' );
|
@@ -12,9 +12,8 @@ TABLE OF CONTENTS:
|
|
12 |
Â
1.1 Version Badge
|
13 |
Â
1.2 About Panel
|
14 |
Â
1.2.1 Headline Feature
|
15 |
-
1.2.2
|
16 |
-
1.2.3
|
17 |
-
1.2.4 Changelog Section
|
18 |
Â
2.0 Dashicons
|
19 |
Â
2.1 Top level menus
|
20 |
Â
2.2 Settings - Components
|
@@ -62,136 +61,213 @@ TABLE OF CONTENTS:
|
|
62 |
Â
/*
|
63 |
Â
* 1.2.1 Headline Feature
|
64 |
Â
*/
|
65 |
-
.index_page_bp-about .
|
66 |
-
.dashboard_page_bp-about .
|
67 |
-
margin-bottom:
|
68 |
Â
text-align: center;
|
69 |
Â
}
|
70 |
Â
|
71 |
-
.index_page_bp-about .
|
72 |
-
.index_page_bp-about .headline-feature .headline-title,
|
73 |
-
.dashboard_page_bp-about .
|
74 |
-
.dashboard_page_bp-about .headline-feature .headline-title {
|
75 |
Â
font-size: 2.2em;
|
76 |
-
font-weight: normal;
|
77 |
Â
line-height: 1.3;
|
78 |
Â
margin: 1.25em 0 0.6em;
|
79 |
Â
text-align: center;
|
80 |
Â
}
|
81 |
Â
|
82 |
-
.index_page_bp-about .
|
83 |
-
.dashboard_page_bp-about .
|
84 |
Â
font-size: 1.15em;
|
85 |
Â
margin: 1.15em auto 0.6em;
|
Â
|
|
86 |
Â
}
|
87 |
Â
|
88 |
-
.index_page_bp-about .
|
89 |
-
.dashboard_page_bp-about .
|
90 |
Â
font-weight: 600;
|
91 |
Â
}
|
92 |
Â
|
93 |
-
/*
|
94 |
-
* 1.2.2 Columns
|
95 |
-
*/
|
96 |
-
.index_page_bp-about .about-wrap .two-col > div,
|
97 |
-
.dashboard_page_bp-about .about-wrap .two-col > div {
|
98 |
-
float: right;
|
99 |
-
margin-left: 4.799999999%;
|
100 |
-
position: relative;
|
101 |
-
width: 47.6%;
|
102 |
-
}
|
103 |
-
|
104 |
-
.index_page_bp-about .about-wrap .two-col .last-feature,
|
105 |
-
.dashboard_page_bp-about .about-wrap .two-col .last-feature {
|
106 |
-
margin-left: 0;
|
107 |
-
}
|
108 |
Â
|
109 |
Â
/*
|
110 |
-
* 1.2.
|
111 |
Â
*/
|
112 |
Â
.index_page_bp-about .bp-features-section,
|
113 |
Â
.dashboard_page_bp-about .bp-features-section {
|
Â
|
|
114 |
Â
margin-bottom: 2em;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
115 |
Â
}
|
116 |
Â
|
117 |
-
.index_page_bp-about .
|
118 |
-
.dashboard_page_bp-about .
|
119 |
Â
clear: both;
|
120 |
-
margin-top: 2em;
|
121 |
Â
overflow: hidden;
|
122 |
-
|
Â
|
|
123 |
Â
}
|
124 |
Â
|
125 |
-
.index_page_bp-about .
|
126 |
-
.dashboard_page_bp-about .
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
127 |
Â
margin-top: 0;
|
Â
|
|
128 |
Â
}
|
129 |
Â
|
130 |
-
.index_page_bp-about .
|
131 |
-
.dashboard_page_bp-about .
|
132 |
-
font-size: 1.
|
133 |
-
|
134 |
-
margin: 0 0 0.6em;
|
135 |
Â
}
|
136 |
Â
|
137 |
-
.index_page_bp-about .
|
138 |
-
.dashboard_page_bp-about .
|
139 |
-
|
140 |
-
|
141 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
142 |
Â
}
|
143 |
Â
|
Â
|
|
144 |
Â
/*
|
145 |
-
* 1.2.
|
146 |
Â
*/
|
147 |
-
.index_page_bp-about .
|
148 |
-
.dashboard_page_bp-about .
|
149 |
-
border-top: 1px solid #
|
Â
|
|
150 |
Â
margin-bottom: 3em;
|
Â
|
|
Â
|
|
151 |
Â
}
|
152 |
Â
|
153 |
-
.index_page_bp-about .
|
154 |
-
.dashboard_page_bp-about .
|
155 |
-
|
156 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
157 |
Â
margin: 1.25em 0 .6em;
|
158 |
Â
text-align: center;
|
159 |
Â
}
|
160 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
161 |
Â
@media screen and ( max-width: 782px ) {
|
162 |
-
.index_page_bp-about .
|
163 |
-
.dashboard_page_bp-about .
|
164 |
Â
max-width: 100%;
|
165 |
Â
}
|
166 |
-
.index_page_bp-about .
|
167 |
-
.
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
Â
}
|
172 |
Â
.index_page_bp-about .bp-features-section,
|
173 |
Â
.dashboard_page_bp-about .bp-features-section {
|
174 |
Â
margin-bottom: 0;
|
Â
|
|
175 |
Â
}
|
176 |
-
.index_page_bp-about .
|
177 |
-
.dashboard_page_bp-about .
|
178 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
179 |
Â
}
|
180 |
-
.index_page_bp-about .
|
181 |
-
.dashboard_page_bp-about .
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
Â
|
|
Â
|
|
Â
|
|
186 |
Â
}
|
187 |
-
.index_page_bp-about .changelog .two-col > div,
|
188 |
-
.dashboard_page_bp-about .changelog .two-col > div {
|
189 |
Â
margin-top: 0;
|
190 |
-
padding-bottom: 0;
|
191 |
-
|
192 |
-
.index_page_bp-about .about-wrap .changelog .changelog-title,
|
193 |
-
.dashboard_page_bp-about .about-wrap .changelog .changelog-title {
|
194 |
-
text-align: right;
|
195 |
Â
}
|
196 |
Â
}
|
197 |
Â
|
@@ -367,3 +443,18 @@ body.users_page_bp-signups td.count_sent {
|
|
367 |
Â
body.post-type-bp-email #excerpt {
|
368 |
Â
height: auto;
|
369 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
12 |
Â
1.1 Version Badge
|
13 |
Â
1.2 About Panel
|
14 |
Â
1.2.1 Headline Feature
|
15 |
+
1.2.2 Features Section
|
16 |
+
1.2.3 Changelog Section
|
Â
|
|
17 |
Â
2.0 Dashicons
|
18 |
Â
2.1 Top level menus
|
19 |
Â
2.2 Settings - Components
|
61 |
Â
/*
|
62 |
Â
* 1.2.1 Headline Feature
|
63 |
Â
*/
|
64 |
+
.index_page_bp-about .bp-headline-feature,
|
65 |
+
.dashboard_page_bp-about .bp-headline-feature {
|
66 |
+
margin-bottom: 3em;
|
67 |
Â
text-align: center;
|
68 |
Â
}
|
69 |
Â
|
70 |
+
.index_page_bp-about .bp-headline-feature h3,
|
71 |
+
.index_page_bp-about .bp-headline-feature .headline-title,
|
72 |
+
.dashboard_page_bp-about .bp-headline-feature h3,
|
73 |
+
.dashboard_page_bp-about .bp-headline-feature .headline-title {
|
74 |
Â
font-size: 2.2em;
|
Â
|
|
75 |
Â
line-height: 1.3;
|
76 |
Â
margin: 1.25em 0 0.6em;
|
77 |
Â
text-align: center;
|
78 |
Â
}
|
79 |
Â
|
80 |
+
.index_page_bp-about .bp-headline-feature p,
|
81 |
+
.dashboard_page_bp-about .bp-headline-feature p {
|
82 |
Â
font-size: 1.15em;
|
83 |
Â
margin: 1.15em auto 0.6em;
|
84 |
+
max-width: 80%;
|
85 |
Â
}
|
86 |
Â
|
87 |
+
.index_page_bp-about .bp-headline-feature .introduction,
|
88 |
+
.dashboard_page_bp-about .bp-headline-feature .introduction {
|
89 |
Â
font-weight: 600;
|
90 |
Â
}
|
91 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
92 |
Â
|
93 |
Â
/*
|
94 |
+
* 1.2.2 Features Section
|
95 |
Â
*/
|
96 |
Â
.index_page_bp-about .bp-features-section,
|
97 |
Â
.dashboard_page_bp-about .bp-features-section {
|
98 |
+
clear: both;
|
99 |
Â
margin-bottom: 2em;
|
100 |
+
margin-top: 2em;
|
101 |
+
padding-bottom: 0;
|
102 |
+
}
|
103 |
+
|
104 |
+
.index_page_bp-about .bp-features-section h3,
|
105 |
+
.dashboard_page_bp-about .bp-features-section h3 {
|
106 |
+
font-size: 1.8em;
|
107 |
+
font-weight: normal;
|
108 |
+
line-height: 1.5em;
|
109 |
+
margin: 0 0 0.6em;
|
110 |
+
text-align: center;
|
111 |
Â
}
|
112 |
Â
|
113 |
+
.index_page_bp-about .bp-feature,
|
114 |
+
.dashboard_page_bp-about .bp-feature {
|
115 |
Â
clear: both;
|
Â
|
|
116 |
Â
overflow: hidden;
|
117 |
+
margin-bottom: 3em;
|
118 |
+
margin-top: 3em;
|
119 |
Â
}
|
120 |
Â
|
121 |
+
.index_page_bp-about .bp-feature::after,
|
122 |
+
.dashboard_page_bp-about .bp-feature::after {
|
123 |
+
content: '';
|
124 |
+
}
|
125 |
+
|
126 |
+
.index_page_bp-about .bp-feature h4,
|
127 |
+
.dashboard_page_bp-about .bp-feature h4 {
|
128 |
+
color: #23282d;
|
129 |
+
display: inline-block;
|
130 |
+
font-size: 1.4em;
|
131 |
+
font-weight: normal;
|
132 |
+
margin-bottom: 0.6em;
|
133 |
Â
margin-top: 0;
|
134 |
+
width: 47%;
|
135 |
Â
}
|
136 |
Â
|
137 |
+
.index_page_bp-about .bp-feature p,
|
138 |
+
.dashboard_page_bp-about .bp-feature p {
|
139 |
+
font-size: 1.15em;
|
140 |
+
width: 47%;
|
Â
|
|
141 |
Â
}
|
142 |
Â
|
143 |
+
.index_page_bp-about .bp-feature.opposite h4,
|
144 |
+
.dashboard_page_bp-about .bp-feature.opposite h4,
|
145 |
+
.index_page_bp-about .bp-feature.opposite p,
|
146 |
+
.dashboard_page_bp-about .bp-feature.opposite p {
|
147 |
+
float: left;
|
148 |
+
}
|
149 |
+
|
150 |
+
.index_page_bp-about .bp-feature img,
|
151 |
+
.dashboard_page_bp-about .bp-feature img {
|
152 |
+
clear: left;
|
153 |
+
float: left;
|
154 |
+
margin-right: 2.5%;
|
155 |
+
width: 50%;
|
156 |
+
max-width: 50%;
|
157 |
+
}
|
158 |
+
|
159 |
+
.index_page_bp-about .bp-feature.opposite img,
|
160 |
+
.dashboard_page_bp-about .bp-feature.opposite img{
|
161 |
+
clear: right;
|
162 |
+
float: right;
|
163 |
+
margin-right: 0;
|
164 |
+
margin-left: 2.5%;
|
165 |
Â
}
|
166 |
Â
|
167 |
+
|
168 |
Â
/*
|
169 |
+
* 1.2.3 Changelog Section
|
170 |
Â
*/
|
171 |
+
.index_page_bp-about .bp-changelog-section,
|
172 |
+
.dashboard_page_bp-about .bp-changelog-section {
|
173 |
+
border-top: 1px solid #ccc;
|
174 |
+
clear: both;
|
175 |
Â
margin-bottom: 3em;
|
176 |
+
margin-top: 2em;
|
177 |
+
padding-bottom: 0;
|
178 |
Â
}
|
179 |
Â
|
180 |
+
.index_page_bp-about .bp-changelog-section::after,
|
181 |
+
.dashboard_page_bp-about .bp-changelog-section::after {
|
182 |
+
content: '';
|
183 |
+
}
|
184 |
+
|
185 |
+
.index_page_bp-about .bp-changelog-section .changelog-title,
|
186 |
+
.dashboard_page_bp-about .bp-changelog-section .changelog-title {
|
187 |
+
color: #23282d;
|
188 |
+
font-size: 1.6em;
|
189 |
+
font-weight: normal;
|
190 |
+
line-height: 1.5;
|
191 |
Â
margin: 1.25em 0 .6em;
|
192 |
Â
text-align: center;
|
193 |
Â
}
|
194 |
Â
|
195 |
+
.index_page_bp-about .bp-changelog-section .two-col > div,
|
196 |
+
.dashboard_page_bp-about .bp-changelog-section .two-col > div {
|
197 |
+
float: right;
|
198 |
+
margin-left: 4.799999999%;
|
199 |
+
position: relative;
|
200 |
+
width: 47.6%;
|
201 |
+
}
|
202 |
+
|
203 |
+
.index_page_bp-about .bp-changelog-section .two-col > div.last-feature,
|
204 |
+
.dashboard_page_bp-about .bp-changelog-section .two-col > div.last-feature {
|
205 |
+
margin-left: 0;
|
206 |
+
}
|
207 |
+
|
208 |
+
.index_page_bp-about .bp-changelog,
|
209 |
+
.dashboard_page_bp-about .bp-changelog {
|
210 |
+
margin-bottom: 3em;
|
211 |
+
}
|
212 |
+
|
213 |
+
.index_page_bp-about .bp-changelog h4,
|
214 |
+
.dashboard_page_bp-about .bp-changelog h4 {
|
215 |
+
font-size: 1.15em;
|
216 |
+
margin-top: 1.5em;
|
217 |
+
margin-bottom: 0.6em;
|
218 |
+
}
|
219 |
+
|
220 |
+
.index_page_bp-about .bp-changelog p,
|
221 |
+
.dashboard_page_bp-about .bp-changelog p {
|
222 |
+
font-size: 1.05em;
|
223 |
+
margin-top: 0.75em;
|
224 |
+
}
|
225 |
+
|
226 |
+
.bp-assets {
|
227 |
+
clear: both;
|
228 |
+
margin-bottom: 2em;
|
229 |
+
padding-top: 3em;
|
230 |
+
}
|
231 |
+
|
232 |
Â
@media screen and ( max-width: 782px ) {
|
233 |
+
.index_page_bp-about .bp-headline-feature,
|
234 |
+
.dashboard_page_bp-about .bp-headline-feature {
|
235 |
Â
max-width: 100%;
|
236 |
Â
}
|
237 |
+
.index_page_bp-about .bp-headline-feature .headline-title,
|
238 |
+
.dashboard_page_bp-about .bp-headline-feature .headline-title {
|
239 |
+
font-size: 1.5em;
|
240 |
+
line-height: 1.5;
|
241 |
+
text-align: right;
|
242 |
Â
}
|
243 |
Â
.index_page_bp-about .bp-features-section,
|
244 |
Â
.dashboard_page_bp-about .bp-features-section {
|
245 |
Â
margin-bottom: 0;
|
246 |
+
margin-top: 2em;
|
247 |
Â
}
|
248 |
+
.index_page_bp-about .bp-features-section h3,
|
249 |
+
.dashboard_page_bp-about .bp-features-section h3,
|
250 |
+
.index_page_bp-about .bp-changelog-section .changelog-title,
|
251 |
+
.dashboard_page_bp-about .bp-changelog-section .changelog-title {
|
252 |
+
font-size: 1.5em;
|
253 |
+
line-height: 1.5;
|
254 |
+
text-align: right;
|
255 |
Â
}
|
256 |
+
.index_page_bp-about .bp-features-section h4,
|
257 |
+
.dashboard_page_bp-about .bp-features-section h4,
|
258 |
+
.index_page_bp-about .bp-changelog-section h4,
|
259 |
+
.dashboard_page_bp-about .bp-changelog-section h4 {
|
260 |
+
font-size: 1.25em;
|
261 |
+
font-weight: normal;
|
262 |
+
line-height: 1.25;
|
263 |
+
margin-top: 0.6em;
|
264 |
+
text-align: right;
|
265 |
Â
}
|
266 |
+
.index_page_bp-about .bp-changelog-section .two-col > div,
|
267 |
+
.dashboard_page_bp-about .bp-changelog-section .two-col > div {
|
268 |
Â
margin-top: 0;
|
269 |
+
padding-bottom: 0.5em;
|
270 |
+
width: 100%;
|
Â
|
|
Â
|
|
Â
|
|
271 |
Â
}
|
272 |
Â
}
|
273 |
Â
|
443 |
Â
body.post-type-bp-email #excerpt {
|
444 |
Â
height: auto;
|
445 |
Â
}
|
446 |
+
|
447 |
+
body.post-type-bp-email th#situation {
|
448 |
+
width: 20%;
|
449 |
+
}
|
450 |
+
|
451 |
+
body.post-type-bp-email td.column-situation ul {
|
452 |
+
margin: 0;
|
453 |
+
}
|
454 |
+
|
455 |
+
body.post-type-bp-email .categorydiv label {
|
456 |
+
display: block;
|
457 |
+
float: right;
|
458 |
+
padding-right: 25px;
|
459 |
+
text-indent: -25px;
|
460 |
+
}
|
@@ -1 +1 @@
|
|
1 |
-
.bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons!important}.bp-badge:before{content:"\f448"}.about-wrap .bp-badge{position:absolute;top:0;left:0}@media only screen and (max-width:500px){.about-wrap .bp-badge{position:relative;margin:10px auto;top:auto;left:auto}}.dashboard_page_bp-about .
|
1 |
+
.bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons!important}.bp-badge:before{content:"\f448"}.dashboard_page_bp-about .bp-changelog-section::after,.dashboard_page_bp-about .bp-feature::after,.index_page_bp-about .bp-changelog-section::after,.index_page_bp-about .bp-feature::after{content:''}.about-wrap .bp-badge{position:absolute;top:0;left:0}@media only screen and (max-width:500px){.about-wrap .bp-badge{position:relative;margin:10px auto;top:auto;left:auto}}.dashboard_page_bp-about .bp-headline-feature,.index_page_bp-about .bp-headline-feature{margin-bottom:3em;text-align:center}.dashboard_page_bp-about .bp-headline-feature .headline-title,.dashboard_page_bp-about .bp-headline-feature h3,.index_page_bp-about .bp-headline-feature .headline-title,.index_page_bp-about .bp-headline-feature h3{font-size:2.2em;line-height:1.3;margin:1.25em 0 .6em;text-align:center}.dashboard_page_bp-about .bp-headline-feature p,.index_page_bp-about .bp-headline-feature p{font-size:1.15em;margin:1.15em auto .6em;max-width:80%}.dashboard_page_bp-about .bp-headline-feature .introduction,.index_page_bp-about .bp-headline-feature .introduction{font-weight:600}.dashboard_page_bp-about .bp-features-section,.index_page_bp-about .bp-features-section{clear:both;margin-bottom:2em;margin-top:2em;padding-bottom:0}.dashboard_page_bp-about .bp-features-section h3,.index_page_bp-about .bp-features-section h3{font-size:1.8em;font-weight:400;line-height:1.5em;margin:0 0 .6em;text-align:center}.dashboard_page_bp-about .bp-feature,.index_page_bp-about .bp-feature{clear:both;overflow:hidden;margin-bottom:3em;margin-top:3em}.dashboard_page_bp-about .bp-feature h4,.index_page_bp-about .bp-feature h4{color:#23282d;display:inline-block;font-size:1.4em;font-weight:400;margin-bottom:.6em;margin-top:0;width:47%}.dashboard_page_bp-about .bp-feature p,.index_page_bp-about .bp-feature p{font-size:1.15em;width:47%}.dashboard_page_bp-about .bp-feature.opposite h4,.dashboard_page_bp-about .bp-feature.opposite p,.index_page_bp-about .bp-feature.opposite h4,.index_page_bp-about .bp-feature.opposite p{float:left}.dashboard_page_bp-about .bp-feature img,.index_page_bp-about .bp-feature img{clear:left;float:left;margin-right:2.5%;width:50%;max-width:50%}.dashboard_page_bp-about .bp-feature.opposite img,.index_page_bp-about .bp-feature.opposite img{clear:right;float:right;margin-right:0;margin-left:2.5%}.dashboard_page_bp-about .bp-changelog-section,.index_page_bp-about .bp-changelog-section{border-top:1px solid #ccc;clear:both;margin-bottom:3em;margin-top:2em;padding-bottom:0}.dashboard_page_bp-about .bp-changelog-section .changelog-title,.index_page_bp-about .bp-changelog-section .changelog-title{color:#23282d;font-size:1.6em;font-weight:400;line-height:1.5;margin:1.25em 0 .6em;text-align:center}.dashboard_page_bp-about .bp-changelog-section .two-col>div,.index_page_bp-about .bp-changelog-section .two-col>div{float:right;margin-left:4.799999999%;position:relative;width:47.6%}.dashboard_page_bp-about .bp-changelog-section .two-col>div.last-feature,.index_page_bp-about .bp-changelog-section .two-col>div.last-feature{margin-left:0}.dashboard_page_bp-about .bp-changelog,.index_page_bp-about .bp-changelog{margin-bottom:3em}.dashboard_page_bp-about .bp-changelog h4,.index_page_bp-about .bp-changelog h4{font-size:1.15em;margin-top:1.5em;margin-bottom:.6em}.dashboard_page_bp-about .bp-changelog p,.index_page_bp-about .bp-changelog p{font-size:1.05em;margin-top:.75em}.bp-assets{clear:both;margin-bottom:2em;padding-top:3em}@media screen and (max-width:782px){.dashboard_page_bp-about .bp-changelog-section .changelog-title,.dashboard_page_bp-about .bp-features-section h3,.dashboard_page_bp-about .bp-headline-feature .headline-title,.index_page_bp-about .bp-changelog-section .changelog-title,.index_page_bp-about .bp-features-section h3,.index_page_bp-about .bp-headline-feature .headline-title{font-size:1.5em;line-height:1.5;text-align:right}.dashboard_page_bp-about .bp-headline-feature,.index_page_bp-about .bp-headline-feature{max-width:100%}.dashboard_page_bp-about .bp-features-section,.index_page_bp-about .bp-features-section{margin-bottom:0;margin-top:2em}.dashboard_page_bp-about .bp-changelog-section h4,.dashboard_page_bp-about .bp-features-section h4,.index_page_bp-about .bp-changelog-section h4,.index_page_bp-about .bp-features-section h4{font-size:1.25em;font-weight:400;line-height:1.25;margin-top:.6em;text-align:right}.dashboard_page_bp-about .bp-changelog-section .two-col>div,.index_page_bp-about .bp-changelog-section .two-col>div{margin-top:0;padding-bottom:.5em;width:100%}}#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"}.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"}.settings_page_bp-components tr.core td.plugin-title span:before{content:"\f448"}.settings_page_bp-components tr.members td.plugin-title span:before{content:"\f307"}#bp-admin-component-form .wp-list-table.plugins .plugin-title{width:25%}@media screen and (max-width:782px){.settings_page_bp-components td.plugin-title span{margin-top:5px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{display:block;width:auto}#bp-admin-component-form .subsubsub{margin-bottom:0;padding-bottom:35px}}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}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.post-type-bp-email th#situation,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.post-type-bp-email #excerpt{height:auto}body.post-type-bp-email td.column-situation ul{margin:0}body.post-type-bp-email .categorydiv label{display:block;float:right;padding-right:25px;text-indent:-25px}
|
@@ -12,9 +12,8 @@ TABLE OF CONTENTS:
|
|
12 |
Â
1.1 Version Badge
|
13 |
Â
1.2 About Panel
|
14 |
Â
1.2.1 Headline Feature
|
15 |
-
1.2.2
|
16 |
-
1.2.3
|
17 |
-
1.2.4 Changelog Section
|
18 |
Â
2.0 Dashicons
|
19 |
Â
2.1 Top level menus
|
20 |
Â
2.2 Settings - Components
|
@@ -62,136 +61,213 @@ TABLE OF CONTENTS:
|
|
62 |
Â
/*
|
63 |
Â
* 1.2.1 Headline Feature
|
64 |
Â
*/
|
65 |
-
.index_page_bp-about .
|
66 |
-
.dashboard_page_bp-about .
|
67 |
-
margin-bottom:
|
68 |
Â
text-align: center;
|
69 |
Â
}
|
70 |
Â
|
71 |
-
.index_page_bp-about .
|
72 |
-
.index_page_bp-about .headline-feature .headline-title,
|
73 |
-
.dashboard_page_bp-about .
|
74 |
-
.dashboard_page_bp-about .headline-feature .headline-title {
|
75 |
Â
font-size: 2.2em;
|
76 |
-
font-weight: normal;
|
77 |
Â
line-height: 1.3;
|
78 |
Â
margin: 1.25em 0 0.6em;
|
79 |
Â
text-align: center;
|
80 |
Â
}
|
81 |
Â
|
82 |
-
.index_page_bp-about .
|
83 |
-
.dashboard_page_bp-about .
|
84 |
Â
font-size: 1.15em;
|
85 |
Â
margin: 1.15em auto 0.6em;
|
Â
|
|
86 |
Â
}
|
87 |
Â
|
88 |
-
.index_page_bp-about .
|
89 |
-
.dashboard_page_bp-about .
|
90 |
Â
font-weight: 600;
|
91 |
Â
}
|
92 |
Â
|
93 |
-
/*
|
94 |
-
* 1.2.2 Columns
|
95 |
-
*/
|
96 |
-
.index_page_bp-about .about-wrap .two-col > div,
|
97 |
-
.dashboard_page_bp-about .about-wrap .two-col > div {
|
98 |
-
float: left;
|
99 |
-
margin-right: 4.799999999%;
|
100 |
-
position: relative;
|
101 |
-
width: 47.6%;
|
102 |
-
}
|
103 |
-
|
104 |
-
.index_page_bp-about .about-wrap .two-col .last-feature,
|
105 |
-
.dashboard_page_bp-about .about-wrap .two-col .last-feature {
|
106 |
-
margin-right: 0;
|
107 |
-
}
|
108 |
Â
|
109 |
Â
/*
|
110 |
-
* 1.2.
|
111 |
Â
*/
|
112 |
Â
.index_page_bp-about .bp-features-section,
|
113 |
Â
.dashboard_page_bp-about .bp-features-section {
|
Â
|
|
114 |
Â
margin-bottom: 2em;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
115 |
Â
}
|
116 |
Â
|
117 |
-
.index_page_bp-about .
|
118 |
-
.dashboard_page_bp-about .
|
119 |
Â
clear: both;
|
120 |
-
margin-top: 2em;
|
121 |
Â
overflow: hidden;
|
122 |
-
|
Â
|
|
123 |
Â
}
|
124 |
Â
|
125 |
-
.index_page_bp-about .
|
126 |
-
.dashboard_page_bp-about .
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
127 |
Â
margin-top: 0;
|
Â
|
|
128 |
Â
}
|
129 |
Â
|
130 |
-
.index_page_bp-about .
|
131 |
-
.dashboard_page_bp-about .
|
132 |
-
font-size: 1.
|
133 |
-
|
134 |
-
margin: 0 0 0.6em;
|
135 |
Â
}
|
136 |
Â
|
137 |
-
.index_page_bp-about .
|
138 |
-
.dashboard_page_bp-about .
|
139 |
-
|
140 |
-
|
141 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
142 |
Â
}
|
143 |
Â
|
Â
|
|
144 |
Â
/*
|
145 |
-
* 1.2.
|
146 |
Â
*/
|
147 |
-
.index_page_bp-about .
|
148 |
-
.dashboard_page_bp-about .
|
149 |
-
border-top: 1px solid #
|
Â
|
|
150 |
Â
margin-bottom: 3em;
|
Â
|
|
Â
|
|
151 |
Â
}
|
152 |
Â
|
153 |
-
.index_page_bp-about .
|
154 |
-
.dashboard_page_bp-about .
|
155 |
-
|
156 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
157 |
Â
margin: 1.25em 0 .6em;
|
158 |
Â
text-align: center;
|
159 |
Â
}
|
160 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
161 |
Â
@media screen and ( max-width: 782px ) {
|
162 |
-
.index_page_bp-about .
|
163 |
-
.dashboard_page_bp-about .
|
164 |
Â
max-width: 100%;
|
165 |
Â
}
|
166 |
-
.index_page_bp-about .
|
167 |
-
.
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
Â
}
|
172 |
Â
.index_page_bp-about .bp-features-section,
|
173 |
Â
.dashboard_page_bp-about .bp-features-section {
|
174 |
Â
margin-bottom: 0;
|
Â
|
|
175 |
Â
}
|
176 |
-
.index_page_bp-about .
|
177 |
-
.dashboard_page_bp-about .
|
178 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
179 |
Â
}
|
180 |
-
.index_page_bp-about .
|
181 |
-
.dashboard_page_bp-about .
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
Â
|
|
Â
|
|
Â
|
|
186 |
Â
}
|
187 |
-
.index_page_bp-about .changelog .two-col > div,
|
188 |
-
.dashboard_page_bp-about .changelog .two-col > div {
|
189 |
Â
margin-top: 0;
|
190 |
-
padding-bottom: 0;
|
191 |
-
|
192 |
-
.index_page_bp-about .about-wrap .changelog .changelog-title,
|
193 |
-
.dashboard_page_bp-about .about-wrap .changelog .changelog-title {
|
194 |
-
text-align: left;
|
195 |
Â
}
|
196 |
Â
}
|
197 |
Â
|
@@ -367,3 +443,18 @@ body.users_page_bp-signups td.count_sent {
|
|
367 |
Â
body.post-type-bp-email #excerpt {
|
368 |
Â
height: auto;
|
369 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
12 |
Â
1.1 Version Badge
|
13 |
Â
1.2 About Panel
|
14 |
Â
1.2.1 Headline Feature
|
15 |
+
1.2.2 Features Section
|
16 |
+
1.2.3 Changelog Section
|
Â
|
|
17 |
Â
2.0 Dashicons
|
18 |
Â
2.1 Top level menus
|
19 |
Â
2.2 Settings - Components
|
61 |
Â
/*
|
62 |
Â
* 1.2.1 Headline Feature
|
63 |
Â
*/
|
64 |
+
.index_page_bp-about .bp-headline-feature,
|
65 |
+
.dashboard_page_bp-about .bp-headline-feature {
|
66 |
+
margin-bottom: 3em;
|
67 |
Â
text-align: center;
|
68 |
Â
}
|
69 |
Â
|
70 |
+
.index_page_bp-about .bp-headline-feature h3,
|
71 |
+
.index_page_bp-about .bp-headline-feature .headline-title,
|
72 |
+
.dashboard_page_bp-about .bp-headline-feature h3,
|
73 |
+
.dashboard_page_bp-about .bp-headline-feature .headline-title {
|
74 |
Â
font-size: 2.2em;
|
Â
|
|
75 |
Â
line-height: 1.3;
|
76 |
Â
margin: 1.25em 0 0.6em;
|
77 |
Â
text-align: center;
|
78 |
Â
}
|
79 |
Â
|
80 |
+
.index_page_bp-about .bp-headline-feature p,
|
81 |
+
.dashboard_page_bp-about .bp-headline-feature p {
|
82 |
Â
font-size: 1.15em;
|
83 |
Â
margin: 1.15em auto 0.6em;
|
84 |
+
max-width: 80%;
|
85 |
Â
}
|
86 |
Â
|
87 |
+
.index_page_bp-about .bp-headline-feature .introduction,
|
88 |
+
.dashboard_page_bp-about .bp-headline-feature .introduction {
|
89 |
Â
font-weight: 600;
|
90 |
Â
}
|
91 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
92 |
Â
|
93 |
Â
/*
|
94 |
+
* 1.2.2 Features Section
|
95 |
Â
*/
|
96 |
Â
.index_page_bp-about .bp-features-section,
|
97 |
Â
.dashboard_page_bp-about .bp-features-section {
|
98 |
+
clear: both;
|
99 |
Â
margin-bottom: 2em;
|
100 |
+
margin-top: 2em;
|
101 |
+
padding-bottom: 0;
|
102 |
+
}
|
103 |
+
|
104 |
+
.index_page_bp-about .bp-features-section h3,
|
105 |
+
.dashboard_page_bp-about .bp-features-section h3 {
|
106 |
+
font-size: 1.8em;
|
107 |
+
font-weight: normal;
|
108 |
+
line-height: 1.5em;
|
109 |
+
margin: 0 0 0.6em;
|
110 |
+
text-align: center;
|
111 |
Â
}
|
112 |
Â
|
113 |
+
.index_page_bp-about .bp-feature,
|
114 |
+
.dashboard_page_bp-about .bp-feature {
|
115 |
Â
clear: both;
|
Â
|
|
116 |
Â
overflow: hidden;
|
117 |
+
margin-bottom: 3em;
|
118 |
+
margin-top: 3em;
|
119 |
Â
}
|
120 |
Â
|
121 |
+
.index_page_bp-about .bp-feature::after,
|
122 |
+
.dashboard_page_bp-about .bp-feature::after {
|
123 |
+
content: '';
|
124 |
+
}
|
125 |
+
|
126 |
+
.index_page_bp-about .bp-feature h4,
|
127 |
+
.dashboard_page_bp-about .bp-feature h4 {
|
128 |
+
color: #23282d;
|
129 |
+
display: inline-block;
|
130 |
+
font-size: 1.4em;
|
131 |
+
font-weight: normal;
|
132 |
+
margin-bottom: 0.6em;
|
133 |
Â
margin-top: 0;
|
134 |
+
width: 47%;
|
135 |
Â
}
|
136 |
Â
|
137 |
+
.index_page_bp-about .bp-feature p,
|
138 |
+
.dashboard_page_bp-about .bp-feature p {
|
139 |
+
font-size: 1.15em;
|
140 |
+
width: 47%;
|
Â
|
|
141 |
Â
}
|
142 |
Â
|
143 |
+
.index_page_bp-about .bp-feature.opposite h4,
|
144 |
+
.dashboard_page_bp-about .bp-feature.opposite h4,
|
145 |
+
.index_page_bp-about .bp-feature.opposite p,
|
146 |
+
.dashboard_page_bp-about .bp-feature.opposite p {
|
147 |
+
float: right;
|
148 |
+
}
|
149 |
+
|
150 |
+
.index_page_bp-about .bp-feature img,
|
151 |
+
.dashboard_page_bp-about .bp-feature img {
|
152 |
+
clear: right;
|
153 |
+
float: right;
|
154 |
+
margin-left: 2.5%;
|
155 |
+
width: 50%;
|
156 |
+
max-width: 50%;
|
157 |
+
}
|
158 |
+
|
159 |
+
.index_page_bp-about .bp-feature.opposite img,
|
160 |
+
.dashboard_page_bp-about .bp-feature.opposite img{
|
161 |
+
clear: left;
|
162 |
+
float: left;
|
163 |
+
margin-left: 0;
|
164 |
+
margin-right: 2.5%;
|
165 |
Â
}
|
166 |
Â
|
167 |
+
|
168 |
Â
/*
|
169 |
+
* 1.2.3 Changelog Section
|
170 |
Â
*/
|
171 |
+
.index_page_bp-about .bp-changelog-section,
|
172 |
+
.dashboard_page_bp-about .bp-changelog-section {
|
173 |
+
border-top: 1px solid #ccc;
|
174 |
+
clear: both;
|
175 |
Â
margin-bottom: 3em;
|
176 |
+
margin-top: 2em;
|
177 |
+
padding-bottom: 0;
|
178 |
Â
}
|
179 |
Â
|
180 |
+
.index_page_bp-about .bp-changelog-section::after,
|
181 |
+
.dashboard_page_bp-about .bp-changelog-section::after {
|
182 |
+
content: '';
|
183 |
+
}
|
184 |
+
|
185 |
+
.index_page_bp-about .bp-changelog-section .changelog-title,
|
186 |
+
.dashboard_page_bp-about .bp-changelog-section .changelog-title {
|
187 |
+
color: #23282d;
|
188 |
+
font-size: 1.6em;
|
189 |
+
font-weight: normal;
|
190 |
+
line-height: 1.5;
|
191 |
Â
margin: 1.25em 0 .6em;
|
192 |
Â
text-align: center;
|
193 |
Â
}
|
194 |
Â
|
195 |
+
.index_page_bp-about .bp-changelog-section .two-col > div,
|
196 |
+
.dashboard_page_bp-about .bp-changelog-section .two-col > div {
|
197 |
+
float: left;
|
198 |
+
margin-right: 4.799999999%;
|
199 |
+
position: relative;
|
200 |
+
width: 47.6%;
|
201 |
+
}
|
202 |
+
|
203 |
+
.index_page_bp-about .bp-changelog-section .two-col > div.last-feature,
|
204 |
+
.dashboard_page_bp-about .bp-changelog-section .two-col > div.last-feature {
|
205 |
+
margin-right: 0;
|
206 |
+
}
|
207 |
+
|
208 |
+
.index_page_bp-about .bp-changelog,
|
209 |
+
.dashboard_page_bp-about .bp-changelog {
|
210 |
+
margin-bottom: 3em;
|
211 |
+
}
|
212 |
+
|
213 |
+
.index_page_bp-about .bp-changelog h4,
|
214 |
+
.dashboard_page_bp-about .bp-changelog h4 {
|
215 |
+
font-size: 1.15em;
|
216 |
+
margin-top: 1.5em;
|
217 |
+
margin-bottom: 0.6em;
|
218 |
+
}
|
219 |
+
|
220 |
+
.index_page_bp-about .bp-changelog p,
|
221 |
+
.dashboard_page_bp-about .bp-changelog p {
|
222 |
+
font-size: 1.05em;
|
223 |
+
margin-top: 0.75em;
|
224 |
+
}
|
225 |
+
|
226 |
+
.bp-assets {
|
227 |
+
clear: both;
|
228 |
+
margin-bottom: 2em;
|
229 |
+
padding-top: 3em;
|
230 |
+
}
|
231 |
+
|
232 |
Â
@media screen and ( max-width: 782px ) {
|
233 |
+
.index_page_bp-about .bp-headline-feature,
|
234 |
+
.dashboard_page_bp-about .bp-headline-feature {
|
235 |
Â
max-width: 100%;
|
236 |
Â
}
|
237 |
+
.index_page_bp-about .bp-headline-feature .headline-title,
|
238 |
+
.dashboard_page_bp-about .bp-headline-feature .headline-title {
|
239 |
+
font-size: 1.5em;
|
240 |
+
line-height: 1.5;
|
241 |
+
text-align: left;
|
242 |
Â
}
|
243 |
Â
.index_page_bp-about .bp-features-section,
|
244 |
Â
.dashboard_page_bp-about .bp-features-section {
|
245 |
Â
margin-bottom: 0;
|
246 |
+
margin-top: 2em;
|
247 |
Â
}
|
248 |
+
.index_page_bp-about .bp-features-section h3,
|
249 |
+
.dashboard_page_bp-about .bp-features-section h3,
|
250 |
+
.index_page_bp-about .bp-changelog-section .changelog-title,
|
251 |
+
.dashboard_page_bp-about .bp-changelog-section .changelog-title {
|
252 |
+
font-size: 1.5em;
|
253 |
+
line-height: 1.5;
|
254 |
+
text-align: left;
|
255 |
Â
}
|
256 |
+
.index_page_bp-about .bp-features-section h4,
|
257 |
+
.dashboard_page_bp-about .bp-features-section h4,
|
258 |
+
.index_page_bp-about .bp-changelog-section h4,
|
259 |
+
.dashboard_page_bp-about .bp-changelog-section h4 {
|
260 |
+
font-size: 1.25em;
|
261 |
+
font-weight: normal;
|
262 |
+
line-height: 1.25;
|
263 |
+
margin-top: 0.6em;
|
264 |
+
text-align: left;
|
265 |
Â
}
|
266 |
+
.index_page_bp-about .bp-changelog-section .two-col > div,
|
267 |
+
.dashboard_page_bp-about .bp-changelog-section .two-col > div {
|
268 |
Â
margin-top: 0;
|
269 |
+
padding-bottom: 0.5em;
|
270 |
+
width: 100%;
|
Â
|
|
Â
|
|
Â
|
|
271 |
Â
}
|
272 |
Â
}
|
273 |
Â
|
443 |
Â
body.post-type-bp-email #excerpt {
|
444 |
Â
height: auto;
|
445 |
Â
}
|
446 |
+
|
447 |
+
body.post-type-bp-email th#situation {
|
448 |
+
width: 20%;
|
449 |
+
}
|
450 |
+
|
451 |
+
body.post-type-bp-email td.column-situation ul {
|
452 |
+
margin: 0;
|
453 |
+
}
|
454 |
+
|
455 |
+
body.post-type-bp-email .categorydiv label {
|
456 |
+
display: block;
|
457 |
+
float: left;
|
458 |
+
padding-left: 25px;
|
459 |
+
text-indent: -25px;
|
460 |
+
}
|
@@ -1 +1 @@
|
|
1 |
-
.bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons!important}.bp-badge:before{content:"\f448"}.about-wrap .bp-badge{position:absolute;top:0;right:0}@media only screen and (max-width:500px){.about-wrap .bp-badge{position:relative;margin:10px auto;top:auto;right:auto}}.dashboard_page_bp-about .
|
1 |
+
.bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons!important}.bp-badge:before{content:"\f448"}.dashboard_page_bp-about .bp-changelog-section::after,.dashboard_page_bp-about .bp-feature::after,.index_page_bp-about .bp-changelog-section::after,.index_page_bp-about .bp-feature::after{content:''}.about-wrap .bp-badge{position:absolute;top:0;right:0}@media only screen and (max-width:500px){.about-wrap .bp-badge{position:relative;margin:10px auto;top:auto;right:auto}}.dashboard_page_bp-about .bp-headline-feature,.index_page_bp-about .bp-headline-feature{margin-bottom:3em;text-align:center}.dashboard_page_bp-about .bp-headline-feature .headline-title,.dashboard_page_bp-about .bp-headline-feature h3,.index_page_bp-about .bp-headline-feature .headline-title,.index_page_bp-about .bp-headline-feature h3{font-size:2.2em;line-height:1.3;margin:1.25em 0 .6em;text-align:center}.dashboard_page_bp-about .bp-headline-feature p,.index_page_bp-about .bp-headline-feature p{font-size:1.15em;margin:1.15em auto .6em;max-width:80%}.dashboard_page_bp-about .bp-headline-feature .introduction,.index_page_bp-about .bp-headline-feature .introduction{font-weight:600}.dashboard_page_bp-about .bp-features-section,.index_page_bp-about .bp-features-section{clear:both;margin-bottom:2em;margin-top:2em;padding-bottom:0}.dashboard_page_bp-about .bp-features-section h3,.index_page_bp-about .bp-features-section h3{font-size:1.8em;font-weight:400;line-height:1.5em;margin:0 0 .6em;text-align:center}.dashboard_page_bp-about .bp-feature,.index_page_bp-about .bp-feature{clear:both;overflow:hidden;margin-bottom:3em;margin-top:3em}.dashboard_page_bp-about .bp-feature h4,.index_page_bp-about .bp-feature h4{color:#23282d;display:inline-block;font-size:1.4em;font-weight:400;margin-bottom:.6em;margin-top:0;width:47%}.dashboard_page_bp-about .bp-feature p,.index_page_bp-about .bp-feature p{font-size:1.15em;width:47%}.dashboard_page_bp-about .bp-feature.opposite h4,.dashboard_page_bp-about .bp-feature.opposite p,.index_page_bp-about .bp-feature.opposite h4,.index_page_bp-about .bp-feature.opposite p{float:right}.dashboard_page_bp-about .bp-feature img,.index_page_bp-about .bp-feature img{clear:right;float:right;margin-left:2.5%;width:50%;max-width:50%}.dashboard_page_bp-about .bp-feature.opposite img,.index_page_bp-about .bp-feature.opposite img{clear:left;float:left;margin-left:0;margin-right:2.5%}.dashboard_page_bp-about .bp-changelog-section,.index_page_bp-about .bp-changelog-section{border-top:1px solid #ccc;clear:both;margin-bottom:3em;margin-top:2em;padding-bottom:0}.dashboard_page_bp-about .bp-changelog-section .changelog-title,.index_page_bp-about .bp-changelog-section .changelog-title{color:#23282d;font-size:1.6em;font-weight:400;line-height:1.5;margin:1.25em 0 .6em;text-align:center}.dashboard_page_bp-about .bp-changelog-section .two-col>div,.index_page_bp-about .bp-changelog-section .two-col>div{float:left;margin-right:4.799999999%;position:relative;width:47.6%}.dashboard_page_bp-about .bp-changelog-section .two-col>div.last-feature,.index_page_bp-about .bp-changelog-section .two-col>div.last-feature{margin-right:0}.dashboard_page_bp-about .bp-changelog,.index_page_bp-about .bp-changelog{margin-bottom:3em}.dashboard_page_bp-about .bp-changelog h4,.index_page_bp-about .bp-changelog h4{font-size:1.15em;margin-top:1.5em;margin-bottom:.6em}.dashboard_page_bp-about .bp-changelog p,.index_page_bp-about .bp-changelog p{font-size:1.05em;margin-top:.75em}.bp-assets{clear:both;margin-bottom:2em;padding-top:3em}@media screen and (max-width:782px){.dashboard_page_bp-about .bp-changelog-section .changelog-title,.dashboard_page_bp-about .bp-features-section h3,.dashboard_page_bp-about .bp-headline-feature .headline-title,.index_page_bp-about .bp-changelog-section .changelog-title,.index_page_bp-about .bp-features-section h3,.index_page_bp-about .bp-headline-feature .headline-title{font-size:1.5em;line-height:1.5;text-align:left}.dashboard_page_bp-about .bp-headline-feature,.index_page_bp-about .bp-headline-feature{max-width:100%}.dashboard_page_bp-about .bp-features-section,.index_page_bp-about .bp-features-section{margin-bottom:0;margin-top:2em}.dashboard_page_bp-about .bp-changelog-section h4,.dashboard_page_bp-about .bp-features-section h4,.index_page_bp-about .bp-changelog-section h4,.index_page_bp-about .bp-features-section h4{font-size:1.25em;font-weight:400;line-height:1.25;margin-top:.6em;text-align:left}.dashboard_page_bp-about .bp-changelog-section .two-col>div,.index_page_bp-about .bp-changelog-section .two-col>div{margin-top:0;padding-bottom:.5em;width:100%}}#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"}.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"}.settings_page_bp-components tr.core td.plugin-title span:before{content:"\f448"}.settings_page_bp-components tr.members td.plugin-title span:before{content:"\f307"}#bp-admin-component-form .wp-list-table.plugins .plugin-title{width:25%}@media screen and (max-width:782px){.settings_page_bp-components td.plugin-title span{margin-top:5px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{display:block;width:auto}#bp-admin-component-form .subsubsub{margin-bottom:0;padding-bottom:35px}}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}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.post-type-bp-email th#situation,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.post-type-bp-email #excerpt{height:auto}body.post-type-bp-email td.column-situation ul{margin:0}body.post-type-bp-email .categorydiv label{display:block;float:left;padding-left:25px;text-indent:-25px}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
Â
!function(a){a(window).on("load",function(){a(".customize-control-range input").on("input",function(){var b=a(this);b.siblings("output").text(b.val())})})}(jQuery);
|
Â
|
|
1 |
Â
!function(a){a(window).on("load",function(){a(".customize-control-range input").on("input",function(){var b=a(this);b.siblings("output").text(b.val())})})}(jQuery);
|
@@ -1,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
Â
!function(a){wp.customize("bp_email_options[email_bg]",function(b){b.bind(function(b){b.length&&(a(".email_bg").attr("bgcolor",b),a("hr").attr("color",b))})}),wp.customize("bp_email_options[header_bg]",function(b){b.bind(function(b){b.length&&a(".header_bg").attr("bgcolor",b)})}),wp.customize("bp_email_options[header_text_size]",function(b){b.bind(function(b){b.length&&a(".header_text_size").css("font-size",b+"px")})}),wp.customize("bp_email_options[header_text_color]",function(b){b.bind(function(b){b.length&&a(".header_text_color").css("color",b)})}),wp.customize("bp_email_options[highlight_color]",function(b){b.bind(function(b){b.length&&(a(".header_bg").css("border-top-color",b),a("a").css("color",b),a("hr").attr("color",b))})}),wp.customize("bp_email_options[body_bg]",function(b){b.bind(function(b){b.length&&a(".body_bg").attr("bgcolor",b)})}),wp.customize("bp_email_options[body_text_size]",function(b){b.bind(function(b){b.length&&(a(".body_text_size").css("font-size",b+"px").css("line-height",Math.floor(1.618*b)+"px"),a(".welcome").css("font-size",Math.floor(1.35*b)+"px"))})}),wp.customize("bp_email_options[body_text_color]",function(b){b.bind(function(b){b.length&&a(".body_text_color").css("color",b)})}),wp.customize("bp_email_options[footer_bg]",function(b){b.bind(function(b){b.length&&a(".footer_bg").attr("bgcolor",b)})}),wp.customize("bp_email_options[footer_text_size]",function(b){b.bind(function(b){b.length&&a(".footer_text_size").css("font-size",b+"px").css("line-height",Math.floor(1.618*b)+"px")})}),wp.customize("bp_email_options[footer_text_color]",function(b){b.bind(function(b){b.length&&a(".footer_text_color").css("color",b)})}),wp.customize("bp_email_options[footer_text]",function(b){b.bind(function(b){a(".footer_text").text(b)})})}(jQuery);
|
Â
|
|
1 |
Â
!function(a){wp.customize("bp_email_options[email_bg]",function(b){b.bind(function(b){b.length&&(a(".email_bg").attr("bgcolor",b),a("hr").attr("color",b))})}),wp.customize("bp_email_options[header_bg]",function(b){b.bind(function(b){b.length&&a(".header_bg").attr("bgcolor",b)})}),wp.customize("bp_email_options[header_text_size]",function(b){b.bind(function(b){b.length&&a(".header_text_size").css("font-size",b+"px")})}),wp.customize("bp_email_options[header_text_color]",function(b){b.bind(function(b){b.length&&a(".header_text_color").css("color",b)})}),wp.customize("bp_email_options[highlight_color]",function(b){b.bind(function(b){b.length&&(a(".header_bg").css("border-top-color",b),a("a").css("color",b),a("hr").attr("color",b))})}),wp.customize("bp_email_options[body_bg]",function(b){b.bind(function(b){b.length&&a(".body_bg").attr("bgcolor",b)})}),wp.customize("bp_email_options[body_text_size]",function(b){b.bind(function(b){b.length&&(a(".body_text_size").css("font-size",b+"px").css("line-height",Math.floor(1.618*b)+"px"),a(".welcome").css("font-size",Math.floor(1.35*b)+"px"))})}),wp.customize("bp_email_options[body_text_color]",function(b){b.bind(function(b){b.length&&a(".body_text_color").css("color",b)})}),wp.customize("bp_email_options[footer_bg]",function(b){b.bind(function(b){b.length&&a(".footer_bg").attr("bgcolor",b)})}),wp.customize("bp_email_options[footer_text_size]",function(b){b.bind(function(b){b.length&&a(".footer_text_size").css("font-size",b+"px").css("line-height",Math.floor(1.618*b)+"px")})}),wp.customize("bp_email_options[footer_text_color]",function(b){b.bind(function(b){b.length&&a(".footer_text_color").css("color",b)})}),wp.customize("bp_email_options[footer_text]",function(b){b.bind(function(b){a(".footer_text").text(b)})})}(jQuery);
|
@@ -32,6 +32,7 @@ defined( 'ABSPATH' ) || exit;
|
|
32 |
Â
*/
|
33 |
Â
add_action( 'plugins_loaded', 'bp_loaded', 10 );
|
34 |
Â
add_action( 'init', 'bp_init', 10 );
|
Â
|
|
35 |
Â
add_action( 'customize_register', 'bp_customize_register', 20 ); // After WP core.
|
36 |
Â
add_action( 'parse_query', 'bp_parse_query', 2 ); // Early for overrides.
|
37 |
Â
add_action( 'wp', 'bp_ready', 10 );
|
@@ -39,6 +40,7 @@ add_action( 'set_current_user', 'bp_setup_current_user', 10 );
|
|
39 |
Â
add_action( 'setup_theme', 'bp_setup_theme', 10 );
|
40 |
Â
add_action( 'after_setup_theme', 'bp_after_setup_theme', 100 ); // After WP themes.
|
41 |
Â
add_action( 'wp_enqueue_scripts', 'bp_enqueue_scripts', 10 );
|
Â
|
|
42 |
Â
add_action( 'admin_bar_menu', 'bp_setup_admin_bar', 20 ); // After WP core.
|
43 |
Â
add_action( 'template_redirect', 'bp_template_redirect', 10 );
|
44 |
Â
add_action( 'widgets_init', 'bp_widgets_init', 10 );
|
32 |
Â
*/
|
33 |
Â
add_action( 'plugins_loaded', 'bp_loaded', 10 );
|
34 |
Â
add_action( 'init', 'bp_init', 10 );
|
35 |
+
add_action( 'rest_api_init', 'bp_rest_api_init', 20 ); // After WP core.
|
36 |
Â
add_action( 'customize_register', 'bp_customize_register', 20 ); // After WP core.
|
37 |
Â
add_action( 'parse_query', 'bp_parse_query', 2 ); // Early for overrides.
|
38 |
Â
add_action( 'wp', 'bp_ready', 10 );
|
40 |
Â
add_action( 'setup_theme', 'bp_setup_theme', 10 );
|
41 |
Â
add_action( 'after_setup_theme', 'bp_after_setup_theme', 100 ); // After WP themes.
|
42 |
Â
add_action( 'wp_enqueue_scripts', 'bp_enqueue_scripts', 10 );
|
43 |
+
add_action( 'enqueue_embed_scripts', 'bp_enqueue_embed_scripts', 10 );
|
44 |
Â
add_action( 'admin_bar_menu', 'bp_setup_admin_bar', 20 ); // After WP core.
|
45 |
Â
add_action( 'template_redirect', 'bp_template_redirect', 10 );
|
46 |
Â
add_action( 'widgets_init', 'bp_widgets_init', 10 );
|
@@ -10,14 +10,15 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Setup BuddyPress Admin.
|
17 |
Â
*
|
18 |
Â
* @since 1.6.0
|
19 |
Â
*
|
20 |
-
* @uses BP_Admin
|
21 |
Â
*/
|
22 |
Â
function bp_admin() {
|
23 |
Â
buddypress()->admin = new BP_Admin();
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-admin.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Setup BuddyPress Admin.
|
19 |
Â
*
|
20 |
Â
* @since 1.6.0
|
21 |
Â
*
|
Â
|
|
22 |
Â
*/
|
23 |
Â
function bp_admin() {
|
24 |
Â
buddypress()->admin = new BP_Admin();
|
@@ -55,17 +55,6 @@ add_action( 'admin_bar_menu', 'bp_admin_bar_my_account_root', 100 );
|
|
55 |
Â
* @since 1.2.0
|
56 |
Â
*
|
57 |
Â
* @global string $wp_version
|
58 |
-
* @uses bp_get_option()
|
59 |
-
* @uses is_user_logged_in()
|
60 |
-
* @uses bp_use_wp_admin_bar()
|
61 |
-
* @uses show_admin_bar()
|
62 |
-
* @uses add_action() To hook 'bp_adminbar_logo' to 'bp_adminbar_logo'.
|
63 |
-
* @uses add_action() To hook 'bp_adminbar_login_menu' to 'bp_adminbar_menus'.
|
64 |
-
* @uses add_action() To hook 'bp_adminbar_account_menu' to 'bp_adminbar_menus'.
|
65 |
-
* @uses add_action() To hook 'bp_adminbar_thisblog_menu' to 'bp_adminbar_menus'.
|
66 |
-
* @uses add_action() To hook 'bp_adminbar_random_menu' to 'bp_adminbar_menus'.
|
67 |
-
* @uses add_action() To hook 'bp_core_admin_bar' to 'wp_footer'.
|
68 |
-
* @uses add_action() To hook 'bp_core_admin_bar' to 'admin_footer'.
|
69 |
Â
*/
|
70 |
Â
function bp_core_load_admin_bar() {
|
71 |
Â
|
55 |
Â
* @since 1.2.0
|
56 |
Â
*
|
57 |
Â
* @global string $wp_version
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
58 |
Â
*/
|
59 |
Â
function bp_core_load_admin_bar() {
|
60 |
Â
|
@@ -1033,7 +1033,7 @@ function bp_attachments_cover_image_is_edit() {
|
|
1033 |
Â
$retval = false;
|
1034 |
Â
|
1035 |
Â
$current_component = bp_current_component();
|
1036 |
-
if ( '
|
1037 |
Â
$current_component = 'xprofile';
|
1038 |
Â
}
|
1039 |
Â
|
1033 |
Â
$retval = false;
|
1034 |
Â
|
1035 |
Â
$current_component = bp_current_component();
|
1036 |
+
if ( bp_is_active( 'xprofile' ) && bp_is_current_component( 'xprofile' ) ) {
|
1037 |
Â
$current_component = 'xprofile';
|
1038 |
Â
}
|
1039 |
Â
|
@@ -175,7 +175,7 @@ add_action( 'bp_setup_globals', 'bp_core_set_avatar_globals' );
|
|
175 |
Â
* local avatar. In some cases, this may be undesirable, in which
|
176 |
Â
* case 'no_grav' should be set to true. To disable Gravatar
|
177 |
Â
* fallbacks globally, see the 'bp_core_fetch_avatar_no_grav' filter.
|
178 |
-
* Default: false.
|
179 |
Â
* @type bool $html Whether to return an <img> HTML element, vs a raw URL
|
180 |
Â
* to an avatar. If false, <img>-specific arguments (like 'css_id')
|
181 |
Â
* will be ignored. Default: true.
|
@@ -211,7 +211,7 @@ function bp_core_fetch_avatar( $args = '' ) {
|
|
211 |
Â
'css_id' => false,
|
212 |
Â
'alt' => '',
|
213 |
Â
'email' => false,
|
214 |
-
'no_grav' =>
|
215 |
Â
'html' => true,
|
216 |
Â
'title' => '',
|
217 |
Â
'extra_attr' => '',
|
@@ -564,6 +564,11 @@ function bp_core_fetch_avatar( $args = '' ) {
|
|
564 |
Â
}
|
565 |
Â
}
|
566 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
567 |
Â
/**
|
568 |
Â
* Filters whether or not to skip Gravatar check.
|
569 |
Â
*
|
@@ -636,6 +641,17 @@ function bp_core_fetch_avatar( $args = '' ) {
|
|
636 |
Â
if ( ! empty( $params['rating'] ) ) {
|
637 |
Â
$url_args['r'] = strtolower( $params['rating'] );
|
638 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
639 |
Â
// Only set default image if 'Gravatar Logo' is not requested.
|
640 |
Â
if ( 'gravatar_default' !== $default_grav ) {
|
641 |
Â
$url_args['d'] = $default_grav;
|
@@ -660,7 +676,7 @@ function bp_core_fetch_avatar( $args = '' ) {
|
|
660 |
Â
* @param string $value Default avatar for non-gravatar requests.
|
661 |
Â
* @param array $params Array of parameters for the avatar request.
|
662 |
Â
*/
|
663 |
-
$gravatar = apply_filters( 'bp_core_default_avatar_' . $params['object'], bp_core_avatar_default( 'local' ), $params );
|
664 |
Â
}
|
665 |
Â
|
666 |
Â
if ( true === $params['html'] ) {
|
@@ -1038,8 +1054,9 @@ function bp_avatar_ajax_upload() {
|
|
1038 |
Â
// Remove template message.
|
1039 |
Â
$bp->template_message = false;
|
1040 |
Â
$bp->template_message_type = false;
|
1041 |
-
|
1042 |
-
@setcookie( 'bp-message
|
Â
|
|
1043 |
Â
}
|
1044 |
Â
|
1045 |
Â
if ( empty( $avatar ) ) {
|
@@ -1623,8 +1640,6 @@ function bp_core_get_upload_dir( $type = 'upload_path' ) {
|
|
1623 |
Â
*
|
1624 |
Â
* @since 1.2.0
|
1625 |
Â
*
|
1626 |
-
* @uses bp_core_get_upload_dir() To get upload directory info.
|
1627 |
-
*
|
1628 |
Â
* @return string Absolute path to WP upload directory.
|
1629 |
Â
*/
|
1630 |
Â
function bp_core_avatar_upload_path() {
|
@@ -1644,8 +1659,6 @@ function bp_core_avatar_upload_path() {
|
|
1644 |
Â
*
|
1645 |
Â
* @since 1.2.0
|
1646 |
Â
*
|
1647 |
-
* @uses bp_core_get_upload_dir() To get upload directory info.
|
1648 |
-
*
|
1649 |
Â
* @return string Full URL to current upload location.
|
1650 |
Â
*/
|
1651 |
Â
function bp_core_avatar_url() {
|
@@ -1674,7 +1687,7 @@ function bp_get_user_has_avatar( $user_id = 0 ) {
|
|
1674 |
Â
$user_id = bp_displayed_user_id();
|
1675 |
Â
|
1676 |
Â
$retval = false;
|
1677 |
-
if ( bp_core_fetch_avatar( array( 'item_id' => $user_id, 'no_grav' => true, 'html' => false ) ) != bp_core_avatar_default( 'local' ) )
|
1678 |
Â
$retval = true;
|
1679 |
Â
|
1680 |
Â
/**
|
@@ -1833,34 +1846,53 @@ function bp_core_avatar_original_max_filesize() {
|
|
1833 |
Â
* Get the URL of the 'full' default avatar.
|
1834 |
Â
*
|
1835 |
Â
* @since 1.5.0
|
Â
|
|
1836 |
Â
*
|
1837 |
-
* @param string $type
|
1838 |
-
*
|
1839 |
-
*
|
Â
|
|
1840 |
Â
* @return string The URL of the default avatar.
|
1841 |
Â
*/
|
1842 |
-
function bp_core_avatar_default( $type = 'gravatar' ) {
|
1843 |
Â
// Local override.
|
1844 |
Â
if ( defined( 'BP_AVATAR_DEFAULT' ) ) {
|
1845 |
Â
$avatar = BP_AVATAR_DEFAULT;
|
1846 |
Â
|
1847 |
Â
// Use the local default image.
|
1848 |
Â
} elseif ( 'local' === $type ) {
|
1849 |
-
$
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1850 |
Â
|
1851 |
Â
// Use Gravatar's mystery person as fallback.
|
1852 |
Â
} else {
|
1853 |
-
$
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1854 |
Â
}
|
1855 |
Â
|
1856 |
Â
/**
|
1857 |
Â
* Filters the URL of the 'full' default avatar.
|
1858 |
Â
*
|
1859 |
Â
* @since 1.5.0
|
Â
|
|
1860 |
Â
*
|
1861 |
Â
* @param string $avatar URL of the default avatar.
|
Â
|
|
1862 |
Â
*/
|
1863 |
-
return apply_filters( 'bp_core_avatar_default', $avatar );
|
1864 |
Â
}
|
1865 |
Â
|
1866 |
Â
/**
|
@@ -1870,13 +1902,15 @@ function bp_core_avatar_default( $type = 'gravatar' ) {
|
|
1870 |
Â
* defined.
|
1871 |
Â
*
|
1872 |
Â
* @since 1.5.0
|
Â
|
|
1873 |
Â
*
|
1874 |
-
* @param string $type
|
1875 |
-
*
|
1876 |
-
*
|
Â
|
|
1877 |
Â
* @return string The URL of the default avatar thumb.
|
1878 |
Â
*/
|
1879 |
-
function bp_core_avatar_default_thumb( $type = 'gravatar' ) {
|
1880 |
Â
// Local override.
|
1881 |
Â
if ( defined( 'BP_AVATAR_DEFAULT_THUMB' ) ) {
|
1882 |
Â
$avatar = BP_AVATAR_DEFAULT_THUMB;
|
@@ -1894,10 +1928,12 @@ function bp_core_avatar_default_thumb( $type = 'gravatar' ) {
|
|
1894 |
Â
* Filters the URL of the 'thumb' default avatar.
|
1895 |
Â
*
|
1896 |
Â
* @since 1.5.0
|
Â
|
|
1897 |
Â
*
|
1898 |
Â
* @param string $avatar URL of the default avatar.
|
Â
|
|
1899 |
Â
*/
|
1900 |
-
return apply_filters( 'bp_core_avatar_thumb', $avatar );
|
1901 |
Â
}
|
1902 |
Â
|
1903 |
Â
/**
|
@@ -1909,12 +1945,6 @@ function bp_core_avatar_default_thumb( $type = 'gravatar' ) {
|
|
1909 |
Â
*
|
1910 |
Â
* @since 2.2.0
|
1911 |
Â
*
|
1912 |
-
* @uses bp_is_group_create()
|
1913 |
-
* @uses bp_is_group_admin_page()
|
1914 |
-
* @uses bp_is_group_admin_screen() to check for a group admin screen
|
1915 |
-
* @uses bp_action_variable() to check for the group's avatar creation step
|
1916 |
-
* @uses bp_is_user_change_avatar() to check for the user's change profile screen
|
1917 |
-
*
|
1918 |
Â
* @param WP_Query|null $posts_query The main query object.
|
1919 |
Â
*/
|
1920 |
Â
function bp_core_avatar_reset_query( $posts_query = null ) {
|
175 |
Â
* local avatar. In some cases, this may be undesirable, in which
|
176 |
Â
* case 'no_grav' should be set to true. To disable Gravatar
|
177 |
Â
* fallbacks globally, see the 'bp_core_fetch_avatar_no_grav' filter.
|
178 |
+
* Default: true for groups, otherwise false.
|
179 |
Â
* @type bool $html Whether to return an <img> HTML element, vs a raw URL
|
180 |
Â
* to an avatar. If false, <img>-specific arguments (like 'css_id')
|
181 |
Â
* will be ignored. Default: true.
|
211 |
Â
'css_id' => false,
|
212 |
Â
'alt' => '',
|
213 |
Â
'email' => false,
|
214 |
+
'no_grav' => null,
|
215 |
Â
'html' => true,
|
216 |
Â
'title' => '',
|
217 |
Â
'extra_attr' => '',
|
564 |
Â
}
|
565 |
Â
}
|
566 |
Â
|
567 |
+
// By default, Gravatar is not pinged for groups.
|
568 |
+
if ( null === $params['no_grav'] ) {
|
569 |
+
$params['no_grav'] = 'group' === $params['object'];
|
570 |
+
}
|
571 |
+
|
572 |
Â
/**
|
573 |
Â
* Filters whether or not to skip Gravatar check.
|
574 |
Â
*
|
641 |
Â
if ( ! empty( $params['rating'] ) ) {
|
642 |
Â
$url_args['r'] = strtolower( $params['rating'] );
|
643 |
Â
}
|
644 |
+
|
645 |
+
/**
|
646 |
+
* Filters the Gravatar "d" parameter.
|
647 |
+
*
|
648 |
+
* @since 2.6.0
|
649 |
+
*
|
650 |
+
* @param string $default_grav The avatar default.
|
651 |
+
* @param array $params The avatar's data.
|
652 |
+
*/
|
653 |
+
$default_grav = apply_filters( 'bp_core_avatar_default', $default_grav, $params );
|
654 |
+
|
655 |
Â
// Only set default image if 'Gravatar Logo' is not requested.
|
656 |
Â
if ( 'gravatar_default' !== $default_grav ) {
|
657 |
Â
$url_args['d'] = $default_grav;
|
676 |
Â
* @param string $value Default avatar for non-gravatar requests.
|
677 |
Â
* @param array $params Array of parameters for the avatar request.
|
678 |
Â
*/
|
679 |
+
$gravatar = apply_filters( 'bp_core_default_avatar_' . $params['object'], bp_core_avatar_default( 'local', $params ), $params );
|
680 |
Â
}
|
681 |
Â
|
682 |
Â
if ( true === $params['html'] ) {
|
1054 |
Â
// Remove template message.
|
1055 |
Â
$bp->template_message = false;
|
1056 |
Â
$bp->template_message_type = false;
|
1057 |
+
|
1058 |
+
@setcookie( 'bp-message', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
1059 |
+
@setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
1060 |
Â
}
|
1061 |
Â
|
1062 |
Â
if ( empty( $avatar ) ) {
|
1640 |
Â
*
|
1641 |
Â
* @since 1.2.0
|
1642 |
Â
*
|
Â
|
|
Â
|
|
1643 |
Â
* @return string Absolute path to WP upload directory.
|
1644 |
Â
*/
|
1645 |
Â
function bp_core_avatar_upload_path() {
|
1659 |
Â
*
|
1660 |
Â
* @since 1.2.0
|
1661 |
Â
*
|
Â
|
|
Â
|
|
1662 |
Â
* @return string Full URL to current upload location.
|
1663 |
Â
*/
|
1664 |
Â
function bp_core_avatar_url() {
|
1687 |
Â
$user_id = bp_displayed_user_id();
|
1688 |
Â
|
1689 |
Â
$retval = false;
|
1690 |
+
if ( bp_core_fetch_avatar( array( 'item_id' => $user_id, 'no_grav' => true, 'html' => false, 'type' => 'full' ) ) != bp_core_avatar_default( 'local' ) )
|
1691 |
Â
$retval = true;
|
1692 |
Â
|
1693 |
Â
/**
|
1846 |
Â
* Get the URL of the 'full' default avatar.
|
1847 |
Â
*
|
1848 |
Â
* @since 1.5.0
|
1849 |
+
* @since 2.6.0 Introduced `$params` and `$object_type` parameters.
|
1850 |
Â
*
|
1851 |
+
* @param string $type 'local' if the fallback should be the locally-hosted version
|
1852 |
+
* of the mystery person, 'gravatar' if the fallback should be
|
1853 |
+
* Gravatar's version. Default: 'gravatar'.
|
1854 |
+
* @param array $params Parameters passed to bp_core_fetch_avatar().
|
1855 |
Â
* @return string The URL of the default avatar.
|
1856 |
Â
*/
|
1857 |
+
function bp_core_avatar_default( $type = 'gravatar', $params = array() ) {
|
1858 |
Â
// Local override.
|
1859 |
Â
if ( defined( 'BP_AVATAR_DEFAULT' ) ) {
|
1860 |
Â
$avatar = BP_AVATAR_DEFAULT;
|
1861 |
Â
|
1862 |
Â
// Use the local default image.
|
1863 |
Â
} elseif ( 'local' === $type ) {
|
1864 |
+
$size = '';
|
1865 |
+
if (
|
1866 |
+
( isset( $params['type'] ) && 'thumb' === $params['type'] && bp_core_avatar_thumb_width() <= 50 ) ||
|
1867 |
+
( isset( $params['width'] ) && $params['width'] <= 50 )
|
1868 |
+
) {
|
1869 |
+
|
1870 |
+
$size = '-50';
|
1871 |
+
}
|
1872 |
+
|
1873 |
+
$avatar = buddypress()->plugin_url . "bp-core/images/mystery-man{$size}.jpg";
|
1874 |
Â
|
1875 |
Â
// Use Gravatar's mystery person as fallback.
|
1876 |
Â
} else {
|
1877 |
+
$size = '';
|
1878 |
+
if ( isset( $params['type'] ) && 'thumb' === $params['type'] ) {
|
1879 |
+
$size = bp_core_avatar_thumb_width();
|
1880 |
+
} else {
|
1881 |
+
$size = bp_core_avatar_full_width();
|
1882 |
+
}
|
1883 |
+
$avatar = '//www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&s=' . $size;
|
1884 |
Â
}
|
1885 |
Â
|
1886 |
Â
/**
|
1887 |
Â
* Filters the URL of the 'full' default avatar.
|
1888 |
Â
*
|
1889 |
Â
* @since 1.5.0
|
1890 |
+
* @since 2.6.0 Added `$params`.
|
1891 |
Â
*
|
1892 |
Â
* @param string $avatar URL of the default avatar.
|
1893 |
+
* @param array $params Params provided to bp_core_fetch_avatar().
|
1894 |
Â
*/
|
1895 |
+
return apply_filters( 'bp_core_avatar_default', $avatar, $params );
|
1896 |
Â
}
|
1897 |
Â
|
1898 |
Â
/**
|
1902 |
Â
* defined.
|
1903 |
Â
*
|
1904 |
Â
* @since 1.5.0
|
1905 |
+
* @since 2.6.0 Introduced `$object_type` parameter.
|
1906 |
Â
*
|
1907 |
+
* @param string $type 'local' if the fallback should be the locally-hosted version
|
1908 |
+
* of the mystery person, 'gravatar' if the fallback should be
|
1909 |
+
* Gravatar's version. Default: 'gravatar'.
|
1910 |
+
* @param array $params Parameters passed to bp_core_fetch_avatar().
|
1911 |
Â
* @return string The URL of the default avatar thumb.
|
1912 |
Â
*/
|
1913 |
+
function bp_core_avatar_default_thumb( $type = 'gravatar', $params = array() ) {
|
1914 |
Â
// Local override.
|
1915 |
Â
if ( defined( 'BP_AVATAR_DEFAULT_THUMB' ) ) {
|
1916 |
Â
$avatar = BP_AVATAR_DEFAULT_THUMB;
|
1928 |
Â
* Filters the URL of the 'thumb' default avatar.
|
1929 |
Â
*
|
1930 |
Â
* @since 1.5.0
|
1931 |
+
* @since 2.6.0 Added `$params`.
|
1932 |
Â
*
|
1933 |
Â
* @param string $avatar URL of the default avatar.
|
1934 |
+
* @param string $params Params provided to bp_core_fetch_avatar().
|
1935 |
Â
*/
|
1936 |
+
return apply_filters( 'bp_core_avatar_thumb', $avatar, $params );
|
1937 |
Â
}
|
1938 |
Â
|
1939 |
Â
/**
|
1945 |
Â
*
|
1946 |
Â
* @since 2.2.0
|
1947 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1948 |
Â
* @param WP_Query|null $posts_query The main query object.
|
1949 |
Â
*/
|
1950 |
Â
function bp_core_avatar_reset_query( $posts_query = null ) {
|
@@ -13,9 +13,10 @@
|
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
Â
/**
|
16 |
-
* Add an item to the
|
17 |
Â
*
|
18 |
Â
* @since 1.1.0
|
Â
|
|
19 |
Â
*
|
20 |
Â
* @param array|string $args {
|
21 |
Â
* Array describing the new nav item.
|
@@ -32,9 +33,13 @@ defined( 'ABSPATH' ) || exit;
|
|
32 |
Â
* @type bool|string $default_subnav_slug Optional. The slug of the default subnav item to select when the nav
|
33 |
Â
* item is clicked.
|
34 |
Â
* }
|
Â
|
|
35 |
Â
* @return bool|null Returns false on failure.
|
36 |
Â
*/
|
37 |
-
function bp_core_new_nav_item( $args = '' ) {
|
Â
|
|
Â
|
|
Â
|
|
38 |
Â
|
39 |
Â
$defaults = array(
|
40 |
Â
'name' => false, // Display name for the nav item.
|
@@ -49,18 +54,19 @@ function bp_core_new_nav_item( $args = '' ) {
|
|
49 |
Â
|
50 |
Â
$r = wp_parse_args( $args, $defaults );
|
51 |
Â
|
52 |
-
//
|
53 |
-
$
|
54 |
Â
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
Â
|
|
59 |
Â
return false;
|
60 |
Â
}
|
61 |
Â
|
62 |
Â
// Then, hook the screen function for the added nav item.
|
63 |
-
$hooked = bp_core_register_nav_screen_function( $
|
64 |
Â
if ( false === $hooked ){
|
65 |
Â
return false;
|
66 |
Â
}
|
@@ -81,9 +87,10 @@ function bp_core_new_nav_item( $args = '' ) {
|
|
81 |
Â
}
|
82 |
Â
|
83 |
Â
/**
|
84 |
-
* Add a link to the main BuddyPress navigation
|
85 |
Â
*
|
86 |
Â
* @since 2.4.0
|
Â
|
|
87 |
Â
*
|
88 |
Â
* @param array|string $args {
|
89 |
Â
* Array describing the new nav item.
|
@@ -100,9 +107,10 @@ function bp_core_new_nav_item( $args = '' ) {
|
|
100 |
Â
* @type bool|string $default_subnav_slug Optional. The slug of the default subnav item to select when the nav
|
101 |
Â
* item is clicked.
|
102 |
Â
* }
|
103 |
-
* @
|
Â
|
|
104 |
Â
*/
|
105 |
-
function bp_core_create_nav_link( $args = '' ) {
|
106 |
Â
$bp = buddypress();
|
107 |
Â
|
108 |
Â
$defaults = array(
|
@@ -132,7 +140,7 @@ function bp_core_create_nav_link( $args = '' ) {
|
|
132 |
Â
$r['item_css_id'] = $r['slug'];
|
133 |
Â
}
|
134 |
Â
|
135 |
-
$
|
136 |
Â
'name' => $r['name'],
|
137 |
Â
'slug' => $r['slug'],
|
138 |
Â
'link' => trailingslashit( bp_loggedin_user_domain() . $r['slug'] ),
|
@@ -143,16 +151,23 @@ function bp_core_create_nav_link( $args = '' ) {
|
|
143 |
Â
'default_subnav_slug' => $r['default_subnav_slug']
|
144 |
Â
);
|
145 |
Â
|
Â
|
|
Â
|
|
Â
|
|
146 |
Â
/**
|
147 |
-
* Fires after a link is added to the main BuddyPress
|
148 |
Â
*
|
149 |
Â
* @since 2.4.0
|
Â
|
|
150 |
Â
*
|
151 |
-
* @param array
|
152 |
-
* @param array
|
153 |
-
* @param array
|
Â
|
|
154 |
Â
*/
|
155 |
-
do_action( 'bp_core_create_nav_link', $r, $args, $defaults );
|
Â
|
|
Â
|
|
156 |
Â
}
|
157 |
Â
|
158 |
Â
/**
|
@@ -290,20 +305,33 @@ function bp_core_new_nav_default( $args = '' ) {
|
|
290 |
Â
|
291 |
Â
$r = wp_parse_args( $args, $defaults );
|
292 |
Â
|
293 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
294 |
Â
// Remove our screen hook if screen function is callable.
|
295 |
-
if ( is_callable( $
|
296 |
-
remove_action( 'bp_screens', $
|
297 |
Â
}
|
298 |
Â
}
|
299 |
Â
|
300 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
301 |
Â
|
302 |
-
if ( bp_is_current_component( $
|
303 |
Â
|
304 |
Â
// The only way to tell whether to set the subnav is to peek at the unfiltered_uri
|
305 |
Â
// Find the component.
|
306 |
-
$component_uri_key = array_search( $
|
307 |
Â
|
308 |
Â
if ( false !== $component_uri_key ) {
|
309 |
Â
if ( ! empty( $bp->unfiltered_uri[$component_uri_key + 1] ) ) {
|
@@ -339,47 +367,10 @@ function bp_core_new_nav_default( $args = '' ) {
|
|
339 |
Â
}
|
340 |
Â
|
341 |
Â
/**
|
342 |
-
*
|
343 |
-
*
|
344 |
-
* The sorting is split into a separate function because it can only happen
|
345 |
-
* after all plugins have had a chance to register their navigation items.
|
346 |
-
*
|
347 |
-
* @since 1.0.0
|
348 |
-
*
|
349 |
-
* @return bool|null Returns false on failure.
|
350 |
-
*/
|
351 |
-
function bp_core_sort_nav_items() {
|
352 |
-
$bp = buddypress();
|
353 |
-
|
354 |
-
if ( empty( $bp->bp_nav ) || ! is_array( $bp->bp_nav ) ) {
|
355 |
-
return false;
|
356 |
-
}
|
357 |
-
|
358 |
-
$temp = array();
|
359 |
-
|
360 |
-
foreach ( (array) $bp->bp_nav as $slug => $nav_item ) {
|
361 |
-
if ( empty( $temp[$nav_item['position']] ) ) {
|
362 |
-
$temp[$nav_item['position']] = $nav_item;
|
363 |
-
} else {
|
364 |
-
// Increase numbers here to fit new items in.
|
365 |
-
do {
|
366 |
-
$nav_item['position']++;
|
367 |
-
} while ( ! empty( $temp[$nav_item['position']] ) );
|
368 |
-
|
369 |
-
$temp[$nav_item['position']] = $nav_item;
|
370 |
-
}
|
371 |
-
}
|
372 |
-
|
373 |
-
ksort( $temp );
|
374 |
-
$bp->bp_nav = &$temp;
|
375 |
-
}
|
376 |
-
add_action( 'wp_head', 'bp_core_sort_nav_items' );
|
377 |
-
add_action( 'admin_head', 'bp_core_sort_nav_items' );
|
378 |
-
|
379 |
-
/**
|
380 |
-
* Add a subnav item to the BuddyPress navigation.
|
381 |
Â
*
|
382 |
Â
* @since 1.1.0
|
Â
|
|
383 |
Â
*
|
384 |
Â
* @param array|string $args {
|
385 |
Â
* Array describing the new subnav item.
|
@@ -403,22 +394,49 @@ add_action( 'admin_head', 'bp_core_sort_nav_items' );
|
|
403 |
Â
* @type bool $show_in_admin_bar Optional. Whether the nav item should be added into the group's "Edit"
|
404 |
Â
* Admin Bar menu for group admins. Default: false.
|
405 |
Â
* }
|
Â
|
|
406 |
Â
* @return bool|null Returns false on failure.
|
407 |
Â
*/
|
408 |
-
function bp_core_new_subnav_item( $args =
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
409 |
Â
|
410 |
-
// First,
|
411 |
-
$
|
412 |
Â
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
Â
|
|
417 |
Â
return false;
|
418 |
Â
}
|
419 |
Â
|
420 |
Â
// Then, hook the screen function for the added subnav item.
|
421 |
-
$hooked = bp_core_register_subnav_screen_function( $
|
422 |
Â
if ( false === $hooked ) {
|
423 |
Â
return false;
|
424 |
Â
}
|
@@ -428,6 +446,7 @@ function bp_core_new_subnav_item( $args = '' ) {
|
|
428 |
Â
* Add a subnav link to the BuddyPress navigation.
|
429 |
Â
*
|
430 |
Â
* @since 2.4.0
|
Â
|
|
431 |
Â
*
|
432 |
Â
* @param array|string $args {
|
433 |
Â
* Array describing the new subnav item.
|
@@ -455,9 +474,10 @@ function bp_core_new_subnav_item( $args = '' ) {
|
|
455 |
Â
* the group's "Edit" Admin Bar menu for group admins.
|
456 |
Â
* Default: false.
|
457 |
Â
* }
|
458 |
-
* @
|
Â
|
|
459 |
Â
*/
|
460 |
-
function bp_core_create_subnav_link( $args = '' ) {
|
461 |
Â
$bp = buddypress();
|
462 |
Â
|
463 |
Â
$r = wp_parse_args( $args, array(
|
@@ -483,9 +503,14 @@ function bp_core_create_subnav_link( $args = '' ) {
|
|
483 |
Â
if ( empty( $r['link'] ) ) {
|
484 |
Â
$r['link'] = trailingslashit( $r['parent_url'] . $r['slug'] );
|
485 |
Â
|
Â
|
|
Â
|
|
486 |
Â
// If this sub item is the default for its parent, skip the slug.
|
487 |
-
if (
|
488 |
-
$
|
Â
|
|
Â
|
|
Â
|
|
489 |
Â
}
|
490 |
Â
}
|
491 |
Â
|
@@ -502,6 +527,7 @@ function bp_core_create_subnav_link( $args = '' ) {
|
|
502 |
Â
'name' => $r['name'],
|
503 |
Â
'link' => $r['link'],
|
504 |
Â
'slug' => $r['slug'],
|
Â
|
|
505 |
Â
'css_id' => $r['item_css_id'],
|
506 |
Â
'position' => $r['position'],
|
507 |
Â
'user_has_access' => $r['user_has_access'],
|
@@ -510,13 +536,14 @@ function bp_core_create_subnav_link( $args = '' ) {
|
|
510 |
Â
'show_in_admin_bar' => (bool) $r['show_in_admin_bar'],
|
511 |
Â
);
|
512 |
Â
|
513 |
-
$
|
514 |
Â
}
|
515 |
Â
|
516 |
Â
/**
|
517 |
Â
* Register a screen function, whether or not a related subnav link exists.
|
518 |
Â
*
|
519 |
Â
* @since 2.4.0
|
Â
|
|
520 |
Â
*
|
521 |
Â
* @param array|string $args {
|
522 |
Â
* Array describing the new subnav item.
|
@@ -541,9 +568,10 @@ function bp_core_create_subnav_link( $args = '' ) {
|
|
541 |
Â
* the group's "Edit" Admin Bar menu for group admins.
|
542 |
Â
* Default: false.
|
543 |
Â
* }
|
Â
|
|
544 |
Â
* @return bool|null Returns false on failure.
|
545 |
Â
*/
|
546 |
-
function bp_core_register_subnav_screen_function( $args = '' ) {
|
547 |
Â
$bp = buddypress();
|
548 |
Â
|
549 |
Â
$r = wp_parse_args( $args, array(
|
@@ -555,7 +583,7 @@ function bp_core_register_subnav_screen_function( $args = '' ) {
|
|
555 |
Â
'screen_function' => false, // The name of the function to run when clicked.
|
556 |
Â
) );
|
557 |
Â
|
558 |
-
|
559 |
Â
* Hook the screen function for the added subnav item. But this only needs to
|
560 |
Â
* be done if this subnav item is the current view, and the user has access to the
|
561 |
Â
* subnav item. We figure out whether we're currently viewing this subnav by
|
@@ -568,8 +596,8 @@ function bp_core_register_subnav_screen_function( $args = '' ) {
|
|
568 |
Â
* (b) there is no current_action (ie, this is the default subnav for the parent nav)
|
569 |
Â
* and this subnav item is the default for the parent item (which we check by
|
570 |
Â
* comparing this subnav item's screen function with the screen function of the
|
571 |
-
* parent nav item in
|
572 |
-
* user, since groups should always have an action set.
|
573 |
Â
*/
|
574 |
Â
|
575 |
Â
// If we *don't* meet condition (1), return.
|
@@ -577,15 +605,17 @@ function bp_core_register_subnav_screen_function( $args = '' ) {
|
|
577 |
Â
return;
|
578 |
Â
}
|
579 |
Â
|
Â
|
|
Â
|
|
580 |
Â
// If we *do* meet condition (2), then the added subnav item is currently being requested.
|
581 |
-
if ( ( bp_current_action() && bp_is_current_action( $r['slug'] ) ) || ( bp_is_user() && ! bp_current_action() && ( $r['screen_function'] == $
|
582 |
Â
|
583 |
Â
// If this is for site admins only and the user is not one, don't create the subnav item.
|
584 |
Â
if ( ! empty( $r['site_admin_only'] ) && ! bp_current_user_can( 'bp_moderate' ) ) {
|
585 |
Â
return false;
|
586 |
Â
}
|
587 |
Â
|
588 |
-
$hooked = bp_core_maybe_hook_new_subnav_screen_function( $r );
|
589 |
Â
|
590 |
Â
// If redirect args have been returned, perform the redirect now.
|
591 |
Â
if ( ! empty( $hooked['status'] ) && 'failure' === $hooked['status'] && isset( $hooked['redirect_args'] ) ) {
|
@@ -598,11 +628,14 @@ function bp_core_register_subnav_screen_function( $args = '' ) {
|
|
598 |
Â
* For a given subnav item, either hook the screen function or generate redirect arguments, as necessary.
|
599 |
Â
*
|
600 |
Â
* @since 2.1.0
|
Â
|
|
601 |
Â
*
|
602 |
-
* @param array
|
Â
|
|
Â
|
|
603 |
Â
* @return array
|
604 |
Â
*/
|
605 |
-
function bp_core_maybe_hook_new_subnav_screen_function( $subnav_item ) {
|
606 |
Â
$retval = array(
|
607 |
Â
'status' => '',
|
608 |
Â
);
|
@@ -645,10 +678,15 @@ function bp_core_maybe_hook_new_subnav_screen_function( $subnav_item ) {
|
|
645 |
Â
// redirect URL.
|
646 |
Â
} elseif ( bp_is_user() ) {
|
647 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
648 |
Â
// Redirect to the displayed user's default
|
649 |
Â
// component, as long as that component is
|
650 |
Â
// publicly accessible.
|
651 |
-
if ( bp_is_my_profile() ||
|
652 |
Â
$message = __( 'You do not have access to this page.', 'buddypress' );
|
653 |
Â
$redirect_to = bp_displayed_user_domain();
|
654 |
Â
|
@@ -691,58 +729,32 @@ function bp_core_maybe_hook_new_subnav_screen_function( $subnav_item ) {
|
|
691 |
Â
}
|
692 |
Â
|
693 |
Â
/**
|
694 |
-
*
|
695 |
Â
*
|
696 |
-
* @since 1.
|
Â
|
|
697 |
Â
*
|
698 |
-
* @
|
Â
|
|
Â
|
|
Â
|
|
699 |
Â
*/
|
700 |
-
function
|
701 |
Â
$bp = buddypress();
|
702 |
Â
|
703 |
-
if (
|
704 |
Â
return false;
|
Â
|
|
705 |
Â
|
706 |
-
|
707 |
-
|
708 |
-
continue;
|
709 |
-
|
710 |
-
foreach ( (array) $subnav_items as $subnav_item ) {
|
711 |
-
if ( empty( $temp[$subnav_item['position']]) )
|
712 |
-
$temp[$subnav_item['position']] = $subnav_item;
|
713 |
-
else {
|
714 |
-
// Increase numbers here to fit new items in.
|
715 |
-
do {
|
716 |
-
$subnav_item['position']++;
|
717 |
-
} while ( !empty( $temp[$subnav_item['position']] ) );
|
718 |
Â
|
719 |
-
|
720 |
-
|
721 |
Â
}
|
722 |
-
ksort( $temp );
|
723 |
-
$bp->bp_options_nav[$parent_slug] = &$temp;
|
724 |
-
unset( $temp );
|
725 |
Â
}
|
726 |
-
}
|
727 |
-
add_action( 'wp_head', 'bp_core_sort_subnav_items' );
|
728 |
-
add_action( 'admin_head', 'bp_core_sort_subnav_items' );
|
729 |
Â
|
730 |
-
|
731 |
-
* Check whether a given nav item has subnav items.
|
732 |
-
*
|
733 |
-
* @since 1.5.0
|
734 |
-
*
|
735 |
-
* @param string $nav_item The slug of the top-level nav item whose subnav items you're checking.
|
736 |
-
* Default: the current component slug.
|
737 |
-
* @return bool $has_subnav True if the nav item is found and has subnav items; false otherwise.
|
738 |
-
*/
|
739 |
-
function bp_nav_item_has_subnav( $nav_item = '' ) {
|
740 |
-
$bp = buddypress();
|
741 |
-
|
742 |
-
if ( !$nav_item )
|
743 |
-
$nav_item = bp_current_component();
|
744 |
-
|
745 |
-
$has_subnav = isset( $bp->bp_options_nav[$nav_item] ) && count( $bp->bp_options_nav[$nav_item] ) > 0;
|
746 |
Â
|
747 |
Â
/**
|
748 |
Â
* Filters whether or not a given nav item has subnav items.
|
@@ -756,75 +768,131 @@ function bp_nav_item_has_subnav( $nav_item = '' ) {
|
|
756 |
Â
}
|
757 |
Â
|
758 |
Â
/**
|
759 |
-
*
|
760 |
Â
*
|
761 |
Â
* @since 1.0.0
|
Â
|
|
762 |
Â
*
|
763 |
-
* @param
|
764 |
-
* @
|
Â
|
|
765 |
Â
*/
|
766 |
-
function bp_core_remove_nav_item( $
|
767 |
Â
$bp = buddypress();
|
768 |
Â
|
769 |
-
//
|
770 |
-
if (
|
771 |
-
|
772 |
-
|
773 |
Â
}
|
774 |
Â
}
|
775 |
Â
|
776 |
-
if (
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
777 |
Â
return false;
|
Â
|
|
Â
|
|
Â
|
|
778 |
Â
|
779 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
780 |
Â
// Remove our screen hook if screen function is callable.
|
781 |
-
if ( is_callable( $
|
782 |
-
remove_action( 'bp_screens', $
|
783 |
Â
}
|
784 |
Â
}
|
785 |
Â
|
786 |
-
|
787 |
Â
}
|
788 |
Â
|
789 |
Â
/**
|
790 |
-
*
|
791 |
Â
*
|
792 |
Â
* @since 1.0.0
|
Â
|
|
793 |
Â
*
|
794 |
-
* @param string $
|
795 |
-
* @param string $slug
|
Â
|
|
Â
|
|
796 |
Â
*/
|
797 |
-
function bp_core_remove_subnav_item( $
|
798 |
Â
$bp = buddypress();
|
799 |
Â
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
if ( ! empty( $screen_function ) ) {
|
805 |
-
// Remove our screen hook if screen function is callable.
|
806 |
-
if ( is_callable( $screen_function ) ) {
|
807 |
-
remove_action( 'bp_screens', $screen_function, 3 );
|
808 |
Â
}
|
809 |
Â
}
|
810 |
Â
|
811 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
812 |
Â
|
813 |
-
|
814 |
-
unset($bp->bp_options_nav[$parent_id]);
|
815 |
Â
}
|
816 |
Â
|
817 |
Â
/**
|
818 |
Â
* Clear all subnav items from a specific nav item.
|
819 |
Â
*
|
820 |
Â
* @since 1.0.0
|
Â
|
|
821 |
Â
*
|
822 |
Â
* @param string $parent_slug The slug of the parent navigation item.
|
Â
|
|
823 |
Â
*/
|
824 |
-
function bp_core_reset_subnav_items( $parent_slug ) {
|
825 |
Â
$bp = buddypress();
|
826 |
Â
|
827 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
828 |
Â
}
|
829 |
Â
|
830 |
Â
|
@@ -835,8 +903,6 @@ function bp_core_reset_subnav_items( $parent_slug ) {
|
|
835 |
Â
*
|
836 |
Â
* @since 1.5.0
|
837 |
Â
*
|
838 |
-
* @uses get_user_option()
|
839 |
-
*
|
840 |
Â
* @param string $context Context of this preference check. 'admin' or 'front'.
|
841 |
Â
* @param int $user Optional. ID of the user to check. Default: 0 (which falls back to the logged-in user's ID).
|
842 |
Â
* @return bool True if the toolbar should be showing for this user.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
Â
/**
|
16 |
+
* Add an item to the primary navigation of the specified component.
|
17 |
Â
*
|
18 |
Â
* @since 1.1.0
|
19 |
+
* @since 2.6.0 Introduced the `$component` parameter.
|
20 |
Â
*
|
21 |
Â
* @param array|string $args {
|
22 |
Â
* Array describing the new nav item.
|
33 |
Â
* @type bool|string $default_subnav_slug Optional. The slug of the default subnav item to select when the nav
|
34 |
Â
* item is clicked.
|
35 |
Â
* }
|
36 |
+
* @param string $component The component the navigation is attached to. Defaults to 'members'.
|
37 |
Â
* @return bool|null Returns false on failure.
|
38 |
Â
*/
|
39 |
+
function bp_core_new_nav_item( $args, $component = 'members' ) {
|
40 |
+
if ( ! bp_is_active( $component ) ) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
Â
|
44 |
Â
$defaults = array(
|
45 |
Â
'name' => false, // Display name for the nav item.
|
54 |
Â
|
55 |
Â
$r = wp_parse_args( $args, $defaults );
|
56 |
Â
|
57 |
+
// Validate nav link data.
|
58 |
+
$nav_item = bp_core_create_nav_link( $r, $component );
|
59 |
Â
|
60 |
+
/*
|
61 |
+
* To mimic legacy behavior, if bp_core_create_nav_link() returns false, we make
|
62 |
+
* an early exit and don't attempt to register the screen function.
|
63 |
+
*/
|
64 |
+
if ( false === $nav_item ) {
|
65 |
Â
return false;
|
66 |
Â
}
|
67 |
Â
|
68 |
Â
// Then, hook the screen function for the added nav item.
|
69 |
+
$hooked = bp_core_register_nav_screen_function( $nav_item );
|
70 |
Â
if ( false === $hooked ){
|
71 |
Â
return false;
|
72 |
Â
}
|
87 |
Â
}
|
88 |
Â
|
89 |
Â
/**
|
90 |
+
* Add a link to the main BuddyPress navigation.
|
91 |
Â
*
|
92 |
Â
* @since 2.4.0
|
93 |
+
* @since 2.6.0 Introduced the `$component` parameter. Began returning a BP_Nav_Item object on success.
|
94 |
Â
*
|
95 |
Â
* @param array|string $args {
|
96 |
Â
* Array describing the new nav item.
|
107 |
Â
* @type bool|string $default_subnav_slug Optional. The slug of the default subnav item to select when the nav
|
108 |
Â
* item is clicked.
|
109 |
Â
* }
|
110 |
+
* @param string $component Optional. Component that the nav belongs to.
|
111 |
+
* @return bool|BP_Nav_Item Returns false on failure, new nav item on success.
|
112 |
Â
*/
|
113 |
+
function bp_core_create_nav_link( $args = '', $component = 'members' ) {
|
114 |
Â
$bp = buddypress();
|
115 |
Â
|
116 |
Â
$defaults = array(
|
140 |
Â
$r['item_css_id'] = $r['slug'];
|
141 |
Â
}
|
142 |
Â
|
143 |
+
$nav_item = array(
|
144 |
Â
'name' => $r['name'],
|
145 |
Â
'slug' => $r['slug'],
|
146 |
Â
'link' => trailingslashit( bp_loggedin_user_domain() . $r['slug'] ),
|
151 |
Â
'default_subnav_slug' => $r['default_subnav_slug']
|
152 |
Â
);
|
153 |
Â
|
154 |
+
// Add the item to the nav.
|
155 |
+
$retval = buddypress()->{$component}->nav->add_nav( $nav_item );
|
156 |
+
|
157 |
Â
/**
|
158 |
+
* Fires after a link is added to the main BuddyPress nav.
|
159 |
Â
*
|
160 |
Â
* @since 2.4.0
|
161 |
+
* @since 2.6.0 Added `$component` parameter.
|
162 |
Â
*
|
163 |
+
* @param array $r Parsed arguments for the nav item.
|
164 |
+
* @param array $args Originally passed in arguments for the nav item.
|
165 |
+
* @param array $defaults Default arguments for a nav item.
|
166 |
+
* @param string $component Component that the nav belongs to.
|
167 |
Â
*/
|
168 |
+
do_action( 'bp_core_create_nav_link', $r, $args, $defaults, $component );
|
169 |
+
|
170 |
+
return $retval;
|
171 |
Â
}
|
172 |
Â
|
173 |
Â
/**
|
305 |
Â
|
306 |
Â
$r = wp_parse_args( $args, $defaults );
|
307 |
Â
|
308 |
+
// This is specific to Members - it's not available in Groups.
|
309 |
+
$parent_nav = $bp->members->nav->get_primary( array( 'slug' => $r['parent_slug'] ), false );
|
310 |
+
|
311 |
+
if ( ! $parent_nav ) {
|
312 |
+
return ;
|
313 |
+
}
|
314 |
+
|
315 |
+
$parent_nav = reset( $parent_nav );
|
316 |
+
|
317 |
+
if ( ! empty( $parent_nav->screen_function ) ) {
|
318 |
Â
// Remove our screen hook if screen function is callable.
|
319 |
+
if ( is_callable( $parent_nav->screen_function ) ) {
|
320 |
+
remove_action( 'bp_screens', $parent_nav->screen_function, 3 );
|
321 |
Â
}
|
322 |
Â
}
|
323 |
Â
|
324 |
+
// Edit the screen function for the parent nav
|
325 |
+
$bp->members->nav->edit_nav( array(
|
326 |
+
'screen_function' => &$r['screen_function'],
|
327 |
+
'default_subnav_slug' => $r['subnav_slug'],
|
328 |
+
), $parent_nav->slug );
|
329 |
Â
|
330 |
+
if ( bp_is_current_component( $parent_nav->slug ) ) {
|
331 |
Â
|
332 |
Â
// The only way to tell whether to set the subnav is to peek at the unfiltered_uri
|
333 |
Â
// Find the component.
|
334 |
+
$component_uri_key = array_search( $parent_nav->slug, $bp->unfiltered_uri );
|
335 |
Â
|
336 |
Â
if ( false !== $component_uri_key ) {
|
337 |
Â
if ( ! empty( $bp->unfiltered_uri[$component_uri_key + 1] ) ) {
|
367 |
Â
}
|
368 |
Â
|
369 |
Â
/**
|
370 |
+
* Add an item to secondary navigation of the specified component.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
371 |
Â
*
|
372 |
Â
* @since 1.1.0
|
373 |
+
* @since 2.6.0 Introduced the `$component` parameter.
|
374 |
Â
*
|
375 |
Â
* @param array|string $args {
|
376 |
Â
* Array describing the new subnav item.
|
394 |
Â
* @type bool $show_in_admin_bar Optional. Whether the nav item should be added into the group's "Edit"
|
395 |
Â
* Admin Bar menu for group admins. Default: false.
|
396 |
Â
* }
|
397 |
+
* @param string $component The component the navigation is attached to. Defaults to 'members'.
|
398 |
Â
* @return bool|null Returns false on failure.
|
399 |
Â
*/
|
400 |
+
function bp_core_new_subnav_item( $args, $component = null ) {
|
401 |
+
// Backward compatibility for plugins using `bp_core_new_subnav_item()` without `$component`
|
402 |
+
// to add group subnav items.
|
403 |
+
if ( null === $component && bp_is_active( 'groups' ) && bp_is_group() && isset( $args['parent_slug'] ) ) {
|
404 |
+
/*
|
405 |
+
* Assume that this item is intended to belong to the current group if:
|
406 |
+
* a) the 'parent_slug' is the same as the slug of the current group, or
|
407 |
+
* b) the 'parent_slug' starts with the slug of the current group, and the members nav doesn't have
|
408 |
+
* a primary item with that slug
|
409 |
+
*/
|
410 |
+
$group_slug = bp_get_current_group_slug();
|
411 |
+
if (
|
412 |
+
$group_slug === $args['parent_slug'] ||
|
413 |
+
( 0 === strpos( $args['parent_slug'], $group_slug ) && ! buddypress()->members->nav->get_primary( array( 'slug' => $args['parent_slug'] ), false ) )
|
414 |
+
) {
|
415 |
+
$component = 'groups';
|
416 |
+
}
|
417 |
+
}
|
418 |
+
|
419 |
+
if ( ! $component ) {
|
420 |
+
$component = 'members';
|
421 |
+
}
|
422 |
+
|
423 |
+
if ( ! bp_is_active( $component ) ) {
|
424 |
+
return;
|
425 |
+
}
|
426 |
Â
|
427 |
+
// First, register the subnav item in the nav.
|
428 |
+
$subnav_item = bp_core_create_subnav_link( $args, $component );
|
429 |
Â
|
430 |
+
/*
|
431 |
+
* To mimic legacy behavior, if bp_core_create_subnav_link() returns false, we make an
|
432 |
+
* early exit and don't attempt to register the screen function.
|
433 |
+
*/
|
434 |
+
if ( false === $subnav_item ) {
|
435 |
Â
return false;
|
436 |
Â
}
|
437 |
Â
|
438 |
Â
// Then, hook the screen function for the added subnav item.
|
439 |
+
$hooked = bp_core_register_subnav_screen_function( $subnav_item, $component );
|
440 |
Â
if ( false === $hooked ) {
|
441 |
Â
return false;
|
442 |
Â
}
|
446 |
Â
* Add a subnav link to the BuddyPress navigation.
|
447 |
Â
*
|
448 |
Â
* @since 2.4.0
|
449 |
+
* @since 2.6.0 Introduced the `$component` parameter. Began returning a BP_Nav_Item object on success.
|
450 |
Â
*
|
451 |
Â
* @param array|string $args {
|
452 |
Â
* Array describing the new subnav item.
|
474 |
Â
* the group's "Edit" Admin Bar menu for group admins.
|
475 |
Â
* Default: false.
|
476 |
Â
* }
|
477 |
+
* @param string $component The component the navigation is attached to. Defaults to 'members'.
|
478 |
+
* @return bool|BP_Nav_Item Returns false on failure, new nav item on success.
|
479 |
Â
*/
|
480 |
+
function bp_core_create_subnav_link( $args = '', $component = 'members' ) {
|
481 |
Â
$bp = buddypress();
|
482 |
Â
|
483 |
Â
$r = wp_parse_args( $args, array(
|
503 |
Â
if ( empty( $r['link'] ) ) {
|
504 |
Â
$r['link'] = trailingslashit( $r['parent_url'] . $r['slug'] );
|
505 |
Â
|
506 |
+
$parent_nav = $bp->{$component}->nav->get_primary( array( 'slug' => $r['parent_slug'] ), false );
|
507 |
+
|
508 |
Â
// If this sub item is the default for its parent, skip the slug.
|
509 |
+
if ( $parent_nav ) {
|
510 |
+
$parent_nav_item = reset( $parent_nav );
|
511 |
+
if ( ! empty( $parent_nav_item->default_subnav_slug ) && $r['slug'] === $parent_nav_item->default_subnav_slug ) {
|
512 |
+
$r['link'] = trailingslashit( $r['parent_url'] );
|
513 |
+
}
|
514 |
Â
}
|
515 |
Â
}
|
516 |
Â
|
527 |
Â
'name' => $r['name'],
|
528 |
Â
'link' => $r['link'],
|
529 |
Â
'slug' => $r['slug'],
|
530 |
+
'parent_slug' => $r['parent_slug'],
|
531 |
Â
'css_id' => $r['item_css_id'],
|
532 |
Â
'position' => $r['position'],
|
533 |
Â
'user_has_access' => $r['user_has_access'],
|
536 |
Â
'show_in_admin_bar' => (bool) $r['show_in_admin_bar'],
|
537 |
Â
);
|
538 |
Â
|
539 |
+
return buddypress()->{$component}->nav->add_nav( $subnav_item );
|
540 |
Â
}
|
541 |
Â
|
542 |
Â
/**
|
543 |
Â
* Register a screen function, whether or not a related subnav link exists.
|
544 |
Â
*
|
545 |
Â
* @since 2.4.0
|
546 |
+
* @since 2.6.0 Introduced the `$component` parameter.
|
547 |
Â
*
|
548 |
Â
* @param array|string $args {
|
549 |
Â
* Array describing the new subnav item.
|
568 |
Â
* the group's "Edit" Admin Bar menu for group admins.
|
569 |
Â
* Default: false.
|
570 |
Â
* }
|
571 |
+
* @param string $component The component the navigation is attached to. Defaults to 'members'.
|
572 |
Â
* @return bool|null Returns false on failure.
|
573 |
Â
*/
|
574 |
+
function bp_core_register_subnav_screen_function( $args = '', $component = 'members' ) {
|
575 |
Â
$bp = buddypress();
|
576 |
Â
|
577 |
Â
$r = wp_parse_args( $args, array(
|
583 |
Â
'screen_function' => false, // The name of the function to run when clicked.
|
584 |
Â
) );
|
585 |
Â
|
586 |
+
/*
|
587 |
Â
* Hook the screen function for the added subnav item. But this only needs to
|
588 |
Â
* be done if this subnav item is the current view, and the user has access to the
|
589 |
Â
* subnav item. We figure out whether we're currently viewing this subnav by
|
596 |
Â
* (b) there is no current_action (ie, this is the default subnav for the parent nav)
|
597 |
Â
* and this subnav item is the default for the parent item (which we check by
|
598 |
Â
* comparing this subnav item's screen function with the screen function of the
|
599 |
+
* parent nav item in the component's primary nav). This condition only arises
|
600 |
+
* when viewing a user, since groups should always have an action set.
|
601 |
Â
*/
|
602 |
Â
|
603 |
Â
// If we *don't* meet condition (1), return.
|
605 |
Â
return;
|
606 |
Â
}
|
607 |
Â
|
608 |
+
$parent_nav = $bp->{$component}->nav->get_primary( array( 'slug' => $r['parent_slug'] ), false );
|
609 |
+
|
610 |
Â
// If we *do* meet condition (2), then the added subnav item is currently being requested.
|
611 |
+
if ( ( bp_current_action() && bp_is_current_action( $r['slug'] ) ) || ( bp_is_user() && ! bp_current_action() && ! empty( $parent_nav->screen_function ) && $r['screen_function'] == $parent_nav->screen_function ) ) {
|
612 |
Â
|
613 |
Â
// If this is for site admins only and the user is not one, don't create the subnav item.
|
614 |
Â
if ( ! empty( $r['site_admin_only'] ) && ! bp_current_user_can( 'bp_moderate' ) ) {
|
615 |
Â
return false;
|
616 |
Â
}
|
617 |
Â
|
618 |
+
$hooked = bp_core_maybe_hook_new_subnav_screen_function( $r, $component );
|
619 |
Â
|
620 |
Â
// If redirect args have been returned, perform the redirect now.
|
621 |
Â
if ( ! empty( $hooked['status'] ) && 'failure' === $hooked['status'] && isset( $hooked['redirect_args'] ) ) {
|
628 |
Â
* For a given subnav item, either hook the screen function or generate redirect arguments, as necessary.
|
629 |
Â
*
|
630 |
Â
* @since 2.1.0
|
631 |
+
* @since 2.6.0 Introduced the `$component` parameter.
|
632 |
Â
*
|
633 |
+
* @param array $subnav_item The subnav array added to the secondary navigation of
|
634 |
+
* the component in bp_core_new_subnav_item().
|
635 |
+
* @param string $component The component the navigation is attached to. Defaults to 'members'.
|
636 |
Â
* @return array
|
637 |
Â
*/
|
638 |
+
function bp_core_maybe_hook_new_subnav_screen_function( $subnav_item, $component = 'members' ) {
|
639 |
Â
$retval = array(
|
640 |
Â
'status' => '',
|
641 |
Â
);
|
678 |
Â
// redirect URL.
|
679 |
Â
} elseif ( bp_is_user() ) {
|
680 |
Â
|
681 |
+
$parent_nav_default = $bp->{$component}->nav->get_primary( array( 'slug' => $bp->default_component ), false );
|
682 |
+
if ( $parent_nav_default ) {
|
683 |
+
$parent_nav_default_item = reset( $parent_nav_default );
|
684 |
+
}
|
685 |
+
|
686 |
Â
// Redirect to the displayed user's default
|
687 |
Â
// component, as long as that component is
|
688 |
Â
// publicly accessible.
|
689 |
+
if ( bp_is_my_profile() || ( isset( $parent_nav_default_item ) && $parent_nav_default_item->show_for_displayed_user ) ) {
|
690 |
Â
$message = __( 'You do not have access to this page.', 'buddypress' );
|
691 |
Â
$redirect_to = bp_displayed_user_domain();
|
692 |
Â
|
729 |
Â
}
|
730 |
Â
|
731 |
Â
/**
|
732 |
+
* Check whether a given nav item has subnav items.
|
733 |
Â
*
|
734 |
+
* @since 1.5.0
|
735 |
+
* @since 2.6.0 Introduced the `$component` parameter.
|
736 |
Â
*
|
737 |
+
* @param string $nav_item The slug of the top-level nav item whose subnav items you're checking.
|
738 |
+
* Default: the current component slug.
|
739 |
+
* @param string $component The component the navigation is attached to. Defaults to 'members'.
|
740 |
+
* @return bool $has_subnav True if the nav item is found and has subnav items; false otherwise.
|
741 |
Â
*/
|
742 |
+
function bp_nav_item_has_subnav( $nav_item = '', $component = 'members' ) {
|
743 |
Â
$bp = buddypress();
|
744 |
Â
|
745 |
+
if ( ! isset( $bp->{$component}->nav ) ) {
|
746 |
Â
return false;
|
747 |
+
}
|
748 |
Â
|
749 |
+
if ( ! $nav_item ) {
|
750 |
+
$nav_item = bp_current_component();
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
751 |
Â
|
752 |
+
if ( bp_is_group() ) {
|
753 |
+
$nav_item = bp_current_item();
|
754 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
755 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
756 |
Â
|
757 |
+
$has_subnav = (bool) $bp->{$component}->nav->get_secondary( array( 'parent_slug' => $nav_item ), false );
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
758 |
Â
|
759 |
Â
/**
|
760 |
Â
* Filters whether or not a given nav item has subnav items.
|
768 |
Â
}
|
769 |
Â
|
770 |
Â
/**
|
771 |
+
* Deletes an item from the primary navigation of the specified component.
|
772 |
Â
*
|
773 |
Â
* @since 1.0.0
|
774 |
+
* @since 2.6.0 Introduced the `$component` parameter.
|
775 |
Â
*
|
776 |
+
* @param string $slug The slug of the primary navigation item.
|
777 |
+
* @param string $component The component the navigation is attached to. Defaults to 'members'.
|
778 |
+
* @return bool Returns false on failure, True on success.
|
779 |
Â
*/
|
780 |
+
function bp_core_remove_nav_item( $slug, $component = null ) {
|
781 |
Â
$bp = buddypress();
|
782 |
Â
|
783 |
+
// Backward compatibility for removing group nav items using the group slug as `$parent_slug`.
|
784 |
+
if ( ! $component && bp_is_active( 'groups' ) && isset( $bp->groups->nav ) ) {
|
785 |
+
if ( $bp->groups->nav->get_primary( array( 'slug' => $slug ) ) ) {
|
786 |
+
$component = 'groups';
|
787 |
Â
}
|
788 |
Â
}
|
789 |
Â
|
790 |
+
if ( ! $component ) {
|
791 |
+
$component = 'members';
|
792 |
+
}
|
793 |
+
|
794 |
+
if ( ! isset( $bp->{$component}->nav ) ) {
|
795 |
Â
return false;
|
796 |
+
}
|
797 |
+
|
798 |
+
$screen_functions = $bp->{$component}->nav->delete_nav( $slug );
|
799 |
Â
|
800 |
+
// Reset backcompat nav items so that subsequent references will be correct.
|
801 |
+
if ( buddypress()->do_nav_backcompat ) {
|
802 |
+
$bp->bp_nav->reset();
|
803 |
+
$bp->bp_options_nav->reset();
|
804 |
+
}
|
805 |
+
|
806 |
+
if ( ! is_array( $screen_functions ) ) {
|
807 |
+
return false;
|
808 |
+
}
|
809 |
+
|
810 |
+
foreach ( $screen_functions as $screen_function ) {
|
811 |
Â
// Remove our screen hook if screen function is callable.
|
812 |
+
if ( is_callable( $screen_function ) ) {
|
813 |
+
remove_action( 'bp_screens', $screen_function, 3 );
|
814 |
Â
}
|
815 |
Â
}
|
816 |
Â
|
817 |
+
return true;
|
818 |
Â
}
|
819 |
Â
|
820 |
Â
/**
|
821 |
+
* Deletes an item from the secondary navigation of the specified component.
|
822 |
Â
*
|
823 |
Â
* @since 1.0.0
|
824 |
+
* @since 2.6.0 Introduced the `$component` parameter.
|
825 |
Â
*
|
826 |
+
* @param string $parent_slug The slug of the primary navigation item.
|
827 |
+
* @param string $slug The slug of the secondary item to be removed.
|
828 |
+
* @param string $component The component the navigation is attached to. Defaults to 'members'.
|
829 |
+
* @return bool Returns false on failure, True on success.
|
830 |
Â
*/
|
831 |
+
function bp_core_remove_subnav_item( $parent_slug, $slug, $component = null ) {
|
832 |
Â
$bp = buddypress();
|
833 |
Â
|
834 |
+
// Backward compatibility for removing group nav items using the group slug as `$parent_slug`.
|
835 |
+
if ( ! $component && bp_is_active( 'groups' ) && isset( $bp->groups->nav ) ) {
|
836 |
+
if ( $bp->groups->nav->get_primary( array( 'slug' => $parent_slug ) ) ) {
|
837 |
+
$component = 'groups';
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
838 |
Â
}
|
839 |
Â
}
|
840 |
Â
|
841 |
+
if ( ! $component ) {
|
842 |
+
$component = 'members';
|
843 |
+
}
|
844 |
+
|
845 |
+
if ( ! isset( $bp->{$component}->nav ) ) {
|
846 |
+
return false;
|
847 |
+
}
|
848 |
+
|
849 |
+
$screen_functions = $bp->{$component}->nav->delete_nav( $slug, $parent_slug );
|
850 |
+
|
851 |
+
// Reset backcompat nav items so that subsequent references will be correct.
|
852 |
+
if ( buddypress()->do_nav_backcompat ) {
|
853 |
+
$bp->bp_nav->reset();
|
854 |
+
$bp->bp_options_nav->reset();
|
855 |
+
}
|
856 |
+
|
857 |
+
if ( ! is_array( $screen_functions ) ) {
|
858 |
+
return false;
|
859 |
+
}
|
860 |
+
|
861 |
+
$screen_function = reset( $screen_functions );
|
862 |
+
|
863 |
+
// Remove our screen hook if screen function is callable.
|
864 |
+
if ( is_callable( $screen_function ) ) {
|
865 |
+
remove_action( 'bp_screens', $screen_function, 3 );
|
866 |
+
}
|
867 |
Â
|
868 |
+
return true;
|
Â
|
|
869 |
Â
}
|
870 |
Â
|
871 |
Â
/**
|
872 |
Â
* Clear all subnav items from a specific nav item.
|
873 |
Â
*
|
874 |
Â
* @since 1.0.0
|
875 |
+
* @since 2.6.0 Introduced the `$component` parameter.
|
876 |
Â
*
|
877 |
Â
* @param string $parent_slug The slug of the parent navigation item.
|
878 |
+
* @param string $component The component the navigation is attached to. Defaults to 'members'.
|
879 |
Â
*/
|
880 |
+
function bp_core_reset_subnav_items( $parent_slug, $component = 'members' ) {
|
881 |
Â
$bp = buddypress();
|
882 |
Â
|
883 |
+
if ( ! isset( $bp->{$component}->nav ) ) {
|
884 |
+
return;
|
885 |
+
}
|
886 |
+
|
887 |
+
$subnav_items = $bp->{$component}->nav->get_secondary( array( 'parent_slug' => $parent_slug ), false );
|
888 |
+
|
889 |
+
if ( ! $subnav_items ) {
|
890 |
+
return;
|
891 |
+
}
|
892 |
+
|
893 |
+
foreach( $subnav_items as $subnav_item ) {
|
894 |
+
$bp->{$component}->nav->delete_nav( $subnav_item->slug, $parent_slug );
|
895 |
+
}
|
896 |
Â
}
|
897 |
Â
|
898 |
Â
|
903 |
Â
*
|
904 |
Â
* @since 1.5.0
|
905 |
Â
*
|
Â
|
|
Â
|
|
906 |
Â
* @param string $context Context of this preference check. 'admin' or 'front'.
|
907 |
Â
* @param int $user Optional. ID of the user to check. Default: 0 (which falls back to the logged-in user's ID).
|
908 |
Â
* @return bool True if the toolbar should be showing for this user.
|
@@ -57,9 +57,6 @@ function bp_get_current_blog_roles() {
|
|
57 |
Â
*
|
58 |
Â
* @since 1.6.0
|
59 |
Â
*
|
60 |
-
* @uses get_role() To get the administrator, default and moderator roles.
|
61 |
-
* @uses WP_Role::add_cap() To add various capabilities.
|
62 |
-
* @uses do_action() Calls 'bp_add_caps'.
|
63 |
Â
*/
|
64 |
Â
function bp_add_caps() {
|
65 |
Â
global $wp_roles;
|
@@ -93,9 +90,6 @@ function bp_add_caps() {
|
|
93 |
Â
*
|
94 |
Â
* @since 1.6.0
|
95 |
Â
*
|
96 |
-
* @uses get_role() To get the administrator and default roles.
|
97 |
-
* @uses WP_Role::remove_cap() To remove various capabilities.
|
98 |
-
* @uses do_action() Calls 'bp_remove_caps'.
|
99 |
Â
*/
|
100 |
Â
function bp_remove_caps() {
|
101 |
Â
global $wp_roles;
|
@@ -129,7 +123,6 @@ function bp_remove_caps() {
|
|
129 |
Â
*
|
130 |
Â
* @see WP_User::has_cap() for description of the arguments passed to the
|
131 |
Â
* 'map_meta_cap' filter.
|
132 |
-
* @uses apply_filters() Calls 'bp_map_meta_caps' with caps, cap, user ID and
|
133 |
Â
* args.
|
134 |
Â
*
|
135 |
Â
* @param array $caps See {@link WP_User::has_cap()}.
|
@@ -158,8 +151,6 @@ function bp_map_meta_caps( $caps, $cap, $user_id, $args ) {
|
|
158 |
Â
*
|
159 |
Â
* @since 1.6.0
|
160 |
Â
*
|
161 |
-
* @uses apply_filters() Calls 'bp_get_community_caps' with the capabilities.
|
162 |
-
*
|
163 |
Â
* @return array Community capabilities.
|
164 |
Â
*/
|
165 |
Â
function bp_get_community_caps() {
|
@@ -182,8 +173,6 @@ function bp_get_community_caps() {
|
|
182 |
Â
*
|
183 |
Â
* @since 1.6.0
|
184 |
Â
*
|
185 |
-
* @uses apply_filters() Allow return value to be filtered.
|
186 |
-
*
|
187 |
Â
* @param string $role The role for which you're loading caps.
|
188 |
Â
* @return array Capabilities for $role.
|
189 |
Â
*/
|
@@ -232,12 +221,6 @@ function bp_get_caps_for_role( $role = '' ) {
|
|
232 |
Â
*
|
233 |
Â
* @global BuddyPress $bp Global BuddyPress settings object.
|
234 |
Â
*
|
235 |
-
* @uses is_multisite()
|
236 |
-
* @uses bp_allow_global_access()
|
237 |
-
* @uses bp_is_user_inactive()
|
238 |
-
* @uses is_user_logged_in()
|
239 |
-
* @uses current_user_can()
|
240 |
-
* @uses WP_User::set_role()
|
241 |
Â
*/
|
242 |
Â
function bp_set_current_user_default_role() {
|
243 |
Â
|
57 |
Â
*
|
58 |
Â
* @since 1.6.0
|
59 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
60 |
Â
*/
|
61 |
Â
function bp_add_caps() {
|
62 |
Â
global $wp_roles;
|
90 |
Â
*
|
91 |
Â
* @since 1.6.0
|
92 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
93 |
Â
*/
|
94 |
Â
function bp_remove_caps() {
|
95 |
Â
global $wp_roles;
|
123 |
Â
*
|
124 |
Â
* @see WP_User::has_cap() for description of the arguments passed to the
|
125 |
Â
* 'map_meta_cap' filter.
|
Â
|
|
126 |
Â
* args.
|
127 |
Â
*
|
128 |
Â
* @param array $caps See {@link WP_User::has_cap()}.
|
151 |
Â
*
|
152 |
Â
* @since 1.6.0
|
153 |
Â
*
|
Â
|
|
Â
|
|
154 |
Â
* @return array Community capabilities.
|
155 |
Â
*/
|
156 |
Â
function bp_get_community_caps() {
|
173 |
Â
*
|
174 |
Â
* @since 1.6.0
|
175 |
Â
*
|
Â
|
|
Â
|
|
176 |
Â
* @param string $role The role for which you're loading caps.
|
177 |
Â
* @return array Capabilities for $role.
|
178 |
Â
*/
|
221 |
Â
*
|
222 |
Â
* @global BuddyPress $bp Global BuddyPress settings object.
|
223 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
224 |
Â
*/
|
225 |
Â
function bp_set_current_user_default_role() {
|
226 |
Â
|
@@ -210,13 +210,27 @@ function bp_core_set_uri_globals() {
|
|
210 |
Â
}
|
211 |
Â
|
212 |
Â
// URLs with BP_ENABLE_ROOT_PROFILES enabled won't be caught above.
|
213 |
-
if ( empty( $matches ) && bp_core_enable_root_profiles() ) {
|
214 |
Â
|
215 |
Â
// Switch field based on compat.
|
216 |
Â
$field = bp_is_username_compatibility_mode() ? 'login' : 'slug';
|
217 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
218 |
Â
// Make sure there's a user corresponding to $bp_uri[0].
|
219 |
-
if ( !empty( $bp->pages->members ) &&
|
220 |
Â
|
221 |
Â
// Force BP to recognize that this is a members page.
|
222 |
Â
$matches[] = 1;
|
@@ -272,6 +286,10 @@ function bp_core_set_uri_globals() {
|
|
272 |
Â
|
273 |
Â
// Are we viewing a specific user?
|
274 |
Â
if ( $after_member_slug ) {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
275 |
Â
// If root profile, we've already queried for the user.
|
276 |
Â
if ( $root_profile instanceof WP_User ) {
|
277 |
Â
$bp->displayed_user->id = $root_profile->ID;
|
@@ -438,6 +456,17 @@ function bp_core_load_template( $templates ) {
|
|
438 |
Â
* @param array $filtered_templates Array of templates to attempt to load.
|
439 |
Â
*/
|
440 |
Â
$located_template = apply_filters( 'bp_located_template', $template, $filtered_templates );
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
441 |
Â
if ( !empty( $located_template ) ) {
|
442 |
Â
// Template was located, lets set this as a valid page and not a 404.
|
443 |
Â
status_header( 200 );
|
@@ -516,6 +545,46 @@ function bp_core_catch_profile_uri() {
|
|
516 |
Â
}
|
517 |
Â
}
|
518 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
519 |
Â
/**
|
520 |
Â
* Catch unauthorized access to certain BuddyPress pages and redirect accordingly.
|
521 |
Â
*
|
@@ -667,8 +736,6 @@ add_action( 'login_form_bpnoaccess', 'bp_core_no_access_wp_login_error' );
|
|
667 |
Â
* @see BP_Members_Component::setup_globals() where
|
668 |
Â
* $bp->canonical_stack['base_url'] and ['component'] may be set.
|
669 |
Â
* @see bp_core_new_nav_item() where $bp->canonical_stack['action'] may be set.
|
670 |
-
* @uses bp_get_canonical_url()
|
671 |
-
* @uses bp_get_requested_url()
|
672 |
Â
*/
|
673 |
Â
function bp_redirect_canonical() {
|
674 |
Â
|
@@ -738,8 +805,6 @@ function bp_rel_canonical() {
|
|
738 |
Â
*
|
739 |
Â
* @since 1.6.0
|
740 |
Â
*
|
741 |
-
* @uses apply_filters() Filter bp_get_canonical_url to modify return value.
|
742 |
-
*
|
743 |
Â
* @param array $args {
|
744 |
Â
* Optional array of arguments.
|
745 |
Â
* @type bool $include_query_args Whether to include current URL arguments
|
@@ -875,7 +940,6 @@ function bp_get_requested_url() {
|
|
875 |
Â
*
|
876 |
Â
* @since 1.6.0
|
877 |
Â
*
|
878 |
-
* @uses bp_is_blog_page()
|
879 |
Â
*/
|
880 |
Â
function _bp_maybe_remove_redirect_canonical() {
|
881 |
Â
if ( ! bp_is_blog_page() )
|
210 |
Â
}
|
211 |
Â
|
212 |
Â
// URLs with BP_ENABLE_ROOT_PROFILES enabled won't be caught above.
|
213 |
+
if ( empty( $matches ) && bp_core_enable_root_profiles() && ! empty( $bp_uri[0] ) ) {
|
214 |
Â
|
215 |
Â
// Switch field based on compat.
|
216 |
Â
$field = bp_is_username_compatibility_mode() ? 'login' : 'slug';
|
217 |
Â
|
218 |
+
/**
|
219 |
+
* Filter the portion of the URI that is the displayed user's slug.
|
220 |
+
*
|
221 |
+
* eg. example.com/ADMIN (when root profiles is enabled)
|
222 |
+
* example.com/members/ADMIN (when root profiles isn't enabled)
|
223 |
+
*
|
224 |
+
* ADMIN would be the displayed user's slug.
|
225 |
+
*
|
226 |
+
* @since 2.6.0
|
227 |
+
*
|
228 |
+
* @param string $member_slug
|
229 |
+
*/
|
230 |
+
$member_slug = apply_filters( 'bp_core_set_uri_globals_member_slug', $bp_uri[0] );
|
231 |
+
|
232 |
Â
// Make sure there's a user corresponding to $bp_uri[0].
|
233 |
+
if ( ! empty( $bp->pages->members ) && $root_profile = get_user_by( $field, $member_slug ) ) {
|
234 |
Â
|
235 |
Â
// Force BP to recognize that this is a members page.
|
236 |
Â
$matches[] = 1;
|
286 |
Â
|
287 |
Â
// Are we viewing a specific user?
|
288 |
Â
if ( $after_member_slug ) {
|
289 |
+
|
290 |
+
/** This filter is documented in bp-core/bp-core-catchuri.php */
|
291 |
+
$after_member_slug = apply_filters( 'bp_core_set_uri_globals_member_slug', $after_member_slug );
|
292 |
+
|
293 |
Â
// If root profile, we've already queried for the user.
|
294 |
Â
if ( $root_profile instanceof WP_User ) {
|
295 |
Â
$bp->displayed_user->id = $root_profile->ID;
|
456 |
Â
* @param array $filtered_templates Array of templates to attempt to load.
|
457 |
Â
*/
|
458 |
Â
$located_template = apply_filters( 'bp_located_template', $template, $filtered_templates );
|
459 |
+
|
460 |
+
/*
|
461 |
+
* If current page is an embed, wipe out bp-default template.
|
462 |
+
*
|
463 |
+
* Wiping out the bp-default template allows WordPress to use their special
|
464 |
+
* embed template, which is what we want.
|
465 |
+
*/
|
466 |
+
if ( function_exists( 'is_embed' ) && is_embed() ) {
|
467 |
+
$located_template = '';
|
468 |
+
}
|
469 |
+
|
470 |
Â
if ( !empty( $located_template ) ) {
|
471 |
Â
// Template was located, lets set this as a valid page and not a 404.
|
472 |
Â
status_header( 200 );
|
545 |
Â
}
|
546 |
Â
}
|
547 |
Â
|
548 |
+
/**
|
549 |
+
* Members user shortlink redirector.
|
550 |
+
*
|
551 |
+
* Redirects x.com/members/me/* to x.com/members/{LOGGED_IN_USER_SLUG}/*
|
552 |
+
*
|
553 |
+
* @since 2.6.0
|
554 |
+
*
|
555 |
+
* @param string $member_slug The current member slug.
|
556 |
+
*/
|
557 |
+
function bp_core_members_shortlink_redirector( $member_slug ) {
|
558 |
+
/**
|
559 |
+
* Shortlink slug to redirect to logged-in user.
|
560 |
+
*
|
561 |
+
* x.com/members/me/* will redirect to x.com/members/{LOGGED_IN_USER_SLUG}/*
|
562 |
+
*
|
563 |
+
* @since 2.6.0
|
564 |
+
*
|
565 |
+
* @var string $slug Defaults to 'me'.
|
566 |
+
*/
|
567 |
+
$me_slug = apply_filters( 'bp_core_members_shortlink_slug', 'me' );
|
568 |
+
|
569 |
+
// Check if we're on our special shortlink slug. If not, bail.
|
570 |
+
if ( $me_slug !== $member_slug ) {
|
571 |
+
return $member_slug;
|
572 |
+
}
|
573 |
+
|
574 |
+
// If logged out, redirect user to login.
|
575 |
+
if ( false === is_user_logged_in() ) {
|
576 |
+
// Add our login redirector hook.
|
577 |
+
add_action( 'template_redirect', 'bp_core_no_access', 0 );
|
578 |
+
|
579 |
+
return $member_slug;
|
580 |
+
}
|
581 |
+
|
582 |
+
$user = wp_get_current_user();
|
583 |
+
|
584 |
+
return bp_core_get_username( $user->ID, $user->user_nicename, $user->user_login );
|
585 |
+
}
|
586 |
+
add_filter( 'bp_core_set_uri_globals_member_slug', 'bp_core_members_shortlink_redirector' );
|
587 |
+
|
588 |
Â
/**
|
589 |
Â
* Catch unauthorized access to certain BuddyPress pages and redirect accordingly.
|
590 |
Â
*
|
736 |
Â
* @see BP_Members_Component::setup_globals() where
|
737 |
Â
* $bp->canonical_stack['base_url'] and ['component'] may be set.
|
738 |
Â
* @see bp_core_new_nav_item() where $bp->canonical_stack['action'] may be set.
|
Â
|
|
Â
|
|
739 |
Â
*/
|
740 |
Â
function bp_redirect_canonical() {
|
741 |
Â
|
805 |
Â
*
|
806 |
Â
* @since 1.6.0
|
807 |
Â
*
|
Â
|
|
Â
|
|
808 |
Â
* @param array $args {
|
809 |
Â
* Optional array of arguments.
|
810 |
Â
* @type bool $include_query_args Whether to include current URL arguments
|
940 |
Â
*
|
941 |
Â
* @since 1.6.0
|
942 |
Â
*
|
Â
|
|
943 |
Â
*/
|
944 |
Â
function _bp_maybe_remove_redirect_canonical() {
|
945 |
Â
if ( ! bp_is_blog_page() )
|
@@ -30,3 +30,11 @@ require dirname( __FILE__ ) . '/classes/class-bp-email-recipient.php';
|
|
30 |
Â
require dirname( __FILE__ ) . '/classes/class-bp-email.php';
|
31 |
Â
require dirname( __FILE__ ) . '/classes/class-bp-email-delivery.php';
|
32 |
Â
require dirname( __FILE__ ) . '/classes/class-bp-phpmailer.php';
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
30 |
Â
require dirname( __FILE__ ) . '/classes/class-bp-email.php';
|
31 |
Â
require dirname( __FILE__ ) . '/classes/class-bp-email-delivery.php';
|
32 |
Â
require dirname( __FILE__ ) . '/classes/class-bp-phpmailer.php';
|
33 |
+
require dirname( __FILE__ ) . '/classes/class-bp-core-nav.php';
|
34 |
+
require dirname( __FILE__ ) . '/classes/class-bp-core-nav-item.php';
|
35 |
+
require dirname( __FILE__ ) . '/classes/class-bp-core-oembed-extension.php';
|
36 |
+
|
37 |
+
if ( buddypress()->do_nav_backcompat ) {
|
38 |
+
require dirname( __FILE__ ) . '/classes/class-bp-core-bp-nav-backcompat.php';
|
39 |
+
require dirname( __FILE__ ) . '/classes/class-bp-core-bp-options-nav-backcompat.php';
|
40 |
+
}
|
@@ -10,4 +10,6 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! class_exists( 'BP_Component' ) ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-component.php';
|
15 |
+
}
|
@@ -339,8 +339,6 @@ function bp_core_ajax_url() {
|
|
339 |
Â
*
|
340 |
Â
* @since 2.0.0
|
341 |
Â
*
|
342 |
-
* @uses apply_filters() to allow other component to load extra dependencies.
|
343 |
-
*
|
344 |
Â
* @return array The JavaScript dependencies.
|
345 |
Â
*/
|
346 |
Â
function bp_core_get_js_dependencies() {
|
339 |
Â
*
|
340 |
Â
* @since 2.0.0
|
341 |
Â
*
|
Â
|
|
Â
|
|
342 |
Â
* @return array The JavaScript dependencies.
|
343 |
Â
*/
|
344 |
Â
function bp_core_get_js_dependencies() {
|
@@ -47,7 +47,9 @@ function bp_email_init_customizer( WP_Customize_Manager $wp_customize ) {
|
|
47 |
Â
/**
|
48 |
Â
* BP_Customizer_Control_Range class.
|
49 |
Â
*/
|
50 |
-
|
Â
|
|
Â
|
|
51 |
Â
|
52 |
Â
/**
|
53 |
Â
* Fires to let plugins register extra Customizer controls for emails.
|
@@ -192,7 +194,7 @@ function bp_email_get_customizer_settings() {
|
|
192 |
Â
'bp_email_options[header_text_size]' => array(
|
193 |
Â
'capability' => 'bp_moderate',
|
194 |
Â
'default' => $defaults['header_text_size'],
|
195 |
-
'sanitize_callback' => '
|
196 |
Â
'transport' => 'postMessage',
|
197 |
Â
'type' => 'option',
|
198 |
Â
),
|
@@ -220,7 +222,7 @@ function bp_email_get_customizer_settings() {
|
|
220 |
Â
'bp_email_options[body_text_size]' => array(
|
221 |
Â
'capability' => 'bp_moderate',
|
222 |
Â
'default' => $defaults['body_text_size'],
|
223 |
-
'sanitize_callback' => '
|
224 |
Â
'transport' => 'postMessage',
|
225 |
Â
'type' => 'option',
|
226 |
Â
),
|
@@ -248,7 +250,7 @@ function bp_email_get_customizer_settings() {
|
|
248 |
Â
'bp_email_options[footer_text_size]' => array(
|
249 |
Â
'capability' => 'bp_moderate',
|
250 |
Â
'default' => $defaults['footer_text_size'],
|
251 |
-
'sanitize_callback' => '
|
252 |
Â
'transport' => 'postMessage',
|
253 |
Â
'type' => 'option',
|
254 |
Â
),
|
47 |
Â
/**
|
48 |
Â
* BP_Customizer_Control_Range class.
|
49 |
Â
*/
|
50 |
+
if ( ! buddypress()->do_autoload ) {
|
51 |
+
require_once dirname( __FILE__ ) . '/classes/class-bp-customizer-control-range.php';
|
52 |
+
}
|
53 |
Â
|
54 |
Â
/**
|
55 |
Â
* Fires to let plugins register extra Customizer controls for emails.
|
194 |
Â
'bp_email_options[header_text_size]' => array(
|
195 |
Â
'capability' => 'bp_moderate',
|
196 |
Â
'default' => $defaults['header_text_size'],
|
197 |
+
'sanitize_callback' => 'absint',
|
198 |
Â
'transport' => 'postMessage',
|
199 |
Â
'type' => 'option',
|
200 |
Â
),
|
222 |
Â
'bp_email_options[body_text_size]' => array(
|
223 |
Â
'capability' => 'bp_moderate',
|
224 |
Â
'default' => $defaults['body_text_size'],
|
225 |
+
'sanitize_callback' => 'absint',
|
226 |
Â
'transport' => 'postMessage',
|
227 |
Â
'type' => 'option',
|
228 |
Â
),
|
250 |
Â
'bp_email_options[footer_text_size]' => array(
|
251 |
Â
'capability' => 'bp_moderate',
|
252 |
Â
'default' => $defaults['footer_text_size'],
|
253 |
+
'sanitize_callback' => 'absint',
|
254 |
Â
'transport' => 'postMessage',
|
255 |
Â
'type' => 'option',
|
256 |
Â
),
|
@@ -207,22 +207,27 @@ function bp_setup_cache_groups() {
|
|
207 |
Â
/**
|
208 |
Â
* Set up the currently logged-in user.
|
209 |
Â
*
|
210 |
-
* We white-list the WordPress
|
Â
|
|
Â
|
|
211 |
Â
*
|
212 |
Â
* @since 1.7.0
|
213 |
Â
*
|
214 |
Â
* @link https://buddypress.trac.wordpress.org/ticket/6046
|
215 |
Â
* @link https://core.trac.wordpress.org/ticket/24169
|
216 |
Â
*
|
217 |
-
* @uses did_action() To make sure the user isn't loaded out of order.
|
218 |
-
* @uses do_action() Calls 'bp_setup_current_user'.
|
219 |
Â
*/
|
220 |
Â
function bp_setup_current_user() {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
221 |
Â
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
Â
|
|
226 |
Â
}
|
227 |
Â
|
228 |
Â
/**
|
@@ -248,6 +253,21 @@ function bp_init() {
|
|
248 |
Â
do_action( 'bp_init' );
|
249 |
Â
}
|
250 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
251 |
Â
/**
|
252 |
Â
* Fire the 'bp_customize_register' action when the Customizer has loaded,
|
253 |
Â
* allowing scripts and styles to be initialized.
|
@@ -356,7 +376,7 @@ function bp_widgets_init() {
|
|
356 |
Â
*
|
357 |
Â
* @since 1.6.0
|
358 |
Â
*/
|
359 |
-
do_action
|
360 |
Â
}
|
361 |
Â
|
362 |
Â
/**
|
@@ -373,7 +393,7 @@ function bp_head() {
|
|
373 |
Â
*
|
374 |
Â
* @since 1.6.0
|
375 |
Â
*/
|
376 |
-
do_action
|
377 |
Â
}
|
378 |
Â
|
379 |
Â
/** Theme Permissions *********************************************************/
|
@@ -387,7 +407,6 @@ function bp_head() {
|
|
387 |
Â
*
|
388 |
Â
* @since 1.6.0
|
389 |
Â
*
|
390 |
-
* @uses do_action()
|
391 |
Â
*/
|
392 |
Â
function bp_template_redirect() {
|
393 |
Â
|
@@ -408,7 +427,6 @@ function bp_template_redirect() {
|
|
408 |
Â
*
|
409 |
Â
* @since 1.5.0
|
410 |
Â
*
|
411 |
-
* @uses do_action()
|
412 |
Â
*/
|
413 |
Â
function bp_register_theme_directory() {
|
414 |
Â
|
@@ -429,7 +447,6 @@ function bp_register_theme_directory() {
|
|
429 |
Â
*
|
430 |
Â
* @since 1.7.0
|
431 |
Â
*
|
432 |
-
* @uses do_action()
|
433 |
Â
*/
|
434 |
Â
function bp_register_theme_packages() {
|
435 |
Â
|
@@ -446,7 +463,6 @@ function bp_register_theme_packages() {
|
|
446 |
Â
*
|
447 |
Â
* @since 1.6.0
|
448 |
Â
*
|
449 |
-
* @uses do_action() Calls 'bp_enqueue_scripts'.
|
450 |
Â
*/
|
451 |
Â
function bp_enqueue_scripts() {
|
452 |
Â
|
@@ -455,7 +471,25 @@ function bp_enqueue_scripts() {
|
|
455 |
Â
*
|
456 |
Â
* @since 1.6.0
|
457 |
Â
*/
|
458 |
-
do_action
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
459 |
Â
}
|
460 |
Â
|
461 |
Â
/**
|
@@ -463,7 +497,6 @@ function bp_enqueue_scripts() {
|
|
463 |
Â
*
|
464 |
Â
* @since 1.8.0
|
465 |
Â
*
|
466 |
-
* @uses do_action() Calls 'bp_add_rewrite_tags'.
|
467 |
Â
*/
|
468 |
Â
function bp_add_rewrite_tags() {
|
469 |
Â
|
@@ -480,7 +513,6 @@ function bp_add_rewrite_tags() {
|
|
480 |
Â
*
|
481 |
Â
* @since 1.9.0
|
482 |
Â
*
|
483 |
-
* @uses do_action() Calls 'bp_add_rewrite_rules'.
|
484 |
Â
*/
|
485 |
Â
function bp_add_rewrite_rules() {
|
486 |
Â
|
@@ -497,7 +529,6 @@ function bp_add_rewrite_rules() {
|
|
497 |
Â
*
|
498 |
Â
* @since 1.9.0
|
499 |
Â
*
|
500 |
-
* @uses do_action() Calls 'bp_add_permastructs'.
|
501 |
Â
*/
|
502 |
Â
function bp_add_permastructs() {
|
503 |
Â
|
@@ -517,7 +548,6 @@ function bp_add_permastructs() {
|
|
517 |
Â
*
|
518 |
Â
* @since 1.6.0
|
519 |
Â
*
|
520 |
-
* @uses do_action() Calls 'bp_setup_theme'.
|
521 |
Â
*/
|
522 |
Â
function bp_setup_theme() {
|
523 |
Â
|
@@ -526,7 +556,7 @@ function bp_setup_theme() {
|
|
526 |
Â
*
|
527 |
Â
* @since 1.6.0
|
528 |
Â
*/
|
529 |
-
do_action
|
530 |
Â
}
|
531 |
Â
|
532 |
Â
/**
|
@@ -541,7 +571,6 @@ function bp_setup_theme() {
|
|
541 |
Â
*
|
542 |
Â
* @since 1.6.0
|
543 |
Â
*
|
544 |
-
* @uses do_action() Calls 'bp_after_setup_theme'.
|
545 |
Â
*/
|
546 |
Â
function bp_after_setup_theme() {
|
547 |
Â
|
@@ -550,7 +579,7 @@ function bp_after_setup_theme() {
|
|
550 |
Â
*
|
551 |
Â
* @since 1.7.0
|
552 |
Â
*/
|
553 |
-
do_action
|
554 |
Â
}
|
555 |
Â
|
556 |
Â
/** Theme Compatibility Filter ************************************************/
|
@@ -608,8 +637,6 @@ function bp_login_redirect( $redirect_to = '', $redirect_to_raw = '', $user = fa
|
|
608 |
Â
*
|
609 |
Â
* @since 1.6.0
|
610 |
Â
*
|
611 |
-
* @uses apply_filters()
|
612 |
-
*
|
613 |
Â
* @param string $template See 'template_include'.
|
614 |
Â
* @return string Template file to use.
|
615 |
Â
*/
|
@@ -630,8 +657,6 @@ function bp_template_include( $template = '' ) {
|
|
630 |
Â
*
|
631 |
Â
* @since 1.7.0
|
632 |
Â
*
|
633 |
-
* @uses do_action() Calls 'bp_generate_rewrite_rules' with {@link WP_Rewrite}.
|
634 |
-
*
|
635 |
Â
* @param WP_Rewrite $wp_rewrite See 'generate_rewrite_rules'.
|
636 |
Â
*/
|
637 |
Â
function bp_generate_rewrite_rules( $wp_rewrite ) {
|
@@ -653,8 +678,6 @@ function bp_generate_rewrite_rules( $wp_rewrite ) {
|
|
653 |
Â
*
|
654 |
Â
* @since 1.7.0
|
655 |
Â
*
|
656 |
-
* @uses apply_filters() Calls 'bp_allowed_themes' with the allowed themes list.
|
657 |
-
*
|
658 |
Â
* @param array $themes The path of the template to include.
|
659 |
Â
* @return array
|
660 |
Â
*/
|
@@ -677,7 +700,6 @@ function bp_allowed_themes( $themes ) {
|
|
677 |
Â
*
|
678 |
Â
* @since 1.9.0
|
679 |
Â
*
|
680 |
-
* @uses do_action()
|
681 |
Â
*/
|
682 |
Â
function bp_post_request() {
|
683 |
Â
|
@@ -721,7 +743,6 @@ function bp_post_request() {
|
|
721 |
Â
*
|
722 |
Â
* @since 1.9.0
|
723 |
Â
*
|
724 |
-
* @uses do_action()
|
725 |
Â
*/
|
726 |
Â
function bp_get_request() {
|
727 |
Â
|
207 |
Â
/**
|
208 |
Â
* Set up the currently logged-in user.
|
209 |
Â
*
|
210 |
+
* We white-list the WordPress Customizer which purposely loads the user early.
|
211 |
+
* If the current user is being setup before the "init" action has fired,
|
212 |
+
* strange (and difficult to debug) role/capability issues will occur.
|
213 |
Â
*
|
214 |
Â
* @since 1.7.0
|
215 |
Â
*
|
216 |
Â
* @link https://buddypress.trac.wordpress.org/ticket/6046
|
217 |
Â
* @link https://core.trac.wordpress.org/ticket/24169
|
218 |
Â
*
|
Â
|
|
Â
|
|
219 |
Â
*/
|
220 |
Â
function bp_setup_current_user() {
|
221 |
+
$skip_warning = (
|
222 |
+
( isset( $_REQUEST['wp_customize'] ) && 'on' === $_REQUEST['wp_customize'] ) ||
|
223 |
+
( is_admin() && 'customize.php' === basename( $_SERVER['PHP_SELF'] ) )
|
224 |
+
);
|
225 |
Â
|
226 |
+
if ( ! $skip_warning && ! did_action( 'after_setup_theme' ) ) {
|
227 |
+
$e = new Exception;
|
228 |
+
$trace = $e->getTraceAsString();
|
229 |
+
|
230 |
+
_doing_it_wrong( __FUNCTION__, __( 'The current user is being initialized without using $wp->init().', 'buddypress' ) . "\n===\nTrace:\n" . substr( $trace, strpos( $trace, '#6' ) ) . "\n===\n", '1.7' );
|
231 |
Â
}
|
232 |
Â
|
233 |
Â
/**
|
253 |
Â
do_action( 'bp_init' );
|
254 |
Â
}
|
255 |
Â
|
256 |
+
/**
|
257 |
+
* Fire the 'bp_rest_api_init' action, where BuddyPress registers REST API endpoints.
|
258 |
+
*
|
259 |
+
* @since 2.6.0
|
260 |
+
*/
|
261 |
+
function bp_rest_api_init() {
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Fires the 'bp_rest_api_init' function, where BuddyPress registers REST API endpoints.
|
265 |
+
*
|
266 |
+
* @since 2.6.0
|
267 |
+
*/
|
268 |
+
do_action( 'bp_rest_api_init' );
|
269 |
+
}
|
270 |
+
|
271 |
Â
/**
|
272 |
Â
* Fire the 'bp_customize_register' action when the Customizer has loaded,
|
273 |
Â
* allowing scripts and styles to be initialized.
|
376 |
Â
*
|
377 |
Â
* @since 1.6.0
|
378 |
Â
*/
|
379 |
+
do_action( 'bp_widgets_init' );
|
380 |
Â
}
|
381 |
Â
|
382 |
Â
/**
|
393 |
Â
*
|
394 |
Â
* @since 1.6.0
|
395 |
Â
*/
|
396 |
+
do_action( 'bp_head' );
|
397 |
Â
}
|
398 |
Â
|
399 |
Â
/** Theme Permissions *********************************************************/
|
407 |
Â
*
|
408 |
Â
* @since 1.6.0
|
409 |
Â
*
|
Â
|
|
410 |
Â
*/
|
411 |
Â
function bp_template_redirect() {
|
412 |
Â
|
427 |
Â
*
|
428 |
Â
* @since 1.5.0
|
429 |
Â
*
|
Â
|
|
430 |
Â
*/
|
431 |
Â
function bp_register_theme_directory() {
|
432 |
Â
|
447 |
Â
*
|
448 |
Â
* @since 1.7.0
|
449 |
Â
*
|
Â
|
|
450 |
Â
*/
|
451 |
Â
function bp_register_theme_packages() {
|
452 |
Â
|
463 |
Â
*
|
464 |
Â
* @since 1.6.0
|
465 |
Â
*
|
Â
|
|
466 |
Â
*/
|
467 |
Â
function bp_enqueue_scripts() {
|
468 |
Â
|
471 |
Â
*
|
472 |
Â
* @since 1.6.0
|
473 |
Â
*/
|
474 |
+
do_action( 'bp_enqueue_scripts' );
|
475 |
+
}
|
476 |
+
|
477 |
+
/**
|
478 |
+
* Fires the 'bp_enqueue_embed_scripts' action in the <head> for BP oEmbeds.
|
479 |
+
*
|
480 |
+
* @since 2.6.0
|
481 |
+
*/
|
482 |
+
function bp_enqueue_embed_scripts() {
|
483 |
+
if ( ! is_buddypress() ) {
|
484 |
+
return;
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Enqueue CSS and JS files for BuddyPress embeds.
|
489 |
+
*
|
490 |
+
* @since 2.6.0
|
491 |
+
*/
|
492 |
+
do_action( 'bp_enqueue_embed_scripts' );
|
493 |
Â
}
|
494 |
Â
|
495 |
Â
/**
|
497 |
Â
*
|
498 |
Â
* @since 1.8.0
|
499 |
Â
*
|
Â
|
|
500 |
Â
*/
|
501 |
Â
function bp_add_rewrite_tags() {
|
502 |
Â
|
513 |
Â
*
|
514 |
Â
* @since 1.9.0
|
515 |
Â
*
|
Â
|
|
516 |
Â
*/
|
517 |
Â
function bp_add_rewrite_rules() {
|
518 |
Â
|
529 |
Â
*
|
530 |
Â
* @since 1.9.0
|
531 |
Â
*
|
Â
|
|
532 |
Â
*/
|
533 |
Â
function bp_add_permastructs() {
|
534 |
Â
|
548 |
Â
*
|
549 |
Â
* @since 1.6.0
|
550 |
Â
*
|
Â
|
|
551 |
Â
*/
|
552 |
Â
function bp_setup_theme() {
|
553 |
Â
|
556 |
Â
*
|
557 |
Â
* @since 1.6.0
|
558 |
Â
*/
|
559 |
+
do_action( 'bp_setup_theme' );
|
560 |
Â
}
|
561 |
Â
|
562 |
Â
/**
|
571 |
Â
*
|
572 |
Â
* @since 1.6.0
|
573 |
Â
*
|
Â
|
|
574 |
Â
*/
|
575 |
Â
function bp_after_setup_theme() {
|
576 |
Â
|
579 |
Â
*
|
580 |
Â
* @since 1.7.0
|
581 |
Â
*/
|
582 |
+
do_action( 'bp_after_setup_theme' );
|
583 |
Â
}
|
584 |
Â
|
585 |
Â
/** Theme Compatibility Filter ************************************************/
|
637 |
Â
*
|
638 |
Â
* @since 1.6.0
|
639 |
Â
*
|
Â
|
|
Â
|
|
640 |
Â
* @param string $template See 'template_include'.
|
641 |
Â
* @return string Template file to use.
|
642 |
Â
*/
|
657 |
Â
*
|
658 |
Â
* @since 1.7.0
|
659 |
Â
*
|
Â
|
|
Â
|
|
660 |
Â
* @param WP_Rewrite $wp_rewrite See 'generate_rewrite_rules'.
|
661 |
Â
*/
|
662 |
Â
function bp_generate_rewrite_rules( $wp_rewrite ) {
|
678 |
Â
*
|
679 |
Â
* @since 1.7.0
|
680 |
Â
*
|
Â
|
|
Â
|
|
681 |
Â
* @param array $themes The path of the template to include.
|
682 |
Â
* @return array
|
683 |
Â
*/
|
700 |
Â
*
|
701 |
Â
* @since 1.9.0
|
702 |
Â
*
|
Â
|
|
703 |
Â
*/
|
704 |
Â
function bp_post_request() {
|
705 |
Â
|
743 |
Â
*
|
744 |
Â
* @since 1.9.0
|
745 |
Â
*
|
Â
|
|
746 |
Â
*/
|
747 |
Â
function bp_get_request() {
|
748 |
Â
|
@@ -80,8 +80,6 @@ add_filter( 'comments_open', 'bp_comments_open', 10, 2 );
|
|
80 |
Â
*
|
81 |
Â
* @since 1.5.0
|
82 |
Â
*
|
83 |
-
* @uses bp_is_active() checks if a BuddyPress component is active.
|
84 |
-
*
|
85 |
Â
* @param array $pages List of excluded page IDs, as passed to the
|
86 |
Â
* 'wp_list_pages_excludes' filter.
|
87 |
Â
* @return array The exclude list, with BP's pages added.
|
@@ -119,9 +117,6 @@ add_filter( 'wp_list_pages_excludes', 'bp_core_exclude_pages' );
|
|
119 |
Â
*
|
120 |
Â
* @since 2.0.0
|
121 |
Â
*
|
122 |
-
* @uses bp_is_root_blog() checks if current blog is root blog.
|
123 |
-
* @uses buddypress() gets BuddyPress main instance
|
124 |
-
*
|
125 |
Â
* @param object|null $object The post type object used in the meta box.
|
126 |
Â
* @return object|null The $object, with a query argument to remove register and activate pages id.
|
127 |
Â
*/
|
@@ -286,7 +281,6 @@ add_filter( 'comments_array', 'bp_core_filter_comments', 10, 2 );
|
|
286 |
Â
*
|
287 |
Â
* @since 1.2.0
|
288 |
Â
*
|
289 |
-
* @uses apply_filters() Filter 'bp_core_login_redirect' to modify where users
|
290 |
Â
* are redirected to on login.
|
291 |
Â
*
|
292 |
Â
* @param string $redirect_to The URL to be redirected to, sanitized in wp-login.php.
|
80 |
Â
*
|
81 |
Â
* @since 1.5.0
|
82 |
Â
*
|
Â
|
|
Â
|
|
83 |
Â
* @param array $pages List of excluded page IDs, as passed to the
|
84 |
Â
* 'wp_list_pages_excludes' filter.
|
85 |
Â
* @return array The exclude list, with BP's pages added.
|
117 |
Â
*
|
118 |
Â
* @since 2.0.0
|
119 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
120 |
Â
* @param object|null $object The post type object used in the meta box.
|
121 |
Â
* @return object|null The $object, with a query argument to remove register and activate pages id.
|
122 |
Â
*/
|
281 |
Â
*
|
282 |
Â
* @since 1.2.0
|
283 |
Â
*
|
Â
|
|
284 |
Â
* are redirected to on login.
|
285 |
Â
*
|
286 |
Â
* @param string $redirect_to The URL to be redirected to, sanitized in wp-login.php.
|
@@ -17,7 +17,6 @@ defined( 'ABSPATH' ) || exit;
|
|
17 |
Â
*
|
18 |
Â
* @since 1.6.0
|
19 |
Â
*
|
20 |
-
* @uses bp_get_version() To get the BuddyPress version.
|
21 |
Â
*/
|
22 |
Â
function bp_version() {
|
23 |
Â
echo bp_get_version();
|
@@ -38,7 +37,6 @@ function bp_version() {
|
|
38 |
Â
*
|
39 |
Â
* @since 1.6.0
|
40 |
Â
*
|
41 |
-
* @uses bp_get_db_version() To get the BuddyPress database version.
|
42 |
Â
*/
|
43 |
Â
function bp_db_version() {
|
44 |
Â
echo bp_get_db_version();
|
@@ -59,7 +57,6 @@ function bp_db_version() {
|
|
59 |
Â
*
|
60 |
Â
* @since 1.6.0
|
61 |
Â
*
|
62 |
-
* @uses bp_get_db_version_raw() To get the current database BuddyPress version.
|
63 |
Â
*/
|
64 |
Â
function bp_db_version_raw() {
|
65 |
Â
echo bp_get_db_version_raw();
|
@@ -358,7 +355,6 @@ function bp_esc_like( $text ) {
|
|
358 |
Â
*
|
359 |
Â
* @since 1.5.0
|
360 |
Â
*
|
361 |
-
* @uses apply_filters() Filter 'bp_is_username_compatibility_mode' to alter.
|
362 |
Â
* @todo Move to members component?
|
363 |
Â
*
|
364 |
Â
* @return bool False when compatibility mode is disabled, true when enabled.
|
@@ -384,8 +380,6 @@ function bp_is_username_compatibility_mode() {
|
|
384 |
Â
*
|
385 |
Â
* @since 1.5.0
|
386 |
Â
*
|
387 |
-
* @uses apply_filters() Filter 'bp_use_wp_admin_bar' to alter.
|
388 |
-
*
|
389 |
Â
* @return bool Default: true. False when WP Toolbar support is disabled.
|
390 |
Â
*/
|
391 |
Â
function bp_use_wp_admin_bar() {
|
@@ -492,6 +486,29 @@ function bp_core_get_directory_page_ids( $status = 'active' ) {
|
|
492 |
Â
return apply_filters( 'bp_core_get_directory_page_ids', $page_ids );
|
493 |
Â
}
|
494 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
495 |
Â
/**
|
496 |
Â
* Store the list of BP directory pages in the appropriate meta table.
|
497 |
Â
*
|
@@ -900,8 +917,6 @@ function bp_do_register_theme_directory() {
|
|
900 |
Â
*
|
901 |
Â
* @since 1.0.0
|
902 |
Â
*
|
903 |
-
* @uses get_blog_option() WordPress function to fetch blog meta.
|
904 |
-
*
|
905 |
Â
* @return string The domain URL for the blog.
|
906 |
Â
*/
|
907 |
Â
function bp_core_get_root_domain() {
|
@@ -923,8 +938,6 @@ function bp_core_get_root_domain() {
|
|
923 |
Â
*
|
924 |
Â
* @since 1.0.0
|
925 |
Â
*
|
926 |
-
* @uses wp_safe_redirect()
|
927 |
-
*
|
928 |
Â
* @param string $location The redirect URL.
|
929 |
Â
* @param int $status Optional. The numeric code to give in the redirect
|
930 |
Â
* headers. Default: 302.
|
@@ -1054,9 +1067,6 @@ function bp_core_current_time( $gmt = true, $type = 'mysql' ) {
|
|
1054 |
Â
*
|
1055 |
Â
* @since 1.0.0
|
1056 |
Â
*
|
1057 |
-
* @uses apply_filters() Filter 'bp_core_time_since_pre' to bypass BP's calculations.
|
1058 |
-
* @uses apply_filters() Filter 'bp_core_time_since' to modify BP's calculations.
|
1059 |
-
*
|
1060 |
Â
* @param int|string $older_date The earlier time from which you're calculating
|
1061 |
Â
* the time elapsed. Enter either as an integer Unix timestamp,
|
1062 |
Â
* or as a date string of the format 'Y-m-d h:i:s'.
|
@@ -1267,8 +1277,8 @@ function bp_core_add_message( $message, $type = '' ) {
|
|
1267 |
Â
}
|
1268 |
Â
|
1269 |
Â
// Send the values to the cookie for page reload display.
|
1270 |
-
@setcookie( 'bp-message', $message, time() + 60 * 60 * 24, COOKIEPATH );
|
1271 |
-
@setcookie( 'bp-message-type', $type, time() + 60 * 60 * 24, COOKIEPATH );
|
1272 |
Â
|
1273 |
Â
// Get BuddyPress.
|
1274 |
Â
$bp = buddypress();
|
@@ -1293,7 +1303,6 @@ function bp_core_add_message( $message, $type = '' ) {
|
|
1293 |
Â
*
|
1294 |
Â
* @since 1.1.0
|
1295 |
Â
*
|
1296 |
-
* @uses setcookie() Sets a cookie value for the user.
|
1297 |
Â
*/
|
1298 |
Â
function bp_core_setup_message() {
|
1299 |
Â
|
@@ -1311,11 +1320,11 @@ function bp_core_setup_message() {
|
|
1311 |
Â
add_action( 'template_notices', 'bp_core_render_message' );
|
1312 |
Â
|
1313 |
Â
if ( isset( $_COOKIE['bp-message'] ) ) {
|
1314 |
-
@setcookie( 'bp-message', false, time() - 1000, COOKIEPATH );
|
1315 |
Â
}
|
1316 |
Â
|
1317 |
Â
if ( isset( $_COOKIE['bp-message-type'] ) ) {
|
1318 |
-
@setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH );
|
1319 |
Â
}
|
1320 |
Â
}
|
1321 |
Â
add_action( 'bp_actions', 'bp_core_setup_message', 5 );
|
@@ -1377,7 +1386,6 @@ function bp_core_render_message() {
|
|
1377 |
Â
*
|
1378 |
Â
* @since 1.0.0
|
1379 |
Â
*
|
1380 |
-
* @uses bp_update_user_meta() BP function to update user metadata in the
|
1381 |
Â
* usermeta table.
|
1382 |
Â
*
|
1383 |
Â
* @return bool|null Returns false if there is nothing to do.
|
@@ -1435,7 +1443,6 @@ add_action( 'wp_head', 'bp_core_record_activity' );
|
|
1435 |
Â
*
|
1436 |
Â
* @since 1.0.0
|
1437 |
Â
*
|
1438 |
-
* @uses bp_core_time_since() This function will return an English
|
1439 |
Â
* representation of the time elapsed.
|
1440 |
Â
*
|
1441 |
Â
* @param int|string $last_activity_date The date of last activity.
|
@@ -1486,8 +1493,6 @@ function bp_core_get_last_activity( $last_activity_date = '', $string = '' ) {
|
|
1486 |
Â
*
|
1487 |
Â
* @since 1.5.0
|
1488 |
Â
*
|
1489 |
-
* @uses apply_filters() Filter 'bp_get_user_meta_key' to modify keys individually.
|
1490 |
-
*
|
1491 |
Â
* @param string|bool $key The usermeta meta_key.
|
1492 |
Â
* @return string $key The usermeta meta_key.
|
1493 |
Â
*/
|
@@ -1513,7 +1518,6 @@ function bp_get_user_meta_key( $key = false ) {
|
|
1513 |
Â
* @since 1.5.0
|
1514 |
Â
*
|
1515 |
Â
* @see get_user_meta() For complete details about parameters and return values.
|
1516 |
-
* @uses bp_get_user_meta_key() For a filterable version of the meta key.
|
1517 |
Â
*
|
1518 |
Â
* @param int $user_id The ID of the user whose meta you're fetching.
|
1519 |
Â
* @param string $key The meta key to retrieve.
|
@@ -1535,7 +1539,6 @@ function bp_get_user_meta( $user_id, $key, $single = false ) {
|
|
1535 |
Â
* @since 1.5.0
|
1536 |
Â
*
|
1537 |
Â
* @see update_user_meta() For complete details about parameters and return values.
|
1538 |
-
* @uses bp_get_user_meta_key() For a filterable version of the meta key.
|
1539 |
Â
*
|
1540 |
Â
* @param int $user_id The ID of the user whose meta you're setting.
|
1541 |
Â
* @param string $key The meta key to set.
|
@@ -1557,7 +1560,6 @@ function bp_update_user_meta( $user_id, $key, $value, $prev_value = '' ) {
|
|
1557 |
Â
* @since 1.5.0
|
1558 |
Â
*
|
1559 |
Â
* @see delete_user_meta() For complete details about parameters and return values.
|
1560 |
-
* @uses bp_get_user_meta_key() For a filterable version of the meta key.
|
1561 |
Â
*
|
1562 |
Â
* @param int $user_id The ID of the user whose meta you're deleting.
|
1563 |
Â
* @param string $key The meta key to delete.
|
@@ -1666,6 +1668,38 @@ function bp_use_embed_in_private_messages() {
|
|
1666 |
Â
return apply_filters( 'bp_use_embed_in_private_messages', !defined( 'BP_EMBED_DISABLE_PRIVATE_MESSAGES' ) || !BP_EMBED_DISABLE_PRIVATE_MESSAGES );
|
1667 |
Â
}
|
1668 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1669 |
Â
/** Admin *********************************************************************/
|
1670 |
Â
|
1671 |
Â
/**
|
@@ -1686,9 +1720,6 @@ function bp_admin_url( $path = '', $scheme = 'admin' ) {
|
|
1686 |
Â
*
|
1687 |
Â
* @since 1.5.0
|
1688 |
Â
*
|
1689 |
-
* @uses bp_core_do_network_admin()
|
1690 |
-
* @uses network_admin_url()
|
1691 |
-
* @uses admin_url()
|
1692 |
Â
*
|
1693 |
Â
* @param string $path Optional. The sub-path under /wp-admin to be
|
1694 |
Â
* appended to the admin URL.
|
@@ -1720,9 +1751,6 @@ function bp_admin_url( $path = '', $scheme = 'admin' ) {
|
|
1720 |
Â
*
|
1721 |
Â
* @since 1.5.0
|
1722 |
Â
*
|
1723 |
-
* @uses bp_is_network_activated()
|
1724 |
-
* @uses bp_is_multiblog_mode()
|
1725 |
-
*
|
1726 |
Â
* @return bool True if the BP admin screen should appear in the Network Admin,
|
1727 |
Â
* otherwise false.
|
1728 |
Â
*/
|
@@ -1855,8 +1883,6 @@ function bp_get_root_blog_id() {
|
|
1855 |
Â
*
|
1856 |
Â
* @since 1.5.0
|
1857 |
Â
*
|
1858 |
-
* @uses apply_filters() Filter 'bp_is_multiblog_mode' to alter.
|
1859 |
-
*
|
1860 |
Â
* @return bool False when multiblog mode is disabled; true when enabled.
|
1861 |
Â
* Default: false.
|
1862 |
Â
*/
|
@@ -2044,8 +2070,6 @@ function bp_do_404( $redirect = 'remove_canonical_direct' ) {
|
|
2044 |
Â
*
|
2045 |
Â
* @since 1.6.0
|
2046 |
Â
*
|
2047 |
-
* @uses do_action() Calls 'bp_verify_nonce_request' on $action.
|
2048 |
-
*
|
2049 |
Â
* @param string $action Action nonce.
|
2050 |
Â
* @param string $query_arg Where to look for nonce in $_REQUEST.
|
2051 |
Â
* @return bool True if the nonce is verified, otherwise false.
|
@@ -2185,7 +2209,7 @@ function bp_core_load_buddypress_textdomain() {
|
|
2185 |
Â
// Default to WP and glotpress.
|
2186 |
Â
return load_plugin_textdomain( $domain );
|
2187 |
Â
}
|
2188 |
-
add_action
|
2189 |
Â
|
2190 |
Â
/**
|
2191 |
Â
* A JavaScript-free implementation of the search functions in BuddyPress.
|
@@ -2263,20 +2287,6 @@ function bp_core_action_search_site( $slug = '' ) {
|
|
2263 |
Â
}
|
2264 |
Â
add_action( 'bp_init', 'bp_core_action_search_site', 7 );
|
2265 |
Â
|
2266 |
-
/**
|
2267 |
-
* Print the generation time in the footer of the site.
|
2268 |
-
*
|
2269 |
-
* @since 1.0.0
|
2270 |
-
*/
|
2271 |
-
function bp_core_print_generation_time() {
|
2272 |
-
?>
|
2273 |
-
|
2274 |
-
<!-- Generated in <?php timer_stop(1); ?> seconds. (<?php echo get_num_queries(); ?> q) -->
|
2275 |
-
|
2276 |
-
<?php
|
2277 |
-
}
|
2278 |
-
add_action( 'wp_footer', 'bp_core_print_generation_time' );
|
2279 |
-
|
2280 |
Â
/**
|
2281 |
Â
* Remove "prev" and "next" relational links from <head> on BuddyPress pages.
|
2282 |
Â
*
|
@@ -2331,6 +2341,105 @@ function bp_core_get_minified_asset_suffix() {
|
|
2331 |
Â
return $ext;
|
2332 |
Â
}
|
2333 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2334 |
Â
/** Nav Menu ******************************************************************/
|
2335 |
Â
|
2336 |
Â
/**
|
@@ -2358,11 +2467,8 @@ function bp_nav_menu_get_loggedin_pages() {
|
|
2358 |
Â
return buddypress()->wp_nav_menu_items->loggedin;
|
2359 |
Â
}
|
2360 |
Â
|
2361 |
-
// Pull up a list of items registered in BP's
|
2362 |
-
$bp_menu_items = buddypress()->
|
2363 |
-
|
2364 |
-
// Alphabetize.
|
2365 |
-
$bp_menu_items = bp_alpha_sort_by_key( $bp_menu_items, 'name' );
|
2366 |
Â
|
2367 |
Â
// Some BP nav menu items will not be represented in bp_nav, because
|
2368 |
Â
// they are not real BP components. We add them manually here.
|
@@ -2490,7 +2596,7 @@ function bp_nav_menu_get_loggedout_pages() {
|
|
2490 |
Â
* @since 1.9.0
|
2491 |
Â
*
|
2492 |
Â
* @param string $slug The slug of the nav item: login, register, or one of the
|
2493 |
-
* slugs from
|
2494 |
Â
* @return string $nav_item_url The URL generated for the current user.
|
2495 |
Â
*/
|
2496 |
Â
function bp_nav_menu_get_item_url( $slug ) {
|
@@ -2585,12 +2691,6 @@ function bp_core_get_suggestions( $args ) {
|
|
2585 |
Â
*
|
2586 |
Â
* @since 2.3.0
|
2587 |
Â
*
|
2588 |
-
* @uses is_multisite()
|
2589 |
-
* @uses bp_is_root_blog()
|
2590 |
-
* @uses switch_to_blog()
|
2591 |
-
* @uses wp_upload_dir()
|
2592 |
-
* @uses restore_current_blog()
|
2593 |
-
*
|
2594 |
Â
* @return string
|
2595 |
Â
*/
|
2596 |
Â
function bp_upload_dir() {
|
@@ -3242,9 +3342,9 @@ function bp_email_get_schema() {
|
|
3242 |
Â
/* translators: do not remove {} brackets or translate its contents. */
|
3243 |
Â
'post_title' => __( '[{{{site.name}}}] Verify your new email address', 'buddypress' ),
|
3244 |
Â
/* translators: do not remove {} brackets or translate its contents. */
|
3245 |
-
'post_content' => __( "You recently changed the email address associated with your account on {{site.name}}. If this is correct, <a href=\"{{{verify.url}}}\">go here to confirm the change</a>.\n\nOtherwise, you can safely ignore and delete this email if you have changed your mind, or if you think you have received this email in error.", 'buddypress' ),
|
3246 |
Â
/* translators: do not remove {} brackets or translate its contents. */
|
3247 |
-
'post_excerpt' => __( "You recently changed the email address associated with your account on {{site.name}}. If this is correct, go to the following link to confirm the change: {{{verify.url}}}\n\nOtherwise, you can safely ignore and delete this email if you have changed your mind, or if you think you have received this email in error.", 'buddypress' ),
|
3248 |
Â
),
|
3249 |
Â
'groups-membership-request-accepted' => array(
|
3250 |
Â
/* translators: do not remove {} brackets or translate its contents. */
|
17 |
Â
*
|
18 |
Â
* @since 1.6.0
|
19 |
Â
*
|
Â
|
|
20 |
Â
*/
|
21 |
Â
function bp_version() {
|
22 |
Â
echo bp_get_version();
|
37 |
Â
*
|
38 |
Â
* @since 1.6.0
|
39 |
Â
*
|
Â
|
|
40 |
Â
*/
|
41 |
Â
function bp_db_version() {
|
42 |
Â
echo bp_get_db_version();
|
57 |
Â
*
|
58 |
Â
* @since 1.6.0
|
59 |
Â
*
|
Â
|
|
60 |
Â
*/
|
61 |
Â
function bp_db_version_raw() {
|
62 |
Â
echo bp_get_db_version_raw();
|
355 |
Â
*
|
356 |
Â
* @since 1.5.0
|
357 |
Â
*
|
Â
|
|
358 |
Â
* @todo Move to members component?
|
359 |
Â
*
|
360 |
Â
* @return bool False when compatibility mode is disabled, true when enabled.
|
380 |
Â
*
|
381 |
Â
* @since 1.5.0
|
382 |
Â
*
|
Â
|
|
Â
|
|
383 |
Â
* @return bool Default: true. False when WP Toolbar support is disabled.
|
384 |
Â
*/
|
385 |
Â
function bp_use_wp_admin_bar() {
|
486 |
Â
return apply_filters( 'bp_core_get_directory_page_ids', $page_ids );
|
487 |
Â
}
|
488 |
Â
|
489 |
+
/**
|
490 |
+
* Get the page ID corresponding to a component directory.
|
491 |
+
*
|
492 |
+
* @since 2.6.0
|
493 |
+
*
|
494 |
+
* @param string $component The slug representing the component. Defaults to the current component.
|
495 |
+
* @return int|bool The ID of the directory page associated with the component. False if none is found.
|
496 |
+
*/
|
497 |
+
function bp_core_get_directory_page_id( $component = null ) {
|
498 |
+
if ( ! $component ) {
|
499 |
+
$component = bp_current_component();
|
500 |
+
}
|
501 |
+
|
502 |
+
$bp_pages = bp_core_get_directory_page_ids( 'all' );
|
503 |
+
|
504 |
+
$page_id = false;
|
505 |
+
if ( $component && isset( $bp_pages[ $component ] ) ) {
|
506 |
+
$page_id = (int) $bp_pages[ $component ];
|
507 |
+
}
|
508 |
+
|
509 |
+
return $page_id;
|
510 |
+
}
|
511 |
+
|
512 |
Â
/**
|
513 |
Â
* Store the list of BP directory pages in the appropriate meta table.
|
514 |
Â
*
|
917 |
Â
*
|
918 |
Â
* @since 1.0.0
|
919 |
Â
*
|
Â
|
|
Â
|
|
920 |
Â
* @return string The domain URL for the blog.
|
921 |
Â
*/
|
922 |
Â
function bp_core_get_root_domain() {
|
938 |
Â
*
|
939 |
Â
* @since 1.0.0
|
940 |
Â
*
|
Â
|
|
Â
|
|
941 |
Â
* @param string $location The redirect URL.
|
942 |
Â
* @param int $status Optional. The numeric code to give in the redirect
|
943 |
Â
* headers. Default: 302.
|
1067 |
Â
*
|
1068 |
Â
* @since 1.0.0
|
1069 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
1070 |
Â
* @param int|string $older_date The earlier time from which you're calculating
|
1071 |
Â
* the time elapsed. Enter either as an integer Unix timestamp,
|
1072 |
Â
* or as a date string of the format 'Y-m-d h:i:s'.
|
1277 |
Â
}
|
1278 |
Â
|
1279 |
Â
// Send the values to the cookie for page reload display.
|
1280 |
+
@setcookie( 'bp-message', $message, time() + 60 * 60 * 24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
1281 |
+
@setcookie( 'bp-message-type', $type, time() + 60 * 60 * 24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
1282 |
Â
|
1283 |
Â
// Get BuddyPress.
|
1284 |
Â
$bp = buddypress();
|
1303 |
Â
*
|
1304 |
Â
* @since 1.1.0
|
1305 |
Â
*
|
Â
|
|
1306 |
Â
*/
|
1307 |
Â
function bp_core_setup_message() {
|
1308 |
Â
|
1320 |
Â
add_action( 'template_notices', 'bp_core_render_message' );
|
1321 |
Â
|
1322 |
Â
if ( isset( $_COOKIE['bp-message'] ) ) {
|
1323 |
+
@setcookie( 'bp-message', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
1324 |
Â
}
|
1325 |
Â
|
1326 |
Â
if ( isset( $_COOKIE['bp-message-type'] ) ) {
|
1327 |
+
@setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
1328 |
Â
}
|
1329 |
Â
}
|
1330 |
Â
add_action( 'bp_actions', 'bp_core_setup_message', 5 );
|
1386 |
Â
*
|
1387 |
Â
* @since 1.0.0
|
1388 |
Â
*
|
Â
|
|
1389 |
Â
* usermeta table.
|
1390 |
Â
*
|
1391 |
Â
* @return bool|null Returns false if there is nothing to do.
|
1443 |
Â
*
|
1444 |
Â
* @since 1.0.0
|
1445 |
Â
*
|
Â
|
|
1446 |
Â
* representation of the time elapsed.
|
1447 |
Â
*
|
1448 |
Â
* @param int|string $last_activity_date The date of last activity.
|
1493 |
Â
*
|
1494 |
Â
* @since 1.5.0
|
1495 |
Â
*
|
Â
|
|
Â
|
|
1496 |
Â
* @param string|bool $key The usermeta meta_key.
|
1497 |
Â
* @return string $key The usermeta meta_key.
|
1498 |
Â
*/
|
1518 |
Â
* @since 1.5.0
|
1519 |
Â
*
|
1520 |
Â
* @see get_user_meta() For complete details about parameters and return values.
|
Â
|
|
1521 |
Â
*
|
1522 |
Â
* @param int $user_id The ID of the user whose meta you're fetching.
|
1523 |
Â
* @param string $key The meta key to retrieve.
|
1539 |
Â
* @since 1.5.0
|
1540 |
Â
*
|
1541 |
Â
* @see update_user_meta() For complete details about parameters and return values.
|
Â
|
|
1542 |
Â
*
|
1543 |
Â
* @param int $user_id The ID of the user whose meta you're setting.
|
1544 |
Â
* @param string $key The meta key to set.
|
1560 |
Â
* @since 1.5.0
|
1561 |
Â
*
|
1562 |
Â
* @see delete_user_meta() For complete details about parameters and return values.
|
Â
|
|
1563 |
Â
*
|
1564 |
Â
* @param int $user_id The ID of the user whose meta you're deleting.
|
1565 |
Â
* @param string $key The meta key to delete.
|
1668 |
Â
return apply_filters( 'bp_use_embed_in_private_messages', !defined( 'BP_EMBED_DISABLE_PRIVATE_MESSAGES' ) || !BP_EMBED_DISABLE_PRIVATE_MESSAGES );
|
1669 |
Â
}
|
1670 |
Â
|
1671 |
+
/**
|
1672 |
+
* Extracts media metadata from a given content.
|
1673 |
+
*
|
1674 |
+
* @since 2.6.0
|
1675 |
+
*
|
1676 |
+
* @param string $content The content to check.
|
1677 |
+
* @param string|int $type The type to check. Can also use a bitmask. See the class constants in the
|
1678 |
+
* BP_Media_Extractor class for more info.
|
1679 |
+
* @return array|bool If media exists, will return array of media metadata. Else, boolean false.
|
1680 |
+
*/
|
1681 |
+
function bp_core_extract_media_from_content( $content = '', $type = 'all' ) {
|
1682 |
+
if ( is_string( $type ) ) {
|
1683 |
+
$class = new ReflectionClass( 'BP_Media_Extractor' );
|
1684 |
+
$bitmask = $class->getConstant( strtoupper( $type ) );
|
1685 |
+
} else {
|
1686 |
+
$bitmask = (int) $type;
|
1687 |
+
}
|
1688 |
+
|
1689 |
+
// Type isn't valid, so bail.
|
1690 |
+
if ( empty( $bitmask ) ) {
|
1691 |
+
return false;
|
1692 |
+
}
|
1693 |
+
|
1694 |
+
$x = new BP_Media_Extractor;
|
1695 |
+
$media = $x->extract( $content, $bitmask );
|
1696 |
+
|
1697 |
+
unset( $media['has'] );
|
1698 |
+
$retval = array_filter( $media );
|
1699 |
+
|
1700 |
+
return ! empty( $retval ) ? $retval : false;
|
1701 |
+
}
|
1702 |
+
|
1703 |
Â
/** Admin *********************************************************************/
|
1704 |
Â
|
1705 |
Â
/**
|
1720 |
Â
*
|
1721 |
Â
* @since 1.5.0
|
1722 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
1723 |
Â
*
|
1724 |
Â
* @param string $path Optional. The sub-path under /wp-admin to be
|
1725 |
Â
* appended to the admin URL.
|
1751 |
Â
*
|
1752 |
Â
* @since 1.5.0
|
1753 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
1754 |
Â
* @return bool True if the BP admin screen should appear in the Network Admin,
|
1755 |
Â
* otherwise false.
|
1756 |
Â
*/
|
1883 |
Â
*
|
1884 |
Â
* @since 1.5.0
|
1885 |
Â
*
|
Â
|
|
Â
|
|
1886 |
Â
* @return bool False when multiblog mode is disabled; true when enabled.
|
1887 |
Â
* Default: false.
|
1888 |
Â
*/
|
2070 |
Â
*
|
2071 |
Â
* @since 1.6.0
|
2072 |
Â
*
|
Â
|
|
Â
|
|
2073 |
Â
* @param string $action Action nonce.
|
2074 |
Â
* @param string $query_arg Where to look for nonce in $_REQUEST.
|
2075 |
Â
* @return bool True if the nonce is verified, otherwise false.
|
2209 |
Â
// Default to WP and glotpress.
|
2210 |
Â
return load_plugin_textdomain( $domain );
|
2211 |
Â
}
|
2212 |
+
add_action( 'bp_core_loaded', 'bp_core_load_buddypress_textdomain' );
|
2213 |
Â
|
2214 |
Â
/**
|
2215 |
Â
* A JavaScript-free implementation of the search functions in BuddyPress.
|
2287 |
Â
}
|
2288 |
Â
add_action( 'bp_init', 'bp_core_action_search_site', 7 );
|
2289 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2290 |
Â
/**
|
2291 |
Â
* Remove "prev" and "next" relational links from <head> on BuddyPress pages.
|
2292 |
Â
*
|
2341 |
Â
return $ext;
|
2342 |
Â
}
|
2343 |
Â
|
2344 |
+
/**
|
2345 |
+
* Return a list of component information.
|
2346 |
+
*
|
2347 |
+
* @since 2.6.0
|
2348 |
+
*
|
2349 |
+
* @param string $type Optional; component type to fetch. Default value is 'all', or 'optional', 'retired', 'required'.
|
2350 |
+
* @return array Requested components' data.
|
2351 |
+
*/
|
2352 |
+
function bp_core_get_components( $type = 'all' ) {
|
2353 |
+
$required_components = array(
|
2354 |
+
'core' => array(
|
2355 |
+
'title' => __( 'BuddyPress Core', 'buddypress' ),
|
2356 |
+
'description' => __( 'It‘s what makes <del>time travel</del> BuddyPress possible!', 'buddypress' )
|
2357 |
+
),
|
2358 |
+
'members' => array(
|
2359 |
+
'title' => __( 'Community Members', 'buddypress' ),
|
2360 |
+
'description' => __( 'Everything in a BuddyPress community revolves around its members.', 'buddypress' )
|
2361 |
+
),
|
2362 |
+
);
|
2363 |
+
|
2364 |
+
$retired_components = array(
|
2365 |
+
'forums' => array(
|
2366 |
+
'title' => __( 'Group Forums', 'buddypress' ),
|
2367 |
+
'description' => sprintf( __( 'BuddyPress Forums are retired. Use %s.', 'buddypress' ), '<a href="https://bbpress.org/">bbPress</a>' )
|
2368 |
+
),
|
2369 |
+
);
|
2370 |
+
|
2371 |
+
$optional_components = array(
|
2372 |
+
'xprofile' => array(
|
2373 |
+
'title' => __( 'Extended Profiles', 'buddypress' ),
|
2374 |
+
'description' => __( 'Customize your community with fully editable profile fields that allow your users to describe themselves.', 'buddypress' )
|
2375 |
+
),
|
2376 |
+
'settings' => array(
|
2377 |
+
'title' => __( 'Account Settings', 'buddypress' ),
|
2378 |
+
'description' => __( 'Allow your users to modify their account and notification settings directly from within their profiles.', 'buddypress' )
|
2379 |
+
),
|
2380 |
+
'friends' => array(
|
2381 |
+
'title' => __( 'Friend Connections', 'buddypress' ),
|
2382 |
+
'description' => __( 'Let your users make connections so they can track the activity of others and focus on the people they care about the most.', 'buddypress' )
|
2383 |
+
),
|
2384 |
+
'messages' => array(
|
2385 |
+
'title' => __( 'Private Messaging', 'buddypress' ),
|
2386 |
+
'description' => __( 'Allow your users to talk to each other directly and in private. Not just limited to one-on-one discussions, messages can be sent between any number of members.', 'buddypress' )
|
2387 |
+
),
|
2388 |
+
'activity' => array(
|
2389 |
+
'title' => __( 'Activity Streams', 'buddypress' ),
|
2390 |
+
'description' => __( 'Global, personal, and group activity streams with threaded commenting, direct posting, favoriting, and @mentions, all with full RSS feed and email notification support.', 'buddypress' )
|
2391 |
+
),
|
2392 |
+
'notifications' => array(
|
2393 |
+
'title' => __( 'Notifications', 'buddypress' ),
|
2394 |
+
'description' => __( 'Notify members of relevant activity with a toolbar bubble and/or via email, and allow them to customize their notification settings.', 'buddypress' )
|
2395 |
+
),
|
2396 |
+
'groups' => array(
|
2397 |
+
'title' => __( 'User Groups', 'buddypress' ),
|
2398 |
+
'description' => __( 'Groups allow your users to organize themselves into specific public, private or hidden sections with separate activity streams and member listings.', 'buddypress' )
|
2399 |
+
),
|
2400 |
+
'forums' => array(
|
2401 |
+
'title' => __( 'Group Forums (Legacy)', 'buddypress' ),
|
2402 |
+
'description' => __( 'Group forums allow for focused, bulletin-board style conversations.', 'buddypress' )
|
2403 |
+
),
|
2404 |
+
'blogs' => array(
|
2405 |
+
'title' => __( 'Site Tracking', 'buddypress' ),
|
2406 |
+
'description' => __( 'Record activity for new posts and comments from your site.', 'buddypress' )
|
2407 |
+
)
|
2408 |
+
);
|
2409 |
+
|
2410 |
+
// Add blogs tracking if multisite.
|
2411 |
+
if ( is_multisite() ) {
|
2412 |
+
$optional_components['blogs']['description'] = __( 'Record activity for new sites, posts, and comments across your network.', 'buddypress' );
|
2413 |
+
}
|
2414 |
+
|
2415 |
+
switch ( $type ) {
|
2416 |
+
case 'required' :
|
2417 |
+
$components = $required_components;
|
2418 |
+
break;
|
2419 |
+
case 'optional' :
|
2420 |
+
$components = $optional_components;
|
2421 |
+
break;
|
2422 |
+
case 'retired' :
|
2423 |
+
$components = $retired_components;
|
2424 |
+
break;
|
2425 |
+
case 'all' :
|
2426 |
+
default :
|
2427 |
+
$components = array_merge( $required_components, $optional_components, $retired_components );
|
2428 |
+
break;
|
2429 |
+
}
|
2430 |
+
|
2431 |
+
/**
|
2432 |
+
* Filters the list of component information.
|
2433 |
+
*
|
2434 |
+
* @since 2.6.0
|
2435 |
+
*
|
2436 |
+
* @param array $components Array of component information.
|
2437 |
+
* @param string $type Type of component list requested.
|
2438 |
+
* Possible values are 'all', 'optional', 'retired', 'required'.
|
2439 |
+
*/
|
2440 |
+
return apply_filters( 'bp_core_get_components', $components, $type );
|
2441 |
+
}
|
2442 |
+
|
2443 |
Â
/** Nav Menu ******************************************************************/
|
2444 |
Â
|
2445 |
Â
/**
|
2467 |
Â
return buddypress()->wp_nav_menu_items->loggedin;
|
2468 |
Â
}
|
2469 |
Â
|
2470 |
+
// Pull up a list of items registered in BP's primary nav for the member.
|
2471 |
+
$bp_menu_items = buddypress()->members->nav->get_primary();
|
Â
|
|
Â
|
|
Â
|
|
2472 |
Â
|
2473 |
Â
// Some BP nav menu items will not be represented in bp_nav, because
|
2474 |
Â
// they are not real BP components. We add them manually here.
|
2596 |
Â
* @since 1.9.0
|
2597 |
Â
*
|
2598 |
Â
* @param string $slug The slug of the nav item: login, register, or one of the
|
2599 |
+
* slugs from the members navigation.
|
2600 |
Â
* @return string $nav_item_url The URL generated for the current user.
|
2601 |
Â
*/
|
2602 |
Â
function bp_nav_menu_get_item_url( $slug ) {
|
2691 |
Â
*
|
2692 |
Â
* @since 2.3.0
|
2693 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2694 |
Â
* @return string
|
2695 |
Â
*/
|
2696 |
Â
function bp_upload_dir() {
|
3342 |
Â
/* translators: do not remove {} brackets or translate its contents. */
|
3343 |
Â
'post_title' => __( '[{{{site.name}}}] Verify your new email address', 'buddypress' ),
|
3344 |
Â
/* translators: do not remove {} brackets or translate its contents. */
|
3345 |
+
'post_content' => __( "You recently changed the email address associated with your account on {{site.name}} to {{user.email}}. If this is correct, <a href=\"{{{verify.url}}}\">go here to confirm the change</a>.\n\nOtherwise, you can safely ignore and delete this email if you have changed your mind, or if you think you have received this email in error.", 'buddypress' ),
|
3346 |
Â
/* translators: do not remove {} brackets or translate its contents. */
|
3347 |
+
'post_excerpt' => __( "You recently changed the email address associated with your account on {{site.name}} to {{user.email}}. If this is correct, go to the following link to confirm the change: {{{verify.url}}}\n\nOtherwise, you can safely ignore and delete this email if you have changed your mind, or if you think you have received this email in error.", 'buddypress' ),
|
3348 |
Â
),
|
3349 |
Â
'groups-membership-request-accepted' => array(
|
3350 |
Â
/* translators: do not remove {} brackets or translate its contents. */
|
@@ -12,7 +12,10 @@
|
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
-
|
Â
|
|
Â
|
|
Â
|
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Set up the BuddyPress Core component.
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
+
if ( ! buddypress()->do_autoload ) {
|
16 |
+
require dirname( __FILE__ ) . '/classes/class-bp-component.php';
|
17 |
+
require dirname( __FILE__ ) . '/classes/class-bp-core.php';
|
18 |
+
}
|
19 |
Â
|
20 |
Â
/**
|
21 |
Â
* Set up the BuddyPress Core component.
|
@@ -20,11 +20,6 @@ defined( 'ABSPATH' ) || exit;
|
|
20 |
Â
*
|
21 |
Â
* @since 1.6.0
|
22 |
Â
*
|
23 |
-
* @uses current_user_can() To check if the current user can throttle.
|
24 |
-
* @uses bp_get_option() To get the throttle time.
|
25 |
-
* @uses get_transient() To get the last posted transient of the ip.
|
26 |
-
* @uses get_user_meta() To get the last posted meta of the user.
|
27 |
-
*
|
28 |
Â
* @param int $user_id User id to check for flood.
|
29 |
Â
* @return bool True if there is no flooding, false if there is.
|
30 |
Â
*/
|
@@ -52,17 +47,15 @@ function bp_core_check_for_flood( $user_id = 0 ) {
|
|
52 |
Â
* Check for moderation keys and too many links.
|
53 |
Â
*
|
54 |
Â
* @since 1.6.0
|
Â
|
|
55 |
Â
*
|
56 |
-
* @
|
57 |
-
* @
|
58 |
-
* @
|
59 |
-
*
|
60 |
-
* @param int $user_id Topic or reply author ID.
|
61 |
-
* @param string $title The title of the content.
|
62 |
-
* @param string $content The content being posted.
|
63 |
Â
* @return bool True if test is passed, false if fail.
|
64 |
Â
*/
|
65 |
-
function bp_core_check_for_moderation( $user_id = 0, $title = '', $content = '' ) {
|
66 |
Â
|
67 |
Â
/**
|
68 |
Â
* Filters whether or not to bypass checking for moderation keys and too many links.
|
@@ -136,7 +129,11 @@ function bp_core_check_for_moderation( $user_id = 0, $title = '', $content = ''
|
|
136 |
Â
|
137 |
Â
// Das ist zu viele links!
|
138 |
Â
if ( $num_links >= $max_links ) {
|
139 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
140 |
Â
}
|
141 |
Â
}
|
142 |
Â
|
@@ -173,9 +170,11 @@ function bp_core_check_for_moderation( $user_id = 0, $title = '', $content = ''
|
|
173 |
Â
|
174 |
Â
// Check each user data for current word.
|
175 |
Â
if ( preg_match( $pattern, $post_data ) ) {
|
176 |
-
|
177 |
-
|
178 |
-
|
Â
|
|
Â
|
|
179 |
Â
}
|
180 |
Â
}
|
181 |
Â
}
|
@@ -189,17 +188,17 @@ function bp_core_check_for_moderation( $user_id = 0, $title = '', $content = ''
|
|
189 |
Â
* Check for blocked keys.
|
190 |
Â
*
|
191 |
Â
* @since 1.6.0
|
Â
|
|
192 |
Â
*
|
193 |
-
* @
|
194 |
-
* @uses bp_current_author_ua() To get current user agent.
|
195 |
-
* @uses bp_current_user_can() Allow super admins to bypass blacklist.
|
196 |
Â
*
|
197 |
-
* @param int $user_id
|
198 |
-
* @param string $title
|
199 |
-
* @param string $content
|
Â
|
|
200 |
Â
* @return bool True if test is passed, false if fail.
|
201 |
Â
*/
|
202 |
-
function bp_core_check_for_blacklist( $user_id = 0, $title = '', $content = '' ) {
|
203 |
Â
|
204 |
Â
/**
|
205 |
Â
* Filters whether or not to bypass checking for blocked keys.
|
@@ -284,9 +283,11 @@ function bp_core_check_for_blacklist( $user_id = 0, $title = '', $content = '' )
|
|
284 |
Â
|
285 |
Â
// Check each user data for current word.
|
286 |
Â
if ( preg_match( $pattern, $post_data ) ) {
|
287 |
-
|
288 |
-
|
289 |
-
|
Â
|
|
Â
|
|
290 |
Â
}
|
291 |
Â
}
|
292 |
Â
}
|
20 |
Â
*
|
21 |
Â
* @since 1.6.0
|
22 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
23 |
Â
* @param int $user_id User id to check for flood.
|
24 |
Â
* @return bool True if there is no flooding, false if there is.
|
25 |
Â
*/
|
47 |
Â
* Check for moderation keys and too many links.
|
48 |
Â
*
|
49 |
Â
* @since 1.6.0
|
50 |
+
* @since 2.6.0 Added $error_type parameter.
|
51 |
Â
*
|
52 |
+
* @param int $user_id User ID.
|
53 |
+
* @param string $title The title of the content.
|
54 |
+
* @param string $content The content being posted.
|
55 |
+
* @param string $error_type The error type to return. Either 'bool' or 'wp_error'.
|
Â
|
|
Â
|
|
Â
|
|
56 |
Â
* @return bool True if test is passed, false if fail.
|
57 |
Â
*/
|
58 |
+
function bp_core_check_for_moderation( $user_id = 0, $title = '', $content = '', $error_type = 'bool' ) {
|
59 |
Â
|
60 |
Â
/**
|
61 |
Â
* Filters whether or not to bypass checking for moderation keys and too many links.
|
129 |
Â
|
130 |
Â
// Das ist zu viele links!
|
131 |
Â
if ( $num_links >= $max_links ) {
|
132 |
+
if ( 'bool' === $error_type ) {
|
133 |
+
return false;
|
134 |
+
} else {
|
135 |
+
return new WP_Error( 'bp_moderation_too_many_links', __( 'You have posted too many links', 'buddypress' ) );
|
136 |
+
}
|
137 |
Â
}
|
138 |
Â
}
|
139 |
Â
|
170 |
Â
|
171 |
Â
// Check each user data for current word.
|
172 |
Â
if ( preg_match( $pattern, $post_data ) ) {
|
173 |
+
if ( 'bool' === $error_type ) {
|
174 |
+
return false;
|
175 |
+
} else {
|
176 |
+
return new WP_Error( 'bp_moderation_word_match', _x( 'You have posted an inappropriate word.', 'Comment moderation', 'buddypress' ) );
|
177 |
+
}
|
178 |
Â
}
|
179 |
Â
}
|
180 |
Â
}
|
188 |
Â
* Check for blocked keys.
|
189 |
Â
*
|
190 |
Â
* @since 1.6.0
|
191 |
+
* @since 2.6.0 Added $error_type parameter.
|
192 |
Â
*
|
193 |
+
* @todo Why don't we use wp_blacklist_check() for this?
|
Â
|
|
Â
|
|
194 |
Â
*
|
195 |
+
* @param int $user_id User ID.
|
196 |
+
* @param string $title The title of the content.
|
197 |
+
* @param string $content The content being posted.
|
198 |
+
* @param string $error_type The error type to return. Either 'bool' or 'wp_error'.
|
199 |
Â
* @return bool True if test is passed, false if fail.
|
200 |
Â
*/
|
201 |
+
function bp_core_check_for_blacklist( $user_id = 0, $title = '', $content = '', $error_type = 'bool' ) {
|
202 |
Â
|
203 |
Â
/**
|
204 |
Â
* Filters whether or not to bypass checking for blocked keys.
|
283 |
Â
|
284 |
Â
// Check each user data for current word.
|
285 |
Â
if ( preg_match( $pattern, $post_data ) ) {
|
286 |
+
if ( 'bool' === $error_type ) {
|
287 |
+
return false;
|
288 |
+
} else {
|
289 |
+
return new WP_Error( 'bp_moderation_blacklist_match', _x( 'You have posted an inappropriate word.', 'Comment blacklist', 'buddypress' ) );
|
290 |
+
}
|
291 |
Â
}
|
292 |
Â
}
|
293 |
Â
}
|
@@ -126,9 +126,6 @@ function bp_get_default_options() {
|
|
126 |
Â
*
|
127 |
Â
* @since 1.6.0
|
128 |
Â
*
|
129 |
-
* @uses bp_get_default_options() To get default options.
|
130 |
-
* @uses add_option() Adds default options.
|
131 |
-
* @uses do_action() Calls 'bp_add_options'.
|
132 |
Â
*/
|
133 |
Â
function bp_add_options() {
|
134 |
Â
|
@@ -160,9 +157,6 @@ function bp_add_options() {
|
|
160 |
Â
*
|
161 |
Â
* @since 1.6.0
|
162 |
Â
*
|
163 |
-
* @uses bp_get_default_options() To get default options.
|
164 |
-
* @uses delete_option() Removes default options.
|
165 |
-
* @uses do_action() Calls 'bp_delete_options'.
|
166 |
Â
*/
|
167 |
Â
function bp_delete_options() {
|
168 |
Â
|
@@ -191,9 +185,6 @@ function bp_delete_options() {
|
|
191 |
Â
*
|
192 |
Â
* @since 1.6.0
|
193 |
Â
*
|
194 |
-
* @uses bp_get_default_options() To get default options.
|
195 |
-
* @uses add_filter() To add filters to 'pre_option_{$key}'.
|
196 |
-
* @uses do_action() Calls 'bp_add_option_filters'.
|
197 |
Â
*/
|
198 |
Â
function bp_setup_option_filters() {
|
199 |
Â
|
@@ -253,8 +244,6 @@ function bp_pre_get_option( $value = false ) {
|
|
253 |
Â
*
|
254 |
Â
* @since 1.2.0
|
255 |
Â
*
|
256 |
-
* @uses bp_get_root_blog_id()
|
257 |
-
*
|
258 |
Â
* @param string $option_name The option to be retrieved.
|
259 |
Â
* @param string $default Optional. Default value to be returned if the option
|
260 |
Â
* isn't set. See {@link get_blog_option()}.
|
@@ -298,8 +287,6 @@ function bp_add_option( $option_name, $value ) {
|
|
298 |
Â
*
|
299 |
Â
* @since 1.5.0
|
300 |
Â
*
|
301 |
-
* @uses bp_get_root_blog_id()
|
302 |
-
*
|
303 |
Â
* @param string $option_name The option key to be set.
|
304 |
Â
* @param string $value The value to be set.
|
305 |
Â
* @return bool True on success, false on failure.
|
@@ -317,8 +304,6 @@ function bp_update_option( $option_name, $value ) {
|
|
317 |
Â
*
|
318 |
Â
* @since 1.5.0
|
319 |
Â
*
|
320 |
-
* @uses bp_get_root_blog_id()
|
321 |
-
*
|
322 |
Â
* @param string $option_name The option key to be deleted.
|
323 |
Â
* @return bool True on success, false on failure.
|
324 |
Â
*/
|
@@ -529,8 +514,6 @@ function bp_core_get_root_option( $option ) {
|
|
529 |
Â
*
|
530 |
Â
* @since 1.6.0
|
531 |
Â
*
|
532 |
-
* @uses bp_get_option() To get the profile sync option.
|
533 |
-
*
|
534 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
535 |
Â
* Default: true.
|
536 |
Â
* @return bool True if profile sync is enabled, otherwise false.
|
@@ -552,8 +535,6 @@ function bp_disable_profile_sync( $default = false ) {
|
|
552 |
Â
*
|
553 |
Â
* @since 1.6.0
|
554 |
Â
*
|
555 |
-
* @uses bp_get_option() To get the logged out Toolbar option.
|
556 |
-
*
|
557 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
558 |
Â
* Default: true.
|
559 |
Â
* @return bool True if the admin bar should be hidden for logged-out users,
|
@@ -576,8 +557,6 @@ function bp_hide_loggedout_adminbar( $default = true ) {
|
|
576 |
Â
*
|
577 |
Â
* @since 1.6.0
|
578 |
Â
*
|
579 |
-
* @uses bp_get_option() To get the avatar uploads option.
|
580 |
-
*
|
581 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
582 |
Â
* Default: true.
|
583 |
Â
* @return bool True if avatar uploads are disabled, otherwise false.
|
@@ -599,8 +578,6 @@ function bp_disable_avatar_uploads( $default = true ) {
|
|
599 |
Â
*
|
600 |
Â
* @since 2.4.0
|
601 |
Â
*
|
602 |
-
* @uses bp_get_option() To get the cover image uploads option.
|
603 |
-
*
|
604 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
605 |
Â
* Default: false.
|
606 |
Â
* @return bool True if cover image uploads are disabled, otherwise false.
|
@@ -656,8 +633,6 @@ function bp_disable_group_avatar_uploads( $default = null ) {
|
|
656 |
Â
*
|
657 |
Â
* @since 2.4.0
|
658 |
Â
*
|
659 |
-
* @uses bp_get_option() To get the group cover image uploads option.
|
660 |
-
*
|
661 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
662 |
Â
* Default: false.
|
663 |
Â
* @return bool True if group cover image uploads are disabled, otherwise false.
|
@@ -679,8 +654,6 @@ function bp_disable_group_cover_image_uploads( $default = false ) {
|
|
679 |
Â
*
|
680 |
Â
* @since 1.6.0
|
681 |
Â
*
|
682 |
-
* @uses bp_get_option() To get the account deletion option.
|
683 |
-
*
|
684 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
685 |
Â
* Default: true.
|
686 |
Â
* @return bool True if users are able to delete their own accounts, otherwise
|
@@ -704,7 +677,6 @@ function bp_disable_account_deletion( $default = false ) {
|
|
704 |
Â
* @since 1.6.0
|
705 |
Â
*
|
706 |
Â
* @todo split and move into blog and forum components.
|
707 |
-
* @uses bp_get_option() To get the blog/forum comments option.
|
708 |
Â
*
|
709 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
710 |
Â
* Default: false.
|
@@ -729,7 +701,6 @@ function bp_disable_blogforum_comments( $default = false ) {
|
|
729 |
Â
* @since 1.6.0
|
730 |
Â
*
|
731 |
Â
* @todo Move into groups component.
|
732 |
-
* @uses bp_get_option() To get the group creation.
|
733 |
Â
*
|
734 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
735 |
Â
* Default: true.
|
@@ -752,8 +723,6 @@ function bp_restrict_group_creation( $default = true ) {
|
|
752 |
Â
*
|
753 |
Â
* @since 1.6.0
|
754 |
Â
*
|
755 |
-
* @uses bp_get_option() To get the BuddyBar option.
|
756 |
-
*
|
757 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
758 |
Â
* Default: true.
|
759 |
Â
* @return bool True if the BuddyBar should be forced on, otherwise false.
|
@@ -785,7 +754,6 @@ function bp_group_forums_root_id( $default = '0' ) {
|
|
785 |
Â
*
|
786 |
Â
* @since 1.6.0
|
787 |
Â
*
|
788 |
-
* @uses bp_get_option() To get the root forum ID from the database.
|
789 |
Â
*
|
790 |
Â
* @param bool|string $default Optional. Default: '0'.
|
791 |
Â
* @return int The ID of the group forums root forum.
|
@@ -807,8 +775,6 @@ function bp_group_forums_root_id( $default = '0' ) {
|
|
807 |
Â
*
|
808 |
Â
* @since 1.6.0
|
809 |
Â
*
|
810 |
-
* @uses bp_get_option() To get the group forums option.
|
811 |
-
*
|
812 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
813 |
Â
* Default: true.
|
814 |
Â
* @return bool True if group forums are active, otherwise false.
|
@@ -830,8 +796,6 @@ function bp_is_group_forums_active( $default = true ) {
|
|
830 |
Â
*
|
831 |
Â
* @since 1.6.0
|
832 |
Â
*
|
833 |
-
* @uses bp_get_option() To get the Akismet option.
|
834 |
-
*
|
835 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
836 |
Â
* Default: true.
|
837 |
Â
* @return bool True if Akismet is enabled, otherwise false.
|
@@ -853,8 +817,6 @@ function bp_is_akismet_active( $default = true ) {
|
|
853 |
Â
*
|
854 |
Â
* @since 2.0.0
|
855 |
Â
*
|
856 |
-
* @uses bp_get_option() To get the Heartbeat option.
|
857 |
-
*
|
858 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
859 |
Â
* Default: true.
|
860 |
Â
* @return bool True if Heartbeat refresh is enabled, otherwise false.
|
@@ -876,8 +838,6 @@ function bp_is_activity_heartbeat_active( $default = true ) {
|
|
876 |
Â
*
|
877 |
Â
* @since 1.7.0
|
878 |
Â
*
|
879 |
-
* @uses get_option() To get the theme package option.
|
880 |
-
*
|
881 |
Â
* @param string $default Optional. Fallback value if not found in the database.
|
882 |
Â
* Default: 'legacy'.
|
883 |
Â
* @return string ID of the theme package.
|
126 |
Â
*
|
127 |
Â
* @since 1.6.0
|
128 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
129 |
Â
*/
|
130 |
Â
function bp_add_options() {
|
131 |
Â
|
157 |
Â
*
|
158 |
Â
* @since 1.6.0
|
159 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
160 |
Â
*/
|
161 |
Â
function bp_delete_options() {
|
162 |
Â
|
185 |
Â
*
|
186 |
Â
* @since 1.6.0
|
187 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
188 |
Â
*/
|
189 |
Â
function bp_setup_option_filters() {
|
190 |
Â
|
244 |
Â
*
|
245 |
Â
* @since 1.2.0
|
246 |
Â
*
|
Â
|
|
Â
|
|
247 |
Â
* @param string $option_name The option to be retrieved.
|
248 |
Â
* @param string $default Optional. Default value to be returned if the option
|
249 |
Â
* isn't set. See {@link get_blog_option()}.
|
287 |
Â
*
|
288 |
Â
* @since 1.5.0
|
289 |
Â
*
|
Â
|
|
Â
|
|
290 |
Â
* @param string $option_name The option key to be set.
|
291 |
Â
* @param string $value The value to be set.
|
292 |
Â
* @return bool True on success, false on failure.
|
304 |
Â
*
|
305 |
Â
* @since 1.5.0
|
306 |
Â
*
|
Â
|
|
Â
|
|
307 |
Â
* @param string $option_name The option key to be deleted.
|
308 |
Â
* @return bool True on success, false on failure.
|
309 |
Â
*/
|
514 |
Â
*
|
515 |
Â
* @since 1.6.0
|
516 |
Â
*
|
Â
|
|
Â
|
|
517 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
518 |
Â
* Default: true.
|
519 |
Â
* @return bool True if profile sync is enabled, otherwise false.
|
535 |
Â
*
|
536 |
Â
* @since 1.6.0
|
537 |
Â
*
|
Â
|
|
Â
|
|
538 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
539 |
Â
* Default: true.
|
540 |
Â
* @return bool True if the admin bar should be hidden for logged-out users,
|
557 |
Â
*
|
558 |
Â
* @since 1.6.0
|
559 |
Â
*
|
Â
|
|
Â
|
|
560 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
561 |
Â
* Default: true.
|
562 |
Â
* @return bool True if avatar uploads are disabled, otherwise false.
|
578 |
Â
*
|
579 |
Â
* @since 2.4.0
|
580 |
Â
*
|
Â
|
|
Â
|
|
581 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
582 |
Â
* Default: false.
|
583 |
Â
* @return bool True if cover image uploads are disabled, otherwise false.
|
633 |
Â
*
|
634 |
Â
* @since 2.4.0
|
635 |
Â
*
|
Â
|
|
Â
|
|
636 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
637 |
Â
* Default: false.
|
638 |
Â
* @return bool True if group cover image uploads are disabled, otherwise false.
|
654 |
Â
*
|
655 |
Â
* @since 1.6.0
|
656 |
Â
*
|
Â
|
|
Â
|
|
657 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
658 |
Â
* Default: true.
|
659 |
Â
* @return bool True if users are able to delete their own accounts, otherwise
|
677 |
Â
* @since 1.6.0
|
678 |
Â
*
|
679 |
Â
* @todo split and move into blog and forum components.
|
Â
|
|
680 |
Â
*
|
681 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
682 |
Â
* Default: false.
|
701 |
Â
* @since 1.6.0
|
702 |
Â
*
|
703 |
Â
* @todo Move into groups component.
|
Â
|
|
704 |
Â
*
|
705 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
706 |
Â
* Default: true.
|
723 |
Â
*
|
724 |
Â
* @since 1.6.0
|
725 |
Â
*
|
Â
|
|
Â
|
|
726 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
727 |
Â
* Default: true.
|
728 |
Â
* @return bool True if the BuddyBar should be forced on, otherwise false.
|
754 |
Â
*
|
755 |
Â
* @since 1.6.0
|
756 |
Â
*
|
Â
|
|
757 |
Â
*
|
758 |
Â
* @param bool|string $default Optional. Default: '0'.
|
759 |
Â
* @return int The ID of the group forums root forum.
|
775 |
Â
*
|
776 |
Â
* @since 1.6.0
|
777 |
Â
*
|
Â
|
|
Â
|
|
778 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
779 |
Â
* Default: true.
|
780 |
Â
* @return bool True if group forums are active, otherwise false.
|
796 |
Â
*
|
797 |
Â
* @since 1.6.0
|
798 |
Â
*
|
Â
|
|
Â
|
|
799 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
800 |
Â
* Default: true.
|
801 |
Â
* @return bool True if Akismet is enabled, otherwise false.
|
817 |
Â
*
|
818 |
Â
* @since 2.0.0
|
819 |
Â
*
|
Â
|
|
Â
|
|
820 |
Â
* @param bool $default Optional. Fallback value if not found in the database.
|
821 |
Â
* Default: true.
|
822 |
Â
* @return bool True if Heartbeat refresh is enabled, otherwise false.
|
838 |
Â
*
|
839 |
Â
* @since 1.7.0
|
840 |
Â
*
|
Â
|
|
Â
|
|
841 |
Â
* @param string $default Optional. Fallback value if not found in the database.
|
842 |
Â
* Default: 'legacy'.
|
843 |
Â
* @return string ID of the theme package.
|
@@ -44,6 +44,29 @@ function bp_register_default_taxonomies() {
|
|
44 |
Â
}
|
45 |
Â
add_action( 'bp_register_taxonomies', 'bp_register_default_taxonomies' );
|
46 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
47 |
Â
/**
|
48 |
Â
* Set taxonomy terms on a BuddyPress object.
|
49 |
Â
*
|
@@ -58,16 +81,18 @@ add_action( 'bp_register_taxonomies', 'bp_register_default_taxonomies' );
|
|
58 |
Â
* @return array Array of term taxonomy IDs.
|
59 |
Â
*/
|
60 |
Â
function bp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
|
61 |
-
$
|
62 |
Â
|
63 |
-
|
64 |
-
|
Â
|
|
65 |
Â
bp_register_taxonomies();
|
Â
|
|
66 |
Â
}
|
67 |
Â
|
68 |
Â
$retval = wp_set_object_terms( $object_id, $terms, $taxonomy, $append );
|
69 |
Â
|
70 |
-
if (
|
71 |
Â
restore_current_blog();
|
72 |
Â
}
|
73 |
Â
|
@@ -87,17 +112,28 @@ function bp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
|
|
87 |
Â
* @return array
|
88 |
Â
*/
|
89 |
Â
function bp_get_object_terms( $object_ids, $taxonomies, $args = array() ) {
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
Â
}
|
96 |
Â
|
97 |
-
$retval =
|
98 |
-
|
99 |
-
|
100 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
101 |
Â
}
|
102 |
Â
|
103 |
Â
return $retval;
|
@@ -116,16 +152,18 @@ function bp_get_object_terms( $object_ids, $taxonomies, $args = array() ) {
|
|
116 |
Â
* @return bool|WP_Error True on success, false or WP_Error on failure.
|
117 |
Â
*/
|
118 |
Â
function bp_remove_object_terms( $object_id, $terms, $taxonomy ) {
|
119 |
-
$
|
120 |
Â
|
121 |
-
|
122 |
-
|
Â
|
|
123 |
Â
bp_register_taxonomies();
|
Â
|
|
124 |
Â
}
|
125 |
Â
|
126 |
Â
$retval = wp_remove_object_terms( $object_id, $terms, $taxonomy );
|
127 |
Â
|
128 |
-
if (
|
129 |
Â
restore_current_blog();
|
130 |
Â
}
|
131 |
Â
|
44 |
Â
}
|
45 |
Â
add_action( 'bp_register_taxonomies', 'bp_register_default_taxonomies' );
|
46 |
Â
|
47 |
+
/**
|
48 |
+
* Gets the ID of the site that BP should use for taxonomy term storage.
|
49 |
+
*
|
50 |
+
* Defaults to the root blog ID.
|
51 |
+
*
|
52 |
+
* @since 2.6.0
|
53 |
+
*
|
54 |
+
* @return int
|
55 |
+
*/
|
56 |
+
function bp_get_taxonomy_term_site_id( $taxonomy = '' ) {
|
57 |
+
$site_id = bp_get_root_blog_id();
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Filters the ID of the site where BP should store taxonomy terms.
|
61 |
+
*
|
62 |
+
* @since 2.6.0
|
63 |
+
*
|
64 |
+
* @param int $site_id
|
65 |
+
* @param string $taxonomy
|
66 |
+
*/
|
67 |
+
return (int) apply_filters( 'bp_get_taxonomy_term_site_id', $site_id, $taxonomy );
|
68 |
+
}
|
69 |
+
|
70 |
Â
/**
|
71 |
Â
* Set taxonomy terms on a BuddyPress object.
|
72 |
Â
*
|
81 |
Â
* @return array Array of term taxonomy IDs.
|
82 |
Â
*/
|
83 |
Â
function bp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
|
84 |
+
$site_id = bp_get_taxonomy_term_site_id( $taxonomy );
|
85 |
Â
|
86 |
+
$switched = false;
|
87 |
+
if ( $site_id !== get_current_blog_id() ) {
|
88 |
+
switch_to_blog( $site_id );
|
89 |
Â
bp_register_taxonomies();
|
90 |
+
$switched = true;
|
91 |
Â
}
|
92 |
Â
|
93 |
Â
$retval = wp_set_object_terms( $object_id, $terms, $taxonomy, $append );
|
94 |
Â
|
95 |
+
if ( $switched ) {
|
96 |
Â
restore_current_blog();
|
97 |
Â
}
|
98 |
Â
|
112 |
Â
* @return array
|
113 |
Â
*/
|
114 |
Â
function bp_get_object_terms( $object_ids, $taxonomies, $args = array() ) {
|
115 |
+
// Different taxonomies must be stored on different sites.
|
116 |
+
$taxonomy_site_map = array();
|
117 |
+
foreach ( (array) $taxonomies as $taxonomy ) {
|
118 |
+
$taxonomy_site_id = bp_get_taxonomy_term_site_id( $taxonomy );
|
119 |
+
$taxonomy_site_map[ $taxonomy_site_id ][] = $taxonomy;
|
120 |
Â
}
|
121 |
Â
|
122 |
+
$retval = array();
|
123 |
+
foreach ( $taxonomy_site_map as $taxonomy_site_id => $site_taxonomies ) {
|
124 |
+
$switched = false;
|
125 |
+
if ( $taxonomy_site_id !== get_current_blog_id() ) {
|
126 |
+
switch_to_blog( $taxonomy_site_id );
|
127 |
+
bp_register_taxonomies();
|
128 |
+
$switched = true;
|
129 |
+
}
|
130 |
+
|
131 |
+
$site_terms = wp_get_object_terms( $object_ids, $site_taxonomies, $args );
|
132 |
+
$retval = array_merge( $retval, $site_terms );
|
133 |
+
|
134 |
+
if ( $switched ) {
|
135 |
+
restore_current_blog();
|
136 |
+
}
|
137 |
Â
}
|
138 |
Â
|
139 |
Â
return $retval;
|
152 |
Â
* @return bool|WP_Error True on success, false or WP_Error on failure.
|
153 |
Â
*/
|
154 |
Â
function bp_remove_object_terms( $object_id, $terms, $taxonomy ) {
|
155 |
+
$site_id = bp_get_taxonomy_term_site_id( $taxonomy );
|
156 |
Â
|
157 |
+
$switched = false;
|
158 |
+
if ( $site_id !== get_current_blog_id() ) {
|
159 |
+
switch_to_blog( $site_id );
|
160 |
Â
bp_register_taxonomies();
|
161 |
+
$switched = true;
|
162 |
Â
}
|
163 |
Â
|
164 |
Â
$retval = wp_remove_object_terms( $object_id, $terms, $taxonomy );
|
165 |
Â
|
166 |
+
if ( $switched ) {
|
167 |
Â
restore_current_blog();
|
168 |
Â
}
|
169 |
Â
|
@@ -19,10 +19,6 @@ defined( 'ABSPATH' ) || exit;
|
|
19 |
Â
*
|
20 |
Â
* @since 1.7.0
|
21 |
Â
*
|
22 |
-
* @uses bp_locate_template()
|
23 |
-
* @uses load_template()
|
24 |
-
* @uses get_template_part()
|
25 |
-
*
|
26 |
Â
* @param string $slug Template part slug. Used to generate filenames,
|
27 |
Â
* eg 'friends' for 'friends.php'.
|
28 |
Â
* @param string|null $name Optional. Template part name. Used to generate
|
@@ -65,6 +61,20 @@ function bp_get_template_part( $slug, $name = null ) {
|
|
65 |
Â
return bp_locate_template( $templates, true, false );
|
66 |
Â
}
|
67 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
68 |
Â
/**
|
69 |
Â
* Retrieve the name of the highest priority template file that exists.
|
70 |
Â
*
|
@@ -123,10 +133,6 @@ function bp_locate_template( $template_names, $load = false, $require_once = tru
|
|
123 |
Â
*/
|
124 |
Â
do_action( 'bp_locate_template', $located, $template_name, $template_names, $template_locations, $load, $require_once );
|
125 |
Â
|
126 |
-
// Maybe load the template if one was located.
|
127 |
-
$use_themes = defined( 'WP_USE_THEMES' ) && WP_USE_THEMES;
|
128 |
-
$doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
|
129 |
-
|
130 |
Â
/**
|
131 |
Â
* Filter here to allow/disallow template loading.
|
132 |
Â
*
|
@@ -134,15 +140,58 @@ function bp_locate_template( $template_names, $load = false, $require_once = tru
|
|
134 |
Â
*
|
135 |
Â
* @param bool $value True to load the template, false otherwise.
|
136 |
Â
*/
|
137 |
-
$load_template = (bool) apply_filters( 'bp_locate_template_and_load',
|
138 |
Â
|
139 |
-
if ( $load_template &&
|
140 |
Â
load_template( $located, $require_once );
|
141 |
Â
}
|
142 |
Â
|
143 |
Â
return $located;
|
144 |
Â
}
|
145 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
146 |
Â
/**
|
147 |
Â
* Register a new template stack location.
|
148 |
Â
*
|
@@ -303,10 +352,6 @@ function bp_buffer_template_part( $slug, $name = null, $echo = true ) {
|
|
303 |
Â
*
|
304 |
Â
* @since 1.7.0
|
305 |
Â
*
|
306 |
-
* @uses bp_set_theme_compat_templates()
|
307 |
-
* @uses bp_locate_template()
|
308 |
-
* @uses bp_set_theme_compat_template()
|
309 |
-
*
|
310 |
Â
* @param string $type Filename without extension.
|
311 |
Â
* @param array $templates An optional list of template candidates.
|
312 |
Â
* @return string Full path to file.
|
@@ -517,7 +562,6 @@ function bp_is_template_included() {
|
|
517 |
Â
* @since 1.7.0
|
518 |
Â
*
|
519 |
Â
* @global string $pagenow
|
520 |
-
* @uses bp_locate_template()
|
521 |
Â
*/
|
522 |
Â
function bp_load_theme_functions() {
|
523 |
Â
global $pagenow, $wp_query;
|
19 |
Â
*
|
20 |
Â
* @since 1.7.0
|
21 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
22 |
Â
* @param string $slug Template part slug. Used to generate filenames,
|
23 |
Â
* eg 'friends' for 'friends.php'.
|
24 |
Â
* @param string|null $name Optional. Template part name. Used to generate
|
61 |
Â
return bp_locate_template( $templates, true, false );
|
62 |
Â
}
|
63 |
Â
|
64 |
+
/**
|
65 |
+
* Get an asset template part.
|
66 |
+
*
|
67 |
+
* Basically the same as {@link bp_get_template_part()}, but with 'assets/'
|
68 |
+
* prepended to the slug.
|
69 |
+
*
|
70 |
+
* @since 2.6.0
|
71 |
+
*
|
72 |
+
* @see bp_get_template_part() for full documentation.
|
73 |
+
*/
|
74 |
+
function bp_get_asset_template_part( $slug, $name = null ) {
|
75 |
+
return bp_get_template_part( "assets/{$slug}", $name );
|
76 |
+
}
|
77 |
+
|
78 |
Â
/**
|
79 |
Â
* Retrieve the name of the highest priority template file that exists.
|
80 |
Â
*
|
133 |
Â
*/
|
134 |
Â
do_action( 'bp_locate_template', $located, $template_name, $template_names, $template_locations, $load, $require_once );
|
135 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
136 |
Â
/**
|
137 |
Â
* Filter here to allow/disallow template loading.
|
138 |
Â
*
|
140 |
Â
*
|
141 |
Â
* @param bool $value True to load the template, false otherwise.
|
142 |
Â
*/
|
143 |
+
$load_template = (bool) apply_filters( 'bp_locate_template_and_load', true );
|
144 |
Â
|
145 |
+
if ( $load_template && $load && ! empty( $located ) ) {
|
146 |
Â
load_template( $located, $require_once );
|
147 |
Â
}
|
148 |
Â
|
149 |
Â
return $located;
|
150 |
Â
}
|
151 |
Â
|
152 |
+
/**
|
153 |
+
* Get file data of the highest priority asset that exists.
|
154 |
+
*
|
155 |
+
* Similar to {@link bp_locate_template()}, but for files like CSS and JS.
|
156 |
+
*
|
157 |
+
* @since 2.6.0
|
158 |
+
*
|
159 |
+
* @param string Relative filename to search for.
|
160 |
+
* @return array|bool Array of asset data if one is located (includes absolute filepath and URI).
|
161 |
+
* Boolean false on failure.
|
162 |
+
*/
|
163 |
+
function bp_locate_template_asset( $filename ) {
|
164 |
+
// Ensure assets can be located when running from /src/.
|
165 |
+
if ( defined( 'BP_SOURCE_SUBDIRECTORY' ) && 'src' === BP_SOURCE_SUBDIRECTORY ) {
|
166 |
+
$filename = str_replace( '.min', '', $filename );
|
167 |
+
}
|
168 |
+
|
169 |
+
// Use bp_locate_template() to find our asset.
|
170 |
+
$located = bp_locate_template( $filename, false );
|
171 |
+
if ( false === $located ) {
|
172 |
+
return false;
|
173 |
+
}
|
174 |
+
|
175 |
+
// Set up data array.
|
176 |
+
$data = array();
|
177 |
+
$data['file'] = $data['uri'] = $located;
|
178 |
+
|
179 |
+
$find = array(
|
180 |
+
get_theme_root(),
|
181 |
+
buddypress()->plugin_dir
|
182 |
+
);
|
183 |
+
|
184 |
+
$replace = array(
|
185 |
+
get_theme_root_uri(),
|
186 |
+
buddypress()->plugin_url
|
187 |
+
);
|
188 |
+
|
189 |
+
// Make sure URI path is relative to site URL.
|
190 |
+
$data['uri'] = str_replace( $find, $replace, $data['uri'] );
|
191 |
+
|
192 |
+
return $data;
|
193 |
+
}
|
194 |
+
|
195 |
Â
/**
|
196 |
Â
* Register a new template stack location.
|
197 |
Â
*
|
352 |
Â
*
|
353 |
Â
* @since 1.7.0
|
354 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
355 |
Â
* @param string $type Filename without extension.
|
356 |
Â
* @param array $templates An optional list of template candidates.
|
357 |
Â
* @return string Full path to file.
|
562 |
Â
* @since 1.7.0
|
563 |
Â
*
|
564 |
Â
* @global string $pagenow
|
Â
|
|
565 |
Â
*/
|
566 |
Â
function bp_load_theme_functions() {
|
567 |
Â
global $pagenow, $wp_query;
|
@@ -13,7 +13,7 @@ defined( 'ABSPATH' ) || exit;
|
|
13 |
Â
/**
|
14 |
Â
* Output the "options nav", the secondary-level single item navigation menu.
|
15 |
Â
*
|
16 |
-
* Uses the
|
17 |
Â
* current component. Each component adds to its sub navigation array within
|
18 |
Â
* its own setup_nav() function.
|
19 |
Â
*
|
@@ -26,7 +26,6 @@ defined( 'ABSPATH' ) || exit;
|
|
26 |
Â
*
|
27 |
Â
* @since 1.0.0
|
28 |
Â
*
|
29 |
-
* @uses bp_get_user_nav() Renders the navigation for a profile of a currently
|
30 |
Â
* viewed user.
|
31 |
Â
*
|
32 |
Â
* @param string $parent_slug Options nav slug.
|
@@ -40,35 +39,50 @@ function bp_get_options_nav( $parent_slug = '' ) {
|
|
40 |
Â
$component_index = !empty( $bp->displayed_user ) ? bp_current_component() : bp_get_root_slug( bp_current_component() );
|
41 |
Â
$selected_item = bp_current_action();
|
42 |
Â
|
Â
|
|
43 |
Â
if ( ! bp_is_single_item() ) {
|
44 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
45 |
Â
return false;
|
46 |
-
} else {
|
47 |
-
$the_index = $component_index;
|
48 |
Â
}
|
Â
|
|
Â
|
|
49 |
Â
} else {
|
50 |
Â
$current_item = bp_current_item();
|
Â
|
|
51 |
Â
|
Â
|
|
52 |
Â
if ( ! empty( $parent_slug ) ) {
|
53 |
Â
$current_item = $parent_slug;
|
54 |
Â
$selected_item = bp_action_variable( 0 );
|
55 |
Â
}
|
56 |
Â
|
57 |
-
|
58 |
-
|
Â
|
|
59 |
Â
} else {
|
60 |
-
$
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
61 |
Â
}
|
62 |
Â
}
|
63 |
Â
|
64 |
Â
// Loop through each navigation item.
|
65 |
-
foreach (
|
66 |
-
if ( empty( $subnav_item
|
67 |
Â
continue;
|
68 |
Â
}
|
69 |
Â
|
70 |
Â
// If the current action or an action variable matches the nav item id, then add a highlight CSS class.
|
71 |
-
if ( $subnav_item
|
72 |
Â
$selected = ' class="current selected"';
|
73 |
Â
} else {
|
74 |
Â
$selected = '';
|
@@ -88,7 +102,7 @@ function bp_get_options_nav( $parent_slug = '' ) {
|
|
88 |
Â
* @param array $subnav_item Submenu array item being displayed.
|
89 |
Â
* @param string $selected_item Current action.
|
90 |
Â
*/
|
91 |
-
echo apply_filters( 'bp_get_options_nav_' . $subnav_item
|
92 |
Â
}
|
93 |
Â
}
|
94 |
Â
|
@@ -769,14 +783,8 @@ function bp_button( $args = '' ) {
|
|
769 |
Â
* This function is borrowed from CakePHP v2.0, under the MIT license. See
|
770 |
Â
* http://book.cakephp.org/view/1469/Text#truncate-1625
|
771 |
Â
*
|
772 |
-
* ### Options:
|
773 |
-
*
|
774 |
-
* - `ending` Will be used as Ending and appended to the trimmed string.
|
775 |
-
* - `exact` If false, $text will not be cut mid-word.
|
776 |
-
* - `html` If true, HTML tags would be handled correctly.
|
777 |
-
* - `filter_shortcodes` If true, shortcodes will be stripped before truncating.
|
778 |
-
*
|
779 |
Â
* @since 1.0.0
|
Â
|
|
780 |
Â
*
|
781 |
Â
* @param string $text String to truncate.
|
782 |
Â
* @param int $length Optional. Length of returned string, including ellipsis.
|
@@ -791,6 +799,10 @@ function bp_button( $args = '' ) {
|
|
791 |
Â
* excerpt length. Default: true.
|
792 |
Â
* @type bool $filter_shortcodes If true, shortcodes will be stripped.
|
793 |
Â
* Default: true.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
794 |
Â
* }
|
795 |
Â
* @return string Trimmed string.
|
796 |
Â
*/
|
@@ -803,7 +815,9 @@ function bp_create_excerpt( $text, $length = 225, $options = array() ) {
|
|
803 |
Â
'ending' => __( ' […]', 'buddypress' ),
|
804 |
Â
'exact' => false,
|
805 |
Â
'html' => true,
|
806 |
-
'filter_shortcodes' => $filter_shortcodes_default
|
Â
|
|
Â
|
|
807 |
Â
), 'create_excerpt' );
|
808 |
Â
|
809 |
Â
// Save the original text, to be passed along to the filter.
|
@@ -889,8 +903,28 @@ function bp_create_excerpt( $text, $length = 225, $options = array() ) {
|
|
889 |
Â
}
|
890 |
Â
}
|
891 |
Â
} else {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
892 |
Â
if ( mb_strlen( $text ) <= $length ) {
|
893 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
894 |
Â
} else {
|
895 |
Â
$truncate = mb_substr( $text, 0, $length - mb_strlen( $ending ) );
|
896 |
Â
}
|
@@ -971,16 +1005,7 @@ function bp_create_excerpt( $text, $length = 225, $options = array() ) {
|
|
971 |
Â
}
|
972 |
Â
}
|
973 |
Â
|
974 |
-
/**
|
975 |
-
* Filters the final generated excerpt.
|
976 |
-
*
|
977 |
-
* @since 1.1.0
|
978 |
-
*
|
979 |
-
* @param string $truncate Generated excerpt.
|
980 |
-
* @param string $original_text Original text provided.
|
981 |
-
* @param int $length Length of returned string, including ellipsis.
|
982 |
-
* @param array $options Array of HTML attributes and options.
|
983 |
-
*/
|
984 |
Â
return apply_filters( 'bp_create_excerpt', $truncate, $original_text, $length, $options );
|
985 |
Â
}
|
986 |
Â
add_filter( 'bp_create_excerpt', 'stripslashes_deep' );
|
@@ -1468,7 +1493,6 @@ function bp_user_has_access() {
|
|
1468 |
Â
*
|
1469 |
Â
* @since 1.5.0
|
1470 |
Â
*
|
1471 |
-
* @uses bp_get_search_slug()
|
1472 |
Â
*/
|
1473 |
Â
function bp_search_slug() {
|
1474 |
Â
echo bp_get_search_slug();
|
@@ -1497,8 +1521,6 @@ function bp_search_slug() {
|
|
1497 |
Â
*
|
1498 |
Â
* @since 1.0.0
|
1499 |
Â
*
|
1500 |
-
* @uses apply_filters() Filter 'bp_displayed_user_id' to change this value.
|
1501 |
-
*
|
1502 |
Â
* @return int $id ID of the currently displayed user.
|
1503 |
Â
*/
|
1504 |
Â
function bp_displayed_user_id() {
|
@@ -1522,8 +1544,6 @@ function bp_displayed_user_id() {
|
|
1522 |
Â
*
|
1523 |
Â
* @since 1.0.0
|
1524 |
Â
*
|
1525 |
-
* @uses apply_filters() Filter 'bp_loggedin_user_id' to change this value.
|
1526 |
-
*
|
1527 |
Â
* @return int ID of the logged-in user.
|
1528 |
Â
*/
|
1529 |
Â
function bp_loggedin_user_id() {
|
@@ -2255,6 +2275,19 @@ function bp_is_user() {
|
|
2255 |
Â
return (bool) bp_displayed_user_id();
|
2256 |
Â
}
|
2257 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2258 |
Â
/**
|
2259 |
Â
* Is the current page a user's activity stream page?
|
2260 |
Â
*
|
@@ -3010,24 +3043,36 @@ function bp_get_title_parts( $seplocation = 'right' ) {
|
|
3010 |
Â
// Set empty subnav name.
|
3011 |
Â
$component_subnav_name = '';
|
3012 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3013 |
Â
// Use the component nav name.
|
3014 |
-
if ( ! empty( $
|
3015 |
-
$component_name = _bp_strip_spans_from_title( $
|
3016 |
Â
|
3017 |
Â
// Fall back on the component ID.
|
3018 |
Â
} elseif ( ! empty( $bp->{$component_id}->id ) ) {
|
3019 |
Â
$component_name = ucwords( $bp->{$component_id}->id );
|
3020 |
Â
}
|
3021 |
Â
|
3022 |
-
|
3023 |
-
|
3024 |
-
|
Â
|
|
Â
|
|
3025 |
Â
|
3026 |
-
if (
|
3027 |
-
$
|
3028 |
Â
}
|
3029 |
Â
}
|
3030 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3031 |
Â
// If on the user profile's landing page, just use the fullname.
|
3032 |
Â
if ( bp_is_current_component( $bp->default_component ) && ( bp_get_requested_url() === bp_displayed_user_domain() ) ) {
|
3033 |
Â
$bp_title_parts[] = $displayed_user_name;
|
@@ -3045,14 +3090,28 @@ function bp_get_title_parts( $seplocation = 'right' ) {
|
|
3045 |
Â
}
|
3046 |
Â
}
|
3047 |
Â
|
3048 |
-
// A single
|
3049 |
-
} elseif ( bp_is_active( 'groups' ) && ! empty( $bp->groups->current_group ) && ! empty( $bp->bp_options_nav[ $bp->groups->current_group->slug ] ) ) {
|
3050 |
-
$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'] : '';
|
3051 |
-
$bp_title_parts = array( $bp->bp_options_title, $subnav );
|
3052 |
-
|
3053 |
-
// A single item from a component other than groups.
|
3054 |
Â
} elseif ( bp_is_single_item() ) {
|
3055 |
-
$
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3056 |
Â
|
3057 |
Â
// An index or directory.
|
3058 |
Â
} elseif ( bp_is_directory() ) {
|
@@ -3428,79 +3487,58 @@ function _bp_nav_menu_sort( $a, $b ) {
|
|
3428 |
Â
* Get the items registered in the primary and secondary BuddyPress navigation menus.
|
3429 |
Â
*
|
3430 |
Â
* @since 1.7.0
|
Â
|
|
3431 |
Â
*
|
Â
|
|
3432 |
Â
* @return array A multidimensional array of all navigation items.
|
3433 |
Â
*/
|
3434 |
-
function bp_get_nav_menu_items() {
|
3435 |
-
$
|
3436 |
-
|
3437 |
-
// Get the second level menus.
|
3438 |
-
foreach ( (array) buddypress()->bp_options_nav as $parent_menu => $sub_menus ) {
|
3439 |
-
|
3440 |
-
// The root menu's ID is "xprofile", but the Profile submenus are using "profile". See BP_Core::setup_nav().
|
3441 |
-
if ( 'profile' === $parent_menu ) {
|
3442 |
-
$parent_menu = 'xprofile';
|
3443 |
-
}
|
3444 |
-
|
3445 |
-
// Sort the items in this menu's navigation by their position property.
|
3446 |
-
$second_level_menus = (array) $sub_menus;
|
3447 |
-
usort( $second_level_menus, '_bp_nav_menu_sort' );
|
3448 |
Â
|
3449 |
-
|
3450 |
-
|
3451 |
-
|
3452 |
-
// Skip items we don't have access to.
|
3453 |
-
if ( empty( $sub_nav['user_has_access'] ) ) {
|
3454 |
-
continue;
|
3455 |
-
}
|
3456 |
-
|
3457 |
-
// Add this menu.
|
3458 |
-
$menu = new stdClass;
|
3459 |
-
$menu->class = array( 'menu-child' );
|
3460 |
-
$menu->css_id = $sub_nav['css_id'];
|
3461 |
-
$menu->link = $sub_nav['link'];
|
3462 |
-
$menu->name = $sub_nav['name'];
|
3463 |
-
$menu->parent = $parent_menu; // Associate this sub nav with a top-level menu.
|
3464 |
-
|
3465 |
-
// If we're viewing this item's screen, record that we need to mark its parent menu to be selected.
|
3466 |
-
if ( $sub_nav['slug'] == bp_current_action() ) {
|
3467 |
-
$menu->class[] = 'current-menu-item';
|
3468 |
-
$selected_menus[] = $parent_menu;
|
3469 |
-
}
|
3470 |
-
|
3471 |
-
$menus[] = $menu;
|
3472 |
-
}
|
3473 |
Â
}
|
3474 |
Â
|
3475 |
-
// Get the
|
3476 |
-
|
3477 |
-
usort( $top_level_menus, '_bp_nav_menu_sort' );
|
3478 |
-
|
3479 |
-
// Iterate through the top-level menus.
|
3480 |
-
foreach ( $top_level_menus as $nav ) {
|
3481 |
-
|
3482 |
-
// Skip items marked as user-specific if you're not on your own profile.
|
3483 |
-
if ( empty( $nav['show_for_displayed_user'] ) && ! bp_core_can_edit_settings() ) {
|
3484 |
-
continue;
|
3485 |
-
}
|
3486 |
-
|
3487 |
Â
// Get the correct menu link. See https://buddypress.trac.wordpress.org/ticket/4624.
|
3488 |
-
$link = bp_loggedin_user_domain() ? str_replace( bp_loggedin_user_domain(), bp_displayed_user_domain(), $
|
3489 |
Â
|
3490 |
Â
// Add this menu.
|
3491 |
Â
$menu = new stdClass;
|
3492 |
Â
$menu->class = array( 'menu-parent' );
|
3493 |
-
$menu->css_id = $
|
3494 |
Â
$menu->link = $link;
|
3495 |
-
$menu->name = $
|
3496 |
Â
$menu->parent = 0;
|
3497 |
Â
|
3498 |
-
|
3499 |
-
|
3500 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3501 |
Â
}
|
3502 |
Â
|
3503 |
Â
$menus[] = $menu;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3504 |
Â
}
|
3505 |
Â
|
3506 |
Â
/**
|
13 |
Â
/**
|
14 |
Â
* Output the "options nav", the secondary-level single item navigation menu.
|
15 |
Â
*
|
16 |
+
* Uses the component's nav global to render out the sub navigation for the
|
17 |
Â
* current component. Each component adds to its sub navigation array within
|
18 |
Â
* its own setup_nav() function.
|
19 |
Â
*
|
26 |
Â
*
|
27 |
Â
* @since 1.0.0
|
28 |
Â
*
|
Â
|
|
29 |
Â
* viewed user.
|
30 |
Â
*
|
31 |
Â
* @param string $parent_slug Options nav slug.
|
39 |
Â
$component_index = !empty( $bp->displayed_user ) ? bp_current_component() : bp_get_root_slug( bp_current_component() );
|
40 |
Â
$selected_item = bp_current_action();
|
41 |
Â
|
42 |
+
// Default to the Members nav.
|
43 |
Â
if ( ! bp_is_single_item() ) {
|
44 |
+
// Set the parent slug, if not provided.
|
45 |
+
if ( empty( $parent_slug ) ) {
|
46 |
+
$parent_slug = $component_index;
|
47 |
+
}
|
48 |
+
|
49 |
+
$secondary_nav_items = $bp->members->nav->get_secondary( array( 'parent_slug' => $parent_slug ) );
|
50 |
+
|
51 |
+
if ( ! $secondary_nav_items ) {
|
52 |
Â
return false;
|
Â
|
|
Â
|
|
53 |
Â
}
|
54 |
+
|
55 |
+
// For a single item, try to use the component's nav.
|
56 |
Â
} else {
|
57 |
Â
$current_item = bp_current_item();
|
58 |
+
$single_item_component = bp_current_component();
|
59 |
Â
|
60 |
+
// Adjust the selected nav item for the current single item if needed.
|
61 |
Â
if ( ! empty( $parent_slug ) ) {
|
62 |
Â
$current_item = $parent_slug;
|
63 |
Â
$selected_item = bp_action_variable( 0 );
|
64 |
Â
}
|
65 |
Â
|
66 |
+
// If the nav is not defined by the parent component, look in the Members nav.
|
67 |
+
if ( ! isset( $bp->{$single_item_component}->nav ) ) {
|
68 |
+
$secondary_nav_items = $bp->members->nav->get_secondary( array( 'parent_slug' => $current_item ) );
|
69 |
Â
} else {
|
70 |
+
$secondary_nav_items = $bp->{$single_item_component}->nav->get_secondary( array( 'parent_slug' => $current_item ) );
|
71 |
+
}
|
72 |
+
|
73 |
+
if ( ! $secondary_nav_items ) {
|
74 |
+
return false;
|
75 |
Â
}
|
76 |
Â
}
|
77 |
Â
|
78 |
Â
// Loop through each navigation item.
|
79 |
+
foreach ( $secondary_nav_items as $subnav_item ) {
|
80 |
+
if ( empty( $subnav_item->user_has_access ) ) {
|
81 |
Â
continue;
|
82 |
Â
}
|
83 |
Â
|
84 |
Â
// If the current action or an action variable matches the nav item id, then add a highlight CSS class.
|
85 |
+
if ( $subnav_item->slug === $selected_item ) {
|
86 |
Â
$selected = ' class="current selected"';
|
87 |
Â
} else {
|
88 |
Â
$selected = '';
|
102 |
Â
* @param array $subnav_item Submenu array item being displayed.
|
103 |
Â
* @param string $selected_item Current action.
|
104 |
Â
*/
|
105 |
+
echo apply_filters( 'bp_get_options_nav_' . $subnav_item->css_id, '<li id="' . esc_attr( $subnav_item->css_id . '-' . $list_type . '-li' ) . '" ' . $selected . '><a id="' . esc_attr( $subnav_item->css_id ) . '" href="' . esc_url( $subnav_item->link ) . '">' . $subnav_item->name . '</a></li>', $subnav_item, $selected_item );
|
106 |
Â
}
|
107 |
Â
}
|
108 |
Â
|
783 |
Â
* This function is borrowed from CakePHP v2.0, under the MIT license. See
|
784 |
Â
* http://book.cakephp.org/view/1469/Text#truncate-1625
|
785 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
786 |
Â
* @since 1.0.0
|
787 |
+
* @since 2.6.0 Added 'strip_tags' and 'remove_links' as $options args.
|
788 |
Â
*
|
789 |
Â
* @param string $text String to truncate.
|
790 |
Â
* @param int $length Optional. Length of returned string, including ellipsis.
|
799 |
Â
* excerpt length. Default: true.
|
800 |
Â
* @type bool $filter_shortcodes If true, shortcodes will be stripped.
|
801 |
Â
* Default: true.
|
802 |
+
* @type bool $strip_tags If true, HTML tags will be stripped. Default: false.
|
803 |
+
* Only applicable if $html is set to false.
|
804 |
+
* @type bool $remove_links If true, URLs will be stripped. Default: false.
|
805 |
+
* Only applicable if $html is set to false.
|
806 |
Â
* }
|
807 |
Â
* @return string Trimmed string.
|
808 |
Â
*/
|
815 |
Â
'ending' => __( ' […]', 'buddypress' ),
|
816 |
Â
'exact' => false,
|
817 |
Â
'html' => true,
|
818 |
+
'filter_shortcodes' => $filter_shortcodes_default,
|
819 |
+
'strip_tags' => false,
|
820 |
+
'remove_links' => false,
|
821 |
Â
), 'create_excerpt' );
|
822 |
Â
|
823 |
Â
// Save the original text, to be passed along to the filter.
|
903 |
Â
}
|
904 |
Â
}
|
905 |
Â
} else {
|
906 |
+
// Strip HTML tags if necessary.
|
907 |
+
if ( ! empty( $r['strip_tags'] ) ) {
|
908 |
+
$text = strip_tags( $text );
|
909 |
+
}
|
910 |
+
|
911 |
+
// Remove links if necessary.
|
912 |
+
if ( ! empty( $r['remove_links'] ) ) {
|
913 |
+
$text = preg_replace( '#^\s*(https?://[^\s"]+)\s*$#im', '', $text );
|
914 |
+
}
|
915 |
+
|
916 |
Â
if ( mb_strlen( $text ) <= $length ) {
|
917 |
+
/**
|
918 |
+
* Filters the final generated excerpt.
|
919 |
+
*
|
920 |
+
* @since 1.1.0
|
921 |
+
*
|
922 |
+
* @param string $truncate Generated excerpt.
|
923 |
+
* @param string $original_text Original text provided.
|
924 |
+
* @param int $length Length of returned string, including ellipsis.
|
925 |
+
* @param array $options Array of HTML attributes and options.
|
926 |
+
*/
|
927 |
+
return apply_filters( 'bp_create_excerpt', $text, $original_text, $length, $options );
|
928 |
Â
} else {
|
929 |
Â
$truncate = mb_substr( $text, 0, $length - mb_strlen( $ending ) );
|
930 |
Â
}
|
1005 |
Â
}
|
1006 |
Â
}
|
1007 |
Â
|
1008 |
+
/** This filter is documented in /bp-core/bp-core-template.php */
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1009 |
Â
return apply_filters( 'bp_create_excerpt', $truncate, $original_text, $length, $options );
|
1010 |
Â
}
|
1011 |
Â
add_filter( 'bp_create_excerpt', 'stripslashes_deep' );
|
1493 |
Â
*
|
1494 |
Â
* @since 1.5.0
|
1495 |
Â
*
|
Â
|
|
1496 |
Â
*/
|
1497 |
Â
function bp_search_slug() {
|
1498 |
Â
echo bp_get_search_slug();
|
1521 |
Â
*
|
1522 |
Â
* @since 1.0.0
|
1523 |
Â
*
|
Â
|
|
Â
|
|
1524 |
Â
* @return int $id ID of the currently displayed user.
|
1525 |
Â
*/
|
1526 |
Â
function bp_displayed_user_id() {
|
1544 |
Â
*
|
1545 |
Â
* @since 1.0.0
|
1546 |
Â
*
|
Â
|
|
Â
|
|
1547 |
Â
* @return int ID of the logged-in user.
|
1548 |
Â
*/
|
1549 |
Â
function bp_loggedin_user_id() {
|
2275 |
Â
return (bool) bp_displayed_user_id();
|
2276 |
Â
}
|
2277 |
Â
|
2278 |
+
/**
|
2279 |
+
* Is the current page a user custom front page?
|
2280 |
+
*
|
2281 |
+
* Will return true anytime there is a custom front page for the displayed user.
|
2282 |
+
*
|
2283 |
+
* @since 2.6.0
|
2284 |
+
*
|
2285 |
+
* @return bool True if the current page is a user custom front page.
|
2286 |
+
*/
|
2287 |
+
function bp_is_user_front() {
|
2288 |
+
return (bool) ( bp_is_user() && bp_is_current_component( 'front' ) );
|
2289 |
+
}
|
2290 |
+
|
2291 |
Â
/**
|
2292 |
Â
* Is the current page a user's activity stream page?
|
2293 |
Â
*
|
3043 |
Â
// Set empty subnav name.
|
3044 |
Â
$component_subnav_name = '';
|
3045 |
Â
|
3046 |
+
if ( ! empty( $bp->members->nav ) ) {
|
3047 |
+
$primary_nav_item = $bp->members->nav->get_primary( array( 'slug' => $component_id ), false );
|
3048 |
+
$primary_nav_item = reset( $primary_nav_item );
|
3049 |
+
}
|
3050 |
+
|
3051 |
Â
// Use the component nav name.
|
3052 |
+
if ( ! empty( $primary_nav_item->name ) ) {
|
3053 |
+
$component_name = _bp_strip_spans_from_title( $primary_nav_item->name );
|
3054 |
Â
|
3055 |
Â
// Fall back on the component ID.
|
3056 |
Â
} elseif ( ! empty( $bp->{$component_id}->id ) ) {
|
3057 |
Â
$component_name = ucwords( $bp->{$component_id}->id );
|
3058 |
Â
}
|
3059 |
Â
|
3060 |
+
if ( ! empty( $bp->members->nav ) ) {
|
3061 |
+
$secondary_nav_item = $bp->members->nav->get_secondary( array(
|
3062 |
+
'parent_slug' => $component_id,
|
3063 |
+
'slug' => bp_current_action()
|
3064 |
+
), false );
|
3065 |
Â
|
3066 |
+
if ( $secondary_nav_item ) {
|
3067 |
+
$secondary_nav_item = reset( $secondary_nav_item );
|
3068 |
Â
}
|
3069 |
Â
}
|
3070 |
Â
|
3071 |
+
// Append action name if we're on a member component sub-page.
|
3072 |
+
if ( ! empty( $secondary_nav_item->name ) && ! empty( $bp->canonical_stack['action'] ) ) {
|
3073 |
+
$component_subnav_name = $secondary_nav_item->name;
|
3074 |
+
}
|
3075 |
+
|
3076 |
Â
// If on the user profile's landing page, just use the fullname.
|
3077 |
Â
if ( bp_is_current_component( $bp->default_component ) && ( bp_get_requested_url() === bp_displayed_user_domain() ) ) {
|
3078 |
Â
$bp_title_parts[] = $displayed_user_name;
|
3090 |
Â
}
|
3091 |
Â
}
|
3092 |
Â
|
3093 |
+
// A single item from a component other than Members.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3094 |
Â
} elseif ( bp_is_single_item() ) {
|
3095 |
+
$component_id = bp_current_component();
|
3096 |
+
|
3097 |
+
if ( ! empty( $bp->{$component_id}->nav ) ) {
|
3098 |
+
$secondary_nav_item = $bp->{$component_id}->nav->get_secondary( array(
|
3099 |
+
'parent_slug' => bp_current_item(),
|
3100 |
+
'slug' => bp_current_action()
|
3101 |
+
), false );
|
3102 |
+
|
3103 |
+
if ( $secondary_nav_item ) {
|
3104 |
+
$secondary_nav_item = reset( $secondary_nav_item );
|
3105 |
+
}
|
3106 |
+
}
|
3107 |
+
|
3108 |
+
$single_item_subnav = '';
|
3109 |
+
|
3110 |
+
if ( ! empty( $secondary_nav_item->name ) ) {
|
3111 |
+
$single_item_subnav = $secondary_nav_item->name;
|
3112 |
+
}
|
3113 |
+
|
3114 |
+
$bp_title_parts = array( $bp->bp_options_title, $single_item_subnav );
|
3115 |
Â
|
3116 |
Â
// An index or directory.
|
3117 |
Â
} elseif ( bp_is_directory() ) {
|
3487 |
Â
* Get the items registered in the primary and secondary BuddyPress navigation menus.
|
3488 |
Â
*
|
3489 |
Â
* @since 1.7.0
|
3490 |
+
* @since 2.6.0 Introduced the `$component` parameter.
|
3491 |
Â
*
|
3492 |
+
* @param string $component Optional. Component whose nav items are being fetched.
|
3493 |
Â
* @return array A multidimensional array of all navigation items.
|
3494 |
Â
*/
|
3495 |
+
function bp_get_nav_menu_items( $component = 'members' ) {
|
3496 |
+
$bp = buddypress();
|
3497 |
+
$menus = array();
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3498 |
Â
|
3499 |
+
if ( ! isset( $bp->{$component}->nav ) ) {
|
3500 |
+
return $menus;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3501 |
Â
}
|
3502 |
Â
|
3503 |
+
// Get the item nav and build the menus.
|
3504 |
+
foreach ( $bp->{$component}->nav->get_item_nav() as $nav_menu ) {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3505 |
Â
// Get the correct menu link. See https://buddypress.trac.wordpress.org/ticket/4624.
|
3506 |
+
$link = bp_loggedin_user_domain() ? str_replace( bp_loggedin_user_domain(), bp_displayed_user_domain(), $nav_menu->link ) : trailingslashit( bp_displayed_user_domain() . $nav_menu->link );
|
3507 |
Â
|
3508 |
Â
// Add this menu.
|
3509 |
Â
$menu = new stdClass;
|
3510 |
Â
$menu->class = array( 'menu-parent' );
|
3511 |
+
$menu->css_id = $nav_menu->css_id;
|
3512 |
Â
$menu->link = $link;
|
3513 |
+
$menu->name = $nav_menu->name;
|
3514 |
Â
$menu->parent = 0;
|
3515 |
Â
|
3516 |
+
if ( ! empty( $nav_menu->children ) ) {
|
3517 |
+
$submenus = array();
|
3518 |
+
|
3519 |
+
foreach( $nav_menu->children as $sub_menu ) {
|
3520 |
+
$submenu = new stdClass;
|
3521 |
+
$submenu->class = array( 'menu-child' );
|
3522 |
+
$submenu->css_id = $sub_menu->css_id;
|
3523 |
+
$submenu->link = $sub_menu->link;
|
3524 |
+
$submenu->name = $sub_menu->name;
|
3525 |
+
$submenu->parent = $nav_menu->slug;
|
3526 |
+
|
3527 |
+
// If we're viewing this item's screen, record that we need to mark its parent menu to be selected.
|
3528 |
+
if ( $sub_menu->slug == bp_current_action() ) {
|
3529 |
+
$menu->class[] = 'current-menu-parent';
|
3530 |
+
$submenu->class[] = 'current-menu-item';
|
3531 |
+
}
|
3532 |
+
|
3533 |
+
$submenus[] = $submenu;
|
3534 |
+
}
|
3535 |
Â
}
|
3536 |
Â
|
3537 |
Â
$menus[] = $menu;
|
3538 |
+
|
3539 |
+
if ( ! empty( $submenus ) ) {
|
3540 |
+
$menus = array_merge( $menus, $submenus );
|
3541 |
+
}
|
3542 |
Â
}
|
3543 |
Â
|
3544 |
Â
/**
|
@@ -24,7 +24,9 @@ defined( 'ABSPATH' ) || exit;
|
|
24 |
Â
|
25 |
Â
/** Base Class ****************************************************************/
|
26 |
Â
|
27 |
-
|
Â
|
|
Â
|
|
28 |
Â
|
29 |
Â
/** Functions *****************************************************************/
|
30 |
Â
|
@@ -55,8 +57,6 @@ function bp_setup_theme_compat( $theme = '' ) {
|
|
55 |
Â
*
|
56 |
Â
* @since 1.7.0
|
57 |
Â
*
|
58 |
-
* @uses apply_filters()
|
59 |
-
*
|
60 |
Â
* @return string ID of the theme package in use.
|
61 |
Â
*/
|
62 |
Â
function bp_get_theme_compat_id() {
|
@@ -79,8 +79,6 @@ function bp_get_theme_compat_id() {
|
|
79 |
Â
*
|
80 |
Â
* @since 1.7.0
|
81 |
Â
*
|
82 |
-
* @uses apply_filters()
|
83 |
-
*
|
84 |
Â
* @return string Name of the theme package currently in use.
|
85 |
Â
*/
|
86 |
Â
function bp_get_theme_compat_name() {
|
@@ -103,8 +101,6 @@ function bp_get_theme_compat_name() {
|
|
103 |
Â
*
|
104 |
Â
* @since 1.7.0
|
105 |
Â
*
|
106 |
-
* @uses apply_filters()
|
107 |
-
*
|
108 |
Â
* @return string The version string of the theme package currently in use.
|
109 |
Â
*/
|
110 |
Â
function bp_get_theme_compat_version() {
|
@@ -127,8 +123,6 @@ function bp_get_theme_compat_version() {
|
|
127 |
Â
*
|
128 |
Â
* @since 1.7.0
|
129 |
Â
*
|
130 |
-
* @uses apply_filters()
|
131 |
-
*
|
132 |
Â
* @return string The absolute path of the theme package currently in use.
|
133 |
Â
*/
|
134 |
Â
function bp_get_theme_compat_dir() {
|
@@ -152,8 +146,6 @@ function bp_get_theme_compat_dir() {
|
|
152 |
Â
*
|
153 |
Â
* @since 1.7.0
|
154 |
Â
*
|
155 |
-
* @uses apply_filters()
|
156 |
-
*
|
157 |
Â
* @return string URL of the theme package currently in use.
|
158 |
Â
*/
|
159 |
Â
function bp_get_theme_compat_url() {
|
@@ -176,8 +168,6 @@ function bp_get_theme_compat_url() {
|
|
176 |
Â
*
|
177 |
Â
* @since 1.9.0
|
178 |
Â
*
|
179 |
-
* @uses bp_detect_theme_compat_with_current_theme()
|
180 |
-
*
|
181 |
Â
* @return bool True if the current theme needs theme compatibility.
|
182 |
Â
*/
|
183 |
Â
function bp_use_theme_compat_with_current_theme() {
|
@@ -676,28 +666,14 @@ function bp_theme_compat_reset_post( $args = array() ) {
|
|
676 |
Â
*
|
677 |
Â
* @since 1.7.0
|
678 |
Â
*
|
679 |
-
* @uses bp_is_single_user() To check if page is single user.
|
680 |
-
* @uses bp_get_single_user_template() To get user template.
|
681 |
-
* @uses bp_is_single_user_edit() To check if page is single user edit.
|
682 |
-
* @uses bp_get_single_user_edit_template() To get user edit template.
|
683 |
-
* @uses bp_is_single_view() To check if page is single view.
|
684 |
-
* @uses bp_get_single_view_template() To get view template.
|
685 |
-
* @uses bp_is_forum_edit() To check if page is forum edit.
|
686 |
-
* @uses bp_get_forum_edit_template() To get forum edit template.
|
687 |
-
* @uses bp_is_topic_merge() To check if page is topic merge.
|
688 |
-
* @uses bp_get_topic_merge_template() To get topic merge template.
|
689 |
-
* @uses bp_is_topic_split() To check if page is topic split.
|
690 |
-
* @uses bp_get_topic_split_template() To get topic split template.
|
691 |
-
* @uses bp_is_topic_edit() To check if page is topic edit.
|
692 |
-
* @uses bp_get_topic_edit_template() To get topic edit template.
|
693 |
-
* @uses bp_is_reply_edit() To check if page is reply edit.
|
694 |
-
* @uses bp_get_reply_edit_template() To get reply edit template.
|
695 |
-
* @uses bp_set_theme_compat_template() To set the global theme compat template.
|
696 |
-
*
|
697 |
Â
* @param string $template Template name.
|
698 |
Â
* @return string $template Template name.
|
699 |
Â
*/
|
700 |
Â
function bp_template_include_theme_compat( $template = '' ) {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
701 |
Â
|
702 |
Â
// If the current theme doesn't need theme compat, bail at this point.
|
703 |
Â
if ( ! bp_use_theme_compat_with_current_theme() ) {
|
24 |
Â
|
25 |
Â
/** Base Class ****************************************************************/
|
26 |
Â
|
27 |
+
if ( ! buddypress()->do_autoload ) {
|
28 |
+
require dirname( __FILE__ ) . '/classes/class-bp-theme-compat.php';
|
29 |
+
}
|
30 |
Â
|
31 |
Â
/** Functions *****************************************************************/
|
32 |
Â
|
57 |
Â
*
|
58 |
Â
* @since 1.7.0
|
59 |
Â
*
|
Â
|
|
Â
|
|
60 |
Â
* @return string ID of the theme package in use.
|
61 |
Â
*/
|
62 |
Â
function bp_get_theme_compat_id() {
|
79 |
Â
*
|
80 |
Â
* @since 1.7.0
|
81 |
Â
*
|
Â
|
|
Â
|
|
82 |
Â
* @return string Name of the theme package currently in use.
|
83 |
Â
*/
|
84 |
Â
function bp_get_theme_compat_name() {
|
101 |
Â
*
|
102 |
Â
* @since 1.7.0
|
103 |
Â
*
|
Â
|
|
Â
|
|
104 |
Â
* @return string The version string of the theme package currently in use.
|
105 |
Â
*/
|
106 |
Â
function bp_get_theme_compat_version() {
|
123 |
Â
*
|
124 |
Â
* @since 1.7.0
|
125 |
Â
*
|
Â
|
|
Â
|
|
126 |
Â
* @return string The absolute path of the theme package currently in use.
|
127 |
Â
*/
|
128 |
Â
function bp_get_theme_compat_dir() {
|
146 |
Â
*
|
147 |
Â
* @since 1.7.0
|
148 |
Â
*
|
Â
|
|
Â
|
|
149 |
Â
* @return string URL of the theme package currently in use.
|
150 |
Â
*/
|
151 |
Â
function bp_get_theme_compat_url() {
|
168 |
Â
*
|
169 |
Â
* @since 1.9.0
|
170 |
Â
*
|
Â
|
|
Â
|
|
171 |
Â
* @return bool True if the current theme needs theme compatibility.
|
172 |
Â
*/
|
173 |
Â
function bp_use_theme_compat_with_current_theme() {
|
666 |
Â
*
|
667 |
Â
* @since 1.7.0
|
668 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
669 |
Â
* @param string $template Template name.
|
670 |
Â
* @return string $template Template name.
|
671 |
Â
*/
|
672 |
Â
function bp_template_include_theme_compat( $template = '' ) {
|
673 |
+
// If embed template, bail.
|
674 |
+
if ( true === function_exists( 'is_embed' ) && is_embed() ) {
|
675 |
+
return $template;
|
676 |
+
}
|
677 |
Â
|
678 |
Â
// If the current theme doesn't need theme compat, bail at this point.
|
679 |
Â
if ( ! bp_use_theme_compat_with_current_theme() ) {
|
@@ -17,9 +17,6 @@ defined( 'ABSPATH' ) || exit;
|
|
17 |
Â
*
|
18 |
Â
* @since 1.7.0
|
19 |
Â
*
|
20 |
-
* @uses get_option()
|
21 |
-
* @uses bp_get_db_version() To get BuddyPress's database version.
|
22 |
-
*
|
23 |
Â
* @return bool True if this is a fresh BP install, otherwise false.
|
24 |
Â
*/
|
25 |
Â
function bp_is_install() {
|
@@ -35,9 +32,6 @@ function bp_is_install() {
|
|
35 |
Â
*
|
36 |
Â
* @since 1.6.0
|
37 |
Â
*
|
38 |
-
* @uses get_option()
|
39 |
-
* @uses bp_get_db_version() To get BuddyPress's database version.
|
40 |
-
*
|
41 |
Â
* @return bool True if update, otherwise false.
|
42 |
Â
*/
|
43 |
Â
function bp_is_update() {
|
@@ -58,8 +52,6 @@ function bp_is_update() {
|
|
58 |
Â
*
|
59 |
Â
* @since 1.6.0
|
60 |
Â
*
|
61 |
-
* @uses buddypress()
|
62 |
-
*
|
63 |
Â
* @param string $basename BuddyPress basename.
|
64 |
Â
* @return bool True if activating BuddyPress, false if not.
|
65 |
Â
*/
|
@@ -104,8 +96,6 @@ function bp_is_activation( $basename = '' ) {
|
|
104 |
Â
*
|
105 |
Â
* @since 1.6.0
|
106 |
Â
*
|
107 |
-
* @uses buddypress()
|
108 |
-
*
|
109 |
Â
* @param string $basename BuddyPress basename.
|
110 |
Â
* @return bool True if deactivating BuddyPress, false if not.
|
111 |
Â
*/
|
@@ -150,8 +140,6 @@ function bp_is_deactivation( $basename = '' ) {
|
|
150 |
Â
*
|
151 |
Â
* @since 1.6.0
|
152 |
Â
*
|
153 |
-
* @uses bp_get_db_version() To get BuddyPress's database version.
|
154 |
-
* @uses bp_update_option() To update BuddyPress's database version.
|
155 |
Â
*/
|
156 |
Â
function bp_version_bump() {
|
157 |
Â
bp_update_option( '_bp_db_version', bp_get_db_version() );
|
@@ -519,7 +507,6 @@ function bp_update_to_2_5() {
|
|
519 |
Â
* @since 2.2.0
|
520 |
Â
*
|
521 |
Â
* @global $wpdb
|
522 |
-
* @uses buddypress()
|
523 |
Â
*/
|
524 |
Â
function bp_migrate_new_member_activity_component() {
|
525 |
Â
global $wpdb;
|
@@ -553,7 +540,6 @@ function bp_migrate_new_member_activity_component() {
|
|
553 |
Â
*
|
554 |
Â
* @since 2.2.0
|
555 |
Â
*
|
556 |
-
* @uses bp_activity_delete() to delete the corresponding friendship activities.
|
557 |
Â
*/
|
558 |
Â
function bp_cleanup_friendship_activities() {
|
559 |
Â
bp_activity_delete( array(
|
@@ -570,7 +556,6 @@ function bp_cleanup_friendship_activities() {
|
|
570 |
Â
*
|
571 |
Â
* @internal Used internally to redirect BuddyPress to the about page on activation.
|
572 |
Â
*
|
573 |
-
* @uses set_transient() To drop the activation transient for 30 seconds.
|
574 |
Â
*/
|
575 |
Â
function bp_add_activation_redirect() {
|
576 |
Â
|
@@ -640,7 +625,6 @@ function bp_core_maybe_install_signups() {
|
|
640 |
Â
*
|
641 |
Â
* @since 1.6.0
|
642 |
Â
*
|
643 |
-
* @uses do_action() Calls 'bp_activation' hook.
|
644 |
Â
*/
|
645 |
Â
function bp_activation() {
|
646 |
Â
|
@@ -670,7 +654,6 @@ function bp_activation() {
|
|
670 |
Â
*
|
671 |
Â
* @since 1.6.0
|
672 |
Â
*
|
673 |
-
* @uses do_action() Calls 'bp_deactivation' hook.
|
674 |
Â
*/
|
675 |
Â
function bp_deactivation() {
|
676 |
Â
|
@@ -705,7 +688,6 @@ function bp_deactivation() {
|
|
705 |
Â
*
|
706 |
Â
* @since 1.6.0
|
707 |
Â
*
|
708 |
-
* @uses do_action() Calls 'bp_uninstall' hook.
|
709 |
Â
*/
|
710 |
Â
function bp_uninstall() {
|
711 |
Â
|
17 |
Â
*
|
18 |
Â
* @since 1.7.0
|
19 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
20 |
Â
* @return bool True if this is a fresh BP install, otherwise false.
|
21 |
Â
*/
|
22 |
Â
function bp_is_install() {
|
32 |
Â
*
|
33 |
Â
* @since 1.6.0
|
34 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
35 |
Â
* @return bool True if update, otherwise false.
|
36 |
Â
*/
|
37 |
Â
function bp_is_update() {
|
52 |
Â
*
|
53 |
Â
* @since 1.6.0
|
54 |
Â
*
|
Â
|
|
Â
|
|
55 |
Â
* @param string $basename BuddyPress basename.
|
56 |
Â
* @return bool True if activating BuddyPress, false if not.
|
57 |
Â
*/
|
96 |
Â
*
|
97 |
Â
* @since 1.6.0
|
98 |
Â
*
|
Â
|
|
Â
|
|
99 |
Â
* @param string $basename BuddyPress basename.
|
100 |
Â
* @return bool True if deactivating BuddyPress, false if not.
|
101 |
Â
*/
|
140 |
Â
*
|
141 |
Â
* @since 1.6.0
|
142 |
Â
*
|
Â
|
|
Â
|
|
143 |
Â
*/
|
144 |
Â
function bp_version_bump() {
|
145 |
Â
bp_update_option( '_bp_db_version', bp_get_db_version() );
|
507 |
Â
* @since 2.2.0
|
508 |
Â
*
|
509 |
Â
* @global $wpdb
|
Â
|
|
510 |
Â
*/
|
511 |
Â
function bp_migrate_new_member_activity_component() {
|
512 |
Â
global $wpdb;
|
540 |
Â
*
|
541 |
Â
* @since 2.2.0
|
542 |
Â
*
|
Â
|
|
543 |
Â
*/
|
544 |
Â
function bp_cleanup_friendship_activities() {
|
545 |
Â
bp_activity_delete( array(
|
556 |
Â
*
|
557 |
Â
* @internal Used internally to redirect BuddyPress to the about page on activation.
|
558 |
Â
*
|
Â
|
|
559 |
Â
*/
|
560 |
Â
function bp_add_activation_redirect() {
|
561 |
Â
|
625 |
Â
*
|
626 |
Â
* @since 1.6.0
|
627 |
Â
*
|
Â
|
|
628 |
Â
*/
|
629 |
Â
function bp_activation() {
|
630 |
Â
|
654 |
Â
*
|
655 |
Â
* @since 1.6.0
|
656 |
Â
*
|
Â
|
|
657 |
Â
*/
|
658 |
Â
function bp_deactivation() {
|
659 |
Â
|
688 |
Â
*
|
689 |
Â
* @since 1.6.0
|
690 |
Â
*
|
Â
|
|
691 |
Â
*/
|
692 |
Â
function bp_uninstall() {
|
693 |
Â
|
@@ -10,7 +10,9 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Register bp-core widgets.
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-core-login-widget.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Register bp-core widgets.
|
@@ -82,9 +82,6 @@ class BP_Admin {
|
|
82 |
Â
*
|
83 |
Â
* @since 1.6.0
|
84 |
Â
*
|
85 |
-
* @uses BP_Admin::setup_globals() Setup the globals needed.
|
86 |
-
* @uses BP_Admin::includes() Include the required files.
|
87 |
-
* @uses BP_Admin::setup_actions() Setup the hooks and actions.
|
88 |
Â
*/
|
89 |
Â
public function __construct() {
|
90 |
Â
$this->setup_globals();
|
@@ -120,7 +117,10 @@ class BP_Admin {
|
|
120 |
Â
* @since 1.6.0
|
121 |
Â
*/
|
122 |
Â
private function includes() {
|
123 |
-
|
Â
|
|
Â
|
|
Â
|
|
124 |
Â
require( $this->admin_dir . 'bp-core-admin-actions.php' );
|
125 |
Â
require( $this->admin_dir . 'bp-core-admin-settings.php' );
|
126 |
Â
require( $this->admin_dir . 'bp-core-admin-functions.php' );
|
@@ -134,8 +134,6 @@ class BP_Admin {
|
|
134 |
Â
*
|
135 |
Â
* @since 1.6.0
|
136 |
Â
*
|
137 |
-
* @uses add_action() To add various actions.
|
138 |
-
* @uses add_filter() To add various filters.
|
139 |
Â
*/
|
140 |
Â
private function setup_actions() {
|
141 |
Â
|
@@ -171,6 +169,10 @@ class BP_Admin {
|
|
171 |
Â
// On non-multisite, catch.
|
172 |
Â
add_action( 'load-users.php', 'bp_core_admin_user_manage_spammers' );
|
173 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
174 |
Â
/* Filters ***********************************************************/
|
175 |
Â
|
176 |
Â
// Add link to settings page.
|
@@ -192,8 +194,6 @@ class BP_Admin {
|
|
192 |
Â
*
|
193 |
Â
* @since 1.6.0
|
194 |
Â
*
|
195 |
-
* @uses add_management_page() To add the Recount page in Tools section.
|
196 |
-
* @uses add_options_page() To add the Forums settings page in Settings
|
197 |
Â
* section.
|
198 |
Â
*/
|
199 |
Â
public function admin_menus() {
|
@@ -374,9 +374,6 @@ class BP_Admin {
|
|
374 |
Â
*
|
375 |
Â
* @since 1.6.0
|
376 |
Â
*
|
377 |
-
* @uses add_settings_section() To add our own settings section.
|
378 |
-
* @uses add_settings_field() To add various settings fields.
|
379 |
-
* @uses register_setting() To register various settings.
|
380 |
Â
*/
|
381 |
Â
public function register_admin_settings() {
|
382 |
Â
|
@@ -555,6 +552,11 @@ class BP_Admin {
|
|
555 |
Â
* @since 1.7.0
|
556 |
Â
*/
|
557 |
Â
public function about_screen() {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
558 |
Â
?>
|
559 |
Â
|
560 |
Â
<div class="wrap about-wrap">
|
@@ -612,15 +614,28 @@ class BP_Admin {
|
|
612 |
Â
|
613 |
Â
<?php endif; ?>
|
614 |
Â
|
615 |
-
<div class="headline-feature">
|
616 |
-
<h3 class="headline-title"><?php esc_html_e( '
|
617 |
Â
|
618 |
-
|
619 |
-
|
620 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
621 |
Â
|
622 |
-
<p class="introduction"><?php _e( '
|
623 |
-
<p><?php _e( '
|
624 |
Â
|
625 |
Â
<div class="clear"></div>
|
626 |
Â
</div>
|
@@ -628,50 +643,49 @@ class BP_Admin {
|
|
628 |
Â
<hr />
|
629 |
Â
|
630 |
Â
<div class="bp-features-section">
|
Â
|
|
631 |
Â
|
632 |
-
<div class="feature
|
633 |
-
<
|
634 |
-
|
635 |
-
|
636 |
-
<p><?php esc_html_e( 'New Activity functions help you track post type comments in sync with the Blogs component when activated.', 'buddypress' ); ?></p>
|
637 |
-
</div>
|
638 |
-
<div class="last-feature">
|
639 |
-
<h3 class="feature-title"><?php esc_html_e( 'Twenty Twelve Companion Stylesheet', 'buddypress' ); ?></h3>
|
640 |
-
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/twentytwelve.png' ); ?>" alt="<?php esc_attr_e( 'BuddyPress styles Twenty Twelve', 'buddypress' ); ?>">
|
641 |
-
<p><?php esc_html_e( 'BuddyPress components never looked so fine as they do now in the Twenty Twelve theme.', 'buddypress' ); ?></p>
|
642 |
-
</div>
|
643 |
Â
</div>
|
644 |
Â
|
645 |
-
<div class="feature
|
646 |
-
<
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
Â
|
651 |
-
|
652 |
-
<
|
653 |
-
|
654 |
-
|
655 |
-
<p><?php _e( 'Administrators can enable or disable autolink settings for each new profile field type.', 'buddypress' ); ?></p>
|
656 |
-
</div>
|
657 |
Â
</div>
|
658 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
659 |
Â
</div>
|
660 |
Â
|
661 |
-
<div class="changelog">
|
662 |
Â
<h3 class="changelog-title"><?php esc_html_e( 'Under The Hood', 'buddypress' ); ?></h3>
|
663 |
Â
|
664 |
-
<div class="
|
665 |
Â
<div>
|
Â
|
|
Â
|
|
666 |
Â
<h4 class="title"><?php esc_html_e( 'Localization Improvements', 'buddypress' ); ?></h4>
|
667 |
-
<p><?php esc_html_e( '
|
668 |
-
<h4 class="title"><?php esc_html_e( 'Accessibility Upgrades', 'buddypress' ); ?></h4>
|
669 |
-
<p><?php esc_html_e( 'Continued improvements in the frontend and backend to make BuddyPress usable for everyone.', 'buddypress' ); ?></p>
|
670 |
Â
</div>
|
671 |
Â
|
672 |
Â
<div class="last-feature">
|
673 |
-
<h4 class="title"><?php esc_html_e( '
|
674 |
-
<p><?php esc_html_e( '
|
Â
|
|
Â
|
|
675 |
Â
<h4 class="title"><?php esc_html_e( 'Developer Reference', 'buddypress' ); ?></h4>
|
676 |
Â
<p><?php esc_html_e( 'Regular updates to inline code documentation make it easier for developers to understand how BuddyPress works.', 'buddypress' ); ?></p>
|
677 |
Â
</div>
|
@@ -679,9 +693,11 @@ class BP_Admin {
|
|
679 |
Â
|
680 |
Â
</div>
|
681 |
Â
|
682 |
-
<
|
Â
|
|
683 |
Â
|
684 |
-
|
Â
|
|
685 |
Â
|
686 |
Â
</div>
|
687 |
Â
|
@@ -787,40 +803,48 @@ class BP_Admin {
|
|
787 |
Â
|
788 |
Â
<h3 class="wp-people-group"><?php printf( esc_html__( 'Contributors to BuddyPress %s', 'buddypress' ), self::display_version() ); ?></h3>
|
789 |
Â
<p class="wp-credits-list">
|
Â
|
|
790 |
Â
<a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
|
791 |
-
<a href="https://profiles.wordpress.org/sbrajesh/">Brajesh Singh (sbrajesh)</a>,
|
792 |
Â
<a href="https://profiles.wordpress.org/thebrandonallen/">Brandon Allen (thebrandonallen)</a>,
|
793 |
-
<a href="https://profiles.wordpress.org/
|
794 |
-
<a href="https://profiles.wordpress.org/timersys/">Damian (timersys)</a>,
|
795 |
Â
<a href="https://profiles.wordpress.org/danbrellis/">danbrellis</a>,
|
796 |
Â
<a href="https://profiles.wordpress.org/dcavins/">David Cavins (dcavins)</a>,
|
797 |
Â
<a href="https://profiles.wordpress.org/wpdennis/">Dennis (wpdennis)</a>,
|
Â
|
|
798 |
Â
<a href="https://profiles.wordpress.org/wdfee/">Fee (wdfee)</a>,
|
799 |
Â
<a href="https://profiles.wordpress.org/garrett-eclipse/">Garrett Hyder (garrett-eclipse)</a>,
|
Â
|
|
800 |
Â
<a href="https://profiles.wordpress.org/Mamaduka/">George Mamadashvili (Mamaduka)</a>,
|
801 |
Â
<a href="https://profiles.wordpress.org/henrywright/">Henry Wright (henry.wright)</a>,
|
802 |
Â
<a href="https://profiles.wordpress.org/hnla/">Hugo (hnla)</a>,
|
803 |
-
<a href="https://profiles.wordpress.org/jeffsayre/">Jeff Sayre (jeffsayre)</a>,
|
804 |
Â
<a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
|
805 |
-
<a href="https://profiles.wordpress.org/
|
806 |
-
<a href="https://profiles.wordpress.org/joost-abrahams/">Joost Abrahams (joost-abrahams)</a>,
|
807 |
-
<a href="https://profiles.wordpress.org/kennibc/">kennibc</a>,
|
808 |
Â
<a href="https://profiles.wordpress.org/sooskriszta/">OC2PS (sooskriszta)</a>,
|
Â
|
|
809 |
Â
<a href="https://profiles.wordpress.org/Offereins">Laurens Offereins (Offereins)</a>,
|
810 |
-
<a href="https://profiles.wordpress.org/
|
811 |
Â
<a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
|
812 |
Â
<a href="https://profiles.wordpress.org/mercime/">mercime</a>,
|
813 |
Â
<a href="https://profiles.wordpress.org/tw2113/">Michael Beckwith (tw2113)</a>,
|
Â
|
|
814 |
Â
<a href="https://profiles.wordpress.org/modemlooper/">modemlooper</a>,
|
Â
|
|
Â
|
|
Â
|
|
815 |
Â
<a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
|
816 |
Â
<a href="https://profiles.wordpress.org/ramiy/">Rami Yushuvaev (ramiy)</a>,
|
817 |
Â
<a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
|
818 |
-
<a href="https://profiles.wordpress.org/
|
Â
|
|
Â
|
|
Â
|
|
819 |
Â
<a href="https://profiles.wordpress.org/slaffik/">Slava UA (slaffik)</a>,
|
820 |
-
<a href="https://profiles.wordpress.org/jozik/">Srdjan (jozik)</a>,
|
821 |
Â
<a href="https://profiles.wordpress.org/netweb/">Stephen Edgar (netweb)</a>,
|
822 |
-
<a href="https://profiles.wordpress.org/
|
823 |
-
<a href="https://profiles.wordpress.org/
|
Â
|
|
Â
|
|
Â
|
|
824 |
Â
</p>
|
825 |
Â
|
826 |
Â
<h3 class="wp-people-group"><?php _e( '💖With our thanks to these Open Source projects💖', 'buddypress' ); ?></h3>
|
@@ -829,6 +853,7 @@ class BP_Admin {
|
|
829 |
Â
<a href="https://bbpress.org">bbPress</a>,
|
830 |
Â
<a href="https://github.com/ichord/Caret.js">Caret.js</a>,
|
831 |
Â
<a href="http://tedgoas.github.io/Cerberus/">Cerberus</a>,
|
Â
|
|
832 |
Â
<a href="https://github.com/carhartl/jquery-cookie">jquery.cookie</a>,
|
833 |
Â
<a href="https://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a>,
|
834 |
Â
<a href="https://wordpress.org">WordPress</a>.
|
@@ -891,6 +916,47 @@ class BP_Admin {
|
|
891 |
Â
<?php
|
892 |
Â
}
|
893 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
894 |
Â
/** Helpers ***************************************************************/
|
895 |
Â
|
896 |
Â
/**
|
82 |
Â
*
|
83 |
Â
* @since 1.6.0
|
84 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
85 |
Â
*/
|
86 |
Â
public function __construct() {
|
87 |
Â
$this->setup_globals();
|
117 |
Â
* @since 1.6.0
|
118 |
Â
*/
|
119 |
Â
private function includes() {
|
120 |
+
if ( ! buddypress()->do_autoload ) {
|
121 |
+
require( $this->admin_dir . 'bp-core-admin-classes.php' );
|
122 |
+
}
|
123 |
+
|
124 |
Â
require( $this->admin_dir . 'bp-core-admin-actions.php' );
|
125 |
Â
require( $this->admin_dir . 'bp-core-admin-settings.php' );
|
126 |
Â
require( $this->admin_dir . 'bp-core-admin-functions.php' );
|
134 |
Â
*
|
135 |
Â
* @since 1.6.0
|
136 |
Â
*
|
Â
|
|
Â
|
|
137 |
Â
*/
|
138 |
Â
private function setup_actions() {
|
139 |
Â
|
169 |
Â
// On non-multisite, catch.
|
170 |
Â
add_action( 'load-users.php', 'bp_core_admin_user_manage_spammers' );
|
171 |
Â
|
172 |
+
// Emails.
|
173 |
+
add_filter( 'manage_' . bp_get_email_post_type() . '_posts_columns', array( $this, 'emails_register_situation_column' ) );
|
174 |
+
add_action( 'manage_' . bp_get_email_post_type() . '_posts_custom_column', array( $this, 'emails_display_situation_column_data' ), 10, 2 );
|
175 |
+
|
176 |
Â
/* Filters ***********************************************************/
|
177 |
Â
|
178 |
Â
// Add link to settings page.
|
194 |
Â
*
|
195 |
Â
* @since 1.6.0
|
196 |
Â
*
|
Â
|
|
Â
|
|
197 |
Â
* section.
|
198 |
Â
*/
|
199 |
Â
public function admin_menus() {
|
374 |
Â
*
|
375 |
Â
* @since 1.6.0
|
376 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
377 |
Â
*/
|
378 |
Â
public function register_admin_settings() {
|
379 |
Â
|
552 |
Â
* @since 1.7.0
|
553 |
Â
*/
|
554 |
Â
public function about_screen() {
|
555 |
+
$embedded_activity = '';
|
556 |
+
|
557 |
+
if ( version_compare( $GLOBALS['wp_version'], '4.5', '>=' ) ) {
|
558 |
+
$embedded_activity = wp_oembed_get( 'https://buddypress.org/members/djpaul/activity/573821/' );
|
559 |
+
}
|
560 |
Â
?>
|
561 |
Â
|
562 |
Â
<div class="wrap about-wrap">
|
614 |
Â
|
615 |
Â
<?php endif; ?>
|
616 |
Â
|
617 |
+
<div class="bp-headline-feature">
|
618 |
+
<h3 class="headline-title"><?php esc_html_e( 'Activity Embeds', 'buddypress' ); ?></h3>
|
619 |
Â
|
620 |
+
<?php if ( $embedded_activity ) :
|
621 |
+
wp_enqueue_script( 'wp-embed' );
|
622 |
+
?>
|
623 |
+
<div class="embed-container">
|
624 |
+
<?php echo $embedded_activity ; ?>
|
625 |
+
</div>
|
626 |
+
|
627 |
+
<?php else : ?>
|
628 |
+
|
629 |
+
<div class="featured-image">
|
630 |
+
<a href="http://wordpress.tv/2016/06/15/buddypress-2-6-introducing-buddypress-activity-embeds/" title="<?php esc_attr_e( 'View the Activity Embeds demo', 'buddypress' ); ?>">
|
631 |
+
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/activity-embeds.png' ); ?>" alt="<?php esc_attr_e( 'Embed activities into your WordPress posts or pages.', 'buddypress' ); ?>">
|
632 |
+
</a>
|
633 |
+
</div>
|
634 |
+
|
635 |
+
<?php endif ; ?>
|
636 |
Â
|
637 |
+
<p class="introduction"><?php _e( 'Embed activities into your WordPress posts or pages.', 'buddypress' ); ?> </p>
|
638 |
+
<p><?php _e( 'Copy the permalink URL of the activity of your choice, paste it into the content editor of your WordPress post or page, and <em>voilà </em>!, you've embedded an activity update.', 'buddypress' ); ?> <a href="http://wordpress.tv/2016/06/15/buddypress-2-6-introducing-buddypress-activity-embeds/"><?php esc_html_e( 'View the Activity Embeds demo', 'buddypress' ); ?></a></p>
|
639 |
Â
|
640 |
Â
<div class="clear"></div>
|
641 |
Â
</div>
|
643 |
Â
<hr />
|
644 |
Â
|
645 |
Â
<div class="bp-features-section">
|
646 |
+
<h3 class="headline-title"><?php esc_html_e( 'Features', 'buddypress' ); ?></h3>
|
647 |
Â
|
648 |
+
<div class="bp-feature">
|
649 |
+
<h4 class="feature-title"><?php esc_html_e( 'Custom Front Page for Member Profile ', 'buddypress' ); ?></h4>
|
650 |
+
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/user-frontpage.png' ); ?>" alt="<?php esc_attr_e( 'A member custom front page using widgets.', 'buddypress' ); ?>">
|
651 |
+
<p><?php _e( 'Theme developers or site owners can create custom front pages for their community's members by adding a <code>front.php</code> template to their template overrides. A specific template hierarchy is also available to make them even more unique.', 'buddypress' ); ?> <a href="https://bpdevel.wordpress.com/2016/05/24/custom-front-pages-for-your-users-profiles/"><?php esc_html_e( 'Read all about this new feature.', 'buddypress' ); ?></a></p>
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
652 |
Â
</div>
|
653 |
Â
|
654 |
+
<div class="bp-feature opposite">
|
655 |
+
<h4 class="feature-title"><?php esc_html_e( 'Group Types API', 'buddypress' ); ?></h4>
|
656 |
+
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/group-type-pop.png' ); ?>" alt="<?php esc_attr_e( 'Group types metabox in Groups admin page.', 'buddypress' ); ?>">
|
657 |
+
<p><?php esc_html_e( 'Registering group types finally enables a strict separation of different and explicit types of groups. This new feature is available to plugin developers starting with BuddyPress 2.6.', 'buddypress' ); ?> <a href="https://codex.buddypress.org/developer/group-types/"><?php esc_html_e( 'Learn how to set up Group Types.', 'buddypress' ); ?></a></p>
|
658 |
+
</div>
|
659 |
Â
|
660 |
+
<div class="bp-feature">
|
661 |
+
<h4 class="feature-title"><?php esc_html_e( 'New Navigation API', 'buddypress' ); ?></h4>
|
662 |
+
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/new-nav-api.png' ); ?>" alt="<?php esc_attr_e( 'Sample code for using the new navigation API', 'buddypress' ); ?>">
|
663 |
+
<p><?php esc_html_e( 'The member and group navigation system has been totally rewritten, making it easier than ever to customize BuddyPress nav items.', 'buddypress' ); ?> <a href="https://buddypress.trac.wordpress.org/changeset/10745"><?php esc_html_e( 'Read the informative commit message.', 'buddypress' ); ?></a></p>
|
Â
|
|
Â
|
|
664 |
Â
</div>
|
665 |
Â
|
666 |
+
<div class="bp-feature opposite">
|
667 |
+
<h4 class="feature-title"><?php esc_html_e( 'Stylesheets for Twenty Eleven and Twenty Ten', 'buddypress' ); ?></h4>
|
668 |
+
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/admin/images/default-themes.png' ); ?>" alt="<?php esc_attr_e( 'Styled BuddyPress components in Twenty Eleven and Twenty Ten', 'buddypress' ); ?>">
|
669 |
+
<p><?php esc_html_e( 'BuddyPress feels right at home now in the classic default themes, Twenty Ten and Twenty Eleven.', 'buddypress' ); ?></p>
|
670 |
+
</div>
|
671 |
Â
</div>
|
672 |
Â
|
673 |
+
<div class="bp-changelog-section">
|
674 |
Â
<h3 class="changelog-title"><?php esc_html_e( 'Under The Hood', 'buddypress' ); ?></h3>
|
675 |
Â
|
676 |
+
<div class="bp-changelog col two-col">
|
677 |
Â
<div>
|
678 |
+
<h4 class="title"><?php esc_html_e( 'Performance Enhancements', 'buddypress' ); ?></h4>
|
679 |
+
<p><?php esc_html_e( 'Class autoloading reduces the memory needed to run BuddyPress on your server. Improved caching strategies for group membership statuses mean fewer round trips to your overworked database server.', 'buddypress' ); ?></p>
|
680 |
Â
<h4 class="title"><?php esc_html_e( 'Localization Improvements', 'buddypress' ); ?></h4>
|
681 |
+
<p><?php esc_html_e( 'Improved localization strings and comments help translators do their much-appreciated work: making BuddyPress available in many languages.', 'buddypress' ); ?></p>
|
Â
|
|
Â
|
|
682 |
Â
</div>
|
683 |
Â
|
684 |
Â
<div class="last-feature">
|
685 |
+
<h4 class="title"><?php esc_html_e( 'Notifications Updates', 'buddypress' ); ?></h4>
|
686 |
+
<p><?php esc_html_e( 'Adjustments to the notifications component allow members to receive timely and relevant updates about activity in your community.', 'buddypress' ); ?></p>
|
687 |
+
<h4 class="title"><?php esc_html_e( 'Accessibility Upgrades', 'buddypress' ); ?></h4>
|
688 |
+
<p><?php esc_html_e( 'Continued improvements help make BuddyPress' back- and front-end screens usable for everyone (and on more devices).', 'buddypress' ); ?></p>
|
689 |
Â
<h4 class="title"><?php esc_html_e( 'Developer Reference', 'buddypress' ); ?></h4>
|
690 |
Â
<p><?php esc_html_e( 'Regular updates to inline code documentation make it easier for developers to understand how BuddyPress works.', 'buddypress' ); ?></p>
|
691 |
Â
</div>
|
693 |
Â
|
694 |
Â
</div>
|
695 |
Â
|
696 |
+
<div class="bp-assets">
|
697 |
+
<p><?php _ex( 'Learn more:', 'About screen, website links', 'buddypress' ); ?> <a href="https://buddypress.org/blog/"><?php _ex( 'News', 'About screen, link to project blog', 'buddypress' ); ?></a> • <a href="https://buddypress.org/support/"><?php _ex( 'Support', 'About screen, link to support site', 'buddypress' ); ?></a> • <a href="https://codex.buddypress.org/"><?php _ex( 'Documentation', 'About screen, link to documentation', 'buddypress' ); ?></a> • <a href="https://bpdevel.wordpress.com/"><?php _ex( 'Development Blog', 'About screen, link to development blog', 'buddypress' ); ?></a></p>
|
698 |
Â
|
699 |
+
<p><?php _ex( 'Twitter:', 'official Twitter accounts:', 'buddypress' ); ?> <a href="https://twitter.com/buddypress/"><?php _ex( 'BuddyPress', '@buddypress twitter account name', 'buddypress' ); ?></a> • <a href="https://twitter.com/bptrac/"><?php _ex( 'Trac', '@bptrac twitter account name', 'buddypress' ); ?></a> • <a href="https://twitter.com/buddypressdev/"><?php _ex( 'Development', '@buddypressdev twitter account name', 'buddypress' ); ?></a></p>
|
700 |
+
</div>
|
701 |
Â
|
702 |
Â
</div>
|
703 |
Â
|
803 |
Â
|
804 |
Â
<h3 class="wp-people-group"><?php printf( esc_html__( 'Contributors to BuddyPress %s', 'buddypress' ), self::display_version() ); ?></h3>
|
805 |
Â
<p class="wp-credits-list">
|
806 |
+
<a href="https://profiles.wordpress.org/abweb/">abweb</a>,
|
807 |
Â
<a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
|
Â
|
|
808 |
Â
<a href="https://profiles.wordpress.org/thebrandonallen/">Brandon Allen (thebrandonallen)</a>,
|
809 |
+
<a href="https://profiles.wordpress.org/chherbst/">chherbst</a>,
|
Â
|
|
810 |
Â
<a href="https://profiles.wordpress.org/danbrellis/">danbrellis</a>,
|
811 |
Â
<a href="https://profiles.wordpress.org/dcavins/">David Cavins (dcavins)</a>,
|
812 |
Â
<a href="https://profiles.wordpress.org/wpdennis/">Dennis (wpdennis)</a>,
|
813 |
+
<a href="https://profiles.wordpress.org/emrikol/">emrikol</a>,
|
814 |
Â
<a href="https://profiles.wordpress.org/wdfee/">Fee (wdfee)</a>,
|
815 |
Â
<a href="https://profiles.wordpress.org/garrett-eclipse/">Garrett Hyder (garrett-eclipse)</a>,
|
816 |
+
<a href="https://profiles.wordpress.org/pento/">Gary Pendergast (pento)</a>,
|
817 |
Â
<a href="https://profiles.wordpress.org/Mamaduka/">George Mamadashvili (Mamaduka)</a>,
|
818 |
Â
<a href="https://profiles.wordpress.org/henrywright/">Henry Wright (henry.wright)</a>,
|
819 |
Â
<a href="https://profiles.wordpress.org/hnla/">Hugo (hnla)</a>,
|
Â
|
|
820 |
Â
<a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
|
821 |
+
<a href="https://profiles.wordpress.org/kmbdeamorg/">Klaus (kmbdeamorg)</a>,
|
Â
|
|
Â
|
|
822 |
Â
<a href="https://profiles.wordpress.org/sooskriszta/">OC2PS (sooskriszta)</a>,
|
823 |
+
<a href="https://profiles.wordpress.org/lakrisgubben/">lakrisgubben</a>,
|
824 |
Â
<a href="https://profiles.wordpress.org/Offereins">Laurens Offereins (Offereins)</a>,
|
825 |
+
<a href="https://profiles.wordpress.org/mahadri/">mahadri</a>,
|
826 |
Â
<a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
|
827 |
Â
<a href="https://profiles.wordpress.org/mercime/">mercime</a>,
|
828 |
Â
<a href="https://profiles.wordpress.org/tw2113/">Michael Beckwith (tw2113)</a>,
|
829 |
+
<a href="https://profiles.wordpress.org/mmcachran/">mmcachran</a>,
|
830 |
Â
<a href="https://profiles.wordpress.org/modemlooper/">modemlooper</a>,
|
831 |
+
<a href="https://profiles.wordpress.org/nickmomrik/">Nick Momrik (nickmomrik)</a>,
|
832 |
+
<a href="https://profiles.wordpress.org/OakCreative/">OakCreative</a>,
|
833 |
+
<a href="https://profiles.wordpress.org/oksankaa/">oksankaa</a>,
|
834 |
Â
<a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
|
835 |
Â
<a href="https://profiles.wordpress.org/ramiy/">Rami Yushuvaev (ramiy)</a>,
|
836 |
Â
<a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
|
837 |
+
<a href="https://profiles.wordpress.org/rekmla/">rekmla</a>,
|
838 |
+
<a href="https://profiles.wordpress.org/r0z/">r0z</a>,
|
839 |
+
<a href="https://profiles.wordpress.org/SergeyBiryukov/">Sergey Biryukov (SergeyBiryukov)</a>,
|
840 |
+
<a href="https://profiles.wordpress.org/singhleo/">singhleo</a>,
|
841 |
Â
<a href="https://profiles.wordpress.org/slaffik/">Slava UA (slaffik)</a>,
|
Â
|
|
842 |
Â
<a href="https://profiles.wordpress.org/netweb/">Stephen Edgar (netweb)</a>,
|
843 |
+
<a href="https://profiles.wordpress.org/tharsheblows/">tharsheblows</a>,
|
844 |
+
<a href="https://profiles.wordpress.org/VibeThemes/">VibeThemes</a>,
|
845 |
+
<a href="https://profiles.wordpress.org/vortfu/">vortfu</a>,
|
846 |
+
<a href="https://profiles.wordpress.org/WeddyWood/">WeddyWood</a>,
|
847 |
+
<a href="https://profiles.wordpress.org/w3dzign/">w3dzign</a>.
|
848 |
Â
</p>
|
849 |
Â
|
850 |
Â
<h3 class="wp-people-group"><?php _e( '💖With our thanks to these Open Source projects💖', 'buddypress' ); ?></h3>
|
853 |
Â
<a href="https://bbpress.org">bbPress</a>,
|
854 |
Â
<a href="https://github.com/ichord/Caret.js">Caret.js</a>,
|
855 |
Â
<a href="http://tedgoas.github.io/Cerberus/">Cerberus</a>,
|
856 |
+
<a href="http://ionicons.com/">Ionicons</a>,
|
857 |
Â
<a href="https://github.com/carhartl/jquery-cookie">jquery.cookie</a>,
|
858 |
Â
<a href="https://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a>,
|
859 |
Â
<a href="https://wordpress.org">WordPress</a>.
|
916 |
Â
<?php
|
917 |
Â
}
|
918 |
Â
|
919 |
+
/** Emails ****************************************************************/
|
920 |
+
|
921 |
+
/**
|
922 |
+
* Registers 'Situations' column on Emails dashboard page.
|
923 |
+
*
|
924 |
+
* @since 2.6.0
|
925 |
+
*
|
926 |
+
* @param array $columns Current column data.
|
927 |
+
* @return array
|
928 |
+
*/
|
929 |
+
public function emails_register_situation_column( $columns = array() ) {
|
930 |
+
$situation = array(
|
931 |
+
'situation' => _x( 'Situations', 'Email post type', 'buddypress' )
|
932 |
+
);
|
933 |
+
|
934 |
+
// Inject our 'Situations' column just before the last 'Date' column.
|
935 |
+
return array_slice( $columns, 0, -1, true ) + $situation + array_slice( $columns, -1, null, true );
|
936 |
+
}
|
937 |
+
|
938 |
+
/**
|
939 |
+
* Output column data for our custom 'Situations' column.
|
940 |
+
*
|
941 |
+
* @since 2.6.0
|
942 |
+
*
|
943 |
+
* @param string $column Current column name.
|
944 |
+
* @param int $post_id Current post ID.
|
945 |
+
*/
|
946 |
+
public function emails_display_situation_column_data( $column = '', $post_id = 0 ) {
|
947 |
+
if ( 'situation' !== $column ) {
|
948 |
+
return;
|
949 |
+
}
|
950 |
+
|
951 |
+
// Grab email situations for the current post.
|
952 |
+
$situations = wp_list_pluck( get_the_terms( $post_id, bp_get_email_tax_type() ), 'description' );
|
953 |
+
|
954 |
+
// Output each situation as a list item.
|
955 |
+
echo '<ul><li>';
|
956 |
+
echo implode( '</li><li>', $situations );
|
957 |
+
echo '</li></ul>';
|
958 |
+
}
|
959 |
+
|
960 |
Â
/** Helpers ***************************************************************/
|
961 |
Â
|
962 |
Â
/**
|
@@ -25,8 +25,6 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
25 |
Â
* @since 2.3.0
|
26 |
Â
*
|
27 |
Â
* @see BP_Attachment::__construct() for list of parameters
|
28 |
-
* @uses bp_core_avatar_original_max_filesize()
|
29 |
-
* @uses BP_Attachment::__construct()
|
30 |
Â
*/
|
31 |
Â
public function __construct() {
|
32 |
Â
// Allowed avatar types.
|
@@ -64,10 +62,6 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
64 |
Â
*
|
65 |
Â
* @since 2.3.0
|
66 |
Â
*
|
67 |
-
* @uses bp_core_avatar_upload_path()
|
68 |
-
* @uses bp_core_avatar_url()
|
69 |
-
* @uses bp_upload_dir()
|
70 |
-
* @uses BP_Attachment::set_upload_dir()
|
71 |
Â
*/
|
72 |
Â
public function set_upload_dir() {
|
73 |
Â
if ( bp_core_avatar_upload_path() && bp_core_avatar_url() ) {
|
@@ -87,8 +81,6 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
87 |
Â
*
|
88 |
Â
* @since 2.3.0
|
89 |
Â
*
|
90 |
-
* @uses bp_core_check_avatar_size()
|
91 |
-
* @uses bp_core_check_avatar_type()
|
92 |
Â
*
|
93 |
Â
* @param array $file the temporary file attributes (before it has been moved).
|
94 |
Â
* @return array the file with extra errors if needed.
|
@@ -118,7 +110,6 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
118 |
Â
* @since 2.3.0
|
119 |
Â
* @since 2.4.0 Add the $ui_available_width parameter, to inform about the Avatar UI width.
|
120 |
Â
*
|
121 |
-
* @uses bp_core_avatar_original_max_width()
|
122 |
Â
*
|
123 |
Â
* @param string $file The absolute path to the file.
|
124 |
Â
* @param int $ui_available_width Available width for the UI.
|
@@ -184,8 +175,6 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
184 |
Â
*
|
185 |
Â
* @since 2.3.0
|
186 |
Â
*
|
187 |
-
* @uses bp_core_avatar_full_width()
|
188 |
-
* @uses bp_core_avatar_full_height()
|
189 |
Â
*
|
190 |
Â
* @param string $file the absolute path to the file.
|
191 |
Â
* @return bool
|
@@ -208,12 +197,6 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
208 |
Â
* @since 2.3.0
|
209 |
Â
*
|
210 |
Â
* @see BP_Attachment::crop for the list of parameters
|
211 |
-
* @uses bp_core_fetch_avatar()
|
212 |
-
* @uses bp_core_delete_existing_avatar()
|
213 |
-
* @uses bp_core_avatar_full_width()
|
214 |
-
* @uses bp_core_avatar_full_height()
|
215 |
-
* @uses bp_core_avatar_dimension()
|
216 |
-
* @uses BP_Attachment::crop
|
217 |
Â
*
|
218 |
Â
* @param array $args Array of arguments for the cropping.
|
219 |
Â
* @return array The cropped avatars (full and thumb).
|
25 |
Â
* @since 2.3.0
|
26 |
Â
*
|
27 |
Â
* @see BP_Attachment::__construct() for list of parameters
|
Â
|
|
Â
|
|
28 |
Â
*/
|
29 |
Â
public function __construct() {
|
30 |
Â
// Allowed avatar types.
|
62 |
Â
*
|
63 |
Â
* @since 2.3.0
|
64 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
65 |
Â
*/
|
66 |
Â
public function set_upload_dir() {
|
67 |
Â
if ( bp_core_avatar_upload_path() && bp_core_avatar_url() ) {
|
81 |
Â
*
|
82 |
Â
* @since 2.3.0
|
83 |
Â
*
|
Â
|
|
Â
|
|
84 |
Â
*
|
85 |
Â
* @param array $file the temporary file attributes (before it has been moved).
|
86 |
Â
* @return array the file with extra errors if needed.
|
110 |
Â
* @since 2.3.0
|
111 |
Â
* @since 2.4.0 Add the $ui_available_width parameter, to inform about the Avatar UI width.
|
112 |
Â
*
|
Â
|
|
113 |
Â
*
|
114 |
Â
* @param string $file The absolute path to the file.
|
115 |
Â
* @param int $ui_available_width Available width for the UI.
|
175 |
Â
*
|
176 |
Â
* @since 2.3.0
|
177 |
Â
*
|
Â
|
|
Â
|
|
178 |
Â
*
|
179 |
Â
* @param string $file the absolute path to the file.
|
180 |
Â
* @return bool
|
197 |
Â
* @since 2.3.0
|
198 |
Â
*
|
199 |
Â
* @see BP_Attachment::crop for the list of parameters
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
200 |
Â
*
|
201 |
Â
* @param array $args Array of arguments for the cropping.
|
202 |
Â
* @return array The cropped avatars (full and thumb).
|
@@ -50,11 +50,6 @@ abstract class BP_Attachment {
|
|
50 |
Â
*
|
51 |
Â
* @since 2.3.0
|
52 |
Â
* @since 2.4.0 Add the $upload_dir_filter_args argument to the $arguments array
|
53 |
-
* @uses sanitize_key()
|
54 |
-
* @uses wp_max_upload_size()
|
55 |
-
* @uses bp_parse_args()
|
56 |
-
* @uses BP_Attachment->set_upload_error_strings()
|
57 |
-
* @uses BP_Attachment->set_upload_dir()
|
58 |
Â
*
|
59 |
Â
* @param array|string $args {
|
60 |
Â
* @type int $original_max_filesize Maximum file size in kilobytes. Defaults to php.ini settings.
|
@@ -115,7 +110,6 @@ abstract class BP_Attachment {
|
|
115 |
Â
*
|
116 |
Â
* @since 2.3.0
|
117 |
Â
*
|
118 |
-
* @uses bp_upload_dir()
|
119 |
Â
*/
|
120 |
Â
public function set_upload_dir() {
|
121 |
Â
// Set the directory, path, & url variables.
|
@@ -203,10 +197,6 @@ abstract class BP_Attachment {
|
|
203 |
Â
*
|
204 |
Â
* @since 2.3.0
|
205 |
Â
*
|
206 |
-
* @uses wp_handle_upload() To upload the file
|
207 |
-
* @uses add_filter() To temporarly overrides WordPress uploads data
|
208 |
-
* @uses remove_filter() To stop overriding WordPress uploads data
|
209 |
-
* @uses apply_filters() Call 'bp_attachment_upload_overrides' to include specific upload overrides
|
210 |
Â
*
|
211 |
Â
* @param array $file The appropriate entry the from $_FILES superglobal.
|
212 |
Â
* @param string $upload_dir_filter A specific filter to be applied to 'upload_dir' (optional).
|
@@ -303,7 +293,6 @@ abstract class BP_Attachment {
|
|
303 |
Â
*
|
304 |
Â
* @since 2.3.0
|
305 |
Â
*
|
306 |
-
* @uses get_allowed_mime_types()
|
307 |
Â
*/
|
308 |
Â
protected function validate_mime_types() {
|
309 |
Â
$wp_mimes = get_allowed_mime_types();
|
@@ -354,7 +343,6 @@ abstract class BP_Attachment {
|
|
354 |
Â
* @since 2.3.0
|
355 |
Â
* @since 2.4.0 Add the $upload_dir parameter to the method
|
356 |
Â
*
|
357 |
-
* @uses apply_filters() call 'bp_attachment_upload_dir' to eventually override the upload location
|
358 |
Â
* regarding to context
|
359 |
Â
*
|
360 |
Â
* @param array $upload_dir The original Uploads dir.
|
@@ -389,7 +377,6 @@ abstract class BP_Attachment {
|
|
389 |
Â
*
|
390 |
Â
* @since 2.3.0
|
391 |
Â
*
|
392 |
-
* @uses wp_mkdir_p()
|
393 |
Â
*/
|
394 |
Â
public function create_dir() {
|
395 |
Â
// Bail if no specific base dir is set.
|
@@ -426,7 +413,6 @@ abstract class BP_Attachment {
|
|
426 |
Â
* @type int $src_abs Optional. If the source crop points are absolute.
|
427 |
Â
* @type string $dst_file Optional. The destination file to write to.
|
428 |
Â
* }
|
429 |
-
* @uses wp_crop_image()
|
430 |
Â
*
|
431 |
Â
* @return string|WP_Error New filepath on success, WP_Error on failure.
|
432 |
Â
*/
|
50 |
Â
*
|
51 |
Â
* @since 2.3.0
|
52 |
Â
* @since 2.4.0 Add the $upload_dir_filter_args argument to the $arguments array
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
53 |
Â
*
|
54 |
Â
* @param array|string $args {
|
55 |
Â
* @type int $original_max_filesize Maximum file size in kilobytes. Defaults to php.ini settings.
|
110 |
Â
*
|
111 |
Â
* @since 2.3.0
|
112 |
Â
*
|
Â
|
|
113 |
Â
*/
|
114 |
Â
public function set_upload_dir() {
|
115 |
Â
// Set the directory, path, & url variables.
|
197 |
Â
*
|
198 |
Â
* @since 2.3.0
|
199 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
200 |
Â
*
|
201 |
Â
* @param array $file The appropriate entry the from $_FILES superglobal.
|
202 |
Â
* @param string $upload_dir_filter A specific filter to be applied to 'upload_dir' (optional).
|
293 |
Â
*
|
294 |
Â
* @since 2.3.0
|
295 |
Â
*
|
Â
|
|
296 |
Â
*/
|
297 |
Â
protected function validate_mime_types() {
|
298 |
Â
$wp_mimes = get_allowed_mime_types();
|
343 |
Â
* @since 2.3.0
|
344 |
Â
* @since 2.4.0 Add the $upload_dir parameter to the method
|
345 |
Â
*
|
Â
|
|
346 |
Â
* regarding to context
|
347 |
Â
*
|
348 |
Â
* @param array $upload_dir The original Uploads dir.
|
377 |
Â
*
|
378 |
Â
* @since 2.3.0
|
379 |
Â
*
|
Â
|
|
380 |
Â
*/
|
381 |
Â
public function create_dir() {
|
382 |
Â
// Bail if no specific base dir is set.
|
413 |
Â
* @type int $src_abs Optional. If the source crop points are absolute.
|
414 |
Â
* @type string $dst_file Optional. The destination file to write to.
|
415 |
Â
* }
|
Â
|
|
416 |
Â
*
|
417 |
Â
* @return string|WP_Error New filepath on success, WP_Error on failure.
|
418 |
Â
*/
|
@@ -206,8 +206,6 @@ class BP_Component {
|
|
206 |
Â
*
|
207 |
Â
* @since 1.5.0
|
208 |
Â
*
|
209 |
-
* @uses apply_filters() Calls 'bp_{@link bp_Component::name}_id'.
|
210 |
-
* @uses apply_filters() Calls 'bp_{@link bp_Component::name}_slug'.
|
211 |
Â
*
|
212 |
Â
* @param array $args {
|
213 |
Â
* All values are optional.
|
@@ -350,7 +348,6 @@ class BP_Component {
|
|
350 |
Â
*
|
351 |
Â
* @since 1.5.0
|
352 |
Â
*
|
353 |
-
* @uses do_action() Calls 'bp_{@link bp_Component::name}includes'.
|
354 |
Â
*
|
355 |
Â
* @param array $includes An array of file names, or file name chunks,
|
356 |
Â
* to be parsed and then included.
|
@@ -401,8 +398,6 @@ class BP_Component {
|
|
401 |
Â
*
|
402 |
Â
* @since 1.5.0
|
403 |
Â
*
|
404 |
-
* @uses add_action() To add various actions.
|
405 |
-
* @uses do_action() Calls 'bp_{@link BP_Component::name}setup_actions'.
|
406 |
Â
*/
|
407 |
Â
public function setup_actions() {
|
408 |
Â
|
@@ -489,12 +484,12 @@ class BP_Component {
|
|
489 |
Â
|
490 |
Â
// No sub nav items without a main nav item.
|
491 |
Â
if ( !empty( $main_nav ) ) {
|
492 |
-
bp_core_new_nav_item( $main_nav );
|
493 |
Â
|
494 |
Â
// Sub nav items are not required.
|
495 |
Â
if ( !empty( $sub_nav ) ) {
|
496 |
Â
foreach( (array) $sub_nav as $nav ) {
|
497 |
-
bp_core_new_subnav_item( $nav );
|
498 |
Â
}
|
499 |
Â
}
|
500 |
Â
}
|
@@ -598,7 +593,6 @@ class BP_Component {
|
|
598 |
Â
*
|
599 |
Â
* @since 1.5.0
|
600 |
Â
*
|
601 |
-
* @uses do_action() Calls 'bp_{@link bp_Component::name}_setup_title'.
|
602 |
Â
*/
|
603 |
Â
public function setup_title() {
|
604 |
Â
|
@@ -617,7 +611,6 @@ class BP_Component {
|
|
617 |
Â
*
|
618 |
Â
* @since 2.2.0
|
619 |
Â
*
|
620 |
-
* @uses do_action() Calls 'bp_setup_{@link bp_Component::name}_cache_groups'.
|
621 |
Â
*/
|
622 |
Â
public function setup_cache_groups() {
|
623 |
Â
|
@@ -723,7 +716,6 @@ class BP_Component {
|
|
723 |
Â
*
|
724 |
Â
* @since 1.5.0
|
725 |
Â
*
|
726 |
-
* @uses do_action() Calls 'bp_{@link bp_Component::name}_register_post_types'.
|
727 |
Â
*/
|
728 |
Â
public function register_post_types() {
|
729 |
Â
|
@@ -742,7 +734,6 @@ class BP_Component {
|
|
742 |
Â
*
|
743 |
Â
* @since 1.5.0
|
744 |
Â
*
|
745 |
-
* @uses do_action() Calls 'bp_{@link bp_Component::name}_register_taxonomies'.
|
746 |
Â
*/
|
747 |
Â
public function register_taxonomies() {
|
748 |
Â
|
@@ -761,7 +752,6 @@ class BP_Component {
|
|
761 |
Â
*
|
762 |
Â
* @since 1.5.0
|
763 |
Â
*
|
764 |
-
* @uses do_action() Calls 'bp_{@link bp_Component::name}_add_rewrite_tags'.
|
765 |
Â
*/
|
766 |
Â
public function add_rewrite_tags() {
|
767 |
Â
|
@@ -780,7 +770,6 @@ class BP_Component {
|
|
780 |
Â
*
|
781 |
Â
* @since 1.9.0
|
782 |
Â
*
|
783 |
-
* @uses do_action() Calls 'bp_{@link bp_Component::name}_add_rewrite_rules'.
|
784 |
Â
*/
|
785 |
Â
public function add_rewrite_rules() {
|
786 |
Â
|
@@ -799,7 +788,6 @@ class BP_Component {
|
|
799 |
Â
*
|
800 |
Â
* @since 1.9.0
|
801 |
Â
*
|
802 |
-
* @uses do_action() Calls 'bp_{@link bp_Component::name}_add_permastruct'.
|
803 |
Â
*/
|
804 |
Â
public function add_permastructs() {
|
805 |
Â
|
@@ -818,7 +806,6 @@ class BP_Component {
|
|
818 |
Â
*
|
819 |
Â
* @since 1.9.0
|
820 |
Â
*
|
821 |
-
* @uses do_action() Calls 'bp_{@link bp_Component::name}_parse_query'.
|
822 |
Â
*
|
823 |
Â
* @param object $query The main WP_Query.
|
824 |
Â
*/
|
@@ -841,7 +828,6 @@ class BP_Component {
|
|
841 |
Â
*
|
842 |
Â
* @since 1.5.0
|
843 |
Â
*
|
844 |
-
* @uses do_action() Calls 'bp_{@link bp_Component::name}_generate_rewrite_rules'.
|
845 |
Â
*/
|
846 |
Â
public function generate_rewrite_rules() {
|
847 |
Â
|
206 |
Â
*
|
207 |
Â
* @since 1.5.0
|
208 |
Â
*
|
Â
|
|
Â
|
|
209 |
Â
*
|
210 |
Â
* @param array $args {
|
211 |
Â
* All values are optional.
|
348 |
Â
*
|
349 |
Â
* @since 1.5.0
|
350 |
Â
*
|
Â
|
|
351 |
Â
*
|
352 |
Â
* @param array $includes An array of file names, or file name chunks,
|
353 |
Â
* to be parsed and then included.
|
398 |
Â
*
|
399 |
Â
* @since 1.5.0
|
400 |
Â
*
|
Â
|
|
Â
|
|
401 |
Â
*/
|
402 |
Â
public function setup_actions() {
|
403 |
Â
|
484 |
Â
|
485 |
Â
// No sub nav items without a main nav item.
|
486 |
Â
if ( !empty( $main_nav ) ) {
|
487 |
+
bp_core_new_nav_item( $main_nav, 'members' );
|
488 |
Â
|
489 |
Â
// Sub nav items are not required.
|
490 |
Â
if ( !empty( $sub_nav ) ) {
|
491 |
Â
foreach( (array) $sub_nav as $nav ) {
|
492 |
+
bp_core_new_subnav_item( $nav, 'members' );
|
493 |
Â
}
|
494 |
Â
}
|
495 |
Â
}
|
593 |
Â
*
|
594 |
Â
* @since 1.5.0
|
595 |
Â
*
|
Â
|
|
596 |
Â
*/
|
597 |
Â
public function setup_title() {
|
598 |
Â
|
611 |
Â
*
|
612 |
Â
* @since 2.2.0
|
613 |
Â
*
|
Â
|
|
614 |
Â
*/
|
615 |
Â
public function setup_cache_groups() {
|
616 |
Â
|
716 |
Â
*
|
717 |
Â
* @since 1.5.0
|
718 |
Â
*
|
Â
|
|
719 |
Â
*/
|
720 |
Â
public function register_post_types() {
|
721 |
Â
|
734 |
Â
*
|
735 |
Â
* @since 1.5.0
|
736 |
Â
*
|
Â
|
|
737 |
Â
*/
|
738 |
Â
public function register_taxonomies() {
|
739 |
Â
|
752 |
Â
*
|
753 |
Â
* @since 1.5.0
|
754 |
Â
*
|
Â
|
|
755 |
Â
*/
|
756 |
Â
public function add_rewrite_tags() {
|
757 |
Â
|
770 |
Â
*
|
771 |
Â
* @since 1.9.0
|
772 |
Â
*
|
Â
|
|
773 |
Â
*/
|
774 |
Â
public function add_rewrite_rules() {
|
775 |
Â
|
788 |
Â
*
|
789 |
Â
* @since 1.9.0
|
790 |
Â
*
|
Â
|
|
791 |
Â
*/
|
792 |
Â
public function add_permastructs() {
|
793 |
Â
|
806 |
Â
*
|
807 |
Â
* @since 1.9.0
|
808 |
Â
*
|
Â
|
|
809 |
Â
*
|
810 |
Â
* @param object $query The main WP_Query.
|
811 |
Â
*/
|
828 |
Â
*
|
829 |
Â
* @since 1.5.0
|
830 |
Â
*
|
Â
|
|
831 |
Â
*/
|
832 |
Â
public function generate_rewrite_rules() {
|
833 |
Â
|
@@ -0,0 +1,270 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Backward compatibility for the $bp->bp_nav global.
|
4 |
+
*
|
5 |
+
* @since 2.6.0
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly.
|
9 |
+
defined( 'ABSPATH' ) || exit;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* bp_nav backward compatibility class.
|
13 |
+
*
|
14 |
+
* This class is used to provide backward compatibility for extensions that access and modify
|
15 |
+
* the $bp->bp_nav global.
|
16 |
+
*
|
17 |
+
* @since 2.6.0
|
18 |
+
*/
|
19 |
+
class BP_Core_BP_Nav_BackCompat implements ArrayAccess {
|
20 |
+
/**
|
21 |
+
* Nav items.
|
22 |
+
*
|
23 |
+
* @since 2.6.0
|
24 |
+
* @access public
|
25 |
+
* @var array
|
26 |
+
*/
|
27 |
+
public $backcompat_nav = array();
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Component to which nav items belong.
|
31 |
+
*
|
32 |
+
* @since 2.6.0
|
33 |
+
* @access public
|
34 |
+
* @var array
|
35 |
+
*/
|
36 |
+
public $component;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Constructor.
|
40 |
+
*
|
41 |
+
* @since 2.6.0
|
42 |
+
*
|
43 |
+
* @param array $backcompat_nav Optional. Array of nav items.
|
44 |
+
*/
|
45 |
+
public function __construct( $backcompat_nav = array() ) {
|
46 |
+
foreach ( $backcompat_nav as $key => $value ) {
|
47 |
+
if ( is_array( $value ) ) {
|
48 |
+
$this->backcompat_nav[ $key ] = new self( $value );
|
49 |
+
} else {
|
50 |
+
$this->backcompat_nav[ $key ] = $value;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Assign a value to the nav array at the specified offset.
|
57 |
+
*
|
58 |
+
* @since 2.6.0
|
59 |
+
*
|
60 |
+
* @param mixed $offset Array offset.
|
61 |
+
* @param array $value Nav item.
|
62 |
+
*/
|
63 |
+
public function offsetSet( $offset, $value ) {
|
64 |
+
_doing_it_wrong(
|
65 |
+
'bp_nav',
|
66 |
+
__( 'The bp_nav and bp_options_nav globals should not be used directly and are deprecated. Please use the BuddyPress nav functions instead.', 'buddypress' ),
|
67 |
+
'2.6.0'
|
68 |
+
);
|
69 |
+
|
70 |
+
$bp = buddypress();
|
71 |
+
|
72 |
+
if ( is_array( $value ) ) {
|
73 |
+
$value = new self( $value );
|
74 |
+
}
|
75 |
+
|
76 |
+
if ( $offset !== null ) {
|
77 |
+
// Temporarily set the backcompat_nav.
|
78 |
+
$this->backcompat_nav[ $offset ] = $value;
|
79 |
+
|
80 |
+
$args = $this->to_array();
|
81 |
+
if ( isset( $args['parent_slug'] ) ) {
|
82 |
+
$this->get_component_nav( $args['parent_slug'] )->edit_nav( $args, $args['slug'], $args['parent_slug'] );
|
83 |
+
} elseif ( isset( $args['slug'] ) ) {
|
84 |
+
$bp->members->nav->edit_nav( $args, $args['slug'] );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get a value of the nav array at the specified offset.
|
91 |
+
*
|
92 |
+
* @since 2.6.0
|
93 |
+
*
|
94 |
+
* @param mixed $offset Array offset.
|
95 |
+
* @return BP_Core_BP_Nav_BackCompat
|
96 |
+
*/
|
97 |
+
public function offsetGet( $offset ) {
|
98 |
+
_doing_it_wrong(
|
99 |
+
'bp_nav',
|
100 |
+
__( 'The bp_nav and bp_options_nav globals should not be used directly and are deprecated. Please use the BuddyPress nav functions instead.', 'buddypress' ),
|
101 |
+
'2.6.0'
|
102 |
+
);
|
103 |
+
|
104 |
+
// if ( ! isset( $this->backcompat_nav[ $offset ] ) ) {
|
105 |
+
$nav = $this->get_nav( $offset );
|
106 |
+
if ( $nav && isset( $nav[ $offset ] ) ) {
|
107 |
+
$this->backcompat_nav[ $offset ] = new self( $nav[ $offset ] );
|
108 |
+
}
|
109 |
+
// }
|
110 |
+
|
111 |
+
return $this->backcompat_nav[ $offset ];
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Check whether nav array has a value at the specified offset.
|
116 |
+
*
|
117 |
+
* @since 2.6.0
|
118 |
+
*
|
119 |
+
* @param mixed $offset Array offset.
|
120 |
+
* @return bool
|
121 |
+
*/
|
122 |
+
public function offsetExists( $offset ) {
|
123 |
+
_doing_it_wrong(
|
124 |
+
'bp_nav',
|
125 |
+
__( 'The bp_nav and bp_options_nav globals should not be used directly and are deprecated. Please use the BuddyPress nav functions instead.', 'buddypress' ),
|
126 |
+
'2.6.0'
|
127 |
+
);
|
128 |
+
|
129 |
+
if ( isset( $this->backcompat_nav[ $offset ] ) ) {
|
130 |
+
return true;
|
131 |
+
}
|
132 |
+
|
133 |
+
$nav = $this->get_nav( $offset );
|
134 |
+
if ( $nav && isset( $nav[ $offset ] ) ) {
|
135 |
+
return true;
|
136 |
+
}
|
137 |
+
|
138 |
+
return false;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Unset a nav array value at the specified offset.
|
143 |
+
*
|
144 |
+
* @since 2.6.0
|
145 |
+
*
|
146 |
+
* @param mixed $offset Array offset.
|
147 |
+
*/
|
148 |
+
public function offsetUnset( $offset ) {
|
149 |
+
_doing_it_wrong(
|
150 |
+
'bp_nav',
|
151 |
+
__( 'The bp_nav and bp_options_nav globals should not be used directly and are deprecated. Please use the BuddyPress nav functions instead.', 'buddypress' ),
|
152 |
+
'2.6.0'
|
153 |
+
);
|
154 |
+
|
155 |
+
// For top-level nav items, the backcompat nav hasn't yet been initialized.
|
156 |
+
if ( ! isset( $this->backcompat_nav[ $offset ] ) ) {
|
157 |
+
buddypress()->members->nav->delete_nav( $offset );
|
158 |
+
unset( $this->backcompat_nav[ $offset ] );
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Set the component to which the nav belongs.
|
164 |
+
*
|
165 |
+
* @since 2.6.0
|
166 |
+
*
|
167 |
+
* @param string $component
|
168 |
+
*/
|
169 |
+
public function set_component( $component ) {
|
170 |
+
$this->component = $component;
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Get the component to which the a nav item belongs.
|
175 |
+
*
|
176 |
+
* We use the following heuristic to guess, based on an offset, which component the item belongs to:
|
177 |
+
* - If this is a group, and the offset is the same as the current group's slug, it's a group nav item.
|
178 |
+
* - Otherwise, it's a member nav item.
|
179 |
+
*
|
180 |
+
* @since 2.6.0
|
181 |
+
*
|
182 |
+
* @param mixed $offset Array offset.
|
183 |
+
* @return string
|
184 |
+
*/
|
185 |
+
public function get_component( $offset = '' ) {
|
186 |
+
if ( ! isset( $this->component ) ) {
|
187 |
+
if ( bp_is_active( 'groups' ) && $offset === bp_get_current_group_slug() ) {
|
188 |
+
$this->component = 'groups';
|
189 |
+
} else {
|
190 |
+
$this->component = 'members';
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
return $this->component;
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Reset the cached nav items.
|
199 |
+
*
|
200 |
+
* Called when the nav API removes items from the nav array.
|
201 |
+
*
|
202 |
+
* @since 2.6.0
|
203 |
+
*/
|
204 |
+
public function reset() {
|
205 |
+
$this->backcompat_nav = array();
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Get the nav object corresponding to the specified offset.
|
210 |
+
*
|
211 |
+
* @since 2.6.0
|
212 |
+
*
|
213 |
+
* @param mixed $offset Array offset.
|
214 |
+
* @return bool|array
|
215 |
+
*/
|
216 |
+
protected function get_nav( $offset ) {
|
217 |
+
$bp = buddypress();
|
218 |
+
|
219 |
+
$component_nav = $this->get_component_nav( $offset );
|
220 |
+
$primary_nav = $component_nav->get_primary( array( 'slug' => $offset ), false );
|
221 |
+
|
222 |
+
$nav = array();
|
223 |
+
|
224 |
+
if ( empty( $primary_nav ) ) {
|
225 |
+
return $nav;
|
226 |
+
}
|
227 |
+
|
228 |
+
foreach ( $primary_nav as $item ) {
|
229 |
+
$nav[ $item->slug ] = (array) $item;
|
230 |
+
}
|
231 |
+
|
232 |
+
return $nav;
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Get the BP_Core_Nav object corresponding to the component, based on a nav item name.
|
237 |
+
*
|
238 |
+
* The way bp_nav was previously organized makes it impossible to know for sure which component's nav is
|
239 |
+
* being referenced by a given nav item name. We guess in the following manner:
|
240 |
+
* - If we're looking at a group, and the nav item name (`$offset`) is the same as the slug of the current
|
241 |
+
* group, we assume that the proper component nav is 'groups'.
|
242 |
+
* - Otherwise, fall back on 'members'.
|
243 |
+
*
|
244 |
+
* @since 2.6.0
|
245 |
+
*
|
246 |
+
* @param string $offset Nav item name.
|
247 |
+
* @return BP_Core_Nav
|
248 |
+
*/
|
249 |
+
protected function get_component_nav( $offset = '' ) {
|
250 |
+
$component = $this->get_component( $offset );
|
251 |
+
|
252 |
+
$bp = buddypress();
|
253 |
+
if ( ! isset( $bp->{$component}->nav ) ) {
|
254 |
+
return false;
|
255 |
+
}
|
256 |
+
|
257 |
+
return $bp->{$component}->nav;
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Get the nav data, formatted as a flat array.
|
262 |
+
*
|
263 |
+
* @since 2.6.0
|
264 |
+
*
|
265 |
+
* @return array
|
266 |
+
*/
|
267 |
+
protected function to_array() {
|
268 |
+
return $this->backcompat_nav;
|
269 |
+
}
|
270 |
+
}
|
@@ -0,0 +1,138 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Backward compatibility for the $bp->bp_options_nav global.
|
4 |
+
*
|
5 |
+
* @since 2.6.0
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly.
|
9 |
+
defined( 'ABSPATH' ) || exit;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* bp_options_nav backward compatibility class.
|
13 |
+
*
|
14 |
+
* This class is used to provide backward compatibility for extensions that access and modify
|
15 |
+
* the $bp->bp_options_nav global.
|
16 |
+
*
|
17 |
+
* @since 2.6.0
|
18 |
+
*/
|
19 |
+
class BP_Core_BP_Options_Nav_BackCompat extends BP_Core_BP_Nav_BackCompat {
|
20 |
+
/**
|
21 |
+
* Parent slug of the current nav item.
|
22 |
+
*
|
23 |
+
* @since 2.6.0
|
24 |
+
* @access protected
|
25 |
+
* @var string
|
26 |
+
*/
|
27 |
+
protected $parent_slug = '';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Get a value of the nav array at the specified offset.
|
31 |
+
*
|
32 |
+
* @since 2.6.0
|
33 |
+
*
|
34 |
+
* @param mixed $offset Array offset.
|
35 |
+
* @return BP_Core_BP_Nav_BackCompat
|
36 |
+
*/
|
37 |
+
public function offsetGet( $offset ) {
|
38 |
+
_doing_it_wrong(
|
39 |
+
'bp_nav',
|
40 |
+
__( 'These globals should not be used directly and are deprecated. Please use the BuddyPress nav functions instead.', 'buddypress' ),
|
41 |
+
'2.6.0'
|
42 |
+
);
|
43 |
+
|
44 |
+
if ( empty( $this->backcompat_nav[ $offset ] ) ) {
|
45 |
+
$nav = $this->get_nav( $offset );
|
46 |
+
if ( $nav ) {
|
47 |
+
$subnavs = $this->get_component_nav( $offset )->get_secondary( array( 'parent_slug' => $offset ) );
|
48 |
+
$subnav_keyed = array();
|
49 |
+
if ( $subnavs ) {
|
50 |
+
foreach ( $subnavs as $subnav ) {
|
51 |
+
$subnav_keyed[ $subnav->slug ] = (array) $subnav;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
$subnav_object = new self( $subnav_keyed );
|
56 |
+
$subnav_object->set_component( $this->get_component() );
|
57 |
+
$subnav_object->set_parent_slug( $offset );
|
58 |
+
|
59 |
+
$this->backcompat_nav[ $offset ] = $subnav_object;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
if ( isset( $this->backcompat_nav[ $offset ] ) ) {
|
64 |
+
return $this->backcompat_nav[ $offset ];
|
65 |
+
}
|
66 |
+
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Unset a nav array value at the specified offset.
|
72 |
+
*
|
73 |
+
* @since 2.6.0
|
74 |
+
*
|
75 |
+
* @param mixed $offset Array offset.
|
76 |
+
*/
|
77 |
+
public function offsetUnset( $offset ) {
|
78 |
+
_doing_it_wrong(
|
79 |
+
'bp_nav',
|
80 |
+
__( 'These globals should not be used directly and are deprecated. Please use the BuddyPress nav functions instead.', 'buddypress' ),
|
81 |
+
'2.6.0'
|
82 |
+
);
|
83 |
+
|
84 |
+
$this->get_component_nav( $offset )->delete_nav( $offset, $this->get_parent_slug() );
|
85 |
+
|
86 |
+
// Clear the cached nav.
|
87 |
+
unset( $this->backcompat_nav[ $offset ] );
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Get the parent slug of the current nav item.
|
92 |
+
*
|
93 |
+
* @since 2.6.0
|
94 |
+
*
|
95 |
+
* @return string
|
96 |
+
*/
|
97 |
+
public function get_parent_slug() {
|
98 |
+
return $this->parent_slug;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Set the parent slug of the current nav item.
|
103 |
+
*
|
104 |
+
* @since 2.6.0
|
105 |
+
*/
|
106 |
+
public function set_parent_slug( $slug ) {
|
107 |
+
$this->parent_slug = $slug;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Get the nav object corresponding to the specified offset.
|
112 |
+
*
|
113 |
+
* @since 2.6.0
|
114 |
+
*
|
115 |
+
* @param mixed $offset Array offset.
|
116 |
+
* @return bool|array
|
117 |
+
*/
|
118 |
+
public function get_nav( $offset ) {
|
119 |
+
$nav = parent::get_nav( $offset );
|
120 |
+
|
121 |
+
if ( ! $nav ) {
|
122 |
+
$component_nav = $this->get_component_nav( $offset );
|
123 |
+
$secondary_nav = $component_nav->get_secondary( array( 'slug' => $offset ), false );
|
124 |
+
|
125 |
+
$nav = array();
|
126 |
+
|
127 |
+
if ( empty( $primary_nav ) ) {
|
128 |
+
return $nav;
|
129 |
+
}
|
130 |
+
|
131 |
+
foreach ( $primary_nav as $item ) {
|
132 |
+
$nav[ $item->slug ] = (array) $item;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
return $nav;
|
137 |
+
}
|
138 |
+
}
|
@@ -27,8 +27,9 @@ class BP_Core_Login_Widget extends WP_Widget {
|
|
27 |
Â
false,
|
28 |
Â
_x( '(BuddyPress) Log In', 'Title of the login widget', 'buddypress' ),
|
29 |
Â
array(
|
30 |
-
'description'
|
31 |
-
'classname'
|
Â
|
|
32 |
Â
)
|
33 |
Â
);
|
34 |
Â
}
|
27 |
Â
false,
|
28 |
Â
_x( '(BuddyPress) Log In', 'Title of the login widget', 'buddypress' ),
|
29 |
Â
array(
|
30 |
+
'description' => __( 'Show a Log In form to logged-out visitors, and a Log Out link to those who are logged in.', 'buddypress' ),
|
31 |
+
'classname' => 'widget_bp_core_login_widget buddypress widget',
|
32 |
+
'customize_selective_refresh' => true,
|
33 |
Â
)
|
34 |
Â
);
|
35 |
Â
}
|
@@ -0,0 +1,34 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Exit if accessed directly.
|
4 |
+
defined( 'ABSPATH' ) || exit;
|
5 |
+
|
6 |
+
if ( class_exists( 'ArrayObject' ) ) :
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Navigation item.
|
10 |
+
*
|
11 |
+
* @since 2.6.0
|
12 |
+
*/
|
13 |
+
class BP_Core_Nav_Item extends ArrayObject {
|
14 |
+
public function __construct( $data ) {
|
15 |
+
parent::__construct( $data, ArrayObject::ARRAY_AS_PROPS );
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
else :
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Navigation item.
|
23 |
+
*
|
24 |
+
* @since 2.6.0
|
25 |
+
*/
|
26 |
+
class BP_Core_Nav_Item {
|
27 |
+
public function __construct( $data ) {
|
28 |
+
foreach ( $data as $key => $value ) {
|
29 |
+
$this->key = $value;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
endif;
|
@@ -0,0 +1,402 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Core component class.
|
4 |
+
*
|
5 |
+
* @package BuddyPress
|
6 |
+
* @subpackage Core
|
7 |
+
* @since 2.6.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly.
|
11 |
+
defined( 'ABSPATH' ) || exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* BuddyPress Nav.
|
15 |
+
*
|
16 |
+
* This class is used to build each component's navigation.
|
17 |
+
*
|
18 |
+
* @since 2.6.0
|
19 |
+
*/
|
20 |
+
class BP_Core_Nav {
|
21 |
+
/**
|
22 |
+
* An associative array containing the nav items for the object ID.
|
23 |
+
*
|
24 |
+
* @since 2.6.0
|
25 |
+
* @var array
|
26 |
+
*/
|
27 |
+
protected $nav;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* The current object ID.
|
31 |
+
*
|
32 |
+
* @since 2.6.0
|
33 |
+
* @var int
|
34 |
+
*/
|
35 |
+
private $object_id;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Initializes the Nav belonging to the specified object.
|
39 |
+
*
|
40 |
+
* @since 2.6.0
|
41 |
+
*
|
42 |
+
* @param int $object_id The item ID to build the nav for. Default is the displayed user ID.
|
43 |
+
*/
|
44 |
+
public function __construct( $object_id = 0 ) {
|
45 |
+
if ( empty( $object_id ) ) {
|
46 |
+
$this->object_id = (int) bp_displayed_user_id();
|
47 |
+
} else {
|
48 |
+
$this->object_id = (int) $object_id;
|
49 |
+
}
|
50 |
+
|
51 |
+
$this->nav[ $this->object_id ] = array();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Checks whether a nav item is set.
|
56 |
+
*
|
57 |
+
* @since 2.6.0
|
58 |
+
*
|
59 |
+
* @param string $key The requested nav slug.
|
60 |
+
* @return bool True if the nav item is set, false otherwise.
|
61 |
+
*/
|
62 |
+
public function __isset( $key ) {
|
63 |
+
return isset( $this->nav[ $this->object_id ][ $key ] );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Gets a nav item.
|
68 |
+
*
|
69 |
+
* @since 2.6.0
|
70 |
+
*
|
71 |
+
* @param string $key The requested nav slug.
|
72 |
+
* @return mixed The value corresponding to the requested nav item.
|
73 |
+
*/
|
74 |
+
public function __get( $key ) {
|
75 |
+
if ( ! isset( $this->nav[ $this->object_id ][ $key ] ) ) {
|
76 |
+
$this->nav[ $this->object_id ][ $key ] = null;
|
77 |
+
}
|
78 |
+
|
79 |
+
return $this->nav[ $this->object_id ][ $key ];
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Sets a nav item.
|
84 |
+
*
|
85 |
+
* @since 2.6.0
|
86 |
+
*
|
87 |
+
* @param string $key The requested nav slug.
|
88 |
+
* @param mixed $value The value of the nav item.
|
89 |
+
*/
|
90 |
+
public function __set( $key, $value ) {
|
91 |
+
if ( is_array( $value ) ) {
|
92 |
+
$value['primary'] = true;
|
93 |
+
}
|
94 |
+
|
95 |
+
$this->nav[ $this->object_id ][ $key ] = new BP_Core_Nav_Item( $value );
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Gets a specific nav item or array of nav items.
|
100 |
+
*
|
101 |
+
* @since 2.6.0
|
102 |
+
*
|
103 |
+
* @param string $key The nav item slug to get. Optional.
|
104 |
+
* @return mixed An array of nav item, a single nav item, or null if none found.
|
105 |
+
*/
|
106 |
+
public function get( $key = '' ) {
|
107 |
+
$return = null;
|
108 |
+
|
109 |
+
// Return the requested nav item.
|
110 |
+
if ( ! empty( $key ) ) {
|
111 |
+
if ( ! isset( $this->nav[ $this->object_id ][ $key ] ) ) {
|
112 |
+
$return = null;
|
113 |
+
} else {
|
114 |
+
$return = $this->nav[ $this->object_id ][ $key ];
|
115 |
+
}
|
116 |
+
|
117 |
+
// Return all nav item items.
|
118 |
+
} else {
|
119 |
+
$return = $this->nav[ $this->object_id ];
|
120 |
+
}
|
121 |
+
|
122 |
+
return $return;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Adds a new nav item.
|
127 |
+
*
|
128 |
+
* @since 2.6.0
|
129 |
+
*
|
130 |
+
* @param array $args The nav item's arguments.
|
131 |
+
* @return BP_Core_Nav_Item
|
132 |
+
*/
|
133 |
+
public function add_nav( $args ) {
|
134 |
+
if ( empty( $args['slug'] ) ) {
|
135 |
+
return false;
|
136 |
+
}
|
137 |
+
|
138 |
+
// We have a child and the parent exists.
|
139 |
+
if ( ! empty( $args['parent_slug'] ) ) {
|
140 |
+
$slug = $args['parent_slug'] . '/' . $args['slug'];
|
141 |
+
$args['secondary'] = true;
|
142 |
+
|
143 |
+
// This is a parent.
|
144 |
+
} else {
|
145 |
+
$slug = $args['slug'];
|
146 |
+
$args['primary'] = true;
|
147 |
+
}
|
148 |
+
|
149 |
+
// Add to the nav.
|
150 |
+
$this->nav[ $this->object_id ][ $slug ] = new BP_Core_Nav_Item( $args );
|
151 |
+
|
152 |
+
return $this->nav[ $this->object_id ][ $slug ];
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Edits a nav item.
|
157 |
+
*
|
158 |
+
* @since 2.6.0
|
159 |
+
*
|
160 |
+
* @param array $args The nav item's arguments.
|
161 |
+
* @param string $slug The slug of the nav item.
|
162 |
+
* @param string $parent_slug The slug of the parent nav item (required to edit a child).
|
163 |
+
* @return BP_Core_Nav_Item
|
164 |
+
*/
|
165 |
+
public function edit_nav( $args = array(), $slug = '', $parent_slug = '' ) {
|
166 |
+
if ( empty( $slug ) ) {
|
167 |
+
return false;
|
168 |
+
}
|
169 |
+
|
170 |
+
// We're editing a parent!
|
171 |
+
if ( empty( $parent_slug ) ) {
|
172 |
+
$nav_items = $this->get_primary( array( 'slug' => $slug ), false );
|
173 |
+
|
174 |
+
if ( ! $nav_items ) {
|
175 |
+
return false;
|
176 |
+
}
|
177 |
+
|
178 |
+
$nav_item = reset( $nav_items );
|
179 |
+
$this->nav[ $this->object_id ][ $slug ] = new BP_Core_Nav_Item( wp_parse_args( $args, (array) $nav_item ) );
|
180 |
+
|
181 |
+
// Return the edited object.
|
182 |
+
return $this->nav[ $this->object_id ][ $slug ];
|
183 |
+
|
184 |
+
// We're editing a child.
|
185 |
+
} else {
|
186 |
+
$sub_items = $this->get_secondary( array( 'parent_slug' => $parent_slug, 'slug' => $slug ), false );
|
187 |
+
|
188 |
+
if ( ! $sub_items ) {
|
189 |
+
return false;
|
190 |
+
}
|
191 |
+
|
192 |
+
$sub_item = reset( $sub_items );
|
193 |
+
|
194 |
+
$params = wp_parse_args( $args, (array) $sub_item );
|
195 |
+
|
196 |
+
// When we have parents, it's for life, we can't change them!
|
197 |
+
if ( empty( $params['parent_slug'] ) || $parent_slug !== $params['parent_slug'] ) {
|
198 |
+
return false;
|
199 |
+
}
|
200 |
+
|
201 |
+
$this->nav[ $this->object_id ][ $parent_slug . '/' . $slug ] = new BP_Core_Nav_Item( $params );
|
202 |
+
|
203 |
+
// Return the edited object.
|
204 |
+
return $this->nav[ $this->object_id ][ $parent_slug . '/' . $slug ];
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Unset an item or a subitem of the nav.
|
210 |
+
*
|
211 |
+
* @since 2.6.0
|
212 |
+
*
|
213 |
+
* @param string $slug The slug of the main item.
|
214 |
+
* @param string $parent_slug The slug of the sub item.
|
215 |
+
* @return bool|callable|array False on failure, the screen function(s) on success.
|
216 |
+
*/
|
217 |
+
public function delete_nav( $slug = '', $parent_slug = '' ) {
|
218 |
+
|
219 |
+
// Bail if slug is empty
|
220 |
+
if ( empty( $slug ) ) {
|
221 |
+
return false;
|
222 |
+
}
|
223 |
+
|
224 |
+
// We're deleting a child
|
225 |
+
if ( ! empty( $parent_slug ) ) {
|
226 |
+
|
227 |
+
// Validate the subnav
|
228 |
+
$sub_items = $this->get_secondary( array( 'parent_slug' => $parent_slug, 'slug' => $slug ), false );
|
229 |
+
|
230 |
+
if ( ! $sub_items ) {
|
231 |
+
return false;
|
232 |
+
}
|
233 |
+
|
234 |
+
$sub_item = reset( $sub_items );
|
235 |
+
|
236 |
+
if ( empty( $sub_item->slug ) ) {
|
237 |
+
return false;
|
238 |
+
}
|
239 |
+
|
240 |
+
// Delete the child
|
241 |
+
unset( $this->nav[ $this->object_id ][ $parent_slug . '/' . $slug ] );
|
242 |
+
|
243 |
+
// Return the deleted item's screen function
|
244 |
+
return array( $sub_item->screen_function );
|
245 |
+
|
246 |
+
// We're deleting a parent
|
247 |
+
} else {
|
248 |
+
// Validate the nav
|
249 |
+
$nav_items = $this->get_primary( array( 'slug' => $slug ), false );
|
250 |
+
|
251 |
+
if ( ! $nav_items ) {
|
252 |
+
return false;
|
253 |
+
}
|
254 |
+
|
255 |
+
$nav_item = reset( $nav_items );
|
256 |
+
|
257 |
+
if ( empty( $nav_item->slug ) ) {
|
258 |
+
return false;
|
259 |
+
}
|
260 |
+
|
261 |
+
$screen_functions = array( $nav_item->screen_function );
|
262 |
+
|
263 |
+
// Life's unfair, children won't survive the parent :(
|
264 |
+
$sub_items = $this->get_secondary( array( 'parent_slug' => $nav_item->slug ), false );
|
265 |
+
|
266 |
+
if ( ! empty( $sub_items ) ) {
|
267 |
+
foreach ( $sub_items as $sub_item ) {
|
268 |
+
$screen_functions[] = $sub_item->screen_function;
|
269 |
+
|
270 |
+
// Delete the child
|
271 |
+
unset( $this->nav[ $this->object_id ][ $nav_item->slug . '/' . $sub_item->slug ] );
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
// Delete the parent.
|
276 |
+
unset( $this->nav[ $this->object_id ][ $nav_item->slug ] );
|
277 |
+
|
278 |
+
// Return the deleted item's screen functions.
|
279 |
+
return array_unique( $screen_functions );
|
280 |
+
}
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Sorts a list of nav items.
|
285 |
+
*
|
286 |
+
* @since 2.6.0
|
287 |
+
*
|
288 |
+
* @param array $items The nav items to sort.
|
289 |
+
* @return array
|
290 |
+
*/
|
291 |
+
public function sort_nav( $items ) {
|
292 |
+
$sorted = array();
|
293 |
+
|
294 |
+
foreach ( $items as $item ) {
|
295 |
+
// Default position
|
296 |
+
$position = 99;
|
297 |
+
|
298 |
+
if ( isset( $item->position ) ) {
|
299 |
+
$position = (int) $item->position;
|
300 |
+
}
|
301 |
+
|
302 |
+
// If position is already taken, move to the first next available
|
303 |
+
if ( isset( $sorted[ $position ] ) ) {
|
304 |
+
$sorted_keys = array_keys( $sorted );
|
305 |
+
|
306 |
+
do {
|
307 |
+
$position += 1;
|
308 |
+
} while ( in_array( $position, $sorted_keys ) );
|
309 |
+
}
|
310 |
+
|
311 |
+
$sorted[ $position ] = $item;
|
312 |
+
}
|
313 |
+
|
314 |
+
ksort( $sorted );
|
315 |
+
return $sorted;
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Gets the primary nav items.
|
320 |
+
*
|
321 |
+
* @since 2.6.0
|
322 |
+
*
|
323 |
+
* @param array $args Filters to select the specific primary items. See wp_list_filter().
|
324 |
+
* @param bool $sort True to sort the nav items. False otherwise.
|
325 |
+
* @return array The list of primary objects nav
|
326 |
+
*/
|
327 |
+
public function get_primary( $args = array(), $sort = true ) {
|
328 |
+
$params = wp_parse_args( $args, array( 'primary' => true ) );
|
329 |
+
|
330 |
+
// This parameter is not overridable
|
331 |
+
if ( empty( $params['primary'] ) ) {
|
332 |
+
return false;
|
333 |
+
}
|
334 |
+
|
335 |
+
$primary_nav = wp_list_filter( $this->nav[ $this->object_id ], $params );
|
336 |
+
|
337 |
+
if ( ! $primary_nav ) {
|
338 |
+
return false;
|
339 |
+
}
|
340 |
+
|
341 |
+
if ( true !== $sort ) {
|
342 |
+
return $primary_nav;
|
343 |
+
}
|
344 |
+
|
345 |
+
return $this->sort_nav( $primary_nav );
|
346 |
+
}
|
347 |
+
|
348 |
+
/**
|
349 |
+
* Gets the secondary nav items.
|
350 |
+
*
|
351 |
+
* @since 2.6.0
|
352 |
+
*
|
353 |
+
* @param array $args Filters to select the specific secondary items. See wp_list_filter().
|
354 |
+
* @param bool $sort True to sort the nav items. False otherwise.
|
355 |
+
* @return array The list of secondary objects nav
|
356 |
+
*/
|
357 |
+
public function get_secondary( $args = array(), $sort = true ) {
|
358 |
+
$params = wp_parse_args( $args, array( 'parent_slug' => '' ) );
|
359 |
+
|
360 |
+
// No need to search children if the parent is not set
|
361 |
+
if ( empty( $params['parent_slug'] ) && empty( $params['secondary'] ) ) {
|
362 |
+
return false;
|
363 |
+
}
|
364 |
+
|
365 |
+
$secondary_nav = wp_list_filter( $this->nav[ $this->object_id ], $params );
|
366 |
+
|
367 |
+
if ( ! $secondary_nav ) {
|
368 |
+
return false;
|
369 |
+
}
|
370 |
+
|
371 |
+
if ( true !== $sort ) {
|
372 |
+
return $secondary_nav;
|
373 |
+
}
|
374 |
+
|
375 |
+
return $this->sort_nav( $secondary_nav );
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Gets a nested list of visible nav items.
|
380 |
+
*
|
381 |
+
* @since 2.6.0
|
382 |
+
*
|
383 |
+
* @return array The list of visible nav items.
|
384 |
+
*/
|
385 |
+
public function get_item_nav() {
|
386 |
+
$primary_nav_items = $this->get_primary( array( 'show_for_displayed_user' => true ) );
|
387 |
+
|
388 |
+
if ( $primary_nav_items ) {
|
389 |
+
foreach( $primary_nav_items as $key_nav => $primary_nav ) {
|
390 |
+
// Try to get the children
|
391 |
+
$children = $this->get_secondary( array( 'parent_slug' => $primary_nav->slug, 'user_has_access' => true ) );
|
392 |
+
|
393 |
+
if ( $children ) {
|
394 |
+
$primary_nav_items[ $key_nav ] = clone( $primary_nav );
|
395 |
+
$primary_nav_items[ $key_nav ]->children = $children;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
}
|
399 |
+
|
400 |
+
return $primary_nav_items;
|
401 |
+
}
|
402 |
+
}
|
@@ -0,0 +1,616 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Core component classes.
|
4 |
+
*
|
5 |
+
* @package BuddyPress
|
6 |
+
* @subpackage Core
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Exit if accessed directly.
|
10 |
+
defined( 'ABSPATH' ) || exit;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* API for responding and returning a custom oEmbed request.
|
14 |
+
*
|
15 |
+
* @since 2.6.0
|
16 |
+
*/
|
17 |
+
abstract class BP_Core_oEmbed_Extension {
|
18 |
+
|
19 |
+
/** START PROPERTIES ****************************************************/
|
20 |
+
|
21 |
+
/**
|
22 |
+
* (required) The slug endpoint.
|
23 |
+
*
|
24 |
+
* Should be your component id.
|
25 |
+
*
|
26 |
+
* @since 2.6.0
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
public $slug_endpoint = '';
|
31 |
+
|
32 |
+
/** END PROPERTIES ******************************************************/
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Constructor.
|
36 |
+
*/
|
37 |
+
final public function __construct() {
|
38 |
+
$this->setup_properties();
|
39 |
+
|
40 |
+
// Some rudimentary logic checking.
|
41 |
+
if ( empty( $this->slug_endpoint ) ) {
|
42 |
+
return;
|
43 |
+
}
|
44 |
+
|
45 |
+
$this->setup_hooks();
|
46 |
+
$this->custom_hooks();
|
47 |
+
}
|
48 |
+
|
49 |
+
/** REQUIRED METHODS ****************************************************/
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Add content for your oEmbed response here.
|
53 |
+
*
|
54 |
+
* @since 2.6.0
|
55 |
+
*/
|
56 |
+
abstract protected function content();
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Add a check for when you are on the page you want to oEmbed.
|
60 |
+
*
|
61 |
+
* You'll want to return a boolean here. eg. bp_is_single_activity().
|
62 |
+
*
|
63 |
+
* @since 2.6.0
|
64 |
+
*
|
65 |
+
* @return bool
|
66 |
+
*/
|
67 |
+
abstract protected function is_page();
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Validate the URL to see if it matches your item ID.
|
71 |
+
*
|
72 |
+
* @since 2.6.0
|
73 |
+
*
|
74 |
+
* @return int Your item ID
|
75 |
+
*/
|
76 |
+
abstract protected function validate_url_to_item_id( $url );
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Set the oEmbed response data.
|
80 |
+
*
|
81 |
+
* @since 2.6.0
|
82 |
+
*
|
83 |
+
* @param int $item_id Your item ID to do checks against.
|
84 |
+
* @return array Should contain 'content', 'title', 'author_url', 'author_name' as array
|
85 |
+
* keys. 'author_url' and 'author_name' is optional; the rest are required.
|
86 |
+
*/
|
87 |
+
abstract protected function set_oembed_response_data( $item_id );
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Sets the fallback HTML for the oEmbed response.
|
91 |
+
*
|
92 |
+
* In a WordPress oEmbed item, the fallback HTML is a <blockquote>. This is
|
93 |
+
* usually hidden after the <iframe> is loaded.
|
94 |
+
*
|
95 |
+
* @since 2.6.0
|
96 |
+
*
|
97 |
+
* @param int $item_id Your item ID to do checks against.
|
98 |
+
* @return string Fallback HTML you want to output.
|
99 |
+
*/
|
100 |
+
abstract protected function set_fallback_html( $item_id );
|
101 |
+
|
102 |
+
/** OPTIONAL METHODS ****************************************************/
|
103 |
+
|
104 |
+
/**
|
105 |
+
* If your oEmbed endpoint requires additional arguments, set them here.
|
106 |
+
*
|
107 |
+
* @see register_rest_route() View the $args parameter for more info.
|
108 |
+
*
|
109 |
+
* @since 2.6.0
|
110 |
+
*
|
111 |
+
* @return array
|
112 |
+
*/
|
113 |
+
protected function set_route_args() {
|
114 |
+
return array();
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Set the iframe title.
|
119 |
+
*
|
120 |
+
* If not set, this will fallback to WP's 'Embedded WordPress Post'.
|
121 |
+
*
|
122 |
+
* @since 2.6.0
|
123 |
+
*
|
124 |
+
* @param int $item_id The item ID to do checks for.
|
125 |
+
* @return string
|
126 |
+
*/
|
127 |
+
protected function set_iframe_title( $item_id ) {}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Do what you need to do here to initialize any custom hooks.
|
131 |
+
*
|
132 |
+
* @since 2.6.0
|
133 |
+
*/
|
134 |
+
protected function custom_hooks() {}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Set permalink for oEmbed link discovery.
|
138 |
+
*
|
139 |
+
* This method will be called on the page we want to oEmbed. In most cases,
|
140 |
+
* you will not need to override this method. However, if you need to, do
|
141 |
+
* override in your extended class.
|
142 |
+
*
|
143 |
+
* @since 2.6.0
|
144 |
+
*/
|
145 |
+
protected function set_permalink() {
|
146 |
+
$url = bp_get_requested_url();
|
147 |
+
|
148 |
+
// Remove querystring from bp_get_requested_url()
|
149 |
+
if ( false !== strpos( bp_get_requested_url(), '?' ) ) {
|
150 |
+
$url = substr( bp_get_requested_url(), 0, strpos( bp_get_requested_url(), '?' ) );
|
151 |
+
}
|
152 |
+
|
153 |
+
return $url;
|
154 |
+
}
|
155 |
+
|
156 |
+
/** HELPERS *************************************************************/
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Get the item ID when filtering the oEmbed HTML.
|
160 |
+
*
|
161 |
+
* Should only be used during the 'embed_html' hook.
|
162 |
+
*
|
163 |
+
* @since 2.6.0
|
164 |
+
*/
|
165 |
+
protected function get_item_id() {
|
166 |
+
return $this->is_page() ? $this->validate_url_to_item_id( $this->set_permalink() ) : buddypress()->{$this->slug_endpoint}->embedid_in_progress;
|
167 |
+
}
|
168 |
+
|
169 |
+
/** SET UP **************************************************************/
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Set up properties.
|
173 |
+
*
|
174 |
+
* @since 2.6.0
|
175 |
+
*/
|
176 |
+
protected function setup_properties() {
|
177 |
+
$this->slug_endpoint = sanitize_title( $this->slug_endpoint );
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Hooks! We do the dirty work here, so you don't have to! :)
|
182 |
+
*
|
183 |
+
* More hooks are available in the setup_template_parts() method.
|
184 |
+
*
|
185 |
+
* @since 2.6.0
|
186 |
+
*/
|
187 |
+
protected function setup_hooks() {
|
188 |
+
add_action( 'rest_api_init', array( $this, 'register_route' ) );
|
189 |
+
add_action( 'bp_embed_content', array( $this, 'inject_content' ) );
|
190 |
+
|
191 |
+
add_filter( 'embed_template', array( $this, 'setup_template_parts' ) );
|
192 |
+
add_filter( 'post_embed_url', array( $this, 'filter_embed_url' ) );
|
193 |
+
add_filter( 'embed_html', array( $this, 'filter_embed_html' ) );
|
194 |
+
add_filter( 'oembed_discovery_links', array( $this, 'add_oembed_discovery_links' ) );
|
195 |
+
add_filter( 'rest_pre_serve_request', array( $this, 'oembed_xml_request' ), 20, 4 );
|
196 |
+
}
|
197 |
+
|
198 |
+
/** HOOKS ***************************************************************/
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Register the oEmbed REST API route.
|
202 |
+
*
|
203 |
+
* @since 2.6.0
|
204 |
+
*/
|
205 |
+
public function register_route() {
|
206 |
+
/** This filter is documented in wp-includes/class-wp-oembed-controller.php */
|
207 |
+
$maxwidth = apply_filters( 'oembed_default_width', 600 );
|
208 |
+
|
209 |
+
// Required arguments.
|
210 |
+
$args = array(
|
211 |
+
'url' => array(
|
212 |
+
'required' => true,
|
213 |
+
'sanitize_callback' => 'esc_url_raw',
|
214 |
+
),
|
215 |
+
'format' => array(
|
216 |
+
'default' => 'json',
|
217 |
+
'sanitize_callback' => 'wp_oembed_ensure_format',
|
218 |
+
),
|
219 |
+
'maxwidth' => array(
|
220 |
+
'default' => $maxwidth,
|
221 |
+
'sanitize_callback' => 'absint',
|
222 |
+
)
|
223 |
+
);
|
224 |
+
|
225 |
+
// Merge custom arguments here.
|
226 |
+
$args = $args + (array) $this->set_route_args();
|
227 |
+
|
228 |
+
register_rest_route( 'oembed/1.0', "/embed/{$this->slug_endpoint}", array(
|
229 |
+
array(
|
230 |
+
'methods' => WP_REST_Server::READABLE,
|
231 |
+
'callback' => array( $this, 'get_item' ),
|
232 |
+
'args' => $args
|
233 |
+
),
|
234 |
+
) );
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Set up custom embed template parts for BuddyPress use.
|
239 |
+
*
|
240 |
+
* @since 2.6.0
|
241 |
+
*
|
242 |
+
* @param string $template File path to current embed template.
|
243 |
+
* @return string
|
244 |
+
*/
|
245 |
+
public function setup_template_parts( $template ) {
|
246 |
+
// Determine if we're on our BP page.
|
247 |
+
if ( ! $this->is_page() || is_404() ) {
|
248 |
+
return $template;
|
249 |
+
}
|
250 |
+
|
251 |
+
// Set up some BP-specific embed template overrides.
|
252 |
+
add_action( 'get_template_part_embed', array( $this, 'content_buffer_start' ), -999, 2 );
|
253 |
+
add_action( 'get_footer', array( $this, 'content_buffer_end' ), -999 );
|
254 |
+
|
255 |
+
// Return the original WP embed template.
|
256 |
+
return $template;
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Start object buffer.
|
261 |
+
*
|
262 |
+
* We're going to override WP's get_template_part( 'embed, 'content' ) call
|
263 |
+
* and inject our own template for BuddyPress use.
|
264 |
+
*
|
265 |
+
* @since 2.6.0
|
266 |
+
*/
|
267 |
+
public function content_buffer_start( $slug, $name ) {
|
268 |
+
if ( 'embed' !== $slug || 'content' !== $name ) {
|
269 |
+
return;
|
270 |
+
}
|
271 |
+
|
272 |
+
// Start the buffer to wipe out get_template_part( 'embed, 'content' ).
|
273 |
+
ob_start();
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* End object buffer.
|
278 |
+
*
|
279 |
+
* We're going to override WP's get_template_part( 'embed, 'content' ) call
|
280 |
+
* and inject our own template for BuddyPress use.
|
281 |
+
*
|
282 |
+
* @since 2.6.0
|
283 |
+
*/
|
284 |
+
public function content_buffer_end( $name ) {
|
285 |
+
if ( 'embed' !== $name || is_404() ) {
|
286 |
+
return;
|
287 |
+
}
|
288 |
+
|
289 |
+
// Wipe out get_template_part( 'embed, 'content' ).
|
290 |
+
ob_end_clean();
|
291 |
+
|
292 |
+
// Start our custom BuddyPress embed template!
|
293 |
+
echo '<div ';
|
294 |
+
post_class( 'wp-embed' );
|
295 |
+
echo '>';
|
296 |
+
|
297 |
+
// Template part for our embed header.
|
298 |
+
bp_get_asset_template_part( 'embeds/header', bp_current_component() );
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Inject BuddyPress embed content on this hook.
|
302 |
+
*
|
303 |
+
* You shouldn't really need to use this if you extend the
|
304 |
+
* {@link BP_oEmbed_Component} class.
|
305 |
+
*
|
306 |
+
* @since 2.6.0
|
307 |
+
*/
|
308 |
+
do_action( 'bp_embed_content' );
|
309 |
+
|
310 |
+
// Template part for our embed footer.
|
311 |
+
bp_get_asset_template_part( 'embeds/footer', bp_current_component() );
|
312 |
+
|
313 |
+
echo '</div>';
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Adds oEmbed discovery links on single activity pages.
|
318 |
+
*
|
319 |
+
* @since 2.6.0
|
320 |
+
*
|
321 |
+
* @param string $retval Current discovery links.
|
322 |
+
* @return string
|
323 |
+
*/
|
324 |
+
public function add_oembed_discovery_links( $retval ) {
|
325 |
+
if ( ! $this->is_page() ) {
|
326 |
+
return $retval;
|
327 |
+
}
|
328 |
+
|
329 |
+
$permalink = $this->set_permalink();
|
330 |
+
if ( empty( $permalink ) ) {
|
331 |
+
return $retval;
|
332 |
+
}
|
333 |
+
|
334 |
+
add_filter( 'rest_url' , array( $this, 'filter_rest_url' ) );
|
335 |
+
|
336 |
+
$retval = '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( $permalink ) ) . '" />' . "\n";
|
337 |
+
|
338 |
+
if ( class_exists( 'SimpleXMLElement' ) ) {
|
339 |
+
$retval .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( $permalink, 'xml' ) ) . '" />' . "\n";
|
340 |
+
}
|
341 |
+
|
342 |
+
remove_filter( 'rest_url' , array( $this, 'filter_rest_url' ) );
|
343 |
+
|
344 |
+
return $retval;
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Fetch our oEmbed response data to return.
|
349 |
+
*
|
350 |
+
* A simplified version of {@link get_oembed_response_data()}.
|
351 |
+
*
|
352 |
+
* @since 2.6.0
|
353 |
+
*
|
354 |
+
* @link http://oembed.com/ View the 'Response parameters' section for more details.
|
355 |
+
*
|
356 |
+
* @param array $item Custom oEmbed response data.
|
357 |
+
* @param int $width The requested width.
|
358 |
+
* @return array
|
359 |
+
*/
|
360 |
+
protected function get_oembed_response_data( $item, $width ) {
|
361 |
+
$data = wp_parse_args( $item, array(
|
362 |
+
'version' => '1.0',
|
363 |
+
'provider_name' => get_bloginfo( 'name' ),
|
364 |
+
'provider_url' => get_home_url(),
|
365 |
+
'author_name' => get_bloginfo( 'name' ),
|
366 |
+
'author_url' => get_home_url(),
|
367 |
+
'title' => ucfirst( $this->slug_endpoint ),
|
368 |
+
'type' => 'rich',
|
369 |
+
) );
|
370 |
+
|
371 |
+
/** This filter is documented in /wp-includes/embed.php */
|
372 |
+
$min_max_width = apply_filters( 'oembed_min_max_width', array(
|
373 |
+
'min' => 200,
|
374 |
+
'max' => 600
|
375 |
+
) );
|
376 |
+
|
377 |
+
$width = min( max( $min_max_width['min'], $width ), $min_max_width['max'] );
|
378 |
+
$height = max( ceil( $width / 16 * 9 ), 200 );
|
379 |
+
|
380 |
+
$data['width'] = absint( $width );
|
381 |
+
$data['height'] = absint( $height );
|
382 |
+
|
383 |
+
// Set 'html' parameter.
|
384 |
+
if ( 'video' === $data['type'] || 'rich' === $data['type'] ) {
|
385 |
+
// Fake a WP post so we can use get_post_embed_html().
|
386 |
+
$post = new stdClass;
|
387 |
+
$post->post_content = $data['content'];
|
388 |
+
$post->post_title = $data['title'];
|
389 |
+
|
390 |
+
$data['html'] = get_post_embed_html( $data['width'], $data['height'], $post );
|
391 |
+
}
|
392 |
+
|
393 |
+
// Remove temporary parameters.
|
394 |
+
unset( $data['content'] );
|
395 |
+
|
396 |
+
return $data;
|
397 |
+
}
|
398 |
+
|
399 |
+
/**
|
400 |
+
* Callback for the API endpoint.
|
401 |
+
*
|
402 |
+
* Returns the JSON object for the item.
|
403 |
+
*
|
404 |
+
* @since 2.6.0
|
405 |
+
*
|
406 |
+
* @param WP_REST_Request $request Full data about the request.
|
407 |
+
* @return WP_Error|array oEmbed response data or WP_Error on failure.
|
408 |
+
*/
|
409 |
+
public function get_item( $request ) {
|
410 |
+
$url = $request['url'];
|
411 |
+
|
412 |
+
$data = false;
|
413 |
+
|
414 |
+
$item_id = (int) $this->validate_url_to_item_id( $url );
|
415 |
+
|
416 |
+
if ( ! empty( $item_id ) ) {
|
417 |
+
// Add markers to tell that we're embedding a single activity.
|
418 |
+
// This is needed for various oEmbed response data filtering.
|
419 |
+
if ( empty( buddypress()->{$this->slug_endpoint} ) ) {
|
420 |
+
buddypress()->{$this->slug_endpoint} = new stdClass;
|
421 |
+
}
|
422 |
+
buddypress()->{$this->slug_endpoint}->embedurl_in_progress = $url;
|
423 |
+
buddypress()->{$this->slug_endpoint}->embedid_in_progress = $item_id;
|
424 |
+
|
425 |
+
// Save custom route args as well.
|
426 |
+
$custom_args = array_keys( (array) $this->set_route_args() );
|
427 |
+
if ( ! empty( $custom_args ) ) {
|
428 |
+
buddypress()->{$this->slug_endpoint}->embedargs_in_progress = array();
|
429 |
+
|
430 |
+
foreach( $custom_args as $arg ) {
|
431 |
+
if ( isset( $request[ $arg ] ) ) {
|
432 |
+
buddypress()->{$this->slug_endpoint}->embedargs_in_progress[ $arg ] = $request[ $arg ];
|
433 |
+
}
|
434 |
+
}
|
435 |
+
}
|
436 |
+
|
437 |
+
// Grab custom oEmbed response data.
|
438 |
+
$item = $this->set_oembed_response_data( $item_id );
|
439 |
+
|
440 |
+
// Set oEmbed response data.
|
441 |
+
$data = $this->get_oembed_response_data( $item, $request['maxwidth'] );
|
442 |
+
}
|
443 |
+
|
444 |
+
if ( ! $data ) {
|
445 |
+
return new WP_Error( 'oembed_invalid_url', get_status_header_desc( 404 ), array( 'status' => 404 ) );
|
446 |
+
}
|
447 |
+
|
448 |
+
return $data;
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* If oEmbed request wants XML, return XML instead of JSON.
|
453 |
+
*
|
454 |
+
* Basically a copy of {@link _oembed_rest_pre_serve_request()}. Unfortunate
|
455 |
+
* that we have to duplicate this just for a URL check.
|
456 |
+
*
|
457 |
+
* @since 2.6.0
|
458 |
+
*
|
459 |
+
* @param bool $served Whether the request has already been served.
|
460 |
+
* @param WP_HTTP_ResponseInterface $result Result to send to the client. Usually a WP_REST_Response.
|
461 |
+
* @param WP_REST_Request $request Request used to generate the response.
|
462 |
+
* @param WP_REST_Server $server Server instance.
|
463 |
+
* @return bool
|
464 |
+
*/
|
465 |
+
public function oembed_xml_request( $served, $result, $request, $server ) {
|
466 |
+
$params = $request->get_params();
|
467 |
+
|
468 |
+
if ( ! isset( $params['format'] ) || 'xml' !== $params['format'] ) {
|
469 |
+
return $served;
|
470 |
+
}
|
471 |
+
|
472 |
+
// Validate URL against our oEmbed endpoint. If not valid, bail.
|
473 |
+
// This is our mod to _oembed_rest_pre_serve_request().
|
474 |
+
$query_params = $request->get_query_params();
|
475 |
+
if ( false === $this->validate_url_to_item_id( $query_params['url'] ) ) {
|
476 |
+
return $served;
|
477 |
+
}
|
478 |
+
|
479 |
+
// Embed links inside the request.
|
480 |
+
$data = $server->response_to_data( $result, false );
|
481 |
+
|
482 |
+
if ( ! class_exists( 'SimpleXMLElement' ) ) {
|
483 |
+
status_header( 501 );
|
484 |
+
die( get_status_header_desc( 501 ) );
|
485 |
+
}
|
486 |
+
|
487 |
+
$result = _oembed_create_xml( $data );
|
488 |
+
|
489 |
+
// Bail if there's no XML.
|
490 |
+
if ( ! $result ) {
|
491 |
+
status_header( 501 );
|
492 |
+
return get_status_header_desc( 501 );
|
493 |
+
}
|
494 |
+
|
495 |
+
if ( ! headers_sent() ) {
|
496 |
+
$server->send_header( 'Content-Type', 'text/xml; charset=' . get_option( 'blog_charset' ) );
|
497 |
+
}
|
498 |
+
|
499 |
+
echo $result;
|
500 |
+
|
501 |
+
return true;
|
502 |
+
}
|
503 |
+
|
504 |
+
/**
|
505 |
+
* Pass our BuddyPress activity permalink for embedding.
|
506 |
+
*
|
507 |
+
* @since 2.6.0
|
508 |
+
*
|
509 |
+
* @see bp_activity_embed_rest_route_callback()
|
510 |
+
*
|
511 |
+
* @param string $retval Current embed URL
|
512 |
+
* @return string
|
513 |
+
*/
|
514 |
+
public function filter_embed_url( $retval ) {
|
515 |
+
if ( false === isset( buddypress()->{$this->slug_endpoint}->embedurl_in_progress ) && ! $this->is_page() ) {
|
516 |
+
return $retval;
|
517 |
+
}
|
518 |
+
|
519 |
+
$url = $this->is_page() ? $this->set_permalink() : buddypress()->{$this->slug_endpoint}->embedurl_in_progress;
|
520 |
+
$url = trailingslashit( $url );
|
521 |
+
|
522 |
+
// This is for the 'WordPress Embed' block
|
523 |
+
// @see bp_activity_embed_comments_button()
|
524 |
+
if ( 'the_permalink' !== current_filter() ) {
|
525 |
+
$url = add_query_arg( 'embed', 'true', trailingslashit( $url ) );
|
526 |
+
|
527 |
+
// Add custom route args to iframe.
|
528 |
+
if ( ! empty( buddypress()->{$this->slug_endpoint}->embedargs_in_progress ) ) {
|
529 |
+
foreach( buddypress()->{$this->slug_endpoint}->embedargs_in_progress as $key => $value ) {
|
530 |
+
$url = add_query_arg( $key, $value, $url );
|
531 |
+
}
|
532 |
+
}
|
533 |
+
}
|
534 |
+
|
535 |
+
return $url;
|
536 |
+
}
|
537 |
+
|
538 |
+
/**
|
539 |
+
* Filters the embed HTML for our BP oEmbed endpoint.
|
540 |
+
*
|
541 |
+
* @since 2.6.0
|
542 |
+
*
|
543 |
+
* @param string $retval Current embed HTML
|
544 |
+
* @return string
|
545 |
+
*/
|
546 |
+
public function filter_embed_html( $retval ) {
|
547 |
+
if ( false === isset( buddypress()->{$this->slug_endpoint}->embedurl_in_progress ) && ! $this->is_page() ) {
|
548 |
+
return $retval;
|
549 |
+
}
|
550 |
+
|
551 |
+
$url = $this->set_permalink();
|
552 |
+
|
553 |
+
$item_id = $this->is_page() ? $this->validate_url_to_item_id( $url ) : buddypress()->{$this->slug_endpoint}->embedid_in_progress;
|
554 |
+
|
555 |
+
// Change 'Embedded WordPress Post' to custom title.
|
556 |
+
$custom_title = $this->set_iframe_title( $item_id );
|
557 |
+
if ( ! empty( $custom_title ) ) {
|
558 |
+
$title_pos = strpos( $retval, 'title=' ) + 7;
|
559 |
+
$title_end_pos = strpos( $retval, '"', $title_pos );
|
560 |
+
|
561 |
+
$retval = substr_replace( $retval, esc_attr( $custom_title ), $title_pos, $title_end_pos - $title_pos );
|
562 |
+
}
|
563 |
+
|
564 |
+
// Add 'max-width' CSS attribute to IFRAME.
|
565 |
+
// This will make our oEmbeds responsive.
|
566 |
+
if ( false === strpos( $retval, 'style="max-width' ) ) {
|
567 |
+
$retval = str_replace( '<iframe', '<iframe style="max-width:100%"', $retval );
|
568 |
+
}
|
569 |
+
|
570 |
+
// Remove default <blockquote>
|
571 |
+
$retval = substr( $retval, strpos( $retval, '</blockquote>' ) + 13 );
|
572 |
+
|
573 |
+
// Set up new fallback HTML
|
574 |
+
// @todo Maybe use KSES?
|
575 |
+
$fallback_html = $this->set_fallback_html( $item_id );
|
576 |
+
|
577 |
+
/**
|
578 |
+
* Dynamic filter to return BP oEmbed HTML.
|
579 |
+
*
|
580 |
+
* @since 2.6.0
|
581 |
+
*
|
582 |
+
* @var string $retval
|
583 |
+
*/
|
584 |
+
return apply_filters( "bp_{$this->slug_endpoint}_embed_html", $fallback_html . $retval );
|
585 |
+
}
|
586 |
+
|
587 |
+
/**
|
588 |
+
* Append our custom slug endpoint to oEmbed endpoint URL.
|
589 |
+
*
|
590 |
+
* Meant to be used as a filter on 'rest_url' before any call to
|
591 |
+
* {@link get_oembed_endpoint_url()} is used.
|
592 |
+
*
|
593 |
+
* @since 2.6.0
|
594 |
+
*
|
595 |
+
* @see add_oembed_discovery_links()
|
596 |
+
*
|
597 |
+
* @param string $retval Current oEmbed endpoint URL
|
598 |
+
* @return string
|
599 |
+
*/
|
600 |
+
public function filter_rest_url( $retval = '' ) {
|
601 |
+
return $retval . "/{$this->slug_endpoint}";
|
602 |
+
}
|
603 |
+
|
604 |
+
/**
|
605 |
+
* Inject content into the embed template.
|
606 |
+
*
|
607 |
+
* @since 2.6.0
|
608 |
+
*/
|
609 |
+
public function inject_content() {
|
610 |
+
if ( ! $this->is_page() ) {
|
611 |
+
return;
|
612 |
+
}
|
613 |
+
|
614 |
+
$this->content();
|
615 |
+
}
|
616 |
+
}
|
@@ -146,18 +146,6 @@ class BP_Core_User {
|
|
146 |
Â
|
147 |
Â
/**
|
148 |
Â
* Populate the instantiated class with data based on the User ID provided.
|
149 |
-
*
|
150 |
-
* @uses bp_core_get_userurl() Returns the URL with no HTML markup for
|
151 |
-
* a user based on their user id.
|
152 |
-
* @uses bp_core_get_userlink() Returns a HTML formatted link for a
|
153 |
-
* user with the user's full name as the link text.
|
154 |
-
* @uses bp_core_get_user_email() Returns the email address for the
|
155 |
-
* user based on user ID.
|
156 |
-
* @uses bp_get_user_meta() BP function returns the value of passed
|
157 |
-
* usermeta name from usermeta table.
|
158 |
-
* @uses bp_core_fetch_avatar() Returns HTML formatted avatar for a user
|
159 |
-
* @uses bp_profile_last_updated_date() Returns the last updated date
|
160 |
-
* for a user.
|
161 |
Â
*/
|
162 |
Â
public function populate() {
|
163 |
Â
|
@@ -934,7 +922,7 @@ class BP_Core_User {
|
|
934 |
Â
|
935 |
Â
$existing = self::get_last_activity( $user_id );
|
936 |
Â
|
937 |
-
if ( empty( $existing ) ) {
|
938 |
Â
return false;
|
939 |
Â
}
|
940 |
Â
|
146 |
Â
|
147 |
Â
/**
|
148 |
Â
* Populate the instantiated class with data based on the User ID provided.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
149 |
Â
*/
|
150 |
Â
public function populate() {
|
151 |
Â
|
922 |
Â
|
923 |
Â
$existing = self::get_last_activity( $user_id );
|
924 |
Â
|
925 |
+
if ( empty( $existing ) || empty( $existing[ $user_id ]['activity_id'] ) ) {
|
926 |
Â
return false;
|
927 |
Â
}
|
928 |
Â
|
@@ -24,7 +24,6 @@ class BP_Core extends BP_Component {
|
|
24 |
Â
*
|
25 |
Â
* @since 1.5.0
|
26 |
Â
*
|
27 |
-
* @uses BP_Core::bootstrap()
|
28 |
Â
*/
|
29 |
Â
public function __construct() {
|
30 |
Â
parent::start(
|
@@ -254,6 +253,12 @@ class BP_Core extends BP_Component {
|
|
254 |
Â
// bp-notifications instead.
|
255 |
Â
$bp->core->table_name_notifications = $bp->table_prefix . 'bp_notifications';
|
256 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
257 |
Â
/**
|
258 |
Â
* Used to determine if user has admin rights on current content. If the
|
259 |
Â
* logged in user is viewing their own profile and wants to delete
|
24 |
Â
*
|
25 |
Â
* @since 1.5.0
|
26 |
Â
*
|
Â
|
|
27 |
Â
*/
|
28 |
Â
public function __construct() {
|
29 |
Â
parent::start(
|
253 |
Â
// bp-notifications instead.
|
254 |
Â
$bp->core->table_name_notifications = $bp->table_prefix . 'bp_notifications';
|
255 |
Â
|
256 |
+
// Backward compatibility for plugins modifying the legacy bp_nav and bp_options_nav global properties.
|
257 |
+
if ( buddypress()->do_nav_backcompat ) {
|
258 |
+
$bp->bp_nav = new BP_Core_BP_Nav_BackCompat();
|
259 |
+
$bp->bp_options_nav = new BP_Core_BP_Options_Nav_BackCompat();
|
260 |
+
}
|
261 |
+
|
262 |
Â
/**
|
263 |
Â
* Used to determine if user has admin rights on current content. If the
|
264 |
Â
* logged in user is viewing their own profile and wants to delete
|
@@ -55,19 +55,23 @@ class BP_Email_Recipient {
|
|
55 |
Â
public function __construct( $email_or_user, $name = '' ) {
|
56 |
Â
$name = sanitize_text_field( $name );
|
57 |
Â
|
58 |
-
// User ID, WP_User object.
|
59 |
-
if ( is_int( $email_or_user ) || is_object( $email_or_user ) ) {
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
Â
|
|
Â
|
|
Â
|
|
65 |
Â
|
66 |
-
|
67 |
-
|
Â
|
|
68 |
Â
}
|
69 |
Â
|
70 |
-
// Array
|
71 |
Â
} else {
|
72 |
Â
if ( ! is_array( $email_or_user ) ) {
|
73 |
Â
$email_or_user = array( $email_or_user => $name );
|
@@ -80,11 +84,30 @@ class BP_Email_Recipient {
|
|
80 |
Â
$address = key( $email_or_user );
|
81 |
Â
$name = current( $email_or_user );
|
82 |
Â
}
|
Â
|
|
83 |
Â
|
84 |
-
|
85 |
-
|
86 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
87 |
Â
|
Â
|
|
Â
|
|
88 |
Â
$this->name = $name;
|
89 |
Â
}
|
90 |
Â
|
55 |
Â
public function __construct( $email_or_user, $name = '' ) {
|
56 |
Â
$name = sanitize_text_field( $name );
|
57 |
Â
|
58 |
+
// User ID, email address or WP_User object.
|
59 |
+
if ( is_int( $email_or_user ) || ( is_string( $email_or_user ) && is_email( $email_or_user ) ) || is_object( $email_or_user ) ) {
|
60 |
+
// We already have a WP user.
|
61 |
+
if ( is_object( $email_or_user ) ) {
|
62 |
+
$this->user_object = $email_or_user;
|
63 |
+
|
64 |
+
// Query for WP user by user ID.
|
65 |
+
} elseif ( is_int( $email_or_user ) ) {
|
66 |
+
$this->user_object = get_user_by( 'id', $email_or_user );
|
67 |
+
}
|
68 |
Â
|
69 |
+
// Set email address.
|
70 |
+
if ( empty( $this->user_object ) && is_email( $email_or_user ) ) {
|
71 |
+
$address = $email_or_user;
|
72 |
Â
}
|
73 |
Â
|
74 |
+
// Array or miscellaneous string.
|
75 |
Â
} else {
|
76 |
Â
if ( ! is_array( $email_or_user ) ) {
|
77 |
Â
$email_or_user = array( $email_or_user => $name );
|
84 |
Â
$address = key( $email_or_user );
|
85 |
Â
$name = current( $email_or_user );
|
86 |
Â
}
|
87 |
+
}
|
88 |
Â
|
89 |
+
// Set address if we have one.
|
90 |
+
if ( ! empty( $address ) ) {
|
91 |
+
$this->address = sanitize_email( $address );
|
92 |
+
}
|
93 |
+
|
94 |
+
// Still no user object; try to query user by email address.
|
95 |
+
if ( empty( $this->user_object ) ) {
|
96 |
+
$this->get_user( 'search-email' );
|
97 |
+
}
|
98 |
+
|
99 |
+
// We have a user object; so set address and name from DB.
|
100 |
+
if ( $this->user_object ) {
|
101 |
+
// This is escaped with esc_html in bp_core_get_user_displayname()
|
102 |
+
$wp_name = wp_specialchars_decode( bp_core_get_user_displayname( $this->user_object->ID ), ENT_QUOTES );
|
103 |
+
|
104 |
+
$this->address = $this->user_object->user_email;
|
105 |
+
$this->name = sanitize_text_field( $wp_name );
|
106 |
+
|
107 |
+
}
|
108 |
Â
|
109 |
+
// Custom name override.
|
110 |
+
if ( $name ) {
|
111 |
Â
$this->name = $name;
|
112 |
Â
}
|
113 |
Â
|
@@ -75,11 +75,6 @@ class BP_Embed extends WP_Embed {
|
|
75 |
Â
* enabled, then the URL will be passed to {@link BP_Embed::parse_oembed()}
|
76 |
Â
* for oEmbed parsing.
|
77 |
Â
*
|
78 |
-
* @uses wp_parse_args()
|
79 |
-
* @uses wp_embed_defaults()
|
80 |
-
* @uses current_user_can()
|
81 |
-
* @uses _wp_oembed_get_object()
|
82 |
-
* @uses WP_Embed::maybe_make_link()
|
83 |
Â
*
|
84 |
Â
* @param array $attr Shortcode attributes.
|
85 |
Â
* @param string $url The URL attempting to be embeded.
|
@@ -174,11 +169,7 @@ class BP_Embed extends WP_Embed {
|
|
174 |
Â
*
|
175 |
Â
* View an example to add support in {@link bp_activity_embed()}.
|
176 |
Â
*
|
177 |
-
* @uses apply_filters() Filters cache.
|
178 |
-
* @uses do_action() To save cache.
|
179 |
-
* @uses wp_oembed_get() Connects to oEmbed provider and returns HTML
|
180 |
Â
* on success.
|
181 |
-
* @uses WP_Embed::maybe_make_link() Process URL for hyperlinking on
|
182 |
Â
* oEmbed failure.
|
183 |
Â
*
|
184 |
Â
* @param int $id ID to do the caching for.
|
75 |
Â
* enabled, then the URL will be passed to {@link BP_Embed::parse_oembed()}
|
76 |
Â
* for oEmbed parsing.
|
77 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
78 |
Â
*
|
79 |
Â
* @param array $attr Shortcode attributes.
|
80 |
Â
* @param string $url The URL attempting to be embeded.
|
169 |
Â
*
|
170 |
Â
* View an example to add support in {@link bp_activity_embed()}.
|
171 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
172 |
Â
* on success.
|
Â
|
|
173 |
Â
* oEmbed failure.
|
174 |
Â
*
|
175 |
Â
* @param int $id ID to do the caching for.
|
@@ -788,9 +788,10 @@ class BP_User_Query {
|
|
788 |
Â
) );
|
789 |
Â
|
790 |
Â
// Switch to the root blog, where member type taxonomies live.
|
Â
|
|
791 |
Â
$switched = false;
|
792 |
-
if (
|
793 |
-
switch_to_blog(
|
794 |
Â
$switched = true;
|
795 |
Â
}
|
796 |
Â
|
788 |
Â
) );
|
789 |
Â
|
790 |
Â
// Switch to the root blog, where member type taxonomies live.
|
791 |
+
$site_id = bp_get_taxonomy_term_site_id( 'bp_member_type' );
|
792 |
Â
$switched = false;
|
793 |
+
if ( $site_id !== get_current_blog_id() ) {
|
794 |
+
switch_to_blog( $site_id );
|
795 |
Â
$switched = true;
|
796 |
Â
}
|
797 |
Â
|
@@ -84,7 +84,7 @@ class BP_Walker_Category_Checklist extends Walker {
|
|
84 |
Â
} else {
|
85 |
Â
/** This filter is documented in wp-includes/category-template.php */
|
86 |
Â
$output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
|
87 |
-
'<label class="selectit"><input value="' . $category->slug . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' .
|
88 |
Â
checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) .
|
89 |
Â
disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .
|
90 |
Â
esc_html( apply_filters( 'the_category', $category->description ) ) . '</label>';
|
84 |
Â
} else {
|
85 |
Â
/** This filter is documented in wp-includes/category-template.php */
|
86 |
Â
$output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
|
87 |
+
'<label for="in-'.$taxonomy.'-' . $category->term_id . '" class="selectit"><input value="' . $category->slug . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' .
|
88 |
Â
checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) .
|
89 |
Â
disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .
|
90 |
Â
esc_html( apply_filters( 'the_category', $category->description ) ) . '</label>';
|
@@ -142,7 +142,7 @@ div.bp-avatar-nav {
|
|
142 |
Â
|
143 |
Â
.drag-drop .drag-drop-inside p.drag-drop-buttons {
|
144 |
Â
margin: auto;
|
145 |
-
text-align:
|
146 |
Â
}
|
147 |
Â
|
148 |
Â
.drag-drop #drag-drop-area {
|
142 |
Â
|
143 |
Â
.drag-drop .drag-drop-inside p.drag-drop-buttons {
|
144 |
Â
margin: auto;
|
145 |
+
text-align: inherit;
|
146 |
Â
}
|
147 |
Â
|
148 |
Â
.drag-drop #drag-drop-area {
|
@@ -1 +1 @@
|
|
1 |
-
div.bp-avatar-status,div.bp-cover-image-status{clear:both;margin:1em 0}div.bp-avatar-status p.updated,div.bp-cover-image-status p.updated{display:block;padding:10px 15px}div.bp-avatar-status p.success,div.bp-cover-image-status p.success{background-color:#efc;border:1px solid #591;color:#250}div.bp-avatar-status p.error,div.bp-cover-image-status p.error{background-color:#fdc;border:1px solid #a00;color:#800}div.bp-avatar-status .bp-progress,div.bp-cover-image-status .bp-progress{background:0 0;border:1px solid #d1d1d1;float:left;height:22px;line-height:2em;margin:6px 0 2px 10px;padding:0;overflow:hidden;width:200px}div.bp-avatar-status .bp-bar,div.bp-cover-image-status .bp-bar{background-color:#c3ff88;width:0;height:100%;z-index:9}.bp-uploader-progress div.error{background-color:#fdc;border:1px solid #a00;color:#800;display:block;font-size:90%;padding:10px 15px}#buddypress p.warning,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{background-color:#ffd;border:1px solid #cb2;color:#440;display:block;font-size:90%;margin:1em 0;padding:10px 15px}div.bp-avatar-nav{background:0 0;clear:both;margin:10px 0;overflow:hidden}.avatar-nav-items{margin:0;padding:0}.bp-avatar-nav .avatar-nav-items li.avatar-nav-item{float:right!important;margin:0;list-style:none}.avatar-nav-items li a{display:block;padding:5px 10px;text-decoration:none}.bp-avatar-nav ul:after,.bp-avatar-nav ul:before{content:" ";display:table}.bp-avatar-nav ul:after{clear:both}.bp-avatar-nav ul{border-bottom:1px solid #ccc;margin-bottom:10px}.bp-avatar-nav ul.avatar-nav-items li.current{border:1px solid #ccc;border-bottom-color:#fff;border-top-right-radius:4px;border-top-left-radius:4px;margin-bottom:-1px}.bp-avatar-nav li.current a{background:0 0;color:inherit;font-weight:700;opacity:.8;outline:0}#drag-drop-area{border:4px dashed #bbb;height:200px}.drag-drop.drag-over #drag-drop-area{border-color:#83b4d8}.drag-drop-inside p{display:none}.drag-drop-inside p.drag-drop-buttons{margin-top:80px;text-align:center}.drag-drop .drag-drop-inside p.drag-drop-buttons{margin:auto;text-align:
|
1 |
+
div.bp-avatar-status,div.bp-cover-image-status{clear:both;margin:1em 0}div.bp-avatar-status p.updated,div.bp-cover-image-status p.updated{display:block;padding:10px 15px}div.bp-avatar-status p.success,div.bp-cover-image-status p.success{background-color:#efc;border:1px solid #591;color:#250}div.bp-avatar-status p.error,div.bp-cover-image-status p.error{background-color:#fdc;border:1px solid #a00;color:#800}div.bp-avatar-status .bp-progress,div.bp-cover-image-status .bp-progress{background:0 0;border:1px solid #d1d1d1;float:left;height:22px;line-height:2em;margin:6px 0 2px 10px;padding:0;overflow:hidden;width:200px}div.bp-avatar-status .bp-bar,div.bp-cover-image-status .bp-bar{background-color:#c3ff88;width:0;height:100%;z-index:9}.bp-uploader-progress div.error{background-color:#fdc;border:1px solid #a00;color:#800;display:block;font-size:90%;padding:10px 15px}#buddypress p.warning,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{background-color:#ffd;border:1px solid #cb2;color:#440;display:block;font-size:90%;margin:1em 0;padding:10px 15px}div.bp-avatar-nav{background:0 0;clear:both;margin:10px 0;overflow:hidden}.avatar-nav-items{margin:0;padding:0}.bp-avatar-nav .avatar-nav-items li.avatar-nav-item{float:right!important;margin:0;list-style:none}.avatar-nav-items li a{display:block;padding:5px 10px;text-decoration:none}.bp-avatar-nav ul:after,.bp-avatar-nav ul:before{content:" ";display:table}.bp-avatar-nav ul:after{clear:both}.bp-avatar-nav ul{border-bottom:1px solid #ccc;margin-bottom:10px}.bp-avatar-nav ul.avatar-nav-items li.current{border:1px solid #ccc;border-bottom-color:#fff;border-top-right-radius:4px;border-top-left-radius:4px;margin-bottom:-1px}.bp-avatar-nav li.current a{background:0 0;color:inherit;font-weight:700;opacity:.8;outline:0}#drag-drop-area{border:4px dashed #bbb;height:200px}.drag-drop.drag-over #drag-drop-area{border-color:#83b4d8}.drag-drop-inside p{display:none}.drag-drop-inside p.drag-drop-buttons{margin-top:80px;text-align:center}.drag-drop .drag-drop-inside p.drag-drop-buttons{margin:auto;text-align:inherit}.drag-drop #drag-drop-area{box-sizing:border-box;display:table;height:100%;width:100%}.drag-drop .drag-drop-inside{display:table-cell;padding:40px 0;text-align:center;vertical-align:middle}.drag-drop .drag-drop-inside p,.drag-drop-inside p.drag-drop-buttons{display:block}.drag-drop .drag-drop-inside p{color:#aaa;font-size:110%;margin:5px 0;text-align:center}.drag-drop-inside p.drag-drop-info{margin-top:0}@supports (-ms-accelerator:true){.drag-drop-inside p.drag-drop-info{display:block}}#avatar-to-crop{margin:0 auto 20px;text-align:right}#bp-webcam-avatar #avatar-to-crop{float:right;margin:0 0 20px}#avatar-to-crop .jcrop-holder{margin:0 auto}.avatar-crop-management{clear:right;overflow:hidden;padding-top:20px;text-align:center}#bp-webcam-avatar .avatar-crop-management{clear:none;float:none;overflow:visible;padding-top:0;width:auto}#avatar-crop-pane{margin:0 auto;overflow:hidden}#bp-webcam-avatar #avatar-to-crop{border:1px solid #eee;max-width:100%;width:100%}@media screen and (min-width:801px){#bp-webcam-avatar #avatar-to-crop{max-width:64%;width:64%}}#avatar-crop-actions a{display:block}#bp-webcam-avatar #avatar-crop-actions{float:right;margin:0 0 20px;width:50%}#avatar-crop-actions a.button{margin-top:10px}#bp-webcam-avatar #avatar-crop-actions a.button{display:block;margin:0 0 5px;padding:4px 0;width:100%}#avatar-crop-pane canvas,#avatar-crop-pane img,#avatar-to-crop img,#avatar-upload-form img,#create-group-form img,#group-settings-form img{border:none!important;max-width:none!important}#bp-webcam-avatar video{float:right;margin-bottom:0;max-width:100%;width:100%;-webkit-transform:scaleX(-1);transform:scaleX(-1)}#bp-webcam-avatar #avatar-crop-pane{border:2px dashed #bbb;clear:right;float:left;margin:0 0 10px 40px;overflow:hidden}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{max-width:150px;max-height:150px}#avatar-crop-pane canvas{height:auto;width:100%;max-width:100%}.group-avatar .bp-avatar .avatar-crop-management{margin-right:0;padding-top:0;width:auto}.bp-avatar .item{overflow:hidden}.bp-avatar .avatar-crop-management.adjust{float:right;clear:none;padding-top:0}.bp-avatar #avatar-to-crop.adjust{float:right;margin-left:20px}@media screen and (max-width:480px){#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions,#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{float:none}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{margin:0 auto 10px}#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions{width:auto}}@media screen and (min-width:801px){#bp-webcam-avatar .avatar-crop-management{clear:none;float:left}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{float:none;margin:0 auto 10px}#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions{float:right;width:100%}}body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent{height:95%!important;width:95%!important}body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.updated,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.updated,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{display:block;padding:10px 15px}.wp-admin #TB_window .bp-avatar #avatar-to-crop{float:right;margin:0}.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop{margin-bottom:20px}@media screen and (min-width:783px){.wp-admin #TB_window .bp-avatar .avatar-crop-management{clear:none;float:right;margin-right:20px;padding-top:0;text-align:center}}.wp-admin #TB_window .bp-avatar #avatar-to-crop video{width:100%}.wp-admin #TB_window .bp-avatar .avatar-crop-management a.button{height:auto;line-height:inherit}@media screen and (min-width:810px){.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop{max-width:none;width:76%}.wp-admin #TB_window #bp-webcam-avatar .avatar-crop-management{max-width:none;width:auto}}
|
@@ -142,7 +142,7 @@ div.bp-avatar-nav {
|
|
142 |
Â
|
143 |
Â
.drag-drop .drag-drop-inside p.drag-drop-buttons {
|
144 |
Â
margin: auto;
|
145 |
-
text-align:
|
146 |
Â
}
|
147 |
Â
|
148 |
Â
.drag-drop #drag-drop-area {
|
142 |
Â
|
143 |
Â
.drag-drop .drag-drop-inside p.drag-drop-buttons {
|
144 |
Â
margin: auto;
|
145 |
+
text-align: inherit;
|
146 |
Â
}
|
147 |
Â
|
148 |
Â
.drag-drop #drag-drop-area {
|
@@ -1 +1 @@
|
|
1 |
-
div.bp-avatar-status,div.bp-cover-image-status{clear:both;margin:1em 0}div.bp-avatar-status p.updated,div.bp-cover-image-status p.updated{display:block;padding:10px 15px}div.bp-avatar-status p.success,div.bp-cover-image-status p.success{background-color:#efc;border:1px solid #591;color:#250}div.bp-avatar-status p.error,div.bp-cover-image-status p.error{background-color:#fdc;border:1px solid #a00;color:#800}div.bp-avatar-status .bp-progress,div.bp-cover-image-status .bp-progress{background:0 0;border:1px solid #d1d1d1;float:right;height:22px;line-height:2em;margin:6px 10px 2px 0;padding:0;overflow:hidden;width:200px}div.bp-avatar-status .bp-bar,div.bp-cover-image-status .bp-bar{background-color:#c3ff88;width:0;height:100%;z-index:9}.bp-uploader-progress div.error{background-color:#fdc;border:1px solid #a00;color:#800;display:block;font-size:90%;padding:10px 15px}#buddypress p.warning,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{background-color:#ffd;border:1px solid #cb2;color:#440;display:block;font-size:90%;margin:1em 0;padding:10px 15px}div.bp-avatar-nav{background:0 0;clear:both;margin:10px 0;overflow:hidden}.avatar-nav-items{margin:0;padding:0}.bp-avatar-nav .avatar-nav-items li.avatar-nav-item{float:left!important;margin:0;list-style:none}.avatar-nav-items li a{display:block;padding:5px 10px;text-decoration:none}.bp-avatar-nav ul:after,.bp-avatar-nav ul:before{content:" ";display:table}.bp-avatar-nav ul:after{clear:both}.bp-avatar-nav ul{border-bottom:1px solid #ccc;margin-bottom:10px}.bp-avatar-nav ul.avatar-nav-items li.current{border:1px solid #ccc;border-bottom-color:#fff;border-top-left-radius:4px;border-top-right-radius:4px;margin-bottom:-1px}.bp-avatar-nav li.current a{background:0 0;color:inherit;font-weight:700;opacity:.8;outline:0}#drag-drop-area{border:4px dashed #bbb;height:200px}.drag-drop.drag-over #drag-drop-area{border-color:#83b4d8}.drag-drop-inside p{display:none}.drag-drop-inside p.drag-drop-buttons{margin-top:80px;text-align:center}.drag-drop .drag-drop-inside p.drag-drop-buttons{margin:auto;text-align:
|
1 |
+
div.bp-avatar-status,div.bp-cover-image-status{clear:both;margin:1em 0}div.bp-avatar-status p.updated,div.bp-cover-image-status p.updated{display:block;padding:10px 15px}div.bp-avatar-status p.success,div.bp-cover-image-status p.success{background-color:#efc;border:1px solid #591;color:#250}div.bp-avatar-status p.error,div.bp-cover-image-status p.error{background-color:#fdc;border:1px solid #a00;color:#800}div.bp-avatar-status .bp-progress,div.bp-cover-image-status .bp-progress{background:0 0;border:1px solid #d1d1d1;float:right;height:22px;line-height:2em;margin:6px 10px 2px 0;padding:0;overflow:hidden;width:200px}div.bp-avatar-status .bp-bar,div.bp-cover-image-status .bp-bar{background-color:#c3ff88;width:0;height:100%;z-index:9}.bp-uploader-progress div.error{background-color:#fdc;border:1px solid #a00;color:#800;display:block;font-size:90%;padding:10px 15px}#buddypress p.warning,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{background-color:#ffd;border:1px solid #cb2;color:#440;display:block;font-size:90%;margin:1em 0;padding:10px 15px}div.bp-avatar-nav{background:0 0;clear:both;margin:10px 0;overflow:hidden}.avatar-nav-items{margin:0;padding:0}.bp-avatar-nav .avatar-nav-items li.avatar-nav-item{float:left!important;margin:0;list-style:none}.avatar-nav-items li a{display:block;padding:5px 10px;text-decoration:none}.bp-avatar-nav ul:after,.bp-avatar-nav ul:before{content:" ";display:table}.bp-avatar-nav ul:after{clear:both}.bp-avatar-nav ul{border-bottom:1px solid #ccc;margin-bottom:10px}.bp-avatar-nav ul.avatar-nav-items li.current{border:1px solid #ccc;border-bottom-color:#fff;border-top-left-radius:4px;border-top-right-radius:4px;margin-bottom:-1px}.bp-avatar-nav li.current a{background:0 0;color:inherit;font-weight:700;opacity:.8;outline:0}#drag-drop-area{border:4px dashed #bbb;height:200px}.drag-drop.drag-over #drag-drop-area{border-color:#83b4d8}.drag-drop-inside p{display:none}.drag-drop-inside p.drag-drop-buttons{margin-top:80px;text-align:center}.drag-drop .drag-drop-inside p.drag-drop-buttons{margin:auto;text-align:inherit}.drag-drop #drag-drop-area{box-sizing:border-box;display:table;height:100%;width:100%}.drag-drop .drag-drop-inside{display:table-cell;padding:40px 0;text-align:center;vertical-align:middle}.drag-drop .drag-drop-inside p,.drag-drop-inside p.drag-drop-buttons{display:block}.drag-drop .drag-drop-inside p{color:#aaa;font-size:110%;margin:5px 0;text-align:center}.drag-drop-inside p.drag-drop-info{margin-top:0}@supports (-ms-accelerator:true){.drag-drop-inside p.drag-drop-info{display:block}}#avatar-to-crop{margin:0 auto 20px;text-align:left}#bp-webcam-avatar #avatar-to-crop{float:left;margin:0 0 20px}#avatar-to-crop .jcrop-holder{margin:0 auto}.avatar-crop-management{clear:left;overflow:hidden;padding-top:20px;text-align:center}#bp-webcam-avatar .avatar-crop-management{clear:none;float:none;overflow:visible;padding-top:0;width:auto}#avatar-crop-pane{margin:0 auto;overflow:hidden}#bp-webcam-avatar #avatar-to-crop{border:1px solid #eee;max-width:100%;width:100%}@media screen and (min-width:801px){#bp-webcam-avatar #avatar-to-crop{max-width:64%;width:64%}}#avatar-crop-actions a{display:block}#bp-webcam-avatar #avatar-crop-actions{float:left;margin:0 0 20px;width:50%}#avatar-crop-actions a.button{margin-top:10px}#bp-webcam-avatar #avatar-crop-actions a.button{display:block;margin:0 0 5px;padding:4px 0;width:100%}#avatar-crop-pane canvas,#avatar-crop-pane img,#avatar-to-crop img,#avatar-upload-form img,#create-group-form img,#group-settings-form img{border:none!important;max-width:none!important}#bp-webcam-avatar video{float:left;margin-bottom:0;max-width:100%;width:100%;-webkit-transform:scaleX(-1);transform:scaleX(-1)}#bp-webcam-avatar #avatar-crop-pane{border:2px dashed #bbb;clear:left;float:right;margin:0 40px 10px 0;overflow:hidden}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{max-width:150px;max-height:150px}#avatar-crop-pane canvas{height:auto;width:100%;max-width:100%}.group-avatar .bp-avatar .avatar-crop-management{margin-left:0;padding-top:0;width:auto}.bp-avatar .item{overflow:hidden}.bp-avatar .avatar-crop-management.adjust{float:left;clear:none;padding-top:0}.bp-avatar #avatar-to-crop.adjust{float:left;margin-right:20px}@media screen and (max-width:480px){#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions,#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{float:none}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{margin:0 auto 10px}#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions{width:auto}}@media screen and (min-width:801px){#bp-webcam-avatar .avatar-crop-management{clear:none;float:right}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{float:none;margin:0 auto 10px}#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions{float:left;width:100%}}body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent{height:95%!important;width:95%!important}body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.updated,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.updated,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{display:block;padding:10px 15px}.wp-admin #TB_window .bp-avatar #avatar-to-crop{float:left;margin:0}.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop{margin-bottom:20px}@media screen and (min-width:783px){.wp-admin #TB_window .bp-avatar .avatar-crop-management{clear:none;float:left;margin-left:20px;padding-top:0;text-align:center}}.wp-admin #TB_window .bp-avatar #avatar-to-crop video{width:100%}.wp-admin #TB_window .bp-avatar .avatar-crop-management a.button{height:auto;line-height:inherit}@media screen and (min-width:810px){.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop{max-width:none;width:76%}.wp-admin #TB_window #bp-webcam-avatar .avatar-crop-management{max-width:none;width:auto}}
|
@@ -86,7 +86,7 @@ body#bp-default #admin-bar-logo {
|
|
86 |
Â
padding: 0;
|
87 |
Â
float: right;
|
88 |
Â
position: relative;
|
89 |
-
background: url('../images/admin-menu-arrow.gif')
|
90 |
Â
padding-left: 11px;
|
91 |
Â
}
|
92 |
Â
#wp-admin-bar ul li.no-arrow {
|
@@ -121,9 +121,9 @@ body#bp-default #admin-bar-logo {
|
|
121 |
Â
-webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
122 |
Â
-moz-border-radius: 3px;
|
123 |
Â
-webkit-border-radius: 3px;
|
124 |
-
-moz-border-radius-topleft: 0;
|
125 |
-
-webkit-border-top-right-radius: 0;
|
126 |
Â
-moz-border-radius-topright: 0;
|
Â
|
|
Â
|
|
127 |
Â
-webkit-border-top-left-radius: 0;
|
128 |
Â
}
|
129 |
Â
#wp-admin-bar ul li > ul {
|
86 |
Â
padding: 0;
|
87 |
Â
float: right;
|
88 |
Â
position: relative;
|
89 |
+
background: url('../images/admin-menu-arrow.gif') 88% 53% no-repeat;
|
90 |
Â
padding-left: 11px;
|
91 |
Â
}
|
92 |
Â
#wp-admin-bar ul li.no-arrow {
|
121 |
Â
-webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
122 |
Â
-moz-border-radius: 3px;
|
123 |
Â
-webkit-border-radius: 3px;
|
Â
|
|
Â
|
|
124 |
Â
-moz-border-radius-topright: 0;
|
125 |
+
-webkit-border-top-right-radius: 0;
|
126 |
+
-moz-border-radius-topleft: 0;
|
127 |
Â
-webkit-border-top-left-radius: 0;
|
128 |
Â
}
|
129 |
Â
#wp-admin-bar ul li > ul {
|
@@ -1 +1 @@
|
|
1 |
-
#admin-bar-logo,#wp-admin-bar li a{font-size:11px;text-decoration:none}#wp-admin-bar ul li ul a,#wp-admin-bar ul li ul li:hover ul li a{color:#eee}#wp-admin-bar ul li ul li ul li:hover a,#wp-admin-bar ul li ul li:hover a{color:#fff}body:not(.wp-admin){padding-top:25px!important}#wp-admin-bar{position:fixed;top:0;right:0;height:25px;font-size:11px;width:100%;z-index:9999}#wp-admin-bar .padder{position:relative;padding:0;width:100%;margin:0 auto;background:url(../images/60pc_black.png);height:25px}body#bp-default #wp-admin-bar .padder{max-width:1250px}#wp-admin-bar *{z-index:999}#wp-admin-bar div#admin-bar-logo{position:absolute;top:5px;right:10px}#wp-admin-bar a img,#wp-admin-bar li.alt{border:none}#wp-admin-bar li{list-style:none;margin:0;padding:0;line-height:100%;text-align:right}#wp-admin-bar li a{padding:7px 15px;color:#eee}#wp-admin-bar li.no-arrow a{padding-left:15px}#wp-admin-bar ul li ul li a span{display:none}#wp-admin-bar li.hover,#wp-admin-bar li:hover{position:static}#admin-bar-logo{float:right;font-weight:700;padding:5px 8px;margin:0;color:#fff}body#bp-default #admin-bar-logo{padding:2px 8px}#wp-admin-bar ul{margin:0;list-style:none;line-height:1;cursor:pointer;height:auto;padding:0}#wp-admin-bar ul li{padding:0 0 0 11px;float:right;position:relative;background:url(../images/admin-menu-arrow.gif)
|
1 |
+
#admin-bar-logo,#wp-admin-bar li a{font-size:11px;text-decoration:none}#wp-admin-bar ul li ul a,#wp-admin-bar ul li ul li:hover ul li a{color:#eee}#wp-admin-bar ul li ul li ul li:hover a,#wp-admin-bar ul li ul li:hover a{color:#fff}body:not(.wp-admin){padding-top:25px!important}#wp-admin-bar{position:fixed;top:0;right:0;height:25px;font-size:11px;width:100%;z-index:9999}#wp-admin-bar .padder{position:relative;padding:0;width:100%;margin:0 auto;background:url(../images/60pc_black.png);height:25px}body#bp-default #wp-admin-bar .padder{max-width:1250px}#wp-admin-bar *{z-index:999}#wp-admin-bar div#admin-bar-logo{position:absolute;top:5px;right:10px}#wp-admin-bar a img,#wp-admin-bar li.alt{border:none}#wp-admin-bar li{list-style:none;margin:0;padding:0;line-height:100%;text-align:right}#wp-admin-bar li a{padding:7px 15px;color:#eee}#wp-admin-bar li.no-arrow a{padding-left:15px}#wp-admin-bar ul li ul li a span{display:none}#wp-admin-bar li.hover,#wp-admin-bar li:hover{position:static}#admin-bar-logo{float:right;font-weight:700;padding:5px 8px;margin:0;color:#fff}body#bp-default #admin-bar-logo{padding:2px 8px}#wp-admin-bar ul{margin:0;list-style:none;line-height:1;cursor:pointer;height:auto;padding:0}#wp-admin-bar ul li{padding:0 0 0 11px;float:right;position:relative;background:url(../images/admin-menu-arrow.gif) 88% 53% no-repeat}#wp-admin-bar ul li.no-arrow{background:0 0;padding-left:0}#wp-admin-bar ul li ul li{background-image:none;float:right;width:174px;margin:0}#wp-admin-bar ul li.align-right{position:absolute;left:0}#wp-admin-bar ul li a{display:block}#wp-admin-bar ul.main-nav li ul li.sfhover,#wp-admin-bar ul.main-nav li.sfhover,#wp-admin-bar ul.main-nav li:hover{background-color:#333}#wp-admin-bar ul li ul{position:absolute;width:185px;right:-999em;margin-right:0;background:#333;border:1px solid #222;-moz-box-shadow:0 4px 8px rgba(0,0,0,.1);-webkit-box-shadow:0 4px 8px rgba(0,0,0,.1);-moz-border-radius:3px;-webkit-border-radius:0 0 3px 3px;-moz-border-radius-topright:0;-moz-border-radius-topleft:0}#wp-admin-bar ul li>ul{border-top:none}#wp-admin-bar ul li div.admin-bar-clear{clear:both}#wp-admin-bar ul.main-nav li ul li.sfhover,#wp-admin-bar ul.main-nav li ul li:hover{background-color:#222}#wp-admin-bar ul li ul ul{margin:-25px 184px 0 0;-moz-border-radius:3px;-webkit-border-radius:3px}#wp-admin-bar ul li ul li.sfhover ul,#wp-admin-bar ul li ul li:hover ul,#wp-admin-bar ul li.sfhover ul,#wp-admin-bar ul li:hover ul{right:auto}#wp-admin-bar ul li.align-right:hover ul{left:0}#wp-admin-bar li.sfhover ul li ul,#wp-admin-bar ul li:hover ul ul{right:-999em}#wp-admin-bar img.avatar{float:right;margin-left:8px}#wp-admin-bar span.activity{display:block;margin-right:34px;padding:0}#wp-admin-bar ul.author-list li a{height:17px}#wp-admin-bar ul li#bp-adminbar-notifications-menu a span{padding:0 6px;margin-right:2px;background:#fff;color:#000;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}#wp-admin-bar-user-info img.avatar{height:64px;width:64px}
|
@@ -16,8 +16,6 @@
|
|
16 |
Â
*
|
17 |
Â
* @param array $args
|
18 |
Â
*
|
19 |
-
* @uses BP_Activity_Activity::get() {@link BP_Activity_Activity}
|
20 |
-
*
|
21 |
Â
* @return object $activity The activity/activities object
|
22 |
Â
*/
|
23 |
Â
function bp_activity_get_sitewide( $args = '' ) {
|
16 |
Â
*
|
17 |
Â
* @param array $args
|
18 |
Â
*
|
Â
|
|
Â
|
|
19 |
Â
* @return object $activity The activity/activities object
|
20 |
Â
*/
|
21 |
Â
function bp_activity_get_sitewide( $args = '' ) {
|
@@ -15,7 +15,6 @@ defined( 'ABSPATH' ) || exit;
|
|
15 |
Â
*
|
16 |
Â
* @since 1.6.0
|
17 |
Â
* @deprecated 1.7.0
|
18 |
-
* @uses bp_get_maintenance_mode() To get the BuddyPress maintenance mode
|
19 |
Â
*/
|
20 |
Â
function bp_maintenance_mode() {
|
21 |
Â
echo bp_get_maintenance_mode();
|
15 |
Â
*
|
16 |
Â
* @since 1.6.0
|
17 |
Â
* @deprecated 1.7.0
|
Â
|
|
18 |
Â
*/
|
19 |
Â
function bp_maintenance_mode() {
|
20 |
Â
echo bp_get_maintenance_mode();
|
@@ -0,0 +1,50 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Deprecated functions.
|
4 |
+
*
|
5 |
+
* @deprecated 2.6.0
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Exit if accessed directly.
|
9 |
+
defined( 'ABSPATH' ) || exit;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Print the generation time in the footer of the site.
|
13 |
+
*
|
14 |
+
* @since 1.0.0
|
15 |
+
* @deprecated 2.6.0
|
16 |
+
*/
|
17 |
+
function bp_core_print_generation_time() {
|
18 |
+
?>
|
19 |
+
|
20 |
+
<!-- Generated in <?php timer_stop(1); ?> seconds. (<?php echo get_num_queries(); ?> q) -->
|
21 |
+
|
22 |
+
<?php
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Sort the navigation menu items.
|
27 |
+
*
|
28 |
+
* The sorting is split into a separate function because it can only happen
|
29 |
+
* after all plugins have had a chance to register their navigation items.
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
* @deprecated 2.6.0
|
33 |
+
*
|
34 |
+
* @return bool|null Returns false on failure.
|
35 |
+
*/
|
36 |
+
function bp_core_sort_nav_items() {
|
37 |
+
_deprecated_function( __FUNCTION__, '2.6' );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Sort all subnavigation arrays.
|
42 |
+
*
|
43 |
+
* @since 1.1.0
|
44 |
+
* @deprecated 2.6.0
|
45 |
+
*
|
46 |
+
* @return bool|null Returns false on failure.
|
47 |
+
*/
|
48 |
+
function bp_core_sort_subnav_items() {
|
49 |
+
_deprecated_function( __FUNCTION__, '2.6' );
|
50 |
+
}
|
Binary file
|
Binary file
|
@@ -1,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
Â
window.bp=window.bp||{},function(a,b){"undefined"!=typeof BP_Uploader&&(bp.Models=bp.Models||{},bp.Collections=bp.Collections||{},bp.Views=bp.Views||{},bp.Avatar={start:function(){var a=this;this.removeLegacyUI(),this.views=new Backbone.Collection,this.jcropapi={},this.warning=null,this.setupNav(),this.avatars=bp.Uploader.filesUploaded,this.Attachment=new Backbone.Model,bp.Uploader.filesQueue.on("reset",this.cropView,this),b("body.wp-admin").on("tb_unload","#TB_window",function(){a.resetViews()}),b("body.wp-admin").on("click",".bp-xprofile-avatar-user-edit",function(){a.resetViews()})},removeLegacyUI:function(){b("#avatar-upload-form").length?(b("#avatar-upload").remove(),b("#avatar-upload-form p").remove()):b("#group-settings-form").length?(b("#group-settings-form p").each(function(a){0!==a&&b(this).remove()}),b("#delete-group-avatar-button").length&&b("#delete-group-avatar-button").remove()):b("#group-create-body").length?(b(".main-column p #file").remove(),b(".main-column p #upload").remove()):b("#bp_xprofile_user_admin_avatar a.bp-xprofile-avatar-user-admin").length&&b("#bp_xprofile_user_admin_avatar a.bp-xprofile-avatar-user-admin").remove()},setView:function(a){switch(_.isUndefined(this.views.models)||_.each(this.views.models,function(a){a.get("view").remove()},this),this.views.reset(),_.isUndefined(this.avatars)||this.avatars.reset(),_.isEmpty(this.jcropapi)||(this.jcropapi.destroy(),this.jcropapi={}),a){case"upload":this.uploaderView();break;case"delete":this.deleteView()}},resetViews:function(){this.nav.trigger("bp-avatar-view:changed","upload"),_.each(this.navItems.models,function(a){"upload"===a.id?a.set({active:1}):a.set({active:0})})},setupNav:function(){var a,b,c=this;this.navItems=new Backbone.Collection,_.each(BP_Uploader.settings.nav,function(d,e){_.isObject(d)&&(b=0,0===e&&(a=d.id,b=1),c.navItems.add({id:d.id,name:d.caption,href:"#",active:b,hide:_.isUndefined(d.hide)?0:d.hide}))}),this.nav=new bp.Views.Nav({collection:this.navItems}),this.nav.inject(".bp-avatar-nav"),this.setView(a),this.nav.on("bp-avatar-view:changed",_.bind(this.setView,this))},uploaderView:function(){bp.Uploader.filesQueue.on("add",this.uploadProgress,this);var a=new bp.Views.Uploader;this.views.add({id:"upload",view:a}),a.inject(".bp-avatar")},uploadProgress:function(){var a=new bp.Views.uploaderStatus({collection:bp.Uploader.filesQueue});_.isUndefined(this.views.get("status"))?this.views.add({id:"status",view:a}):this.views.set({id:"status",view:a}),a.inject(".bp-avatar-status")},cropView:function(){var a;if(!_.isEmpty(this.avatars.models)){_.isUndefined(this.views.get("status"))||(a=this.views.get("status"),a.get("view").remove(),this.views.remove({id:"status",view:a}));var b=new bp.Views.Avatars({collection:this.avatars});this.views.add({id:"crop",view:b}),b.inject(".bp-avatar")}},setAvatar:function(a){var c,d=this;_.isUndefined(this.views.get("crop"))||(_.isEmpty(this.jcropapi)||(this.jcropapi.destroy(),this.jcropapi={}),c=this.views.get("crop"),c.get("view").remove(),this.views.remove({id:"crop",view:c})),bp.ajax.post("bp_avatar_set",{json:!0,original_file:a.get("url"),crop_w:a.get("w"),crop_h:a.get("h"),crop_x:a.get("x"),crop_y:a.get("y"),item_id:a.get("item_id"),object:a.get("object"),type:_.isUndefined(a.get("type"))?"crop":a.get("type"),nonce:a.get("nonces").set}).done(function(c){var e=new bp.Views.AvatarStatus({value:BP_Uploader.strings.feedback_messages[c.feedback_code],type:"success"});d.views.add({id:"status",view:e}),e.inject(".bp-avatar-status"),b("."+a.get("object")+"-"+c.item_id+"-avatar").each(function(){b(this).prop("src",c.avatar)}),bp.Avatar.navItems.get("delete").set({hide:0}),d.Attachment.set(_.extend(_.pick(a.attributes,["object","item_id"]),{url:c.avatar,action:"uploaded"}))}).fail(function(a){var b=BP_Uploader.strings.default_error;_.isUndefined(a)||(b=BP_Uploader.strings.feedback_messages[a.feedback_code]);var c=new bp.Views.AvatarStatus({value:b,type:"error"});d.views.add({id:"status",view:c}),c.inject(".bp-avatar-status")})},deleteView:function(){var a=new Backbone.Model(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,"object","item_id","nonces")),b=new bp.Views.DeleteAvatar({model:a});this.views.add({id:"delete",view:b}),b.inject(".bp-avatar")},deleteAvatar:function(a){var c,d=this;_.isUndefined(this.views.get("delete"))||(c=this.views.get("delete"),c.get("view").remove(),this.views.remove({id:"delete",view:c})),bp.ajax.post("bp_avatar_delete",{json:!0,item_id:a.get("item_id"),object:a.get("object"),nonce:a.get("nonces").remove}).done(function(c){var e=new bp.Views.AvatarStatus({value:BP_Uploader.strings.feedback_messages[c.feedback_code],type:"success"});d.views.add({id:"status",view:e}),e.inject(".bp-avatar-status"),b("."+a.get("object")+"-"+c.item_id+"-avatar").each(function(){b(this).prop("src",c.avatar)}),bp.Avatar.navItems.get("delete").set({active:0,hide:1}),d.Attachment.set(_.extend(_.pick(a.attributes,["object","item_id"]),{url:c.avatar,action:"deleted"}))}).fail(function(a){var b=BP_Uploader.strings.default_error;_.isUndefined(a)||(b=BP_Uploader.strings.feedback_messages[a.feedback_code]);var c=new bp.Views.AvatarStatus({value:b,type:"error"});d.views.add({id:"status",view:c}),c.inject(".bp-avatar-status")})},removeWarning:function(){_.isNull(this.warning)||this.warning.remove()},displayWarning:function(a){this.removeWarning(),this.warning=new bp.Views.uploaderWarning({value:a}),this.warning.inject(".bp-avatar-status")}},bp.Views.Nav=bp.View.extend({tagName:"ul",className:"avatar-nav-items",events:{"click .bp-avatar-nav-item":"toggleView"},initialize:function(){var a=_.findWhere(this.collection.models,{id:"delete"});1!==a.get("hide")&&bp.Avatar.displayWarning(BP_Uploader.strings.has_avatar_warning),_.each(this.collection.models,this.addNavItem,this),this.collection.on("change:hide",this.showHideNavItem,this)},addNavItem:function(a){1!==a.get("hide")&&this.views.add(new bp.Views.NavItem({model:a}))},showHideNavItem:function(a){var b=null;_.each(this.views._views[""],function(c){1===c.model.get("hide")&&c.remove(),a.get("id")===c.model.get("id")&&(b=!0)}),_.isBoolean(b)||this.addNavItem(a)},toggleView:function(a){a.preventDefault(),bp.Avatar.removeWarning();var c=b(a.target).data("nav");_.each(this.collection.models,function(a){a.id===c?(a.set({active:1}),this.trigger("bp-avatar-view:changed",a.id)):a.set({active:0})},this)}}),bp.Views.NavItem=bp.View.extend({tagName:"li",className:"avatar-nav-item",template:bp.template("bp-avatar-nav"),initialize:function(){1===this.model.get("active")&&(this.el.className+=" current"),this.el.id+="bp-avatar-"+this.model.get("id"),this.model.on("change:active",this.setCurrentNav,this)},setCurrentNav:function(a){1===a.get("active")?this.$el.addClass("current"):this.$el.removeClass("current")}}),bp.Views.Avatars=bp.View.extend({className:"items",initialize:function(){_.each(this.collection.models,this.addItemView,this)},addItemView:function(a){var b={full_h:150,full_w:150};_.isUndefined(BP_Uploader.settings.crop.full_h)||_.isUndefined(BP_Uploader.settings.crop.full_w)||(b.full_h=BP_Uploader.settings.crop.full_h,b.full_w=BP_Uploader.settings.crop.full_w),a.set(_.extend(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,"object","item_id","nonces"),b)),this.views.add(new bp.Views.Avatar({model:a}))}}),bp.Views.Avatar=bp.View.extend({className:"item",template:bp.template("bp-avatar-item"),events:{"click .avatar-crop-submit":"cropAvatar"},initialize:function(){_.defaults(this.options,{full_h:BP_Uploader.settings.crop.full_h,full_w:BP_Uploader.settings.crop.full_w,aspectRatio:1}),!1!==this.model.get("feedback")&&bp.Avatar.displayWarning(this.model.get("feedback")),this.on("ready",this.initCropper)},initCropper:function(){var a,c,d,e,f,g,h=this,i=this.$el.find("#avatar-to-crop img"),j=this.$el.width(),k={};_.isUndefined(this.options.full_h)||_.isUndefined(this.options.full_w)||(this.options.aspectRatio=this.options.full_w/this.options.full_h),k.w=this.model.get("width"),k.h=this.model.get("height"),this.options.full_w+k.w+20<j&&(b("#avatar-to-crop").addClass("adjust"),this.$el.find(".avatar-crop-management").addClass("adjust")),k.h<=k.w?(a=Math.round(k.h/4),f=g=Math.round(k.h/2),c=f+a,d=(k.w-g)/2,e=g+d):(d=Math.round(k.w/4),f=g=Math.round(k.w/2),e=g+d,a=(k.h-f)/2,c=f+a),i.Jcrop({onChange:_.bind(h.showPreview,h),onSelect:_.bind(h.showPreview,h),aspectRatio:h.options.aspectRatio,setSelect:[d,a,e,c]},function(){bp.Avatar.jcropapi=this})},cropAvatar:function(a){a.preventDefault(),bp.Avatar.setAvatar(this.model)},showPreview:function(a){if(a.w&&a.h&&parseInt(a.w,10)>0){var c=this.options.full_w,d=this.options.full_h,e=c/a.w,f=d/a.h;this.model.set({x:a.x,y:a.y,w:a.w,h:a.h}),b("#avatar-crop-preview").css({maxWidth:"none",width:Math.round(e*this.model.get("width"))+"px",height:Math.round(f*this.model.get("height"))+"px",marginLeft:"-"+Math.round(e*this.model.get("x"))+"px",marginTop:"-"+Math.round(f*this.model.get("y"))+"px"})}}}),bp.Views.AvatarStatus=bp.View.extend({tagName:"p",className:"updated",id:"bp-avatar-feedback",initialize:function(){this.el.className+=" "+this.options.type,this.value=this.options.value},render:function(){return this.$el.html(this.value),this}}),bp.Views.DeleteAvatar=bp.View.extend({tagName:"div",id:"bp-delete-avatar-container",template:bp.template("bp-avatar-delete"),events:{"click #bp-delete-avatar":"deleteAvatar"},deleteAvatar:function(a){a.preventDefault(),bp.Avatar.deleteAvatar(this.model)}}),bp.Avatar.start())}(bp,jQuery);
|
Â
|
|
1 |
Â
window.bp=window.bp||{},function(a,b){"undefined"!=typeof BP_Uploader&&(bp.Models=bp.Models||{},bp.Collections=bp.Collections||{},bp.Views=bp.Views||{},bp.Avatar={start:function(){var a=this;this.removeLegacyUI(),this.views=new Backbone.Collection,this.jcropapi={},this.warning=null,this.setupNav(),this.avatars=bp.Uploader.filesUploaded,this.Attachment=new Backbone.Model,bp.Uploader.filesQueue.on("reset",this.cropView,this),b("body.wp-admin").on("tb_unload","#TB_window",function(){a.resetViews()}),b("body.wp-admin").on("click",".bp-xprofile-avatar-user-edit",function(){a.resetViews()})},removeLegacyUI:function(){b("#avatar-upload-form").length?(b("#avatar-upload").remove(),b("#avatar-upload-form p").remove()):b("#group-settings-form").length?(b("#group-settings-form p").each(function(a){0!==a&&b(this).remove()}),b("#delete-group-avatar-button").length&&b("#delete-group-avatar-button").remove()):b("#group-create-body").length?(b(".main-column p #file").remove(),b(".main-column p #upload").remove()):b("#bp_xprofile_user_admin_avatar a.bp-xprofile-avatar-user-admin").length&&b("#bp_xprofile_user_admin_avatar a.bp-xprofile-avatar-user-admin").remove()},setView:function(a){switch(_.isUndefined(this.views.models)||_.each(this.views.models,function(a){a.get("view").remove()},this),this.views.reset(),_.isUndefined(this.avatars)||this.avatars.reset(),_.isEmpty(this.jcropapi)||(this.jcropapi.destroy(),this.jcropapi={}),a){case"upload":this.uploaderView();break;case"delete":this.deleteView()}},resetViews:function(){this.nav.trigger("bp-avatar-view:changed","upload"),_.each(this.navItems.models,function(a){"upload"===a.id?a.set({active:1}):a.set({active:0})})},setupNav:function(){var a,b,c=this;this.navItems=new Backbone.Collection,_.each(BP_Uploader.settings.nav,function(d,e){_.isObject(d)&&(b=0,0===e&&(a=d.id,b=1),c.navItems.add({id:d.id,name:d.caption,href:"#",active:b,hide:_.isUndefined(d.hide)?0:d.hide}))}),this.nav=new bp.Views.Nav({collection:this.navItems}),this.nav.inject(".bp-avatar-nav"),this.setView(a),this.nav.on("bp-avatar-view:changed",_.bind(this.setView,this))},uploaderView:function(){bp.Uploader.filesQueue.on("add",this.uploadProgress,this);var a=new bp.Views.Uploader;this.views.add({id:"upload",view:a}),a.inject(".bp-avatar")},uploadProgress:function(){var a=new bp.Views.uploaderStatus({collection:bp.Uploader.filesQueue});_.isUndefined(this.views.get("status"))?this.views.add({id:"status",view:a}):this.views.set({id:"status",view:a}),a.inject(".bp-avatar-status")},cropView:function(){var a;if(!_.isEmpty(this.avatars.models)){_.isUndefined(this.views.get("status"))||(a=this.views.get("status"),a.get("view").remove(),this.views.remove({id:"status",view:a}));var b=new bp.Views.Avatars({collection:this.avatars});this.views.add({id:"crop",view:b}),b.inject(".bp-avatar")}},setAvatar:function(a){var c,d=this;_.isUndefined(this.views.get("crop"))||(_.isEmpty(this.jcropapi)||(this.jcropapi.destroy(),this.jcropapi={}),c=this.views.get("crop"),c.get("view").remove(),this.views.remove({id:"crop",view:c})),bp.ajax.post("bp_avatar_set",{json:!0,original_file:a.get("url"),crop_w:a.get("w"),crop_h:a.get("h"),crop_x:a.get("x"),crop_y:a.get("y"),item_id:a.get("item_id"),object:a.get("object"),type:_.isUndefined(a.get("type"))?"crop":a.get("type"),nonce:a.get("nonces").set}).done(function(c){var e=new bp.Views.AvatarStatus({value:BP_Uploader.strings.feedback_messages[c.feedback_code],type:"success"});d.views.add({id:"status",view:e}),e.inject(".bp-avatar-status"),b("."+a.get("object")+"-"+c.item_id+"-avatar").each(function(){b(this).prop("src",c.avatar)}),bp.Avatar.navItems.get("delete").set({hide:0}),d.Attachment.set(_.extend(_.pick(a.attributes,["object","item_id"]),{url:c.avatar,action:"uploaded"}))}).fail(function(a){var b=BP_Uploader.strings.default_error;_.isUndefined(a)||(b=BP_Uploader.strings.feedback_messages[a.feedback_code]);var c=new bp.Views.AvatarStatus({value:b,type:"error"});d.views.add({id:"status",view:c}),c.inject(".bp-avatar-status")})},deleteView:function(){var a=new Backbone.Model(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,"object","item_id","nonces")),b=new bp.Views.DeleteAvatar({model:a});this.views.add({id:"delete",view:b}),b.inject(".bp-avatar")},deleteAvatar:function(a){var c,d=this;_.isUndefined(this.views.get("delete"))||(c=this.views.get("delete"),c.get("view").remove(),this.views.remove({id:"delete",view:c})),bp.ajax.post("bp_avatar_delete",{json:!0,item_id:a.get("item_id"),object:a.get("object"),nonce:a.get("nonces").remove}).done(function(c){var e=new bp.Views.AvatarStatus({value:BP_Uploader.strings.feedback_messages[c.feedback_code],type:"success"});d.views.add({id:"status",view:e}),e.inject(".bp-avatar-status"),b("."+a.get("object")+"-"+c.item_id+"-avatar").each(function(){b(this).prop("src",c.avatar)}),bp.Avatar.navItems.get("delete").set({active:0,hide:1}),d.Attachment.set(_.extend(_.pick(a.attributes,["object","item_id"]),{url:c.avatar,action:"deleted"}))}).fail(function(a){var b=BP_Uploader.strings.default_error;_.isUndefined(a)||(b=BP_Uploader.strings.feedback_messages[a.feedback_code]);var c=new bp.Views.AvatarStatus({value:b,type:"error"});d.views.add({id:"status",view:c}),c.inject(".bp-avatar-status")})},removeWarning:function(){_.isNull(this.warning)||this.warning.remove()},displayWarning:function(a){this.removeWarning(),this.warning=new bp.Views.uploaderWarning({value:a}),this.warning.inject(".bp-avatar-status")}},bp.Views.Nav=bp.View.extend({tagName:"ul",className:"avatar-nav-items",events:{"click .bp-avatar-nav-item":"toggleView"},initialize:function(){var a=_.findWhere(this.collection.models,{id:"delete"});1!==a.get("hide")&&bp.Avatar.displayWarning(BP_Uploader.strings.has_avatar_warning),_.each(this.collection.models,this.addNavItem,this),this.collection.on("change:hide",this.showHideNavItem,this)},addNavItem:function(a){1!==a.get("hide")&&this.views.add(new bp.Views.NavItem({model:a}))},showHideNavItem:function(a){var b=null;_.each(this.views._views[""],function(c){1===c.model.get("hide")&&c.remove(),a.get("id")===c.model.get("id")&&(b=!0)}),_.isBoolean(b)||this.addNavItem(a)},toggleView:function(a){a.preventDefault(),bp.Avatar.removeWarning();var c=b(a.target).data("nav");_.each(this.collection.models,function(a){a.id===c?(a.set({active:1}),this.trigger("bp-avatar-view:changed",a.id)):a.set({active:0})},this)}}),bp.Views.NavItem=bp.View.extend({tagName:"li",className:"avatar-nav-item",template:bp.template("bp-avatar-nav"),initialize:function(){1===this.model.get("active")&&(this.el.className+=" current"),this.el.id+="bp-avatar-"+this.model.get("id"),this.model.on("change:active",this.setCurrentNav,this)},setCurrentNav:function(a){1===a.get("active")?this.$el.addClass("current"):this.$el.removeClass("current")}}),bp.Views.Avatars=bp.View.extend({className:"items",initialize:function(){_.each(this.collection.models,this.addItemView,this)},addItemView:function(a){var b={full_h:150,full_w:150};_.isUndefined(BP_Uploader.settings.crop.full_h)||_.isUndefined(BP_Uploader.settings.crop.full_w)||(b.full_h=BP_Uploader.settings.crop.full_h,b.full_w=BP_Uploader.settings.crop.full_w),a.set(_.extend(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,"object","item_id","nonces"),b)),this.views.add(new bp.Views.Avatar({model:a}))}}),bp.Views.Avatar=bp.View.extend({className:"item",template:bp.template("bp-avatar-item"),events:{"click .avatar-crop-submit":"cropAvatar"},initialize:function(){_.defaults(this.options,{full_h:BP_Uploader.settings.crop.full_h,full_w:BP_Uploader.settings.crop.full_w,aspectRatio:1}),!1!==this.model.get("feedback")&&bp.Avatar.displayWarning(this.model.get("feedback")),this.on("ready",this.initCropper)},initCropper:function(){var a,c,d,e,f,g,h=this,i=this.$el.find("#avatar-to-crop img"),j=this.$el.width(),k={};_.isUndefined(this.options.full_h)||_.isUndefined(this.options.full_w)||(this.options.aspectRatio=this.options.full_w/this.options.full_h),k.w=this.model.get("width"),k.h=this.model.get("height"),this.options.full_w+k.w+20<j&&(b("#avatar-to-crop").addClass("adjust"),this.$el.find(".avatar-crop-management").addClass("adjust")),k.h<=k.w?(a=Math.round(k.h/4),f=g=Math.round(k.h/2),c=f+a,d=(k.w-g)/2,e=g+d):(d=Math.round(k.w/4),f=g=Math.round(k.w/2),e=g+d,a=(k.h-f)/2,c=f+a),i.Jcrop({onChange:_.bind(h.showPreview,h),onSelect:_.bind(h.showPreview,h),aspectRatio:h.options.aspectRatio,setSelect:[d,a,e,c]},function(){bp.Avatar.jcropapi=this})},cropAvatar:function(a){a.preventDefault(),bp.Avatar.setAvatar(this.model)},showPreview:function(a){if(a.w&&a.h&&parseInt(a.w,10)>0){var c=this.options.full_w,d=this.options.full_h,e=c/a.w,f=d/a.h;this.model.set({x:a.x,y:a.y,w:a.w,h:a.h}),b("#avatar-crop-preview").css({maxWidth:"none",width:Math.round(e*this.model.get("width"))+"px",height:Math.round(f*this.model.get("height"))+"px",marginLeft:"-"+Math.round(e*this.model.get("x"))+"px",marginTop:"-"+Math.round(f*this.model.get("y"))+"px"})}}}),bp.Views.AvatarStatus=bp.View.extend({tagName:"p",className:"updated",id:"bp-avatar-feedback",initialize:function(){this.el.className+=" "+this.options.type,this.value=this.options.value},render:function(){return this.$el.html(this.value),this}}),bp.Views.DeleteAvatar=bp.View.extend({tagName:"div",id:"bp-delete-avatar-container",template:bp.template("bp-avatar-delete"),events:{"click #bp-delete-avatar":"deleteAvatar"},deleteAvatar:function(a){a.preventDefault(),bp.Avatar.deleteAvatar(this.model)}}),bp.Avatar.start())}(bp,jQuery);
|
@@ -1,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
Â
window.wp=window.wp||{},window.bp=window.bp||{},function(a,b){"undefined"!=typeof BP_Uploader&&(_.extend(bp,_.pick(wp,"Backbone","ajax","template")),bp.Models=bp.Models||{},bp.Collections=bp.Collections||{},bp.Views=bp.Views||{},bp.Uploader={},bp.Uploader.uploader=function(){var a=this,c=-1!==navigator.userAgent.indexOf("Trident/")||-1!==navigator.userAgent.indexOf("MSIE ");return this.params=BP_Uploader.settings,this.strings=BP_Uploader.strings,this.supports={upload:this.params.browser.supported},this.supported=this.supports.upload,this.supported?(c||"flash"!==plupload.predictRuntime(this.params.defaults)||this.params.defaults.required_features&&this.params.defaults.required_features.hasOwnProperty("send_binary_string")||(this.params.defaults.required_features=this.params.defaults.required_features||{},this.params.defaults.required_features.send_binary_string=!0),this.uploader=new plupload.Uploader(this.params.defaults),this.uploader.bind("Init",function(c){var d=b("#"+a.params.defaults.container),e=b("#"+a.params.defaults.drop_element);"html4"===c.runtime&&(c.settings.multipart_params.html4=!0),"bp_avatar_upload"===c.settings.multipart_params.action&&(c.settings.multipart_params.bp_params.ui_available_width=d.width()),c.features.dragdrop&&!a.params.browser.mobile?(d.addClass("drag-drop"),e.bind("dragover.wp-uploader",function(){d.addClass("drag-over")}).bind("dragleave.wp-uploader, drop.wp-uploader",function(){d.removeClass("drag-over")})):(d.removeClass("drag-drop"),e.unbind(".wp-uploader"))}),this.uploader.init(),this.feedback=function(a,b,c){!_.isNull(c)&&c.item&&c.item.clear(),bp.Uploader.filesError.unshift({message:a,data:b,file:c})},this.uploader.bind("FilesAdded",function(c,d){var e=104857600,f=parseInt(c.settings.max_file_size,10),g=this;if(!c.settings.multi_selection&&d.length>1){for(var h in d)c.removeFile(d[h]);return void b(a).trigger("bp-uploader-warning",a.strings.unique_file_warning)}_.each(d,function(a){var b;plupload.FAILED!==a.status&&(f>e&&a.size>e&&"html5"!==c.runtime?g.uploadSizeError(c,a,!0):(b=_.extend({id:a.id,file:a,uploading:!0,date:new Date,filename:a.name},_.pick(a,"loaded","size","percent")),a.item=new bp.Models.File(b),bp.Uploader.filesQueue.add(a.item)))}),c.refresh(),c.start()}),this.uploader.bind("UploadProgress",function(a,b){b.item.set(_.pick(b,"loaded","percent"))}),this.uploader.bind("FileUploaded",function(b,c,d){var e=a.strings.default_error;try{d=JSON.parse(d.response)}catch(f){return a.feedback(e,f,c)}return!_.isObject(d)||_.isUndefined(d.success)?a.feedback(e,null,c):d.success?(_.each(["file","loaded","size","percent"],function(a){c.item.unset(a)}),c.item.set(_.extend(d.data,{uploading:!1})),void bp.Uploader.filesUploaded.add(c.item)):(d.data&&d.data.message&&(e=d.data.message),a.feedback(e,d.data,c))}),this.uploader.bind("BeforeUpload",function(c,d){b(a).trigger("bp-uploader-new-upload",c,d)}),this.uploader.bind("UploadComplete",function(c,d){b(a).trigger("bp-uploader-upload-complete",c,d),bp.Uploader.filesQueue.reset()}),void this.uploader.bind("Error",function(c,d){var e,f=a.strings.default_error,g={FAILED:a.strings.upload_failed,FILE_EXTENSION_ERROR:a.strings.invalid_filetype,IMAGE_FORMAT_ERROR:a.strings.not_an_image,IMAGE_MEMORY_ERROR:a.strings.image_memory_exceeded,IMAGE_DIMENSIONS_ERROR:a.strings.image_dimensions_exceeded,GENERIC_ERROR:a.strings.upload_failed,IO_ERROR:a.strings.io_error,HTTP_ERROR:a.strings.http_error,SECURITY_ERROR:a.strings.security_error,FILE_SIZE_ERROR:a.strings.file_exceeds_size_limit.replace("%s",d.file.name)};for(e in g)if(d.code===plupload[e]){f=g[e];break}b(a).trigger("bp-uploader-warning",f),c.refresh()})):void(BP_Uploader=void 0)},bp.Models.File=Backbone.Model.extend({file:{}}),b.extend(bp.Uploader,{filesQueue:new Backbone.Collection,filesUploaded:new Backbone.Collection,filesError:new Backbone.Collection}),bp.View=bp.Backbone.View.extend({inject:function(a){this.render(),b(a).html(this.el),this.views.ready()},prepare:function(){return!_.isUndefined(this.model)&&_.isFunction(this.model.toJSON)?this.model.toJSON():{}}}),bp.Views.Uploader=bp.View.extend({className:"bp-uploader-window",template:bp.template("upload-window"),defaults:_.pick(BP_Uploader.settings.defaults,"container","drop_element","browse_button"),initialize:function(){this.warnings=[],this.model=new Backbone.Model(this.defaults),this.on("ready",this.initUploader)},initUploader:function(){this.uploader=new bp.Uploader.uploader,b(this.uploader).on("bp-uploader-warning",_.bind(this.setWarning,this)),b(this.uploader).on("bp-uploader-new-upload",_.bind(this.resetWarning,this))},setWarning:function(a,b){if(!_.isUndefined(b)){var c=new bp.Views.uploaderWarning({value:b}).render();this.warnings.push(c),this.$el.after(c.el)}},resetWarning:function(){0!==this.warnings.length&&(_.each(this.warnings,function(a){a.remove()}),this.warnings=[])}}),bp.Views.uploaderWarning=bp.View.extend({tagName:"p",className:"warning",initialize:function(){this.value=this.options.value},render:function(){return this.$el.html(this.value),this}}),bp.Views.uploaderStatus=bp.View.extend({className:"files",initialize:function(){_.each(this.collection.models,this.addFile,this),this.collection.on("change:percent",this.progress,this),bp.Uploader.filesError.on("add",this.feedback,this)},addFile:function(a){this.views.add(new bp.Views.uploaderProgress({model:a}))},progress:function(a){_.isUndefined(a.get("percent"))||b("#"+a.get("id")+" .bp-progress .bp-bar").css("width",a.get("percent")+"%")},feedback:function(a){_.isUndefined(a.get("message"))||_.isUndefined(a.get("file"))||b("#"+a.get("file").id).html(a.get("message")).addClass("error")}}),bp.Views.uploaderProgress=bp.View.extend({className:"bp-uploader-progress",template:bp.template("progress-window")}))}(bp,jQuery);
|
Â
|
|
1 |
Â
window.wp=window.wp||{},window.bp=window.bp||{},function(a,b){"undefined"!=typeof BP_Uploader&&(_.extend(bp,_.pick(wp,"Backbone","ajax","template")),bp.Models=bp.Models||{},bp.Collections=bp.Collections||{},bp.Views=bp.Views||{},bp.Uploader={},bp.Uploader.uploader=function(){var a=this,c=-1!==navigator.userAgent.indexOf("Trident/")||-1!==navigator.userAgent.indexOf("MSIE ");return this.params=BP_Uploader.settings,this.strings=BP_Uploader.strings,this.supports={upload:this.params.browser.supported},this.supported=this.supports.upload,this.supported?(c||"flash"!==plupload.predictRuntime(this.params.defaults)||this.params.defaults.required_features&&this.params.defaults.required_features.hasOwnProperty("send_binary_string")||(this.params.defaults.required_features=this.params.defaults.required_features||{},this.params.defaults.required_features.send_binary_string=!0),this.uploader=new plupload.Uploader(this.params.defaults),this.uploader.bind("Init",function(c){var d=b("#"+a.params.defaults.container),e=b("#"+a.params.defaults.drop_element);"html4"===c.runtime&&(c.settings.multipart_params.html4=!0),"bp_avatar_upload"===c.settings.multipart_params.action&&(c.settings.multipart_params.bp_params.ui_available_width=d.width()),c.features.dragdrop&&!a.params.browser.mobile?(d.addClass("drag-drop"),e.bind("dragover.wp-uploader",function(){d.addClass("drag-over")}).bind("dragleave.wp-uploader, drop.wp-uploader",function(){d.removeClass("drag-over")})):(d.removeClass("drag-drop"),e.unbind(".wp-uploader"))}),this.uploader.init(),this.feedback=function(a,b,c){!_.isNull(c)&&c.item&&c.item.clear(),bp.Uploader.filesError.unshift({message:a,data:b,file:c})},this.uploader.bind("FilesAdded",function(c,d){var e=104857600,f=parseInt(c.settings.max_file_size,10),g=this;if(!c.settings.multi_selection&&d.length>1){for(var h in d)c.removeFile(d[h]);return void b(a).trigger("bp-uploader-warning",a.strings.unique_file_warning)}_.each(d,function(a){var b;plupload.FAILED!==a.status&&(f>e&&a.size>e&&"html5"!==c.runtime?g.uploadSizeError(c,a,!0):(b=_.extend({id:a.id,file:a,uploading:!0,date:new Date,filename:a.name},_.pick(a,"loaded","size","percent")),a.item=new bp.Models.File(b),bp.Uploader.filesQueue.add(a.item)))}),c.refresh(),c.start()}),this.uploader.bind("UploadProgress",function(a,b){b.item.set(_.pick(b,"loaded","percent"))}),this.uploader.bind("FileUploaded",function(b,c,d){var e=a.strings.default_error;try{d=JSON.parse(d.response)}catch(f){return a.feedback(e,f,c)}return!_.isObject(d)||_.isUndefined(d.success)?a.feedback(e,null,c):d.success?(_.each(["file","loaded","size","percent"],function(a){c.item.unset(a)}),c.item.set(_.extend(d.data,{uploading:!1})),void bp.Uploader.filesUploaded.add(c.item)):(d.data&&d.data.message&&(e=d.data.message),a.feedback(e,d.data,c))}),this.uploader.bind("BeforeUpload",function(c,d){b(a).trigger("bp-uploader-new-upload",c,d)}),this.uploader.bind("UploadComplete",function(c,d){b(a).trigger("bp-uploader-upload-complete",c,d),bp.Uploader.filesQueue.reset()}),void this.uploader.bind("Error",function(c,d){var e,f=a.strings.default_error,g={FAILED:a.strings.upload_failed,FILE_EXTENSION_ERROR:a.strings.invalid_filetype,IMAGE_FORMAT_ERROR:a.strings.not_an_image,IMAGE_MEMORY_ERROR:a.strings.image_memory_exceeded,IMAGE_DIMENSIONS_ERROR:a.strings.image_dimensions_exceeded,GENERIC_ERROR:a.strings.upload_failed,IO_ERROR:a.strings.io_error,HTTP_ERROR:a.strings.http_error,SECURITY_ERROR:a.strings.security_error,FILE_SIZE_ERROR:a.strings.file_exceeds_size_limit.replace("%s",d.file.name)};for(e in g)if(d.code===plupload[e]){f=g[e];break}b(a).trigger("bp-uploader-warning",f),c.refresh()})):void(BP_Uploader=void 0)},bp.Models.File=Backbone.Model.extend({file:{}}),b.extend(bp.Uploader,{filesQueue:new Backbone.Collection,filesUploaded:new Backbone.Collection,filesError:new Backbone.Collection}),bp.View=bp.Backbone.View.extend({inject:function(a){this.render(),b(a).html(this.el),this.views.ready()},prepare:function(){return!_.isUndefined(this.model)&&_.isFunction(this.model.toJSON)?this.model.toJSON():{}}}),bp.Views.Uploader=bp.View.extend({className:"bp-uploader-window",template:bp.template("upload-window"),defaults:_.pick(BP_Uploader.settings.defaults,"container","drop_element","browse_button"),initialize:function(){this.warnings=[],this.model=new Backbone.Model(this.defaults),this.on("ready",this.initUploader)},initUploader:function(){this.uploader=new bp.Uploader.uploader,b(this.uploader).on("bp-uploader-warning",_.bind(this.setWarning,this)),b(this.uploader).on("bp-uploader-new-upload",_.bind(this.resetWarning,this))},setWarning:function(a,b){if(!_.isUndefined(b)){var c=new bp.Views.uploaderWarning({value:b}).render();this.warnings.push(c),this.$el.after(c.el)}},resetWarning:function(){0!==this.warnings.length&&(_.each(this.warnings,function(a){a.remove()}),this.warnings=[])}}),bp.Views.uploaderWarning=bp.View.extend({tagName:"p",className:"warning",initialize:function(){this.value=this.options.value},render:function(){return this.$el.html(this.value),this}}),bp.Views.uploaderStatus=bp.View.extend({className:"files",initialize:function(){_.each(this.collection.models,this.addFile,this),this.collection.on("change:percent",this.progress,this),bp.Uploader.filesError.on("add",this.feedback,this)},addFile:function(a){this.views.add(new bp.Views.uploaderProgress({model:a}))},progress:function(a){_.isUndefined(a.get("percent"))||b("#"+a.get("id")+" .bp-progress .bp-bar").css("width",a.get("percent")+"%")},feedback:function(a){_.isUndefined(a.get("message"))||_.isUndefined(a.get("file"))||b("#"+a.get("file").id).html(a.get("message")).addClass("error")}}),bp.Views.uploaderProgress=bp.View.extend({className:"bp-uploader-progress",template:bp.template("progress-window")}))}(bp,jQuery);
|
@@ -1,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM 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})});
|
Â
|
|
1 |
Â
jQuery(document).ready(function(){jQuery("a.confirm").click(function(){return confirm(BP_Confirm.are_you_sure)?!0:!1})});
|
@@ -1,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
Â
window.bp=window.bp||{},function(a,b){"undefined"!=typeof BP_Uploader&&(bp.Models=bp.Models||{},bp.Collections=bp.Collections||{},bp.Views=bp.Views||{},bp.CoverImage={start:function(){this.views=new Backbone.Collection,this.warning=null,this.Attachment=new Backbone.Model,this.uploaderView(),this.displayWarning(BP_Uploader.strings.cover_image_warnings.dimensions),!0===BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image&&this.deleteView()},uploaderView:function(){bp.Uploader.filesQueue.on("add",this.uploadProgress,this);var a=new bp.Views.Uploader;this.views.add({id:"upload",view:a}),a.inject(".bp-cover-image")},uploadProgress:function(){var a=new bp.Views.coverImageUploadProgress({collection:bp.Uploader.filesQueue});_.isUndefined(this.views.get("status"))?this.views.add({id:"status",view:a}):this.views.set({id:"status",view:a}),a.inject(".bp-cover-image-status")},deleteView:function(){var a=new Backbone.Model(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,["object","item_id","nonces"]));if(_.isUndefined(this.views.get("delete"))){var b=new bp.Views.DeleteCoverImage({model:a});this.views.add({id:"delete",view:b}),b.inject(".bp-cover-image-manage")}},deleteCoverImage:function(a){var c,d=this;_.isUndefined(this.views.get("delete"))||(c=this.views.get("delete"),c.get("view").remove(),this.views.remove({id:"delete",view:c})),bp.ajax.post("bp_cover_image_delete",{json:!0,item_id:a.get("item_id"),object:a.get("object"),nonce:a.get("nonces").remove}).done(function(c){var e=new bp.Views.CoverImageStatus({value:BP_Uploader.strings.feedback_messages[c.feedback_code],type:"success"});d.views.add({id:"status",view:e}),e.inject(".bp-cover-image-status"),""===c.reset_url?b("#header-cover-image").css({"background-image":"none"}):b("#header-cover-image").css({"background-image":"url( "+c.reset_url+" )"}),BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image=!1,d.Attachment.set(_.extend(_.pick(a.attributes,["object","item_id"]),{url:c.reset_url,action:"deleted"}))}).fail(function(a){var b=BP_Uploader.strings.default_error;_.isUndefined(a)||(b=BP_Uploader.strings.feedback_messages[a.feedback_code]);var c=new bp.Views.CoverImageStatus({value:b,type:"error"});d.views.add({id:"status",view:c}),c.inject(".bp-cover-image-status"),bp.CoverImage.deleteView()})},removeWarning:function(){_.isNull(this.warning)||this.warning.remove()},displayWarning:function(a){this.removeWarning(),this.warning=new bp.Views.uploaderWarning({value:a}),this.warning.inject(".bp-cover-image-status")}},bp.Views.coverImageUploadProgress=bp.Views.uploaderStatus.extend({className:"files",initialize:function(){bp.Views.uploaderStatus.prototype.initialize.apply(this,arguments),this.collection.on("change:url",this.uploadResult,this)},uploadResult:function(a){var c,d;_.isUndefined(a.get("url"))||(0===a.get("feedback_code")?(c=BP_Uploader.strings.cover_image_warnings.dimensions,d="warning"):(c=BP_Uploader.strings.feedback_messages[a.get("feedback_code")],d="success"),this.views.set(".bp-uploader-progress",new bp.Views.CoverImageStatus({value:c,type:d})),b("#header-cover-image").css({"background-image":"url( "+a.get("url")+" )"}),bp.CoverImage.deleteView(),bp.CoverImage.Attachment.set(_.extend(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,["object","item_id"]),{url:a.get("url"),action:"uploaded"})))}}),bp.Views.CoverImageStatus=bp.View.extend({tagName:"p",className:"updated",id:"bp-cover-image-feedback",initialize:function(){this.el.className+=" "+this.options.type,this.value=this.options.value},render:function(){return this.$el.html(this.value),this}}),bp.Views.DeleteCoverImage=bp.View.extend({tagName:"div",id:"bp-delete-cover-image-container",template:bp.template("bp-cover-image-delete"),events:{"click #bp-delete-cover-image":"deleteCoverImage"},deleteCoverImage:function(a){a.preventDefault(),bp.CoverImage.deleteCoverImage(this.model)}}),bp.CoverImage.start())}(bp,jQuery);
|
Â
|
|
1 |
Â
window.bp=window.bp||{},function(a,b){"undefined"!=typeof BP_Uploader&&(bp.Models=bp.Models||{},bp.Collections=bp.Collections||{},bp.Views=bp.Views||{},bp.CoverImage={start:function(){this.views=new Backbone.Collection,this.warning=null,this.Attachment=new Backbone.Model,this.uploaderView(),this.displayWarning(BP_Uploader.strings.cover_image_warnings.dimensions),!0===BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image&&this.deleteView()},uploaderView:function(){bp.Uploader.filesQueue.on("add",this.uploadProgress,this);var a=new bp.Views.Uploader;this.views.add({id:"upload",view:a}),a.inject(".bp-cover-image")},uploadProgress:function(){var a=new bp.Views.coverImageUploadProgress({collection:bp.Uploader.filesQueue});_.isUndefined(this.views.get("status"))?this.views.add({id:"status",view:a}):this.views.set({id:"status",view:a}),a.inject(".bp-cover-image-status")},deleteView:function(){var a=new Backbone.Model(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,["object","item_id","nonces"]));if(_.isUndefined(this.views.get("delete"))){var b=new bp.Views.DeleteCoverImage({model:a});this.views.add({id:"delete",view:b}),b.inject(".bp-cover-image-manage")}},deleteCoverImage:function(a){var c,d=this;_.isUndefined(this.views.get("delete"))||(c=this.views.get("delete"),c.get("view").remove(),this.views.remove({id:"delete",view:c})),bp.ajax.post("bp_cover_image_delete",{json:!0,item_id:a.get("item_id"),object:a.get("object"),nonce:a.get("nonces").remove}).done(function(c){var e=new bp.Views.CoverImageStatus({value:BP_Uploader.strings.feedback_messages[c.feedback_code],type:"success"});d.views.add({id:"status",view:e}),e.inject(".bp-cover-image-status"),""===c.reset_url?b("#header-cover-image").css({"background-image":"none"}):b("#header-cover-image").css({"background-image":"url( "+c.reset_url+" )"}),BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image=!1,d.Attachment.set(_.extend(_.pick(a.attributes,["object","item_id"]),{url:c.reset_url,action:"deleted"}))}).fail(function(a){var b=BP_Uploader.strings.default_error;_.isUndefined(a)||(b=BP_Uploader.strings.feedback_messages[a.feedback_code]);var c=new bp.Views.CoverImageStatus({value:b,type:"error"});d.views.add({id:"status",view:c}),c.inject(".bp-cover-image-status"),bp.CoverImage.deleteView()})},removeWarning:function(){_.isNull(this.warning)||this.warning.remove()},displayWarning:function(a){this.removeWarning(),this.warning=new bp.Views.uploaderWarning({value:a}),this.warning.inject(".bp-cover-image-status")}},bp.Views.coverImageUploadProgress=bp.Views.uploaderStatus.extend({className:"files",initialize:function(){bp.Views.uploaderStatus.prototype.initialize.apply(this,arguments),this.collection.on("change:url",this.uploadResult,this)},uploadResult:function(a){var c,d;_.isUndefined(a.get("url"))||(0===a.get("feedback_code")?(c=BP_Uploader.strings.cover_image_warnings.dimensions,d="warning"):(c=BP_Uploader.strings.feedback_messages[a.get("feedback_code")],d="success"),this.views.set(".bp-uploader-progress",new bp.Views.CoverImageStatus({value:c,type:d})),b("#header-cover-image").css({"background-image":"url( "+a.get("url")+" )"}),bp.CoverImage.deleteView(),bp.CoverImage.Attachment.set(_.extend(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,["object","item_id"]),{url:a.get("url"),action:"uploaded"})))}}),bp.Views.CoverImageStatus=bp.View.extend({tagName:"p",className:"updated",id:"bp-cover-image-feedback",initialize:function(){this.el.className+=" "+this.options.type,this.value=this.options.value},render:function(){return this.$el.html(this.value),this}}),bp.Views.DeleteCoverImage=bp.View.extend({tagName:"div",id:"bp-delete-cover-image-container",template:bp.template("bp-cover-image-delete"),events:{"click #bp-delete-cover-image":"deleteCoverImage"},deleteCoverImage:function(a){a.preventDefault(),bp.CoverImage.deleteCoverImage(this.model)}}),bp.CoverImage.start())}(bp,jQuery);
|
@@ -1,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM 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))}});
|
Â
|
|
1 |
Â
!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,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM 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}
|
Â
|
|
1 |
Â
function bp_get_querystring(a){var b=location.search.split(a+"=")[1];return b?decodeURIComponent(b.split("&")[0]):null}
|
@@ -1,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM 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});
|
Â
|
|
1 |
Â
!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,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM UTC - https://wordpress.org/plugins/buddypress/ */
|
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(b){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,b){var c;try{return this.setting[a]}catch(d){return c=d,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,c){var d,e,f,g,h,i,j,k,l,m,n,o;if(d=this.$inputor,l=this.callbacks("inserting_wrapper").call(this,d,b,this.get_opt("suffix")),d.is("textarea, input"))i=d.val(),j=i.slice(0,Math.max(this.query.head_pos-this.at.length,0)),k=""+j+l+i.slice(this.query.end_pos||0),d.val(k),d.caret("pos",j.length+l.length,{iframe:this.app.iframe});else if(g=this.range){for(f=g.startOffset-(this.query.end_pos-this.query.head_pos)-this.at.length,g.setStart(g.endContainer,Math.max(f,0)),g.setEnd(g.endContainer,g.endOffset),g.deleteContents(),o=a(l,this.app.document),m=0,n=o.length;n>m;m++)e=o[m],g.insertNode(e),g.setEndAfter(e),g.collapse(!1);h=this.app.window.getSelection(),h.removeAllRanges(),h.addRange(g)}else(g=this.ie8_range)&&(g.moveStart("character",this.query.end_pos-this.query.head_pos-this.at.length),g.pasteHTML(l),g.collapse(!1),g.select());return d.is(":focus")||d.focus(),d.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],a.isPlainObject(c)?f.push(c):f.push({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,d){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,b){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 |
Â
!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(b){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,b){var c;try{return this.setting[a]}catch(d){return c=d,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,c){var d,e,f,g,h,i,j,k,l,m,n,o;if(d=this.$inputor,l=this.callbacks("inserting_wrapper").call(this,d,b,this.get_opt("suffix")),d.is("textarea, input"))i=d.val(),j=i.slice(0,Math.max(this.query.head_pos-this.at.length,0)),k=""+j+l+i.slice(this.query.end_pos||0),d.val(k),d.caret("pos",j.length+l.length,{iframe:this.app.iframe});else if(g=this.range){for(f=g.startOffset-(this.query.end_pos-this.query.head_pos)-this.at.length,g.setStart(g.endContainer,Math.max(f,0)),g.setEnd(g.endContainer,g.endOffset),g.deleteContents(),o=a(l,this.app.document),m=0,n=o.length;n>m;m++)e=o[m],g.insertNode(e),g.setEndAfter(e),g.collapse(!1);h=this.app.window.getSelection(),h.removeAllRanges(),h.addRange(g)}else(g=this.ie8_range)&&(g.moveStart("character",this.query.end_pos-this.query.head_pos-this.at.length),g.pasteHTML(l),g.collapse(!1),g.select());return d.is(":focus")||d.focus(),d.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],a.isPlainObject(c)?f.push(c):f.push({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,d){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,b){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,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM UTC - https://wordpress.org/plugins/buddypress/ */
|
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){"use strict";var b,c,d,e,f,g,h,i,j,k,l;k="caret",b=function(){function b(a){this.$inputor=a,this.domInputor=this.$inputor[0]}return b.prototype.setPos=function(a){return this.domInputor},b.prototype.getIEPosition=function(){return this.getPosition()},b.prototype.getPosition=function(){var a,b;return b=this.getOffset(),a=this.$inputor.offset(),b.left-=a.left,b.top-=a.top,b},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(b){var c,d,e,f,g;return j.getSelection&&(e=this.range())?(e.endOffset-1>0&&e.endContainer===!this.domInputor&&(c=e.cloneRange(),c.setStart(e.endContainer,e.endOffset-1),c.setEnd(e.endContainer,e.endOffset),f=c.getBoundingClientRect(),d={height:f.height,left:f.left+f.width,top:f.top},c.detach()),d&&0!==(null!=d?d.height:void 0)||(c=e.cloneRange(),g=a(h.createTextNode("|")),c.insertNode(g[0]),c.selectNode(g[0]),f=c.getBoundingClientRect(),d={height:f.height,left:f.left,top:f.top},g.remove(),c.detach())):h.selection&&(d=this.getOldIEOffset()),d&&(d.top+=a(j).scrollTop(),d.left+=a(j).scrollLeft()),d},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=a.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"<br/>"),/firefox/i.test(navigator.userAgent)&&(a=a.replace(/\s/g," ")),a},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(a){var b;return b=this.getOffset(a)}},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});
|
Â
|
|
1 |
Â
!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){"use strict";var b,c,d,e,f,g,h,i,j,k,l;k="caret",b=function(){function b(a){this.$inputor=a,this.domInputor=this.$inputor[0]}return b.prototype.setPos=function(a){return this.domInputor},b.prototype.getIEPosition=function(){return this.getPosition()},b.prototype.getPosition=function(){var a,b;return b=this.getOffset(),a=this.$inputor.offset(),b.left-=a.left,b.top-=a.top,b},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(b){var c,d,e,f,g;return j.getSelection&&(e=this.range())?(e.endOffset-1>0&&e.endContainer===!this.domInputor&&(c=e.cloneRange(),c.setStart(e.endContainer,e.endOffset-1),c.setEnd(e.endContainer,e.endOffset),f=c.getBoundingClientRect(),d={height:f.height,left:f.left+f.width,top:f.top},c.detach()),d&&0!==(null!=d?d.height:void 0)||(c=e.cloneRange(),g=a(h.createTextNode("|")),c.insertNode(g[0]),c.selectNode(g[0]),f=c.getBoundingClientRect(),d={height:f.height,left:f.left,top:f.top},g.remove(),c.detach())):h.selection&&(d=this.getOldIEOffset()),d&&(d.top+=a(j).scrollTop(),d.left+=a(j).scrollLeft()),d},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=a.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"<br/>"),/firefox/i.test(navigator.userAgent)&&(a=a.replace(/\s/g," ")),a},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(a){var b;return b=this.getOffset(a)}},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});
|
@@ -1,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM UTC - https://wordpress.org/plugins/buddypress/ */
|
2 |
Â
window.bp=window.bp||{},function(){"undefined"!=typeof BP_Uploader&&(bp.Models=bp.Models||{},bp.Collections=bp.Collections||{},bp.Views=bp.Views||{},bp.WebCam={start:function(){this.params={video:null,videoStream:null,capture_enable:!1,capture:null,canvas:null,warning:null,flipped:!1},bp.Avatar.nav.on("bp-avatar-view:changed",_.bind(this.setView,this))},setView:function(a){if("camera"!==a)return void(_.isNull(this.params.video)||(this.stop(),this.removeWarning()));var b=new bp.Views.WebCamAvatar({model:new Backbone.Model({user_media:!1})});this.params.flipped=!1,bp.Avatar.views.add({id:"camera",view:b}),b.inject(".bp-avatar")},removeView:function(){var a;_.isUndefined(bp.Avatar.views.get("camera"))||(a=bp.Avatar.views.get("camera"),a.get("view").remove(),bp.Avatar.views.remove({id:"camera",view:a}))},gotStream:function(a){var b=bp.WebCam.params.video;bp.WebCam.params.videoStream=a,bp.WebCam.displayWarning("loaded"),b.onerror=function(){bp.WebCam.displayWarning("videoerror"),b&&bp.WebCam.stop()},a.onended=bp.WebCam.noStream(),void 0!==b.mozSrcObject?(b.mozSrcObject=a,b.play()):navigator.mozGetUserMedia?(b.src=a,b.play()):void 0!==b.srcObject?b.srcObject=a:window.URL?b.src=window.URL.createObjectURL(a):b.src=a,bp.WebCam.params.capture_enable=!0},stop:function(){bp.WebCam.params.capture_enable=!1,bp.WebCam.params.videoStream&&(bp.WebCam.params.videoStream.stop?bp.WebCam.params.videoStream.stop():bp.WebCam.params.videoStream.msStop&&bp.WebCam.params.videoStream.msStop(),bp.WebCam.params.videoStream.onended=null,bp.WebCam.params.videoStream=null),bp.WebCam.params.video&&(bp.WebCam.params.video.onerror=null,bp.WebCam.params.video.pause(),bp.WebCam.params.video.mozSrcObject&&(bp.WebCam.params.video.mozSrcObject=null),bp.WebCam.params.video.src="")},noStream:function(){_.isNull(bp.WebCam.params.videoStream)&&(bp.WebCam.displayWarning("noaccess"),bp.WebCam.removeView())},setAvatar:function(a){a.get("url")||bp.WebCam.displayWarning("nocapture"),bp.WebCam.removeView(),bp.Avatar.setAvatar(a)},removeWarning:function(){_.isNull(this.params.warning)||this.params.warning.remove()},displayWarning:function(a){this.removeWarning(),this.params.warning=new bp.Views.uploaderWarning({value:BP_Uploader.strings.camera_warnings[a]}),this.params.warning.inject(".bp-avatar-status")}},bp.Views.WebCamAvatar=bp.View.extend({tagName:"div",id:"bp-webcam-avatar",template:bp.template("bp-avatar-webcam"),events:{"click .avatar-webcam-capture":"captureStream","click .avatar-webcam-save":"saveCapture"},initialize:function(){var a;(navigator.getUserMedia||navigator.oGetUserMedia||navigator.mozGetUserMedia||navigator.webkitGetUserMedia||navigator.msGetUserMedia)&&(a=_.extend(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,"object","item_id","nonces"),{user_media:!0,w:BP_Uploader.settings.crop.full_w,h:BP_Uploader.settings.crop.full_h,x:0,y:0,type:"camera"}),this.model.set(a)),this.on("ready",this.useStream,this)},useStream:function(){this.model.get("user_media")&&(this.options.video=new bp.Views.WebCamVideo,this.options.canvas=new bp.Views.WebCamCanvas,this.$el.find("#avatar-to-crop").append(this.options.video.el),this.$el.find("#avatar-crop-pane").append(this.options.canvas.el),bp.WebCam.params.video=this.options.video.el,bp.WebCam.params.canvas=this.options.canvas.el,bp.WebCam.displayWarning("requesting"),navigator.getUserMedia?navigator.getUserMedia({video:!0},bp.WebCam.gotStream,bp.WebCam.noStream):navigator.oGetUserMedia?navigator.oGetUserMedia({video:!0},bp.WebCam.gotStream,bp.WebCam.noStream):navigator.mozGetUserMedia?navigator.mozGetUserMedia({video:!0},bp.WebCam.gotStream,bp.WebCam.noStream):navigator.webkitGetUserMedia?navigator.webkitGetUserMedia({video:!0},bp.WebCam.gotStream,bp.WebCam.noStream):navigator.msGetUserMedia?navigator.msGetUserMedia({video:!0,audio:!1},bp.WebCams.gotStream,bp.WebCam.noStream):bp.WebCam.displayWarning("errormsg"))},captureStream:function(a){var b,c;return a.preventDefault(),bp.WebCam.params.capture_enable?this.model.get("h")>this.options.video.el.videoHeight||this.model.get("w")>this.options.video.el.videoWidth?void bp.WebCam.displayWarning("videoerror"):(c=this.options.video.el.videoHeight,b=(this.options.video.el.videoWidth-c)/2,bp.WebCam.params.flipped||(this.options.canvas.el.getContext("2d").translate(this.model.get("w"),0),this.options.canvas.el.getContext("2d").scale(-1,1),bp.WebCam.params.flipped=!0),this.options.canvas.el.getContext("2d").drawImage(this.options.video.el,b,0,c,c,0,0,this.model.get("w"),this.model.get("h")),bp.WebCam.params.capture=this.options.canvas.el.toDataURL("image/png"),this.model.set("url",bp.WebCam.params.capture),void bp.WebCam.displayWarning("ready")):void bp.WebCam.displayWarning("loading")},saveCapture:function(a){return a.preventDefault(),bp.WebCam.params.capture?(bp.WebCam.stop(),void bp.WebCam.setAvatar(this.model)):void bp.WebCam.displayWarning("nocapture")}}),bp.Views.WebCamVideo=bp.View.extend({tagName:"video",id:"bp-webcam-video",attributes:{autoplay:"autoplay"}}),bp.Views.WebCamCanvas=bp.View.extend({tagName:"canvas",id:"bp-webcam-canvas",attributes:{width:150,height:150},initialize:function(){_.isUndefined(BP_Uploader.settings.crop.full_h)||_.isUndefined(BP_Uploader.settings.crop.full_w)||(this.el.attributes.width.value=BP_Uploader.settings.crop.full_w,this.el.attributes.height.value=BP_Uploader.settings.crop.full_h)}}),bp.WebCam.start())}(bp,jQuery);
|
Â
|
|
1 |
Â
window.bp=window.bp||{},function(){"undefined"!=typeof BP_Uploader&&(bp.Models=bp.Models||{},bp.Collections=bp.Collections||{},bp.Views=bp.Views||{},bp.WebCam={start:function(){this.params={video:null,videoStream:null,capture_enable:!1,capture:null,canvas:null,warning:null,flipped:!1},bp.Avatar.nav.on("bp-avatar-view:changed",_.bind(this.setView,this))},setView:function(a){if("camera"!==a)return void(_.isNull(this.params.video)||(this.stop(),this.removeWarning()));var b=new bp.Views.WebCamAvatar({model:new Backbone.Model({user_media:!1})});this.params.flipped=!1,bp.Avatar.views.add({id:"camera",view:b}),b.inject(".bp-avatar")},removeView:function(){var a;_.isUndefined(bp.Avatar.views.get("camera"))||(a=bp.Avatar.views.get("camera"),a.get("view").remove(),bp.Avatar.views.remove({id:"camera",view:a}))},gotStream:function(a){var b=bp.WebCam.params.video;bp.WebCam.params.videoStream=a,bp.WebCam.displayWarning("loaded"),b.onerror=function(){bp.WebCam.displayWarning("videoerror"),b&&bp.WebCam.stop()},a.onended=bp.WebCam.noStream(),void 0!==b.mozSrcObject?(b.mozSrcObject=a,b.play()):navigator.mozGetUserMedia?(b.src=a,b.play()):void 0!==b.srcObject?b.srcObject=a:window.URL?b.src=window.URL.createObjectURL(a):b.src=a,bp.WebCam.params.capture_enable=!0},stop:function(){bp.WebCam.params.capture_enable=!1,bp.WebCam.params.videoStream&&(bp.WebCam.params.videoStream.stop?bp.WebCam.params.videoStream.stop():bp.WebCam.params.videoStream.msStop&&bp.WebCam.params.videoStream.msStop(),bp.WebCam.params.videoStream.onended=null,bp.WebCam.params.videoStream=null),bp.WebCam.params.video&&(bp.WebCam.params.video.onerror=null,bp.WebCam.params.video.pause(),bp.WebCam.params.video.mozSrcObject&&(bp.WebCam.params.video.mozSrcObject=null),bp.WebCam.params.video.src="")},noStream:function(){_.isNull(bp.WebCam.params.videoStream)&&(bp.WebCam.displayWarning("noaccess"),bp.WebCam.removeView())},setAvatar:function(a){a.get("url")||bp.WebCam.displayWarning("nocapture"),bp.WebCam.removeView(),bp.Avatar.setAvatar(a)},removeWarning:function(){_.isNull(this.params.warning)||this.params.warning.remove()},displayWarning:function(a){this.removeWarning(),this.params.warning=new bp.Views.uploaderWarning({value:BP_Uploader.strings.camera_warnings[a]}),this.params.warning.inject(".bp-avatar-status")}},bp.Views.WebCamAvatar=bp.View.extend({tagName:"div",id:"bp-webcam-avatar",template:bp.template("bp-avatar-webcam"),events:{"click .avatar-webcam-capture":"captureStream","click .avatar-webcam-save":"saveCapture"},initialize:function(){var a;(navigator.getUserMedia||navigator.oGetUserMedia||navigator.mozGetUserMedia||navigator.webkitGetUserMedia||navigator.msGetUserMedia)&&(a=_.extend(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,"object","item_id","nonces"),{user_media:!0,w:BP_Uploader.settings.crop.full_w,h:BP_Uploader.settings.crop.full_h,x:0,y:0,type:"camera"}),this.model.set(a)),this.on("ready",this.useStream,this)},useStream:function(){this.model.get("user_media")&&(this.options.video=new bp.Views.WebCamVideo,this.options.canvas=new bp.Views.WebCamCanvas,this.$el.find("#avatar-to-crop").append(this.options.video.el),this.$el.find("#avatar-crop-pane").append(this.options.canvas.el),bp.WebCam.params.video=this.options.video.el,bp.WebCam.params.canvas=this.options.canvas.el,bp.WebCam.displayWarning("requesting"),navigator.getUserMedia?navigator.getUserMedia({video:!0},bp.WebCam.gotStream,bp.WebCam.noStream):navigator.oGetUserMedia?navigator.oGetUserMedia({video:!0},bp.WebCam.gotStream,bp.WebCam.noStream):navigator.mozGetUserMedia?navigator.mozGetUserMedia({video:!0},bp.WebCam.gotStream,bp.WebCam.noStream):navigator.webkitGetUserMedia?navigator.webkitGetUserMedia({video:!0},bp.WebCam.gotStream,bp.WebCam.noStream):navigator.msGetUserMedia?navigator.msGetUserMedia({video:!0,audio:!1},bp.WebCams.gotStream,bp.WebCam.noStream):bp.WebCam.displayWarning("errormsg"))},captureStream:function(a){var b,c;return a.preventDefault(),bp.WebCam.params.capture_enable?this.model.get("h")>this.options.video.el.videoHeight||this.model.get("w")>this.options.video.el.videoWidth?void bp.WebCam.displayWarning("videoerror"):(c=this.options.video.el.videoHeight,b=(this.options.video.el.videoWidth-c)/2,bp.WebCam.params.flipped||(this.options.canvas.el.getContext("2d").translate(this.model.get("w"),0),this.options.canvas.el.getContext("2d").scale(-1,1),bp.WebCam.params.flipped=!0),this.options.canvas.el.getContext("2d").drawImage(this.options.video.el,b,0,c,c,0,0,this.model.get("w"),this.model.get("h")),bp.WebCam.params.capture=this.options.canvas.el.toDataURL("image/png"),this.model.set("url",bp.WebCam.params.capture),void bp.WebCam.displayWarning("ready")):void bp.WebCam.displayWarning("loading")},saveCapture:function(a){return a.preventDefault(),bp.WebCam.params.capture?(bp.WebCam.stop(),void bp.WebCam.setAvatar(this.model)):void bp.WebCam.displayWarning("nocapture")}}),bp.Views.WebCamVideo=bp.View.extend({tagName:"video",id:"bp-webcam-video",attributes:{autoplay:"autoplay"}}),bp.Views.WebCamCanvas=bp.View.extend({tagName:"canvas",id:"bp-webcam-canvas",attributes:{width:150,height:150},initialize:function(){_.isUndefined(BP_Uploader.settings.crop.full_h)||_.isUndefined(BP_Uploader.settings.crop.full_w)||(this.el.attributes.width.value=BP_Uploader.settings.crop.full_w,this.el.attributes.height.value=BP_Uploader.settings.crop.full_h)}}),bp.WebCam.start())}(bp,jQuery);
|
@@ -1,4 +1,15 @@
|
|
1 |
Â
jQuery(document).ready( function() {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2 |
Â
jQuery('.widget div#members-list-options a').on('click',
|
3 |
Â
function() {
|
4 |
Â
var link = this;
|
@@ -23,7 +34,7 @@ jQuery(document).ready( function() {
|
|
23 |
Â
return false;
|
24 |
Â
}
|
25 |
Â
);
|
26 |
-
}
|
27 |
Â
|
28 |
Â
function member_widget_response(response) {
|
29 |
Â
response = response.substr(0, response.length-1);
|
1 |
Â
jQuery(document).ready( function() {
|
2 |
+
member_widget_click_handler();
|
3 |
+
|
4 |
+
// WP 4.5 - Customizer selective refresh support.
|
5 |
+
if ( 'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh ) {
|
6 |
+
wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() {
|
7 |
+
member_widget_click_handler();
|
8 |
+
} );
|
9 |
+
}
|
10 |
+
});
|
11 |
+
|
12 |
+
function member_widget_click_handler() {
|
13 |
Â
jQuery('.widget div#members-list-options a').on('click',
|
14 |
Â
function() {
|
15 |
Â
var link = this;
|
34 |
Â
return false;
|
35 |
Â
}
|
36 |
Â
);
|
37 |
+
}
|
38 |
Â
|
39 |
Â
function member_widget_response(response) {
|
40 |
Â
response = response.substr(0, response.length-1);
|
@@ -1,2 +1 @@
|
|
1 |
-
|
2 |
-
function member_widget_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_widget_response(b)}),!1})});
|
1 |
+
function member_widget_click_handler(){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_widget_response(b)}),!1})}function member_widget_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(){member_widget_click_handler(),"undefined"!=typeof wp&&wp.customize&&wp.customize.selectiveRefresh&&wp.customize.selectiveRefresh.bind("partial-content-rendered",function(){member_widget_click_handler()})});
|
Â
|
@@ -13,6 +13,8 @@ defined( 'ABSPATH' ) || exit;
|
|
13 |
Â
/**
|
14 |
Â
* Bootstrap bbPress 1.x, and manipulate globals to integrate with BuddyPress.
|
15 |
Â
*
|
Â
|
|
Â
|
|
16 |
Â
* @return bool|null Returns false on failure.
|
17 |
Â
*/
|
18 |
Â
function bp_forums_load_bbpress() {
|
@@ -156,6 +158,8 @@ add_action( 'bbpress_init', 'bp_forums_load_bbpress' );
|
|
156 |
Â
/**
|
157 |
Â
* Get the current bbPress user.
|
158 |
Â
*
|
Â
|
|
Â
|
|
159 |
Â
* @return object $current_user Current user object from WordPress.
|
160 |
Â
*/
|
161 |
Â
function bb_get_current_user() { global $current_user; return $current_user; }
|
@@ -163,6 +167,8 @@ function bb_get_current_user() { global $current_user; return $current_user; }
|
|
163 |
Â
/**
|
164 |
Â
* Get userdata for a bbPress user.
|
165 |
Â
*
|
Â
|
|
Â
|
|
166 |
Â
* @param int $user_id User ID.
|
167 |
Â
* @return object User data from WordPress.
|
168 |
Â
*/
|
@@ -173,14 +179,27 @@ function bb_get_user( $user_id ) { return get_userdata( $user_id ); }
|
|
173 |
Â
*
|
174 |
Â
* Noop.
|
175 |
Â
*
|
Â
|
|
Â
|
|
176 |
Â
* @param array $users Array of users.
|
177 |
Â
*/
|
178 |
Â
function bb_cache_users( $users ) {}
|
179 |
Â
|
180 |
Â
/**
|
181 |
Â
* The bbPress plugin needs this class for its usermeta manipulation.
|
Â
|
|
Â
|
|
182 |
Â
*/
|
183 |
Â
class BP_Forums_BB_Auth {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
184 |
Â
function update_meta( $args = '' ) {
|
185 |
Â
$defaults = array( 'id' => 0, 'meta_key' => null, 'meta_value' => null, 'meta_table' => 'usermeta', 'meta_field' => 'user_id', 'cache_group' => 'users' );
|
186 |
Â
$args = wp_parse_args( $args, $defaults );
|
@@ -198,12 +217,20 @@ class BP_Forums_BB_Auth {
|
|
198 |
Â
* of BPDB which extend the appropriate base class.
|
199 |
Â
*/
|
200 |
Â
if ( ! class_exists( 'BPDB' ) ) :
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
201 |
Â
class BPDB extends WPDB {
|
202 |
Â
var $db_servers = array();
|
203 |
Â
|
204 |
Â
/**
|
205 |
Â
* Constructor.
|
206 |
Â
*
|
Â
|
|
Â
|
|
207 |
Â
* @see WPDB::__construct() for description of parameters.
|
208 |
Â
*/
|
209 |
Â
function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
|
@@ -226,6 +253,8 @@ if ( ! class_exists( 'BPDB' ) ) :
|
|
226 |
Â
* supported by WordPress' minimum required MySQL version, so
|
227 |
Â
* this is safe.
|
228 |
Â
*
|
Â
|
|
Â
|
|
229 |
Â
* @see WPDB::has_cap() for a description of parameters and
|
230 |
Â
* return values.
|
231 |
Â
*
|
@@ -279,6 +308,8 @@ if ( ! class_exists( 'BPDB' ) ) :
|
|
279 |
Â
/**
|
280 |
Â
* Stub for escape_deep() compatibility.
|
281 |
Â
*
|
Â
|
|
Â
|
|
282 |
Â
* @see WPDB::escape_deep() for description of parameters and
|
283 |
Â
* return values.
|
284 |
Â
*
|
@@ -296,6 +327,8 @@ endif; // End class_exists( 'BPDB' ).
|
|
296 |
Â
*
|
297 |
Â
* The bbPress plugin needs this to convert vars.
|
298 |
Â
*
|
Â
|
|
Â
|
|
299 |
Â
* @param object $object Object to convert.
|
300 |
Â
* @param string $output Type of object to return. OBJECT, ARRAY_A, or ARRAY_N.
|
301 |
Â
*/
|
@@ -318,6 +351,8 @@ function backpress_convert_object( &$object, $output ) {
|
|
318 |
Â
* Copied from wp-admin/includes/upgrade.php, this will take care of creating
|
319 |
Â
* the bbPress stand-alone tables without loading a conflicting WP Admin.
|
320 |
Â
*
|
Â
|
|
Â
|
|
321 |
Â
* @see dbDelta() for a description of parameters and return value.
|
322 |
Â
*
|
323 |
Â
* @param array $queries See {@link dbDelta()}.
|
13 |
Â
/**
|
14 |
Â
* Bootstrap bbPress 1.x, and manipulate globals to integrate with BuddyPress.
|
15 |
Â
*
|
16 |
+
* @since 1.1.0
|
17 |
+
*
|
18 |
Â
* @return bool|null Returns false on failure.
|
19 |
Â
*/
|
20 |
Â
function bp_forums_load_bbpress() {
|
158 |
Â
/**
|
159 |
Â
* Get the current bbPress user.
|
160 |
Â
*
|
161 |
+
* @since 1.1.0
|
162 |
+
*
|
163 |
Â
* @return object $current_user Current user object from WordPress.
|
164 |
Â
*/
|
165 |
Â
function bb_get_current_user() { global $current_user; return $current_user; }
|
167 |
Â
/**
|
168 |
Â
* Get userdata for a bbPress user.
|
169 |
Â
*
|
170 |
+
* @since 1.1.0
|
171 |
+
*
|
172 |
Â
* @param int $user_id User ID.
|
173 |
Â
* @return object User data from WordPress.
|
174 |
Â
*/
|
179 |
Â
*
|
180 |
Â
* Noop.
|
181 |
Â
*
|
182 |
+
* @since 1.1.0
|
183 |
+
*
|
184 |
Â
* @param array $users Array of users.
|
185 |
Â
*/
|
186 |
Â
function bb_cache_users( $users ) {}
|
187 |
Â
|
188 |
Â
/**
|
189 |
Â
* The bbPress plugin needs this class for its usermeta manipulation.
|
190 |
+
*
|
191 |
+
* @since 1.1.0
|
192 |
Â
*/
|
193 |
Â
class BP_Forums_BB_Auth {
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Update usermeta data.
|
197 |
+
*
|
198 |
+
* @since 1.1.0
|
199 |
+
*
|
200 |
+
* @param string $args Array of arguments.
|
201 |
+
* @return bool
|
202 |
+
*/
|
203 |
Â
function update_meta( $args = '' ) {
|
204 |
Â
$defaults = array( 'id' => 0, 'meta_key' => null, 'meta_value' => null, 'meta_table' => 'usermeta', 'meta_field' => 'user_id', 'cache_group' => 'users' );
|
205 |
Â
$args = wp_parse_args( $args, $defaults );
|
217 |
Â
* of BPDB which extend the appropriate base class.
|
218 |
Â
*/
|
219 |
Â
if ( ! class_exists( 'BPDB' ) ) :
|
220 |
+
|
221 |
+
/**
|
222 |
+
* WPDB class extension.
|
223 |
+
*
|
224 |
+
* @since 1.1.0
|
225 |
+
*/
|
226 |
Â
class BPDB extends WPDB {
|
227 |
Â
var $db_servers = array();
|
228 |
Â
|
229 |
Â
/**
|
230 |
Â
* Constructor.
|
231 |
Â
*
|
232 |
+
* @since 1.1.0
|
233 |
+
*
|
234 |
Â
* @see WPDB::__construct() for description of parameters.
|
235 |
Â
*/
|
236 |
Â
function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
|
253 |
Â
* supported by WordPress' minimum required MySQL version, so
|
254 |
Â
* this is safe.
|
255 |
Â
*
|
256 |
+
* @since 1.1.0
|
257 |
+
*
|
258 |
Â
* @see WPDB::has_cap() for a description of parameters and
|
259 |
Â
* return values.
|
260 |
Â
*
|
308 |
Â
/**
|
309 |
Â
* Stub for escape_deep() compatibility.
|
310 |
Â
*
|
311 |
+
* @since 1.1.0
|
312 |
+
*
|
313 |
Â
* @see WPDB::escape_deep() for description of parameters and
|
314 |
Â
* return values.
|
315 |
Â
*
|
327 |
Â
*
|
328 |
Â
* The bbPress plugin needs this to convert vars.
|
329 |
Â
*
|
330 |
+
* @since 1.1.0
|
331 |
+
*
|
332 |
Â
* @param object $object Object to convert.
|
333 |
Â
* @param string $output Type of object to return. OBJECT, ARRAY_A, or ARRAY_N.
|
334 |
Â
*/
|
351 |
Â
* Copied from wp-admin/includes/upgrade.php, this will take care of creating
|
352 |
Â
* the bbPress stand-alone tables without loading a conflicting WP Admin.
|
353 |
Â
*
|
354 |
+
* @since 1.5.0
|
355 |
+
*
|
356 |
Â
* @see dbDelta() for a description of parameters and return value.
|
357 |
Â
*
|
358 |
Â
* @param array $queries See {@link dbDelta()}.
|
@@ -58,6 +58,8 @@ add_filter( 'bp_get_the_topic_post_content', 'bp_forums_make_nofollow_filter' );
|
|
58 |
Â
/**
|
59 |
Â
* Custom KSES filter for the Forums component.
|
60 |
Â
*
|
Â
|
|
Â
|
|
61 |
Â
* @param string $content Content to sanitize.
|
62 |
Â
* @return string Sanitized string.
|
63 |
Â
*/
|
@@ -98,6 +100,8 @@ function bp_forums_filter_kses( $content ) {
|
|
98 |
Â
/**
|
99 |
Â
* Get a link for a forum topic tags directory.
|
100 |
Â
*
|
Â
|
|
Â
|
|
101 |
Â
* @param string $link Link passed from filter.
|
102 |
Â
* @param string $tag Name of the tag.
|
103 |
Â
* @param string $page Page number, passed from the filter.
|
@@ -119,6 +123,8 @@ add_filter( 'bb_get_tag_link', 'bp_forums_filter_tag_link', 10, 4);
|
|
119 |
Â
/**
|
120 |
Â
* Add rel="nofollow" to bbPress content.
|
121 |
Â
*
|
Â
|
|
Â
|
|
122 |
Â
* @param string $text Post content.
|
123 |
Â
* @return string Modified post content.
|
124 |
Â
*/
|
@@ -128,6 +134,8 @@ function bp_forums_make_nofollow_filter( $text ) {
|
|
128 |
Â
/**
|
129 |
Â
* Callback for preg_replace_callback() in bp_forums_make_nofollow_filter().
|
130 |
Â
*
|
Â
|
|
Â
|
|
131 |
Â
* @param array $matches Regex matches from {@link bp_forums_make_nofollow_filter()}.
|
132 |
Â
* @return string Text with nofollow links.
|
133 |
Â
*/
|
@@ -140,6 +148,8 @@ function bp_forums_make_nofollow_filter( $text ) {
|
|
140 |
Â
/**
|
141 |
Â
* Append forum topic to page title.
|
142 |
Â
*
|
Â
|
|
Â
|
|
143 |
Â
* @see bp_modify_page_title()
|
144 |
Â
*
|
145 |
Â
* @param string $title New page title; see {@link bp_modify_page_title()}.
|
@@ -163,6 +173,8 @@ add_filter( 'bp_modify_page_title', 'bp_forums_add_forum_topic_to_page_title', 9
|
|
163 |
Â
*
|
164 |
Â
* Prevents embedded anchor tags.
|
165 |
Â
*
|
Â
|
|
Â
|
|
166 |
Â
* @param string $content Edited post content.
|
167 |
Â
* @return string $content Sanitized post content.
|
168 |
Â
*/
|
58 |
Â
/**
|
59 |
Â
* Custom KSES filter for the Forums component.
|
60 |
Â
*
|
61 |
+
* @since 1.2.0
|
62 |
+
*
|
63 |
Â
* @param string $content Content to sanitize.
|
64 |
Â
* @return string Sanitized string.
|
65 |
Â
*/
|
100 |
Â
/**
|
101 |
Â
* Get a link for a forum topic tags directory.
|
102 |
Â
*
|
103 |
+
* @since 1.1.0
|
104 |
+
*
|
105 |
Â
* @param string $link Link passed from filter.
|
106 |
Â
* @param string $tag Name of the tag.
|
107 |
Â
* @param string $page Page number, passed from the filter.
|
123 |
Â
/**
|
124 |
Â
* Add rel="nofollow" to bbPress content.
|
125 |
Â
*
|
126 |
+
* @since 1.2.1
|
127 |
+
*
|
128 |
Â
* @param string $text Post content.
|
129 |
Â
* @return string Modified post content.
|
130 |
Â
*/
|
134 |
Â
/**
|
135 |
Â
* Callback for preg_replace_callback() in bp_forums_make_nofollow_filter().
|
136 |
Â
*
|
137 |
+
* @since 1.2.1
|
138 |
+
*
|
139 |
Â
* @param array $matches Regex matches from {@link bp_forums_make_nofollow_filter()}.
|
140 |
Â
* @return string Text with nofollow links.
|
141 |
Â
*/
|
148 |
Â
/**
|
149 |
Â
* Append forum topic to page title.
|
150 |
Â
*
|
151 |
+
* @since 1.2.6
|
152 |
+
*
|
153 |
Â
* @see bp_modify_page_title()
|
154 |
Â
*
|
155 |
Â
* @param string $title New page title; see {@link bp_modify_page_title()}.
|
173 |
Â
*
|
174 |
Â
* Prevents embedded anchor tags.
|
175 |
Â
*
|
176 |
+
* @since 1.5.0
|
177 |
+
*
|
178 |
Â
* @param string $content Edited post content.
|
179 |
Â
* @return string $content Sanitized post content.
|
180 |
Â
*/
|
@@ -76,6 +76,8 @@ function bp_forums_has_directory() {
|
|
76 |
Â
*
|
77 |
Â
* Wrapper for {@link bb_get_forum()}.
|
78 |
Â
*
|
Â
|
|
Â
|
|
79 |
Â
* @param int $forum_id ID of the forum being fetched.
|
80 |
Â
* @return object bbPress forum object.
|
81 |
Â
*/
|
@@ -91,6 +93,8 @@ function bp_forums_get_forum( $forum_id ) {
|
|
91 |
Â
*
|
92 |
Â
* Wrapper for {@link bb_new_forum()}.
|
93 |
Â
*
|
Â
|
|
Â
|
|
94 |
Â
* @param array|string $args {
|
95 |
Â
* Forum setup arguments.
|
96 |
Â
* @type string $forum_name Name of the forum.
|
@@ -124,6 +128,8 @@ function bp_forums_new_forum( $args = '' ) {
|
|
124 |
Â
*
|
125 |
Â
* Wrapper for {@link bb_update_forum(}.
|
126 |
Â
*
|
Â
|
|
Â
|
|
127 |
Â
* @param array|string $args {
|
128 |
Â
* Forum setup arguments.
|
129 |
Â
* @type int $forum_id ID of the forum to be updated.
|
@@ -158,6 +164,8 @@ function bp_forums_update_forum( $args = '' ) {
|
|
158 |
Â
/**
|
159 |
Â
* Delete a group forum by the group id.
|
160 |
Â
*
|
Â
|
|
Â
|
|
161 |
Â
* @param int $group_id ID of the group whose forum is to be deleted.
|
162 |
Â
*/
|
163 |
Â
function bp_forums_delete_group_forum( $group_id ) {
|
@@ -177,6 +185,8 @@ add_action( 'groups_delete_group', 'bp_forums_delete_group_forum' );
|
|
177 |
Â
/**
|
178 |
Â
* Fetch a set of forum topics.
|
179 |
Â
*
|
Â
|
|
Â
|
|
180 |
Â
* @param array|string $args {
|
181 |
Â
* @type string $type Order or filter type. Default: 'newest'.
|
182 |
Â
* @type int $forum_id Optional. Pass a forum ID to limit results to topics
|
@@ -255,6 +265,8 @@ function bp_forums_get_forum_topics( $args = '' ) {
|
|
255 |
Â
/**
|
256 |
Â
* Get additional details about a given forum topic.
|
257 |
Â
*
|
Â
|
|
Â
|
|
258 |
Â
* @param int $topic_id ID of the topic for which you're fetching details.
|
259 |
Â
* @return object Details about the topic.
|
260 |
Â
*/
|
@@ -273,6 +285,8 @@ function bp_forums_get_topic_details( $topic_id ) {
|
|
273 |
Â
*
|
274 |
Â
* Wrapper for {@link bb_get_id_from_slug()}.
|
275 |
Â
*
|
Â
|
|
Â
|
|
276 |
Â
* @param string $topic_slug Slug of the topic.
|
277 |
Â
* @return int|bool ID of the topic (if found), false on failure.
|
278 |
Â
*/
|
@@ -290,6 +304,8 @@ function bp_forums_get_topic_id_from_slug( $topic_slug ) {
|
|
290 |
Â
/**
|
291 |
Â
* Create a new forum topic.
|
292 |
Â
*
|
Â
|
|
Â
|
|
293 |
Â
* @param array|string $args {
|
294 |
Â
* @type string $topic_title Title of the new topic.
|
295 |
Â
* @type string $topic_slug Slug of the new topic.
|
@@ -373,6 +389,8 @@ function bp_forums_new_topic( $args = '' ) {
|
|
373 |
Â
/**
|
374 |
Â
* Update a topic's details.
|
375 |
Â
*
|
Â
|
|
Â
|
|
376 |
Â
* @param array|string $args {
|
377 |
Â
* Array of arguments.
|
378 |
Â
* @type int $topic_id ID of the topic being updated.
|
@@ -418,6 +436,14 @@ function bp_forums_update_topic( $args = '' ) {
|
|
418 |
Â
return bp_forums_get_topic_details( $topic_id );
|
419 |
Â
}
|
420 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
421 |
Â
function bp_forums_sticky_topic( $args = '' ) {
|
422 |
Â
|
423 |
Â
/** This action is documented in bp-forums/bp-forums-screens.php */
|
@@ -440,6 +466,8 @@ function bp_forums_sticky_topic( $args = '' ) {
|
|
440 |
Â
/**
|
441 |
Â
* Set a topic's open/closed status.
|
442 |
Â
*
|
Â
|
|
Â
|
|
443 |
Â
* @param array|string $args {
|
444 |
Â
* @type int $topic_id ID of the topic whose status is being changed.
|
445 |
Â
* @type string $mode New status of the topic. 'open' or 'close'.
|
@@ -469,6 +497,8 @@ function bp_forums_openclose_topic( $args = '' ) {
|
|
469 |
Â
/**
|
470 |
Â
* Delete a topic.
|
471 |
Â
*
|
Â
|
|
Â
|
|
472 |
Â
* @param array|string $args {
|
473 |
Â
* @type int $topic_id ID of the topic being deleted.
|
474 |
Â
* }
|
@@ -490,6 +520,8 @@ function bp_forums_delete_topic( $args = '' ) {
|
|
490 |
Â
/**
|
491 |
Â
* Get a count of the total topics on the site.
|
492 |
Â
*
|
Â
|
|
Â
|
|
493 |
Â
* @return int $count Total topic count.
|
494 |
Â
*/
|
495 |
Â
function bp_forums_total_topic_count() {
|
@@ -592,6 +624,8 @@ function bp_forums_reply_exists( $text = '', $topic_id = 0, $user_id = 0 ) {
|
|
592 |
Â
/**
|
593 |
Â
* Get a total "Topics Started" count for a given user.
|
594 |
Â
*
|
Â
|
|
Â
|
|
595 |
Â
* @param int $user_id ID of the user being queried. Falls back on displayed
|
596 |
Â
* user, then loggedin.
|
597 |
Â
* @param string $type The current filter/sort type. 'active', 'popular',
|
@@ -693,6 +727,8 @@ function bp_forums_total_replied_count_for_user( $user_id = 0, $type = 'active'
|
|
693 |
Â
* - details about the last poster
|
694 |
Â
* - information about topic users that may have been deleted/spammed
|
695 |
Â
*
|
Â
|
|
Â
|
|
696 |
Â
* @param array $topics Array of topics.
|
697 |
Â
* @return array $topics Topics with BP details added.
|
698 |
Â
*/
|
@@ -756,6 +792,8 @@ function bp_forums_get_topic_extras( $topics ) {
|
|
756 |
Â
/**
|
757 |
Â
* Get the posts belonging to a topic.
|
758 |
Â
*
|
Â
|
|
Â
|
|
759 |
Â
* @param array|string $args {
|
760 |
Â
* @type int $topic_id ID of the topic for which posts are being fetched.
|
761 |
Â
* @type int $page Optional. Page of results to return. Default: 1.
|
@@ -788,6 +826,8 @@ function bp_forums_get_topic_posts( $args = '' ) {
|
|
788 |
Â
*
|
789 |
Â
* Wrapper for {@link bb_get_post()}.
|
790 |
Â
*
|
Â
|
|
Â
|
|
791 |
Â
* @param int $post_id ID of the post being fetched.
|
792 |
Â
* @return object Post object.
|
793 |
Â
*/
|
@@ -803,6 +843,8 @@ function bp_forums_get_post( $post_id ) {
|
|
803 |
Â
*
|
804 |
Â
* Wrapper for {@link bb_delete_post()}.
|
805 |
Â
*
|
Â
|
|
Â
|
|
806 |
Â
* @param array|string $args {
|
807 |
Â
* @type int $post_id ID of the post being deleted.
|
808 |
Â
* }
|
@@ -825,6 +867,8 @@ function bp_forums_delete_post( $args = '' ) {
|
|
825 |
Â
/**
|
826 |
Â
* Create a new post.
|
827 |
Â
*
|
Â
|
|
Â
|
|
828 |
Â
* @param array|string $args {
|
829 |
Â
* @type int $post_id Optional. ID of an existing post, if you want to
|
830 |
Â
* update rather than create. Default: false.
|
@@ -905,6 +949,8 @@ function bp_forums_insert_post( $args = '' ) {
|
|
905 |
Â
* - WP userdata for each poster
|
906 |
Â
* - BP fullname for each poster
|
907 |
Â
*
|
Â
|
|
Â
|
|
908 |
Â
* @param array $posts List of posts.
|
909 |
Â
* @return array Posts with BP-data added.
|
910 |
Â
*/
|
@@ -958,6 +1004,8 @@ function bp_forums_get_post_extras( $posts ) {
|
|
958 |
Â
/**
|
959 |
Â
* Get topic and post counts for a given forum.
|
960 |
Â
*
|
Â
|
|
Â
|
|
961 |
Â
* @param int $forum_id ID of the forum.
|
962 |
Â
* @return object Object with properties $topics (topic count) and $posts
|
963 |
Â
* (post count).
|
@@ -975,6 +1023,8 @@ function bp_forums_get_forum_topicpost_count( $forum_id ) {
|
|
975 |
Â
/**
|
976 |
Â
* Map WordPress caps onto bbPress users, to ensure that they can post.
|
977 |
Â
*
|
Â
|
|
Â
|
|
978 |
Â
* @param array $allcaps Array of capabilities.
|
979 |
Â
* @return array Caps array with bbPress caps added.
|
980 |
Â
*/
|
76 |
Â
*
|
77 |
Â
* Wrapper for {@link bb_get_forum()}.
|
78 |
Â
*
|
79 |
+
* @since 1.0.0
|
80 |
+
*
|
81 |
Â
* @param int $forum_id ID of the forum being fetched.
|
82 |
Â
* @return object bbPress forum object.
|
83 |
Â
*/
|
93 |
Â
*
|
94 |
Â
* Wrapper for {@link bb_new_forum()}.
|
95 |
Â
*
|
96 |
+
* @since 1.0.0
|
97 |
+
*
|
98 |
Â
* @param array|string $args {
|
99 |
Â
* Forum setup arguments.
|
100 |
Â
* @type string $forum_name Name of the forum.
|
128 |
Â
*
|
129 |
Â
* Wrapper for {@link bb_update_forum(}.
|
130 |
Â
*
|
131 |
+
* @since 1.2.5
|
132 |
+
*
|
133 |
Â
* @param array|string $args {
|
134 |
Â
* Forum setup arguments.
|
135 |
Â
* @type int $forum_id ID of the forum to be updated.
|
164 |
Â
/**
|
165 |
Â
* Delete a group forum by the group id.
|
166 |
Â
*
|
167 |
+
* @since 1.6.0
|
168 |
+
*
|
169 |
Â
* @param int $group_id ID of the group whose forum is to be deleted.
|
170 |
Â
*/
|
171 |
Â
function bp_forums_delete_group_forum( $group_id ) {
|
185 |
Â
/**
|
186 |
Â
* Fetch a set of forum topics.
|
187 |
Â
*
|
188 |
+
* @since 1.1.0
|
189 |
+
*
|
190 |
Â
* @param array|string $args {
|
191 |
Â
* @type string $type Order or filter type. Default: 'newest'.
|
192 |
Â
* @type int $forum_id Optional. Pass a forum ID to limit results to topics
|
265 |
Â
/**
|
266 |
Â
* Get additional details about a given forum topic.
|
267 |
Â
*
|
268 |
+
* @since 1.0.0
|
269 |
+
*
|
270 |
Â
* @param int $topic_id ID of the topic for which you're fetching details.
|
271 |
Â
* @return object Details about the topic.
|
272 |
Â
*/
|
285 |
Â
*
|
286 |
Â
* Wrapper for {@link bb_get_id_from_slug()}.
|
287 |
Â
*
|
288 |
+
* @since 1.1.0
|
289 |
+
*
|
290 |
Â
* @param string $topic_slug Slug of the topic.
|
291 |
Â
* @return int|bool ID of the topic (if found), false on failure.
|
292 |
Â
*/
|
304 |
Â
/**
|
305 |
Â
* Create a new forum topic.
|
306 |
Â
*
|
307 |
+
* @since 1.0.0
|
308 |
+
*
|
309 |
Â
* @param array|string $args {
|
310 |
Â
* @type string $topic_title Title of the new topic.
|
311 |
Â
* @type string $topic_slug Slug of the new topic.
|
389 |
Â
/**
|
390 |
Â
* Update a topic's details.
|
391 |
Â
*
|
392 |
+
* @since 1.1.0
|
393 |
+
*
|
394 |
Â
* @param array|string $args {
|
395 |
Â
* Array of arguments.
|
396 |
Â
* @type int $topic_id ID of the topic being updated.
|
436 |
Â
return bp_forums_get_topic_details( $topic_id );
|
437 |
Â
}
|
438 |
Â
|
439 |
+
/**
|
440 |
+
* Set a topic as sticky/unsticky.
|
441 |
+
*
|
442 |
+
* @since 1.1.0
|
443 |
+
*
|
444 |
+
* @param string $args Array of arguments for sticky topic.
|
445 |
+
* @return bool
|
446 |
+
*/
|
447 |
Â
function bp_forums_sticky_topic( $args = '' ) {
|
448 |
Â
|
449 |
Â
/** This action is documented in bp-forums/bp-forums-screens.php */
|
466 |
Â
/**
|
467 |
Â
* Set a topic's open/closed status.
|
468 |
Â
*
|
469 |
+
* @since 1.1.0
|
470 |
+
*
|
471 |
Â
* @param array|string $args {
|
472 |
Â
* @type int $topic_id ID of the topic whose status is being changed.
|
473 |
Â
* @type string $mode New status of the topic. 'open' or 'close'.
|
497 |
Â
/**
|
498 |
Â
* Delete a topic.
|
499 |
Â
*
|
500 |
+
* @since 1.1.0
|
501 |
+
*
|
502 |
Â
* @param array|string $args {
|
503 |
Â
* @type int $topic_id ID of the topic being deleted.
|
504 |
Â
* }
|
520 |
Â
/**
|
521 |
Â
* Get a count of the total topics on the site.
|
522 |
Â
*
|
523 |
+
* @since 1.2.0
|
524 |
+
*
|
525 |
Â
* @return int $count Total topic count.
|
526 |
Â
*/
|
527 |
Â
function bp_forums_total_topic_count() {
|
624 |
Â
/**
|
625 |
Â
* Get a total "Topics Started" count for a given user.
|
626 |
Â
*
|
627 |
+
* @since 1.2.0
|
628 |
+
*
|
629 |
Â
* @param int $user_id ID of the user being queried. Falls back on displayed
|
630 |
Â
* user, then loggedin.
|
631 |
Â
* @param string $type The current filter/sort type. 'active', 'popular',
|
727 |
Â
* - details about the last poster
|
728 |
Â
* - information about topic users that may have been deleted/spammed
|
729 |
Â
*
|
730 |
+
* @since 1.2.0
|
731 |
+
*
|
732 |
Â
* @param array $topics Array of topics.
|
733 |
Â
* @return array $topics Topics with BP details added.
|
734 |
Â
*/
|
792 |
Â
/**
|
793 |
Â
* Get the posts belonging to a topic.
|
794 |
Â
*
|
795 |
+
* @since 1.1.0
|
796 |
+
*
|
797 |
Â
* @param array|string $args {
|
798 |
Â
* @type int $topic_id ID of the topic for which posts are being fetched.
|
799 |
Â
* @type int $page Optional. Page of results to return. Default: 1.
|
826 |
Â
*
|
827 |
Â
* Wrapper for {@link bb_get_post()}.
|
828 |
Â
*
|
829 |
+
* @since 1.0.0
|
830 |
+
*
|
831 |
Â
* @param int $post_id ID of the post being fetched.
|
832 |
Â
* @return object Post object.
|
833 |
Â
*/
|
843 |
Â
*
|
844 |
Â
* Wrapper for {@link bb_delete_post()}.
|
845 |
Â
*
|
846 |
+
* @since 1.1.0
|
847 |
+
*
|
848 |
Â
* @param array|string $args {
|
849 |
Â
* @type int $post_id ID of the post being deleted.
|
850 |
Â
* }
|
867 |
Â
/**
|
868 |
Â
* Create a new post.
|
869 |
Â
*
|
870 |
+
* @since 1.1.0
|
871 |
+
*
|
872 |
Â
* @param array|string $args {
|
873 |
Â
* @type int $post_id Optional. ID of an existing post, if you want to
|
874 |
Â
* update rather than create. Default: false.
|
949 |
Â
* - WP userdata for each poster
|
950 |
Â
* - BP fullname for each poster
|
951 |
Â
*
|
952 |
+
* @since 1.2.0
|
953 |
+
*
|
954 |
Â
* @param array $posts List of posts.
|
955 |
Â
* @return array Posts with BP-data added.
|
956 |
Â
*/
|
1004 |
Â
/**
|
1005 |
Â
* Get topic and post counts for a given forum.
|
1006 |
Â
*
|
1007 |
+
* @since 1.1.0
|
1008 |
+
*
|
1009 |
Â
* @param int $forum_id ID of the forum.
|
1010 |
Â
* @return object Object with properties $topics (topic count) and $posts
|
1011 |
Â
* (post count).
|
1023 |
Â
/**
|
1024 |
Â
* Map WordPress caps onto bbPress users, to ensure that they can post.
|
1025 |
Â
*
|
1026 |
+
* @since 1.1.0
|
1027 |
+
*
|
1028 |
Â
* @param array $allcaps Array of capabilities.
|
1029 |
Â
* @return array Caps array with bbPress caps added.
|
1030 |
Â
*/
|
@@ -15,6 +15,11 @@
|
|
15 |
Â
// Exit if accessed directly.
|
16 |
Â
defined( 'ABSPATH' ) || exit;
|
17 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
18 |
Â
class BP_Forums_Component extends BP_Component {
|
19 |
Â
|
20 |
Â
/**
|
@@ -80,6 +85,8 @@ class BP_Forums_Component extends BP_Component {
|
|
80 |
Â
/**
|
81 |
Â
* Include bp-forums files.
|
82 |
Â
*
|
Â
|
|
Â
|
|
83 |
Â
* @see BP_Component::includes() for description of parameters.
|
84 |
Â
*
|
85 |
Â
* @param array $includes See {@link BP_Component::includes()}.
|
@@ -238,6 +245,8 @@ class BP_Forums_Component extends BP_Component {
|
|
238 |
Â
|
239 |
Â
/**
|
240 |
Â
* Set up the title for pages and the <title> element.
|
Â
|
|
Â
|
|
241 |
Â
*/
|
242 |
Â
public function setup_title() {
|
243 |
Â
|
@@ -263,6 +272,8 @@ class BP_Forums_Component extends BP_Component {
|
|
263 |
Â
|
264 |
Â
/**
|
265 |
Â
* Set up the bp-forums component.
|
Â
|
|
Â
|
|
266 |
Â
*/
|
267 |
Â
function bp_setup_forums() {
|
268 |
Â
buddypress()->forums = new BP_Forums_Component();
|
15 |
Â
// Exit if accessed directly.
|
16 |
Â
defined( 'ABSPATH' ) || exit;
|
17 |
Â
|
18 |
+
/**
|
19 |
+
* Sets up the forums component.
|
20 |
+
*
|
21 |
+
* @since 1.5.0
|
22 |
+
*/
|
23 |
Â
class BP_Forums_Component extends BP_Component {
|
24 |
Â
|
25 |
Â
/**
|
85 |
Â
/**
|
86 |
Â
* Include bp-forums files.
|
87 |
Â
*
|
88 |
+
* @since 1.5.0
|
89 |
+
*
|
90 |
Â
* @see BP_Component::includes() for description of parameters.
|
91 |
Â
*
|
92 |
Â
* @param array $includes See {@link BP_Component::includes()}.
|
245 |
Â
|
246 |
Â
/**
|
247 |
Â
* Set up the title for pages and the <title> element.
|
248 |
+
*
|
249 |
+
* @since 1.5.0
|
250 |
Â
*/
|
251 |
Â
public function setup_title() {
|
252 |
Â
|
272 |
Â
|
273 |
Â
/**
|
274 |
Â
* Set up the bp-forums component.
|
275 |
+
*
|
276 |
+
* @since 1.6.0
|
277 |
Â
*/
|
278 |
Â
function bp_setup_forums() {
|
279 |
Â
buddypress()->forums = new BP_Forums_Component();
|
@@ -12,6 +12,8 @@ defined( 'ABSPATH' ) || exit;
|
|
12 |
Â
|
13 |
Â
/**
|
14 |
Â
* Load the Forums directory.
|
Â
|
|
Â
|
|
15 |
Â
*/
|
16 |
Â
function bp_forums_directory_forums_setup() {
|
17 |
Â
|
@@ -102,6 +104,8 @@ add_action( 'bp_screens', 'bp_forums_directory_forums_setup', 2 );
|
|
102 |
Â
|
103 |
Â
/**
|
104 |
Â
* Load the Topics Started screen.
|
Â
|
|
Â
|
|
105 |
Â
*/
|
106 |
Â
function bp_member_forums_screen_topics() {
|
107 |
Â
|
@@ -124,6 +128,8 @@ function bp_member_forums_screen_topics() {
|
|
124 |
Â
|
125 |
Â
/**
|
126 |
Â
* Load the Replied To screen.
|
Â
|
|
Â
|
|
127 |
Â
*/
|
128 |
Â
function bp_member_forums_screen_replies() {
|
129 |
Â
|
@@ -148,6 +154,8 @@ function bp_member_forums_screen_replies() {
|
|
148 |
Â
* Load the template content for a user's Favorites forum tab.
|
149 |
Â
*
|
150 |
Â
* Note that this feature is not fully implemented at the moment.
|
Â
|
|
Â
|
|
151 |
Â
*/
|
152 |
Â
function bp_member_forums_screen_favorites() {
|
153 |
Â
|
@@ -170,6 +178,8 @@ function bp_member_forums_screen_favorites() {
|
|
170 |
Â
|
171 |
Â
/**
|
172 |
Â
* Load a single forum page.
|
Â
|
|
Â
|
|
173 |
Â
*/
|
174 |
Â
function bp_forums_screen_single_forum() {
|
175 |
Â
|
@@ -196,6 +206,8 @@ add_action( 'bp_screens', 'bp_forums_screen_single_forum' );
|
|
196 |
Â
|
197 |
Â
/**
|
198 |
Â
* Load a single forum topic page.
|
Â
|
|
Â
|
|
199 |
Â
*/
|
200 |
Â
function bp_forums_screen_single_topic() {
|
201 |
Â
|
12 |
Â
|
13 |
Â
/**
|
14 |
Â
* Load the Forums directory.
|
15 |
+
*
|
16 |
+
* @since 1.1.0
|
17 |
Â
*/
|
18 |
Â
function bp_forums_directory_forums_setup() {
|
19 |
Â
|
104 |
Â
|
105 |
Â
/**
|
106 |
Â
* Load the Topics Started screen.
|
107 |
+
*
|
108 |
+
* @since 1.5.0
|
109 |
Â
*/
|
110 |
Â
function bp_member_forums_screen_topics() {
|
111 |
Â
|
128 |
Â
|
129 |
Â
/**
|
130 |
Â
* Load the Replied To screen.
|
131 |
+
*
|
132 |
+
* @since 1.5.0
|
133 |
Â
*/
|
134 |
Â
function bp_member_forums_screen_replies() {
|
135 |
Â
|
154 |
Â
* Load the template content for a user's Favorites forum tab.
|
155 |
Â
*
|
156 |
Â
* Note that this feature is not fully implemented at the moment.
|
157 |
+
*
|
158 |
+
* @since 1.5.0
|
159 |
Â
*/
|
160 |
Â
function bp_member_forums_screen_favorites() {
|
161 |
Â
|
178 |
Â
|
179 |
Â
/**
|
180 |
Â
* Load a single forum page.
|
181 |
+
*
|
182 |
+
* @since 1.5.0
|
183 |
Â
*/
|
184 |
Â
function bp_forums_screen_single_forum() {
|
185 |
Â
|
206 |
Â
|
207 |
Â
/**
|
208 |
Â
* Load a single forum topic page.
|
209 |
+
*
|
210 |
+
* @since 1.5.0
|
211 |
Â
*/
|
212 |
Â
function bp_forums_screen_single_topic() {
|
213 |
Â
|
@@ -15,7 +15,6 @@ defined( 'ABSPATH' ) || exit;
|
|
15 |
Â
*
|
16 |
Â
* @since 1.5.0
|
17 |
Â
*
|
18 |
-
* @uses bp_get_forums_slug()
|
19 |
Â
*/
|
20 |
Â
function bp_forums_slug() {
|
21 |
Â
echo bp_get_forums_slug();
|
@@ -43,7 +42,6 @@ function bp_forums_slug() {
|
|
43 |
Â
*
|
44 |
Â
* @since 1.5.0
|
45 |
Â
*
|
46 |
-
* @uses bp_get_forums_root_slug()
|
47 |
Â
*/
|
48 |
Â
function bp_forums_root_slug() {
|
49 |
Â
echo bp_get_forums_root_slug();
|
@@ -71,7 +69,6 @@ function bp_forums_root_slug() {
|
|
71 |
Â
*
|
72 |
Â
* @since 1.5.0
|
73 |
Â
*
|
74 |
-
* @uses bp_get_forums_directory_permalink()
|
75 |
Â
*/
|
76 |
Â
function bp_forums_directory_permalink() {
|
77 |
Â
echo esc_url( bp_get_forums_directory_permalink() );
|
@@ -81,10 +78,6 @@ function bp_forums_directory_permalink() {
|
|
81 |
Â
*
|
82 |
Â
* @since 1.5.0
|
83 |
Â
*
|
84 |
-
* @uses apply_filters()
|
85 |
-
* @uses trailingslashit()
|
86 |
-
* @uses bp_get_root_domain()
|
87 |
-
* @uses bp_get_forums_root_slug()
|
88 |
Â
*
|
89 |
Â
* @return string The permalink for the forums component directory.
|
90 |
Â
*/
|
@@ -104,11 +97,14 @@ function bp_forums_directory_permalink() {
|
|
104 |
Â
* The main forums template loop class.
|
105 |
Â
*
|
106 |
Â
* Responsible for loading a group of forum topics into a loop for display.
|
Â
|
|
Â
|
|
107 |
Â
*/
|
108 |
Â
class BP_Forums_Template_Forum {
|
109 |
Â
/**
|
110 |
Â
* The loop iterator.
|
111 |
Â
*
|
Â
|
|
112 |
Â
* @var int
|
113 |
Â
*/
|
114 |
Â
public $current_topic = -1;
|
@@ -116,6 +112,7 @@ class BP_Forums_Template_Forum {
|
|
116 |
Â
/**
|
117 |
Â
* The number of topics returned by the paged query.
|
118 |
Â
*
|
Â
|
|
119 |
Â
* @var int
|
120 |
Â
*/
|
121 |
Â
public $topic_count;
|
@@ -123,6 +120,7 @@ class BP_Forums_Template_Forum {
|
|
123 |
Â
/**
|
124 |
Â
* Array of topics located by the query.
|
125 |
Â
*
|
Â
|
|
126 |
Â
* @var array
|
127 |
Â
*/
|
128 |
Â
public $topics;
|
@@ -130,6 +128,7 @@ class BP_Forums_Template_Forum {
|
|
130 |
Â
/**
|
131 |
Â
* The topic object currently being iterated on.
|
132 |
Â
*
|
Â
|
|
133 |
Â
* @var object
|
134 |
Â
*/
|
135 |
Â
public $topic;
|
@@ -137,6 +136,7 @@ class BP_Forums_Template_Forum {
|
|
137 |
Â
/**
|
138 |
Â
* The ID of the forum whose topics are being queried.
|
139 |
Â
*
|
Â
|
|
140 |
Â
* @var int
|
141 |
Â
*/
|
142 |
Â
public $forum_id;
|
@@ -144,6 +144,7 @@ class BP_Forums_Template_Forum {
|
|
144 |
Â
/**
|
145 |
Â
* A flag for whether the loop is currently being iterated.
|
146 |
Â
*
|
Â
|
|
147 |
Â
* @var bool
|
148 |
Â
*/
|
149 |
Â
public $in_the_loop;
|
@@ -151,6 +152,7 @@ class BP_Forums_Template_Forum {
|
|
151 |
Â
/**
|
152 |
Â
* The page number being requested.
|
153 |
Â
*
|
Â
|
|
154 |
Â
* @var int
|
155 |
Â
*/
|
156 |
Â
public $pag_page;
|
@@ -158,6 +160,7 @@ class BP_Forums_Template_Forum {
|
|
158 |
Â
/**
|
159 |
Â
* The number of items being requested per page.
|
160 |
Â
*
|
Â
|
|
161 |
Â
* @var int
|
162 |
Â
*/
|
163 |
Â
public $pag_num;
|
@@ -165,6 +168,7 @@ class BP_Forums_Template_Forum {
|
|
165 |
Â
/**
|
166 |
Â
* An HTML string containing pagination links.
|
167 |
Â
*
|
Â
|
|
168 |
Â
* @var string
|
169 |
Â
*/
|
170 |
Â
public $pag_links;
|
@@ -172,6 +176,7 @@ class BP_Forums_Template_Forum {
|
|
172 |
Â
/**
|
173 |
Â
* The total number of topics matching the query parameters.
|
174 |
Â
*
|
Â
|
|
175 |
Â
* @var int
|
176 |
Â
*/
|
177 |
Â
public $total_topic_count;
|
@@ -179,6 +184,7 @@ class BP_Forums_Template_Forum {
|
|
179 |
Â
/**
|
180 |
Â
* Whether requesting a single topic. Not currently used.
|
181 |
Â
*
|
Â
|
|
182 |
Â
* @var bool
|
183 |
Â
*/
|
184 |
Â
public $single_topic = false;
|
@@ -186,6 +192,7 @@ class BP_Forums_Template_Forum {
|
|
186 |
Â
/**
|
187 |
Â
* Term to sort by. Not currently used.
|
188 |
Â
*
|
Â
|
|
189 |
Â
* @var string
|
190 |
Â
*/
|
191 |
Â
public $sort_by;
|
@@ -193,6 +200,7 @@ class BP_Forums_Template_Forum {
|
|
193 |
Â
/**
|
194 |
Â
* Sort order. Not currently used.
|
195 |
Â
*
|
Â
|
|
196 |
Â
* @var string
|
197 |
Â
*/
|
198 |
Â
public $order;
|
@@ -200,6 +208,8 @@ class BP_Forums_Template_Forum {
|
|
200 |
Â
/**
|
201 |
Â
* Constructor method.
|
202 |
Â
*
|
Â
|
|
Â
|
|
203 |
Â
* @param string $type The 'type' is the sort order/kind. 'newest',
|
204 |
Â
* 'popular', 'unreplied', 'tags'.
|
205 |
Â
* @param int $forum_id The ID of the forum for which topics are being
|
@@ -356,6 +366,8 @@ class BP_Forums_Template_Forum {
|
|
356 |
Â
/**
|
357 |
Â
* Whether there are topics available in the loop.
|
358 |
Â
*
|
Â
|
|
Â
|
|
359 |
Â
* @see bp_has_forum_topics()
|
360 |
Â
*
|
361 |
Â
* @return bool True if there are items in the loop, otherwise false.
|
@@ -371,6 +383,8 @@ class BP_Forums_Template_Forum {
|
|
371 |
Â
/**
|
372 |
Â
* Set up the next topic and iterate index.
|
373 |
Â
*
|
Â
|
|
Â
|
|
374 |
Â
* @return object The next topic to iterate over.
|
375 |
Â
*/
|
376 |
Â
function next_topic() {
|
@@ -382,6 +396,8 @@ class BP_Forums_Template_Forum {
|
|
382 |
Â
|
383 |
Â
/**
|
384 |
Â
* Rewind the topics and reset topic index.
|
Â
|
|
Â
|
|
385 |
Â
*/
|
386 |
Â
function rewind_topics() {
|
387 |
Â
$this->current_topic = -1;
|
@@ -399,6 +415,8 @@ class BP_Forums_Template_Forum {
|
|
399 |
Â
*
|
400 |
Â
* @see bp_forum_topics()
|
401 |
Â
*
|
Â
|
|
Â
|
|
402 |
Â
* @return bool True if there are more topics to show, otherwise false.
|
403 |
Â
*/
|
404 |
Â
function user_topics() {
|
@@ -423,6 +441,8 @@ class BP_Forums_Template_Forum {
|
|
423 |
Â
/**
|
424 |
Â
* Set up the current topic in the loop.
|
425 |
Â
*
|
Â
|
|
Â
|
|
426 |
Â
* @see bp_the_forum_topic()
|
427 |
Â
*/
|
428 |
Â
function the_topic() {
|
@@ -451,7 +471,8 @@ class BP_Forums_Template_Forum {
|
|
451 |
Â
* are determined dynamically, depending on your current page. All of these
|
452 |
Â
* $defaults can be overridden in the $args parameter.
|
453 |
Â
*
|
454 |
-
* @
|
Â
|
|
455 |
Â
* $forums_template global before it's rendered, or to modify the value
|
456 |
Â
* of has_topics().
|
457 |
Â
*
|
@@ -663,6 +684,8 @@ function bp_has_forum_topics( $args = '' ) {
|
|
663 |
Â
/**
|
664 |
Â
* Determine whether there are still topics left in the loop.
|
665 |
Â
*
|
Â
|
|
Â
|
|
666 |
Â
* @global BP_Forums_Template_Forum $forum_template Template global.
|
667 |
Â
*
|
668 |
Â
* @return bool Returns true when topics are found.
|
@@ -675,6 +698,8 @@ function bp_forum_topics() {
|
|
675 |
Â
/**
|
676 |
Â
* Get the current topic object in the loop.
|
677 |
Â
*
|
Â
|
|
Â
|
|
678 |
Â
* @global BP_Forums_Template_Forum $forum_template Template global.
|
679 |
Â
*
|
680 |
Â
* @return object The current topic object.
|
@@ -686,6 +711,8 @@ function bp_the_forum_topic() {
|
|
686 |
Â
|
687 |
Â
/**
|
688 |
Â
* Output the ID of the current topic in the loop.
|
Â
|
|
Â
|
|
689 |
Â
*/
|
690 |
Â
function bp_the_topic_id() {
|
691 |
Â
echo bp_get_the_topic_id();
|
@@ -693,6 +720,8 @@ function bp_the_topic_id() {
|
|
693 |
Â
/**
|
694 |
Â
* Return the ID of the current topic in the loop.
|
695 |
Â
*
|
Â
|
|
Â
|
|
696 |
Â
* @return int ID of the current topic in the loop.
|
697 |
Â
*/
|
698 |
Â
function bp_get_the_topic_id() {
|
@@ -710,6 +739,8 @@ function bp_the_topic_id() {
|
|
710 |
Â
|
711 |
Â
/**
|
712 |
Â
* Output the title of the current topic in the loop.
|
Â
|
|
Â
|
|
713 |
Â
*/
|
714 |
Â
function bp_the_topic_title() {
|
715 |
Â
echo bp_get_the_topic_title();
|
@@ -717,6 +748,8 @@ function bp_the_topic_title() {
|
|
717 |
Â
/**
|
718 |
Â
* Return the title of the current topic in the loop.
|
719 |
Â
*
|
Â
|
|
Â
|
|
720 |
Â
* @return string Title of the current topic in the loop.
|
721 |
Â
*/
|
722 |
Â
function bp_get_the_topic_title() {
|
@@ -734,6 +767,8 @@ function bp_the_topic_title() {
|
|
734 |
Â
|
735 |
Â
/**
|
736 |
Â
* Output the slug of the current topic in the loop.
|
Â
|
|
Â
|
|
737 |
Â
*/
|
738 |
Â
function bp_the_topic_slug() {
|
739 |
Â
echo bp_get_the_topic_slug();
|
@@ -741,6 +776,8 @@ function bp_the_topic_slug() {
|
|
741 |
Â
/**
|
742 |
Â
* Return the slug of the current topic in the loop.
|
743 |
Â
*
|
Â
|
|
Â
|
|
744 |
Â
* @return string Slug of the current topic in the loop.
|
745 |
Â
*/
|
746 |
Â
function bp_get_the_topic_slug() {
|
@@ -758,6 +795,8 @@ function bp_the_topic_slug() {
|
|
758 |
Â
|
759 |
Â
/**
|
760 |
Â
* Output the text of the first post in the current topic in the loop.
|
Â
|
|
Â
|
|
761 |
Â
*/
|
762 |
Â
function bp_the_topic_text() {
|
763 |
Â
echo bp_get_the_topic_text();
|
@@ -765,6 +804,8 @@ function bp_the_topic_text() {
|
|
765 |
Â
/**
|
766 |
Â
* Return the text of the first post in the current topic in the loop.
|
767 |
Â
*
|
Â
|
|
Â
|
|
768 |
Â
* @return string Text of the first post in the current topic.
|
769 |
Â
*/
|
770 |
Â
function bp_get_the_topic_text() {
|
@@ -784,6 +825,8 @@ function bp_the_topic_text() {
|
|
784 |
Â
|
785 |
Â
/**
|
786 |
Â
* Output the ID of the user who posted the current topic in the loop.
|
Â
|
|
Â
|
|
787 |
Â
*/
|
788 |
Â
function bp_the_topic_poster_id() {
|
789 |
Â
echo bp_get_the_topic_poster_id();
|
@@ -791,6 +834,8 @@ function bp_the_topic_poster_id() {
|
|
791 |
Â
/**
|
792 |
Â
* Return the ID of the user who posted the current topic in the loop.
|
793 |
Â
*
|
Â
|
|
Â
|
|
794 |
Â
* @return int ID of the user who posted the current topic.
|
795 |
Â
*/
|
796 |
Â
function bp_get_the_topic_poster_id() {
|
@@ -809,6 +854,8 @@ function bp_the_topic_poster_id() {
|
|
809 |
Â
/**
|
810 |
Â
* Output the avatar of the user who posted the current topic in the loop.
|
811 |
Â
*
|
Â
|
|
Â
|
|
812 |
Â
* @see bp_get_the_topic_poster_avatar() for a description of arguments.
|
813 |
Â
*
|
814 |
Â
* @param array|string $args See {@link bp_get_the_topic_poster_avatar()}.
|
@@ -819,6 +866,8 @@ function bp_the_topic_poster_avatar( $args = '' ) {
|
|
819 |
Â
/**
|
820 |
Â
* Return the avatar of the user who posted the current topic in the loop.
|
821 |
Â
*
|
Â
|
|
Â
|
|
822 |
Â
* @param array|string $args {
|
823 |
Â
* Arguments for building the avatar.
|
824 |
Â
* @type string $type Avatar type. 'thumb' or 'full'. Default:
|
@@ -859,6 +908,8 @@ function bp_the_topic_poster_avatar( $args = '' ) {
|
|
859 |
Â
|
860 |
Â
/**
|
861 |
Â
* Output the name of the user who posted the current topic in the loop.
|
Â
|
|
Â
|
|
862 |
Â
*/
|
863 |
Â
function bp_the_topic_poster_name() {
|
864 |
Â
echo bp_get_the_topic_poster_name();
|
@@ -866,6 +917,8 @@ function bp_the_topic_poster_name() {
|
|
866 |
Â
/**
|
867 |
Â
* Return the name of the user who posted the current topic in the loop.
|
868 |
Â
*
|
Â
|
|
Â
|
|
869 |
Â
* @return string Name of the user who posted the current topic.
|
870 |
Â
*/
|
871 |
Â
function bp_get_the_topic_poster_name() {
|
@@ -888,6 +941,8 @@ function bp_the_topic_poster_name() {
|
|
888 |
Â
|
889 |
Â
/**
|
890 |
Â
* Output the ID of the object associated with the current topic in the loop.
|
Â
|
|
Â
|
|
891 |
Â
*/
|
892 |
Â
function bp_the_topic_object_id() {
|
893 |
Â
echo bp_get_the_topic_object_id();
|
@@ -897,6 +952,8 @@ function bp_the_topic_object_id() {
|
|
897 |
Â
*
|
898 |
Â
* Objects are things like associated groups.
|
899 |
Â
*
|
Â
|
|
Â
|
|
900 |
Â
* @return int ID of the associated object.
|
901 |
Â
*/
|
902 |
Â
function bp_get_the_topic_object_id() {
|
@@ -916,6 +973,8 @@ function bp_the_topic_object_id() {
|
|
916 |
Â
|
917 |
Â
/**
|
918 |
Â
* Output the name of the object associated with the current topic in the loop.
|
Â
|
|
Â
|
|
919 |
Â
*/
|
920 |
Â
function bp_the_topic_object_name() {
|
921 |
Â
echo bp_get_the_topic_object_name();
|
@@ -926,6 +985,8 @@ function bp_the_topic_object_name() {
|
|
926 |
Â
* Objects are things like groups. So this function would return the
|
927 |
Â
* name of the group associated with the forum topic, if it exists.
|
928 |
Â
*
|
Â
|
|
Â
|
|
929 |
Â
* @return string Object name.
|
930 |
Â
*/
|
931 |
Â
function bp_get_the_topic_object_name() {
|
@@ -951,6 +1012,8 @@ function bp_the_topic_object_name() {
|
|
951 |
Â
|
952 |
Â
/**
|
953 |
Â
* Output the slug of the object associated with the current topic in the loop.
|
Â
|
|
Â
|
|
954 |
Â
*/
|
955 |
Â
function bp_the_topic_object_slug() {
|
956 |
Â
echo bp_get_the_topic_object_slug();
|
@@ -961,6 +1024,8 @@ function bp_the_topic_object_slug() {
|
|
961 |
Â
* Objects are things like groups. So this function would return the
|
962 |
Â
* slug of the group associated with the forum topic, if it exists.
|
963 |
Â
*
|
Â
|
|
Â
|
|
964 |
Â
* @return string Object slug.
|
965 |
Â
*/
|
966 |
Â
function bp_get_the_topic_object_slug() {
|
@@ -981,6 +1046,8 @@ function bp_the_topic_object_slug() {
|
|
981 |
Â
|
982 |
Â
/**
|
983 |
Â
* Output the permalink of the object associated with the current topic in the loop.
|
Â
|
|
Â
|
|
984 |
Â
*/
|
985 |
Â
function bp_the_topic_object_permalink() {
|
986 |
Â
echo bp_get_the_topic_object_permalink();
|
@@ -991,6 +1058,8 @@ function bp_the_topic_object_permalink() {
|
|
991 |
Â
* Objects are things like groups. So this function would return the
|
992 |
Â
* permalink of the group associated with the forum topic, if it exists.
|
993 |
Â
*
|
Â
|
|
Â
|
|
994 |
Â
* @return string Object permalink.
|
995 |
Â
*/
|
996 |
Â
function bp_get_the_topic_object_permalink() {
|
@@ -1017,6 +1086,8 @@ function bp_the_topic_object_permalink() {
|
|
1017 |
Â
|
1018 |
Â
/**
|
1019 |
Â
* Output the linked name of the user who last posted to the current topic in the loop.
|
Â
|
|
Â
|
|
1020 |
Â
*/
|
1021 |
Â
function bp_the_topic_last_poster_name() {
|
1022 |
Â
echo bp_get_the_topic_last_poster_name();
|
@@ -1024,6 +1095,8 @@ function bp_the_topic_last_poster_name() {
|
|
1024 |
Â
/**
|
1025 |
Â
* Return the linked name of the user who last posted to the current topic in the loop.
|
1026 |
Â
*
|
Â
|
|
Â
|
|
1027 |
Â
* @return string HTML link to the profile of the user who last posted
|
1028 |
Â
* to the current topic.
|
1029 |
Â
*/
|
@@ -1051,6 +1124,8 @@ function bp_the_topic_last_poster_name() {
|
|
1051 |
Â
/**
|
1052 |
Â
* Output the permalink of the object associated with the current topic in the loop.
|
1053 |
Â
*
|
Â
|
|
Â
|
|
1054 |
Â
* @see bp_get_the_topic_object_avatar() for description of arguments.
|
1055 |
Â
*
|
1056 |
Â
* @param array|string $args See {@bp_get_the_topic_object_avatar()}.
|
@@ -1064,6 +1139,8 @@ function bp_the_topic_object_avatar( $args = '' ) {
|
|
1064 |
Â
* Objects are things like groups. So this function would return the
|
1065 |
Â
* avatar of the group associated with the forum topic, if it exists.
|
1066 |
Â
*
|
Â
|
|
Â
|
|
1067 |
Â
* @param array|string $args {
|
1068 |
Â
* Arguments for building the avatar.
|
1069 |
Â
* @type string $type Avatar type. 'thumb' or 'full'. Default:
|
@@ -1108,6 +1185,8 @@ function bp_the_topic_object_avatar( $args = '' ) {
|
|
1108 |
Â
/**
|
1109 |
Â
* Output the avatar for the user who last posted to the current topic in the loop.
|
1110 |
Â
*
|
Â
|
|
Â
|
|
1111 |
Â
* @see bp_get_the_topic_last_poster_avatar() for description of arguments.
|
1112 |
Â
*
|
1113 |
Â
* @param array|string $args See {@bp_get_the_topic_last_poster_avatar()}.
|
@@ -1118,6 +1197,8 @@ function bp_the_topic_last_poster_avatar( $args = '' ) {
|
|
1118 |
Â
/**
|
1119 |
Â
* Return the avatar for the user who last posted to the current topic in the loop.
|
1120 |
Â
*
|
Â
|
|
Â
|
|
1121 |
Â
* @param array|string $args {
|
1122 |
Â
* Arguments for building the avatar.
|
1123 |
Â
* @type string $type Avatar type. 'thumb' or 'full'. Default:
|
@@ -1158,6 +1239,8 @@ function bp_the_topic_last_poster_avatar( $args = '' ) {
|
|
1158 |
Â
|
1159 |
Â
/**
|
1160 |
Â
* Output the start time of the current topic in the loop.
|
Â
|
|
Â
|
|
1161 |
Â
*/
|
1162 |
Â
function bp_the_topic_start_time() {
|
1163 |
Â
echo bp_get_the_topic_start_time();
|
@@ -1165,6 +1248,8 @@ function bp_the_topic_start_time() {
|
|
1165 |
Â
/**
|
1166 |
Â
* Return the start time of the current topic in the loop.
|
1167 |
Â
*
|
Â
|
|
Â
|
|
1168 |
Â
* @return string Start time of the current topic.
|
1169 |
Â
*/
|
1170 |
Â
function bp_get_the_topic_start_time() {
|
@@ -1182,6 +1267,8 @@ function bp_the_topic_start_time() {
|
|
1182 |
Â
|
1183 |
Â
/**
|
1184 |
Â
* Output the topic time of the current topic in the loop.
|
Â
|
|
Â
|
|
1185 |
Â
*/
|
1186 |
Â
function bp_the_topic_time() {
|
1187 |
Â
echo bp_get_the_topic_time();
|
@@ -1189,6 +1276,8 @@ function bp_the_topic_time() {
|
|
1189 |
Â
/**
|
1190 |
Â
* Return the topic time of the current topic in the loop.
|
1191 |
Â
*
|
Â
|
|
Â
|
|
1192 |
Â
* @return string Topic time of the current topic.
|
1193 |
Â
*/
|
1194 |
Â
function bp_get_the_topic_time() {
|
@@ -1206,6 +1295,8 @@ function bp_the_topic_time() {
|
|
1206 |
Â
|
1207 |
Â
/**
|
1208 |
Â
* Output the ID of the forum associated with the current topic in the loop.
|
Â
|
|
Â
|
|
1209 |
Â
*/
|
1210 |
Â
function bp_the_topic_forum_id() {
|
1211 |
Â
echo bp_get_the_topic_forum_id();
|
@@ -1213,6 +1304,8 @@ function bp_the_topic_forum_id() {
|
|
1213 |
Â
/**
|
1214 |
Â
* Return the ID of the forum associated with the current topic in the loop.
|
1215 |
Â
*
|
Â
|
|
Â
|
|
1216 |
Â
* @return int ID of the forum associated with the current topic.
|
1217 |
Â
*/
|
1218 |
Â
function bp_get_the_topic_forum_id() {
|
@@ -1230,6 +1323,8 @@ function bp_the_topic_forum_id() {
|
|
1230 |
Â
|
1231 |
Â
/**
|
1232 |
Â
* Output the status of the current topic in the loop.
|
Â
|
|
Â
|
|
1233 |
Â
*/
|
1234 |
Â
function bp_the_topic_status() {
|
1235 |
Â
echo bp_get_the_topic_status();
|
@@ -1237,6 +1332,8 @@ function bp_the_topic_status() {
|
|
1237 |
Â
/**
|
1238 |
Â
* Return the status of the current topic in the loop.
|
1239 |
Â
*
|
Â
|
|
Â
|
|
1240 |
Â
* @return string Status of the current topic.
|
1241 |
Â
*/
|
1242 |
Â
function bp_get_the_topic_status() {
|
@@ -1254,6 +1351,8 @@ function bp_the_topic_status() {
|
|
1254 |
Â
|
1255 |
Â
/**
|
1256 |
Â
* Output whether the current topic in the loop is open.
|
Â
|
|
Â
|
|
1257 |
Â
*/
|
1258 |
Â
function bp_the_topic_is_topic_open() {
|
1259 |
Â
echo bp_get_the_topic_is_topic_open();
|
@@ -1261,6 +1360,8 @@ function bp_the_topic_is_topic_open() {
|
|
1261 |
Â
/**
|
1262 |
Â
* Return whether the current topic in the loop is open.
|
1263 |
Â
*
|
Â
|
|
Â
|
|
1264 |
Â
* @return string
|
1265 |
Â
*/
|
1266 |
Â
function bp_get_the_topic_is_topic_open() {
|
@@ -1278,6 +1379,8 @@ function bp_the_topic_is_topic_open() {
|
|
1278 |
Â
|
1279 |
Â
/**
|
1280 |
Â
* Output the ID of the last post in the current topic in the loop.
|
Â
|
|
Â
|
|
1281 |
Â
*/
|
1282 |
Â
function bp_the_topic_last_post_id() {
|
1283 |
Â
echo bp_get_the_topic_last_post_id();
|
@@ -1285,6 +1388,8 @@ function bp_the_topic_last_post_id() {
|
|
1285 |
Â
/**
|
1286 |
Â
* Return the ID of the last post in the current topic in the loop.
|
1287 |
Â
*
|
Â
|
|
Â
|
|
1288 |
Â
* @return int ID of the last post in the current topic.
|
1289 |
Â
*/
|
1290 |
Â
function bp_get_the_topic_last_post_id() {
|
@@ -1302,6 +1407,8 @@ function bp_the_topic_last_post_id() {
|
|
1302 |
Â
|
1303 |
Â
/**
|
1304 |
Â
* Output whether the current topic in the loop is sticky.
|
Â
|
|
Â
|
|
1305 |
Â
*/
|
1306 |
Â
function bp_the_topic_is_sticky() {
|
1307 |
Â
echo bp_get_the_topic_is_sticky();
|
@@ -1309,6 +1416,8 @@ function bp_the_topic_is_sticky() {
|
|
1309 |
Â
/**
|
1310 |
Â
* Return whether the current topic in the loop is sticky.
|
1311 |
Â
*
|
Â
|
|
Â
|
|
1312 |
Â
* @return bool
|
1313 |
Â
*/
|
1314 |
Â
function bp_get_the_topic_is_sticky() {
|
@@ -1326,6 +1435,8 @@ function bp_the_topic_is_sticky() {
|
|
1326 |
Â
|
1327 |
Â
/**
|
1328 |
Â
* Output a 'x posts' string with the number of posts in the current topic.
|
Â
|
|
Â
|
|
1329 |
Â
*/
|
1330 |
Â
function bp_the_topic_total_post_count() {
|
1331 |
Â
echo bp_get_the_topic_total_post_count();
|
@@ -1333,6 +1444,8 @@ function bp_the_topic_total_post_count() {
|
|
1333 |
Â
/**
|
1334 |
Â
* Return a 'x posts' string with the number of posts in the current topic.
|
1335 |
Â
*
|
Â
|
|
Â
|
|
1336 |
Â
* @return string String of the form 'x posts'.
|
1337 |
Â
*/
|
1338 |
Â
function bp_get_the_topic_total_post_count() {
|
@@ -1357,6 +1470,8 @@ function bp_the_topic_total_post_count() {
|
|
1357 |
Â
|
1358 |
Â
/**
|
1359 |
Â
* Output the total number of posts in the current topic in the loop.
|
Â
|
|
Â
|
|
1360 |
Â
*/
|
1361 |
Â
function bp_the_topic_total_posts() {
|
1362 |
Â
echo bp_get_the_topic_total_posts();
|
@@ -1364,6 +1479,8 @@ function bp_the_topic_total_posts() {
|
|
1364 |
Â
/**
|
1365 |
Â
* Return the total number of posts in the current topic in the loop.
|
1366 |
Â
*
|
Â
|
|
Â
|
|
1367 |
Â
* @return int Total number of posts in the current topic.
|
1368 |
Â
*/
|
1369 |
Â
function bp_get_the_topic_total_posts() {
|
@@ -1381,6 +1498,8 @@ function bp_the_topic_total_posts() {
|
|
1381 |
Â
|
1382 |
Â
/**
|
1383 |
Â
* Output the tag count for the current topic in the loop.
|
Â
|
|
Â
|
|
1384 |
Â
*/
|
1385 |
Â
function bp_the_topic_tag_count() {
|
1386 |
Â
echo bp_get_the_topic_tag_count();
|
@@ -1388,6 +1507,8 @@ function bp_the_topic_tag_count() {
|
|
1388 |
Â
/**
|
1389 |
Â
* Return the tag count for the current topic in the loop.
|
1390 |
Â
*
|
Â
|
|
Â
|
|
1391 |
Â
* @return int Tag count for the current topic.
|
1392 |
Â
*/
|
1393 |
Â
function bp_get_the_topic_tag_count() {
|
@@ -1405,6 +1526,8 @@ function bp_the_topic_tag_count() {
|
|
1405 |
Â
|
1406 |
Â
/**
|
1407 |
Â
* Output the permalink of the current topic in the loop.
|
Â
|
|
Â
|
|
1408 |
Â
*/
|
1409 |
Â
function bp_the_topic_permalink() {
|
1410 |
Â
echo bp_get_the_topic_permalink();
|
@@ -1412,6 +1535,8 @@ function bp_the_topic_permalink() {
|
|
1412 |
Â
/**
|
1413 |
Â
* Return the permalink for the current topic in the loop.
|
1414 |
Â
*
|
Â
|
|
Â
|
|
1415 |
Â
* @return string Permalink for the current topic.
|
1416 |
Â
*/
|
1417 |
Â
function bp_get_the_topic_permalink() {
|
@@ -1446,6 +1571,8 @@ function bp_the_topic_permalink() {
|
|
1446 |
Â
|
1447 |
Â
/**
|
1448 |
Â
* Output a 'since' string describing when the current topic was created.
|
Â
|
|
Â
|
|
1449 |
Â
*/
|
1450 |
Â
function bp_the_topic_time_since_created() {
|
1451 |
Â
echo bp_get_the_topic_time_since_created();
|
@@ -1453,6 +1580,8 @@ function bp_the_topic_time_since_created() {
|
|
1453 |
Â
/**
|
1454 |
Â
* Return a 'since' string describing when the current topic was created.
|
1455 |
Â
*
|
Â
|
|
Â
|
|
1456 |
Â
* @see bp_core_time_since() for a description of return value.
|
1457 |
Â
*
|
1458 |
Â
* @return string
|
@@ -1473,6 +1602,8 @@ function bp_the_topic_time_since_created() {
|
|
1473 |
Â
/**
|
1474 |
Â
* Output an excerpt from the latest post of the current topic in the loop.
|
1475 |
Â
*
|
Â
|
|
Â
|
|
1476 |
Â
* @param array|string $args See {@bp_get_the_topic_latest_post_excerpt()}.
|
1477 |
Â
*/
|
1478 |
Â
function bp_the_topic_latest_post_excerpt( $args = '' ) {
|
@@ -1481,6 +1612,8 @@ function bp_the_topic_latest_post_excerpt( $args = '' ) {
|
|
1481 |
Â
/**
|
1482 |
Â
* Return an excerpt from the latest post of the current topic in the loop.
|
1483 |
Â
*
|
Â
|
|
Â
|
|
1484 |
Â
* @param array|string $args {
|
1485 |
Â
* @type int $length The length of the excerpted text. Default: 225.
|
1486 |
Â
* }
|
@@ -1512,6 +1645,8 @@ function bp_the_topic_latest_post_excerpt( $args = '' ) {
|
|
1512 |
Â
|
1513 |
Â
/**
|
1514 |
Â
* Output a 'since' string describing when the last post in the current topic was created.
|
Â
|
|
Â
|
|
1515 |
Â
*/
|
1516 |
Â
function bp_the_topic_time_since_last_post() {
|
1517 |
Â
echo bp_get_the_topic_time_since_last_post();
|
@@ -1519,6 +1654,8 @@ function bp_the_topic_time_since_last_post() {
|
|
1519 |
Â
/**
|
1520 |
Â
* Return a 'since' string describing when the last post in the current topic was created.
|
1521 |
Â
*
|
Â
|
|
Â
|
|
1522 |
Â
* @see bp_core_time_since() for a description of return value.
|
1523 |
Â
*
|
1524 |
Â
* @return string
|
@@ -1538,6 +1675,8 @@ function bp_the_topic_time_since_last_post() {
|
|
1538 |
Â
|
1539 |
Â
/**
|
1540 |
Â
* Output whether the current topic in the loop belongs to the logged-in user.
|
Â
|
|
Â
|
|
1541 |
Â
*/
|
1542 |
Â
function bp_the_topic_is_mine() {
|
1543 |
Â
echo bp_get_the_topic_is_mine();
|
@@ -1545,6 +1684,8 @@ function bp_the_topic_is_mine() {
|
|
1545 |
Â
/**
|
1546 |
Â
* Does the current topic belong to the logged-in user?
|
1547 |
Â
*
|
Â
|
|
Â
|
|
1548 |
Â
* @return bool True if the current topic in the loop was created by
|
1549 |
Â
* the logged-in user, otherwise false.
|
1550 |
Â
*/
|
@@ -1557,6 +1698,8 @@ function bp_the_topic_is_mine() {
|
|
1557 |
Â
/**
|
1558 |
Â
* Output the admin links for the current topic in the loop.
|
1559 |
Â
*
|
Â
|
|
Â
|
|
1560 |
Â
* @see bp_get_the_topic_admin_links() for a description of arguments.
|
1561 |
Â
*
|
1562 |
Â
* @param array|string $args See {@link bp_get_the_topic_admin_links()}.
|
@@ -1567,6 +1710,8 @@ function bp_the_topic_admin_links( $args = '' ) {
|
|
1567 |
Â
/**
|
1568 |
Â
* Return the admin links for the current topic in the loop.
|
1569 |
Â
*
|
Â
|
|
Â
|
|
1570 |
Â
* @param array|string $args {
|
1571 |
Â
* @type string $separator The character to use when separating links. Default: '|'.
|
1572 |
Â
* }
|
@@ -1603,6 +1748,8 @@ function bp_the_topic_admin_links( $args = '' ) {
|
|
1603 |
Â
|
1604 |
Â
/**
|
1605 |
Â
* Output the CSS class for the current topic in the loop.
|
Â
|
|
Â
|
|
1606 |
Â
*/
|
1607 |
Â
function bp_the_topic_css_class() {
|
1608 |
Â
echo bp_get_the_topic_css_class();
|
@@ -1613,6 +1760,8 @@ function bp_the_topic_css_class() {
|
|
1613 |
Â
* This class may contain keywords like 'alt', 'sticky', or 'closed',
|
1614 |
Â
* based on context.
|
1615 |
Â
*
|
Â
|
|
Â
|
|
1616 |
Â
* @return string Contents of the 'class' attribute.
|
1617 |
Â
*/
|
1618 |
Â
function bp_get_the_topic_css_class() {
|
@@ -1644,6 +1793,8 @@ function bp_the_topic_css_class() {
|
|
1644 |
Â
|
1645 |
Â
/**
|
1646 |
Â
* Output the permalink to the 'personal' topics tab.
|
Â
|
|
Â
|
|
1647 |
Â
*/
|
1648 |
Â
function bp_my_forum_topics_link() {
|
1649 |
Â
echo bp_get_my_forum_topics_link();
|
@@ -1651,6 +1802,8 @@ function bp_my_forum_topics_link() {
|
|
1651 |
Â
/**
|
1652 |
Â
* Return the permalink to the 'personal' topics tab.
|
1653 |
Â
*
|
Â
|
|
Â
|
|
1654 |
Â
* @return string Link to the 'personal' topics tab.
|
1655 |
Â
*/
|
1656 |
Â
function bp_get_my_forum_topics_link() {
|
@@ -1666,6 +1819,8 @@ function bp_my_forum_topics_link() {
|
|
1666 |
Â
|
1667 |
Â
/**
|
1668 |
Â
* Output the permalink to the 'unreplied' topics tab.
|
Â
|
|
Â
|
|
1669 |
Â
*/
|
1670 |
Â
function bp_unreplied_forum_topics_link() {
|
1671 |
Â
echo bp_get_unreplied_forum_topics_link();
|
@@ -1673,6 +1828,8 @@ function bp_unreplied_forum_topics_link() {
|
|
1673 |
Â
/**
|
1674 |
Â
* Return the permalink to the 'unreplied' topics tab.
|
1675 |
Â
*
|
Â
|
|
Â
|
|
1676 |
Â
* @return string Link to the 'unreplied' topics tab.
|
1677 |
Â
*/
|
1678 |
Â
function bp_get_unreplied_forum_topics_link() {
|
@@ -1688,6 +1845,8 @@ function bp_unreplied_forum_topics_link() {
|
|
1688 |
Â
|
1689 |
Â
/**
|
1690 |
Â
* Output the permalink to the 'popular' topics tab.
|
Â
|
|
Â
|
|
1691 |
Â
*/
|
1692 |
Â
function bp_popular_forum_topics_link() {
|
1693 |
Â
echo bp_get_popular_forum_topics_link();
|
@@ -1695,6 +1854,8 @@ function bp_popular_forum_topics_link() {
|
|
1695 |
Â
/**
|
1696 |
Â
* Return the permalink to the 'popular' topics tab.
|
1697 |
Â
*
|
Â
|
|
Â
|
|
1698 |
Â
* @return string Link to the 'popular' topics tab.
|
1699 |
Â
*/
|
1700 |
Â
function bp_get_popular_forum_topics_link() {
|
@@ -1710,6 +1871,8 @@ function bp_popular_forum_topics_link() {
|
|
1710 |
Â
|
1711 |
Â
/**
|
1712 |
Â
* Output the link to the forums directory.
|
Â
|
|
Â
|
|
1713 |
Â
*/
|
1714 |
Â
function bp_newest_forum_topics_link() {
|
1715 |
Â
echo bp_get_newest_forum_topics_link();
|
@@ -1717,6 +1880,8 @@ function bp_newest_forum_topics_link() {
|
|
1717 |
Â
/**
|
1718 |
Â
* Return the link to the forums directory.
|
1719 |
Â
*
|
Â
|
|
Â
|
|
1720 |
Â
* @return string Link to the forums directory.
|
1721 |
Â
*/
|
1722 |
Â
function bp_get_newest_forum_topics_link() {
|
@@ -1732,6 +1897,8 @@ function bp_newest_forum_topics_link() {
|
|
1732 |
Â
|
1733 |
Â
/**
|
1734 |
Â
* Output the currently viewed topic list type.
|
Â
|
|
Â
|
|
1735 |
Â
*/
|
1736 |
Â
function bp_forum_topic_type() {
|
1737 |
Â
echo bp_get_forum_topic_type();
|
@@ -1741,6 +1908,8 @@ function bp_forum_topic_type() {
|
|
1741 |
Â
*
|
1742 |
Â
* Eg, 'newest', 'popular', etc.
|
1743 |
Â
*
|
Â
|
|
Â
|
|
1744 |
Â
* @return string Type of the currently viewed topic list.
|
1745 |
Â
*/
|
1746 |
Â
function bp_get_forum_topic_type() {
|
@@ -1773,7 +1942,6 @@ function bp_forum_topic_new_reply_link() {
|
|
1773 |
Â
*
|
1774 |
Â
* @since 1.5.0
|
1775 |
Â
*
|
1776 |
-
* @uses apply_filters() Filter bp_get_forum_topic_new_reply_link to
|
1777 |
Â
* modify.
|
1778 |
Â
*
|
1779 |
Â
* @return string The URL for the New Reply link.
|
@@ -1805,6 +1973,8 @@ function bp_forum_topic_new_reply_link() {
|
|
1805 |
Â
/**
|
1806 |
Â
* Output the currently viewed tag name.
|
1807 |
Â
*
|
Â
|
|
Â
|
|
1808 |
Â
* @todo Deprecate?
|
1809 |
Â
*/
|
1810 |
Â
function bp_forums_tag_name() {
|
@@ -1813,7 +1983,11 @@ function bp_forums_tag_name() {
|
|
1813 |
Â
/**
|
1814 |
Â
* Return the currently viewed tag name.
|
1815 |
Â
*
|
Â
|
|
Â
|
|
1816 |
Â
* @todo Deprecate? Seems unused
|
Â
|
|
Â
|
|
1817 |
Â
*/
|
1818 |
Â
function bp_get_forums_tag_name() {
|
1819 |
Â
$tag_name = bp_is_directory() && bp_is_forums_component() ? bp_action_variable( 0 ) : false;
|
@@ -1823,6 +1997,8 @@ function bp_forums_tag_name() {
|
|
1823 |
Â
|
1824 |
Â
/**
|
1825 |
Â
* Output the pagination links for the current topic list.
|
Â
|
|
Â
|
|
1826 |
Â
*/
|
1827 |
Â
function bp_forum_pagination() {
|
1828 |
Â
echo bp_get_forum_pagination();
|
@@ -1830,6 +2006,8 @@ function bp_forum_pagination() {
|
|
1830 |
Â
/**
|
1831 |
Â
* Return the pagination links for the current topic list.
|
1832 |
Â
*
|
Â
|
|
Â
|
|
1833 |
Â
* @return string HTML pagination links.
|
1834 |
Â
*/
|
1835 |
Â
function bp_get_forum_pagination() {
|
@@ -1847,6 +2025,8 @@ function bp_forum_pagination() {
|
|
1847 |
Â
|
1848 |
Â
/**
|
1849 |
Â
* Output the pagination count for the current topic list.
|
Â
|
|
Â
|
|
1850 |
Â
*/
|
1851 |
Â
function bp_forum_pagination_count() {
|
1852 |
Â
echo bp_get_forum_pagination_count();
|
@@ -1856,6 +2036,8 @@ function bp_forum_pagination_count() {
|
|
1856 |
Â
*
|
1857 |
Â
* The "count" is a string of the form "Viewing x of y topics".
|
1858 |
Â
*
|
Â
|
|
Â
|
|
1859 |
Â
* @return string
|
1860 |
Â
*/
|
1861 |
Â
function bp_get_forum_pagination_count() {
|
@@ -1892,6 +2074,8 @@ function bp_forum_pagination_count() {
|
|
1892 |
Â
/**
|
1893 |
Â
* Are we currently on an Edit Topic screen?
|
1894 |
Â
*
|
Â
|
|
Â
|
|
1895 |
Â
* @return bool True if currently editing a topic, otherwise false.
|
1896 |
Â
*/
|
1897 |
Â
function bp_is_edit_topic() {
|
@@ -1906,11 +2090,14 @@ function bp_is_edit_topic() {
|
|
1906 |
Â
* The single forum topic template loop class.
|
1907 |
Â
*
|
1908 |
Â
* Responsible for loading a topic's posts into a loop for display.
|
Â
|
|
Â
|
|
1909 |
Â
*/
|
1910 |
Â
class BP_Forums_Template_Topic {
|
1911 |
Â
/**
|
1912 |
Â
* The loop iterator.
|
1913 |
Â
*
|
Â
|
|
1914 |
Â
* @var int
|
1915 |
Â
*/
|
1916 |
Â
public $current_post = -1;
|
@@ -1918,6 +2105,7 @@ class BP_Forums_Template_Topic {
|
|
1918 |
Â
/**
|
1919 |
Â
* The number of posts returned by the paged query.
|
1920 |
Â
*
|
Â
|
|
1921 |
Â
* @var int
|
1922 |
Â
*/
|
1923 |
Â
public $post_count;
|
@@ -1925,6 +2113,7 @@ class BP_Forums_Template_Topic {
|
|
1925 |
Â
/**
|
1926 |
Â
* Array of posts located by the query.
|
1927 |
Â
*
|
Â
|
|
1928 |
Â
* @var array
|
1929 |
Â
*/
|
1930 |
Â
public $posts;
|
@@ -1932,6 +2121,7 @@ class BP_Forums_Template_Topic {
|
|
1932 |
Â
/**
|
1933 |
Â
* The post object currently being iterated on.
|
1934 |
Â
*
|
Â
|
|
1935 |
Â
* @var object
|
1936 |
Â
*/
|
1937 |
Â
public $post;
|
@@ -1939,6 +2129,7 @@ class BP_Forums_Template_Topic {
|
|
1939 |
Â
/**
|
1940 |
Â
* The ID of the forum whose topic is being queried.
|
1941 |
Â
*
|
Â
|
|
1942 |
Â
* @var int
|
1943 |
Â
*/
|
1944 |
Â
public $forum_id;
|
@@ -1946,6 +2137,7 @@ class BP_Forums_Template_Topic {
|
|
1946 |
Â
/**
|
1947 |
Â
* The ID of the topic whose posts are being queried.
|
1948 |
Â
*
|
Â
|
|
1949 |
Â
* @var int
|
1950 |
Â
*/
|
1951 |
Â
public $topic_id;
|
@@ -1953,6 +2145,7 @@ class BP_Forums_Template_Topic {
|
|
1953 |
Â
/**
|
1954 |
Â
* The topic object to which the posts belong.
|
1955 |
Â
*
|
Â
|
|
1956 |
Â
* @var object
|
1957 |
Â
*/
|
1958 |
Â
public $topic;
|
@@ -1960,6 +2153,7 @@ class BP_Forums_Template_Topic {
|
|
1960 |
Â
/**
|
1961 |
Â
* A flag for whether the loop is currently being iterated.
|
1962 |
Â
*
|
Â
|
|
1963 |
Â
* @var bool
|
1964 |
Â
*/
|
1965 |
Â
public $in_the_loop;
|
@@ -1976,6 +2170,7 @@ class BP_Forums_Template_Topic {
|
|
1976 |
Â
/**
|
1977 |
Â
* The page number being requested.
|
1978 |
Â
*
|
Â
|
|
1979 |
Â
* @var int
|
1980 |
Â
*/
|
1981 |
Â
public $pag_page;
|
@@ -1983,6 +2178,7 @@ class BP_Forums_Template_Topic {
|
|
1983 |
Â
/**
|
1984 |
Â
* The number of items being requested per page.
|
1985 |
Â
*
|
Â
|
|
1986 |
Â
* @var int
|
1987 |
Â
*/
|
1988 |
Â
public $pag_num;
|
@@ -1990,6 +2186,7 @@ class BP_Forums_Template_Topic {
|
|
1990 |
Â
/**
|
1991 |
Â
* An HTML string containing pagination links.
|
1992 |
Â
*
|
Â
|
|
1993 |
Â
* @var string
|
1994 |
Â
*/
|
1995 |
Â
public $pag_links;
|
@@ -1997,6 +2194,7 @@ class BP_Forums_Template_Topic {
|
|
1997 |
Â
/**
|
1998 |
Â
* The total number of posts matching the query parameters.
|
1999 |
Â
*
|
Â
|
|
2000 |
Â
* @var int
|
2001 |
Â
*/
|
2002 |
Â
public $total_post_count;
|
@@ -2004,6 +2202,7 @@ class BP_Forums_Template_Topic {
|
|
2004 |
Â
/**
|
2005 |
Â
* Whether requesting a single topic. Not currently used.
|
2006 |
Â
*
|
Â
|
|
2007 |
Â
* @var bool
|
2008 |
Â
*/
|
2009 |
Â
public $single_post = false;
|
@@ -2011,6 +2210,7 @@ class BP_Forums_Template_Topic {
|
|
2011 |
Â
/**
|
2012 |
Â
* Term to sort by.
|
2013 |
Â
*
|
Â
|
|
2014 |
Â
* @var string
|
2015 |
Â
*/
|
2016 |
Â
public $sort_by;
|
@@ -2018,6 +2218,7 @@ class BP_Forums_Template_Topic {
|
|
2018 |
Â
/**
|
2019 |
Â
* Sort order.
|
2020 |
Â
*
|
Â
|
|
2021 |
Â
* @var string
|
2022 |
Â
*/
|
2023 |
Â
public $order;
|
@@ -2025,6 +2226,8 @@ class BP_Forums_Template_Topic {
|
|
2025 |
Â
/**
|
2026 |
Â
* Constructor method.
|
2027 |
Â
*
|
Â
|
|
Â
|
|
2028 |
Â
* @param int $topic_id ID of the topic whose posts are being requested.
|
2029 |
Â
* @param int $per_page Number of items to return per page.
|
2030 |
Â
* @param int $max Max records to return.
|
@@ -2094,6 +2297,8 @@ class BP_Forums_Template_Topic {
|
|
2094 |
Â
/**
|
2095 |
Â
* Whether there are posts available in the loop.
|
2096 |
Â
*
|
Â
|
|
Â
|
|
2097 |
Â
* @see bp_has_forum_topic_posts()
|
2098 |
Â
*
|
2099 |
Â
* @return bool True if there are items in the loop, otherwise false.
|
@@ -2108,6 +2313,8 @@ class BP_Forums_Template_Topic {
|
|
2108 |
Â
/**
|
2109 |
Â
* Set up the next post and iterate index.
|
2110 |
Â
*
|
Â
|
|
Â
|
|
2111 |
Â
* @return object The next post to iterate over.
|
2112 |
Â
*/
|
2113 |
Â
function next_post() {
|
@@ -2119,6 +2326,8 @@ class BP_Forums_Template_Topic {
|
|
2119 |
Â
|
2120 |
Â
/**
|
2121 |
Â
* Rewind the posts and reset post index.
|
Â
|
|
Â
|
|
2122 |
Â
*/
|
2123 |
Â
function rewind_posts() {
|
2124 |
Â
$this->current_post = -1;
|
@@ -2134,6 +2343,8 @@ class BP_Forums_Template_Topic {
|
|
2134 |
Â
* the while loop that controls iteration inside the blogs loop, eg:
|
2135 |
Â
* while ( bp_forum_topic_posts() ) { ...
|
2136 |
Â
*
|
Â
|
|
Â
|
|
2137 |
Â
* @see bp_forum_topic_posts()
|
2138 |
Â
*
|
2139 |
Â
* @return bool True if there are more posts to show, otherwise false.
|
@@ -2160,6 +2371,8 @@ class BP_Forums_Template_Topic {
|
|
2160 |
Â
/**
|
2161 |
Â
* Set up the current topic in the loop.
|
2162 |
Â
*
|
Â
|
|
Â
|
|
2163 |
Â
* @see bp_the_forum_topic_post()
|
2164 |
Â
*/
|
2165 |
Â
function the_post() {
|
@@ -2183,6 +2396,8 @@ class BP_Forums_Template_Topic {
|
|
2183 |
Â
/**
|
2184 |
Â
* Initiate the loop for a single topic's posts.
|
2185 |
Â
*
|
Â
|
|
Â
|
|
2186 |
Â
* @param array|string $args {
|
2187 |
Â
* Arguments for limiting the contents of the topic posts loop.
|
2188 |
Â
* @type int $topic_id ID of the topic to which the posts belong.
|
@@ -2236,6 +2451,8 @@ function bp_has_forum_topic_posts( $args = '' ) {
|
|
2236 |
Â
/**
|
2237 |
Â
* Determine whether there are posts left in the loop.
|
2238 |
Â
*
|
Â
|
|
Â
|
|
2239 |
Â
* @return bool True when posts are found.
|
2240 |
Â
*/
|
2241 |
Â
function bp_forum_topic_posts() {
|
@@ -2246,6 +2463,8 @@ function bp_forum_topic_posts() {
|
|
2246 |
Â
/**
|
2247 |
Â
* Set up the current post in the loop.
|
2248 |
Â
*
|
Â
|
|
Â
|
|
2249 |
Â
* @return object
|
2250 |
Â
*/
|
2251 |
Â
function bp_the_forum_topic_post() {
|
@@ -2255,6 +2474,8 @@ function bp_the_forum_topic_post() {
|
|
2255 |
Â
|
2256 |
Â
/**
|
2257 |
Â
* Output the ID of the current post in the loop.
|
Â
|
|
Â
|
|
2258 |
Â
*/
|
2259 |
Â
function bp_the_topic_post_id() {
|
2260 |
Â
echo bp_get_the_topic_post_id();
|
@@ -2262,6 +2483,8 @@ function bp_the_topic_post_id() {
|
|
2262 |
Â
/**
|
2263 |
Â
* Return the ID of the current post in the loop.
|
2264 |
Â
*
|
Â
|
|
Â
|
|
2265 |
Â
* @return int ID of the current post in the loop.
|
2266 |
Â
*/
|
2267 |
Â
function bp_get_the_topic_post_id() {
|
@@ -2279,6 +2502,8 @@ function bp_the_topic_post_id() {
|
|
2279 |
Â
|
2280 |
Â
/**
|
2281 |
Â
* Output the content of the current post in the loop.
|
Â
|
|
Â
|
|
2282 |
Â
*/
|
2283 |
Â
function bp_the_topic_post_content() {
|
2284 |
Â
echo bp_get_the_topic_post_content();
|
@@ -2286,6 +2511,8 @@ function bp_the_topic_post_content() {
|
|
2286 |
Â
/**
|
2287 |
Â
* Return the content of the current post in the loop.
|
2288 |
Â
*
|
Â
|
|
Â
|
|
2289 |
Â
* @return string Content of the current post.
|
2290 |
Â
*/
|
2291 |
Â
function bp_get_the_topic_post_content() {
|
@@ -2303,6 +2530,8 @@ function bp_the_topic_post_content() {
|
|
2303 |
Â
|
2304 |
Â
/**
|
2305 |
Â
* Output the CSS class of the current post in the loop.
|
Â
|
|
Â
|
|
2306 |
Â
*/
|
2307 |
Â
function bp_the_topic_post_css_class() {
|
2308 |
Â
echo bp_get_the_topic_post_css_class();
|
@@ -2313,6 +2542,8 @@ function bp_the_topic_post_css_class() {
|
|
2313 |
Â
* May contain strings 'alt', 'deleted', or 'open', depending on
|
2314 |
Â
* context.
|
2315 |
Â
*
|
Â
|
|
Â
|
|
2316 |
Â
* @return string String to put in the 'class' attribute of the current
|
2317 |
Â
* post.
|
2318 |
Â
*/
|
@@ -2346,6 +2577,8 @@ function bp_the_topic_post_css_class() {
|
|
2346 |
Â
/**
|
2347 |
Â
* Output the avatar of the user who posted the current post in the loop.
|
2348 |
Â
*
|
Â
|
|
Â
|
|
2349 |
Â
* @see bp_get_the_topic_post_poster_avatar() for a description of arguments.
|
2350 |
Â
*
|
2351 |
Â
* @param array|string $args See {@link bp_get_the_topic_post_poster_avatar()}.
|
@@ -2356,6 +2589,8 @@ function bp_the_topic_post_poster_avatar( $args = '' ) {
|
|
2356 |
Â
/**
|
2357 |
Â
* Return the avatar of the user who posted the current post in the loop.
|
2358 |
Â
*
|
Â
|
|
Â
|
|
2359 |
Â
* @param array|string $args {
|
2360 |
Â
* Arguments for building the avatar.
|
2361 |
Â
* @type string $type Avatar type. 'thumb' or 'full'. Default:
|
@@ -2396,6 +2631,8 @@ function bp_the_topic_post_poster_avatar( $args = '' ) {
|
|
2396 |
Â
|
2397 |
Â
/**
|
2398 |
Â
* Output the name of the user who posted the current post in the loop.
|
Â
|
|
Â
|
|
2399 |
Â
*/
|
2400 |
Â
function bp_the_topic_post_poster_name() {
|
2401 |
Â
echo bp_get_the_topic_post_poster_name();
|
@@ -2403,6 +2640,8 @@ function bp_the_topic_post_poster_name() {
|
|
2403 |
Â
/**
|
2404 |
Â
* Return the name of the user who posted the current post in the loop.
|
2405 |
Â
*
|
Â
|
|
Â
|
|
2406 |
Â
* @return string Name of the user who posted the current post.
|
2407 |
Â
*/
|
2408 |
Â
function bp_get_the_topic_post_poster_name() {
|
@@ -2423,6 +2662,8 @@ function bp_the_topic_post_poster_name() {
|
|
2423 |
Â
|
2424 |
Â
/**
|
2425 |
Â
* Output a link to the profile of the user who posted the current post.
|
Â
|
|
Â
|
|
2426 |
Â
*/
|
2427 |
Â
function bp_the_topic_post_poster_link() {
|
2428 |
Â
echo bp_get_the_topic_post_poster_link();
|
@@ -2430,6 +2671,8 @@ function bp_the_topic_post_poster_link() {
|
|
2430 |
Â
/**
|
2431 |
Â
* Return a link to the profile of the user who posted the current post.
|
2432 |
Â
*
|
Â
|
|
Â
|
|
2433 |
Â
* @return string Link to the profile of the user who posted the
|
2434 |
Â
* current post.
|
2435 |
Â
*/
|
@@ -2448,6 +2691,8 @@ function bp_the_topic_post_poster_link() {
|
|
2448 |
Â
|
2449 |
Â
/**
|
2450 |
Â
* Output a 'since' string describing when the current post in the loop was posted.
|
Â
|
|
Â
|
|
2451 |
Â
*/
|
2452 |
Â
function bp_the_topic_post_time_since() {
|
2453 |
Â
echo bp_get_the_topic_post_time_since();
|
@@ -2455,6 +2700,8 @@ function bp_the_topic_post_time_since() {
|
|
2455 |
Â
/**
|
2456 |
Â
* Return a 'since' string describing when the current post in the loop was posted.
|
2457 |
Â
*
|
Â
|
|
Â
|
|
2458 |
Â
* @see bp_core_time_since() for a description of return value.
|
2459 |
Â
*
|
2460 |
Â
* @return string
|
@@ -2474,6 +2721,8 @@ function bp_the_topic_post_time_since() {
|
|
2474 |
Â
|
2475 |
Â
/**
|
2476 |
Â
* Output whether the current post in the loop belongs to the logged-in user.
|
Â
|
|
Â
|
|
2477 |
Â
*/
|
2478 |
Â
function bp_the_topic_post_is_mine() {
|
2479 |
Â
echo bp_get_the_topic_post_is_mine();
|
@@ -2481,6 +2730,8 @@ function bp_the_topic_post_is_mine() {
|
|
2481 |
Â
/**
|
2482 |
Â
* Does the current post belong to the logged-in user?
|
2483 |
Â
*
|
Â
|
|
Â
|
|
2484 |
Â
* @return bool True if the current post in the loop was created by
|
2485 |
Â
* the logged-in user, otherwise false.
|
2486 |
Â
*/
|
@@ -2493,6 +2744,8 @@ function bp_the_topic_post_is_mine() {
|
|
2493 |
Â
/**
|
2494 |
Â
* Output the admin links for the current post in the loop.
|
2495 |
Â
*
|
Â
|
|
Â
|
|
2496 |
Â
* @see bp_get_the_post_admin_links() for a description of arguments.
|
2497 |
Â
*
|
2498 |
Â
* @param array|string $args See {@link bp_get_the_post_admin_links()}.
|
@@ -2503,6 +2756,8 @@ function bp_the_topic_post_admin_links( $args = '' ) {
|
|
2503 |
Â
/**
|
2504 |
Â
* Return the admin links for the current post in the loop.
|
2505 |
Â
*
|
Â
|
|
Â
|
|
2506 |
Â
* @param array|string $args {
|
2507 |
Â
* @type string $separator The character to use when separating
|
2508 |
Â
* links. Default: '|'.
|
@@ -2543,6 +2798,8 @@ function bp_the_topic_post_admin_links( $args = '' ) {
|
|
2543 |
Â
|
2544 |
Â
/**
|
2545 |
Â
* Output the text to edit when editing a post.
|
Â
|
|
Â
|
|
2546 |
Â
*/
|
2547 |
Â
function bp_the_topic_post_edit_text() {
|
2548 |
Â
echo bp_get_the_topic_post_edit_text();
|
@@ -2550,6 +2807,8 @@ function bp_the_topic_post_edit_text() {
|
|
2550 |
Â
/**
|
2551 |
Â
* Return the text to edit when editing a post.
|
2552 |
Â
*
|
Â
|
|
Â
|
|
2553 |
Â
* @return string Editable text.
|
2554 |
Â
*/
|
2555 |
Â
function bp_get_the_topic_post_edit_text() {
|
@@ -2567,6 +2826,8 @@ function bp_the_topic_post_edit_text() {
|
|
2567 |
Â
|
2568 |
Â
/**
|
2569 |
Â
* Output the pagination links for the current topic.
|
Â
|
|
Â
|
|
2570 |
Â
*/
|
2571 |
Â
function bp_the_topic_pagination() {
|
2572 |
Â
echo bp_get_the_topic_pagination();
|
@@ -2574,6 +2835,8 @@ function bp_the_topic_pagination() {
|
|
2574 |
Â
/**
|
2575 |
Â
* Return the pagination links for the current topic page.
|
2576 |
Â
*
|
Â
|
|
Â
|
|
2577 |
Â
* @return string HTML pagination links.
|
2578 |
Â
*/
|
2579 |
Â
function bp_get_the_topic_pagination() {
|
@@ -2594,6 +2857,8 @@ function bp_the_topic_pagination() {
|
|
2594 |
Â
* Return the pagination count for the current topic page.
|
2595 |
Â
*
|
2596 |
Â
* The "count" is a string of the form "Viewing x of y posts".
|
Â
|
|
Â
|
|
2597 |
Â
*/
|
2598 |
Â
function bp_the_topic_pagination_count() {
|
2599 |
Â
global $topic_template;
|
@@ -2624,6 +2889,8 @@ function bp_the_topic_pagination_count() {
|
|
2624 |
Â
|
2625 |
Â
/**
|
2626 |
Â
* Output whether this is the last page in the current topic.
|
Â
|
|
Â
|
|
2627 |
Â
*/
|
2628 |
Â
function bp_the_topic_is_last_page() {
|
2629 |
Â
echo bp_get_the_topic_is_last_page();
|
@@ -2631,6 +2898,8 @@ function bp_the_topic_is_last_page() {
|
|
2631 |
Â
/**
|
2632 |
Â
* Is this the last page in the current topic?
|
2633 |
Â
*
|
Â
|
|
Â
|
|
2634 |
Â
* @return bool True if this is the last page of posts for the current
|
2635 |
Â
* topic, otherwise false.
|
2636 |
Â
*/
|
@@ -2649,6 +2918,8 @@ function bp_the_topic_is_last_page() {
|
|
2649 |
Â
|
2650 |
Â
/**
|
2651 |
Â
* Output the forums directory search form.
|
Â
|
|
Â
|
|
2652 |
Â
*/
|
2653 |
Â
function bp_directory_forums_search_form() {
|
2654 |
Â
$default_search_value = bp_get_search_default_text( 'forums' );
|
@@ -2672,6 +2943,8 @@ function bp_directory_forums_search_form() {
|
|
2672 |
Â
/**
|
2673 |
Â
* Output the link to a given forum.
|
2674 |
Â
*
|
Â
|
|
Â
|
|
2675 |
Â
* @see bp_get_forum_permalink() for a description of arguments.
|
2676 |
Â
*
|
2677 |
Â
* @param int $forum_id See {@link bp_get_forum_permalink()}.
|
@@ -2682,6 +2955,8 @@ function bp_forum_permalink( $forum_id = 0 ) {
|
|
2682 |
Â
/**
|
2683 |
Â
* Return the permalink to a given forum.
|
2684 |
Â
*
|
Â
|
|
Â
|
|
2685 |
Â
* @param int $forum_id Optional. Defaults to the current forum, if
|
2686 |
Â
* there is one.
|
2687 |
Â
* @return string|bool False on failure, a URL on success.
|
@@ -2716,6 +2991,8 @@ function bp_forum_permalink( $forum_id = 0 ) {
|
|
2716 |
Â
/**
|
2717 |
Â
* Output the name of a given forum.
|
2718 |
Â
*
|
Â
|
|
Â
|
|
2719 |
Â
* @see bp_get_forum_name() for a description of parameters.
|
2720 |
Â
*
|
2721 |
Â
* @param int $forum_id See {@link bp_get_forum_name()}.
|
@@ -2726,6 +3003,8 @@ function bp_forum_name( $forum_id = 0 ) {
|
|
2726 |
Â
/**
|
2727 |
Â
* Return the name of a given forum.
|
2728 |
Â
*
|
Â
|
|
Â
|
|
2729 |
Â
* @param int $forum_id Optional. Defaults to the current forum, if
|
2730 |
Â
* there is one.
|
2731 |
Â
* @return string|bool False on failure, a name on success.
|
@@ -2760,6 +3039,8 @@ function bp_forum_name( $forum_id = 0 ) {
|
|
2760 |
Â
* A wrapper for {@link bb_tag_heat_map}, which provides it with BP-friendly
|
2761 |
Â
* defaults.
|
2762 |
Â
*
|
Â
|
|
Â
|
|
2763 |
Â
* @param array|string $args {
|
2764 |
Â
* An array of optional arguments.
|
2765 |
Â
* @type int $smallest Size of the smallest link. Default: 10.
|
@@ -2853,6 +3134,8 @@ function bp_forum_topic_has_tags() {
|
|
2853 |
Â
|
2854 |
Â
/**
|
2855 |
Â
* Output a URL to use in as a forum form 'action'.
|
Â
|
|
Â
|
|
2856 |
Â
*/
|
2857 |
Â
function bp_forum_action() {
|
2858 |
Â
echo bp_get_forum_action();
|
@@ -2860,6 +3143,8 @@ function bp_forum_action() {
|
|
2860 |
Â
/**
|
2861 |
Â
* Get a URL to use in as a forum form 'action'.
|
2862 |
Â
*
|
Â
|
|
Â
|
|
2863 |
Â
* @return string URL of the current page, minus query args.
|
2864 |
Â
*/
|
2865 |
Â
function bp_get_forum_action() {
|
@@ -2877,6 +3162,8 @@ function bp_forum_action() {
|
|
2877 |
Â
|
2878 |
Â
/**
|
2879 |
Â
* Output a URL to use in as a forum topic form 'action'.
|
Â
|
|
Â
|
|
2880 |
Â
*/
|
2881 |
Â
function bp_forum_topic_action() {
|
2882 |
Â
echo bp_get_forum_topic_action();
|
@@ -2884,6 +3171,8 @@ function bp_forum_topic_action() {
|
|
2884 |
Â
/**
|
2885 |
Â
* Get a URL to use in as a forum topic form 'action'.
|
2886 |
Â
*
|
Â
|
|
Â
|
|
2887 |
Â
* @return string URL of the current page, minus query args.
|
2888 |
Â
*/
|
2889 |
Â
function bp_get_forum_topic_action() {
|
@@ -2901,6 +3190,8 @@ function bp_forum_topic_action() {
|
|
2901 |
Â
/**
|
2902 |
Â
* Output the total topic count for a given user.
|
2903 |
Â
*
|
Â
|
|
Â
|
|
2904 |
Â
* @see bp_get_forum_topic_count_for_user() for description of parameters.
|
2905 |
Â
*
|
2906 |
Â
* @param int $user_id See {@link bp_get_forum_topic_count_for_user()}.
|
@@ -2911,6 +3202,8 @@ function bp_forum_topic_count_for_user( $user_id = 0 ) {
|
|
2911 |
Â
/**
|
2912 |
Â
* Return the total topic count for a given user.
|
2913 |
Â
*
|
Â
|
|
Â
|
|
2914 |
Â
* @param int $user_id See {@link bp_forums_total_topic_count_for_user}.
|
2915 |
Â
*
|
2916 |
Â
* @return int
|
@@ -2930,6 +3223,8 @@ function bp_forum_topic_count_for_user( $user_id = 0 ) {
|
|
2930 |
Â
/**
|
2931 |
Â
* Output the total topic count for a given user.
|
2932 |
Â
*
|
Â
|
|
Â
|
|
2933 |
Â
* @see bp_get_forum_topic_count() for description of parameters.
|
2934 |
Â
*
|
2935 |
Â
* @param int $user_id See {@link bp_get_forum_topic_count()}.
|
@@ -2940,6 +3235,8 @@ function bp_forum_topic_count( $user_id = 0 ) {
|
|
2940 |
Â
/**
|
2941 |
Â
* Return the total topic count for a given user.
|
2942 |
Â
*
|
Â
|
|
Â
|
|
2943 |
Â
* @param int $user_id See {@link bp_forums_total_topic_count()}.
|
2944 |
Â
*
|
2945 |
Â
* @return int
|
15 |
Â
*
|
16 |
Â
* @since 1.5.0
|
17 |
Â
*
|
Â
|
|
18 |
Â
*/
|
19 |
Â
function bp_forums_slug() {
|
20 |
Â
echo bp_get_forums_slug();
|
42 |
Â
*
|
43 |
Â
* @since 1.5.0
|
44 |
Â
*
|
Â
|
|
45 |
Â
*/
|
46 |
Â
function bp_forums_root_slug() {
|
47 |
Â
echo bp_get_forums_root_slug();
|
69 |
Â
*
|
70 |
Â
* @since 1.5.0
|
71 |
Â
*
|
Â
|
|
72 |
Â
*/
|
73 |
Â
function bp_forums_directory_permalink() {
|
74 |
Â
echo esc_url( bp_get_forums_directory_permalink() );
|
78 |
Â
*
|
79 |
Â
* @since 1.5.0
|
80 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
81 |
Â
*
|
82 |
Â
* @return string The permalink for the forums component directory.
|
83 |
Â
*/
|
97 |
Â
* The main forums template loop class.
|
98 |
Â
*
|
99 |
Â
* Responsible for loading a group of forum topics into a loop for display.
|
100 |
+
*
|
101 |
+
* @since 1.0.0
|
102 |
Â
*/
|
103 |
Â
class BP_Forums_Template_Forum {
|
104 |
Â
/**
|
105 |
Â
* The loop iterator.
|
106 |
Â
*
|
107 |
+
* @since 1.0.0
|
108 |
Â
* @var int
|
109 |
Â
*/
|
110 |
Â
public $current_topic = -1;
|
112 |
Â
/**
|
113 |
Â
* The number of topics returned by the paged query.
|
114 |
Â
*
|
115 |
+
* @since 1.0.0
|
116 |
Â
* @var int
|
117 |
Â
*/
|
118 |
Â
public $topic_count;
|
120 |
Â
/**
|
121 |
Â
* Array of topics located by the query.
|
122 |
Â
*
|
123 |
+
* @since 1.0.0
|
124 |
Â
* @var array
|
125 |
Â
*/
|
126 |
Â
public $topics;
|
128 |
Â
/**
|
129 |
Â
* The topic object currently being iterated on.
|
130 |
Â
*
|
131 |
+
* @since 1.0.0
|
132 |
Â
* @var object
|
133 |
Â
*/
|
134 |
Â
public $topic;
|
136 |
Â
/**
|
137 |
Â
* The ID of the forum whose topics are being queried.
|
138 |
Â
*
|
139 |
+
* @since 1.5.0
|
140 |
Â
* @var int
|
141 |
Â
*/
|
142 |
Â
public $forum_id;
|
144 |
Â
/**
|
145 |
Â
* A flag for whether the loop is currently being iterated.
|
146 |
Â
*
|
147 |
+
* @since 1.0.0
|
148 |
Â
* @var bool
|
149 |
Â
*/
|
150 |
Â
public $in_the_loop;
|
152 |
Â
/**
|
153 |
Â
* The page number being requested.
|
154 |
Â
*
|
155 |
+
* @since 1.0.0
|
156 |
Â
* @var int
|
157 |
Â
*/
|
158 |
Â
public $pag_page;
|
160 |
Â
/**
|
161 |
Â
* The number of items being requested per page.
|
162 |
Â
*
|
163 |
+
* @since 1.0.0
|
164 |
Â
* @var int
|
165 |
Â
*/
|
166 |
Â
public $pag_num;
|
168 |
Â
/**
|
169 |
Â
* An HTML string containing pagination links.
|
170 |
Â
*
|
171 |
+
* @since 1.0.0
|
172 |
Â
* @var string
|
173 |
Â
*/
|
174 |
Â
public $pag_links;
|
176 |
Â
/**
|
177 |
Â
* The total number of topics matching the query parameters.
|
178 |
Â
*
|
179 |
+
* @since 1.0.0
|
180 |
Â
* @var int
|
181 |
Â
*/
|
182 |
Â
public $total_topic_count;
|
184 |
Â
/**
|
185 |
Â
* Whether requesting a single topic. Not currently used.
|
186 |
Â
*
|
187 |
+
* @since 1.0.0
|
188 |
Â
* @var bool
|
189 |
Â
*/
|
190 |
Â
public $single_topic = false;
|
192 |
Â
/**
|
193 |
Â
* Term to sort by. Not currently used.
|
194 |
Â
*
|
195 |
+
* @since 1.0.0
|
196 |
Â
* @var string
|
197 |
Â
*/
|
198 |
Â
public $sort_by;
|
200 |
Â
/**
|
201 |
Â
* Sort order. Not currently used.
|
202 |
Â
*
|
203 |
+
* @since 1.0.0
|
204 |
Â
* @var string
|
205 |
Â
*/
|
206 |
Â
public $order;
|
208 |
Â
/**
|
209 |
Â
* Constructor method.
|
210 |
Â
*
|
211 |
+
* @since 1.5.0
|
212 |
+
*
|
213 |
Â
* @param string $type The 'type' is the sort order/kind. 'newest',
|
214 |
Â
* 'popular', 'unreplied', 'tags'.
|
215 |
Â
* @param int $forum_id The ID of the forum for which topics are being
|
366 |
Â
/**
|
367 |
Â
* Whether there are topics available in the loop.
|
368 |
Â
*
|
369 |
+
* @since 1.0.0
|
370 |
+
*
|
371 |
Â
* @see bp_has_forum_topics()
|
372 |
Â
*
|
373 |
Â
* @return bool True if there are items in the loop, otherwise false.
|
383 |
Â
/**
|
384 |
Â
* Set up the next topic and iterate index.
|
385 |
Â
*
|
386 |
+
* @since 1.0.0
|
387 |
+
*
|
388 |
Â
* @return object The next topic to iterate over.
|
389 |
Â
*/
|
390 |
Â
function next_topic() {
|
396 |
Â
|
397 |
Â
/**
|
398 |
Â
* Rewind the topics and reset topic index.
|
399 |
+
*
|
400 |
+
* @since 1.0.0
|
401 |
Â
*/
|
402 |
Â
function rewind_topics() {
|
403 |
Â
$this->current_topic = -1;
|
415 |
Â
*
|
416 |
Â
* @see bp_forum_topics()
|
417 |
Â
*
|
418 |
+
* @since 1.0.0
|
419 |
+
*
|
420 |
Â
* @return bool True if there are more topics to show, otherwise false.
|
421 |
Â
*/
|
422 |
Â
function user_topics() {
|
441 |
Â
/**
|
442 |
Â
* Set up the current topic in the loop.
|
443 |
Â
*
|
444 |
+
* @since 1.0.0
|
445 |
+
*
|
446 |
Â
* @see bp_the_forum_topic()
|
447 |
Â
*/
|
448 |
Â
function the_topic() {
|
471 |
Â
* are determined dynamically, depending on your current page. All of these
|
472 |
Â
* $defaults can be overridden in the $args parameter.
|
473 |
Â
*
|
474 |
+
* @since 1.1.0
|
475 |
+
*
|
476 |
Â
* $forums_template global before it's rendered, or to modify the value
|
477 |
Â
* of has_topics().
|
478 |
Â
*
|
684 |
Â
/**
|
685 |
Â
* Determine whether there are still topics left in the loop.
|
686 |
Â
*
|
687 |
+
* @since 1.1.0
|
688 |
+
*
|
689 |
Â
* @global BP_Forums_Template_Forum $forum_template Template global.
|
690 |
Â
*
|
691 |
Â
* @return bool Returns true when topics are found.
|
698 |
Â
/**
|
699 |
Â
* Get the current topic object in the loop.
|
700 |
Â
*
|
701 |
+
* @since 1.1.0
|
702 |
+
*
|
703 |
Â
* @global BP_Forums_Template_Forum $forum_template Template global.
|
704 |
Â
*
|
705 |
Â
* @return object The current topic object.
|
711 |
Â
|
712 |
Â
/**
|
713 |
Â
* Output the ID of the current topic in the loop.
|
714 |
+
*
|
715 |
+
* @since 1.0.0
|
716 |
Â
*/
|
717 |
Â
function bp_the_topic_id() {
|
718 |
Â
echo bp_get_the_topic_id();
|
720 |
Â
/**
|
721 |
Â
* Return the ID of the current topic in the loop.
|
722 |
Â
*
|
723 |
+
* @since 1.0.0
|
724 |
+
*
|
725 |
Â
* @return int ID of the current topic in the loop.
|
726 |
Â
*/
|
727 |
Â
function bp_get_the_topic_id() {
|
739 |
Â
|
740 |
Â
/**
|
741 |
Â
* Output the title of the current topic in the loop.
|
742 |
+
*
|
743 |
+
* @since 1.0.0
|
744 |
Â
*/
|
745 |
Â
function bp_the_topic_title() {
|
746 |
Â
echo bp_get_the_topic_title();
|
748 |
Â
/**
|
749 |
Â
* Return the title of the current topic in the loop.
|
750 |
Â
*
|
751 |
+
* @since 1.0.0
|
752 |
+
*
|
753 |
Â
* @return string Title of the current topic in the loop.
|
754 |
Â
*/
|
755 |
Â
function bp_get_the_topic_title() {
|
767 |
Â
|
768 |
Â
/**
|
769 |
Â
* Output the slug of the current topic in the loop.
|
770 |
+
*
|
771 |
+
* @since 1.0.0
|
772 |
Â
*/
|
773 |
Â
function bp_the_topic_slug() {
|
774 |
Â
echo bp_get_the_topic_slug();
|
776 |
Â
/**
|
777 |
Â
* Return the slug of the current topic in the loop.
|
778 |
Â
*
|
779 |
+
* @since 1.0.0
|
780 |
+
*
|
781 |
Â
* @return string Slug of the current topic in the loop.
|
782 |
Â
*/
|
783 |
Â
function bp_get_the_topic_slug() {
|
795 |
Â
|
796 |
Â
/**
|
797 |
Â
* Output the text of the first post in the current topic in the loop.
|
798 |
+
*
|
799 |
+
* @since 1.1.0
|
800 |
Â
*/
|
801 |
Â
function bp_the_topic_text() {
|
802 |
Â
echo bp_get_the_topic_text();
|
804 |
Â
/**
|
805 |
Â
* Return the text of the first post in the current topic in the loop.
|
806 |
Â
*
|
807 |
+
* @since 1.1.0
|
808 |
+
*
|
809 |
Â
* @return string Text of the first post in the current topic.
|
810 |
Â
*/
|
811 |
Â
function bp_get_the_topic_text() {
|
825 |
Â
|
826 |
Â
/**
|
827 |
Â
* Output the ID of the user who posted the current topic in the loop.
|
828 |
+
*
|
829 |
+
* @since 1.0.0
|
830 |
Â
*/
|
831 |
Â
function bp_the_topic_poster_id() {
|
832 |
Â
echo bp_get_the_topic_poster_id();
|
834 |
Â
/**
|
835 |
Â
* Return the ID of the user who posted the current topic in the loop.
|
836 |
Â
*
|
837 |
+
* @since 1.0.0
|
838 |
+
*
|
839 |
Â
* @return int ID of the user who posted the current topic.
|
840 |
Â
*/
|
841 |
Â
function bp_get_the_topic_poster_id() {
|
854 |
Â
/**
|
855 |
Â
* Output the avatar of the user who posted the current topic in the loop.
|
856 |
Â
*
|
857 |
+
* @since 1.0.0
|
858 |
+
*
|
859 |
Â
* @see bp_get_the_topic_poster_avatar() for a description of arguments.
|
860 |
Â
*
|
861 |
Â
* @param array|string $args See {@link bp_get_the_topic_poster_avatar()}.
|
866 |
Â
/**
|
867 |
Â
* Return the avatar of the user who posted the current topic in the loop.
|
868 |
Â
*
|
869 |
+
* @since 1.0.0
|
870 |
+
*
|
871 |
Â
* @param array|string $args {
|
872 |
Â
* Arguments for building the avatar.
|
873 |
Â
* @type string $type Avatar type. 'thumb' or 'full'. Default:
|
908 |
Â
|
909 |
Â
/**
|
910 |
Â
* Output the name of the user who posted the current topic in the loop.
|
911 |
+
*
|
912 |
+
* @since 1.0.0
|
913 |
Â
*/
|
914 |
Â
function bp_the_topic_poster_name() {
|
915 |
Â
echo bp_get_the_topic_poster_name();
|
917 |
Â
/**
|
918 |
Â
* Return the name of the user who posted the current topic in the loop.
|
919 |
Â
*
|
920 |
+
* @since 1.0.0
|
921 |
+
*
|
922 |
Â
* @return string Name of the user who posted the current topic.
|
923 |
Â
*/
|
924 |
Â
function bp_get_the_topic_poster_name() {
|
941 |
Â
|
942 |
Â
/**
|
943 |
Â
* Output the ID of the object associated with the current topic in the loop.
|
944 |
+
*
|
945 |
+
* @since 1.1.0
|
946 |
Â
*/
|
947 |
Â
function bp_the_topic_object_id() {
|
948 |
Â
echo bp_get_the_topic_object_id();
|
952 |
Â
*
|
953 |
Â
* Objects are things like associated groups.
|
954 |
Â
*
|
955 |
+
* @since 1.1.0
|
956 |
+
*
|
957 |
Â
* @return int ID of the associated object.
|
958 |
Â
*/
|
959 |
Â
function bp_get_the_topic_object_id() {
|
973 |
Â
|
974 |
Â
/**
|
975 |
Â
* Output the name of the object associated with the current topic in the loop.
|
976 |
+
*
|
977 |
+
* @since 1.1.0
|
978 |
Â
*/
|
979 |
Â
function bp_the_topic_object_name() {
|
980 |
Â
echo bp_get_the_topic_object_name();
|
985 |
Â
* Objects are things like groups. So this function would return the
|
986 |
Â
* name of the group associated with the forum topic, if it exists.
|
987 |
Â
*
|
988 |
+
* @since 1.1.0
|
989 |
+
*
|
990 |
Â
* @return string Object name.
|
991 |
Â
*/
|
992 |
Â
function bp_get_the_topic_object_name() {
|
1012 |
Â
|
1013 |
Â
/**
|
1014 |
Â
* Output the slug of the object associated with the current topic in the loop.
|
1015 |
+
*
|
1016 |
+
* @since 1.1.0
|
1017 |
Â
*/
|
1018 |
Â
function bp_the_topic_object_slug() {
|
1019 |
Â
echo bp_get_the_topic_object_slug();
|
1024 |
Â
* Objects are things like groups. So this function would return the
|
1025 |
Â
* slug of the group associated with the forum topic, if it exists.
|
1026 |
Â
*
|
1027 |
+
* @since 1.1.0
|
1028 |
+
*
|
1029 |
Â
* @return string Object slug.
|
1030 |
Â
*/
|
1031 |
Â
function bp_get_the_topic_object_slug() {
|
1046 |
Â
|
1047 |
Â
/**
|
1048 |
Â
* Output the permalink of the object associated with the current topic in the loop.
|
1049 |
+
*
|
1050 |
+
* @since 1.1.0
|
1051 |
Â
*/
|
1052 |
Â
function bp_the_topic_object_permalink() {
|
1053 |
Â
echo bp_get_the_topic_object_permalink();
|
1058 |
Â
* Objects are things like groups. So this function would return the
|
1059 |
Â
* permalink of the group associated with the forum topic, if it exists.
|
1060 |
Â
*
|
1061 |
+
* @since 1.1.0
|
1062 |
+
*
|
1063 |
Â
* @return string Object permalink.
|
1064 |
Â
*/
|
1065 |
Â
function bp_get_the_topic_object_permalink() {
|
1086 |
Â
|
1087 |
Â
/**
|
1088 |
Â
* Output the linked name of the user who last posted to the current topic in the loop.
|
1089 |
+
*
|
1090 |
+
* @since 1.0.0
|
1091 |
Â
*/
|
1092 |
Â
function bp_the_topic_last_poster_name() {
|
1093 |
Â
echo bp_get_the_topic_last_poster_name();
|
1095 |
Â
/**
|
1096 |
Â
* Return the linked name of the user who last posted to the current topic in the loop.
|
1097 |
Â
*
|
1098 |
+
* @since 1.0.0
|
1099 |
+
*
|
1100 |
Â
* @return string HTML link to the profile of the user who last posted
|
1101 |
Â
* to the current topic.
|
1102 |
Â
*/
|
1124 |
Â
/**
|
1125 |
Â
* Output the permalink of the object associated with the current topic in the loop.
|
1126 |
Â
*
|
1127 |
+
* @since 1.1.0
|
1128 |
+
*
|
1129 |
Â
* @see bp_get_the_topic_object_avatar() for description of arguments.
|
1130 |
Â
*
|
1131 |
Â
* @param array|string $args See {@bp_get_the_topic_object_avatar()}.
|
1139 |
Â
* Objects are things like groups. So this function would return the
|
1140 |
Â
* avatar of the group associated with the forum topic, if it exists.
|
1141 |
Â
*
|
1142 |
+
* @since 1.1.0
|
1143 |
+
*
|
1144 |
Â
* @param array|string $args {
|
1145 |
Â
* Arguments for building the avatar.
|
1146 |
Â
* @type string $type Avatar type. 'thumb' or 'full'. Default:
|
1185 |
Â
/**
|
1186 |
Â
* Output the avatar for the user who last posted to the current topic in the loop.
|
1187 |
Â
*
|
1188 |
+
* @since 1.0.0
|
1189 |
+
*
|
1190 |
Â
* @see bp_get_the_topic_last_poster_avatar() for description of arguments.
|
1191 |
Â
*
|
1192 |
Â
* @param array|string $args See {@bp_get_the_topic_last_poster_avatar()}.
|
1197 |
Â
/**
|
1198 |
Â
* Return the avatar for the user who last posted to the current topic in the loop.
|
1199 |
Â
*
|
1200 |
+
* @since 1.0.0
|
1201 |
+
*
|
1202 |
Â
* @param array|string $args {
|
1203 |
Â
* Arguments for building the avatar.
|
1204 |
Â
* @type string $type Avatar type. 'thumb' or 'full'. Default:
|
1239 |
Â
|
1240 |
Â
/**
|
1241 |
Â
* Output the start time of the current topic in the loop.
|
1242 |
+
*
|
1243 |
+
* @since 1.0.0
|
1244 |
Â
*/
|
1245 |
Â
function bp_the_topic_start_time() {
|
1246 |
Â
echo bp_get_the_topic_start_time();
|
1248 |
Â
/**
|
1249 |
Â
* Return the start time of the current topic in the loop.
|
1250 |
Â
*
|
1251 |
+
* @since 1.0.0
|
1252 |
+
*
|
1253 |
Â
* @return string Start time of the current topic.
|
1254 |
Â
*/
|
1255 |
Â
function bp_get_the_topic_start_time() {
|
1267 |
Â
|
1268 |
Â
/**
|
1269 |
Â
* Output the topic time of the current topic in the loop.
|
1270 |
+
*
|
1271 |
+
* @since 1.0.0
|
1272 |
Â
*/
|
1273 |
Â
function bp_the_topic_time() {
|
1274 |
Â
echo bp_get_the_topic_time();
|
1276 |
Â
/**
|
1277 |
Â
* Return the topic time of the current topic in the loop.
|
1278 |
Â
*
|
1279 |
+
* @since 1.0.0
|
1280 |
+
*
|
1281 |
Â
* @return string Topic time of the current topic.
|
1282 |
Â
*/
|
1283 |
Â
function bp_get_the_topic_time() {
|
1295 |
Â
|
1296 |
Â
/**
|
1297 |
Â
* Output the ID of the forum associated with the current topic in the loop.
|
1298 |
+
*
|
1299 |
+
* @since 1.0.0
|
1300 |
Â
*/
|
1301 |
Â
function bp_the_topic_forum_id() {
|
1302 |
Â
echo bp_get_the_topic_forum_id();
|
1304 |
Â
/**
|
1305 |
Â
* Return the ID of the forum associated with the current topic in the loop.
|
1306 |
Â
*
|
1307 |
+
* @since 1.0.0
|
1308 |
+
*
|
1309 |
Â
* @return int ID of the forum associated with the current topic.
|
1310 |
Â
*/
|
1311 |
Â
function bp_get_the_topic_forum_id() {
|
1323 |
Â
|
1324 |
Â
/**
|
1325 |
Â
* Output the status of the current topic in the loop.
|
1326 |
+
*
|
1327 |
+
* @since 1.0.0
|
1328 |
Â
*/
|
1329 |
Â
function bp_the_topic_status() {
|
1330 |
Â
echo bp_get_the_topic_status();
|
1332 |
Â
/**
|
1333 |
Â
* Return the status of the current topic in the loop.
|
1334 |
Â
*
|
1335 |
+
* @since 1.0.0
|
1336 |
+
*
|
1337 |
Â
* @return string Status of the current topic.
|
1338 |
Â
*/
|
1339 |
Â
function bp_get_the_topic_status() {
|
1351 |
Â
|
1352 |
Â
/**
|
1353 |
Â
* Output whether the current topic in the loop is open.
|
1354 |
+
*
|
1355 |
+
* @since 1.0.0
|
1356 |
Â
*/
|
1357 |
Â
function bp_the_topic_is_topic_open() {
|
1358 |
Â
echo bp_get_the_topic_is_topic_open();
|
1360 |
Â
/**
|
1361 |
Â
* Return whether the current topic in the loop is open.
|
1362 |
Â
*
|
1363 |
+
* @since 1.0.0
|
1364 |
+
*
|
1365 |
Â
* @return string
|
1366 |
Â
*/
|
1367 |
Â
function bp_get_the_topic_is_topic_open() {
|
1379 |
Â
|
1380 |
Â
/**
|
1381 |
Â
* Output the ID of the last post in the current topic in the loop.
|
1382 |
+
*
|
1383 |
+
* @since 1.0.0
|
1384 |
Â
*/
|
1385 |
Â
function bp_the_topic_last_post_id() {
|
1386 |
Â
echo bp_get_the_topic_last_post_id();
|
1388 |
Â
/**
|
1389 |
Â
* Return the ID of the last post in the current topic in the loop.
|
1390 |
Â
*
|
1391 |
+
* @since 1.0.0
|
1392 |
+
*
|
1393 |
Â
* @return int ID of the last post in the current topic.
|
1394 |
Â
*/
|
1395 |
Â
function bp_get_the_topic_last_post_id() {
|
1407 |
Â
|
1408 |
Â
/**
|
1409 |
Â
* Output whether the current topic in the loop is sticky.
|
1410 |
+
*
|
1411 |
+
* @since 1.0.0
|
1412 |
Â
*/
|
1413 |
Â
function bp_the_topic_is_sticky() {
|
1414 |
Â
echo bp_get_the_topic_is_sticky();
|
1416 |
Â
/**
|
1417 |
Â
* Return whether the current topic in the loop is sticky.
|
1418 |
Â
*
|
1419 |
+
* @since 1.0.0
|
1420 |
+
*
|
1421 |
Â
* @return bool
|
1422 |
Â
*/
|
1423 |
Â
function bp_get_the_topic_is_sticky() {
|
1435 |
Â
|
1436 |
Â
/**
|
1437 |
Â
* Output a 'x posts' string with the number of posts in the current topic.
|
1438 |
+
*
|
1439 |
+
* @since 1.0.0
|
1440 |
Â
*/
|
1441 |
Â
function bp_the_topic_total_post_count() {
|
1442 |
Â
echo bp_get_the_topic_total_post_count();
|
1444 |
Â
/**
|
1445 |
Â
* Return a 'x posts' string with the number of posts in the current topic.
|
1446 |
Â
*
|
1447 |
+
* @since 1.0.0
|
1448 |
+
*
|
1449 |
Â
* @return string String of the form 'x posts'.
|
1450 |
Â
*/
|
1451 |
Â
function bp_get_the_topic_total_post_count() {
|
1470 |
Â
|
1471 |
Â
/**
|
1472 |
Â
* Output the total number of posts in the current topic in the loop.
|
1473 |
+
*
|
1474 |
+
* @since 1.1.0
|
1475 |
Â
*/
|
1476 |
Â
function bp_the_topic_total_posts() {
|
1477 |
Â
echo bp_get_the_topic_total_posts();
|
1479 |
Â
/**
|
1480 |
Â
* Return the total number of posts in the current topic in the loop.
|
1481 |
Â
*
|
1482 |
+
* @since 1.1.0
|
1483 |
+
*
|
1484 |
Â
* @return int Total number of posts in the current topic.
|
1485 |
Â
*/
|
1486 |
Â
function bp_get_the_topic_total_posts() {
|
1498 |
Â
|
1499 |
Â
/**
|
1500 |
Â
* Output the tag count for the current topic in the loop.
|
1501 |
+
*
|
1502 |
+
* @since 1.0.0
|
1503 |
Â
*/
|
1504 |
Â
function bp_the_topic_tag_count() {
|
1505 |
Â
echo bp_get_the_topic_tag_count();
|
1507 |
Â
/**
|
1508 |
Â
* Return the tag count for the current topic in the loop.
|
1509 |
Â
*
|
1510 |
+
* @since 1.0.0
|
1511 |
+
*
|
1512 |
Â
* @return int Tag count for the current topic.
|
1513 |
Â
*/
|
1514 |
Â
function bp_get_the_topic_tag_count() {
|
1526 |
Â
|
1527 |
Â
/**
|
1528 |
Â
* Output the permalink of the current topic in the loop.
|
1529 |
+
*
|
1530 |
+
* @since 1.0.0
|
1531 |
Â
*/
|
1532 |
Â
function bp_the_topic_permalink() {
|
1533 |
Â
echo bp_get_the_topic_permalink();
|
1535 |
Â
/**
|
1536 |
Â
* Return the permalink for the current topic in the loop.
|
1537 |
Â
*
|
1538 |
+
* @since 1.0.0
|
1539 |
+
*
|
1540 |
Â
* @return string Permalink for the current topic.
|
1541 |
Â
*/
|
1542 |
Â
function bp_get_the_topic_permalink() {
|
1571 |
Â
|
1572 |
Â
/**
|
1573 |
Â
* Output a 'since' string describing when the current topic was created.
|
1574 |
+
*
|
1575 |
+
* @since 1.0.0
|
1576 |
Â
*/
|
1577 |
Â
function bp_the_topic_time_since_created() {
|
1578 |
Â
echo bp_get_the_topic_time_since_created();
|
1580 |
Â
/**
|
1581 |
Â
* Return a 'since' string describing when the current topic was created.
|
1582 |
Â
*
|
1583 |
+
* @since 1.0.0
|
1584 |
+
*
|
1585 |
Â
* @see bp_core_time_since() for a description of return value.
|
1586 |
Â
*
|
1587 |
Â
* @return string
|
1602 |
Â
/**
|
1603 |
Â
* Output an excerpt from the latest post of the current topic in the loop.
|
1604 |
Â
*
|
1605 |
+
* @since 1.0.0
|
1606 |
+
*
|
1607 |
Â
* @param array|string $args See {@bp_get_the_topic_latest_post_excerpt()}.
|
1608 |
Â
*/
|
1609 |
Â
function bp_the_topic_latest_post_excerpt( $args = '' ) {
|
1612 |
Â
/**
|
1613 |
Â
* Return an excerpt from the latest post of the current topic in the loop.
|
1614 |
Â
*
|
1615 |
+
* @since 1.0.0
|
1616 |
+
*
|
1617 |
Â
* @param array|string $args {
|
1618 |
Â
* @type int $length The length of the excerpted text. Default: 225.
|
1619 |
Â
* }
|
1645 |
Â
|
1646 |
Â
/**
|
1647 |
Â
* Output a 'since' string describing when the last post in the current topic was created.
|
1648 |
+
*
|
1649 |
+
* @since 1.0.0
|
1650 |
Â
*/
|
1651 |
Â
function bp_the_topic_time_since_last_post() {
|
1652 |
Â
echo bp_get_the_topic_time_since_last_post();
|
1654 |
Â
/**
|
1655 |
Â
* Return a 'since' string describing when the last post in the current topic was created.
|
1656 |
Â
*
|
1657 |
+
* @since 1.0.0
|
1658 |
+
*
|
1659 |
Â
* @see bp_core_time_since() for a description of return value.
|
1660 |
Â
*
|
1661 |
Â
* @return string
|
1675 |
Â
|
1676 |
Â
/**
|
1677 |
Â
* Output whether the current topic in the loop belongs to the logged-in user.
|
1678 |
+
*
|
1679 |
+
* @since 1.1.0
|
1680 |
Â
*/
|
1681 |
Â
function bp_the_topic_is_mine() {
|
1682 |
Â
echo bp_get_the_topic_is_mine();
|
1684 |
Â
/**
|
1685 |
Â
* Does the current topic belong to the logged-in user?
|
1686 |
Â
*
|
1687 |
+
* @since 1.1.0
|
1688 |
+
*
|
1689 |
Â
* @return bool True if the current topic in the loop was created by
|
1690 |
Â
* the logged-in user, otherwise false.
|
1691 |
Â
*/
|
1698 |
Â
/**
|
1699 |
Â
* Output the admin links for the current topic in the loop.
|
1700 |
Â
*
|
1701 |
+
* @since 1.1.0
|
1702 |
+
*
|
1703 |
Â
* @see bp_get_the_topic_admin_links() for a description of arguments.
|
1704 |
Â
*
|
1705 |
Â
* @param array|string $args See {@link bp_get_the_topic_admin_links()}.
|
1710 |
Â
/**
|
1711 |
Â
* Return the admin links for the current topic in the loop.
|
1712 |
Â
*
|
1713 |
+
* @since 1.1.0
|
1714 |
+
*
|
1715 |
Â
* @param array|string $args {
|
1716 |
Â
* @type string $separator The character to use when separating links. Default: '|'.
|
1717 |
Â
* }
|
1748 |
Â
|
1749 |
Â
/**
|
1750 |
Â
* Output the CSS class for the current topic in the loop.
|
1751 |
+
*
|
1752 |
+
* @since 1.1.0
|
1753 |
Â
*/
|
1754 |
Â
function bp_the_topic_css_class() {
|
1755 |
Â
echo bp_get_the_topic_css_class();
|
1760 |
Â
* This class may contain keywords like 'alt', 'sticky', or 'closed',
|
1761 |
Â
* based on context.
|
1762 |
Â
*
|
1763 |
+
* @since 1.1.0
|
1764 |
+
*
|
1765 |
Â
* @return string Contents of the 'class' attribute.
|
1766 |
Â
*/
|
1767 |
Â
function bp_get_the_topic_css_class() {
|
1793 |
Â
|
1794 |
Â
/**
|
1795 |
Â
* Output the permalink to the 'personal' topics tab.
|
1796 |
+
*
|
1797 |
+
* @since 1.1.0
|
1798 |
Â
*/
|
1799 |
Â
function bp_my_forum_topics_link() {
|
1800 |
Â
echo bp_get_my_forum_topics_link();
|
1802 |
Â
/**
|
1803 |
Â
* Return the permalink to the 'personal' topics tab.
|
1804 |
Â
*
|
1805 |
+
* @since 1.1.0
|
1806 |
+
*
|
1807 |
Â
* @return string Link to the 'personal' topics tab.
|
1808 |
Â
*/
|
1809 |
Â
function bp_get_my_forum_topics_link() {
|
1819 |
Â
|
1820 |
Â
/**
|
1821 |
Â
* Output the permalink to the 'unreplied' topics tab.
|
1822 |
+
*
|
1823 |
+
* @since 1.1.0
|
1824 |
Â
*/
|
1825 |
Â
function bp_unreplied_forum_topics_link() {
|
1826 |
Â
echo bp_get_unreplied_forum_topics_link();
|
1828 |
Â
/**
|
1829 |
Â
* Return the permalink to the 'unreplied' topics tab.
|
1830 |
Â
*
|
1831 |
+
* @since 1.1.0
|
1832 |
+
*
|
1833 |
Â
* @return string Link to the 'unreplied' topics tab.
|
1834 |
Â
*/
|
1835 |
Â
function bp_get_unreplied_forum_topics_link() {
|
1845 |
Â
|
1846 |
Â
/**
|
1847 |
Â
* Output the permalink to the 'popular' topics tab.
|
1848 |
+
*
|
1849 |
+
* @since 1.1.0
|
1850 |
Â
*/
|
1851 |
Â
function bp_popular_forum_topics_link() {
|
1852 |
Â
echo bp_get_popular_forum_topics_link();
|
1854 |
Â
/**
|
1855 |
Â
* Return the permalink to the 'popular' topics tab.
|
1856 |
Â
*
|
1857 |
+
* @since 1.1.0
|
1858 |
+
*
|
1859 |
Â
* @return string Link to the 'popular' topics tab.
|
1860 |
Â
*/
|
1861 |
Â
function bp_get_popular_forum_topics_link() {
|
1871 |
Â
|
1872 |
Â
/**
|
1873 |
Â
* Output the link to the forums directory.
|
1874 |
+
*
|
1875 |
+
* @since 1.1.0
|
1876 |
Â
*/
|
1877 |
Â
function bp_newest_forum_topics_link() {
|
1878 |
Â
echo bp_get_newest_forum_topics_link();
|
1880 |
Â
/**
|
1881 |
Â
* Return the link to the forums directory.
|
1882 |
Â
*
|
1883 |
+
* @since 1.1.0
|
1884 |
+
*
|
1885 |
Â
* @return string Link to the forums directory.
|
1886 |
Â
*/
|
1887 |
Â
function bp_get_newest_forum_topics_link() {
|
1897 |
Â
|
1898 |
Â
/**
|
1899 |
Â
* Output the currently viewed topic list type.
|
1900 |
+
*
|
1901 |
+
* @since 1.1.0
|
1902 |
Â
*/
|
1903 |
Â
function bp_forum_topic_type() {
|
1904 |
Â
echo bp_get_forum_topic_type();
|
1908 |
Â
*
|
1909 |
Â
* Eg, 'newest', 'popular', etc.
|
1910 |
Â
*
|
1911 |
+
* @since 1.1.0
|
1912 |
+
*
|
1913 |
Â
* @return string Type of the currently viewed topic list.
|
1914 |
Â
*/
|
1915 |
Â
function bp_get_forum_topic_type() {
|
1942 |
Â
*
|
1943 |
Â
* @since 1.5.0
|
1944 |
Â
*
|
Â
|
|
1945 |
Â
* modify.
|
1946 |
Â
*
|
1947 |
Â
* @return string The URL for the New Reply link.
|
1973 |
Â
/**
|
1974 |
Â
* Output the currently viewed tag name.
|
1975 |
Â
*
|
1976 |
+
* @since 1.1.0
|
1977 |
+
*
|
1978 |
Â
* @todo Deprecate?
|
1979 |
Â
*/
|
1980 |
Â
function bp_forums_tag_name() {
|
1983 |
Â
/**
|
1984 |
Â
* Return the currently viewed tag name.
|
1985 |
Â
*
|
1986 |
+
* @since 1.1.0
|
1987 |
+
*
|
1988 |
Â
* @todo Deprecate? Seems unused
|
1989 |
+
*
|
1990 |
+
* @return bool|string
|
1991 |
Â
*/
|
1992 |
Â
function bp_get_forums_tag_name() {
|
1993 |
Â
$tag_name = bp_is_directory() && bp_is_forums_component() ? bp_action_variable( 0 ) : false;
|
1997 |
Â
|
1998 |
Â
/**
|
1999 |
Â
* Output the pagination links for the current topic list.
|
2000 |
+
*
|
2001 |
+
* @since 1.0.0
|
2002 |
Â
*/
|
2003 |
Â
function bp_forum_pagination() {
|
2004 |
Â
echo bp_get_forum_pagination();
|
2006 |
Â
/**
|
2007 |
Â
* Return the pagination links for the current topic list.
|
2008 |
Â
*
|
2009 |
+
* @since 1.0.0
|
2010 |
+
*
|
2011 |
Â
* @return string HTML pagination links.
|
2012 |
Â
*/
|
2013 |
Â
function bp_get_forum_pagination() {
|
2025 |
Â
|
2026 |
Â
/**
|
2027 |
Â
* Output the pagination count for the current topic list.
|
2028 |
+
*
|
2029 |
+
* @since 1.0.0
|
2030 |
Â
*/
|
2031 |
Â
function bp_forum_pagination_count() {
|
2032 |
Â
echo bp_get_forum_pagination_count();
|
2036 |
Â
*
|
2037 |
Â
* The "count" is a string of the form "Viewing x of y topics".
|
2038 |
Â
*
|
2039 |
+
* @since 1.5.0
|
2040 |
+
*
|
2041 |
Â
* @return string
|
2042 |
Â
*/
|
2043 |
Â
function bp_get_forum_pagination_count() {
|
2074 |
Â
/**
|
2075 |
Â
* Are we currently on an Edit Topic screen?
|
2076 |
Â
*
|
2077 |
+
* @since 1.1.0
|
2078 |
+
*
|
2079 |
Â
* @return bool True if currently editing a topic, otherwise false.
|
2080 |
Â
*/
|
2081 |
Â
function bp_is_edit_topic() {
|
2090 |
Â
* The single forum topic template loop class.
|
2091 |
Â
*
|
2092 |
Â
* Responsible for loading a topic's posts into a loop for display.
|
2093 |
+
*
|
2094 |
+
* @since 1.0.0
|
2095 |
Â
*/
|
2096 |
Â
class BP_Forums_Template_Topic {
|
2097 |
Â
/**
|
2098 |
Â
* The loop iterator.
|
2099 |
Â
*
|
2100 |
+
* @since 1.0.0
|
2101 |
Â
* @var int
|
2102 |
Â
*/
|
2103 |
Â
public $current_post = -1;
|
2105 |
Â
/**
|
2106 |
Â
* The number of posts returned by the paged query.
|
2107 |
Â
*
|
2108 |
+
* @since 1.0.0
|
2109 |
Â
* @var int
|
2110 |
Â
*/
|
2111 |
Â
public $post_count;
|
2113 |
Â
/**
|
2114 |
Â
* Array of posts located by the query.
|
2115 |
Â
*
|
2116 |
+
* @since 1.0.0
|
2117 |
Â
* @var array
|
2118 |
Â
*/
|
2119 |
Â
public $posts;
|
2121 |
Â
/**
|
2122 |
Â
* The post object currently being iterated on.
|
2123 |
Â
*
|
2124 |
+
* @since 1.0.0
|
2125 |
Â
* @var object
|
2126 |
Â
*/
|
2127 |
Â
public $post;
|
2129 |
Â
/**
|
2130 |
Â
* The ID of the forum whose topic is being queried.
|
2131 |
Â
*
|
2132 |
+
* @since 1.5.0
|
2133 |
Â
* @var int
|
2134 |
Â
*/
|
2135 |
Â
public $forum_id;
|
2137 |
Â
/**
|
2138 |
Â
* The ID of the topic whose posts are being queried.
|
2139 |
Â
*
|
2140 |
+
* @since 1.0.0
|
2141 |
Â
* @var int
|
2142 |
Â
*/
|
2143 |
Â
public $topic_id;
|
2145 |
Â
/**
|
2146 |
Â
* The topic object to which the posts belong.
|
2147 |
Â
*
|
2148 |
+
* @since 1.0.0
|
2149 |
Â
* @var object
|
2150 |
Â
*/
|
2151 |
Â
public $topic;
|
2153 |
Â
/**
|
2154 |
Â
* A flag for whether the loop is currently being iterated.
|
2155 |
Â
*
|
2156 |
+
* @since 1.0.0
|
2157 |
Â
* @var bool
|
2158 |
Â
*/
|
2159 |
Â
public $in_the_loop;
|
2170 |
Â
/**
|
2171 |
Â
* The page number being requested.
|
2172 |
Â
*
|
2173 |
+
* @since 1.0.0
|
2174 |
Â
* @var int
|
2175 |
Â
*/
|
2176 |
Â
public $pag_page;
|
2178 |
Â
/**
|
2179 |
Â
* The number of items being requested per page.
|
2180 |
Â
*
|
2181 |
+
* @since 1.0.0
|
2182 |
Â
* @var int
|
2183 |
Â
*/
|
2184 |
Â
public $pag_num;
|
2186 |
Â
/**
|
2187 |
Â
* An HTML string containing pagination links.
|
2188 |
Â
*
|
2189 |
+
* @since 1.0.0
|
2190 |
Â
* @var string
|
2191 |
Â
*/
|
2192 |
Â
public $pag_links;
|
2194 |
Â
/**
|
2195 |
Â
* The total number of posts matching the query parameters.
|
2196 |
Â
*
|
2197 |
+
* @since 1.0.0
|
2198 |
Â
* @var int
|
2199 |
Â
*/
|
2200 |
Â
public $total_post_count;
|
2202 |
Â
/**
|
2203 |
Â
* Whether requesting a single topic. Not currently used.
|
2204 |
Â
*
|
2205 |
+
* @since 1.0.0
|
2206 |
Â
* @var bool
|
2207 |
Â
*/
|
2208 |
Â
public $single_post = false;
|
2210 |
Â
/**
|
2211 |
Â
* Term to sort by.
|
2212 |
Â
*
|
2213 |
+
* @since 1.0.0
|
2214 |
Â
* @var string
|
2215 |
Â
*/
|
2216 |
Â
public $sort_by;
|
2218 |
Â
/**
|
2219 |
Â
* Sort order.
|
2220 |
Â
*
|
2221 |
+
* @since 1.0.0
|
2222 |
Â
* @var string
|
2223 |
Â
*/
|
2224 |
Â
public $order;
|
2226 |
Â
/**
|
2227 |
Â
* Constructor method.
|
2228 |
Â
*
|
2229 |
+
* @since 1.5.0
|
2230 |
+
*
|
2231 |
Â
* @param int $topic_id ID of the topic whose posts are being requested.
|
2232 |
Â
* @param int $per_page Number of items to return per page.
|
2233 |
Â
* @param int $max Max records to return.
|
2297 |
Â
/**
|
2298 |
Â
* Whether there are posts available in the loop.
|
2299 |
Â
*
|
2300 |
+
* @since 1.0.0
|
2301 |
+
*
|
2302 |
Â
* @see bp_has_forum_topic_posts()
|
2303 |
Â
*
|
2304 |
Â
* @return bool True if there are items in the loop, otherwise false.
|
2313 |
Â
/**
|
2314 |
Â
* Set up the next post and iterate index.
|
2315 |
Â
*
|
2316 |
+
* @since 1.0.0
|
2317 |
+
*
|
2318 |
Â
* @return object The next post to iterate over.
|
2319 |
Â
*/
|
2320 |
Â
function next_post() {
|
2326 |
Â
|
2327 |
Â
/**
|
2328 |
Â
* Rewind the posts and reset post index.
|
2329 |
+
*
|
2330 |
+
* @since 1.0.0
|
2331 |
Â
*/
|
2332 |
Â
function rewind_posts() {
|
2333 |
Â
$this->current_post = -1;
|
2343 |
Â
* the while loop that controls iteration inside the blogs loop, eg:
|
2344 |
Â
* while ( bp_forum_topic_posts() ) { ...
|
2345 |
Â
*
|
2346 |
+
* @since 1.0.0
|
2347 |
+
*
|
2348 |
Â
* @see bp_forum_topic_posts()
|
2349 |
Â
*
|
2350 |
Â
* @return bool True if there are more posts to show, otherwise false.
|
2371 |
Â
/**
|
2372 |
Â
* Set up the current topic in the loop.
|
2373 |
Â
*
|
2374 |
+
* @since 1.0.0
|
2375 |
+
*
|
2376 |
Â
* @see bp_the_forum_topic_post()
|
2377 |
Â
*/
|
2378 |
Â
function the_post() {
|
2396 |
Â
/**
|
2397 |
Â
* Initiate the loop for a single topic's posts.
|
2398 |
Â
*
|
2399 |
+
* @since 1.1.0
|
2400 |
+
*
|
2401 |
Â
* @param array|string $args {
|
2402 |
Â
* Arguments for limiting the contents of the topic posts loop.
|
2403 |
Â
* @type int $topic_id ID of the topic to which the posts belong.
|
2451 |
Â
/**
|
2452 |
Â
* Determine whether there are posts left in the loop.
|
2453 |
Â
*
|
2454 |
+
* @since 1.1.0
|
2455 |
+
*
|
2456 |
Â
* @return bool True when posts are found.
|
2457 |
Â
*/
|
2458 |
Â
function bp_forum_topic_posts() {
|
2463 |
Â
/**
|
2464 |
Â
* Set up the current post in the loop.
|
2465 |
Â
*
|
2466 |
+
* @since 1.1.0
|
2467 |
+
*
|
2468 |
Â
* @return object
|
2469 |
Â
*/
|
2470 |
Â
function bp_the_forum_topic_post() {
|
2474 |
Â
|
2475 |
Â
/**
|
2476 |
Â
* Output the ID of the current post in the loop.
|
2477 |
+
*
|
2478 |
+
* @since 1.0.0
|
2479 |
Â
*/
|
2480 |
Â
function bp_the_topic_post_id() {
|
2481 |
Â
echo bp_get_the_topic_post_id();
|
2483 |
Â
/**
|
2484 |
Â
* Return the ID of the current post in the loop.
|
2485 |
Â
*
|
2486 |
+
* @since 1.0.0
|
2487 |
+
*
|
2488 |
Â
* @return int ID of the current post in the loop.
|
2489 |
Â
*/
|
2490 |
Â
function bp_get_the_topic_post_id() {
|
2502 |
Â
|
2503 |
Â
/**
|
2504 |
Â
* Output the content of the current post in the loop.
|
2505 |
+
*
|
2506 |
+
* @since 1.0.0
|
2507 |
Â
*/
|
2508 |
Â
function bp_the_topic_post_content() {
|
2509 |
Â
echo bp_get_the_topic_post_content();
|
2511 |
Â
/**
|
2512 |
Â
* Return the content of the current post in the loop.
|
2513 |
Â
*
|
2514 |
+
* @since 1.0.0
|
2515 |
+
*
|
2516 |
Â
* @return string Content of the current post.
|
2517 |
Â
*/
|
2518 |
Â
function bp_get_the_topic_post_content() {
|
2530 |
Â
|
2531 |
Â
/**
|
2532 |
Â
* Output the CSS class of the current post in the loop.
|
2533 |
+
*
|
2534 |
+
* @since 1.2.4
|
2535 |
Â
*/
|
2536 |
Â
function bp_the_topic_post_css_class() {
|
2537 |
Â
echo bp_get_the_topic_post_css_class();
|
2542 |
Â
* May contain strings 'alt', 'deleted', or 'open', depending on
|
2543 |
Â
* context.
|
2544 |
Â
*
|
2545 |
+
* @since 1.2.4
|
2546 |
+
*
|
2547 |
Â
* @return string String to put in the 'class' attribute of the current
|
2548 |
Â
* post.
|
2549 |
Â
*/
|
2577 |
Â
/**
|
2578 |
Â
* Output the avatar of the user who posted the current post in the loop.
|
2579 |
Â
*
|
2580 |
+
* @since 1.0.0
|
2581 |
+
*
|
2582 |
Â
* @see bp_get_the_topic_post_poster_avatar() for a description of arguments.
|
2583 |
Â
*
|
2584 |
Â
* @param array|string $args See {@link bp_get_the_topic_post_poster_avatar()}.
|
2589 |
Â
/**
|
2590 |
Â
* Return the avatar of the user who posted the current post in the loop.
|
2591 |
Â
*
|
2592 |
+
* @since 1.0.0
|
2593 |
+
*
|
2594 |
Â
* @param array|string $args {
|
2595 |
Â
* Arguments for building the avatar.
|
2596 |
Â
* @type string $type Avatar type. 'thumb' or 'full'. Default:
|
2631 |
Â
|
2632 |
Â
/**
|
2633 |
Â
* Output the name of the user who posted the current post in the loop.
|
2634 |
+
*
|
2635 |
+
* @since 1.0.0
|
2636 |
Â
*/
|
2637 |
Â
function bp_the_topic_post_poster_name() {
|
2638 |
Â
echo bp_get_the_topic_post_poster_name();
|
2640 |
Â
/**
|
2641 |
Â
* Return the name of the user who posted the current post in the loop.
|
2642 |
Â
*
|
2643 |
+
* @since 1.0.0
|
2644 |
+
*
|
2645 |
Â
* @return string Name of the user who posted the current post.
|
2646 |
Â
*/
|
2647 |
Â
function bp_get_the_topic_post_poster_name() {
|
2662 |
Â
|
2663 |
Â
/**
|
2664 |
Â
* Output a link to the profile of the user who posted the current post.
|
2665 |
+
*
|
2666 |
+
* @since 1.2.0
|
2667 |
Â
*/
|
2668 |
Â
function bp_the_topic_post_poster_link() {
|
2669 |
Â
echo bp_get_the_topic_post_poster_link();
|
2671 |
Â
/**
|
2672 |
Â
* Return a link to the profile of the user who posted the current post.
|
2673 |
Â
*
|
2674 |
+
* @since 1.2.0
|
2675 |
+
*
|
2676 |
Â
* @return string Link to the profile of the user who posted the
|
2677 |
Â
* current post.
|
2678 |
Â
*/
|
2691 |
Â
|
2692 |
Â
/**
|
2693 |
Â
* Output a 'since' string describing when the current post in the loop was posted.
|
2694 |
+
*
|
2695 |
+
* @since 1.0.0
|
2696 |
Â
*/
|
2697 |
Â
function bp_the_topic_post_time_since() {
|
2698 |
Â
echo bp_get_the_topic_post_time_since();
|
2700 |
Â
/**
|
2701 |
Â
* Return a 'since' string describing when the current post in the loop was posted.
|
2702 |
Â
*
|
2703 |
+
* @since 1.0.0
|
2704 |
+
*
|
2705 |
Â
* @see bp_core_time_since() for a description of return value.
|
2706 |
Â
*
|
2707 |
Â
* @return string
|
2721 |
Â
|
2722 |
Â
/**
|
2723 |
Â
* Output whether the current post in the loop belongs to the logged-in user.
|
2724 |
+
*
|
2725 |
+
* @since 1.1.0
|
2726 |
Â
*/
|
2727 |
Â
function bp_the_topic_post_is_mine() {
|
2728 |
Â
echo bp_get_the_topic_post_is_mine();
|
2730 |
Â
/**
|
2731 |
Â
* Does the current post belong to the logged-in user?
|
2732 |
Â
*
|
2733 |
+
* @since 1.1.0
|
2734 |
+
*
|
2735 |
Â
* @return bool True if the current post in the loop was created by
|
2736 |
Â
* the logged-in user, otherwise false.
|
2737 |
Â
*/
|
2744 |
Â
/**
|
2745 |
Â
* Output the admin links for the current post in the loop.
|
2746 |
Â
*
|
2747 |
+
* @since 1.1.0
|
2748 |
+
*
|
2749 |
Â
* @see bp_get_the_post_admin_links() for a description of arguments.
|
2750 |
Â
*
|
2751 |
Â
* @param array|string $args See {@link bp_get_the_post_admin_links()}.
|
2756 |
Â
/**
|
2757 |
Â
* Return the admin links for the current post in the loop.
|
2758 |
Â
*
|
2759 |
+
* @since 1.1.0
|
2760 |
+
*
|
2761 |
Â
* @param array|string $args {
|
2762 |
Â
* @type string $separator The character to use when separating
|
2763 |
Â
* links. Default: '|'.
|
2798 |
Â
|
2799 |
Â
/**
|
2800 |
Â
* Output the text to edit when editing a post.
|
2801 |
+
*
|
2802 |
+
* @since 1.1.0
|
2803 |
Â
*/
|
2804 |
Â
function bp_the_topic_post_edit_text() {
|
2805 |
Â
echo bp_get_the_topic_post_edit_text();
|
2807 |
Â
/**
|
2808 |
Â
* Return the text to edit when editing a post.
|
2809 |
Â
*
|
2810 |
+
* @since 1.1.0
|
2811 |
+
*
|
2812 |
Â
* @return string Editable text.
|
2813 |
Â
*/
|
2814 |
Â
function bp_get_the_topic_post_edit_text() {
|
2826 |
Â
|
2827 |
Â
/**
|
2828 |
Â
* Output the pagination links for the current topic.
|
2829 |
+
*
|
2830 |
+
* @since 1.0.0
|
2831 |
Â
*/
|
2832 |
Â
function bp_the_topic_pagination() {
|
2833 |
Â
echo bp_get_the_topic_pagination();
|
2835 |
Â
/**
|
2836 |
Â
* Return the pagination links for the current topic page.
|
2837 |
Â
*
|
2838 |
+
* @since 1.0.0
|
2839 |
+
*
|
2840 |
Â
* @return string HTML pagination links.
|
2841 |
Â
*/
|
2842 |
Â
function bp_get_the_topic_pagination() {
|
2857 |
Â
* Return the pagination count for the current topic page.
|
2858 |
Â
*
|
2859 |
Â
* The "count" is a string of the form "Viewing x of y posts".
|
2860 |
+
*
|
2861 |
+
* @since 1.0.0
|
2862 |
Â
*/
|
2863 |
Â
function bp_the_topic_pagination_count() {
|
2864 |
Â
global $topic_template;
|
2889 |
Â
|
2890 |
Â
/**
|
2891 |
Â
* Output whether this is the last page in the current topic.
|
2892 |
+
*
|
2893 |
+
* @since 1.2.0
|
2894 |
Â
*/
|
2895 |
Â
function bp_the_topic_is_last_page() {
|
2896 |
Â
echo bp_get_the_topic_is_last_page();
|
2898 |
Â
/**
|
2899 |
Â
* Is this the last page in the current topic?
|
2900 |
Â
*
|
2901 |
+
* @since 1.2.0
|
2902 |
+
*
|
2903 |
Â
* @return bool True if this is the last page of posts for the current
|
2904 |
Â
* topic, otherwise false.
|
2905 |
Â
*/
|
2918 |
Â
|
2919 |
Â
/**
|
2920 |
Â
* Output the forums directory search form.
|
2921 |
+
*
|
2922 |
+
* @since 1.1.0
|
2923 |
Â
*/
|
2924 |
Â
function bp_directory_forums_search_form() {
|
2925 |
Â
$default_search_value = bp_get_search_default_text( 'forums' );
|
2943 |
Â
/**
|
2944 |
Â
* Output the link to a given forum.
|
2945 |
Â
*
|
2946 |
+
* @since 1.0.0
|
2947 |
+
*
|
2948 |
Â
* @see bp_get_forum_permalink() for a description of arguments.
|
2949 |
Â
*
|
2950 |
Â
* @param int $forum_id See {@link bp_get_forum_permalink()}.
|
2955 |
Â
/**
|
2956 |
Â
* Return the permalink to a given forum.
|
2957 |
Â
*
|
2958 |
+
* @since 1.0.0
|
2959 |
+
*
|
2960 |
Â
* @param int $forum_id Optional. Defaults to the current forum, if
|
2961 |
Â
* there is one.
|
2962 |
Â
* @return string|bool False on failure, a URL on success.
|
2991 |
Â
/**
|
2992 |
Â
* Output the name of a given forum.
|
2993 |
Â
*
|
2994 |
+
* @since 1.5.0
|
2995 |
+
*
|
2996 |
Â
* @see bp_get_forum_name() for a description of parameters.
|
2997 |
Â
*
|
2998 |
Â
* @param int $forum_id See {@link bp_get_forum_name()}.
|
3003 |
Â
/**
|
3004 |
Â
* Return the name of a given forum.
|
3005 |
Â
*
|
3006 |
+
* @since 1.5.0
|
3007 |
+
*
|
3008 |
Â
* @param int $forum_id Optional. Defaults to the current forum, if
|
3009 |
Â
* there is one.
|
3010 |
Â
* @return string|bool False on failure, a name on success.
|
3039 |
Â
* A wrapper for {@link bb_tag_heat_map}, which provides it with BP-friendly
|
3040 |
Â
* defaults.
|
3041 |
Â
*
|
3042 |
+
* @since 1.1.0
|
3043 |
+
*
|
3044 |
Â
* @param array|string $args {
|
3045 |
Â
* An array of optional arguments.
|
3046 |
Â
* @type int $smallest Size of the smallest link. Default: 10.
|
3134 |
Â
|
3135 |
Â
/**
|
3136 |
Â
* Output a URL to use in as a forum form 'action'.
|
3137 |
+
*
|
3138 |
+
* @since 1.0.0
|
3139 |
Â
*/
|
3140 |
Â
function bp_forum_action() {
|
3141 |
Â
echo bp_get_forum_action();
|
3143 |
Â
/**
|
3144 |
Â
* Get a URL to use in as a forum form 'action'.
|
3145 |
Â
*
|
3146 |
+
* @since 1.0.0
|
3147 |
+
*
|
3148 |
Â
* @return string URL of the current page, minus query args.
|
3149 |
Â
*/
|
3150 |
Â
function bp_get_forum_action() {
|
3162 |
Â
|
3163 |
Â
/**
|
3164 |
Â
* Output a URL to use in as a forum topic form 'action'.
|
3165 |
+
*
|
3166 |
+
* @since 1.0.0
|
3167 |
Â
*/
|
3168 |
Â
function bp_forum_topic_action() {
|
3169 |
Â
echo bp_get_forum_topic_action();
|
3171 |
Â
/**
|
3172 |
Â
* Get a URL to use in as a forum topic form 'action'.
|
3173 |
Â
*
|
3174 |
+
* @since 1.0.0
|
3175 |
+
*
|
3176 |
Â
* @return string URL of the current page, minus query args.
|
3177 |
Â
*/
|
3178 |
Â
function bp_get_forum_topic_action() {
|
3190 |
Â
/**
|
3191 |
Â
* Output the total topic count for a given user.
|
3192 |
Â
*
|
3193 |
+
* @since 1.2.0
|
3194 |
+
*
|
3195 |
Â
* @see bp_get_forum_topic_count_for_user() for description of parameters.
|
3196 |
Â
*
|
3197 |
Â
* @param int $user_id See {@link bp_get_forum_topic_count_for_user()}.
|
3202 |
Â
/**
|
3203 |
Â
* Return the total topic count for a given user.
|
3204 |
Â
*
|
3205 |
+
* @since 1.2.0
|
3206 |
+
*
|
3207 |
Â
* @param int $user_id See {@link bp_forums_total_topic_count_for_user}.
|
3208 |
Â
*
|
3209 |
Â
* @return int
|
3223 |
Â
/**
|
3224 |
Â
* Output the total topic count for a given user.
|
3225 |
Â
*
|
3226 |
+
* @since 1.2.0
|
3227 |
+
*
|
3228 |
Â
* @see bp_get_forum_topic_count() for description of parameters.
|
3229 |
Â
*
|
3230 |
Â
* @param int $user_id See {@link bp_get_forum_topic_count()}.
|
3235 |
Â
/**
|
3236 |
Â
* Return the total topic count for a given user.
|
3237 |
Â
*
|
3238 |
+
* @since 1.2.0
|
3239 |
+
*
|
3240 |
Â
* @param int $user_id See {@link bp_forums_total_topic_count()}.
|
3241 |
Â
*
|
3242 |
Â
* @return int
|
@@ -137,18 +137,22 @@ function bp_forums_bbpress_install_wizard() {
|
|
137 |
Â
case 'existing':
|
138 |
Â
if ( isset( $_REQUEST['doinstall'] ) && ( 1 == (int) $_REQUEST['doinstall'] ) ) {
|
139 |
Â
if ( !bp_forums_configure_existing_install() ) {
|
140 |
-
|
Â
|
|
141 |
Â
} else {
|
142 |
Â
?>
|
143 |
Â
<h3><?php _e( 'Forums were set up correctly using your existing bbPress install!', 'buddypress' ) ?></h3>
|
144 |
-
|
Â
|
|
145 |
Â
}
|
146 |
Â
} else { ?>
|
147 |
Â
|
148 |
Â
<form action="" method="post">
|
149 |
Â
<h3><?php _e( 'Existing bbPress Installation', 'buddypress' ) ?></h3>
|
150 |
-
|
151 |
-
<p
|
Â
|
|
Â
|
|
152 |
Â
<p><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Complete Installation', 'buddypress' ) ?>" /></p>
|
153 |
Â
<input type="hidden" name="step" value="existing" />
|
154 |
Â
<input type="hidden" name="doinstall" value="1" />
|
@@ -166,13 +170,15 @@ function bp_forums_bbpress_install_wizard() {
|
|
166 |
Â
switch ( $result ) {
|
167 |
Â
case 1:
|
168 |
Â
echo '<p>';
|
169 |
-
|
Â
|
|
170 |
Â
echo '</p>';
|
171 |
Â
break;
|
172 |
Â
default:
|
173 |
Â
// Just write the contents to screen.
|
174 |
Â
echo '<p>';
|
175 |
-
|
Â
|
|
176 |
Â
echo '</p>';
|
177 |
Â
?>
|
178 |
Â
<textarea style="display:block; margin-top: 30px; width: 80%;" rows="50"><?php echo esc_textarea( $result ); ?></textarea>
|
137 |
Â
case 'existing':
|
138 |
Â
if ( isset( $_REQUEST['doinstall'] ) && ( 1 == (int) $_REQUEST['doinstall'] ) ) {
|
139 |
Â
if ( !bp_forums_configure_existing_install() ) {
|
140 |
+
/* translators: %s: bb-config.php */
|
141 |
+
printf( __( 'The %s file was not found at that location. Please try again.', 'buddypress' ), '<code>bb-config.php</code>' );
|
142 |
Â
} else {
|
143 |
Â
?>
|
144 |
Â
<h3><?php _e( 'Forums were set up correctly using your existing bbPress install!', 'buddypress' ) ?></h3>
|
145 |
+
<?php /* translators: %s: bb-config.php */ ?>
|
146 |
+
<p><?php printf( __( 'BuddyPress will now use its internal copy of bbPress to run the forums on your site. If you wish, you can remove your old bbPress installation files, as long as you keep the %s file in the same location.', 'buddypress' ), '<code>bb-config.php</code>' ); ?></p><?php
|
147 |
Â
}
|
148 |
Â
} else { ?>
|
149 |
Â
|
150 |
Â
<form action="" method="post">
|
151 |
Â
<h3><?php _e( 'Existing bbPress Installation', 'buddypress' ) ?></h3>
|
152 |
+
<?php /* translators: %s: bb-config.php */ ?>
|
153 |
+
<p><?php printf( __( 'BuddyPress can make use of your existing bbPress install. Just provide the location of your %s file, and BuddyPress will do the rest.', 'buddypress' ), '<code>bb-config.php</code>' ); ?></p>
|
154 |
+
<?php /* translators: %s: bb-config.php */ ?>
|
155 |
+
<p><label><?php printf( __( '%s file location:', 'buddypress' ), '<code>bb-config.php</code>' ); ?></label><br /><input style="width: 50%" type="text" name="bbconfigloc" id="bbconfigloc" value="<?php echo esc_attr( str_replace( 'buddypress', '', $_SERVER['DOCUMENT_ROOT'] ) ) ?>" /></p>
|
156 |
Â
<p><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Complete Installation', 'buddypress' ) ?>" /></p>
|
157 |
Â
<input type="hidden" name="step" value="existing" />
|
158 |
Â
<input type="hidden" name="doinstall" value="1" />
|
170 |
Â
switch ( $result ) {
|
171 |
Â
case 1:
|
172 |
Â
echo '<p>';
|
173 |
+
/* translators: %s: bb-config.php */
|
174 |
+
printf( __( 'All done! Configuration settings have been saved to the %s file in the root of your WordPress install.', 'buddypress' ), '<code>bb-config.php</code>' );
|
175 |
Â
echo '</p>';
|
176 |
Â
break;
|
177 |
Â
default:
|
178 |
Â
// Just write the contents to screen.
|
179 |
Â
echo '<p>';
|
180 |
+
/* translators: %s: bb-config.php */
|
181 |
+
printf( __( 'A configuration file could not be created. No problem, but you will need to save the text shown below into a file named %s in the root directory of your WordPress installation before you can start using the forum functionality.', 'buddypress' ), '<code>bb-config.php</code>' );
|
182 |
Â
echo '</p>';
|
183 |
Â
?>
|
184 |
Â
<textarea style="display:block; margin-top: 30px; width: 80%;" rows="50"><?php echo esc_textarea( $result ); ?></textarea>
|
@@ -408,4 +408,4 @@ function bp_friends_delete_activity_on_user_delete( $user_id = 0 ) {
|
|
408 |
Â
'secondary_item_id' => $user_id
|
409 |
Â
) );
|
410 |
Â
}
|
411 |
-
add_action( 'friends_remove_data', 'bp_friends_delete_activity_on_user_delete' );
|
408 |
Â
'secondary_item_id' => $user_id
|
409 |
Â
) );
|
410 |
Â
}
|
411 |
+
add_action( 'friends_remove_data', 'bp_friends_delete_activity_on_user_delete' );
|
@@ -12,7 +12,9 @@
|
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
-
|
Â
|
|
Â
|
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Set up the bp-forums component.
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
+
if ( ! buddypress()->do_autoload ) {
|
16 |
+
require dirname( __FILE__ ) . '/classes/class-bp-friends-component.php';
|
17 |
+
}
|
18 |
Â
|
19 |
Â
/**
|
20 |
Â
* Set up the bp-forums component.
|
@@ -59,9 +59,7 @@ add_action( 'friends_friendship_requested', 'friends_notification_new_request',
|
|
59 |
Â
* @param int $friend_id ID of the request recipient.
|
60 |
Â
*/
|
61 |
Â
function friends_notification_accepted_request( $friendship_id, $initiator_id, $friend_id ) {
|
62 |
-
|
63 |
-
|
64 |
-
if ( 'no' == bp_get_user_meta( $initiator_id, 'notification_friends_friendship_accepted', true ) ) {
|
65 |
Â
return;
|
66 |
Â
}
|
67 |
Â
|
59 |
Â
* @param int $friend_id ID of the request recipient.
|
60 |
Â
*/
|
61 |
Â
function friends_notification_accepted_request( $friendship_id, $initiator_id, $friend_id ) {
|
62 |
+
if ( 'no' == bp_get_user_meta( (int) $initiator_id, 'notification_friends_friendship_accepted', true ) ) {
|
Â
|
|
Â
|
|
63 |
Â
return;
|
64 |
Â
}
|
65 |
Â
|
@@ -122,14 +122,26 @@ function friends_screen_notification_settings() {
|
|
122 |
Â
<tr id="friends-notification-settings-request">
|
123 |
Â
<td></td>
|
124 |
Â
<td><?php _ex( 'A member sends you a friendship request', 'Friend settings on notification settings page', 'buddypress' ) ?></td>
|
125 |
-
<td class="yes"><input type="radio" name="notifications[notification_friends_friendship_request]" id="notification-friends-friendship-request-yes" value="yes" <?php checked( $send_requests, 'yes', true ) ?>/><label for="notification-friends-friendship-request-yes" class="bp-screen-reader-text"><?php
|
126 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
127 |
Â
</tr>
|
128 |
Â
<tr id="friends-notification-settings-accepted">
|
129 |
Â
<td></td>
|
130 |
Â
<td><?php _ex( 'A member accepts your friendship request', 'Friend settings on notification settings page', 'buddypress' ) ?></td>
|
131 |
-
<td class="yes"><input type="radio" name="notifications[notification_friends_friendship_accepted]" id="notification-friends-friendship-accepted-yes" value="yes" <?php checked( $accept_requests, 'yes', true ) ?>/><label for="notification-friends-friendship-accepted-yes" class="bp-screen-reader-text"><?php
|
132 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
133 |
Â
</tr>
|
134 |
Â
|
135 |
Â
<?php
|
122 |
Â
<tr id="friends-notification-settings-request">
|
123 |
Â
<td></td>
|
124 |
Â
<td><?php _ex( 'A member sends you a friendship request', 'Friend settings on notification settings page', 'buddypress' ) ?></td>
|
125 |
+
<td class="yes"><input type="radio" name="notifications[notification_friends_friendship_request]" id="notification-friends-friendship-request-yes" value="yes" <?php checked( $send_requests, 'yes', true ) ?>/><label for="notification-friends-friendship-request-yes" class="bp-screen-reader-text"><?php
|
126 |
+
/* translators: accessibility text */
|
127 |
+
_e( 'Yes, send email', 'buddypress' );
|
128 |
+
?></label></td>
|
129 |
+
<td class="no"><input type="radio" name="notifications[notification_friends_friendship_request]" id="notification-friends-friendship-request-no" value="no" <?php checked( $send_requests, 'no', true ) ?>/><label for="notification-friends-friendship-request-no" class="bp-screen-reader-text"><?php
|
130 |
+
/* translators: accessibility text */
|
131 |
+
_e( 'No, do not send email', 'buddypress' );
|
132 |
+
?></label></td>
|
133 |
Â
</tr>
|
134 |
Â
<tr id="friends-notification-settings-accepted">
|
135 |
Â
<td></td>
|
136 |
Â
<td><?php _ex( 'A member accepts your friendship request', 'Friend settings on notification settings page', 'buddypress' ) ?></td>
|
137 |
+
<td class="yes"><input type="radio" name="notifications[notification_friends_friendship_accepted]" id="notification-friends-friendship-accepted-yes" value="yes" <?php checked( $accept_requests, 'yes', true ) ?>/><label for="notification-friends-friendship-accepted-yes" class="bp-screen-reader-text"><?php
|
138 |
+
/* translators: accessibility text */
|
139 |
+
_e( 'Yes, send email', 'buddypress' );
|
140 |
+
?></label></td>
|
141 |
+
<td class="no"><input type="radio" name="notifications[notification_friends_friendship_accepted]" id="notification-friends-friendship-accepted-no" value="no" <?php checked( $accept_requests, 'no', true ) ?>/><label for="notification-friends-friendship-accepted-no" class="bp-screen-reader-text"><?php
|
142 |
+
/* translators: accessibility text */
|
143 |
+
_e( 'No, do not send email', 'buddypress' );
|
144 |
+
?></label></td>
|
145 |
Â
</tr>
|
146 |
Â
|
147 |
Â
<?php
|
@@ -15,7 +15,6 @@ defined( 'ABSPATH' ) || exit;
|
|
15 |
Â
*
|
16 |
Â
* @since 1.5.0
|
17 |
Â
*
|
18 |
-
* @uses bp_get_friends_slug()
|
19 |
Â
*/
|
20 |
Â
function bp_friends_slug() {
|
21 |
Â
echo bp_get_friends_slug();
|
@@ -44,7 +43,6 @@ function bp_friends_slug() {
|
|
44 |
Â
*
|
45 |
Â
* @since 1.5.0
|
46 |
Â
*
|
47 |
-
* @uses bp_get_friends_root_slug()
|
48 |
Â
*/
|
49 |
Â
function bp_friends_root_slug() {
|
50 |
Â
echo bp_get_friends_root_slug();
|
@@ -496,10 +494,12 @@ function bp_get_friendship_requests( $user_id = 0 ) {
|
|
496 |
Â
* Filters the total pending friendship requests for a user.
|
497 |
Â
*
|
498 |
Â
* @since 1.2.0
|
Â
|
|
499 |
Â
*
|
500 |
-
* @param array|int An array of user IDs if found, or a 0 if none are found.
|
Â
|
|
501 |
Â
*/
|
502 |
-
return apply_filters( 'bp_get_friendship_requests', $requests );
|
503 |
Â
}
|
504 |
Â
|
505 |
Â
/**
|
@@ -562,10 +562,12 @@ function bp_friend_accept_request_link() {
|
|
562 |
Â
* Filters the URL for accepting the current friendship request in the loop.
|
563 |
Â
*
|
564 |
Â
* @since 1.0.0
|
Â
|
|
565 |
Â
*
|
566 |
-
* @param string $value
|
Â
|
|
567 |
Â
*/
|
568 |
-
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' ) );
|
569 |
Â
}
|
570 |
Â
|
571 |
Â
/**
|
@@ -595,10 +597,12 @@ function bp_friend_reject_request_link() {
|
|
595 |
Â
* Filters the URL for rejecting the current friendship request in the loop.
|
596 |
Â
*
|
597 |
Â
* @since 1.0.0
|
Â
|
|
598 |
Â
*
|
599 |
-
* @param string $value
|
Â
|
|
600 |
Â
*/
|
601 |
-
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' ) );
|
602 |
Â
}
|
603 |
Â
|
604 |
Â
/**
|
@@ -625,10 +629,12 @@ function bp_total_friend_count( $user_id = 0 ) {
|
|
625 |
Â
* Filters the total friend count for a given user.
|
626 |
Â
*
|
627 |
Â
* @since 1.2.0
|
Â
|
|
628 |
Â
*
|
629 |
-
* @param int $value
|
Â
|
|
630 |
Â
*/
|
631 |
-
return apply_filters( 'bp_get_total_friend_count', friends_get_total_friend_count( $user_id ) );
|
632 |
Â
}
|
633 |
Â
add_filter( 'bp_get_total_friend_count', 'bp_core_number_format' );
|
634 |
Â
|
@@ -661,10 +667,12 @@ function bp_friend_total_requests_count( $user_id = 0 ) {
|
|
661 |
Â
* Filters the total friendship request count for a given user.
|
662 |
Â
*
|
663 |
Â
* @since 1.2.0
|
Â
|
|
664 |
Â
*
|
665 |
-
* @param int $value
|
Â
|
|
666 |
Â
*/
|
667 |
-
return apply_filters( 'bp_friend_get_total_requests_count', count( BP_Friends_Friendship::get_friend_user_ids( $user_id, true ) ) );
|
668 |
Â
}
|
669 |
Â
|
670 |
Â
/** Stats **********************************************************************/
|
@@ -674,8 +682,6 @@ function bp_friend_total_requests_count( $user_id = 0 ) {
|
|
674 |
Â
*
|
675 |
Â
* @since 2.0.0
|
676 |
Â
*
|
677 |
-
* @uses bp_friends_get_profile_stats() to get the stats.
|
678 |
-
*
|
679 |
Â
* @param array|string $args before|after|user_id.
|
680 |
Â
*/
|
681 |
Â
function bp_friends_profile_stats( $args = '' ) {
|
15 |
Â
*
|
16 |
Â
* @since 1.5.0
|
17 |
Â
*
|
Â
|
|
18 |
Â
*/
|
19 |
Â
function bp_friends_slug() {
|
20 |
Â
echo bp_get_friends_slug();
|
43 |
Â
*
|
44 |
Â
* @since 1.5.0
|
45 |
Â
*
|
Â
|
|
46 |
Â
*/
|
47 |
Â
function bp_friends_root_slug() {
|
48 |
Â
echo bp_get_friends_root_slug();
|
494 |
Â
* Filters the total pending friendship requests for a user.
|
495 |
Â
*
|
496 |
Â
* @since 1.2.0
|
497 |
+
* @since 2.6.0 Added the `$user_id` parameter.
|
498 |
Â
*
|
499 |
+
* @param array|int $requests An array of user IDs if found, or a 0 if none are found.
|
500 |
+
* @param int $user_id ID of the queried user.
|
501 |
Â
*/
|
502 |
+
return apply_filters( 'bp_get_friendship_requests', $requests, $user_id );
|
503 |
Â
}
|
504 |
Â
|
505 |
Â
/**
|
562 |
Â
* Filters the URL for accepting the current friendship request in the loop.
|
563 |
Â
*
|
564 |
Â
* @since 1.0.0
|
565 |
+
* @since 2.6.0 Added the `$friendship_id` parameter.
|
566 |
Â
*
|
567 |
+
* @param string $value Accept-friendship URL.
|
568 |
+
* @param int $friendship_id ID of the friendship.
|
569 |
Â
*/
|
570 |
+
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' ), $friendship_id );
|
571 |
Â
}
|
572 |
Â
|
573 |
Â
/**
|
597 |
Â
* Filters the URL for rejecting the current friendship request in the loop.
|
598 |
Â
*
|
599 |
Â
* @since 1.0.0
|
600 |
+
* @since 2.6.0 Added the `$friendship_id` parameter.
|
601 |
Â
*
|
602 |
+
* @param string $value Reject-friendship URL.
|
603 |
+
* @param int $friendship_id ID of the friendship.
|
604 |
Â
*/
|
605 |
+
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' ), $friendship_id );
|
606 |
Â
}
|
607 |
Â
|
608 |
Â
/**
|
629 |
Â
* Filters the total friend count for a given user.
|
630 |
Â
*
|
631 |
Â
* @since 1.2.0
|
632 |
+
* @since 2.6.0 Added the `$user_id` parameter.
|
633 |
Â
*
|
634 |
+
* @param int $value Total friend count.
|
635 |
+
* @param int $user_id ID of the queried user.
|
636 |
Â
*/
|
637 |
+
return apply_filters( 'bp_get_total_friend_count', friends_get_total_friend_count( $user_id ), $user_id );
|
638 |
Â
}
|
639 |
Â
add_filter( 'bp_get_total_friend_count', 'bp_core_number_format' );
|
640 |
Â
|
667 |
Â
* Filters the total friendship request count for a given user.
|
668 |
Â
*
|
669 |
Â
* @since 1.2.0
|
670 |
+
* @since 2.6.0 Added the `$user_id` parameter.
|
671 |
Â
*
|
672 |
+
* @param int $value Friendship request count.
|
673 |
+
* @param int $user_id ID of the queried user.
|
674 |
Â
*/
|
675 |
+
return apply_filters( 'bp_friend_get_total_requests_count', count( BP_Friends_Friendship::get_friend_user_ids( $user_id, true ) ), $user_id );
|
676 |
Â
}
|
677 |
Â
|
678 |
Â
/** Stats **********************************************************************/
|
682 |
Â
*
|
683 |
Â
* @since 2.0.0
|
684 |
Â
*
|
Â
|
|
Â
|
|
685 |
Â
* @param array|string $args before|after|user_id.
|
686 |
Â
*/
|
687 |
Â
function bp_friends_profile_stats( $args = '' ) {
|
@@ -10,7 +10,9 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Register the friends widget.
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-core-friends-widget.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Register the friends widget.
|
@@ -24,11 +24,25 @@ class BP_Core_Friends_Widget extends WP_Widget {
|
|
24 |
Â
*/
|
25 |
Â
function __construct() {
|
26 |
Â
$widget_ops = array(
|
27 |
-
'description'
|
28 |
-
'classname'
|
Â
|
|
29 |
Â
);
|
30 |
Â
parent::__construct( false, $name = _x( '(BuddyPress) Friends', 'widget name', 'buddypress' ), $widget_ops );
|
31 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
32 |
Â
}
|
33 |
Â
|
34 |
Â
/**
|
@@ -48,9 +62,6 @@ class BP_Core_Friends_Widget extends WP_Widget {
|
|
48 |
Â
return;
|
49 |
Â
}
|
50 |
Â
|
51 |
-
$min = bp_core_get_minified_asset_suffix();
|
52 |
-
wp_enqueue_script( 'bp_core_widget_friends-js', buddypress()->plugin_url . "bp-friends/js/widget-friends{$min}.js", array( 'jquery' ), bp_get_version() );
|
53 |
-
|
54 |
Â
$user_id = bp_displayed_user_id();
|
55 |
Â
$link = trailingslashit( bp_displayed_user_domain() . bp_get_friends_slug() );
|
56 |
Â
$instance['title'] = sprintf( __( "%s's Friends", 'buddypress' ), bp_get_displayed_user_fullname() );
|
24 |
Â
*/
|
25 |
Â
function __construct() {
|
26 |
Â
$widget_ops = array(
|
27 |
+
'description' => __( 'A dynamic list of recently active, popular, and newest Friends of the displayed member. Widget is only shown when viewing a member profile.', 'buddypress' ),
|
28 |
+
'classname' => 'widget_bp_core_friends_widget buddypress widget',
|
29 |
+
'customize_selective_refresh' => true,
|
30 |
Â
);
|
31 |
Â
parent::__construct( false, $name = _x( '(BuddyPress) Friends', 'widget name', 'buddypress' ), $widget_ops );
|
32 |
Â
|
33 |
+
if ( is_customize_preview() || is_active_widget( false, false, $this->id_base ) ) {
|
34 |
+
add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Enqueue scripts.
|
40 |
+
*
|
41 |
+
* @since 2.6.0
|
42 |
+
*/
|
43 |
+
public function enqueue_scripts() {
|
44 |
+
$min = bp_core_get_minified_asset_suffix();
|
45 |
+
wp_enqueue_script( 'bp_core_widget_friends-js', buddypress()->plugin_url . "bp-friends/js/widget-friends{$min}.js", array( 'jquery' ), bp_get_version() );
|
46 |
Â
}
|
47 |
Â
|
48 |
Â
/**
|
62 |
Â
return;
|
63 |
Â
}
|
64 |
Â
|
Â
|
|
Â
|
|
Â
|
|
65 |
Â
$user_id = bp_displayed_user_id();
|
66 |
Â
$link = trailingslashit( bp_displayed_user_domain() . bp_get_friends_slug() );
|
67 |
Â
$instance['title'] = sprintf( __( "%s's Friends", 'buddypress' ), bp_get_displayed_user_fullname() );
|
@@ -50,7 +50,6 @@ class BP_Friends_Component extends BP_Component {
|
|
50 |
Â
'actions',
|
51 |
Â
'screens',
|
52 |
Â
'filters',
|
53 |
-
'classes',
|
54 |
Â
'activity',
|
55 |
Â
'template',
|
56 |
Â
'functions',
|
@@ -58,6 +57,10 @@ class BP_Friends_Component extends BP_Component {
|
|
58 |
Â
'widgets',
|
59 |
Â
);
|
60 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
61 |
Â
parent::includes( $includes );
|
62 |
Â
}
|
63 |
Â
|
@@ -134,10 +137,21 @@ class BP_Friends_Component extends BP_Component {
|
|
134 |
Â
$friends_link = trailingslashit( $user_domain . $slug );
|
135 |
Â
|
136 |
Â
// Add 'Friends' to the main navigation.
|
137 |
-
$count
|
138 |
-
$class
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
139 |
Â
$main_nav = array(
|
140 |
-
'name' =>
|
141 |
Â
'slug' => $slug,
|
142 |
Â
'position' => 60,
|
143 |
Â
'screen_function' => 'friends_screen_my_friends',
|
@@ -190,8 +204,16 @@ class BP_Friends_Component extends BP_Component {
|
|
190 |
Â
// Pending friend requests.
|
191 |
Â
$count = count( friends_get_friendship_request_user_ids( bp_loggedin_user_id() ) );
|
192 |
Â
if ( !empty( $count ) ) {
|
193 |
-
$title
|
194 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
195 |
Â
} else {
|
196 |
Â
$title = _x( 'Friends', 'My Account Friends menu', 'buddypress' );
|
197 |
Â
$pending = _x( 'No Pending Requests','My Account Friends menu sub nav', 'buddypress' );
|
50 |
Â
'actions',
|
51 |
Â
'screens',
|
52 |
Â
'filters',
|
Â
|
|
53 |
Â
'activity',
|
54 |
Â
'template',
|
55 |
Â
'functions',
|
57 |
Â
'widgets',
|
58 |
Â
);
|
59 |
Â
|
60 |
+
if ( ! buddypress()->do_autoload ) {
|
61 |
+
$includes[] = 'classes';
|
62 |
+
}
|
63 |
+
|
64 |
Â
parent::includes( $includes );
|
65 |
Â
}
|
66 |
Â
|
137 |
Â
$friends_link = trailingslashit( $user_domain . $slug );
|
138 |
Â
|
139 |
Â
// Add 'Friends' to the main navigation.
|
140 |
+
$count = friends_get_total_friend_count();
|
141 |
+
$class = ( 0 === $count ) ? 'no-count' : 'count';
|
142 |
+
|
143 |
+
$main_nav_name = sprintf(
|
144 |
+
/* translators: %s: Friend count for the current user */
|
145 |
+
__( 'Friends %s', 'buddypress' ),
|
146 |
+
sprintf(
|
147 |
+
'<span class="%s">%s</span>',
|
148 |
+
esc_attr( $class ),
|
149 |
+
bp_core_number_format( $count )
|
150 |
+
)
|
151 |
+
);
|
152 |
+
|
153 |
Â
$main_nav = array(
|
154 |
+
'name' => $main_nav_name,
|
155 |
Â
'slug' => $slug,
|
156 |
Â
'position' => 60,
|
157 |
Â
'screen_function' => 'friends_screen_my_friends',
|
204 |
Â
// Pending friend requests.
|
205 |
Â
$count = count( friends_get_friendship_request_user_ids( bp_loggedin_user_id() ) );
|
206 |
Â
if ( !empty( $count ) ) {
|
207 |
+
$title = sprintf(
|
208 |
+
/* translators: %s: Pending friend request count for the current user */
|
209 |
+
_x( 'Friends %s', 'My Account Friends menu', 'buddypress' ),
|
210 |
+
'<span class="count">' . bp_core_number_format( $count ) . '</span>'
|
211 |
+
);
|
212 |
+
$pending = sprintf(
|
213 |
+
/* translators: %s: Pending friend request count for the current user */
|
214 |
+
_x( 'Pending Requests %s', 'My Account Friends menu sub nav', 'buddypress' ),
|
215 |
+
'<span class="count">' . bp_core_number_format( $count ) . '</span>'
|
216 |
+
);
|
217 |
Â
} else {
|
218 |
Â
$title = _x( 'Friends', 'My Account Friends menu', 'buddypress' );
|
219 |
Â
$pending = _x( 'No Pending Requests','My Account Friends menu sub nav', 'buddypress' );
|
@@ -106,7 +106,7 @@ class BP_Friends_Friendship {
|
|
106 |
Â
$this->is_request = $is_request;
|
107 |
Â
|
108 |
Â
if ( !empty( $id ) ) {
|
109 |
-
$this->id = $id;
|
110 |
Â
$this->populate_friend_details = $populate_friend_details;
|
111 |
Â
$this->populate( $this->id );
|
112 |
Â
}
|
@@ -123,10 +123,10 @@ class BP_Friends_Friendship {
|
|
123 |
Â
$bp = buddypress();
|
124 |
Â
|
125 |
Â
if ( $friendship = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) ) ) {
|
126 |
-
$this->initiator_user_id = $friendship->initiator_user_id;
|
127 |
-
$this->friend_user_id = $friendship->friend_user_id;
|
128 |
-
$this->is_confirmed = $friendship->is_confirmed;
|
129 |
-
$this->is_limited = $friendship->is_limited;
|
130 |
Â
$this->date_created = $friendship->date_created;
|
131 |
Â
}
|
132 |
Â
|
@@ -655,6 +655,7 @@ class BP_Friends_Friendship {
|
|
655 |
Â
* - users who have been banned from the group
|
656 |
Â
*
|
657 |
Â
* @since 1.0.0
|
Â
|
|
658 |
Â
*
|
659 |
Â
* @param int $user_id ID of the user whose friends are being counted.
|
660 |
Â
* @param int $group_id ID of the group friends are being invited to.
|
@@ -663,23 +664,26 @@ class BP_Friends_Friendship {
|
|
663 |
Â
public static function get_invitable_friend_count( $user_id, $group_id ) {
|
664 |
Â
|
665 |
Â
// Setup some data we'll use below.
|
666 |
-
$is_group_admin =
|
667 |
Â
$friend_ids = BP_Friends_Friendship::get_friend_user_ids( $user_id );
|
668 |
Â
$invitable_count = 0;
|
669 |
Â
|
670 |
Â
for ( $i = 0, $count = count( $friend_ids ); $i < $count; ++$i ) {
|
671 |
Â
|
672 |
Â
// If already a member, they cannot be invited again.
|
673 |
-
if (
|
674 |
Â
continue;
|
Â
|
|
675 |
Â
|
676 |
Â
// If user already has invite, they cannot be added.
|
677 |
-
if (
|
678 |
Â
continue;
|
Â
|
|
679 |
Â
|
680 |
Â
// If user is not group admin and friend is banned, they cannot be invited.
|
681 |
-
if ( ( false === $is_group_admin ) &&
|
682 |
Â
continue;
|
Â
|
|
683 |
Â
|
684 |
Â
$invitable_count++;
|
685 |
Â
}
|
106 |
Â
$this->is_request = $is_request;
|
107 |
Â
|
108 |
Â
if ( !empty( $id ) ) {
|
109 |
+
$this->id = (int) $id;
|
110 |
Â
$this->populate_friend_details = $populate_friend_details;
|
111 |
Â
$this->populate( $this->id );
|
112 |
Â
}
|
123 |
Â
$bp = buddypress();
|
124 |
Â
|
125 |
Â
if ( $friendship = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->friends->table_name} WHERE id = %d", $this->id ) ) ) {
|
126 |
+
$this->initiator_user_id = (int) $friendship->initiator_user_id;
|
127 |
+
$this->friend_user_id = (int) $friendship->friend_user_id;
|
128 |
+
$this->is_confirmed = (int) $friendship->is_confirmed;
|
129 |
+
$this->is_limited = (int) $friendship->is_limited;
|
130 |
Â
$this->date_created = $friendship->date_created;
|
131 |
Â
}
|
132 |
Â
|
655 |
Â
* - users who have been banned from the group
|
656 |
Â
*
|
657 |
Â
* @since 1.0.0
|
658 |
+
* @todo Need to do a group component check before using group functions.
|
659 |
Â
*
|
660 |
Â
* @param int $user_id ID of the user whose friends are being counted.
|
661 |
Â
* @param int $group_id ID of the group friends are being invited to.
|
664 |
Â
public static function get_invitable_friend_count( $user_id, $group_id ) {
|
665 |
Â
|
666 |
Â
// Setup some data we'll use below.
|
667 |
+
$is_group_admin = groups_is_user_admin( $user_id, $group_id );
|
668 |
Â
$friend_ids = BP_Friends_Friendship::get_friend_user_ids( $user_id );
|
669 |
Â
$invitable_count = 0;
|
670 |
Â
|
671 |
Â
for ( $i = 0, $count = count( $friend_ids ); $i < $count; ++$i ) {
|
672 |
Â
|
673 |
Â
// If already a member, they cannot be invited again.
|
674 |
+
if ( groups_is_user_member( (int) $friend_ids[$i], $group_id ) ) {
|
675 |
Â
continue;
|
676 |
+
}
|
677 |
Â
|
678 |
Â
// If user already has invite, they cannot be added.
|
679 |
+
if ( groups_check_user_has_invite( (int) $friend_ids[$i], $group_id ) ) {
|
680 |
Â
continue;
|
681 |
+
}
|
682 |
Â
|
683 |
Â
// If user is not group admin and friend is banned, they cannot be invited.
|
684 |
+
if ( ( false === $is_group_admin ) && groups_is_user_banned( (int) $friend_ids[$i], $group_id ) ) {
|
685 |
Â
continue;
|
686 |
+
}
|
687 |
Â
|
688 |
Â
$invitable_count++;
|
689 |
Â
}
|
@@ -1,4 +1,15 @@
|
|
1 |
Â
jQuery(document).ready( function() {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2 |
Â
jQuery('.widget div#friends-list-options a').on('click',
|
3 |
Â
function() {
|
4 |
Â
var link = this;
|
@@ -23,7 +34,7 @@ jQuery(document).ready( function() {
|
|
23 |
Â
return false;
|
24 |
Â
}
|
25 |
Â
);
|
26 |
-
}
|
27 |
Â
|
28 |
Â
function friend_widget_response(response) {
|
29 |
Â
response = response.substr(0, response.length-1);
|
1 |
Â
jQuery(document).ready( function() {
|
2 |
+
friend_widget_click_handler();
|
3 |
+
|
4 |
+
// WP 4.5 - Customizer selective refresh support.
|
5 |
+
if ( 'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh ) {
|
6 |
+
wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() {
|
7 |
+
friend_widget_click_handler();
|
8 |
+
} );
|
9 |
+
}
|
10 |
+
});
|
11 |
+
|
12 |
+
function friend_widget_click_handler() {
|
13 |
Â
jQuery('.widget div#friends-list-options a').on('click',
|
14 |
Â
function() {
|
15 |
Â
var link = this;
|
34 |
Â
return false;
|
35 |
Â
}
|
36 |
Â
);
|
37 |
+
}
|
38 |
Â
|
39 |
Â
function friend_widget_response(response) {
|
40 |
Â
response = response.substr(0, response.length-1);
|
@@ -1,2 +1 @@
|
|
1 |
-
|
2 |
-
function friend_widget_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_widget_response(b)}),!1})});
|
1 |
+
function friend_widget_click_handler(){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_widget_response(b)}),!1})}function friend_widget_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(){friend_widget_click_handler(),"undefined"!=typeof wp&&wp.customize&&wp.customize.selectiveRefresh&&wp.customize.selectiveRefresh.bind("partial-content-rendered",function(){friend_widget_click_handler()})});
|
Â
|
@@ -1,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM 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);
|
Â
|
|
1 |
Â
!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);
|
@@ -14,6 +14,21 @@
|
|
14 |
Â
// Exit if accessed directly.
|
15 |
Â
defined( 'ABSPATH' ) || exit;
|
16 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
17 |
Â
/**
|
18 |
Â
* Protect access to single groups.
|
19 |
Â
*
|
@@ -122,8 +137,8 @@ function groups_action_create_group() {
|
|
122 |
Â
unset( $bp->groups->current_create_step );
|
123 |
Â
unset( $bp->groups->completed_create_steps );
|
124 |
Â
|
125 |
-
setcookie( 'bp_new_group_id', false, time() - 1000, COOKIEPATH );
|
126 |
-
setcookie( 'bp_completed_create_steps', false, time() - 1000, COOKIEPATH );
|
127 |
Â
|
128 |
Â
$reset_steps = true;
|
129 |
Â
$keys = array_keys( $bp->groups->group_creation_steps );
|
@@ -252,8 +267,8 @@ function groups_action_create_group() {
|
|
252 |
Â
$bp->groups->completed_create_steps[] = bp_get_groups_current_create_step();
|
253 |
Â
|
254 |
Â
// Reset cookie info.
|
255 |
-
setcookie( 'bp_new_group_id', $bp->groups->new_group_id, time()+60*60*24, COOKIEPATH );
|
256 |
-
setcookie( 'bp_completed_create_steps', base64_encode( json_encode( $bp->groups->completed_create_steps ) ), time()+60*60*24, COOKIEPATH );
|
257 |
Â
|
258 |
Â
// If we have completed all steps and hit done on the final step we
|
259 |
Â
// can redirect to the completed group.
|
@@ -262,8 +277,8 @@ function groups_action_create_group() {
|
|
262 |
Â
unset( $bp->groups->current_create_step );
|
263 |
Â
unset( $bp->groups->completed_create_steps );
|
264 |
Â
|
265 |
-
setcookie( 'bp_new_group_id', false, time() - 3600, COOKIEPATH );
|
266 |
-
setcookie( 'bp_completed_create_steps', false, time() - 3600, COOKIEPATH );
|
267 |
Â
|
268 |
Â
// Once we completed all steps, record the group creation in the activity stream.
|
269 |
Â
groups_record_activity( array(
|
14 |
Â
// Exit if accessed directly.
|
15 |
Â
defined( 'ABSPATH' ) || exit;
|
16 |
Â
|
17 |
+
/**
|
18 |
+
* Fire the 'bp_groups_register_group_types' action.
|
19 |
+
*
|
20 |
+
* @since 2.6.0
|
21 |
+
*/
|
22 |
+
function bp_groups_register_group_types() {
|
23 |
+
/**
|
24 |
+
* Fires when it's appropriate to register group types.
|
25 |
+
*
|
26 |
+
* @since 2.6.0
|
27 |
+
*/
|
28 |
+
do_action( 'bp_groups_register_group_types' );
|
29 |
+
}
|
30 |
+
add_action( 'bp_loaded', 'bp_groups_register_group_types', 8 );
|
31 |
+
|
32 |
Â
/**
|
33 |
Â
* Protect access to single groups.
|
34 |
Â
*
|
137 |
Â
unset( $bp->groups->current_create_step );
|
138 |
Â
unset( $bp->groups->completed_create_steps );
|
139 |
Â
|
140 |
+
setcookie( 'bp_new_group_id', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
141 |
+
setcookie( 'bp_completed_create_steps', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
142 |
Â
|
143 |
Â
$reset_steps = true;
|
144 |
Â
$keys = array_keys( $bp->groups->group_creation_steps );
|
267 |
Â
$bp->groups->completed_create_steps[] = bp_get_groups_current_create_step();
|
268 |
Â
|
269 |
Â
// Reset cookie info.
|
270 |
+
setcookie( 'bp_new_group_id', $bp->groups->new_group_id, time()+60*60*24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
271 |
+
setcookie( 'bp_completed_create_steps', base64_encode( json_encode( $bp->groups->completed_create_steps ) ), time()+60*60*24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
272 |
Â
|
273 |
Â
// If we have completed all steps and hit done on the final step we
|
274 |
Â
// can redirect to the completed group.
|
277 |
Â
unset( $bp->groups->current_create_step );
|
278 |
Â
unset( $bp->groups->completed_create_steps );
|
279 |
Â
|
280 |
+
setcookie( 'bp_new_group_id', false, time() - 3600, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
281 |
+
setcookie( 'bp_completed_create_steps', false, time() - 3600, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
282 |
Â
|
283 |
Â
// Once we completed all steps, record the group creation in the activity stream.
|
284 |
Â
groups_record_activity( array(
|
@@ -379,7 +379,8 @@ function groups_record_activity( $args = '' ) {
|
|
379 |
Â
'item_id' => false,
|
380 |
Â
'secondary_item_id' => false,
|
381 |
Â
'recorded_time' => bp_core_current_time(),
|
382 |
-
'hide_sitewide' => $hide_sitewide
|
Â
|
|
383 |
Â
) );
|
384 |
Â
|
385 |
Â
return bp_activity_add( $r );
|
379 |
Â
'item_id' => false,
|
380 |
Â
'secondary_item_id' => false,
|
381 |
Â
'recorded_time' => bp_core_current_time(),
|
382 |
+
'hide_sitewide' => $hide_sitewide,
|
383 |
+
'error_type' => 'bool'
|
384 |
Â
) );
|
385 |
Â
|
386 |
Â
return bp_activity_add( $r );
|
@@ -16,7 +16,9 @@ defined( 'ABSPATH' ) || exit;
|
|
16 |
Â
// Include WP's list table class.
|
17 |
Â
if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
18 |
Â
|
19 |
-
|
Â
|
|
Â
|
|
20 |
Â
|
21 |
Â
// The per_page screen option. Has to be hooked in extremely early.
|
22 |
Â
if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-groups' == $_REQUEST['page'] )
|
@@ -132,6 +134,19 @@ function bp_groups_admin_load() {
|
|
132 |
Â
add_meta_box( 'bp_group_add_members', _x( 'Add New Members', 'group admin edit screen', 'buddypress' ), 'bp_groups_admin_edit_metabox_add_new_members', get_current_screen()->id, 'normal', 'core' );
|
133 |
Â
add_meta_box( 'bp_group_members', _x( 'Manage Members', 'group admin edit screen', 'buddypress' ), 'bp_groups_admin_edit_metabox_members', get_current_screen()->id, 'normal', 'core' );
|
134 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
135 |
Â
/**
|
136 |
Â
* Fires after the registration of all of the default group meta boxes.
|
137 |
Â
*
|
@@ -177,6 +192,7 @@ function bp_groups_admin_load() {
|
|
177 |
Â
// Add accessible hidden heading and text for Groups screen pagination.
|
178 |
Â
if ( bp_get_major_wp_version() >= 4.4 ) {
|
179 |
Â
get_current_screen()->set_screen_reader_content( array(
|
Â
|
|
180 |
Â
'heading_pagination' => __( 'Groups list navigation', 'buddypress' ),
|
181 |
Â
) );
|
182 |
Â
}
|
@@ -552,8 +568,7 @@ function bp_groups_admin_edit() {
|
|
552 |
Â
// Get the group from the database.
|
553 |
Â
$group = groups_get_group( 'group_id=' . (int) $_GET['gid'] );
|
554 |
Â
|
555 |
-
|
556 |
-
$group_name = isset( $group->name ) ? apply_filters( 'bp_get_group_name', $group->name ) : '';
|
557 |
Â
|
558 |
Â
// Construct URL for form.
|
559 |
Â
$form_url = remove_query_arg( array( 'action', 'deleted', 'no_admins', 'error', 'error_new', 'success_new', 'error_modified', 'success_modified' ), $_SERVER['REQUEST_URI'] );
|
@@ -584,7 +599,7 @@ function bp_groups_admin_edit() {
|
|
584 |
Â
<div id="moderated" class="<?php echo ( $is_error ) ? 'error' : 'updated'; ?>"><p><?php echo implode( "</p><p>", $messages ); ?></p></div>
|
585 |
Â
<?php endif; ?>
|
586 |
Â
|
587 |
-
<?php if (
|
588 |
Â
|
589 |
Â
<form action="<?php echo esc_url( $form_url ); ?>" id="bp-groups-edit-form" method="post">
|
590 |
Â
<div id="poststuff">
|
@@ -595,13 +610,19 @@ function bp_groups_admin_edit() {
|
|
595 |
Â
<div id="bp_groups_name" class="postbox">
|
596 |
Â
<h2><?php _e( 'Name and Description', 'buddypress' ); ?></h2>
|
597 |
Â
<div class="inside">
|
598 |
-
<label for="bp-groups-name" class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
599 |
Â
<input type="text" name="bp-groups-name" id="bp-groups-name" value="<?php echo esc_attr( stripslashes( $group_name ) ) ?>" />
|
600 |
Â
<div id="bp-groups-permalink-box">
|
601 |
Â
<strong><?php esc_html_e( 'Permalink:', 'buddypress' ) ?></strong> <span id="sample-permalink"><?php bp_group_permalink( $group ) ?></span> <a href="<?php echo bp_group_permalink( $group ) ?>" class="button button-small" id="bp-groups-visit-group"><?php esc_html_e( 'Visit Group', 'buddypress' ) ?></a>
|
602 |
Â
</div>
|
603 |
Â
|
604 |
-
<label for="bp-groups-description" class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
605 |
Â
<?php wp_editor( stripslashes( $group->description ), 'bp-groups-description', array( 'media_buttons' => false, 'teeny' => true, 'textarea_rows' => 5, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
|
606 |
Â
</div>
|
607 |
Â
</div>
|
@@ -625,7 +646,16 @@ function bp_groups_admin_edit() {
|
|
625 |
Â
</form>
|
626 |
Â
|
627 |
Â
<?php else : ?>
|
628 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
629 |
Â
<?php endif; ?>
|
630 |
Â
|
631 |
Â
</div><!-- .wrap -->
|
@@ -672,7 +702,7 @@ function bp_groups_admin_delete() {
|
|
672 |
Â
|
673 |
Â
<ul class="bp-group-delete-list">
|
674 |
Â
<?php foreach ( $groups['groups'] as $group ) : ?>
|
675 |
-
<li><?php echo
|
676 |
Â
<?php endforeach; ?>
|
677 |
Â
</ul>
|
678 |
Â
|
@@ -809,7 +839,10 @@ function bp_groups_admin_edit_metabox_settings( $item ) {
|
|
809 |
Â
function bp_groups_admin_edit_metabox_add_new_members( $item ) {
|
810 |
Â
?>
|
811 |
Â
|
812 |
-
<label for="bp-groups-new-members" class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
813 |
Â
<input name="bp-groups-new-members" id="bp-groups-new-members" class="bp-suggest-user" placeholder="<?php esc_attr_e( 'Enter a comma-separated list of user logins.', 'buddypress' ) ?>" />
|
814 |
Â
<ul id="bp-groups-new-members-list"></ul>
|
815 |
Â
<?php
|
@@ -903,7 +936,10 @@ function bp_groups_admin_edit_metabox_members( $item ) {
|
|
903 |
Â
</td>
|
904 |
Â
|
905 |
Â
<td class="urole-column">
|
906 |
-
<label for="bp-groups-role-<?php echo esc_attr( $type_user->ID ); ?>" class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
907 |
Â
<select class="bp-groups-role" id="bp-groups-role-<?php echo esc_attr( $type_user->ID ); ?>" name="bp-groups-role[<?php echo esc_attr( $type_user->ID ); ?>]">
|
908 |
Â
<optgroup label="<?php esc_attr_e( 'Roles', 'buddypress' ); ?>">
|
909 |
Â
<option class="admin" value="admin" <?php selected( 'admin', $member_type ); ?>><?php esc_html_e( 'Administrator', 'buddypress' ); ?></option>
|
@@ -1000,6 +1036,73 @@ function bp_groups_admin_edit_metabox_status( $item ) {
|
|
1000 |
Â
<?php
|
1001 |
Â
}
|
1002 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1003 |
Â
/**
|
1004 |
Â
* Create pagination links out of a BP_Group_Member_Query.
|
1005 |
Â
*
|
16 |
Â
// Include WP's list table class.
|
17 |
Â
if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
18 |
Â
|
19 |
+
if ( ! buddypress()->do_autoload ) {
|
20 |
+
require dirname( __FILE__ ) . '/classes/class-bp-groups-list-table.php';
|
21 |
+
}
|
22 |
Â
|
23 |
Â
// The per_page screen option. Has to be hooked in extremely early.
|
24 |
Â
if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-groups' == $_REQUEST['page'] )
|
134 |
Â
add_meta_box( 'bp_group_add_members', _x( 'Add New Members', 'group admin edit screen', 'buddypress' ), 'bp_groups_admin_edit_metabox_add_new_members', get_current_screen()->id, 'normal', 'core' );
|
135 |
Â
add_meta_box( 'bp_group_members', _x( 'Manage Members', 'group admin edit screen', 'buddypress' ), 'bp_groups_admin_edit_metabox_members', get_current_screen()->id, 'normal', 'core' );
|
136 |
Â
|
137 |
+
// Group Type metabox. Only added if group types have been registered.
|
138 |
+
$group_types = bp_groups_get_group_types();
|
139 |
+
if ( ! empty( $group_types ) ) {
|
140 |
+
add_meta_box(
|
141 |
+
'bp_groups_admin_group_type',
|
142 |
+
_x( 'Group Type', 'groups admin edit screen', 'buddypress' ),
|
143 |
+
'bp_groups_admin_edit_metabox_group_type',
|
144 |
+
get_current_screen()->id,
|
145 |
+
'side',
|
146 |
+
'core'
|
147 |
+
);
|
148 |
+
}
|
149 |
+
|
150 |
Â
/**
|
151 |
Â
* Fires after the registration of all of the default group meta boxes.
|
152 |
Â
*
|
192 |
Â
// Add accessible hidden heading and text for Groups screen pagination.
|
193 |
Â
if ( bp_get_major_wp_version() >= 4.4 ) {
|
194 |
Â
get_current_screen()->set_screen_reader_content( array(
|
195 |
+
/* translators: accessibility text */
|
196 |
Â
'heading_pagination' => __( 'Groups list navigation', 'buddypress' ),
|
197 |
Â
) );
|
198 |
Â
}
|
568 |
Â
// Get the group from the database.
|
569 |
Â
$group = groups_get_group( 'group_id=' . (int) $_GET['gid'] );
|
570 |
Â
|
571 |
+
$group_name = isset( $group->name ) ? bp_get_group_name( $group ) : '';
|
Â
|
|
572 |
Â
|
573 |
Â
// Construct URL for form.
|
574 |
Â
$form_url = remove_query_arg( array( 'action', 'deleted', 'no_admins', 'error', 'error_new', 'success_new', 'error_modified', 'success_modified' ), $_SERVER['REQUEST_URI'] );
|
599 |
Â
<div id="moderated" class="<?php echo ( $is_error ) ? 'error' : 'updated'; ?>"><p><?php echo implode( "</p><p>", $messages ); ?></p></div>
|
600 |
Â
<?php endif; ?>
|
601 |
Â
|
602 |
+
<?php if ( $group->id ) : ?>
|
603 |
Â
|
604 |
Â
<form action="<?php echo esc_url( $form_url ); ?>" id="bp-groups-edit-form" method="post">
|
605 |
Â
<div id="poststuff">
|
610 |
Â
<div id="bp_groups_name" class="postbox">
|
611 |
Â
<h2><?php _e( 'Name and Description', 'buddypress' ); ?></h2>
|
612 |
Â
<div class="inside">
|
613 |
+
<label for="bp-groups-name" class="screen-reader-text"><?php
|
614 |
+
/* translators: accessibility text */
|
615 |
+
_e( 'Group Name', 'buddypress' );
|
616 |
+
?></label>
|
617 |
Â
<input type="text" name="bp-groups-name" id="bp-groups-name" value="<?php echo esc_attr( stripslashes( $group_name ) ) ?>" />
|
618 |
Â
<div id="bp-groups-permalink-box">
|
619 |
Â
<strong><?php esc_html_e( 'Permalink:', 'buddypress' ) ?></strong> <span id="sample-permalink"><?php bp_group_permalink( $group ) ?></span> <a href="<?php echo bp_group_permalink( $group ) ?>" class="button button-small" id="bp-groups-visit-group"><?php esc_html_e( 'Visit Group', 'buddypress' ) ?></a>
|
620 |
Â
</div>
|
621 |
Â
|
622 |
+
<label for="bp-groups-description" class="screen-reader-text"><?php
|
623 |
+
/* translators: accessibility text */
|
624 |
+
_e( 'Group Description', 'buddypress' );
|
625 |
+
?></label>
|
626 |
Â
<?php wp_editor( stripslashes( $group->description ), 'bp-groups-description', array( 'media_buttons' => false, 'teeny' => true, 'textarea_rows' => 5, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
|
627 |
Â
</div>
|
628 |
Â
</div>
|
646 |
Â
</form>
|
647 |
Â
|
648 |
Â
<?php else : ?>
|
649 |
+
|
650 |
+
<p><?php
|
651 |
+
printf(
|
652 |
+
'%1$s <a href="%2$s">%3$s</a>',
|
653 |
+
__( 'No group found with this ID.', 'buddypress' ),
|
654 |
+
esc_url( bp_get_admin_url( 'admin.php?page=bp-groups' ) ),
|
655 |
+
__( 'Go back and try again.', 'buddypress' )
|
656 |
+
);
|
657 |
+
?></p>
|
658 |
+
|
659 |
Â
<?php endif; ?>
|
660 |
Â
|
661 |
Â
</div><!-- .wrap -->
|
702 |
Â
|
703 |
Â
<ul class="bp-group-delete-list">
|
704 |
Â
<?php foreach ( $groups['groups'] as $group ) : ?>
|
705 |
+
<li><?php echo esc_html( bp_get_group_name( $group ) ); ?></li>
|
706 |
Â
<?php endforeach; ?>
|
707 |
Â
</ul>
|
708 |
Â
|
839 |
Â
function bp_groups_admin_edit_metabox_add_new_members( $item ) {
|
840 |
Â
?>
|
841 |
Â
|
842 |
+
<label for="bp-groups-new-members" class="screen-reader-text"><?php
|
843 |
+
/* translators: accessibility text */
|
844 |
+
_e( 'Add new members', 'buddypress' );
|
845 |
+
?></label>
|
846 |
Â
<input name="bp-groups-new-members" id="bp-groups-new-members" class="bp-suggest-user" placeholder="<?php esc_attr_e( 'Enter a comma-separated list of user logins.', 'buddypress' ) ?>" />
|
847 |
Â
<ul id="bp-groups-new-members-list"></ul>
|
848 |
Â
<?php
|
936 |
Â
</td>
|
937 |
Â
|
938 |
Â
<td class="urole-column">
|
939 |
+
<label for="bp-groups-role-<?php echo esc_attr( $type_user->ID ); ?>" class="screen-reader-text"><?php
|
940 |
+
/* translators: accessibility text */
|
941 |
+
_e( 'Select group role for member', 'buddypress' );
|
942 |
+
?></label>
|
943 |
Â
<select class="bp-groups-role" id="bp-groups-role-<?php echo esc_attr( $type_user->ID ); ?>" name="bp-groups-role[<?php echo esc_attr( $type_user->ID ); ?>]">
|
944 |
Â
<optgroup label="<?php esc_attr_e( 'Roles', 'buddypress' ); ?>">
|
945 |
Â
<option class="admin" value="admin" <?php selected( 'admin', $member_type ); ?>><?php esc_html_e( 'Administrator', 'buddypress' ); ?></option>
|
1036 |
Â
<?php
|
1037 |
Â
}
|
1038 |
Â
|
1039 |
+
/**
|
1040 |
+
* Render the Group Type metabox.
|
1041 |
+
*
|
1042 |
+
* @since 2.6.0
|
1043 |
+
*
|
1044 |
+
* @param BP_Groups_Group|null $user The BP_Groups_Group object corresponding to the group being edited.
|
1045 |
+
*/
|
1046 |
+
function bp_groups_admin_edit_metabox_group_type( BP_Groups_Group $group = null ) {
|
1047 |
+
|
1048 |
+
// Bail if no group ID.
|
1049 |
+
if ( empty( $group->id ) ) {
|
1050 |
+
return;
|
1051 |
+
}
|
1052 |
+
|
1053 |
+
$types = bp_groups_get_group_types( array(), 'objects' );
|
1054 |
+
$current_type = bp_groups_get_group_type( $group->id );
|
1055 |
+
?>
|
1056 |
+
|
1057 |
+
<label for="bp-groups-group-type" class="screen-reader-text"><?php
|
1058 |
+
/* translators: accessibility text */
|
1059 |
+
esc_html_e( 'Select group type', 'buddypress' );
|
1060 |
+
?></label>
|
1061 |
+
<select name="bp-groups-group-type" id="bp-groups-group-type">
|
1062 |
+
<option value="" <?php selected( '', $current_type ); ?>><?php /* translators: no option picked in select box */ esc_attr_e( '----', 'buddypress' ) ?></option>
|
1063 |
+
<?php foreach ( $types as $type ) : ?>
|
1064 |
+
<option value="<?php echo esc_attr( $type->name ) ?>" <?php selected( $type->name, $current_type ) ?>><?php echo esc_html( $type->labels['singular_name'] ) ?></option>
|
1065 |
+
<?php endforeach; ?>
|
1066 |
+
</select>
|
1067 |
+
|
1068 |
+
<?php
|
1069 |
+
|
1070 |
+
wp_nonce_field( 'bp-group-type-change-' . $group->id, 'bp-group-type-nonce' );
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
/**
|
1074 |
+
* Process changes from the Group Type metabox.
|
1075 |
+
*
|
1076 |
+
* @since 2.6.0
|
1077 |
+
*/
|
1078 |
+
function bp_groups_process_group_type_update( $group_id ) {
|
1079 |
+
if ( ! isset( $_POST['bp-group-type-nonce'] ) || ! isset( $_POST['bp-groups-group-type'] ) ) {
|
1080 |
+
return;
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
check_admin_referer( 'bp-group-type-change-' . $group_id, 'bp-group-type-nonce' );
|
1084 |
+
|
1085 |
+
// Permission check.
|
1086 |
+
if ( ! current_user_can( 'bp_moderate' ) ) {
|
1087 |
+
return;
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
// Group type string must either reference a valid group type, or be empty.
|
1091 |
+
$group_type = wp_unslash( $_POST['bp-groups-group-type'] );
|
1092 |
+
if ( $group_type && ! bp_groups_get_group_type_object( $group_type ) ) {
|
1093 |
+
return;
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
/*
|
1097 |
+
* If an invalid group type is passed, someone's doing something
|
1098 |
+
* fishy with the POST request, so we can fail silently.
|
1099 |
+
*/
|
1100 |
+
if ( bp_groups_set_group_type( $group_id, $group_type ) ) {
|
1101 |
+
// @todo Success messages can't be posted because other stuff happens on the page load.
|
1102 |
+
}
|
1103 |
+
}
|
1104 |
+
add_action( 'bp_group_admin_edit_after', 'bp_groups_process_group_type_update' );
|
1105 |
+
|
1106 |
Â
/**
|
1107 |
Â
* Create pagination links out of a BP_Group_Member_Query.
|
1108 |
Â
*
|
@@ -47,15 +47,15 @@ function bp_groups_group_admin_menu() {
|
|
47 |
Â
) );
|
48 |
Â
|
49 |
Â
// Index of the Manage tabs parent slug.
|
50 |
-
$
|
51 |
Â
|
52 |
Â
// Check if current group has Manage tabs.
|
53 |
-
if (
|
54 |
Â
return;
|
55 |
Â
}
|
56 |
Â
|
57 |
Â
// Build the Group Admin menus.
|
58 |
-
foreach ( $
|
59 |
Â
/**
|
60 |
Â
* Should we add the current manage link in the Group's "Edit" Admin Bar menu ?
|
61 |
Â
*
|
@@ -63,19 +63,19 @@ function bp_groups_group_admin_menu() {
|
|
63 |
Â
* to also add the link to the "edit screen" of their group component. To do so, set the
|
64 |
Â
* the 'show_in_admin_bar' argument of your edit screen to true
|
65 |
Â
*/
|
66 |
-
if ( $menu
|
67 |
-
$title = sprintf( _x( 'Edit Group %s', 'Group WP Admin Bar manage links', 'buddypress' ), $menu
|
68 |
Â
|
69 |
Â
// Title is specific for delete.
|
70 |
-
if ( 'delete-group' == $menu
|
71 |
-
$title = sprintf( _x( '%s Group', 'Group WP Admin Bar delete link', 'buddypress' ), $menu
|
72 |
Â
}
|
73 |
Â
|
74 |
Â
$wp_admin_bar->add_menu( array(
|
75 |
Â
'parent' => $bp->group_admin_menu_id,
|
76 |
-
'id' => $menu
|
77 |
Â
'title' => $title,
|
78 |
-
'href' => bp_get_groups_action_link( 'admin/' . $menu
|
79 |
Â
) );
|
80 |
Â
}
|
81 |
Â
}
|
47 |
Â
) );
|
48 |
Â
|
49 |
Â
// Index of the Manage tabs parent slug.
|
50 |
+
$secondary_nav_items = $bp->groups->nav->get_secondary( array( 'parent_slug' => $bp->groups->current_group->slug . '_manage' ) );
|
51 |
Â
|
52 |
Â
// Check if current group has Manage tabs.
|
53 |
+
if ( ! $secondary_nav_items ) {
|
54 |
Â
return;
|
55 |
Â
}
|
56 |
Â
|
57 |
Â
// Build the Group Admin menus.
|
58 |
+
foreach ( $secondary_nav_items as $menu ) {
|
59 |
Â
/**
|
60 |
Â
* Should we add the current manage link in the Group's "Edit" Admin Bar menu ?
|
61 |
Â
*
|
63 |
Â
* to also add the link to the "edit screen" of their group component. To do so, set the
|
64 |
Â
* the 'show_in_admin_bar' argument of your edit screen to true
|
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 |
Â
// Title is specific for delete.
|
70 |
+
if ( 'delete-group' == $menu->slug ) {
|
71 |
+
$title = sprintf( _x( '%s Group', 'Group WP Admin Bar delete link', 'buddypress' ), $menu->name );
|
72 |
Â
}
|
73 |
Â
|
74 |
Â
$wp_admin_bar->add_menu( array(
|
75 |
Â
'parent' => $bp->group_admin_menu_id,
|
76 |
+
'id' => $menu->slug,
|
77 |
Â
'title' => $title,
|
78 |
+
'href' => bp_get_groups_action_link( 'admin/' . $menu->slug )
|
79 |
Â
) );
|
80 |
Â
}
|
81 |
Â
}
|
@@ -212,6 +212,47 @@ function groups_clear_group_administrator_cache_on_member_save( BP_Groups_Member
|
|
212 |
Â
}
|
213 |
Â
add_action( 'groups_member_after_save', 'groups_clear_group_administrator_cache_on_member_save' );
|
214 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
215 |
Â
/* List actions to clear super cached pages on, if super cache is installed */
|
216 |
Â
add_action( 'groups_join_group', 'bp_core_clear_cache' );
|
217 |
Â
add_action( 'groups_leave_group', 'bp_core_clear_cache' );
|
212 |
Â
}
|
213 |
Â
add_action( 'groups_member_after_save', 'groups_clear_group_administrator_cache_on_member_save' );
|
214 |
Â
|
215 |
+
/**
|
216 |
+
* Clear the group type cache for a group.
|
217 |
+
*
|
218 |
+
* Called when group is deleted.
|
219 |
+
*
|
220 |
+
* @since 2.6.0
|
221 |
+
*
|
222 |
+
* @param int $group_id The group ID.
|
223 |
+
*/
|
224 |
+
function groups_clear_group_type_cache( $group_id = 0 ) {
|
225 |
+
wp_cache_delete( $group_id, 'bp_groups_group_type' );
|
226 |
+
}
|
227 |
+
add_action( 'groups_delete_group', 'groups_clear_group_type_cache' );
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Clear caches on membership save.
|
231 |
+
*
|
232 |
+
* @since 2.6.0
|
233 |
+
*/
|
234 |
+
function bp_groups_clear_user_group_cache_on_membership_save( BP_Groups_Member $member ) {
|
235 |
+
wp_cache_delete( $member->user_id, 'bp_groups_memberships_for_user' );
|
236 |
+
wp_cache_delete( $member->id, 'bp_groups_memberships' );
|
237 |
+
}
|
238 |
+
add_action( 'groups_member_before_save', 'bp_groups_clear_user_group_cache_on_membership_save' );
|
239 |
+
add_action( 'groups_member_before_remove', 'bp_groups_clear_user_group_cache_on_membership_save' );
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Clear group memberships cache on miscellaneous actions not covered by the 'after_save' hook.
|
243 |
+
*
|
244 |
+
* @since 2.6.0
|
245 |
+
*/
|
246 |
+
function bp_groups_clear_user_group_cache_on_other_events( $user_id, $group_id ) {
|
247 |
+
wp_cache_delete( $user_id, 'bp_groups_memberships_for_user' );
|
248 |
+
|
249 |
+
$membership = new BP_Groups_Member( $user_id, $group_id );
|
250 |
+
wp_cache_delete( $membership->id, 'bp_groups_memberships' );
|
251 |
+
}
|
252 |
+
add_action( 'bp_groups_member_before_delete', 'bp_groups_clear_user_group_cache_on_other_events', 10, 2 );
|
253 |
+
add_action( 'bp_groups_member_before_delete_invite', 'bp_groups_clear_user_group_cache_on_other_events', 10, 2 );
|
254 |
+
add_action( 'groups_accept_invite', 'bp_groups_clear_user_group_cache_on_other_events', 10, 2 );
|
255 |
+
|
256 |
Â
/* List actions to clear super cached pages on, if super cache is installed */
|
257 |
Â
add_action( 'groups_join_group', 'bp_core_clear_cache' );
|
258 |
Â
add_action( 'groups_leave_group', 'bp_core_clear_cache' );
|
@@ -54,7 +54,7 @@ add_filter( 'groups_group_description_before_save', 'force_balance_tags' );
|
|
54 |
Â
add_filter( 'groups_group_name_before_save', 'trim' );
|
55 |
Â
add_filter( 'groups_group_description_before_save', 'trim' );
|
56 |
Â
|
57 |
-
// Support
|
58 |
Â
if ( function_exists( 'wp_encode_emoji' ) ) {
|
59 |
Â
add_filter( 'groups_group_description_before_save', 'wp_encode_emoji' );
|
60 |
Â
}
|
@@ -73,6 +73,10 @@ add_filter( 'bp_get_total_group_count_for_user', 'bp_core_number_format' );
|
|
73 |
Â
// Activity component integration.
|
74 |
Â
add_filter( 'bp_activity_at_name_do_notifications', 'bp_groups_disable_at_mention_notification_for_non_public_groups', 10, 4 );
|
75 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
76 |
Â
/**
|
77 |
Â
* Filter output of Group Description through WordPress's KSES API.
|
78 |
Â
*
|
@@ -319,3 +323,26 @@ function bp_groups_disable_at_mention_notification_for_non_public_groups( $send,
|
|
319 |
Â
|
320 |
Â
return $send;
|
321 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
54 |
Â
add_filter( 'groups_group_name_before_save', 'trim' );
|
55 |
Â
add_filter( 'groups_group_description_before_save', 'trim' );
|
56 |
Â
|
57 |
+
// Support emoji.
|
58 |
Â
if ( function_exists( 'wp_encode_emoji' ) ) {
|
59 |
Â
add_filter( 'groups_group_description_before_save', 'wp_encode_emoji' );
|
60 |
Â
}
|
73 |
Â
// Activity component integration.
|
74 |
Â
add_filter( 'bp_activity_at_name_do_notifications', 'bp_groups_disable_at_mention_notification_for_non_public_groups', 10, 4 );
|
75 |
Â
|
76 |
+
// Default group avatar.
|
77 |
+
add_filter( 'bp_core_avatar_default', 'bp_groups_default_avatar', 10, 3 );
|
78 |
+
add_filter( 'bp_core_avatar_default_thumb', 'bp_groups_default_avatar', 10, 3 );
|
79 |
+
|
80 |
Â
/**
|
81 |
Â
* Filter output of Group Description through WordPress's KSES API.
|
82 |
Â
*
|
323 |
Â
|
324 |
Â
return $send;
|
325 |
Â
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Use the mystery group avatar for groups.
|
329 |
+
*
|
330 |
+
* @since 2.6.0
|
331 |
+
*
|
332 |
+
* @param string $avatar Current avatar src.
|
333 |
+
* @param array $params Avatar params.
|
334 |
+
* @return string
|
335 |
+
*/
|
336 |
+
function bp_groups_default_avatar( $avatar, $params ) {
|
337 |
+
if ( isset( $params['object'] ) && 'group' === $params['object'] ) {
|
338 |
+
if ( isset( $params['type'] ) && 'thumb' === $params['type'] ) {
|
339 |
+
$file = 'mystery-group-50.png';
|
340 |
+
} else {
|
341 |
+
$file = 'mystery-group.png';
|
342 |
+
}
|
343 |
+
|
344 |
+
$avatar = buddypress()->plugin_url . "bp-core/images/$file";
|
345 |
+
}
|
346 |
+
|
347 |
+
return $avatar;
|
348 |
+
}
|
@@ -683,6 +683,7 @@ function groups_get_total_member_count( $group_id ) {
|
|
683 |
Â
* Get a collection of groups, based on the parameters passed.
|
684 |
Â
*
|
685 |
Â
* @since 1.2.0
|
Â
|
|
686 |
Â
*
|
687 |
Â
* @param array|string $args {
|
688 |
Â
* Array of arguments. Supports all arguments of
|
@@ -696,37 +697,43 @@ function groups_get_total_member_count( $group_id ) {
|
|
696 |
Â
function groups_get_groups( $args = '' ) {
|
697 |
Â
|
698 |
Â
$defaults = array(
|
699 |
-
'type'
|
700 |
-
'order'
|
701 |
-
'orderby'
|
702 |
-
'user_id'
|
703 |
-
'include'
|
704 |
-
'exclude'
|
705 |
-
'search_terms'
|
706 |
-
'
|
707 |
-
'
|
708 |
-
'
|
709 |
-
'
|
710 |
-
'
|
711 |
-
'
|
Â
|
|
Â
|
|
Â
|
|
712 |
Â
);
|
713 |
Â
|
714 |
Â
$r = wp_parse_args( $args, $defaults );
|
715 |
Â
|
716 |
Â
$groups = BP_Groups_Group::get( array(
|
717 |
-
'type'
|
718 |
-
'user_id'
|
719 |
-
'include'
|
720 |
-
'exclude'
|
721 |
-
'search_terms'
|
722 |
-
'
|
723 |
-
'
|
724 |
-
'
|
725 |
-
'
|
726 |
-
'
|
727 |
-
'
|
728 |
-
'
|
729 |
-
'
|
Â
|
|
Â
|
|
Â
|
|
730 |
Â
) );
|
731 |
Â
|
732 |
Â
/**
|
@@ -783,6 +790,131 @@ function groups_get_user_groups( $user_id = 0, $pag_num = 0, $pag_page = 0 ) {
|
|
783 |
Â
return BP_Groups_Member::get_group_ids( $user_id, $pag_num, $pag_page );
|
784 |
Â
}
|
785 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
786 |
Â
/**
|
787 |
Â
* Get the count of groups of which the specified user is a member.
|
788 |
Â
*
|
@@ -879,10 +1011,20 @@ function groups_avatar_upload_dir( $group_id = 0 ) {
|
|
879 |
Â
*
|
880 |
Â
* @param int $user_id ID of the user.
|
881 |
Â
* @param int $group_id ID of the group.
|
882 |
-
* @return bool
|
883 |
Â
*/
|
884 |
Â
function groups_is_user_admin( $user_id, $group_id ) {
|
885 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
886 |
Â
}
|
887 |
Â
|
888 |
Â
/**
|
@@ -892,10 +1034,20 @@ function groups_is_user_admin( $user_id, $group_id ) {
|
|
892 |
Â
*
|
893 |
Â
* @param int $user_id ID of the user.
|
894 |
Â
* @param int $group_id ID of the group.
|
895 |
-
* @return bool
|
896 |
Â
*/
|
897 |
Â
function groups_is_user_mod( $user_id, $group_id ) {
|
898 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
899 |
Â
}
|
900 |
Â
|
901 |
Â
/**
|
@@ -905,10 +1057,21 @@ function groups_is_user_mod( $user_id, $group_id ) {
|
|
905 |
Â
*
|
906 |
Â
* @param int $user_id ID of the user.
|
907 |
Â
* @param int $group_id ID of the group.
|
908 |
-
* @return bool
|
909 |
Â
*/
|
910 |
Â
function groups_is_user_member( $user_id, $group_id ) {
|
911 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
912 |
Â
}
|
913 |
Â
|
914 |
Â
/**
|
@@ -918,11 +1081,69 @@ function groups_is_user_member( $user_id, $group_id ) {
|
|
918 |
Â
*
|
919 |
Â
* @param int $user_id ID of the user.
|
920 |
Â
* @param int $group_id ID of the group.
|
921 |
-
*
|
922 |
-
* @return bool
|
923 |
Â
*/
|
924 |
Â
function groups_is_user_banned( $user_id, $group_id ) {
|
925 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
926 |
Â
}
|
927 |
Â
|
928 |
Â
/**
|
@@ -944,6 +1165,7 @@ function groups_is_user_creator( $user_id, $group_id ) {
|
|
944 |
Â
* Post an Activity status update affiliated with a group.
|
945 |
Â
*
|
946 |
Â
* @since 1.2.0
|
Â
|
|
947 |
Â
*
|
948 |
Â
* @param array|string $args {
|
949 |
Â
* Array of arguments.
|
@@ -963,9 +1185,10 @@ function groups_post_update( $args = '' ) {
|
|
963 |
Â
$bp = buddypress();
|
964 |
Â
|
965 |
Â
$defaults = array(
|
966 |
-
'content'
|
967 |
-
'user_id'
|
968 |
-
'group_id'
|
Â
|
|
969 |
Â
);
|
970 |
Â
|
971 |
Â
$r = wp_parse_args( $args, $defaults );
|
@@ -1006,11 +1229,12 @@ function groups_post_update( $args = '' ) {
|
|
1006 |
Â
$content_filtered = apply_filters( 'groups_activity_new_update_content', $activity_content );
|
1007 |
Â
|
1008 |
Â
$activity_id = groups_record_activity( array(
|
1009 |
-
'user_id'
|
1010 |
-
'action'
|
1011 |
-
'content'
|
1012 |
-
'type'
|
1013 |
-
'item_id'
|
Â
|
|
1014 |
Â
) );
|
1015 |
Â
|
1016 |
Â
groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() );
|
@@ -1100,8 +1324,9 @@ function groups_invite_user( $args = '' ) {
|
|
1100 |
Â
$args = wp_parse_args( $args, $defaults );
|
1101 |
Â
extract( $args, EXTR_SKIP );
|
1102 |
Â
|
1103 |
-
if (
|
1104 |
Â
return false;
|
Â
|
|
1105 |
Â
|
1106 |
Â
// If the user has already requested membership, accept the request.
|
1107 |
Â
if ( $membership_id = groups_check_for_membership_request( $user_id, $group_id ) ) {
|
@@ -1335,10 +1560,29 @@ function groups_get_invites_for_group( $user_id, $group_id ) {
|
|
1335 |
Â
* @param int $group_id ID of potential group.
|
1336 |
Â
* @param string $type Optional. Use 'sent' to check for sent invites,
|
1337 |
Â
* 'all' to check for all. Default: 'sent'.
|
1338 |
-
* @return bool
|
1339 |
Â
*/
|
1340 |
Â
function groups_check_user_has_invite( $user_id, $group_id, $type = 'sent' ) {
|
1341 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1342 |
Â
}
|
1343 |
Â
|
1344 |
Â
/**
|
@@ -1683,10 +1927,23 @@ function groups_delete_membership_request( $membership_id, $user_id = 0, $group_
|
|
1683 |
Â
*
|
1684 |
Â
* @param int $user_id ID of the user.
|
1685 |
Â
* @param int $group_id ID of the group.
|
1686 |
-
* @return int|
|
1687 |
Â
*/
|
1688 |
Â
function groups_check_for_membership_request( $user_id, $group_id ) {
|
1689 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1690 |
Â
}
|
1691 |
Â
|
1692 |
Â
/**
|
@@ -1849,3 +2106,290 @@ function groups_remove_data_for_user( $user_id ) {
|
|
1849 |
Â
add_action( 'wpmu_delete_user', 'groups_remove_data_for_user' );
|
1850 |
Â
add_action( 'delete_user', 'groups_remove_data_for_user' );
|
1851 |
Â
add_action( 'bp_make_spam_user', 'groups_remove_data_for_user' );
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
683 |
Â
* Get a collection of groups, based on the parameters passed.
|
684 |
Â
*
|
685 |
Â
* @since 1.2.0
|
686 |
+
* @since 2.6.0 Added `$group_type`, `$group_type__in`, and `$group_type__not_in` parameters.
|
687 |
Â
*
|
688 |
Â
* @param array|string $args {
|
689 |
Â
* Array of arguments. Supports all arguments of
|
697 |
Â
function groups_get_groups( $args = '' ) {
|
698 |
Â
|
699 |
Â
$defaults = array(
|
700 |
+
'type' => false, // Active, newest, alphabetical, random, popular, most-forum-topics or most-forum-posts.
|
701 |
+
'order' => 'DESC', // 'ASC' or 'DESC'
|
702 |
+
'orderby' => 'date_created', // date_created, last_activity, total_member_count, name, random.
|
703 |
+
'user_id' => false, // Pass a user_id to limit to only groups that this user is a member of.
|
704 |
+
'include' => false, // Only include these specific groups (group_ids).
|
705 |
+
'exclude' => false, // Do not include these specific groups (group_ids).
|
706 |
+
'search_terms' => false, // Limit to groups that match these search terms.
|
707 |
+
'group_type' => '',
|
708 |
+
'group_type__in' => '',
|
709 |
+
'group_type__not_in' => '',
|
710 |
+
'meta_query' => false, // Filter by groupmeta. See WP_Meta_Query for syntax.
|
711 |
+
'show_hidden' => false, // Show hidden groups to non-admins.
|
712 |
+
'per_page' => 20, // The number of results to return per page.
|
713 |
+
'page' => 1, // The page to return if limiting per page.
|
714 |
+
'populate_extras' => true, // Fetch meta such as is_banned and is_member.
|
715 |
+
'update_meta_cache' => true, // Pre-fetch groupmeta for queried groups.
|
716 |
Â
);
|
717 |
Â
|
718 |
Â
$r = wp_parse_args( $args, $defaults );
|
719 |
Â
|
720 |
Â
$groups = BP_Groups_Group::get( array(
|
721 |
+
'type' => $r['type'],
|
722 |
+
'user_id' => $r['user_id'],
|
723 |
+
'include' => $r['include'],
|
724 |
+
'exclude' => $r['exclude'],
|
725 |
+
'search_terms' => $r['search_terms'],
|
726 |
+
'group_type' => $r['group_type'],
|
727 |
+
'group_type__in' => $r['group_type__in'],
|
728 |
+
'group_type__not_in' => $r['group_type__not_in'],
|
729 |
+
'meta_query' => $r['meta_query'],
|
730 |
+
'show_hidden' => $r['show_hidden'],
|
731 |
+
'per_page' => $r['per_page'],
|
732 |
+
'page' => $r['page'],
|
733 |
+
'populate_extras' => $r['populate_extras'],
|
734 |
+
'update_meta_cache' => $r['update_meta_cache'],
|
735 |
+
'order' => $r['order'],
|
736 |
+
'orderby' => $r['orderby'],
|
737 |
Â
) );
|
738 |
Â
|
739 |
Â
/**
|
790 |
Â
return BP_Groups_Member::get_group_ids( $user_id, $pag_num, $pag_page );
|
791 |
Â
}
|
792 |
Â
|
793 |
+
/**
|
794 |
+
* Get a list of groups of which the specified user is a member.
|
795 |
+
*
|
796 |
+
* Get a list of the groups to which this member belongs,
|
797 |
+
* filtered by group membership status and role.
|
798 |
+
* Usage examples: Used with no arguments specified,
|
799 |
+
*
|
800 |
+
* bp_get_user_groups( bp_loggedin_user_id() );
|
801 |
+
*
|
802 |
+
* returns an array of the groups in which the logged-in user
|
803 |
+
* is an unpromoted member. To fetch an array of all groups that
|
804 |
+
* the current user belongs to, in any membership role,
|
805 |
+
* member, moderator or administrator, use
|
806 |
+
*
|
807 |
+
* bp_get_user_groups( $user_id, array(
|
808 |
+
* 'is_admin' => null,
|
809 |
+
* 'is_mod' => null,
|
810 |
+
* ) );
|
811 |
+
*
|
812 |
+
* @since 2.6.0
|
813 |
+
*
|
814 |
+
* @param int $user_id ID of the user.
|
815 |
+
* @param array $args {
|
816 |
+
* Array of optional args.
|
817 |
+
* @param bool|null $is_confirmed Whether to return only confirmed memberships. Pass `null` to disable this
|
818 |
+
* filter. Default: true.
|
819 |
+
* @param bool|null $is_banned Whether to return only banned memberships. Pass `null` to disable this filter.
|
820 |
+
* Default: false.
|
821 |
+
* @param bool|null $is_admin Whether to return only admin memberships. Pass `null` to disable this filter.
|
822 |
+
* Default: false.
|
823 |
+
* @param bool|null $is_mod Whether to return only mod memberships. Pass `null` to disable this filter.
|
824 |
+
* Default: false.
|
825 |
+
* @param bool|null $invite_sent Whether to return only memberships with 'invite_sent'. Pass `null` to disable
|
826 |
+
* this filter. Default: false.
|
827 |
+
* @param string $orderby Field to order by. Accepts 'id' (membership ID), 'group_id', 'date_modified'.
|
828 |
+
* Default: 'group_id'.
|
829 |
+
* @param string $order Sort order. Accepts 'ASC' or 'DESC'. Default: 'ASC'.
|
830 |
+
* }
|
831 |
+
* @return array Array of matching group memberships, keyed by group ID.
|
832 |
+
*/
|
833 |
+
function bp_get_user_groups( $user_id, $args = array() ) {
|
834 |
+
$r = bp_parse_args( $args, array(
|
835 |
+
'is_confirmed' => true,
|
836 |
+
'is_banned' => false,
|
837 |
+
'is_admin' => false,
|
838 |
+
'is_mod' => false,
|
839 |
+
'invite_sent' => null,
|
840 |
+
'orderby' => 'group_id',
|
841 |
+
'order' => 'ASC',
|
842 |
+
), 'get_user_groups' );
|
843 |
+
|
844 |
+
$user_id = intval( $user_id );
|
845 |
+
|
846 |
+
$membership_ids = wp_cache_get( $user_id, 'bp_groups_memberships_for_user' );
|
847 |
+
if ( false === $membership_ids ) {
|
848 |
+
$membership_ids = BP_Groups_Member::get_membership_ids_for_user( $user_id );
|
849 |
+
wp_cache_set( $user_id, $membership_ids, 'bp_groups_memberships_for_user' );
|
850 |
+
}
|
851 |
+
|
852 |
+
// Prime the membership cache.
|
853 |
+
$uncached_membership_ids = bp_get_non_cached_ids( $membership_ids, 'bp_groups_memberships' );
|
854 |
+
if ( ! empty( $uncached_membership_ids ) ) {
|
855 |
+
$uncached_memberships = BP_Groups_Member::get_memberships_by_id( $uncached_membership_ids );
|
856 |
+
|
857 |
+
foreach ( $uncached_memberships as $uncached_membership ) {
|
858 |
+
wp_cache_set( $uncached_membership->id, $uncached_membership, 'bp_groups_memberships' );
|
859 |
+
}
|
860 |
+
}
|
861 |
+
|
862 |
+
// Populate group membership array from cache.
|
863 |
+
$groups = array();
|
864 |
+
foreach ( $membership_ids as $membership_id ) {
|
865 |
+
$membership = wp_cache_get( $membership_id, 'bp_groups_memberships' );
|
866 |
+
|
867 |
+
// Sanity check.
|
868 |
+
if ( ! isset( $membership->group_id ) ) {
|
869 |
+
continue;
|
870 |
+
}
|
871 |
+
|
872 |
+
$group_id = (int) $membership->group_id;
|
873 |
+
|
874 |
+
$groups[ $group_id ] = $membership;
|
875 |
+
}
|
876 |
+
|
877 |
+
// Normalize group data.
|
878 |
+
foreach ( $groups as &$group ) {
|
879 |
+
// Integer values.
|
880 |
+
foreach ( array( 'id', 'group_id', 'user_id', 'inviter_id' ) as $index ) {
|
881 |
+
$group->{$index} = intval( $group->{$index} );
|
882 |
+
}
|
883 |
+
|
884 |
+
// Boolean values.
|
885 |
+
foreach ( array( 'is_admin', 'is_mod', 'is_confirmed', 'is_banned', 'invite_sent' ) as $index ) {
|
886 |
+
$group->{$index} = (bool) $group->{$index};
|
887 |
+
}
|
888 |
+
}
|
889 |
+
|
890 |
+
// Assemble filter array for use in `wp_list_filter()`.
|
891 |
+
$filters = wp_array_slice_assoc( $r, array( 'is_confirmed', 'is_banned', 'is_admin', 'is_mod', 'invite_sent' ) );
|
892 |
+
foreach ( $filters as $filter_name => $filter_value ) {
|
893 |
+
if ( is_null( $filter_value ) ) {
|
894 |
+
unset( $filters[ $filter_name ] );
|
895 |
+
}
|
896 |
+
}
|
897 |
+
|
898 |
+
if ( ! empty( $filters ) ) {
|
899 |
+
$groups = wp_list_filter( $groups, $filters );
|
900 |
+
}
|
901 |
+
|
902 |
+
// By default, results are ordered by membership id.
|
903 |
+
if ( 'group_id' === $r['orderby'] ) {
|
904 |
+
ksort( $groups );
|
905 |
+
} elseif ( in_array( $r['orderby'], array( 'id', 'date_modified' ) ) ) {
|
906 |
+
$groups = bp_sort_by_key( $groups, $r['orderby'] );
|
907 |
+
}
|
908 |
+
|
909 |
+
// By default, results are ordered ASC.
|
910 |
+
if ( 'DESC' === strtoupper( $r['order'] ) ) {
|
911 |
+
// `true` to preserve keys.
|
912 |
+
$groups = array_reverse( $groups, true );
|
913 |
+
}
|
914 |
+
|
915 |
+
return $groups;
|
916 |
+
}
|
917 |
+
|
918 |
Â
/**
|
919 |
Â
* Get the count of groups of which the specified user is a member.
|
920 |
Â
*
|
1011 |
Â
*
|
1012 |
Â
* @param int $user_id ID of the user.
|
1013 |
Â
* @param int $group_id ID of the group.
|
1014 |
+
* @return int|bool ID of the membership if the user is admin, otherwise false.
|
1015 |
Â
*/
|
1016 |
Â
function groups_is_user_admin( $user_id, $group_id ) {
|
1017 |
+
$is_admin = false;
|
1018 |
+
|
1019 |
+
$user_groups = bp_get_user_groups( $user_id, array(
|
1020 |
+
'is_admin' => true,
|
1021 |
+
) );
|
1022 |
+
|
1023 |
+
if ( isset( $user_groups[ $group_id ] ) ) {
|
1024 |
+
$is_admin = $user_groups[ $group_id ]->id;
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
return $is_admin;
|
1028 |
Â
}
|
1029 |
Â
|
1030 |
Â
/**
|
1034 |
Â
*
|
1035 |
Â
* @param int $user_id ID of the user.
|
1036 |
Â
* @param int $group_id ID of the group.
|
1037 |
+
* @return int|bool ID of the membership if the user is mod, otherwise false.
|
1038 |
Â
*/
|
1039 |
Â
function groups_is_user_mod( $user_id, $group_id ) {
|
1040 |
+
$is_mod = false;
|
1041 |
+
|
1042 |
+
$user_groups = bp_get_user_groups( $user_id, array(
|
1043 |
+
'is_mod' => true,
|
1044 |
+
) );
|
1045 |
+
|
1046 |
+
if ( isset( $user_groups[ $group_id ] ) ) {
|
1047 |
+
$is_mod = $user_groups[ $group_id ]->id;
|
1048 |
+
}
|
1049 |
+
|
1050 |
+
return $is_mod;
|
1051 |
Â
}
|
1052 |
Â
|
1053 |
Â
/**
|
1057 |
Â
*
|
1058 |
Â
* @param int $user_id ID of the user.
|
1059 |
Â
* @param int $group_id ID of the group.
|
1060 |
+
* @return int|bool ID of the membership if the user is member, otherwise false.
|
1061 |
Â
*/
|
1062 |
Â
function groups_is_user_member( $user_id, $group_id ) {
|
1063 |
+
$is_member = false;
|
1064 |
+
|
1065 |
+
$user_groups = bp_get_user_groups( $user_id, array(
|
1066 |
+
'is_admin' => null,
|
1067 |
+
'is_mod' => null,
|
1068 |
+
) );
|
1069 |
+
|
1070 |
+
if ( isset( $user_groups[ $group_id ] ) ) {
|
1071 |
+
$is_member = $user_groups[ $group_id ]->id;
|
1072 |
+
}
|
1073 |
+
|
1074 |
+
return $is_member;
|
1075 |
Â
}
|
1076 |
Â
|
1077 |
Â
/**
|
1081 |
Â
*
|
1082 |
Â
* @param int $user_id ID of the user.
|
1083 |
Â
* @param int $group_id ID of the group.
|
1084 |
+
* @return int|bool ID of the membership if the user is banned, otherwise false.
|
Â
|
|
1085 |
Â
*/
|
1086 |
Â
function groups_is_user_banned( $user_id, $group_id ) {
|
1087 |
+
$is_banned = false;
|
1088 |
+
|
1089 |
+
$user_groups = bp_get_user_groups( $user_id, array(
|
1090 |
+
'is_confirmed' => null,
|
1091 |
+
'is_banned' => true,
|
1092 |
+
) );
|
1093 |
+
|
1094 |
+
if ( isset( $user_groups[ $group_id ] ) ) {
|
1095 |
+
$is_banned = $user_groups[ $group_id ]->id;
|
1096 |
+
}
|
1097 |
+
|
1098 |
+
return $is_banned;
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
/**
|
1102 |
+
* Check whether a user has an outstanding invitation to a group.
|
1103 |
+
*
|
1104 |
+
* @since 2.6.0
|
1105 |
+
*
|
1106 |
+
* @param int $user_id ID of the user.
|
1107 |
+
* @param int $group_id ID of the group.
|
1108 |
+
* @return int|bool ID of the membership if the user is invited, otherwise false.
|
1109 |
+
*/
|
1110 |
+
function groups_is_user_invited( $user_id, $group_id ) {
|
1111 |
+
$is_invited = false;
|
1112 |
+
|
1113 |
+
$user_groups = bp_get_user_groups( $user_id, array(
|
1114 |
+
'invite_sent' => true,
|
1115 |
+
'is_confirmed' => false,
|
1116 |
+
) );
|
1117 |
+
|
1118 |
+
if ( isset( $user_groups[ $group_id ] ) ) {
|
1119 |
+
$is_invited = $user_groups[ $group_id ]->id;
|
1120 |
+
}
|
1121 |
+
|
1122 |
+
return $is_invited;
|
1123 |
+
}
|
1124 |
+
|
1125 |
+
/**
|
1126 |
+
* Check whether a user has a pending membership request for a group.
|
1127 |
+
*
|
1128 |
+
* @since 2.6.0
|
1129 |
+
*
|
1130 |
+
* @param int $user_id ID of the user.
|
1131 |
+
* @param int $group_id ID of the group.
|
1132 |
+
* @return int|bool ID of the membership if the user is pending, otherwise false.
|
1133 |
+
*/
|
1134 |
+
function groups_is_user_pending( $user_id, $group_id ) {
|
1135 |
+
$is_pending = false;
|
1136 |
+
|
1137 |
+
$user_groups = bp_get_user_groups( $user_id, array(
|
1138 |
+
'invite_sent' => false,
|
1139 |
+
'is_confirmed' => false,
|
1140 |
+
) );
|
1141 |
+
|
1142 |
+
if ( isset( $user_groups[ $group_id ] ) ) {
|
1143 |
+
$is_pending = $user_groups[ $group_id ]->id;
|
1144 |
+
}
|
1145 |
+
|
1146 |
+
return $is_pending;
|
1147 |
Â
}
|
1148 |
Â
|
1149 |
Â
/**
|
1165 |
Â
* Post an Activity status update affiliated with a group.
|
1166 |
Â
*
|
1167 |
Â
* @since 1.2.0
|
1168 |
+
* @since 2.6.0 Added 'error_type' parameter to $args.
|
1169 |
Â
*
|
1170 |
Â
* @param array|string $args {
|
1171 |
Â
* Array of arguments.
|
1185 |
Â
$bp = buddypress();
|
1186 |
Â
|
1187 |
Â
$defaults = array(
|
1188 |
+
'content' => false,
|
1189 |
+
'user_id' => bp_loggedin_user_id(),
|
1190 |
+
'group_id' => 0,
|
1191 |
+
'error_type' => 'bool'
|
1192 |
Â
);
|
1193 |
Â
|
1194 |
Â
$r = wp_parse_args( $args, $defaults );
|
1229 |
Â
$content_filtered = apply_filters( 'groups_activity_new_update_content', $activity_content );
|
1230 |
Â
|
1231 |
Â
$activity_id = groups_record_activity( array(
|
1232 |
+
'user_id' => $user_id,
|
1233 |
+
'action' => $action,
|
1234 |
+
'content' => $content_filtered,
|
1235 |
+
'type' => 'activity_update',
|
1236 |
+
'item_id' => $group_id,
|
1237 |
+
'error_type' => $error_type
|
1238 |
Â
) );
|
1239 |
Â
|
1240 |
Â
groups_update_groupmeta( $group_id, 'last_activity', bp_core_current_time() );
|
1324 |
Â
$args = wp_parse_args( $args, $defaults );
|
1325 |
Â
extract( $args, EXTR_SKIP );
|
1326 |
Â
|
1327 |
+
if ( ! $user_id || ! $group_id || ! $inviter_id ) {
|
1328 |
Â
return false;
|
1329 |
+
}
|
1330 |
Â
|
1331 |
Â
// If the user has already requested membership, accept the request.
|
1332 |
Â
if ( $membership_id = groups_check_for_membership_request( $user_id, $group_id ) ) {
|
1560 |
Â
* @param int $group_id ID of potential group.
|
1561 |
Â
* @param string $type Optional. Use 'sent' to check for sent invites,
|
1562 |
Â
* 'all' to check for all. Default: 'sent'.
|
1563 |
+
* @return int|bool ID of the membership if found, otherwise false.
|
1564 |
Â
*/
|
1565 |
Â
function groups_check_user_has_invite( $user_id, $group_id, $type = 'sent' ) {
|
1566 |
+
$invite = false;
|
1567 |
+
|
1568 |
+
$args = array(
|
1569 |
+
'is_confirmed' => false,
|
1570 |
+
'is_banned' => null,
|
1571 |
+
'is_admin' => null,
|
1572 |
+
'is_mod' => null,
|
1573 |
+
);
|
1574 |
+
|
1575 |
+
if ( 'sent' === $type ) {
|
1576 |
+
$args['invite_sent'] = true;
|
1577 |
+
}
|
1578 |
+
|
1579 |
+
$user_groups = bp_get_user_groups( $user_id, $args );
|
1580 |
+
|
1581 |
+
if ( isset( $user_groups[ $group_id ] ) && 0 !== $user_groups[ $group_id ]->inviter_id ) {
|
1582 |
+
$invite = $user_groups[ $group_id ]->id;
|
1583 |
+
}
|
1584 |
+
|
1585 |
+
return $invite;
|
1586 |
Â
}
|
1587 |
Â
|
1588 |
Â
/**
|
1927 |
Â
*
|
1928 |
Â
* @param int $user_id ID of the user.
|
1929 |
Â
* @param int $group_id ID of the group.
|
1930 |
+
* @return int|bool ID of the membership if found, otherwise false.
|
1931 |
Â
*/
|
1932 |
Â
function groups_check_for_membership_request( $user_id, $group_id ) {
|
1933 |
+
$request = false;
|
1934 |
+
|
1935 |
+
$user_groups = bp_get_user_groups( $user_id, array(
|
1936 |
+
'is_confirmed' => false,
|
1937 |
+
'is_banned' => false,
|
1938 |
+
'is_admin' => null,
|
1939 |
+
'is_mod' => null
|
1940 |
+
) );
|
1941 |
+
|
1942 |
+
if ( isset( $user_groups[ $group_id ] ) && 0 === $user_groups[ $group_id ]->inviter_id ) {
|
1943 |
+
$request = $user_groups[ $group_id ]->id;
|
1944 |
+
}
|
1945 |
+
|
1946 |
+
return $request;
|
1947 |
Â
}
|
1948 |
Â
|
1949 |
Â
/**
|
2106 |
Â
add_action( 'wpmu_delete_user', 'groups_remove_data_for_user' );
|
2107 |
Â
add_action( 'delete_user', 'groups_remove_data_for_user' );
|
2108 |
Â
add_action( 'bp_make_spam_user', 'groups_remove_data_for_user' );
|
2109 |
+
|
2110 |
+
/** Group Types ***************************************************************/
|
2111 |
+
|
2112 |
+
/**
|
2113 |
+
* Register a group type.
|
2114 |
+
*
|
2115 |
+
* @since 2.6.0
|
2116 |
+
*
|
2117 |
+
* @param string $group_type Unique string identifier for the group type.
|
2118 |
+
* @param array $args {
|
2119 |
+
* Array of arguments describing the group type.
|
2120 |
+
*
|
2121 |
+
* @type array $labels {
|
2122 |
+
* Array of labels to use in various parts of the interface.
|
2123 |
+
*
|
2124 |
+
* @type string $name Default name. Should typically be plural.
|
2125 |
+
* @type string $singular_name Singular name.
|
2126 |
+
* }
|
2127 |
+
* }
|
2128 |
+
* @return object|WP_Error Group type object on success, WP_Error object on failure.
|
2129 |
+
*/
|
2130 |
+
function bp_groups_register_group_type( $group_type, $args = array() ) {
|
2131 |
+
$bp = buddypress();
|
2132 |
+
|
2133 |
+
if ( isset( $bp->groups->types[ $group_type ] ) ) {
|
2134 |
+
return new WP_Error( 'bp_group_type_exists', __( 'Group type already exists.', 'buddypress' ), $group_type );
|
2135 |
+
}
|
2136 |
+
|
2137 |
+
$r = bp_parse_args( $args, array(
|
2138 |
+
'labels' => array(),
|
2139 |
+
), 'register_group_type' );
|
2140 |
+
|
2141 |
+
$group_type = sanitize_key( $group_type );
|
2142 |
+
|
2143 |
+
/**
|
2144 |
+
* Filters the list of illegal group type names.
|
2145 |
+
*
|
2146 |
+
* - 'any' is a special pseudo-type, representing items unassociated with any group type.
|
2147 |
+
* - 'null' is a special pseudo-type, representing users without any type.
|
2148 |
+
* - '_none' is used internally to denote an item that should not apply to any group types.
|
2149 |
+
*
|
2150 |
+
* @since 2.6.0
|
2151 |
+
*
|
2152 |
+
* @param array $illegal_names Array of illegal names.
|
2153 |
+
*/
|
2154 |
+
$illegal_names = apply_filters( 'bp_group_type_illegal_names', array( 'any', 'null', '_none' ) );
|
2155 |
+
if ( in_array( $group_type, $illegal_names, true ) ) {
|
2156 |
+
return new WP_Error( 'bp_group_type_illegal_name', __( 'You may not register a group type with this name.', 'buddypress' ), $group_type );
|
2157 |
+
}
|
2158 |
+
|
2159 |
+
// Store the group type name as data in the object (not just as the array key).
|
2160 |
+
$r['name'] = $group_type;
|
2161 |
+
|
2162 |
+
// Make sure the relevant labels have been filled in.
|
2163 |
+
$default_name = isset( $r['labels']['name'] ) ? $r['labels']['name'] : ucfirst( $r['name'] );
|
2164 |
+
$r['labels'] = array_merge( array(
|
2165 |
+
'name' => $default_name,
|
2166 |
+
'singular_name' => $default_name,
|
2167 |
+
), $r['labels'] );
|
2168 |
+
|
2169 |
+
$bp->groups->types[ $group_type ] = $type = (object) $r;
|
2170 |
+
|
2171 |
+
/**
|
2172 |
+
* Fires after a group type is registered.
|
2173 |
+
*
|
2174 |
+
* @since 2.6.0
|
2175 |
+
*
|
2176 |
+
* @param string $group_type Group type identifier.
|
2177 |
+
* @param object $type Group type object.
|
2178 |
+
*/
|
2179 |
+
do_action( 'bp_groups_register_group_type', $group_type, $type );
|
2180 |
+
|
2181 |
+
return $type;
|
2182 |
+
}
|
2183 |
+
|
2184 |
+
/**
|
2185 |
+
* Get a list of all registered group type objects.
|
2186 |
+
*
|
2187 |
+
* @since 2.6.0
|
2188 |
+
*
|
2189 |
+
* @see bp_groups_register_group_type() for accepted arguments.
|
2190 |
+
*
|
2191 |
+
* @param array|string $args Optional. An array of key => value arguments to match against
|
2192 |
+
* the group type objects. Default empty array.
|
2193 |
+
* @param string $output Optional. The type of output to return. Accepts 'names'
|
2194 |
+
* or 'objects'. Default 'names'.
|
2195 |
+
* @param string $operator Optional. The logical operation to perform. 'or' means only one
|
2196 |
+
* element from the array needs to match; 'and' means all elements
|
2197 |
+
* must match. Accepts 'or' or 'and'. Default 'and'.
|
2198 |
+
* @return array $types A list of groups type names or objects.
|
2199 |
+
*/
|
2200 |
+
function bp_groups_get_group_types( $args = array(), $output = 'names', $operator = 'and' ) {
|
2201 |
+
$types = buddypress()->groups->types;
|
2202 |
+
|
2203 |
+
$types = wp_filter_object_list( $types, $args, $operator );
|
2204 |
+
|
2205 |
+
/**
|
2206 |
+
* Filters the array of group type objects.
|
2207 |
+
*
|
2208 |
+
* This filter is run before the $output filter has been applied, so that
|
2209 |
+
* filtering functions have access to the entire group type objects.
|
2210 |
+
*
|
2211 |
+
* @since 2.6.0
|
2212 |
+
*
|
2213 |
+
* @param array $types group type objects, keyed by name.
|
2214 |
+
* @param array $args Array of key=>value arguments for filtering.
|
2215 |
+
* @param string $operator 'or' to match any of $args, 'and' to require all.
|
2216 |
+
*/
|
2217 |
+
$types = apply_filters( 'bp_groups_get_group_types', $types, $args, $operator );
|
2218 |
+
|
2219 |
+
if ( 'names' === $output ) {
|
2220 |
+
$types = wp_list_pluck( $types, 'name' );
|
2221 |
+
}
|
2222 |
+
|
2223 |
+
return $types;
|
2224 |
+
}
|
2225 |
+
|
2226 |
+
/**
|
2227 |
+
* Retrieve a group type object by name.
|
2228 |
+
*
|
2229 |
+
* @since 2.6.0
|
2230 |
+
*
|
2231 |
+
* @param string $group_type The name of the group type.
|
2232 |
+
* @return object A group type object.
|
2233 |
+
*/
|
2234 |
+
function bp_groups_get_group_type_object( $group_type ) {
|
2235 |
+
$types = bp_groups_get_group_types( array(), 'objects' );
|
2236 |
+
|
2237 |
+
if ( empty( $types[ $group_type ] ) ) {
|
2238 |
+
return null;
|
2239 |
+
}
|
2240 |
+
|
2241 |
+
return $types[ $group_type ];
|
2242 |
+
}
|
2243 |
+
|
2244 |
+
/**
|
2245 |
+
* Set type for a group.
|
2246 |
+
*
|
2247 |
+
* @since 2.6.0
|
2248 |
+
*
|
2249 |
+
* @param int $group ID of the group.
|
2250 |
+
* @param string $group_type Group type.
|
2251 |
+
* @param bool $append Optional. True to append this to existing types for group,
|
2252 |
+
* false to replace. Default: false.
|
2253 |
+
* @return array $retval See bp_set_object_terms().
|
2254 |
+
*/
|
2255 |
+
function bp_groups_set_group_type( $group_id, $group_type, $append = false ) {
|
2256 |
+
// Pass an empty group type to remove group's type.
|
2257 |
+
if ( ! empty( $group_type ) && ! bp_groups_get_group_type_object( $group_type ) ) {
|
2258 |
+
return false;
|
2259 |
+
}
|
2260 |
+
|
2261 |
+
$retval = bp_set_object_terms( $group_id, $group_type, 'bp_group_type', $append );
|
2262 |
+
|
2263 |
+
// Bust the cache if the type has been updated.
|
2264 |
+
if ( ! is_wp_error( $retval ) ) {
|
2265 |
+
wp_cache_delete( $group_id, 'bp_groups_group_type' );
|
2266 |
+
|
2267 |
+
/**
|
2268 |
+
* Fires just after a group type has been changed.
|
2269 |
+
*
|
2270 |
+
* @since 2.6.0
|
2271 |
+
*
|
2272 |
+
* @param int $group_id ID of the group whose group type has been updated.
|
2273 |
+
* @param string $group_type Group type.
|
2274 |
+
* @param bool $append Whether the type is being appended to existing types.
|
2275 |
+
*/
|
2276 |
+
do_action( 'bp_groups_set_group_type', $group_id, $group_type, $append );
|
2277 |
+
}
|
2278 |
+
|
2279 |
+
return $retval;
|
2280 |
+
}
|
2281 |
+
|
2282 |
+
/**
|
2283 |
+
* Get type for a group.
|
2284 |
+
*
|
2285 |
+
* @since 2.6.0
|
2286 |
+
*
|
2287 |
+
* @param int $group_id ID of the group.
|
2288 |
+
* @param bool $single Optional. Whether to return a single type string. If multiple types are found
|
2289 |
+
* for the group, the oldest one will be returned. Default: true.
|
2290 |
+
* @return string|array|bool On success, returns a single group type (if `$single` is true) or an array of group
|
2291 |
+
* types (if `$single` is false). Returns false on failure.
|
2292 |
+
*/
|
2293 |
+
function bp_groups_get_group_type( $group_id, $single = true ) {
|
2294 |
+
$types = wp_cache_get( $group_id, 'bp_groups_group_type' );
|
2295 |
+
|
2296 |
+
if ( false === $types ) {
|
2297 |
+
$types = bp_get_object_terms( $group_id, 'bp_group_type' );
|
2298 |
+
|
2299 |
+
if ( ! is_wp_error( $types ) ) {
|
2300 |
+
$types = wp_list_pluck( $types, 'name' );
|
2301 |
+
wp_cache_set( $group_id, $types, 'bp_groups_group_type' );
|
2302 |
+
}
|
2303 |
+
}
|
2304 |
+
|
2305 |
+
$type = false;
|
2306 |
+
if ( ! empty( $types ) ) {
|
2307 |
+
if ( $single ) {
|
2308 |
+
$type = end( $types );
|
2309 |
+
} else {
|
2310 |
+
$type = $types;
|
2311 |
+
}
|
2312 |
+
}
|
2313 |
+
|
2314 |
+
/**
|
2315 |
+
* Filters a groups's group type(s).
|
2316 |
+
*
|
2317 |
+
* @since 2.6.0
|
2318 |
+
*
|
2319 |
+
* @param string|array $type Group type.
|
2320 |
+
* @param int $group_id ID of the group.
|
2321 |
+
* @param bool $single Whether to return a single type srting, or an array.
|
2322 |
+
*/
|
2323 |
+
return apply_filters( 'bp_groups_get_group_type', $type, $group_id, $single );
|
2324 |
+
}
|
2325 |
+
|
2326 |
+
/**
|
2327 |
+
* Remove type for a group.
|
2328 |
+
*
|
2329 |
+
* @since 2.6.0
|
2330 |
+
*
|
2331 |
+
* @param int $group ID of the user.
|
2332 |
+
* @param string $group_type Group type.
|
2333 |
+
* @return bool|WP_Error $deleted True on success. False or WP_Error on failure.
|
2334 |
+
*/
|
2335 |
+
function bp_groups_remove_group_type( $group_id, $group_type ) {
|
2336 |
+
if ( empty( $group_type ) || ! bp_groups_get_group_type_object( $group_type ) ) {
|
2337 |
+
return false;
|
2338 |
+
}
|
2339 |
+
|
2340 |
+
$deleted = bp_remove_object_terms( $group_id, $group_type, 'bp_group_type' );
|
2341 |
+
|
2342 |
+
// Bust the case, if the type has been removed.
|
2343 |
+
if ( ! is_wp_error( $deleted ) ) {
|
2344 |
+
wp_cache_delete( $group_id, 'bp_groups_group_type' );
|
2345 |
+
|
2346 |
+
/**
|
2347 |
+
* Fires just after a group's group type has been removed.
|
2348 |
+
*
|
2349 |
+
* @since 2.6.0
|
2350 |
+
*
|
2351 |
+
* @param int $group ID of the group whose group type has been removed.
|
2352 |
+
* @param string $group_type Group type.
|
2353 |
+
*/
|
2354 |
+
do_action( 'bp_groups_remove_group_type', $group_id, $group_type );
|
2355 |
+
}
|
2356 |
+
|
2357 |
+
return $deleted;
|
2358 |
+
}
|
2359 |
+
|
2360 |
+
/**
|
2361 |
+
* Check whether the given group has a certain group type.
|
2362 |
+
*
|
2363 |
+
* @since 2.6.0
|
2364 |
+
*
|
2365 |
+
* @param int $group_id ID of the group.
|
2366 |
+
* @param srting $group_type Group type.
|
2367 |
+
* @return bool Whether the group has the give group type.
|
2368 |
+
*/
|
2369 |
+
function bp_groups_has_group_type( $group_id, $group_type ) {
|
2370 |
+
if ( empty( $group_type ) || ! bp_groups_get_group_type_object( $group_type ) ) {
|
2371 |
+
return false;
|
2372 |
+
}
|
2373 |
+
|
2374 |
+
// Get all group's group types.
|
2375 |
+
$types = bp_groups_get_group_type( $group_id, false );
|
2376 |
+
|
2377 |
+
if ( ! is_array( $types ) ) {
|
2378 |
+
return false;
|
2379 |
+
}
|
2380 |
+
|
2381 |
+
return in_array( $group_type, $types );
|
2382 |
+
}
|
2383 |
+
|
2384 |
+
/**
|
2385 |
+
* Delete a group's type when the group is deleted.
|
2386 |
+
*
|
2387 |
+
* @since 2.6.0
|
2388 |
+
*
|
2389 |
+
* @param int $group_id ID of the group.
|
2390 |
+
* @return array $value See {@see bp_groups_set_group_type()}.
|
2391 |
+
*/
|
2392 |
+
function bp_remove_group_type_on_group_delete( $group_id = 0 ) {
|
2393 |
+
bp_groups_set_group_type( $group_id, '' );
|
2394 |
+
}
|
2395 |
+
add_action( 'groups_delete_group', 'bp_remove_group_type_on_group_delete' );
|
@@ -14,7 +14,9 @@
|
|
14 |
Â
// Exit if accessed directly.
|
15 |
Â
defined( 'ABSPATH' ) || exit;
|
16 |
Â
|
17 |
-
|
Â
|
|
Â
|
|
18 |
Â
|
19 |
Â
/**
|
20 |
Â
* Bootstrap the Notifications component.
|
14 |
Â
// Exit if accessed directly.
|
15 |
Â
defined( 'ABSPATH' ) || exit;
|
16 |
Â
|
17 |
+
if ( ! buddypress()->do_autoload ) {
|
18 |
+
require dirname( __FILE__ ) . '/classes/class-bp-groups-component.php';
|
19 |
+
}
|
20 |
Â
|
21 |
Â
/**
|
22 |
Â
* Bootstrap the Notifications component.
|
@@ -14,7 +14,9 @@
|
|
14 |
Â
// Exit if accessed directly.
|
15 |
Â
defined( 'ABSPATH' ) || exit;
|
16 |
Â
|
17 |
-
|
Â
|
|
Â
|
|
18 |
Â
|
19 |
Â
/**
|
20 |
Â
* Handle the display of the Groups directory index.
|
@@ -688,7 +690,7 @@ function groups_remove_group_invite() {
|
|
688 |
Â
if ( ! bp_groups_user_can_send_invites( $group_id ) ) {
|
689 |
Â
$message = __( 'You are not allowed to send or remove invites', 'buddypress' );
|
690 |
Â
$error = 'error';
|
691 |
-
} elseif (
|
692 |
Â
$message = __( 'The member requested to join the group', 'buddypress' );
|
693 |
Â
$error = 'error';
|
694 |
Â
} elseif ( ! groups_uninvite_user( $friend_id, $group_id ) ) {
|
@@ -1421,7 +1423,12 @@ function groups_screen_notification_settings() {
|
|
1421 |
Â
$group_promo = 'yes';
|
1422 |
Â
|
1423 |
Â
if ( !$group_request = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_membership_request', true ) )
|
1424 |
-
$group_request = 'yes';
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1425 |
Â
|
1426 |
Â
<table class="notification-settings" id="groups-notification-settings">
|
1427 |
Â
<thead>
|
@@ -1437,26 +1444,62 @@ function groups_screen_notification_settings() {
|
|
1437 |
Â
<tr id="groups-notification-settings-invitation">
|
1438 |
Â
<td></td>
|
1439 |
Â
<td><?php _ex( 'A member invites you to join a group', 'group settings on notification settings page','buddypress' ) ?></td>
|
1440 |
-
<td class="yes"><input type="radio" name="notifications[notification_groups_invite]" id="notification-groups-invite-yes" value="yes" <?php checked( $group_invite, 'yes', true ) ?>/><label for="notification-groups-invite-yes" class="bp-screen-reader-text"><?php
|
1441 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1442 |
Â
</tr>
|
1443 |
Â
<tr id="groups-notification-settings-info-updated">
|
1444 |
Â
<td></td>
|
1445 |
Â
<td><?php _ex( 'Group information is updated', 'group settings on notification settings page', 'buddypress' ) ?></td>
|
1446 |
-
<td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" id="notification-groups-group-updated-yes" value="yes" <?php checked( $group_update, 'yes', true ) ?>/><label for="notification-groups-group-updated-yes" class="bp-screen-reader-text"><?php
|
1447 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1448 |
Â
</tr>
|
1449 |
Â
<tr id="groups-notification-settings-promoted">
|
1450 |
Â
<td></td>
|
1451 |
Â
<td><?php _ex( 'You are promoted to a group administrator or moderator', 'group settings on notification settings page', 'buddypress' ) ?></td>
|
1452 |
-
<td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" id="notification-groups-admin-promotion-yes" value="yes" <?php checked( $group_promo, 'yes', true ) ?>/><label for="notification-groups-admin-promotion-yes" class="bp-screen-reader-text"><?php
|
1453 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1454 |
Â
</tr>
|
1455 |
Â
<tr id="groups-notification-settings-request">
|
1456 |
Â
<td></td>
|
1457 |
Â
<td><?php _ex( 'A member requests to join a private group for which you are an admin', 'group settings on notification settings page', 'buddypress' ) ?></td>
|
1458 |
-
<td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" id="notification-groups-membership-request-yes" value="yes" <?php checked( $group_request, 'yes', true ) ?>/><label for="notification-groups-membership-request-yes" class="bp-screen-reader-text"><?php
|
1459 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1460 |
Â
</tr>
|
1461 |
Â
|
1462 |
Â
<?php
|
14 |
Â
// Exit if accessed directly.
|
15 |
Â
defined( 'ABSPATH' ) || exit;
|
16 |
Â
|
17 |
+
if ( ! buddypress()->do_autoload ) {
|
18 |
+
require dirname( __FILE__ ) . '/classes/class-bp-groups-theme-compat.php';
|
19 |
+
}
|
20 |
Â
|
21 |
Â
/**
|
22 |
Â
* Handle the display of the Groups directory index.
|
690 |
Â
if ( ! bp_groups_user_can_send_invites( $group_id ) ) {
|
691 |
Â
$message = __( 'You are not allowed to send or remove invites', 'buddypress' );
|
692 |
Â
$error = 'error';
|
693 |
+
} elseif ( groups_check_for_membership_request( $friend_id, $group_id ) ) {
|
694 |
Â
$message = __( 'The member requested to join the group', 'buddypress' );
|
695 |
Â
$error = 'error';
|
696 |
Â
} elseif ( ! groups_uninvite_user( $friend_id, $group_id ) ) {
|
1423 |
Â
$group_promo = 'yes';
|
1424 |
Â
|
1425 |
Â
if ( !$group_request = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_membership_request', true ) )
|
1426 |
+
$group_request = 'yes';
|
1427 |
+
|
1428 |
+
if ( ! $group_request_completed = bp_get_user_meta( bp_displayed_user_id(), 'notification_membership_request_completed', true ) ) {
|
1429 |
+
$group_request_completed = 'yes';
|
1430 |
+
}
|
1431 |
+
?>
|
1432 |
Â
|
1433 |
Â
<table class="notification-settings" id="groups-notification-settings">
|
1434 |
Â
<thead>
|
1444 |
Â
<tr id="groups-notification-settings-invitation">
|
1445 |
Â
<td></td>
|
1446 |
Â
<td><?php _ex( 'A member invites you to join a group', 'group settings on notification settings page','buddypress' ) ?></td>
|
1447 |
+
<td class="yes"><input type="radio" name="notifications[notification_groups_invite]" id="notification-groups-invite-yes" value="yes" <?php checked( $group_invite, 'yes', true ) ?>/><label for="notification-groups-invite-yes" class="bp-screen-reader-text"><?php
|
1448 |
+
/* translators: accessibility text */
|
1449 |
+
_e( 'Yes, send email', 'buddypress' );
|
1450 |
+
?></label></td>
|
1451 |
+
<td class="no"><input type="radio" name="notifications[notification_groups_invite]" id="notification-groups-invite-no" value="no" <?php checked( $group_invite, 'no', true ) ?>/><label for="notification-groups-invite-no" class="bp-screen-reader-text"><?php
|
1452 |
+
/* translators: accessibility text */
|
1453 |
+
_e( 'No, do not send email', 'buddypress' );
|
1454 |
+
?></label></td>
|
1455 |
Â
</tr>
|
1456 |
Â
<tr id="groups-notification-settings-info-updated">
|
1457 |
Â
<td></td>
|
1458 |
Â
<td><?php _ex( 'Group information is updated', 'group settings on notification settings page', 'buddypress' ) ?></td>
|
1459 |
+
<td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" id="notification-groups-group-updated-yes" value="yes" <?php checked( $group_update, 'yes', true ) ?>/><label for="notification-groups-group-updated-yes" class="bp-screen-reader-text"><?php
|
1460 |
+
/* translators: accessibility text */
|
1461 |
+
_e( 'Yes, send email', 'buddypress' );
|
1462 |
+
?></label></td>
|
1463 |
+
<td class="no"><input type="radio" name="notifications[notification_groups_group_updated]" id="notification-groups-group-updated-no" value="no" <?php checked( $group_update, 'no', true ) ?>/><label for="notification-groups-group-updated-no" class="bp-screen-reader-text"><?php
|
1464 |
+
/* translators: accessibility text */
|
1465 |
+
_e( 'No, do not send email', 'buddypress' );
|
1466 |
+
?></label></td>
|
1467 |
Â
</tr>
|
1468 |
Â
<tr id="groups-notification-settings-promoted">
|
1469 |
Â
<td></td>
|
1470 |
Â
<td><?php _ex( 'You are promoted to a group administrator or moderator', 'group settings on notification settings page', 'buddypress' ) ?></td>
|
1471 |
+
<td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" id="notification-groups-admin-promotion-yes" value="yes" <?php checked( $group_promo, 'yes', true ) ?>/><label for="notification-groups-admin-promotion-yes" class="bp-screen-reader-text"><?php
|
1472 |
+
/* translators: accessibility text */
|
1473 |
+
_e( 'Yes, send email', 'buddypress' );
|
1474 |
+
?></label></td>
|
1475 |
+
<td class="no"><input type="radio" name="notifications[notification_groups_admin_promotion]" id="notification-groups-admin-promotion-no" value="no" <?php checked( $group_promo, 'no', true ) ?>/><label for="notification-groups-admin-promotion-no" class="bp-screen-reader-text"><?php
|
1476 |
+
/* translators: accessibility text */
|
1477 |
+
_e( 'No, do not send email', 'buddypress' );
|
1478 |
+
?></label></td>
|
1479 |
Â
</tr>
|
1480 |
Â
<tr id="groups-notification-settings-request">
|
1481 |
Â
<td></td>
|
1482 |
Â
<td><?php _ex( 'A member requests to join a private group for which you are an admin', 'group settings on notification settings page', 'buddypress' ) ?></td>
|
1483 |
+
<td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" id="notification-groups-membership-request-yes" value="yes" <?php checked( $group_request, 'yes', true ) ?>/><label for="notification-groups-membership-request-yes" class="bp-screen-reader-text"><?php
|
1484 |
+
/* translators: accessibility text */
|
1485 |
+
_e( 'Yes, send email', 'buddypress' );
|
1486 |
+
?></label></td>
|
1487 |
+
<td class="no"><input type="radio" name="notifications[notification_groups_membership_request]" id="notification-groups-membership-request-no" value="no" <?php checked( $group_request, 'no', true ) ?>/><label for="notification-groups-membership-request-no" class="bp-screen-reader-text"><?php
|
1488 |
+
/* translators: accessibility text */
|
1489 |
+
_e( 'No, do not send email', 'buddypress' );
|
1490 |
+
?></label></td>
|
1491 |
+
</tr>
|
1492 |
+
<tr id="groups-notification-settings-request-completed">
|
1493 |
+
<td></td>
|
1494 |
+
<td><?php _ex( 'Your request to join a group has been approved or denied', 'group settings on notification settings page', 'buddypress' ) ?></td>
|
1495 |
+
<td class="yes"><input type="radio" name="notifications[notification_membership_request_completed]" id="notification-groups-membership-request-completed-yes" value="yes" <?php checked( $group_request_completed, 'yes', true ) ?>/><label for="notification-groups-membership-request-completed-yes" class="bp-screen-reader-text"><?php
|
1496 |
+
/* translators: accessibility text */
|
1497 |
+
_e( 'Yes, send email', 'buddypress' );
|
1498 |
+
?></label></td>
|
1499 |
+
<td class="no"><input type="radio" name="notifications[notification_membership_request_completed]" id="notification-groups-membership-request-completed-no" value="no" <?php checked( $group_request_completed, 'no', true ) ?>/><label for="notification-groups-membership-request-completed-no" class="bp-screen-reader-text"><?php
|
1500 |
+
/* translators: accessibility text */
|
1501 |
+
_e( 'No, do not send email', 'buddypress' );
|
1502 |
+
?></label></td>
|
1503 |
Â
</tr>
|
1504 |
Â
|
1505 |
Â
<?php
|
@@ -10,10 +10,12 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
14 |
-
require dirname( __FILE__ ) . '/classes/class-bp-groups-
|
15 |
-
require dirname( __FILE__ ) . '/classes/class-bp-groups-
|
16 |
-
require dirname( __FILE__ ) . '/classes/class-bp-groups-
|
Â
|
|
Â
|
|
17 |
Â
|
18 |
Â
/**
|
19 |
Â
* Output the groups component slug.
|
@@ -100,56 +102,42 @@ function bp_groups_directory_permalink() {
|
|
100 |
Â
* Start the Groups Template Loop.
|
101 |
Â
*
|
102 |
Â
* @since 1.0.0
|
Â
|
|
103 |
Â
*
|
104 |
Â
* @param array|string $args {
|
105 |
Â
* Array of parameters. All items are optional.
|
106 |
-
* @type string $type
|
107 |
-
*
|
108 |
-
*
|
109 |
-
*
|
110 |
-
*
|
111 |
-
*
|
112 |
-
*
|
113 |
-
* @type
|
114 |
-
*
|
115 |
-
*
|
116 |
-
* @type
|
117 |
-
*
|
118 |
-
* @type int $
|
119 |
-
*
|
120 |
-
* @type
|
121 |
-
*
|
122 |
-
*
|
123 |
-
*
|
124 |
-
*
|
125 |
-
*
|
126 |
-
* @type string
|
127 |
-
*
|
128 |
-
*
|
129 |
-
*
|
130 |
-
*
|
131 |
-
*
|
132 |
-
*
|
133 |
-
*
|
134 |
-
*
|
135 |
-
* @type string
|
136 |
-
*
|
137 |
-
*
|
138 |
-
* `$_REQUEST['groups_search']` or
|
139 |
-
* `$_REQUEST['s']`, if present. Otherwise false.
|
140 |
-
* @type array $meta_query An array of meta_query conditions.
|
141 |
-
* See {@link WP_Meta_Query::queries} for description.
|
142 |
-
* @type array|string $include Array or comma-separated list of
|
143 |
-
* group IDs. Results will be limited
|
144 |
-
* to groups within the list. Default: false.
|
145 |
-
* @type bool $populate_extras Whether to fetch additional information
|
146 |
-
* (such as member count) about groups.
|
147 |
-
* Default: true.
|
148 |
-
* @type array|string $exclude Array or comma-separated list of group IDs.
|
149 |
-
* Results will exclude the listed groups.
|
150 |
-
* Default: false.
|
151 |
-
* @type bool $update_meta_cache Whether to fetch groupmeta for queried groups.
|
152 |
-
* Default: true.
|
153 |
Â
* }
|
154 |
Â
* @return bool True if there are groups to display that match the params
|
155 |
Â
*/
|
@@ -193,42 +181,48 @@ function bp_has_groups( $args = '' ) {
|
|
193 |
Â
|
194 |
Â
// Parse defaults and requested arguments.
|
195 |
Â
$r = bp_parse_args( $args, array(
|
196 |
-
'type'
|
197 |
-
'order'
|
198 |
-
'orderby'
|
199 |
-
'page'
|
200 |
-
'per_page'
|
201 |
-
'max'
|
202 |
-
'show_hidden'
|
203 |
-
'page_arg'
|
204 |
-
'user_id'
|
205 |
-
'slug'
|
206 |
-
'search_terms'
|
207 |
-
'
|
208 |
-
'
|
209 |
-
'
|
210 |
-
'
|
211 |
-
'
|
Â
|
|
Â
|
|
Â
|
|
212 |
Â
), 'has_groups' );
|
213 |
Â
|
214 |
Â
// Setup the Groups template global.
|
215 |
Â
$groups_template = new BP_Groups_Template( array(
|
216 |
-
'type'
|
217 |
-
'order'
|
218 |
-
'orderby'
|
219 |
-
'page'
|
220 |
-
'per_page'
|
221 |
-
'max'
|
222 |
-
'show_hidden'
|
223 |
-
'page_arg'
|
224 |
-
'user_id'
|
225 |
-
'slug'
|
226 |
-
'search_terms'
|
227 |
-
'
|
228 |
-
'
|
229 |
-
'
|
230 |
-
'
|
231 |
-
'
|
Â
|
|
Â
|
|
Â
|
|
232 |
Â
) );
|
233 |
Â
|
234 |
Â
/**
|
@@ -597,7 +591,7 @@ function bp_group_avatar( $args = '' ) {
|
|
597 |
Â
'css_id' => $r['id'],
|
598 |
Â
'class' => $r['class'],
|
599 |
Â
'width' => $r['width'],
|
600 |
-
'height' => $r['height']
|
601 |
Â
) );
|
602 |
Â
|
603 |
Â
// If No avatar found, provide some backwards compatibility.
|
@@ -3420,8 +3414,6 @@ function bp_group_create_nav_item() {
|
|
3420 |
Â
*
|
3421 |
Â
* @since 2.2.0
|
3422 |
Â
*
|
3423 |
-
* @uses bp_group_create_nav_item() to output the create a Group nav item.
|
3424 |
-
*
|
3425 |
Â
* @return string HTML Output
|
3426 |
Â
*/
|
3427 |
Â
function bp_group_backcompat_create_nav_item() {
|
@@ -3628,6 +3620,12 @@ function bp_group_has_members( $args = '' ) {
|
|
3628 |
Â
$exclude_admins_mods = 0;
|
3629 |
Â
}
|
3630 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
3631 |
Â
$r = wp_parse_args( $args, array(
|
3632 |
Â
'group_id' => bp_get_current_group_id(),
|
3633 |
Â
'page' => 1,
|
@@ -3637,7 +3635,7 @@ function bp_group_has_members( $args = '' ) {
|
|
3637 |
Â
'exclude_admins_mods' => $exclude_admins_mods,
|
3638 |
Â
'exclude_banned' => 1,
|
3639 |
Â
'group_role' => false,
|
3640 |
-
'search_terms' =>
|
3641 |
Â
'type' => 'last_joined',
|
3642 |
Â
) );
|
3643 |
Â
|
@@ -4304,9 +4302,6 @@ function bp_groups_members_filter() {
|
|
4304 |
Â
*
|
4305 |
Â
* @since 1.5.0
|
4306 |
Â
*
|
4307 |
-
* @uses apply_filters() To call 'bp_user_can_create_groups'.
|
4308 |
-
* @uses bp_get_option() To retrieve value of 'bp_restrict_group_creation'. Defaults to 0.
|
4309 |
-
* @uses bp_current_user_can() To determine if current user if super admin.
|
4310 |
Â
* @return bool True if user can create groups. False otherwise.
|
4311 |
Â
*/
|
4312 |
Â
function bp_user_can_create_groups() {
|
@@ -4703,7 +4698,6 @@ function bp_new_group_avatar( $args = '' ) {
|
|
4703 |
Â
'class' => 'avatar',
|
4704 |
Â
'id' => 'avatar-crop-preview',
|
4705 |
Â
'alt' => __( 'Group photo', 'buddypress' ),
|
4706 |
-
'no_grav' => false
|
4707 |
Â
), 'get_new_group_avatar' );
|
4708 |
Â
|
4709 |
Â
// Merge parsed arguments with object specific data.
|
@@ -4788,7 +4782,6 @@ function bp_groups_current_create_step() {
|
|
4788 |
Â
*
|
4789 |
Â
* @since 1.6.0
|
4790 |
Â
*
|
4791 |
-
* @uses apply_filters() Filter bp_get_groups_current_create_step to modify.
|
4792 |
Â
*
|
4793 |
Â
* @return string $current_create_step
|
4794 |
Â
*/
|
@@ -5068,7 +5061,6 @@ function bp_group_current_admin_tab() {
|
|
5068 |
Â
*
|
5069 |
Â
* @since 1.6.0
|
5070 |
Â
*
|
5071 |
-
* @uses apply_filters() Filter bp_get_current_group_admin_tab to modify return value.
|
5072 |
Â
*
|
5073 |
Â
* @return string $tab The current tab's slug.
|
5074 |
Â
*/
|
@@ -5096,8 +5088,6 @@ function bp_group_current_admin_tab() {
|
|
5096 |
Â
*
|
5097 |
Â
* @since 1.0.0
|
5098 |
Â
*
|
5099 |
-
* @uses bp_get_group_current_avatar() to get the avatar of the current group.
|
5100 |
-
*
|
5101 |
Â
* @param string $type Thumb or full.
|
5102 |
Â
*/
|
5103 |
Â
function bp_group_current_avatar( $type = 'thumb' ) {
|
@@ -5146,14 +5136,17 @@ function bp_get_group_has_avatar( $group_id = false ) {
|
|
5146 |
Â
$group_id = bp_get_current_group_id();
|
5147 |
Â
}
|
5148 |
Â
|
5149 |
-
$
|
5150 |
Â
'item_id' => $group_id,
|
5151 |
Â
'object' => 'group',
|
5152 |
Â
'no_grav' => true,
|
5153 |
Â
'html' => false,
|
5154 |
-
|
Â
|
|
Â
|
|
Â
|
|
5155 |
Â
|
5156 |
-
if ( bp_core_avatar_default( 'local' ) === $group_avatar ) {
|
5157 |
Â
return false;
|
5158 |
Â
}
|
5159 |
Â
|
@@ -5791,7 +5784,6 @@ function bp_current_group_id() {
|
|
5791 |
Â
* Returns the ID of the current group.
|
5792 |
Â
*
|
5793 |
Â
* @since 1.5.0
|
5794 |
-
* @uses apply_filters() Filter bp_get_current_group_id to modify this output.
|
5795 |
Â
*
|
5796 |
Â
* @return int $current_group_id The id of the current group, if there is one.
|
5797 |
Â
*/
|
@@ -5822,7 +5814,6 @@ function bp_current_group_slug() {
|
|
5822 |
Â
* Returns the slug of the current group.
|
5823 |
Â
*
|
5824 |
Â
* @since 1.5.0
|
5825 |
-
* @uses apply_filters() Filter bp_get_current_group_slug to modify this output.
|
5826 |
Â
*
|
5827 |
Â
* @return string $current_group_slug The slug of the current group, if there is one.
|
5828 |
Â
*/
|
@@ -5853,26 +5844,22 @@ function bp_current_group_name() {
|
|
5853 |
Â
* Returns the name of the current group.
|
5854 |
Â
*
|
5855 |
Â
* @since 1.5.0
|
5856 |
-
* @uses apply_filters() Filter bp_get_current_group_name to modify this output.
|
5857 |
Â
*
|
5858 |
Â
* @return string The name of the current group, if there is one.
|
5859 |
Â
*/
|
5860 |
Â
function bp_get_current_group_name() {
|
5861 |
-
$current_group
|
5862 |
-
$
|
5863 |
-
|
5864 |
-
/** This filter is documented in bp-groups/bp-groups-template.php */
|
5865 |
-
$name = apply_filters( 'bp_get_group_name', $current_group_name );
|
5866 |
Â
|
5867 |
Â
/**
|
5868 |
Â
* Filters the name of the current group.
|
5869 |
Â
*
|
5870 |
Â
* @since 1.2.0
|
5871 |
Â
*
|
5872 |
-
* @param string $
|
5873 |
Â
* @param object $current_group Instance holding the current group.
|
5874 |
Â
*/
|
5875 |
-
return apply_filters( 'bp_get_current_group_name', $
|
5876 |
Â
}
|
5877 |
Â
|
5878 |
Â
/**
|
@@ -5887,7 +5874,6 @@ function bp_current_group_description() {
|
|
5887 |
Â
* Returns the description of the current group.
|
5888 |
Â
*
|
5889 |
Â
* @since 2.1.0
|
5890 |
-
* @uses apply_filters() Filter bp_get_current_group_description to modify
|
5891 |
Â
* this output.
|
5892 |
Â
*
|
5893 |
Â
* @return string The description of the current group, if there is one.
|
@@ -5993,7 +5979,6 @@ function bp_groups_action_link( $action = '', $query_args = '', $nonce = false )
|
|
5993 |
Â
*
|
5994 |
Â
* @param array|string $args before|after|user_id
|
5995 |
Â
*
|
5996 |
-
* @uses bp_groups_get_profile_stats() to get the stats.
|
5997 |
Â
*/
|
5998 |
Â
function bp_groups_profile_stats( $args = '' ) {
|
5999 |
Â
echo bp_groups_get_profile_stats( $args );
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-groups-template.php';
|
15 |
+
require dirname( __FILE__ ) . '/classes/class-bp-groups-group-members-template.php';
|
16 |
+
require dirname( __FILE__ ) . '/classes/class-bp-groups-membership-requests-template.php';
|
17 |
+
require dirname( __FILE__ ) . '/classes/class-bp-groups-invite-template.php';
|
18 |
+
}
|
19 |
Â
|
20 |
Â
/**
|
21 |
Â
* Output the groups component slug.
|
102 |
Â
* Start the Groups Template Loop.
|
103 |
Â
*
|
104 |
Â
* @since 1.0.0
|
105 |
+
* @since 2.6.0 Added `$group_type`, `$group_type__in`, and `$group_type__not_in` parameters.
|
106 |
Â
*
|
107 |
Â
* @param array|string $args {
|
108 |
Â
* Array of parameters. All items are optional.
|
109 |
+
* @type string $type Shorthand for certain orderby/order combinations. 'newest', 'active',
|
110 |
+
* 'popular', 'alphabetical', 'random'. When present, will override
|
111 |
+
* orderby and order params. Default: null.
|
112 |
+
* @type string $order Sort order. 'ASC' or 'DESC'. Default: 'DESC'.
|
113 |
+
* @type string $orderby Property to sort by. 'date_created', 'last_activity',
|
114 |
+
* 'total_member_count', 'name', 'random'. Default: 'last_activity'.
|
115 |
+
* @type int $page Page offset of results to return. Default: 1 (first page of results).
|
116 |
+
* @type int $per_page Number of items to return per page of results. Default: 20.
|
117 |
+
* @type int $max Does NOT affect query. May change the reported number of total groups
|
118 |
+
* found, but not the actual number of found groups. Default: false.
|
119 |
+
* @type bool $show_hidden Whether to include hidden groups in results. Default: false.
|
120 |
+
* @type string $page_arg Query argument used for pagination. Default: 'grpage'.
|
121 |
+
* @type int $user_id If provided, results will be limited to groups of which the specified
|
122 |
+
* user is a member. Default: value of bp_displayed_user_id().
|
123 |
+
* @type string $slug If provided, only the group with the matching slug will be returned.
|
124 |
+
* Default: false.
|
125 |
+
* @type string $search_terms If provided, only groups whose names or descriptions match the search
|
126 |
+
* terms will be returned. Default: value of `$_REQUEST['groups_search']` or
|
127 |
+
* `$_REQUEST['s']`, if present. Otherwise false.
|
128 |
+
* @type array|string $group_type Array or comma-separated list of group types to limit results to.
|
129 |
+
* @type array|string $group_type__in Array or comma-separated list of group types to limit results to.
|
130 |
+
* @type array|string $group_type__not_in Array or comma-separated list of group types that will be
|
131 |
+
* excluded from results.
|
132 |
+
* @type array $meta_query An array of meta_query conditions.
|
133 |
+
* See {@link WP_Meta_Query::queries} for description.
|
134 |
+
* @type array|string $include Array or comma-separated list of group IDs. Results will be limited
|
135 |
+
* to groups within the list. Default: false.
|
136 |
+
* @type bool $populate_extras Whether to fetch additional information (such as member count)
|
137 |
+
* about groups. Default: true.
|
138 |
+
* @type array|string $exclude Array or comma-separated list of group IDs. Results will exclude
|
139 |
+
* the listed groups. Default: false.
|
140 |
+
* @type bool $update_meta_cache Whether to fetch groupmeta for queried groups. Default: true.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
141 |
Â
* }
|
142 |
Â
* @return bool True if there are groups to display that match the params
|
143 |
Â
*/
|
181 |
Â
|
182 |
Â
// Parse defaults and requested arguments.
|
183 |
Â
$r = bp_parse_args( $args, array(
|
184 |
+
'type' => $type,
|
185 |
+
'order' => 'DESC',
|
186 |
+
'orderby' => 'last_activity',
|
187 |
+
'page' => 1,
|
188 |
+
'per_page' => 20,
|
189 |
+
'max' => false,
|
190 |
+
'show_hidden' => false,
|
191 |
+
'page_arg' => 'grpage',
|
192 |
+
'user_id' => bp_displayed_user_id(),
|
193 |
+
'slug' => $slug,
|
194 |
+
'search_terms' => $search_terms,
|
195 |
+
'group_type' => '',
|
196 |
+
'group_type__in' => '',
|
197 |
+
'group_type__not_in' => '',
|
198 |
+
'meta_query' => false,
|
199 |
+
'include' => false,
|
200 |
+
'exclude' => false,
|
201 |
+
'populate_extras' => true,
|
202 |
+
'update_meta_cache' => true,
|
203 |
Â
), 'has_groups' );
|
204 |
Â
|
205 |
Â
// Setup the Groups template global.
|
206 |
Â
$groups_template = new BP_Groups_Template( array(
|
207 |
+
'type' => $r['type'],
|
208 |
+
'order' => $r['order'],
|
209 |
+
'orderby' => $r['orderby'],
|
210 |
+
'page' => (int) $r['page'],
|
211 |
+
'per_page' => (int) $r['per_page'],
|
212 |
+
'max' => (int) $r['max'],
|
213 |
+
'show_hidden' => $r['show_hidden'],
|
214 |
+
'page_arg' => $r['page_arg'],
|
215 |
+
'user_id' => (int) $r['user_id'],
|
216 |
+
'slug' => $r['slug'],
|
217 |
+
'search_terms' => $r['search_terms'],
|
218 |
+
'group_type' => $r['group_type'],
|
219 |
+
'group_type__in' => $r['group_type__in'],
|
220 |
+
'group_type__not_in' => $r['group_type__not_in'],
|
221 |
+
'meta_query' => $r['meta_query'],
|
222 |
+
'include' => $r['include'],
|
223 |
+
'exclude' => $r['exclude'],
|
224 |
+
'populate_extras' => (bool) $r['populate_extras'],
|
225 |
+
'update_meta_cache' => (bool) $r['update_meta_cache'],
|
226 |
Â
) );
|
227 |
Â
|
228 |
Â
/**
|
591 |
Â
'css_id' => $r['id'],
|
592 |
Â
'class' => $r['class'],
|
593 |
Â
'width' => $r['width'],
|
594 |
+
'height' => $r['height'],
|
595 |
Â
) );
|
596 |
Â
|
597 |
Â
// If No avatar found, provide some backwards compatibility.
|
3414 |
Â
*
|
3415 |
Â
* @since 2.2.0
|
3416 |
Â
*
|
Â
|
|
Â
|
|
3417 |
Â
* @return string HTML Output
|
3418 |
Â
*/
|
3419 |
Â
function bp_group_backcompat_create_nav_item() {
|
3620 |
Â
$exclude_admins_mods = 0;
|
3621 |
Â
}
|
3622 |
Â
|
3623 |
+
$search_terms_default = null;
|
3624 |
+
$search_query_arg = bp_core_get_component_search_query_arg( 'members' );
|
3625 |
+
if ( ! empty( $_REQUEST[ $search_query_arg ] ) ) {
|
3626 |
+
$search_terms_default = stripslashes( $_REQUEST[ $search_query_arg ] );
|
3627 |
+
}
|
3628 |
+
|
3629 |
Â
$r = wp_parse_args( $args, array(
|
3630 |
Â
'group_id' => bp_get_current_group_id(),
|
3631 |
Â
'page' => 1,
|
3635 |
Â
'exclude_admins_mods' => $exclude_admins_mods,
|
3636 |
Â
'exclude_banned' => 1,
|
3637 |
Â
'group_role' => false,
|
3638 |
+
'search_terms' => $search_terms_default,
|
3639 |
Â
'type' => 'last_joined',
|
3640 |
Â
) );
|
3641 |
Â
|
4302 |
Â
*
|
4303 |
Â
* @since 1.5.0
|
4304 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
4305 |
Â
* @return bool True if user can create groups. False otherwise.
|
4306 |
Â
*/
|
4307 |
Â
function bp_user_can_create_groups() {
|
4698 |
Â
'class' => 'avatar',
|
4699 |
Â
'id' => 'avatar-crop-preview',
|
4700 |
Â
'alt' => __( 'Group photo', 'buddypress' ),
|
Â
|
|
4701 |
Â
), 'get_new_group_avatar' );
|
4702 |
Â
|
4703 |
Â
// Merge parsed arguments with object specific data.
|
4782 |
Â
*
|
4783 |
Â
* @since 1.6.0
|
4784 |
Â
*
|
Â
|
|
4785 |
Â
*
|
4786 |
Â
* @return string $current_create_step
|
4787 |
Â
*/
|
5061 |
Â
*
|
5062 |
Â
* @since 1.6.0
|
5063 |
Â
*
|
Â
|
|
5064 |
Â
*
|
5065 |
Â
* @return string $tab The current tab's slug.
|
5066 |
Â
*/
|
5088 |
Â
*
|
5089 |
Â
* @since 1.0.0
|
5090 |
Â
*
|
Â
|
|
Â
|
|
5091 |
Â
* @param string $type Thumb or full.
|
5092 |
Â
*/
|
5093 |
Â
function bp_group_current_avatar( $type = 'thumb' ) {
|
5136 |
Â
$group_id = bp_get_current_group_id();
|
5137 |
Â
}
|
5138 |
Â
|
5139 |
+
$avatar_args = array(
|
5140 |
Â
'item_id' => $group_id,
|
5141 |
Â
'object' => 'group',
|
5142 |
Â
'no_grav' => true,
|
5143 |
Â
'html' => false,
|
5144 |
+
'type' => 'thumb',
|
5145 |
+
);
|
5146 |
+
|
5147 |
+
$group_avatar = bp_core_fetch_avatar( $avatar_args );
|
5148 |
Â
|
5149 |
+
if ( bp_core_avatar_default( 'local', $avatar_args ) === $group_avatar ) {
|
5150 |
Â
return false;
|
5151 |
Â
}
|
5152 |
Â
|
5784 |
Â
* Returns the ID of the current group.
|
5785 |
Â
*
|
5786 |
Â
* @since 1.5.0
|
Â
|
|
5787 |
Â
*
|
5788 |
Â
* @return int $current_group_id The id of the current group, if there is one.
|
5789 |
Â
*/
|
5814 |
Â
* Returns the slug of the current group.
|
5815 |
Â
*
|
5816 |
Â
* @since 1.5.0
|
Â
|
|
5817 |
Â
*
|
5818 |
Â
* @return string $current_group_slug The slug of the current group, if there is one.
|
5819 |
Â
*/
|
5844 |
Â
* Returns the name of the current group.
|
5845 |
Â
*
|
5846 |
Â
* @since 1.5.0
|
Â
|
|
5847 |
Â
*
|
5848 |
Â
* @return string The name of the current group, if there is one.
|
5849 |
Â
*/
|
5850 |
Â
function bp_get_current_group_name() {
|
5851 |
+
$current_group = groups_get_current_group();
|
5852 |
+
$current_name = bp_get_group_name( $current_group );
|
Â
|
|
Â
|
|
Â
|
|
5853 |
Â
|
5854 |
Â
/**
|
5855 |
Â
* Filters the name of the current group.
|
5856 |
Â
*
|
5857 |
Â
* @since 1.2.0
|
5858 |
Â
*
|
5859 |
+
* @param string $current_name Name of the current group.
|
5860 |
Â
* @param object $current_group Instance holding the current group.
|
5861 |
Â
*/
|
5862 |
+
return apply_filters( 'bp_get_current_group_name', $current_name, $current_group );
|
5863 |
Â
}
|
5864 |
Â
|
5865 |
Â
/**
|
5874 |
Â
* Returns the description of the current group.
|
5875 |
Â
*
|
5876 |
Â
* @since 2.1.0
|
Â
|
|
5877 |
Â
* this output.
|
5878 |
Â
*
|
5879 |
Â
* @return string The description of the current group, if there is one.
|
5979 |
Â
*
|
5980 |
Â
* @param array|string $args before|after|user_id
|
5981 |
Â
*
|
Â
|
|
5982 |
Â
*/
|
5983 |
Â
function bp_groups_profile_stats( $args = '' ) {
|
5984 |
Â
echo bp_groups_get_profile_stats( $args );
|
@@ -10,7 +10,9 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Register widgets for groups component.
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-groups-widget.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Register widgets for groups component.
|
@@ -737,7 +737,7 @@ class BP_Group_Extension {
|
|
737 |
Â
'screen_function' => array( &$this, '_display_hook' ),
|
738 |
Â
'user_has_access' => $user_can_see_nav_item,
|
739 |
Â
'no_access_url' => $group_permalink,
|
740 |
-
) );
|
741 |
Â
}
|
742 |
Â
|
743 |
Â
// If the user can visit the screen, we register it.
|
@@ -752,7 +752,7 @@ class BP_Group_Extension {
|
|
752 |
Â
'screen_function' => array( &$this, '_display_hook' ),
|
753 |
Â
'user_has_access' => $user_can_visit,
|
754 |
Â
'no_access_url' => $group_permalink,
|
755 |
-
) );
|
756 |
Â
|
757 |
Â
// When we are viewing the extension display page, set the title and options title.
|
758 |
Â
if ( bp_is_current_action( $this->slug ) ) {
|
@@ -967,7 +967,7 @@ class BP_Group_Extension {
|
|
967 |
Â
}
|
968 |
Â
|
969 |
Â
// Add the tab to the manage navigation.
|
970 |
-
bp_core_new_subnav_item( $subnav_args );
|
971 |
Â
|
972 |
Â
// Catch the edit screen and forward it to the plugin template.
|
973 |
Â
if ( bp_is_groups_component() && bp_is_current_action( 'admin' ) && bp_is_action_variable( $screen['slug'], 0 ) ) {
|
737 |
Â
'screen_function' => array( &$this, '_display_hook' ),
|
738 |
Â
'user_has_access' => $user_can_see_nav_item,
|
739 |
Â
'no_access_url' => $group_permalink,
|
740 |
+
), 'groups' );
|
741 |
Â
}
|
742 |
Â
|
743 |
Â
// If the user can visit the screen, we register it.
|
752 |
Â
'screen_function' => array( &$this, '_display_hook' ),
|
753 |
Â
'user_has_access' => $user_can_visit,
|
754 |
Â
'no_access_url' => $group_permalink,
|
755 |
+
), 'groups' );
|
756 |
Â
|
757 |
Â
// When we are viewing the extension display page, set the title and options title.
|
758 |
Â
if ( bp_is_current_action( $this->slug ) ) {
|
967 |
Â
}
|
968 |
Â
|
969 |
Â
// Add the tab to the manage navigation.
|
970 |
+
bp_core_new_subnav_item( $subnav_args, 'groups' );
|
971 |
Â
|
972 |
Â
// Catch the edit screen and forward it to the plugin template.
|
973 |
Â
if ( bp_is_groups_component() && bp_is_current_action( 'admin' ) && bp_is_action_variable( $screen['slug'], 0 ) ) {
|
@@ -74,6 +74,16 @@ class BP_Groups_Component extends BP_Component {
|
|
74 |
Â
*/
|
75 |
Â
public $valid_status;
|
76 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
77 |
Â
/**
|
78 |
Â
* Start the groups component creation process.
|
79 |
Â
*
|
@@ -107,7 +117,6 @@ class BP_Groups_Component extends BP_Component {
|
|
107 |
Â
'actions',
|
108 |
Â
'filters',
|
109 |
Â
'screens',
|
110 |
-
'classes',
|
111 |
Â
'widgets',
|
112 |
Â
'activity',
|
113 |
Â
'template',
|
@@ -116,6 +125,10 @@ class BP_Groups_Component extends BP_Component {
|
|
116 |
Â
'notifications'
|
117 |
Â
);
|
118 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
119 |
Â
if ( is_admin() ) {
|
120 |
Â
$includes[] = 'admin';
|
121 |
Â
}
|
@@ -250,6 +263,9 @@ class BP_Groups_Component extends BP_Component {
|
|
250 |
Â
// Check once if the current group has a custom front template.
|
251 |
Â
$this->current_group->front_template = bp_groups_get_front_template( $this->current_group );
|
252 |
Â
|
Â
|
|
Â
|
|
Â
|
|
253 |
Â
// Set current_group to 0 to prevent debug errors.
|
254 |
Â
} else {
|
255 |
Â
$this->current_group = 0;
|
@@ -432,8 +448,17 @@ class BP_Groups_Component extends BP_Component {
|
|
432 |
Â
|
433 |
Â
// Only grab count if we're on a user page.
|
434 |
Â
if ( bp_is_user() ) {
|
435 |
-
$class
|
436 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
437 |
Â
} else {
|
438 |
Â
$nav_name = _x( 'Groups', 'Group screen nav without counter', 'buddypress' );
|
439 |
Â
}
|
@@ -484,15 +509,18 @@ class BP_Groups_Component extends BP_Component {
|
|
484 |
Â
// Reset sub nav.
|
485 |
Â
$sub_nav = array();
|
486 |
Â
|
487 |
-
|
488 |
-
|
Â
|
|
Â
|
|
Â
|
|
489 |
Â
'name' => __( 'Memberships', 'buddypress' ),
|
490 |
Â
'slug' => $this->current_group->slug,
|
491 |
Â
'position' => -1, // Do not show in BuddyBar.
|
492 |
Â
'screen_function' => 'groups_screen_group_home',
|
493 |
Â
'default_subnav_slug' => $this->default_extension,
|
494 |
Â
'item_css_id' => $this->id
|
495 |
-
);
|
496 |
Â
|
497 |
Â
$group_link = bp_get_group_permalink( $this->current_group );
|
498 |
Â
|
@@ -663,7 +691,9 @@ class BP_Groups_Component extends BP_Component {
|
|
663 |
Â
), $default_params );
|
664 |
Â
}
|
665 |
Â
|
666 |
-
|
Â
|
|
Â
|
|
667 |
Â
}
|
668 |
Â
|
669 |
Â
if ( isset( $this->current_group->user_has_access ) ) {
|
@@ -707,8 +737,17 @@ class BP_Groups_Component extends BP_Component {
|
|
707 |
Â
$pending = _x( 'No Pending Invites', 'My Account Groups sub nav', 'buddypress' );
|
708 |
Â
|
709 |
Â
if ( ! empty( $count['total'] ) ) {
|
710 |
-
$title
|
711 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
712 |
Â
}
|
713 |
Â
|
714 |
Â
// Add the "My Account" sub menus.
|
@@ -806,9 +845,23 @@ class BP_Groups_Component extends BP_Component {
|
|
806 |
Â
'bp_groups',
|
807 |
Â
'bp_group_admins',
|
808 |
Â
'bp_group_invite_count',
|
809 |
-
'group_meta'
|
Â
|
|
Â
|
|
810 |
Â
) );
|
811 |
Â
|
812 |
Â
parent::setup_cache_groups();
|
813 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
814 |
Â
}
|
74 |
Â
*/
|
75 |
Â
public $valid_status;
|
76 |
Â
|
77 |
+
/**
|
78 |
+
* Group types.
|
79 |
+
*
|
80 |
+
* @see bp_groups_register_group_type()
|
81 |
+
*
|
82 |
+
* @since 2.6.0
|
83 |
+
* @var array
|
84 |
+
*/
|
85 |
+
public $types = array();
|
86 |
+
|
87 |
Â
/**
|
88 |
Â
* Start the groups component creation process.
|
89 |
Â
*
|
117 |
Â
'actions',
|
118 |
Â
'filters',
|
119 |
Â
'screens',
|
Â
|
|
120 |
Â
'widgets',
|
121 |
Â
'activity',
|
122 |
Â
'template',
|
125 |
Â
'notifications'
|
126 |
Â
);
|
127 |
Â
|
128 |
+
if ( ! buddypress()->do_autoload ) {
|
129 |
+
$includes[] = 'classes';
|
130 |
+
}
|
131 |
+
|
132 |
Â
if ( is_admin() ) {
|
133 |
Â
$includes[] = 'admin';
|
134 |
Â
}
|
263 |
Â
// Check once if the current group has a custom front template.
|
264 |
Â
$this->current_group->front_template = bp_groups_get_front_template( $this->current_group );
|
265 |
Â
|
266 |
+
// Initialize the nav for the groups component.
|
267 |
+
$this->nav = new BP_Core_Nav( $this->current_group->id );
|
268 |
+
|
269 |
Â
// Set current_group to 0 to prevent debug errors.
|
270 |
Â
} else {
|
271 |
Â
$this->current_group = 0;
|
448 |
Â
|
449 |
Â
// Only grab count if we're on a user page.
|
450 |
Â
if ( bp_is_user() ) {
|
451 |
+
$class = ( 0 === groups_total_groups_for_user( bp_displayed_user_id() ) ) ? 'no-count' : 'count';
|
452 |
+
|
453 |
+
$nav_name = sprintf(
|
454 |
+
/* translators: %s: Group count for the current user */
|
455 |
+
_x( 'Groups %s', 'Group screen nav with counter', 'buddypress' ),
|
456 |
+
sprintf(
|
457 |
+
'<span class="%s">%s</span>',
|
458 |
+
esc_attr( $class ),
|
459 |
+
bp_get_total_group_count_for_user()
|
460 |
+
)
|
461 |
+
);
|
462 |
Â
} else {
|
463 |
Â
$nav_name = _x( 'Groups', 'Group screen nav without counter', 'buddypress' );
|
464 |
Â
}
|
509 |
Â
// Reset sub nav.
|
510 |
Â
$sub_nav = array();
|
511 |
Â
|
512 |
+
/*
|
513 |
+
* The top-level Groups item is called 'Memberships' for legacy reasons.
|
514 |
+
* It does not appear in the interface.
|
515 |
+
*/
|
516 |
+
bp_core_new_nav_item( array(
|
517 |
Â
'name' => __( 'Memberships', 'buddypress' ),
|
518 |
Â
'slug' => $this->current_group->slug,
|
519 |
Â
'position' => -1, // Do not show in BuddyBar.
|
520 |
Â
'screen_function' => 'groups_screen_group_home',
|
521 |
Â
'default_subnav_slug' => $this->default_extension,
|
522 |
Â
'item_css_id' => $this->id
|
523 |
+
), 'groups' );
|
524 |
Â
|
525 |
Â
$group_link = bp_get_group_permalink( $this->current_group );
|
526 |
Â
|
691 |
Â
), $default_params );
|
692 |
Â
}
|
693 |
Â
|
694 |
+
foreach ( $sub_nav as $nav ) {
|
695 |
+
bp_core_new_subnav_item( $nav, 'groups' );
|
696 |
+
}
|
697 |
Â
}
|
698 |
Â
|
699 |
Â
if ( isset( $this->current_group->user_has_access ) ) {
|
737 |
Â
$pending = _x( 'No Pending Invites', 'My Account Groups sub nav', 'buddypress' );
|
738 |
Â
|
739 |
Â
if ( ! empty( $count['total'] ) ) {
|
740 |
+
$title = sprintf(
|
741 |
+
/* translators: %s: Group invitation count for the current user */
|
742 |
+
_x( 'Groups %s', 'My Account Groups nav', 'buddypress' ),
|
743 |
+
'<span class="count">' . bp_core_number_format( $count ) . '</span>'
|
744 |
+
);
|
745 |
+
|
746 |
+
$pending = sprintf(
|
747 |
+
/* translators: %s: Group invitation count for the current user */
|
748 |
+
_x( 'Pending Invites %s', 'My Account Groups sub nav', 'buddypress' ),
|
749 |
+
'<span class="count">' . bp_core_number_format( $count ) . '</span>'
|
750 |
+
);
|
751 |
Â
}
|
752 |
Â
|
753 |
Â
// Add the "My Account" sub menus.
|
845 |
Â
'bp_groups',
|
846 |
Â
'bp_group_admins',
|
847 |
Â
'bp_group_invite_count',
|
848 |
+
'group_meta',
|
849 |
+
'bp_groups_memberships',
|
850 |
+
'bp_groups_memberships_for_user',
|
851 |
Â
) );
|
852 |
Â
|
853 |
Â
parent::setup_cache_groups();
|
854 |
Â
}
|
855 |
+
|
856 |
+
/**
|
857 |
+
* Set up taxonomies.
|
858 |
+
*
|
859 |
+
* @since 2.6.0
|
860 |
+
*/
|
861 |
+
public function register_taxonomies() {
|
862 |
+
// Group Type.
|
863 |
+
register_taxonomy( 'bp_group_type', 'bp_group', array(
|
864 |
+
'public' => false,
|
865 |
+
) );
|
866 |
+
}
|
867 |
Â
}
|
@@ -245,9 +245,9 @@ class BP_Groups_Group {
|
|
245 |
Â
|
246 |
Â
// Set user-specific data.
|
247 |
Â
$user_id = bp_loggedin_user_id();
|
248 |
-
$this->is_member =
|
249 |
-
$this->is_invited =
|
250 |
-
$this->is_pending =
|
251 |
Â
|
252 |
Â
// If this is a private or hidden group, does the current user have access?
|
253 |
Â
if ( ( 'private' === $this->status ) || ( 'hidden' === $this->status ) ) {
|
@@ -683,39 +683,40 @@ class BP_Groups_Group {
|
|
683 |
Â
* parameter format.
|
684 |
Â
*
|
685 |
Â
* @since 1.6.0
|
Â
|
|
686 |
Â
*
|
687 |
Â
* @param array $args {
|
688 |
Â
* Array of parameters. All items are optional.
|
689 |
-
* @type string $type
|
690 |
-
*
|
691 |
-
*
|
692 |
-
*
|
693 |
-
* @type string $orderby
|
694 |
-
*
|
695 |
-
*
|
696 |
-
* @type
|
697 |
-
*
|
698 |
-
* @type int $
|
699 |
-
*
|
700 |
-
* @type int $
|
701 |
-
*
|
702 |
-
* @type
|
703 |
-
*
|
704 |
-
* @type string
|
705 |
-
*
|
706 |
-
*
|
707 |
-
*
|
708 |
-
*
|
709 |
-
*
|
710 |
-
*
|
711 |
-
*
|
712 |
-
* @type bool $populate_extras
|
713 |
-
*
|
714 |
-
* @type array|string $exclude
|
715 |
-
*
|
716 |
-
* @type bool $update_meta_cache
|
717 |
-
*
|
718 |
-
* @type bool $show_hidden
|
719 |
Â
* }
|
720 |
Â
* @return array {
|
721 |
Â
* @type array $groups Array of group objects returned by the
|
@@ -748,19 +749,22 @@ class BP_Groups_Group {
|
|
748 |
Â
}
|
749 |
Â
|
750 |
Â
$defaults = array(
|
751 |
-
'type'
|
752 |
-
'orderby'
|
753 |
-
'order'
|
754 |
-
'per_page'
|
755 |
-
'page'
|
756 |
-
'user_id'
|
757 |
-
'search_terms'
|
758 |
-
'
|
759 |
-
'
|
760 |
-
'
|
761 |
-
'
|
762 |
-
'
|
763 |
-
'
|
Â
|
|
Â
|
|
Â
|
|
764 |
Â
);
|
765 |
Â
|
766 |
Â
$r = wp_parse_args( $args, $defaults );
|
@@ -804,6 +808,24 @@ class BP_Groups_Group {
|
|
804 |
Â
$sql['meta'] = $meta_query_sql['where'];
|
805 |
Â
}
|
806 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
807 |
Â
if ( ! empty( $r['user_id'] ) ) {
|
808 |
Â
$sql['user'] = $wpdb->prepare( " AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0", $r['user_id'] );
|
809 |
Â
}
|
@@ -915,6 +937,11 @@ class BP_Groups_Group {
|
|
915 |
Â
$total_sql['where'][] = $meta_query_clause;
|
916 |
Â
}
|
917 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
918 |
Â
// Already escaped in the paginated results block.
|
919 |
Â
if ( ! empty( $include ) ) {
|
920 |
Â
$total_sql['where'][] = "g.id IN ({$include})";
|
@@ -1395,68 +1422,13 @@ class BP_Groups_Group {
|
|
1395 |
Â
* @return array $paged_groups
|
1396 |
Â
*/
|
1397 |
Â
public static function get_group_extras( &$paged_groups, &$group_ids, $type = false ) {
|
1398 |
-
|
1399 |
-
|
1400 |
-
if ( empty( $group_ids ) )
|
1401 |
-
return $paged_groups;
|
1402 |
-
|
1403 |
-
$bp = buddypress();
|
1404 |
-
|
1405 |
-
// Sanitize group IDs.
|
1406 |
-
$group_ids = implode( ',', wp_parse_id_list( $group_ids ) );
|
1407 |
-
|
1408 |
-
// Fetch the logged-in user's status within each group.
|
1409 |
-
if ( is_user_logged_in() ) {
|
1410 |
-
$user_status_results = $wpdb->get_results( $wpdb->prepare( "SELECT group_id, is_confirmed, invite_sent FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id IN ( {$group_ids} ) AND is_banned = 0", bp_loggedin_user_id() ) );
|
1411 |
-
} else {
|
1412 |
-
$user_status_results = array();
|
1413 |
-
}
|
1414 |
-
|
1415 |
-
// Reindex.
|
1416 |
-
$user_status = array();
|
1417 |
-
foreach ( $user_status_results as $user_status_result ) {
|
1418 |
-
$user_status[ $user_status_result->group_id ] = $user_status_result;
|
1419 |
-
}
|
1420 |
-
|
1421 |
-
for ( $i = 0, $count = count( $paged_groups ); $i < $count; ++$i ) {
|
1422 |
-
$is_member = $is_invited = $is_pending = '0';
|
1423 |
-
$gid = $paged_groups[ $i ]->id;
|
1424 |
-
|
1425 |
-
if ( isset( $user_status[ $gid ] ) ) {
|
1426 |
-
|
1427 |
-
// The is_confirmed means the user is a member.
|
1428 |
-
if ( $user_status[ $gid ]->is_confirmed ) {
|
1429 |
-
$is_member = '1';
|
1430 |
-
|
1431 |
-
// The invite_sent means the user has been invited.
|
1432 |
-
} elseif ( $user_status[ $gid ]->invite_sent ) {
|
1433 |
-
$is_invited = '1';
|
1434 |
Â
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
$paged_groups[ $i ]->is_member = $is_member;
|
1442 |
-
$paged_groups[ $i ]->is_invited = $is_invited;
|
1443 |
-
$paged_groups[ $i ]->is_pending = $is_pending;
|
1444 |
-
}
|
1445 |
-
|
1446 |
-
if ( is_user_logged_in() ) {
|
1447 |
-
$user_banned = $wpdb->get_col( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE is_banned = 1 AND user_id = %d AND group_id IN ( {$group_ids} )", bp_loggedin_user_id() ) );
|
1448 |
-
} else {
|
1449 |
-
$user_banned = array();
|
1450 |
-
}
|
1451 |
-
|
1452 |
-
for ( $i = 0, $count = count( $paged_groups ); $i < $count; ++$i ) {
|
1453 |
-
$paged_groups[$i]->is_banned = false;
|
1454 |
-
|
1455 |
-
foreach ( (array) $user_banned as $group_id ) {
|
1456 |
-
if ( $group_id == $paged_groups[$i]->id ) {
|
1457 |
-
$paged_groups[$i]->is_banned = true;
|
1458 |
-
}
|
1459 |
-
}
|
1460 |
Â
}
|
1461 |
Â
|
1462 |
Â
return $paged_groups;
|
@@ -1624,4 +1596,73 @@ class BP_Groups_Group {
|
|
1624 |
Â
|
1625 |
Â
return $ids;
|
1626 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1627 |
Â
}
|
245 |
Â
|
246 |
Â
// Set user-specific data.
|
247 |
Â
$user_id = bp_loggedin_user_id();
|
248 |
+
$this->is_member = groups_is_user_member( $user_id, $this->id );
|
249 |
+
$this->is_invited = groups_check_user_has_invite( $user_id, $this->id );
|
250 |
+
$this->is_pending = groups_check_for_membership_request( $user_id, $this->id );
|
251 |
Â
|
252 |
Â
// If this is a private or hidden group, does the current user have access?
|
253 |
Â
if ( ( 'private' === $this->status ) || ( 'hidden' === $this->status ) ) {
|
683 |
Â
* parameter format.
|
684 |
Â
*
|
685 |
Â
* @since 1.6.0
|
686 |
+
* @since 2.6.0 Added `$group_type`, `$group_type__in`, and `$group_type__not_in` parameters.
|
687 |
Â
*
|
688 |
Â
* @param array $args {
|
689 |
Â
* Array of parameters. All items are optional.
|
690 |
+
* @type string $type Optional. Shorthand for certain orderby/order combinations.
|
691 |
+
* 'newest', 'active', 'popular', 'alphabetical', 'random'.
|
692 |
+
* When present, will override orderby and order params.
|
693 |
+
* Default: null.
|
694 |
+
* @type string $orderby Optional. Property to sort by. 'date_created', 'last_activity',
|
695 |
+
* 'total_member_count', 'name', 'random'. Default: 'date_created'.
|
696 |
+
* @type string $order Optional. Sort order. 'ASC' or 'DESC'. Default: 'DESC'.
|
697 |
+
* @type int $per_page Optional. Number of items to return per page of results.
|
698 |
+
* Default: null (no limit).
|
699 |
+
* @type int $page Optional. Page offset of results to return.
|
700 |
+
* Default: null (no limit).
|
701 |
+
* @type int $user_id Optional. If provided, results will be limited to groups
|
702 |
+
* of which the specified user is a member. Default: null.
|
703 |
+
* @type string $search_terms Optional. If provided, only groups whose names or descriptions
|
704 |
+
* match the search terms will be returned. Default: false.
|
705 |
+
* @type array|string $group_type Array or comma-separated list of group types to limit results to.
|
706 |
+
* @type array|string $group_type__in Array or comma-separated list of group types to limit results to.
|
707 |
+
* @type array|string $group_type__not_in Array or comma-separated list of group types that will be
|
708 |
+
* excluded from results.
|
709 |
+
* @type array $meta_query Optional. An array of meta_query conditions.
|
710 |
+
* See {@link WP_Meta_Query::queries} for description.
|
711 |
+
* @type array|string $value Optional. Array or comma-separated list of group IDs. Results
|
712 |
+
* will be limited to groups within the list. Default: false.
|
713 |
+
* @type bool $populate_extras Whether to fetch additional information
|
714 |
+
* (such as member count) about groups. Default: true.
|
715 |
+
* @type array|string $exclude Optional. Array or comma-separated list of group IDs.
|
716 |
+
* Results will exclude the listed groups. Default: false.
|
717 |
+
* @type bool $update_meta_cache Whether to pre-fetch groupmeta for the returned groups.
|
718 |
+
* Default: true.
|
719 |
+
* @type bool $show_hidden Whether to include hidden groups in results. Default: false.
|
720 |
Â
* }
|
721 |
Â
* @return array {
|
722 |
Â
* @type array $groups Array of group objects returned by the
|
749 |
Â
}
|
750 |
Â
|
751 |
Â
$defaults = array(
|
752 |
+
'type' => null,
|
753 |
+
'orderby' => 'date_created',
|
754 |
+
'order' => 'DESC',
|
755 |
+
'per_page' => null,
|
756 |
+
'page' => null,
|
757 |
+
'user_id' => 0,
|
758 |
+
'search_terms' => false,
|
759 |
+
'group_type' => '',
|
760 |
+
'group_type__in' => '',
|
761 |
+
'group_type__not_in' => '',
|
762 |
+
'meta_query' => false,
|
763 |
+
'include' => false,
|
764 |
+
'populate_extras' => true,
|
765 |
+
'update_meta_cache' => true,
|
766 |
+
'exclude' => false,
|
767 |
+
'show_hidden' => false,
|
768 |
Â
);
|
769 |
Â
|
770 |
Â
$r = wp_parse_args( $args, $defaults );
|
808 |
Â
$sql['meta'] = $meta_query_sql['where'];
|
809 |
Â
}
|
810 |
Â
|
811 |
+
// Only use 'group_type__in', if 'group_type' is not set.
|
812 |
+
if ( empty( $r['group_type'] ) && ! empty( $r['group_type__in']) ) {
|
813 |
+
$r['group_type'] = $r['group_type__in'];
|
814 |
+
}
|
815 |
+
|
816 |
+
// Group types to exclude. This has priority over inclusions.
|
817 |
+
if ( ! empty( $r['group_type__not_in'] ) ) {
|
818 |
+
$group_type_clause = self::get_sql_clause_for_group_types( $r['group_type__not_in'], 'NOT IN' );
|
819 |
+
|
820 |
+
// Group types to include.
|
821 |
+
} elseif ( ! empty( $r['group_type'] ) ) {
|
822 |
+
$group_type_clause = self::get_sql_clause_for_group_types( $r['group_type'], 'IN' );
|
823 |
+
}
|
824 |
+
|
825 |
+
if ( ! empty( $group_type_clause ) ) {
|
826 |
+
$sql['group_type'] = $group_type_clause;
|
827 |
+
}
|
828 |
+
|
829 |
Â
if ( ! empty( $r['user_id'] ) ) {
|
830 |
Â
$sql['user'] = $wpdb->prepare( " AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0", $r['user_id'] );
|
831 |
Â
}
|
937 |
Â
$total_sql['where'][] = $meta_query_clause;
|
938 |
Â
}
|
939 |
Â
|
940 |
+
// Trim leading 'AND' to match `$total_sql` query style.
|
941 |
+
if ( ! empty( $group_type_clause ) ) {
|
942 |
+
$total_sql['where'][] = preg_replace( '/^\s*AND\s*/', '', $group_type_clause );
|
943 |
+
}
|
944 |
+
|
945 |
Â
// Already escaped in the paginated results block.
|
946 |
Â
if ( ! empty( $include ) ) {
|
947 |
Â
$total_sql['where'][] = "g.id IN ({$include})";
|
1422 |
Â
* @return array $paged_groups
|
1423 |
Â
*/
|
1424 |
Â
public static function get_group_extras( &$paged_groups, &$group_ids, $type = false ) {
|
1425 |
+
$user_id = bp_loggedin_user_id();
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1426 |
Â
|
1427 |
+
foreach ( $paged_groups as &$group ) {
|
1428 |
+
$group->is_member = groups_is_user_member( $user_id, $group->id ) ? '1' : '0';
|
1429 |
+
$group->is_invited = groups_is_user_invited( $user_id, $group->id ) ? '1' : '0';
|
1430 |
+
$group->is_pending = groups_is_user_pending( $user_id, $group->id ) ? '1' : '0';
|
1431 |
+
$group->is_banned = (bool) groups_is_user_banned( $user_id, $group->id );
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1432 |
Â
}
|
1433 |
Â
|
1434 |
Â
return $paged_groups;
|
1596 |
Â
|
1597 |
Â
return $ids;
|
1598 |
Â
}
|
1599 |
+
|
1600 |
+
/**
|
1601 |
+
* Get SQL clause for group type(s).
|
1602 |
+
*
|
1603 |
+
* @since 2.6.0
|
1604 |
+
*
|
1605 |
+
* @param string|array $group_types Group type(s).
|
1606 |
+
* @param string $operator 'IN' or 'NOT IN'.
|
1607 |
+
* @return string $clause SQL clause.
|
1608 |
+
*/
|
1609 |
+
protected static function get_sql_clause_for_group_types( $group_types, $operator ) {
|
1610 |
+
global $wpdb;
|
1611 |
+
|
1612 |
+
// Sanitize operator.
|
1613 |
+
if ( 'NOT IN' !== $operator ) {
|
1614 |
+
$operator = 'IN';
|
1615 |
+
}
|
1616 |
+
|
1617 |
+
// Parse and sanitize types.
|
1618 |
+
if ( ! is_array( $group_types ) ) {
|
1619 |
+
$group_types = preg_split( '/[,\s+]/', $group_types );
|
1620 |
+
}
|
1621 |
+
|
1622 |
+
$types = array();
|
1623 |
+
foreach ( $group_types as $gt ) {
|
1624 |
+
if ( bp_groups_get_group_type_object( $gt ) ) {
|
1625 |
+
$types[] = $gt;
|
1626 |
+
}
|
1627 |
+
}
|
1628 |
+
|
1629 |
+
$tax_query = new WP_Tax_Query( array(
|
1630 |
+
array(
|
1631 |
+
'taxonomy' => 'bp_group_type',
|
1632 |
+
'field' => 'name',
|
1633 |
+
'operator' => $operator,
|
1634 |
+
'terms' => $types,
|
1635 |
+
),
|
1636 |
+
) );
|
1637 |
+
|
1638 |
+
$site_id = bp_get_taxonomy_term_site_id( 'bp_group_type' );
|
1639 |
+
$switched = false;
|
1640 |
+
if ( $site_id !== get_current_blog_id() ) {
|
1641 |
+
switch_to_blog( $site_id );
|
1642 |
+
$switched = true;
|
1643 |
+
}
|
1644 |
+
|
1645 |
+
$sql_clauses = $tax_query->get_sql( 'g', 'id' );
|
1646 |
+
|
1647 |
+
if ( $switched ) {
|
1648 |
+
restore_current_blog();
|
1649 |
+
}
|
1650 |
+
|
1651 |
+
$clause = '';
|
1652 |
+
|
1653 |
+
// The no_results clauses are the same between IN and NOT IN.
|
1654 |
+
if ( false !== strpos( $sql_clauses['where'], '0 = 1' ) ) {
|
1655 |
+
$clause = $sql_clauses['where'];
|
1656 |
+
|
1657 |
+
// The tax_query clause generated for NOT IN can be used almost as-is.
|
1658 |
+
} elseif ( 'NOT IN' === $operator ) {
|
1659 |
+
$clause = $sql_clauses['where'];
|
1660 |
+
|
1661 |
+
// IN clauses must be converted to a subquery.
|
1662 |
+
} elseif ( preg_match( '/' . $wpdb->term_relationships . '\.term_taxonomy_id IN \([0-9, ]+\)/', $sql_clauses['where'], $matches ) ) {
|
1663 |
+
$clause = " AND g.id IN ( SELECT object_id FROM $wpdb->term_relationships WHERE {$matches[0]} )";
|
1664 |
+
}
|
1665 |
+
|
1666 |
+
return $clause;
|
1667 |
+
}
|
1668 |
Â
}
|
@@ -216,7 +216,10 @@ class BP_Groups_List_Table extends WP_List_Table {
|
|
216 |
Â
public function display() {
|
217 |
Â
$this->display_tablenav( 'top' ); ?>
|
218 |
Â
|
219 |
-
<h2 class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
220 |
Â
|
221 |
Â
<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
|
222 |
Â
<thead>
|
@@ -225,15 +228,15 @@ class BP_Groups_List_Table extends WP_List_Table {
|
|
225 |
Â
</tr>
|
226 |
Â
</thead>
|
227 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
228 |
Â
<tfoot>
|
229 |
Â
<tr>
|
230 |
Â
<?php $this->print_column_headers( false ); ?>
|
231 |
Â
</tr>
|
232 |
Â
</tfoot>
|
233 |
-
|
234 |
-
<tbody id="the-comment-list">
|
235 |
-
<?php $this->display_rows_or_placeholder(); ?>
|
236 |
-
</tbody>
|
237 |
Â
</table>
|
238 |
Â
<?php
|
239 |
Â
|
@@ -284,7 +287,10 @@ class BP_Groups_List_Table extends WP_List_Table {
|
|
284 |
Â
public function get_views() {
|
285 |
Â
$url_base = bp_get_admin_url( 'admin.php?page=bp-groups' ); ?>
|
286 |
Â
|
287 |
-
<h2 class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
288 |
Â
|
289 |
Â
<ul class="subsubsub">
|
290 |
Â
<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>
|
@@ -422,6 +428,7 @@ class BP_Groups_List_Table extends WP_List_Table {
|
|
422 |
Â
* @param array $item A singular item (one full row).
|
423 |
Â
*/
|
424 |
Â
public function column_cb( $item = array() ) {
|
Â
|
|
425 |
Â
printf( '<label class="screen-reader-text" for="gid-%1$d">' . __( 'Select group %1$d', 'buddypress' ) . '</label><input type="checkbox" name="gid[]" value="%1$d" id="gid-%1$d" />', $item['id'] );
|
426 |
Â
}
|
427 |
Â
|
216 |
Â
public function display() {
|
217 |
Â
$this->display_tablenav( 'top' ); ?>
|
218 |
Â
|
219 |
+
<h2 class="screen-reader-text"><?php
|
220 |
+
/* translators: accessibility text */
|
221 |
+
_e( 'Groups list', 'buddypress' );
|
222 |
+
?></h2>
|
223 |
Â
|
224 |
Â
<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
|
225 |
Â
<thead>
|
228 |
Â
</tr>
|
229 |
Â
</thead>
|
230 |
Â
|
231 |
+
<tbody id="the-comment-list">
|
232 |
+
<?php $this->display_rows_or_placeholder(); ?>
|
233 |
+
</tbody>
|
234 |
+
|
235 |
Â
<tfoot>
|
236 |
Â
<tr>
|
237 |
Â
<?php $this->print_column_headers( false ); ?>
|
238 |
Â
</tr>
|
239 |
Â
</tfoot>
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
240 |
Â
</table>
|
241 |
Â
<?php
|
242 |
Â
|
287 |
Â
public function get_views() {
|
288 |
Â
$url_base = bp_get_admin_url( 'admin.php?page=bp-groups' ); ?>
|
289 |
Â
|
290 |
+
<h2 class="screen-reader-text"><?php
|
291 |
+
/* translators: accessibility text */
|
292 |
+
_e( 'Filter groups list', 'buddypress' );
|
293 |
+
?></h2>
|
294 |
Â
|
295 |
Â
<ul class="subsubsub">
|
296 |
Â
<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>
|
428 |
Â
* @param array $item A singular item (one full row).
|
429 |
Â
*/
|
430 |
Â
public function column_cb( $item = array() ) {
|
431 |
+
/* translators: accessibility text */
|
432 |
Â
printf( '<label class="screen-reader-text" for="gid-%1$d">' . __( 'Select group %1$d', 'buddypress' ) . '</label><input type="checkbox" name="gid[]" value="%1$d" id="gid-%1$d" />', $item['id'] );
|
433 |
Â
}
|
434 |
Â
|
@@ -821,6 +821,16 @@ class BP_Groups_Member {
|
|
821 |
Â
return false;
|
822 |
Â
}
|
823 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
824 |
Â
$table_name = buddypress()->groups->table_name_members;
|
825 |
Â
|
826 |
Â
$sql = "DELETE FROM {$table_name}
|
@@ -1052,6 +1062,23 @@ class BP_Groups_Member {
|
|
1052 |
Â
return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_mod = 1 AND is_banned = 0", $group_id ) );
|
1053 |
Â
}
|
1054 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1055 |
Â
/**
|
1056 |
Â
* Get the IDs users with outstanding membership requests to the group.
|
1057 |
Â
*
|
@@ -1160,6 +1187,24 @@ class BP_Groups_Member {
|
|
1160 |
Â
return array( 'members' => $members, 'count' => $total_member_count );
|
1161 |
Â
}
|
1162 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1163 |
Â
/**
|
1164 |
Â
* Delete all memberships for a given group.
|
1165 |
Â
*
|
821 |
Â
return false;
|
822 |
Â
}
|
823 |
Â
|
824 |
+
/**
|
825 |
+
* Fires before a group invitation is deleted.
|
826 |
+
*
|
827 |
+
* @since 2.6.0
|
828 |
+
*
|
829 |
+
* @param int $user_id ID of the user.
|
830 |
+
* @param int $group_id ID of the group.
|
831 |
+
*/
|
832 |
+
do_action( 'bp_groups_member_before_delete_invite', $user_id, $group_id );
|
833 |
+
|
834 |
Â
$table_name = buddypress()->groups->table_name_members;
|
835 |
Â
|
836 |
Â
$sql = "DELETE FROM {$table_name}
|
1062 |
Â
return $wpdb->get_results( $wpdb->prepare( "SELECT user_id, date_modified FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_mod = 1 AND is_banned = 0", $group_id ) );
|
1063 |
Â
}
|
1064 |
Â
|
1065 |
+
/**
|
1066 |
+
* Get group membership objects by ID (or an array of IDs).
|
1067 |
+
*
|
1068 |
+
* @since 2.6.0
|
1069 |
+
*
|
1070 |
+
* @param int|string|array $membership_ids Single membership ID or comma-separated/array list of membership IDs.
|
1071 |
+
* @return array
|
1072 |
+
*/
|
1073 |
+
public static function get_memberships_by_id( $membership_ids ) {
|
1074 |
+
global $wpdb;
|
1075 |
+
|
1076 |
+
$bp = buddypress();
|
1077 |
+
|
1078 |
+
$membership_ids = implode( ',', wp_parse_id_list( $membership_ids ) );
|
1079 |
+
return $wpdb->get_results( "SELECT * FROM {$bp->groups->table_name_members} WHERE id IN ({$membership_ids})" );
|
1080 |
+
}
|
1081 |
+
|
1082 |
Â
/**
|
1083 |
Â
* Get the IDs users with outstanding membership requests to the group.
|
1084 |
Â
*
|
1187 |
Â
return array( 'members' => $members, 'count' => $total_member_count );
|
1188 |
Â
}
|
1189 |
Â
|
1190 |
+
/**
|
1191 |
+
* Get all membership IDs for a user.
|
1192 |
+
*
|
1193 |
+
* @since 2.6.0
|
1194 |
+
*
|
1195 |
+
* @param int $user_id ID of the user.
|
1196 |
+
* @return array
|
1197 |
+
*/
|
1198 |
+
public static function get_membership_ids_for_user( $user_id ) {
|
1199 |
+
global $wpdb;
|
1200 |
+
|
1201 |
+
$bp = buddypress();
|
1202 |
+
|
1203 |
+
$group_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d ORDER BY id ASC", $user_id ) );
|
1204 |
+
|
1205 |
+
return $group_ids;
|
1206 |
+
}
|
1207 |
+
|
1208 |
Â
/**
|
1209 |
Â
* Delete all memberships for a given group.
|
1210 |
Â
*
|
@@ -153,22 +153,25 @@ class BP_Groups_Template {
|
|
153 |
Â
}
|
154 |
Â
|
155 |
Â
$defaults = array(
|
156 |
-
'page'
|
157 |
-
'per_page'
|
158 |
-
'page_arg'
|
159 |
-
'max'
|
160 |
-
'type'
|
161 |
-
'order'
|
162 |
-
'orderby'
|
163 |
-
'show_hidden'
|
164 |
-
'user_id'
|
165 |
-
'slug'
|
166 |
-
'include'
|
167 |
-
'exclude'
|
168 |
-
'search_terms'
|
169 |
-
'
|
170 |
-
'
|
171 |
-
'
|
Â
|
|
Â
|
|
Â
|
|
172 |
Â
);
|
173 |
Â
|
174 |
Â
$r = wp_parse_args( $args, $defaults );
|
@@ -210,19 +213,22 @@ class BP_Groups_Template {
|
|
210 |
Â
|
211 |
Â
} else {
|
212 |
Â
$this->groups = groups_get_groups( array(
|
213 |
-
'type'
|
214 |
-
'order'
|
215 |
-
'orderby'
|
216 |
-
'per_page'
|
217 |
-
'page'
|
218 |
-
'user_id'
|
219 |
-
'search_terms'
|
220 |
-
'meta_query'
|
221 |
-
'
|
222 |
-
'
|
223 |
-
'
|
224 |
-
'
|
225 |
-
'
|
Â
|
|
Â
|
|
Â
|
|
226 |
Â
) );
|
227 |
Â
}
|
228 |
Â
|
153 |
Â
}
|
154 |
Â
|
155 |
Â
$defaults = array(
|
156 |
+
'page' => 1,
|
157 |
+
'per_page' => 20,
|
158 |
+
'page_arg' => 'grpage',
|
159 |
+
'max' => false,
|
160 |
+
'type' => 'active',
|
161 |
+
'order' => 'DESC',
|
162 |
+
'orderby' => 'date_created',
|
163 |
+
'show_hidden' => false,
|
164 |
+
'user_id' => 0,
|
165 |
+
'slug' => false,
|
166 |
+
'include' => false,
|
167 |
+
'exclude' => false,
|
168 |
+
'search_terms' => '',
|
169 |
+
'group_type' => '',
|
170 |
+
'group_type__in' => '',
|
171 |
+
'group_type__not_in' => '',
|
172 |
+
'meta_query' => false,
|
173 |
+
'populate_extras' => true,
|
174 |
+
'update_meta_cache' => true,
|
175 |
Â
);
|
176 |
Â
|
177 |
Â
$r = wp_parse_args( $args, $defaults );
|
213 |
Â
|
214 |
Â
} else {
|
215 |
Â
$this->groups = groups_get_groups( array(
|
216 |
+
'type' => $type,
|
217 |
+
'order' => $order,
|
218 |
+
'orderby' => $orderby,
|
219 |
+
'per_page' => $this->pag_num,
|
220 |
+
'page' => $this->pag_page,
|
221 |
+
'user_id' => $user_id,
|
222 |
+
'search_terms' => $search_terms,
|
223 |
+
'meta_query' => $meta_query,
|
224 |
+
'group_type' => $group_type,
|
225 |
+
'group_type__in' => $group_type__in,
|
226 |
+
'group_type__not_in' => $group_type__not_in,
|
227 |
+
'include' => $include,
|
228 |
+
'exclude' => $exclude,
|
229 |
+
'populate_extras' => $populate_extras,
|
230 |
+
'update_meta_cache' => $update_meta_cache,
|
231 |
+
'show_hidden' => $show_hidden,
|
232 |
Â
) );
|
233 |
Â
}
|
234 |
Â
|
@@ -24,17 +24,27 @@ class BP_Groups_Widget extends WP_Widget {
|
|
24 |
Â
*/
|
25 |
Â
public function __construct() {
|
26 |
Â
$widget_ops = array(
|
27 |
-
'description'
|
28 |
-
'classname'
|
Â
|
|
29 |
Â
);
|
30 |
Â
parent::__construct( false, _x( '(BuddyPress) Groups', 'widget name', 'buddypress' ), $widget_ops );
|
31 |
Â
|
32 |
-
if ( is_active_widget( false, false, $this->id_base )
|
33 |
-
$
|
34 |
-
wp_enqueue_script( 'groups_widget_groups_list-js', buddypress()->plugin_url . "bp-groups/js/widget-groups{$min}.js", array( 'jquery' ), bp_get_version() );
|
35 |
Â
}
|
36 |
Â
}
|
37 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
38 |
Â
/**
|
39 |
Â
* Extends our frontend output method.
|
40 |
Â
*
|
24 |
Â
*/
|
25 |
Â
public function __construct() {
|
26 |
Â
$widget_ops = array(
|
27 |
+
'description' => __( 'A dynamic list of recently active, popular, and newest groups', 'buddypress' ),
|
28 |
+
'classname' => 'widget_bp_groups_widget buddypress widget',
|
29 |
+
'customize_selective_refresh' => true,
|
30 |
Â
);
|
31 |
Â
parent::__construct( false, _x( '(BuddyPress) Groups', 'widget name', 'buddypress' ), $widget_ops );
|
32 |
Â
|
33 |
+
if ( is_customize_preview() || is_active_widget( false, false, $this->id_base ) ) {
|
34 |
+
add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
Â
|
|
35 |
Â
}
|
36 |
Â
}
|
37 |
Â
|
38 |
+
/**
|
39 |
+
* Enqueue scripts.
|
40 |
+
*
|
41 |
+
* @since 2.6.0
|
42 |
+
*/
|
43 |
+
public function enqueue_scripts() {
|
44 |
+
$min = bp_core_get_minified_asset_suffix();
|
45 |
+
wp_enqueue_script( 'groups_widget_groups_list-js', buddypress()->plugin_url . "bp-groups/js/widget-groups{$min}.js", array( 'jquery' ), bp_get_version() );
|
46 |
+
}
|
47 |
+
|
48 |
Â
/**
|
49 |
Â
* Extends our frontend output method.
|
50 |
Â
*
|
@@ -1,4 +1,15 @@
|
|
1 |
Â
jQuery(document).ready( function() {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2 |
Â
jQuery('.widget div#groups-list-options a').on('click',
|
3 |
Â
function() {
|
4 |
Â
var link = this;
|
@@ -23,7 +34,7 @@ jQuery(document).ready( function() {
|
|
23 |
Â
return false;
|
24 |
Â
}
|
25 |
Â
);
|
26 |
-
}
|
27 |
Â
|
28 |
Â
function groups_widget_response(response) {
|
29 |
Â
response = response.substr(0, response.length-1);
|
1 |
Â
jQuery(document).ready( function() {
|
2 |
+
groups_widget_click_handler();
|
3 |
+
|
4 |
+
// WP 4.5 - Customizer selective refresh support.
|
5 |
+
if ( 'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh ) {
|
6 |
+
wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() {
|
7 |
+
groups_widget_click_handler();
|
8 |
+
} );
|
9 |
+
}
|
10 |
+
});
|
11 |
+
|
12 |
+
function groups_widget_click_handler() {
|
13 |
Â
jQuery('.widget div#groups-list-options a').on('click',
|
14 |
Â
function() {
|
15 |
Â
var link = this;
|
34 |
Â
return false;
|
35 |
Â
}
|
36 |
Â
);
|
37 |
+
}
|
38 |
Â
|
39 |
Â
function groups_widget_response(response) {
|
40 |
Â
response = response.substr(0, response.length-1);
|
@@ -1,2 +1 @@
|
|
1 |
-
|
2 |
-
function groups_widget_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_widget_response(b)}),!1})});
|
1 |
+
function groups_widget_click_handler(){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_widget_response(b)}),!1})}function groups_widget_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(){groups_widget_click_handler(),"undefined"!=typeof wp&&wp.customize&&wp.customize.selectiveRefresh&&wp.customize.selectiveRefresh.bind("partial-content-rendered",function(){groups_widget_click_handler()})});
|
Â
|
@@ -15,7 +15,7 @@
|
|
15 |
Â
* Description: BuddyPress helps you build any type of community website using WordPress, with member profiles, activity streams, user groups, messaging, and more.
|
16 |
Â
* Author: The BuddyPress Community
|
17 |
Â
* Author URI: https://buddypress.org/
|
18 |
-
* Version: 2.
|
19 |
Â
* Text Domain: buddypress
|
20 |
Â
* Domain Path: /bp-languages/
|
21 |
Â
* License: GPLv2 or later (license.txt)
|
@@ -101,6 +101,22 @@ class BuddyPress {
|
|
101 |
Â
*/
|
102 |
Â
public $active_components = array();
|
103 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
104 |
Â
/** Option Overload *******************************************************/
|
105 |
Â
|
106 |
Â
/**
|
@@ -123,11 +139,6 @@ class BuddyPress {
|
|
123 |
Â
* @since 1.7.0
|
124 |
Â
*
|
125 |
Â
* @static object $instance
|
126 |
-
* @uses BuddyPress::constants() Setup the constants (mostly deprecated).
|
127 |
-
* @uses BuddyPress::setup_globals() Setup the globals needed.
|
128 |
-
* @uses BuddyPress::legacy_constants() Setup the legacy constants (deprecated).
|
129 |
-
* @uses BuddyPress::includes() Include the required files.
|
130 |
-
* @uses BuddyPress::setup_actions() Setup the hooks and actions.
|
131 |
Â
* @see buddypress()
|
132 |
Â
*
|
133 |
Â
* @return BuddyPress The one true BuddyPress.
|
@@ -238,11 +249,6 @@ class BuddyPress {
|
|
238 |
Â
*
|
239 |
Â
* @since 1.6.0
|
240 |
Â
*
|
241 |
-
* @uses is_multisite()
|
242 |
-
* @uses get_current_site()
|
243 |
-
* @uses get_current_blog_id()
|
244 |
-
* @uses plugin_dir_path()
|
245 |
-
* @uses plugin_dir_url()
|
246 |
Â
*/
|
247 |
Â
private function constants() {
|
248 |
Â
|
@@ -319,15 +325,12 @@ class BuddyPress {
|
|
319 |
Â
*
|
320 |
Â
* @since 1.6.0
|
321 |
Â
*
|
322 |
-
* @uses plugin_dir_path() To generate BuddyPress plugin path.
|
323 |
-
* @uses plugin_dir_url() To generate BuddyPress plugin url.
|
324 |
-
* @uses apply_filters() Calls various filters.
|
325 |
Â
*/
|
326 |
Â
private function setup_globals() {
|
327 |
Â
|
328 |
Â
/** Versions **********************************************************/
|
329 |
Â
|
330 |
-
$this->version = '2.
|
331 |
Â
$this->db_version = 10469;
|
332 |
Â
|
333 |
Â
/** Loading ***********************************************************/
|
@@ -426,6 +429,12 @@ class BuddyPress {
|
|
426 |
Â
/** Post types and taxonomies *****************************************/
|
427 |
Â
$this->email_post_type = apply_filters( 'bp_email_post_type', 'bp-email' );
|
428 |
Â
$this->email_taxonomy_type = apply_filters( 'bp_email_tax_type', 'bp-email-type' );
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
429 |
Â
}
|
430 |
Â
|
431 |
Â
/**
|
@@ -454,9 +463,12 @@ class BuddyPress {
|
|
454 |
Â
*
|
455 |
Â
* @since 1.6.0
|
456 |
Â
*
|
457 |
-
* @uses is_admin() If in WordPress admin, load additional file.
|
458 |
Â
*/
|
459 |
Â
private function includes() {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
460 |
Â
|
461 |
Â
// Load the WP abstraction file so BuddyPress can run on all WordPress setups.
|
462 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-wpabstraction.php' );
|
@@ -478,7 +490,6 @@ class BuddyPress {
|
|
478 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-cssjs.php' );
|
479 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-update.php' );
|
480 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-options.php' );
|
481 |
-
require( $this->plugin_dir . 'bp-core/bp-core-classes.php' );
|
482 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-taxonomy.php' );
|
483 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-filters.php' );
|
484 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-attachments.php' );
|
@@ -488,12 +499,15 @@ class BuddyPress {
|
|
488 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-adminbar.php' );
|
489 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-buddybar.php' );
|
490 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-catchuri.php' );
|
491 |
-
require( $this->plugin_dir . 'bp-core/bp-core-component.php' );
|
492 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-functions.php' );
|
493 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-moderation.php' );
|
494 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-loader.php' );
|
495 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-customizer-email.php' );
|
496 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
497 |
Â
// Skip or load deprecated content
|
498 |
Â
if ( false !== $this->load_deprecated ) {
|
499 |
Â
require( $this->plugin_dir . 'bp-core/deprecated/1.2.php' );
|
@@ -507,17 +521,110 @@ class BuddyPress {
|
|
507 |
Â
require( $this->plugin_dir . 'bp-core/deprecated/2.3.php' );
|
508 |
Â
require( $this->plugin_dir . 'bp-core/deprecated/2.4.php' );
|
509 |
Â
require( $this->plugin_dir . 'bp-core/deprecated/2.5.php' );
|
Â
|
|
510 |
Â
}
|
511 |
Â
}
|
512 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
513 |
Â
/**
|
514 |
Â
* Set up the default hooks and actions.
|
515 |
Â
*
|
516 |
Â
* @since 1.6.0
|
517 |
Â
*
|
518 |
-
* @uses register_activation_hook() To register the activation hook.
|
519 |
-
* @uses register_deactivation_hook() To register the deactivation hook.
|
520 |
-
* @uses add_action() To add various actions.
|
521 |
Â
*/
|
522 |
Â
private function setup_actions() {
|
523 |
Â
|
15 |
Â
* Description: BuddyPress helps you build any type of community website using WordPress, with member profiles, activity streams, user groups, messaging, and more.
|
16 |
Â
* Author: The BuddyPress Community
|
17 |
Â
* Author URI: https://buddypress.org/
|
18 |
+
* Version: 2.6.0-rc1
|
19 |
Â
* Text Domain: buddypress
|
20 |
Â
* Domain Path: /bp-languages/
|
21 |
Â
* License: GPLv2 or later (license.txt)
|
101 |
Â
*/
|
102 |
Â
public $active_components = array();
|
103 |
Â
|
104 |
+
/**
|
105 |
+
* Whether autoload is in use.
|
106 |
+
*
|
107 |
+
* @since 2.5.0
|
108 |
+
* @var bool
|
109 |
+
*/
|
110 |
+
public $do_autoload = false;
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Whether to load backward compatibility classes for navigation globals.
|
114 |
+
*
|
115 |
+
* @since 2.6.0
|
116 |
+
* @var bool
|
117 |
+
*/
|
118 |
+
public $do_nav_backcompat = false;
|
119 |
+
|
120 |
Â
/** Option Overload *******************************************************/
|
121 |
Â
|
122 |
Â
/**
|
139 |
Â
* @since 1.7.0
|
140 |
Â
*
|
141 |
Â
* @static object $instance
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
142 |
Â
* @see buddypress()
|
143 |
Â
*
|
144 |
Â
* @return BuddyPress The one true BuddyPress.
|
249 |
Â
*
|
250 |
Â
* @since 1.6.0
|
251 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
252 |
Â
*/
|
253 |
Â
private function constants() {
|
254 |
Â
|
325 |
Â
*
|
326 |
Â
* @since 1.6.0
|
327 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
328 |
Â
*/
|
329 |
Â
private function setup_globals() {
|
330 |
Â
|
331 |
Â
/** Versions **********************************************************/
|
332 |
Â
|
333 |
+
$this->version = '2.6.0-rc1';
|
334 |
Â
$this->db_version = 10469;
|
335 |
Â
|
336 |
Â
/** Loading ***********************************************************/
|
429 |
Â
/** Post types and taxonomies *****************************************/
|
430 |
Â
$this->email_post_type = apply_filters( 'bp_email_post_type', 'bp-email' );
|
431 |
Â
$this->email_taxonomy_type = apply_filters( 'bp_email_tax_type', 'bp-email-type' );
|
432 |
+
|
433 |
+
/** Navigation backward compatibility *********************************/
|
434 |
+
if ( interface_exists( 'ArrayAccess', false ) ) {
|
435 |
+
// bp_nav and bp_options_nav compatibility depends on SPL.
|
436 |
+
$this->do_nav_backcompat = true;
|
437 |
+
}
|
438 |
Â
}
|
439 |
Â
|
440 |
Â
/**
|
463 |
Â
*
|
464 |
Â
* @since 1.6.0
|
465 |
Â
*
|
Â
|
|
466 |
Â
*/
|
467 |
Â
private function includes() {
|
468 |
+
if ( function_exists( 'spl_autoload_register' ) ) {
|
469 |
+
spl_autoload_register( array( $this, 'autoload' ) );
|
470 |
+
$this->do_autoload = true;
|
471 |
+
}
|
472 |
Â
|
473 |
Â
// Load the WP abstraction file so BuddyPress can run on all WordPress setups.
|
474 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-wpabstraction.php' );
|
490 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-cssjs.php' );
|
491 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-update.php' );
|
492 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-options.php' );
|
Â
|
|
493 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-taxonomy.php' );
|
494 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-filters.php' );
|
495 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-attachments.php' );
|
499 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-adminbar.php' );
|
500 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-buddybar.php' );
|
501 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-catchuri.php' );
|
Â
|
|
502 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-functions.php' );
|
503 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-moderation.php' );
|
504 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-loader.php' );
|
505 |
Â
require( $this->plugin_dir . 'bp-core/bp-core-customizer-email.php' );
|
506 |
Â
|
507 |
+
if ( ! $this->do_autoload ) {
|
508 |
+
require( $this->plugin_dir . 'bp-core/bp-core-classes.php' );
|
509 |
+
}
|
510 |
+
|
511 |
Â
// Skip or load deprecated content
|
512 |
Â
if ( false !== $this->load_deprecated ) {
|
513 |
Â
require( $this->plugin_dir . 'bp-core/deprecated/1.2.php' );
|
521 |
Â
require( $this->plugin_dir . 'bp-core/deprecated/2.3.php' );
|
522 |
Â
require( $this->plugin_dir . 'bp-core/deprecated/2.4.php' );
|
523 |
Â
require( $this->plugin_dir . 'bp-core/deprecated/2.5.php' );
|
524 |
+
require( $this->plugin_dir . 'bp-core/deprecated/2.6.php' );
|
525 |
Â
}
|
526 |
Â
}
|
527 |
Â
|
528 |
+
/**
|
529 |
+
* Autoload classes.
|
530 |
+
*
|
531 |
+
* @since 2.5.0
|
532 |
+
*
|
533 |
+
* @param string $class
|
534 |
+
*/
|
535 |
+
public function autoload( $class ) {
|
536 |
+
$class_parts = explode( '_', strtolower( $class ) );
|
537 |
+
|
538 |
+
if ( 'bp' !== $class_parts[0] ) {
|
539 |
+
return;
|
540 |
+
}
|
541 |
+
|
542 |
+
$components = array(
|
543 |
+
'activity',
|
544 |
+
'blogs',
|
545 |
+
'core',
|
546 |
+
'friends',
|
547 |
+
'groups',
|
548 |
+
'members',
|
549 |
+
'messages',
|
550 |
+
'notifications',
|
551 |
+
'settings',
|
552 |
+
'xprofile',
|
553 |
+
);
|
554 |
+
|
555 |
+
// These classes don't have a name that matches their component.
|
556 |
+
$irregular_map = array(
|
557 |
+
'BP_Akismet' => 'activity',
|
558 |
+
|
559 |
+
'BP_Admin' => 'core',
|
560 |
+
'BP_Attachment_Avatar' => 'core',
|
561 |
+
'BP_Attachment_Cover_Image' => 'core',
|
562 |
+
'BP_Attachment' => 'core',
|
563 |
+
'BP_Button' => 'core',
|
564 |
+
'BP_Component' => 'core',
|
565 |
+
'BP_Customizer_Control_Range' => 'core',
|
566 |
+
'BP_Date_Query' => 'core',
|
567 |
+
'BP_Email_Delivery' => 'core',
|
568 |
+
'BP_Email_Recipient' => 'core',
|
569 |
+
'BP_Email' => 'core',
|
570 |
+
'BP_Embed' => 'core',
|
571 |
+
'BP_Media_Extractor' => 'core',
|
572 |
+
'BP_Members_Suggestions' => 'core',
|
573 |
+
'BP_PHPMailer' => 'core',
|
574 |
+
'BP_Recursive_Query' => 'core',
|
575 |
+
'BP_Suggestions' => 'core',
|
576 |
+
'BP_Theme_Compat' => 'core',
|
577 |
+
'BP_User_Query' => 'core',
|
578 |
+
'BP_Walker_Category_Checklist' => 'core',
|
579 |
+
'BP_Walker_Nav_Menu_Checklist' => 'core',
|
580 |
+
'BP_Walker_Nav_Menu' => 'core',
|
581 |
+
|
582 |
+
'BP_Core_Friends_Widget' => 'friends',
|
583 |
+
|
584 |
+
'BP_Group_Extension' => 'groups',
|
585 |
+
'BP_Group_Member_Query' => 'groups',
|
586 |
+
|
587 |
+
'BP_Core_Members_Template' => 'members',
|
588 |
+
'BP_Core_Members_Widget' => 'members',
|
589 |
+
'BP_Core_Recently_Active_Widget' => 'members',
|
590 |
+
'BP_Core_Whos_Online_Widget' => 'members',
|
591 |
+
'BP_Registration_Theme_Compat' => 'members',
|
592 |
+
'BP_Signup' => 'members',
|
593 |
+
);
|
594 |
+
|
595 |
+
$component = null;
|
596 |
+
|
597 |
+
// First check to see if the class is one without a properly namespaced name.
|
598 |
+
if ( isset( $irregular_map[ $class ] ) ) {
|
599 |
+
$component = $irregular_map[ $class ];
|
600 |
+
|
601 |
+
// Next chunk is usually the component name.
|
602 |
+
} elseif ( in_array( $class_parts[1], $components, true ) ) {
|
603 |
+
$component = $class_parts[1];
|
604 |
+
}
|
605 |
+
|
606 |
+
if ( ! $component ) {
|
607 |
+
return;
|
608 |
+
}
|
609 |
+
|
610 |
+
// Sanitize class name.
|
611 |
+
$class = strtolower( str_replace( '_', '-', $class ) );
|
612 |
+
|
613 |
+
$path = dirname( __FILE__ ) . "/bp-{$component}/classes/class-{$class}.php";
|
614 |
+
|
615 |
+
// Sanity check.
|
616 |
+
if ( ! file_exists( $path ) ) {
|
617 |
+
return;
|
618 |
+
}
|
619 |
+
|
620 |
+
require $path;
|
621 |
+
}
|
622 |
+
|
623 |
Â
/**
|
624 |
Â
* Set up the default hooks and actions.
|
625 |
Â
*
|
626 |
Â
* @since 1.6.0
|
627 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
628 |
Â
*/
|
629 |
Â
private function setup_actions() {
|
630 |
Â
|
@@ -1,4 +1,6 @@
|
|
1 |
-
/**** BP Members Profile Administration Screens
|
Â
|
|
Â
|
|
2 |
Â
|
3 |
Â
div#profile-page.wrap form#your-profile {
|
4 |
Â
position: relative;
|
@@ -112,8 +114,7 @@ div#community-profile-page p.not-activated {
|
|
112 |
Â
.bp-profile-field p {
|
113 |
Â
font-size: 14px;
|
114 |
Â
}
|
115 |
-
|
116 |
-
.bp-profile-field .radio > label,
|
117 |
Â
.bp-profile-field > label { /* label takes on left side 200px */
|
118 |
Â
display: inline-block;
|
119 |
Â
font-weight: 600;
|
@@ -129,7 +130,7 @@ div#community-profile-page p.not-activated {
|
|
129 |
Â
vertical-align: top;
|
130 |
Â
}
|
131 |
Â
.bp-profile-field .description { /* description also sits in the right side column */
|
132 |
-
margin: 10px 200px
|
133 |
Â
text-align: right;
|
134 |
Â
}
|
135 |
Â
.clear-value { /* 'clear value' option also sits in the right side column */
|
@@ -142,10 +143,15 @@ div#community-profile-page p.not-activated {
|
|
142 |
Â
margin-right: 200px;
|
143 |
Â
width: auto;
|
144 |
Â
}
|
145 |
-
.field_type_radio .radio
|
Â
|
|
Â
|
|
146 |
Â
display: block;
|
147 |
Â
}
|
148 |
-
.
|
Â
|
|
Â
|
|
Â
|
|
149 |
Â
display: inline-block;
|
150 |
Â
}
|
151 |
Â
.field-visibility-settings-notoggle,
|
@@ -161,6 +167,90 @@ div#community-profile-page p.not-activated {
|
|
161 |
Â
margin-bottom: 15px;
|
162 |
Â
}
|
163 |
Â
#normal-sortables .field-visibility-settings legend { /* id required for css selector weight */
|
164 |
-
font-size:
|
165 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
166 |
Â
}
|
1 |
+
/**** BP Members Profile Administration Screens
|
2 |
+
* TO DO: Organize and clean up stylesheet.
|
3 |
+
****/
|
4 |
Â
|
5 |
Â
div#profile-page.wrap form#your-profile {
|
6 |
Â
position: relative;
|
114 |
Â
.bp-profile-field p {
|
115 |
Â
font-size: 14px;
|
116 |
Â
}
|
117 |
+
|
Â
|
|
118 |
Â
.bp-profile-field > label { /* label takes on left side 200px */
|
119 |
Â
display: inline-block;
|
120 |
Â
font-weight: 600;
|
130 |
Â
vertical-align: top;
|
131 |
Â
}
|
132 |
Â
.bp-profile-field .description { /* description also sits in the right side column */
|
133 |
+
margin: 10px 200px 12px 0;
|
134 |
Â
text-align: right;
|
135 |
Â
}
|
136 |
Â
.clear-value { /* 'clear value' option also sits in the right side column */
|
143 |
Â
margin-right: 200px;
|
144 |
Â
width: auto;
|
145 |
Â
}
|
146 |
+
.field_type_radio .radio .input-options label,
|
147 |
+
.field_type_checkbox .checkbox .input-options label {
|
148 |
+
/* force checkboxes and radio buttons to new lines */
|
149 |
Â
display: block;
|
150 |
Â
}
|
151 |
+
.field_type_checkbox .checkbox .input-options,
|
152 |
+
.field_type_datebox .datebox .input-options,
|
153 |
+
.field_type_radio .radio .input-options {
|
154 |
+
/* make the checkboxes, select menus, and radio buttons sit in the right side column */
|
155 |
Â
display: inline-block;
|
156 |
Â
}
|
157 |
Â
.field-visibility-settings-notoggle,
|
167 |
Â
margin-bottom: 15px;
|
168 |
Â
}
|
169 |
Â
#normal-sortables .field-visibility-settings legend { /* id required for css selector weight */
|
170 |
+
font-size: 14px;
|
171 |
+
font-weight:600;
|
172 |
+
}
|
173 |
+
|
174 |
+
#your-profile .bp-profile-field .checkbox legend,
|
175 |
+
#your-profile .bp-profile-field .datebox legend,
|
176 |
+
#your-profile .bp-profile-field .radio legend {
|
177 |
+
float:right; /* Firefox will not apply display: inline-block to legends */
|
178 |
+
font-size: 14px;
|
179 |
+
font-weight: 600;
|
180 |
+
line-height: 1.4em;
|
181 |
+
text-align: right;
|
182 |
+
vertical-align: middle;
|
183 |
+
width: 192px;
|
184 |
+
}
|
185 |
+
|
186 |
+
#your-profile .bp-profile-field .radio legend,
|
187 |
+
#your-profile .bp-profile-field .checkbox legend {
|
188 |
+
margin-bottom: 20px;
|
189 |
+
}
|
190 |
+
|
191 |
+
.bp-profile-field .radio .clear-value {
|
192 |
+
margin-top: 10px;
|
193 |
+
}
|
194 |
+
|
195 |
+
@media screen and (max-width: 782px) {
|
196 |
+
#your-profile .bp-profile-field .checkbox legend,
|
197 |
+
#your-profile .bp-profile-field .datebox legend,
|
198 |
+
#your-profile .bp-profile-field .radio legend,
|
199 |
+
.bp-profile-field label {
|
200 |
+
float: none;
|
201 |
+
clear: right;
|
202 |
+
display: block;
|
203 |
+
margin-bottom: 12px;
|
204 |
+
}
|
205 |
+
.bp-profile-field .checkbox label,
|
206 |
+
.bp-profile-field .radio label {
|
207 |
+
line-height: 1.4em;
|
208 |
+
margin-bottom: 12px;
|
209 |
+
vertical-align: middle;
|
210 |
+
}
|
211 |
+
.bp-profile-field .checkbox input[type="checkbox"],
|
212 |
+
.bp-profile-field .radio input[type="radio"] {
|
213 |
+
vertical-align: top;
|
214 |
+
}
|
215 |
+
.bp-profile-field .clear-value,
|
216 |
+
.bp-profile-field .description,
|
217 |
+
.bp-profile-field input[type="checkbox"],
|
218 |
+
.bp-profile-field input[type="email"],
|
219 |
+
.bp-profile-field input[type="number"],
|
220 |
+
.bp-profile-field input[type="radio"],
|
221 |
+
.bp-profile-field input[type="text"],
|
222 |
+
.bp-profile-field input[type="url"],
|
223 |
+
.bp-profile-field select:nth-of-type(1),
|
224 |
+
.bp-profile-field .wp-editor-wrap,
|
225 |
+
.field-visibility-settings-notoggle,
|
226 |
+
.field-visibility-settings-toggle {
|
227 |
+
clear: right;
|
228 |
+
margin-right: 50px;
|
229 |
+
}
|
230 |
+
.field-visibility-settings {
|
231 |
+
margin-right: 100px;
|
232 |
+
}
|
233 |
+
#your-profile .field_multiselectbox select {
|
234 |
+
height: auto;
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
@media screen and (max-width: 480px) {
|
239 |
+
.bp-profile-field .clear-value,
|
240 |
+
.bp-profile-field .description,
|
241 |
+
.bp-profile-field input[type="checkbox"],
|
242 |
+
.bp-profile-field input[type="email"],
|
243 |
+
.bp-profile-field input[type="number"],
|
244 |
+
.bp-profile-field input[type="radio"],
|
245 |
+
.bp-profile-field input[type="text"],
|
246 |
+
.bp-profile-field input[type="url"],
|
247 |
+
.bp-profile-field select:nth-of-type(1),
|
248 |
+
.bp-profile-field .wp-editor-wrap,
|
249 |
+
.field-visibility-settings-notoggle,
|
250 |
+
.field-visibility-settings-toggle {
|
251 |
+
margin-right: 0;
|
252 |
+
}
|
253 |
+
.field-visibility-settings {
|
254 |
+
margin-right: 50px;
|
255 |
+
}
|
256 |
Â
}
|
@@ -1 +1 @@
|
|
1 |
-
div#profile-page.wrap form#your-profile{position:relative;padding-top:50px}div#profile-page.wrap form#your-profile h3:first-of-type{margin-top:5em}div#profile-page.wrap form#your-profile #profile-nav{position:absolute;top:0;width:97%}div#community-profile-page #profile-nav{margin-bottom:1em}#bp_members_admin_user_stats ul{margin-bottom:0}div#community-profile-page a.bp-xprofile-avatar-user-admin:before,div#community-profile-page a.bp-xprofile-avatar-user-edit:before,div#community-profile-page li.bp-blogs-profile-stats:before,div#community-profile-page li.bp-friends-profile-stats:before,div#community-profile-page li.bp-groups-profile-stats:before,div#community-profile-page li.bp-members-profile-stats:before{font:400 20px/1 dashicons;speak:none;display:inline-block;padding:0 0 0 2px;top:0;right:-1px;position:relative;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important;color:#888}div#community-profile-page li.bp-members-profile-stats:before{content:"\f130"}div#community-profile-page li.bp-friends-profile-stats:before{content:"\f454"}div#community-profile-page li.bp-groups-profile-stats:before{content:"\f456"}div#community-profile-page li.bp-blogs-profile-stats:before{content:"\f120"}div#community-profile-page a.bp-xprofile-avatar-user-admin:before{content:"\f182"}div#community-profile-page a.bp-xprofile-avatar-user-edit:before{content:"\f107"}div#community-profile-page div#bp_xprofile_user_admin_avatar div.avatar{width:150px;margin:0 auto}div#community-profile-page div#bp_xprofile_user_admin_avatar div.avatar img{max-width:100%;height:auto}div#community-profile-page div#bp_xprofile_user_admin_avatar a{display:block;margin:1em 0;text-decoration:none;color:#888}div#community-profile-page p.not-activated{margin:1em 1em 0;color:red}#community-profile-page #submitdiv #publishing-action{float:none;width:100%}.bp-view-profile{float:right}.alt{background:0 0}.bp-profile-field{border-bottom:dotted 1px #ccc;font-size:14px;margin:15px 0;padding:10px}.bp-profile-field:last-child{border-bottom:0}.bp-profile-field p{font-size:14px}.bp-profile-field
|
1 |
+
div#profile-page.wrap form#your-profile{position:relative;padding-top:50px}div#profile-page.wrap form#your-profile h3:first-of-type{margin-top:5em}div#profile-page.wrap form#your-profile #profile-nav{position:absolute;top:0;width:97%}div#community-profile-page #profile-nav{margin-bottom:1em}#bp_members_admin_user_stats ul{margin-bottom:0}div#community-profile-page a.bp-xprofile-avatar-user-admin:before,div#community-profile-page a.bp-xprofile-avatar-user-edit:before,div#community-profile-page li.bp-blogs-profile-stats:before,div#community-profile-page li.bp-friends-profile-stats:before,div#community-profile-page li.bp-groups-profile-stats:before,div#community-profile-page li.bp-members-profile-stats:before{font:400 20px/1 dashicons;speak:none;display:inline-block;padding:0 0 0 2px;top:0;right:-1px;position:relative;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important;color:#888}div#community-profile-page li.bp-members-profile-stats:before{content:"\f130"}div#community-profile-page li.bp-friends-profile-stats:before{content:"\f454"}div#community-profile-page li.bp-groups-profile-stats:before{content:"\f456"}div#community-profile-page li.bp-blogs-profile-stats:before{content:"\f120"}div#community-profile-page a.bp-xprofile-avatar-user-admin:before{content:"\f182"}div#community-profile-page a.bp-xprofile-avatar-user-edit:before{content:"\f107"}div#community-profile-page div#bp_xprofile_user_admin_avatar div.avatar{width:150px;margin:0 auto}div#community-profile-page div#bp_xprofile_user_admin_avatar div.avatar img{max-width:100%;height:auto}div#community-profile-page div#bp_xprofile_user_admin_avatar a{display:block;margin:1em 0;text-decoration:none;color:#888}div#community-profile-page p.not-activated{margin:1em 1em 0;color:red}#community-profile-page #submitdiv #publishing-action{float:none;width:100%}.bp-view-profile{float:right}.alt{background:0 0}.bp-profile-field{border-bottom:dotted 1px #ccc;font-size:14px;margin:15px 0;padding:10px}.bp-profile-field:last-child{border-bottom:0}.bp-profile-field p{font-size:14px}.bp-profile-field>label{display:inline-block;font-weight:600;text-align:right;vertical-align:middle;width:200px}.clear-value,.field_type_checkbox .checkbox .input-options label,.field_type_radio .radio .input-options label{display:block}.field_type_checkbox .checkbox>label,.field_type_multiselectbox>label,.field_type_radio .radio>label,.field_type_textarea>label{vertical-align:top}.bp-profile-field .description{margin:10px 200px 12px 0;text-align:right}.clear-value{font-size:12px;margin-right:200px}.field_type_checkbox .checkbox>label+label{display:block;margin-right:200px;width:auto}.field_type_checkbox .checkbox .input-options,.field_type_datebox .datebox .input-options,.field_type_radio .radio .input-options{display:inline-block}.field-visibility-settings-notoggle,.field-visibility-settings-toggle{margin:10px 200px 10px 0;text-align:right}.field-visibility-settings{display:none;margin-right:200px}.field-visibility-settings .button{margin-bottom:15px}#normal-sortables .field-visibility-settings legend{font-size:14px;font-weight:600}#your-profile .bp-profile-field .checkbox legend,#your-profile .bp-profile-field .datebox legend,#your-profile .bp-profile-field .radio legend{float:right;font-size:14px;font-weight:600;line-height:1.4em;text-align:right;vertical-align:middle;width:192px}#your-profile .bp-profile-field .checkbox legend,#your-profile .bp-profile-field .radio legend{margin-bottom:20px}.bp-profile-field .radio .clear-value{margin-top:10px}@media screen and (max-width:782px){#your-profile .bp-profile-field .checkbox legend,#your-profile .bp-profile-field .datebox legend,#your-profile .bp-profile-field .radio legend,.bp-profile-field label{float:none;clear:right;display:block;margin-bottom:12px}.bp-profile-field .checkbox label,.bp-profile-field .radio label{line-height:1.4em;margin-bottom:12px;vertical-align:middle}.bp-profile-field .checkbox input[type=checkbox],.bp-profile-field .radio input[type=radio]{vertical-align:top}.bp-profile-field .clear-value,.bp-profile-field .description,.bp-profile-field .wp-editor-wrap,.bp-profile-field input[type=number],.bp-profile-field input[type=text],.bp-profile-field input[type=url],.bp-profile-field input[type=checkbox],.bp-profile-field input[type=radio],.bp-profile-field input[type=email],.bp-profile-field select:nth-of-type(1),.field-visibility-settings-notoggle,.field-visibility-settings-toggle{clear:right;margin-right:50px}.field-visibility-settings{margin-right:100px}#your-profile .field_multiselectbox select{height:auto}}@media screen and (max-width:480px){.bp-profile-field .clear-value,.bp-profile-field .description,.bp-profile-field .wp-editor-wrap,.bp-profile-field input[type=number],.bp-profile-field input[type=text],.bp-profile-field input[type=url],.bp-profile-field input[type=checkbox],.bp-profile-field input[type=radio],.bp-profile-field input[type=email],.bp-profile-field select:nth-of-type(1),.field-visibility-settings-notoggle,.field-visibility-settings-toggle{margin-right:0}.field-visibility-settings{margin-right:50px}}
|
@@ -1,4 +1,6 @@
|
|
1 |
-
/**** BP Members Profile Administration Screens
|
Â
|
|
Â
|
|
2 |
Â
|
3 |
Â
div#profile-page.wrap form#your-profile {
|
4 |
Â
position: relative;
|
@@ -112,8 +114,7 @@ div#community-profile-page p.not-activated {
|
|
112 |
Â
.bp-profile-field p {
|
113 |
Â
font-size: 14px;
|
114 |
Â
}
|
115 |
-
|
116 |
-
.bp-profile-field .radio > label,
|
117 |
Â
.bp-profile-field > label { /* label takes on left side 200px */
|
118 |
Â
display: inline-block;
|
119 |
Â
font-weight: 600;
|
@@ -129,7 +130,7 @@ div#community-profile-page p.not-activated {
|
|
129 |
Â
vertical-align: top;
|
130 |
Â
}
|
131 |
Â
.bp-profile-field .description { /* description also sits in the right side column */
|
132 |
-
margin: 10px 0
|
133 |
Â
text-align: left;
|
134 |
Â
}
|
135 |
Â
.clear-value { /* 'clear value' option also sits in the right side column */
|
@@ -142,10 +143,15 @@ div#community-profile-page p.not-activated {
|
|
142 |
Â
margin-left: 200px;
|
143 |
Â
width: auto;
|
144 |
Â
}
|
145 |
-
.field_type_radio .radio
|
Â
|
|
Â
|
|
146 |
Â
display: block;
|
147 |
Â
}
|
148 |
-
.
|
Â
|
|
Â
|
|
Â
|
|
149 |
Â
display: inline-block;
|
150 |
Â
}
|
151 |
Â
.field-visibility-settings-notoggle,
|
@@ -161,6 +167,90 @@ div#community-profile-page p.not-activated {
|
|
161 |
Â
margin-bottom: 15px;
|
162 |
Â
}
|
163 |
Â
#normal-sortables .field-visibility-settings legend { /* id required for css selector weight */
|
164 |
-
font-size:
|
165 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
166 |
Â
}
|
1 |
+
/**** BP Members Profile Administration Screens
|
2 |
+
* TO DO: Organize and clean up stylesheet.
|
3 |
+
****/
|
4 |
Â
|
5 |
Â
div#profile-page.wrap form#your-profile {
|
6 |
Â
position: relative;
|
114 |
Â
.bp-profile-field p {
|
115 |
Â
font-size: 14px;
|
116 |
Â
}
|
117 |
+
|
Â
|
|
118 |
Â
.bp-profile-field > label { /* label takes on left side 200px */
|
119 |
Â
display: inline-block;
|
120 |
Â
font-weight: 600;
|
130 |
Â
vertical-align: top;
|
131 |
Â
}
|
132 |
Â
.bp-profile-field .description { /* description also sits in the right side column */
|
133 |
+
margin: 10px 0 12px 200px;
|
134 |
Â
text-align: left;
|
135 |
Â
}
|
136 |
Â
.clear-value { /* 'clear value' option also sits in the right side column */
|
143 |
Â
margin-left: 200px;
|
144 |
Â
width: auto;
|
145 |
Â
}
|
146 |
+
.field_type_radio .radio .input-options label,
|
147 |
+
.field_type_checkbox .checkbox .input-options label {
|
148 |
+
/* force checkboxes and radio buttons to new lines */
|
149 |
Â
display: block;
|
150 |
Â
}
|
151 |
+
.field_type_checkbox .checkbox .input-options,
|
152 |
+
.field_type_datebox .datebox .input-options,
|
153 |
+
.field_type_radio .radio .input-options {
|
154 |
+
/* make the checkboxes, select menus, and radio buttons sit in the right side column */
|
155 |
Â
display: inline-block;
|
156 |
Â
}
|
157 |
Â
.field-visibility-settings-notoggle,
|
167 |
Â
margin-bottom: 15px;
|
168 |
Â
}
|
169 |
Â
#normal-sortables .field-visibility-settings legend { /* id required for css selector weight */
|
170 |
+
font-size: 14px;
|
171 |
+
font-weight:600;
|
172 |
+
}
|
173 |
+
|
174 |
+
#your-profile .bp-profile-field .checkbox legend,
|
175 |
+
#your-profile .bp-profile-field .datebox legend,
|
176 |
+
#your-profile .bp-profile-field .radio legend {
|
177 |
+
float:left; /* Firefox will not apply display: inline-block to legends */
|
178 |
+
font-size: 14px;
|
179 |
+
font-weight: 600;
|
180 |
+
line-height: 1.4em;
|
181 |
+
text-align: left;
|
182 |
+
vertical-align: middle;
|
183 |
+
width: 192px;
|
184 |
+
}
|
185 |
+
|
186 |
+
#your-profile .bp-profile-field .radio legend,
|
187 |
+
#your-profile .bp-profile-field .checkbox legend {
|
188 |
+
margin-bottom: 20px;
|
189 |
+
}
|
190 |
+
|
191 |
+
.bp-profile-field .radio .clear-value {
|
192 |
+
margin-top: 10px;
|
193 |
+
}
|
194 |
+
|
195 |
+
@media screen and (max-width: 782px) {
|
196 |
+
#your-profile .bp-profile-field .checkbox legend,
|
197 |
+
#your-profile .bp-profile-field .datebox legend,
|
198 |
+
#your-profile .bp-profile-field .radio legend,
|
199 |
+
.bp-profile-field label {
|
200 |
+
float: none;
|
201 |
+
clear: left;
|
202 |
+
display: block;
|
203 |
+
margin-bottom: 12px;
|
204 |
+
}
|
205 |
+
.bp-profile-field .checkbox label,
|
206 |
+
.bp-profile-field .radio label {
|
207 |
+
line-height: 1.4em;
|
208 |
+
margin-bottom: 12px;
|
209 |
+
vertical-align: middle;
|
210 |
+
}
|
211 |
+
.bp-profile-field .checkbox input[type="checkbox"],
|
212 |
+
.bp-profile-field .radio input[type="radio"] {
|
213 |
+
vertical-align: top;
|
214 |
+
}
|
215 |
+
.bp-profile-field .clear-value,
|
216 |
+
.bp-profile-field .description,
|
217 |
+
.bp-profile-field input[type="checkbox"],
|
218 |
+
.bp-profile-field input[type="email"],
|
219 |
+
.bp-profile-field input[type="number"],
|
220 |
+
.bp-profile-field input[type="radio"],
|
221 |
+
.bp-profile-field input[type="text"],
|
222 |
+
.bp-profile-field input[type="url"],
|
223 |
+
.bp-profile-field select:nth-of-type(1),
|
224 |
+
.bp-profile-field .wp-editor-wrap,
|
225 |
+
.field-visibility-settings-notoggle,
|
226 |
+
.field-visibility-settings-toggle {
|
227 |
+
clear: left;
|
228 |
+
margin-left: 50px;
|
229 |
+
}
|
230 |
+
.field-visibility-settings {
|
231 |
+
margin-left: 100px;
|
232 |
+
}
|
233 |
+
#your-profile .field_multiselectbox select {
|
234 |
+
height: auto;
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
@media screen and (max-width: 480px) {
|
239 |
+
.bp-profile-field .clear-value,
|
240 |
+
.bp-profile-field .description,
|
241 |
+
.bp-profile-field input[type="checkbox"],
|
242 |
+
.bp-profile-field input[type="email"],
|
243 |
+
.bp-profile-field input[type="number"],
|
244 |
+
.bp-profile-field input[type="radio"],
|
245 |
+
.bp-profile-field input[type="text"],
|
246 |
+
.bp-profile-field input[type="url"],
|
247 |
+
.bp-profile-field select:nth-of-type(1),
|
248 |
+
.bp-profile-field .wp-editor-wrap,
|
249 |
+
.field-visibility-settings-notoggle,
|
250 |
+
.field-visibility-settings-toggle {
|
251 |
+
margin-left: 0;
|
252 |
+
}
|
253 |
+
.field-visibility-settings {
|
254 |
+
margin-left: 50px;
|
255 |
+
}
|
256 |
Â
}
|
@@ -1 +1 @@
|
|
1 |
-
div#profile-page.wrap form#your-profile{position:relative;padding-top:50px}div#profile-page.wrap form#your-profile h3:first-of-type{margin-top:5em}div#profile-page.wrap form#your-profile #profile-nav{position:absolute;top:0;width:97%}div#community-profile-page #profile-nav{margin-bottom:1em}#bp_members_admin_user_stats ul{margin-bottom:0}div#community-profile-page a.bp-xprofile-avatar-user-admin:before,div#community-profile-page a.bp-xprofile-avatar-user-edit:before,div#community-profile-page li.bp-blogs-profile-stats:before,div#community-profile-page li.bp-friends-profile-stats:before,div#community-profile-page li.bp-groups-profile-stats:before,div#community-profile-page li.bp-members-profile-stats:before{font:400 20px/1 dashicons;speak:none;display:inline-block;padding:0 2px 0 0;top:0;left:-1px;position:relative;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important;color:#888}div#community-profile-page li.bp-members-profile-stats:before{content:"\f130"}div#community-profile-page li.bp-friends-profile-stats:before{content:"\f454"}div#community-profile-page li.bp-groups-profile-stats:before{content:"\f456"}div#community-profile-page li.bp-blogs-profile-stats:before{content:"\f120"}div#community-profile-page a.bp-xprofile-avatar-user-admin:before{content:"\f182"}div#community-profile-page a.bp-xprofile-avatar-user-edit:before{content:"\f107"}div#community-profile-page div#bp_xprofile_user_admin_avatar div.avatar{width:150px;margin:0 auto}div#community-profile-page div#bp_xprofile_user_admin_avatar div.avatar img{max-width:100%;height:auto}div#community-profile-page div#bp_xprofile_user_admin_avatar a{display:block;margin:1em 0;text-decoration:none;color:#888}div#community-profile-page p.not-activated{margin:1em 1em 0;color:red}#community-profile-page #submitdiv #publishing-action{float:none;width:100%}.bp-view-profile{float:left}.alt{background:0 0}.bp-profile-field{border-bottom:dotted 1px #ccc;font-size:14px;margin:15px 0;padding:10px}.bp-profile-field:last-child{border-bottom:0}.bp-profile-field p{font-size:14px}.bp-profile-field
|
1 |
+
div#profile-page.wrap form#your-profile{position:relative;padding-top:50px}div#profile-page.wrap form#your-profile h3:first-of-type{margin-top:5em}div#profile-page.wrap form#your-profile #profile-nav{position:absolute;top:0;width:97%}div#community-profile-page #profile-nav{margin-bottom:1em}#bp_members_admin_user_stats ul{margin-bottom:0}div#community-profile-page a.bp-xprofile-avatar-user-admin:before,div#community-profile-page a.bp-xprofile-avatar-user-edit:before,div#community-profile-page li.bp-blogs-profile-stats:before,div#community-profile-page li.bp-friends-profile-stats:before,div#community-profile-page li.bp-groups-profile-stats:before,div#community-profile-page li.bp-members-profile-stats:before{font:400 20px/1 dashicons;speak:none;display:inline-block;padding:0 2px 0 0;top:0;left:-1px;position:relative;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important;color:#888}div#community-profile-page li.bp-members-profile-stats:before{content:"\f130"}div#community-profile-page li.bp-friends-profile-stats:before{content:"\f454"}div#community-profile-page li.bp-groups-profile-stats:before{content:"\f456"}div#community-profile-page li.bp-blogs-profile-stats:before{content:"\f120"}div#community-profile-page a.bp-xprofile-avatar-user-admin:before{content:"\f182"}div#community-profile-page a.bp-xprofile-avatar-user-edit:before{content:"\f107"}div#community-profile-page div#bp_xprofile_user_admin_avatar div.avatar{width:150px;margin:0 auto}div#community-profile-page div#bp_xprofile_user_admin_avatar div.avatar img{max-width:100%;height:auto}div#community-profile-page div#bp_xprofile_user_admin_avatar a{display:block;margin:1em 0;text-decoration:none;color:#888}div#community-profile-page p.not-activated{margin:1em 1em 0;color:red}#community-profile-page #submitdiv #publishing-action{float:none;width:100%}.bp-view-profile{float:left}.alt{background:0 0}.bp-profile-field{border-bottom:dotted 1px #ccc;font-size:14px;margin:15px 0;padding:10px}.bp-profile-field:last-child{border-bottom:0}.bp-profile-field p{font-size:14px}.bp-profile-field>label{display:inline-block;font-weight:600;text-align:left;vertical-align:middle;width:200px}.clear-value,.field_type_checkbox .checkbox .input-options label,.field_type_radio .radio .input-options label{display:block}.field_type_checkbox .checkbox>label,.field_type_multiselectbox>label,.field_type_radio .radio>label,.field_type_textarea>label{vertical-align:top}.bp-profile-field .description{margin:10px 0 12px 200px;text-align:left}.clear-value{font-size:12px;margin-left:200px}.field_type_checkbox .checkbox>label+label{display:block;margin-left:200px;width:auto}.field_type_checkbox .checkbox .input-options,.field_type_datebox .datebox .input-options,.field_type_radio .radio .input-options{display:inline-block}.field-visibility-settings-notoggle,.field-visibility-settings-toggle{margin:10px 0 10px 200px;text-align:left}.field-visibility-settings{display:none;margin-left:200px}.field-visibility-settings .button{margin-bottom:15px}#normal-sortables .field-visibility-settings legend{font-size:14px;font-weight:600}#your-profile .bp-profile-field .checkbox legend,#your-profile .bp-profile-field .datebox legend,#your-profile .bp-profile-field .radio legend{float:left;font-size:14px;font-weight:600;line-height:1.4em;text-align:left;vertical-align:middle;width:192px}#your-profile .bp-profile-field .checkbox legend,#your-profile .bp-profile-field .radio legend{margin-bottom:20px}.bp-profile-field .radio .clear-value{margin-top:10px}@media screen and (max-width:782px){#your-profile .bp-profile-field .checkbox legend,#your-profile .bp-profile-field .datebox legend,#your-profile .bp-profile-field .radio legend,.bp-profile-field label{float:none;clear:left;display:block;margin-bottom:12px}.bp-profile-field .checkbox label,.bp-profile-field .radio label{line-height:1.4em;margin-bottom:12px;vertical-align:middle}.bp-profile-field .checkbox input[type=checkbox],.bp-profile-field .radio input[type=radio]{vertical-align:top}.bp-profile-field .clear-value,.bp-profile-field .description,.bp-profile-field .wp-editor-wrap,.bp-profile-field input[type=number],.bp-profile-field input[type=text],.bp-profile-field input[type=url],.bp-profile-field input[type=checkbox],.bp-profile-field input[type=radio],.bp-profile-field input[type=email],.bp-profile-field select:nth-of-type(1),.field-visibility-settings-notoggle,.field-visibility-settings-toggle{clear:left;margin-left:50px}.field-visibility-settings{margin-left:100px}#your-profile .field_multiselectbox select{height:auto}}@media screen and (max-width:480px){.bp-profile-field .clear-value,.bp-profile-field .description,.bp-profile-field .wp-editor-wrap,.bp-profile-field input[type=number],.bp-profile-field input[type=text],.bp-profile-field input[type=url],.bp-profile-field input[type=checkbox],.bp-profile-field input[type=radio],.bp-profile-field input[type=email],.bp-profile-field select:nth-of-type(1),.field-visibility-settings-notoggle,.field-visibility-settings-toggle{margin-left:0}.field-visibility-settings{margin-left:50px}}
|
@@ -1,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM 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);
|
Â
|
|
1 |
Â
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);
|
@@ -23,6 +23,8 @@ defined( 'ABSPATH' ) || exit;
|
|
23 |
Â
*
|
24 |
Â
* Note: no longer used in the current state. See the Settings component.
|
25 |
Â
*
|
Â
|
|
Â
|
|
26 |
Â
* @param int $user_id Optional. User ID to mark as spam. Defaults to displayed user.
|
27 |
Â
*/
|
28 |
Â
function bp_core_action_set_spammer_status( $user_id = 0 ) {
|
@@ -73,6 +75,8 @@ function bp_core_action_set_spammer_status( $user_id = 0 ) {
|
|
73 |
Â
* Process user deletion requests.
|
74 |
Â
*
|
75 |
Â
* Note: No longer called here. See the Settings component.
|
Â
|
|
Â
|
|
76 |
Â
*/
|
77 |
Â
function bp_core_action_delete_user() {
|
78 |
Â
|
23 |
Â
*
|
24 |
Â
* Note: no longer used in the current state. See the Settings component.
|
25 |
Â
*
|
26 |
+
* @since 1.1.0
|
27 |
+
*
|
28 |
Â
* @param int $user_id Optional. User ID to mark as spam. Defaults to displayed user.
|
29 |
Â
*/
|
30 |
Â
function bp_core_action_set_spammer_status( $user_id = 0 ) {
|
75 |
Â
* Process user deletion requests.
|
76 |
Â
*
|
77 |
Â
* Note: No longer called here. See the Settings component.
|
78 |
+
*
|
79 |
+
* @since 1.1.0
|
80 |
Â
*/
|
81 |
Â
function bp_core_action_delete_user() {
|
82 |
Â
|
@@ -15,8 +15,6 @@ defined( 'ABSPATH' ) || exit;
|
|
15 |
Â
*
|
16 |
Â
* @since 2.2.0
|
17 |
Â
*
|
18 |
-
* @uses bp_activity_set_action()
|
19 |
-
* @uses buddypress()
|
20 |
Â
*/
|
21 |
Â
function bp_members_register_activity_actions() {
|
22 |
Â
|
@@ -70,6 +68,8 @@ function bp_members_format_activity_action_new_member( $action, $activity ) {
|
|
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 |
Â
* @return bool
|
75 |
Â
*/
|
15 |
Â
*
|
16 |
Â
* @since 2.2.0
|
17 |
Â
*
|
Â
|
|
Â
|
|
18 |
Â
*/
|
19 |
Â
function bp_members_register_activity_actions() {
|
20 |
Â
|
68 |
Â
/**
|
69 |
Â
* Create a "became a registered user" activity item when a user activates his account.
|
70 |
Â
*
|
71 |
+
* @since 1.2.2
|
72 |
+
*
|
73 |
Â
* @param array $user Array of userdata passed to bp_core_activated_user hook.
|
74 |
Â
* @return bool
|
75 |
Â
*/
|
@@ -10,7 +10,9 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
// Load the BP Members admin.
|
16 |
Â
add_action( 'bp_init', array( 'BP_Members_Admin', 'register_members_admin' ) );
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-members-admin.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
// Load the BP Members admin.
|
18 |
Â
add_action( 'bp_init', array( 'BP_Members_Admin', 'register_members_admin' ) );
|
@@ -44,10 +44,10 @@ function bp_members_admin_bar_my_account_menu() {
|
|
44 |
Â
'class' => 'ab-sub-secondary'
|
45 |
Â
) ) );
|
46 |
Â
|
47 |
-
|
48 |
Â
} elseif ( !empty( $wp_admin_bar ) ) {
|
49 |
Â
|
50 |
-
add_filter
|
51 |
Â
|
52 |
Â
// Create the main 'My Account' menu.
|
53 |
Â
$wp_admin_bar->add_menu( array(
|
44 |
Â
'class' => 'ab-sub-secondary'
|
45 |
Â
) ) );
|
46 |
Â
|
47 |
+
// Show login and sign-up links.
|
48 |
Â
} elseif ( !empty( $wp_admin_bar ) ) {
|
49 |
Â
|
50 |
+
add_filter( 'show_admin_bar', '__return_true' );
|
51 |
Â
|
52 |
Â
// Create the main 'My Account' menu.
|
53 |
Â
$wp_admin_bar->add_menu( array(
|
@@ -52,7 +52,7 @@ add_action( 'bp_user_query_populate_extras', 'bp_members_prefetch_member_type' )
|
|
52 |
Â
*
|
53 |
Â
* Called when the user is deleted or marked as spam.
|
54 |
Â
*
|
55 |
-
* @since
|
56 |
Â
*
|
57 |
Â
* @param int $user_id ID of the deleted user.
|
58 |
Â
*/
|
52 |
Â
*
|
53 |
Â
* Called when the user is deleted or marked as spam.
|
54 |
Â
*
|
55 |
+
* @since 2.2.0
|
56 |
Â
*
|
57 |
Â
* @param int $user_id ID of the deleted user.
|
58 |
Â
*/
|
@@ -110,8 +110,8 @@ function bp_members_edit_profile_url( $url, $user_id, $scheme = 'admin' ) {
|
|
110 |
Â
if ( ! is_admin() && bp_is_active( 'xprofile' ) ) {
|
111 |
Â
$profile_link = trailingslashit( bp_core_get_user_domain( $user_id ) . bp_get_profile_slug() . '/edit' );
|
112 |
Â
|
113 |
-
// Default to $url.
|
114 |
Â
} else {
|
Â
|
|
115 |
Â
$profile_link = $url;
|
116 |
Â
}
|
117 |
Â
|
110 |
Â
if ( ! is_admin() && bp_is_active( 'xprofile' ) ) {
|
111 |
Â
$profile_link = trailingslashit( bp_core_get_user_domain( $user_id ) . bp_get_profile_slug() . '/edit' );
|
112 |
Â
|
Â
|
|
113 |
Â
} else {
|
114 |
+
// Default to $url.
|
115 |
Â
$profile_link = $url;
|
116 |
Â
}
|
117 |
Â
|
@@ -35,6 +35,8 @@ function bp_members_has_directory() {
|
|
35 |
Â
*
|
36 |
Â
* In general, fallback values are only used during initial BP page creation,
|
37 |
Â
* when no slugs have been explicitly defined.
|
Â
|
|
Â
|
|
38 |
Â
*/
|
39 |
Â
function bp_core_define_slugs() {
|
40 |
Â
$bp = buddypress();
|
@@ -75,6 +77,8 @@ add_action( 'bp_setup_globals', 'bp_core_define_slugs', 11 );
|
|
75 |
Â
* need backward compatibility with BP_Core_User::get_users(), filter the
|
76 |
Â
* bp_use_legacy_user_query value, returning true.
|
77 |
Â
*
|
Â
|
|
Â
|
|
78 |
Â
* @param array|string $args {
|
79 |
Â
* Array of arguments. All are optional. See {@link BP_User_Query} for
|
80 |
Â
* a more complete description of arguments.
|
@@ -158,6 +162,8 @@ function bp_core_get_users( $args = '' ) {
|
|
158 |
Â
/**
|
159 |
Â
* Return the domain for the passed user: e.g. http://example.com/members/andy/.
|
160 |
Â
*
|
Â
|
|
Â
|
|
161 |
Â
* @param int $user_id The ID of the user.
|
162 |
Â
* @param string|bool $user_nicename Optional. user_nicename of the user.
|
163 |
Â
* @param string|bool $user_login Optional. user_login of the user.
|
@@ -198,6 +204,8 @@ function bp_core_get_user_domain( $user_id = 0, $user_nicename = false, $user_lo
|
|
198 |
Â
/**
|
199 |
Â
* Fetch everything in the wp_users table for a user, without any usermeta.
|
200 |
Â
*
|
Â
|
|
Â
|
|
201 |
Â
* @param int $user_id The ID of the user.
|
202 |
Â
* @return array
|
203 |
Â
*/
|
@@ -293,6 +301,8 @@ function bp_core_get_userid_from_nicename( $user_nicename = '' ) {
|
|
293 |
Â
* This function is sensitive to the BP_ENABLE_USERNAME_COMPATIBILITY_MODE,
|
294 |
Â
* so it will return the user_login or user_nicename as appropriate.
|
295 |
Â
*
|
Â
|
|
Â
|
|
296 |
Â
* @param int $user_id User ID to check.
|
297 |
Â
* @param string|bool $user_nicename Optional. user_nicename of user being checked.
|
298 |
Â
* @param string|bool $user_login Optional. user_login of user being checked.
|
@@ -435,6 +445,8 @@ function bp_members_get_user_nicename( $user_id ) {
|
|
435 |
Â
/**
|
436 |
Â
* Return the email address for the user based on user ID.
|
437 |
Â
*
|
Â
|
|
Â
|
|
438 |
Â
* @param int $uid User ID to check.
|
439 |
Â
* @return string The email for the matched user. Empty string if no user
|
440 |
Â
* matched the $uid.
|
@@ -473,6 +485,8 @@ function bp_core_get_user_email( $uid ) {
|
|
473 |
Â
*
|
474 |
Â
* Optional parameters will return just the name or just the URL.
|
475 |
Â
*
|
Â
|
|
Â
|
|
476 |
Â
* @param int $user_id User ID to check.
|
477 |
Â
* @param bool $no_anchor Disable URL and HTML and just return full name.
|
478 |
Â
* Default: false.
|
@@ -598,6 +612,8 @@ function bp_core_get_user_displaynames( $user_ids ) {
|
|
598 |
Â
/**
|
599 |
Â
* Fetch the display name for a user.
|
600 |
Â
*
|
Â
|
|
Â
|
|
601 |
Â
* @param int|string|bool $user_id_or_username User ID or username.
|
602 |
Â
* @return string|bool The display name for the user in question, or false if
|
603 |
Â
* user not found.
|
@@ -643,6 +659,8 @@ add_filter( 'bp_core_get_user_displayname', 'esc_html' );
|
|
643 |
Â
/**
|
644 |
Â
* Return the user link for the user based on user email address.
|
645 |
Â
*
|
Â
|
|
Â
|
|
646 |
Â
* @param string $email The email address for the user.
|
647 |
Â
* @return string The link to the users home base. False on no match.
|
648 |
Â
*/
|
@@ -662,6 +680,8 @@ function bp_core_get_userlink_by_email( $email ) {
|
|
662 |
Â
/**
|
663 |
Â
* Return the user link for the user based on the supplied identifier.
|
664 |
Â
*
|
Â
|
|
Â
|
|
665 |
Â
* @param string $username If BP_ENABLE_USERNAME_COMPATIBILITY_MODE is set,
|
666 |
Â
* this should be user_login, otherwise it should
|
667 |
Â
* be user_nicename.
|
@@ -691,6 +711,8 @@ function bp_core_get_userlink_by_username( $username ) {
|
|
691 |
Â
* account for users who have logged activity (last_active). See
|
692 |
Â
* {@link bp_core_get_active_member_count()}.
|
693 |
Â
*
|
Â
|
|
Â
|
|
694 |
Â
* @return int The total number of members.
|
695 |
Â
*/
|
696 |
Â
function bp_core_get_total_member_count() {
|
@@ -717,6 +739,8 @@ function bp_core_get_total_member_count() {
|
|
717 |
Â
/**
|
718 |
Â
* Return the total number of members, limited to those members with last_activity.
|
719 |
Â
*
|
Â
|
|
Â
|
|
720 |
Â
* @return int The number of active members.
|
721 |
Â
*/
|
722 |
Â
function bp_core_get_active_member_count() {
|
@@ -919,6 +943,8 @@ add_action( 'make_ham_user', 'bp_core_mark_user_ham_admin' );
|
|
919 |
Â
/**
|
920 |
Â
* Check whether a user has been marked as a spammer.
|
921 |
Â
*
|
Â
|
|
Â
|
|
922 |
Â
* @param int $user_id The ID for the user.
|
923 |
Â
* @return bool True if spammer, otherwise false.
|
924 |
Â
*/
|
@@ -983,6 +1009,8 @@ function bp_is_user_spammer( $user_id = 0 ) {
|
|
983 |
Â
/**
|
984 |
Â
* Check whether a user has been marked as deleted.
|
985 |
Â
*
|
Â
|
|
Â
|
|
986 |
Â
* @param int $user_id The ID for the user.
|
987 |
Â
* @return bool True if deleted, otherwise false.
|
988 |
Â
*/
|
@@ -1049,11 +1077,6 @@ function bp_is_user_deleted( $user_id = 0 ) {
|
|
1049 |
Â
*
|
1050 |
Â
* @since 1.6.0
|
1051 |
Â
*
|
1052 |
-
* @uses is_user_logged_in() To check if user is logged in
|
1053 |
-
* @uses bp_loggedin_user_id() To get current user ID
|
1054 |
-
* @uses bp_is_user_spammer() To check if user is spammer
|
1055 |
-
* @uses bp_is_user_deleted() To check if user is deleted
|
1056 |
-
*
|
1057 |
Â
* @param int $user_id The user ID to check.
|
1058 |
Â
* @return bool True if active, otherwise false.
|
1059 |
Â
*/
|
@@ -1091,10 +1114,6 @@ function bp_is_user_active( $user_id = 0 ) {
|
|
1091 |
Â
* @todo No need for the user fallback checks, since they're done in
|
1092 |
Â
* bp_is_user_active().
|
1093 |
Â
*
|
1094 |
-
* @uses is_user_logged_in() To check if user is logged in.
|
1095 |
-
* @uses bp_get_displayed_user_id() To get current user ID.
|
1096 |
-
* @uses bp_is_user_active() To check if user is active.
|
1097 |
-
*
|
1098 |
Â
* @param int $user_id The user ID to check.
|
1099 |
Â
* @return bool True if inactive, otherwise false.
|
1100 |
Â
*/
|
@@ -1214,6 +1233,8 @@ add_filter( 'update_user_metadata', '_bp_update_user_meta_last_activity_warning'
|
|
1214 |
Â
/**
|
1215 |
Â
* Get the last activity for a given user.
|
1216 |
Â
*
|
Â
|
|
Â
|
|
1217 |
Â
* @param int $user_id The ID of the user.
|
1218 |
Â
* @return string Time of last activity, in 'Y-m-d H:i:s' format, or an empty
|
1219 |
Â
* string if none is found.
|
@@ -1293,6 +1314,8 @@ function bp_core_get_all_posts_for_user( $user_id = 0 ) {
|
|
1293 |
Â
*
|
1294 |
Â
* Primarily used for self-deletions, as requested through Settings.
|
1295 |
Â
*
|
Â
|
|
Â
|
|
1296 |
Â
* @param int $user_id Optional. ID of the user to be deleted. Default: the
|
1297 |
Â
* logged-in user.
|
1298 |
Â
* @return bool True on success, false on failure.
|
@@ -1379,6 +1402,8 @@ add_action( 'delete_user', 'bp_core_delete_avatar_on_user_delete' );
|
|
1379 |
Â
*
|
1380 |
Â
* Uses multibyte functions when available on the PHP build.
|
1381 |
Â
*
|
Â
|
|
Â
|
|
1382 |
Â
* @param string $str String to be upper-cased.
|
1383 |
Â
* @return string
|
1384 |
Â
*/
|
@@ -1425,6 +1450,8 @@ add_filter( 'authenticate', 'bp_core_boot_spammer', 30 );
|
|
1425 |
Â
/**
|
1426 |
Â
* Delete last_activity data for the user when the user is deleted.
|
1427 |
Â
*
|
Â
|
|
Â
|
|
1428 |
Â
* @param int $user_id The user ID for the user to delete usermeta for.
|
1429 |
Â
*/
|
1430 |
Â
function bp_core_remove_data( $user_id ) {
|
@@ -1442,6 +1469,8 @@ add_action( 'bp_make_spam_user', 'bp_core_remove_data' );
|
|
1442 |
Â
/**
|
1443 |
Â
* Check whether the logged-in user can edit settings for the displayed user.
|
1444 |
Â
*
|
Â
|
|
Â
|
|
1445 |
Â
* @return bool True if editing is allowed, otherwise false.
|
1446 |
Â
*/
|
1447 |
Â
function bp_core_can_edit_settings() {
|
@@ -1464,6 +1493,8 @@ function bp_core_can_edit_settings() {
|
|
1464 |
Â
|
1465 |
Â
/**
|
1466 |
Â
* Flush illegal names by getting and setting 'illegal_names' site option.
|
Â
|
|
Â
|
|
1467 |
Â
*/
|
1468 |
Â
function bp_core_flush_illegal_names() {
|
1469 |
Â
$illegal_names = get_site_option( 'illegal_names' );
|
@@ -1473,6 +1504,8 @@ function bp_core_flush_illegal_names() {
|
|
1473 |
Â
/**
|
1474 |
Â
* Add BuddyPress-specific items to the illegal_names array.
|
1475 |
Â
*
|
Â
|
|
Â
|
|
1476 |
Â
* @param array|string $value Illegal names as being saved defined in
|
1477 |
Â
* Multisite settings.
|
1478 |
Â
* @param array|string $oldvalue The old value of the option.
|
@@ -1641,6 +1674,8 @@ function bp_core_add_validation_error_messages( WP_Error $errors, $validation_re
|
|
1641 |
Â
/**
|
1642 |
Â
* Validate a user name and email address when creating a new user.
|
1643 |
Â
*
|
Â
|
|
Â
|
|
1644 |
Â
* @param string $user_name Username to validate.
|
1645 |
Â
* @param string $user_email Email address to validate.
|
1646 |
Â
* @return array Results of user validation including errors, if any.
|
@@ -1744,6 +1779,8 @@ function bp_core_validate_user_signup( $user_name, $user_email ) {
|
|
1744 |
Â
/**
|
1745 |
Â
* Validate blog URL and title provided at signup.
|
1746 |
Â
*
|
Â
|
|
Â
|
|
1747 |
Â
* @todo Why do we have this wrapper?
|
1748 |
Â
*
|
1749 |
Â
* @param string $blog_url Blog URL requested during registration.
|
@@ -1768,6 +1805,8 @@ function bp_core_validate_blog_signup( $blog_url, $blog_title ) {
|
|
1768 |
Â
/**
|
1769 |
Â
* Process data submitted at user registration and convert to a signup object.
|
1770 |
Â
*
|
Â
|
|
Â
|
|
1771 |
Â
* @todo There appears to be a bug in the return value on success.
|
1772 |
Â
*
|
1773 |
Â
* @param string $user_login Login name requested by the user.
|
@@ -1864,6 +1903,8 @@ function bp_core_signup_user( $user_login, $user_password, $user_email, $usermet
|
|
1864 |
Â
/**
|
1865 |
Â
* Create a blog and user based on data supplied at user registration.
|
1866 |
Â
*
|
Â
|
|
Â
|
|
1867 |
Â
* @param string $blog_domain Domain requested by user.
|
1868 |
Â
* @param string $blog_path Path requested by user.
|
1869 |
Â
* @param string $blog_title Title as entered by user.
|
@@ -1893,6 +1934,8 @@ function bp_core_signup_blog( $blog_domain, $blog_path, $blog_title, $user_name,
|
|
1893 |
Â
/**
|
1894 |
Â
* Activate a signup, as identified by an activation key.
|
1895 |
Â
*
|
Â
|
|
Â
|
|
1896 |
Â
* @param string $key Activation key.
|
1897 |
Â
* @return int|bool User ID on success, false on failure.
|
1898 |
Â
*/
|
@@ -2134,6 +2177,8 @@ function bp_members_migrate_signups() {
|
|
2134 |
Â
* This only happens when a user is registered in wp-admin by an administrator;
|
2135 |
Â
* during normal registration, XProfile data is provided directly by the user.
|
2136 |
Â
*
|
Â
|
|
Â
|
|
2137 |
Â
* @param int $user_id ID of the user.
|
2138 |
Â
* @return bool
|
2139 |
Â
*/
|
@@ -2162,6 +2207,8 @@ add_action( 'user_register', 'bp_core_map_user_registration' );
|
|
2162 |
Â
/**
|
2163 |
Â
* Get the avatar storage directory for use during registration.
|
2164 |
Â
*
|
Â
|
|
Â
|
|
2165 |
Â
* @return string|bool Directory path on success, false on failure.
|
2166 |
Â
*/
|
2167 |
Â
function bp_core_signup_avatar_upload_dir() {
|
@@ -2198,7 +2245,8 @@ function bp_core_signup_avatar_upload_dir() {
|
|
2198 |
Â
/**
|
2199 |
Â
* Send activation email to a newly registered user.
|
2200 |
Â
*
|
2201 |
-
* @since
|
Â
|
|
2202 |
Â
*
|
2203 |
Â
* @param int|bool $user_id ID of the new user, false if BP_SIGNUPS_SKIP_USER_CREATION is true.
|
2204 |
Â
* @param string $user_email Email address of the new user.
|
@@ -2320,6 +2368,8 @@ add_action( 'login_form_bp-resend-activation', 'bp_members_login_resend_activati
|
|
2320 |
Â
|
2321 |
Â
/**
|
2322 |
Â
* Redirect away from wp-signup.php if BP registration templates are present.
|
Â
|
|
Â
|
|
2323 |
Â
*/
|
2324 |
Â
function bp_core_wpsignup_redirect() {
|
2325 |
Â
|
@@ -2331,7 +2381,7 @@ function bp_core_wpsignup_redirect() {
|
|
2331 |
Â
$action = !empty( $_GET['action'] ) ? $_GET['action'] : '';
|
2332 |
Â
|
2333 |
Â
// Not at the WP core signup page and action is not register.
|
2334 |
-
if ( ! empty( $_SERVER['SCRIPT_NAME'] ) && false === strpos( $_SERVER['SCRIPT_NAME']
|
2335 |
Â
return;
|
2336 |
Â
}
|
2337 |
Â
|
@@ -2420,6 +2470,31 @@ function bp_live_spammer_login_error() {
|
|
2420 |
Â
}
|
2421 |
Â
add_action( 'login_form_bp-spam', 'bp_live_spammer_login_error' );
|
2422 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2423 |
Â
/** Member Types *************************************************************/
|
2424 |
Â
|
2425 |
Â
/**
|
@@ -2740,5 +2815,13 @@ add_action( 'delete_user', 'bp_remove_member_type_on_user_delete' );
|
|
2740 |
Â
* @return string
|
2741 |
Â
*/
|
2742 |
Â
function bp_get_current_member_type() {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
2743 |
Â
return apply_filters( 'bp_get_current_member_type', buddypress()->current_member_type );
|
2744 |
Â
}
|
35 |
Â
*
|
36 |
Â
* In general, fallback values are only used during initial BP page creation,
|
37 |
Â
* when no slugs have been explicitly defined.
|
38 |
+
*
|
39 |
+
* @since 1.5.0
|
40 |
Â
*/
|
41 |
Â
function bp_core_define_slugs() {
|
42 |
Â
$bp = buddypress();
|
77 |
Â
* need backward compatibility with BP_Core_User::get_users(), filter the
|
78 |
Â
* bp_use_legacy_user_query value, returning true.
|
79 |
Â
*
|
80 |
+
* @since 1.2.0
|
81 |
+
*
|
82 |
Â
* @param array|string $args {
|
83 |
Â
* Array of arguments. All are optional. See {@link BP_User_Query} for
|
84 |
Â
* a more complete description of arguments.
|
162 |
Â
/**
|
163 |
Â
* Return the domain for the passed user: e.g. http://example.com/members/andy/.
|
164 |
Â
*
|
165 |
+
* @since 1.0.0
|
166 |
+
*
|
167 |
Â
* @param int $user_id The ID of the user.
|
168 |
Â
* @param string|bool $user_nicename Optional. user_nicename of the user.
|
169 |
Â
* @param string|bool $user_login Optional. user_login of the user.
|
204 |
Â
/**
|
205 |
Â
* Fetch everything in the wp_users table for a user, without any usermeta.
|
206 |
Â
*
|
207 |
+
* @since 1.2.0
|
208 |
+
*
|
209 |
Â
* @param int $user_id The ID of the user.
|
210 |
Â
* @return array
|
211 |
Â
*/
|
301 |
Â
* This function is sensitive to the BP_ENABLE_USERNAME_COMPATIBILITY_MODE,
|
302 |
Â
* so it will return the user_login or user_nicename as appropriate.
|
303 |
Â
*
|
304 |
+
* @since 1.0.0
|
305 |
+
*
|
306 |
Â
* @param int $user_id User ID to check.
|
307 |
Â
* @param string|bool $user_nicename Optional. user_nicename of user being checked.
|
308 |
Â
* @param string|bool $user_login Optional. user_login of user being checked.
|
445 |
Â
/**
|
446 |
Â
* Return the email address for the user based on user ID.
|
447 |
Â
*
|
448 |
+
* @since 1.0.0
|
449 |
+
*
|
450 |
Â
* @param int $uid User ID to check.
|
451 |
Â
* @return string The email for the matched user. Empty string if no user
|
452 |
Â
* matched the $uid.
|
485 |
Â
*
|
486 |
Â
* Optional parameters will return just the name or just the URL.
|
487 |
Â
*
|
488 |
+
* @since 1.0.0
|
489 |
+
*
|
490 |
Â
* @param int $user_id User ID to check.
|
491 |
Â
* @param bool $no_anchor Disable URL and HTML and just return full name.
|
492 |
Â
* Default: false.
|
612 |
Â
/**
|
613 |
Â
* Fetch the display name for a user.
|
614 |
Â
*
|
615 |
+
* @since 1.0.1
|
616 |
+
*
|
617 |
Â
* @param int|string|bool $user_id_or_username User ID or username.
|
618 |
Â
* @return string|bool The display name for the user in question, or false if
|
619 |
Â
* user not found.
|
659 |
Â
/**
|
660 |
Â
* Return the user link for the user based on user email address.
|
661 |
Â
*
|
662 |
+
* @since 1.0.0
|
663 |
+
*
|
664 |
Â
* @param string $email The email address for the user.
|
665 |
Â
* @return string The link to the users home base. False on no match.
|
666 |
Â
*/
|
680 |
Â
/**
|
681 |
Â
* Return the user link for the user based on the supplied identifier.
|
682 |
Â
*
|
683 |
+
* @since 1.0.0
|
684 |
+
*
|
685 |
Â
* @param string $username If BP_ENABLE_USERNAME_COMPATIBILITY_MODE is set,
|
686 |
Â
* this should be user_login, otherwise it should
|
687 |
Â
* be user_nicename.
|
711 |
Â
* account for users who have logged activity (last_active). See
|
712 |
Â
* {@link bp_core_get_active_member_count()}.
|
713 |
Â
*
|
714 |
+
* @since 1.2.0
|
715 |
+
*
|
716 |
Â
* @return int The total number of members.
|
717 |
Â
*/
|
718 |
Â
function bp_core_get_total_member_count() {
|
739 |
Â
/**
|
740 |
Â
* Return the total number of members, limited to those members with last_activity.
|
741 |
Â
*
|
742 |
+
* @since 1.6.0
|
743 |
+
*
|
744 |
Â
* @return int The number of active members.
|
745 |
Â
*/
|
746 |
Â
function bp_core_get_active_member_count() {
|
943 |
Â
/**
|
944 |
Â
* Check whether a user has been marked as a spammer.
|
945 |
Â
*
|
946 |
+
* @since 1.6.0
|
947 |
+
*
|
948 |
Â
* @param int $user_id The ID for the user.
|
949 |
Â
* @return bool True if spammer, otherwise false.
|
950 |
Â
*/
|
1009 |
Â
/**
|
1010 |
Â
* Check whether a user has been marked as deleted.
|
1011 |
Â
*
|
1012 |
+
* @since 1.6.0
|
1013 |
+
*
|
1014 |
Â
* @param int $user_id The ID for the user.
|
1015 |
Â
* @return bool True if deleted, otherwise false.
|
1016 |
Â
*/
|
1077 |
Â
*
|
1078 |
Â
* @since 1.6.0
|
1079 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1080 |
Â
* @param int $user_id The user ID to check.
|
1081 |
Â
* @return bool True if active, otherwise false.
|
1082 |
Â
*/
|
1114 |
Â
* @todo No need for the user fallback checks, since they're done in
|
1115 |
Â
* bp_is_user_active().
|
1116 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1117 |
Â
* @param int $user_id The user ID to check.
|
1118 |
Â
* @return bool True if inactive, otherwise false.
|
1119 |
Â
*/
|
1233 |
Â
/**
|
1234 |
Â
* Get the last activity for a given user.
|
1235 |
Â
*
|
1236 |
+
* @since 1.9.0
|
1237 |
+
*
|
1238 |
Â
* @param int $user_id The ID of the user.
|
1239 |
Â
* @return string Time of last activity, in 'Y-m-d H:i:s' format, or an empty
|
1240 |
Â
* string if none is found.
|
1314 |
Â
*
|
1315 |
Â
* Primarily used for self-deletions, as requested through Settings.
|
1316 |
Â
*
|
1317 |
+
* @since 1.0.0
|
1318 |
+
*
|
1319 |
Â
* @param int $user_id Optional. ID of the user to be deleted. Default: the
|
1320 |
Â
* logged-in user.
|
1321 |
Â
* @return bool True on success, false on failure.
|
1402 |
Â
*
|
1403 |
Â
* Uses multibyte functions when available on the PHP build.
|
1404 |
Â
*
|
1405 |
+
* @since 1.0.0
|
1406 |
+
*
|
1407 |
Â
* @param string $str String to be upper-cased.
|
1408 |
Â
* @return string
|
1409 |
Â
*/
|
1450 |
Â
/**
|
1451 |
Â
* Delete last_activity data for the user when the user is deleted.
|
1452 |
Â
*
|
1453 |
+
* @since 1.0.0
|
1454 |
+
*
|
1455 |
Â
* @param int $user_id The user ID for the user to delete usermeta for.
|
1456 |
Â
*/
|
1457 |
Â
function bp_core_remove_data( $user_id ) {
|
1469 |
Â
/**
|
1470 |
Â
* Check whether the logged-in user can edit settings for the displayed user.
|
1471 |
Â
*
|
1472 |
+
* @since 1.5.0
|
1473 |
+
*
|
1474 |
Â
* @return bool True if editing is allowed, otherwise false.
|
1475 |
Â
*/
|
1476 |
Â
function bp_core_can_edit_settings() {
|
1493 |
Â
|
1494 |
Â
/**
|
1495 |
Â
* Flush illegal names by getting and setting 'illegal_names' site option.
|
1496 |
+
*
|
1497 |
+
* @since 1.2.5
|
1498 |
Â
*/
|
1499 |
Â
function bp_core_flush_illegal_names() {
|
1500 |
Â
$illegal_names = get_site_option( 'illegal_names' );
|
1504 |
Â
/**
|
1505 |
Â
* Add BuddyPress-specific items to the illegal_names array.
|
1506 |
Â
*
|
1507 |
+
* @since 1.2.7
|
1508 |
+
*
|
1509 |
Â
* @param array|string $value Illegal names as being saved defined in
|
1510 |
Â
* Multisite settings.
|
1511 |
Â
* @param array|string $oldvalue The old value of the option.
|
1674 |
Â
/**
|
1675 |
Â
* Validate a user name and email address when creating a new user.
|
1676 |
Â
*
|
1677 |
+
* @since 1.2.2
|
1678 |
+
*
|
1679 |
Â
* @param string $user_name Username to validate.
|
1680 |
Â
* @param string $user_email Email address to validate.
|
1681 |
Â
* @return array Results of user validation including errors, if any.
|
1779 |
Â
/**
|
1780 |
Â
* Validate blog URL and title provided at signup.
|
1781 |
Â
*
|
1782 |
+
* @since 1.2.2
|
1783 |
+
*
|
1784 |
Â
* @todo Why do we have this wrapper?
|
1785 |
Â
*
|
1786 |
Â
* @param string $blog_url Blog URL requested during registration.
|
1805 |
Â
/**
|
1806 |
Â
* Process data submitted at user registration and convert to a signup object.
|
1807 |
Â
*
|
1808 |
+
* @since 1.2.0
|
1809 |
+
*
|
1810 |
Â
* @todo There appears to be a bug in the return value on success.
|
1811 |
Â
*
|
1812 |
Â
* @param string $user_login Login name requested by the user.
|
1903 |
Â
/**
|
1904 |
Â
* Create a blog and user based on data supplied at user registration.
|
1905 |
Â
*
|
1906 |
+
* @since 1.2.2
|
1907 |
+
*
|
1908 |
Â
* @param string $blog_domain Domain requested by user.
|
1909 |
Â
* @param string $blog_path Path requested by user.
|
1910 |
Â
* @param string $blog_title Title as entered by user.
|
1934 |
Â
/**
|
1935 |
Â
* Activate a signup, as identified by an activation key.
|
1936 |
Â
*
|
1937 |
+
* @since 1.2.2
|
1938 |
+
*
|
1939 |
Â
* @param string $key Activation key.
|
1940 |
Â
* @return int|bool User ID on success, false on failure.
|
1941 |
Â
*/
|
2177 |
Â
* This only happens when a user is registered in wp-admin by an administrator;
|
2178 |
Â
* during normal registration, XProfile data is provided directly by the user.
|
2179 |
Â
*
|
2180 |
+
* @since 1.2.0
|
2181 |
+
*
|
2182 |
Â
* @param int $user_id ID of the user.
|
2183 |
Â
* @return bool
|
2184 |
Â
*/
|
2207 |
Â
/**
|
2208 |
Â
* Get the avatar storage directory for use during registration.
|
2209 |
Â
*
|
2210 |
+
* @since 1.1.0
|
2211 |
+
*
|
2212 |
Â
* @return string|bool Directory path on success, false on failure.
|
2213 |
Â
*/
|
2214 |
Â
function bp_core_signup_avatar_upload_dir() {
|
2245 |
Â
/**
|
2246 |
Â
* Send activation email to a newly registered user.
|
2247 |
Â
*
|
2248 |
+
* @since 1.2.2
|
2249 |
+
* @since 2.5.0 Add the $user_login parameter.
|
2250 |
Â
*
|
2251 |
Â
* @param int|bool $user_id ID of the new user, false if BP_SIGNUPS_SKIP_USER_CREATION is true.
|
2252 |
Â
* @param string $user_email Email address of the new user.
|
2368 |
Â
|
2369 |
Â
/**
|
2370 |
Â
* Redirect away from wp-signup.php if BP registration templates are present.
|
2371 |
+
*
|
2372 |
+
* @since 1.1.0
|
2373 |
Â
*/
|
2374 |
Â
function bp_core_wpsignup_redirect() {
|
2375 |
Â
|
2381 |
Â
$action = !empty( $_GET['action'] ) ? $_GET['action'] : '';
|
2382 |
Â
|
2383 |
Â
// Not at the WP core signup page and action is not register.
|
2384 |
+
if ( ! empty( $_SERVER['SCRIPT_NAME'] ) && false === strpos( 'wp-signup.php', $_SERVER['SCRIPT_NAME'] ) && ( 'register' != $action ) ) {
|
2385 |
Â
return;
|
2386 |
Â
}
|
2387 |
Â
|
2470 |
Â
}
|
2471 |
Â
add_action( 'login_form_bp-spam', 'bp_live_spammer_login_error' );
|
2472 |
Â
|
2473 |
+
/**
|
2474 |
+
* Get the displayed user Object
|
2475 |
+
*
|
2476 |
+
* @since 2.6.0
|
2477 |
+
*
|
2478 |
+
* @return object The displayed user object, null otherwise.
|
2479 |
+
*/
|
2480 |
+
function bp_get_displayed_user() {
|
2481 |
+
$bp = buddypress();
|
2482 |
+
|
2483 |
+
$displayed_user = null;
|
2484 |
+
if ( ! empty( $bp->displayed_user->id ) ) {
|
2485 |
+
$displayed_user = $bp->displayed_user;
|
2486 |
+
}
|
2487 |
+
|
2488 |
+
/**
|
2489 |
+
* Filters the displayed_user object corresponding to the displayed member.
|
2490 |
+
*
|
2491 |
+
* @since 2.6.0
|
2492 |
+
*
|
2493 |
+
* @param object $displayed_user The displayed_user object.
|
2494 |
+
*/
|
2495 |
+
return apply_filters( 'bp_get_displayed_user', $displayed_user );
|
2496 |
+
}
|
2497 |
+
|
2498 |
Â
/** Member Types *************************************************************/
|
2499 |
Â
|
2500 |
Â
/**
|
2815 |
Â
* @return string
|
2816 |
Â
*/
|
2817 |
Â
function bp_get_current_member_type() {
|
2818 |
+
|
2819 |
+
/**
|
2820 |
+
* Filters the "current" member type, if one is provided, in member directories.
|
2821 |
+
*
|
2822 |
+
* @since 2.3.0
|
2823 |
+
*
|
2824 |
+
* @param string $value "Current" member type.
|
2825 |
+
*/
|
2826 |
Â
return apply_filters( 'bp_get_current_member_type', buddypress()->current_member_type );
|
2827 |
Â
}
|
@@ -10,10 +10,14 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Set up the bp-members component.
|
Â
|
|
Â
|
|
17 |
Â
*/
|
18 |
Â
function bp_setup_members() {
|
19 |
Â
buddypress()->members = new BP_Members_Component();
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-members-component.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Set up the bp-members component.
|
19 |
+
*
|
20 |
+
* @since 1.6.0
|
21 |
Â
*/
|
22 |
Â
function bp_setup_members() {
|
23 |
Â
buddypress()->members = new BP_Members_Component();
|
@@ -12,11 +12,15 @@
|
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
-
|
16 |
-
require dirname( __FILE__ ) . '/classes/class-bp-
|
Â
|
|
Â
|
|
17 |
Â
|
18 |
Â
/**
|
19 |
Â
* Handle the display of the profile page by loading the correct template file.
|
Â
|
|
Â
|
|
20 |
Â
*/
|
21 |
Â
function bp_members_screen_display_profile() {
|
22 |
Â
|
@@ -39,6 +43,8 @@ function bp_members_screen_display_profile() {
|
|
39 |
Â
|
40 |
Â
/**
|
41 |
Â
* Handle the display of the members directory index.
|
Â
|
|
Â
|
|
42 |
Â
*/
|
43 |
Â
function bp_members_screen_index() {
|
44 |
Â
if ( bp_is_members_directory() ) {
|
@@ -65,6 +71,8 @@ add_action( 'bp_screens', 'bp_members_screen_index' );
|
|
65 |
Â
|
66 |
Â
/**
|
67 |
Â
* Handle the loading of the signup screen.
|
Â
|
|
Â
|
|
68 |
Â
*/
|
69 |
Â
function bp_core_screen_signup() {
|
70 |
Â
$bp = buddypress();
|
@@ -99,7 +107,7 @@ function bp_core_screen_signup() {
|
|
99 |
Â
if ( !bp_get_signup_allowed() ) {
|
100 |
Â
$bp->signup->step = 'registration-disabled';
|
101 |
Â
|
102 |
-
|
103 |
Â
} elseif ( isset( $_POST['signup_submit'] ) && bp_verify_nonce_request( 'bp_new_signup' ) ) {
|
104 |
Â
|
105 |
Â
/**
|
@@ -151,7 +159,7 @@ function bp_core_screen_signup() {
|
|
151 |
Â
$bp->signup->errors['field_' . $field_id] = __( 'This is a required field', 'buddypress' );
|
152 |
Â
}
|
153 |
Â
|
154 |
-
|
155 |
Â
} else {
|
156 |
Â
bp_core_redirect( bp_get_root_domain() );
|
157 |
Â
}
|
@@ -295,6 +303,8 @@ add_action( 'bp_screens', 'bp_core_screen_signup' );
|
|
295 |
Â
/**
|
296 |
Â
* Handle the loading of the Activate screen.
|
297 |
Â
*
|
Â
|
|
Â
|
|
298 |
Â
* @todo Move the actual activation process into an action in bp-members-actions.php
|
299 |
Â
*/
|
300 |
Â
function bp_core_screen_activation() {
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
+
if ( ! buddypress()->do_autoload ) {
|
16 |
+
require dirname( __FILE__ ) . '/classes/class-bp-members-theme-compat.php';
|
17 |
+
require dirname( __FILE__ ) . '/classes/class-bp-registration-theme-compat.php';
|
18 |
+
}
|
19 |
Â
|
20 |
Â
/**
|
21 |
Â
* Handle the display of the profile page by loading the correct template file.
|
22 |
+
*
|
23 |
+
* @since 1.5.0
|
24 |
Â
*/
|
25 |
Â
function bp_members_screen_display_profile() {
|
26 |
Â
|
43 |
Â
|
44 |
Â
/**
|
45 |
Â
* Handle the display of the members directory index.
|
46 |
+
*
|
47 |
+
* @since 1.5.0
|
48 |
Â
*/
|
49 |
Â
function bp_members_screen_index() {
|
50 |
Â
if ( bp_is_members_directory() ) {
|
71 |
Â
|
72 |
Â
/**
|
73 |
Â
* Handle the loading of the signup screen.
|
74 |
+
*
|
75 |
+
* @since 1.1.0
|
76 |
Â
*/
|
77 |
Â
function bp_core_screen_signup() {
|
78 |
Â
$bp = buddypress();
|
107 |
Â
if ( !bp_get_signup_allowed() ) {
|
108 |
Â
$bp->signup->step = 'registration-disabled';
|
109 |
Â
|
110 |
+
// If the signup page is submitted, validate and save.
|
111 |
Â
} elseif ( isset( $_POST['signup_submit'] ) && bp_verify_nonce_request( 'bp_new_signup' ) ) {
|
112 |
Â
|
113 |
Â
/**
|
159 |
Â
$bp->signup->errors['field_' . $field_id] = __( 'This is a required field', 'buddypress' );
|
160 |
Â
}
|
161 |
Â
|
162 |
+
// This situation doesn't naturally occur so bounce to website root.
|
163 |
Â
} else {
|
164 |
Â
bp_core_redirect( bp_get_root_domain() );
|
165 |
Â
}
|
303 |
Â
/**
|
304 |
Â
* Handle the loading of the Activate screen.
|
305 |
Â
*
|
306 |
+
* @since 1.1.0
|
307 |
+
*
|
308 |
Â
* @todo Move the actual activation process into an action in bp-members-actions.php
|
309 |
Â
*/
|
310 |
Â
function bp_core_screen_activation() {
|
@@ -12,14 +12,15 @@
|
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
-
|
Â
|
|
Â
|
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Output the profile component slug.
|
19 |
Â
*
|
20 |
Â
* @since 2.4.0
|
21 |
Â
*
|
22 |
-
* @uses bp_get_profile_slug()
|
23 |
Â
*/
|
24 |
Â
function bp_profile_slug() {
|
25 |
Â
echo bp_get_profile_slug();
|
@@ -48,7 +49,6 @@ function bp_profile_slug() {
|
|
48 |
Â
*
|
49 |
Â
* @since 1.5.0
|
50 |
Â
*
|
51 |
-
* @uses bp_get_members_slug()
|
52 |
Â
*/
|
53 |
Â
function bp_members_slug() {
|
54 |
Â
echo bp_get_members_slug();
|
@@ -77,7 +77,6 @@ function bp_members_slug() {
|
|
77 |
Â
*
|
78 |
Â
* @since 1.5.0
|
79 |
Â
*
|
80 |
-
* @uses bp_get_members_root_slug()
|
81 |
Â
*/
|
82 |
Â
function bp_members_root_slug() {
|
83 |
Â
echo bp_get_members_root_slug();
|
@@ -136,7 +135,6 @@ function bp_members_member_type_base() {
|
|
136 |
Â
*
|
137 |
Â
* @since 1.5.0
|
138 |
Â
*
|
139 |
-
* @uses bp_get_members_directory_permalink()
|
140 |
Â
*/
|
141 |
Â
function bp_members_directory_permalink() {
|
142 |
Â
echo esc_url( bp_get_members_directory_permalink() );
|
@@ -165,8 +163,6 @@ function bp_members_directory_permalink() {
|
|
165 |
Â
*
|
166 |
Â
* @since 2.5.0
|
167 |
Â
*
|
168 |
-
* @uses bp_get_member_type_directory_permalink()
|
169 |
-
*
|
170 |
Â
* @param string $member_type Optional. Member type.
|
171 |
Â
*/
|
172 |
Â
function bp_member_type_directory_permalink( $member_type = '' ) {
|
@@ -213,7 +209,6 @@ function bp_member_type_directory_permalink( $member_type = '' ) {
|
|
213 |
Â
*
|
214 |
Â
* @since 1.5.0
|
215 |
Â
*
|
216 |
-
* @uses bp_get_signup_slug()
|
217 |
Â
*/
|
218 |
Â
function bp_signup_slug() {
|
219 |
Â
echo bp_get_signup_slug();
|
@@ -251,7 +246,6 @@ function bp_signup_slug() {
|
|
251 |
Â
*
|
252 |
Â
* @since 1.5.0
|
253 |
Â
*
|
254 |
-
* @uses bp_get_activate_slug()
|
255 |
Â
*/
|
256 |
Â
function bp_activate_slug() {
|
257 |
Â
echo bp_get_activate_slug();
|
@@ -291,6 +285,8 @@ function bp_activate_slug() {
|
|
291 |
Â
* global, enabling the use of BuddyPress templates and template functions to
|
292 |
Â
* display a list of members.
|
293 |
Â
*
|
Â
|
|
Â
|
|
294 |
Â
* @global object $members_template {@link BP_Members_Template}
|
295 |
Â
*
|
296 |
Â
* @param array|string $args {
|
@@ -426,16 +422,20 @@ function bp_has_members( $args = '' ) {
|
|
426 |
Â
* Filters whether or not BuddyPress has members to iterate over.
|
427 |
Â
*
|
428 |
Â
* @since 1.2.4
|
Â
|
|
429 |
Â
*
|
430 |
Â
* @param bool $value Whether or not there are members to iterate over.
|
431 |
Â
* @param array $members_template Populated $members_template global.
|
Â
|
|
432 |
Â
*/
|
433 |
-
return apply_filters( 'bp_has_members', $members_template->has_members(), $members_template );
|
434 |
Â
}
|
435 |
Â
|
436 |
Â
/**
|
437 |
Â
* Set up the current member inside the loop.
|
438 |
Â
*
|
Â
|
|
Â
|
|
439 |
Â
* @return object
|
440 |
Â
*/
|
441 |
Â
function bp_the_member() {
|
@@ -446,6 +446,8 @@ function bp_the_member() {
|
|
446 |
Â
/**
|
447 |
Â
* Check whether there are more members to iterate over.
|
448 |
Â
*
|
Â
|
|
Â
|
|
449 |
Â
* @return bool
|
450 |
Â
*/
|
451 |
Â
function bp_members() {
|
@@ -455,6 +457,8 @@ function bp_members() {
|
|
455 |
Â
|
456 |
Â
/**
|
457 |
Â
* Output the members pagination count.
|
Â
|
|
Â
|
|
458 |
Â
*/
|
459 |
Â
function bp_members_pagination_count() {
|
460 |
Â
echo bp_get_members_pagination_count();
|
@@ -462,6 +466,8 @@ function bp_members_pagination_count() {
|
|
462 |
Â
/**
|
463 |
Â
* Generate the members pagination count.
|
464 |
Â
*
|
Â
|
|
Â
|
|
465 |
Â
* @return string
|
466 |
Â
*/
|
467 |
Â
function bp_get_members_pagination_count() {
|
@@ -513,6 +519,8 @@ function bp_members_pagination_count() {
|
|
513 |
Â
|
514 |
Â
/**
|
515 |
Â
* Output the members pagination links.
|
Â
|
|
Â
|
|
516 |
Â
*/
|
517 |
Â
function bp_members_pagination_links() {
|
518 |
Â
echo bp_get_members_pagination_links();
|
@@ -520,6 +528,8 @@ function bp_members_pagination_links() {
|
|
520 |
Â
/**
|
521 |
Â
* Fetch the members pagination links.
|
522 |
Â
*
|
Â
|
|
Â
|
|
523 |
Â
* @return string
|
524 |
Â
*/
|
525 |
Â
function bp_get_members_pagination_links() {
|
@@ -538,7 +548,8 @@ function bp_members_pagination_links() {
|
|
538 |
Â
/**
|
539 |
Â
* Output the ID of the current member in the loop.
|
540 |
Â
*
|
541 |
-
* @
|
Â
|
|
542 |
Â
*/
|
543 |
Â
function bp_member_user_id() {
|
544 |
Â
echo bp_get_member_user_id();
|
@@ -546,6 +557,8 @@ function bp_member_user_id() {
|
|
546 |
Â
/**
|
547 |
Â
* Get the ID of the current member in the loop.
|
548 |
Â
*
|
Â
|
|
Â
|
|
549 |
Â
* @return string Member ID.
|
550 |
Â
*/
|
551 |
Â
function bp_get_member_user_id() {
|
@@ -578,7 +591,6 @@ function bp_member_class( $classes = array() ) {
|
|
578 |
Â
* @since 1.7.0
|
579 |
Â
*
|
580 |
Â
* @param array $classes Array of custom classes.
|
581 |
-
*
|
582 |
Â
* @return string Row class of the member
|
583 |
Â
*/
|
584 |
Â
function bp_get_member_class( $classes = array() ) {
|
@@ -589,7 +601,7 @@ function bp_member_class( $classes = array() ) {
|
|
589 |
Â
$pos_in_loop = (int) $members_template->current_member;
|
590 |
Â
$classes[] = ( $pos_in_loop % 2 ) ? 'even' : 'odd';
|
591 |
Â
|
592 |
-
|
593 |
Â
} else {
|
594 |
Â
$classes[] = 'bp-single-member';
|
595 |
Â
}
|
@@ -613,6 +625,13 @@ function bp_member_class( $classes = array() ) {
|
|
613 |
Â
$classes[] = 'is-current-user';
|
614 |
Â
}
|
615 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
616 |
Â
/**
|
617 |
Â
* Filters the determined classes to add to the HTML element.
|
618 |
Â
*
|
@@ -629,6 +648,8 @@ function bp_member_class( $classes = array() ) {
|
|
629 |
Â
|
630 |
Â
/**
|
631 |
Â
* Output nicename of current member in the loop.
|
Â
|
|
Â
|
|
632 |
Â
*/
|
633 |
Â
function bp_member_user_nicename() {
|
634 |
Â
echo bp_get_member_user_nicename();
|
@@ -636,6 +657,8 @@ function bp_member_user_nicename() {
|
|
636 |
Â
/**
|
637 |
Â
* Get the nicename of the current member in the loop.
|
638 |
Â
*
|
Â
|
|
Â
|
|
639 |
Â
* @return string Members nicename.
|
640 |
Â
*/
|
641 |
Â
function bp_get_member_user_nicename() {
|
@@ -653,6 +676,8 @@ function bp_member_user_nicename() {
|
|
653 |
Â
|
654 |
Â
/**
|
655 |
Â
* Output login for current member in the loop.
|
Â
|
|
Â
|
|
656 |
Â
*/
|
657 |
Â
function bp_member_user_login() {
|
658 |
Â
echo bp_get_member_user_login();
|
@@ -660,6 +685,8 @@ function bp_member_user_login() {
|
|
660 |
Â
/**
|
661 |
Â
* Get the login of the current member in the loop.
|
662 |
Â
*
|
Â
|
|
Â
|
|
663 |
Â
* @return string Member's login.
|
664 |
Â
*/
|
665 |
Â
function bp_get_member_user_login() {
|
@@ -677,6 +704,8 @@ function bp_member_user_login() {
|
|
677 |
Â
|
678 |
Â
/**
|
679 |
Â
* Output the email address for the current member in the loop.
|
Â
|
|
Â
|
|
680 |
Â
*/
|
681 |
Â
function bp_member_user_email() {
|
682 |
Â
echo bp_get_member_user_email();
|
@@ -684,6 +713,8 @@ function bp_member_user_email() {
|
|
684 |
Â
/**
|
685 |
Â
* Get the email address of the current member in the loop.
|
686 |
Â
*
|
Â
|
|
Â
|
|
687 |
Â
* @return string Member's email address.
|
688 |
Â
*/
|
689 |
Â
function bp_get_member_user_email() {
|
@@ -702,6 +733,8 @@ function bp_member_user_email() {
|
|
702 |
Â
/**
|
703 |
Â
* Check whether the current member in the loop is the logged-in user.
|
704 |
Â
*
|
Â
|
|
Â
|
|
705 |
Â
* @return bool
|
706 |
Â
*/
|
707 |
Â
function bp_member_is_loggedin_user() {
|
@@ -720,6 +753,8 @@ function bp_member_is_loggedin_user() {
|
|
720 |
Â
/**
|
721 |
Â
* Output a member's avatar.
|
722 |
Â
*
|
Â
|
|
Â
|
|
723 |
Â
* @see bp_get_member_avatar() for description of arguments.
|
724 |
Â
*
|
725 |
Â
* @param array|string $args See {@link bp_get_member_avatar()}.
|
@@ -730,14 +765,18 @@ function bp_member_avatar( $args = '' ) {
|
|
730 |
Â
* Filters a members avatar.
|
731 |
Â
*
|
732 |
Â
* @since 1.2.0
|
Â
|
|
733 |
Â
*
|
734 |
-
* @param string
|
Â
|
|
735 |
Â
*/
|
736 |
-
echo apply_filters( 'bp_member_avatar', bp_get_member_avatar( $args ) );
|
737 |
Â
}
|
738 |
Â
/**
|
739 |
Â
* Get a member's avatar.
|
740 |
Â
*
|
Â
|
|
Â
|
|
741 |
Â
* @see bp_core_fetch_avatar() For a description of arguments and
|
742 |
Â
* return values.
|
743 |
Â
*
|
@@ -776,14 +815,18 @@ function bp_member_avatar( $args = '' ) {
|
|
776 |
Â
* Filters a members avatar.
|
777 |
Â
*
|
778 |
Â
* @since 1.2.0
|
Â
|
|
779 |
Â
*
|
780 |
Â
* @param string $value Formatted HTML <img> element, or raw avatar URL based on $html arg.
|
Â
|
|
781 |
Â
*/
|
782 |
-
return apply_filters( 'bp_get_member_avatar', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->id, 'type' => $type, 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $members_template->member->user_email ) ) );
|
783 |
Â
}
|
784 |
Â
|
785 |
Â
/**
|
786 |
Â
* Output the permalink for the current member in the loop.
|
Â
|
|
Â
|
|
787 |
Â
*/
|
788 |
Â
function bp_member_permalink() {
|
789 |
Â
echo bp_get_member_permalink();
|
@@ -791,6 +834,8 @@ function bp_member_permalink() {
|
|
791 |
Â
/**
|
792 |
Â
* Get the permalink for the current member in the loop.
|
793 |
Â
*
|
Â
|
|
Â
|
|
794 |
Â
* @return string
|
795 |
Â
*/
|
796 |
Â
function bp_get_member_permalink() {
|
@@ -808,16 +853,22 @@ function bp_member_permalink() {
|
|
808 |
Â
|
809 |
Â
/**
|
810 |
Â
* Alias of {@link bp_member_permalink()}.
|
Â
|
|
Â
|
|
811 |
Â
*/
|
812 |
Â
function bp_member_link() { echo bp_get_member_permalink(); }
|
813 |
Â
|
814 |
Â
/**
|
815 |
Â
* Alias of {@link bp_get_member_permalink()}.
|
Â
|
|
Â
|
|
816 |
Â
*/
|
817 |
Â
function bp_get_member_link() { return bp_get_member_permalink(); }
|
818 |
Â
|
819 |
Â
/**
|
820 |
Â
* Output display name of current member in the loop.
|
Â
|
|
Â
|
|
821 |
Â
*/
|
822 |
Â
function bp_member_name() {
|
823 |
Â
|
@@ -838,6 +889,8 @@ function bp_member_name() {
|
|
838 |
Â
* WP users table, in the following order of preference: display_name,
|
839 |
Â
* user_nicename, user_login.
|
840 |
Â
*
|
Â
|
|
Â
|
|
841 |
Â
* @return string The user's fullname for display.
|
842 |
Â
*/
|
843 |
Â
function bp_get_member_name() {
|
@@ -878,6 +931,8 @@ function bp_member_name() {
|
|
878 |
Â
/**
|
879 |
Â
* Output the current member's last active time.
|
880 |
Â
*
|
Â
|
|
Â
|
|
881 |
Â
* @param array $args See {@link bp_get_member_last_active()}.
|
882 |
Â
*/
|
883 |
Â
function bp_member_last_active( $args = array() ) {
|
@@ -886,6 +941,8 @@ function bp_member_last_active( $args = array() ) {
|
|
886 |
Â
/**
|
887 |
Â
* Return the current member's last active time.
|
888 |
Â
*
|
Â
|
|
Â
|
|
889 |
Â
* @param array $args {
|
890 |
Â
* Array of optional arguments.
|
891 |
Â
* @type mixed $active_format If true, formatted "active 5 minutes
|
@@ -916,7 +973,7 @@ function bp_member_last_active( $args = array() ) {
|
|
916 |
Â
? bp_core_get_last_activity( $members_template->member->last_activity, $r['active_format'] )
|
917 |
Â
: bp_core_time_since( $members_template->member->last_activity );
|
918 |
Â
|
919 |
-
|
920 |
Â
} else {
|
921 |
Â
$last_activity = __( 'Never active', 'buddypress' );
|
922 |
Â
}
|
@@ -935,6 +992,8 @@ function bp_member_last_active( $args = array() ) {
|
|
935 |
Â
/**
|
936 |
Â
* Output the latest update of the current member in the loop.
|
937 |
Â
*
|
Â
|
|
Â
|
|
938 |
Â
* @param array|string $args Array of arguments for latest update.
|
939 |
Â
*/
|
940 |
Â
function bp_member_latest_update( $args = '' ) {
|
@@ -943,6 +1002,8 @@ function bp_member_latest_update( $args = '' ) {
|
|
943 |
Â
/**
|
944 |
Â
* Get the latest update from the current member in the loop.
|
945 |
Â
*
|
Â
|
|
Â
|
|
946 |
Â
* @param array|string $args {
|
947 |
Â
* Array of optional arguments.
|
948 |
Â
* @type int $length Truncation length. Default: 225.
|
@@ -969,10 +1030,12 @@ function bp_member_latest_update( $args = '' ) {
|
|
969 |
Â
* Filters the excerpt of the latest update for current member in the loop.
|
970 |
Â
*
|
971 |
Â
* @since 1.2.5
|
Â
|
|
972 |
Â
*
|
973 |
Â
* @param string $value Excerpt of the latest update for current member in the loop.
|
Â
|
|
974 |
Â
*/
|
975 |
-
$update_content = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], $length ) ) ) );
|
976 |
Â
|
977 |
Â
$update_content = sprintf( _x( '- "%s"', 'member latest update in member directory', 'buddypress' ), $update_content );
|
978 |
Â
|
@@ -988,15 +1051,19 @@ function bp_member_latest_update( $args = '' ) {
|
|
988 |
Â
* Filters the latest update from the current member in the loop.
|
989 |
Â
*
|
990 |
Â
* @since 1.2.0
|
Â
|
|
991 |
Â
*
|
992 |
Â
* @param string $update_content Formatted latest update for current member.
|
Â
|
|
993 |
Â
*/
|
994 |
-
return apply_filters( 'bp_get_member_latest_update', $update_content );
|
995 |
Â
}
|
996 |
Â
|
997 |
Â
/**
|
998 |
Â
* Output a piece of user profile data.
|
999 |
Â
*
|
Â
|
|
Â
|
|
1000 |
Â
* @see bp_get_member_profile_data() for a description of params.
|
1001 |
Â
*
|
1002 |
Â
* @param array|string $args See {@link bp_get_member_profile_data()}.
|
@@ -1011,6 +1078,8 @@ function bp_member_profile_data( $args = '' ) {
|
|
1011 |
Â
* to fetch profile data cached in the template global. It is also safe
|
1012 |
Â
* to use outside of the loop.
|
1013 |
Â
*
|
Â
|
|
Â
|
|
1014 |
Â
* @param array|string $args {
|
1015 |
Â
* Array of config parameters.
|
1016 |
Â
* @type string $field Name of the profile field.
|
@@ -1070,14 +1139,18 @@ function bp_member_profile_data( $args = '' ) {
|
|
1070 |
Â
* Filters resulting piece of member profile data.
|
1071 |
Â
*
|
1072 |
Â
* @since 1.2.0
|
Â
|
|
1073 |
Â
*
|
1074 |
Â
* @param string|bool $data Profile data if found, otherwise false.
|
Â
|
|
1075 |
Â
*/
|
1076 |
-
return apply_filters( 'bp_get_member_profile_data', $data );
|
1077 |
Â
}
|
1078 |
Â
|
1079 |
Â
/**
|
1080 |
Â
* Output the 'registered [x days ago]' string for the current member.
|
Â
|
|
Â
|
|
1081 |
Â
*/
|
1082 |
Â
function bp_member_registered() {
|
1083 |
Â
echo bp_get_member_registered();
|
@@ -1085,6 +1158,8 @@ function bp_member_registered() {
|
|
1085 |
Â
/**
|
1086 |
Â
* Get the 'registered [x days ago]' string for the current member.
|
1087 |
Â
*
|
Â
|
|
Â
|
|
1088 |
Â
* @return string
|
1089 |
Â
*/
|
1090 |
Â
function bp_get_member_registered() {
|
@@ -1104,6 +1179,8 @@ function bp_member_registered() {
|
|
1104 |
Â
|
1105 |
Â
/**
|
1106 |
Â
* Output a random piece of profile data for the current member in the loop.
|
Â
|
|
Â
|
|
1107 |
Â
*/
|
1108 |
Â
function bp_member_random_profile_data() {
|
1109 |
Â
global $members_template;
|
@@ -1117,6 +1194,8 @@ function bp_member_random_profile_data() {
|
|
1117 |
Â
|
1118 |
Â
/**
|
1119 |
Â
* Output hidden input for preserving member search params on form submit.
|
Â
|
|
Â
|
|
1120 |
Â
*/
|
1121 |
Â
function bp_member_hidden_fields() {
|
1122 |
Â
$query_arg = bp_core_get_component_search_query_arg( 'members' );
|
@@ -1136,6 +1215,8 @@ function bp_member_hidden_fields() {
|
|
1136 |
Â
|
1137 |
Â
/**
|
1138 |
Â
* Output the Members directory search form.
|
Â
|
|
Â
|
|
1139 |
Â
*/
|
1140 |
Â
function bp_directory_members_search_form() {
|
1141 |
Â
|
@@ -1164,6 +1245,8 @@ function bp_directory_members_search_form() {
|
|
1164 |
Â
|
1165 |
Â
/**
|
1166 |
Â
* Output the total member count.
|
Â
|
|
Â
|
|
1167 |
Â
*/
|
1168 |
Â
function bp_total_site_member_count() {
|
1169 |
Â
echo bp_get_total_site_member_count();
|
@@ -1171,6 +1254,8 @@ function bp_total_site_member_count() {
|
|
1171 |
Â
/**
|
1172 |
Â
* Get the total site member count.
|
1173 |
Â
*
|
Â
|
|
Â
|
|
1174 |
Â
* @return int
|
1175 |
Â
*/
|
1176 |
Â
function bp_get_total_site_member_count() {
|
@@ -1199,6 +1284,8 @@ function bp_total_site_member_count() {
|
|
1199 |
Â
* The function will also analyze the current component the user is in, to
|
1200 |
Â
* determine whether or not to highlight a particular nav item.
|
1201 |
Â
*
|
Â
|
|
Â
|
|
1202 |
Â
* @todo Move to a back-compat file?
|
1203 |
Â
* @deprecated Does not seem to be called anywhere in BP core.
|
1204 |
Â
*/
|
@@ -1206,12 +1293,12 @@ function bp_get_loggedin_user_nav() {
|
|
1206 |
Â
$bp = buddypress();
|
1207 |
Â
|
1208 |
Â
// Loop through each navigation item.
|
1209 |
-
foreach( (array) $bp->
|
1210 |
Â
|
1211 |
Â
$selected = '';
|
1212 |
Â
|
1213 |
Â
// If the current component matches the nav item id, then add a highlight CSS class.
|
1214 |
-
if ( !bp_is_directory() && !empty( $bp->active_components[bp_current_component()] ) && $bp->active_components[bp_current_component()] == $nav_item
|
1215 |
Â
$selected = ' class="current selected"';
|
1216 |
Â
}
|
1217 |
Â
|
@@ -1223,7 +1310,7 @@ function bp_get_loggedin_user_nav() {
|
|
1223 |
Â
$selected = '';
|
1224 |
Â
|
1225 |
Â
if ( bp_is_active( 'friends' ) ) {
|
1226 |
-
if ( $nav_item
|
1227 |
Â
if ( friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() ) ) {
|
1228 |
Â
$selected = ' class="current selected"';
|
1229 |
Â
}
|
@@ -1232,7 +1319,7 @@ function bp_get_loggedin_user_nav() {
|
|
1232 |
Â
}
|
1233 |
Â
|
1234 |
Â
// Echo out the final list item.
|
1235 |
-
echo apply_filters_ref_array( 'bp_get_loggedin_user_nav_' . $nav_item
|
1236 |
Â
}
|
1237 |
Â
|
1238 |
Â
// Always add a log out list item to the end of the navigation.
|
@@ -1241,25 +1328,120 @@ function bp_get_loggedin_user_nav() {
|
|
1241 |
Â
echo apply_filters( 'bp_logout_nav_link', $logout_link );
|
1242 |
Â
}
|
1243 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1244 |
Â
/**
|
1245 |
Â
* Render the navigation markup for the displayed user.
|
Â
|
|
Â
|
|
1246 |
Â
*/
|
1247 |
Â
function bp_get_displayed_user_nav() {
|
1248 |
Â
$bp = buddypress();
|
1249 |
Â
|
1250 |
-
foreach (
|
1251 |
-
if ( empty( $user_nav_item
|
1252 |
Â
continue;
|
Â
|
|
1253 |
Â
|
1254 |
Â
$selected = '';
|
1255 |
-
if ( bp_is_current_component( $user_nav_item
|
1256 |
Â
$selected = ' class="current selected"';
|
1257 |
Â
}
|
1258 |
Â
|
1259 |
Â
if ( bp_loggedin_user_domain() ) {
|
1260 |
-
$link = str_replace( bp_loggedin_user_domain(), bp_displayed_user_domain(), $user_nav_item
|
1261 |
Â
} else {
|
1262 |
-
$link = trailingslashit( bp_displayed_user_domain() . $user_nav_item
|
1263 |
Â
}
|
1264 |
Â
|
1265 |
Â
/**
|
@@ -1273,7 +1455,7 @@ function bp_get_displayed_user_nav() {
|
|
1273 |
Â
* @param array $user_nav_item Array holding parts used to construct tab list item.
|
1274 |
Â
* Passed by reference.
|
1275 |
Â
*/
|
1276 |
-
echo apply_filters_ref_array( 'bp_get_displayed_user_nav_' . $user_nav_item
|
1277 |
Â
}
|
1278 |
Â
}
|
1279 |
Â
|
@@ -1296,6 +1478,8 @@ function bp_displayed_user_use_cover_image_header() {
|
|
1296 |
Â
/**
|
1297 |
Â
* Output the logged-in user's avatar.
|
1298 |
Â
*
|
Â
|
|
Â
|
|
1299 |
Â
* @see bp_get_loggedin_user_avatar() for a description of params.
|
1300 |
Â
*
|
1301 |
Â
* @param array|string $args Array of arguments for logged in user avatar.
|
@@ -1306,6 +1490,8 @@ function bp_loggedin_user_avatar( $args = '' ) {
|
|
1306 |
Â
/**
|
1307 |
Â
* Get the logged-in user's avatar.
|
1308 |
Â
*
|
Â
|
|
Â
|
|
1309 |
Â
* @see bp_core_fetch_avatar() For a description of arguments and
|
1310 |
Â
* return values.
|
1311 |
Â
*
|
@@ -1338,6 +1524,8 @@ function bp_loggedin_user_avatar( $args = '' ) {
|
|
1338 |
Â
* @since 1.1.0
|
1339 |
Â
*
|
1340 |
Â
* @param string $value User avatar string.
|
Â
|
|
Â
|
|
1341 |
Â
*/
|
1342 |
Â
return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( $r ), $r, $args );
|
1343 |
Â
}
|
@@ -1345,6 +1533,8 @@ function bp_loggedin_user_avatar( $args = '' ) {
|
|
1345 |
Â
/**
|
1346 |
Â
* Output the displayed user's avatar.
|
1347 |
Â
*
|
Â
|
|
Â
|
|
1348 |
Â
* @see bp_get_displayed_user_avatar() for a description of params.
|
1349 |
Â
*
|
1350 |
Â
* @param array|string $args Array of arguments for displayed user avatar.
|
@@ -1355,6 +1545,8 @@ function bp_displayed_user_avatar( $args = '' ) {
|
|
1355 |
Â
/**
|
1356 |
Â
* Get the displayed user's avatar.
|
1357 |
Â
*
|
Â
|
|
Â
|
|
1358 |
Â
* @see bp_core_fetch_avatar() For a description of arguments and
|
1359 |
Â
* return values.
|
1360 |
Â
*
|
@@ -1387,12 +1579,16 @@ function bp_displayed_user_avatar( $args = '' ) {
|
|
1387 |
Â
* @since 1.1.0
|
1388 |
Â
*
|
1389 |
Â
* @param string $value User avatar string.
|
Â
|
|
Â
|
|
1390 |
Â
*/
|
1391 |
Â
return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( $r ), $r, $args );
|
1392 |
Â
}
|
1393 |
Â
|
1394 |
Â
/**
|
1395 |
Â
* Output the email address of the displayed user.
|
Â
|
|
Â
|
|
1396 |
Â
*/
|
1397 |
Â
function bp_displayed_user_email() {
|
1398 |
Â
echo bp_get_displayed_user_email();
|
@@ -1400,6 +1596,8 @@ function bp_displayed_user_email() {
|
|
1400 |
Â
/**
|
1401 |
Â
* Get the email address of the displayed user.
|
1402 |
Â
*
|
Â
|
|
Â
|
|
1403 |
Â
* @return string
|
1404 |
Â
*/
|
1405 |
Â
function bp_get_displayed_user_email() {
|
@@ -1424,6 +1622,8 @@ function bp_displayed_user_email() {
|
|
1424 |
Â
/**
|
1425 |
Â
* Output the "active [x days ago]" string for a user.
|
1426 |
Â
*
|
Â
|
|
Â
|
|
1427 |
Â
* @see bp_get_last_activity() for a description of parameters.
|
1428 |
Â
*
|
1429 |
Â
* @param int $user_id See {@link bp_get_last_activity()}.
|
@@ -1442,6 +1642,8 @@ function bp_last_activity( $user_id = 0 ) {
|
|
1442 |
Â
/**
|
1443 |
Â
* Get the "active [x days ago]" string for a user.
|
1444 |
Â
*
|
Â
|
|
Â
|
|
1445 |
Â
* @param int $user_id ID of the user. Default: displayed user ID.
|
1446 |
Â
* @return string
|
1447 |
Â
*/
|
@@ -1456,14 +1658,18 @@ function bp_last_activity( $user_id = 0 ) {
|
|
1456 |
Â
* Filters the 'active [x days ago]' string for a user.
|
1457 |
Â
*
|
1458 |
Â
* @since 1.5.0
|
Â
|
|
1459 |
Â
*
|
1460 |
-
* @param string $value
|
Â
|
|
1461 |
Â
*/
|
1462 |
-
return apply_filters( 'bp_get_last_activity', $last_activity );
|
1463 |
Â
}
|
1464 |
Â
|
1465 |
Â
/**
|
1466 |
Â
* Output the calculated first name of the displayed or logged-in user.
|
Â
|
|
Â
|
|
1467 |
Â
*/
|
1468 |
Â
function bp_user_firstname() {
|
1469 |
Â
echo bp_get_user_firstname();
|
@@ -1473,6 +1679,8 @@ function bp_user_firstname() {
|
|
1473 |
Â
*
|
1474 |
Â
* Simply takes all the characters before the first space in a name.
|
1475 |
Â
*
|
Â
|
|
Â
|
|
1476 |
Â
* @param string|bool $name Full name to use when generating first name.
|
1477 |
Â
* Defaults to displayed user's first name, or to
|
1478 |
Â
* logged-in user's first name if it's unavailable.
|
@@ -1503,6 +1711,8 @@ function bp_user_firstname() {
|
|
1503 |
Â
|
1504 |
Â
/**
|
1505 |
Â
* Output the link for the logged-in user's profile.
|
Â
|
|
Â
|
|
1506 |
Â
*/
|
1507 |
Â
function bp_loggedin_user_link() {
|
1508 |
Â
echo bp_get_loggedin_user_link();
|
@@ -1510,6 +1720,8 @@ function bp_loggedin_user_link() {
|
|
1510 |
Â
/**
|
1511 |
Â
* Get the link for the logged-in user's profile.
|
1512 |
Â
*
|
Â
|
|
Â
|
|
1513 |
Â
* @return string
|
1514 |
Â
*/
|
1515 |
Â
function bp_get_loggedin_user_link() {
|
@@ -1526,6 +1738,8 @@ function bp_loggedin_user_link() {
|
|
1526 |
Â
|
1527 |
Â
/**
|
1528 |
Â
* Output the link for the displayed user's profile.
|
Â
|
|
Â
|
|
1529 |
Â
*/
|
1530 |
Â
function bp_displayed_user_link() {
|
1531 |
Â
echo bp_get_displayed_user_link();
|
@@ -1533,6 +1747,8 @@ function bp_displayed_user_link() {
|
|
1533 |
Â
/**
|
1534 |
Â
* Get the link for the displayed user's profile.
|
1535 |
Â
*
|
Â
|
|
Â
|
|
1536 |
Â
* @return string
|
1537 |
Â
*/
|
1538 |
Â
function bp_get_displayed_user_link() {
|
@@ -1556,12 +1772,16 @@ function bp_displayed_user_link() {
|
|
1556 |
Â
|
1557 |
Â
/**
|
1558 |
Â
* Alias of {@link bp_displayed_user_id()}.
|
Â
|
|
Â
|
|
1559 |
Â
*/
|
1560 |
Â
function bp_current_user_id() { return bp_displayed_user_id(); }
|
1561 |
Â
|
1562 |
Â
/**
|
1563 |
Â
* Generate the link for the displayed user's profile.
|
1564 |
Â
*
|
Â
|
|
Â
|
|
1565 |
Â
* @return string
|
1566 |
Â
*/
|
1567 |
Â
function bp_displayed_user_domain() {
|
@@ -1580,6 +1800,8 @@ function bp_displayed_user_domain() {
|
|
1580 |
Â
/**
|
1581 |
Â
* Generate the link for the logged-in user's profile.
|
1582 |
Â
*
|
Â
|
|
Â
|
|
1583 |
Â
* @return string
|
1584 |
Â
*/
|
1585 |
Â
function bp_loggedin_user_domain() {
|
@@ -1597,6 +1819,8 @@ function bp_loggedin_user_domain() {
|
|
1597 |
Â
|
1598 |
Â
/**
|
1599 |
Â
* Output the displayed user's display name.
|
Â
|
|
Â
|
|
1600 |
Â
*/
|
1601 |
Â
function bp_displayed_user_fullname() {
|
1602 |
Â
echo bp_get_displayed_user_fullname();
|
@@ -1604,6 +1828,8 @@ function bp_displayed_user_fullname() {
|
|
1604 |
Â
/**
|
1605 |
Â
* Get the displayed user's display name.
|
1606 |
Â
*
|
Â
|
|
Â
|
|
1607 |
Â
* @return string
|
1608 |
Â
*/
|
1609 |
Â
function bp_get_displayed_user_fullname() {
|
@@ -1621,12 +1847,16 @@ function bp_displayed_user_fullname() {
|
|
1621 |
Â
|
1622 |
Â
/**
|
1623 |
Â
* Alias of {@link bp_get_displayed_user_fullname()}.
|
Â
|
|
Â
|
|
1624 |
Â
*/
|
1625 |
Â
function bp_user_fullname() { echo bp_get_displayed_user_fullname(); }
|
1626 |
Â
|
1627 |
Â
|
1628 |
Â
/**
|
1629 |
Â
* Output the logged-in user's display name.
|
Â
|
|
Â
|
|
1630 |
Â
*/
|
1631 |
Â
function bp_loggedin_user_fullname() {
|
1632 |
Â
echo bp_get_loggedin_user_fullname();
|
@@ -1634,6 +1864,8 @@ function bp_loggedin_user_fullname() {
|
|
1634 |
Â
/**
|
1635 |
Â
* Get the logged-in user's display name.
|
1636 |
Â
*
|
Â
|
|
Â
|
|
1637 |
Â
* @return string
|
1638 |
Â
*/
|
1639 |
Â
function bp_get_loggedin_user_fullname() {
|
@@ -1651,6 +1883,8 @@ function bp_loggedin_user_fullname() {
|
|
1651 |
Â
|
1652 |
Â
/**
|
1653 |
Â
* Output the username of the displayed user.
|
Â
|
|
Â
|
|
1654 |
Â
*/
|
1655 |
Â
function bp_displayed_user_username() {
|
1656 |
Â
echo bp_get_displayed_user_username();
|
@@ -1658,6 +1892,8 @@ function bp_displayed_user_username() {
|
|
1658 |
Â
/**
|
1659 |
Â
* Get the username of the displayed user.
|
1660 |
Â
*
|
Â
|
|
Â
|
|
1661 |
Â
* @return string
|
1662 |
Â
*/
|
1663 |
Â
function bp_get_displayed_user_username() {
|
@@ -1681,6 +1917,8 @@ function bp_displayed_user_username() {
|
|
1681 |
Â
|
1682 |
Â
/**
|
1683 |
Â
* Output the username of the logged-in user.
|
Â
|
|
Â
|
|
1684 |
Â
*/
|
1685 |
Â
function bp_loggedin_user_username() {
|
1686 |
Â
echo bp_get_loggedin_user_username();
|
@@ -1688,6 +1926,8 @@ function bp_loggedin_user_username() {
|
|
1688 |
Â
/**
|
1689 |
Â
* Get the username of the logged-in user.
|
1690 |
Â
*
|
Â
|
|
Â
|
|
1691 |
Â
* @return string
|
1692 |
Â
*/
|
1693 |
Â
function bp_get_loggedin_user_username() {
|
@@ -1728,6 +1968,13 @@ function bp_current_member_type_message() {
|
|
1728 |
Â
|
1729 |
Â
$message = sprintf( __( 'Viewing members of the type: %s', 'buddypress' ), '<strong>' . $type_object->labels['singular_name'] . '</strong>' );
|
1730 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1731 |
Â
return apply_filters( 'bp_get_current_member_type_message', $message );
|
1732 |
Â
}
|
1733 |
Â
|
@@ -1738,9 +1985,6 @@ function bp_current_member_type_message() {
|
|
1738 |
Â
*
|
1739 |
Â
* @since 1.5.0
|
1740 |
Â
*
|
1741 |
-
* @uses bp_get_signup_slug() To make sure there is a slug assigned to the page.
|
1742 |
-
* @uses bp_locate_template() To make sure a template exists to provide output.
|
1743 |
-
*
|
1744 |
Â
* @return bool True if page and template exist, false if not.
|
1745 |
Â
*/
|
1746 |
Â
function bp_has_custom_signup_page() {
|
@@ -1754,6 +1998,8 @@ function bp_has_custom_signup_page() {
|
|
1754 |
Â
|
1755 |
Â
/**
|
1756 |
Â
* Output the URL to the signup page.
|
Â
|
|
Â
|
|
1757 |
Â
*/
|
1758 |
Â
function bp_signup_page() {
|
1759 |
Â
echo esc_url( bp_get_signup_page() );
|
@@ -1761,6 +2007,8 @@ function bp_signup_page() {
|
|
1761 |
Â
/**
|
1762 |
Â
* Get the URL to the signup page.
|
1763 |
Â
*
|
Â
|
|
Â
|
|
1764 |
Â
* @return string
|
1765 |
Â
*/
|
1766 |
Â
function bp_get_signup_page() {
|
@@ -1785,8 +2033,6 @@ function bp_signup_page() {
|
|
1785 |
Â
*
|
1786 |
Â
* @since 1.5.0
|
1787 |
Â
*
|
1788 |
-
* @uses bp_get_activate_slug() To make sure there is a slug assigned to the page.
|
1789 |
-
* @uses bp_locate_template() To make sure a template exists to provide output.
|
1790 |
Â
* @return boolean True if page and template exist, false if not.
|
1791 |
Â
*/
|
1792 |
Â
function bp_has_custom_activation_page() {
|
@@ -1800,6 +2046,8 @@ function bp_has_custom_activation_page() {
|
|
1800 |
Â
|
1801 |
Â
/**
|
1802 |
Â
* Output the URL of the activation page.
|
Â
|
|
Â
|
|
1803 |
Â
*/
|
1804 |
Â
function bp_activation_page() {
|
1805 |
Â
echo esc_url( bp_get_activation_page() );
|
@@ -1807,6 +2055,8 @@ function bp_activation_page() {
|
|
1807 |
Â
/**
|
1808 |
Â
* Get the URL of the activation page.
|
1809 |
Â
*
|
Â
|
|
Â
|
|
1810 |
Â
* @return string
|
1811 |
Â
*/
|
1812 |
Â
function bp_get_activation_page() {
|
@@ -1828,6 +2078,8 @@ function bp_activation_page() {
|
|
1828 |
Â
|
1829 |
Â
/**
|
1830 |
Â
* Output the username submitted during signup.
|
Â
|
|
Â
|
|
1831 |
Â
*/
|
1832 |
Â
function bp_signup_username_value() {
|
1833 |
Â
echo bp_get_signup_username_value();
|
@@ -1835,6 +2087,8 @@ function bp_signup_username_value() {
|
|
1835 |
Â
/**
|
1836 |
Â
* Get the username submitted during signup.
|
1837 |
Â
*
|
Â
|
|
Â
|
|
1838 |
Â
* @todo This should be properly escaped.
|
1839 |
Â
*
|
1840 |
Â
* @return string
|
@@ -1856,6 +2110,8 @@ function bp_signup_username_value() {
|
|
1856 |
Â
|
1857 |
Â
/**
|
1858 |
Â
* Output the user email address submitted during signup.
|
Â
|
|
Â
|
|
1859 |
Â
*/
|
1860 |
Â
function bp_signup_email_value() {
|
1861 |
Â
echo bp_get_signup_email_value();
|
@@ -1863,6 +2119,8 @@ function bp_signup_email_value() {
|
|
1863 |
Â
/**
|
1864 |
Â
* Get the email address submitted during signup.
|
1865 |
Â
*
|
Â
|
|
Â
|
|
1866 |
Â
* @todo This should be properly escaped.
|
1867 |
Â
*
|
1868 |
Â
* @return string
|
@@ -1884,6 +2142,8 @@ function bp_signup_email_value() {
|
|
1884 |
Â
|
1885 |
Â
/**
|
1886 |
Â
* Output the 'signup_with_blog' value submitted during signup.
|
Â
|
|
Â
|
|
1887 |
Â
*/
|
1888 |
Â
function bp_signup_with_blog_value() {
|
1889 |
Â
echo bp_get_signup_with_blog_value();
|
@@ -1891,6 +2151,8 @@ function bp_signup_with_blog_value() {
|
|
1891 |
Â
/**
|
1892 |
Â
* Get the 'signup_with_blog' value submitted during signup.
|
1893 |
Â
*
|
Â
|
|
Â
|
|
1894 |
Â
* @return string
|
1895 |
Â
*/
|
1896 |
Â
function bp_get_signup_with_blog_value() {
|
@@ -1910,6 +2172,8 @@ function bp_signup_with_blog_value() {
|
|
1910 |
Â
|
1911 |
Â
/**
|
1912 |
Â
* Output the 'signup_blog_url' value submitted at signup.
|
Â
|
|
Â
|
|
1913 |
Â
*/
|
1914 |
Â
function bp_signup_blog_url_value() {
|
1915 |
Â
echo bp_get_signup_blog_url_value();
|
@@ -1917,6 +2181,8 @@ function bp_signup_blog_url_value() {
|
|
1917 |
Â
/**
|
1918 |
Â
* Get the 'signup_blog_url' value submitted at signup.
|
1919 |
Â
*
|
Â
|
|
Â
|
|
1920 |
Â
* @todo Should be properly escaped.
|
1921 |
Â
*
|
1922 |
Â
* @return string
|
@@ -1972,6 +2238,8 @@ function bp_signup_subdomain_base() {
|
|
1972 |
Â
|
1973 |
Â
/**
|
1974 |
Â
* Output the 'signup_blog_titl' value submitted at signup.
|
Â
|
|
Â
|
|
1975 |
Â
*/
|
1976 |
Â
function bp_signup_blog_title_value() {
|
1977 |
Â
echo bp_get_signup_blog_title_value();
|
@@ -1979,6 +2247,8 @@ function bp_signup_blog_title_value() {
|
|
1979 |
Â
/**
|
1980 |
Â
* Get the 'signup_blog_title' value submitted at signup.
|
1981 |
Â
*
|
Â
|
|
Â
|
|
1982 |
Â
* @todo Should be properly escaped.
|
1983 |
Â
*
|
1984 |
Â
* @return string
|
@@ -2000,6 +2270,8 @@ function bp_signup_blog_title_value() {
|
|
2000 |
Â
|
2001 |
Â
/**
|
2002 |
Â
* Output the 'signup_blog_privacy' value submitted at signup.
|
Â
|
|
Â
|
|
2003 |
Â
*/
|
2004 |
Â
function bp_signup_blog_privacy_value() {
|
2005 |
Â
echo bp_get_signup_blog_privacy_value();
|
@@ -2007,6 +2279,8 @@ function bp_signup_blog_privacy_value() {
|
|
2007 |
Â
/**
|
2008 |
Â
* Get the 'signup_blog_privacy' value submitted at signup.
|
2009 |
Â
*
|
Â
|
|
Â
|
|
2010 |
Â
* @todo Should be properly escaped.
|
2011 |
Â
*
|
2012 |
Â
* @return string
|
@@ -2028,6 +2302,8 @@ function bp_signup_blog_privacy_value() {
|
|
2028 |
Â
|
2029 |
Â
/**
|
2030 |
Â
* Output the avatar dir used during signup.
|
Â
|
|
Â
|
|
2031 |
Â
*/
|
2032 |
Â
function bp_signup_avatar_dir_value() {
|
2033 |
Â
echo bp_get_signup_avatar_dir_value();
|
@@ -2035,6 +2311,8 @@ function bp_signup_avatar_dir_value() {
|
|
2035 |
Â
/**
|
2036 |
Â
* Get the avatar dir used during signup.
|
2037 |
Â
*
|
Â
|
|
Â
|
|
2038 |
Â
* @return string
|
2039 |
Â
*/
|
2040 |
Â
function bp_get_signup_avatar_dir_value() {
|
@@ -2064,6 +2342,8 @@ function bp_signup_avatar_dir_value() {
|
|
2064 |
Â
|
2065 |
Â
/**
|
2066 |
Â
* Output the current signup step.
|
Â
|
|
Â
|
|
2067 |
Â
*/
|
2068 |
Â
function bp_current_signup_step() {
|
2069 |
Â
echo bp_get_current_signup_step();
|
@@ -2071,6 +2351,8 @@ function bp_current_signup_step() {
|
|
2071 |
Â
/**
|
2072 |
Â
* Get the current signup step.
|
2073 |
Â
*
|
Â
|
|
Â
|
|
2074 |
Â
* @return string
|
2075 |
Â
*/
|
2076 |
Â
function bp_get_current_signup_step() {
|
@@ -2080,6 +2362,8 @@ function bp_current_signup_step() {
|
|
2080 |
Â
/**
|
2081 |
Â
* Output the user avatar during signup.
|
2082 |
Â
*
|
Â
|
|
Â
|
|
2083 |
Â
* @see bp_get_signup_avatar() for description of arguments.
|
2084 |
Â
*
|
2085 |
Â
* @param array|string $args See {@link bp_get_signup_avatar(}.
|
@@ -2090,6 +2374,8 @@ function bp_signup_avatar( $args = '' ) {
|
|
2090 |
Â
/**
|
2091 |
Â
* Get the user avatar during signup.
|
2092 |
Â
*
|
Â
|
|
Â
|
|
2093 |
Â
* @see bp_core_fetch_avatar() for description of arguments.
|
2094 |
Â
*
|
2095 |
Â
* @param array|string $args {
|
@@ -2126,7 +2412,7 @@ function bp_signup_avatar( $args = '' ) {
|
|
2126 |
Â
'class' => $class
|
2127 |
Â
) );
|
2128 |
Â
|
2129 |
-
|
2130 |
Â
} else {
|
2131 |
Â
|
2132 |
Â
// Set default gravatar type.
|
@@ -2163,6 +2449,8 @@ function bp_signup_avatar( $args = '' ) {
|
|
2163 |
Â
/**
|
2164 |
Â
* Output whether signup is allowed.
|
2165 |
Â
*
|
Â
|
|
Â
|
|
2166 |
Â
* @todo Remove this function. Echoing a bool is pointless.
|
2167 |
Â
*/
|
2168 |
Â
function bp_signup_allowed() {
|
@@ -2171,6 +2459,8 @@ function bp_signup_allowed() {
|
|
2171 |
Â
/**
|
2172 |
Â
* Is user signup allowed?
|
2173 |
Â
*
|
Â
|
|
Â
|
|
2174 |
Â
* @return bool
|
2175 |
Â
*/
|
2176 |
Â
function bp_get_signup_allowed() {
|
@@ -2219,6 +2509,8 @@ add_action( 'bp_head', 'bp_members_activity_feed' );
|
|
2219 |
Â
/**
|
2220 |
Â
* Output a link to a members component subpage.
|
2221 |
Â
*
|
Â
|
|
Â
|
|
2222 |
Â
* @see bp_get_members_component_link() for description of parameters.
|
2223 |
Â
*
|
2224 |
Â
* @param string $component See {@bp_get_members_component_link()}.
|
@@ -2232,6 +2524,8 @@ function bp_members_component_link( $component, $action = '', $query_args = '',
|
|
2232 |
Â
/**
|
2233 |
Â
* Generate a link to a members component subpage.
|
2234 |
Â
*
|
Â
|
|
Â
|
|
2235 |
Â
* @param string $component ID of the component (eg 'friends').
|
2236 |
Â
* @param string $action Optional. 'action' slug (eg 'invites').
|
2237 |
Â
* @param array|string $query_args Optional. Array of URL params to add to the
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
+
if ( ! buddypress()->do_autoload ) {
|
16 |
+
require dirname( __FILE__ ) . '/classes/class-bp-core-members-template.php';
|
17 |
+
}
|
18 |
Â
|
19 |
Â
/**
|
20 |
Â
* Output the profile component slug.
|
21 |
Â
*
|
22 |
Â
* @since 2.4.0
|
23 |
Â
*
|
Â
|
|
24 |
Â
*/
|
25 |
Â
function bp_profile_slug() {
|
26 |
Â
echo bp_get_profile_slug();
|
49 |
Â
*
|
50 |
Â
* @since 1.5.0
|
51 |
Â
*
|
Â
|
|
52 |
Â
*/
|
53 |
Â
function bp_members_slug() {
|
54 |
Â
echo bp_get_members_slug();
|
77 |
Â
*
|
78 |
Â
* @since 1.5.0
|
79 |
Â
*
|
Â
|
|
80 |
Â
*/
|
81 |
Â
function bp_members_root_slug() {
|
82 |
Â
echo bp_get_members_root_slug();
|
135 |
Â
*
|
136 |
Â
* @since 1.5.0
|
137 |
Â
*
|
Â
|
|
138 |
Â
*/
|
139 |
Â
function bp_members_directory_permalink() {
|
140 |
Â
echo esc_url( bp_get_members_directory_permalink() );
|
163 |
Â
*
|
164 |
Â
* @since 2.5.0
|
165 |
Â
*
|
Â
|
|
Â
|
|
166 |
Â
* @param string $member_type Optional. Member type.
|
167 |
Â
*/
|
168 |
Â
function bp_member_type_directory_permalink( $member_type = '' ) {
|
209 |
Â
*
|
210 |
Â
* @since 1.5.0
|
211 |
Â
*
|
Â
|
|
212 |
Â
*/
|
213 |
Â
function bp_signup_slug() {
|
214 |
Â
echo bp_get_signup_slug();
|
246 |
Â
*
|
247 |
Â
* @since 1.5.0
|
248 |
Â
*
|
Â
|
|
249 |
Â
*/
|
250 |
Â
function bp_activate_slug() {
|
251 |
Â
echo bp_get_activate_slug();
|
285 |
Â
* global, enabling the use of BuddyPress templates and template functions to
|
286 |
Â
* display a list of members.
|
287 |
Â
*
|
288 |
+
* @since 1.2.0
|
289 |
+
*
|
290 |
Â
* @global object $members_template {@link BP_Members_Template}
|
291 |
Â
*
|
292 |
Â
* @param array|string $args {
|
422 |
Â
* Filters whether or not BuddyPress has members to iterate over.
|
423 |
Â
*
|
424 |
Â
* @since 1.2.4
|
425 |
+
* @since 2.6.0 Added the `$r` parameter
|
426 |
Â
*
|
427 |
Â
* @param bool $value Whether or not there are members to iterate over.
|
428 |
Â
* @param array $members_template Populated $members_template global.
|
429 |
+
* @param array $r Array of arguments passed into the BP_Core_Members_Template class.
|
430 |
Â
*/
|
431 |
+
return apply_filters( 'bp_has_members', $members_template->has_members(), $members_template, $r );
|
432 |
Â
}
|
433 |
Â
|
434 |
Â
/**
|
435 |
Â
* Set up the current member inside the loop.
|
436 |
Â
*
|
437 |
+
* @since 1.2.0
|
438 |
+
*
|
439 |
Â
* @return object
|
440 |
Â
*/
|
441 |
Â
function bp_the_member() {
|
446 |
Â
/**
|
447 |
Â
* Check whether there are more members to iterate over.
|
448 |
Â
*
|
449 |
+
* @since 1.2.0
|
450 |
+
*
|
451 |
Â
* @return bool
|
452 |
Â
*/
|
453 |
Â
function bp_members() {
|
457 |
Â
|
458 |
Â
/**
|
459 |
Â
* Output the members pagination count.
|
460 |
+
*
|
461 |
+
* @since 1.2.0
|
462 |
Â
*/
|
463 |
Â
function bp_members_pagination_count() {
|
464 |
Â
echo bp_get_members_pagination_count();
|
466 |
Â
/**
|
467 |
Â
* Generate the members pagination count.
|
468 |
Â
*
|
469 |
+
* @since 1.5.0
|
470 |
+
*
|
471 |
Â
* @return string
|
472 |
Â
*/
|
473 |
Â
function bp_get_members_pagination_count() {
|
519 |
Â
|
520 |
Â
/**
|
521 |
Â
* Output the members pagination links.
|
522 |
+
*
|
523 |
+
* @since 1.2.0
|
524 |
Â
*/
|
525 |
Â
function bp_members_pagination_links() {
|
526 |
Â
echo bp_get_members_pagination_links();
|
528 |
Â
/**
|
529 |
Â
* Fetch the members pagination links.
|
530 |
Â
*
|
531 |
+
* @since 1.2.0
|
532 |
+
*
|
533 |
Â
* @return string
|
534 |
Â
*/
|
535 |
Â
function bp_get_members_pagination_links() {
|
548 |
Â
/**
|
549 |
Â
* Output the ID of the current member in the loop.
|
550 |
Â
*
|
551 |
+
* @since 1.2.0
|
552 |
+
*
|
553 |
Â
*/
|
554 |
Â
function bp_member_user_id() {
|
555 |
Â
echo bp_get_member_user_id();
|
557 |
Â
/**
|
558 |
Â
* Get the ID of the current member in the loop.
|
559 |
Â
*
|
560 |
+
* @since 1.2.0
|
561 |
+
*
|
562 |
Â
* @return string Member ID.
|
563 |
Â
*/
|
564 |
Â
function bp_get_member_user_id() {
|
591 |
Â
* @since 1.7.0
|
592 |
Â
*
|
593 |
Â
* @param array $classes Array of custom classes.
|
Â
|
|
594 |
Â
* @return string Row class of the member
|
595 |
Â
*/
|
596 |
Â
function bp_get_member_class( $classes = array() ) {
|
601 |
Â
$pos_in_loop = (int) $members_template->current_member;
|
602 |
Â
$classes[] = ( $pos_in_loop % 2 ) ? 'even' : 'odd';
|
603 |
Â
|
604 |
+
// If we've only one member in the loop, don't bother with odd and even.
|
605 |
Â
} else {
|
606 |
Â
$classes[] = 'bp-single-member';
|
607 |
Â
}
|
625 |
Â
$classes[] = 'is-current-user';
|
626 |
Â
}
|
627 |
Â
|
628 |
+
// Add current user member types.
|
629 |
+
if ( $member_types = bp_get_member_type( $members_template->member->id, false ) ) {
|
630 |
+
foreach ( $member_types as $member_type ) {
|
631 |
+
$classes[] = sprintf( 'member-type-%s', esc_attr( $member_type ) );
|
632 |
+
}
|
633 |
+
}
|
634 |
+
|
635 |
Â
/**
|
636 |
Â
* Filters the determined classes to add to the HTML element.
|
637 |
Â
*
|
648 |
Â
|
649 |
Â
/**
|
650 |
Â
* Output nicename of current member in the loop.
|
651 |
+
*
|
652 |
+
* @since 1.2.5
|
653 |
Â
*/
|
654 |
Â
function bp_member_user_nicename() {
|
655 |
Â
echo bp_get_member_user_nicename();
|
657 |
Â
/**
|
658 |
Â
* Get the nicename of the current member in the loop.
|
659 |
Â
*
|
660 |
+
* @since 1.2.5
|
661 |
+
*
|
662 |
Â
* @return string Members nicename.
|
663 |
Â
*/
|
664 |
Â
function bp_get_member_user_nicename() {
|
676 |
Â
|
677 |
Â
/**
|
678 |
Â
* Output login for current member in the loop.
|
679 |
+
*
|
680 |
+
* @since 1.2.5
|
681 |
Â
*/
|
682 |
Â
function bp_member_user_login() {
|
683 |
Â
echo bp_get_member_user_login();
|
685 |
Â
/**
|
686 |
Â
* Get the login of the current member in the loop.
|
687 |
Â
*
|
688 |
+
* @since 1.2.5
|
689 |
+
*
|
690 |
Â
* @return string Member's login.
|
691 |
Â
*/
|
692 |
Â
function bp_get_member_user_login() {
|
704 |
Â
|
705 |
Â
/**
|
706 |
Â
* Output the email address for the current member in the loop.
|
707 |
+
*
|
708 |
+
* @since 1.2.5
|
709 |
Â
*/
|
710 |
Â
function bp_member_user_email() {
|
711 |
Â
echo bp_get_member_user_email();
|
713 |
Â
/**
|
714 |
Â
* Get the email address of the current member in the loop.
|
715 |
Â
*
|
716 |
+
* @since 1.2.5
|
717 |
+
*
|
718 |
Â
* @return string Member's email address.
|
719 |
Â
*/
|
720 |
Â
function bp_get_member_user_email() {
|
733 |
Â
/**
|
734 |
Â
* Check whether the current member in the loop is the logged-in user.
|
735 |
Â
*
|
736 |
+
* @since 1.2.5
|
737 |
+
*
|
738 |
Â
* @return bool
|
739 |
Â
*/
|
740 |
Â
function bp_member_is_loggedin_user() {
|
753 |
Â
/**
|
754 |
Â
* Output a member's avatar.
|
755 |
Â
*
|
756 |
+
* @since 1.2.0
|
757 |
+
*
|
758 |
Â
* @see bp_get_member_avatar() for description of arguments.
|
759 |
Â
*
|
760 |
Â
* @param array|string $args See {@link bp_get_member_avatar()}.
|
765 |
Â
* Filters a members avatar.
|
766 |
Â
*
|
767 |
Â
* @since 1.2.0
|
768 |
+
* @since 2.6.0 Added the `$args` parameter.
|
769 |
Â
*
|
770 |
+
* @param string $value Formatted HTML <img> element, or raw avatar URL based on $html arg.
|
771 |
+
* @param array|string $args See {@link bp_get_member_avatar()}.
|
772 |
Â
*/
|
773 |
+
echo apply_filters( 'bp_member_avatar', bp_get_member_avatar( $args ), $args );
|
774 |
Â
}
|
775 |
Â
/**
|
776 |
Â
* Get a member's avatar.
|
777 |
Â
*
|
778 |
+
* @since 1.2.0
|
779 |
+
*
|
780 |
Â
* @see bp_core_fetch_avatar() For a description of arguments and
|
781 |
Â
* return values.
|
782 |
Â
*
|
815 |
Â
* Filters a members avatar.
|
816 |
Â
*
|
817 |
Â
* @since 1.2.0
|
818 |
+
* @since 2.6.0 Added the `$r` parameter.
|
819 |
Â
*
|
820 |
Â
* @param string $value Formatted HTML <img> element, or raw avatar URL based on $html arg.
|
821 |
+
* @param array $r Array of parsed arguments. See {@link bp_get_member_avatar()}.
|
822 |
Â
*/
|
823 |
+
return apply_filters( 'bp_get_member_avatar', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->id, 'type' => $type, 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $members_template->member->user_email ) ), $r );
|
824 |
Â
}
|
825 |
Â
|
826 |
Â
/**
|
827 |
Â
* Output the permalink for the current member in the loop.
|
828 |
+
*
|
829 |
+
* @since 1.2.0
|
830 |
Â
*/
|
831 |
Â
function bp_member_permalink() {
|
832 |
Â
echo bp_get_member_permalink();
|
834 |
Â
/**
|
835 |
Â
* Get the permalink for the current member in the loop.
|
836 |
Â
*
|
837 |
+
* @since 1.2.0
|
838 |
+
*
|
839 |
Â
* @return string
|
840 |
Â
*/
|
841 |
Â
function bp_get_member_permalink() {
|
853 |
Â
|
854 |
Â
/**
|
855 |
Â
* Alias of {@link bp_member_permalink()}.
|
856 |
+
*
|
857 |
+
* @since 1.2.0
|
858 |
Â
*/
|
859 |
Â
function bp_member_link() { echo bp_get_member_permalink(); }
|
860 |
Â
|
861 |
Â
/**
|
862 |
Â
* Alias of {@link bp_get_member_permalink()}.
|
863 |
+
*
|
864 |
+
* @since 1.2.0
|
865 |
Â
*/
|
866 |
Â
function bp_get_member_link() { return bp_get_member_permalink(); }
|
867 |
Â
|
868 |
Â
/**
|
869 |
Â
* Output display name of current member in the loop.
|
870 |
+
*
|
871 |
+
* @since 1.2.0
|
872 |
Â
*/
|
873 |
Â
function bp_member_name() {
|
874 |
Â
|
889 |
Â
* WP users table, in the following order of preference: display_name,
|
890 |
Â
* user_nicename, user_login.
|
891 |
Â
*
|
892 |
+
* @since 1.2.0
|
893 |
+
*
|
894 |
Â
* @return string The user's fullname for display.
|
895 |
Â
*/
|
896 |
Â
function bp_get_member_name() {
|
931 |
Â
/**
|
932 |
Â
* Output the current member's last active time.
|
933 |
Â
*
|
934 |
+
* @since 1.2.0
|
935 |
+
*
|
936 |
Â
* @param array $args See {@link bp_get_member_last_active()}.
|
937 |
Â
*/
|
938 |
Â
function bp_member_last_active( $args = array() ) {
|
941 |
Â
/**
|
942 |
Â
* Return the current member's last active time.
|
943 |
Â
*
|
944 |
+
* @since 1.2.0
|
945 |
+
*
|
946 |
Â
* @param array $args {
|
947 |
Â
* Array of optional arguments.
|
948 |
Â
* @type mixed $active_format If true, formatted "active 5 minutes
|
973 |
Â
? bp_core_get_last_activity( $members_template->member->last_activity, $r['active_format'] )
|
974 |
Â
: bp_core_time_since( $members_template->member->last_activity );
|
975 |
Â
|
976 |
+
// Member has never logged in or been active.
|
977 |
Â
} else {
|
978 |
Â
$last_activity = __( 'Never active', 'buddypress' );
|
979 |
Â
}
|
992 |
Â
/**
|
993 |
Â
* Output the latest update of the current member in the loop.
|
994 |
Â
*
|
995 |
+
* @since 1.2.0
|
996 |
+
*
|
997 |
Â
* @param array|string $args Array of arguments for latest update.
|
998 |
Â
*/
|
999 |
Â
function bp_member_latest_update( $args = '' ) {
|
1002 |
Â
/**
|
1003 |
Â
* Get the latest update from the current member in the loop.
|
1004 |
Â
*
|
1005 |
+
* @since 1.2.0
|
1006 |
+
*
|
1007 |
Â
* @param array|string $args {
|
1008 |
Â
* Array of optional arguments.
|
1009 |
Â
* @type int $length Truncation length. Default: 225.
|
1030 |
Â
* Filters the excerpt of the latest update for current member in the loop.
|
1031 |
Â
*
|
1032 |
Â
* @since 1.2.5
|
1033 |
+
* @since 2.6.0 Added the `$r` parameter.
|
1034 |
Â
*
|
1035 |
Â
* @param string $value Excerpt of the latest update for current member in the loop.
|
1036 |
+
* @param array $r Array of parsed arguments.
|
1037 |
Â
*/
|
1038 |
+
$update_content = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], $length ) ) ), $r );
|
1039 |
Â
|
1040 |
Â
$update_content = sprintf( _x( '- "%s"', 'member latest update in member directory', 'buddypress' ), $update_content );
|
1041 |
Â
|
1051 |
Â
* Filters the latest update from the current member in the loop.
|
1052 |
Â
*
|
1053 |
Â
* @since 1.2.0
|
1054 |
+
* @since 2.6.0 Added the `$r` parameter.
|
1055 |
Â
*
|
1056 |
Â
* @param string $update_content Formatted latest update for current member.
|
1057 |
+
* @param array $r Array of parsed arguments.
|
1058 |
Â
*/
|
1059 |
+
return apply_filters( 'bp_get_member_latest_update', $update_content, $r );
|
1060 |
Â
}
|
1061 |
Â
|
1062 |
Â
/**
|
1063 |
Â
* Output a piece of user profile data.
|
1064 |
Â
*
|
1065 |
+
* @since 1.2.0
|
1066 |
+
*
|
1067 |
Â
* @see bp_get_member_profile_data() for a description of params.
|
1068 |
Â
*
|
1069 |
Â
* @param array|string $args See {@link bp_get_member_profile_data()}.
|
1078 |
Â
* to fetch profile data cached in the template global. It is also safe
|
1079 |
Â
* to use outside of the loop.
|
1080 |
Â
*
|
1081 |
+
* @since 1.2.0
|
1082 |
+
*
|
1083 |
Â
* @param array|string $args {
|
1084 |
Â
* Array of config parameters.
|
1085 |
Â
* @type string $field Name of the profile field.
|
1139 |
Â
* Filters resulting piece of member profile data.
|
1140 |
Â
*
|
1141 |
Â
* @since 1.2.0
|
1142 |
+
* @since 2.6.0 Added the `$r` parameter.
|
1143 |
Â
*
|
1144 |
Â
* @param string|bool $data Profile data if found, otherwise false.
|
1145 |
+
* @param array $r Array of parsed arguments.
|
1146 |
Â
*/
|
1147 |
+
return apply_filters( 'bp_get_member_profile_data', $data, $r );
|
1148 |
Â
}
|
1149 |
Â
|
1150 |
Â
/**
|
1151 |
Â
* Output the 'registered [x days ago]' string for the current member.
|
1152 |
+
*
|
1153 |
+
* @since 1.2.0
|
1154 |
Â
*/
|
1155 |
Â
function bp_member_registered() {
|
1156 |
Â
echo bp_get_member_registered();
|
1158 |
Â
/**
|
1159 |
Â
* Get the 'registered [x days ago]' string for the current member.
|
1160 |
Â
*
|
1161 |
+
* @since 1.2.0
|
1162 |
+
*
|
1163 |
Â
* @return string
|
1164 |
Â
*/
|
1165 |
Â
function bp_get_member_registered() {
|
1179 |
Â
|
1180 |
Â
/**
|
1181 |
Â
* Output a random piece of profile data for the current member in the loop.
|
1182 |
+
*
|
1183 |
+
* @since 1.2.0
|
1184 |
Â
*/
|
1185 |
Â
function bp_member_random_profile_data() {
|
1186 |
Â
global $members_template;
|
1194 |
Â
|
1195 |
Â
/**
|
1196 |
Â
* Output hidden input for preserving member search params on form submit.
|
1197 |
+
*
|
1198 |
+
* @since 1.2.0
|
1199 |
Â
*/
|
1200 |
Â
function bp_member_hidden_fields() {
|
1201 |
Â
$query_arg = bp_core_get_component_search_query_arg( 'members' );
|
1215 |
Â
|
1216 |
Â
/**
|
1217 |
Â
* Output the Members directory search form.
|
1218 |
+
*
|
1219 |
+
* @since 1.0.0
|
1220 |
Â
*/
|
1221 |
Â
function bp_directory_members_search_form() {
|
1222 |
Â
|
1245 |
Â
|
1246 |
Â
/**
|
1247 |
Â
* Output the total member count.
|
1248 |
+
*
|
1249 |
+
* @since 1.2.0
|
1250 |
Â
*/
|
1251 |
Â
function bp_total_site_member_count() {
|
1252 |
Â
echo bp_get_total_site_member_count();
|
1254 |
Â
/**
|
1255 |
Â
* Get the total site member count.
|
1256 |
Â
*
|
1257 |
+
* @since 1.2.0
|
1258 |
+
*
|
1259 |
Â
* @return int
|
1260 |
Â
*/
|
1261 |
Â
function bp_get_total_site_member_count() {
|
1284 |
Â
* The function will also analyze the current component the user is in, to
|
1285 |
Â
* determine whether or not to highlight a particular nav item.
|
1286 |
Â
*
|
1287 |
+
* @since 1.1.0
|
1288 |
+
*
|
1289 |
Â
* @todo Move to a back-compat file?
|
1290 |
Â
* @deprecated Does not seem to be called anywhere in BP core.
|
1291 |
Â
*/
|
1293 |
Â
$bp = buddypress();
|
1294 |
Â
|
1295 |
Â
// Loop through each navigation item.
|
1296 |
+
foreach ( (array) $bp->members->nav->get_primary() as $nav_item ) {
|
1297 |
Â
|
1298 |
Â
$selected = '';
|
1299 |
Â
|
1300 |
Â
// If the current component matches the nav item id, then add a highlight CSS class.
|
1301 |
+
if ( ! bp_is_directory() && ! empty( $bp->active_components[ bp_current_component() ] ) && $bp->active_components[ bp_current_component() ] == $nav_item->css_id ) {
|
1302 |
Â
$selected = ' class="current selected"';
|
1303 |
Â
}
|
1304 |
Â
|
1310 |
Â
$selected = '';
|
1311 |
Â
|
1312 |
Â
if ( bp_is_active( 'friends' ) ) {
|
1313 |
+
if ( $nav_item->css_id == $bp->friends->id ) {
|
1314 |
Â
if ( friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() ) ) {
|
1315 |
Â
$selected = ' class="current selected"';
|
1316 |
Â
}
|
1319 |
Â
}
|
1320 |
Â
|
1321 |
Â
// Echo out the final list item.
|
1322 |
+
echo apply_filters_ref_array( 'bp_get_loggedin_user_nav_' . $nav_item->css_id, array( '<li id="li-nav-' . $nav_item->css_id . '" ' . $selected . '><a id="my-' . $nav_item->css_id . '" href="' . $nav_item->link . '">' . $nav_item->name . '</a></li>', &$nav_item ) );
|
1323 |
Â
}
|
1324 |
Â
|
1325 |
Â
// Always add a log out list item to the end of the navigation.
|
1328 |
Â
echo apply_filters( 'bp_logout_nav_link', $logout_link );
|
1329 |
Â
}
|
1330 |
Â
|
1331 |
+
/**
|
1332 |
+
* Output the contents of the current user's home page.
|
1333 |
+
*
|
1334 |
+
* @since 2.6.0
|
1335 |
+
*/
|
1336 |
+
function bp_displayed_user_front_template_part() {
|
1337 |
+
$located = bp_displayed_user_get_front_template();
|
1338 |
+
|
1339 |
+
if ( false !== $located ) {
|
1340 |
+
$slug = str_replace( '.php', '', $located );
|
1341 |
+
$name = null;
|
1342 |
+
|
1343 |
+
/**
|
1344 |
+
* Let plugins adding an action to bp_get_template_part get it from here
|
1345 |
+
*
|
1346 |
+
* @param string $slug Template part slug requested.
|
1347 |
+
* @param string $name Template part name requested.
|
1348 |
+
*/
|
1349 |
+
do_action( 'get_template_part_' . $slug, $slug, $name );
|
1350 |
+
|
1351 |
+
load_template( $located, true );
|
1352 |
+
}
|
1353 |
+
|
1354 |
+
return $located;
|
1355 |
+
}
|
1356 |
+
|
1357 |
+
/**
|
1358 |
+
* Locate a custom user front template if it exists.
|
1359 |
+
*
|
1360 |
+
* @since 2.6.0
|
1361 |
+
*
|
1362 |
+
* @param object|null $displayed_user Optional. Falls back to current user if not passed.
|
1363 |
+
* @return string|bool Path to front template on success; boolean false on failure.
|
1364 |
+
*/
|
1365 |
+
function bp_displayed_user_get_front_template( $displayed_user = null ) {
|
1366 |
+
if ( ! is_object( $displayed_user ) || empty( $displayed_user->id ) ) {
|
1367 |
+
$displayed_user = bp_get_displayed_user();
|
1368 |
+
}
|
1369 |
+
|
1370 |
+
if ( ! isset( $displayed_user->id ) ) {
|
1371 |
+
return false;
|
1372 |
+
}
|
1373 |
+
|
1374 |
+
if ( isset( $displayed_user->front_template ) ) {
|
1375 |
+
return $displayed_user->front_template;
|
1376 |
+
}
|
1377 |
+
|
1378 |
+
// Init the hierarchy
|
1379 |
+
$template_names = array(
|
1380 |
+
'members/single/front-id-' . sanitize_file_name( $displayed_user->id ) . '.php',
|
1381 |
+
'members/single/front-nicename-' . sanitize_file_name( $displayed_user->userdata->user_nicename ) . '.php',
|
1382 |
+
);
|
1383 |
+
|
1384 |
+
/**
|
1385 |
+
* Check for member types and add it to the hierarchy
|
1386 |
+
*
|
1387 |
+
* Make sure to register your member
|
1388 |
+
* type using the hook 'bp_register_member_types'
|
1389 |
+
*/
|
1390 |
+
if ( bp_get_member_types() ) {
|
1391 |
+
$displayed_user_member_type = bp_get_member_type( $displayed_user->id );
|
1392 |
+
if ( ! $displayed_user_member_type ) {
|
1393 |
+
$displayed_user_member_type = 'none';
|
1394 |
+
}
|
1395 |
+
|
1396 |
+
$template_names[] = 'members/single/front-member-type-' . sanitize_file_name( $displayed_user_member_type ) . '.php';
|
1397 |
+
}
|
1398 |
+
|
1399 |
+
// Add The generic template to the end of the hierarchy
|
1400 |
+
$template_names[] = 'members/single/front.php';
|
1401 |
+
|
1402 |
+
/**
|
1403 |
+
* Filters the hierarchy of user front templates corresponding to a specific user.
|
1404 |
+
*
|
1405 |
+
* @since 2.6.0
|
1406 |
+
*
|
1407 |
+
* @param array $template_names Array of template paths.
|
1408 |
+
*/
|
1409 |
+
return bp_locate_template( apply_filters( 'bp_displayed_user_get_front_template', $template_names ), false, true );
|
1410 |
+
}
|
1411 |
+
|
1412 |
+
/**
|
1413 |
+
* Check if the displayed user has a custom front template.
|
1414 |
+
*
|
1415 |
+
* @since 2.6.0
|
1416 |
+
*/
|
1417 |
+
function bp_displayed_user_has_front_template() {
|
1418 |
+
$displayed_user = bp_get_displayed_user();
|
1419 |
+
|
1420 |
+
return ! empty( $displayed_user->front_template );
|
1421 |
+
}
|
1422 |
+
|
1423 |
Â
/**
|
1424 |
Â
* Render the navigation markup for the displayed user.
|
1425 |
+
*
|
1426 |
+
* @since 1.1.0
|
1427 |
Â
*/
|
1428 |
Â
function bp_get_displayed_user_nav() {
|
1429 |
Â
$bp = buddypress();
|
1430 |
Â
|
1431 |
+
foreach ( $bp->members->nav->get_primary() as $user_nav_item ) {
|
1432 |
+
if ( empty( $user_nav_item->show_for_displayed_user ) && ! bp_is_my_profile() ) {
|
1433 |
Â
continue;
|
1434 |
+
}
|
1435 |
Â
|
1436 |
Â
$selected = '';
|
1437 |
+
if ( bp_is_current_component( $user_nav_item->slug ) ) {
|
1438 |
Â
$selected = ' class="current selected"';
|
1439 |
Â
}
|
1440 |
Â
|
1441 |
Â
if ( bp_loggedin_user_domain() ) {
|
1442 |
+
$link = str_replace( bp_loggedin_user_domain(), bp_displayed_user_domain(), $user_nav_item->link );
|
1443 |
Â
} else {
|
1444 |
+
$link = trailingslashit( bp_displayed_user_domain() . $user_nav_item->link );
|
1445 |
Â
}
|
1446 |
Â
|
1447 |
Â
/**
|
1455 |
Â
* @param array $user_nav_item Array holding parts used to construct tab list item.
|
1456 |
Â
* Passed by reference.
|
1457 |
Â
*/
|
1458 |
+
echo apply_filters_ref_array( 'bp_get_displayed_user_nav_' . $user_nav_item->css_id, array( '<li id="' . $user_nav_item->css_id . '-personal-li" ' . $selected . '><a id="user-' . $user_nav_item->css_id . '" href="' . $link . '">' . $user_nav_item->name . '</a></li>', &$user_nav_item ) );
|
1459 |
Â
}
|
1460 |
Â
}
|
1461 |
Â
|
1478 |
Â
/**
|
1479 |
Â
* Output the logged-in user's avatar.
|
1480 |
Â
*
|
1481 |
+
* @since 1.1.0
|
1482 |
+
*
|
1483 |
Â
* @see bp_get_loggedin_user_avatar() for a description of params.
|
1484 |
Â
*
|
1485 |
Â
* @param array|string $args Array of arguments for logged in user avatar.
|
1490 |
Â
/**
|
1491 |
Â
* Get the logged-in user's avatar.
|
1492 |
Â
*
|
1493 |
+
* @since 1.1.0
|
1494 |
+
*
|
1495 |
Â
* @see bp_core_fetch_avatar() For a description of arguments and
|
1496 |
Â
* return values.
|
1497 |
Â
*
|
1524 |
Â
* @since 1.1.0
|
1525 |
Â
*
|
1526 |
Â
* @param string $value User avatar string.
|
1527 |
+
* @param array $r Array of parsed arguments.
|
1528 |
+
* @param array $args Array of initial arguments.
|
1529 |
Â
*/
|
1530 |
Â
return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( $r ), $r, $args );
|
1531 |
Â
}
|
1533 |
Â
/**
|
1534 |
Â
* Output the displayed user's avatar.
|
1535 |
Â
*
|
1536 |
+
* @since 1.1.0
|
1537 |
+
*
|
1538 |
Â
* @see bp_get_displayed_user_avatar() for a description of params.
|
1539 |
Â
*
|
1540 |
Â
* @param array|string $args Array of arguments for displayed user avatar.
|
1545 |
Â
/**
|
1546 |
Â
* Get the displayed user's avatar.
|
1547 |
Â
*
|
1548 |
+
* @since 1.1.0
|
1549 |
+
*
|
1550 |
Â
* @see bp_core_fetch_avatar() For a description of arguments and
|
1551 |
Â
* return values.
|
1552 |
Â
*
|
1579 |
Â
* @since 1.1.0
|
1580 |
Â
*
|
1581 |
Â
* @param string $value User avatar string.
|
1582 |
+
* @param array $r Array of parsed arguments.
|
1583 |
+
* @param array $args Array of initial arguments.
|
1584 |
Â
*/
|
1585 |
Â
return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( $r ), $r, $args );
|
1586 |
Â
}
|
1587 |
Â
|
1588 |
Â
/**
|
1589 |
Â
* Output the email address of the displayed user.
|
1590 |
+
*
|
1591 |
+
* @since 1.5.0
|
1592 |
Â
*/
|
1593 |
Â
function bp_displayed_user_email() {
|
1594 |
Â
echo bp_get_displayed_user_email();
|
1596 |
Â
/**
|
1597 |
Â
* Get the email address of the displayed user.
|
1598 |
Â
*
|
1599 |
+
* @since 1.5.0
|
1600 |
+
*
|
1601 |
Â
* @return string
|
1602 |
Â
*/
|
1603 |
Â
function bp_get_displayed_user_email() {
|
1622 |
Â
/**
|
1623 |
Â
* Output the "active [x days ago]" string for a user.
|
1624 |
Â
*
|
1625 |
+
* @since 1.0.0
|
1626 |
+
*
|
1627 |
Â
* @see bp_get_last_activity() for a description of parameters.
|
1628 |
Â
*
|
1629 |
Â
* @param int $user_id See {@link bp_get_last_activity()}.
|
1642 |
Â
/**
|
1643 |
Â
* Get the "active [x days ago]" string for a user.
|
1644 |
Â
*
|
1645 |
+
* @since 1.5.0
|
1646 |
+
*
|
1647 |
Â
* @param int $user_id ID of the user. Default: displayed user ID.
|
1648 |
Â
* @return string
|
1649 |
Â
*/
|
1658 |
Â
* Filters the 'active [x days ago]' string for a user.
|
1659 |
Â
*
|
1660 |
Â
* @since 1.5.0
|
1661 |
+
* @since 2.6.0 Added the `$user_id` parameter.
|
1662 |
Â
*
|
1663 |
+
* @param string $value Formatted 'active [x days ago]' string.
|
1664 |
+
* @param int $user_id ID of the user.
|
1665 |
Â
*/
|
1666 |
+
return apply_filters( 'bp_get_last_activity', $last_activity, $user_id );
|
1667 |
Â
}
|
1668 |
Â
|
1669 |
Â
/**
|
1670 |
Â
* Output the calculated first name of the displayed or logged-in user.
|
1671 |
+
*
|
1672 |
+
* @since 1.2.0
|
1673 |
Â
*/
|
1674 |
Â
function bp_user_firstname() {
|
1675 |
Â
echo bp_get_user_firstname();
|
1679 |
Â
*
|
1680 |
Â
* Simply takes all the characters before the first space in a name.
|
1681 |
Â
*
|
1682 |
+
* @since 1.2.0
|
1683 |
+
*
|
1684 |
Â
* @param string|bool $name Full name to use when generating first name.
|
1685 |
Â
* Defaults to displayed user's first name, or to
|
1686 |
Â
* logged-in user's first name if it's unavailable.
|
1711 |
Â
|
1712 |
Â
/**
|
1713 |
Â
* Output the link for the logged-in user's profile.
|
1714 |
+
*
|
1715 |
+
* @since 1.2.4
|
1716 |
Â
*/
|
1717 |
Â
function bp_loggedin_user_link() {
|
1718 |
Â
echo bp_get_loggedin_user_link();
|
1720 |
Â
/**
|
1721 |
Â
* Get the link for the logged-in user's profile.
|
1722 |
Â
*
|
1723 |
+
* @since 1.0.0
|
1724 |
+
*
|
1725 |
Â
* @return string
|
1726 |
Â
*/
|
1727 |
Â
function bp_get_loggedin_user_link() {
|
1738 |
Â
|
1739 |
Â
/**
|
1740 |
Â
* Output the link for the displayed user's profile.
|
1741 |
+
*
|
1742 |
+
* @since 1.2.4
|
1743 |
Â
*/
|
1744 |
Â
function bp_displayed_user_link() {
|
1745 |
Â
echo bp_get_displayed_user_link();
|
1747 |
Â
/**
|
1748 |
Â
* Get the link for the displayed user's profile.
|
1749 |
Â
*
|
1750 |
+
* @since 1.0.0
|
1751 |
+
*
|
1752 |
Â
* @return string
|
1753 |
Â
*/
|
1754 |
Â
function bp_get_displayed_user_link() {
|
1772 |
Â
|
1773 |
Â
/**
|
1774 |
Â
* Alias of {@link bp_displayed_user_id()}.
|
1775 |
+
*
|
1776 |
+
* @since 1.0.0
|
1777 |
Â
*/
|
1778 |
Â
function bp_current_user_id() { return bp_displayed_user_id(); }
|
1779 |
Â
|
1780 |
Â
/**
|
1781 |
Â
* Generate the link for the displayed user's profile.
|
1782 |
Â
*
|
1783 |
+
* @since 1.0.0
|
1784 |
+
*
|
1785 |
Â
* @return string
|
1786 |
Â
*/
|
1787 |
Â
function bp_displayed_user_domain() {
|
1800 |
Â
/**
|
1801 |
Â
* Generate the link for the logged-in user's profile.
|
1802 |
Â
*
|
1803 |
+
* @since 1.0.0
|
1804 |
+
*
|
1805 |
Â
* @return string
|
1806 |
Â
*/
|
1807 |
Â
function bp_loggedin_user_domain() {
|
1819 |
Â
|
1820 |
Â
/**
|
1821 |
Â
* Output the displayed user's display name.
|
1822 |
+
*
|
1823 |
+
* @since 1.0.0
|
1824 |
Â
*/
|
1825 |
Â
function bp_displayed_user_fullname() {
|
1826 |
Â
echo bp_get_displayed_user_fullname();
|
1828 |
Â
/**
|
1829 |
Â
* Get the displayed user's display name.
|
1830 |
Â
*
|
1831 |
+
* @since 1.2.0
|
1832 |
+
*
|
1833 |
Â
* @return string
|
1834 |
Â
*/
|
1835 |
Â
function bp_get_displayed_user_fullname() {
|
1847 |
Â
|
1848 |
Â
/**
|
1849 |
Â
* Alias of {@link bp_get_displayed_user_fullname()}.
|
1850 |
+
*
|
1851 |
+
* @since 1.0.0
|
1852 |
Â
*/
|
1853 |
Â
function bp_user_fullname() { echo bp_get_displayed_user_fullname(); }
|
1854 |
Â
|
1855 |
Â
|
1856 |
Â
/**
|
1857 |
Â
* Output the logged-in user's display name.
|
1858 |
+
*
|
1859 |
+
* @since 1.0.0
|
1860 |
Â
*/
|
1861 |
Â
function bp_loggedin_user_fullname() {
|
1862 |
Â
echo bp_get_loggedin_user_fullname();
|
1864 |
Â
/**
|
1865 |
Â
* Get the logged-in user's display name.
|
1866 |
Â
*
|
1867 |
+
* @since 1.0.0
|
1868 |
+
*
|
1869 |
Â
* @return string
|
1870 |
Â
*/
|
1871 |
Â
function bp_get_loggedin_user_fullname() {
|
1883 |
Â
|
1884 |
Â
/**
|
1885 |
Â
* Output the username of the displayed user.
|
1886 |
+
*
|
1887 |
+
* @since 1.2.0
|
1888 |
Â
*/
|
1889 |
Â
function bp_displayed_user_username() {
|
1890 |
Â
echo bp_get_displayed_user_username();
|
1892 |
Â
/**
|
1893 |
Â
* Get the username of the displayed user.
|
1894 |
Â
*
|
1895 |
+
* @since 1.2.0
|
1896 |
+
*
|
1897 |
Â
* @return string
|
1898 |
Â
*/
|
1899 |
Â
function bp_get_displayed_user_username() {
|
1917 |
Â
|
1918 |
Â
/**
|
1919 |
Â
* Output the username of the logged-in user.
|
1920 |
+
*
|
1921 |
+
* @since 1.2.0
|
1922 |
Â
*/
|
1923 |
Â
function bp_loggedin_user_username() {
|
1924 |
Â
echo bp_get_loggedin_user_username();
|
1926 |
Â
/**
|
1927 |
Â
* Get the username of the logged-in user.
|
1928 |
Â
*
|
1929 |
+
* @since 1.2.0
|
1930 |
+
*
|
1931 |
Â
* @return string
|
1932 |
Â
*/
|
1933 |
Â
function bp_get_loggedin_user_username() {
|
1968 |
Â
|
1969 |
Â
$message = sprintf( __( 'Viewing members of the type: %s', 'buddypress' ), '<strong>' . $type_object->labels['singular_name'] . '</strong>' );
|
1970 |
Â
|
1971 |
+
/**
|
1972 |
+
* Filters the current member type message.
|
1973 |
+
*
|
1974 |
+
* @since 2.3.0
|
1975 |
+
*
|
1976 |
+
* @param string $message Message to filter.
|
1977 |
+
*/
|
1978 |
Â
return apply_filters( 'bp_get_current_member_type_message', $message );
|
1979 |
Â
}
|
1980 |
Â
|
1985 |
Â
*
|
1986 |
Â
* @since 1.5.0
|
1987 |
Â
*
|
Â
|
|
Â
|
|
Â
|
|
1988 |
Â
* @return bool True if page and template exist, false if not.
|
1989 |
Â
*/
|
1990 |
Â
function bp_has_custom_signup_page() {
|
1998 |
Â
|
1999 |
Â
/**
|
2000 |
Â
* Output the URL to the signup page.
|
2001 |
+
*
|
2002 |
+
* @since 1.0.0
|
2003 |
Â
*/
|
2004 |
Â
function bp_signup_page() {
|
2005 |
Â
echo esc_url( bp_get_signup_page() );
|
2007 |
Â
/**
|
2008 |
Â
* Get the URL to the signup page.
|
2009 |
Â
*
|
2010 |
+
* @since 1.1.0
|
2011 |
+
*
|
2012 |
Â
* @return string
|
2013 |
Â
*/
|
2014 |
Â
function bp_get_signup_page() {
|
2033 |
Â
*
|
2034 |
Â
* @since 1.5.0
|
2035 |
Â
*
|
Â
|
|
Â
|
|
2036 |
Â
* @return boolean True if page and template exist, false if not.
|
2037 |
Â
*/
|
2038 |
Â
function bp_has_custom_activation_page() {
|
2046 |
Â
|
2047 |
Â
/**
|
2048 |
Â
* Output the URL of the activation page.
|
2049 |
+
*
|
2050 |
+
* @since 1.0.0
|
2051 |
Â
*/
|
2052 |
Â
function bp_activation_page() {
|
2053 |
Â
echo esc_url( bp_get_activation_page() );
|
2055 |
Â
/**
|
2056 |
Â
* Get the URL of the activation page.
|
2057 |
Â
*
|
2058 |
+
* @since 1.2.0
|
2059 |
+
*
|
2060 |
Â
* @return string
|
2061 |
Â
*/
|
2062 |
Â
function bp_get_activation_page() {
|
2078 |
Â
|
2079 |
Â
/**
|
2080 |
Â
* Output the username submitted during signup.
|
2081 |
+
*
|
2082 |
+
* @since 1.1.0
|
2083 |
Â
*/
|
2084 |
Â
function bp_signup_username_value() {
|
2085 |
Â
echo bp_get_signup_username_value();
|
2087 |
Â
/**
|
2088 |
Â
* Get the username submitted during signup.
|
2089 |
Â
*
|
2090 |
+
* @since 1.1.0
|
2091 |
+
*
|
2092 |
Â
* @todo This should be properly escaped.
|
2093 |
Â
*
|
2094 |
Â
* @return string
|
2110 |
Â
|
2111 |
Â
/**
|
2112 |
Â
* Output the user email address submitted during signup.
|
2113 |
+
*
|
2114 |
+
* @since 1.1.0
|
2115 |
Â
*/
|
2116 |
Â
function bp_signup_email_value() {
|
2117 |
Â
echo bp_get_signup_email_value();
|
2119 |
Â
/**
|
2120 |
Â
* Get the email address submitted during signup.
|
2121 |
Â
*
|
2122 |
+
* @since 1.1.0
|
2123 |
+
*
|
2124 |
Â
* @todo This should be properly escaped.
|
2125 |
Â
*
|
2126 |
Â
* @return string
|
2142 |
Â
|
2143 |
Â
/**
|
2144 |
Â
* Output the 'signup_with_blog' value submitted during signup.
|
2145 |
+
*
|
2146 |
+
* @since 1.1.0
|
2147 |
Â
*/
|
2148 |
Â
function bp_signup_with_blog_value() {
|
2149 |
Â
echo bp_get_signup_with_blog_value();
|
2151 |
Â
/**
|
2152 |
Â
* Get the 'signup_with_blog' value submitted during signup.
|
2153 |
Â
*
|
2154 |
+
* @since 1.1.0
|
2155 |
+
*
|
2156 |
Â
* @return string
|
2157 |
Â
*/
|
2158 |
Â
function bp_get_signup_with_blog_value() {
|
2172 |
Â
|
2173 |
Â
/**
|
2174 |
Â
* Output the 'signup_blog_url' value submitted at signup.
|
2175 |
+
*
|
2176 |
+
* @since 1.1.0
|
2177 |
Â
*/
|
2178 |
Â
function bp_signup_blog_url_value() {
|
2179 |
Â
echo bp_get_signup_blog_url_value();
|
2181 |
Â
/**
|
2182 |
Â
* Get the 'signup_blog_url' value submitted at signup.
|
2183 |
Â
*
|
2184 |
+
* @since 1.1.0
|
2185 |
+
*
|
2186 |
Â
* @todo Should be properly escaped.
|
2187 |
Â
*
|
2188 |
Â
* @return string
|
2238 |
Â
|
2239 |
Â
/**
|
2240 |
Â
* Output the 'signup_blog_titl' value submitted at signup.
|
2241 |
+
*
|
2242 |
+
* @since 1.1.0
|
2243 |
Â
*/
|
2244 |
Â
function bp_signup_blog_title_value() {
|
2245 |
Â
echo bp_get_signup_blog_title_value();
|
2247 |
Â
/**
|
2248 |
Â
* Get the 'signup_blog_title' value submitted at signup.
|
2249 |
Â
*
|
2250 |
+
* @since 1.1.0
|
2251 |
+
*
|
2252 |
Â
* @todo Should be properly escaped.
|
2253 |
Â
*
|
2254 |
Â
* @return string
|
2270 |
Â
|
2271 |
Â
/**
|
2272 |
Â
* Output the 'signup_blog_privacy' value submitted at signup.
|
2273 |
+
*
|
2274 |
+
* @since 1.1.0
|
2275 |
Â
*/
|
2276 |
Â
function bp_signup_blog_privacy_value() {
|
2277 |
Â
echo bp_get_signup_blog_privacy_value();
|
2279 |
Â
/**
|
2280 |
Â
* Get the 'signup_blog_privacy' value submitted at signup.
|
2281 |
Â
*
|
2282 |
+
* @since 1.1.0
|
2283 |
+
*
|
2284 |
Â
* @todo Should be properly escaped.
|
2285 |
Â
*
|
2286 |
Â
* @return string
|
2302 |
Â
|
2303 |
Â
/**
|
2304 |
Â
* Output the avatar dir used during signup.
|
2305 |
+
*
|
2306 |
+
* @since 1.1.0
|
2307 |
Â
*/
|
2308 |
Â
function bp_signup_avatar_dir_value() {
|
2309 |
Â
echo bp_get_signup_avatar_dir_value();
|
2311 |
Â
/**
|
2312 |
Â
* Get the avatar dir used during signup.
|
2313 |
Â
*
|
2314 |
+
* @since 1.1.0
|
2315 |
+
*
|
2316 |
Â
* @return string
|
2317 |
Â
*/
|
2318 |
Â
function bp_get_signup_avatar_dir_value() {
|
2342 |
Â
|
2343 |
Â
/**
|
2344 |
Â
* Output the current signup step.
|
2345 |
+
*
|
2346 |
+
* @since 1.1.0
|
2347 |
Â
*/
|
2348 |
Â
function bp_current_signup_step() {
|
2349 |
Â
echo bp_get_current_signup_step();
|
2351 |
Â
/**
|
2352 |
Â
* Get the current signup step.
|
2353 |
Â
*
|
2354 |
+
* @since 1.1.0
|
2355 |
+
*
|
2356 |
Â
* @return string
|
2357 |
Â
*/
|
2358 |
Â
function bp_get_current_signup_step() {
|
2362 |
Â
/**
|
2363 |
Â
* Output the user avatar during signup.
|
2364 |
Â
*
|
2365 |
+
* @since 1.1.0
|
2366 |
+
*
|
2367 |
Â
* @see bp_get_signup_avatar() for description of arguments.
|
2368 |
Â
*
|
2369 |
Â
* @param array|string $args See {@link bp_get_signup_avatar(}.
|
2374 |
Â
/**
|
2375 |
Â
* Get the user avatar during signup.
|
2376 |
Â
*
|
2377 |
+
* @since 1.1.0
|
2378 |
+
*
|
2379 |
Â
* @see bp_core_fetch_avatar() for description of arguments.
|
2380 |
Â
*
|
2381 |
Â
* @param array|string $args {
|
2412 |
Â
'class' => $class
|
2413 |
Â
) );
|
2414 |
Â
|
2415 |
+
// No avatar DIR was found.
|
2416 |
Â
} else {
|
2417 |
Â
|
2418 |
Â
// Set default gravatar type.
|
2449 |
Â
/**
|
2450 |
Â
* Output whether signup is allowed.
|
2451 |
Â
*
|
2452 |
+
* @since 1.1.0
|
2453 |
+
*
|
2454 |
Â
* @todo Remove this function. Echoing a bool is pointless.
|
2455 |
Â
*/
|
2456 |
Â
function bp_signup_allowed() {
|
2459 |
Â
/**
|
2460 |
Â
* Is user signup allowed?
|
2461 |
Â
*
|
2462 |
+
* @since 1.1.0
|
2463 |
+
*
|
2464 |
Â
* @return bool
|
2465 |
Â
*/
|
2466 |
Â
function bp_get_signup_allowed() {
|
2509 |
Â
/**
|
2510 |
Â
* Output a link to a members component subpage.
|
2511 |
Â
*
|
2512 |
+
* @since 1.5.0
|
2513 |
+
*
|
2514 |
Â
* @see bp_get_members_component_link() for description of parameters.
|
2515 |
Â
*
|
2516 |
Â
* @param string $component See {@bp_get_members_component_link()}.
|
2524 |
Â
/**
|
2525 |
Â
* Generate a link to a members component subpage.
|
2526 |
Â
*
|
2527 |
+
* @since 1.5.0
|
2528 |
+
*
|
2529 |
Â
* @param string $component ID of the component (eg 'friends').
|
2530 |
Â
* @param string $action Optional. 'action' slug (eg 'invites').
|
2531 |
Â
* @param array|string $query_args Optional. Array of URL params to add to the
|
@@ -10,9 +10,11 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
14 |
-
require dirname( __FILE__ ) . '/classes/class-bp-core-
|
15 |
-
require dirname( __FILE__ ) . '/classes/class-bp-core-
|
Â
|
|
Â
|
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Register bp-members widgets.
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-core-members-widget.php';
|
15 |
+
require dirname( __FILE__ ) . '/classes/class-bp-core-whos-online-widget.php';
|
16 |
+
require dirname( __FILE__ ) . '/classes/class-bp-core-recently-active-widget.php';
|
17 |
+
}
|
18 |
Â
|
19 |
Â
/**
|
20 |
Â
* Register bp-members widgets.
|
@@ -13,12 +13,15 @@ defined( 'ABSPATH' ) || exit;
|
|
13 |
Â
* The main member template loop class.
|
14 |
Â
*
|
15 |
Â
* Responsible for loading a group of members into a loop for display.
|
Â
|
|
Â
|
|
16 |
Â
*/
|
17 |
Â
class BP_Core_Members_Template {
|
18 |
Â
|
19 |
Â
/**
|
20 |
Â
* The loop iterator.
|
21 |
Â
*
|
Â
|
|
22 |
Â
* @var int
|
23 |
Â
*/
|
24 |
Â
public $current_member = -1;
|
@@ -26,6 +29,7 @@ class BP_Core_Members_Template {
|
|
26 |
Â
/**
|
27 |
Â
* The number of members returned by the paged query.
|
28 |
Â
*
|
Â
|
|
29 |
Â
* @var int
|
30 |
Â
*/
|
31 |
Â
public $member_count;
|
@@ -33,6 +37,7 @@ class BP_Core_Members_Template {
|
|
33 |
Â
/**
|
34 |
Â
* Array of members located by the query.
|
35 |
Â
*
|
Â
|
|
36 |
Â
* @var array
|
37 |
Â
*/
|
38 |
Â
public $members;
|
@@ -40,6 +45,7 @@ class BP_Core_Members_Template {
|
|
40 |
Â
/**
|
41 |
Â
* The member object currently being iterated on.
|
42 |
Â
*
|
Â
|
|
43 |
Â
* @var object
|
44 |
Â
*/
|
45 |
Â
public $member;
|
@@ -47,6 +53,7 @@ class BP_Core_Members_Template {
|
|
47 |
Â
/**
|
48 |
Â
* A flag for whether the loop is currently being iterated.
|
49 |
Â
*
|
Â
|
|
50 |
Â
* @var bool
|
51 |
Â
*/
|
52 |
Â
public $in_the_loop;
|
@@ -54,6 +61,7 @@ class BP_Core_Members_Template {
|
|
54 |
Â
/**
|
55 |
Â
* The type of member being requested. Used for ordering results.
|
56 |
Â
*
|
Â
|
|
57 |
Â
* @var string
|
58 |
Â
*/
|
59 |
Â
public $type;
|
@@ -61,6 +69,7 @@ class BP_Core_Members_Template {
|
|
61 |
Â
/**
|
62 |
Â
* The unique string used for pagination queries.
|
63 |
Â
*
|
Â
|
|
64 |
Â
* @var string
|
65 |
Â
*/
|
66 |
Â
public $pag_arg;
|
@@ -68,6 +77,7 @@ class BP_Core_Members_Template {
|
|
68 |
Â
/**
|
69 |
Â
* The page number being requested.
|
70 |
Â
*
|
Â
|
|
71 |
Â
* @var string
|
72 |
Â
*/
|
73 |
Â
public $pag_page;
|
@@ -75,6 +85,7 @@ class BP_Core_Members_Template {
|
|
75 |
Â
/**
|
76 |
Â
* The number of items being requested per page.
|
77 |
Â
*
|
Â
|
|
78 |
Â
* @var string
|
79 |
Â
*/
|
80 |
Â
public $pag_num;
|
@@ -82,6 +93,7 @@ class BP_Core_Members_Template {
|
|
82 |
Â
/**
|
83 |
Â
* An HTML string containing pagination links.
|
84 |
Â
*
|
Â
|
|
85 |
Â
* @var string
|
86 |
Â
*/
|
87 |
Â
public $pag_links;
|
@@ -89,6 +101,7 @@ class BP_Core_Members_Template {
|
|
89 |
Â
/**
|
90 |
Â
* The total number of members matching the query parameters.
|
91 |
Â
*
|
Â
|
|
92 |
Â
* @var int
|
93 |
Â
*/
|
94 |
Â
public $total_member_count;
|
@@ -96,6 +109,8 @@ class BP_Core_Members_Template {
|
|
96 |
Â
/**
|
97 |
Â
* Constructor method.
|
98 |
Â
*
|
Â
|
|
Â
|
|
99 |
Â
* @see BP_User_Query for an in-depth description of parameters.
|
100 |
Â
*
|
101 |
Â
* @param string $type Sort order.
|
@@ -184,6 +199,8 @@ class BP_Core_Members_Template {
|
|
184 |
Â
/**
|
185 |
Â
* Whether there are members available in the loop.
|
186 |
Â
*
|
Â
|
|
Â
|
|
187 |
Â
* @see bp_has_members()
|
188 |
Â
*
|
189 |
Â
* @return bool True if there are items in the loop, otherwise false.
|
@@ -198,6 +215,8 @@ class BP_Core_Members_Template {
|
|
198 |
Â
/**
|
199 |
Â
* Set up the next member and iterate index.
|
200 |
Â
*
|
Â
|
|
Â
|
|
201 |
Â
* @return object The next member to iterate over.
|
202 |
Â
*/
|
203 |
Â
function next_member() {
|
@@ -209,6 +228,8 @@ class BP_Core_Members_Template {
|
|
209 |
Â
|
210 |
Â
/**
|
211 |
Â
* Rewind the members and reset member index.
|
Â
|
|
Â
|
|
212 |
Â
*/
|
213 |
Â
function rewind_members() {
|
214 |
Â
$this->current_member = -1;
|
@@ -224,6 +245,8 @@ class BP_Core_Members_Template {
|
|
224 |
Â
* that controls iteration inside the members loop, eg:
|
225 |
Â
* while ( bp_members() ) { ...
|
226 |
Â
*
|
Â
|
|
Â
|
|
227 |
Â
* @see bp_members()
|
228 |
Â
*
|
229 |
Â
* @return bool True if there are more members to show, otherwise false.
|
@@ -254,6 +277,8 @@ class BP_Core_Members_Template {
|
|
254 |
Â
* while looping, so that template tags used during that iteration make
|
255 |
Â
* reference to the current member.
|
256 |
Â
*
|
Â
|
|
Â
|
|
257 |
Â
* @see bp_the_member()
|
258 |
Â
*/
|
259 |
Â
function the_member() {
|
13 |
Â
* The main member template loop class.
|
14 |
Â
*
|
15 |
Â
* Responsible for loading a group of members into a loop for display.
|
16 |
+
*
|
17 |
+
* @since 1.0.0
|
18 |
Â
*/
|
19 |
Â
class BP_Core_Members_Template {
|
20 |
Â
|
21 |
Â
/**
|
22 |
Â
* The loop iterator.
|
23 |
Â
*
|
24 |
+
* @since 1.0.0
|
25 |
Â
* @var int
|
26 |
Â
*/
|
27 |
Â
public $current_member = -1;
|
29 |
Â
/**
|
30 |
Â
* The number of members returned by the paged query.
|
31 |
Â
*
|
32 |
+
* @since 1.0.0
|
33 |
Â
* @var int
|
34 |
Â
*/
|
35 |
Â
public $member_count;
|
37 |
Â
/**
|
38 |
Â
* Array of members located by the query.
|
39 |
Â
*
|
40 |
+
* @since 1.0.0
|
41 |
Â
* @var array
|
42 |
Â
*/
|
43 |
Â
public $members;
|
45 |
Â
/**
|
46 |
Â
* The member object currently being iterated on.
|
47 |
Â
*
|
48 |
+
* @since 1.0.0
|
49 |
Â
* @var object
|
50 |
Â
*/
|
51 |
Â
public $member;
|
53 |
Â
/**
|
54 |
Â
* A flag for whether the loop is currently being iterated.
|
55 |
Â
*
|
56 |
+
* @since 1.0.0
|
57 |
Â
* @var bool
|
58 |
Â
*/
|
59 |
Â
public $in_the_loop;
|
61 |
Â
/**
|
62 |
Â
* The type of member being requested. Used for ordering results.
|
63 |
Â
*
|
64 |
+
* @since 2.3.0
|
65 |
Â
* @var string
|
66 |
Â
*/
|
67 |
Â
public $type;
|
69 |
Â
/**
|
70 |
Â
* The unique string used for pagination queries.
|
71 |
Â
*
|
72 |
+
* @since 2.2.0
|
73 |
Â
* @var string
|
74 |
Â
*/
|
75 |
Â
public $pag_arg;
|
77 |
Â
/**
|
78 |
Â
* The page number being requested.
|
79 |
Â
*
|
80 |
+
* @since 1.0.0
|
81 |
Â
* @var string
|
82 |
Â
*/
|
83 |
Â
public $pag_page;
|
85 |
Â
/**
|
86 |
Â
* The number of items being requested per page.
|
87 |
Â
*
|
88 |
+
* @since 1.0.0
|
89 |
Â
* @var string
|
90 |
Â
*/
|
91 |
Â
public $pag_num;
|
93 |
Â
/**
|
94 |
Â
* An HTML string containing pagination links.
|
95 |
Â
*
|
96 |
+
* @since 1.0.0
|
97 |
Â
* @var string
|
98 |
Â
*/
|
99 |
Â
public $pag_links;
|
101 |
Â
/**
|
102 |
Â
* The total number of members matching the query parameters.
|
103 |
Â
*
|
104 |
+
* @since 1.0.0
|
105 |
Â
* @var int
|
106 |
Â
*/
|
107 |
Â
public $total_member_count;
|
109 |
Â
/**
|
110 |
Â
* Constructor method.
|
111 |
Â
*
|
112 |
+
* @since 1.5.0
|
113 |
+
*
|
114 |
Â
* @see BP_User_Query for an in-depth description of parameters.
|
115 |
Â
*
|
116 |
Â
* @param string $type Sort order.
|
199 |
Â
/**
|
200 |
Â
* Whether there are members available in the loop.
|
201 |
Â
*
|
202 |
+
* @since 1.0.0
|
203 |
+
*
|
204 |
Â
* @see bp_has_members()
|
205 |
Â
*
|
206 |
Â
* @return bool True if there are items in the loop, otherwise false.
|
215 |
Â
/**
|
216 |
Â
* Set up the next member and iterate index.
|
217 |
Â
*
|
218 |
+
* @since 1.0.0
|
219 |
+
*
|
220 |
Â
* @return object The next member to iterate over.
|
221 |
Â
*/
|
222 |
Â
function next_member() {
|
228 |
Â
|
229 |
Â
/**
|
230 |
Â
* Rewind the members and reset member index.
|
231 |
+
*
|
232 |
+
* @since 1.0.0
|
233 |
Â
*/
|
234 |
Â
function rewind_members() {
|
235 |
Â
$this->current_member = -1;
|
245 |
Â
* that controls iteration inside the members loop, eg:
|
246 |
Â
* while ( bp_members() ) { ...
|
247 |
Â
*
|
248 |
+
* @since 1.2.0
|
249 |
+
*
|
250 |
Â
* @see bp_members()
|
251 |
Â
*
|
252 |
Â
* @return bool True if there are more members to show, otherwise false.
|
277 |
Â
* while looping, so that template tags used during that iteration make
|
278 |
Â
* reference to the current member.
|
279 |
Â
*
|
280 |
+
* @since 1.0.0
|
281 |
+
*
|
282 |
Â
* @see bp_the_member()
|
283 |
Â
*/
|
284 |
Â
function the_member() {
|
@@ -19,6 +19,8 @@ class BP_Core_Members_Widget extends WP_Widget {
|
|
19 |
Â
|
20 |
Â
/**
|
21 |
Â
* Constructor method.
|
Â
|
|
Â
|
|
22 |
Â
*/
|
23 |
Â
public function __construct() {
|
24 |
Â
|
@@ -28,19 +30,30 @@ class BP_Core_Members_Widget extends WP_Widget {
|
|
28 |
Â
|
29 |
Â
// Call WP_Widget constructor.
|
30 |
Â
parent::__construct( false, $name, array(
|
31 |
-
'description'
|
32 |
-
'classname'
|
Â
|
|
33 |
Â
) );
|
34 |
Â
|
35 |
-
|
36 |
-
|
37 |
-
wp_enqueue_script( 'bp-widget-members' );
|
38 |
Â
}
|
39 |
Â
}
|
40 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
41 |
Â
/**
|
42 |
Â
* Display the Members widget.
|
43 |
Â
*
|
Â
|
|
Â
|
|
44 |
Â
* @see WP_Widget::widget() for description of parameters.
|
45 |
Â
*
|
46 |
Â
* @param array $args Widget arguments.
|
@@ -159,6 +172,8 @@ class BP_Core_Members_Widget extends WP_Widget {
|
|
159 |
Â
/**
|
160 |
Â
* Update the Members widget options.
|
161 |
Â
*
|
Â
|
|
Â
|
|
162 |
Â
* @param array $new_instance The new instance options.
|
163 |
Â
* @param array $old_instance The old instance options.
|
164 |
Â
* @return array $instance The parsed options to be saved.
|
@@ -177,8 +192,9 @@ class BP_Core_Members_Widget extends WP_Widget {
|
|
177 |
Â
/**
|
178 |
Â
* Output the Members widget options form.
|
179 |
Â
*
|
180 |
-
* @
|
181 |
Â
*
|
Â
|
|
182 |
Â
* @return void
|
183 |
Â
*/
|
184 |
Â
public function form( $instance ) {
|
@@ -228,7 +244,6 @@ class BP_Core_Members_Widget extends WP_Widget {
|
|
228 |
Â
*
|
229 |
Â
* @since 2.3.0
|
230 |
Â
*
|
231 |
-
* @uses bp_parse_args() To merge widget settings into defaults.
|
232 |
Â
*
|
233 |
Â
* @param array $instance Widget instance settings.
|
234 |
Â
* @return array
|
19 |
Â
|
20 |
Â
/**
|
21 |
Â
* Constructor method.
|
22 |
+
*
|
23 |
+
* @since 1.5.0
|
24 |
Â
*/
|
25 |
Â
public function __construct() {
|
26 |
Â
|
30 |
Â
|
31 |
Â
// Call WP_Widget constructor.
|
32 |
Â
parent::__construct( false, $name, array(
|
33 |
+
'description' => $description,
|
34 |
+
'classname' => 'widget_bp_core_members_widget buddypress widget',
|
35 |
+
'customize_selective_refresh' => true,
|
36 |
Â
) );
|
37 |
Â
|
38 |
+
if ( is_customize_preview() || is_active_widget( false, false, $this->id_base ) ) {
|
39 |
+
add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
Â
|
|
40 |
Â
}
|
41 |
Â
}
|
42 |
Â
|
43 |
+
/**
|
44 |
+
* Enqueue scripts.
|
45 |
+
*
|
46 |
+
* @since 2.6.0
|
47 |
+
*/
|
48 |
+
public function enqueue_scripts() {
|
49 |
+
wp_enqueue_script( 'bp-widget-members' );
|
50 |
+
}
|
51 |
+
|
52 |
Â
/**
|
53 |
Â
* Display the Members widget.
|
54 |
Â
*
|
55 |
+
* @since 1.0.3
|
56 |
+
*
|
57 |
Â
* @see WP_Widget::widget() for description of parameters.
|
58 |
Â
*
|
59 |
Â
* @param array $args Widget arguments.
|
172 |
Â
/**
|
173 |
Â
* Update the Members widget options.
|
174 |
Â
*
|
175 |
+
* @since 1.0.3
|
176 |
+
*
|
177 |
Â
* @param array $new_instance The new instance options.
|
178 |
Â
* @param array $old_instance The old instance options.
|
179 |
Â
* @return array $instance The parsed options to be saved.
|
192 |
Â
/**
|
193 |
Â
* Output the Members widget options form.
|
194 |
Â
*
|
195 |
+
* @since 1.0.3
|
196 |
Â
*
|
197 |
+
* @param array $instance Widget instance settings.
|
198 |
Â
* @return void
|
199 |
Â
*/
|
200 |
Â
public function form( $instance ) {
|
244 |
Â
*
|
245 |
Â
* @since 2.3.0
|
246 |
Â
*
|
Â
|
|
247 |
Â
*
|
248 |
Â
* @param array $instance Widget instance settings.
|
249 |
Â
* @return array
|
@@ -19,19 +19,24 @@ class BP_Core_Recently_Active_Widget extends WP_Widget {
|
|
19 |
Â
|
20 |
Â
/**
|
21 |
Â
* Constructor method.
|
Â
|
|
Â
|
|
22 |
Â
*/
|
23 |
Â
public function __construct() {
|
24 |
Â
$name = _x( '(BuddyPress) Recently Active Members', 'widget name', 'buddypress' );
|
25 |
Â
$description = __( 'Profile photos of recently active members', 'buddypress' );
|
26 |
Â
parent::__construct( false, $name, array(
|
27 |
-
'description'
|
28 |
-
'classname'
|
Â
|
|
29 |
Â
) );
|
30 |
Â
}
|
31 |
Â
|
32 |
Â
/**
|
33 |
Â
* Display the Recently Active widget.
|
34 |
Â
*
|
Â
|
|
Â
|
|
35 |
Â
* @see WP_Widget::widget() for description of parameters.
|
36 |
Â
*
|
37 |
Â
* @param array $args Widget arguments.
|
@@ -106,6 +111,8 @@ class BP_Core_Recently_Active_Widget extends WP_Widget {
|
|
106 |
Â
/**
|
107 |
Â
* Update the Recently Active widget options.
|
108 |
Â
*
|
Â
|
|
Â
|
|
109 |
Â
* @param array $new_instance The new instance options.
|
110 |
Â
* @param array $old_instance The old instance options.
|
111 |
Â
* @return array $instance The parsed options to be saved.
|
@@ -121,6 +128,8 @@ class BP_Core_Recently_Active_Widget extends WP_Widget {
|
|
121 |
Â
/**
|
122 |
Â
* Output the Recently Active widget options form.
|
123 |
Â
*
|
Â
|
|
Â
|
|
124 |
Â
* @param array $instance Widget instance settings.
|
125 |
Â
* @return void
|
126 |
Â
*/
|
@@ -153,7 +162,6 @@ class BP_Core_Recently_Active_Widget extends WP_Widget {
|
|
153 |
Â
*
|
154 |
Â
* @since 2.3.0
|
155 |
Â
*
|
156 |
-
* @uses bp_parse_args() To merge widget settings into defaults.
|
157 |
Â
*
|
158 |
Â
* @param array $instance Widget instance settings.
|
159 |
Â
* @return array
|
19 |
Â
|
20 |
Â
/**
|
21 |
Â
* Constructor method.
|
22 |
+
*
|
23 |
+
* @since 1.5.0
|
24 |
Â
*/
|
25 |
Â
public function __construct() {
|
26 |
Â
$name = _x( '(BuddyPress) Recently Active Members', 'widget name', 'buddypress' );
|
27 |
Â
$description = __( 'Profile photos of recently active members', 'buddypress' );
|
28 |
Â
parent::__construct( false, $name, array(
|
29 |
+
'description' => $description,
|
30 |
+
'classname' => 'widget_bp_core_recently_active_widget buddypress widget',
|
31 |
+
'customize_selective_refresh' => true,
|
32 |
Â
) );
|
33 |
Â
}
|
34 |
Â
|
35 |
Â
/**
|
36 |
Â
* Display the Recently Active widget.
|
37 |
Â
*
|
38 |
+
* @since 1.0.3
|
39 |
+
*
|
40 |
Â
* @see WP_Widget::widget() for description of parameters.
|
41 |
Â
*
|
42 |
Â
* @param array $args Widget arguments.
|
111 |
Â
/**
|
112 |
Â
* Update the Recently Active widget options.
|
113 |
Â
*
|
114 |
+
* @since 1.0.3
|
115 |
+
*
|
116 |
Â
* @param array $new_instance The new instance options.
|
117 |
Â
* @param array $old_instance The old instance options.
|
118 |
Â
* @return array $instance The parsed options to be saved.
|
128 |
Â
/**
|
129 |
Â
* Output the Recently Active widget options form.
|
130 |
Â
*
|
131 |
+
* @since 1.0.3
|
132 |
+
*
|
133 |
Â
* @param array $instance Widget instance settings.
|
134 |
Â
* @return void
|
135 |
Â
*/
|
162 |
Â
*
|
163 |
Â
* @since 2.3.0
|
164 |
Â
*
|
Â
|
|
165 |
Â
*
|
166 |
Â
* @param array $instance Widget instance settings.
|
167 |
Â
* @return array
|
@@ -19,19 +19,24 @@ class BP_Core_Whos_Online_Widget extends WP_Widget {
|
|
19 |
Â
|
20 |
Â
/**
|
21 |
Â
* Constructor method.
|
Â
|
|
Â
|
|
22 |
Â
*/
|
23 |
Â
public function __construct() {
|
24 |
Â
$name = _x( "(BuddyPress) Who's Online", 'widget name', 'buddypress' );
|
25 |
Â
$description = __( 'Profile photos of online users', 'buddypress' );
|
26 |
Â
parent::__construct( false, $name, array(
|
27 |
-
'description'
|
28 |
-
'classname'
|
Â
|
|
29 |
Â
) );
|
30 |
Â
}
|
31 |
Â
|
32 |
Â
/**
|
33 |
Â
* Display the Who's Online widget.
|
34 |
Â
*
|
Â
|
|
Â
|
|
35 |
Â
* @see WP_Widget::widget() for description of parameters.
|
36 |
Â
*
|
37 |
Â
* @param array $args Widget arguments.
|
@@ -106,6 +111,8 @@ class BP_Core_Whos_Online_Widget extends WP_Widget {
|
|
106 |
Â
/**
|
107 |
Â
* Update the Who's Online widget options.
|
108 |
Â
*
|
Â
|
|
Â
|
|
109 |
Â
* @param array $new_instance The new instance options.
|
110 |
Â
* @param array $old_instance The old instance options.
|
111 |
Â
* @return array $instance The parsed options to be saved.
|
@@ -121,6 +128,8 @@ class BP_Core_Whos_Online_Widget extends WP_Widget {
|
|
121 |
Â
/**
|
122 |
Â
* Output the Who's Online widget options form.
|
123 |
Â
*
|
Â
|
|
Â
|
|
124 |
Â
* @param array $instance Widget instance settings.
|
125 |
Â
* @return void
|
126 |
Â
*/
|
@@ -153,7 +162,6 @@ class BP_Core_Whos_Online_Widget extends WP_Widget {
|
|
153 |
Â
*
|
154 |
Â
* @since 2.3.0
|
155 |
Â
*
|
156 |
-
* @uses bp_parse_args() To merge widget settings into defaults.
|
157 |
Â
*
|
158 |
Â
* @param array $instance Widget instance settings.
|
159 |
Â
* @return array
|
19 |
Â
|
20 |
Â
/**
|
21 |
Â
* Constructor method.
|
22 |
+
*
|
23 |
+
* @since 1.5.0
|
24 |
Â
*/
|
25 |
Â
public function __construct() {
|
26 |
Â
$name = _x( "(BuddyPress) Who's Online", 'widget name', 'buddypress' );
|
27 |
Â
$description = __( 'Profile photos of online users', 'buddypress' );
|
28 |
Â
parent::__construct( false, $name, array(
|
29 |
+
'description' => $description,
|
30 |
+
'classname' => 'widget_bp_core_whos_online_widget buddypress widget',
|
31 |
+
'customize_selective_refresh' => true,
|
32 |
Â
) );
|
33 |
Â
}
|
34 |
Â
|
35 |
Â
/**
|
36 |
Â
* Display the Who's Online widget.
|
37 |
Â
*
|
38 |
+
* @since 1.0.3
|
39 |
+
*
|
40 |
Â
* @see WP_Widget::widget() for description of parameters.
|
41 |
Â
*
|
42 |
Â
* @param array $args Widget arguments.
|
111 |
Â
/**
|
112 |
Â
* Update the Who's Online widget options.
|
113 |
Â
*
|
114 |
+
* @since 1.0.3
|
115 |
+
*
|
116 |
Â
* @param array $new_instance The new instance options.
|
117 |
Â
* @param array $old_instance The old instance options.
|
118 |
Â
* @return array $instance The parsed options to be saved.
|
128 |
Â
/**
|
129 |
Â
* Output the Who's Online widget options form.
|
130 |
Â
*
|
131 |
+
* @since 1.0.3
|
132 |
+
*
|
133 |
Â
* @param array $instance Widget instance settings.
|
134 |
Â
* @return void
|
135 |
Â
*/
|
162 |
Â
*
|
163 |
Â
* @since 2.3.0
|
164 |
Â
*
|
Â
|
|
165 |
Â
*
|
166 |
Â
* @param array $instance Widget instance settings.
|
167 |
Â
* @return array
|
@@ -65,7 +65,6 @@ class BP_Members_Admin {
|
|
65 |
Â
*
|
66 |
Â
* @since 2.0.0
|
67 |
Â
*
|
68 |
-
* @uses buddypress() to get BuddyPress main instance.
|
69 |
Â
*/
|
70 |
Â
public static function register_members_admin() {
|
71 |
Â
if ( ! is_admin() ) {
|
@@ -368,7 +367,6 @@ class BP_Members_Admin {
|
|
368 |
Â
*
|
369 |
Â
* @since 2.1.0
|
370 |
Â
*
|
371 |
-
* @uses add_submenu_page() To add the Edit Profile page in Profile section.
|
372 |
Â
*/
|
373 |
Â
public function user_profile_menu() {
|
374 |
Â
|
@@ -406,7 +404,6 @@ class BP_Members_Admin {
|
|
406 |
Â
*
|
407 |
Â
* @since 2.0.0
|
408 |
Â
*
|
409 |
-
* @uses add_submenu_page() To add the Edit Profile page in Users/Profile section.
|
410 |
Â
*/
|
411 |
Â
public function admin_menus() {
|
412 |
Â
|
@@ -934,7 +931,14 @@ class BP_Members_Admin {
|
|
934 |
Â
|
935 |
Â
<?php else : ?>
|
936 |
Â
|
937 |
-
<p><?php
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
938 |
Â
|
939 |
Â
<?php endif; ?>
|
940 |
Â
|
@@ -1102,9 +1106,15 @@ class BP_Members_Admin {
|
|
1102 |
Â
$current_type = bp_get_member_type( $user->ID );
|
1103 |
Â
?>
|
1104 |
Â
|
1105 |
-
<label for="bp-members-profile-member-type" class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
1106 |
Â
<select name="bp-members-profile-member-type" id="bp-members-profile-member-type">
|
1107 |
-
<option value="" <?php selected( '', $current_type ); ?>><?php
|
Â
|
|
Â
|
|
Â
|
|
1108 |
Â
<?php foreach ( $types as $type ) : ?>
|
1109 |
Â
<option value="<?php echo esc_attr( $type->name ) ?>" <?php selected( $type->name, $current_type ) ?>><?php echo esc_html( $type->labels['singular_name'] ) ?></option>
|
1110 |
Â
<?php endforeach; ?>
|
@@ -1221,7 +1231,6 @@ class BP_Members_Admin {
|
|
1221 |
Â
*
|
1222 |
Â
* @since 2.1.0
|
1223 |
Â
*
|
1224 |
-
* @uses user_admin_url()
|
1225 |
Â
*
|
1226 |
Â
* @param string $profile_link Profile Link for admin bar.
|
1227 |
Â
* @param string $url Profile URL.
|
@@ -1366,7 +1375,10 @@ class BP_Members_Admin {
|
|
1366 |
Â
|
1367 |
Â
if ( ! empty( $required ) ) {
|
1368 |
Â
require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php' );
|
1369 |
-
|
Â
|
|
Â
|
|
Â
|
|
1370 |
Â
}
|
1371 |
Â
|
1372 |
Â
return new $class();
|
@@ -1451,8 +1463,11 @@ class BP_Members_Admin {
|
|
1451 |
Â
// Add accessible hidden headings and text for the Pending Users screen.
|
1452 |
Â
if ( bp_get_major_wp_version() >= 4.4 ) {
|
1453 |
Â
get_current_screen()->set_screen_reader_content( array(
|
Â
|
|
1454 |
Â
'heading_views' => __( 'Filter users list', 'buddypress' ),
|
Â
|
|
1455 |
Â
'heading_pagination' => __( 'Pending users list navigation', 'buddypress' ),
|
Â
|
|
1456 |
Â
'heading_list' => __( 'Pending users list', 'buddypress' ),
|
1457 |
Â
) );
|
1458 |
Â
}
|
65 |
Â
*
|
66 |
Â
* @since 2.0.0
|
67 |
Â
*
|
Â
|
|
68 |
Â
*/
|
69 |
Â
public static function register_members_admin() {
|
70 |
Â
if ( ! is_admin() ) {
|
367 |
Â
*
|
368 |
Â
* @since 2.1.0
|
369 |
Â
*
|
Â
|
|
370 |
Â
*/
|
371 |
Â
public function user_profile_menu() {
|
372 |
Â
|
404 |
Â
*
|
405 |
Â
* @since 2.0.0
|
406 |
Â
*
|
Â
|
|
407 |
Â
*/
|
408 |
Â
public function admin_menus() {
|
409 |
Â
|
931 |
Â
|
932 |
Â
<?php else : ?>
|
933 |
Â
|
934 |
+
<p><?php
|
935 |
+
printf(
|
936 |
+
'%1$s <a href="%2$s">%3$s</a>',
|
937 |
+
__( 'No user found with this ID.', 'buddypress' ),
|
938 |
+
esc_url( bp_get_admin_url( 'users.php' ) ),
|
939 |
+
__( 'Go back and try again.', 'buddypress' )
|
940 |
+
);
|
941 |
+
?></p>
|
942 |
Â
|
943 |
Â
<?php endif; ?>
|
944 |
Â
|
1106 |
Â
$current_type = bp_get_member_type( $user->ID );
|
1107 |
Â
?>
|
1108 |
Â
|
1109 |
+
<label for="bp-members-profile-member-type" class="screen-reader-text"><?php
|
1110 |
+
/* translators: accessibility text */
|
1111 |
+
esc_html_e( 'Select member type', 'buddypress' );
|
1112 |
+
?></label>
|
1113 |
Â
<select name="bp-members-profile-member-type" id="bp-members-profile-member-type">
|
1114 |
+
<option value="" <?php selected( '', $current_type ); ?>><?php
|
1115 |
+
/* translators: no option picked in select box */
|
1116 |
+
esc_attr_e( '----', 'buddypress' );
|
1117 |
+
?></option>
|
1118 |
Â
<?php foreach ( $types as $type ) : ?>
|
1119 |
Â
<option value="<?php echo esc_attr( $type->name ) ?>" <?php selected( $type->name, $current_type ) ?>><?php echo esc_html( $type->labels['singular_name'] ) ?></option>
|
1120 |
Â
<?php endforeach; ?>
|
1231 |
Â
*
|
1232 |
Â
* @since 2.1.0
|
1233 |
Â
*
|
Â
|
|
1234 |
Â
*
|
1235 |
Â
* @param string $profile_link Profile Link for admin bar.
|
1236 |
Â
* @param string $url Profile URL.
|
1375 |
Â
|
1376 |
Â
if ( ! empty( $required ) ) {
|
1377 |
Â
require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php' );
|
1378 |
+
|
1379 |
+
if ( ! buddypress()->do_autoload ) {
|
1380 |
+
require_once( buddypress()->members->admin->admin_dir . 'bp-members-admin-classes.php' );
|
1381 |
+
}
|
1382 |
Â
}
|
1383 |
Â
|
1384 |
Â
return new $class();
|
1463 |
Â
// Add accessible hidden headings and text for the Pending Users screen.
|
1464 |
Â
if ( bp_get_major_wp_version() >= 4.4 ) {
|
1465 |
Â
get_current_screen()->set_screen_reader_content( array(
|
1466 |
+
/* translators: accessibility text */
|
1467 |
Â
'heading_views' => __( 'Filter users list', 'buddypress' ),
|
1468 |
+
/* translators: accessibility text */
|
1469 |
Â
'heading_pagination' => __( 'Pending users list navigation', 'buddypress' ),
|
1470 |
+
/* translators: accessibility text */
|
1471 |
Â
'heading_list' => __( 'Pending users list', 'buddypress' ),
|
1472 |
Â
) );
|
1473 |
Â
}
|
@@ -12,6 +12,8 @@ defined( 'ABSPATH' ) || exit;
|
|
12 |
Â
|
13 |
Â
/**
|
14 |
Â
* Defines the BuddyPress Members Component.
|
Â
|
|
Â
|
|
15 |
Â
*/
|
16 |
Â
class BP_Members_Component extends BP_Component {
|
17 |
Â
|
@@ -45,6 +47,8 @@ class BP_Members_Component extends BP_Component {
|
|
45 |
Â
/**
|
46 |
Â
* Include bp-members files.
|
47 |
Â
*
|
Â
|
|
Â
|
|
48 |
Â
* @see BP_Component::includes() for description of parameters.
|
49 |
Â
*
|
50 |
Â
* @param array $includes See {@link BP_Component::includes()}.
|
@@ -54,7 +58,6 @@ class BP_Members_Component extends BP_Component {
|
|
54 |
Â
// Always include these files.
|
55 |
Â
$includes = array(
|
56 |
Â
'actions',
|
57 |
-
'classes',
|
58 |
Â
'filters',
|
59 |
Â
'screens',
|
60 |
Â
'template',
|
@@ -64,6 +67,10 @@ class BP_Members_Component extends BP_Component {
|
|
64 |
Â
'cache',
|
65 |
Â
);
|
66 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
67 |
Â
if ( bp_is_active( 'activity' ) ) {
|
68 |
Â
$includes[] = 'activity';
|
69 |
Â
}
|
@@ -110,7 +117,7 @@ class BP_Members_Component extends BP_Component {
|
|
110 |
Â
'search_string' => __( 'Search Members...', 'buddypress' ),
|
111 |
Â
'global_tables' => array(
|
112 |
Â
'table_name_last_activity' => bp_core_get_table_prefix() . 'bp_activity',
|
113 |
-
'table_name_signups' => $wpdb->base_prefix . 'signups', //
|
114 |
Â
)
|
115 |
Â
);
|
116 |
Â
|
@@ -143,6 +150,14 @@ class BP_Members_Component extends BP_Component {
|
|
143 |
Â
// The domain for the user currently being displayed.
|
144 |
Â
$bp->displayed_user->domain = bp_core_get_user_domain( bp_displayed_user_id() );
|
145 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
146 |
Â
/** Signup ***********************************************************
|
147 |
Â
*/
|
148 |
Â
|
@@ -168,15 +183,14 @@ class BP_Members_Component extends BP_Component {
|
|
168 |
Â
|
169 |
Â
/** Default Profile Component ****************************************
|
170 |
Â
*/
|
171 |
-
|
172 |
-
|
Â
|
|
173 |
Â
$bp->default_component = BP_DEFAULT_COMPONENT;
|
Â
|
|
Â
|
|
174 |
Â
} else {
|
175 |
-
|
176 |
-
$bp->default_component = bp_get_activity_slug();
|
177 |
-
} else {
|
178 |
-
$bp->default_component = ( 'xprofile' === $bp->profile->id ) ? 'profile' : $bp->profile->id;
|
179 |
-
}
|
180 |
Â
}
|
181 |
Â
|
182 |
Â
/** Canonical Component Stack ****************************************
|
@@ -232,13 +246,15 @@ class BP_Members_Component extends BP_Component {
|
|
232 |
Â
*/
|
233 |
Â
public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
|
234 |
Â
|
235 |
-
//
|
236 |
-
if (
|
237 |
Â
return;
|
238 |
Â
}
|
239 |
Â
|
240 |
-
|
241 |
-
|
Â
|
|
Â
|
|
242 |
Â
return;
|
243 |
Â
}
|
244 |
Â
|
@@ -251,34 +267,106 @@ class BP_Members_Component extends BP_Component {
|
|
251 |
Â
return;
|
252 |
Â
}
|
253 |
Â
|
254 |
-
|
255 |
-
$
|
256 |
-
|
257 |
-
//
|
258 |
-
$main_nav = array(
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
266 |
Â
|
267 |
-
|
268 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
269 |
Â
'name' => _x( 'View', 'Member profile view', 'buddypress' ),
|
270 |
Â
'slug' => 'public',
|
271 |
-
'parent_url' => $
|
272 |
Â
'parent_slug' => $slug,
|
273 |
Â
'screen_function' => 'bp_members_screen_display_profile',
|
274 |
Â
'position' => 10
|
275 |
Â
);
|
276 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
277 |
Â
parent::setup_nav( $main_nav, $sub_nav );
|
278 |
Â
}
|
279 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
280 |
Â
/**
|
281 |
Â
* Set up the title for pages and <title>.
|
Â
|
|
Â
|
|
282 |
Â
*/
|
283 |
Â
public function setup_title() {
|
284 |
Â
$bp = buddypress();
|
12 |
Â
|
13 |
Â
/**
|
14 |
Â
* Defines the BuddyPress Members Component.
|
15 |
+
*
|
16 |
+
* @since 1.5.0
|
17 |
Â
*/
|
18 |
Â
class BP_Members_Component extends BP_Component {
|
19 |
Â
|
47 |
Â
/**
|
48 |
Â
* Include bp-members files.
|
49 |
Â
*
|
50 |
+
* @since 1.5.0
|
51 |
+
*
|
52 |
Â
* @see BP_Component::includes() for description of parameters.
|
53 |
Â
*
|
54 |
Â
* @param array $includes See {@link BP_Component::includes()}.
|
58 |
Â
// Always include these files.
|
59 |
Â
$includes = array(
|
60 |
Â
'actions',
|
Â
|
|
61 |
Â
'filters',
|
62 |
Â
'screens',
|
63 |
Â
'template',
|
67 |
Â
'cache',
|
68 |
Â
);
|
69 |
Â
|
70 |
+
if ( ! buddypress()->do_autoload ) {
|
71 |
+
$includes[] = 'classes';
|
72 |
+
}
|
73 |
+
|
74 |
Â
if ( bp_is_active( 'activity' ) ) {
|
75 |
Â
$includes[] = 'activity';
|
76 |
Â
}
|
117 |
Â
'search_string' => __( 'Search Members...', 'buddypress' ),
|
118 |
Â
'global_tables' => array(
|
119 |
Â
'table_name_last_activity' => bp_core_get_table_prefix() . 'bp_activity',
|
120 |
+
'table_name_signups' => $wpdb->base_prefix . 'signups', // Signups is a global WordPress table.
|
121 |
Â
)
|
122 |
Â
);
|
123 |
Â
|
150 |
Â
// The domain for the user currently being displayed.
|
151 |
Â
$bp->displayed_user->domain = bp_core_get_user_domain( bp_displayed_user_id() );
|
152 |
Â
|
153 |
+
// Initialize the nav for the members component.
|
154 |
+
$this->nav = new BP_Core_Nav();
|
155 |
+
|
156 |
+
// If A user is displayed, check if there is a front template
|
157 |
+
if ( bp_get_displayed_user() ) {
|
158 |
+
$bp->displayed_user->front_template = bp_displayed_user_get_front_template();
|
159 |
+
}
|
160 |
+
|
161 |
Â
/** Signup ***********************************************************
|
162 |
Â
*/
|
163 |
Â
|
183 |
Â
|
184 |
Â
/** Default Profile Component ****************************************
|
185 |
Â
*/
|
186 |
+
if ( bp_displayed_user_has_front_template() ) {
|
187 |
+
$bp->default_component = 'front';
|
188 |
+
} elseif ( defined( 'BP_DEFAULT_COMPONENT' ) && BP_DEFAULT_COMPONENT ) {
|
189 |
Â
$bp->default_component = BP_DEFAULT_COMPONENT;
|
190 |
+
} elseif ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) ) {
|
191 |
+
$bp->default_component = bp_get_activity_slug();
|
192 |
Â
} else {
|
193 |
+
$bp->default_component = ( 'xprofile' === $bp->profile->id ) ? 'profile' : $bp->profile->id;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
194 |
Â
}
|
195 |
Â
|
196 |
Â
/** Canonical Component Stack ****************************************
|
246 |
Â
*/
|
247 |
Â
public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
|
248 |
Â
|
249 |
+
// Don't set up navigation if there's no member.
|
250 |
+
if ( ! is_user_logged_in() && ! bp_is_user() ) {
|
251 |
Â
return;
|
252 |
Â
}
|
253 |
Â
|
254 |
+
$is_xprofile_active = bp_is_active( 'xprofile' );
|
255 |
+
|
256 |
+
// Bail if XProfile component is active and there's no custom front page for the user.
|
257 |
+
if ( ! bp_displayed_user_has_front_template() && $is_xprofile_active ) {
|
258 |
Â
return;
|
259 |
Â
}
|
260 |
Â
|
267 |
Â
return;
|
268 |
Â
}
|
269 |
Â
|
270 |
+
// Set slug to profile in case the xProfile component is not active
|
271 |
+
$slug = bp_get_profile_slug();
|
272 |
+
|
273 |
+
// Defaults to empty navs
|
274 |
+
$this->main_nav = array();
|
275 |
+
$this->sub_nav = array();
|
276 |
+
|
277 |
+
if ( ! $is_xprofile_active ) {
|
278 |
+
$this->main_nav = array(
|
279 |
+
'name' => _x( 'Profile', 'Member profile main navigation', 'buddypress' ),
|
280 |
+
'slug' => $slug,
|
281 |
+
'position' => 20,
|
282 |
+
'screen_function' => 'bp_members_screen_display_profile',
|
283 |
+
'default_subnav_slug' => 'public',
|
284 |
+
'item_css_id' => buddypress()->profile->id
|
285 |
+
);
|
286 |
+
}
|
287 |
Â
|
288 |
+
/**
|
289 |
+
* Setup the subnav items for the member profile.
|
290 |
+
*
|
291 |
+
* This is required in case there's a custom front or in case the xprofile component
|
292 |
+
* is not active.
|
293 |
+
*/
|
294 |
+
$this->sub_nav = array(
|
295 |
Â
'name' => _x( 'View', 'Member profile view', 'buddypress' ),
|
296 |
Â
'slug' => 'public',
|
297 |
+
'parent_url' => trailingslashit( $user_domain . $slug ),
|
298 |
Â
'parent_slug' => $slug,
|
299 |
Â
'screen_function' => 'bp_members_screen_display_profile',
|
300 |
Â
'position' => 10
|
301 |
Â
);
|
302 |
Â
|
303 |
+
/**
|
304 |
+
* If there's a front template the members component nav
|
305 |
+
* will be there to display the user's front page.
|
306 |
+
*/
|
307 |
+
if ( bp_displayed_user_has_front_template() ) {
|
308 |
+
$main_nav = array(
|
309 |
+
'name' => _x( 'Home', 'Member Home page', 'buddypress' ),
|
310 |
+
'slug' => 'front',
|
311 |
+
'position' => 5,
|
312 |
+
'screen_function' => 'bp_members_screen_display_profile',
|
313 |
+
'default_subnav_slug' => 'public',
|
314 |
+
);
|
315 |
+
|
316 |
+
// We need a dummy subnav for the front page to load.
|
317 |
+
$front_subnav = $this->sub_nav;
|
318 |
+
$front_subnav['parent_slug'] = 'front';
|
319 |
+
|
320 |
+
// In case the subnav is displayed in the front template
|
321 |
+
$front_subnav['parent_url'] = trailingslashit( $user_domain . 'front' );
|
322 |
+
|
323 |
+
// Set the subnav
|
324 |
+
$sub_nav[] = $front_subnav;
|
325 |
+
|
326 |
+
/**
|
327 |
+
* If the profile component is not active, we need to create a new
|
328 |
+
* nav to display the WordPress profile.
|
329 |
+
*/
|
330 |
+
if ( ! $is_xprofile_active ) {
|
331 |
+
add_action( 'bp_members_setup_nav', array( $this, 'setup_profile_nav' ) );
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* If there's no front template and xProfile is not active, the members
|
336 |
+
* component nav will be there to display the WordPress profile
|
337 |
+
*/
|
338 |
+
} else {
|
339 |
+
$main_nav = $this->main_nav;
|
340 |
+
$sub_nav[] = $this->sub_nav;
|
341 |
+
}
|
342 |
+
|
343 |
+
|
344 |
Â
parent::setup_nav( $main_nav, $sub_nav );
|
345 |
Â
}
|
346 |
Â
|
347 |
+
/**
|
348 |
+
* Set up a profile nav in case the xProfile
|
349 |
+
* component is not active and a front template is
|
350 |
+
* used.
|
351 |
+
*
|
352 |
+
* @since 2.6.0
|
353 |
+
*/
|
354 |
+
public function setup_profile_nav() {
|
355 |
+
if ( empty( $this->main_nav ) || empty( $this->sub_nav ) ) {
|
356 |
+
return;
|
357 |
+
}
|
358 |
+
|
359 |
+
// Add the main nav
|
360 |
+
bp_core_new_nav_item( $this->main_nav, 'members' );
|
361 |
+
|
362 |
+
// Add the sub nav item.
|
363 |
+
bp_core_new_subnav_item( $this->sub_nav, 'members' );
|
364 |
+
}
|
365 |
+
|
366 |
Â
/**
|
367 |
Â
* Set up the title for pages and <title>.
|
368 |
+
*
|
369 |
+
* @since 1.5.0
|
370 |
Â
*/
|
371 |
Â
public function setup_title() {
|
372 |
Â
$bp = buddypress();
|
@@ -93,25 +93,25 @@ class BP_Members_List_Table extends WP_Users_List_Table {
|
|
93 |
Â
public function views() {
|
94 |
Â
global $role;
|
95 |
Â
|
96 |
-
// Used to reset the role
|
97 |
Â
$reset_role = $role;
|
98 |
Â
|
99 |
-
// Temporarly set the role to registered
|
100 |
Â
$role = 'registered';
|
101 |
Â
|
102 |
-
// Used to reset the screen id once views are displayed
|
103 |
Â
$reset_screen_id = $this->screen->id;
|
104 |
Â
|
105 |
-
// Temporarly set the screen id to the users one
|
106 |
Â
$this->screen->id = 'users';
|
107 |
Â
|
108 |
-
// Use the parent function so that other plugins can safely add views
|
109 |
Â
parent::views();
|
110 |
Â
|
111 |
-
// Reset the role
|
112 |
Â
$role = $reset_role;
|
113 |
Â
|
114 |
-
// Reset the screen id
|
115 |
Â
$this->screen->id = $reset_screen_id;
|
116 |
Â
}
|
117 |
Â
|
@@ -260,7 +260,10 @@ class BP_Members_List_Table extends WP_Users_List_Table {
|
|
260 |
Â
*/
|
261 |
Â
public function column_cb( $signup_object = null ) {
|
262 |
Â
?>
|
263 |
-
<label class="screen-reader-text" for="signup_<?php echo intval( $signup_object->id ); ?>"><?php
|
Â
|
|
Â
|
|
Â
|
|
264 |
Â
<input type="checkbox" id="signup_<?php echo intval( $signup_object->id ) ?>" name="allsignups[]" value="<?php echo esc_attr( $signup_object->id ) ?>" />
|
265 |
Â
<?php
|
266 |
Â
}
|
@@ -334,7 +337,7 @@ class BP_Members_List_Table extends WP_Users_List_Table {
|
|
334 |
Â
*
|
335 |
Â
* @since 2.0.0
|
336 |
Â
*
|
337 |
-
* @param object $signup_object The signup data object.
|
338 |
Â
*/
|
339 |
Â
public function column_name( $signup_object = null ) {
|
340 |
Â
echo esc_html( $signup_object->user_name );
|
93 |
Â
public function views() {
|
94 |
Â
global $role;
|
95 |
Â
|
96 |
+
// Used to reset the role.
|
97 |
Â
$reset_role = $role;
|
98 |
Â
|
99 |
+
// Temporarly set the role to registered.
|
100 |
Â
$role = 'registered';
|
101 |
Â
|
102 |
+
// Used to reset the screen id once views are displayed.
|
103 |
Â
$reset_screen_id = $this->screen->id;
|
104 |
Â
|
105 |
+
// Temporarly set the screen id to the users one.
|
106 |
Â
$this->screen->id = 'users';
|
107 |
Â
|
108 |
+
// Use the parent function so that other plugins can safely add views.
|
109 |
Â
parent::views();
|
110 |
Â
|
111 |
+
// Reset the role.
|
112 |
Â
$role = $reset_role;
|
113 |
Â
|
114 |
+
// Reset the screen id.
|
115 |
Â
$this->screen->id = $reset_screen_id;
|
116 |
Â
}
|
117 |
Â
|
260 |
Â
*/
|
261 |
Â
public function column_cb( $signup_object = null ) {
|
262 |
Â
?>
|
263 |
+
<label class="screen-reader-text" for="signup_<?php echo intval( $signup_object->id ); ?>"><?php
|
264 |
+
/* translators: accessibility text */
|
265 |
+
printf( esc_html__( 'Select user: %s', 'buddypress' ), $signup_object->user_login );
|
266 |
+
?></label>
|
267 |
Â
<input type="checkbox" id="signup_<?php echo intval( $signup_object->id ) ?>" name="allsignups[]" value="<?php echo esc_attr( $signup_object->id ) ?>" />
|
268 |
Â
<?php
|
269 |
Â
}
|
337 |
Â
*
|
338 |
Â
* @since 2.0.0
|
339 |
Â
*
|
340 |
+
* @param object|null $signup_object The signup data object.
|
341 |
Â
*/
|
342 |
Â
public function column_name( $signup_object = null ) {
|
343 |
Â
echo esc_html( $signup_object->user_name );
|
@@ -94,25 +94,25 @@ class BP_Members_MS_List_Table extends WP_MS_Users_List_Table {
|
|
94 |
Â
public function views() {
|
95 |
Â
global $role;
|
96 |
Â
|
97 |
-
// Used to reset the role
|
98 |
Â
$reset_role = $role;
|
99 |
Â
|
100 |
-
// Temporarly set the role to registered
|
101 |
Â
$role = 'registered';
|
102 |
Â
|
103 |
-
// Used to reset the screen id once views are displayed
|
104 |
Â
$reset_screen_id = $this->screen->id;
|
105 |
Â
|
106 |
-
// Temporarly set the screen id to the users one
|
107 |
Â
$this->screen->id = 'users-network';
|
108 |
Â
|
109 |
-
// Use the parent function so that other plugins can safely add views
|
110 |
Â
parent::views();
|
111 |
Â
|
112 |
-
// Reset the role
|
113 |
Â
$role = $reset_role;
|
114 |
Â
|
115 |
-
// Reset the screen id
|
116 |
Â
$this->screen->id = $reset_screen_id;
|
117 |
Â
}
|
118 |
Â
|
@@ -253,7 +253,10 @@ class BP_Members_MS_List_Table extends WP_MS_Users_List_Table {
|
|
253 |
Â
*/
|
254 |
Â
public function column_cb( $signup_object = null ) {
|
255 |
Â
?>
|
256 |
-
<label class="screen-reader-text" for="signup_<?php echo intval( $signup_object->id ); ?>"><?php printf(
|
Â
|
|
Â
|
|
Â
|
|
257 |
Â
<input type="checkbox" id="signup_<?php echo intval( $signup_object->id ) ?>" name="allsignups[]" value="<?php echo esc_attr( $signup_object->id ) ?>" />
|
258 |
Â
<?php
|
259 |
Â
}
|
94 |
Â
public function views() {
|
95 |
Â
global $role;
|
96 |
Â
|
97 |
+
// Used to reset the role.
|
98 |
Â
$reset_role = $role;
|
99 |
Â
|
100 |
+
// Temporarly set the role to registered.
|
101 |
Â
$role = 'registered';
|
102 |
Â
|
103 |
+
// Used to reset the screen id once views are displayed.
|
104 |
Â
$reset_screen_id = $this->screen->id;
|
105 |
Â
|
106 |
+
// Temporarly set the screen id to the users one.
|
107 |
Â
$this->screen->id = 'users-network';
|
108 |
Â
|
109 |
+
// Use the parent function so that other plugins can safely add views.
|
110 |
Â
parent::views();
|
111 |
Â
|
112 |
+
// Reset the role.
|
113 |
Â
$role = $reset_role;
|
114 |
Â
|
115 |
+
// Reset the screen id.
|
116 |
Â
$this->screen->id = $reset_screen_id;
|
117 |
Â
}
|
118 |
Â
|
253 |
Â
*/
|
254 |
Â
public function column_cb( $signup_object = null ) {
|
255 |
Â
?>
|
256 |
+
<label class="screen-reader-text" for="signup_<?php echo intval( $signup_object->id ); ?>"><?php printf(
|
257 |
+
/* translators: accessibility text */
|
258 |
+
esc_html__( 'Select user: %s', 'buddypress' ), $signup_object->user_login );
|
259 |
+
?></label>
|
260 |
Â
<input type="checkbox" id="signup_<?php echo intval( $signup_object->id ) ?>" name="allsignups[]" value="<?php echo esc_attr( $signup_object->id ) ?>" />
|
261 |
Â
<?php
|
262 |
Â
}
|
@@ -9,12 +9,15 @@
|
|
9 |
Â
|
10 |
Â
/**
|
11 |
Â
* Class used to handle Signups.
|
Â
|
|
Â
|
|
12 |
Â
*/
|
13 |
Â
class BP_Signup {
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* ID of the signup which the object relates to.
|
17 |
Â
*
|
Â
|
|
18 |
Â
* @var integer
|
19 |
Â
*/
|
20 |
Â
public $id;
|
@@ -22,6 +25,7 @@ class BP_Signup {
|
|
22 |
Â
/**
|
23 |
Â
* The URL to the full size of the avatar for the user.
|
24 |
Â
*
|
Â
|
|
25 |
Â
* @var string
|
26 |
Â
*/
|
27 |
Â
public $avatar;
|
@@ -29,6 +33,7 @@ class BP_Signup {
|
|
29 |
Â
/**
|
30 |
Â
* The username for the user.
|
31 |
Â
*
|
Â
|
|
32 |
Â
* @var string
|
33 |
Â
*/
|
34 |
Â
public $user_login;
|
@@ -36,6 +41,7 @@ class BP_Signup {
|
|
36 |
Â
/**
|
37 |
Â
* The email for the user.
|
38 |
Â
*
|
Â
|
|
39 |
Â
* @var string
|
40 |
Â
*/
|
41 |
Â
public $user_email;
|
@@ -43,6 +49,7 @@ class BP_Signup {
|
|
43 |
Â
/**
|
44 |
Â
* The full name of the user.
|
45 |
Â
*
|
Â
|
|
46 |
Â
* @var string
|
47 |
Â
*/
|
48 |
Â
public $user_name;
|
@@ -50,6 +57,7 @@ class BP_Signup {
|
|
50 |
Â
/**
|
51 |
Â
* Metadata associated with the signup.
|
52 |
Â
*
|
Â
|
|
53 |
Â
* @var array
|
54 |
Â
*/
|
55 |
Â
public $meta;
|
@@ -57,6 +65,7 @@ class BP_Signup {
|
|
57 |
Â
/**
|
58 |
Â
* The registered date for the user.
|
59 |
Â
*
|
Â
|
|
60 |
Â
* @var string
|
61 |
Â
*/
|
62 |
Â
public $registered;
|
@@ -64,6 +73,7 @@ class BP_Signup {
|
|
64 |
Â
/**
|
65 |
Â
* The activation key for the user.
|
66 |
Â
*
|
Â
|
|
67 |
Â
* @var string
|
68 |
Â
*/
|
69 |
Â
public $activation_key;
|
9 |
Â
|
10 |
Â
/**
|
11 |
Â
* Class used to handle Signups.
|
12 |
+
*
|
13 |
+
* @since 2.0.0
|
14 |
Â
*/
|
15 |
Â
class BP_Signup {
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* ID of the signup which the object relates to.
|
19 |
Â
*
|
20 |
+
* @since 2.0.0
|
21 |
Â
* @var integer
|
22 |
Â
*/
|
23 |
Â
public $id;
|
25 |
Â
/**
|
26 |
Â
* The URL to the full size of the avatar for the user.
|
27 |
Â
*
|
28 |
+
* @since 2.0.0
|
29 |
Â
* @var string
|
30 |
Â
*/
|
31 |
Â
public $avatar;
|
33 |
Â
/**
|
34 |
Â
* The username for the user.
|
35 |
Â
*
|
36 |
+
* @since 2.0.0
|
37 |
Â
* @var string
|
38 |
Â
*/
|
39 |
Â
public $user_login;
|
41 |
Â
/**
|
42 |
Â
* The email for the user.
|
43 |
Â
*
|
44 |
+
* @since 2.0.0
|
45 |
Â
* @var string
|
46 |
Â
*/
|
47 |
Â
public $user_email;
|
49 |
Â
/**
|
50 |
Â
* The full name of the user.
|
51 |
Â
*
|
52 |
+
* @since 2.0.0
|
53 |
Â
* @var string
|
54 |
Â
*/
|
55 |
Â
public $user_name;
|
57 |
Â
/**
|
58 |
Â
* Metadata associated with the signup.
|
59 |
Â
*
|
60 |
+
* @since 2.0.0
|
61 |
Â
* @var array
|
62 |
Â
*/
|
63 |
Â
public $meta;
|
65 |
Â
/**
|
66 |
Â
* The registered date for the user.
|
67 |
Â
*
|
68 |
+
* @since 2.0.0
|
69 |
Â
* @var string
|
70 |
Â
*/
|
71 |
Â
public $registered;
|
73 |
Â
/**
|
74 |
Â
* The activation key for the user.
|
75 |
Â
*
|
76 |
+
* @since 2.0.0
|
77 |
Â
* @var string
|
78 |
Â
*/
|
79 |
Â
public $activation_key;
|
@@ -335,9 +335,9 @@ function messages_mark_thread_unread( $thread_id ) {
|
|
335 |
Â
* @param string $content Content of the message.
|
336 |
Â
*/
|
337 |
Â
function messages_add_callback_values( $recipients, $subject, $content ) {
|
338 |
-
@setcookie( 'bp_messages_send_to', $recipients, time() + 60 * 60 * 24, COOKIEPATH );
|
339 |
-
@setcookie( 'bp_messages_subject', $subject, time() + 60 * 60 * 24, COOKIEPATH );
|
340 |
-
@setcookie( 'bp_messages_content', $content, time() + 60 * 60 * 24, COOKIEPATH );
|
341 |
Â
}
|
342 |
Â
|
343 |
Â
/**
|
@@ -346,9 +346,9 @@ function messages_add_callback_values( $recipients, $subject, $content ) {
|
|
346 |
Â
* @see messages_add_callback_values()
|
347 |
Â
*/
|
348 |
Â
function messages_remove_callback_values() {
|
349 |
-
@setcookie( 'bp_messages_send_to', false, time() - 1000, COOKIEPATH );
|
350 |
-
@setcookie( 'bp_messages_subject', false, time() - 1000, COOKIEPATH );
|
351 |
-
@setcookie( 'bp_messages_content', false, time() - 1000, COOKIEPATH );
|
352 |
Â
}
|
353 |
Â
|
354 |
Â
/**
|
335 |
Â
* @param string $content Content of the message.
|
336 |
Â
*/
|
337 |
Â
function messages_add_callback_values( $recipients, $subject, $content ) {
|
338 |
+
@setcookie( 'bp_messages_send_to', $recipients, time() + 60 * 60 * 24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
339 |
+
@setcookie( 'bp_messages_subject', $subject, time() + 60 * 60 * 24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
340 |
+
@setcookie( 'bp_messages_content', $content, time() + 60 * 60 * 24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
341 |
Â
}
|
342 |
Â
|
343 |
Â
/**
|
346 |
Â
* @see messages_add_callback_values()
|
347 |
Â
*/
|
348 |
Â
function messages_remove_callback_values() {
|
349 |
+
@setcookie( 'bp_messages_send_to', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
350 |
+
@setcookie( 'bp_messages_subject', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
351 |
+
@setcookie( 'bp_messages_content', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
352 |
Â
}
|
353 |
Â
|
354 |
Â
/**
|
@@ -12,7 +12,9 @@
|
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
-
|
Â
|
|
Â
|
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Bootstrap the Messages component.
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
+
if ( ! buddypress()->do_autoload ) {
|
16 |
+
require dirname( __FILE__ ) . '/classes/class-bp-messages-component.php';
|
17 |
+
}
|
18 |
Â
|
19 |
Â
/**
|
20 |
Â
* Bootstrap the Messages component.
|
@@ -103,6 +103,7 @@ add_action( 'messages_message_sent', 'messages_notification_new_message', 10 );
|
|
103 |
Â
*/
|
104 |
Â
function messages_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
|
105 |
Â
$total_items = (int) $total_items;
|
Â
|
|
106 |
Â
$link = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/inbox' );
|
107 |
Â
$title = __( 'Inbox', 'buddypress' );
|
108 |
Â
$amount = 'single';
|
@@ -111,9 +112,8 @@ function messages_format_notifications( $action, $item_id, $secondary_item_id, $
|
|
111 |
Â
if ( $total_items > 1 ) {
|
112 |
Â
$amount = 'multiple';
|
113 |
Â
$text = sprintf( __( 'You have %d new messages', 'buddypress' ), $total_items );
|
114 |
-
} else {
|
115 |
-
$amount = 'single';
|
116 |
Â
|
Â
|
|
117 |
Â
// Get message thread ID.
|
118 |
Â
$message = new BP_Messages_Message( $item_id );
|
119 |
Â
$thread_id = $message->thread_id;
|
@@ -127,35 +127,78 @@ function messages_format_notifications( $action, $item_id, $secondary_item_id, $
|
|
127 |
Â
$text = sprintf( _n( 'You have %s new private message', 'You have %s new private messages', $total_items, 'buddypress' ), bp_core_number_format( $total_items ) );
|
128 |
Â
}
|
129 |
Â
}
|
130 |
-
}
|
131 |
Â
|
132 |
-
|
133 |
-
|
134 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
135 |
Â
} else {
|
136 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
137 |
Â
}
|
138 |
Â
|
139 |
Â
/**
|
140 |
-
*
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
141 |
Â
*
|
142 |
-
* This is a dynamic filter
|
143 |
-
* - 'bp_messages_multiple_new_message_notification'.
|
144 |
-
* - 'bp_messages_single_new_message_notification'.
|
145 |
Â
*
|
146 |
-
* @
|
147 |
-
*
|
148 |
-
* @param
|
149 |
Â
* @param int $item_id ID of the associated item.
|
150 |
Â
* @param int $secondary_item_id ID of the secondary associated item.
|
Â
|
|
Â
|
|
Â
|
|
151 |
Â
*/
|
152 |
-
$return = apply_filters(
|
153 |
-
} else {
|
154 |
-
/** This filter is documented in bp-messages/bp-messages-notifications.php */
|
155 |
-
$return = apply_filters( 'bp_messages_' . $amount . '_new_message_notification', array(
|
156 |
-
'text' => $text,
|
157 |
-
'link' => $link
|
158 |
-
), $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id );
|
159 |
Â
}
|
160 |
Â
|
161 |
Â
/**
|
103 |
Â
*/
|
104 |
Â
function messages_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
|
105 |
Â
$total_items = (int) $total_items;
|
106 |
+
$text = '';
|
107 |
Â
$link = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/inbox' );
|
108 |
Â
$title = __( 'Inbox', 'buddypress' );
|
109 |
Â
$amount = 'single';
|
112 |
Â
if ( $total_items > 1 ) {
|
113 |
Â
$amount = 'multiple';
|
114 |
Â
$text = sprintf( __( 'You have %d new messages', 'buddypress' ), $total_items );
|
Â
|
|
Â
|
|
115 |
Â
|
116 |
+
} else {
|
117 |
Â
// Get message thread ID.
|
118 |
Â
$message = new BP_Messages_Message( $item_id );
|
119 |
Â
$thread_id = $message->thread_id;
|
127 |
Â
$text = sprintf( _n( 'You have %s new private message', 'You have %s new private messages', $total_items, 'buddypress' ), bp_core_number_format( $total_items ) );
|
128 |
Â
}
|
129 |
Â
}
|
Â
|
|
130 |
Â
|
131 |
+
if ( 'string' === $format ) {
|
132 |
+
if ( ! empty( $link ) ) {
|
133 |
+
$return = '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $text ) . '</a>';
|
134 |
+
} else {
|
135 |
+
$return = esc_html( $text );
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Filters the new message notification text before the notification is created.
|
140 |
+
*
|
141 |
+
* This is a dynamic filter. Possible filter names are:
|
142 |
+
* - 'bp_messages_multiple_new_message_notification'.
|
143 |
+
* - 'bp_messages_single_new_message_notification'.
|
144 |
+
*
|
145 |
+
* @param string $return Notification text.
|
146 |
+
* @param int $total_items Number of messages referred to by the notification.
|
147 |
+
* @param string $text The raw notification test (ie, not wrapped in a link).
|
148 |
+
* @param int $item_id ID of the associated item.
|
149 |
+
* @param int $secondary_item_id ID of the secondary associated item.
|
150 |
+
*/
|
151 |
+
$return = apply_filters( 'bp_messages_' . $amount . '_new_message_notification', $return, (int) $total_items, $text, $link, $item_id, $secondary_item_id );
|
152 |
Â
} else {
|
153 |
+
/** This filter is documented in bp-messages/bp-messages-notifications.php */
|
154 |
+
$return = apply_filters( 'bp_messages_' . $amount . '_new_message_notification', array(
|
155 |
+
'text' => $text,
|
156 |
+
'link' => $link
|
157 |
+
), $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id );
|
158 |
+
}
|
159 |
+
|
160 |
+
// Custom notification action for the Messages component
|
161 |
+
} else {
|
162 |
+
if ( 'string' === $format ) {
|
163 |
+
$return = $text;
|
164 |
+
} else {
|
165 |
+
$return = array(
|
166 |
+
'text' => $text,
|
167 |
+
'link' => $link
|
168 |
+
);
|
169 |
Â
}
|
170 |
Â
|
171 |
Â
/**
|
172 |
+
* Backcompat for plugins that used to filter bp_messages_single_new_message_notification
|
173 |
+
* for their custom actions. These plugins should now use 'bp_messages_' . $action . '_notification'
|
174 |
+
*/
|
175 |
+
if ( has_filter( 'bp_messages_single_new_message_notification' ) ) {
|
176 |
+
if ( 'string' === $format ) {
|
177 |
+
/** This filter is documented in bp-messages/bp-messages-notifications.php */
|
178 |
+
$return = apply_filters( 'bp_messages_single_new_message_notification', $return, (int) $total_items, $text, $link, $item_id, $secondary_item_id );
|
179 |
+
|
180 |
+
// Notice that there are seven parameters instead of six? Ugh...
|
181 |
+
} else {
|
182 |
+
/** This filter is documented in bp-messages/bp-messages-notifications.php */
|
183 |
+
$return = apply_filters( 'bp_messages_single_new_message_notification', $return, $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id );
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Filters the custom action notification before the notification is created.
|
189 |
Â
*
|
190 |
+
* This is a dynamic filter based on the message notification action.
|
Â
|
|
Â
|
|
191 |
Â
*
|
192 |
+
* @since 2.6.0
|
193 |
+
*
|
194 |
+
* @param array $value An associative array containing the text and the link of the notification
|
195 |
Â
* @param int $item_id ID of the associated item.
|
196 |
Â
* @param int $secondary_item_id ID of the secondary associated item.
|
197 |
+
* @param int $total_items Number of messages referred to by the notification.
|
198 |
+
* @param string $format Return value format. 'string' for BuddyBar-compatible
|
199 |
+
* notifications; 'array' for WP Toolbar. Default: 'string'.
|
200 |
Â
*/
|
201 |
+
$return = apply_filters( "bp_messages_{$action}_notification", $return, $item_id, $secondary_item_id, $total_items, $format );
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
202 |
Â
}
|
203 |
Â
|
204 |
Â
/**
|
@@ -132,7 +132,10 @@ function messages_screen_conversation() {
|
|
132 |
Â
$class = ( 0 === $count ) ? 'no-count' : 'count';
|
133 |
Â
$nav_name = sprintf( __( 'Messages <span class="%s">%s</span>', 'buddypress' ), esc_attr( $class ), bp_core_number_format( $count ) );
|
134 |
Â
|
135 |
-
|
Â
|
|
Â
|
|
Â
|
|
136 |
Â
|
137 |
Â
/**
|
138 |
Â
* Fires right before the loading of the Messages view screen template file.
|
@@ -213,8 +216,14 @@ function messages_screen_notification_settings() {
|
|
213 |
Â
<tr id="messages-notification-settings-new-message">
|
214 |
Â
<td></td>
|
215 |
Â
<td><?php _e( 'A member sends you a new message', 'buddypress' ) ?></td>
|
216 |
-
<td class="yes"><input type="radio" name="notifications[notification_messages_new_message]" id="notification-messages-new-messages-yes" value="yes" <?php checked( $new_messages, 'yes', true ) ?>/><label for="notification-messages-new-messages-yes" class="bp-screen-reader-text"><?php
|
217 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
218 |
Â
</tr>
|
219 |
Â
|
220 |
Â
<?php
|
132 |
Â
$class = ( 0 === $count ) ? 'no-count' : 'count';
|
133 |
Â
$nav_name = sprintf( __( 'Messages <span class="%s">%s</span>', 'buddypress' ), esc_attr( $class ), bp_core_number_format( $count ) );
|
134 |
Â
|
135 |
+
// Edit the Navigation name.
|
136 |
+
$bp->members->nav->edit_nav( array(
|
137 |
+
'name' => $nav_name,
|
138 |
+
), $bp->messages->slug );
|
139 |
Â
|
140 |
Â
/**
|
141 |
Â
* Fires right before the loading of the Messages view screen template file.
|
216 |
Â
<tr id="messages-notification-settings-new-message">
|
217 |
Â
<td></td>
|
218 |
Â
<td><?php _e( 'A member sends you a new message', 'buddypress' ) ?></td>
|
219 |
+
<td class="yes"><input type="radio" name="notifications[notification_messages_new_message]" id="notification-messages-new-messages-yes" value="yes" <?php checked( $new_messages, 'yes', true ) ?>/><label for="notification-messages-new-messages-yes" class="bp-screen-reader-text"><?php
|
220 |
+
/* translators: accessibility text */
|
221 |
+
_e( 'Yes, send email', 'buddypress' );
|
222 |
+
?></label></td>
|
223 |
+
<td class="no"><input type="radio" name="notifications[notification_messages_new_message]" id="notification-messages-new-messages-no" value="no" <?php checked( $new_messages, 'no', true ) ?>/><label for="notification-messages-new-messages-no" class="bp-screen-reader-text"><?php
|
224 |
+
/* translators: accessibility text */
|
225 |
+
_e( 'No, do not send email', 'buddypress' );
|
226 |
+
?></label></td>
|
227 |
Â
</tr>
|
228 |
Â
|
229 |
Â
<?php
|
@@ -10,8 +10,10 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
14 |
-
require dirname( __FILE__ ) . '/classes/class-bp-messages-
|
Â
|
|
Â
|
|
15 |
Â
|
16 |
Â
/**
|
17 |
Â
* Retrieve private message threads for display in inbox/sentbox/notices.
|
@@ -302,10 +304,12 @@ function bp_message_thread_view_link( $thread_id = 0 ) {
|
|
302 |
Â
* Filters the permalink of a particular thread.
|
303 |
Â
*
|
304 |
Â
* @since 1.0.0
|
Â
|
|
305 |
Â
*
|
306 |
-
* @param string $value
|
Â
|
|
307 |
Â
*/
|
308 |
-
return apply_filters( 'bp_get_message_thread_view_link', trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id ) );
|
309 |
Â
}
|
310 |
Â
|
311 |
Â
/**
|
@@ -544,10 +548,12 @@ function bp_message_thread_total_count( $thread_id = false ) {
|
|
544 |
Â
* Filters the current thread's total message count.
|
545 |
Â
*
|
546 |
Â
* @since 2.2.0
|
Â
|
|
547 |
Â
*
|
548 |
-
* @param int $count
|
Â
|
|
549 |
Â
*/
|
550 |
-
return apply_filters( 'bp_get_message_thread_total_count', $count );
|
551 |
Â
}
|
552 |
Â
|
553 |
Â
/**
|
@@ -575,6 +581,7 @@ function bp_message_thread_total_and_unread_count( $thread_id = false ) {
|
|
575 |
Â
$unread = bp_get_message_thread_unread_count( $thread_id );
|
576 |
Â
|
577 |
Â
return sprintf(
|
Â
|
|
578 |
Â
'<span class="thread-count">(%1$s)</span> <span class="bp-screen-reader-text">%2$s</span>',
|
579 |
Â
number_format_i18n( $total ),
|
580 |
Â
sprintf( _n( '%d unread', '%d unread', $unread, 'buddypress' ), number_format_i18n( $unread ) )
|
@@ -676,8 +683,10 @@ function bp_message_thread_avatar( $args = '' ) {
|
|
676 |
Â
* Filters the avatar for the last sender in the current message thread.
|
677 |
Â
*
|
678 |
Â
* @since 1.0.0
|
Â
|
|
679 |
Â
*
|
680 |
Â
* @param string $value User avatar string.
|
Â
|
|
681 |
Â
*/
|
682 |
Â
return apply_filters( 'bp_get_message_thread_avatar', bp_core_fetch_avatar( array(
|
683 |
Â
'item_id' => $messages_template->thread->last_sender_id,
|
@@ -687,7 +696,7 @@ function bp_message_thread_avatar( $args = '' ) {
|
|
687 |
Â
'class' => $r['class'],
|
688 |
Â
'width' => $r['width'],
|
689 |
Â
'height' => $r['height'],
|
690 |
-
) ) );
|
691 |
Â
}
|
692 |
Â
|
693 |
Â
/**
|
@@ -777,7 +786,10 @@ function bp_message_search_form() {
|
|
777 |
Â
ob_start(); ?>
|
778 |
Â
|
779 |
Â
<form action="" method="get" id="search-message-form">
|
780 |
-
<label for="messages_search" class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
781 |
Â
<input type="text" name="s" id="messages_search"<?php echo $search_placeholder . $search_value; ?> />
|
782 |
Â
<input type="submit" class="button" id="messages_search_submit" name="messages_search_submit" value="<?php esc_html_e( 'Search', 'buddypress' ); ?>" />
|
783 |
Â
</form>
|
@@ -919,10 +931,10 @@ function bp_messages_content_value() {
|
|
919 |
Â
function bp_messages_options() {
|
920 |
Â
?>
|
921 |
Â
|
922 |
-
<label for="message-type-select" class="bp-screen-reader-text"
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
Â
<select name="message-type-select" id="message-type-select">
|
927 |
Â
<option value=""><?php _e( 'Select', 'buddypress' ); ?></option>
|
928 |
Â
<option value="read"><?php _ex('Read', 'Message dropdown filter', 'buddypress') ?></option>
|
@@ -949,7 +961,9 @@ function bp_messages_options() {
|
|
949 |
Â
*/
|
950 |
Â
function bp_messages_bulk_management_dropdown() {
|
951 |
Â
?>
|
952 |
-
<label class="bp-screen-reader-text" for="messages-select"><?php
|
Â
|
|
Â
|
|
953 |
Â
<select name="messages_bulk_action" id="messages-select">
|
954 |
Â
<option value="" selected="selected"><?php _e( 'Bulk Actions', 'buddypress' ); ?></option>
|
955 |
Â
<option value="read"><?php _e( 'Mark read', 'buddypress' ); ?></option>
|
@@ -999,7 +1013,6 @@ function bp_messages_is_active_notice() {
|
|
999 |
Â
*
|
1000 |
Â
* @since 1.0.0
|
1001 |
Â
* @deprecated 1.6.0
|
1002 |
-
* @uses bp_get_message_is_active_notice()
|
1003 |
Â
* @return bool
|
1004 |
Â
*/
|
1005 |
Â
function bp_message_is_active_notice() {
|
@@ -1013,7 +1026,6 @@ function bp_message_is_active_notice() {
|
|
1013 |
Â
*
|
1014 |
Â
* @since 1.0.0
|
1015 |
Â
* @deprecated 1.6.0
|
1016 |
-
* @uses bp_messages_is_active_notice()
|
1017 |
Â
*/
|
1018 |
Â
function bp_get_message_is_active_notice() {
|
1019 |
Â
|
@@ -1210,7 +1222,6 @@ function bp_message_activate_deactivate_text() {
|
|
1210 |
Â
*
|
1211 |
Â
* @since 1.5.0
|
1212 |
Â
*
|
1213 |
-
* @uses bp_get_messages_slug()
|
1214 |
Â
*/
|
1215 |
Â
function bp_messages_slug() {
|
1216 |
Â
echo bp_get_messages_slug();
|
@@ -1299,7 +1310,6 @@ function bp_send_private_message_link() {
|
|
1299 |
Â
*
|
1300 |
Â
* @since 1.2.6
|
1301 |
Â
*
|
1302 |
-
* @uses bp_get_send_message_button()
|
1303 |
Â
*/
|
1304 |
Â
function bp_send_private_message_button() {
|
1305 |
Â
echo bp_get_send_message_button();
|
@@ -1802,8 +1812,10 @@ function bp_the_thread_message_sender_avatar( $args = '' ) {
|
|
1802 |
Â
* Filters the avatar for the current message sender.
|
1803 |
Â
*
|
1804 |
Â
* @since 1.1.0
|
Â
|
|
1805 |
Â
*
|
1806 |
Â
* @param string $value <img> tag containing the avatar value.
|
Â
|
|
1807 |
Â
*/
|
1808 |
Â
return apply_filters( 'bp_get_the_thread_message_sender_avatar_thumb', bp_core_fetch_avatar( array(
|
1809 |
Â
'item_id' => $thread_template->message->sender_id,
|
@@ -1811,7 +1823,7 @@ function bp_the_thread_message_sender_avatar( $args = '' ) {
|
|
1811 |
Â
'width' => $r['width'],
|
1812 |
Â
'height' => $r['height'],
|
1813 |
Â
'alt' => bp_core_get_user_displayname( $thread_template->message->sender_id )
|
1814 |
-
) ) );
|
1815 |
Â
}
|
1816 |
Â
|
1817 |
Â
/**
|
@@ -1944,7 +1956,6 @@ function bp_the_thread_message_date_sent() {
|
|
1944 |
Â
*
|
1945 |
Â
* @since 2.1.0
|
1946 |
Â
*
|
1947 |
-
* @uses strtotime() To convert the message string into a usable timestamp.
|
1948 |
Â
*
|
1949 |
Â
* @return int
|
1950 |
Â
*/
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-messages-box-template.php';
|
15 |
+
require dirname( __FILE__ ) . '/classes/class-bp-messages-thread-template.php';
|
16 |
+
}
|
17 |
Â
|
18 |
Â
/**
|
19 |
Â
* Retrieve private message threads for display in inbox/sentbox/notices.
|
304 |
Â
* Filters the permalink of a particular thread.
|
305 |
Â
*
|
306 |
Â
* @since 1.0.0
|
307 |
+
* @since 2.6.0 Added the `$thread_id` parameter.
|
308 |
Â
*
|
309 |
+
* @param string $value Permalink of a particular thread.
|
310 |
+
* @param int $thread_id ID of the thread.
|
311 |
Â
*/
|
312 |
+
return apply_filters( 'bp_get_message_thread_view_link', trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id ), $thread_id );
|
313 |
Â
}
|
314 |
Â
|
315 |
Â
/**
|
548 |
Â
* Filters the current thread's total message count.
|
549 |
Â
*
|
550 |
Â
* @since 2.2.0
|
551 |
+
* @since 2.6.0 Added the `$thread_id` parameter.
|
552 |
Â
*
|
553 |
+
* @param int $count Current thread total message count.
|
554 |
+
* @param int $thread_id ID of the queried thread.
|
555 |
Â
*/
|
556 |
+
return apply_filters( 'bp_get_message_thread_total_count', $count, $thread_id );
|
557 |
Â
}
|
558 |
Â
|
559 |
Â
/**
|
581 |
Â
$unread = bp_get_message_thread_unread_count( $thread_id );
|
582 |
Â
|
583 |
Â
return sprintf(
|
584 |
+
/* translators: 1: total number, 2: accessibility text: number of unread messages */
|
585 |
Â
'<span class="thread-count">(%1$s)</span> <span class="bp-screen-reader-text">%2$s</span>',
|
586 |
Â
number_format_i18n( $total ),
|
587 |
Â
sprintf( _n( '%d unread', '%d unread', $unread, 'buddypress' ), number_format_i18n( $unread ) )
|
683 |
Â
* Filters the avatar for the last sender in the current message thread.
|
684 |
Â
*
|
685 |
Â
* @since 1.0.0
|
686 |
+
* @since 2.6.0 Added the `$r` parameter.
|
687 |
Â
*
|
688 |
Â
* @param string $value User avatar string.
|
689 |
+
* @param array $r Array of parsed arguments.
|
690 |
Â
*/
|
691 |
Â
return apply_filters( 'bp_get_message_thread_avatar', bp_core_fetch_avatar( array(
|
692 |
Â
'item_id' => $messages_template->thread->last_sender_id,
|
696 |
Â
'class' => $r['class'],
|
697 |
Â
'width' => $r['width'],
|
698 |
Â
'height' => $r['height'],
|
699 |
+
) ), $r );
|
700 |
Â
}
|
701 |
Â
|
702 |
Â
/**
|
786 |
Â
ob_start(); ?>
|
787 |
Â
|
788 |
Â
<form action="" method="get" id="search-message-form">
|
789 |
+
<label for="messages_search" class="bp-screen-reader-text"><?php
|
790 |
+
/* translators: accessibility text */
|
791 |
+
esc_html_e( 'Search Messages', 'buddypress' );
|
792 |
+
?></label>
|
793 |
Â
<input type="text" name="s" id="messages_search"<?php echo $search_placeholder . $search_value; ?> />
|
794 |
Â
<input type="submit" class="button" id="messages_search_submit" name="messages_search_submit" value="<?php esc_html_e( 'Search', 'buddypress' ); ?>" />
|
795 |
Â
</form>
|
931 |
Â
function bp_messages_options() {
|
932 |
Â
?>
|
933 |
Â
|
934 |
+
<label for="message-type-select" class="bp-screen-reader-text"><?php
|
935 |
+
/* translators: accessibility text */
|
936 |
+
_e( 'Select:', 'buddypress' );
|
937 |
+
?></label>
|
938 |
Â
<select name="message-type-select" id="message-type-select">
|
939 |
Â
<option value=""><?php _e( 'Select', 'buddypress' ); ?></option>
|
940 |
Â
<option value="read"><?php _ex('Read', 'Message dropdown filter', 'buddypress') ?></option>
|
961 |
Â
*/
|
962 |
Â
function bp_messages_bulk_management_dropdown() {
|
963 |
Â
?>
|
964 |
+
<label class="bp-screen-reader-text" for="messages-select"><?php
|
965 |
+
_e( 'Select Bulk Action', 'buddypress' );
|
966 |
+
?></label>
|
967 |
Â
<select name="messages_bulk_action" id="messages-select">
|
968 |
Â
<option value="" selected="selected"><?php _e( 'Bulk Actions', 'buddypress' ); ?></option>
|
969 |
Â
<option value="read"><?php _e( 'Mark read', 'buddypress' ); ?></option>
|
1013 |
Â
*
|
1014 |
Â
* @since 1.0.0
|
1015 |
Â
* @deprecated 1.6.0
|
Â
|
|
1016 |
Â
* @return bool
|
1017 |
Â
*/
|
1018 |
Â
function bp_message_is_active_notice() {
|
1026 |
Â
*
|
1027 |
Â
* @since 1.0.0
|
1028 |
Â
* @deprecated 1.6.0
|
Â
|
|
1029 |
Â
*/
|
1030 |
Â
function bp_get_message_is_active_notice() {
|
1031 |
Â
|
1222 |
Â
*
|
1223 |
Â
* @since 1.5.0
|
1224 |
Â
*
|
Â
|
|
1225 |
Â
*/
|
1226 |
Â
function bp_messages_slug() {
|
1227 |
Â
echo bp_get_messages_slug();
|
1310 |
Â
*
|
1311 |
Â
* @since 1.2.6
|
1312 |
Â
*
|
Â
|
|
1313 |
Â
*/
|
1314 |
Â
function bp_send_private_message_button() {
|
1315 |
Â
echo bp_get_send_message_button();
|
1812 |
Â
* Filters the avatar for the current message sender.
|
1813 |
Â
*
|
1814 |
Â
* @since 1.1.0
|
1815 |
+
* @since 2.6.0 Added the `$r` parameter.
|
1816 |
Â
*
|
1817 |
Â
* @param string $value <img> tag containing the avatar value.
|
1818 |
+
* @param array $r Array of parsed arguments.
|
1819 |
Â
*/
|
1820 |
Â
return apply_filters( 'bp_get_the_thread_message_sender_avatar_thumb', bp_core_fetch_avatar( array(
|
1821 |
Â
'item_id' => $thread_template->message->sender_id,
|
1823 |
Â
'width' => $r['width'],
|
1824 |
Â
'height' => $r['height'],
|
1825 |
Â
'alt' => bp_core_get_user_displayname( $thread_template->message->sender_id )
|
1826 |
+
) ), $r );
|
1827 |
Â
}
|
1828 |
Â
|
1829 |
Â
/**
|
1956 |
Â
*
|
1957 |
Â
* @since 2.1.0
|
1958 |
Â
*
|
Â
|
|
1959 |
Â
*
|
1960 |
Â
* @return int
|
1961 |
Â
*/
|
@@ -10,7 +10,9 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Register widgets for the Messages component.
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-messages-sitewide-notices-widget.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Register widgets for the Messages component.
|
@@ -60,7 +60,6 @@ class BP_Messages_Component extends BP_Component {
|
|
60 |
Â
'cache',
|
61 |
Â
'actions',
|
62 |
Â
'screens',
|
63 |
-
'classes',
|
64 |
Â
'filters',
|
65 |
Â
'template',
|
66 |
Â
'functions',
|
@@ -68,6 +67,10 @@ class BP_Messages_Component extends BP_Component {
|
|
68 |
Â
'widgets',
|
69 |
Â
);
|
70 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
71 |
Â
// Conditional includes.
|
72 |
Â
if ( bp_is_active( $this->id, 'star' ) ) {
|
73 |
Â
$includes[] = 'star';
|
@@ -146,7 +149,15 @@ class BP_Messages_Component extends BP_Component {
|
|
146 |
Â
if ( bp_is_user() && bp_user_has_access() ) {
|
147 |
Â
$count = bp_get_total_unread_messages_count();
|
148 |
Â
$class = ( 0 === $count ) ? 'no-count' : 'count';
|
149 |
-
$nav_name = sprintf(
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
150 |
Â
} else {
|
151 |
Â
$nav_name = __( 'Messages', 'buddypress' );
|
152 |
Â
}
|
@@ -236,8 +247,16 @@ class BP_Messages_Component extends BP_Component {
|
|
236 |
Â
// Unread message count.
|
237 |
Â
$count = messages_get_unread_count();
|
238 |
Â
if ( !empty( $count ) ) {
|
239 |
-
$title = sprintf(
|
240 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
241 |
Â
} else {
|
242 |
Â
$title = __( 'Messages', 'buddypress' );
|
243 |
Â
$inbox = __( 'Inbox', 'buddypress' );
|
60 |
Â
'cache',
|
61 |
Â
'actions',
|
62 |
Â
'screens',
|
Â
|
|
63 |
Â
'filters',
|
64 |
Â
'template',
|
65 |
Â
'functions',
|
67 |
Â
'widgets',
|
68 |
Â
);
|
69 |
Â
|
70 |
+
if ( ! buddypress()->do_autoload ) {
|
71 |
+
$includes[] = 'classes';
|
72 |
+
}
|
73 |
+
|
74 |
Â
// Conditional includes.
|
75 |
Â
if ( bp_is_active( $this->id, 'star' ) ) {
|
76 |
Â
$includes[] = 'star';
|
149 |
Â
if ( bp_is_user() && bp_user_has_access() ) {
|
150 |
Â
$count = bp_get_total_unread_messages_count();
|
151 |
Â
$class = ( 0 === $count ) ? 'no-count' : 'count';
|
152 |
+
$nav_name = sprintf(
|
153 |
+
/* translators: %s: Unread message count for the current user */
|
154 |
+
__( 'Messages %s', 'buddypress' ),
|
155 |
+
sprintf(
|
156 |
+
'<span class="%s">%s</span>',
|
157 |
+
esc_attr( $class ),
|
158 |
+
bp_core_number_format( $count )
|
159 |
+
)
|
160 |
+
);
|
161 |
Â
} else {
|
162 |
Â
$nav_name = __( 'Messages', 'buddypress' );
|
163 |
Â
}
|
247 |
Â
// Unread message count.
|
248 |
Â
$count = messages_get_unread_count();
|
249 |
Â
if ( !empty( $count ) ) {
|
250 |
+
$title = sprintf(
|
251 |
+
/* translators: %s: Unread message count for the current user */
|
252 |
+
__( 'Messages %s', 'buddypress' ),
|
253 |
+
'<span class="count">' . bp_core_number_format( $count ) . '</span>'
|
254 |
+
);
|
255 |
+
$inbox = sprintf(
|
256 |
+
/* translators: %s: Unread message count for the current user */
|
257 |
+
__( 'Inbox %s', 'buddypress' ),
|
258 |
+
'<span class="count">' . bp_core_number_format( $count ) . '</span>'
|
259 |
+
);
|
260 |
Â
} else {
|
261 |
Â
$title = __( 'Messages', 'buddypress' );
|
262 |
Â
$inbox = __( 'Inbox', 'buddypress' );
|
@@ -25,8 +25,9 @@ class BP_Messages_Sitewide_Notices_Widget extends WP_Widget {
|
|
25 |
Â
'bp_messages_sitewide_notices_widget',
|
26 |
Â
__( '(BuddyPress) Sitewide Notices', 'buddypress' ),
|
27 |
Â
array(
|
28 |
-
'classname'
|
29 |
-
'description'
|
Â
|
|
30 |
Â
)
|
31 |
Â
);
|
32 |
Â
}
|
25 |
Â
'bp_messages_sitewide_notices_widget',
|
26 |
Â
__( '(BuddyPress) Sitewide Notices', 'buddypress' ),
|
27 |
Â
array(
|
28 |
+
'classname' => 'widget_bp_core_sitewide_messages buddypress widget',
|
29 |
+
'description' => __( 'Display Sitewide Notices posted by the site administrator', 'buddypress' ),
|
30 |
+
'customize_selective_refresh' => true,
|
31 |
Â
)
|
32 |
Â
);
|
33 |
Â
}
|
@@ -4,11 +4,11 @@
|
|
4 |
Â
z-index: 99999;
|
5 |
Â
background: #fff;
|
6 |
Â
border: 1px solid #ccc;
|
7 |
-
-moz-border-radius-
|
8 |
Â
-khtml-border-bottom-right-radius: 3px;
|
9 |
Â
-webkit-border-bottom-right-radius: 3px;
|
10 |
Â
border-bottom-right-radius: 3px;
|
11 |
-
-moz-border-radius-
|
12 |
Â
-khtml-border-bottom-left-radius: 3px;
|
13 |
Â
-webkit-border-bottom-left-radius: 3px;
|
14 |
Â
border-bottom-left-radius: 3px;
|
4 |
Â
z-index: 99999;
|
5 |
Â
background: #fff;
|
6 |
Â
border: 1px solid #ccc;
|
7 |
+
-moz-border-radius-bottomright: 3px;
|
8 |
Â
-khtml-border-bottom-right-radius: 3px;
|
9 |
Â
-webkit-border-bottom-right-radius: 3px;
|
10 |
Â
border-bottom-right-radius: 3px;
|
11 |
+
-moz-border-radius-bottomleft: 3px;
|
12 |
Â
-khtml-border-bottom-left-radius: 3px;
|
13 |
Â
-webkit-border-bottom-left-radius: 3px;
|
14 |
Â
border-bottom-left-radius: 3px;
|
@@ -1 +1 @@
|
|
1 |
-
.ac_results{padding:0;overflow:hidden;z-index:99999;background:#fff;border:1px solid #ccc;-moz-border-radius-
|
1 |
+
.ac_results{padding:0;overflow:hidden;z-index:99999;background:#fff;border:1px solid #ccc;-moz-border-radius-bottomright:3px;-khtml-border-bottom-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px;-moz-border-radius-bottomleft:3px;-khtml-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px}.ac_results ul{width:100%;list-style:none;padding:0;margin:0}.ac_results li{margin:0;padding:5px 10px;cursor:pointer;display:block;font-size:1em;line-height:16px;overflow:hidden}.ac_results li img{margin-left:5px}.ac_odd{background-color:#f0f0f0}.ac_over{background-color:#888;color:#fff}ul.acfb-holder{margin:0;height:auto!important;height:1%;overflow:hidden;padding:0;list-style:none}ul.acfb-holder li{float:right;margin:0 0 4px 5px;list-style-type:none}ul.acfb-holder li.friend-tab{border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;border:1px solid #ffe7c7;padding:2px 7px;background:#FFF9DF;font-size:1em}li.friend-tab img.avatar{border-width:2px!important;vertical-align:middle}li.friend-tab span.p{padding-right:5px;font-size:.8em;cursor:pointer}input#send-to-input{width:275px}
|
@@ -9,12 +9,13 @@
|
|
9 |
Â
*
|
10 |
Â
* Revision: $Id: jquery.autocomplete.js 4485 2008-01-20 13:52:47Z joern.zaefferer $
|
11 |
Â
*
|
Â
|
|
12 |
Â
*/
|
13 |
Â
|
14 |
Â
;(function($) {
|
15 |
Â
|
16 |
Â
$.fn.extend({
|
17 |
-
|
18 |
Â
var isUrl = typeof urlOrData == "string";
|
19 |
Â
options = $.extend({}, $.Autocompleter.defaults, {
|
20 |
Â
url: isUrl ? urlOrData : null,
|
9 |
Â
*
|
10 |
Â
* Revision: $Id: jquery.autocomplete.js 4485 2008-01-20 13:52:47Z joern.zaefferer $
|
11 |
Â
*
|
12 |
+
* Namespaced for BuddyPress as $.fn.autocompletebp, to avoid conflicts with other autocomplete scripts.
|
13 |
Â
*/
|
14 |
Â
|
15 |
Â
;(function($) {
|
16 |
Â
|
17 |
Â
$.fn.extend({
|
18 |
+
autocompletebp: function(urlOrData, options) {
|
19 |
Â
var isUrl = typeof urlOrData == "string";
|
20 |
Â
options = $.extend({}, $.Autocompleter.defaults, {
|
21 |
Â
url: isUrl ? urlOrData : null,
|
@@ -1,2 +1 @@
|
|
1 |
-
|
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=x.selected();if(!a)return!1;var b=a.result;if(t=b,c.multiple){var d=f(s.val());d.length>1&&(b=d.slice(0,d.length-1).join(c.multipleSeparator)+c.multipleSeparator+b),b+=c.multipleSeparator}return s.val(b),j(),s.trigger("result",[a.data,a.value]),!0}function e(a,b){if(q==r.DEL)return void x.hide();var d=s.val();(b||d!=t)&&(t=d,d=g(d),d.length>=c.minChars?(s.addClass(c.loadingClass),jQuery("#send-to-input").addClass("loading"),c.matchCase||(d=d.toLowerCase()),l(d,k,j)):(n(),x.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(s.val()).toLowerCase()==d.toLowerCase()&&8!=q&&(s.val(s.val()+e.substring(g(t).length)),a.Autocompleter.Selection(b,t.length,t.length+e.length))}function i(){clearTimeout(p),p=setTimeout(j,200)}function j(){x.hide(),clearTimeout(p),n(),c.mustMatch&&s.search(function(a){a||s.val("")})}function k(a,b){if(b&&b.length&&v){n(),x.display(b,a);var c=b[0].value.split(";");b.value=c[0],h(a,b.value),x.show()}else j()}function l(d,e,f){c.matchCase||(d=d.toLowerCase());var h=u.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:o()},i),success:function(a){var b=c.parse&&c.parse(a)||m(a);u.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(){s.removeClass(c.loadingClass),jQuery("#send-to-input").removeClass("loading")}function o(){var a,b,c,d,e,f=document.cookie.split(";"),g={},h="bp-";for(a=0;a<f.length;a++)b=f[a],c=b.indexOf("="),d=jq.trim(unescape(b.slice(0,c))),e=unescape(b.slice(c+1)),0===d.indexOf(h)&&(g[d]=e);return encodeURIComponent(jq.param(g))}var p,q,r={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34},s=a(b).attr("autocomplete","off").addClass(c.inputClass),t="",u=a.Autocompleter.Cache(c),v=0,w={mouseDownOnSelect:!1},x=a.Autocompleter.Select(c,b,d,w);s.keydown(function(b){switch(q=b.keyCode,b.keyCode){case r.UP:b.preventDefault(),x.visible()?x.prev():e(0,!0);break;case r.DOWN:b.preventDefault(),x.visible()?x.next():e(0,!0);break;case r.PAGEUP:b.preventDefault(),x.visible()?x.pageUp():e(0,!0);break;case r.PAGEDOWN:b.preventDefault(),x.visible()?x.pageDown():e(0,!0);break;case c.multiple&&","==a.trim(c.multipleSeparator)&&r.COMMA:case r.TAB:case r.RETURN:d()&&(c.multiple||s.blur(),b.preventDefault(),s.focus());break;case r.ESC:x.hide();break;default:clearTimeout(p),p=setTimeout(e,c.delay)}}).keypress(function(){}).focus(function(){v++}).blur(function(){v=0,w.mouseDownOnSelect||i()}).click(function(){v++>1&&!x.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):s.trigger("result",d&&[d.data,d.value])}var c=arguments.length>1?arguments[1]:null;a.each(f(s.val()),function(a,c){l(c,b,b)})}).bind("flushCache",function(){u.flush()}).bind("setOptions",function(){a.extend(c,arguments[1]),"data"in arguments[1]&&u.populate()}).bind("unautocomplete",function(){x.unbind(),s.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);
|
1 |
+
!function(a){a.fn.extend({autocompletebp: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=x.selected();if(!a)return!1;var b=a.result;if(t=b,c.multiple){var d=f(s.val());d.length>1&&(b=d.slice(0,d.length-1).join(c.multipleSeparator)+c.multipleSeparator+b),b+=c.multipleSeparator}return s.val(b),j(),s.trigger("result",[a.data,a.value]),!0}function e(a,b){if(q==r.DEL)return void x.hide();var d=s.val();(b||d!=t)&&(t=d,d=g(d),d.length>=c.minChars?(s.addClass(c.loadingClass),jQuery("#send-to-input").addClass("loading"),c.matchCase||(d=d.toLowerCase()),l(d,k,j)):(n(),x.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(s.val()).toLowerCase()==d.toLowerCase()&&8!=q&&(s.val(s.val()+e.substring(g(t).length)),a.Autocompleter.Selection(b,t.length,t.length+e.length))}function i(){clearTimeout(p),p=setTimeout(j,200)}function j(){x.hide(),clearTimeout(p),n(),c.mustMatch&&s.search(function(a){a||s.val("")})}function k(a,b){if(b&&b.length&&v){n(),x.display(b,a);var c=b[0].value.split(";");b.value=c[0],h(a,b.value),x.show()}else j()}function l(d,e,f){c.matchCase||(d=d.toLowerCase());var h=u.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:o()},i),success:function(a){var b=c.parse&&c.parse(a)||m(a);u.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(){s.removeClass(c.loadingClass),jQuery("#send-to-input").removeClass("loading")}function o(){var a,b,c,d,e,f=document.cookie.split(";"),g={},h="bp-";for(a=0;a<f.length;a++)b=f[a],c=b.indexOf("="),d=jq.trim(unescape(b.slice(0,c))),e=unescape(b.slice(c+1)),0===d.indexOf(h)&&(g[d]=e);return encodeURIComponent(jq.param(g))}var p,q,r={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34},s=a(b).attr("autocomplete","off").addClass(c.inputClass),t="",u=a.Autocompleter.Cache(c),v=0,w={mouseDownOnSelect:!1},x=a.Autocompleter.Select(c,b,d,w);s.keydown(function(b){switch(q=b.keyCode,b.keyCode){case r.UP:b.preventDefault(),x.visible()?x.prev():e(0,!0);break;case r.DOWN:b.preventDefault(),x.visible()?x.next():e(0,!0);break;case r.PAGEUP:b.preventDefault(),x.visible()?x.pageUp():e(0,!0);break;case r.PAGEDOWN:b.preventDefault(),x.visible()?x.pageDown():e(0,!0);break;case c.multiple&&","==a.trim(c.multipleSeparator)&&r.COMMA:case r.TAB:case r.RETURN:d()&&(c.multiple||s.blur(),b.preventDefault(),s.focus());break;case r.ESC:x.hide();break;default:clearTimeout(p),p=setTimeout(e,c.delay)}}).keypress(function(){}).focus(function(){v++}).blur(function(){v=0,w.mouseDownOnSelect||i()}).click(function(){v++>1&&!x.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):s.trigger("result",d&&[d.data,d.value])}var c=arguments.length>1?arguments[1]:null;a.each(f(s.val()),function(a,c){l(c,b,b)})}).bind("flushCache",function(){u.flush()}).bind("setOptions",function(){a.extend(c,arguments[1]),"data"in arguments[1]&&u.populate()}).bind("unautocomplete",function(){x.unbind(),s.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);
|
Â
|
@@ -46,7 +46,7 @@ jQuery.fn.autoCompletefb = function(options)
|
|
46 |
Â
acfb.removeFind(this);
|
47 |
Â
});
|
48 |
Â
|
49 |
-
jQuery(settings.inputClass,tmp).
|
50 |
Â
jQuery(settings.inputClass,tmp).result(function(e,d,f){
|
51 |
Â
var f = settings.foundClass.replace(/\./,'');
|
52 |
Â
var d = String(d).split(' (');
|
46 |
Â
acfb.removeFind(this);
|
47 |
Â
});
|
48 |
Â
|
49 |
+
jQuery(settings.inputClass,tmp).autocompletebp(settings.urlLookup,settings.acOptions);
|
50 |
Â
jQuery(settings.inputClass,tmp).result(function(e,d,f){
|
51 |
Â
var f = settings.foundClass.replace(/\./,'');
|
52 |
Â
var d = String(d).split(' (');
|
@@ -1,2 +1 @@
|
|
1 |
-
|
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 |
+
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).autocompletebp(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,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM 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);
|
Â
|
|
1 |
Â
!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,2 +1 @@
|
|
1 |
-
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 PM 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);
|
Â
|
|
1 |
Â
!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);
|
@@ -43,7 +43,7 @@ function bp_notifications_add_notification( $args = array() ) {
|
|
43 |
Â
'date_notified' => bp_core_current_time(),
|
44 |
Â
'is_new' => 1,
|
45 |
Â
'allow_duplicate' => false,
|
46 |
-
), 'notifications_add_notification' )
|
47 |
Â
|
48 |
Â
// Check for existing duplicate notifications.
|
49 |
Â
if ( ! $r['allow_duplicate'] ) {
|
@@ -98,7 +98,7 @@ function bp_notifications_get_notification( $id ) {
|
|
98 |
Â
* @return bool True on success, false on failure.
|
99 |
Â
*/
|
100 |
Â
function bp_notifications_delete_notification( $id ) {
|
101 |
-
if ( ! bp_notifications_check_notification_access(
|
102 |
Â
return false;
|
103 |
Â
}
|
104 |
Â
|
@@ -117,7 +117,7 @@ function bp_notifications_delete_notification( $id ) {
|
|
117 |
Â
* @return bool True on success, false on failure.
|
118 |
Â
*/
|
119 |
Â
function bp_notifications_mark_notification( $id, $is_new = false ) {
|
120 |
-
if ( ! bp_notifications_check_notification_access(
|
121 |
Â
return false;
|
122 |
Â
}
|
123 |
Â
|
@@ -233,7 +233,8 @@ function bp_notifications_get_notifications_for_user( $user_id, $format = 'strin
|
|
233 |
Â
$component_action_items[0]->item_id,
|
234 |
Â
$component_action_items[0]->secondary_item_id,
|
235 |
Â
$action_item_count,
|
236 |
-
'array'
|
Â
|
|
237 |
Â
);
|
238 |
Â
|
239 |
Â
// Create the object to be returned.
|
@@ -253,7 +254,7 @@ function bp_notifications_get_notifications_for_user( $user_id, $format = 'strin
|
|
253 |
Â
|
254 |
Â
// Return an array of content strings.
|
255 |
Â
} else {
|
256 |
-
$content = call_user_func( $bp->{$component_name}->notification_callback, $component_action_name, $component_action_items[0]->item_id, $component_action_items[0]->secondary_item_id, $action_item_count );
|
257 |
Â
$renderable[] = $content;
|
258 |
Â
}
|
259 |
Â
|
@@ -270,18 +271,38 @@ function bp_notifications_get_notifications_for_user( $user_id, $format = 'strin
|
|
270 |
Â
$component_action_items[0]->item_id,
|
271 |
Â
$component_action_items[0]->secondary_item_id,
|
272 |
Â
$action_item_count,
|
273 |
-
$format
|
Â
|
|
Â
|
|
Â
|
|
274 |
Â
);
|
275 |
Â
|
276 |
Â
// Function should return an object.
|
277 |
Â
if ( 'object' === $format ) {
|
278 |
Â
|
279 |
Â
/**
|
280 |
-
* Filters the
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
281 |
Â
*
|
282 |
Â
* @since 1.9.0
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
283 |
Â
*
|
284 |
-
* @
|
Â
|
|
Â
|
|
285 |
Â
*/
|
286 |
Â
$content = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', $ref_array );
|
287 |
Â
|
@@ -683,7 +704,7 @@ function bp_notifications_delete_meta( $notification_id, $meta_key = '', $meta_v
|
|
683 |
Â
|
684 |
Â
add_filter( 'query', 'bp_filter_metaid_column_name' );
|
685 |
Â
foreach ( $keys as $key ) {
|
686 |
-
$retval = delete_metadata( '
|
687 |
Â
}
|
688 |
Â
remove_filter( 'query', 'bp_filter_metaid_column_name' );
|
689 |
Â
|
@@ -695,8 +716,6 @@ function bp_notifications_delete_meta( $notification_id, $meta_key = '', $meta_v
|
|
695 |
Â
*
|
696 |
Â
* @since 2.3.0
|
697 |
Â
*
|
698 |
-
* @uses apply_filters() To call the 'bp_notifications_get_meta' hook.
|
699 |
-
*
|
700 |
Â
* @param int $notification_id ID of the notification item whose metadata is being requested.
|
701 |
Â
* @param string $meta_key Optional. If present, only the metadata matching
|
702 |
Â
* that meta key will be returned. Otherwise, all metadata for the
|
@@ -708,7 +727,7 @@ function bp_notifications_delete_meta( $notification_id, $meta_key = '', $meta_v
|
|
708 |
Â
*/
|
709 |
Â
function bp_notifications_get_meta( $notification_id = 0, $meta_key = '', $single = true ) {
|
710 |
Â
add_filter( 'query', 'bp_filter_metaid_column_name' );
|
711 |
-
$retval = get_metadata( '
|
712 |
Â
remove_filter( 'query', 'bp_filter_metaid_column_name' );
|
713 |
Â
|
714 |
Â
/**
|
@@ -743,7 +762,7 @@ function bp_notifications_get_meta( $notification_id = 0, $meta_key = '', $singl
|
|
743 |
Â
*/
|
744 |
Â
function bp_notifications_update_meta( $notification_id, $meta_key, $meta_value, $prev_value = '' ) {
|
745 |
Â
add_filter( 'query', 'bp_filter_metaid_column_name' );
|
746 |
-
$retval = update_metadata( '
|
747 |
Â
remove_filter( 'query', 'bp_filter_metaid_column_name' );
|
748 |
Â
|
749 |
Â
return $retval;
|
@@ -764,7 +783,7 @@ function bp_notifications_update_meta( $notification_id, $meta_key, $meta_value,
|
|
764 |
Â
*/
|
765 |
Â
function bp_notifications_add_meta( $notification_id, $meta_key, $meta_value, $unique = false ) {
|
766 |
Â
add_filter( 'query', 'bp_filter_metaid_column_name' );
|
767 |
-
$retval = add_metadata( '
|
768 |
Â
remove_filter( 'query', 'bp_filter_metaid_column_name' );
|
769 |
Â
|
770 |
Â
return $retval;
|
43 |
Â
'date_notified' => bp_core_current_time(),
|
44 |
Â
'is_new' => 1,
|
45 |
Â
'allow_duplicate' => false,
|
46 |
+
), 'notifications_add_notification' );
|
47 |
Â
|
48 |
Â
// Check for existing duplicate notifications.
|
49 |
Â
if ( ! $r['allow_duplicate'] ) {
|
98 |
Â
* @return bool True on success, false on failure.
|
99 |
Â
*/
|
100 |
Â
function bp_notifications_delete_notification( $id ) {
|
101 |
+
if ( ! bp_notifications_check_notification_access( bp_displayed_user_id(), $id ) ) {
|
102 |
Â
return false;
|
103 |
Â
}
|
104 |
Â
|
117 |
Â
* @return bool True on success, false on failure.
|
118 |
Â
*/
|
119 |
Â
function bp_notifications_mark_notification( $id, $is_new = false ) {
|
120 |
+
if ( ! bp_notifications_check_notification_access( bp_displayed_user_id(), $id ) ) {
|
121 |
Â
return false;
|
122 |
Â
}
|
123 |
Â
|
233 |
Â
$component_action_items[0]->item_id,
|
234 |
Â
$component_action_items[0]->secondary_item_id,
|
235 |
Â
$action_item_count,
|
236 |
+
'array',
|
237 |
+
$component_action_items[0]->id
|
238 |
Â
);
|
239 |
Â
|
240 |
Â
// Create the object to be returned.
|
254 |
Â
|
255 |
Â
// Return an array of content strings.
|
256 |
Â
} else {
|
257 |
+
$content = call_user_func( $bp->{$component_name}->notification_callback, $component_action_name, $component_action_items[0]->item_id, $component_action_items[0]->secondary_item_id, $action_item_count, $component_action_items[0]->id );
|
258 |
Â
$renderable[] = $content;
|
259 |
Â
}
|
260 |
Â
|
271 |
Â
$component_action_items[0]->item_id,
|
272 |
Â
$component_action_items[0]->secondary_item_id,
|
273 |
Â
$action_item_count,
|
274 |
+
$format,
|
275 |
+
$component_action_name, // Duplicated so plugins can check the canonical action name.
|
276 |
+
$component_name,
|
277 |
+
$component_action_items[0]->id
|
278 |
Â
);
|
279 |
Â
|
280 |
Â
// Function should return an object.
|
281 |
Â
if ( 'object' === $format ) {
|
282 |
Â
|
283 |
Â
/**
|
284 |
+
* Filters the notification content for notifications created by plugins.
|
285 |
+
*
|
286 |
+
* If your plugin extends the {@link BP_Component} class, you should use the
|
287 |
+
* 'notification_callback' parameter in your extended
|
288 |
+
* {@link BP_Component::setup_globals()} method instead.
|
289 |
Â
*
|
290 |
Â
* @since 1.9.0
|
291 |
+
* @since 2.6.0 Added $component_action_name, $component_name, $id as parameters.
|
292 |
+
*
|
293 |
+
* @param string $content Component action. Deprecated. Do not do checks against this! Use
|
294 |
+
* the 6th parameter instead - $component_action_name.
|
295 |
+
* @param int $item_id Notification item ID.
|
296 |
+
* @param int $secondary_item_id Notification secondary item ID.
|
297 |
+
* @param int $action_item_count Number of notifications with the same action.
|
298 |
+
* @param string $format Format of return. Either 'string' or 'object'.
|
299 |
+
* @param string $component_action_name Canonical notification action.
|
300 |
+
* @param string $component_name Notification component ID.
|
301 |
+
* @param int $id Notification ID.
|
302 |
Â
*
|
303 |
+
* @return string|array If $format is 'string', return a string of the notification content.
|
304 |
+
* If $format is 'object', return an array formatted like:
|
305 |
+
* array( 'text' => 'CONTENT', 'link' => 'LINK' )
|
306 |
Â
*/
|
307 |
Â
$content = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', $ref_array );
|
308 |
Â
|
704 |
Â
|
705 |
Â
add_filter( 'query', 'bp_filter_metaid_column_name' );
|
706 |
Â
foreach ( $keys as $key ) {
|
707 |
+
$retval = delete_metadata( 'notification', $notification_id, $key, $meta_value, $delete_all );
|
708 |
Â
}
|
709 |
Â
remove_filter( 'query', 'bp_filter_metaid_column_name' );
|
710 |
Â
|
716 |
Â
*
|
717 |
Â
* @since 2.3.0
|
718 |
Â
*
|
Â
|
|
Â
|
|
719 |
Â
* @param int $notification_id ID of the notification item whose metadata is being requested.
|
720 |
Â
* @param string $meta_key Optional. If present, only the metadata matching
|
721 |
Â
* that meta key will be returned. Otherwise, all metadata for the
|
727 |
Â
*/
|
728 |
Â
function bp_notifications_get_meta( $notification_id = 0, $meta_key = '', $single = true ) {
|
729 |
Â
add_filter( 'query', 'bp_filter_metaid_column_name' );
|
730 |
+
$retval = get_metadata( 'notification', $notification_id, $meta_key, $single );
|
731 |
Â
remove_filter( 'query', 'bp_filter_metaid_column_name' );
|
732 |
Â
|
733 |
Â
/**
|
762 |
Â
*/
|
763 |
Â
function bp_notifications_update_meta( $notification_id, $meta_key, $meta_value, $prev_value = '' ) {
|
764 |
Â
add_filter( 'query', 'bp_filter_metaid_column_name' );
|
765 |
+
$retval = update_metadata( 'notification', $notification_id, $meta_key, $meta_value, $prev_value );
|
766 |
Â
remove_filter( 'query', 'bp_filter_metaid_column_name' );
|
767 |
Â
|
768 |
Â
return $retval;
|
783 |
Â
*/
|
784 |
Â
function bp_notifications_add_meta( $notification_id, $meta_key, $meta_value, $unique = false ) {
|
785 |
Â
add_filter( 'query', 'bp_filter_metaid_column_name' );
|
786 |
+
$retval = add_metadata( 'notification', $notification_id, $meta_key, $meta_value, $unique );
|
787 |
Â
remove_filter( 'query', 'bp_filter_metaid_column_name' );
|
788 |
Â
|
789 |
Â
return $retval;
|
@@ -12,7 +12,9 @@
|
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
-
|
Â
|
|
Â
|
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Bootstrap the Notifications component.
|
12 |
Â
// Exit if accessed directly.
|
13 |
Â
defined( 'ABSPATH' ) || exit;
|
14 |
Â
|
15 |
+
if ( ! buddypress()->do_autoload ) {
|
16 |
+
require dirname( __FILE__ ) . '/classes/class-bp-notifications-component.php';
|
17 |
+
}
|
18 |
Â
|
19 |
Â
/**
|
20 |
Â
* Bootstrap the Notifications component.
|
@@ -10,7 +10,9 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Output the notifications component slug.
|
@@ -40,68 +42,98 @@ function bp_notifications_slug() {
|
|
40 |
Â
}
|
41 |
Â
|
42 |
Â
/**
|
43 |
-
* Output the notifications permalink.
|
44 |
Â
*
|
45 |
Â
* @since 1.9.0
|
Â
|
|
Â
|
|
Â
|
|
46 |
Â
*/
|
47 |
-
function bp_notifications_permalink() {
|
48 |
-
echo bp_get_notifications_permalink();
|
49 |
Â
}
|
50 |
Â
/**
|
51 |
Â
* Return the notifications permalink.
|
52 |
Â
*
|
53 |
Â
* @since 1.9.0
|
Â
|
|
54 |
Â
*
|
Â
|
|
55 |
Â
* @return string Notifications permalink.
|
56 |
Â
*/
|
57 |
-
function bp_get_notifications_permalink() {
|
58 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
59 |
Â
|
60 |
Â
/**
|
61 |
Â
* Filters the notifications permalink.
|
62 |
Â
*
|
63 |
Â
* @since 1.9.0
|
Â
|
|
64 |
Â
*
|
65 |
-
* @param string $retval
|
Â
|
|
66 |
Â
*/
|
67 |
-
return apply_filters( 'bp_get_notifications_permalink', $retval );
|
68 |
Â
}
|
69 |
Â
|
70 |
Â
/**
|
71 |
-
* Output the unread notifications permalink.
|
72 |
Â
*
|
73 |
Â
* @since 1.9.0
|
Â
|
|
Â
|
|
Â
|
|
74 |
Â
*/
|
75 |
-
function bp_notifications_unread_permalink() {
|
76 |
-
echo bp_get_notifications_unread_permalink();
|
77 |
Â
}
|
78 |
Â
/**
|
79 |
Â
* Return the unread notifications permalink.
|
80 |
Â
*
|
81 |
-
* @since
|
82 |
Â
*
|
Â
|
|
83 |
Â
* @return string Unread notifications permalink.
|
84 |
Â
*/
|
85 |
-
function bp_get_notifications_unread_permalink() {
|
86 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
87 |
Â
|
88 |
Â
/**
|
89 |
Â
* Filters the unread notifications permalink.
|
90 |
Â
*
|
91 |
Â
* @since 1.9.0
|
Â
|
|
92 |
Â
*
|
93 |
-
* @param string $retval
|
Â
|
|
94 |
Â
*/
|
95 |
-
return apply_filters( 'bp_get_notifications_unread_permalink', $retval );
|
96 |
Â
}
|
97 |
Â
|
98 |
Â
/**
|
99 |
-
* Output the read notifications permalink.
|
100 |
Â
*
|
101 |
Â
* @since 1.9.0
|
Â
|
|
Â
|
|
Â
|
|
102 |
Â
*/
|
103 |
-
function bp_notifications_read_permalink() {
|
104 |
-
echo bp_get_notifications_read_permalink();
|
105 |
Â
}
|
106 |
Â
/**
|
107 |
Â
* Return the read notifications permalink.
|
@@ -110,17 +142,26 @@ function bp_notifications_read_permalink() {
|
|
110 |
Â
*
|
111 |
Â
* @return string Read notifications permalink.
|
112 |
Â
*/
|
113 |
-
function bp_get_notifications_read_permalink() {
|
114 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
115 |
Â
|
116 |
Â
/**
|
117 |
Â
* Filters the read notifications permalink.
|
118 |
Â
*
|
119 |
Â
* @since 1.9.0
|
Â
|
|
120 |
Â
*
|
121 |
-
* @param string $retval
|
Â
|
|
122 |
Â
*/
|
123 |
-
return apply_filters( 'bp_get_notifications_unread_permalink', $retval );
|
124 |
Â
}
|
125 |
Â
|
126 |
Â
/** The Loop ******************************************************************/
|
@@ -167,15 +208,29 @@ function bp_has_notifications( $args = '' ) {
|
|
167 |
Â
$user_id = bp_loggedin_user_id();
|
168 |
Â
}
|
169 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
170 |
Â
// Parse the args.
|
171 |
Â
$r = bp_parse_args( $args, array(
|
172 |
Â
'id' => false,
|
173 |
Â
'user_id' => $user_id,
|
174 |
Â
'secondary_item_id' => false,
|
175 |
Â
'component_name' => bp_notifications_get_registered_components(),
|
176 |
-
'component_action' =>
|
177 |
Â
'is_new' => $is_new,
|
178 |
-
'search_terms' =>
|
179 |
Â
'order_by' => 'date_notified',
|
180 |
Â
'sort_order' => 'DESC',
|
181 |
Â
'meta_query' => false,
|
@@ -199,11 +254,13 @@ function bp_has_notifications( $args = '' ) {
|
|
199 |
Â
* Filters whether or not the user has notifications to display.
|
200 |
Â
*
|
201 |
Â
* @since 1.9.0
|
Â
|
|
202 |
Â
*
|
203 |
Â
* @param bool $value Whether or not there are notifications to display.
|
204 |
Â
* @param BP_Notifications_Template $query_loop BP_Notifications_Template object instance.
|
Â
|
|
205 |
Â
*/
|
206 |
-
return apply_filters( 'bp_has_notifications', $query_loop->has_notifications(), $query_loop );
|
207 |
Â
}
|
208 |
Â
|
209 |
Â
/**
|
@@ -453,7 +510,7 @@ function bp_the_notification_description() {
|
|
453 |
Â
|
454 |
Â
// Callback function exists.
|
455 |
Â
if ( isset( $bp->{ $notification->component_name }->notification_callback ) && is_callable( $bp->{ $notification->component_name }->notification_callback ) ) {
|
456 |
-
$description = call_user_func( $bp->{ $notification->component_name }->notification_callback, $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1 );
|
457 |
Â
|
458 |
Â
// @deprecated format_notification_function - 1.5
|
459 |
Â
} elseif ( isset( $bp->{ $notification->component_name }->format_notification_function ) && function_exists( $bp->{ $notification->component_name }->format_notification_function ) ) {
|
@@ -463,7 +520,7 @@ function bp_the_notification_description() {
|
|
463 |
Â
} else {
|
464 |
Â
|
465 |
Â
/** This filter is documented in bp-notifications/bp-notifications-functions.php */
|
466 |
-
$description = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', array( $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1 ) );
|
467 |
Â
}
|
468 |
Â
|
469 |
Â
/**
|
@@ -482,36 +539,38 @@ function bp_the_notification_description() {
|
|
482 |
Â
* Output the mark read link for the current notification.
|
483 |
Â
*
|
484 |
Â
* @since 1.9.0
|
Â
|
|
485 |
Â
*
|
486 |
-
* @
|
487 |
Â
*/
|
488 |
-
function bp_the_notification_mark_read_link() {
|
489 |
-
echo bp_get_the_notification_mark_read_link();
|
490 |
Â
}
|
491 |
Â
/**
|
492 |
Â
* Return the mark read link for the current notification.
|
493 |
Â
*
|
494 |
Â
* @since 1.9.0
|
Â
|
|
495 |
Â
*
|
Â
|
|
496 |
Â
* @return string
|
497 |
Â
*/
|
498 |
-
function bp_get_the_notification_mark_read_link() {
|
499 |
-
|
500 |
-
|
501 |
-
ob_start(); ?>
|
502 |
Â
|
503 |
-
<a href="
|
504 |
-
|
505 |
-
<?php $retval = ob_get_clean();
|
506 |
Â
|
507 |
Â
/**
|
508 |
Â
* Filters the mark read link for the current notification.
|
509 |
Â
*
|
510 |
Â
* @since 1.9.0
|
Â
|
|
511 |
Â
*
|
512 |
-
* @param string $retval
|
Â
|
|
513 |
Â
*/
|
514 |
-
return apply_filters( 'bp_get_the_notification_mark_read_link', $retval );
|
515 |
Â
}
|
516 |
Â
|
517 |
Â
/**
|
@@ -520,20 +579,23 @@ function bp_the_notification_mark_read_link() {
|
|
520 |
Â
* Since this function directly outputs a URL, it is escaped.
|
521 |
Â
*
|
522 |
Â
* @since 2.1.0
|
Â
|
|
523 |
Â
*
|
524 |
-
* @
|
525 |
Â
*/
|
526 |
-
function bp_the_notification_mark_read_url() {
|
527 |
-
echo esc_url( bp_get_the_notification_mark_read_url() );
|
528 |
Â
}
|
529 |
Â
/**
|
530 |
Â
* Return the URL used for marking a single notification as read.
|
531 |
Â
*
|
532 |
Â
* @since 2.1.0
|
Â
|
|
533 |
Â
*
|
Â
|
|
534 |
Â
* @return string
|
535 |
Â
*/
|
536 |
-
function bp_get_the_notification_mark_read_url() {
|
537 |
Â
|
538 |
Â
// Get the notification ID.
|
539 |
Â
$id = bp_get_the_notification_id();
|
@@ -544,8 +606,11 @@ function bp_the_notification_mark_read_url() {
|
|
544 |
Â
'notification_id' => $id
|
545 |
Â
);
|
546 |
Â
|
Â
|
|
Â
|
|
Â
|
|
547 |
Â
// Add the args to the URL.
|
548 |
-
$url = add_query_arg( $args, bp_get_notifications_unread_permalink() );
|
549 |
Â
|
550 |
Â
// Add the nonce.
|
551 |
Â
$url = wp_nonce_url( $url, 'bp_notification_mark_read_' . $id );
|
@@ -554,46 +619,50 @@ function bp_the_notification_mark_read_url() {
|
|
554 |
Â
* Filters the URL used for marking a single notification as read.
|
555 |
Â
*
|
556 |
Â
* @since 2.1.0
|
Â
|
|
557 |
Â
*
|
558 |
-
* @param string $url
|
Â
|
|
559 |
Â
*/
|
560 |
-
return apply_filters( 'bp_get_the_notification_mark_read_url', $url );
|
561 |
Â
}
|
562 |
Â
|
563 |
Â
/**
|
564 |
Â
* Output the mark unread link for the current notification.
|
565 |
Â
*
|
566 |
Â
* @since 1.9.0
|
Â
|
|
567 |
Â
*
|
568 |
-
* @
|
569 |
Â
*/
|
570 |
-
function bp_the_notification_mark_unread_link() {
|
571 |
Â
echo bp_get_the_notification_mark_unread_link();
|
572 |
Â
}
|
573 |
Â
/**
|
574 |
Â
* Return the mark unread link for the current notification.
|
575 |
Â
*
|
576 |
Â
* @since 1.9.0
|
Â
|
|
577 |
Â
*
|
Â
|
|
578 |
Â
* @return string
|
579 |
Â
*/
|
580 |
-
function bp_get_the_notification_mark_unread_link() {
|
581 |
-
|
582 |
-
|
583 |
-
ob_start(); ?>
|
584 |
-
|
585 |
-
<a href="<?php bp_the_notification_mark_unread_url(); ?>" class="mark-unread primary"><?php _ex( 'Unread', 'Notification screen action', 'buddypress' ); ?></a>
|
586 |
Â
|
587 |
-
|
588 |
Â
|
589 |
Â
/**
|
590 |
Â
* Filters the link used for marking a single notification as unread.
|
591 |
Â
*
|
592 |
Â
* @since 1.9.0
|
Â
|
|
593 |
Â
*
|
594 |
-
* @param string $retval
|
Â
|
|
595 |
Â
*/
|
596 |
-
return apply_filters( 'bp_get_the_notification_mark_unread_link', $retval );
|
597 |
Â
}
|
598 |
Â
|
599 |
Â
/**
|
@@ -602,20 +671,23 @@ function bp_the_notification_mark_unread_link() {
|
|
602 |
Â
* Since this function directly outputs a URL, it is escaped.
|
603 |
Â
*
|
604 |
Â
* @since 2.1.0
|
Â
|
|
605 |
Â
*
|
606 |
-
* @
|
607 |
Â
*/
|
608 |
-
function bp_the_notification_mark_unread_url() {
|
609 |
-
echo esc_url( bp_get_the_notification_mark_unread_url() );
|
610 |
Â
}
|
611 |
Â
/**
|
612 |
Â
* Return the URL used for marking a single notification as unread.
|
613 |
Â
*
|
614 |
Â
* @since 2.1.0
|
Â
|
|
615 |
Â
*
|
Â
|
|
616 |
Â
* @return string
|
617 |
Â
*/
|
618 |
-
function bp_get_the_notification_mark_unread_url() {
|
619 |
Â
|
620 |
Â
// Get the notification ID.
|
621 |
Â
$id = bp_get_the_notification_id();
|
@@ -626,8 +698,11 @@ function bp_the_notification_mark_unread_url() {
|
|
626 |
Â
'notification_id' => $id
|
627 |
Â
);
|
628 |
Â
|
Â
|
|
Â
|
|
Â
|
|
629 |
Â
// Add the args to the URL.
|
630 |
-
$url = add_query_arg( $args, bp_get_notifications_read_permalink() );
|
631 |
Â
|
632 |
Â
// Add the nonce.
|
633 |
Â
$url = wp_nonce_url( $url, 'bp_notification_mark_unread_' . $id );
|
@@ -636,81 +711,92 @@ function bp_the_notification_mark_unread_url() {
|
|
636 |
Â
* Filters the URL used for marking a single notification as unread.
|
637 |
Â
*
|
638 |
Â
* @since 2.1.0
|
Â
|
|
639 |
Â
*
|
640 |
-
* @param string $url
|
Â
|
|
641 |
Â
*/
|
642 |
-
return apply_filters( 'bp_get_the_notification_mark_unread_url', $url );
|
643 |
Â
}
|
644 |
Â
|
645 |
Â
/**
|
646 |
Â
* Output the mark link for the current notification.
|
647 |
Â
*
|
648 |
Â
* @since 1.9.0
|
Â
|
|
649 |
Â
*
|
650 |
-
* @
|
651 |
Â
*/
|
652 |
-
function bp_the_notification_mark_link() {
|
653 |
-
echo bp_get_the_notification_mark_link();
|
654 |
Â
}
|
655 |
Â
/**
|
656 |
Â
* Return the mark link for the current notification.
|
657 |
Â
*
|
658 |
Â
* @since 1.9.0
|
Â
|
|
659 |
Â
*
|
Â
|
|
660 |
Â
* @return string
|
661 |
Â
*/
|
662 |
-
function bp_get_the_notification_mark_link() {
|
Â
|
|
Â
|
|
663 |
Â
|
664 |
Â
if ( bp_is_current_action( 'read' ) ) {
|
665 |
-
$retval = bp_get_the_notification_mark_unread_link();
|
666 |
Â
} else {
|
667 |
-
$retval = bp_get_the_notification_mark_read_link();
|
668 |
Â
}
|
669 |
Â
|
670 |
Â
/**
|
671 |
Â
* Filters the mark link for the current notification.
|
672 |
Â
*
|
673 |
Â
* @since 1.9.0
|
Â
|
|
674 |
Â
*
|
675 |
-
* @param string $retval
|
Â
|
|
676 |
Â
*/
|
677 |
-
return apply_filters( 'bp_get_the_notification_mark_link', $retval );
|
678 |
Â
}
|
679 |
Â
|
680 |
Â
/**
|
681 |
Â
* Output the delete link for the current notification.
|
682 |
Â
*
|
683 |
Â
* @since 1.9.0
|
Â
|
|
684 |
Â
*
|
685 |
-
* @
|
686 |
Â
*/
|
687 |
-
function bp_the_notification_delete_link() {
|
688 |
-
echo bp_get_the_notification_delete_link();
|
689 |
Â
}
|
690 |
Â
/**
|
691 |
Â
* Return the delete link for the current notification.
|
692 |
Â
*
|
693 |
Â
* @since 1.9.0
|
Â
|
|
694 |
Â
*
|
Â
|
|
695 |
Â
* @return string
|
696 |
Â
*/
|
697 |
-
function bp_get_the_notification_delete_link() {
|
698 |
-
|
699 |
-
|
700 |
-
ob_start(); ?>
|
701 |
-
|
702 |
-
<a href="<?php bp_the_notification_delete_url(); ?>" class="delete secondary confirm"><?php _e( 'Delete', 'buddypress' ); ?></a>
|
703 |
Â
|
704 |
-
|
705 |
Â
|
706 |
Â
/**
|
707 |
Â
* Filters the delete link for the current notification.
|
708 |
Â
*
|
709 |
Â
* @since 1.9.0
|
Â
|
|
710 |
Â
*
|
711 |
-
* @param string $retval
|
Â
|
|
712 |
Â
*/
|
713 |
-
return apply_filters( 'bp_get_the_notification_delete_link', $retval );
|
714 |
Â
}
|
715 |
Â
|
716 |
Â
/**
|
@@ -719,27 +805,31 @@ function bp_the_notification_delete_link() {
|
|
719 |
Â
* Since this function directly outputs a URL, it is escaped.
|
720 |
Â
*
|
721 |
Â
* @since 2.1.0
|
Â
|
|
722 |
Â
*
|
723 |
-
* @
|
724 |
-
* @uses bp_get_the_notification_delete_url()
|
725 |
Â
*/
|
726 |
-
function bp_the_notification_delete_url() {
|
727 |
-
echo esc_url( bp_get_the_notification_delete_url() );
|
728 |
Â
}
|
729 |
Â
/**
|
730 |
Â
* Return the URL used for deleting a single notification.
|
731 |
Â
*
|
732 |
Â
* @since 2.1.0
|
Â
|
|
733 |
Â
*
|
Â
|
|
734 |
Â
* @return string
|
735 |
Â
*/
|
736 |
-
function bp_get_the_notification_delete_url() {
|
Â
|
|
Â
|
|
737 |
Â
|
738 |
Â
// URL to add nonce to.
|
739 |
Â
if ( bp_is_current_action( 'unread' ) ) {
|
740 |
-
$link = bp_get_notifications_unread_permalink();
|
741 |
Â
} elseif ( bp_is_current_action( 'read' ) ) {
|
742 |
-
$link = bp_get_notifications_read_permalink();
|
743 |
Â
}
|
744 |
Â
|
745 |
Â
// Get the ID.
|
@@ -761,16 +851,19 @@ function bp_the_notification_delete_url() {
|
|
761 |
Â
* Filters the URL used for deleting a single notification.
|
762 |
Â
*
|
763 |
Â
* @since 2.1.0
|
Â
|
|
764 |
Â
*
|
765 |
-
* @param string $url
|
Â
|
|
766 |
Â
*/
|
767 |
-
return apply_filters( 'bp_get_the_notification_delete_url', $url );
|
768 |
Â
}
|
769 |
Â
|
770 |
Â
/**
|
771 |
Â
* Output the action links for the current notification.
|
772 |
Â
*
|
773 |
Â
* @since 1.9.0
|
Â
|
|
774 |
Â
*
|
775 |
Â
* @param array|string $args Array of arguments.
|
776 |
Â
*/
|
@@ -781,16 +874,20 @@ function bp_the_notification_action_links( $args = '' ) {
|
|
781 |
Â
* Return the action links for the current notification.
|
782 |
Â
*
|
783 |
Â
* @since 1.9.0
|
Â
|
|
784 |
Â
*
|
785 |
Â
* @param array|string $args {
|
786 |
-
* @type string $before
|
787 |
-
* @type string $after
|
788 |
-
* @type string $sep
|
789 |
-
* @type array $links
|
Â
|
|
790 |
Â
* }
|
791 |
Â
* @return string HTML links for actions to take on single notifications.
|
792 |
Â
*/
|
793 |
Â
function bp_get_the_notification_action_links( $args = '' ) {
|
Â
|
|
Â
|
|
794 |
Â
|
795 |
Â
// Parse.
|
796 |
Â
$r = wp_parse_args( $args, array(
|
@@ -798,8 +895,8 @@ function bp_the_notification_action_links( $args = '' ) {
|
|
798 |
Â
'after' => '',
|
799 |
Â
'sep' => ' | ',
|
800 |
Â
'links' => array(
|
801 |
-
bp_get_the_notification_mark_link(),
|
802 |
-
bp_get_the_notification_delete_link()
|
803 |
Â
)
|
804 |
Â
) );
|
805 |
Â
|
@@ -810,10 +907,12 @@ function bp_the_notification_action_links( $args = '' ) {
|
|
810 |
Â
* Filters the action links for the current notification.
|
811 |
Â
*
|
812 |
Â
* @since 1.9.0
|
Â
|
|
813 |
Â
*
|
814 |
Â
* @param string $retval HTML links for actions to take on single notifications.
|
Â
|
|
815 |
Â
*/
|
816 |
-
return apply_filters( 'bp_get_the_notification_action_links', $retval );
|
817 |
Â
}
|
818 |
Â
|
819 |
Â
/**
|
@@ -924,7 +1023,10 @@ function bp_notifications_sort_order_form() {
|
|
924 |
Â
*/
|
925 |
Â
function bp_notifications_bulk_management_dropdown() {
|
926 |
Â
?>
|
927 |
-
<label class="bp-screen-reader-text" for="notification-select"><?php
|
Â
|
|
Â
|
|
Â
|
|
928 |
Â
<select name="notification_bulk_action" id="notification-select">
|
929 |
Â
<option value="" selected="selected"><?php _e( 'Bulk Actions', 'buddypress' ); ?></option>
|
930 |
Â
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-notifications-template.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Output the notifications component slug.
|
42 |
Â
}
|
43 |
Â
|
44 |
Â
/**
|
45 |
+
* Output the notifications permalink for a user.
|
46 |
Â
*
|
47 |
Â
* @since 1.9.0
|
48 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
49 |
+
*
|
50 |
+
* @param int $user_id The user ID.
|
51 |
Â
*/
|
52 |
+
function bp_notifications_permalink( $user_id = 0 ) {
|
53 |
+
echo bp_get_notifications_permalink( $user_id );
|
54 |
Â
}
|
55 |
Â
/**
|
56 |
Â
* Return the notifications permalink.
|
57 |
Â
*
|
58 |
Â
* @since 1.9.0
|
59 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
60 |
Â
*
|
61 |
+
* @param int $user_id The user ID.
|
62 |
Â
* @return string Notifications permalink.
|
63 |
Â
*/
|
64 |
+
function bp_get_notifications_permalink( $user_id = 0 ) {
|
65 |
+
if ( 0 === $user_id ) {
|
66 |
+
$user_id = bp_loggedin_user_id();
|
67 |
+
$domain = bp_loggedin_user_domain();
|
68 |
+
} else {
|
69 |
+
$domain = bp_core_get_user_domain( (int) $user_id );
|
70 |
+
}
|
71 |
+
|
72 |
+
$retval = trailingslashit( $domain . bp_get_notifications_slug() );
|
73 |
Â
|
74 |
Â
/**
|
75 |
Â
* Filters the notifications permalink.
|
76 |
Â
*
|
77 |
Â
* @since 1.9.0
|
78 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
79 |
Â
*
|
80 |
+
* @param string $retval Permalink for the notifications.
|
81 |
+
* @param int $user_id The user ID.
|
82 |
Â
*/
|
83 |
+
return apply_filters( 'bp_get_notifications_permalink', $retval, $user_id );
|
84 |
Â
}
|
85 |
Â
|
86 |
Â
/**
|
87 |
+
* Output the unread notifications permalink for a user.
|
88 |
Â
*
|
89 |
Â
* @since 1.9.0
|
90 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
91 |
+
*
|
92 |
+
* @param int $user_id The user ID.
|
93 |
Â
*/
|
94 |
+
function bp_notifications_unread_permalink( $user_id = 0 ) {
|
95 |
+
echo bp_get_notifications_unread_permalink( $user_id );
|
96 |
Â
}
|
97 |
Â
/**
|
98 |
Â
* Return the unread notifications permalink.
|
99 |
Â
*
|
100 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
101 |
Â
*
|
102 |
+
* @param int $user_id The user ID.
|
103 |
Â
* @return string Unread notifications permalink.
|
104 |
Â
*/
|
105 |
+
function bp_get_notifications_unread_permalink( $user_id = 0 ) {
|
106 |
+
if ( 0 === $user_id ) {
|
107 |
+
$user_id = bp_loggedin_user_id();
|
108 |
+
$domain = bp_loggedin_user_domain();
|
109 |
+
} else {
|
110 |
+
$domain = bp_core_get_user_domain( (int) $user_id );
|
111 |
+
}
|
112 |
+
|
113 |
+
$retval = trailingslashit( $domain . bp_get_notifications_slug() . '/unread' );
|
114 |
Â
|
115 |
Â
/**
|
116 |
Â
* Filters the unread notifications permalink.
|
117 |
Â
*
|
118 |
Â
* @since 1.9.0
|
119 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
120 |
Â
*
|
121 |
+
* @param string $retval Permalink for the unread notifications.
|
122 |
+
* @param int $user_id The user ID.
|
123 |
Â
*/
|
124 |
+
return apply_filters( 'bp_get_notifications_unread_permalink', $retval, $user_id );
|
125 |
Â
}
|
126 |
Â
|
127 |
Â
/**
|
128 |
+
* Output the read notifications permalink for a user.
|
129 |
Â
*
|
130 |
Â
* @since 1.9.0
|
131 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
132 |
+
*
|
133 |
+
* @param int $user_id The user ID.
|
134 |
Â
*/
|
135 |
+
function bp_notifications_read_permalink( $user_id = 0 ) {
|
136 |
+
echo bp_get_notifications_read_permalink( $user_id );
|
137 |
Â
}
|
138 |
Â
/**
|
139 |
Â
* Return the read notifications permalink.
|
142 |
Â
*
|
143 |
Â
* @return string Read notifications permalink.
|
144 |
Â
*/
|
145 |
+
function bp_get_notifications_read_permalink( $user_id = 0 ) {
|
146 |
+
if ( 0 === $user_id ) {
|
147 |
+
$user_id = bp_loggedin_user_id();
|
148 |
+
$domain = bp_loggedin_user_domain();
|
149 |
+
} else {
|
150 |
+
$domain = bp_core_get_user_domain( (int) $user_id );
|
151 |
+
}
|
152 |
+
|
153 |
+
$retval = trailingslashit( $domain . bp_get_notifications_slug() . '/read' );
|
154 |
Â
|
155 |
Â
/**
|
156 |
Â
* Filters the read notifications permalink.
|
157 |
Â
*
|
158 |
Â
* @since 1.9.0
|
159 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
160 |
Â
*
|
161 |
+
* @param string $retval Permalink for the read notifications.
|
162 |
+
* @param int $user_id The user ID.
|
163 |
Â
*/
|
164 |
+
return apply_filters( 'bp_get_notifications_unread_permalink', $retval, $user_id );
|
165 |
Â
}
|
166 |
Â
|
167 |
Â
/** The Loop ******************************************************************/
|
208 |
Â
$user_id = bp_loggedin_user_id();
|
209 |
Â
}
|
210 |
Â
|
211 |
+
// Set the component action (by default false to get all actions)
|
212 |
+
$component_action = false;
|
213 |
+
|
214 |
+
if ( isset( $_REQUEST['type'] ) ) {
|
215 |
+
$component_action = sanitize_key( $_REQUEST['type'] );
|
216 |
+
}
|
217 |
+
|
218 |
+
// Set the search terms (by default an empty string to get all notifications)
|
219 |
+
$search_terms = '';
|
220 |
+
|
221 |
+
if ( isset( $_REQUEST['s'] ) ) {
|
222 |
+
$search_terms = stripslashes( $_REQUEST['s'] );
|
223 |
+
}
|
224 |
+
|
225 |
Â
// Parse the args.
|
226 |
Â
$r = bp_parse_args( $args, array(
|
227 |
Â
'id' => false,
|
228 |
Â
'user_id' => $user_id,
|
229 |
Â
'secondary_item_id' => false,
|
230 |
Â
'component_name' => bp_notifications_get_registered_components(),
|
231 |
+
'component_action' => $component_action,
|
232 |
Â
'is_new' => $is_new,
|
233 |
+
'search_terms' => $search_terms,
|
234 |
Â
'order_by' => 'date_notified',
|
235 |
Â
'sort_order' => 'DESC',
|
236 |
Â
'meta_query' => false,
|
254 |
Â
* Filters whether or not the user has notifications to display.
|
255 |
Â
*
|
256 |
Â
* @since 1.9.0
|
257 |
+
* @since 2.6.0 Added the `$r` parameter.
|
258 |
Â
*
|
259 |
Â
* @param bool $value Whether or not there are notifications to display.
|
260 |
Â
* @param BP_Notifications_Template $query_loop BP_Notifications_Template object instance.
|
261 |
+
* @param array $r Array of arguments passed into the BP_Notifications_Template class.
|
262 |
Â
*/
|
263 |
+
return apply_filters( 'bp_has_notifications', $query_loop->has_notifications(), $query_loop, $r );
|
264 |
Â
}
|
265 |
Â
|
266 |
Â
/**
|
510 |
Â
|
511 |
Â
// Callback function exists.
|
512 |
Â
if ( isset( $bp->{ $notification->component_name }->notification_callback ) && is_callable( $bp->{ $notification->component_name }->notification_callback ) ) {
|
513 |
+
$description = call_user_func( $bp->{ $notification->component_name }->notification_callback, $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1, 'string', $notification->id );
|
514 |
Â
|
515 |
Â
// @deprecated format_notification_function - 1.5
|
516 |
Â
} elseif ( isset( $bp->{ $notification->component_name }->format_notification_function ) && function_exists( $bp->{ $notification->component_name }->format_notification_function ) ) {
|
520 |
Â
} else {
|
521 |
Â
|
522 |
Â
/** This filter is documented in bp-notifications/bp-notifications-functions.php */
|
523 |
+
$description = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', array( $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1, 'string', $notification->component_action, $notification->component_name, $notification->id ) );
|
524 |
Â
}
|
525 |
Â
|
526 |
Â
/**
|
539 |
Â
* Output the mark read link for the current notification.
|
540 |
Â
*
|
541 |
Â
* @since 1.9.0
|
542 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
543 |
Â
*
|
544 |
+
* @param int $user_id The user ID.
|
545 |
Â
*/
|
546 |
+
function bp_the_notification_mark_read_link( $user_id = 0 ) {
|
547 |
+
echo bp_get_the_notification_mark_read_link( $user_id );
|
548 |
Â
}
|
549 |
Â
/**
|
550 |
Â
* Return the mark read link for the current notification.
|
551 |
Â
*
|
552 |
Â
* @since 1.9.0
|
553 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
554 |
Â
*
|
555 |
+
* @param int $user_id The user ID.
|
556 |
Â
* @return string
|
557 |
Â
*/
|
558 |
+
function bp_get_the_notification_mark_read_link( $user_id = 0 ) {
|
559 |
+
// Set default user ID to use.
|
560 |
+
$user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
|
Â
|
|
561 |
Â
|
562 |
+
$retval = sprintf( '<a href="%1$s" class="mark-read primary">%2$s</a>', esc_url( bp_get_the_notification_mark_read_url( $user_id ) ), __( 'Read', 'buddypress' ) );
|
Â
|
|
Â
|
|
563 |
Â
|
564 |
Â
/**
|
565 |
Â
* Filters the mark read link for the current notification.
|
566 |
Â
*
|
567 |
Â
* @since 1.9.0
|
568 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
569 |
Â
*
|
570 |
+
* @param string $retval HTML for the mark read link for the current notification.
|
571 |
+
* @param int $user_id The user ID.
|
572 |
Â
*/
|
573 |
+
return apply_filters( 'bp_get_the_notification_mark_read_link', $retval, $user_id );
|
574 |
Â
}
|
575 |
Â
|
576 |
Â
/**
|
579 |
Â
* Since this function directly outputs a URL, it is escaped.
|
580 |
Â
*
|
581 |
Â
* @since 2.1.0
|
582 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
583 |
Â
*
|
584 |
+
* @param int $user_id The user ID.
|
585 |
Â
*/
|
586 |
+
function bp_the_notification_mark_read_url( $user_id = 0 ) {
|
587 |
+
echo esc_url( bp_get_the_notification_mark_read_url( $user_id ) );
|
588 |
Â
}
|
589 |
Â
/**
|
590 |
Â
* Return the URL used for marking a single notification as read.
|
591 |
Â
*
|
592 |
Â
* @since 2.1.0
|
593 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
594 |
Â
*
|
595 |
+
* @param int $user_id The user ID.
|
596 |
Â
* @return string
|
597 |
Â
*/
|
598 |
+
function bp_get_the_notification_mark_read_url( $user_id = 0 ) {
|
599 |
Â
|
600 |
Â
// Get the notification ID.
|
601 |
Â
$id = bp_get_the_notification_id();
|
606 |
Â
'notification_id' => $id
|
607 |
Â
);
|
608 |
Â
|
609 |
+
// Set default user ID to use.
|
610 |
+
$user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
|
611 |
+
|
612 |
Â
// Add the args to the URL.
|
613 |
+
$url = add_query_arg( $args, bp_get_notifications_unread_permalink( $user_id ) );
|
614 |
Â
|
615 |
Â
// Add the nonce.
|
616 |
Â
$url = wp_nonce_url( $url, 'bp_notification_mark_read_' . $id );
|
619 |
Â
* Filters the URL used for marking a single notification as read.
|
620 |
Â
*
|
621 |
Â
* @since 2.1.0
|
622 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
623 |
Â
*
|
624 |
+
* @param string $url URL to use for marking the single notification as read.
|
625 |
+
* @param int $user_id The user ID.
|
626 |
Â
*/
|
627 |
+
return apply_filters( 'bp_get_the_notification_mark_read_url', $url, $user_id );
|
628 |
Â
}
|
629 |
Â
|
630 |
Â
/**
|
631 |
Â
* Output the mark unread link for the current notification.
|
632 |
Â
*
|
633 |
Â
* @since 1.9.0
|
634 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
635 |
Â
*
|
636 |
+
* @param int $user_id The user ID.
|
637 |
Â
*/
|
638 |
+
function bp_the_notification_mark_unread_link( $user_id = 0 ) {
|
639 |
Â
echo bp_get_the_notification_mark_unread_link();
|
640 |
Â
}
|
641 |
Â
/**
|
642 |
Â
* Return the mark unread link for the current notification.
|
643 |
Â
*
|
644 |
Â
* @since 1.9.0
|
645 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
646 |
Â
*
|
647 |
+
* @param int $user_id The user ID.
|
648 |
Â
* @return string
|
649 |
Â
*/
|
650 |
+
function bp_get_the_notification_mark_unread_link( $user_id = 0 ) {
|
651 |
+
// Set default user ID to use.
|
652 |
+
$user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
|
Â
|
|
Â
|
|
Â
|
|
653 |
Â
|
654 |
+
$retval = sprintf( '<a href="%1$s" class="mark-unread primary">%2$s</a>', esc_url( bp_get_the_notification_mark_unread_url( $user_id ) ), __( 'Unread', 'buddypress' ) );
|
655 |
Â
|
656 |
Â
/**
|
657 |
Â
* Filters the link used for marking a single notification as unread.
|
658 |
Â
*
|
659 |
Â
* @since 1.9.0
|
660 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
661 |
Â
*
|
662 |
+
* @param string $retval HTML for the mark unread link for the current notification.
|
663 |
+
* @param int $user_id The user ID.
|
664 |
Â
*/
|
665 |
+
return apply_filters( 'bp_get_the_notification_mark_unread_link', $retval, $user_id );
|
666 |
Â
}
|
667 |
Â
|
668 |
Â
/**
|
671 |
Â
* Since this function directly outputs a URL, it is escaped.
|
672 |
Â
*
|
673 |
Â
* @since 2.1.0
|
674 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
675 |
Â
*
|
676 |
+
* @param int $user_id The user ID.
|
677 |
Â
*/
|
678 |
+
function bp_the_notification_mark_unread_url( $user_id = 0 ) {
|
679 |
+
echo esc_url( bp_get_the_notification_mark_unread_url( $user_id ) );
|
680 |
Â
}
|
681 |
Â
/**
|
682 |
Â
* Return the URL used for marking a single notification as unread.
|
683 |
Â
*
|
684 |
Â
* @since 2.1.0
|
685 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
686 |
Â
*
|
687 |
+
* @param int $user_id The user ID.
|
688 |
Â
* @return string
|
689 |
Â
*/
|
690 |
+
function bp_get_the_notification_mark_unread_url( $user_id = 0 ) {
|
691 |
Â
|
692 |
Â
// Get the notification ID.
|
693 |
Â
$id = bp_get_the_notification_id();
|
698 |
Â
'notification_id' => $id
|
699 |
Â
);
|
700 |
Â
|
701 |
+
// Set default user ID to use.
|
702 |
+
$user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
|
703 |
+
|
704 |
Â
// Add the args to the URL.
|
705 |
+
$url = add_query_arg( $args, bp_get_notifications_read_permalink( $user_id ) );
|
706 |
Â
|
707 |
Â
// Add the nonce.
|
708 |
Â
$url = wp_nonce_url( $url, 'bp_notification_mark_unread_' . $id );
|
711 |
Â
* Filters the URL used for marking a single notification as unread.
|
712 |
Â
*
|
713 |
Â
* @since 2.1.0
|
714 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
715 |
Â
*
|
716 |
+
* @param string $url URL to use for marking the single notification as unread.
|
717 |
+
* @param int $user_id The user ID.
|
718 |
Â
*/
|
719 |
+
return apply_filters( 'bp_get_the_notification_mark_unread_url', $url, $user_id );
|
720 |
Â
}
|
721 |
Â
|
722 |
Â
/**
|
723 |
Â
* Output the mark link for the current notification.
|
724 |
Â
*
|
725 |
Â
* @since 1.9.0
|
726 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
727 |
Â
*
|
728 |
+
* @param int $user_id The user ID.
|
729 |
Â
*/
|
730 |
+
function bp_the_notification_mark_link( $user_id = 0 ) {
|
731 |
+
echo bp_get_the_notification_mark_link( $user_id );
|
732 |
Â
}
|
733 |
Â
/**
|
734 |
Â
* Return the mark link for the current notification.
|
735 |
Â
*
|
736 |
Â
* @since 1.9.0
|
737 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
738 |
Â
*
|
739 |
+
* @param int $user_id The user ID.
|
740 |
Â
* @return string
|
741 |
Â
*/
|
742 |
+
function bp_get_the_notification_mark_link( $user_id = 0 ) {
|
743 |
+
// Set default user ID to use.
|
744 |
+
$user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
|
745 |
Â
|
746 |
Â
if ( bp_is_current_action( 'read' ) ) {
|
747 |
+
$retval = bp_get_the_notification_mark_unread_link( $user_id );
|
748 |
Â
} else {
|
749 |
+
$retval = bp_get_the_notification_mark_read_link( $user_id );
|
750 |
Â
}
|
751 |
Â
|
752 |
Â
/**
|
753 |
Â
* Filters the mark link for the current notification.
|
754 |
Â
*
|
755 |
Â
* @since 1.9.0
|
756 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
757 |
Â
*
|
758 |
+
* @param string $retval The mark link for the current notification.
|
759 |
+
* @param int $user_id The user ID.
|
760 |
Â
*/
|
761 |
+
return apply_filters( 'bp_get_the_notification_mark_link', $retval, $user_id );
|
762 |
Â
}
|
763 |
Â
|
764 |
Â
/**
|
765 |
Â
* Output the delete link for the current notification.
|
766 |
Â
*
|
767 |
Â
* @since 1.9.0
|
768 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
769 |
Â
*
|
770 |
+
* @param int $user_id The user ID.
|
771 |
Â
*/
|
772 |
+
function bp_the_notification_delete_link( $user_id = 0 ) {
|
773 |
+
echo bp_get_the_notification_delete_link( $user_id );
|
774 |
Â
}
|
775 |
Â
/**
|
776 |
Â
* Return the delete link for the current notification.
|
777 |
Â
*
|
778 |
Â
* @since 1.9.0
|
779 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
780 |
Â
*
|
781 |
+
* @param int $user_id The user ID.
|
782 |
Â
* @return string
|
783 |
Â
*/
|
784 |
+
function bp_get_the_notification_delete_link( $user_id = 0 ) {
|
785 |
+
// Set default user ID to use.
|
786 |
+
$user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
|
Â
|
|
Â
|
|
Â
|
|
787 |
Â
|
788 |
+
$retval = sprintf( '<a href="%1$s" class="delete secondary confirm">%2$s</a>', esc_url( bp_get_the_notification_delete_url( $user_id ) ), __( 'Delete', 'buddypress' ) );
|
789 |
Â
|
790 |
Â
/**
|
791 |
Â
* Filters the delete link for the current notification.
|
792 |
Â
*
|
793 |
Â
* @since 1.9.0
|
794 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
795 |
Â
*
|
796 |
+
* @param string $retval HTML for the delete link for the current notification.
|
797 |
+
* @param int $user_id The user ID.
|
798 |
Â
*/
|
799 |
+
return apply_filters( 'bp_get_the_notification_delete_link', $retval, $user_id );
|
800 |
Â
}
|
801 |
Â
|
802 |
Â
/**
|
805 |
Â
* Since this function directly outputs a URL, it is escaped.
|
806 |
Â
*
|
807 |
Â
* @since 2.1.0
|
808 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
809 |
Â
*
|
810 |
+
* @param int $user_id The user ID.
|
Â
|
|
811 |
Â
*/
|
812 |
+
function bp_the_notification_delete_url( $user_id = 0 ) {
|
813 |
+
echo esc_url( bp_get_the_notification_delete_url( $user_id ) );
|
814 |
Â
}
|
815 |
Â
/**
|
816 |
Â
* Return the URL used for deleting a single notification.
|
817 |
Â
*
|
818 |
Â
* @since 2.1.0
|
819 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
820 |
Â
*
|
821 |
+
* @param int $user_id The user ID.
|
822 |
Â
* @return string
|
823 |
Â
*/
|
824 |
+
function bp_get_the_notification_delete_url( $user_id = 0 ) {
|
825 |
+
// Set default user ID to use.
|
826 |
+
$user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
|
827 |
Â
|
828 |
Â
// URL to add nonce to.
|
829 |
Â
if ( bp_is_current_action( 'unread' ) ) {
|
830 |
+
$link = bp_get_notifications_unread_permalink( $user_id );
|
831 |
Â
} elseif ( bp_is_current_action( 'read' ) ) {
|
832 |
+
$link = bp_get_notifications_read_permalink( $user_id );
|
833 |
Â
}
|
834 |
Â
|
835 |
Â
// Get the ID.
|
851 |
Â
* Filters the URL used for deleting a single notification.
|
852 |
Â
*
|
853 |
Â
* @since 2.1.0
|
854 |
+
* @since 2.6.0 Added $user_id as a parameter.
|
855 |
Â
*
|
856 |
+
* @param string $url URL used for deleting a single notification.
|
857 |
+
* @param int $user_id The user ID.
|
858 |
Â
*/
|
859 |
+
return apply_filters( 'bp_get_the_notification_delete_url', $url, $user_id );
|
860 |
Â
}
|
861 |
Â
|
862 |
Â
/**
|
863 |
Â
* Output the action links for the current notification.
|
864 |
Â
*
|
865 |
Â
* @since 1.9.0
|
866 |
+
* @since 2.6.0 Added $user_id as a parameter to $args.
|
867 |
Â
*
|
868 |
Â
* @param array|string $args Array of arguments.
|
869 |
Â
*/
|
874 |
Â
* Return the action links for the current notification.
|
875 |
Â
*
|
876 |
Â
* @since 1.9.0
|
877 |
+
* @since 2.6.0 Added $user_id as a parameter to $args.
|
878 |
Â
*
|
879 |
Â
* @param array|string $args {
|
880 |
+
* @type string $before HTML before the links.
|
881 |
+
* @type string $after HTML after the links.
|
882 |
+
* @type string $sep HTML between the links.
|
883 |
+
* @type array $links Array of links to implode by 'sep'.
|
884 |
+
* @type int $user_id User ID to fetch action links for. Defaults to displayed user ID.
|
885 |
Â
* }
|
886 |
Â
* @return string HTML links for actions to take on single notifications.
|
887 |
Â
*/
|
888 |
Â
function bp_get_the_notification_action_links( $args = '' ) {
|
889 |
+
// Set default user ID to use.
|
890 |
+
$user_id = isset( $args['user_id'] ) ? $args['user_id'] : bp_displayed_user_id();
|
891 |
Â
|
892 |
Â
// Parse.
|
893 |
Â
$r = wp_parse_args( $args, array(
|
895 |
Â
'after' => '',
|
896 |
Â
'sep' => ' | ',
|
897 |
Â
'links' => array(
|
898 |
+
bp_get_the_notification_mark_link( $user_id ),
|
899 |
+
bp_get_the_notification_delete_link( $user_id )
|
900 |
Â
)
|
901 |
Â
) );
|
902 |
Â
|
907 |
Â
* Filters the action links for the current notification.
|
908 |
Â
*
|
909 |
Â
* @since 1.9.0
|
910 |
+
* @since 2.6.0 Added the `$r` parameter.
|
911 |
Â
*
|
912 |
Â
* @param string $retval HTML links for actions to take on single notifications.
|
913 |
+
* @param array $r Array of parsed arguments.
|
914 |
Â
*/
|
915 |
+
return apply_filters( 'bp_get_the_notification_action_links', $retval, $r );
|
916 |
Â
}
|
917 |
Â
|
918 |
Â
/**
|
1023 |
Â
*/
|
1024 |
Â
function bp_notifications_bulk_management_dropdown() {
|
1025 |
Â
?>
|
1026 |
+
<label class="bp-screen-reader-text" for="notification-select"><?php
|
1027 |
+
/* translators: accessibility text */
|
1028 |
+
_e( 'Select Bulk Action', 'buddypress' );
|
1029 |
+
?></label>
|
1030 |
Â
<select name="notification_bulk_action" id="notification-select">
|
1031 |
Â
<option value="" selected="selected"><?php _e( 'Bulk Actions', 'buddypress' ); ?></option>
|
1032 |
Â
|
@@ -45,7 +45,6 @@ class BP_Notifications_Component extends BP_Component {
|
|
45 |
Â
public function includes( $includes = array() ) {
|
46 |
Â
$includes = array(
|
47 |
Â
'actions',
|
48 |
-
'classes',
|
49 |
Â
'screens',
|
50 |
Â
'adminbar',
|
51 |
Â
'template',
|
@@ -53,6 +52,10 @@ class BP_Notifications_Component extends BP_Component {
|
|
53 |
Â
'cache',
|
54 |
Â
);
|
55 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
56 |
Â
parent::includes( $includes );
|
57 |
Â
}
|
58 |
Â
|
@@ -79,6 +82,11 @@ class BP_Notifications_Component extends BP_Component {
|
|
79 |
Â
'table_name_meta' => $bp->table_prefix . 'bp_notifications_meta',
|
80 |
Â
);
|
81 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
82 |
Â
// All globals for the notifications component.
|
83 |
Â
// Note that global_tables is included in this array.
|
84 |
Â
$args = array(
|
@@ -86,6 +94,7 @@ class BP_Notifications_Component extends BP_Component {
|
|
86 |
Â
'has_directory' => false,
|
87 |
Â
'search_string' => __( 'Search Notifications...', 'buddypress' ),
|
88 |
Â
'global_tables' => $global_tables,
|
Â
|
|
89 |
Â
);
|
90 |
Â
|
91 |
Â
parent::setup_globals( $args );
|
@@ -122,7 +131,15 @@ class BP_Notifications_Component extends BP_Component {
|
|
122 |
Â
if ( bp_is_user() && bp_user_has_access() ) {
|
123 |
Â
$count = bp_notifications_get_unread_notification_count( bp_displayed_user_id() );
|
124 |
Â
$class = ( 0 === $count ) ? 'no-count' : 'count';
|
125 |
-
$nav_name = sprintf(
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
126 |
Â
} else {
|
127 |
Â
$nav_name = _x( 'Notifications', 'Profile screen nav', 'buddypress' );
|
128 |
Â
}
|
@@ -185,8 +202,16 @@ class BP_Notifications_Component extends BP_Component {
|
|
185 |
Â
// Pending notification requests.
|
186 |
Â
$count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );
|
187 |
Â
if ( ! empty( $count ) ) {
|
188 |
-
$title
|
189 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
190 |
Â
} else {
|
191 |
Â
$title = _x( 'Notifications', 'My Account Notification', 'buddypress' );
|
192 |
Â
$unread = _x( 'Unread', 'My Account Notification sub nav', 'buddypress' );
|
45 |
Â
public function includes( $includes = array() ) {
|
46 |
Â
$includes = array(
|
47 |
Â
'actions',
|
Â
|
|
48 |
Â
'screens',
|
49 |
Â
'adminbar',
|
50 |
Â
'template',
|
52 |
Â
'cache',
|
53 |
Â
);
|
54 |
Â
|
55 |
+
if ( ! buddypress()->do_autoload ) {
|
56 |
+
$includes[] = 'classes';
|
57 |
+
}
|
58 |
+
|
59 |
Â
parent::includes( $includes );
|
60 |
Â
}
|
61 |
Â
|
82 |
Â
'table_name_meta' => $bp->table_prefix . 'bp_notifications_meta',
|
83 |
Â
);
|
84 |
Â
|
85 |
+
// Metadata tables for notifications component.
|
86 |
+
$meta_tables = array(
|
87 |
+
'notification' => $bp->table_prefix . 'bp_notifications_meta',
|
88 |
+
);
|
89 |
+
|
90 |
Â
// All globals for the notifications component.
|
91 |
Â
// Note that global_tables is included in this array.
|
92 |
Â
$args = array(
|
94 |
Â
'has_directory' => false,
|
95 |
Â
'search_string' => __( 'Search Notifications...', 'buddypress' ),
|
96 |
Â
'global_tables' => $global_tables,
|
97 |
+
'meta_tables' => $meta_tables
|
98 |
Â
);
|
99 |
Â
|
100 |
Â
parent::setup_globals( $args );
|
131 |
Â
if ( bp_is_user() && bp_user_has_access() ) {
|
132 |
Â
$count = bp_notifications_get_unread_notification_count( bp_displayed_user_id() );
|
133 |
Â
$class = ( 0 === $count ) ? 'no-count' : 'count';
|
134 |
+
$nav_name = sprintf(
|
135 |
+
/* translators: %s: Unread notification count for the current user */
|
136 |
+
_x( 'Notifications %s', 'Profile screen nav', 'buddypress' ),
|
137 |
+
sprintf(
|
138 |
+
'<span class="%s">%s</span>',
|
139 |
+
esc_attr( $class ),
|
140 |
+
bp_core_number_format( $count )
|
141 |
+
)
|
142 |
+
);
|
143 |
Â
} else {
|
144 |
Â
$nav_name = _x( 'Notifications', 'Profile screen nav', 'buddypress' );
|
145 |
Â
}
|
202 |
Â
// Pending notification requests.
|
203 |
Â
$count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );
|
204 |
Â
if ( ! empty( $count ) ) {
|
205 |
+
$title = sprintf(
|
206 |
+
/* translators: %s: Unread notification count for the current user */
|
207 |
+
_x( 'Notifications %s', 'My Account Notification pending', 'buddypress' ),
|
208 |
+
'<span class="count">' . bp_core_number_format( $count ) . '</span>'
|
209 |
+
);
|
210 |
+
$unread = sprintf(
|
211 |
+
/* translators: %s: Unread notification count for the current user */
|
212 |
+
_x( 'Unread %s', 'My Account Notification pending', 'buddypress' ),
|
213 |
+
'<span class="count">' . bp_core_number_format( $count ) . '</span>'
|
214 |
+
);
|
215 |
Â
} else {
|
216 |
Â
$title = _x( 'Notifications', 'My Account Notification', 'buddypress' );
|
217 |
Â
$unread = _x( 'Unread', 'My Account Notification sub nav', 'buddypress' );
|
@@ -629,6 +629,10 @@ class BP_Notifications_Notification {
|
|
629 |
Â
* false (no pagination - all items).
|
630 |
Â
* @type int $per_page Number of items to show per page. Default:
|
631 |
Â
* false (no pagination - all items).
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
632 |
Â
* }
|
633 |
Â
* @return array Located notifications.
|
634 |
Â
*/
|
@@ -681,7 +685,14 @@ class BP_Notifications_Notification {
|
|
681 |
Â
// Concatenate query parts.
|
682 |
Â
$sql = "{$select_sql} {$from_sql} {$join_sql} {$where_sql} {$order_sql} {$pag_sql}";
|
683 |
Â
|
684 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
685 |
Â
}
|
686 |
Â
|
687 |
Â
/**
|
629 |
Â
* false (no pagination - all items).
|
630 |
Â
* @type int $per_page Number of items to show per page. Default:
|
631 |
Â
* false (no pagination - all items).
|
632 |
+
* @type array $meta_query Array of meta_query conditions. See WP_Meta_Query::queries.
|
633 |
+
* @type array $date_query Array of date_query conditions. See first parameter of
|
634 |
+
* WP_Date_Query::__construct().
|
635 |
+
* @type bool $update_meta_cache Whether to update meta cache. Default: true.
|
636 |
Â
* }
|
637 |
Â
* @return array Located notifications.
|
638 |
Â
*/
|
685 |
Â
// Concatenate query parts.
|
686 |
Â
$sql = "{$select_sql} {$from_sql} {$join_sql} {$where_sql} {$order_sql} {$pag_sql}";
|
687 |
Â
|
688 |
+
$results = $wpdb->get_results( $sql );
|
689 |
+
|
690 |
+
// Update meta cache.
|
691 |
+
if ( true === $r['update_meta_cache'] ) {
|
692 |
+
bp_notifications_update_meta_cache( wp_list_pluck( $results, 'id' ) );
|
693 |
+
}
|
694 |
+
|
695 |
+
return $results;
|
696 |
Â
}
|
697 |
Â
|
698 |
Â
/**
|
@@ -10,7 +10,9 @@
|
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
-
|
Â
|
|
Â
|
|
14 |
Â
|
15 |
Â
/**
|
16 |
Â
* Instantiates the settings component.
|
10 |
Â
// Exit if accessed directly.
|
11 |
Â
defined( 'ABSPATH' ) || exit;
|
12 |
Â
|
13 |
+
if ( ! buddypress()->do_autoload ) {
|
14 |
+
require dirname( __FILE__ ) . '/classes/class-bp-settings-component.php';
|
15 |
+
}
|
16 |
Â
|
17 |
Â
/**
|
18 |
Â
* Instantiates the settings component.
|
@@ -15,7 +15,6 @@ defined( 'ABSPATH' ) || exit;
|
|
15 |
Â
*
|
16 |
Â
* @since 1.5.0
|
17 |
Â
*
|
18 |
-
* @uses bp_get_settings_slug()
|
19 |
Â
*/
|
20 |
Â
function bp_settings_slug() {
|
21 |
Â
echo bp_get_settings_slug();
|
@@ -44,7 +43,6 @@ function bp_settings_slug() {
|
|
44 |
Â
*
|
45 |
Â
* @since 1.5.0
|
46 |
Â
*
|
47 |
-
* @uses bp_get_settings_root_slug()
|
48 |
Â
*/
|
49 |
Â
function bp_settings_root_slug() {
|
50 |
Â
echo bp_get_settings_root_slug();
|
@@ -88,12 +86,15 @@ function bp_settings_pending_email_notice() {
|
|
88 |
Â
|
89 |
Â
<div id="message" class="bp-template-notice error">
|
90 |
Â
<p><?php printf(
|
91 |
-
__( 'There is a pending change of your email address to %
|
92 |
-
'<code>' . $pending_email['newemail'] . '</code>'
|
93 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
94 |
Â
esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/?dismiss_email_change=1' )
|
95 |
-
);
|
96 |
-
?></p>
|
97 |
Â
</div>
|
98 |
Â
|
99 |
Â
<?php
|
15 |
Â
*
|
16 |
Â
* @since 1.5.0
|
17 |
Â
*
|
Â
|
|
18 |
Â
*/
|
19 |
Â
function bp_settings_slug() {
|
20 |
Â
echo bp_get_settings_slug();
|
43 |
Â
*
|
44 |
Â
* @since 1.5.0
|
45 |
Â
*
|
Â
|
|
46 |
Â
*/
|
47 |
Â
function bp_settings_root_slug() {
|
48 |
Â
echo bp_get_settings_root_slug();
|
86 |
Â
|
87 |
Â
<div id="message" class="bp-template-notice error">
|
88 |
Â
<p><?php printf(
|
89 |
+
__( 'There is a pending change of your email address to %s.', 'buddypress' ),
|
90 |
+
'<code>' . esc_html( $pending_email['newemail'] ) . '</code>'
|
91 |
+
); ?>
|
92 |
+
<br />
|
93 |
+
<?php printf(
|
94 |
+
__( 'Check your email (%1$s) for the verification link, or <a href="%2$s">cancel the pending change</a>.', 'buddypress' ),
|
95 |
+
'<code>' . esc_html( bp_get_displayed_user_email() ) . '</code>',
|
96 |
Â
esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/?dismiss_email_change=1' )
|
97 |
+
); ?></p>
|
Â
|
|
98 |
Â
</div>
|
99 |
Â
|
100 |
Â
<?php
|
@@ -41,8 +41,6 @@ class BP_Legacy extends BP_Theme_Compat {
|
|
41 |
Â
*
|
42 |
Â
* @since 1.7.0
|
43 |
Â
*
|
44 |
-
* @uses BP_Legacy::setup_globals()
|
45 |
-
* @uses BP_Legacy::setup_actions()
|
46 |
Â
*/
|
47 |
Â
public function __construct() {
|
48 |
Â
parent::start();
|
@@ -70,8 +68,6 @@ class BP_Legacy extends BP_Theme_Compat {
|
|
70 |
Â
*
|
71 |
Â
* @since 1.7.0
|
72 |
Â
*
|
73 |
-
* @uses add_filter() To add various filters
|
74 |
-
* @uses add_action() To add various actions
|
75 |
Â
*/
|
76 |
Â
protected function setup_actions() {
|
77 |
Â
|
@@ -86,7 +82,6 @@ class BP_Legacy extends BP_Theme_Compat {
|
|
86 |
Â
add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); // Enqueue theme CSS
|
87 |
Â
add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); // Enqueue theme JS
|
88 |
Â
add_filter( 'bp_enqueue_scripts', array( $this, 'localize_scripts' ) ); // Enqueue theme script localization
|
89 |
-
add_action( 'bp_head', array( $this, 'head_scripts' ) ); // Output some extra JS in the <head>.
|
90 |
Â
|
91 |
Â
/** Body no-js Class **************************************************/
|
92 |
Â
|
@@ -211,7 +206,6 @@ class BP_Legacy extends BP_Theme_Compat {
|
|
211 |
Â
* @since 1.7.0
|
212 |
Â
* @since 2.3.0 Support custom CSS file named after the current theme or parent theme.
|
213 |
Â
*
|
214 |
-
* @uses wp_enqueue_style() To enqueue the styles
|
215 |
Â
*/
|
216 |
Â
public function enqueue_styles() {
|
217 |
Â
$min = bp_core_get_minified_asset_suffix();
|
@@ -429,23 +423,6 @@ class BP_Legacy extends BP_Theme_Compat {
|
|
429 |
Â
return $retval;
|
430 |
Â
}
|
431 |
Â
|
432 |
-
/**
|
433 |
-
* Put some scripts in the header, like AJAX url for wp-lists.
|
434 |
-
*
|
435 |
-
* @since 1.7.0
|
436 |
-
*/
|
437 |
-
public function head_scripts() {
|
438 |
-
?>
|
439 |
-
|
440 |
-
<script type="text/javascript">
|
441 |
-
/* <![CDATA[ */
|
442 |
-
var ajaxurl = '<?php echo bp_core_ajax_url(); ?>';
|
443 |
-
/* ]]> */
|
444 |
-
</script>
|
445 |
-
|
446 |
-
<?php
|
447 |
-
}
|
448 |
-
|
449 |
Â
/**
|
450 |
Â
* Adds the no-js class to the body tag.
|
451 |
Â
*
|
@@ -531,7 +508,6 @@ class BP_Legacy extends BP_Theme_Compat {
|
|
531 |
Â
* @since 2.2.0
|
532 |
Â
*
|
533 |
Â
* @param array $templates Array of templates.
|
534 |
-
* @uses apply_filters() call 'bp_legacy_theme_compat_page_templates_directory_only' and return false
|
535 |
Â
* to use the defined page template for component's directory and its single items
|
536 |
Â
* @return array
|
537 |
Â
*/
|
@@ -624,7 +600,6 @@ function bp_legacy_theme_group_create_button( $title ) {
|
|
624 |
Â
*
|
625 |
Â
* @since 2.2.0
|
626 |
Â
*
|
627 |
-
* @uses bp_group_create_nav_item() to output the create a Group nav item.
|
628 |
Â
*/
|
629 |
Â
function bp_legacy_theme_group_create_nav() {
|
630 |
Â
bp_group_create_nav_item();
|
@@ -654,7 +629,6 @@ function bp_legacy_theme_blog_create_button( $title ) {
|
|
654 |
Â
*
|
655 |
Â
* @since 2.2.0
|
656 |
Â
*
|
657 |
-
* @uses bp_blog_create_nav_item() to output the Create a Site nav item
|
658 |
Â
*/
|
659 |
Â
function bp_legacy_theme_blog_create_nav() {
|
660 |
Â
bp_blog_create_nav_item();
|
@@ -945,11 +919,11 @@ function bp_legacy_theme_post_update() {
|
|
945 |
Â
}
|
946 |
Â
|
947 |
Â
if ( ! $object && bp_is_active( 'activity' ) ) {
|
948 |
-
$activity_id = bp_activity_post_update( array( 'content' => $_POST['content'] ) );
|
949 |
Â
|
950 |
Â
} elseif ( 'groups' === $object ) {
|
951 |
Â
if ( $item_id && bp_is_active( 'groups' ) )
|
952 |
-
$activity_id = groups_post_update( array( 'content' => $_POST['content'], 'group_id' => $item_id ) );
|
953 |
Â
|
954 |
Â
} else {
|
955 |
Â
|
@@ -957,8 +931,11 @@ function bp_legacy_theme_post_update() {
|
|
957 |
Â
$activity_id = apply_filters( 'bp_activity_custom_update', false, $object, $item_id, $_POST['content'] );
|
958 |
Â
}
|
959 |
Â
|
960 |
-
if (
|
961 |
Â
exit( '-1<div id="message" class="error bp-ajax-message"><p>' . __( 'There was a problem posting your update. Please try again.', 'buddypress' ) . '</p></div>' );
|
Â
|
|
Â
|
|
Â
|
|
962 |
Â
|
963 |
Â
$last_recorded = ! empty( $_POST['since'] ) ? date( 'Y-m-d H:i:s', intval( $_POST['since'] ) ) : 0;
|
964 |
Â
if ( $last_recorded ) {
|
@@ -1023,15 +1000,11 @@ function bp_legacy_theme_new_activity_comment() {
|
|
1023 |
Â
'activity_id' => $_POST['form_id'],
|
1024 |
Â
'content' => $_POST['content'],
|
1025 |
Â
'parent_id' => $_POST['comment_id'],
|
Â
|
|
1026 |
Â
) );
|
1027 |
Â
|
1028 |
-
if (
|
1029 |
-
|
1030 |
-
$feedback = $bp->activity->errors['new_comment']->get_error_message();
|
1031 |
-
unset( $bp->activity->errors['new_comment'] );
|
1032 |
-
}
|
1033 |
-
|
1034 |
-
exit( '-1<div id="message" class="error bp-ajax-message"><p>' . esc_html( $feedback ) . '</p></div>' );
|
1035 |
Â
}
|
1036 |
Â
|
1037 |
Â
// Load the new activity item into the $activities_template global.
|
@@ -1296,7 +1269,7 @@ function bp_legacy_theme_ajax_invite_user() {
|
|
1296 |
Â
|
1297 |
Â
// Users who have previously requested membership do not need
|
1298 |
Â
// another invitation created for them.
|
1299 |
-
if (
|
1300 |
Â
$user_status = 'is_pending';
|
1301 |
Â
|
1302 |
Â
// Create the user invitation.
|
@@ -1773,7 +1746,7 @@ function bp_legacy_theme_cover_image( $params = array() ) {
|
|
1773 |
Â
$top_offset = bp_core_avatar_full_height() - 10;
|
1774 |
Â
$left_offset = bp_core_avatar_full_width() + 20;
|
1775 |
Â
|
1776 |
-
$cover_image =
|
1777 |
Â
|
1778 |
Â
$hide_avatar_style = '';
|
1779 |
Â
|
@@ -1794,7 +1767,7 @@ function bp_legacy_theme_cover_image( $params = array() ) {
|
|
1794 |
Â
}
|
1795 |
Â
|
1796 |
Â
#buddypress div#item-header #item-header-cover-image #item-header-content {
|
1797 |
-
margin-left:auto;
|
1798 |
Â
}
|
1799 |
Â
';
|
1800 |
Â
}
|
@@ -1808,8 +1781,8 @@ function bp_legacy_theme_cover_image( $params = array() ) {
|
|
1808 |
Â
}
|
1809 |
Â
|
1810 |
Â
#buddypress #create-group-form #header-cover-image {
|
1811 |
-
position: relative;
|
1812 |
Â
margin: 1em 0;
|
Â
|
|
1813 |
Â
}
|
1814 |
Â
|
1815 |
Â
.bp-user #buddypress #item-header {
|
@@ -1820,7 +1793,7 @@ function bp_legacy_theme_cover_image( $params = array() ) {
|
|
1820 |
Â
margin-top: '. $avatar_offset .'px;
|
1821 |
Â
float: left;
|
1822 |
Â
overflow: visible;
|
1823 |
-
width:auto;
|
1824 |
Â
}
|
1825 |
Â
|
1826 |
Â
#buddypress div#item-header #item-header-cover-image #item-header-content {
|
@@ -1828,40 +1801,40 @@ function bp_legacy_theme_cover_image( $params = array() ) {
|
|
1828 |
Â
float: left;
|
1829 |
Â
margin-left: ' . $left_offset . 'px;
|
1830 |
Â
margin-top: -' . $top_offset . 'px;
|
1831 |
-
width:auto;
|
1832 |
Â
}
|
1833 |
Â
|
1834 |
Â
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content,
|
1835 |
Â
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions {
|
Â
|
|
1836 |
Â
margin-top: ' . $params["height"] . 'px;
|
1837 |
Â
margin-left: 0;
|
1838 |
-
clear: none;
|
1839 |
Â
max-width: 50%;
|
1840 |
Â
}
|
1841 |
Â
|
1842 |
Â
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions {
|
1843 |
-
padding-top: 20px;
|
1844 |
Â
max-width: 20%;
|
Â
|
|
1845 |
Â
}
|
1846 |
Â
|
1847 |
Â
' . $hide_avatar_style . '
|
1848 |
Â
|
1849 |
-
#buddypress div#item-header-cover-image
|
1850 |
-
#buddypress div#item-header-cover-image
|
1851 |
-
|
Â
|
|
Â
|
|
1852 |
Â
text-rendering: optimizelegibility;
|
1853 |
-
text-shadow:
|
1854 |
-
margin: 0 0 .6em;
|
1855 |
-
font-size:200%;
|
1856 |
Â
}
|
1857 |
Â
|
1858 |
Â
#buddypress #item-header-cover-image #item-header-avatar img.avatar {
|
1859 |
-
border: solid 2px #FFF;
|
1860 |
Â
background: rgba( 255, 255, 255, 0.8 );
|
Â
|
|
1861 |
Â
}
|
1862 |
Â
|
1863 |
Â
#buddypress #item-header-cover-image #item-header-avatar a {
|
1864 |
-
border:
|
1865 |
Â
text-decoration: none;
|
1866 |
Â
}
|
1867 |
Â
|
@@ -1880,22 +1853,22 @@ function bp_legacy_theme_cover_image( $params = array() ) {
|
|
1880 |
Â
#buddypress #item-header-cover-image #item-header-avatar,
|
1881 |
Â
.bp-user #buddypress #item-header #item-header-cover-image #item-header-avatar,
|
1882 |
Â
#buddypress div#item-header #item-header-cover-image #item-header-content {
|
1883 |
-
width:100%;
|
1884 |
-
text-align:center;
|
1885 |
Â
}
|
1886 |
Â
|
1887 |
Â
#buddypress #item-header-cover-image #item-header-avatar a {
|
1888 |
-
display:inline-block;
|
1889 |
Â
}
|
1890 |
Â
|
1891 |
Â
#buddypress #item-header-cover-image #item-header-avatar img {
|
1892 |
-
margin:0;
|
1893 |
Â
}
|
1894 |
Â
|
1895 |
Â
#buddypress div#item-header #item-header-cover-image #item-header-content,
|
1896 |
Â
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content,
|
1897 |
Â
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions {
|
1898 |
-
margin:0;
|
1899 |
Â
}
|
1900 |
Â
|
1901 |
Â
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content,
|
@@ -1907,17 +1880,17 @@ function bp_legacy_theme_cover_image( $params = array() ) {
|
|
1907 |
Â
#buddypress div#item-header-cover-image h2 {
|
1908 |
Â
color: inherit;
|
1909 |
Â
text-shadow: none;
|
1910 |
-
margin:25px 0 0;
|
1911 |
-
font-size:200%;
|
1912 |
Â
}
|
1913 |
Â
|
1914 |
Â
#buddypress #item-header-cover-image #item-buttons div {
|
1915 |
-
float:none;
|
1916 |
-
display:inline-block;
|
1917 |
Â
}
|
1918 |
Â
|
1919 |
Â
#buddypress #item-header-cover-image #item-buttons:before {
|
1920 |
-
content:"";
|
1921 |
Â
}
|
1922 |
Â
|
1923 |
Â
#buddypress #item-header-cover-image #item-buttons {
|
41 |
Â
*
|
42 |
Â
* @since 1.7.0
|
43 |
Â
*
|
Â
|
|
Â
|
|
44 |
Â
*/
|
45 |
Â
public function __construct() {
|
46 |
Â
parent::start();
|
68 |
Â
*
|
69 |
Â
* @since 1.7.0
|
70 |
Â
*
|
Â
|
|
Â
|
|
71 |
Â
*/
|
72 |
Â
protected function setup_actions() {
|
73 |
Â
|
82 |
Â
add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); // Enqueue theme CSS
|
83 |
Â
add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); // Enqueue theme JS
|
84 |
Â
add_filter( 'bp_enqueue_scripts', array( $this, 'localize_scripts' ) ); // Enqueue theme script localization
|
Â
|
|
85 |
Â
|
86 |
Â
/** Body no-js Class **************************************************/
|
87 |
Â
|
206 |
Â
* @since 1.7.0
|
207 |
Â
* @since 2.3.0 Support custom CSS file named after the current theme or parent theme.
|
208 |
Â
*
|
Â
|
|
209 |
Â
*/
|
210 |
Â
public function enqueue_styles() {
|
211 |
Â
$min = bp_core_get_minified_asset_suffix();
|
423 |
Â
return $retval;
|
424 |
Â
}
|
425 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
426 |
Â
/**
|
427 |
Â
* Adds the no-js class to the body tag.
|
428 |
Â
*
|
508 |
Â
* @since 2.2.0
|
509 |
Â
*
|
510 |
Â
* @param array $templates Array of templates.
|
Â
|
|
511 |
Â
* to use the defined page template for component's directory and its single items
|
512 |
Â
* @return array
|
513 |
Â
*/
|
600 |
Â
*
|
601 |
Â
* @since 2.2.0
|
602 |
Â
*
|
Â
|
|
603 |
Â
*/
|
604 |
Â
function bp_legacy_theme_group_create_nav() {
|
605 |
Â
bp_group_create_nav_item();
|
629 |
Â
*
|
630 |
Â
* @since 2.2.0
|
631 |
Â
*
|
Â
|
|
632 |
Â
*/
|
633 |
Â
function bp_legacy_theme_blog_create_nav() {
|
634 |
Â
bp_blog_create_nav_item();
|
919 |
Â
}
|
920 |
Â
|
921 |
Â
if ( ! $object && bp_is_active( 'activity' ) ) {
|
922 |
+
$activity_id = bp_activity_post_update( array( 'content' => $_POST['content'], 'error_type' => 'wp_error' ) );
|
923 |
Â
|
924 |
Â
} elseif ( 'groups' === $object ) {
|
925 |
Â
if ( $item_id && bp_is_active( 'groups' ) )
|
926 |
+
$activity_id = groups_post_update( array( 'content' => $_POST['content'], 'group_id' => $item_id, 'error_type' => 'wp_error' ) );
|
927 |
Â
|
928 |
Â
} else {
|
929 |
Â
|
931 |
Â
$activity_id = apply_filters( 'bp_activity_custom_update', false, $object, $item_id, $_POST['content'] );
|
932 |
Â
}
|
933 |
Â
|
934 |
+
if ( false === $activity_id ) {
|
935 |
Â
exit( '-1<div id="message" class="error bp-ajax-message"><p>' . __( 'There was a problem posting your update. Please try again.', 'buddypress' ) . '</p></div>' );
|
936 |
+
} elseif ( is_wp_error( $activity_id ) && $activity_id->get_error_code() ) {
|
937 |
+
exit( '-1<div id="message" class="error bp-ajax-message"><p>' . $activity_id->get_error_message() . '</p></div>' );
|
938 |
+
}
|
939 |
Â
|
940 |
Â
$last_recorded = ! empty( $_POST['since'] ) ? date( 'Y-m-d H:i:s', intval( $_POST['since'] ) ) : 0;
|
941 |
Â
if ( $last_recorded ) {
|
1000 |
Â
'activity_id' => $_POST['form_id'],
|
1001 |
Â
'content' => $_POST['content'],
|
1002 |
Â
'parent_id' => $_POST['comment_id'],
|
1003 |
+
'error_type' => 'wp_error'
|
1004 |
Â
) );
|
1005 |
Â
|
1006 |
+
if ( is_wp_error( $comment_id ) ) {
|
1007 |
+
exit( '-1<div id="message" class="error bp-ajax-message"><p>' . esc_html( $comment_id->get_error_message() ) . '</p></div>' );
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1008 |
Â
}
|
1009 |
Â
|
1010 |
Â
// Load the new activity item into the $activities_template global.
|
1269 |
Â
|
1270 |
Â
// Users who have previously requested membership do not need
|
1271 |
Â
// another invitation created for them.
|
1272 |
+
if ( groups_check_for_membership_request( $friend_id, $group_id ) ) {
|
1273 |
Â
$user_status = 'is_pending';
|
1274 |
Â
|
1275 |
Â
// Create the user invitation.
|
1746 |
Â
$top_offset = bp_core_avatar_full_height() - 10;
|
1747 |
Â
$left_offset = bp_core_avatar_full_width() + 20;
|
1748 |
Â
|
1749 |
+
$cover_image = ( !empty( $params['cover_image'] ) ) ? 'background-image: url(' . $params['cover_image'] . ');' : '';
|
1750 |
Â
|
1751 |
Â
$hide_avatar_style = '';
|
1752 |
Â
|
1767 |
Â
}
|
1768 |
Â
|
1769 |
Â
#buddypress div#item-header #item-header-cover-image #item-header-content {
|
1770 |
+
margin-left: auto;
|
1771 |
Â
}
|
1772 |
Â
';
|
1773 |
Â
}
|
1781 |
Â
}
|
1782 |
Â
|
1783 |
Â
#buddypress #create-group-form #header-cover-image {
|
Â
|
|
1784 |
Â
margin: 1em 0;
|
1785 |
+
position: relative;
|
1786 |
Â
}
|
1787 |
Â
|
1788 |
Â
.bp-user #buddypress #item-header {
|
1793 |
Â
margin-top: '. $avatar_offset .'px;
|
1794 |
Â
float: left;
|
1795 |
Â
overflow: visible;
|
1796 |
+
width: auto;
|
1797 |
Â
}
|
1798 |
Â
|
1799 |
Â
#buddypress div#item-header #item-header-cover-image #item-header-content {
|
1801 |
Â
float: left;
|
1802 |
Â
margin-left: ' . $left_offset . 'px;
|
1803 |
Â
margin-top: -' . $top_offset . 'px;
|
1804 |
+
width: auto;
|
1805 |
Â
}
|
1806 |
Â
|
1807 |
Â
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content,
|
1808 |
Â
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions {
|
1809 |
+
clear: none;
|
1810 |
Â
margin-top: ' . $params["height"] . 'px;
|
1811 |
Â
margin-left: 0;
|
Â
|
|
1812 |
Â
max-width: 50%;
|
1813 |
Â
}
|
1814 |
Â
|
1815 |
Â
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions {
|
Â
|
|
1816 |
Â
max-width: 20%;
|
1817 |
+
padding-top: 20px;
|
1818 |
Â
}
|
1819 |
Â
|
1820 |
Â
' . $hide_avatar_style . '
|
1821 |
Â
|
1822 |
+
#buddypress div#item-header-cover-image .user-nicename a,
|
1823 |
+
#buddypress div#item-header-cover-image .user-nicename {
|
1824 |
+
font-size: 200%;
|
1825 |
+
color: #fff;
|
1826 |
+
margin: 0 0 0.6em;
|
1827 |
Â
text-rendering: optimizelegibility;
|
1828 |
+
text-shadow: 0 0 3px rgba( 0, 0, 0, 0.8 );
|
Â
|
|
Â
|
|
1829 |
Â
}
|
1830 |
Â
|
1831 |
Â
#buddypress #item-header-cover-image #item-header-avatar img.avatar {
|
Â
|
|
1832 |
Â
background: rgba( 255, 255, 255, 0.8 );
|
1833 |
+
border: solid 2px #fff;
|
1834 |
Â
}
|
1835 |
Â
|
1836 |
Â
#buddypress #item-header-cover-image #item-header-avatar a {
|
1837 |
+
border: 0;
|
1838 |
Â
text-decoration: none;
|
1839 |
Â
}
|
1840 |
Â
|
1853 |
Â
#buddypress #item-header-cover-image #item-header-avatar,
|
1854 |
Â
.bp-user #buddypress #item-header #item-header-cover-image #item-header-avatar,
|
1855 |
Â
#buddypress div#item-header #item-header-cover-image #item-header-content {
|
1856 |
+
width: 100%;
|
1857 |
+
text-align: center;
|
1858 |
Â
}
|
1859 |
Â
|
1860 |
Â
#buddypress #item-header-cover-image #item-header-avatar a {
|
1861 |
+
display: inline-block;
|
1862 |
Â
}
|
1863 |
Â
|
1864 |
Â
#buddypress #item-header-cover-image #item-header-avatar img {
|
1865 |
+
margin: 0;
|
1866 |
Â
}
|
1867 |
Â
|
1868 |
Â
#buddypress div#item-header #item-header-cover-image #item-header-content,
|
1869 |
Â
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content,
|
1870 |
Â
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions {
|
1871 |
+
margin: 0;
|
1872 |
Â
}
|
1873 |
Â
|
1874 |
Â
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content,
|
1880 |
Â
#buddypress div#item-header-cover-image h2 {
|
1881 |
Â
color: inherit;
|
1882 |
Â
text-shadow: none;
|
1883 |
+
margin: 25px 0 0;
|
1884 |
+
font-size: 200%;
|
1885 |
Â
}
|
1886 |
Â
|
1887 |
Â
#buddypress #item-header-cover-image #item-buttons div {
|
1888 |
+
float: none;
|
1889 |
+
display: inline-block;
|
1890 |
Â
}
|
1891 |
Â
|
1892 |
Â
#buddypress #item-header-cover-image #item-buttons:before {
|
1893 |
+
content: "";
|
1894 |
Â
}
|
1895 |
Â
|
1896 |
Â
#buddypress #item-header-cover-image #item-buttons {
|
@@ -120,7 +120,10 @@ do_action( 'bp_before_activity_entry' ); ?>
|
|
120 |
Â
<div class="ac-reply-avatar"><?php bp_loggedin_user_avatar( 'width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT ); ?></div>
|
121 |
Â
<div class="ac-reply-content">
|
122 |
Â
<div class="ac-textarea">
|
123 |
-
<label for="ac-input-<?php bp_activity_id(); ?>" class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
124 |
Â
<textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input bp-suggestions" name="ac_input_<?php bp_activity_id(); ?>"></textarea>
|
125 |
Â
</div>
|
126 |
Â
<input type="submit" name="ac_form_submit" value="<?php esc_attr_e( 'Post', 'buddypress' ); ?>" /> <a href="#" class="ac-reply-cancel"><?php _e( 'Cancel', 'buddypress' ); ?></a>
|
120 |
Â
<div class="ac-reply-avatar"><?php bp_loggedin_user_avatar( 'width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT ); ?></div>
|
121 |
Â
<div class="ac-reply-content">
|
122 |
Â
<div class="ac-textarea">
|
123 |
+
<label for="ac-input-<?php bp_activity_id(); ?>" class="bp-screen-reader-text"><?php
|
124 |
+
/* translators: accessibility text */
|
125 |
+
_e( 'Comment', 'buddypress' );
|
126 |
+
?></label>
|
127 |
Â
<textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input bp-suggestions" name="ac_input_<?php bp_activity_id(); ?>"></textarea>
|
128 |
Â
</div>
|
129 |
Â
<input type="submit" name="ac_form_submit" value="<?php esc_attr_e( 'Post', 'buddypress' ); ?>" /> <a href="#" class="ac-reply-cancel"><?php _e( 'Cancel', 'buddypress' ); ?></a>
|
@@ -33,7 +33,10 @@
|
|
33 |
Â
|
34 |
Â
<div id="whats-new-content">
|
35 |
Â
<div id="whats-new-textarea">
|
36 |
-
<label for="whats-new" class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
37 |
Â
<textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="10"
|
38 |
Â
<?php if ( bp_is_group() ) : ?>data-suggestions-group-id="<?php echo esc_attr( (int) bp_get_current_group_id() ); ?>" <?php endif; ?>
|
39 |
Â
><?php if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_textarea( $_GET['r'] ); ?> <?php endif; ?></textarea>
|
@@ -50,7 +53,10 @@
|
|
50 |
Â
|
51 |
Â
<?php _e( 'Post in', 'buddypress' ); ?>:
|
52 |
Â
|
53 |
-
<label for="whats-new-post-in" class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
54 |
Â
<select id="whats-new-post-in" name="whats-new-post-in">
|
55 |
Â
<option selected="selected" value="0"><?php _e( 'My Profile', 'buddypress' ); ?></option>
|
56 |
Â
|
33 |
Â
|
34 |
Â
<div id="whats-new-content">
|
35 |
Â
<div id="whats-new-textarea">
|
36 |
+
<label for="whats-new" class="bp-screen-reader-text"><?php
|
37 |
+
/* translators: accessibility text */
|
38 |
+
_e( 'Post what\'s new', 'buddypress' );
|
39 |
+
?></label>
|
40 |
Â
<textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="10"
|
41 |
Â
<?php if ( bp_is_group() ) : ?>data-suggestions-group-id="<?php echo esc_attr( (int) bp_get_current_group_id() ); ?>" <?php endif; ?>
|
42 |
Â
><?php if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_textarea( $_GET['r'] ); ?> <?php endif; ?></textarea>
|
53 |
Â
|
54 |
Â
<?php _e( 'Post in', 'buddypress' ); ?>:
|
55 |
Â
|
56 |
+
<label for="whats-new-post-in" class="bp-screen-reader-text"><?php
|
57 |
+
/* translators: accessibility text */
|
58 |
+
_e( 'Post in', 'buddypress' );
|
59 |
+
?></label>
|
60 |
Â
<select id="whats-new-post-in" name="whats-new-post-in">
|
61 |
Â
<option selected="selected" value="0"><?php _e( 'My Profile', 'buddypress' ); ?></option>
|
62 |
Â
|
@@ -22,7 +22,10 @@
|
|
22 |
Â
<div class="drag-drop-inside">
|
23 |
Â
<p class="drag-drop-info"><?php esc_html_e( 'Drop your file here', 'buddypress' ); ?></p>
|
24 |
Â
<p><?php _ex( 'or', 'Uploader: Drop your file here - or - Select your File', 'buddypress' ); ?></p>
|
25 |
-
<p class="drag-drop-buttons"><label for="{{data.browse_button}}" class="<?php echo is_admin() ? 'screen-reader-text' : 'bp-screen-reader-text' ;?>"><?php
|
Â
|
|
Â
|
|
Â
|
|
26 |
Â
</div>
|
27 |
Â
</div>
|
28 |
Â
</div>
|
22 |
Â
<div class="drag-drop-inside">
|
23 |
Â
<p class="drag-drop-info"><?php esc_html_e( 'Drop your file here', 'buddypress' ); ?></p>
|
24 |
Â
<p><?php _ex( 'or', 'Uploader: Drop your file here - or - Select your File', 'buddypress' ); ?></p>
|
25 |
+
<p class="drag-drop-buttons"><label for="{{data.browse_button}}" class="<?php echo is_admin() ? 'screen-reader-text' : 'bp-screen-reader-text' ;?>"><?php
|
26 |
+
/* translators: accessibility text */
|
27 |
+
esc_html_e( 'Select your File', 'buddypress' );
|
28 |
+
?></label><input id="{{data.browse_button}}" type="button" value="<?php esc_attr_e( 'Select your File', 'buddypress' ); ?>" class="button" /></p>
|
29 |
Â
</div>
|
30 |
Â
</div>
|
31 |
Â
</div>
|
@@ -0,0 +1,11 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
|
2 |
+
<?php if ( bp_activity_embed_has_activity( bp_current_action() ) ) : ?>
|
3 |
+
|
4 |
+
<?php while ( bp_activities() ) : bp_the_activity(); ?>
|
5 |
+
<div class="bp-embed-excerpt"><?php bp_activity_embed_excerpt(); ?></div>
|
6 |
+
|
7 |
+
<?php bp_activity_embed_media(); ?>
|
8 |
+
|
9 |
+
<?php endwhile; ?>
|
10 |
+
|
11 |
+
<?php endif; ?>
|
@@ -0,0 +1,9 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<div class="wp-embed-footer">
|
2 |
+
<?php the_embed_site_title() ?>
|
3 |
+
|
4 |
+
<div class="wp-embed-meta">
|
5 |
+
<?php
|
6 |
+
/** This action is documented in wp-includes/theme-compat/embed-content.php */
|
7 |
+
do_action( 'embed_content_meta'); ?>
|
8 |
+
</div>
|
9 |
+
</div>
|
@@ -0,0 +1,26 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
|
2 |
+
<div id="bp-embed-header">
|
3 |
+
<div class="bp-embed-avatar">
|
4 |
+
<a href="<?php bp_displayed_user_link(); ?>">
|
5 |
+
<?php bp_displayed_user_avatar( 'type=thumb&width=45&height=45' ); ?>
|
6 |
+
</a>
|
7 |
+
</div>
|
8 |
+
|
9 |
+
<?php if ( bp_activity_embed_has_activity( bp_current_action() ) ) : ?>
|
10 |
+
|
11 |
+
<?php while ( bp_activities() ) : bp_the_activity(); ?>
|
12 |
+
<p class="bp-embed-activity-action">
|
13 |
+
<?php bp_activity_action( array( 'no_timestamp' => true ) ); ?>
|
14 |
+
</p>
|
15 |
+
<?php endwhile; ?>
|
16 |
+
|
17 |
+
<?php endif; ?>
|
18 |
+
|
19 |
+
<p class="bp-embed-header-meta">
|
20 |
+
<?php if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) : ?>
|
21 |
+
<span class="bp-embed-mentionname">@<?php bp_displayed_user_mentionname(); ?> · </span>
|
22 |
+
<?php endif; ?>
|
23 |
+
|
24 |
+
<span class="bp-embed-timestamp"><a href="<?php bp_activity_thread_permalink(); ?>"><?php echo date_i18n( get_option( 'time_format' ) . ' - ' . get_option( 'date_format' ), strtotime( bp_get_activity_date_recorded() ) ); ?></a></span>
|
25 |
+
</p>
|
26 |
+
</div>
|
@@ -0,0 +1,18 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
|
2 |
+
<div id="bp-embed-header">
|
3 |
+
<div class="bp-embed-avatar">
|
4 |
+
<a href="<?php bp_displayed_user_link(); ?>">
|
5 |
+
<?php bp_displayed_user_avatar( 'type=thumb&width=36&height=36' ); ?>
|
6 |
+
</a>
|
7 |
+
</div>
|
8 |
+
|
9 |
+
<p class="wp-embed-heading">
|
10 |
+
<a href="<?php bp_displayed_user_link(); ?>">
|
11 |
+
<?php bp_displayed_user_fullname(); ?>
|
12 |
+
</a>
|
13 |
+
</p>
|
14 |
+
|
15 |
+
<?php if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) : ?>
|
16 |
+
<p class="bp-embed-mentionname">@<?php bp_displayed_user_mentionname(); ?></p>
|
17 |
+
<?php endif; ?>
|
18 |
+
</div>
|
@@ -200,7 +200,10 @@ do_action( 'bp_before_create_group_page' ); ?>
|
|
200 |
Â
<p><?php _e( "Upload an image to use as a profile photo for this group. The image will be shown on the main group page, and in search results.", 'buddypress' ); ?></p>
|
201 |
Â
|
202 |
Â
<p>
|
203 |
-
<label for="file" class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
204 |
Â
<input type="file" name="file" id="file" />
|
205 |
Â
<input type="submit" name="upload" id="upload" value="<?php esc_attr_e( 'Upload Image', 'buddypress' ); ?>" />
|
206 |
Â
<input type="hidden" name="action" id="action" value="bp_avatar_upload" />
|
200 |
Â
<p><?php _e( "Upload an image to use as a profile photo for this group. The image will be shown on the main group page, and in search results.", 'buddypress' ); ?></p>
|
201 |
Â
|
202 |
Â
<p>
|
203 |
+
<label for="file" class="bp-screen-reader-text"><?php
|
204 |
+
/* translators: accessibility text */
|
205 |
+
_e( 'Select an image', 'buddypress' );
|
206 |
+
?></label>
|
207 |
Â
<input type="file" name="file" id="file" />
|
208 |
Â
<input type="submit" name="upload" id="upload" value="<?php esc_attr_e( 'Upload Image', 'buddypress' ); ?>" />
|
209 |
Â
<input type="hidden" name="action" id="action" value="bp_avatar_upload" />
|
@@ -167,7 +167,10 @@ do_action( 'bp_before_group_admin_content' ); ?>
|
|
167 |
Â
<p><?php _e("Upload an image to use as a profile photo for this group. The image will be shown on the main group page, and in search results.", 'buddypress' ); ?></p>
|
168 |
Â
|
169 |
Â
<p>
|
170 |
-
<label for="file" class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
171 |
Â
<input type="file" name="file" id="file" />
|
172 |
Â
<input type="submit" name="upload" id="upload" value="<?php esc_attr_e( 'Upload Image', 'buddypress' ); ?>" />
|
173 |
Â
<input type="hidden" name="action" id="action" value="bp_avatar_upload" />
|
@@ -376,6 +379,22 @@ do_action( 'bp_before_group_admin_content' ); ?>
|
|
376 |
Â
<?php endwhile; ?>
|
377 |
Â
</ul>
|
378 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
379 |
Â
<?php else: ?>
|
380 |
Â
|
381 |
Â
<div id="message" class="info">
|
167 |
Â
<p><?php _e("Upload an image to use as a profile photo for this group. The image will be shown on the main group page, and in search results.", 'buddypress' ); ?></p>
|
168 |
Â
|
169 |
Â
<p>
|
170 |
+
<label for="file" class="bp-screen-reader-text"><?php
|
171 |
+
/* translators: accessibility text */
|
172 |
+
_e( 'Select an image', 'buddypress' );
|
173 |
+
?></label>
|
174 |
Â
<input type="file" name="file" id="file" />
|
175 |
Â
<input type="submit" name="upload" id="upload" value="<?php esc_attr_e( 'Upload Image', 'buddypress' ); ?>" />
|
176 |
Â
<input type="hidden" name="action" id="action" value="bp_avatar_upload" />
|
379 |
Â
<?php endwhile; ?>
|
380 |
Â
</ul>
|
381 |
Â
|
382 |
+
<?php if ( bp_group_member_needs_pagination() ) : ?>
|
383 |
+
|
384 |
+
<div class="pagination no-ajax">
|
385 |
+
|
386 |
+
<div id="member-count" class="pag-count">
|
387 |
+
<?php bp_group_member_pagination_count(); ?>
|
388 |
+
</div>
|
389 |
+
|
390 |
+
<div id="member-admin-pagination" class="pagination-links">
|
391 |
+
<?php bp_group_member_admin_pagination(); ?>
|
392 |
+
</div>
|
393 |
+
|
394 |
+
</div>
|
395 |
+
|
396 |
+
<?php endif; ?>
|
397 |
+
|
398 |
Â
<?php else: ?>
|
399 |
Â
|
400 |
Â
<div id="message" class="info">
|
@@ -108,7 +108,10 @@ do_action( 'bp_before_group_forum_edit_form' ); ?>
|
|
108 |
Â
*/
|
109 |
Â
do_action( 'bp_group_before_edit_forum_post' ); ?>
|
110 |
Â
|
111 |
-
<label for="post_text" class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
112 |
Â
<textarea name="post_text" id="post_text"><?php bp_the_topic_post_edit_text(); ?></textarea>
|
113 |
Â
|
114 |
Â
<?php
|
108 |
Â
*/
|
109 |
Â
do_action( 'bp_group_before_edit_forum_post' ); ?>
|
110 |
Â
|
111 |
+
<label for="post_text" class="bp-screen-reader-text"><?php
|
112 |
+
/* translators: accessibility text */
|
113 |
+
_e( 'Edit text', 'buddypress' );
|
114 |
+
?></label>
|
115 |
Â
<textarea name="post_text" id="post_text"><?php bp_the_topic_post_edit_text(); ?></textarea>
|
116 |
Â
|
117 |
Â
<?php
|
@@ -186,7 +186,10 @@ do_action( 'bp_before_group_forum_topic' ); ?>
|
|
186 |
Â
|
187 |
Â
<h4><?php _e( 'Add a reply:', 'buddypress' ); ?></h4>
|
188 |
Â
|
189 |
-
<label for="reply_text" class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
190 |
Â
<textarea name="reply_text" id="reply_text"></textarea>
|
191 |
Â
|
192 |
Â
<div class="submit">
|
186 |
Â
|
187 |
Â
<h4><?php _e( 'Add a reply:', 'buddypress' ); ?></h4>
|
188 |
Â
|
189 |
+
<label for="reply_text" class="bp-screen-reader-text"><?php
|
190 |
+
/* translators: accessibility text */
|
191 |
+
_e( 'Reply', 'buddypress' );
|
192 |
+
?></label>
|
193 |
Â
<textarea name="reply_text" id="reply_text"></textarea>
|
194 |
Â
|
195 |
Â
<div class="submit">
|
@@ -58,7 +58,7 @@ do_action( 'bp_before_group_header' );
|
|
58 |
Â
|
59 |
Â
<?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
|
60 |
Â
<div id="item-header-avatar">
|
61 |
-
<a href="<?php
|
62 |
Â
|
63 |
Â
<?php bp_group_avatar(); ?>
|
64 |
Â
|
58 |
Â
|
59 |
Â
<?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
|
60 |
Â
<div id="item-header-avatar">
|
61 |
+
<a href="<?php echo esc_url( bp_get_group_permalink() ); ?>" title="<?php echo esc_attr( bp_get_group_name() ); ?>">
|
62 |
Â
|
63 |
Â
<?php bp_group_avatar(); ?>
|
64 |
Â
|
@@ -29,19 +29,28 @@
|
|
29 |
Â
<ul id="request-list" class="item-list">
|
30 |
Â
<?php while ( bp_group_membership_requests() ) : bp_group_the_membership_request(); ?>
|
31 |
Â
|
32 |
-
<li>
|
33 |
-
|
34 |
-
<
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
45 |
Â
|
46 |
Â
<div class="action">
|
47 |
Â
|
29 |
Â
<ul id="request-list" class="item-list">
|
30 |
Â
<?php while ( bp_group_membership_requests() ) : bp_group_the_membership_request(); ?>
|
31 |
Â
|
32 |
+
<li class="item-list group-request-list">
|
33 |
+
|
34 |
+
<div class="item-avatar"><?php bp_group_request_user_avatar_thumb(); ?></div>
|
35 |
+
|
36 |
+
<div class="item">
|
37 |
+
|
38 |
+
<div class="item-title"><?php bp_group_request_user_link(); ?> </div>
|
39 |
+
|
40 |
+
<span class="activity"><?php bp_group_request_time_since_requested(); ?></span>
|
41 |
+
|
42 |
+
<p class="comments"><?php bp_group_request_comment(); ?></p>
|
43 |
+
|
44 |
+
<?php
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Fires inside the groups membership request list loop.
|
48 |
+
*
|
49 |
+
* @since 1.1.0
|
50 |
+
*/
|
51 |
+
do_action( 'bp_group_membership_requests_admin_item' ); ?>
|
52 |
+
|
53 |
+
</div>
|
54 |
Â
|
55 |
Â
<div class="action">
|
56 |
Â
|
@@ -64,7 +64,10 @@
|
|
64 |
Â
*/
|
65 |
Â
do_action( 'bp_before_member_body' );
|
66 |
Â
|
67 |
-
if (
|
Â
|
|
Â
|
|
Â
|
|
68 |
Â
bp_get_template_part( 'members/single/activity' );
|
69 |
Â
|
70 |
Â
elseif ( bp_is_user_blogs() ) :
|
64 |
Â
*/
|
65 |
Â
do_action( 'bp_before_member_body' );
|
66 |
Â
|
67 |
+
if ( bp_is_user_front() ) :
|
68 |
+
bp_displayed_user_front_template_part();
|
69 |
+
|
70 |
+
elseif ( bp_is_user_activity() ) :
|
71 |
Â
bp_get_template_part( 'members/single/activity' );
|
72 |
Â
|
73 |
Â
elseif ( bp_is_user_blogs() ) :
|
@@ -51,7 +51,10 @@ do_action( 'bp_before_member_messages_loop' ); ?>
|
|
51 |
Â
|
52 |
Â
<thead>
|
53 |
Â
<tr>
|
54 |
-
<th scope="col" class="thread-checkbox bulk-select-all"><input id="select-all-messages" type="checkbox"><label class="bp-screen-reader-text" for="select-all-messages"><?php
|
Â
|
|
Â
|
|
Â
|
|
55 |
Â
<th scope="col" class="thread-from"><?php _e( 'From', 'buddypress' ); ?></th>
|
56 |
Â
<th scope="col" class="thread-info"><?php _e( 'Subject', 'buddypress' ); ?></th>
|
57 |
Â
|
@@ -68,7 +71,10 @@ do_action( 'bp_before_member_messages_loop' ); ?>
|
|
68 |
Â
do_action( 'bp_messages_inbox_list_header' ); ?>
|
69 |
Â
|
70 |
Â
<?php if ( bp_is_active( 'messages', 'star' ) ) : ?>
|
71 |
-
<th scope="col" class="thread-star"><span class="message-action-star"><span class="icon"></span> <span class="screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
72 |
Â
<?php endif; ?>
|
73 |
Â
|
74 |
Â
<th scope="col" class="thread-options"><?php _e( 'Actions', 'buddypress' ); ?></th>
|
@@ -81,7 +87,10 @@ do_action( 'bp_before_member_messages_loop' ); ?>
|
|
81 |
Â
|
82 |
Â
<tr id="m-<?php bp_message_thread_id(); ?>" class="<?php bp_message_css_class(); ?><?php if ( bp_message_thread_has_unread() ) : ?> unread<?php else: ?> read<?php endif; ?>">
|
83 |
Â
<td class="bulk-select-check">
|
84 |
-
<label for="bp-message-thread-<?php bp_message_thread_id(); ?>"><input type="checkbox" name="message_ids[]" id="bp-message-thread-<?php bp_message_thread_id(); ?>" class="message-check" value="<?php bp_message_thread_id(); ?>" /><span class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
85 |
Â
</td>
|
86 |
Â
|
87 |
Â
<?php if ( 'sentbox' != bp_current_action() ) : ?>
|
51 |
Â
|
52 |
Â
<thead>
|
53 |
Â
<tr>
|
54 |
+
<th scope="col" class="thread-checkbox bulk-select-all"><input id="select-all-messages" type="checkbox"><label class="bp-screen-reader-text" for="select-all-messages"><?php
|
55 |
+
/* translators: accessibility text */
|
56 |
+
_e( 'Select all', 'buddypress' );
|
57 |
+
?></label></th>
|
58 |
Â
<th scope="col" class="thread-from"><?php _e( 'From', 'buddypress' ); ?></th>
|
59 |
Â
<th scope="col" class="thread-info"><?php _e( 'Subject', 'buddypress' ); ?></th>
|
60 |
Â
|
71 |
Â
do_action( 'bp_messages_inbox_list_header' ); ?>
|
72 |
Â
|
73 |
Â
<?php if ( bp_is_active( 'messages', 'star' ) ) : ?>
|
74 |
+
<th scope="col" class="thread-star"><span class="message-action-star"><span class="icon"></span> <span class="screen-reader-text"><?php
|
75 |
+
/* translators: accessibility text */
|
76 |
+
_e( 'Star', 'buddypress' );
|
77 |
+
?></span></span></th>
|
78 |
Â
<?php endif; ?>
|
79 |
Â
|
80 |
Â
<th scope="col" class="thread-options"><?php _e( 'Actions', 'buddypress' ); ?></th>
|
87 |
Â
|
88 |
Â
<tr id="m-<?php bp_message_thread_id(); ?>" class="<?php bp_message_css_class(); ?><?php if ( bp_message_thread_has_unread() ) : ?> unread<?php else: ?> read<?php endif; ?>">
|
89 |
Â
<td class="bulk-select-check">
|
90 |
+
<label for="bp-message-thread-<?php bp_message_thread_id(); ?>"><input type="checkbox" name="message_ids[]" id="bp-message-thread-<?php bp_message_thread_id(); ?>" class="message-check" value="<?php bp_message_thread_id(); ?>" /><span class="bp-screen-reader-text"><?php
|
91 |
+
/* translators: accessibility text */
|
92 |
+
_e( 'Select this message', 'buddypress' );
|
93 |
+
?></span></label>
|
94 |
Â
</td>
|
95 |
Â
|
96 |
Â
<?php if ( 'sentbox' != bp_current_action() ) : ?>
|
@@ -44,7 +44,7 @@
|
|
44 |
Â
<a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>" title="<?php esc_attr_e( "Delete Conversation", 'buddypress' ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a>
|
45 |
Â
|
46 |
Â
<?php
|
47 |
-
|
48 |
Â
/**
|
49 |
Â
* Fires after the action links in the header of a single message thread.
|
50 |
Â
*
|
@@ -119,7 +119,10 @@
|
|
119 |
Â
*/
|
120 |
Â
do_action( 'bp_before_message_reply_box' ); ?>
|
121 |
Â
|
122 |
-
<label for="message_content" class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
123 |
Â
<textarea name="content" id="message_content" rows="15" cols="40"></textarea>
|
124 |
Â
|
125 |
Â
<?php
|
44 |
Â
<a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>" title="<?php esc_attr_e( "Delete Conversation", 'buddypress' ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a>
|
45 |
Â
|
46 |
Â
<?php
|
47 |
+
|
48 |
Â
/**
|
49 |
Â
* Fires after the action links in the header of a single message thread.
|
50 |
Â
*
|
119 |
Â
*/
|
120 |
Â
do_action( 'bp_before_message_reply_box' ); ?>
|
121 |
Â
|
122 |
+
<label for="message_content" class="bp-screen-reader-text"><?php
|
123 |
+
/* translators: accessibility text */
|
124 |
+
_e( 'Reply to Message', 'buddypress' );
|
125 |
+
?></label>
|
126 |
Â
<textarea name="content" id="message_content" rows="15" cols="40"></textarea>
|
127 |
Â
|
128 |
Â
<?php
|
@@ -12,7 +12,10 @@
|
|
12 |
Â
<thead>
|
13 |
Â
<tr>
|
14 |
Â
<th class="icon"></th>
|
15 |
-
<th class="bulk-select-all"><input id="select-all-notifications" type="checkbox"><label class="bp-screen-reader-text" for="select-all-notifications"><?php
|
Â
|
|
Â
|
|
Â
|
|
16 |
Â
<th class="title"><?php _e( 'Notification', 'buddypress' ); ?></th>
|
17 |
Â
<th class="date"><?php _e( 'Date Received', 'buddypress' ); ?></th>
|
18 |
Â
<th class="actions"><?php _e( 'Actions', 'buddypress' ); ?></th>
|
@@ -25,7 +28,10 @@
|
|
25 |
Â
|
26 |
Â
<tr>
|
27 |
Â
<td></td>
|
28 |
-
<td class="bulk-select-check"><label for="<?php bp_the_notification_id(); ?>"><input id="<?php bp_the_notification_id(); ?>" type="checkbox" name="notifications[]" value="<?php bp_the_notification_id(); ?>" class="notification-check"><span class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
29 |
Â
<td class="notification-description"><?php bp_the_notification_description(); ?></td>
|
30 |
Â
<td class="notification-since"><?php bp_the_notification_time_since(); ?></td>
|
31 |
Â
<td class="notification-actions"><?php bp_the_notification_action_links(); ?></td>
|
12 |
Â
<thead>
|
13 |
Â
<tr>
|
14 |
Â
<th class="icon"></th>
|
15 |
+
<th class="bulk-select-all"><input id="select-all-notifications" type="checkbox"><label class="bp-screen-reader-text" for="select-all-notifications"><?php
|
16 |
+
/* translators: accessibility text */
|
17 |
+
_e( 'Select all', 'buddypress' );
|
18 |
+
?></label></th>
|
19 |
Â
<th class="title"><?php _e( 'Notification', 'buddypress' ); ?></th>
|
20 |
Â
<th class="date"><?php _e( 'Date Received', 'buddypress' ); ?></th>
|
21 |
Â
<th class="actions"><?php _e( 'Actions', 'buddypress' ); ?></th>
|
28 |
Â
|
29 |
Â
<tr>
|
30 |
Â
<td></td>
|
31 |
+
<td class="bulk-select-check"><label for="<?php bp_the_notification_id(); ?>"><input id="<?php bp_the_notification_id(); ?>" type="checkbox" name="notifications[]" value="<?php bp_the_notification_id(); ?>" class="notification-check"><span class="bp-screen-reader-text"><?php
|
32 |
+
/* translators: accessibility text */
|
33 |
+
_e( 'Select this notification', 'buddypress' );
|
34 |
+
?></span></label></td>
|
35 |
Â
<td class="notification-description"><?php bp_the_notification_description(); ?></td>
|
36 |
Â
<td class="notification-since"><?php bp_the_notification_time_since(); ?></td>
|
37 |
Â
<td class="notification-actions"><?php bp_the_notification_action_links(); ?></td>
|
@@ -31,7 +31,10 @@ do_action( 'bp_before_profile_avatar_upload_content' ); ?>
|
|
31 |
Â
<p><?php _e( 'Click below to select a JPG, GIF or PNG format photo from your computer and then click \'Upload Image\' to proceed.', 'buddypress' ); ?></p>
|
32 |
Â
|
33 |
Â
<p id="avatar-upload">
|
34 |
-
<label for="file" class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
35 |
Â
<input type="file" name="file" id="file" />
|
36 |
Â
<input type="submit" name="upload" id="upload" value="<?php esc_attr_e( 'Upload Image', 'buddypress' ); ?>" />
|
37 |
Â
<input type="hidden" name="action" id="action" value="bp_avatar_upload" />
|
31 |
Â
<p><?php _e( 'Click below to select a JPG, GIF or PNG format photo from your computer and then click \'Upload Image\' to proceed.', 'buddypress' ); ?></p>
|
32 |
Â
|
33 |
Â
<p id="avatar-upload">
|
34 |
+
<label for="file" class="bp-screen-reader-text"><?php
|
35 |
+
/* translators: accessibility text */
|
36 |
+
_e( 'Select an image', 'buddypress' );
|
37 |
+
?></label>
|
38 |
Â
<input type="file" name="file" id="file" />
|
39 |
Â
<input type="submit" name="upload" id="upload" value="<?php esc_attr_e( 'Upload Image', 'buddypress' ); ?>" />
|
40 |
Â
<input type="hidden" name="action" id="action" value="bp_avatar_upload" />
|
@@ -24,7 +24,10 @@ do_action( 'bp_before_member_settings_template' ); ?>
|
|
24 |
Â
<label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ); ?></label>
|
25 |
Â
<input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small password-entry" <?php bp_form_field_attributes( 'password' ); ?>/> <?php _e( 'New Password', 'buddypress' ); ?><br />
|
26 |
Â
<div id="pass-strength-result"></div>
|
27 |
-
<label for="pass2" class="bp-screen-reader-text"><?php
|
Â
|
|
Â
|
|
Â
|
|
28 |
Â
<input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small password-entry-confirm" <?php bp_form_field_attributes( 'password' ); ?>/> <?php _e( 'Repeat New Password', 'buddypress' ); ?>
|
29 |
Â
|
30 |
Â
<?php
|
24 |
Â
<label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ); ?></label>
|
25 |
Â
<input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small password-entry" <?php bp_form_field_attributes( 'password' ); ?>/> <?php _e( 'New Password', 'buddypress' ); ?><br />
|
26 |
Â
<div id="pass-strength-result"></div>
|
27 |
+
<label for="pass2" class="bp-screen-reader-text"><?php
|
28 |
+
/* translators: accessibility text */
|
29 |
+
_e( 'Repeat New Password', 'buddypress' );
|
30 |
+
?></label>
|
31 |
Â
<input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small password-entry-confirm" <?php bp_form_field_attributes( 'password' ); ?>/> <?php _e( 'Repeat New Password', 'buddypress' ); ?>
|
32 |
Â
|
33 |
Â
<?php
|
@@ -616,6 +616,12 @@ body.activity-permalink #buddypress div.activity-comments div.acomment-content {
|
|
616 |
Â
/*--------------------------------------------------------------
|
617 |
Â
3.5 - Forms
|
618 |
Â
--------------------------------------------------------------*/
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
619 |
Â
#buddypress .standard-form textarea,
|
620 |
Â
#buddypress .standard-form input[type=text],
|
621 |
Â
#buddypress .standard-form input[type=text],
|
@@ -653,7 +659,8 @@ body.activity-permalink #buddypress div.activity-comments div.acomment-content {
|
|
653 |
Â
margin-bottom: 5px;
|
654 |
Â
}
|
655 |
Â
#buddypress .standard-form label,
|
656 |
-
#buddypress .standard-form span.label
|
Â
|
|
657 |
Â
display: block;
|
658 |
Â
font-weight: bold;
|
659 |
Â
margin: 15px 0 5px 0;
|
@@ -664,13 +671,17 @@ body.activity-permalink #buddypress div.activity-comments div.acomment-content {
|
|
664 |
Â
font-weight: normal;
|
665 |
Â
margin: auto;
|
666 |
Â
}
|
667 |
-
#buddypress .standard-form
|
668 |
-
#buddypress .standard-form
|
669 |
Â
color: #767676;
|
670 |
Â
font-size: 100%;
|
671 |
Â
font-weight: normal;
|
672 |
Â
margin: 5px 0 0 0;
|
673 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
674 |
Â
#buddypress .standard-form#sidebar-login-form label {
|
675 |
Â
margin-top: 5px;
|
676 |
Â
}
|
616 |
Â
/*--------------------------------------------------------------
|
617 |
Â
3.5 - Forms
|
618 |
Â
--------------------------------------------------------------*/
|
619 |
+
|
620 |
+
#buddypress form fieldset {
|
621 |
+
border: 0;
|
622 |
+
padding: 0;
|
623 |
+
}
|
624 |
+
|
625 |
Â
#buddypress .standard-form textarea,
|
626 |
Â
#buddypress .standard-form input[type=text],
|
627 |
Â
#buddypress .standard-form input[type=text],
|
659 |
Â
margin-bottom: 5px;
|
660 |
Â
}
|
661 |
Â
#buddypress .standard-form label,
|
662 |
+
#buddypress .standard-form span.label,
|
663 |
+
#buddypress .standard-form legend {
|
664 |
Â
display: block;
|
665 |
Â
font-weight: bold;
|
666 |
Â
margin: 15px 0 5px 0;
|
671 |
Â
font-weight: normal;
|
672 |
Â
margin: auto;
|
673 |
Â
}
|
674 |
+
#buddypress .standard-form .checkbox label,
|
675 |
+
#buddypress .standard-form .radio label {
|
676 |
Â
color: #767676;
|
677 |
Â
font-size: 100%;
|
678 |
Â
font-weight: normal;
|
679 |
Â
margin: 5px 0 0 0;
|
680 |
Â
}
|
681 |
+
#buddypress .standard-form .checkbox label input,
|
682 |
+
#buddypress .standard-form .radio label input {
|
683 |
+
margin-left: 3px;
|
684 |
+
}
|
685 |
Â
#buddypress .standard-form#sidebar-login-form label {
|
686 |
Â
margin-top: 5px;
|
687 |
Â
}
|
@@ -1 +1 @@
|
|
1 |
-
#buddypress div.pagination .pagination-links a:hover,#buddypress ul.button-nav li.current a{font-weight:700}#buddypress div.pagination{background:0 0;border:none;color:#767676;font-size:small;margin:0;position:relative;display:block;float:right;width:100%;padding:10px 0}#buddypress div.pagination .pag-count{float:right;margin-right:10px}#buddypress div.pagination .pagination-links{float:left;margin-left:10px}#buddypress div.pagination .pagination-links a,#buddypress div.pagination .pagination-links span{font-size:90%;padding:0 5px}#buddypress noscript div.pagination{margin-bottom:15px}#buddypress #nav-above{display:none}#buddypress .paged #nav-above{display:block}#buddypress img.wp-smiley{border:none!important;clear:none!important;float:none!important;margin:0!important;padding:0!important}#buddypress .clear{clear:right}#buddypress #activity-stream{margin-top:-5px}#buddypress #activity-stream p{margin:5px 0}#buddypress #item-body form#whats-new-form{margin:0;padding:0}#buddypress .home-page form#whats-new-form{border-bottom:none;padding-bottom:0}#buddypress form#whats-new-form #whats-new-avatar{float:right}#buddypress form#whats-new-form #whats-new-content{margin-right:55px;padding:0 20px 20px 0}#buddypress form#whats-new-form p.activity-greeting{line-height:.5em;margin-bottom:15px;margin-right:75px}#buddypress form#whats-new-form textarea{background:#fff;box-sizing:border-box;color:#555;font-family:inherit;font-size:medium;height:2.2em;line-height:1.4;padding:6px;width:100%}body.no-js #buddypress form#whats-new-form textarea{height:50px}#buddypress form#whats-new-form #whats-new-options select{max-width:200px;margin-top:12px}#buddypress form#whats-new-form #whats-new-submit{float:left;margin-top:12px}#buddypress #whats-new-options:after{clear:both;content:"";display:table}body.no-js #buddypress #whats-new-options{height:auto}#buddypress #whats-new:focus{border-color:rgba(31,179,221,.9)!important;outline-color:rgba(31,179,221,.9)}#buddypress ul.activity-list li{overflow:hidden;padding:15px 0 0;list-style:none}#buddypress .activity-list .activity-avatar{float:right}#buddypress ul.item-list.activity-list li.has-comments{padding-bottom:15px}body.activity-permalink #buddypress ul.activity-list li.has-comments{padding-bottom:0}#buddypress .activity-list li.mini{font-size:80%;position:relative}#buddypress .activity-list li.mini .activity-avatar img.FB_profile_pic,#buddypress .activity-list li.mini .activity-avatar img.avatar{height:20px;margin-right:30px;width:20px}#buddypress .activity-permalink .activity-list li.mini .activity-avatar img.FB_profile_pic,#buddypress .activity-permalink .activity-list li.mini .activity-avatar img.avatar{height:auto;margin-right:0;width:auto}body.activity-permalink #buddypress .activity-list>li:first-child{padding-top:0}#buddypress .activity-list li .activity-content{position:relative}#buddypress .activity-list li.mini .activity-content p{margin:0}#buddypress .activity-list li.mini .activity-comments{clear:both;font-size:120%}body.activity-permalink #buddypress li.mini .activity-meta{margin-top:4px}#buddypress .activity-list li .activity-inreplyto{color:#767676;font-size:80%}#buddypress .activity-list li .activity-inreplyto>p{margin:0;display:inline}#buddypress .activity-list li .activity-inreplyto blockquote,#buddypress .activity-list li .activity-inreplyto div.activity-inner{background:0 0;border:none;display:inline;margin:0;overflow:hidden;padding:0}#buddypress .activity-list .activity-content{margin:0 70px 0 0}body.activity-permalink #buddypress .activity-list li .activity-content{border:none;font-size:100%;line-height:150%;margin-right:170px;margin-left:0;padding:0}body.activity-permalink #buddypress .activity-list li .activity-header>p{margin:0;padding:5px 0 0}#buddypress .activity-list .activity-content .activity-header,#buddypress .activity-list .activity-content .comment-header{color:#767676;line-height:220%}#buddypress .activity-header{margin-left:20px}#buddypress .acomment-meta a,#buddypress .activity-header a,#buddypress .comment-meta a{text-decoration:none}#buddypress .activity-list .activity-content .activity-header img.avatar{float:none!important;margin:0 0 -8px 5px!important}#buddypress a.bp-secondary-action,#buddypress span.highlight{font-size:80%;padding:0;margin-left:5px;text-decoration:none}#buddypress .activity-list .activity-content .activity-inner,#buddypress .activity-list .activity-content blockquote{margin:10px 0 5px 10px;overflow:hidden}#buddypress .activity-list li.new_forum_post .activity-content .activity-inner,#buddypress .activity-list li.new_forum_topic .activity-content .activity-inner{border-right:2px solid #EAEAEA;margin-right:5px;padding-right:10px}body.activity-permalink #buddypress .activity-content .activity-inner,body.activity-permalink #buddypress .activity-content blockquote{margin-right:0;margin-top:5px}#buddypress .activity-inner>p{word-wrap:break-word}#buddypress .activity-inner>.activity-inner,#buddypress .activity-inner>blockquote{margin:0}#buddypress .activity-list .activity-content img.thumbnail{border:2px solid #eee;float:right;margin:0 0 5px 10px}#buddypress .activity-read-more{margin-right:1em;white-space:nowrap}#buddypress .activity-list li.load-more,#buddypress .activity-list li.load-newest{background:#f0f0f0;font-size:110%;margin:15px 0;padding:10px 15px;text-align:center}#buddypress .activity-list li.load-more a,#buddypress .activity-list li.load-newest a{color:#4D4D4D}#buddypress div.activity-meta{margin:18px 0 0}body.activity-permalink #buddypress div.activity-meta{margin-bottom:6px}#buddypress div.activity-meta a{padding:4px 8px}#buddypress a.activity-time-since{color:#767676;text-decoration:none}#buddypress a.activity-time-since:hover{color:#767676;text-decoration:underline}#buddypress #reply-title small a,#buddypress a.bp-primary-action{font-size:80%;margin-left:5px;text-decoration:none}#buddypress #reply-title small a span,#buddypress a.bp-primary-action span{background:#767676;color:#fff;font-size:90%;margin-right:2px;padding:0 5px}#buddypress #reply-title small a:hover span,#buddypress a.bp-primary-action:hover span{background:#555;color:#fff}#buddypress div.activity-comments{margin:0 70px 0 0;overflow:hidden;position:relative;width:auto;clear:both}body.activity-permalink #buddypress div.activity-comments{background:0 0;margin-right:170px;width:auto}#buddypress div.activity-comments>ul{padding:0 10px 0 0}#buddypress div.activity-comments ul,#buddypress div.activity-comments ul li{border:none;list-style:none}#buddypress div.activity-comments ul{clear:both;margin:0}#buddypress div.activity-comments ul li{border-top:1px solid #eee;padding:10px 0 0}body.activity-permalink #buddypress .activity-list li.mini .activity-comments{clear:none;margin-top:0}body.activity-permalink #buddypress div.activity-comments ul li{border-width:1px;padding:10px 0 0}#buddypress div.activity-comments>ul>li:first-child{border-top:none}#buddypress div.activity-comments ul li:last-child{margin-bottom:0}#buddypress div.activity-comments ul li>ul{margin-right:30px;margin-top:0;padding-right:10px}body.activity-permalink #buddypress div.activity-comments ul li>ul{margin-top:10px}body.activity-permalink #buddypress div.activity-comments>ul{padding:0 15px 0 10px}#buddypress div.activity-comments div.acomment-avatar img{border-width:1px;float:right;height:25px;margin-left:10px;width:25px}#buddypress div.activity-comments div.acomment-content{font-size:80%;margin:5px 40px 0 0}#buddypress div.acomment-content .activity-delete-link,#buddypress div.acomment-content .comment-header,#buddypress div.acomment-content .time-since{display:none}body.activity-permalink #buddypress div.activity-comments div.acomment-content{font-size:90%}#buddypress div.activity-comments div.acomment-meta{color:#767676;font-size:80%}#buddypress div.activity-comments form.ac-form{display:none;padding:10px}#buddypress div.activity-comments li form.ac-form{margin-left:15px;clear:both}#buddypress div.activity-comments form.root{margin-right:0}#buddypress div.activity-comments div#message{margin-top:15px;margin-bottom:0}#buddypress div.activity-comments form .ac-textarea{background:#fff;border:1px inset #ccc;margin-bottom:10px;padding:8px}#buddypress div.activity-comments form textarea{border:none;background:0 0;box-shadow:none;outline:0;color:#555;font-family:inherit;font-size:100%;height:60px;padding:0;margin:0;width:100%}#buddypress div.activity-comments form input{margin-top:5px}#buddypress div.activity-comments form div.ac-reply-avatar{float:right}#buddypress div.ac-reply-avatar img{border:1px solid #eee}#buddypress div.activity-comments form div.ac-reply-content{color:#767676;margin-right:50px;padding-right:15px}#buddypress div.activity-comments form div.ac-reply-content a{text-decoration:none}#buddypress .acomment-options{float:right;margin:5px 40px 5px 0}#buddypress .acomment-options a{color:#767676}#buddypress .acomment-options a:hover{color:inherit}#buddypress div.dir-search{float:left;margin:-39px 0 0}#buddypress div.dir-search input[type=text],#buddypress li.groups-members-search input[type=text]{font-size:90%;padding:1px 3px}#buddypress .current-member-type{font-style:italic}#buddypress .dir-form{clear:both}#buddypress div#message{margin:0 0 15px}#buddypress #message.info{margin-bottom:0}#buddypress div#message.updated{clear:both;display:block}#buddypress div#message p,#sitewide-notice p{font-size:90%;display:block;padding:10px 15px}#buddypress div#message.error p{background-color:#fdc;border:1px solid #a00;clear:right;color:#800}#buddypress div#message.warning p{background-color:#ffe0af;border:1px solid #ffd087;clear:right;color:#800}#buddypress div#message.updated p{background-color:#efc;border:1px solid #591;color:#250}#buddypress #pass-strength-result{background-color:#eee;border-color:#ddd;border-style:solid;border-width:1px;display:none;margin:5px 0 5px 5px;padding:5px;text-align:center;width:150px}#buddypress .standard-form #basic-details-section #pass-strength-result{width:35%}#buddypress #pass-strength-result.bad,#buddypress #pass-strength-result.error{background-color:#ffb78c;border-color:#ff853c!important;display:block}#buddypress #pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;display:block}#buddypress #pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;display:block}#buddypress #pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;display:block}#buddypress .standard-form#signup_form div div.error{background:#faa;color:#a00;margin:0 0 10px;padding:6px;width:90%}#buddypress div.accept,#buddypress div.reject{float:right;margin-right:10px}#buddypress ul.button-nav li{float:right;margin:0 0 10px 10px;list-style:none}#sitewide-notice #message{right:2%;position:fixed;top:1em;width:96%;z-index:9999}#sitewide-notice.admin-bar-on #message{top:3.3em}#sitewide-notice strong{display:block;margin-bottom:-1em}#buddypress .dir-search input[type=search],#buddypress .dir-search input[type=text],#buddypress .groups-members-search input[type=search],#buddypress .groups-members-search input[type=text],#buddypress .standard-form input[type=color],#buddypress .standard-form input[type=date],#buddypress .standard-form input[type=datetime-local],#buddypress .standard-form input[type=datetime],#buddypress .standard-form input[type=email],#buddypress .standard-form input[type=month],#buddypress .standard-form input[type=number],#buddypress .standard-form input[type=password],#buddypress .standard-form input[type=range],#buddypress .standard-form input[type=search],#buddypress .standard-form input[type=tel],#buddypress .standard-form input[type=text],#buddypress .standard-form input[type=time],#buddypress .standard-form input[type=url],#buddypress .standard-form input[type=week],#buddypress .standard-form select,#buddypress .standard-form textarea{border:1px solid #ccc;background:#fafafa;border-radius:0;color:#767676;font:inherit;font-size:100%;padding:6px}#buddypress .standard-form select{padding:3px}#buddypress .standard-form input[type=password]{margin-bottom:5px}#buddypress .standard-form label,#buddypress .standard-form span.label{display:block;font-weight:700;margin:15px 0 5px;width:auto}#buddypress .standard-form #invite-list label,#buddypress .standard-form p label{font-weight:400;margin:auto}#buddypress .standard-form div.checkbox label:nth-child(n+2),#buddypress .standard-form div.radio div label{color:#767676;font-size:100%;font-weight:400;margin:5px 0 0}#buddypress .standard-form#sidebar-login-form label{margin-top:5px}#buddypress .standard-form input[type=text]{width:75%}#buddypress .standard-form#sidebar-login-form input[type=password],#buddypress .standard-form#sidebar-login-form input[type=text]{padding:4px;width:95%}#buddypress .standard-form #basic-details-section input[type=password],#buddypress .standard-form #blog-details-section input#signup_blog_url{width:35%}#buddypress #commentform input[type=text],#buddypress #commentform textarea,#buddypress .form-allowed-tags,#buddypress .standard-form#signup_form input[type=text],#buddypress .standard-form#signup_form textarea{width:90%}#buddypress .standard-form#signup_form div.submit{float:left}#buddypress div#signup-avatar img{margin:0 0 10px 15px}#buddypress .standard-form textarea{width:75%;height:120px}#buddypress .standard-form textarea#message_content{height:200px}#buddypress .standard-form#send-reply textarea{width:97.5%}#buddypress .standard-form p.description{color:#767676;font-size:80%;margin:5px 0}#buddypress .standard-form div.submit{clear:both;padding:15px 0 0}#buddypress .standard-form p.submit{margin-bottom:0;padding:15px 0 0}#buddypress .standard-form div.submit input{margin-left:15px}#buddypress .standard-form div.radio ul{margin:10px 38px 15px 0;list-style:disc}#buddypress .standard-form div.radio ul li{margin-bottom:5px}#buddypress .standard-form a.clear-value{display:block;margin-top:5px;outline:0}#buddypress table.notification-settings td:first-child,#buddypress table.notification-settings th.icon,#buddypress table.notifications td:first-child,#buddypress table.notifications th.icon,body.no-js #buddypress #delete_inbox_messages,body.no-js #buddypress #delete_sentbox_messages,body.no-js #buddypress #message-type-select,body.no-js #buddypress #messages-bulk-management #select-all-messages,body.no-js #buddypress #notifications-bulk-management #select-all-notifications,body.no-js #buddypress label[for=message-type-select]{display:none}#buddypress .standard-form #basic-details-section,#buddypress .standard-form #blog-details-section,#buddypress .standard-form #profile-details-section{float:right;width:48%}#buddypress .standard-form #profile-details-section{float:left}#buddypress #notifications-bulk-management,#buddypress .standard-form #blog-details-section{clear:right}#buddypress .standard-form input:focus,#buddypress .standard-form select:focus,#buddypress .standard-form textarea:focus{background:#fafafa;color:#555}#buddypress form#send-invite-form{margin-top:20px}#buddypress div#invite-list{background:#f5f5f5;height:400px;margin:0 0 10px;overflow:auto;padding:5px;width:160px}#buddypress .comment-reply-link,#buddypress .generic-button a,#buddypress a.button,#buddypress button,#buddypress input[type=button],#buddypress input[type=reset],#buddypress input[type=submit],#buddypress ul.button-nav li a,a.bp-title-button{background:#fff;border:1px solid #ccc;color:#767676;font-size:small;cursor:pointer;outline:0;padding:4px 10px;text-align:center;text-decoration:none}#buddypress .comment-reply-link:hover,#buddypress a.button:focus,#buddypress a.button:hover,#buddypress button:hover,#buddypress div.generic-button a:hover,#buddypress input[type=button]:hover,#buddypress input[type=reset]:hover,#buddypress input[type=submit]:hover,#buddypress ul.button-nav li a:hover,#buddypress ul.button-nav li.current a{background:#ededed;border:1px solid #bbb;color:#555;outline:0;text-decoration:none}#buddypress form.standard-form .left-menu{float:right}#buddypress form.standard-form .left-menu #invite-list ul{margin:1%;list-style:none}#buddypress form.standard-form .left-menu #invite-list ul li{margin:0 1% 0 0}#buddypress form.standard-form .main-column{margin-right:190px}#buddypress form.standard-form .main-column ul#friend-list{clear:none;float:right}#buddypress form.standard-form .main-column ul#friend-list h4{clear:none}#buddypress .wp-editor-wrap a.button,#buddypress .wp-editor-wrap button,#buddypress .wp-editor-wrap input[type=button],#buddypress .wp-editor-wrap input[type=reset],#buddypress .wp-editor-wrap input[type=submit]{padding:0 8px 1px}#buddypress form [disabled=disabled]{cursor:default;opacity:.4}.bp-screen-reader-text{position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip:rect(0 0 0 0);border:0;word-wrap:normal!important}#buddypress a.loading,#buddypress input.loading{-webkit-animation:loader-pulsate .5s infinite ease-in-out alternate;-moz-animation:loader-pulsate .5s infinite ease-in-out alternate;border-color:#aaa}@-webkit-keyframes loader-pulsate{from{border-color:#aaa;-webkit-box-shadow:0 0 6px #ccc;box-shadow:0 0 6px #ccc}to{border-color:#ccc;-webkit-box-shadow:0 0 6px #f8f8f8;box-shadow:0 0 6px #f8f8f8}}@-moz-keyframes loader-pulsate{from{border-color:#aaa;-moz-box-shadow:0 0 6px #ccc;box-shadow:0 0 6px #ccc}to{border-color:#ccc;-moz-box-shadow:0 0 6px #f8f8f8;box-shadow:0 0 6px #f8f8f8}}#buddypress a.loading:hover,#buddypress input.loading:hover{color:#767676}#buddypress a.disabled,#buddypress button.disabled,#buddypress button.pending,#buddypress div.pending a,#buddypress input[type=submit].disabled,#buddypress input[type=submit].pending,#buddypress input[type=submit][disabled=disabled],#buddypress input[type=button].disabled,#buddypress input[type=button].pending,#buddypress input[type=reset].disabled,#buddypress input[type=reset].pending{border-color:#eee;color:#bbb;cursor:default}#buddypress a.disabled:hover,#buddypress button.disabled:hover,#buddypress button.pending:hover,#buddypress div.pending a:hover,#buddypress input[type=submit]:hover.disabled,#buddypress input[type=submit]:hover.pending,#buddypress input[type=button]:hover.disabled,#buddypress input[type=button]:hover.pending,#buddypress input[type=reset]:hover.disabled,#buddypress input[type=reset]:hover.pending{border-color:#eee;color:#bbb}#buddypress ul#topic-post-list{margin:0;width:auto}#buddypress ul#topic-post-list li{padding:15px;position:relative}#buddypress ul#topic-post-list li.alt{background:#f5f5f5}#buddypress ul#topic-post-list li div.poster-meta{color:#767676;margin-bottom:10px}#buddypress ul#topic-post-list li div.post-content{margin-right:54px}#buddypress div.topic-tags{font-size:80%}#buddypress div.admin-links{color:#767676;font-size:80%;position:absolute;top:15px;left:25px}#buddypress div#topic-meta{margin:0;padding:5px 19px 30px;position:relative}#buddypress div#topic-meta div.admin-links{left:19px;top:-36px}#buddypress div#topic-meta h3{margin:5px 0}#buddypress div#new-topic-post{display:none;margin:20px 0 0;padding:1px 0 0}#buddypress table.forum,#buddypress table.messages-notices,#buddypress table.notifications,#buddypress table.notifications-settings,#buddypress table.profile-fields,#buddypress table.profile-settings,#buddypress table.wp-profile-fields{width:100%}#buddypress table.forum thead tr,#buddypress table.messages-notices thead tr,#buddypress table.notifications thead tr,#buddypress table.notifications-settings thead tr,#buddypress table.profile-fields thead tr,#buddypress table.profile-settings thead tr,#buddypress table.wp-profile-fields thead tr{background:#eaeaea}#buddypress table#message-threads{clear:both}#buddypress table.profile-fields{margin-bottom:20px}#buddypress table tr td.thread-info p,#buddypress table.profile-fields p{margin:0}#buddypress table.profile-fields:last-child{margin-bottom:0}#buddypress table.profile-fields p:last-child{margin-top:0}#buddypress table.forum tr td,#buddypress table.forum tr th,#buddypress table.messages-notices tr td,#buddypress table.messages-notices tr th,#buddypress table.notifications tr td,#buddypress table.notifications tr th,#buddypress table.notifications-settings tr td,#buddypress table.notifications-settings tr th,#buddypress table.profile-fields tr td,#buddypress table.profile-fields tr th,#buddypress table.profile-settings tr td,#buddypress table.wp-profile-fields tr td,#buddypress table.wp-profile-fields tr th{padding:8px;vertical-align:middle}#buddypress table.forum tr td.label,#buddypress table.messages-notices tr td.label,#buddypress table.notifications tr td.label,#buddypress table.notifications-settings tr td.label,#buddypress table.profile-fields tr td.label,#buddypress table.wp-profile-fields tr td.label{border-left:1px solid #eaeaea;font-weight:700;width:25%}#buddypress #message-threads .thread-info{min-width:40%}#buddypress table tr td.thread-info p.thread-excerpt{color:#767676;font-size:80%;margin-top:3px}#buddypress table.forum td{text-align:center}#buddypress table.forum tr.alt td,#buddypress table.messages-notices tr.alt td,#buddypress table.notifications tr.alt td,#buddypress table.notifications-settings tr.alt td,#buddypress table.profile-fields tr.alt td,#buddypress table.profile-settings tr.alt td,#buddypress table.wp-profile-fields tr.alt td{background:#f5f5f5}#buddypress table.notification-settings{margin-bottom:20px;text-align:right}#buddypress #groups-notification-settings{margin-bottom:0}#buddypress table.notification-settings th.title,#buddypress table.profile-settings th.title{width:80%}#buddypress table.notification-settings .no,#buddypress table.notification-settings .yes{text-align:center;width:40px}#buddypress table.forum{margin:0;width:auto;clear:both}#buddypress table.forum tr.sticky td{font-size:110%;background:#fff9db;border-top:1px solid #ffe8c4;border-bottom:1px solid #ffe8c4}#buddypress table.forum tr.closed td.td-title{padding-right:35px}#buddypress table.forum td p.topic-text{color:#767676;font-size:100%}#buddypress table.forum tr>td:first-child,#buddypress table.forum tr>th:first-child{padding-right:15px}#buddypress table.forum tr>td:last-child,#buddypress table.forum tr>th:last-child{padding-left:15px}#buddypress table.forum td.td-group,#buddypress table.forum td.td-poster,#buddypress table.forum td.td-title,#buddypress table.forum tr th#th-group,#buddypress table.forum tr th#th-poster,#buddypress table.forum tr th#th-title{text-align:right}#buddypress table.forum tr td.td-title a.topic-title{font-size:110%}#buddypress table.forum td.td-freshness{white-space:nowrap}#buddypress table.forum td.td-freshness span.time-since{font-size:80%;color:#767676}#buddypress table.forum td img.avatar{float:none;margin:0 0 -8px 5px}#buddypress table.forum td.td-group,#buddypress table.forum td.td-poster{min-width:140px}#buddypress table.forum th#th-title{width:80%}#buddypress table.forum th#th-freshness{width:25%}#buddypress table.forum th#th-postcount{width:15%}#buddypress table.forum p.topic-meta{font-size:80%;margin:5px 0 0}#buddypress .item-body{margin:20px 0}#buddypress span.activity{display:inline-block;font-size:small;opacity:.8;padding:0}#buddypress span.user-nicename{color:#767676;display:inline-block;font-size:120%;font-weight:700}#buddypress div#message p,#sitewide-notice p{font-weight:400;margin-top:3px;text-decoration:none;background-color:#ffd;border:1px solid #cb2;color:#440}#buddypress #item-header:after{clear:both;content:"";display:table}#buddypress div#item-header div#item-header-content{float:right;margin-right:0}#buddypress div#item-header h2{line-height:120%;margin:0 0 15px}#buddypress div#item-header h2 a{color:#767676;text-decoration:none}#buddypress div#item-header img.avatar{float:right;margin:0 0 19px 15px}#buddypress div#item-header h2{margin-bottom:5px}#buddypress div#item-header h2 span.highlight{font-size:60%;font-weight:400;line-height:170%;vertical-align:middle;display:inline-block}#buddypress div#item-header ul h5,#buddypress div#item-header ul hr,#buddypress div#item-header ul span,body.no-js #buddypress div#item-header .js-self-profile-button{display:none}#buddypress div#item-header h2 span.highlight span{background:#a1dcfa;color:#fff;cursor:pointer;font-weight:700;font-size:80%;margin-bottom:2px;padding:1px 4px;position:relative;left:-2px;top:-2px;vertical-align:middle}#buddypress div#item-header div#item-meta{font-size:80%;color:#767676;overflow:hidden;margin:15px 0 5px;padding-bottom:10px}#buddypress div#item-header div#item-actions{float:left;margin:0 15px 15px 0;text-align:left;width:20%}#buddypress div#item-header div#item-actions h3{margin:0 0 5px}#buddypress div#item-header ul{margin-bottom:15px;overflow:hidden}#buddypress div#item-header ul li{float:left;list-style:none}#buddypress div#item-header ul img.avatar,#buddypress div#item-header ul.avatars img.avatar{height:30px;margin:2px;width:30px}#buddypress div#item-header a.button,#buddypress div#item-header div.generic-button{float:right;margin:10px 0 0 10px}#buddypress div#item-header div#message.info{line-height:80%}#buddypress ul.item-list{border-top:1px solid #eaeaea;width:100%;list-style:none;clear:both;margin:0;padding:0}body.activity-permalink #buddypress ul.item-list,body.activity-permalink #buddypress ul.item-list li.activity-item{border:none}#buddypress ul.item-list li{border-bottom:1px solid #eaeaea;padding:15px 0;margin:0;position:relative;list-style:none}#buddypress ul.single-line li{border:none}#buddypress ul.item-list li img.avatar{float:right;margin:0 0 0 10px}#buddypress ul.item-list li div.item-title,#buddypress ul.item-list li h4{font-weight:400;font-size:90%;margin:0;width:75%}#buddypress ul.item-list li div.item-title span{color:#767676;font-size:80%}#buddypress ul.item-list li div.item-desc{color:#767676;font-size:80%;margin:10px 60px 0 0;width:50%}#buddypress ul.item-list li.group-no-avatar div.item-desc{margin-right:0}#buddypress ul.item-list li div.action{position:absolute;top:15px;left:0;text-align:left}#buddypress ul.item-list li div.meta{color:#767676;font-size:80%;margin-top:10px}#buddypress ul.item-list li h5 span.small{float:left;font-size:80%;font-weight:400}#buddypress div.item-list-tabs{background:0 0;clear:right;overflow:hidden}#buddypress div.item-list-tabs ul{margin:0;padding:0}#buddypress div.item-list-tabs ul li{float:right;margin:0;list-style:none}#buddypress div.item-list-tabs#subnav ul li{margin-top:0}#buddypress div.item-list-tabs ul li.last{float:left;margin:7px 0 0}#buddypress div.item-list-tabs#subnav ul li.last{margin-top:4px}#buddypress div.item-list-tabs ul li.last select{max-width:185px}#buddypress div.item-list-tabs ul li a,#buddypress div.item-list-tabs ul li span{display:block;padding:5px 10px;text-decoration:none}#buddypress div.item-list-tabs ul li a span{background:#eee;border-radius:50%;border:1px solid #ccc;color:#6c6c6c;display:inline;font-size:70%;margin-right:2px;padding:3px 6px;text-align:center;vertical-align:middle}#buddypress div.item-list-tabs ul li.current a,#buddypress div.item-list-tabs ul li.selected a{background-color:#eee;color:#555;opacity:.8;font-weight:700}#buddypress div.item-list-tabs ul li a:hover span,#buddypress div.item-list-tabs ul li.current a span,#buddypress div.item-list-tabs ul li.selected a span{background-color:#eee}#buddypress div.item-list-tabs ul li.current a span,#buddypress div.item-list-tabs ul li.selected a span{background-color:#fff}#buddypress div#item-nav ul li.loading a{background-position:12% 50%}#buddypress div.item-list-tabs#object-nav{margin-top:0}#buddypress div.item-list-tabs#subnav{background:0 0;margin:10px 0;overflow:hidden}#buddypress #admins-list li,#buddypress #members-list li,#buddypress #mods-list li{overflow:auto;list-style:none}#buddypress div#message-thread div.message-metadata,.widget.buddypress div.avatar-block{overflow:hidden}#buddypress #item-buttons:empty{display:none}#buddypress #cover-image-container{position:relative;z-index:0}#buddypress #header-cover-image{background-color:#c5c5c5;background-position:center top;background-repeat:no-repeat;background-size:cover;border:0;display:block;right:0;margin:0;padding:0;position:absolute;top:0;width:100%;z-index:1}#buddypress #item-header-cover-image{padding:0 1em;position:relative;z-index:2}#buddypress table#message-threads tr.unread td{background:#fff9db;border-top:1px solid #ffe8c4;border-bottom:1px solid #ffe8c4;font-weight:700}#buddypress table#message-threads tr.unread td .activity,#buddypress table#message-threads tr.unread td .thread-excerpt,#buddypress table#message-threads tr.unread td.thread-options{font-weight:400}#buddypress li span.unread-count,#buddypress tr.unread span.unread-count{background:#d00;color:#fff;font-weight:700;padding:2px 8px}#buddypress div.item-list-tabs ul li a span.unread-count{padding:1px 6px;color:#fff}#buddypress div#message-thread div.message-box{margin:0;padding:15px}#buddypress div#message-thread div.alt{background:#f4f4f4}#buddypress div#message-thread p#message-recipients{margin:10px 0 20px}#buddypress div#message-thread img.avatar{float:right;margin:0 0 0 10px;vertical-align:middle}#buddypress div#message-thread strong{font-size:100%;margin:0}#buddypress div#message-thread strong a{text-decoration:none}#buddypress div#message-thread strong span.activity{margin-top:4px}#buddypress div#message-thread div.message-content{margin-right:45px}#buddypress div#message-thread div.message-options{text-align:left}#buddypress #message-threads img.avatar{max-width:none}#buddypress div.message-search{float:left;margin:0 20px}.message-metadata{position:relative}.message-star-actions{position:absolute;left:0;top:0}#buddypress a.message-action-star,#buddypress a.message-action-unstar{border-bottom:0;text-decoration:none;outline:0}a.message-action-star{opacity:.7}a.message-action-star:hover{opacity:1}.message-action-star span.icon:before,.message-action-unstar span.icon:before{font-family:dashicons;font-size:18px}.message-action-star span.icon:before{color:#767676;content:"\f154"}.message-action-unstar span.icon:before{color:#fcdd77;content:"\f155"}#buddypress div.profile h4{margin-bottom:auto;margin-top:15px}#buddypress #profile-edit-form ul.button-nav{margin-top:15px}body.no-js #buddypress .field-visibility-settings-close,body.no-js #buddypress .field-visibility-settings-toggle{display:none}#buddypress .field-visibility-settings{display:none;margin-top:10px}body.no-js #buddypress .field-visibility-settings{display:block}#buddypress .current-visibility-level{font-weight:700;font-style:normal}#buddypress .field-visibility-settings,#buddypress .field-visibility-settings-notoggle,#buddypress .field-visibility-settings-toggle{color:#767676}#buddypress .field-visibility-settings a,#buddypress .field-visibility-settings-toggle a{font-size:80%}body.register #buddypress div.page ul{list-style:none}#buddypress .standard-form .field-visibility-settings label{margin:0;font-weight:400}#buddypress .field-visibility-settings legend,#buddypress .field-visibility-settings-toggle{font-style:italic}#buddypress .field-visibility-settings .radio{list-style:none;margin-bottom:0}#buddypress .field-visibility select{margin:0}#buddypress .wp-editor-container{border:1px solid #dedede}#buddypress .html-active button.switch-html,#buddypress .tmce-active button.switch-tmce{border-bottom-color:transparent;border-bottom-right-radius:0;border-bottom-left-radius:0;background:#f5f5f5}#buddypress .standard-form .wp-editor-container textarea{width:100%;padding-top:0;padding-bottom:0}.widget.buddypress div.item-avatar img.avatar{float:right;margin:0 0 15px 10px}.widget.buddypress span.activity{display:inline-block;font-size:small;opacity:.8;padding:0}.widget.buddypress div.item-options{font-size:90%;margin:0 0 1em;padding:1em 0}.widget.buddypress div.item{margin:0 0 1em}.widget.buddypress div.item-content,.widget.buddypress div.item-meta{font-size:11px;margin-right:50px}.widget.buddypress ul.item-list img.avatar{height:40px;margin-left:10px;width:40px}.widget.buddypress div.item-avatar img{height:40px;margin:1px;width:40px}.widget.buddypress #bp-login-widget-form label{display:block;margin:1rem 0 .5rem}.widget.buddypress #bp-login-widget-form #bp-login-widget-submit{margin-left:10px}.widget.buddypress .bp-login-widget-user-avatar{float:right}.bp-login-widget-user-avatar img.avatar{height:40px;width:40px}.widget.buddypress .bp-login-widget-user-links>div{padding-right:60px;margin-bottom:.5rem}.widget.buddypress .bp-login-widget-user-links>div.bp-login-widget-user-link a{font-weight:700}.widget.buddypress #friends-list,.widget.buddypress #groups-list,.widget.buddypress #members-list{margin-right:0;padding-right:0}.widget.buddypress #friends-list li,.widget.buddypress #groups-list li,.widget.buddypress #members-list li{clear:both;list-style-type:none}@media only screen and (max-width:480px){#buddypress div.dir-search{float:left;margin-top:-50px;text-align:left}#buddypress div.dir-search input[type=text]{margin-bottom:1em;width:50%}a.bp-title-button{margin-right:10px}#buddypress form.standard-form .main-column div.action{position:relative;margin-bottom:1em}#buddypress form.standard-form .main-column ul#friend-list h4{width:100%}}@media only screen and (max-width:320px){#buddypress div.dir-search,#buddypress ul.item-list li div.action{margin-top:0;text-align:right;clear:right;float:right}#buddypress li#groups-order-select{clear:right;float:right}#buddypress ul.item-list li div.action{margin-right:70px;position:relative;top:0;left:0}#buddypress ul.item-list li div.item-desc{clear:right;float:right;margin:10px 0 0;width:auto}#buddypress li div.item{margin-right:70px;width:auto}#buddypress ul.item-list li div.meta{margin-top:0}#buddypress .item-desc p{margin:0 0 10px}#buddypress div.pagination .pag-count{margin-right:0}}@media only screen and (max-width:240px){#buddypress div.dir-search{float:right;margin:0}#buddypress div.dir-search input[type=text]{width:50%}#buddypress li#groups-order-select{float:right}#buddypress ul.item-list li img.avatar{width:30px;height:auto}#buddypress li div.item,#buddypress ul.item-list li div.action{margin-right:45px}h1 a.bp-title-button{clear:right;float:right;margin:10px 0 20px}}
|
1 |
+
#buddypress div.pagination .pagination-links a:hover,#buddypress ul.button-nav li.current a{font-weight:700}#buddypress div.pagination{background:0 0;border:none;color:#767676;font-size:small;margin:0;position:relative;display:block;float:right;width:100%;padding:10px 0}#buddypress div.pagination .pag-count{float:right;margin-right:10px}#buddypress div.pagination .pagination-links{float:left;margin-left:10px}#buddypress div.pagination .pagination-links a,#buddypress div.pagination .pagination-links span{font-size:90%;padding:0 5px}#buddypress noscript div.pagination{margin-bottom:15px}#buddypress #nav-above{display:none}#buddypress .paged #nav-above{display:block}#buddypress img.wp-smiley{border:none!important;clear:none!important;float:none!important;margin:0!important;padding:0!important}#buddypress .clear{clear:right}#buddypress #activity-stream{margin-top:-5px}#buddypress #activity-stream p{margin:5px 0}#buddypress #item-body form#whats-new-form{margin:0;padding:0}#buddypress .home-page form#whats-new-form{border-bottom:none;padding-bottom:0}#buddypress form#whats-new-form #whats-new-avatar{float:right}#buddypress form#whats-new-form #whats-new-content{margin-right:55px;padding:0 20px 20px 0}#buddypress form#whats-new-form p.activity-greeting{line-height:.5em;margin-bottom:15px;margin-right:75px}#buddypress form#whats-new-form textarea{background:#fff;box-sizing:border-box;color:#555;font-family:inherit;font-size:medium;height:2.2em;line-height:1.4;padding:6px;width:100%}body.no-js #buddypress form#whats-new-form textarea{height:50px}#buddypress form#whats-new-form #whats-new-options select{max-width:200px;margin-top:12px}#buddypress form#whats-new-form #whats-new-submit{float:left;margin-top:12px}#buddypress #whats-new-options:after{clear:both;content:"";display:table}body.no-js #buddypress #whats-new-options{height:auto}#buddypress #whats-new:focus{border-color:rgba(31,179,221,.9)!important;outline-color:rgba(31,179,221,.9)}#buddypress ul.activity-list li{overflow:hidden;padding:15px 0 0;list-style:none}#buddypress .activity-list .activity-avatar{float:right}#buddypress ul.item-list.activity-list li.has-comments{padding-bottom:15px}body.activity-permalink #buddypress ul.activity-list li.has-comments{padding-bottom:0}#buddypress .activity-list li.mini{font-size:80%;position:relative}#buddypress .activity-list li.mini .activity-avatar img.FB_profile_pic,#buddypress .activity-list li.mini .activity-avatar img.avatar{height:20px;margin-right:30px;width:20px}#buddypress .activity-permalink .activity-list li.mini .activity-avatar img.FB_profile_pic,#buddypress .activity-permalink .activity-list li.mini .activity-avatar img.avatar{height:auto;margin-right:0;width:auto}body.activity-permalink #buddypress .activity-list>li:first-child{padding-top:0}#buddypress .activity-list li .activity-content{position:relative}#buddypress .activity-list li.mini .activity-content p{margin:0}#buddypress .activity-list li.mini .activity-comments{clear:both;font-size:120%}body.activity-permalink #buddypress li.mini .activity-meta{margin-top:4px}#buddypress .activity-list li .activity-inreplyto{color:#767676;font-size:80%}#buddypress .activity-list li .activity-inreplyto>p{margin:0;display:inline}#buddypress .activity-list li .activity-inreplyto blockquote,#buddypress .activity-list li .activity-inreplyto div.activity-inner{background:0 0;border:none;display:inline;margin:0;overflow:hidden;padding:0}#buddypress .activity-list .activity-content{margin:0 70px 0 0}body.activity-permalink #buddypress .activity-list li .activity-content{border:none;font-size:100%;line-height:150%;margin-right:170px;margin-left:0;padding:0}body.activity-permalink #buddypress .activity-list li .activity-header>p{margin:0;padding:5px 0 0}#buddypress .activity-list .activity-content .activity-header,#buddypress .activity-list .activity-content .comment-header{color:#767676;line-height:220%}#buddypress .activity-header{margin-left:20px}#buddypress .acomment-meta a,#buddypress .activity-header a,#buddypress .comment-meta a{text-decoration:none}#buddypress .activity-list .activity-content .activity-header img.avatar{float:none!important;margin:0 0 -8px 5px!important}#buddypress a.bp-secondary-action,#buddypress span.highlight{font-size:80%;padding:0;margin-left:5px;text-decoration:none}#buddypress .activity-list .activity-content .activity-inner,#buddypress .activity-list .activity-content blockquote{margin:10px 0 5px 10px;overflow:hidden}#buddypress .activity-list li.new_forum_post .activity-content .activity-inner,#buddypress .activity-list li.new_forum_topic .activity-content .activity-inner{border-right:2px solid #EAEAEA;margin-right:5px;padding-right:10px}body.activity-permalink #buddypress .activity-content .activity-inner,body.activity-permalink #buddypress .activity-content blockquote{margin-right:0;margin-top:5px}#buddypress .activity-inner>p{word-wrap:break-word}#buddypress .activity-inner>.activity-inner,#buddypress .activity-inner>blockquote{margin:0}#buddypress .activity-list .activity-content img.thumbnail{border:2px solid #eee;float:right;margin:0 0 5px 10px}#buddypress .activity-read-more{margin-right:1em;white-space:nowrap}#buddypress .activity-list li.load-more,#buddypress .activity-list li.load-newest{background:#f0f0f0;font-size:110%;margin:15px 0;padding:10px 15px;text-align:center}#buddypress .activity-list li.load-more a,#buddypress .activity-list li.load-newest a{color:#4D4D4D}#buddypress div.activity-meta{margin:18px 0 0}body.activity-permalink #buddypress div.activity-meta{margin-bottom:6px}#buddypress div.activity-meta a{padding:4px 8px}#buddypress a.activity-time-since{color:#767676;text-decoration:none}#buddypress a.activity-time-since:hover{color:#767676;text-decoration:underline}#buddypress #reply-title small a,#buddypress a.bp-primary-action{font-size:80%;margin-left:5px;text-decoration:none}#buddypress #reply-title small a span,#buddypress a.bp-primary-action span{background:#767676;color:#fff;font-size:90%;margin-right:2px;padding:0 5px}#buddypress #reply-title small a:hover span,#buddypress a.bp-primary-action:hover span{background:#555;color:#fff}#buddypress div.activity-comments{margin:0 70px 0 0;overflow:hidden;position:relative;width:auto;clear:both}body.activity-permalink #buddypress div.activity-comments{background:0 0;margin-right:170px;width:auto}#buddypress div.activity-comments>ul{padding:0 10px 0 0}#buddypress div.activity-comments ul,#buddypress div.activity-comments ul li{border:none;list-style:none}#buddypress div.activity-comments ul{clear:both;margin:0}#buddypress div.activity-comments ul li{border-top:1px solid #eee;padding:10px 0 0}body.activity-permalink #buddypress .activity-list li.mini .activity-comments{clear:none;margin-top:0}body.activity-permalink #buddypress div.activity-comments ul li{border-width:1px;padding:10px 0 0}#buddypress div.activity-comments>ul>li:first-child{border-top:none}#buddypress div.activity-comments ul li:last-child{margin-bottom:0}#buddypress div.activity-comments ul li>ul{margin-right:30px;margin-top:0;padding-right:10px}body.activity-permalink #buddypress div.activity-comments ul li>ul{margin-top:10px}body.activity-permalink #buddypress div.activity-comments>ul{padding:0 15px 0 10px}#buddypress div.activity-comments div.acomment-avatar img{border-width:1px;float:right;height:25px;margin-left:10px;width:25px}#buddypress div.activity-comments div.acomment-content{font-size:80%;margin:5px 40px 0 0}#buddypress div.acomment-content .activity-delete-link,#buddypress div.acomment-content .comment-header,#buddypress div.acomment-content .time-since{display:none}body.activity-permalink #buddypress div.activity-comments div.acomment-content{font-size:90%}#buddypress div.activity-comments div.acomment-meta{color:#767676;font-size:80%}#buddypress div.activity-comments form.ac-form{display:none;padding:10px}#buddypress div.activity-comments li form.ac-form{margin-left:15px;clear:both}#buddypress div.activity-comments form.root{margin-right:0}#buddypress div.activity-comments div#message{margin-top:15px;margin-bottom:0}#buddypress div.activity-comments form .ac-textarea{background:#fff;border:1px inset #ccc;margin-bottom:10px;padding:8px}#buddypress div.activity-comments form textarea{border:none;background:0 0;box-shadow:none;outline:0;color:#555;font-family:inherit;font-size:100%;height:60px;padding:0;margin:0;width:100%}#buddypress div.activity-comments form input{margin-top:5px}#buddypress div.activity-comments form div.ac-reply-avatar{float:right}#buddypress div.ac-reply-avatar img{border:1px solid #eee}#buddypress div.activity-comments form div.ac-reply-content{color:#767676;margin-right:50px;padding-right:15px}#buddypress div.activity-comments form div.ac-reply-content a{text-decoration:none}#buddypress .acomment-options{float:right;margin:5px 40px 5px 0}#buddypress .acomment-options a{color:#767676}#buddypress .acomment-options a:hover{color:inherit}#buddypress div.dir-search{float:left;margin:-39px 0 0}#buddypress div.dir-search input[type=text],#buddypress li.groups-members-search input[type=text]{font-size:90%;padding:1px 3px}#buddypress .current-member-type{font-style:italic}#buddypress .dir-form{clear:both}#buddypress div#message{margin:0 0 15px}#buddypress #message.info{margin-bottom:0}#buddypress div#message.updated{clear:both;display:block}#buddypress div#message p,#sitewide-notice p{font-size:90%;display:block;padding:10px 15px}#buddypress div#message.error p{background-color:#fdc;border:1px solid #a00;clear:right;color:#800}#buddypress div#message.warning p{background-color:#ffe0af;border:1px solid #ffd087;clear:right;color:#800}#buddypress div#message.updated p{background-color:#efc;border:1px solid #591;color:#250}#buddypress #pass-strength-result{background-color:#eee;border-color:#ddd;border-style:solid;border-width:1px;display:none;margin:5px 0 5px 5px;padding:5px;text-align:center;width:150px}#buddypress .standard-form #basic-details-section #pass-strength-result{width:35%}#buddypress #pass-strength-result.bad,#buddypress #pass-strength-result.error{background-color:#ffb78c;border-color:#ff853c!important;display:block}#buddypress #pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;display:block}#buddypress #pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;display:block}#buddypress #pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;display:block}#buddypress .standard-form#signup_form div div.error{background:#faa;color:#a00;margin:0 0 10px;padding:6px;width:90%}#buddypress div.accept,#buddypress div.reject{float:right;margin-right:10px}#buddypress ul.button-nav li{float:right;margin:0 0 10px 10px;list-style:none}#sitewide-notice #message{right:2%;position:fixed;top:1em;width:96%;z-index:9999}#sitewide-notice.admin-bar-on #message{top:3.3em}#sitewide-notice strong{display:block;margin-bottom:-1em}#buddypress form fieldset{border:0;padding:0}#buddypress .dir-search input[type=search],#buddypress .dir-search input[type=text],#buddypress .groups-members-search input[type=search],#buddypress .groups-members-search input[type=text],#buddypress .standard-form input[type=color],#buddypress .standard-form input[type=date],#buddypress .standard-form input[type=datetime-local],#buddypress .standard-form input[type=datetime],#buddypress .standard-form input[type=email],#buddypress .standard-form input[type=month],#buddypress .standard-form input[type=number],#buddypress .standard-form input[type=password],#buddypress .standard-form input[type=range],#buddypress .standard-form input[type=search],#buddypress .standard-form input[type=tel],#buddypress .standard-form input[type=text],#buddypress .standard-form input[type=time],#buddypress .standard-form input[type=url],#buddypress .standard-form input[type=week],#buddypress .standard-form select,#buddypress .standard-form textarea{border:1px solid #ccc;background:#fafafa;border-radius:0;color:#767676;font:inherit;font-size:100%;padding:6px}#buddypress .standard-form select{padding:3px}#buddypress .standard-form input[type=password]{margin-bottom:5px}#buddypress .standard-form label,#buddypress .standard-form legend,#buddypress .standard-form span.label{display:block;font-weight:700;margin:15px 0 5px;width:auto}#buddypress .standard-form #invite-list label,#buddypress .standard-form p label{font-weight:400;margin:auto}#buddypress .standard-form .checkbox label,#buddypress .standard-form .radio label{color:#767676;font-size:100%;font-weight:400;margin:5px 0 0}#buddypress .standard-form .checkbox label input,#buddypress .standard-form .radio label input{margin-left:3px}#buddypress .standard-form#sidebar-login-form label{margin-top:5px}#buddypress .standard-form input[type=text]{width:75%}#buddypress .standard-form#sidebar-login-form input[type=password],#buddypress .standard-form#sidebar-login-form input[type=text]{padding:4px;width:95%}#buddypress .standard-form #basic-details-section input[type=password],#buddypress .standard-form #blog-details-section input#signup_blog_url{width:35%}#buddypress #commentform input[type=text],#buddypress #commentform textarea,#buddypress .form-allowed-tags,#buddypress .standard-form#signup_form input[type=text],#buddypress .standard-form#signup_form textarea{width:90%}#buddypress .standard-form#signup_form div.submit{float:left}#buddypress div#signup-avatar img{margin:0 0 10px 15px}#buddypress .standard-form textarea{width:75%;height:120px}#buddypress .standard-form textarea#message_content{height:200px}#buddypress .standard-form#send-reply textarea{width:97.5%}#buddypress .standard-form p.description{color:#767676;font-size:80%;margin:5px 0}#buddypress .standard-form div.submit{clear:both;padding:15px 0 0}#buddypress .standard-form p.submit{margin-bottom:0;padding:15px 0 0}#buddypress .standard-form div.submit input{margin-left:15px}#buddypress .standard-form div.radio ul{margin:10px 38px 15px 0;list-style:disc}#buddypress .standard-form div.radio ul li{margin-bottom:5px}#buddypress .standard-form a.clear-value{display:block;margin-top:5px;outline:0}#buddypress table.notification-settings td:first-child,#buddypress table.notification-settings th.icon,#buddypress table.notifications td:first-child,#buddypress table.notifications th.icon,body.no-js #buddypress #delete_inbox_messages,body.no-js #buddypress #delete_sentbox_messages,body.no-js #buddypress #message-type-select,body.no-js #buddypress #messages-bulk-management #select-all-messages,body.no-js #buddypress #notifications-bulk-management #select-all-notifications,body.no-js #buddypress label[for=message-type-select]{display:none}#buddypress .standard-form #basic-details-section,#buddypress .standard-form #blog-details-section,#buddypress .standard-form #profile-details-section{float:right;width:48%}#buddypress .standard-form #profile-details-section{float:left}#buddypress #notifications-bulk-management,#buddypress .standard-form #blog-details-section{clear:right}#buddypress .standard-form input:focus,#buddypress .standard-form select:focus,#buddypress .standard-form textarea:focus{background:#fafafa;color:#555}#buddypress form#send-invite-form{margin-top:20px}#buddypress div#invite-list{background:#f5f5f5;height:400px;margin:0 0 10px;overflow:auto;padding:5px;width:160px}#buddypress .comment-reply-link,#buddypress .generic-button a,#buddypress a.button,#buddypress button,#buddypress input[type=button],#buddypress input[type=reset],#buddypress input[type=submit],#buddypress ul.button-nav li a,a.bp-title-button{background:#fff;border:1px solid #ccc;color:#767676;font-size:small;cursor:pointer;outline:0;padding:4px 10px;text-align:center;text-decoration:none}#buddypress .comment-reply-link:hover,#buddypress a.button:focus,#buddypress a.button:hover,#buddypress button:hover,#buddypress div.generic-button a:hover,#buddypress input[type=button]:hover,#buddypress input[type=reset]:hover,#buddypress input[type=submit]:hover,#buddypress ul.button-nav li a:hover,#buddypress ul.button-nav li.current a{background:#ededed;border:1px solid #bbb;color:#555;outline:0;text-decoration:none}#buddypress form.standard-form .left-menu{float:right}#buddypress form.standard-form .left-menu #invite-list ul{margin:1%;list-style:none}#buddypress form.standard-form .left-menu #invite-list ul li{margin:0 1% 0 0}#buddypress form.standard-form .main-column{margin-right:190px}#buddypress form.standard-form .main-column ul#friend-list{clear:none;float:right}#buddypress form.standard-form .main-column ul#friend-list h4{clear:none}#buddypress .wp-editor-wrap a.button,#buddypress .wp-editor-wrap button,#buddypress .wp-editor-wrap input[type=button],#buddypress .wp-editor-wrap input[type=reset],#buddypress .wp-editor-wrap input[type=submit]{padding:0 8px 1px}#buddypress form [disabled=disabled]{cursor:default;opacity:.4}.bp-screen-reader-text{position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip:rect(0 0 0 0);border:0;word-wrap:normal!important}#buddypress a.loading,#buddypress input.loading{-webkit-animation:loader-pulsate .5s infinite ease-in-out alternate;-moz-animation:loader-pulsate .5s infinite ease-in-out alternate;border-color:#aaa}@-webkit-keyframes loader-pulsate{from{border-color:#aaa;-webkit-box-shadow:0 0 6px #ccc;box-shadow:0 0 6px #ccc}to{border-color:#ccc;-webkit-box-shadow:0 0 6px #f8f8f8;box-shadow:0 0 6px #f8f8f8}}@-moz-keyframes loader-pulsate{from{border-color:#aaa;-moz-box-shadow:0 0 6px #ccc;box-shadow:0 0 6px #ccc}to{border-color:#ccc;-moz-box-shadow:0 0 6px #f8f8f8;box-shadow:0 0 6px #f8f8f8}}#buddypress a.loading:hover,#buddypress input.loading:hover{color:#767676}#buddypress a.disabled,#buddypress button.disabled,#buddypress button.pending,#buddypress div.pending a,#buddypress input[type=submit].disabled,#buddypress input[type=submit].pending,#buddypress input[type=submit][disabled=disabled],#buddypress input[type=button].disabled,#buddypress input[type=button].pending,#buddypress input[type=reset].disabled,#buddypress input[type=reset].pending{border-color:#eee;color:#bbb;cursor:default}#buddypress a.disabled:hover,#buddypress button.disabled:hover,#buddypress button.pending:hover,#buddypress div.pending a:hover,#buddypress input[type=submit]:hover.disabled,#buddypress input[type=submit]:hover.pending,#buddypress input[type=button]:hover.disabled,#buddypress input[type=button]:hover.pending,#buddypress input[type=reset]:hover.disabled,#buddypress input[type=reset]:hover.pending{border-color:#eee;color:#bbb}#buddypress ul#topic-post-list{margin:0;width:auto}#buddypress ul#topic-post-list li{padding:15px;position:relative}#buddypress ul#topic-post-list li.alt{background:#f5f5f5}#buddypress ul#topic-post-list li div.poster-meta{color:#767676;margin-bottom:10px}#buddypress ul#topic-post-list li div.post-content{margin-right:54px}#buddypress div.topic-tags{font-size:80%}#buddypress div.admin-links{color:#767676;font-size:80%;position:absolute;top:15px;left:25px}#buddypress div#topic-meta{margin:0;padding:5px 19px 30px;position:relative}#buddypress div#topic-meta div.admin-links{left:19px;top:-36px}#buddypress div#topic-meta h3{margin:5px 0}#buddypress div#new-topic-post{display:none;margin:20px 0 0;padding:1px 0 0}#buddypress table.forum,#buddypress table.messages-notices,#buddypress table.notifications,#buddypress table.notifications-settings,#buddypress table.profile-fields,#buddypress table.profile-settings,#buddypress table.wp-profile-fields{width:100%}#buddypress table.forum thead tr,#buddypress table.messages-notices thead tr,#buddypress table.notifications thead tr,#buddypress table.notifications-settings thead tr,#buddypress table.profile-fields thead tr,#buddypress table.profile-settings thead tr,#buddypress table.wp-profile-fields thead tr{background:#eaeaea}#buddypress table#message-threads{clear:both}#buddypress table.profile-fields{margin-bottom:20px}#buddypress table tr td.thread-info p,#buddypress table.profile-fields p{margin:0}#buddypress table.profile-fields:last-child{margin-bottom:0}#buddypress table.profile-fields p:last-child{margin-top:0}#buddypress table.forum tr td,#buddypress table.forum tr th,#buddypress table.messages-notices tr td,#buddypress table.messages-notices tr th,#buddypress table.notifications tr td,#buddypress table.notifications tr th,#buddypress table.notifications-settings tr td,#buddypress table.notifications-settings tr th,#buddypress table.profile-fields tr td,#buddypress table.profile-fields tr th,#buddypress table.profile-settings tr td,#buddypress table.wp-profile-fields tr td,#buddypress table.wp-profile-fields tr th{padding:8px;vertical-align:middle}#buddypress table.forum tr td.label,#buddypress table.messages-notices tr td.label,#buddypress table.notifications tr td.label,#buddypress table.notifications-settings tr td.label,#buddypress table.profile-fields tr td.label,#buddypress table.wp-profile-fields tr td.label{border-left:1px solid #eaeaea;font-weight:700;width:25%}#buddypress #message-threads .thread-info{min-width:40%}#buddypress table tr td.thread-info p.thread-excerpt{color:#767676;font-size:80%;margin-top:3px}#buddypress table.forum td{text-align:center}#buddypress table.forum tr.alt td,#buddypress table.messages-notices tr.alt td,#buddypress table.notifications tr.alt td,#buddypress table.notifications-settings tr.alt td,#buddypress table.profile-fields tr.alt td,#buddypress table.profile-settings tr.alt td,#buddypress table.wp-profile-fields tr.alt td{background:#f5f5f5}#buddypress table.notification-settings{margin-bottom:20px;text-align:right}#buddypress #groups-notification-settings{margin-bottom:0}#buddypress table.notification-settings th.title,#buddypress table.profile-settings th.title{width:80%}#buddypress table.notification-settings .no,#buddypress table.notification-settings .yes{text-align:center;width:40px}#buddypress table.forum{margin:0;width:auto;clear:both}#buddypress table.forum tr.sticky td{font-size:110%;background:#fff9db;border-top:1px solid #ffe8c4;border-bottom:1px solid #ffe8c4}#buddypress table.forum tr.closed td.td-title{padding-right:35px}#buddypress table.forum td p.topic-text{color:#767676;font-size:100%}#buddypress table.forum tr>td:first-child,#buddypress table.forum tr>th:first-child{padding-right:15px}#buddypress table.forum tr>td:last-child,#buddypress table.forum tr>th:last-child{padding-left:15px}#buddypress table.forum td.td-group,#buddypress table.forum td.td-poster,#buddypress table.forum td.td-title,#buddypress table.forum tr th#th-group,#buddypress table.forum tr th#th-poster,#buddypress table.forum tr th#th-title{text-align:right}#buddypress table.forum tr td.td-title a.topic-title{font-size:110%}#buddypress table.forum td.td-freshness{white-space:nowrap}#buddypress table.forum td.td-freshness span.time-since{font-size:80%;color:#767676}#buddypress table.forum td img.avatar{float:none;margin:0 0 -8px 5px}#buddypress table.forum td.td-group,#buddypress table.forum td.td-poster{min-width:140px}#buddypress table.forum th#th-title{width:80%}#buddypress table.forum th#th-freshness{width:25%}#buddypress table.forum th#th-postcount{width:15%}#buddypress table.forum p.topic-meta{font-size:80%;margin:5px 0 0}#buddypress .item-body{margin:20px 0}#buddypress span.activity{display:inline-block;font-size:small;opacity:.8;padding:0}#buddypress span.user-nicename{color:#767676;display:inline-block;font-size:120%;font-weight:700}#buddypress div#message p,#sitewide-notice p{font-weight:400;margin-top:3px;text-decoration:none;background-color:#ffd;border:1px solid #cb2;color:#440}#buddypress #item-header:after{clear:both;content:"";display:table}#buddypress div#item-header div#item-header-content{float:right;margin-right:0}#buddypress div#item-header h2{line-height:120%;margin:0 0 15px}#buddypress div#item-header h2 a{color:#767676;text-decoration:none}#buddypress div#item-header img.avatar{float:right;margin:0 0 19px 15px}#buddypress div#item-header h2{margin-bottom:5px}#buddypress div#item-header h2 span.highlight{font-size:60%;font-weight:400;line-height:170%;vertical-align:middle;display:inline-block}#buddypress div#item-header ul h5,#buddypress div#item-header ul hr,#buddypress div#item-header ul span,body.no-js #buddypress div#item-header .js-self-profile-button{display:none}#buddypress div#item-header h2 span.highlight span{background:#a1dcfa;color:#fff;cursor:pointer;font-weight:700;font-size:80%;margin-bottom:2px;padding:1px 4px;position:relative;left:-2px;top:-2px;vertical-align:middle}#buddypress div#item-header div#item-meta{font-size:80%;color:#767676;overflow:hidden;margin:15px 0 5px;padding-bottom:10px}#buddypress div#item-header div#item-actions{float:left;margin:0 15px 15px 0;text-align:left;width:20%}#buddypress div#item-header div#item-actions h3{margin:0 0 5px}#buddypress div#item-header ul{margin-bottom:15px;overflow:hidden}#buddypress div#item-header ul li{float:left;list-style:none}#buddypress div#item-header ul img.avatar,#buddypress div#item-header ul.avatars img.avatar{height:30px;margin:2px;width:30px}#buddypress div#item-header a.button,#buddypress div#item-header div.generic-button{float:right;margin:10px 0 0 10px}#buddypress div#item-header div#message.info{line-height:80%}#buddypress ul.item-list{border-top:1px solid #eaeaea;width:100%;list-style:none;clear:both;margin:0;padding:0}body.activity-permalink #buddypress ul.item-list,body.activity-permalink #buddypress ul.item-list li.activity-item{border:none}#buddypress ul.item-list li{border-bottom:1px solid #eaeaea;padding:15px 0;margin:0;position:relative;list-style:none}#buddypress ul.single-line li{border:none}#buddypress ul.item-list li img.avatar{float:right;margin:0 0 0 10px}#buddypress ul.item-list li div.item-title,#buddypress ul.item-list li h4{font-weight:400;font-size:90%;margin:0;width:75%}#buddypress ul.item-list li div.item-title span{color:#767676;font-size:80%}#buddypress ul.item-list li div.item-desc{color:#767676;font-size:80%;margin:10px 60px 0 0;width:50%}#buddypress ul.item-list li.group-no-avatar div.item-desc{margin-right:0}#buddypress ul.item-list li div.action{position:absolute;top:15px;left:0;text-align:left}#buddypress ul.item-list li div.meta{color:#767676;font-size:80%;margin-top:10px}#buddypress ul.item-list li h5 span.small{float:left;font-size:80%;font-weight:400}#buddypress div.item-list-tabs{background:0 0;clear:right;overflow:hidden}#buddypress div.item-list-tabs ul{margin:0;padding:0}#buddypress div.item-list-tabs ul li{float:right;margin:0;list-style:none}#buddypress div.item-list-tabs#subnav ul li{margin-top:0}#buddypress div.item-list-tabs ul li.last{float:left;margin:7px 0 0}#buddypress div.item-list-tabs#subnav ul li.last{margin-top:4px}#buddypress div.item-list-tabs ul li.last select{max-width:185px}#buddypress div.item-list-tabs ul li a,#buddypress div.item-list-tabs ul li span{display:block;padding:5px 10px;text-decoration:none}#buddypress div.item-list-tabs ul li a span{background:#eee;border-radius:50%;border:1px solid #ccc;color:#6c6c6c;display:inline;font-size:70%;margin-right:2px;padding:3px 6px;text-align:center;vertical-align:middle}#buddypress div.item-list-tabs ul li.current a,#buddypress div.item-list-tabs ul li.selected a{background-color:#eee;color:#555;opacity:.8;font-weight:700}#buddypress div.item-list-tabs ul li a:hover span,#buddypress div.item-list-tabs ul li.current a span,#buddypress div.item-list-tabs ul li.selected a span{background-color:#eee}#buddypress div.item-list-tabs ul li.current a span,#buddypress div.item-list-tabs ul li.selected a span{background-color:#fff}#buddypress div#item-nav ul li.loading a{background-position:12% 50%}#buddypress div.item-list-tabs#object-nav{margin-top:0}#buddypress div.item-list-tabs#subnav{background:0 0;margin:10px 0;overflow:hidden}#buddypress #admins-list li,#buddypress #members-list li,#buddypress #mods-list li{overflow:auto;list-style:none}#buddypress div#message-thread div.message-metadata,.widget.buddypress div.avatar-block{overflow:hidden}#buddypress #item-buttons:empty{display:none}#buddypress #cover-image-container{position:relative;z-index:0}#buddypress #header-cover-image{background-color:#c5c5c5;background-position:center top;background-repeat:no-repeat;background-size:cover;border:0;display:block;right:0;margin:0;padding:0;position:absolute;top:0;width:100%;z-index:1}#buddypress #item-header-cover-image{padding:0 1em;position:relative;z-index:2}#buddypress table#message-threads tr.unread td{background:#fff9db;border-top:1px solid #ffe8c4;border-bottom:1px solid #ffe8c4;font-weight:700}#buddypress table#message-threads tr.unread td .activity,#buddypress table#message-threads tr.unread td .thread-excerpt,#buddypress table#message-threads tr.unread td.thread-options{font-weight:400}#buddypress li span.unread-count,#buddypress tr.unread span.unread-count{background:#d00;color:#fff;font-weight:700;padding:2px 8px}#buddypress div.item-list-tabs ul li a span.unread-count{padding:1px 6px;color:#fff}#buddypress div#message-thread div.message-box{margin:0;padding:15px}#buddypress div#message-thread div.alt{background:#f4f4f4}#buddypress div#message-thread p#message-recipients{margin:10px 0 20px}#buddypress div#message-thread img.avatar{float:right;margin:0 0 0 10px;vertical-align:middle}#buddypress div#message-thread strong{font-size:100%;margin:0}#buddypress div#message-thread strong a{text-decoration:none}#buddypress div#message-thread strong span.activity{margin-top:4px}#buddypress div#message-thread div.message-content{margin-right:45px}#buddypress div#message-thread div.message-options{text-align:left}#buddypress #message-threads img.avatar{max-width:none}#buddypress div.message-search{float:left;margin:0 20px}.message-metadata{position:relative}.message-star-actions{position:absolute;left:0;top:0}#buddypress a.message-action-star,#buddypress a.message-action-unstar{border-bottom:0;text-decoration:none;outline:0}a.message-action-star{opacity:.7}a.message-action-star:hover{opacity:1}.message-action-star span.icon:before,.message-action-unstar span.icon:before{font-family:dashicons;font-size:18px}.message-action-star span.icon:before{color:#767676;content:"\f154"}.message-action-unstar span.icon:before{color:#fcdd77;content:"\f155"}#buddypress div.profile h4{margin-bottom:auto;margin-top:15px}#buddypress #profile-edit-form ul.button-nav{margin-top:15px}body.no-js #buddypress .field-visibility-settings-close,body.no-js #buddypress .field-visibility-settings-toggle{display:none}#buddypress .field-visibility-settings{display:none;margin-top:10px}body.no-js #buddypress .field-visibility-settings{display:block}#buddypress .current-visibility-level{font-weight:700;font-style:normal}#buddypress .field-visibility-settings,#buddypress .field-visibility-settings-notoggle,#buddypress .field-visibility-settings-toggle{color:#767676}#buddypress .field-visibility-settings a,#buddypress .field-visibility-settings-toggle a{font-size:80%}body.register #buddypress div.page ul{list-style:none}#buddypress .standard-form .field-visibility-settings label{margin:0;font-weight:400}#buddypress .field-visibility-settings legend,#buddypress .field-visibility-settings-toggle{font-style:italic}#buddypress .field-visibility-settings .radio{list-style:none;margin-bottom:0}#buddypress .field-visibility select{margin:0}#buddypress .wp-editor-container{border:1px solid #dedede}#buddypress .html-active button.switch-html,#buddypress .tmce-active button.switch-tmce{border-bottom-color:transparent;border-bottom-right-radius:0;border-bottom-left-radius:0;background:#f5f5f5}#buddypress .standard-form .wp-editor-container textarea{width:100%;padding-top:0;padding-bottom:0}.widget.buddypress div.item-avatar img.avatar{float:right;margin:0 0 15px 10px}.widget.buddypress span.activity{display:inline-block;font-size:small;opacity:.8;padding:0}.widget.buddypress div.item-options{font-size:90%;margin:0 0 1em;padding:1em 0}.widget.buddypress div.item{margi
|