Version Description
= 5.2.0 = See: https://codex.buddypress.org/releases/version-5-2-0/
= 5.1.2 = See: https://codex.buddypress.org/releases/version-5-1-2/
= 5.1.1 = See: https://codex.buddypress.org/releases/version-5-1-1/
= 5.1.0 = See: https://codex.buddypress.org/releases/version-5-1-0/
= 5.0.0 = See: https://codex.buddypress.org/releases/version-5-0-0/
= 4.4.0 = See: https://codex.buddypress.org/releases/version-4-4-0/
= 4.3.0 = See: https://codex.buddypress.org/releases/version-4-3-0/
= 4.2.0 = See: https://codex.buddypress.org/releases/version-4-2-0/
= 4.1.0 = See: https://codex.buddypress.org/releases/version-4-1-0/
= 4.0.0 = See: https://codex.buddypress.org/releases/version-4-0-0/
Download this release
Release Info
Developer | imath |
Plugin | ![]() |
Version | 6.0.0-RC1 |
Comparing to | |
See all releases |
Code changes from version 5.2.0 to 6.0.0-RC1
- bp-activity/actions/feeds.php +17 -13
- bp-activity/admin/js/admin.js +20 -20
- bp-activity/bp-activity-admin.php +49 -14
- bp-activity/bp-activity-adminbar.php +2 -2
- bp-activity/bp-activity-akismet.php +1 -1
- bp-activity/bp-activity-embeds.php +7 -6
- bp-activity/bp-activity-filters.php +1 -1
- bp-activity/bp-activity-functions.php +74 -47
- bp-activity/bp-activity-notifications.php +26 -9
- bp-activity/bp-activity-template.php +23 -3
- bp-activity/classes/class-bp-activity-activity.php +32 -3
- bp-activity/classes/class-bp-activity-component.php +6 -2
- bp-activity/classes/class-bp-activity-list-table.php +79 -28
- bp-activity/classes/class-bp-akismet.php +35 -5
- bp-activity/classes/class-bp-rest-activity-endpoint.php +26 -6
- bp-activity/js/mentions.js +9 -9
- bp-activity/screens/permalink.php +2 -2
- bp-blogs/bp-blogs-activity.php +58 -31
- bp-blogs/bp-blogs-cache.php +1 -1
- bp-blogs/bp-blogs-functions.php +61 -46
- bp-blogs/bp-blogs-template.php +102 -31
- bp-blogs/classes/class-bp-blogs-blog.php +1 -1
- bp-blogs/classes/class-bp-blogs-component.php +28 -1
- bp-blogs/classes/class-bp-rest-attachments-blog-avatar-endpoint.php +305 -0
- bp-blogs/classes/class-bp-rest-blogs-endpoint.php +537 -0
- bp-blogs/screens/create.php +2 -4
- bp-core/admin/bp-core-admin-actions.php +1 -1
- bp-core/admin/bp-core-admin-components.php +54 -8
- bp-core/admin/bp-core-admin-functions.php +158 -103
- bp-core/admin/bp-core-admin-schema.php +3 -0
- bp-core/admin/bp-core-admin-settings.php +28 -20
- bp-core/admin/bp-core-admin-slugs.php +17 -4
- bp-core/admin/bp-core-admin-tools.php +75 -2
- bp-core/admin/css/common-rtl.css +5 -0
- bp-core/admin/css/common-rtl.min.css +1 -1
- bp-core/admin/css/common.css +5 -0
- bp-core/admin/css/common.min.css +1 -1
- bp-core/bp-core-actions.php +1 -0
- bp-core/bp-core-admin.php +1 -0
- bp-core/bp-core-adminbar.php +1 -1
- bp-core/bp-core-attachments.php +114 -61
- bp-core/bp-core-avatars.php +18 -20
- bp-core/bp-core-blocks.php +81 -0
- bp-core/bp-core-cache.php +3 -3
- bp-core/bp-core-catchuri.php +1 -1
- bp-core/bp-core-cssjs.php +2 -2
- bp-core/bp-core-dependency.php +15 -1
- bp-core/bp-core-filters.php +18 -2
- bp-core/bp-core-functions.php +38 -37
- bp-core/bp-core-template-loader.php +2 -2
- bp-core/bp-core-template.php +41 -10
- bp-core/bp-core-theme-compatibility.php +4 -4
- bp-core/bp-core-update.php +0 -1
- bp-core/bp-core-wpabstraction.php +165 -0
- bp-core/classes/class-bp-admin.php +106 -97
- bp-core/classes/class-bp-attachment-avatar.php +7 -4
- bp-core/classes/class-bp-attachment-cover-image.php +7 -4
- bp-core/classes/class-bp-attachment.php +12 -2
- bp-core/classes/class-bp-block.php +197 -0
- bp-core/classes/class-bp-component.php +43 -3
- bp-core/classes/class-bp-core-nav.php +10 -10
- bp-core/classes/class-bp-core-user.php +45 -5
- bp-core/classes/class-bp-invitation.php +40 -40
- bp-core/classes/class-bp-media-extractor.php +8 -3
- bp-core/classes/class-bp-phpmailer.php +1 -1
- bp-core/classes/class-bp-recursive-query.php +3 -3
- bp-core/classes/class-bp-rest-attachments-group-avatar-endpoint.php +4 -489
- bp-core/classes/class-bp-rest-attachments-member-avatar-endpoint.php +4 -505
- bp-core/classes/class-bp-rest-components-endpoint.php +5 -38
- bp-core/classes/class-bp-user-query.php +2 -2
- bp-core/classes/class-bp-walker-nav-menu.php +17 -10
- bp-core/classes/trait-attachments.php +166 -27
- bp-core/compat/php53/class-bp-compat-walker-nav-menu.php +0 -32
- bp-core/compat/php56/class-bp-compat-walker-nav-menu.php +0 -31
- bp-core/deprecated/1.2.php +12 -12
- bp-core/deprecated/1.5.php +18 -8
- bp-core/deprecated/1.6.php +8 -8
- bp-core/deprecated/1.7.php +2 -2
- bp-core/deprecated/1.9.php +22 -22
- bp-core/deprecated/2.0.php +1 -1
- bp-core/deprecated/2.1.php +40 -15
- bp-core/deprecated/2.2.php +3 -3
- bp-core/deprecated/2.5.php +2 -2
- bp-core/deprecated/2.8.php +11 -1
- bp-core/deprecated/3.0.php +10 -2
- bp-core/deprecated/6.0.php +159 -0
- bp-core/images/Jcrop.gif +0 -0
- bp-core/images/admin-menu-arrow.gif +0 -0
- bp-core/images/bp-blocks.gif +0 -0
- bp-core/images/bp-nouveau-improvements.png +0 -0
- bp-core/images/bp-nouveau-wide-aligns.png +0 -0
- bp-core/images/buddypress-blocks-category.png +0 -0
- bp-core/images/manage-members-interface.png +0 -0
- bp-core/images/mystery-man-50.jpg +0 -0
- bp-core/images/mystery-man.jpg +0 -0
- bp-core/images/site-health-buddypress-section.png +0 -0
- bp-core/js/avatar.js +61 -61
- bp-core/js/avatar.min.js +1 -1
- bp-core/js/block-components.js +23 -0
- bp-core/js/bp-api-request.js +2 -2
- bp-core/js/bp-plupload.js +23 -23
- bp-core/js/cover-image.js +26 -26
- bp-core/js/vendor/jquery-cookie.js +5 -5
- bp-core/js/vendor/jquery-scroll-to.js +20 -20
- bp-core/js/vendor/jquery.atwho.js +1 -1
- bp-core/js/vendor/jquery.caret.js +1 -1
- bp-core/js/vendor/moment-js/moment.js +218 -218
- bp-core/js/webcam.js +24 -24
- bp-friends/bp-friends-activity.php +3 -1
- bp-friends/bp-friends-functions.php +16 -1
- bp-friends/bp-friends-notifications.php +11 -7
- bp-friends/bp-friends-template.php +40 -19
- bp-friends/classes/class-bp-friends-component.php +17 -1
- bp-friends/classes/class-bp-rest-friends-endpoint.php +924 -0
- bp-groups/actions/feed.php +6 -3
- bp-groups/bp-groups-activity.php +13 -2
- bp-groups/bp-groups-admin.php +7 -1
- bp-groups/bp-groups-adminbar.php +4 -2
- bp-groups/bp-groups-blocks.php +203 -0
- bp-groups/bp-groups-functions.php +26 -2
- bp-groups/bp-groups-notifications.php +20 -5
- bp-groups/bp-groups-template.php +127 -91
- bp-groups/bp-groups-widgets.php +12 -2
- bp-groups/classes/class-bp-groups-component.php +77 -4
- bp-groups/classes/class-bp-groups-group-members-template.php +1 -0
- bp-groups/classes/class-bp-groups-invite-template.php +45 -7
- bp-groups/classes/class-bp-groups-list-table.php +78 -8
- bp-groups/classes/class-bp-groups-membership-requests-template.php +1 -0
- bp-groups/classes/class-bp-groups-widget.php +1 -0
- bp-groups/classes/class-bp-rest-attachments-group-avatar-endpoint.php +497 -0
- bp-groups/classes/class-bp-rest-attachments-group-cover-endpoint.php +430 -0
- bp-groups/classes/class-bp-rest-group-invites-endpoint.php +2 -4
- bp-groups/classes/class-bp-rest-group-membership-endpoint.php +25 -35
- bp-groups/classes/class-bp-rest-groups-endpoint.php +50 -7
- bp-groups/css/blocks/group-rtl.css +118 -0
- bp-groups/css/blocks/group-rtl.min.css +1 -0
- bp-groups/css/blocks/group.css +118 -0
- bp-groups/css/blocks/group.min.css +1 -0
- bp-groups/js/blocks/group.js +3 -0
- bp-groups/screens/user/invites.php +4 -2
- bp-loader.php +3 -3
- {bp-xprofile → bp-members}/actions/delete-avatar.php +6 -7
- bp-members/admin/css/admin-rtl.css +22 -14
- bp-members/admin/css/admin-rtl.min.css +1 -1
- bp-members/admin/css/admin.css +22 -14
- bp-members/admin/css/admin.min.css +1 -1
- bp-members/bp-members-activity.php +3 -1
- bp-members/bp-members-adminbar.php +9 -9
- bp-members/bp-members-blocks.php +194 -0
- bp-members/bp-members-functions.php +132 -5
- bp-members/bp-members-template.php +39 -1
- bp-members/classes/class-bp-members-admin.php +165 -9
- bp-members/classes/class-bp-members-component.php +264 -3
- bp-members/classes/class-bp-members-list-table.php +1 -0
- bp-members/classes/class-bp-members-ms-list-table.php +1 -0
- bp-members/classes/class-bp-rest-attachments-member-avatar-endpoint.php +513 -0
- bp-members/classes/class-bp-rest-attachments-member-cover-endpoint.php +430 -0
- bp-members/classes/class-bp-rest-members-endpoint.php +65 -18
- bp-members/classes/class-bp-rest-signup-endpoint.php +1067 -0
- bp-members/classes/class-bp-signup.php +9 -3
- bp-members/css/blocks/member-rtl.css +110 -0
- bp-members/css/blocks/member-rtl.min.css +1 -0
- bp-members/css/blocks/member.css +110 -0
- bp-members/css/blocks/member.min.css +1 -0
- bp-members/js/blocks/member.js +3 -0
- {bp-xprofile → bp-members}/screens/change-avatar.php +27 -21
- bp-members/screens/change-cover-image.php +42 -0
- bp-members/screens/profile.php +1 -1
- bp-messages/actions/bulk-manage-star.php +3 -1
- bp-messages/bp-messages-functions.php +1 -0
- bp-messages/bp-messages-notifications.php +5 -1
- bp-messages/bp-messages-template.php +11 -1
- bp-messages/classes/class-bp-messages-box-template.php +2 -2
- bp-messages/classes/class-bp-messages-notices-list-table.php +5 -4
- bp-messages/classes/class-bp-messages-thread.php +1 -0
- bp-messages/classes/class-bp-rest-messages-endpoint.php +110 -91
- bp-messages/screens/view.php +4 -2
- bp-notifications/bp-notifications-adminbar.php +3 -3
- bp-notifications/bp-notifications-cache.php +1 -1
- bp-notifications/bp-notifications-functions.php +19 -3
- bp-notifications/bp-notifications-template.php +1 -0
- bp-notifications/classes/class-bp-rest-notifications-endpoint.php +6 -6
- bp-settings/actions/delete-account.php +9 -2
- bp-settings/actions/general.php +1 -1
- bp-settings/bp-settings-template.php +18 -10
- bp-templates/bp-legacy/buddypress-functions.php +3 -0
- bp-templates/bp-legacy/buddypress/activity/comment.php +1 -1
- bp-templates/bp-legacy/buddypress/activity/entry.php +6 -1
- bp-templates/bp-legacy/buddypress/activity/index.php +41 -5
- bp-templates/bp-legacy/buddypress/activity/post-form.php +11 -5
- bp-templates/bp-legacy/buddypress/assets/emails/single-bp-email.php +3 -3
- bp-templates/bp-legacy/buddypress/blogs/index.php +14 -2
- bp-templates/bp-legacy/buddypress/groups/index.php +16 -2
- bp-templates/bp-legacy/buddypress/groups/single/request-membership.php +1 -1
- bp-templates/bp-legacy/buddypress/members/activate.php +6 -1
- bp-templates/bp-legacy/buddypress/members/register.php +1 -0
- bp-templates/bp-legacy/buddypress/members/single/groups/invites.php +10 -1
- bp-templates/bp-legacy/buddypress/members/single/messages/single.php +8 -2
- bp-templates/bp-legacy/buddypress/members/single/profile/edit.php +6 -1
- bp-templates/bp-legacy/buddypress/members/single/settings/data.php +12 -2
- bp-templates/bp-legacy/css/twentyfifteen.scss +0 -6
- bp-templates/bp-legacy/css/twentyseventeen-rtl.css +1 -1
- bp-templates/bp-legacy/css/twentyseventeen-rtl.min.css +1 -1
- bp-templates/bp-legacy/css/twentyseventeen.css +1 -1
- bp-templates/bp-legacy/css/twentyseventeen.min.css +1 -1
- bp-templates/bp-legacy/css/twentyseventeen.scss +4 -4
- bp-templates/bp-nouveau/buddypress-functions.php +19 -17
- bp-templates/bp-nouveau/buddypress/activity/index.php +2 -1
- bp-templates/bp-nouveau/buddypress/assets/emails/single-bp-email.php +1 -1
- bp-templates/bp-nouveau/buddypress/blogs/index.php +2 -1
- bp-templates/bp-nouveau/buddypress/common/js-templates/invites/index.php +2 -2
- bp-templates/bp-nouveau/buddypress/groups/groups-loop.php +1 -1
- bp-templates/bp-nouveau/buddypress/groups/index.php +2 -1
- bp-templates/bp-nouveau/buddypress/groups/single/cover-image-header.php +1 -1
- bp-templates/bp-nouveau/buddypress/groups/single/default-front.php +1 -0
- bp-templates/bp-nouveau/buddypress/groups/single/group-header.php +1 -1
- bp-templates/bp-nouveau/buddypress/groups/single/request-membership.php +1 -1
- bp-templates/bp-nouveau/buddypress/members/index.php +4 -1
- bp-templates/bp-nouveau/buddypress/members/members-loop.php +13 -11
- bp-templates/bp-nouveau/buddypress/members/single/default-front.php +1 -0
- bp-templates/bp-nouveau/buddypress/members/single/settings/general.php +0 -0
bp-activity/actions/feeds.php
CHANGED
@@ -24,9 +24,8 @@ function bp_activity_action_sitewide_feed() {
|
|
24 |
buddypress()->activity->feed = new BP_Activity_Feed( array(
|
25 |
'id' => 'sitewide',
|
26 |
|
27 |
-
/* translators:
|
28 |
'title' => sprintf( __( '%s | Site-Wide Activity', 'buddypress' ), bp_get_site_name() ),
|
29 |
-
|
30 |
'link' => bp_get_activity_directory_permalink(),
|
31 |
'description' => __( 'Activity feed for the entire site.', 'buddypress' ),
|
32 |
'activity_args' => 'display_comments=threaded'
|
@@ -50,10 +49,11 @@ function bp_activity_action_personal_feed() {
|
|
50 |
buddypress()->activity->feed = new BP_Activity_Feed( array(
|
51 |
'id' => 'personal',
|
52 |
|
53 |
-
/* translators:
|
54 |
-
'title' => sprintf(
|
55 |
-
|
56 |
'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() ),
|
|
|
|
|
57 |
'description' => sprintf( __( 'Activity feed for %s.', 'buddypress' ), bp_get_displayed_user_fullname() ),
|
58 |
'activity_args' => 'user_id=' . bp_displayed_user_id()
|
59 |
) );
|
@@ -76,10 +76,11 @@ function bp_activity_action_friends_feed() {
|
|
76 |
buddypress()->activity->feed = new BP_Activity_Feed( array(
|
77 |
'id' => 'friends',
|
78 |
|
79 |
-
/* translators:
|
80 |
'title' => sprintf( __( '%1$s | %2$s | Friends Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
|
81 |
-
|
82 |
'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() ),
|
|
|
|
|
83 |
'description' => sprintf( __( "Activity feed for %s's friends.", 'buddypress' ), bp_get_displayed_user_fullname() ),
|
84 |
'activity_args' => 'scope=friends'
|
85 |
) );
|
@@ -106,10 +107,11 @@ function bp_activity_action_my_groups_feed() {
|
|
106 |
buddypress()->activity->feed = new BP_Activity_Feed( array(
|
107 |
'id' => 'mygroups',
|
108 |
|
109 |
-
/* translators:
|
110 |
'title' => sprintf( __( '%1$s | %2$s | Group Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
|
111 |
-
|
112 |
'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() ),
|
|
|
|
|
113 |
'description' => sprintf( __( "Public group activity feed of which %s is a member.", 'buddypress' ), bp_get_displayed_user_fullname() ),
|
114 |
'activity_args' => array(
|
115 |
'object' => buddypress()->groups->id,
|
@@ -140,10 +142,11 @@ function bp_activity_action_mentions_feed() {
|
|
140 |
buddypress()->activity->feed = new BP_Activity_Feed( array(
|
141 |
'id' => 'mentions',
|
142 |
|
143 |
-
/* translators:
|
144 |
'title' => sprintf( __( '%1$s | %2$s | Mentions', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
|
145 |
-
|
146 |
'link' => bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/',
|
|
|
|
|
147 |
'description' => sprintf( __( "Activity feed mentioning %s.", 'buddypress' ), bp_get_displayed_user_fullname() ),
|
148 |
'activity_args' => array(
|
149 |
'search_terms' => '@' . bp_core_get_username( bp_displayed_user_id() )
|
@@ -172,10 +175,11 @@ function bp_activity_action_favorites_feed() {
|
|
172 |
buddypress()->activity->feed = new BP_Activity_Feed( array(
|
173 |
'id' => 'favorites',
|
174 |
|
175 |
-
/* translators:
|
176 |
'title' => sprintf( __( '%1$s | %2$s | Favorites', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
|
177 |
-
|
178 |
'link' => bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/',
|
|
|
|
|
179 |
'description' => sprintf( __( "Activity feed of %s's favorites.", 'buddypress' ), bp_get_displayed_user_fullname() ),
|
180 |
'activity_args' => 'include=' . $fav_ids
|
181 |
) );
|
24 |
buddypress()->activity->feed = new BP_Activity_Feed( array(
|
25 |
'id' => 'sitewide',
|
26 |
|
27 |
+
/* translators: %s Site Name */
|
28 |
'title' => sprintf( __( '%s | Site-Wide Activity', 'buddypress' ), bp_get_site_name() ),
|
|
|
29 |
'link' => bp_get_activity_directory_permalink(),
|
30 |
'description' => __( 'Activity feed for the entire site.', 'buddypress' ),
|
31 |
'activity_args' => 'display_comments=threaded'
|
49 |
buddypress()->activity->feed = new BP_Activity_Feed( array(
|
50 |
'id' => 'personal',
|
51 |
|
52 |
+
/* translators: 1: Site Name. 2: User Display Name. */
|
53 |
+
'title' => sprintf( _x( '%1$s | %2$s | Activity', 'Personal activity feed title', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
|
|
|
54 |
'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() ),
|
55 |
+
|
56 |
+
/* translators: %s: User Display Name */
|
57 |
'description' => sprintf( __( 'Activity feed for %s.', 'buddypress' ), bp_get_displayed_user_fullname() ),
|
58 |
'activity_args' => 'user_id=' . bp_displayed_user_id()
|
59 |
) );
|
76 |
buddypress()->activity->feed = new BP_Activity_Feed( array(
|
77 |
'id' => 'friends',
|
78 |
|
79 |
+
/* translators: 1: Site Name 2: User Display Name */
|
80 |
'title' => sprintf( __( '%1$s | %2$s | Friends Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
|
|
|
81 |
'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() ),
|
82 |
+
|
83 |
+
/* translators: %s: User Display Name */
|
84 |
'description' => sprintf( __( "Activity feed for %s's friends.", 'buddypress' ), bp_get_displayed_user_fullname() ),
|
85 |
'activity_args' => 'scope=friends'
|
86 |
) );
|
107 |
buddypress()->activity->feed = new BP_Activity_Feed( array(
|
108 |
'id' => 'mygroups',
|
109 |
|
110 |
+
/* translators: 1: Site Name 2: User Display Name */
|
111 |
'title' => sprintf( __( '%1$s | %2$s | Group Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
|
|
|
112 |
'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() ),
|
113 |
+
|
114 |
+
/* translators: %s: User Display Name */
|
115 |
'description' => sprintf( __( "Public group activity feed of which %s is a member.", 'buddypress' ), bp_get_displayed_user_fullname() ),
|
116 |
'activity_args' => array(
|
117 |
'object' => buddypress()->groups->id,
|
142 |
buddypress()->activity->feed = new BP_Activity_Feed( array(
|
143 |
'id' => 'mentions',
|
144 |
|
145 |
+
/* translators: 1: Site Name 2: User Display Name */
|
146 |
'title' => sprintf( __( '%1$s | %2$s | Mentions', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
|
|
|
147 |
'link' => bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/',
|
148 |
+
|
149 |
+
/* translators: %s: User Display Name */
|
150 |
'description' => sprintf( __( "Activity feed mentioning %s.", 'buddypress' ), bp_get_displayed_user_fullname() ),
|
151 |
'activity_args' => array(
|
152 |
'search_terms' => '@' . bp_core_get_username( bp_displayed_user_id() )
|
175 |
buddypress()->activity->feed = new BP_Activity_Feed( array(
|
176 |
'id' => 'favorites',
|
177 |
|
178 |
+
/* translators: 1: Site Name 2: User Display Name */
|
179 |
'title' => sprintf( __( '%1$s | %2$s | Favorites', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
|
|
|
180 |
'link' => bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/',
|
181 |
+
|
182 |
+
/* translators: %s: User Display Name */
|
183 |
'description' => sprintf( __( "Activity feed of %s's favorites.", 'buddypress' ), bp_get_displayed_user_fullname() ),
|
184 |
'activity_args' => 'include=' . $fav_ids
|
185 |
) );
|
bp-activity/admin/js/admin.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
(function( $ ) {
|
3 |
|
4 |
/**
|
5 |
-
* Activity reply object for the activity index screen
|
6 |
*
|
7 |
* @since 1.6.0
|
8 |
*/
|
@@ -18,7 +18,7 @@ var activityReply = {
|
|
18 |
$(document).on( 'click', '#bp-activities-container a.cancel', activityReply.close );
|
19 |
$(document).on( 'click', '#bp-activities-container a.save', activityReply.send );
|
20 |
|
21 |
-
// Close textarea on escape
|
22 |
$(document).on( 'keyup', '#bp-activities:visible', function( e ) {
|
23 |
if ( 27 === e.which ) {
|
24 |
activityReply.close();
|
@@ -32,7 +32,7 @@ var activityReply = {
|
|
32 |
* @since 1.6.0
|
33 |
*/
|
34 |
open : function() {
|
35 |
-
// Hide the container row, and move it to the new location
|
36 |
var box = $( '#bp-activities-container' ).hide();
|
37 |
$( this ).parents( 'tr' ).after( box );
|
38 |
|
@@ -49,13 +49,13 @@ var activityReply = {
|
|
49 |
* @since 1.6.0
|
50 |
*/
|
51 |
close : function() {
|
52 |
-
// Hide the container row
|
53 |
$('#bp-activities-container').fadeOut( '200', function () {
|
54 |
|
55 |
-
// Empty and unfocus the text area
|
56 |
$( '#bp-activities' ).val( '' ).blur();
|
57 |
|
58 |
-
// Remove any error message and disable the spinner
|
59 |
$( '#bp-replysubmit .error' ).html( '' ).hide();
|
60 |
$( '#bp-replysubmit .waiting' ).hide();
|
61 |
});
|
@@ -69,27 +69,27 @@ var activityReply = {
|
|
69 |
* @since 1.6.0
|
70 |
*/
|
71 |
send : function() {
|
72 |
-
// Hide any existing error message, and show the loading spinner
|
73 |
$( '#bp-replysubmit .error' ).hide();
|
74 |
$( '#bp-replysubmit .waiting' ).show();
|
75 |
|
76 |
-
// Grab the nonce
|
77 |
var reply = {};
|
78 |
reply['_ajax_nonce-bp-activity-admin-reply'] = $( '#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]' ).val();
|
79 |
|
80 |
-
// Get the rest of the data
|
81 |
reply.action = 'bp-activity-admin-reply';
|
82 |
reply.content = $( '#bp-activities' ).val();
|
83 |
reply.parent_id = $( '#bp-activities-container' ).prev().data( 'parent_id' );
|
84 |
reply.root_id = $( '#bp-activities-container' ).prev().data( 'root_id' );
|
85 |
|
86 |
-
// Make the AJAX call
|
87 |
$.ajax({
|
88 |
data : reply,
|
89 |
type : 'POST',
|
90 |
url : ajaxurl,
|
91 |
|
92 |
-
// Callbacks
|
93 |
error : function( r ) { activityReply.error( r ); },
|
94 |
success : function( r ) { activityReply.show( r ); }
|
95 |
});
|
@@ -98,7 +98,7 @@ var activityReply = {
|
|
98 |
},
|
99 |
|
100 |
/**
|
101 |
-
* send() error message handler
|
102 |
*
|
103 |
* @since 1.6.0
|
104 |
*/
|
@@ -116,14 +116,14 @@ var activityReply = {
|
|
116 |
},
|
117 |
|
118 |
/**
|
119 |
-
* send() success handler
|
120 |
*
|
121 |
* @since 1.6.0
|
122 |
*/
|
123 |
show : function ( xml ) {
|
124 |
var bg, id, response;
|
125 |
|
126 |
-
// Handle any errors in the response
|
127 |
if ( typeof( xml ) === 'string' ) {
|
128 |
activityReply.error( { 'responseText': xml } );
|
129 |
return false;
|
@@ -139,17 +139,17 @@ var activityReply = {
|
|
139 |
// Close and reset the reply row, and add the new Activity item into the list.
|
140 |
$('#bp-activities-container').fadeOut( '200', function () {
|
141 |
|
142 |
-
// Empty and unfocus the text area
|
143 |
$( '#bp-activities' ).val( '' ).blur();
|
144 |
|
145 |
-
// Remove any error message and disable the spinner
|
146 |
$( '#bp-replysubmit .error' ).html( '' ).hide();
|
147 |
$( '#bp-replysubmit .waiting' ).hide();
|
148 |
|
149 |
-
// Insert new activity item
|
150 |
$( '#bp-activities-container' ).before( response.data );
|
151 |
|
152 |
-
// Get background colour and animate the flash
|
153 |
id = $( '#activity-' + response.id );
|
154 |
bg = id.closest( '.widefat' ).css( 'backgroundColor' );
|
155 |
id.animate( { 'backgroundColor': '#CEB' }, 300 ).animate( { 'backgroundColor': bg }, 300 );
|
@@ -158,10 +158,10 @@ var activityReply = {
|
|
158 |
};
|
159 |
|
160 |
$(document).ready( function () {
|
161 |
-
// Create the Activity reply object after domready event
|
162 |
activityReply.init();
|
163 |
|
164 |
-
// On the edit screen, unload the close/open toggle js for the action & content metaboxes
|
165 |
$( '#bp_activity_action h3, #bp_activity_content h3' ).unbind( 'click' );
|
166 |
|
167 |
// redo the post box toggles to reset the one made by comment.js in favor
|
2 |
(function( $ ) {
|
3 |
|
4 |
/**
|
5 |
+
* Activity reply object for the activity index screen.
|
6 |
*
|
7 |
* @since 1.6.0
|
8 |
*/
|
18 |
$(document).on( 'click', '#bp-activities-container a.cancel', activityReply.close );
|
19 |
$(document).on( 'click', '#bp-activities-container a.save', activityReply.send );
|
20 |
|
21 |
+
// Close textarea on escape.
|
22 |
$(document).on( 'keyup', '#bp-activities:visible', function( e ) {
|
23 |
if ( 27 === e.which ) {
|
24 |
activityReply.close();
|
32 |
* @since 1.6.0
|
33 |
*/
|
34 |
open : function() {
|
35 |
+
// Hide the container row, and move it to the new location.
|
36 |
var box = $( '#bp-activities-container' ).hide();
|
37 |
$( this ).parents( 'tr' ).after( box );
|
38 |
|
49 |
* @since 1.6.0
|
50 |
*/
|
51 |
close : function() {
|
52 |
+
// Hide the container row.
|
53 |
$('#bp-activities-container').fadeOut( '200', function () {
|
54 |
|
55 |
+
// Empty and unfocus the text area.
|
56 |
$( '#bp-activities' ).val( '' ).blur();
|
57 |
|
58 |
+
// Remove any error message and disable the spinner.
|
59 |
$( '#bp-replysubmit .error' ).html( '' ).hide();
|
60 |
$( '#bp-replysubmit .waiting' ).hide();
|
61 |
});
|
69 |
* @since 1.6.0
|
70 |
*/
|
71 |
send : function() {
|
72 |
+
// Hide any existing error message, and show the loading spinner.
|
73 |
$( '#bp-replysubmit .error' ).hide();
|
74 |
$( '#bp-replysubmit .waiting' ).show();
|
75 |
|
76 |
+
// Grab the nonce.
|
77 |
var reply = {};
|
78 |
reply['_ajax_nonce-bp-activity-admin-reply'] = $( '#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]' ).val();
|
79 |
|
80 |
+
// Get the rest of the data.
|
81 |
reply.action = 'bp-activity-admin-reply';
|
82 |
reply.content = $( '#bp-activities' ).val();
|
83 |
reply.parent_id = $( '#bp-activities-container' ).prev().data( 'parent_id' );
|
84 |
reply.root_id = $( '#bp-activities-container' ).prev().data( 'root_id' );
|
85 |
|
86 |
+
// Make the AJAX call.
|
87 |
$.ajax({
|
88 |
data : reply,
|
89 |
type : 'POST',
|
90 |
url : ajaxurl,
|
91 |
|
92 |
+
// Callbacks.
|
93 |
error : function( r ) { activityReply.error( r ); },
|
94 |
success : function( r ) { activityReply.show( r ); }
|
95 |
});
|
98 |
},
|
99 |
|
100 |
/**
|
101 |
+
* send() error message handler.
|
102 |
*
|
103 |
* @since 1.6.0
|
104 |
*/
|
116 |
},
|
117 |
|
118 |
/**
|
119 |
+
* send() success handler.
|
120 |
*
|
121 |
* @since 1.6.0
|
122 |
*/
|
123 |
show : function ( xml ) {
|
124 |
var bg, id, response;
|
125 |
|
126 |
+
// Handle any errors in the response.
|
127 |
if ( typeof( xml ) === 'string' ) {
|
128 |
activityReply.error( { 'responseText': xml } );
|
129 |
return false;
|
139 |
// Close and reset the reply row, and add the new Activity item into the list.
|
140 |
$('#bp-activities-container').fadeOut( '200', function () {
|
141 |
|
142 |
+
// Empty and unfocus the text area.
|
143 |
$( '#bp-activities' ).val( '' ).blur();
|
144 |
|
145 |
+
// Remove any error message and disable the spinner.
|
146 |
$( '#bp-replysubmit .error' ).html( '' ).hide();
|
147 |
$( '#bp-replysubmit .waiting' ).hide();
|
148 |
|
149 |
+
// Insert new activity item.
|
150 |
$( '#bp-activities-container' ).before( response.data );
|
151 |
|
152 |
+
// Get background colour and animate the flash.
|
153 |
id = $( '#activity-' + response.id );
|
154 |
bg = id.closest( '.widefat' ).css( 'backgroundColor' );
|
155 |
id.animate( { 'backgroundColor': '#CEB' }, 300 ).animate( { 'backgroundColor': bg }, 300 );
|
158 |
};
|
159 |
|
160 |
$(document).ready( function () {
|
161 |
+
// Create the Activity reply object after domready event.
|
162 |
activityReply.init();
|
163 |
|
164 |
+
// On the edit screen, unload the close/open toggle js for the action & content metaboxes.
|
165 |
$( '#bp_activity_action h3, #bp_activity_content h3' ).unbind( 'click' );
|
166 |
|
167 |
// redo the post box toggles to reset the one made by comment.js in favor
|
bp-activity/bp-activity-admin.php
CHANGED
@@ -29,8 +29,8 @@ function bp_activity_add_admin_menu() {
|
|
29 |
|
30 |
// Add our screen.
|
31 |
$hook = add_menu_page(
|
32 |
-
_x( 'Activity', 'Admin
|
33 |
-
_x( 'Activity', 'Admin
|
34 |
'bp_moderate',
|
35 |
'bp-activity',
|
36 |
'bp_activity_admin',
|
@@ -75,7 +75,7 @@ function bp_activity_admin_reply() {
|
|
75 |
$parent_id = ! empty( $_REQUEST['parent_id'] ) ? (int) $_REQUEST['parent_id'] : 0;
|
76 |
$root_id = ! empty( $_REQUEST['root_id'] ) ? (int) $_REQUEST['root_id'] : 0;
|
77 |
|
78 |
-
// $parent_id is required
|
79 |
if ( empty( $parent_id ) )
|
80 |
die( '-1' );
|
81 |
|
@@ -356,7 +356,7 @@ function bp_activity_admin_load() {
|
|
356 |
check_admin_referer( 'spam-activity_' . $activity_ids[0] );
|
357 |
}
|
358 |
|
359 |
-
//
|
360 |
$deleted = $spammed = $unspammed = 0;
|
361 |
|
362 |
// Store any errors that occurs when updating the database items.
|
@@ -660,7 +660,12 @@ function bp_activity_admin_edit() {
|
|
660 |
do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) ); ?>
|
661 |
|
662 |
<div class="wrap">
|
663 |
-
<h1
|
|
|
|
|
|
|
|
|
|
|
664 |
|
665 |
<?php if ( ! empty( $activity ) ) : ?>
|
666 |
|
@@ -761,7 +766,12 @@ function bp_activity_admin_edit_metabox_status( $item ) {
|
|
761 |
$datef = __( 'M j, Y @ G:i', 'buddypress' );
|
762 |
$date = date_i18n( $datef, strtotime( $item->date_recorded ) );
|
763 |
?>
|
764 |
-
<span id="timestamp"
|
|
|
|
|
|
|
|
|
|
|
765 |
|
766 |
<div id='timestampdiv' class='hide-if-js'>
|
767 |
<?php touch_time( 1, 0, 5 ); ?>
|
@@ -899,7 +909,16 @@ function bp_activity_admin_edit_metabox_type( $item ) {
|
|
899 |
* of the list.
|
900 |
*/
|
901 |
if ( ! isset( $actions[ $selected ] ) ) {
|
902 |
-
_doing_it_wrong(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
903 |
$actions[ $selected ] = $selected;
|
904 |
}
|
905 |
|
@@ -973,11 +992,14 @@ function bp_activity_admin_index() {
|
|
973 |
// Reindex array.
|
974 |
$errors = array_values( $errors );
|
975 |
|
976 |
-
if ( $deleted > 0 )
|
|
|
977 |
$messages[] = sprintf( _n( '%s activity item has been permanently deleted.', '%s activity items have been permanently deleted.', $deleted, 'buddypress' ), number_format_i18n( $deleted ) );
|
|
|
978 |
|
979 |
if ( ! empty( $errors ) ) {
|
980 |
if ( 1 == count( $errors ) ) {
|
|
|
981 |
$messages[] = sprintf( __( 'An error occurred when trying to update activity ID #%s.', 'buddypress' ), number_format_i18n( $errors[0] ) );
|
982 |
|
983 |
} else {
|
@@ -986,7 +1008,7 @@ function bp_activity_admin_index() {
|
|
986 |
|
987 |
// Display each error as a list item.
|
988 |
foreach ( $errors as $error ) {
|
989 |
-
|
990 |
$error_msg .= '<li>' . sprintf( __( '#%s', 'buddypress' ), number_format_i18n( $error ) ) . '</li>';
|
991 |
}
|
992 |
|
@@ -995,14 +1017,19 @@ function bp_activity_admin_index() {
|
|
995 |
}
|
996 |
}
|
997 |
|
998 |
-
if ( $spammed > 0 )
|
|
|
999 |
$messages[] = sprintf( _n( '%s activity item has been successfully spammed.', '%s activity items have been successfully spammed.', $spammed, 'buddypress' ), number_format_i18n( $spammed ) );
|
|
|
1000 |
|
1001 |
-
if ( $unspammed > 0 )
|
|
|
1002 |
$messages[] = sprintf( _n( '%s activity item has been successfully unspammed.', '%s activity items have been successfully unspammed.', $unspammed, 'buddypress' ), number_format_i18n( $unspammed ) );
|
|
|
1003 |
|
1004 |
-
if ( $updated > 0 )
|
1005 |
$messages[] = __( 'The activity item has been updated successfully.', 'buddypress' );
|
|
|
1006 |
}
|
1007 |
|
1008 |
// Prepare the activity items for display.
|
@@ -1020,13 +1047,21 @@ function bp_activity_admin_index() {
|
|
1020 |
<div class="wrap">
|
1021 |
<h1>
|
1022 |
<?php if ( !empty( $_REQUEST['aid'] ) ) : ?>
|
1023 |
-
<?php
|
|
|
|
|
|
|
1024 |
<?php else : ?>
|
1025 |
<?php _ex( 'Activity', 'Admin SWA page', 'buddypress' ); ?>
|
1026 |
<?php endif; ?>
|
1027 |
|
1028 |
<?php if ( !empty( $_REQUEST['s'] ) ) : ?>
|
1029 |
-
<span class="subtitle"
|
|
|
|
|
|
|
|
|
|
|
1030 |
<?php endif; ?>
|
1031 |
</h1>
|
1032 |
|
29 |
|
30 |
// Add our screen.
|
31 |
$hook = add_menu_page(
|
32 |
+
_x( 'Activity', 'Admin Dashboard SWA page title', 'buddypress' ),
|
33 |
+
_x( 'Activity', 'Admin Dashboard SWA menu', 'buddypress' ),
|
34 |
'bp_moderate',
|
35 |
'bp-activity',
|
36 |
'bp_activity_admin',
|
75 |
$parent_id = ! empty( $_REQUEST['parent_id'] ) ? (int) $_REQUEST['parent_id'] : 0;
|
76 |
$root_id = ! empty( $_REQUEST['root_id'] ) ? (int) $_REQUEST['root_id'] : 0;
|
77 |
|
78 |
+
// $parent_id is required.
|
79 |
if ( empty( $parent_id ) )
|
80 |
die( '-1' );
|
81 |
|
356 |
check_admin_referer( 'spam-activity_' . $activity_ids[0] );
|
357 |
}
|
358 |
|
359 |
+
// Initialize counters for how many of each type of item we perform an action on.
|
360 |
$deleted = $spammed = $unspammed = 0;
|
361 |
|
362 |
// Store any errors that occurs when updating the database items.
|
660 |
do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) ); ?>
|
661 |
|
662 |
<div class="wrap">
|
663 |
+
<h1>
|
664 |
+
<?php
|
665 |
+
/* translators: %s: the activity ID */
|
666 |
+
printf( __( 'Editing Activity (ID #%s)', 'buddypress' ), number_format_i18n( (int) $_REQUEST['aid'] ) );
|
667 |
+
?>
|
668 |
+
</h1>
|
669 |
|
670 |
<?php if ( ! empty( $activity ) ) : ?>
|
671 |
|
766 |
$datef = __( 'M j, Y @ G:i', 'buddypress' );
|
767 |
$date = date_i18n( $datef, strtotime( $item->date_recorded ) );
|
768 |
?>
|
769 |
+
<span id="timestamp">
|
770 |
+
<?php
|
771 |
+
/* translators: %s: the date the activity was submitted on */
|
772 |
+
printf( __( 'Submitted on: %s', 'buddypress' ), '<strong>' . $date . '</strong>' );
|
773 |
+
?>
|
774 |
+
</span> <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e( 'Edit', 'buddypress' ); ?></a>
|
775 |
|
776 |
<div id='timestampdiv' class='hide-if-js'>
|
777 |
<?php touch_time( 1, 0, 5 ); ?>
|
909 |
* of the list.
|
910 |
*/
|
911 |
if ( ! isset( $actions[ $selected ] ) ) {
|
912 |
+
_doing_it_wrong(
|
913 |
+
__FUNCTION__,
|
914 |
+
sprintf(
|
915 |
+
/* translators: %s: the name of the activity type */
|
916 |
+
__( 'This activity item has a type (%s) that is not registered using bp_activity_set_action(), so no label is available.', 'buddypress' ),
|
917 |
+
$selected
|
918 |
+
),
|
919 |
+
'2.0.0'
|
920 |
+
);
|
921 |
+
|
922 |
$actions[ $selected ] = $selected;
|
923 |
}
|
924 |
|
992 |
// Reindex array.
|
993 |
$errors = array_values( $errors );
|
994 |
|
995 |
+
if ( $deleted > 0 ) {
|
996 |
+
/* translators: %s: the number of permanently deleted activities */
|
997 |
$messages[] = sprintf( _n( '%s activity item has been permanently deleted.', '%s activity items have been permanently deleted.', $deleted, 'buddypress' ), number_format_i18n( $deleted ) );
|
998 |
+
}
|
999 |
|
1000 |
if ( ! empty( $errors ) ) {
|
1001 |
if ( 1 == count( $errors ) ) {
|
1002 |
+
/* translators: %s: the ID of the activity which errored during an update */
|
1003 |
$messages[] = sprintf( __( 'An error occurred when trying to update activity ID #%s.', 'buddypress' ), number_format_i18n( $errors[0] ) );
|
1004 |
|
1005 |
} else {
|
1008 |
|
1009 |
// Display each error as a list item.
|
1010 |
foreach ( $errors as $error ) {
|
1011 |
+
/* Translators: %s: the activity ID */
|
1012 |
$error_msg .= '<li>' . sprintf( __( '#%s', 'buddypress' ), number_format_i18n( $error ) ) . '</li>';
|
1013 |
}
|
1014 |
|
1017 |
}
|
1018 |
}
|
1019 |
|
1020 |
+
if ( $spammed > 0 ) {
|
1021 |
+
/* translators: %s: the number of activities successfully marked as spam */
|
1022 |
$messages[] = sprintf( _n( '%s activity item has been successfully spammed.', '%s activity items have been successfully spammed.', $spammed, 'buddypress' ), number_format_i18n( $spammed ) );
|
1023 |
+
}
|
1024 |
|
1025 |
+
if ( $unspammed > 0 ) {
|
1026 |
+
/* translators: %s: the number of activities successfully marked as ham */
|
1027 |
$messages[] = sprintf( _n( '%s activity item has been successfully unspammed.', '%s activity items have been successfully unspammed.', $unspammed, 'buddypress' ), number_format_i18n( $unspammed ) );
|
1028 |
+
}
|
1029 |
|
1030 |
+
if ( $updated > 0 ) {
|
1031 |
$messages[] = __( 'The activity item has been updated successfully.', 'buddypress' );
|
1032 |
+
}
|
1033 |
}
|
1034 |
|
1035 |
// Prepare the activity items for display.
|
1047 |
<div class="wrap">
|
1048 |
<h1>
|
1049 |
<?php if ( !empty( $_REQUEST['aid'] ) ) : ?>
|
1050 |
+
<?php
|
1051 |
+
/* translators: %s: the activity ID */
|
1052 |
+
printf( __( 'Activity related to ID #%s', 'buddypress' ), number_format_i18n( (int) $_REQUEST['aid'] ) );
|
1053 |
+
?>
|
1054 |
<?php else : ?>
|
1055 |
<?php _ex( 'Activity', 'Admin SWA page', 'buddypress' ); ?>
|
1056 |
<?php endif; ?>
|
1057 |
|
1058 |
<?php if ( !empty( $_REQUEST['s'] ) ) : ?>
|
1059 |
+
<span class="subtitle">
|
1060 |
+
<?php
|
1061 |
+
/* translators: %s: the activity search terms */
|
1062 |
+
printf( __( 'Search results for “%s”', 'buddypress' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50 ) );
|
1063 |
+
?>
|
1064 |
+
</span>
|
1065 |
<?php endif; ?>
|
1066 |
</h1>
|
1067 |
|
bp-activity/bp-activity-adminbar.php
CHANGED
@@ -26,7 +26,7 @@ function bp_activity_admin_menu() {
|
|
26 |
return;
|
27 |
}
|
28 |
|
29 |
-
// Only show this menu to super admins
|
30 |
if ( ! bp_current_user_can( 'bp_moderate' ) ) {
|
31 |
return;
|
32 |
}
|
@@ -38,7 +38,7 @@ function bp_activity_admin_menu() {
|
|
38 |
), bp_get_admin_url( 'admin.php' ) );
|
39 |
|
40 |
// Add the top-level Edit Activity button.
|
41 |
-
$wp_admin_bar->
|
42 |
'id' => 'activity-admin',
|
43 |
'title' => __( 'Edit Activity', 'buddypress' ),
|
44 |
'href' => esc_url( $activity_edit_link ),
|
26 |
return;
|
27 |
}
|
28 |
|
29 |
+
// Only show this menu to super admins.
|
30 |
if ( ! bp_current_user_can( 'bp_moderate' ) ) {
|
31 |
return;
|
32 |
}
|
38 |
), bp_get_admin_url( 'admin.php' ) );
|
39 |
|
40 |
// Add the top-level Edit Activity button.
|
41 |
+
$wp_admin_bar->add_node( array(
|
42 |
'id' => 'activity-admin',
|
43 |
'title' => __( 'Edit Activity', 'buddypress' ),
|
44 |
'href' => esc_url( $activity_edit_link ),
|
bp-activity/bp-activity-akismet.php
CHANGED
@@ -60,7 +60,7 @@ function bp_activity_akismet_delete_old_metadata() {
|
|
60 |
// Enforce a minimum of 1 day.
|
61 |
$interval = max( 1, absint( $interval ) );
|
62 |
|
63 |
-
// _bp_akismet_submission meta values are large, so expire them after $interval days regardless of the activity status
|
64 |
$sql = $wpdb->prepare( "SELECT a.id FROM {$bp->activity->table_name} a LEFT JOIN {$bp->activity->table_name_meta} m ON a.id = m.activity_id WHERE m.meta_key = %s AND DATE_SUB(%s, INTERVAL {$interval} DAY) > a.date_recorded LIMIT 10000", '_bp_akismet_submission', current_time( 'mysql', 1 ) );
|
65 |
$activity_ids = $wpdb->get_col( $sql );
|
66 |
|
60 |
// Enforce a minimum of 1 day.
|
61 |
$interval = max( 1, absint( $interval ) );
|
62 |
|
63 |
+
// _bp_akismet_submission meta values are large, so expire them after $interval days regardless of the activity status.
|
64 |
$sql = $wpdb->prepare( "SELECT a.id FROM {$bp->activity->table_name} a LEFT JOIN {$bp->activity->table_name_meta} m ON a.id = m.activity_id WHERE m.meta_key = %s AND DATE_SUB(%s, INTERVAL {$interval} DAY) > a.date_recorded LIMIT 10000", '_bp_akismet_submission', current_time( 'mysql', 1 ) );
|
65 |
$activity_ids = $wpdb->get_col( $sql );
|
66 |
|
bp-activity/bp-activity-embeds.php
CHANGED
@@ -100,7 +100,7 @@ function bp_activity_embed_has_activity( $activity_id = 0 ) {
|
|
100 |
$activity = (array) $activities_template->activities;
|
101 |
$activity = reset( $activity );
|
102 |
|
103 |
-
// No need to requery if we already got the embed activity
|
104 |
if ( (int) $activity_id === $activity->id ) {
|
105 |
return $activities_template->has_activities();
|
106 |
}
|
@@ -234,10 +234,10 @@ function bp_activity_embed_media() {
|
|
234 |
$thumbnail = $oembed->thumbnail_url;
|
235 |
|
236 |
/* Non-oEmbed standard attributes */
|
237 |
-
// Mixcloud
|
238 |
} elseif ( isset( $oembed->image ) ) {
|
239 |
$thumbnail = $oembed->image;
|
240 |
-
// ReverbNation
|
241 |
} elseif ( isset( $oembed->{'thumbnail-url'} ) ) {
|
242 |
$thumbnail = $oembed->{'thumbnail-url'};
|
243 |
}
|
@@ -261,7 +261,7 @@ EOD;
|
|
261 |
$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 );
|
262 |
}
|
263 |
|
264 |
-
// Thumb width
|
265 |
$thumb_width = isset( $oembed->thumbnail_width ) && 'photo' !== $oembed->type && (int) $oembed->thumbnail_width < 550 ? (int) $oembed->thumbnail_width : $width;
|
266 |
|
267 |
$float_width = 350;
|
@@ -274,17 +274,18 @@ EOD;
|
|
274 |
$caption .= sprintf( '<p class="caption-title"><strong>%s</strong></p>', apply_filters( 'single_post_title', $oembed->title ) );
|
275 |
}
|
276 |
|
277 |
-
// Show description (non-oEmbed standard)
|
278 |
if ( isset( $oembed->description ) ) {
|
279 |
$caption .= sprintf( '<div class="caption-description">%s</div>', apply_filters( 'bp_activity_get_embed_excerpt', $oembed->description ) );
|
280 |
}
|
281 |
|
282 |
// Show author info.
|
283 |
if ( isset( $oembed->provider_name ) && isset( $oembed->author_name ) ) {
|
284 |
-
/* translators:
|
285 |
$anchor_text = sprintf( __( 'By %1$s on %2$s', 'buddypress' ), $oembed->author_name, $oembed->provider_name );
|
286 |
|
287 |
} elseif ( isset( $oembed->provider_name ) ) {
|
|
|
288 |
$anchor_text = sprintf( __( 'View on %s', 'buddypress' ), $oembed->provider_name );
|
289 |
}
|
290 |
|
100 |
$activity = (array) $activities_template->activities;
|
101 |
$activity = reset( $activity );
|
102 |
|
103 |
+
// No need to requery if we already got the embed activity.
|
104 |
if ( (int) $activity_id === $activity->id ) {
|
105 |
return $activities_template->has_activities();
|
106 |
}
|
234 |
$thumbnail = $oembed->thumbnail_url;
|
235 |
|
236 |
/* Non-oEmbed standard attributes */
|
237 |
+
// Mixcloud.
|
238 |
} elseif ( isset( $oembed->image ) ) {
|
239 |
$thumbnail = $oembed->image;
|
240 |
+
// ReverbNation.
|
241 |
} elseif ( isset( $oembed->{'thumbnail-url'} ) ) {
|
242 |
$thumbnail = $oembed->{'thumbnail-url'};
|
243 |
}
|
261 |
$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 );
|
262 |
}
|
263 |
|
264 |
+
// Thumb width.
|
265 |
$thumb_width = isset( $oembed->thumbnail_width ) && 'photo' !== $oembed->type && (int) $oembed->thumbnail_width < 550 ? (int) $oembed->thumbnail_width : $width;
|
266 |
|
267 |
$float_width = 350;
|
274 |
$caption .= sprintf( '<p class="caption-title"><strong>%s</strong></p>', apply_filters( 'single_post_title', $oembed->title ) );
|
275 |
}
|
276 |
|
277 |
+
// Show description (non-oEmbed standard).
|
278 |
if ( isset( $oembed->description ) ) {
|
279 |
$caption .= sprintf( '<div class="caption-description">%s</div>', apply_filters( 'bp_activity_get_embed_excerpt', $oembed->description ) );
|
280 |
}
|
281 |
|
282 |
// Show author info.
|
283 |
if ( isset( $oembed->provider_name ) && isset( $oembed->author_name ) ) {
|
284 |
+
/* translators: 1: oEmbed author. 2: oEmbed provider. eg. By BuddyPress on YouTube. */
|
285 |
$anchor_text = sprintf( __( 'By %1$s on %2$s', 'buddypress' ), $oembed->author_name, $oembed->provider_name );
|
286 |
|
287 |
} elseif ( isset( $oembed->provider_name ) ) {
|
288 |
+
/* translators: %s: oEmbed provider. */
|
289 |
$anchor_text = sprintf( __( 'View on %s', 'buddypress' ), $oembed->provider_name );
|
290 |
}
|
291 |
|
bp-activity/bp-activity-filters.php
CHANGED
@@ -615,7 +615,7 @@ function bp_activity_heartbeat_strings( $strings = array() ) {
|
|
615 |
*/
|
616 |
$heartbeat_settings = apply_filters( 'heartbeat_settings', array() );
|
617 |
if ( ! empty( $heartbeat_settings['interval'] ) ) {
|
618 |
-
// 'Fast' is 5
|
619 |
$global_pulse = is_numeric( $heartbeat_settings['interval'] ) ? absint( $heartbeat_settings['interval'] ) : 5;
|
620 |
}
|
621 |
|
615 |
*/
|
616 |
$heartbeat_settings = apply_filters( 'heartbeat_settings', array() );
|
617 |
if ( ! empty( $heartbeat_settings['interval'] ) ) {
|
618 |
+
// 'Fast' is 5.
|
619 |
$global_pulse = is_numeric( $heartbeat_settings['interval'] ) ? absint( $heartbeat_settings['interval'] ) : 5;
|
620 |
}
|
621 |
|
bp-activity/bp-activity-functions.php
CHANGED
@@ -522,12 +522,12 @@ function bp_activity_get_post_type_tracking_args( $post_type ) {
|
|
522 |
$post_type_activity->new_post_type_action_ms = $post_type_object->labels->bp_activity_new_post_ms;
|
523 |
}
|
524 |
|
525 |
-
// If the post type supports comments and has a comment action id, build the comments tracking args
|
526 |
if ( $post_type_support_comments && ! empty( $post_type_activity->comment_action_id ) ) {
|
527 |
-
// Init a new container for the activity type for comments
|
528 |
$post_type_activity->comments_tracking = new stdClass();
|
529 |
|
530 |
-
// Build the activity type for comments
|
531 |
$post_type_activity->comments_tracking->component_id = $post_type_activity->component_id;
|
532 |
$post_type_activity->comments_tracking->action_id = $post_type_activity->comment_action_id;
|
533 |
|
@@ -597,9 +597,9 @@ function bp_activity_get_post_types_tracking_args() {
|
|
597 |
$track_post_type = bp_activity_get_post_type_tracking_args( $post_type );
|
598 |
|
599 |
if ( ! empty( $track_post_type ) ) {
|
600 |
-
// Set the post type comments tracking args
|
601 |
if ( ! empty( $track_post_type->comments_tracking->action_id ) ) {
|
602 |
-
// Used to check support for comment tracking by activity type (new_post_type_comment)
|
603 |
$track_post_type->comments_tracking->comments_tracking = true;
|
604 |
|
605 |
// Used to be able to find the post type this activity type is associated to.
|
@@ -607,7 +607,7 @@ function bp_activity_get_post_types_tracking_args() {
|
|
607 |
|
608 |
$post_types_tracking_args[ $track_post_type->comments_tracking->action_id ] = $track_post_type->comments_tracking;
|
609 |
|
610 |
-
// Used to check support for comment tracking by activity type (new_post_type)
|
611 |
$track_post_type->comments_tracking = true;
|
612 |
}
|
613 |
|
@@ -650,7 +650,7 @@ function bp_activity_type_supports( $activity_type = '', $feature = '' ) {
|
|
650 |
* eg. 'new_blog_post' and 'new_blog_comment' will both return true.
|
651 |
*/
|
652 |
case 'post-type-comment-tracking' :
|
653 |
-
// Set the activity track global if not set yet
|
654 |
if ( empty( $bp->activity->track ) ) {
|
655 |
$bp->activity->track = bp_activity_get_post_types_tracking_args();
|
656 |
}
|
@@ -726,7 +726,7 @@ function bp_activity_post_type_get_tracking_arg( $activity_type, $arg = '' ) {
|
|
726 |
|
727 |
$bp = buddypress();
|
728 |
|
729 |
-
// Set the activity track global if not set yet
|
730 |
if ( empty( $bp->activity->track ) ) {
|
731 |
$bp->activity->track = bp_activity_get_post_types_tracking_args();
|
732 |
}
|
@@ -1277,7 +1277,22 @@ function bp_activity_remove_all_user_data( $user_id = 0 ) {
|
|
1277 |
do_action( 'bp_activity_remove_all_user_data', $user_id );
|
1278 |
}
|
1279 |
add_action( 'wpmu_delete_user', 'bp_activity_remove_all_user_data' );
|
1280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1281 |
|
1282 |
/**
|
1283 |
* Mark all of the user's activity as spam.
|
@@ -1523,7 +1538,11 @@ function bp_activity_generate_action_string( $activity ) {
|
|
1523 |
* @return string $action
|
1524 |
*/
|
1525 |
function bp_activity_format_activity_action_activity_update( $action, $activity ) {
|
1526 |
-
$action = sprintf(
|
|
|
|
|
|
|
|
|
1527 |
|
1528 |
/**
|
1529 |
* Filters the formatted activity action update string.
|
@@ -1546,7 +1565,11 @@ function bp_activity_format_activity_action_activity_update( $action, $activity
|
|
1546 |
* @return string $action
|
1547 |
*/
|
1548 |
function bp_activity_format_activity_action_activity_comment( $action, $activity ) {
|
1549 |
-
$action = sprintf(
|
|
|
|
|
|
|
|
|
1550 |
|
1551 |
/**
|
1552 |
* Filters the formatted activity action comment string.
|
@@ -1597,13 +1620,14 @@ function bp_activity_format_activity_action_custom_post_type_post( $action, $act
|
|
1597 |
if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_action_ms ) ) {
|
1598 |
$action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_action_ms, $user_link, esc_url( $post_url ), $blog_link );
|
1599 |
} else {
|
1600 |
-
|
1601 |
$action = sprintf( esc_html_x( '%1$s wrote a new %2$s, on the site %3$s', 'Activity Custom Post Type post action', 'buddypress' ), $user_link, $post_link, $blog_link );
|
1602 |
}
|
1603 |
} else {
|
1604 |
if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_action ) ) {
|
1605 |
$action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_action, $user_link, $post_url );
|
1606 |
} else {
|
|
|
1607 |
$action = sprintf( esc_html_x( '%1$s wrote a new %2$s', 'Activity Custom Post Type post action', 'buddypress' ), $user_link, $post_link );
|
1608 |
}
|
1609 |
}
|
@@ -1650,12 +1674,14 @@ function bp_activity_format_activity_action_custom_post_type_comment( $action, $
|
|
1650 |
if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_comment_action_ms ) ) {
|
1651 |
$action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_comment_action_ms, $user_link, $activity->primary_link, $blog_link );
|
1652 |
} else {
|
|
|
1653 |
$action = sprintf( esc_html_x( '%1$s commented on the %2$s, on the site %3$s', 'Activity Custom Post Type comment action', 'buddypress' ), $user_link, $post_link, $blog_link );
|
1654 |
}
|
1655 |
} else {
|
1656 |
if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_comment_action ) ) {
|
1657 |
$action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_comment_action, $user_link, $activity->primary_link );
|
1658 |
} else {
|
|
|
1659 |
$action = sprintf( esc_html_x( '%1$s commented on the %2$s', 'Activity Custom Post Type post comment action', 'buddypress' ), $user_link, $post_link );
|
1660 |
}
|
1661 |
}
|
@@ -1702,17 +1728,17 @@ function bp_activity_get( $args = '' ) {
|
|
1702 |
'max' => false, // Maximum number of results to return.
|
1703 |
'fields' => 'all',
|
1704 |
'page' => 1, // Page 1 without a per_page will result in no pagination.
|
1705 |
-
'per_page' => false, // results per page
|
1706 |
-
'sort' => 'DESC', // sort ASC or DESC
|
1707 |
'display_comments' => false, // False for no comments. 'stream' for within stream display, 'threaded' for below each activity item.
|
1708 |
|
1709 |
-
'search_terms' => false, // Pass search terms as a string
|
1710 |
-
'meta_query' => false, // Filter by activity meta. See WP_Meta_Query for format
|
1711 |
'date_query' => false, // Filter by date. See first parameter of WP_Date_Query for format.
|
1712 |
'filter_query' => false,
|
1713 |
'show_hidden' => false, // Show activity items that are hidden site-wide?
|
1714 |
'exclude' => false, // Comma-separated list of activity IDs to exclude.
|
1715 |
-
'in' => false, // Comma-separated list or array of activity IDs to which you
|
1716 |
// want to limit the query.
|
1717 |
'spam' => 'ham_only', // 'ham_only' (default), 'spam_only' or 'all'.
|
1718 |
'update_meta_cache' => true,
|
@@ -1788,7 +1814,7 @@ function bp_activity_get_specific( $args = '' ) {
|
|
1788 |
'page' => 1, // Page 1 without a per_page will result in no pagination.
|
1789 |
'per_page' => false, // Results per page.
|
1790 |
'show_hidden' => true, // When fetching specific items, show all.
|
1791 |
-
'sort' => 'DESC', // Sort ASC or DESC
|
1792 |
'spam' => 'ham_only', // Retrieve items marked as spam.
|
1793 |
'update_meta_cache' => true,
|
1794 |
), 'activity_get_specific' );
|
@@ -1861,8 +1887,8 @@ function bp_activity_add( $args = '' ) {
|
|
1861 |
|
1862 |
$r = bp_parse_args( $args, array(
|
1863 |
'id' => false, // Pass an existing activity ID to update an existing entry.
|
1864 |
-
'action' => '', // The activity action - e.g. "Jon Doe posted an update"
|
1865 |
-
'content' => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"
|
1866 |
'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent.
|
1867 |
'type' => false, // The activity type e.g. activity_update, profile_updated.
|
1868 |
'primary_link' => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink).
|
@@ -2298,20 +2324,20 @@ function bp_activity_post_type_unpublish( $post_id = 0, $post = null ) {
|
|
2298 |
* @return null|WP_Error|bool|int The ID of the activity on success. False on error.
|
2299 |
*/
|
2300 |
function bp_activity_post_type_comment( $comment_id = 0, $is_approved = true, $activity_post_object = null ) {
|
2301 |
-
// Get the users comment
|
2302 |
$post_type_comment = get_comment( $comment_id );
|
2303 |
|
2304 |
-
// Don't record activity if the comment hasn't been approved
|
2305 |
if ( empty( $is_approved ) ) {
|
2306 |
return false;
|
2307 |
}
|
2308 |
|
2309 |
-
// Don't record activity if no email address has been included
|
2310 |
if ( empty( $post_type_comment->comment_author_email ) ) {
|
2311 |
return false;
|
2312 |
}
|
2313 |
|
2314 |
-
// Don't record activity if the comment has already been marked as spam
|
2315 |
if ( 'spam' === $is_approved ) {
|
2316 |
return false;
|
2317 |
}
|
@@ -2319,18 +2345,18 @@ function bp_activity_post_type_comment( $comment_id = 0, $is_approved = true, $a
|
|
2319 |
// Get the user by the comment author email.
|
2320 |
$user = get_user_by( 'email', $post_type_comment->comment_author_email );
|
2321 |
|
2322 |
-
// If user isn't registered, don't record activity
|
2323 |
if ( empty( $user ) ) {
|
2324 |
return false;
|
2325 |
}
|
2326 |
|
2327 |
-
// Get the user_id
|
2328 |
$user_id = (int) $user->ID;
|
2329 |
|
2330 |
-
// Get blog and post data
|
2331 |
$blog_id = get_current_blog_id();
|
2332 |
|
2333 |
-
// Get the post
|
2334 |
$post_type_comment->post = get_post( $post_type_comment->comment_post_ID );
|
2335 |
|
2336 |
if ( ! is_a( $post_type_comment->post, 'WP_Post' ) ) {
|
@@ -2346,25 +2372,25 @@ function bp_activity_post_type_comment( $comment_id = 0, $is_approved = true, $a
|
|
2346 |
*/
|
2347 |
$is_post_status_not_allowed = (bool) apply_filters( 'bp_activity_post_type_is_post_status_allowed', 'publish' !== $post_type_comment->post->post_status || ! empty( $post_type_comment->post->post_password ) );
|
2348 |
|
2349 |
-
// If this is a password protected post, or not a public post don't record the comment
|
2350 |
if ( $is_post_status_not_allowed ) {
|
2351 |
return false;
|
2352 |
}
|
2353 |
|
2354 |
-
// Set post type
|
2355 |
$post_type = $post_type_comment->post->post_type;
|
2356 |
|
2357 |
if ( empty( $activity_post_object ) ) {
|
2358 |
// Get the post type tracking args.
|
2359 |
$activity_post_object = bp_activity_get_post_type_tracking_args( $post_type );
|
2360 |
|
2361 |
-
// Bail if the activity type does not exist
|
2362 |
if ( empty( $activity_post_object->comments_tracking->action_id ) ) {
|
2363 |
return false;
|
2364 |
}
|
2365 |
}
|
2366 |
|
2367 |
-
// Set the $activity_comment_object
|
2368 |
$activity_comment_object = $activity_post_object->comments_tracking;
|
2369 |
|
2370 |
/**
|
@@ -2503,13 +2529,13 @@ function bp_activity_post_type_remove_comment( $comment_id = 0, $activity_post_o
|
|
2503 |
// Get the post type tracking args.
|
2504 |
$activity_post_object = bp_activity_get_post_type_tracking_args( $post_type );
|
2505 |
|
2506 |
-
// Bail if the activity type does not exist
|
2507 |
if ( empty( $activity_post_object->comments_tracking->action_id ) ) {
|
2508 |
return false;
|
2509 |
}
|
2510 |
}
|
2511 |
|
2512 |
-
// Set the $activity_comment_object
|
2513 |
$activity_comment_object = $activity_post_object->comments_tracking;
|
2514 |
|
2515 |
if ( empty( $activity_comment_object->action_id ) ) {
|
@@ -3417,7 +3443,8 @@ function bp_activity_create_summary( $content, $activity ) {
|
|
3417 |
if ( $use_media_type === 'embeds' ) {
|
3418 |
$summary .= PHP_EOL . PHP_EOL . $extracted_media['url'];
|
3419 |
} elseif ( $use_media_type === 'images' ) {
|
3420 |
-
$
|
|
|
3421 |
} elseif ( in_array( $use_media_type, array( 'audio', 'videos' ), true ) ) {
|
3422 |
$summary .= PHP_EOL . PHP_EOL . $extracted_media['original']; // Full shortcode.
|
3423 |
}
|
@@ -4032,16 +4059,16 @@ function bp_activity_transition_post_type_comment_status( $new_status, $old_stat
|
|
4032 |
// Get the post type tracking args.
|
4033 |
$activity_post_object = bp_activity_get_post_type_tracking_args( $post_type );
|
4034 |
|
4035 |
-
// Bail if the activity type does not exist
|
4036 |
if ( empty( $activity_post_object->comments_tracking->action_id ) ) {
|
4037 |
return false;
|
4038 |
|
4039 |
-
// Set the $activity_comment_object
|
4040 |
} else {
|
4041 |
$activity_comment_object = $activity_post_object->comments_tracking;
|
4042 |
}
|
4043 |
|
4044 |
-
// Init an empty activity ID
|
4045 |
$activity_id = 0;
|
4046 |
|
4047 |
/**
|
@@ -4065,7 +4092,7 @@ function bp_activity_transition_post_type_comment_status( $new_status, $old_stat
|
|
4065 |
$action = 'ham_activity';
|
4066 |
}
|
4067 |
|
4068 |
-
// Get the activity
|
4069 |
if ( bp_disable_blogforum_comments() ) {
|
4070 |
$activity_id = bp_activity_get_activity_id( array(
|
4071 |
'component' => $activity_comment_object->component_id,
|
@@ -4093,7 +4120,7 @@ function bp_activity_transition_post_type_comment_status( $new_status, $old_stat
|
|
4093 |
return false;
|
4094 |
}
|
4095 |
|
4096 |
-
// Check activity item exists
|
4097 |
if ( empty( $activity_id ) ) {
|
4098 |
// If no activity exists, but the comment has been approved, record it into the activity table.
|
4099 |
if ( 'approved' == $new_status ) {
|
@@ -4103,20 +4130,20 @@ function bp_activity_transition_post_type_comment_status( $new_status, $old_stat
|
|
4103 |
return;
|
4104 |
}
|
4105 |
|
4106 |
-
// Create an activity object
|
4107 |
$activity = new BP_Activity_Activity( $activity_id );
|
4108 |
if ( empty( $activity->component ) ) {
|
4109 |
return;
|
4110 |
}
|
4111 |
|
4112 |
-
// Spam/ham the activity if it's not already in that state
|
4113 |
if ( 'spam_activity' === $action && ! $activity->is_spam ) {
|
4114 |
bp_activity_mark_as_spam( $activity );
|
4115 |
} elseif ( 'ham_activity' == $action) {
|
4116 |
bp_activity_mark_as_ham( $activity );
|
4117 |
}
|
4118 |
|
4119 |
-
// Add "new_post_type_comment" to the whitelisted activity types, so that the activity's Akismet history is generated
|
4120 |
$post_type_comment_action = $activity_comment_object->action_id;
|
4121 |
$comment_akismet_history = function ( $activity_types ) use ( $post_type_comment_action ) {
|
4122 |
$activity_types[] = $post_type_comment_action;
|
@@ -4125,16 +4152,16 @@ function bp_activity_transition_post_type_comment_status( $new_status, $old_stat
|
|
4125 |
};
|
4126 |
add_filter( 'bp_akismet_get_activity_types', $comment_akismet_history );
|
4127 |
|
4128 |
-
// Make sure the activity change won't edit the comment if sync is on
|
4129 |
remove_action( 'bp_activity_before_save', 'bp_blogs_sync_activity_edit_to_post_comment', 20 );
|
4130 |
|
4131 |
-
// Save the updated activity
|
4132 |
$activity->save();
|
4133 |
|
4134 |
-
// Restore the action
|
4135 |
add_action( 'bp_activity_before_save', 'bp_blogs_sync_activity_edit_to_post_comment', 20 );
|
4136 |
|
4137 |
-
// Remove the "new_blog_comment" activity type whitelist so we don't break anything
|
4138 |
remove_filter( 'bp_akismet_get_activity_types', $comment_akismet_history );
|
4139 |
}
|
4140 |
add_action( 'transition_comment_status', 'bp_activity_transition_post_type_comment_status', 10, 3 );
|
522 |
$post_type_activity->new_post_type_action_ms = $post_type_object->labels->bp_activity_new_post_ms;
|
523 |
}
|
524 |
|
525 |
+
// If the post type supports comments and has a comment action id, build the comments tracking args.
|
526 |
if ( $post_type_support_comments && ! empty( $post_type_activity->comment_action_id ) ) {
|
527 |
+
// Init a new container for the activity type for comments.
|
528 |
$post_type_activity->comments_tracking = new stdClass();
|
529 |
|
530 |
+
// Build the activity type for comments.
|
531 |
$post_type_activity->comments_tracking->component_id = $post_type_activity->component_id;
|
532 |
$post_type_activity->comments_tracking->action_id = $post_type_activity->comment_action_id;
|
533 |
|
597 |
$track_post_type = bp_activity_get_post_type_tracking_args( $post_type );
|
598 |
|
599 |
if ( ! empty( $track_post_type ) ) {
|
600 |
+
// Set the post type comments tracking args.
|
601 |
if ( ! empty( $track_post_type->comments_tracking->action_id ) ) {
|
602 |
+
// Used to check support for comment tracking by activity type (new_post_type_comment).
|
603 |
$track_post_type->comments_tracking->comments_tracking = true;
|
604 |
|
605 |
// Used to be able to find the post type this activity type is associated to.
|
607 |
|
608 |
$post_types_tracking_args[ $track_post_type->comments_tracking->action_id ] = $track_post_type->comments_tracking;
|
609 |
|
610 |
+
// Used to check support for comment tracking by activity type (new_post_type).
|
611 |
$track_post_type->comments_tracking = true;
|
612 |
}
|
613 |
|
650 |
* eg. 'new_blog_post' and 'new_blog_comment' will both return true.
|
651 |
*/
|
652 |
case 'post-type-comment-tracking' :
|
653 |
+
// Set the activity track global if not set yet.
|
654 |
if ( empty( $bp->activity->track ) ) {
|
655 |
$bp->activity->track = bp_activity_get_post_types_tracking_args();
|
656 |
}
|
726 |
|
727 |
$bp = buddypress();
|
728 |
|
729 |
+
// Set the activity track global if not set yet.
|
730 |
if ( empty( $bp->activity->track ) ) {
|
731 |
$bp->activity->track = bp_activity_get_post_types_tracking_args();
|
732 |
}
|
1277 |
do_action( 'bp_activity_remove_all_user_data', $user_id );
|
1278 |
}
|
1279 |
add_action( 'wpmu_delete_user', 'bp_activity_remove_all_user_data' );
|
1280 |
+
|
1281 |
+
/**
|
1282 |
+
* Deletes user activity data on the 'delete_user' hook.
|
1283 |
+
*
|
1284 |
+
* @since 6.0.0
|
1285 |
+
*
|
1286 |
+
* @param int $user_id The ID of the deleted user.
|
1287 |
+
*/
|
1288 |
+
function bp_activity_remove_all_user_data_on_delete_user( $user_id ) {
|
1289 |
+
if ( ! bp_remove_user_data_on_delete_user_hook( 'activity', $user_id ) ) {
|
1290 |
+
return;
|
1291 |
+
}
|
1292 |
+
|
1293 |
+
bp_activity_remove_all_user_data( $user_id );
|
1294 |
+
}
|
1295 |
+
add_action( 'delete_user', 'bp_activity_remove_all_user_data_on_delete_user' );
|
1296 |
|
1297 |
/**
|
1298 |
* Mark all of the user's activity as spam.
|
1538 |
* @return string $action
|
1539 |
*/
|
1540 |
function bp_activity_format_activity_action_activity_update( $action, $activity ) {
|
1541 |
+
$action = sprintf(
|
1542 |
+
/* translators: %s: the activity author user link */
|
1543 |
+
esc_html__( '%s posted an update', 'buddypress' ),
|
1544 |
+
bp_core_get_userlink( $activity->user_id )
|
1545 |
+
);
|
1546 |
|
1547 |
/**
|
1548 |
* Filters the formatted activity action update string.
|
1565 |
* @return string $action
|
1566 |
*/
|
1567 |
function bp_activity_format_activity_action_activity_comment( $action, $activity ) {
|
1568 |
+
$action = sprintf(
|
1569 |
+
/* translators: %s: the activity author user link */
|
1570 |
+
esc_html__( '%s posted a new activity comment', 'buddypress' ),
|
1571 |
+
bp_core_get_userlink( $activity->user_id )
|
1572 |
+
);
|
1573 |
|
1574 |
/**
|
1575 |
* Filters the formatted activity action comment string.
|
1620 |
if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_action_ms ) ) {
|
1621 |
$action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_action_ms, $user_link, esc_url( $post_url ), $blog_link );
|
1622 |
} else {
|
1623 |
+
/* translators: 1: the activity author user link. 2: the post link. 3: the blog link. */
|
1624 |
$action = sprintf( esc_html_x( '%1$s wrote a new %2$s, on the site %3$s', 'Activity Custom Post Type post action', 'buddypress' ), $user_link, $post_link, $blog_link );
|
1625 |
}
|
1626 |
} else {
|
1627 |
if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_action ) ) {
|
1628 |
$action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_action, $user_link, $post_url );
|
1629 |
} else {
|
1630 |
+
/* translators: 1: the activity author user link. 2: the post link. */
|
1631 |
$action = sprintf( esc_html_x( '%1$s wrote a new %2$s', 'Activity Custom Post Type post action', 'buddypress' ), $user_link, $post_link );
|
1632 |
}
|
1633 |
}
|
1674 |
if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_comment_action_ms ) ) {
|
1675 |
$action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_comment_action_ms, $user_link, $activity->primary_link, $blog_link );
|
1676 |
} else {
|
1677 |
+
/* translators: 1: the activity author user link. 2: the post link. 3: the blog link. */
|
1678 |
$action = sprintf( esc_html_x( '%1$s commented on the %2$s, on the site %3$s', 'Activity Custom Post Type comment action', 'buddypress' ), $user_link, $post_link, $blog_link );
|
1679 |
}
|
1680 |
} else {
|
1681 |
if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_comment_action ) ) {
|
1682 |
$action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_comment_action, $user_link, $activity->primary_link );
|
1683 |
} else {
|
1684 |
+
/* translators: 1: the activity author user link. 2: the post link. */
|
1685 |
$action = sprintf( esc_html_x( '%1$s commented on the %2$s', 'Activity Custom Post Type post comment action', 'buddypress' ), $user_link, $post_link );
|
1686 |
}
|
1687 |
}
|
1728 |
'max' => false, // Maximum number of results to return.
|
1729 |
'fields' => 'all',
|
1730 |
'page' => 1, // Page 1 without a per_page will result in no pagination.
|
1731 |
+
'per_page' => false, // results per page.
|
1732 |
+
'sort' => 'DESC', // sort ASC or DESC.
|
1733 |
'display_comments' => false, // False for no comments. 'stream' for within stream display, 'threaded' for below each activity item.
|
1734 |
|
1735 |
+
'search_terms' => false, // Pass search terms as a string.
|
1736 |
+
'meta_query' => false, // Filter by activity meta. See WP_Meta_Query for format.
|
1737 |
'date_query' => false, // Filter by date. See first parameter of WP_Date_Query for format.
|
1738 |
'filter_query' => false,
|
1739 |
'show_hidden' => false, // Show activity items that are hidden site-wide?
|
1740 |
'exclude' => false, // Comma-separated list of activity IDs to exclude.
|
1741 |
+
'in' => false, // Comma-separated list or array of activity IDs to which you.
|
1742 |
// want to limit the query.
|
1743 |
'spam' => 'ham_only', // 'ham_only' (default), 'spam_only' or 'all'.
|
1744 |
'update_meta_cache' => true,
|
1814 |
'page' => 1, // Page 1 without a per_page will result in no pagination.
|
1815 |
'per_page' => false, // Results per page.
|
1816 |
'show_hidden' => true, // When fetching specific items, show all.
|
1817 |
+
'sort' => 'DESC', // Sort ASC or DESC.
|
1818 |
'spam' => 'ham_only', // Retrieve items marked as spam.
|
1819 |
'update_meta_cache' => true,
|
1820 |
), 'activity_get_specific' );
|
1887 |
|
1888 |
$r = bp_parse_args( $args, array(
|
1889 |
'id' => false, // Pass an existing activity ID to update an existing entry.
|
1890 |
+
'action' => '', // The activity action - e.g. "Jon Doe posted an update".
|
1891 |
+
'content' => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!".
|
1892 |
'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent.
|
1893 |
'type' => false, // The activity type e.g. activity_update, profile_updated.
|
1894 |
'primary_link' => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink).
|
2324 |
* @return null|WP_Error|bool|int The ID of the activity on success. False on error.
|
2325 |
*/
|
2326 |
function bp_activity_post_type_comment( $comment_id = 0, $is_approved = true, $activity_post_object = null ) {
|
2327 |
+
// Get the users comment.
|
2328 |
$post_type_comment = get_comment( $comment_id );
|
2329 |
|
2330 |
+
// Don't record activity if the comment hasn't been approved.
|
2331 |
if ( empty( $is_approved ) ) {
|
2332 |
return false;
|
2333 |
}
|
2334 |
|
2335 |
+
// Don't record activity if no email address has been included.
|
2336 |
if ( empty( $post_type_comment->comment_author_email ) ) {
|
2337 |
return false;
|
2338 |
}
|
2339 |
|
2340 |
+
// Don't record activity if the comment has already been marked as spam.
|
2341 |
if ( 'spam' === $is_approved ) {
|
2342 |
return false;
|
2343 |
}
|
2345 |
// Get the user by the comment author email.
|
2346 |
$user = get_user_by( 'email', $post_type_comment->comment_author_email );
|
2347 |
|
2348 |
+
// If user isn't registered, don't record activity.
|
2349 |
if ( empty( $user ) ) {
|
2350 |
return false;
|
2351 |
}
|
2352 |
|
2353 |
+
// Get the user_id.
|
2354 |
$user_id = (int) $user->ID;
|
2355 |
|
2356 |
+
// Get blog and post data.
|
2357 |
$blog_id = get_current_blog_id();
|
2358 |
|
2359 |
+
// Get the post.
|
2360 |
$post_type_comment->post = get_post( $post_type_comment->comment_post_ID );
|
2361 |
|
2362 |
if ( ! is_a( $post_type_comment->post, 'WP_Post' ) ) {
|
2372 |
*/
|
2373 |
$is_post_status_not_allowed = (bool) apply_filters( 'bp_activity_post_type_is_post_status_allowed', 'publish' !== $post_type_comment->post->post_status || ! empty( $post_type_comment->post->post_password ) );
|
2374 |
|
2375 |
+
// If this is a password protected post, or not a public post don't record the comment.
|
2376 |
if ( $is_post_status_not_allowed ) {
|
2377 |
return false;
|
2378 |
}
|
2379 |
|
2380 |
+
// Set post type.
|
2381 |
$post_type = $post_type_comment->post->post_type;
|
2382 |
|
2383 |
if ( empty( $activity_post_object ) ) {
|
2384 |
// Get the post type tracking args.
|
2385 |
$activity_post_object = bp_activity_get_post_type_tracking_args( $post_type );
|
2386 |
|
2387 |
+
// Bail if the activity type does not exist.
|
2388 |
if ( empty( $activity_post_object->comments_tracking->action_id ) ) {
|
2389 |
return false;
|
2390 |
}
|
2391 |
}
|
2392 |
|
2393 |
+
// Set the $activity_comment_object.
|
2394 |
$activity_comment_object = $activity_post_object->comments_tracking;
|
2395 |
|
2396 |
/**
|
2529 |
// Get the post type tracking args.
|
2530 |
$activity_post_object = bp_activity_get_post_type_tracking_args( $post_type );
|
2531 |
|
2532 |
+
// Bail if the activity type does not exist.
|
2533 |
if ( empty( $activity_post_object->comments_tracking->action_id ) ) {
|
2534 |
return false;
|
2535 |
}
|
2536 |
}
|
2537 |
|
2538 |
+
// Set the $activity_comment_object.
|
2539 |
$activity_comment_object = $activity_post_object->comments_tracking;
|
2540 |
|
2541 |
if ( empty( $activity_comment_object->action_id ) ) {
|
3443 |
if ( $use_media_type === 'embeds' ) {
|
3444 |
$summary .= PHP_EOL . PHP_EOL . $extracted_media['url'];
|
3445 |
} elseif ( $use_media_type === 'images' ) {
|
3446 |
+
$extracted_media_url = isset( $extracted_media['url'] ) ? $extracted_media['url'] : '';
|
3447 |
+
$summary .= sprintf( ' <img src="%s">', esc_url( $extracted_media_url ) );
|
3448 |
} elseif ( in_array( $use_media_type, array( 'audio', 'videos' ), true ) ) {
|
3449 |
$summary .= PHP_EOL . PHP_EOL . $extracted_media['original']; // Full shortcode.
|
3450 |
}
|
4059 |
// Get the post type tracking args.
|
4060 |
$activity_post_object = bp_activity_get_post_type_tracking_args( $post_type );
|
4061 |
|
4062 |
+
// Bail if the activity type does not exist.
|
4063 |
if ( empty( $activity_post_object->comments_tracking->action_id ) ) {
|
4064 |
return false;
|
4065 |
|
4066 |
+
// Set the $activity_comment_object.
|
4067 |
} else {
|
4068 |
$activity_comment_object = $activity_post_object->comments_tracking;
|
4069 |
}
|
4070 |
|
4071 |
+
// Init an empty activity ID.
|
4072 |
$activity_id = 0;
|
4073 |
|
4074 |
/**
|
4092 |
$action = 'ham_activity';
|
4093 |
}
|
4094 |
|
4095 |
+
// Get the activity.
|
4096 |
if ( bp_disable_blogforum_comments() ) {
|
4097 |
$activity_id = bp_activity_get_activity_id( array(
|
4098 |
'component' => $activity_comment_object->component_id,
|
4120 |
return false;
|
4121 |
}
|
4122 |
|
4123 |
+
// Check activity item exists.
|
4124 |
if ( empty( $activity_id ) ) {
|
4125 |
// If no activity exists, but the comment has been approved, record it into the activity table.
|
4126 |
if ( 'approved' == $new_status ) {
|
4130 |
return;
|
4131 |
}
|
4132 |
|
4133 |
+
// Create an activity object.
|
4134 |
$activity = new BP_Activity_Activity( $activity_id );
|
4135 |
if ( empty( $activity->component ) ) {
|
4136 |
return;
|
4137 |
}
|
4138 |
|
4139 |
+
// Spam/ham the activity if it's not already in that state.
|
4140 |
if ( 'spam_activity' === $action && ! $activity->is_spam ) {
|
4141 |
bp_activity_mark_as_spam( $activity );
|
4142 |
} elseif ( 'ham_activity' == $action) {
|
4143 |
bp_activity_mark_as_ham( $activity );
|
4144 |
}
|
4145 |
|
4146 |
+
// Add "new_post_type_comment" to the whitelisted activity types, so that the activity's Akismet history is generated.
|
4147 |
$post_type_comment_action = $activity_comment_object->action_id;
|
4148 |
$comment_akismet_history = function ( $activity_types ) use ( $post_type_comment_action ) {
|
4149 |
$activity_types[] = $post_type_comment_action;
|
4152 |
};
|
4153 |
add_filter( 'bp_akismet_get_activity_types', $comment_akismet_history );
|
4154 |
|
4155 |
+
// Make sure the activity change won't edit the comment if sync is on.
|
4156 |
remove_action( 'bp_activity_before_save', 'bp_blogs_sync_activity_edit_to_post_comment', 20 );
|
4157 |
|
4158 |
+
// Save the updated activity.
|
4159 |
$activity->save();
|
4160 |
|
4161 |
+
// Restore the action.
|
4162 |
add_action( 'bp_activity_before_save', 'bp_blogs_sync_activity_edit_to_post_comment', 20 );
|
4163 |
|
4164 |
+
// Remove the "new_blog_comment" activity type whitelist so we don't break anything.
|
4165 |
remove_filter( 'bp_akismet_get_activity_types', $comment_akismet_history );
|
4166 |
}
|
4167 |
add_action( 'transition_comment_status', 'bp_activity_transition_post_type_comment_status', 10, 3 );
|
bp-activity/bp-activity-notifications.php
CHANGED
@@ -34,13 +34,17 @@ function bp_activity_format_notifications( $action, $item_id, $secondary_item_id
|
|
34 |
case 'new_at_mention':
|
35 |
$action_filter = 'at_mentions';
|
36 |
$link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/';
|
37 |
-
|
38 |
-
|
|
|
|
|
39 |
|
40 |
if ( (int) $total_items > 1 ) {
|
|
|
41 |
$text = sprintf( __( 'You have %1$d new mentions', 'buddypress' ), (int) $total_items );
|
42 |
$amount = 'multiple';
|
43 |
} else {
|
|
|
44 |
$text = sprintf( __( '%1$s mentioned you', 'buddypress' ), $user_fullname );
|
45 |
}
|
46 |
break;
|
@@ -51,11 +55,15 @@ function bp_activity_format_notifications( $action, $item_id, $secondary_item_id
|
|
51 |
$amount = 'single';
|
52 |
|
53 |
if ( (int) $total_items > 1 ) {
|
54 |
-
$link
|
|
|
|
|
55 |
$text = sprintf( __( 'You have %1$d new replies', 'buddypress' ), (int) $total_items );
|
56 |
$amount = 'multiple';
|
57 |
} else {
|
58 |
$link = add_query_arg( 'rid', (int) $id, bp_activity_get_permalink( $activity_id ) );
|
|
|
|
|
59 |
$text = sprintf( __( '%1$s commented on one of your updates', 'buddypress' ), $user_fullname );
|
60 |
}
|
61 |
break;
|
@@ -66,11 +74,15 @@ function bp_activity_format_notifications( $action, $item_id, $secondary_item_id
|
|
66 |
$amount = 'single';
|
67 |
|
68 |
if ( (int) $total_items > 1 ) {
|
69 |
-
$link
|
|
|
|
|
70 |
$text = sprintf( __( 'You have %1$d new comment replies', 'buddypress' ), (int) $total_items );
|
71 |
$amount = 'multiple';
|
72 |
} else {
|
73 |
$link = add_query_arg( 'crid', (int) $id, bp_activity_get_permalink( $activity_id ) );
|
|
|
|
|
74 |
$text = sprintf( __( '%1$s replied to one of your activity comments', 'buddypress' ), $user_fullname );
|
75 |
}
|
76 |
break;
|
@@ -396,14 +408,19 @@ function bp_activity_screen_notification_settings() {
|
|
396 |
<?php if ( bp_activity_do_mentions() ) : ?>
|
397 |
<tr id="activity-notification-settings-mentions">
|
398 |
<td> </td>
|
399 |
-
<td
|
|
|
|
|
|
|
|
|
|
|
400 |
<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
|
401 |
/* translators: accessibility text */
|
402 |
-
|
403 |
?></label></td>
|
404 |
<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
|
405 |
/* translators: accessibility text */
|
406 |
-
|
407 |
?></label></td>
|
408 |
</tr>
|
409 |
<?php endif; ?>
|
@@ -413,11 +430,11 @@ function bp_activity_screen_notification_settings() {
|
|
413 |
<td><?php _e( "A member replies to an update or comment you've posted", 'buddypress' ) ?></td>
|
414 |
<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
|
415 |
/* translators: accessibility text */
|
416 |
-
|
417 |
?></label></td>
|
418 |
<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
|
419 |
/* translators: accessibility text */
|
420 |
-
|
421 |
?></label></td>
|
422 |
</tr>
|
423 |
|
34 |
case 'new_at_mention':
|
35 |
$action_filter = 'at_mentions';
|
36 |
$link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/';
|
37 |
+
|
38 |
+
/* translators: %s: the current user display name */
|
39 |
+
$title = sprintf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() );
|
40 |
+
$amount = 'single';
|
41 |
|
42 |
if ( (int) $total_items > 1 ) {
|
43 |
+
/* translators: 1: the number of activity mentions */
|
44 |
$text = sprintf( __( 'You have %1$d new mentions', 'buddypress' ), (int) $total_items );
|
45 |
$amount = 'multiple';
|
46 |
} else {
|
47 |
+
/* translators: 1: the user display name */
|
48 |
$text = sprintf( __( '%1$s mentioned you', 'buddypress' ), $user_fullname );
|
49 |
}
|
50 |
break;
|
55 |
$amount = 'single';
|
56 |
|
57 |
if ( (int) $total_items > 1 ) {
|
58 |
+
$link = add_query_arg( 'type', $action, $link );
|
59 |
+
|
60 |
+
/* translators: 1: the number of activity replies */
|
61 |
$text = sprintf( __( 'You have %1$d new replies', 'buddypress' ), (int) $total_items );
|
62 |
$amount = 'multiple';
|
63 |
} else {
|
64 |
$link = add_query_arg( 'rid', (int) $id, bp_activity_get_permalink( $activity_id ) );
|
65 |
+
|
66 |
+
/* translators: 1: the user display name */
|
67 |
$text = sprintf( __( '%1$s commented on one of your updates', 'buddypress' ), $user_fullname );
|
68 |
}
|
69 |
break;
|
74 |
$amount = 'single';
|
75 |
|
76 |
if ( (int) $total_items > 1 ) {
|
77 |
+
$link = add_query_arg( 'type', $action, $link );
|
78 |
+
|
79 |
+
/* translators: 1: the number of activity comment replies */
|
80 |
$text = sprintf( __( 'You have %1$d new comment replies', 'buddypress' ), (int) $total_items );
|
81 |
$amount = 'multiple';
|
82 |
} else {
|
83 |
$link = add_query_arg( 'crid', (int) $id, bp_activity_get_permalink( $activity_id ) );
|
84 |
+
|
85 |
+
/* translators: 1: the user display name */
|
86 |
$text = sprintf( __( '%1$s replied to one of your activity comments', 'buddypress' ), $user_fullname );
|
87 |
}
|
88 |
break;
|
408 |
<?php if ( bp_activity_do_mentions() ) : ?>
|
409 |
<tr id="activity-notification-settings-mentions">
|
410 |
<td> </td>
|
411 |
+
<td>
|
412 |
+
<?php
|
413 |
+
/* translators: %s: the displayed user username */
|
414 |
+
printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( bp_displayed_user_id() ) );
|
415 |
+
?>
|
416 |
+
</td>
|
417 |
<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
|
418 |
/* translators: accessibility text */
|
419 |
+
esc_html_e( 'Yes, send email', 'buddypress' );
|
420 |
?></label></td>
|
421 |
<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
|
422 |
/* translators: accessibility text */
|
423 |
+
esc_html_e( 'No, do not send email', 'buddypress' );
|
424 |
?></label></td>
|
425 |
</tr>
|
426 |
<?php endif; ?>
|
430 |
<td><?php _e( "A member replies to an update or comment you've posted", 'buddypress' ) ?></td>
|
431 |
<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
|
432 |
/* translators: accessibility text */
|
433 |
+
esc_html_e( 'Yes, send email', 'buddypress' );
|
434 |
?></label></td>
|
435 |
<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
|
436 |
/* translators: accessibility text */
|
437 |
+
esc_html_e( 'No, do not send email', 'buddypress' );
|
438 |
?></label></td>
|
439 |
</tr>
|
440 |
|
bp-activity/bp-activity-template.php
CHANGED
@@ -452,6 +452,7 @@ function bp_activity_pagination_count() {
|
|
452 |
if ( 1 == $activities_template->total_activity_count ) {
|
453 |
$message = __( 'Viewing 1 item', 'buddypress' );
|
454 |
} else {
|
|
|
455 |
$message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s item', 'Viewing %1$s - %2$s of %3$s items', $activities_template->total_activity_count, 'buddypress' ), $from_num, $to_num, $total );
|
456 |
}
|
457 |
|
@@ -1034,7 +1035,11 @@ function bp_activity_avatar( $args = '' ) {
|
|
1034 |
$dn_default = isset( $current_activity_item->display_name ) ? $current_activity_item->display_name : '';
|
1035 |
|
1036 |
// Prepend some descriptive text to alt.
|
1037 |
-
$alt_default =
|
|
|
|
|
|
|
|
|
1038 |
|
1039 |
$defaults = array(
|
1040 |
'alt' => $alt_default,
|
@@ -1182,6 +1187,7 @@ function bp_activity_secondary_avatar( $args = '' ) {
|
|
1182 |
$alt = __( 'Group logo', 'buddypress' );
|
1183 |
|
1184 |
if ( ! empty( $name ) ) {
|
|
|
1185 |
$alt = sprintf( __( 'Group logo of %s', 'buddypress' ), $name );
|
1186 |
}
|
1187 |
}
|
@@ -1193,6 +1199,7 @@ function bp_activity_secondary_avatar( $args = '' ) {
|
|
1193 |
$link = home_url();
|
1194 |
|
1195 |
if ( empty( $alt ) ) {
|
|
|
1196 |
$alt = sprintf( __( 'Profile picture of the author of the site %s', 'buddypress' ), get_blog_option( $item_id, 'blogname' ) );
|
1197 |
}
|
1198 |
|
@@ -1203,6 +1210,7 @@ function bp_activity_secondary_avatar( $args = '' ) {
|
|
1203 |
$link = bp_core_get_userlink( $item_id, false, true );
|
1204 |
|
1205 |
if ( empty( $alt ) ) {
|
|
|
1206 |
$alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_core_get_user_displayname( $activities_template->activity->secondary_item_id ) );
|
1207 |
}
|
1208 |
|
@@ -1214,6 +1222,7 @@ function bp_activity_secondary_avatar( $args = '' ) {
|
|
1214 |
$link = bp_core_get_userlink( $item_id, false, true );
|
1215 |
|
1216 |
if ( empty( $alt ) ) {
|
|
|
1217 |
$alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), $activities_template->activity->display_name );
|
1218 |
}
|
1219 |
|
@@ -1306,6 +1315,7 @@ function bp_activity_action( $args = array() ) {
|
|
1306 |
* Return the activity action.
|
1307 |
*
|
1308 |
* @since 1.2.0
|
|
|
1309 |
*
|
1310 |
* @global object $activities_template {@link BP_Activity_Template}
|
1311 |
*
|
@@ -1344,8 +1354,9 @@ function bp_activity_action( $args = array() ) {
|
|
1344 |
* Filters the activity action after the action has been inserted as meta.
|
1345 |
*
|
1346 |
* @since 1.2.0
|
|
|
1347 |
*
|
1348 |
-
* @param array $value Array containing the current action, the current activity, and the $
|
1349 |
*/
|
1350 |
return apply_filters_ref_array( 'bp_get_activity_action', array(
|
1351 |
$action,
|
@@ -2174,7 +2185,16 @@ function bp_activity_comment_count() {
|
|
2174 |
|
2175 |
// Deprecated notice about $args.
|
2176 |
if ( ! empty( $deprecated ) ) {
|
2177 |
-
_deprecated_argument(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2178 |
}
|
2179 |
|
2180 |
// Get the count using the purpose-built recursive function.
|
452 |
if ( 1 == $activities_template->total_activity_count ) {
|
453 |
$message = __( 'Viewing 1 item', 'buddypress' );
|
454 |
} else {
|
455 |
+
/* translators: 1: the from number item. 2: the to number item. 3: the total number of items. */
|
456 |
$message = sprintf( _n( 'Viewing %1$s - %2$s of %3$s item', 'Viewing %1$s - %2$s of %3$s items', $activities_template->total_activity_count, 'buddypress' ), $from_num, $to_num, $total );
|
457 |
}
|
458 |
|
1035 |
$dn_default = isset( $current_activity_item->display_name ) ? $current_activity_item->display_name : '';
|
1036 |
|
1037 |
// Prepend some descriptive text to alt.
|
1038 |
+
$alt_default = __( 'Profile picture', 'buddypress' );
|
1039 |
+
if ( ! empty( $dn_default ) ) {
|
1040 |
+
/* translators: %s: member name */
|
1041 |
+
$alt_default = sprintf( __( 'Profile picture of %s', 'buddypress' ), $dn_default );
|
1042 |
+
}
|
1043 |
|
1044 |
$defaults = array(
|
1045 |
'alt' => $alt_default,
|
1187 |
$alt = __( 'Group logo', 'buddypress' );
|
1188 |
|
1189 |
if ( ! empty( $name ) ) {
|
1190 |
+
/* translators: %s: the Group name */
|
1191 |
$alt = sprintf( __( 'Group logo of %s', 'buddypress' ), $name );
|
1192 |
}
|
1193 |
}
|
1199 |
$link = home_url();
|
1200 |
|
1201 |
if ( empty( $alt ) ) {
|
1202 |
+
/* translators: %s: the blog name */
|
1203 |
$alt = sprintf( __( 'Profile picture of the author of the site %s', 'buddypress' ), get_blog_option( $item_id, 'blogname' ) );
|
1204 |
}
|
1205 |
|
1210 |
$link = bp_core_get_userlink( $item_id, false, true );
|
1211 |
|
1212 |
if ( empty( $alt ) ) {
|
1213 |
+
/* translators: %s: member name */
|
1214 |
$alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_core_get_user_displayname( $activities_template->activity->secondary_item_id ) );
|
1215 |
}
|
1216 |
|
1222 |
$link = bp_core_get_userlink( $item_id, false, true );
|
1223 |
|
1224 |
if ( empty( $alt ) ) {
|
1225 |
+
/* translators: %s: member name */
|
1226 |
$alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), $activities_template->activity->display_name );
|
1227 |
}
|
1228 |
|
1315 |
* Return the activity action.
|
1316 |
*
|
1317 |
* @since 1.2.0
|
1318 |
+
* @since 1.7.0 Introduce function parameter, $args.
|
1319 |
*
|
1320 |
* @global object $activities_template {@link BP_Activity_Template}
|
1321 |
*
|
1354 |
* Filters the activity action after the action has been inserted as meta.
|
1355 |
*
|
1356 |
* @since 1.2.0
|
1357 |
+
* @since 1.7.0 Now passes a 3rd parameter, $r, an array of arguments from the function.
|
1358 |
*
|
1359 |
+
* @param array $value Array containing the current action, the current activity, and the $r array passed into the function.
|
1360 |
*/
|
1361 |
return apply_filters_ref_array( 'bp_get_activity_action', array(
|
1362 |
$action,
|
2185 |
|
2186 |
// Deprecated notice about $args.
|
2187 |
if ( ! empty( $deprecated ) ) {
|
2188 |
+
_deprecated_argument(
|
2189 |
+
__FUNCTION__,
|
2190 |
+
'1.2',
|
2191 |
+
sprintf(
|
2192 |
+
/* translators: 1: the name of the function. 2: the name of the file. */
|
2193 |
+
__( '%1$s no longer accepts arguments. See the inline documentation at %2$s for more details.', 'buddypress' ),
|
2194 |
+
__FUNCTION__,
|
2195 |
+
__FILE__
|
2196 |
+
)
|
2197 |
+
);
|
2198 |
}
|
2199 |
|
2200 |
// Get the count using the purpose-built recursive function.
|
bp-activity/classes/class-bp-activity-activity.php
CHANGED
@@ -268,15 +268,35 @@ class BP_Activity_Activity {
|
|
268 |
return false;
|
269 |
} else {
|
270 |
if ( empty( $this->component ) ) {
|
271 |
-
$this->errors->add( 'bp_activity_missing_component' );
|
272 |
} else {
|
273 |
-
$this->errors->add( 'bp_activity_missing_type' );
|
274 |
}
|
275 |
|
276 |
return $this->errors;
|
277 |
}
|
278 |
}
|
279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
if ( empty( $this->primary_link ) ) {
|
281 |
$this->primary_link = bp_loggedin_user_domain();
|
282 |
}
|
@@ -364,7 +384,16 @@ class BP_Activity_Activity {
|
|
364 |
|
365 |
// Backward compatibility with old method of passing arguments.
|
366 |
if ( !is_array( $args ) || count( $function_args ) > 1 ) {
|
367 |
-
_deprecated_argument(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
|
369 |
$old_args_keys = array(
|
370 |
0 => 'max',
|
268 |
return false;
|
269 |
} else {
|
270 |
if ( empty( $this->component ) ) {
|
271 |
+
$this->errors->add( 'bp_activity_missing_component', __( 'You need to define a component parameter to insert activity.', 'buddypress' ) );
|
272 |
} else {
|
273 |
+
$this->errors->add( 'bp_activity_missing_type', __( 'You need to define a type parameter to insert activity.', 'buddypress' ) );
|
274 |
}
|
275 |
|
276 |
return $this->errors;
|
277 |
}
|
278 |
}
|
279 |
|
280 |
+
/**
|
281 |
+
* Use this filter to make the content of your activity required.
|
282 |
+
*
|
283 |
+
* @since 6.0.0
|
284 |
+
*
|
285 |
+
* @param bool $value True if the content of the activity type is required.
|
286 |
+
* False otherwise.
|
287 |
+
* @param string $type The type of the activity we are about to insert.
|
288 |
+
*/
|
289 |
+
$type_requires_content = (bool) apply_filters( 'bp_activity_type_requires_content', $this->type === 'activity_update', $this->type );
|
290 |
+
if ( $type_requires_content && ! $this->content ) {
|
291 |
+
if ( 'bool' === $this->error_type ) {
|
292 |
+
return false;
|
293 |
+
} else {
|
294 |
+
$this->errors->add( 'bp_activity_missing_content', __( 'Please enter some content to post.', 'buddypress' ) );
|
295 |
+
|
296 |
+
return $this->errors;
|
297 |
+
}
|
298 |
+
}
|
299 |
+
|
300 |
if ( empty( $this->primary_link ) ) {
|
301 |
$this->primary_link = bp_loggedin_user_domain();
|
302 |
}
|
384 |
|
385 |
// Backward compatibility with old method of passing arguments.
|
386 |
if ( !is_array( $args ) || count( $function_args ) > 1 ) {
|
387 |
+
_deprecated_argument(
|
388 |
+
__METHOD__,
|
389 |
+
'1.6',
|
390 |
+
sprintf(
|
391 |
+
/* translators: 1: the name of the method. 2: the name of the file. */
|
392 |
+
__( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ),
|
393 |
+
__METHOD__,
|
394 |
+
__FILE__
|
395 |
+
)
|
396 |
+
);
|
397 |
|
398 |
$old_args_keys = array(
|
399 |
0 => 'max',
|
bp-activity/classes/class-bp-activity-component.php
CHANGED
@@ -71,7 +71,7 @@ class BP_Activity_Component extends BP_Component {
|
|
71 |
$includes[] = 'akismet';
|
72 |
}
|
73 |
|
74 |
-
// Embeds
|
75 |
if ( bp_is_active( $this->id, 'embeds' ) ) {
|
76 |
$includes[] = 'embeds';
|
77 |
}
|
@@ -431,7 +431,11 @@ class BP_Activity_Component extends BP_Component {
|
|
431 |
$bp->bp_options_avatar = bp_core_fetch_avatar( array(
|
432 |
'item_id' => bp_displayed_user_id(),
|
433 |
'type' => 'thumb',
|
434 |
-
'alt' => sprintf(
|
|
|
|
|
|
|
|
|
435 |
) );
|
436 |
$bp->bp_options_title = bp_get_displayed_user_fullname();
|
437 |
}
|
71 |
$includes[] = 'akismet';
|
72 |
}
|
73 |
|
74 |
+
// Embeds.
|
75 |
if ( bp_is_active( $this->id, 'embeds' ) ) {
|
76 |
$includes[] = 'embeds';
|
77 |
}
|
431 |
$bp->bp_options_avatar = bp_core_fetch_avatar( array(
|
432 |
'item_id' => bp_displayed_user_id(),
|
433 |
'type' => 'thumb',
|
434 |
+
'alt' => sprintf(
|
435 |
+
/* translators: %s: member name */
|
436 |
+
__( 'Profile picture of %s', 'buddypress' ),
|
437 |
+
bp_get_displayed_user_fullname()
|
438 |
+
),
|
439 |
) );
|
440 |
$bp->bp_options_title = bp_get_displayed_user_fullname();
|
441 |
}
|
bp-activity/classes/class-bp-activity-list-table.php
CHANGED
@@ -38,6 +38,14 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
38 |
*/
|
39 |
public $spam_count = 0;
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
/**
|
42 |
* Store activity-to-user-ID mappings for use in the In Response To column.
|
43 |
*
|
@@ -97,23 +105,18 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
97 |
$per_page = $this->get_items_per_page( str_replace( '-', '_', "{$this->screen->id}_per_page" ) );
|
98 |
|
99 |
// Check if we're on the "Spam" view.
|
100 |
-
if ( !empty( $_REQUEST['activity_status'] ) && 'spam'
|
101 |
$spam = 'spam_only';
|
102 |
$this->view = 'spam';
|
103 |
}
|
104 |
|
105 |
-
// Sort order.
|
106 |
-
if ( !empty( $_REQUEST['order'] ) && 'desc' != $_REQUEST['order'] )
|
107 |
-
$sort = 'ASC';
|
108 |
-
|
109 |
-
// Order by.
|
110 |
-
/*if ( !empty( $_REQUEST['orderby'] ) ) {
|
111 |
-
}*/
|
112 |
-
|
113 |
// Filter.
|
114 |
if ( ! empty( $_REQUEST['activity_type'] ) ) {
|
115 |
$filter = array( 'action' => $_REQUEST['activity_type'] );
|
116 |
|
|
|
|
|
|
|
117 |
/**
|
118 |
* Filter here to override the filter with a filter query
|
119 |
*
|
@@ -124,22 +127,30 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
124 |
$has_filter_query = apply_filters( 'bp_activity_list_table_filter_activity_type_items', $filter );
|
125 |
|
126 |
if ( ! empty( $has_filter_query['filter_query'] ) ) {
|
127 |
-
// Reset the filter
|
128 |
$filter = array();
|
129 |
|
130 |
-
// And use the filter query instead
|
131 |
$filter_query = $has_filter_query['filter_query'];
|
132 |
}
|
133 |
}
|
134 |
|
135 |
// Are we doing a search?
|
136 |
-
if ( !empty( $_REQUEST['s'] ) )
|
137 |
$search_terms = $_REQUEST['s'];
|
138 |
|
|
|
|
|
|
|
|
|
139 |
// Check if user has clicked on a specific activity (if so, fetch only that, and any related, activity).
|
140 |
-
if ( !empty( $_REQUEST['aid'] ) )
|
141 |
$include_id = (int) $_REQUEST['aid'];
|
142 |
|
|
|
|
|
|
|
|
|
143 |
// Get the spam total (ignoring any search query or filter).
|
144 |
$spams = bp_activity_get( array(
|
145 |
'display_comments' => 'stream',
|
@@ -160,7 +171,6 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
160 |
'search_terms' => $search_terms,
|
161 |
'filter_query' => $filter_query,
|
162 |
'show_hidden' => true,
|
163 |
-
// 'sort' => $sort,
|
164 |
'spam' => $spam,
|
165 |
'count_total' => 'count_query',
|
166 |
) );
|
@@ -184,7 +194,7 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
184 |
}
|
185 |
|
186 |
// Set raw data to display.
|
187 |
-
$this->items
|
188 |
|
189 |
// Store information needed for handling table pagination.
|
190 |
$this->set_pagination_args( array(
|
@@ -195,6 +205,25 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
195 |
|
196 |
// Don't truncate activity items; bp_activity_truncate_entry() needs to be used inside a BP_Activity_Template loop.
|
197 |
remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
}
|
199 |
|
200 |
/**
|
@@ -309,12 +338,34 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
309 |
|
310 |
<h2 class="screen-reader-text"><?php
|
311 |
/* translators: accessibility text */
|
312 |
-
|
313 |
?></h2>
|
314 |
|
315 |
<ul class="subsubsub">
|
316 |
-
<li class="all"
|
317 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
|
319 |
<?php
|
320 |
|
@@ -553,6 +604,7 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
553 |
if ( isset( $actions[ $item['type'] ] ) ) {
|
554 |
echo $actions[ $item['type'] ];
|
555 |
} else {
|
|
|
556 |
printf( __( 'Unregistered action - %s', 'buddypress' ), $item['type'] );
|
557 |
}
|
558 |
}
|
@@ -645,21 +697,20 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
645 |
// End timestamp.
|
646 |
echo '</div>';
|
647 |
|
|
|
|
|
648 |
// Get activity content - if not set, use the action.
|
649 |
if ( ! empty( $item['content'] ) ) {
|
650 |
-
$activity = new BP_Activity_Activity( $item['id'] );
|
651 |
-
|
652 |
/** This filter is documented in bp-activity/bp-activity-template.php */
|
653 |
$content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $item['content'], &$activity ) );
|
654 |
} else {
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
$content = apply_filters_ref_array( 'bp_get_activity_action', array( $item['action'] ) );
|
663 |
}
|
664 |
|
665 |
/**
|
38 |
*/
|
39 |
public $spam_count = 0;
|
40 |
|
41 |
+
/**
|
42 |
+
* Total number of activities.
|
43 |
+
*
|
44 |
+
* @since 6.0.0
|
45 |
+
* @var int $all_count
|
46 |
+
*/
|
47 |
+
public $all_count = 0;
|
48 |
+
|
49 |
/**
|
50 |
* Store activity-to-user-ID mappings for use in the In Response To column.
|
51 |
*
|
105 |
$per_page = $this->get_items_per_page( str_replace( '-', '_', "{$this->screen->id}_per_page" ) );
|
106 |
|
107 |
// Check if we're on the "Spam" view.
|
108 |
+
if ( ! empty( $_REQUEST['activity_status'] ) && 'spam' === $_REQUEST['activity_status'] ) {
|
109 |
$spam = 'spam_only';
|
110 |
$this->view = 'spam';
|
111 |
}
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
// Filter.
|
114 |
if ( ! empty( $_REQUEST['activity_type'] ) ) {
|
115 |
$filter = array( 'action' => $_REQUEST['activity_type'] );
|
116 |
|
117 |
+
// Set the view as a filtered one.
|
118 |
+
$this->view = 'filtered';
|
119 |
+
|
120 |
/**
|
121 |
* Filter here to override the filter with a filter query
|
122 |
*
|
127 |
$has_filter_query = apply_filters( 'bp_activity_list_table_filter_activity_type_items', $filter );
|
128 |
|
129 |
if ( ! empty( $has_filter_query['filter_query'] ) ) {
|
130 |
+
// Reset the filter.
|
131 |
$filter = array();
|
132 |
|
133 |
+
// And use the filter query instead.
|
134 |
$filter_query = $has_filter_query['filter_query'];
|
135 |
}
|
136 |
}
|
137 |
|
138 |
// Are we doing a search?
|
139 |
+
if ( ! empty( $_REQUEST['s'] ) ) {
|
140 |
$search_terms = $_REQUEST['s'];
|
141 |
|
142 |
+
// Set the view as a search request.
|
143 |
+
$this->view = 'search';
|
144 |
+
}
|
145 |
+
|
146 |
// Check if user has clicked on a specific activity (if so, fetch only that, and any related, activity).
|
147 |
+
if ( ! empty( $_REQUEST['aid'] ) ) {
|
148 |
$include_id = (int) $_REQUEST['aid'];
|
149 |
|
150 |
+
// Set the view as a single activity.
|
151 |
+
$this->view = 'single';
|
152 |
+
}
|
153 |
+
|
154 |
// Get the spam total (ignoring any search query or filter).
|
155 |
$spams = bp_activity_get( array(
|
156 |
'display_comments' => 'stream',
|
171 |
'search_terms' => $search_terms,
|
172 |
'filter_query' => $filter_query,
|
173 |
'show_hidden' => true,
|
|
|
174 |
'spam' => $spam,
|
175 |
'count_total' => 'count_query',
|
176 |
) );
|
194 |
}
|
195 |
|
196 |
// Set raw data to display.
|
197 |
+
$this->items = $new_activities;
|
198 |
|
199 |
// Store information needed for handling table pagination.
|
200 |
$this->set_pagination_args( array(
|
205 |
|
206 |
// Don't truncate activity items; bp_activity_truncate_entry() needs to be used inside a BP_Activity_Template loop.
|
207 |
remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
|
208 |
+
|
209 |
+
// Set the Total number of activities.
|
210 |
+
if ( 'all' === $this->view ) {
|
211 |
+
$this->all_count = (int) $activities['total'];
|
212 |
+
|
213 |
+
// Only perform a query if not on the main list view.
|
214 |
+
} elseif ( 'single' !== $this->view ) {
|
215 |
+
$count_activities = bp_activity_get(
|
216 |
+
array(
|
217 |
+
'fields' => 'ids',
|
218 |
+
'show_hidden' => true,
|
219 |
+
'count_total' => 'count_query',
|
220 |
+
)
|
221 |
+
);
|
222 |
+
|
223 |
+
if ( $count_activities['total'] ) {
|
224 |
+
$this->all_count = (int) $count_activities['total'];
|
225 |
+
}
|
226 |
+
}
|
227 |
}
|
228 |
|
229 |
/**
|
338 |
|
339 |
<h2 class="screen-reader-text"><?php
|
340 |
/* translators: accessibility text */
|
341 |
+
esc_html_e( 'Filter activities list', 'buddypress' );
|
342 |
?></h2>
|
343 |
|
344 |
<ul class="subsubsub">
|
345 |
+
<li class="all">
|
346 |
+
<a href="<?php echo esc_url( $url_base ); ?>" class="<?php if ( 'all' === $this->view ) echo 'current'; ?>">
|
347 |
+
<?php printf(
|
348 |
+
/* translators: %s is the placeholder for the count html tag `<span class="count"/>` */
|
349 |
+
esc_html__( 'All %s', 'buddypress' ),
|
350 |
+
sprintf(
|
351 |
+
'<span class="count">(%s)</span>',
|
352 |
+
number_format_i18n( $this->all_count )
|
353 |
+
)
|
354 |
+
); ?>
|
355 |
+
</a> |
|
356 |
+
</li>
|
357 |
+
<li class="spam">
|
358 |
+
<a href="<?php echo esc_url( add_query_arg( array( 'activity_status' => 'spam' ), $url_base ) ); ?>" class="<?php if ( 'spam' === $this->view ) echo 'current'; ?>">
|
359 |
+
<?php printf(
|
360 |
+
/* translators: %s is the placeholder for the count html tag `<span class="count"/>` */
|
361 |
+
esc_html__( 'Spam %s', 'buddypress' ),
|
362 |
+
sprintf(
|
363 |
+
'<span class="count">(%s)</span>',
|
364 |
+
number_format_i18n( $this->spam_count )
|
365 |
+
)
|
366 |
+
); ?>
|
367 |
+
</a>
|
368 |
+
</li>
|
369 |
|
370 |
<?php
|
371 |
|
604 |
if ( isset( $actions[ $item['type'] ] ) ) {
|
605 |
echo $actions[ $item['type'] ];
|
606 |
} else {
|
607 |
+
/* translators: %s: the name of the activity type */
|
608 |
printf( __( 'Unregistered action - %s', 'buddypress' ), $item['type'] );
|
609 |
}
|
610 |
}
|
697 |
// End timestamp.
|
698 |
echo '</div>';
|
699 |
|
700 |
+
$activity = new BP_Activity_Activity( $item['id'] );
|
701 |
+
|
702 |
// Get activity content - if not set, use the action.
|
703 |
if ( ! empty( $item['content'] ) ) {
|
|
|
|
|
704 |
/** This filter is documented in bp-activity/bp-activity-template.php */
|
705 |
$content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $item['content'], &$activity ) );
|
706 |
} else {
|
707 |
+
// Emulate bp_get_activity_action().
|
708 |
+
$r = array(
|
709 |
+
'no_timestamp' => false,
|
710 |
+
);
|
711 |
+
|
712 |
+
/** This filter is documented in bp-activity/bp-activity-template.php */
|
713 |
+
$content = apply_filters_ref_array( 'bp_get_activity_action', array( $item['action'], &$activity, $r ) );
|
|
|
714 |
}
|
715 |
|
716 |
/**
|
bp-activity/classes/class-bp-akismet.php
CHANGED
@@ -92,10 +92,13 @@ class BP_Akismet {
|
|
92 |
} else {
|
93 |
$who = bp_activity_get_meta( $activity['id'], '_bp_akismet_user' );
|
94 |
|
95 |
-
if ( 'true' == $user_result )
|
|
|
96 |
$desc = sprintf( __( 'Flagged as spam by %s', 'buddypress' ), $who );
|
97 |
-
else
|
|
|
98 |
$desc = sprintf( __( 'Un-spammed by %s', 'buddypress' ), $who );
|
|
|
99 |
}
|
100 |
|
101 |
// Add a History item to the hover links, just after Edit.
|
@@ -442,7 +445,16 @@ class BP_Akismet {
|
|
442 |
if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) )
|
443 |
return;
|
444 |
|
445 |
-
$this->update_activity_history(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
bp_activity_update_meta( $activity->id, '_bp_akismet_user_result', 'true' );
|
447 |
bp_activity_update_meta( $activity->id, '_bp_akismet_user', bp_get_loggedin_user_username() );
|
448 |
}
|
@@ -459,7 +471,16 @@ class BP_Akismet {
|
|
459 |
if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) )
|
460 |
return;
|
461 |
|
462 |
-
$this->update_activity_history(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
bp_activity_update_meta( $activity->id, '_bp_akismet_user_result', 'false' );
|
464 |
bp_activity_update_meta( $activity->id, '_bp_akismet_user', bp_get_loggedin_user_username() );
|
465 |
}
|
@@ -493,7 +514,15 @@ class BP_Akismet {
|
|
493 |
// Uh oh, something's gone horribly wrong. Unexpected result.
|
494 |
} else {
|
495 |
bp_activity_update_meta( $activity->id, '_bp_akismet_error', bp_core_current_time() );
|
496 |
-
$this->update_activity_history(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
497 |
}
|
498 |
|
499 |
// Record the original data which was submitted to Akismet for checking.
|
@@ -618,6 +647,7 @@ class BP_Akismet {
|
|
618 |
return;
|
619 |
|
620 |
echo '<div class="akismet-history"><div>';
|
|
|
621 |
printf( _x( '%1$s — %2$s', 'x hours ago - akismet cleared this item', 'buddypress' ), '<span>' . bp_core_time_since( $history[2] ) . '</span>', esc_html( $history[1] ) );
|
622 |
echo '</div></div>';
|
623 |
}
|
92 |
} else {
|
93 |
$who = bp_activity_get_meta( $activity['id'], '_bp_akismet_user' );
|
94 |
|
95 |
+
if ( 'true' == $user_result ) {
|
96 |
+
/* translators: %s: the name of the user */
|
97 |
$desc = sprintf( __( 'Flagged as spam by %s', 'buddypress' ), $who );
|
98 |
+
} else {
|
99 |
+
/* translators: %s: the name of the user */
|
100 |
$desc = sprintf( __( 'Un-spammed by %s', 'buddypress' ), $who );
|
101 |
+
}
|
102 |
}
|
103 |
|
104 |
// Add a History item to the hover links, just after Edit.
|
445 |
if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) )
|
446 |
return;
|
447 |
|
448 |
+
$this->update_activity_history(
|
449 |
+
$activity->id,
|
450 |
+
sprintf(
|
451 |
+
/* translators: %s: the current user username */
|
452 |
+
__( '%s reported this activity as spam', 'buddypress' ),
|
453 |
+
bp_get_loggedin_user_username()
|
454 |
+
),
|
455 |
+
'report-spam'
|
456 |
+
);
|
457 |
+
|
458 |
bp_activity_update_meta( $activity->id, '_bp_akismet_user_result', 'true' );
|
459 |
bp_activity_update_meta( $activity->id, '_bp_akismet_user', bp_get_loggedin_user_username() );
|
460 |
}
|
471 |
if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) )
|
472 |
return;
|
473 |
|
474 |
+
$this->update_activity_history(
|
475 |
+
$activity->id,
|
476 |
+
sprintf(
|
477 |
+
/* translators: %s: the current user username */
|
478 |
+
__( '%s reported this activity as not spam', 'buddypress' ),
|
479 |
+
bp_get_loggedin_user_username()
|
480 |
+
),
|
481 |
+
'report-ham'
|
482 |
+
);
|
483 |
+
|
484 |
bp_activity_update_meta( $activity->id, '_bp_akismet_user_result', 'false' );
|
485 |
bp_activity_update_meta( $activity->id, '_bp_akismet_user', bp_get_loggedin_user_username() );
|
486 |
}
|
514 |
// Uh oh, something's gone horribly wrong. Unexpected result.
|
515 |
} else {
|
516 |
bp_activity_update_meta( $activity->id, '_bp_akismet_error', bp_core_current_time() );
|
517 |
+
$this->update_activity_history(
|
518 |
+
$activity->id,
|
519 |
+
sprintf(
|
520 |
+
/* translators: %s the akismet result */
|
521 |
+
__( 'Akismet was unable to check this item (response: %s), will automatically retry again later.', 'buddypress' ),
|
522 |
+
$this->last_activity->akismet_submission['bp_as_result']
|
523 |
+
),
|
524 |
+
'check-error'
|
525 |
+
);
|
526 |
}
|
527 |
|
528 |
// Record the original data which was submitted to Akismet for checking.
|
647 |
return;
|
648 |
|
649 |
echo '<div class="akismet-history"><div>';
|
650 |
+
/* translators: 1: the human diff time. 2: the akismet history data. */
|
651 |
printf( _x( '%1$s — %2$s', 'x hours ago - akismet cleared this item', 'buddypress' ), '<span>' . bp_core_time_since( $history[2] ) . '</span>', esc_html( $history[1] ) );
|
652 |
echo '</div></div>';
|
653 |
}
|
bp-activity/classes/class-bp-rest-activity-endpoint.php
CHANGED
@@ -140,6 +140,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
|
|
140 |
'display_comments' => $request['display_comments'],
|
141 |
'site_id' => $request['site_id'],
|
142 |
'group_id' => $request['group_id'],
|
|
|
143 |
'count_total' => true,
|
144 |
'fields' => 'all',
|
145 |
'show_hidden' => false,
|
@@ -193,6 +194,10 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
|
|
193 |
}
|
194 |
}
|
195 |
|
|
|
|
|
|
|
|
|
196 |
if ( isset( $request['type'] ) ) {
|
197 |
$args['filter']['action'] = $request['type'];
|
198 |
}
|
@@ -278,6 +283,16 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
|
|
278 |
public function get_item( $request ) {
|
279 |
$activity = $this->get_activity_object( $request );
|
280 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
$retval = array(
|
282 |
$this->prepare_response_for_collection(
|
283 |
$this->prepare_item_for_response( $activity, $request )
|
@@ -783,9 +798,6 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
|
|
783 |
);
|
784 |
}
|
785 |
|
786 |
-
// Setting context.
|
787 |
-
$request->set_param( 'context', 'edit' );
|
788 |
-
|
789 |
// Prepare the response now the user favorites has been updated.
|
790 |
$retval = array(
|
791 |
$this->prepare_response_for_collection(
|
@@ -876,7 +888,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
|
|
876 |
// Set up activity oEmbed cache.
|
877 |
bp_activity_embed();
|
878 |
|
879 |
-
$rendered = apply_filters( 'bp_get_activity_content_body', $activity->content );
|
880 |
|
881 |
// Restore the `activities_template` global.
|
882 |
$GLOBALS['activities_template'] = $activities_template;
|
@@ -1391,7 +1403,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
|
|
1391 |
|
1392 |
|