BuddyPress - Version 9.1.1

Version Description

See: https://codex.buddypress.org/releases/version-9-1-1/

Download this release

Release Info

Developer imath
Plugin Icon 128x128 BuddyPress
Version 9.1.1
Comparing to
See all releases

Code changes from version 8.0.2 to 9.1.1

Files changed (183) hide show
  1. bp-activity/actions/reply.php +26 -12
  2. bp-activity/bp-activity-blocks.php +145 -11
  3. bp-activity/bp-activity-functions.php +46 -0
  4. bp-activity/classes/class-bp-activity-component.php +59 -15
  5. bp-activity/classes/class-bp-rest-activity-endpoint.php +100 -98
  6. bp-activity/css/blocks/latest-activities-rtl.css +81 -0
  7. bp-activity/css/blocks/latest-activities-rtl.min.css +1 -0
  8. bp-activity/css/blocks/latest-activities.css +81 -0
  9. bp-activity/css/blocks/latest-activities.min.css +1 -0
  10. bp-activity/js/blocks/embed-activity.js +10 -10
  11. bp-activity/js/blocks/embed-activity.js.map +1 -1
  12. bp-activity/js/blocks/latest-activities.js +8 -0
  13. bp-activity/js/blocks/latest-activities.js.map +1 -0
  14. bp-activity/sass/blocks/latest-activities.scss +100 -0
  15. bp-blogs/bp-blogs-blocks.php +137 -0
  16. bp-blogs/classes/class-bp-blogs-component.php +56 -3
  17. bp-blogs/classes/class-bp-blogs-recent-posts-widget.php +6 -0
  18. bp-blogs/classes/class-bp-rest-attachments-blog-avatar-endpoint.php +6 -6
  19. bp-blogs/classes/class-bp-rest-blogs-endpoint.php +71 -30
  20. bp-blogs/css/blocks/recent-posts-rtl.css +42 -0
  21. bp-blogs/css/blocks/recent-posts-rtl.min.css +1 -0
  22. bp-blogs/css/blocks/recent-posts.css +42 -0
  23. bp-blogs/css/blocks/recent-posts.min.css +1 -0
  24. bp-blogs/js/blocks/recent-posts.js +8 -0
  25. bp-blogs/js/blocks/recent-posts.js.map +1 -0
  26. bp-blogs/sass/blocks/recent-posts.scss +46 -0
  27. bp-core/admin/bp-core-admin-slugs.php +2 -2
  28. bp-core/admin/css/common-rtl.css +10 -2
  29. bp-core/admin/css/common-rtl.min.css +1 -1
  30. bp-core/admin/css/common.css +10 -2
  31. bp-core/admin/css/common.min.css +1 -1
  32. bp-core/admin/css/hello-rtl.css +0 -1
  33. bp-core/admin/css/hello-rtl.min.css +1 -1
  34. bp-core/admin/css/hello.css +0 -1
  35. bp-core/admin/css/hello.min.css +1 -1
  36. bp-core/bp-core-blocks.php +305 -1
  37. bp-core/bp-core-cssjs.php +3 -0
  38. bp-core/bp-core-rest-api.php +13 -9
  39. bp-core/bp-core-template-loader.php +57 -0
  40. bp-core/bp-core-template.php +51 -0
  41. bp-core/classes/class-bp-admin.php +45 -112
  42. bp-core/classes/class-bp-block.php +23 -1
  43. bp-core/classes/class-bp-button.php +11 -0
  44. bp-core/classes/class-bp-component.php +115 -77
  45. bp-core/classes/class-bp-core-login-widget.php +2 -0
  46. bp-core/classes/class-bp-core.php +63 -7
  47. bp-core/classes/class-bp-rest-components-endpoint.php +121 -19
  48. bp-core/classes/class-bp-theme-compat.php +12 -0
  49. bp-core/css/blocks/login-form-rtl.css +36 -0
  50. bp-core/css/blocks/login-form-rtl.min.css +1 -0
  51. bp-core/css/blocks/login-form.css +36 -0
  52. bp-core/css/blocks/login-form.min.css +1 -0
  53. bp-core/deprecated/9.0.php +24 -0
  54. bp-core/images/bp-members-invitations-invite-screen.png +0 -0
  55. bp-core/images/bp-members-invitations-manage-admin-screen.png +0 -0
  56. bp-core/images/bp-widget-blocks.jpg +0 -0
  57. bp-core/images/bp-xprofile-admin-signup-fields.png +0 -0
  58. bp-core/images/bp-xprofile-checkbox-acceptance-field-type.png +0 -0
  59. bp-core/images/bp-xprofile-wp-field-type.png +0 -0
  60. bp-core/images/latest-activities.jpg +0 -0
  61. bp-core/images/legacy-widget-to-block.jpg +0 -0
  62. bp-core/js/block-components.js +13 -11
  63. bp-core/js/block-components.js.map +1 -1
  64. bp-core/js/block-data.js +42 -0
  65. bp-core/js/block-data.js.map +1 -0
  66. bp-core/js/blocks/login-form.js +8 -0
  67. bp-core/js/blocks/login-form.js.map +1 -0
  68. bp-core/js/blocks/primary-nav.js +8 -0
  69. bp-core/js/blocks/primary-nav.js.map +1 -0
  70. bp-core/js/dynamic-widget-block.js +4 -0
  71. bp-core/js/dynamic-widget-block.js.map +1 -0
  72. bp-core/sass/blocks/login-form.scss +43 -0
  73. bp-friends/bp-friends-blocks.php +266 -0
  74. bp-friends/bp-friends-cssjs.php +35 -0
  75. bp-friends/classes/class-bp-core-friends-widget.php +4 -2
  76. bp-friends/classes/class-bp-friends-component.php +58 -1
  77. bp-friends/classes/class-bp-rest-friends-endpoint.php +3 -3
  78. bp-friends/css/blocks/friends-rtl.css +36 -0
  79. bp-friends/css/blocks/friends-rtl.min.css +1 -0
  80. bp-friends/css/blocks/friends.css +36 -0
  81. bp-friends/css/blocks/friends.min.css +1 -0
  82. bp-friends/js/blocks/friends.js +10 -0
  83. bp-friends/js/blocks/friends.js.map +1 -0
  84. bp-friends/js/friends.js +4 -0
  85. bp-friends/js/friends.js.map +1 -0
  86. bp-friends/sass/blocks/friends.scss +40 -0
  87. bp-groups/bp-groups-blocks.php +233 -28
  88. bp-groups/bp-groups-cssjs.php +22 -0
  89. bp-groups/bp-groups-functions.php +2 -2
  90. bp-groups/classes/class-bp-groups-component.php +41 -5
  91. bp-groups/classes/class-bp-groups-widget.php +3 -1
  92. bp-groups/classes/class-bp-rest-attachments-group-avatar-endpoint.php +3 -3
  93. bp-groups/classes/class-bp-rest-attachments-group-cover-endpoint.php +1 -1
  94. bp-groups/classes/class-bp-rest-group-invites-endpoint.php +28 -28
  95. bp-groups/classes/class-bp-rest-group-membership-endpoint.php +31 -31
  96. bp-groups/classes/class-bp-rest-group-membership-request-endpoint.php +26 -22
  97. bp-groups/classes/class-bp-rest-groups-endpoint.php +62 -52
  98. bp-groups/css/blocks/dynamic-groups-rtl.css +36 -0
  99. bp-groups/css/blocks/dynamic-groups-rtl.min.css +1 -0
  100. bp-groups/css/blocks/dynamic-groups.css +36 -0
  101. bp-groups/css/blocks/dynamic-groups.min.css +1 -0
  102. bp-groups/css/blocks/groups-rtl.css +0 -1
  103. bp-groups/css/blocks/groups-rtl.min.css +1 -1
  104. bp-groups/css/blocks/groups.css +0 -1
  105. bp-groups/css/blocks/groups.min.css +1 -1
  106. bp-groups/js/blocks/dynamic-groups.js +10 -0
  107. bp-groups/js/blocks/dynamic-groups.js.map +1 -0
  108. bp-groups/js/blocks/group.js +2 -2
  109. bp-groups/js/blocks/group.js.map +1 -1
  110. bp-groups/js/blocks/groups.js +12 -12
  111. bp-groups/js/blocks/groups.js.map +1 -1
  112. bp-groups/js/dynamic-groups.js +4 -0
  113. bp-groups/js/dynamic-groups.js.map +1 -0
  114. bp-groups/sass/blocks/dynamic-groups.scss +40 -0
  115. bp-loader.php +1 -1
  116. bp-members/admin/js/admin.js +7 -8
  117. bp-members/admin/js/admin.min.js +1 -1
  118. bp-members/bp-members-blocks.php +392 -25
  119. bp-members/bp-members-cssjs.php +35 -0
  120. bp-members/classes/class-bp-core-members-widget.php +3 -1
  121. bp-members/classes/class-bp-core-recently-active-widget.php +2 -0
  122. bp-members/classes/class-bp-core-whos-online-widget.php +3 -0
  123. bp-members/classes/class-bp-members-component.php +102 -10
  124. bp-members/classes/class-bp-rest-attachments-member-avatar-endpoint.php +5 -5
  125. bp-members/classes/class-bp-rest-attachments-member-cover-endpoint.php +2 -2
  126. bp-members/classes/class-bp-rest-members-endpoint.php +78 -37
  127. bp-members/classes/class-bp-rest-signup-endpoint.php +14 -15
  128. bp-members/css/blocks/dynamic-members-rtl.css +36 -0
  129. bp-members/css/blocks/dynamic-members-rtl.min.css +1 -0
  130. bp-members/css/blocks/dynamic-members.css +36 -0
  131. bp-members/css/blocks/dynamic-members.min.css +1 -0
  132. bp-members/css/blocks/member-avatar-blocks-rtl.css +10 -0
  133. bp-members/css/blocks/member-avatar-blocks-rtl.min.css +1 -0
  134. bp-members/css/blocks/member-avatar-blocks.css +10 -0
  135. bp-members/css/blocks/member-avatar-blocks.min.css +1 -0
  136. bp-members/css/blocks/members-rtl.css +0 -1
  137. bp-members/css/blocks/members-rtl.min.css +1 -1
  138. bp-members/css/blocks/members.css +0 -1
  139. bp-members/css/blocks/members.min.css +1 -1
  140. bp-members/js/blocks/active-members.js +8 -0
  141. bp-members/js/blocks/active-members.js.map +1 -0
  142. bp-members/js/blocks/dynamic-members.js +10 -0
  143. bp-members/js/blocks/dynamic-members.js.map +1 -0
  144. bp-members/js/blocks/member.js +2 -2
  145. bp-members/js/blocks/member.js.map +1 -1
  146. bp-members/js/blocks/members.js +12 -12
  147. bp-members/js/blocks/members.js.map +1 -1
  148. bp-members/js/blocks/online-members.js +8 -0
  149. bp-members/js/blocks/online-members.js.map +1 -0
  150. bp-members/js/dynamic-members.js +4 -0
  151. bp-members/js/dynamic-members.js.map +1 -0
  152. bp-members/sass/blocks/dynamic-members.scss +40 -0
  153. bp-members/sass/blocks/member-avatar-blocks.scss +13 -0
  154. bp-messages/actions/notices.php +45 -1
  155. bp-messages/bp-messages-blocks.php +132 -0
  156. bp-messages/bp-messages-cssjs.php +19 -0
  157. bp-messages/bp-messages-functions.php +66 -6
  158. bp-messages/bp-messages-template.php +30 -1
  159. bp-messages/classes/class-bp-messages-component.php +39 -0
  160. bp-messages/classes/class-bp-messages-sitewide-notices-widget.php +4 -0
  161. bp-messages/classes/class-bp-messages-thread.php +24 -12
  162. bp-messages/classes/class-bp-rest-messages-endpoint.php +137 -60
  163. bp-messages/classes/class-bp-rest-sitewide-notices-endpoint.php +976 -0
  164. bp-messages/css/blocks/sitewide-notices-rtl.css +77 -0
  165. bp-messages/css/blocks/sitewide-notices-rtl.min.css +1 -0
  166. bp-messages/css/blocks/sitewide-notices.css +77 -0
  167. bp-messages/css/blocks/sitewide-notices.min.css +1 -0
  168. bp-messages/js/blocks/sitewide-notices.js +8 -0
  169. bp-messages/js/blocks/sitewide-notices.js.map +1 -0
  170. bp-messages/js/sitewide-notices.js +4 -0
  171. bp-messages/js/sitewide-notices.js.map +1 -0
  172. bp-messages/sass/blocks/sitewide-notices.scss +80 -0
  173. bp-notifications/classes/class-bp-rest-notifications-endpoint.php +99 -55
  174. bp-settings/actions/general.php +58 -26
  175. bp-settings/classes/class-bp-settings-component.php +12 -0
  176. bp-templates/bp-legacy/buddypress-functions.php +4 -11
  177. bp-templates/bp-legacy/buddypress/assets/widgets/dynamic-groups.php +27 -0
  178. bp-templates/bp-legacy/buddypress/assets/widgets/dynamic-members.php +27 -0
  179. bp-templates/bp-legacy/buddypress/assets/widgets/friends.php +27 -0
  180. bp-templates/bp-legacy/css/buddypress-rtl.css +5 -2
  181. bp-templates/bp-legacy/css/buddypress-rtl.min.css +1 -1
  182. bp-templates/bp-legacy/css/buddypress.css +5 -2
  183. bp-templates/bp-legacy/css/buddypress.min.css +1 -1
bp-activity/actions/reply.php CHANGED
@@ -15,20 +15,31 @@
15
  * @return bool False on failure.
16
  */
17
  function bp_activity_action_post_comment() {
18
- if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'reply' ) )
19
  return false;
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  // Check the nonce.
22
- check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
23
 
24
  /**
25
  * Filters the activity ID a comment will be in reply to.
26
  *
27
  * @since 1.2.0
28
  *
29
- * @param string $value ID of the activity being replied to.
30
  */
31
- $activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] );
32
 
33
  /**
34
  * Filters the comment content for a comment reply.
@@ -50,17 +61,20 @@ function bp_activity_action_post_comment() {
50
  bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
51
  }
52
 
53
- $comment_id = bp_activity_new_comment( array(
54
- 'content' => $content,
55
- 'activity_id' => $activity_id,
56
- 'parent_id' => false
57
- ));
 
 
58
 
59
- if ( !empty( $comment_id ) )
60
  bp_core_add_message( __( 'Reply Posted!', 'buddypress' ) );
61
- else
62
  bp_core_add_message( __( 'There was an error posting that reply. Please try again.', 'buddypress' ), 'error' );
 
63
 
64
  bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
65
  }
66
- add_action( 'bp_actions', 'bp_activity_action_post_comment' );
15
  * @return bool False on failure.
16
  */
17
  function bp_activity_action_post_comment() {
18
+ if ( ! is_user_logged_in() || ! bp_is_activity_component() || ! bp_is_current_action( 'reply' ) ) {
19
  return false;
20
+ }
21
+
22
+ if ( ! isset( $_POST['comment_form_id'] ) ) {
23
+ return false;
24
+ }
25
+
26
+ $activity_id = absint( wp_unslash( $_POST['comment_form_id'] ) );
27
+
28
+ if ( ! isset( $activity_id ) ) {
29
+ return false;
30
+ }
31
 
32
  // Check the nonce.
33
+ check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment_' . $activity_id );
34
 
35
  /**
36
  * Filters the activity ID a comment will be in reply to.
37
  *
38
  * @since 1.2.0
39
  *
40
+ * @param string $activity_id ID of the activity being replied to.
41
  */
42
+ $activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $activity_id );
43
 
44
  /**
45
  * Filters the comment content for a comment reply.
61
  bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
62
  }
63
 
64
+ $comment_id = bp_activity_new_comment(
65
+ array(
66
+ 'content' => $content,
67
+ 'activity_id' => $activity_id,
68
+ 'parent_id' => false
69
+ )
70
+ );
71
 
72
+ if ( ! empty( $comment_id ) ) {
73
  bp_core_add_message( __( 'Reply Posted!', 'buddypress' ) );
74
+ } else {
75
  bp_core_add_message( __( 'There was an error posting that reply. Please try again.', 'buddypress' ), 'error' );
76
+ }
77
 
78
  bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
79
  }
80
+ add_action( 'bp_actions', 'bp_activity_action_post_comment' );
bp-activity/bp-activity-blocks.php CHANGED
@@ -13,21 +13,155 @@ if ( ! defined( 'ABSPATH' ) ) {
13
  }
14
 
15
  /**
16
- * Add BP Activity blocks specific settings to the BP Blocks Editor ones.
17
  *
18
- * @since 7.0.0
19
  *
20
- * @param array $bp_editor_settings BP blocks editor settings.
21
- * @return array BP Activity blocks editor settings.
22
  */
23
- function bp_activity_editor_settings( $bp_editor_settings = array() ) {
24
- return array_merge(
25
- $bp_editor_settings,
26
  array(
27
- 'activity' => array(
28
- 'embedScriptURL' => includes_url( 'js/wp-embed.min.js' ),
29
- ),
 
30
  )
31
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  }
33
- add_filter( 'bp_blocks_editor_settings', 'bp_activity_editor_settings' );
13
  }
14
 
15
  /**
16
+ * Callback function to render the Latest Activities Block.
17
  *
18
+ * @since 9.0.0
19
  *
20
+ * @param array $attributes The block attributes.
21
+ * @return string HTML output.
22
  */
23
+ function bp_activity_render_latest_activities_block( $attributes = array() ) {
24
+ $block_args = wp_parse_args(
25
+ $attributes,
26
  array(
27
+ 'title' => __( 'Latest updates', 'buddypress' ),
28
+ 'maxActivities' => 5,
29
+ 'type' => array( 'activity_update' ),
30
+ 'postId' => 0,
31
  )
32
  );
33
+
34
+ $max_activities = (int) $block_args['maxActivities'];
35
+
36
+ // Should we get a specific member's activities?
37
+ $member_id = 0;
38
+ if ( $block_args['postId'] ) {
39
+ $member_id = (int) get_post_field( 'post_author', $block_args['postId'] );
40
+ } else {
41
+ $member_id = bp_displayed_user_id();
42
+ }
43
+
44
+ // Set the widget's wrapper attributes.
45
+ $types = (array) $block_args['type'];
46
+ $classnames = array_map( 'sanitize_html_class', array_merge( $types, array( 'bp-latest-activities', 'buddypress', 'widget' ) ) );
47
+ $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classnames ) ) );
48
+
49
+ // Set the Block's title.
50
+ $widget_content = sprintf( '<h2 class="widget-title">%s</h2>', esc_html( $block_args['title'] ) );
51
+
52
+ // Avoid conflicts with other activity loops.
53
+ $reset_activities_template = null;
54
+ if ( ! empty( $GLOBALS['activities_template'] ) ) {
55
+ $reset_activities_template = $GLOBALS['activities_template'];
56
+ }
57
+
58
+ /**
59
+ * Filter here to edit the arguments used by the Latest Activities block.
60
+ *
61
+ * @since 9.0.0
62
+ *
63
+ * @param array $widget_args The list of arguments for the Activity query.
64
+ * @param array $block_args The list of Block attributes.
65
+ */
66
+ $widget_args = apply_filters(
67
+ 'bp_activity_block_latest_updates_args',
68
+ array(
69
+ 'max' => $max_activities,
70
+ 'scope' => 'all',
71
+ 'user_id' => $member_id,
72
+ 'object' => false,
73
+ 'action' => implode( ',', $types ),
74
+ 'primary_id' => 0,
75
+ 'secondary_id' => 0,
76
+ ),
77
+ $block_args
78
+ );
79
+
80
+ // Build the activity loop.
81
+ if ( 'nouveau' === bp_get_theme_compat_id() ) {
82
+ $bp_nouveau = bp_nouveau();
83
+
84
+ // Globalize the activity widget arguments.
85
+ $bp_nouveau->activity->widget_args = $widget_args;
86
+
87
+ ob_start();
88
+ bp_get_template_part( 'activity/widget' );
89
+ $widget_content .= ob_get_clean();
90
+
91
+ // Reset the global.
92
+ $bp_nouveau->activity->widget_args = array();
93
+ } else {
94
+ $activity_loop = sprintf( '<div class="widget-error"><p>%s</p></div>', esc_html__( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ) );
95
+
96
+ if ( bp_has_activities( $widget_args ) ) {
97
+ $activity_loop = '';
98
+
99
+ while ( bp_activities() ) {
100
+ bp_the_activity();
101
+
102
+ $activity_footer = '';
103
+ $activity_classes = 'activity-item';
104
+ if ( bp_activity_has_content() ) {
105
+ $activity_content = bp_get_activity_content_body();
106
+ $activity_footer = sprintf(
107
+ '<footer>
108
+ <cite>
109
+ <a href="%1$s" class="bp-tooltip" data-bp-tooltip="%2$s">
110
+ %3$s
111
+ </a>
112
+ </cite>
113
+ %4$s
114
+ </footer>',
115
+ bp_get_activity_user_link(),
116
+ bp_get_activity_member_display_name(),
117
+ bp_get_activity_avatar(
118
+ array(
119
+ 'type' => 'thumb',
120
+ 'width' => '40',
121
+ 'height' => '40',
122
+ )
123
+ ),
124
+ bp_insert_activity_meta()
125
+ );
126
+ } else {
127
+ $activity_classes .= ' mini';
128
+ $activity_content = bp_get_activity_action();
129
+ }
130
+
131
+ $activity_loop .= sprintf(
132
+ '<blockquote>
133
+ <div class="%1$s">%2$s</div>
134
+ %3$s
135
+ </blockquote>',
136
+ $activity_classes,
137
+ $activity_content,
138
+ $activity_footer
139
+ );
140
+ }
141
+ }
142
+
143
+ $widget_content .= sprintf(
144
+ '<div class="activity-list item-list">
145
+ %1$s
146
+ </div>',
147
+ $activity_loop
148
+ );
149
+ }
150
+
151
+ // Adds a container to make sure the block is styled even when used into the Columns parent block.
152
+ $widget_content = sprintf( '<div class="bp-latest-activities-block">%s</div>', "\n" . $widget_content . "\n" );
153
+
154
+ // Reset the global template loop.
155
+ $GLOBALS['activities_template'] = $reset_activities_template;
156
+
157
+ // Only add a block wrapper if not loaded into a Widgets sidebar.
158
+ if ( ! did_action( 'dynamic_sidebar_before' ) ) {
159
+ return sprintf(
160
+ '<div %1$s>%2$s</div>',
161
+ $wrapper_attributes,
162
+ $widget_content
163
+ );
164
+ }
165
+
166
+ return $widget_content;
167
  }
 
bp-activity/bp-activity-functions.php CHANGED
@@ -842,6 +842,52 @@ function bp_activity_get_types() {
842
  return apply_filters( 'bp_activity_get_types', $actions );
843
  }
844
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
845
  /**
846
  * Gets the current activity context.
847
  *
842
  return apply_filters( 'bp_activity_get_types', $actions );
843
  }
844
 
845
+ /**
846
+ * Returns the list of available BuddyPress activity types.
847
+ *
848
+ * @since 9.0.0
849
+ *
850
+ * @return array An array of activity type labels keyed by type names.
851
+ */
852
+ function bp_activity_get_types_list() {
853
+ $actions_object = bp_activity_get_actions();
854
+ $actions_array = get_object_vars( $actions_object );
855
+
856
+ $types = array();
857
+ foreach ( $actions_array as $component => $actions ) {
858
+ $new_types = wp_list_pluck( $actions, 'label', 'key' );
859
+
860
+ if ( $types ) {
861
+ // Makes sure activity types are unique.
862
+ $new_types = array_diff_key( $new_types, $types );
863
+
864
+ if ( 'friends' === $component ) {
865
+ $new_types = array_diff_key(
866
+ array(
867
+ 'friendship_accepted' => false,
868
+ 'friendship_created' => false,
869
+ 'friends_register_activity_action' => false,
870
+ ),
871
+ $new_types
872
+ );
873
+
874
+ $new_types['friendship_accepted,friendship_created'] = __( 'Friendships', 'buddypress' );
875
+ }
876
+ }
877
+
878
+ $types = array_merge( $types, $new_types );
879
+ }
880
+
881
+ /**
882
+ * Filter here to edit the activity types list.
883
+ *
884
+ * @since 9.0.0
885
+ *
886
+ * @param array $types An array of activity type labels keyed by type names.
887
+ */
888
+ return apply_filters( 'bp_activity_get_types_list', $types );
889
+ }
890
+
891
  /**
892
  * Gets the current activity context.
893
  *
bp-activity/classes/class-bp-activity-component.php CHANGED
@@ -207,6 +207,11 @@ class BP_Activity_Component extends BP_Component {
207
  'search_string' => __( 'Search Activity...', 'buddypress' ),
208
  'global_tables' => $global_tables,
209
  'meta_tables' => $meta_tables,
 
 
 
 
 
210
  );
211
 
212
  parent::setup_globals( $args );
@@ -483,23 +488,62 @@ class BP_Activity_Component extends BP_Component {
483
  * description.
484
  */
485
  public function blocks_init( $blocks = array() ) {
486
- parent::blocks_init(
487
- array(
488
- 'bp/embed-activity' => array(
489
- 'name' => 'bp/embed-activity',
490
- 'editor_script' => 'bp-embed-activity-block',
491
- 'editor_script_url' => plugins_url( 'js/blocks/embed-activity.js', dirname( __FILE__ ) ),
492
- 'editor_script_deps' => array(
493
- 'wp-blocks',
494
- 'wp-element',
495
- 'wp-i18n',
496
- 'wp-components',
497
- 'wp-block-editor',
498
- 'wp-data',
499
- 'wp-compose',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
500
  ),
501
  ),
502
- )
 
503
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
504
  }
505
  }
207
  'search_string' => __( 'Search Activity...', 'buddypress' ),
208
  'global_tables' => $global_tables,
209
  'meta_tables' => $meta_tables,
210
+ 'block_globals' => array(
211
+ 'bp/latest-activities' => array(
212
+ 'widget_classnames' => array( 'wp-block-bp-latest-activities', 'buddypress' ),
213
+ )
214
+ ),
215
  );
216
 
217
  parent::setup_globals( $args );
488
  * description.
489
  */
490
  public function blocks_init( $blocks = array() ) {
491
+ $blocks = array(
492
+ 'bp/latest-activities' => array(
493
+ 'name' => 'bp/latest-activities',
494
+ 'editor_script' => 'bp-latest-activities-block',
495
+ 'editor_script_url' => plugins_url( 'js/blocks/latest-activities.js', dirname( __FILE__ ) ),
496
+ 'editor_script_deps' => array(
497
+ 'wp-blocks',
498
+ 'wp-element',
499
+ 'wp-components',
500
+ 'wp-i18n',
501
+ 'wp-block-editor',
502
+ 'bp-block-data',
503
+ 'bp-block-components',
504
+ ),
505
+ 'style' => 'bp-latest-activities-block',
506
+ 'style_url' => plugins_url( 'css/blocks/latest-activities.css', dirname( __FILE__ ) ),
507
+ 'attributes' => array(
508
+ 'title' => array(
509
+ 'type' => 'string',
510
+ 'default' => __( 'Latest updates', 'buddypress' ),
511
+ ),
512
+ 'maxActivities' => array(
513
+ 'type' => 'number',
514
+ 'default' => 5,
515
+ ),
516
+ 'type' => array(
517
+ 'type' => 'array',
518
+ 'default' => array( 'activity_update' ),
519
+ ),
520
+ 'postId' => array(
521
+ 'type' => 'number',
522
+ 'default' => 0,
523
  ),
524
  ),
525
+ 'render_callback' => 'bp_activity_render_latest_activities_block',
526
+ ),
527
  );
528
+
529
+ if ( bp_is_active( $this->id, 'embeds' ) ) {
530
+ $blocks['bp/embed-activity'] = array(
531
+ 'name' => 'bp/embed-activity',
532
+ 'editor_script' => 'bp-embed-activity-block',
533
+ 'editor_script_url' => plugins_url( 'js/blocks/embed-activity.js', dirname( __FILE__ ) ),
534
+ 'editor_script_deps' => array(
535
+ 'wp-blocks',
536
+ 'wp-element',
537
+ 'wp-i18n',
538
+ 'wp-components',
539
+ 'wp-block-editor',
540
+ 'wp-data',
541
+ 'wp-compose',
542
+ 'bp-block-data',
543
+ ),
544
+ );
545
+ }
546
+
547
+ parent::blocks_init( $blocks );
548
  }
549
  }
bp-activity/classes/class-bp-rest-activity-endpoint.php CHANGED
@@ -130,17 +130,17 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
130
  */
131
  public function get_items( $request ) {
132
  $args = array(
133
- 'exclude' => $request['exclude'],
134
- 'in' => $request['include'],
135
- 'page' => $request['page'],
136
- 'per_page' => $request['per_page'],
137
- 'search_terms' => $request['search'],
138
- 'sort' => $request['order'],
139
- 'spam' => $request['status'],
140
- 'display_comments' => $request['display_comments'],
141
- 'site_id' => $request['site_id'],
142
- 'group_id' => $request['group_id'],
143
- 'scope' => $request['scope'],
144
  'count_total' => true,
145
  'fields' => 'all',
146
  'show_hidden' => false,
@@ -152,20 +152,20 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
152
  $args['display_comments'] = false;
153
  }
154
 
155
- if ( empty( $request['exclude'] ) ) {
156
  $args['exclude'] = false;
157
  }
158
 
159
- if ( empty( $request['include'] ) ) {
160
  $args['in'] = false;
161
  }
162
 
163
- if ( isset( $request['after'] ) ) {
164
- $args['since'] = $request['after'];
165
  }
166
 
167
- if ( ! empty( $request['user_id'] ) ) {
168
- $args['filter']['user_id'] = $request['user_id'];
169
  }
170
 
171
  $item_id = 0;
@@ -173,8 +173,8 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
173
  $args['filter']['object'] = 'groups';
174
  $args['filter']['primary_id'] = $args['group_id'];
175
 
176
- if ( empty( $request['component'] ) ) {
177
- $request['component'] = 'groups';
178
  }
179
 
180
  $item_id = $args['group_id'];
@@ -188,33 +188,33 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
188
  }
189
 
190
  if ( empty( $args['group_id'] ) && empty( $args['site_id'] ) ) {
191
- if ( ! empty( $request['component'] ) ) {
192
- $args['filter']['object'] = $request['component'];
193
  }
194
 
195
- if ( ! empty( $request['primary_id'] ) ) {
196
- $item_id = $request['primary_id'];
197
  $args['filter']['primary_id'] = $item_id;
198
  }
199
  }
200
 
201
- if ( empty( $request['scope'] ) ) {
202
  $args['scope'] = false;
203
  }
204
 
205
- if ( isset( $request['type'] ) ) {
206
- $args['filter']['action'] = $request['type'];
207
  }
208
 
209
- if ( ! empty( $request['secondary_id'] ) ) {
210
- $args['filter']['secondary_id'] = $request['secondary_id'];
211
  }
212
 
213
  if ( $args['in'] ) {
214
  $args['count_total'] = false;
215
  }
216
 
217
- if ( $this->show_hidden( $request['component'], $item_id ) ) {
218
  $args['show_hidden'] = true;
219
  }
220
 
@@ -224,7 +224,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
224
  * @since 5.0.0
225
  *
226
  * @param array $args Key value array of query var to query value.
227
- * @param WP_REST_Request $request The request sent to the API.
228
  */
229
  $args = apply_filters( 'bp_rest_activity_get_items_query_args', $args, $request );
230
 
@@ -248,7 +248,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
248
  *
249
  * @param array $activities Fetched activities.
250
  * @param WP_REST_Response $response The response data.
251
- * @param WP_REST_Request $request The request sent to the API.
252
  */
253
  do_action( 'bp_rest_activity_get_items', $activities, $response, $request );
254
 
@@ -271,7 +271,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
271
  * @since 5.0.0
272
  *
273
  * @param true|WP_Error $retval Returned value.
274
- * @param WP_REST_Request $request The request sent to the API.
275
  */
276
  return apply_filters( 'bp_rest_activity_get_items_permissions_check', true, $request );
277
  }
@@ -362,7 +362,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
362
  public function create_item( $request ) {
363
  $request->set_param( 'context', 'edit' );
364
 
365
- if ( empty( $request['content'] ) ) {
366
  return new WP_Error(
367
  'bp_rest_create_activity_empty_content',
368
  __( 'Please, enter some content.', 'buddypress' ),
@@ -376,11 +376,11 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
376
 
377
  // Fallback for the activity_update type.
378
  $type = 'activity_update';
379
- if ( ! empty( $request['type'] ) ) {
380
- $type = $request['type'];
381
  }
382
 
383
- $prime = $request['primary_item_id'];
384
  $activity_id = 0;
385
 
386
  // Post a regular activity update.
@@ -400,8 +400,8 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
400
  }
401
 
402
  // ID of a parent comment.
403
- if ( isset( $request['secondary_item_id'] ) ) {
404
- $prepared_activity->parent_id = (int) $request['secondary_item_id'];
405
  }
406
 
407
  $activity_id = bp_activity_new_comment( $prepared_activity );
@@ -520,7 +520,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
520
  public function update_item( $request ) {
521
  $request->set_param( 'context', 'edit' );
522
 
523
- if ( empty( $request['content'] ) ) {
524
  return new WP_Error(
525
  'bp_rest_update_activity_empty_content',
526
  __( 'Please, enter some content.', 'buddypress' ),
@@ -893,7 +893,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
893
  *
894
  * @since 5.0.0
895
  *
896
- * @param BP_Activity_Activity $activity Activity data.
897
  * @param WP_REST_Request $request Full details about the request.
898
  * @return WP_REST_Response
899
  */
@@ -924,7 +924,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
924
  $comment_count = wp_filter_object_list( $activity->children, array( 'type' => 'activity_comment' ), 'AND', 'id' );
925
  $data['comment_count'] = ! empty( $comment_count ) ? count( $comment_count ) : 0;
926
 
927
- if ( ! empty( $schema['properties']['comments'] ) && 'threaded' === $request['display_comments'] ) {
928
  $data['comments'] = $this->prepare_activity_comments( $activity->children, $request );
929
  }
930
  }
@@ -938,7 +938,6 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
938
  'type' => 'full',
939
  )
940
  ),
941
-
942
  'thumb' => bp_core_fetch_avatar(
943
  array(
944
  'item_id' => $activity->user_id,
@@ -948,11 +947,11 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
948
  );
949
  }
950
 
951
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
952
- $data = $this->add_additional_fields_to_object( $data, $request );
953
- $data = $this->filter_response_by_context( $data, $context );
954
-
955
  $response = rest_ensure_response( $data );
 
956
  $response->add_links( $this->prepare_links( $activity ) );
957
 
958
  /**
@@ -972,8 +971,8 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
972
  *
973
  * @since 5.0.0
974
  *
975
- * @param array $comments Comments.
976
- * @param WP_REST_Request $request Full details about the request.
977
  * @return array An array of activity comments.
978
  */
979
  protected function prepare_activity_comments( $comments, $request ) {
@@ -994,9 +993,9 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
994
  *
995
  * @since 5.0.0
996
  *
997
- * @param array $data An array of activity comments.
998
- * @param array $comments Comments.
999
- * @param WP_REST_Request $request Request used to generate the response.
1000
  */
1001
  return apply_filters( 'bp_rest_activity_prepare_comments', $data, $comments, $request );
1002
  }
@@ -1006,7 +1005,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1006
  *
1007
  * @since 5.0.0
1008
  *
1009
- * @param WP_REST_Request $request Request object.
1010
  * @return stdClass|WP_Error Object or WP_Error.
1011
  */
1012
  protected function prepare_item_for_database( $request ) {
@@ -1017,7 +1016,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1017
  if ( ! empty( $schema['properties']['id'] ) && ! empty( $activity->id ) ) {
1018
  $prepared_activity->id = $activity->id;
1019
 
1020
- if ( 'activity_comment' !== $request['type'] ) {
1021
  $prepared_activity->error_type = 'wp_error';
1022
  }
1023
  }
@@ -1030,15 +1029,15 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1030
  }
1031
 
1032
  // Activity component.
1033
- if ( ! empty( $schema['properties']['component'] ) && isset( $request['component'] ) ) {
1034
- $prepared_activity->component = $request['component'];
1035
  } else {
1036
  $prepared_activity->component = buddypress()->activity->id;
1037
  }
1038
 
1039
  // Activity Item ID.
1040
- if ( ! empty( $schema['properties']['primary_item_id'] ) && isset( $request['primary_item_id'] ) ) {
1041
- $item_id = (int) $request['primary_item_id'];
1042
 
1043
  // Set the group ID of the activity.
1044
  if ( bp_is_active( 'groups' ) && isset( $prepared_activity->component ) && buddypress()->groups->id === $prepared_activity->component ) {
@@ -1051,27 +1050,27 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1051
  }
1052
 
1053
  // Secondary Item ID.
1054
- if ( ! empty( $schema['properties']['secondary_item_id'] ) && isset( $request['secondary_item_id'] ) ) {
1055
- $prepared_activity->secondary_item_id = (int) $request['secondary_item_id'];
1056
  }
1057
 
1058
  // Activity type.
1059
- if ( ! empty( $schema['properties']['type'] ) && isset( $request['type'] ) ) {
1060
- $prepared_activity->type = $request['type'];
1061
  }
1062
 
1063
  // Activity content.
1064
- if ( ! empty( $schema['properties']['content'] ) && isset( $request['content'] ) ) {
1065
- if ( is_string( $request['content'] ) ) {
1066
- $prepared_activity->content = $request['content'];
1067
  } elseif ( isset( $request['content']['raw'] ) ) {
1068
  $prepared_activity->content = $request['content']['raw'];
1069
  }
1070
  }
1071
 
1072
  // Activity Sitewide visibility.
1073
- if ( ! empty( $schema['properties']['hidden'] ) && isset( $request['hidden'] ) ) {
1074
- $prepared_activity->hide_sitewide = (bool) $request['hidden'];
1075
  }
1076
 
1077
  /**
@@ -1094,7 +1093,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1094
  * @return array
1095
  */
1096
  protected function prepare_links( $activity ) {
1097
- $base = sprintf( '/%s/%s/', $this->namespace, $this->rest_base );
1098
  $url = $base . $activity->id;
1099
 
1100
  // Entity meta.
@@ -1105,12 +1104,15 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1105
  'collection' => array(
1106
  'href' => rest_url( $base ),
1107
  ),
1108
- 'user' => array(
1109
- 'href' => rest_url( bp_rest_get_user_url( $activity->user_id ) ),
1110
- 'embeddable' => true,
1111
- ),
1112
  );
1113
 
 
 
 
 
 
 
 
1114
  if ( 'activity_comment' === $activity->type ) {
1115
  $links['up'] = array(
1116
  'href' => rest_url( $url ),
@@ -1124,32 +1126,32 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1124
  }
1125
 
1126
  // Embed Group.
1127
- if ( bp_is_active( 'groups' ) && 'groups' === $activity->component && ! empty( $activity->item_id ) ) {
1128
  $links['group'] = array(
 
1129
  'href' => rest_url(
1130
  sprintf(
1131
- '/%s/%s/%d',
1132
  $this->namespace,
1133
  buddypress()->groups->id,
1134
  absint( $activity->item_id )
1135
  )
1136
  ),
1137
- 'embeddable' => true,
1138
  );
1139
  }
1140
 
1141
  // Embed Blog.
1142
- if ( bp_is_active( 'blogs' ) && 'blogs' === $activity->component && ! empty( $activity->item_id ) ) {
1143
  $links['blog'] = array(
 
1144
  'href' => rest_url(
1145
  sprintf(
1146
- '/%s/%s/%d',
1147
  $this->namespace,
1148
  buddypress()->blogs->id,
1149
  absint( $activity->item_id )
1150
  )
1151
  ),
1152
- 'embeddable' => true,
1153
  );
1154
  }
1155
 
@@ -1184,7 +1186,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1184
  *
1185
  * @since 5.0.0
1186
  *
1187
- * @param string $component The activity component.
1188
  * @param int $item_id The activity item ID.
1189
  * @return boolean
1190
  */
@@ -1223,7 +1225,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1223
  * @return BP_Activity_Activity|string An activity object.
1224
  */
1225
  public function get_activity_object( $request ) {
1226
- $activity_id = is_numeric( $request ) ? $request : (int) $request['id'];
1227
 
1228
  $activity = bp_activity_get_specific(
1229
  array(
@@ -1290,35 +1292,35 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1290
  'type' => 'object',
1291
  'properties' => array(
1292
  'id' => array(
1293
- 'context' => array( 'view', 'edit' ),
1294
  'description' => __( 'A unique numeric ID for the activity.', 'buddypress' ),
1295
  'readonly' => true,
1296
  'type' => 'integer',
1297
  ),
1298
  'primary_item_id' => array(
1299
- 'context' => array( 'view', 'edit' ),
1300
  'description' => __( 'The ID of some other object primarily associated with this one.', 'buddypress' ),
1301
  'type' => 'integer',
1302
  ),
1303
  'secondary_item_id' => array(
1304
- 'context' => array( 'view', 'edit' ),
1305
  'description' => __( 'The ID of some other object also associated with this one.', 'buddypress' ),
1306
  'type' => 'integer',
1307
  ),
1308
  'user_id' => array(
1309
- 'context' => array( 'view', 'edit' ),
1310
  'description' => __( 'The ID for the author of the activity.', 'buddypress' ),
1311
  'readonly' => true,
1312
  'type' => 'integer',
1313
  ),
1314
  'link' => array(
1315
- 'context' => array( 'view', 'edit' ),
1316
  'description' => __( 'The permalink to this activity on the site.', 'buddypress' ),
1317
  'format' => 'uri',
1318
  'type' => 'string',
1319
  ),
1320
  'component' => array(
1321
- 'context' => array( 'view', 'edit' ),
1322
  'description' => __( 'The active BuddyPress component the activity relates to.', 'buddypress' ),
1323
  'type' => 'string',
1324
  'enum' => array_keys( buddypress()->active_components ),
@@ -1327,7 +1329,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1327
  ),
1328
  ),
1329
  'type' => array(
1330
- 'context' => array( 'view', 'edit' ),
1331
  'description' => __( 'The activity type of the activity.', 'buddypress' ),
1332
  'type' => 'string',
1333
  'enum' => array_keys( bp_activity_get_types() ),
@@ -1336,7 +1338,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1336
  ),
1337
  ),
1338
  'title' => array(
1339
- 'context' => array( 'view', 'edit' ),
1340
  'description' => __( 'The description of the activity\'s type (eg: Username posted an update)', 'buddypress' ),
1341
  'type' => 'string',
1342
  'readonly' => true,
@@ -1345,7 +1347,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1345
  ),
1346
  ),
1347
  'content' => array(
1348
- 'context' => array( 'view', 'edit' ),
1349
  'description' => __( 'Allowed HTML content for the activity.', 'buddypress' ),
1350
  'type' => 'object',
1351
  'arg_options' => array(
@@ -1361,19 +1363,19 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1361
  'rendered' => array(
1362
  'description' => __( 'HTML content for the activity, transformed for display.', 'buddypress' ),
1363
  'type' => 'string',
1364
- 'context' => array( 'view', 'edit' ),
1365
  'readonly' => true,
1366
  ),
1367
  ),
1368
  ),
1369
  'date' => array(
1370
- 'context' => array( 'view', 'edit' ),
1371
  'description' => __( "The date the activity was published, in the site's timezone.", 'buddypress' ),
1372
  'type' => 'string',
1373
  'format' => 'date-time',
1374
  ),
1375
  'status' => array(
1376
- 'context' => array( 'view', 'edit' ),
1377
  'description' => __( 'Whether the activity has been marked as spam or not.', 'buddypress' ),
1378
  'type' => 'string',
1379
  'enum' => array( 'published', 'spam' ),
@@ -1383,24 +1385,24 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1383
  ),
1384
  ),
1385
  'comments' => array(
1386
- 'context' => array( 'view', 'edit' ),
1387
  'description' => __( 'A list of objects children of the activity object.', 'buddypress' ),
1388
  'type' => 'array',
1389
  'readonly' => true,
1390
  ),
1391
  'comment_count' => array(
1392
- 'context' => array( 'view', 'edit' ),
1393
  'description' => __( 'Total number of comments of the activity object.', 'buddypress' ),
1394
  'type' => 'integer',
1395
  'readonly' => true,
1396
  ),
1397
  'hidden' => array(
1398
- 'context' => array( 'edit' ),
1399
  'description' => __( 'Whether the activity object should be sitewide hidden or not.', 'buddypress' ),
1400
  'type' => 'boolean',
1401
  ),
1402
  'favorited' => array(
1403
- 'context' => array( 'view', 'edit' ),
1404
  'description' => __( 'Whether the activity object has been favorited by the current user.', 'buddypress' ),
1405
  'type' => 'boolean',
1406
  'readonly' => true,
@@ -1412,7 +1414,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1412
  $avatar_properties = array();
1413
 
1414
  $avatar_properties['full'] = array(
1415
- 'context' => array( 'view', 'edit' ),
1416
  /* translators: 1: Full avatar width in pixels. 2: Full avatar height in pixels */
1417
  'description' => sprintf( __( 'Avatar URL with full image size (%1$d x %2$d pixels).', 'buddypress' ), number_format_i18n( bp_core_avatar_full_width() ), number_format_i18n( bp_core_avatar_full_height() ) ),
1418
  'type' => 'string',
@@ -1420,7 +1422,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1420
  );
1421
 
1422
  $avatar_properties['thumb'] = array(
1423
- 'context' => array( 'view', 'edit' ),
1424
  /* translators: 1: Thumb avatar width in pixels. 2: Thumb avatar height in pixels */
1425
  'description' => sprintf( __( 'Avatar URL with thumb image size (%1$d x %2$d pixels).', 'buddypress' ), number_format_i18n( bp_core_avatar_thumb_width() ), number_format_i18n( bp_core_avatar_thumb_height() ) ),
1426
  'type' => 'string',
@@ -1428,7 +1430,7 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
1428
  );
1429
 
1430
  $schema['properties']['user_avatar'] = array(
1431
- 'context' => array( 'view', 'edit' ),
1432
  'description' => __( 'Avatar URLs for the author of the activity.', 'buddypress' ),
1433
  'type' => 'object',
1434
  'readonly' => true,
130
  */
131
  public function get_items( $request ) {
132
  $args = array(
133
+ 'exclude' => $request->get_param( 'exclude' ),
134
+ 'in' => $request->get_param( 'include' ),
135
+ 'page' => $request->get_param( 'page' ),
136
+ 'per_page' => $request->get_param( 'per_page' ),
137
+ 'search_terms' => $request->get_param( 'search' ),
138
+ 'sort' => $request->get_param( 'order' ),
139
+ 'spam' => $request->get_param( 'status' ),
140
+ 'display_comments' => $request->get_param( 'display_comments' ),
141
+ 'site_id' => $request->get_param( 'site_id' ),
142
+ 'group_id' => $request->get_param( 'group_id' ),
143
+ 'scope' => $request->get_param( 'scope' ),
144
  'count_total' => true,
145
  'fields' => 'all',
146
  'show_hidden' => false,
152
  $args['display_comments'] = false;
153
  }
154
 
155
+ if ( empty( $request->get_param( 'exclude' ) ) ) {
156
  $args['exclude'] = false;
157
  }
158
 
159
+ if ( empty( $request->get_param( 'include' ) ) ) {
160
  $args['in'] = false;
161
  }
162
 
163
+ if ( ! empty( $request->get_param( 'after' ) ) ) {
164
+ $args['since'] = $request->get_param( 'after' );
165
  }
166
 
167
+ if ( ! empty( $request->get_param( 'user_id' ) ) ) {
168
+ $args['filter']['user_id'] = $request->get_param( 'user_id' );
169
  }
170
 
171
  $item_id = 0;
173
  $args['filter']['object'] = 'groups';
174
  $args['filter']['primary_id'] = $args['group_id'];
175
 
176
+ if ( empty( $request->get_param( 'component' ) ) ) {
177
+ $request->set_param( 'component', 'groups' );
178
  }
179
 
180
  $item_id = $args['group_id'];
188
  }
189
 
190
  if ( empty( $args['group_id'] ) && empty( $args['site_id'] ) ) {
191
+ if ( ! empty( $request->get_param( 'component' ) ) ) {
192
+ $args['filter']['object'] = $request->get_param( 'component' );
193
  }
194
 
195
+ if ( ! empty( $request->get_param( 'primary_id' ) ) ) {
196
+ $item_id = $request->get_param( 'primary_id' );
197
  $args['filter']['primary_id'] = $item_id;
198
  }
199
  }
200
 
201
+ if ( empty( $request->get_param( 'scope' ) ) ) {
202
  $args['scope'] = false;
203
  }
204
 
205
+ if ( ! empty( $request->get_param( 'type' ) ) ) {
206
+ $args['filter']['action'] = $request->get_param( 'type' );
207
  }
208
 
209
+ if ( ! empty( $request->get_param( 'secondary_id' ) ) ) {
210
+ $args['filter']['secondary_id'] = $request->get_param( 'secondary_id' );
211
  }
212
 
213
  if ( $args['in'] ) {
214
  $args['count_total'] = false;
215
  }
216
 
217
+ if ( $this->show_hidden( $request->get_param( 'component' ), $item_id ) ) {
218
  $args['show_hidden'] = true;
219
  }
220
 
224
  * @since 5.0.0
225
  *
226
  * @param array $args Key value array of query var to query value.
227
+ * @param WP_REST_Request $request Full data about the request.
228
  */
229
  $args = apply_filters( 'bp_rest_activity_get_items_query_args', $args, $request );
230
 
248
  *
249
  * @param array $activities Fetched activities.
250
  * @param WP_REST_Response $response The response data.
251
+ * @param WP_REST_Request $request Full data about the request.
252
  */
253
  do_action( 'bp_rest_activity_get_items', $activities, $response, $request );
254
 
271
  * @since 5.0.0
272
  *
273
  * @param true|WP_Error $retval Returned value.
274
+ * @param WP_REST_Request $request Full data about the request.
275
  */
276
  return apply_filters( 'bp_rest_activity_get_items_permissions_check', true, $request );
277
  }
362
  public function create_item( $request ) {
363
  $request->set_param( 'context', 'edit' );
364
 
365
+ if ( empty( $request->get_param( 'content' ) ) ) {
366
  return new WP_Error(
367
  'bp_rest_create_activity_empty_content',
368
  __( 'Please, enter some content.', 'buddypress' ),
376
 
377
  // Fallback for the activity_update type.
378
  $type = 'activity_update';
379
+ if ( ! empty( $request->get_param( 'type' ) ) ) {
380
+ $type = $request->get_param( 'type' );
381
  }
382
 
383
+ $prime = $request->get_param( 'primary_item_id' );
384
  $activity_id = 0;
385
 
386
  // Post a regular activity update.
400
  }
401
 
402
  // ID of a parent comment.
403
+ if ( ! empty( $request->get_param( 'secondary_item_id' ) ) ) {
404
+ $prepared_activity->parent_id = $request->get_param( 'secondary_item_id' );
405
  }
406
 
407
  $activity_id = bp_activity_new_comment( $prepared_activity );
520
  public function update_item( $request ) {
521
  $request->set_param( 'context', 'edit' );
522
 
523
+ if ( empty( $request->get_param( 'content' ) ) ) {
524
  return new WP_Error(
525
  'bp_rest_update_activity_empty_content',
526
  __( 'Please, enter some content.', 'buddypress' ),
893
  *
894
  * @since 5.0.0
895
  *
896
+ * @param BP_Activity_Activity $activity Activity object.
897
  * @param WP_REST_Request $request Full details about the request.
898
  * @return WP_REST_Response
899
  */
924
  $comment_count = wp_filter_object_list( $activity->children, array( 'type' => 'activity_comment' ), 'AND', 'id' );
925
  $data['comment_count'] = ! empty( $comment_count ) ? count( $comment_count ) : 0;
926
 
927
+ if ( ! empty( $schema['properties']['comments'] ) && 'threaded' === $request->get_param( 'display_comments' ) ) {
928
  $data['comments'] = $this->prepare_activity_comments( $activity->children, $request );
929
  }
930
  }
938
  'type' => 'full',
939
  )
940
  ),
 
941
  'thumb' => bp_core_fetch_avatar(
942
  array(
943
  'item_id' => $activity->user_id,
947
  );
948
  }
949
 
950
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
951
+ $data = $this->add_additional_fields_to_object( $data, $request );
952
+ $data = $this->filter_response_by_context( $data, $context );
 
953
  $response = rest_ensure_response( $data );
954
+
955
  $response->add_links( $this->prepare_links( $activity ) );
956
 
957
  /**
971
  *
972
  * @since 5.0.0
973
  *
974
+ * @param array $comments Array of comments.
975
+ * @param WP_REST_Request $request Full details about the request.
976
  * @return array An array of activity comments.
977
  */
978
  protected function prepare_activity_comments( $comments, $request ) {
993
  *
994
  * @since 5.0.0
995
  *
996
+ * @param array $data An array of activity comments with proper API response.
997
+ * @param array $comments An array of activity comments.
998
+ * @param WP_REST_Request $request Full details about the request.
999
  */
1000
  return apply_filters( 'bp_rest_activity_prepare_comments', $data, $comments, $request );
1001
  }
1005
  *
1006
  * @since 5.0.0
1007
  *
1008
+ * @param WP_REST_Request $request Full details about the request.
1009
  * @return stdClass|WP_Error Object or WP_Error.
1010
  */
1011
  protected function prepare_item_for_database( $request ) {
1016
  if ( ! empty( $schema['properties']['id'] ) && ! empty( $activity->id ) ) {
1017
  $prepared_activity->id = $activity->id;
1018
 
1019
+ if ( 'activity_comment' !== $request->get_param( 'type' ) ) {
1020
  $prepared_activity->error_type = 'wp_error';
1021
  }
1022
  }
1029
  }
1030
 
1031
  // Activity component.
1032
+ if ( ! empty( $schema['properties']['component'] ) && ! empty( $request->get_param( 'component' ) ) ) {
1033
+ $prepared_activity->component = $request->get_param( 'component' );
1034
  } else {
1035
  $prepared_activity->component = buddypress()->activity->id;
1036
  }
1037
 
1038
  // Activity Item ID.
1039
+ if ( ! empty( $schema['properties']['primary_item_id'] ) && ! empty( $request->get_param( 'primary_item_id' ) ) ) {
1040
+ $item_id = (int) $request->get_param( 'primary_item_id' );
1041
 
1042
  // Set the group ID of the activity.
1043
  if ( bp_is_active( 'groups' ) && isset( $prepared_activity->component ) && buddypress()->groups->id === $prepared_activity->component ) {
1050
  }
1051
 
1052
  // Secondary Item ID.
1053
+ if ( ! empty( $schema['properties']['secondary_item_id'] ) && ! empty( $request->get_param( 'secondary_item_id' ) ) ) {
1054
+ $prepared_activity->secondary_item_id = (int) $request->get_param( 'secondary_item_id' );
1055
  }
1056
 
1057
  // Activity type.
1058
+ if ( ! empty( $schema['properties']['type'] ) && ! empty( $request->get_param( 'type' ) ) ) {
1059
+ $prepared_activity->type = $request->get_param( 'type' );
1060
  }
1061
 
1062
  // Activity content.
1063
+ if ( ! empty( $schema['properties']['content'] ) && ! empty( $request->get_param( 'content' ) ) ) {
1064
+ if ( is_string( $request->get_param( 'content' ) ) ) {
1065
+ $prepared_activity->content = $request->get_param( 'content' );
1066
  } elseif ( isset( $request['content']['raw'] ) ) {
1067
  $prepared_activity->content = $request['content']['raw'];
1068
  }
1069
  }
1070
 
1071
  // Activity Sitewide visibility.
1072
+ if ( ! empty( $schema['properties']['hidden'] ) && ! empty( $request->get_param( 'hidden' ) ) ) {
1073
+ $prepared_activity->hide_sitewide = (bool) $request->get_param( 'hidden' );
1074
  }
1075
 
1076
  /**
1093
  * @return array
1094
  */
1095
  protected function prepare_links( $activity ) {
1096
+ $base = sprintf( '/%1$s/%2$s/', $this->namespace, $this->rest_base );
1097
  $url = $base . $activity->id;
1098
 
1099
  // Entity meta.
1104
  'collection' => array(
1105
  'href' => rest_url( $base ),
1106
  ),
 
 
 
 
1107
  );
1108
 
1109
+ if ( ! empty( $activity->user_id ) ) {
1110
+ $links['user'] = array(
1111
+ 'href' => bp_rest_get_object_url( absint( $activity->user_id ), 'members' ),
1112
+ 'embeddable' => true,
1113
+ );
1114
+ }
1115
+
1116
  if ( 'activity_comment' === $activity->type ) {
1117
  $links['up'] = array(
1118
  'href' => rest_url( $url ),
1126
  }
1127
 
1128
  // Embed Group.
1129
+ if ( bp_is_active( 'groups' ) && buddypress()->groups->id === $activity->component && ! empty( $activity->item_id ) ) {
1130
  $links['group'] = array(
1131
+ 'embeddable' => true,
1132
  'href' => rest_url(
1133
  sprintf(
1134
+ '/%1$s/%2$s/%3$d',
1135
  $this->namespace,
1136
  buddypress()->groups->id,
1137
  absint( $activity->item_id )
1138
  )
1139
  ),
 
1140
  );
1141
  }
1142
 
1143
  // Embed Blog.
1144
+ if ( bp_is_active( 'blogs' ) && buddypress()->blogs->id === $activity->component && ! empty( $activity->item_id ) ) {
1145
  $links['blog'] = array(
1146
+ 'embeddable' => true,
1147
  'href' => rest_url(
1148
  sprintf(
1149
+ '/%1$s/%2$s/%3$d',
1150
  $this->namespace,
1151
  buddypress()->blogs->id,
1152
  absint( $activity->item_id )
1153
  )
1154
  ),
 
1155
  );
1156
  }
1157
 
1186
  *
1187
  * @since 5.0.0
1188
  *
1189
+ * @param string $component The component the activity is from.
1190
  * @param int $item_id The activity item ID.
1191
  * @return boolean
1192
  */
1225
  * @return BP_Activity_Activity|string An activity object.
1226
  */
1227
  public function get_activity_object( $request ) {
1228
+ $activity_id = is_numeric( $request ) ? $request : (int) $request->get_param( 'id' );
1229
 
1230
  $activity = bp_activity_get_specific(
1231
  array(
1292
  'type' => 'object',
1293
  'properties' => array(
1294
  'id' => array(
1295
+ 'context' => array( 'view', 'edit', 'embed' ),
1296
  'description' => __( 'A unique numeric ID for the activity.', 'buddypress' ),
1297
  'readonly' => true,
1298
  'type' => 'integer',
1299
  ),
1300
  'primary_item_id' => array(
1301
+ 'context' => array( 'view', 'edit', 'embed' ),
1302
  'description' => __( 'The ID of some other object primarily associated with this one.', 'buddypress' ),
1303
  'type' => 'integer',
1304
  ),
1305
  'secondary_item_id' => array(
1306
+ 'context' => array( 'view', 'edit', 'embed' ),
1307
  'description' => __( 'The ID of some other object also associated with this one.', 'buddypress' ),
1308
  'type' => 'integer',
1309
  ),
1310
  'user_id' => array(
1311
+ 'context' => array( 'view', 'edit', 'embed' ),
1312
  'description' => __( 'The ID for the author of the activity.', 'buddypress' ),
1313
  'readonly' => true,
1314
  'type' => 'integer',
1315
  ),
1316
  'link' => array(
1317
+ 'context' => array( 'view', 'edit', 'embed' ),
1318
  'description' => __( 'The permalink to this activity on the site.', 'buddypress' ),
1319
  'format' => 'uri',
1320
  'type' => 'string',
1321
  ),
1322
  'component' => array(
1323
+ 'context' => array( 'view', 'edit', 'embed' ),
1324
  'description' => __( 'The active BuddyPress component the activity relates to.', 'buddypress' ),
1325
  'type' => 'string',
1326
  'enum' => array_keys( buddypress()->active_components ),
1329
  ),
1330
  ),
1331
  'type' => array(
1332
+ 'context' => array( 'view', 'edit', 'embed' ),
1333
  'description' => __( 'The activity type of the activity.', 'buddypress' ),
1334
  'type' => 'string',
1335
  'enum' => array_keys( bp_activity_get_types() ),
1338
  ),
1339
  ),
1340
  'title' => array(
1341
+ 'context' => array( 'view', 'edit', 'embed' ),
1342
  'description' => __( 'The description of the activity\'s type (eg: Username posted an update)', 'buddypress' ),
1343
  'type' => 'string',
1344
  'readonly' => true,
1347
  ),
1348
  ),
1349
  'content' => array(
1350
+ 'context' => array( 'view', 'edit', 'embed' ),
1351
  'description' => __( 'Allowed HTML content for the activity.', 'buddypress' ),
1352
  'type' => 'object',
1353
  'arg_options' => array(
1363
  'rendered' => array(
1364
  'description' => __( 'HTML content for the activity, transformed for display.', 'buddypress' ),
1365
  'type' => 'string',
1366
+ 'context' => array( 'view', 'edit', 'embed' ),
1367
  'readonly' => true,
1368
  ),
1369
  ),
1370
  ),
1371
  'date' => array(
1372
+ 'context' => array( 'view', 'edit', 'embed' ),
1373
  'description' => __( "The date the activity was published, in the site's timezone.", 'buddypress' ),
1374
  'type' => 'string',
1375
  'format' => 'date-time',
1376
  ),
1377
  'status' => array(
1378
+ 'context' => array( 'view', 'edit', 'embed' ),
1379
  'description' => __( 'Whether the activity has been marked as spam or not.', 'buddypress' ),
1380
  'type' => 'string',
1381
  'enum' => array( 'published', 'spam' ),
1385
  ),
1386
  ),
1387
  'comments' => array(
1388
+ 'context' => array( 'view', 'edit', 'embed' ),
1389
  'description' => __( 'A list of objects children of the activity object.', 'buddypress' ),
1390
  'type' => 'array',
1391
  'readonly' => true,
1392
  ),
1393
  'comment_count' => array(
1394
+ 'context' => array( 'view', 'edit', 'embed' ),
1395
  'description' => __( 'Total number of comments of the activity object.', 'buddypress' ),
1396
  'type' => 'integer',
1397
  'readonly' => true,
1398
  ),
1399
  'hidden' => array(
1400
+ 'context' => array( 'edit', 'embed' ),
1401
  'description' => __( 'Whether the activity object should be sitewide hidden or not.', 'buddypress' ),
1402
  'type' => 'boolean',
1403
  ),
1404
  'favorited' => array(
1405
+ 'context' => array( 'view', 'edit', 'embed' ),
1406
  'description' => __( 'Whether the activity object has been favorited by the current user.', 'buddypress' ),
1407
  'type' => 'boolean',
1408
  'readonly' => true,
1414
  $avatar_properties = array();
1415
 
1416
  $avatar_properties['full'] = array(
1417
+ 'context' => array( 'view', 'edit', 'embed' ),
1418
  /* translators: 1: Full avatar width in pixels. 2: Full avatar height in pixels */
1419
  'description' => sprintf( __( 'Avatar URL with full image size (%1$d x %2$d pixels).', 'buddypress' ), number_format_i18n( bp_core_avatar_full_width() ), number_format_i18n( bp_core_avatar_full_height() ) ),
1420
  'type' => 'string',
1422
  );
1423
 
1424
  $avatar_properties['thumb'] = array(
1425
+ 'context' => array( 'view', 'edit', 'embed' ),
1426
  /* translators: 1: Thumb avatar width in pixels. 2: Thumb avatar height in pixels */
1427
  'description' => sprintf( __( 'Avatar URL with thumb image size (%1$d x %2$d pixels).', 'buddypress' ), number_format_i18n( bp_core_avatar_thumb_width() ), number_format_i18n( bp_core_avatar_thumb_height() ) ),
1428
  'type' => 'string',
1430
  );
1431
 
1432
  $schema['properties']['user_avatar'] = array(
1433
+ 'context' => array( 'view', 'edit', 'embed' ),
1434
  'description' => __( 'Avatar URLs for the author of the activity.', 'buddypress' ),
1435
  'type' => 'object',
1436
  'readonly' => true,
bp-activity/css/blocks/latest-activities-rtl.css ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-latest-activities .components-flex.components-select-control select[multiple] {
2
+ height: auto;
3
+ padding: 0 8px;
4
+ }
5
+
6
+ .bp-latest-activities .components-flex.components-select-control select[multiple] + .components-input-control__suffix svg {
7
+ display: none;
8
+ }
9
+
10
+ .bp-latest-activities-block a,
11
+ .entry .entry-content .bp-latest-activities-block a {
12
+ border: none;
13
+ text-decoration: none;
14
+ }
15
+
16
+ .bp-latest-activities-block .activity-list.item-list blockquote {
17
+ padding: 0;
18
+ border: none;
19
+ }
20
+
21
+ .bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini) {
22
+ position: relative;
23
+ box-shadow: -1px 0 4px rgba(0, 0, 0, 0.15);
24
+ padding: 0 1em;
25
+ }
26
+
27
+ .bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):after, .bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):before {
28
+ position: absolute;
29
+ right: 15px;
30
+ display: block;
31
+ width: 0;
32
+ height: 0;
33
+ border-style: solid;
34
+ border-color: transparent;
35
+ content: "";
36
+ }
37
+
38
+ .bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):before {
39
+ bottom: -18px;
40
+ border-top-color: rgba(0, 0, 0, 0.15);
41
+ border-width: 9px;
42
+ right: 14px;
43
+ }
44
+
45
+ .bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):after {
46
+ bottom: -16px;
47
+ border-top-color: #fff;
48
+ border-width: 8px;
49
+ }
50
+
51
+ .bp-latest-activities-block .activity-list.item-list blockquote .activity-item.mini .avatar {
52
+ display: inline-block;
53
+ width: 20px;
54
+ height: 20px;
55
+ vertical-align: middle;
56
+ margin-left: 2px;
57
+ }
58
+
59
+ .bp-latest-activities-block .activity-list.item-list footer {
60
+ display: flex;
61
+ align-items: center;
62
+ }
63
+
64
+ .bp-latest-activities-block .activity-list.item-list footer img.avatar {
65
+ display: inline-block;
66
+ border: none;
67
+ margin-left: 0.5em;
68
+ }
69
+
70
+ .bp-latest-activities-block .activity-list.item-list footer .activity-time-since {
71
+ font-size: 90%;
72
+ }
73
+
74
+ .bp-latest-activities-block .widget-error {
75
+ border-right: solid 4px #0b80a4;
76
+ box-shadow: -1px 0 4px rgba(0, 0, 0, 0.15);
77
+ }
78
+
79
+ .bp-latest-activities-block .widget-error p {
80
+ padding: 0 1em;
81
+ }
bp-activity/css/blocks/latest-activities-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .bp-latest-activities .components-flex.components-select-control select[multiple]{height:auto;padding:0 8px}.bp-latest-activities .components-flex.components-select-control select[multiple]+.components-input-control__suffix svg{display:none}.bp-latest-activities-block a,.entry .entry-content .bp-latest-activities-block a{border:none;text-decoration:none}.bp-latest-activities-block .activity-list.item-list blockquote{padding:0;border:none}.bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini){position:relative;box-shadow:-1px 0 4px rgba(0,0,0,.15);padding:0 1em}.bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):after,.bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):before{position:absolute;right:15px;display:block;width:0;height:0;border-style:solid;border-color:transparent;content:""}.bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):before{bottom:-18px;border-top-color:rgba(0,0,0,.15);border-width:9px;right:14px}.bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):after{bottom:-16px;border-top-color:#fff;border-width:8px}.bp-latest-activities-block .activity-list.item-list blockquote .activity-item.mini .avatar{display:inline-block;width:20px;height:20px;vertical-align:middle;margin-left:2px}.bp-latest-activities-block .activity-list.item-list footer{display:flex;align-items:center}.bp-latest-activities-block .activity-list.item-list footer img.avatar{display:inline-block;border:none;margin-left:.5em}.bp-latest-activities-block .activity-list.item-list footer .activity-time-since{font-size:90%}.bp-latest-activities-block .widget-error{border-right:solid 4px #0b80a4;box-shadow:-1px 0 4px rgba(0,0,0,.15)}.bp-latest-activities-block .widget-error p{padding:0 1em}
bp-activity/css/blocks/latest-activities.css ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-latest-activities .components-flex.components-select-control select[multiple] {
2
+ height: auto;
3
+ padding: 0 8px;
4
+ }
5
+
6
+ .bp-latest-activities .components-flex.components-select-control select[multiple] + .components-input-control__suffix svg {
7
+ display: none;
8
+ }
9
+
10
+ .bp-latest-activities-block a,
11
+ .entry .entry-content .bp-latest-activities-block a {
12
+ border: none;
13
+ text-decoration: none;
14
+ }
15
+
16
+ .bp-latest-activities-block .activity-list.item-list blockquote {
17
+ padding: 0;
18
+ border: none;
19
+ }
20
+
21
+ .bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini) {
22
+ position: relative;
23
+ box-shadow: 1px 0 4px rgba(0, 0, 0, 0.15);
24
+ padding: 0 1em;
25
+ }
26
+
27
+ .bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):after, .bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):before {
28
+ position: absolute;
29
+ left: 15px;
30
+ display: block;
31
+ width: 0;
32
+ height: 0;
33
+ border-style: solid;
34
+ border-color: transparent;
35
+ content: "";
36
+ }
37
+
38
+ .bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):before {
39
+ bottom: -18px;
40
+ border-top-color: rgba(0, 0, 0, 0.15);
41
+ border-width: 9px;
42
+ left: 14px;
43
+ }
44
+
45
+ .bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):after {
46
+ bottom: -16px;
47
+ border-top-color: #fff;
48
+ border-width: 8px;
49
+ }
50
+
51
+ .bp-latest-activities-block .activity-list.item-list blockquote .activity-item.mini .avatar {
52
+ display: inline-block;
53
+ width: 20px;
54
+ height: 20px;
55
+ vertical-align: middle;
56
+ margin-right: 2px;
57
+ }
58
+
59
+ .bp-latest-activities-block .activity-list.item-list footer {
60
+ display: flex;
61
+ align-items: center;
62
+ }
63
+
64
+ .bp-latest-activities-block .activity-list.item-list footer img.avatar {
65
+ display: inline-block;
66
+ border: none;
67
+ margin-right: 0.5em;
68
+ }
69
+
70
+ .bp-latest-activities-block .activity-list.item-list footer .activity-time-since {
71
+ font-size: 90%;
72
+ }
73
+
74
+ .bp-latest-activities-block .widget-error {
75
+ border-left: solid 4px #0b80a4;
76
+ box-shadow: 1px 0 4px rgba(0, 0, 0, 0.15);
77
+ }
78
+
79
+ .bp-latest-activities-block .widget-error p {
80
+ padding: 0 1em;
81
+ }
bp-activity/css/blocks/latest-activities.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .bp-latest-activities .components-flex.components-select-control select[multiple]{height:auto;padding:0 8px}.bp-latest-activities .components-flex.components-select-control select[multiple]+.components-input-control__suffix svg{display:none}.bp-latest-activities-block a,.entry .entry-content .bp-latest-activities-block a{border:none;text-decoration:none}.bp-latest-activities-block .activity-list.item-list blockquote{padding:0;border:none}.bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini){position:relative;box-shadow:1px 0 4px rgba(0,0,0,.15);padding:0 1em}.bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):after,.bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):before{position:absolute;left:15px;display:block;width:0;height:0;border-style:solid;border-color:transparent;content:""}.bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):before{bottom:-18px;border-top-color:rgba(0,0,0,.15);border-width:9px;left:14px}.bp-latest-activities-block .activity-list.item-list blockquote .activity-item:not(.mini):after{bottom:-16px;border-top-color:#fff;border-width:8px}.bp-latest-activities-block .activity-list.item-list blockquote .activity-item.mini .avatar{display:inline-block;width:20px;height:20px;vertical-align:middle;margin-right:2px}.bp-latest-activities-block .activity-list.item-list footer{display:flex;align-items:center}.bp-latest-activities-block .activity-list.item-list footer img.avatar{display:inline-block;border:none;margin-right:.5em}.bp-latest-activities-block .activity-list.item-list footer .activity-time-since{font-size:90%}.bp-latest-activities-block .widget-error{border-left:solid 4px #0b80a4;box-shadow:1px 0 4px rgba(0,0,0,.15)}.bp-latest-activities-block .widget-error p{padding:0 1em}
bp-activity/js/blocks/embed-activity.js CHANGED
@@ -1,20 +1,20 @@
1
- parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"dEOc":[function(require,module,exports) {
2
  function r(r){if(Array.isArray(r))return r}module.exports=r;
3
- },{}],"RonT":[function(require,module,exports) {
4
  function r(r,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var e=[],n=!0,o=!1,l=void 0;try{for(var i,u=r[Symbol.iterator]();!(n=(i=u.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(a){o=!0,l=a}finally{try{n||null==u.return||u.return()}finally{if(o)throw l}}return e}}module.exports=r;
5
- },{}],"LGpM":[function(require,module,exports) {
6
  function n(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,l=new Array(r);e<r;e++)l[e]=n[e];return l}module.exports=n;
7
- },{}],"Vzqv":[function(require,module,exports) {
8
  var r=require("./arrayLikeToArray");function t(t,e){if(t){if("string"==typeof t)return r(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(o):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(t,e):void 0}}module.exports=t;
9
- },{"./arrayLikeToArray":"LGpM"}],"sa4T":[function(require,module,exports) {
10
  function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
11
- },{}],"xkYc":[function(require,module,exports) {
12
  var r=require("./arrayWithHoles"),e=require("./iterableToArrayLimit"),t=require("./unsupportedIterableToArray"),i=require("./nonIterableRest");function u(u,a){return r(u)||e(u,a)||t(u,a)||i()}module.exports=u;
13
- },{"./arrayWithHoles":"dEOc","./iterableToArrayLimit":"RonT","./unsupportedIterableToArray":"Vzqv","./nonIterableRest":"sa4T"}],"Sjre":[function(require,module,exports) {
14
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("@babel/runtime/helpers/slicedToArray"));function t(e){return e&&e.__esModule?e:{default:e}}var i=wp,r=i.element,n=r.createElement,o=r.Fragment,s=r.useState,l=i.i18n.__,a=i.components,d=a.Placeholder,u=a.Disabled,c=a.SandBox,p=a.Button,b=a.ExternalLink,m=a.Spinner,y=a.ToolbarGroup,v=a.ToolbarButton,h=i.compose.compose,f=i.data.withSelect,g=i.blockEditor,_=g.RichText,w=g.BlockControls,E=function(t){var i=t.attributes,r=t.setAttributes,a=t.isSelected,h=t.bpSettings,f=t.preview,g=t.fetching,E=i.url,k=i.caption,S=h.embedScriptURL,x=l("BuddyPress Activity URL","buddypress"),P=s(E),L=(0,e.default)(P,2),N=L[0],R=L[1],B=s(!E),T=(0,e.default)(B,2),U=T[0],A=T[1],C=n(w,null,n(y,null,n(v,{icon:"edit",title:l("Edit URL","buddypress"),onClick:function(e){e&&e.preventDefault(),A(!0)}})));return U?n(d,{icon:"buddicons-activity",label:x,className:"wp-block-embed",instructions:l("Paste the link to the activity content you want to display on your site.","buddypress")},n("form",{onSubmit:function(e){e&&e.preventDefault(),A(!1),r({url:N})}},n("input",{type:"url",value:N||"",className:"components-placeholder__input","aria-label":x,placeholder:l("Enter URL to embed here…","buddypress"),onChange:function(e){return R(e.target.value)}}),n(p,{isPrimary:!0,type:"submit"},l("Embed","buddypress"))),n("div",{className:"components-placeholder__learn-more"},n(b,{href:l("https://codex.buddypress.org/activity-embeds/")},l("Learn more about activity embeds","buddypress")))):g?n("div",{className:"wp-block-embed is-loading"},n(m,null),n("p",null,l("Embedding…","buddypress"))):f&&f.x_buddypress&&"activity"===f.x_buddypress?n(o,null,!U&&C,n("figure",{className:"wp-block-embed is-type-bp-activity"},n("div",{className:"wp-block-embed__wrapper"},n(u,null,n(c,{html:f&&f.html?f.html:"",scripts:[S]}))),(!_.isEmpty(k)||a)&&n(_,{tagName:"figcaption",placeholder:l("Write caption…","buddypress"),value:k,onChange:function(e){return r({caption:e})},inlineToolbar:!0}))):n(o,null,C,n(d,{icon:"buddicons-activity",label:x},n("p",{className:"components-placeholder__error"},l("The URL you provided is not a permalink to a public BuddyPress Activity. Please use another URL.","buddypress"))))},k=h([f(function(e,t){var i=t.attributes.url,r=e("core/editor").getEditorSettings(),n=e("core"),o=n.getEmbedPreview,s=n.isRequestingEmbedPreview,l=!!i&&o(i),a=!!i&&s(i);return{bpSettings:r.bp.activity||{},preview:l,fetching:a}})])(E),S=k;exports.default=S;
15
- },{"@babel/runtime/helpers/slicedToArray":"xkYc"}],"zmBI":[function(require,module,exports) {
16
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blockEditor.RichText,a=e.element.createElement,r=function(e){var r=e.attributes,i=r.url,c=r.caption;return i?a("figure",{className:"wp-block-embed is-type-bp-activity"},a("div",{className:"wp-block-embed__wrapper"},"\n".concat(i,"\n")),!t.isEmpty(c)&&a(t.Content,{tagName:"figcaption",value:c})):null},i=r;exports.default=i;
17
  },{}],"hBDw":[function(require,module,exports) {
18
- "use strict";var t=i(require("./embed-activity/edit")),e=i(require("./embed-activity/save"));function i(t){return t&&t.__esModule?t:{default:t}}var s=wp,r=s.i18n.__,d=s.blocks.registerBlockType;d("bp/embed-activity",{title:r("Embed an activity","buddypress"),description:r("Add a block that displays the activity content pulled from this or other community sites.","buddypress"),icon:"buddicons-activity",category:"buddypress",attributes:{url:{type:"string"},caption:{type:"string",source:"html",selector:"figcaption"}},supports:{align:!0},edit:t.default,save:e.default});
19
  },{"./embed-activity/edit":"Sjre","./embed-activity/save":"zmBI"}]},{},["hBDw"], null)
20
  //# sourceMappingURL=/bp-activity/js/blocks/embed-activity.js.map
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"DCTP":[function(require,module,exports) {
2
  function r(r){if(Array.isArray(r))return r}module.exports=r;
3
+ },{}],"LoeL":[function(require,module,exports) {
4
  function r(r,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var e=[],n=!0,o=!1,l=void 0;try{for(var i,u=r[Symbol.iterator]();!(n=(i=u.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(a){o=!0,l=a}finally{try{n||null==u.return||u.return()}finally{if(o)throw l}}return e}}module.exports=r;
5
+ },{}],"jEQo":[function(require,module,exports) {
6
  function n(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,l=new Array(r);e<r;e++)l[e]=n[e];return l}module.exports=n;
7
+ },{}],"Dbv9":[function(require,module,exports) {
8
  var r=require("./arrayLikeToArray");function t(t,e){if(t){if("string"==typeof t)return r(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(o):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(t,e):void 0}}module.exports=t;
9
+ },{"./arrayLikeToArray":"jEQo"}],"MWEO":[function(require,module,exports) {
10
  function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
11
+ },{}],"DERy":[function(require,module,exports) {
12
  var r=require("./arrayWithHoles"),e=require("./iterableToArrayLimit"),t=require("./unsupportedIterableToArray"),i=require("./nonIterableRest");function u(u,a){return r(u)||e(u,a)||t(u,a)||i()}module.exports=u;
13
+ },{"./arrayWithHoles":"DCTP","./iterableToArrayLimit":"LoeL","./unsupportedIterableToArray":"Dbv9","./nonIterableRest":"MWEO"}],"Sjre":[function(require,module,exports) {
14
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("@babel/runtime/helpers/slicedToArray"));function t(e){return e&&e.__esModule?e:{default:e}}var r=wp,i=r.element,l=i.createElement,o=i.Fragment,a=i.useState,n=r.i18n.__,s=r.components,d=s.Placeholder,u=s.Disabled,c=s.SandBox,p=s.Button,b=s.ExternalLink,m=s.Spinner,y=s.ToolbarGroup,v=s.ToolbarButton,h=r.compose.compose,f=r.data.withSelect,_=r.blockEditor,g=_.RichText,w=_.BlockControls,k=bp,E=k.blockData.embedScriptURL,x=function(t){var r=t.attributes,i=t.setAttributes,s=t.isSelected,h=t.preview,f=t.fetching,_=r.url,k=r.caption,x=n("BuddyPress Activity URL","buddypress"),P=a(_),L=(0,e.default)(P,2),N=L[0],R=L[1],S=a(!_),B=(0,e.default)(S,2),T=B[0],U=B[1],A=l(w,null,l(y,null,l(v,{icon:"edit",title:n("Edit URL","buddypress"),onClick:function(e){e&&e.preventDefault(),U(!0)}})));return T?l(d,{icon:"buddicons-activity",label:x,className:"wp-block-embed",instructions:n("Paste the link to the activity content you want to display on your site.","buddypress")},l("form",{onSubmit:function(e){e&&e.preventDefault(),U(!1),i({url:N})}},l("input",{type:"url",value:N||"",className:"components-placeholder__input","aria-label":x,placeholder:n("Enter URL to embed here…","buddypress"),onChange:function(e){return R(e.target.value)}}),l(p,{isPrimary:!0,type:"submit"},n("Embed","buddypress"))),l("div",{className:"components-placeholder__learn-more"},l(b,{href:n("https://codex.buddypress.org/activity-embeds/")},n("Learn more about activity embeds","buddypress")))):f?l("div",{className:"wp-block-embed is-loading"},l(m,null),l("p",null,n("Embedding…","buddypress"))):h&&h.x_buddypress&&"activity"===h.x_buddypress?l(o,null,!T&&A,l("figure",{className:"wp-block-embed is-type-bp-activity"},l("div",{className:"wp-block-embed__wrapper"},l(u,null,l(c,{html:h&&h.html?h.html:"",scripts:[E]}))),(!g.isEmpty(k)||s)&&l(g,{tagName:"figcaption",placeholder:n("Write caption…","buddypress"),value:k,onChange:function(e){return i({caption:e})},inlineToolbar:!0}))):l(o,null,A,l(d,{icon:"buddicons-activity",label:x},l("p",{className:"components-placeholder__error"},n("The URL you provided is not a permalink to a public BuddyPress Activity. Please use another URL.","buddypress"))))},P=h([f(function(e,t){var r=t.attributes.url,i=e("core"),l=i.getEmbedPreview,o=i.isRequestingEmbedPreview;return{preview:!!r&&l(r),fetching:!!r&&o(r)}})])(x),L=P;exports.default=L;
15
+ },{"@babel/runtime/helpers/slicedToArray":"DERy"}],"zmBI":[function(require,module,exports) {
16
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blockEditor.RichText,a=e.element.createElement,r=function(e){var r=e.attributes,i=r.url,c=r.caption;return i?a("figure",{className:"wp-block-embed is-type-bp-activity"},a("div",{className:"wp-block-embed__wrapper"},"\n".concat(i,"\n")),!t.isEmpty(c)&&a(t.Content,{tagName:"figcaption",value:c})):null},i=r;exports.default=i;
17
  },{}],"hBDw":[function(require,module,exports) {
18
+ "use strict";var t=i(require("./embed-activity/edit")),e=i(require("./embed-activity/save"));function i(t){return t&&t.__esModule?t:{default:t}}var r=wp,s=r.i18n.__,d=r.blocks.registerBlockType;d("bp/embed-activity",{title:s("Embed an activity","buddypress"),description:s("Add a block that displays the activity content pulled from this or other community sites.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"buddicons-activity"},category:"buddypress",attributes:{url:{type:"string"},caption:{type:"string",source:"html",selector:"figcaption"}},supports:{align:!0},edit:t.default,save:e.default});
19
  },{"./embed-activity/edit":"Sjre","./embed-activity/save":"zmBI"}]},{},["hBDw"], null)
20
  //# sourceMappingURL=/bp-activity/js/blocks/embed-activity.js.map
bp-activity/js/blocks/embed-activity.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","bp-activity/js/blocks/embed-activity/edit.js","bp-activity/js/blocks/embed-activity/save.js","bp-activity/js/blocks/embed-activity.js"],"names":["editEmbedActivityBlock","wp","element","createElement","Fragment","useState","__","i18n","components","Placeholder","Disabled","SandBox","Button","ExternalLink","Spinner","ToolbarGroup","ToolbarButton","compose","withSelect","data","blockEditor","RichText","BlockControls","EditEmbedActivity","attributes","setAttributes","isSelected","bpSettings","preview","fetching","url","caption","embedScriptURL","label","value","setURL","isEditingURL","setIsEditingURL","editToolbar","event","preventDefault","target","html","isEmpty","select","ownProps","editorSettings","getEditorSettings","getEmbedPreview","isRequestingEmbedPreview","bp","activity","saveEmbedActivityBlock","registerBlockType","blocks","title","description","icon","category","type","source","selector","supports","align","edit","save"],"mappings":";AAAA,SAAA,EAAA,GACA,GAAA,MAAA,QAAA,GAAA,OAAA,EAGA,OAAA,QAAA;;ACJA,SAAA,EAAA,EAAA,GACA,GAAA,oBAAA,QAAA,OAAA,YAAA,OAAA,GAAA,CACA,IAAA,EAAA,GACA,GAAA,EACA,GAAA,EACA,OAAA,EAEA,IACA,IAAA,IAAA,EAAA,EAAA,EAAA,OAAA,cAAA,GAAA,EAAA,EAAA,QAAA,QACA,EAAA,KAAA,EAAA,QAEA,GAAA,EAAA,SAAA,GAHA,GAAA,IAKA,MAAA,GACA,GAAA,EACA,EAAA,EACA,QACA,IACA,GAAA,MAAA,EAAA,QAAA,EAAA,SACA,QACA,GAAA,EAAA,MAAA,GAIA,OAAA,GAGA,OAAA,QAAA;;AC3BA,SAAA,EAAA,EAAA,IACA,MAAA,GAAA,EAAA,EAAA,UAAA,EAAA,EAAA,QAEA,IAAA,IAAA,EAAA,EAAA,EAAA,IAAA,MAAA,GAAA,EAAA,EAAA,IACA,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CACjB,EAAA,MAAA,CAAK,UAAU,2BAERA,KAAAA,OAAAA,EAFP,QAKIT,EAASsB,QAASZ,IACrB,EAAC,EAAS,QAAV,CACC,QAAQ,aACR,MAAQA,KAbJ,MAoBMqB,EAAAA,EAAAA,QAAAA,QAAAA;;AClBf,aAHA,IAAA,EAAA,EAAA,QAAA,0BACA,EAAA,EAAA,QAAA,0BAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GARInD,IAAAA,EAAAA,GALFK,EADDC,EAAAA,KACCD,GAGA+C,EADDC,EAAAA,OACCD,kBAUFA,EAAmB,oBAAqB,CACvCE,MAAOjD,EAAI,oBAAqB,cAChCkD,YAAalD,EAAI,4FAA6F,cAC9GmD,KAAM,qBACNC,SAAU,aACVlC,WAAY,CACXM,IAAK,CACJ6B,KAAM,UAEP5B,QAAS,CACR4B,KAAM,SACNC,OAAQ,OACRC,SAAU,eAGZC,SAAU,CACTC,OAAO,GAERC,KAAMhE,EAlBiC,QAmBvCiE,KAAMb,EAAAA","file":"embed-activity.js","sourceRoot":"../src/js","sourcesContent":["function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","/**\n * WordPress dependencies.\n */\nconst {\n\telement: {\n\t\tcreateElement,\n\t\tFragment,\n\t\tuseState,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n\tcomponents: {\n\t\tPlaceholder,\n\t\tDisabled,\n\t\tSandBox,\n\t\tButton,\n\t\tExternalLink,\n\t\tSpinner,\n\t\tToolbarGroup,\n\t\tToolbarButton,\n\t},\n\tcompose: {\n\t\tcompose,\n\t},\n\tdata: {\n\t\twithSelect,\n\t},\n\tblockEditor: {\n\t\tRichText,\n\t\tBlockControls,\n\t}\n} = wp;\n\nconst EditEmbedActivity = ( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tbpSettings,\n\tpreview,\n\tfetching\n} ) => {\n\tconst { url, caption } = attributes;\n\tconst { embedScriptURL } = bpSettings;\n\tconst label = __( 'BuddyPress Activity URL', 'buddypress' );\n\tconst [ value, setURL ] = useState( url );\n\tconst [ isEditingURL, setIsEditingURL ] = useState( ! url );\n\n\tconst onSubmit = ( event ) => {\n\t\tif ( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: value } );\n\t};\n\n\tconst switchBackToURLInput = ( event ) => {\n\t\tif ( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tsetIsEditingURL( true );\n\t};\n\n\tconst editToolbar = (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\ticon=\"edit\"\n\t\t\t\t\ttitle={ __( 'Edit URL', 'buddypress' ) }\n\t\t\t\t\tonClick={ switchBackToURLInput }\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tif ( isEditingURL ) {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon=\"buddicons-activity\"\n\t\t\t\tlabel={ label }\n\t\t\t\tclassName=\"wp-block-embed\"\n\t\t\t\tinstructions={ __( 'Paste the link to the activity content you want to display on your site.', 'buddypress' ) }\n\t\t\t>\n\t\t\t\t<form onSubmit={ onSubmit }>\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\tvalue={ value || '' }\n\t\t\t\t\t\tclassName=\"components-placeholder__input\"\n\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\tplaceholder={ __( 'Enter URL to embed here…', 'buddypress' ) }\n\t\t\t\t\t\tonChange={ ( event ) => setURL( event.target.value ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<Button isPrimary type=\"submit\">\n\t\t\t\t\t\t{ __( 'Embed', 'buddypress' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</form>\n\t\t\t\t<div className=\"components-placeholder__learn-more\">\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://codex.buddypress.org/activity-embeds/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Learn more about activity embeds', 'buddypress' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</div>\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<div className=\"wp-block-embed is-loading\">\n\t\t\t\t<Spinner />\n\t\t\t\t<p>{ __( 'Embedding…', 'buddypress' ) }</p>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( ! preview || ! preview['x_buddypress'] || 'activity' !== preview['x_buddypress'] ) {\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t{ editToolbar }\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon=\"buddicons-activity\"\n\t\t\t\t\tlabel={ label }\n\t\t\t\t>\n\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t{ __( 'The URL you provided is not a permalink to a public BuddyPress Activity. Please use another URL.', 'buddypress' ) }\n\t\t\t\t\t</p>\n\t\t\t\t</Placeholder>\n\t\t\t</Fragment>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t{ ! isEditingURL && editToolbar }\n\t\t\t<figure className=\"wp-block-embed is-type-bp-activity\">\n\t\t\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t\t\t<Disabled>\n\t\t\t\t\t\t<SandBox\n\t\t\t\t\t\t\thtml={ preview && preview.html ? preview.html : '' }\n\t\t\t\t\t\t\tscripts={ [ embedScriptURL ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Disabled>\n\t\t\t\t</div>\n\t\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\tplaceholder={ __( 'Write caption…', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ ( value ) => setAttributes( { caption: value } ) }\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</figure>\n\t\t</Fragment>\n\t);\n}\n\nconst editEmbedActivityBlock = compose( [\n\twithSelect( ( select, ownProps ) => {\n\t\tconst { url } = ownProps.attributes;\n\t\tconst editorSettings = select( 'core/editor' ).getEditorSettings();\n\t\tconst {\n\t\t\tgetEmbedPreview,\n\t\t\tisRequestingEmbedPreview,\n\t\t} = select( 'core' );\n\n\t\tconst preview = !! url && getEmbedPreview( url );\n\t\tconst fetching = !! url && isRequestingEmbedPreview( url );\n\n\t\treturn {\n\t\t\tbpSettings: editorSettings.bp.activity || {},\n\t\t\tpreview: preview,\n\t\t\tfetching: fetching,\n\t\t};\n\t} ),\n] )( EditEmbedActivity );\n\nexport default editEmbedActivityBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tRichText,\n\t},\n\telement: {\n\t\tcreateElement,\n\t},\n} = wp;\n\nconst saveEmbedActivityBlock = ( { attributes } ) => {\n\tconst { url, caption } = attributes;\n\n\tif ( ! url ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<figure className=\"wp-block-embed is-type-bp-activity\">\n\t\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t{\n\t\t\t\t`\\n${ url }\\n` /* URL needs to be on its own line. */\n\t\t\t}\n\t\t\t</div>\n\t\t\t{ ! RichText.isEmpty( caption ) && (\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\tvalue={ caption }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</figure>\n\t);\n};\n\nexport default saveEmbedActivityBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editEmbedActivityBlock from './embed-activity/edit';\nimport saveEmbedActivityBlock from './embed-activity/save';\n\nregisterBlockType( 'bp/embed-activity', {\n\ttitle: __( 'Embed an activity', 'buddypress' ),\n\tdescription: __( 'Add a block that displays the activity content pulled from this or other community sites.', 'buddypress' ),\n\ticon: 'buddicons-activity',\n\tcategory: 'buddypress',\n\tattributes: {\n\t\turl: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tcaption: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: 'figcaption',\n\t\t},\n\t},\n\tsupports: {\n\t\talign: true,\n\t},\n\tedit: editEmbedActivityBlock,\n\tsave: saveEmbedActivityBlock,\n} );\n"]}
1
+ {"version":3,"sources":["../../../../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../../../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../../../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../../../../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../../../../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../../../../node_modules/@babel/runtime/helpers/slicedToArray.js","bp-activity/js/blocks/embed-activity/edit.js","bp-activity/js/blocks/embed-activity/save.js","bp-activity/js/blocks/embed-activity.js"],"names":["editEmbedActivityBlock","wp","element","createElement","Fragment","useState","__","i18n","components","Placeholder","Disabled","SandBox","Button","ExternalLink","Spinner","ToolbarGroup","ToolbarButton","compose","withSelect","data","blockEditor","RichText","BlockControls","bp","embedScriptURL","blockData","EditEmbedActivity","attributes","setAttributes","isSelected","preview","fetching","url","caption","label","value","setURL","isEditingURL","setIsEditingURL","editToolbar","event","preventDefault","target","html","isEmpty","select","ownProps","getEmbedPreview","isRequestingEmbedPreview","saveEmbedActivityBlock","registerBlockType","blocks","title","description","icon","background","foreground","src","category","type","source","selector","supports","align","edit","save"],"mappings":";AAAA,SAAA,EAAA,GACA,GAAA,MAAA,QAAA,GAAA,OAAA,EAGA,OAAA,QAAA;;ACJA,SAAA,E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ACNlB,UAJkBE,GAAOe,EAAiBf,GAK1CD,WAJmBC,GAAOgB,EAA0BhB,OATxBf,CAgB1BS,GAEU1B,EAAAA,EAAAA,QAAAA,QAAAA;;ACvJAiD,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAjCf,IAOIhD,EAAAA,GALFoB,EADDD,EAAAA,YACCC,SAGAlB,EADDD,EAAAA,QACCC,cAII8C,EAAyB,SAAsB,GAAlBtB,IAAAA,EAAAA,EAAAA,WAC1BK,EAAiBL,EAAjBK,IAAKC,EAAYN,EAAZM,QAER,OAAED,EAKP,EAAA,SAAA,CAAQ,UAAU,sCACjB,EAAA,MAAA,CAAK,UAAU,2BAERA,KAAAA,OAAAA,EAFP,QAKIX,EAASuB,QAASX,IACrB,EAAC,EAAS,QAAV,CACC,QAAQ,aACR,MAAQA,KAbH,MAoBMgB,EAAAA,EAAAA,QAAAA,QAAAA;;AClBf,aAHA,IAAA,EAAA,EAAA,QAAA,0BACA,EAAA,EAAA,QAAA,0BAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAfA,IAOIhD,EAAAA,GALFK,EADDC,EAAAA,KACCD,GAGA4C,EADDC,EAAAA,OACCD,kBAUFA,EAAmB,oBAAqB,CACvCE,MAAO9C,EAAI,oBAAqB,cAChC+C,YAAa/C,EAAI,4FAA6F,cAC9GgD,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,sBAENC,SAAU,aACV/B,WAAY,CACXK,IAAK,CACJ2B,KAAM,UAEP1B,QAAS,CACR0B,KAAM,SACNC,OAAQ,OACRC,SAAU,eAGZC,SAAU,CACTC,OAAO,GAERC,KAAMhE,EAtBiC,QAuBvCiE,KAAMhB,EAAAA","file":"embed-activity.js","sourceRoot":"../src/js","sourcesContent":["function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","/**\n * WordPress dependencies.\n */\nconst {\n\telement: {\n\t\tcreateElement,\n\t\tFragment,\n\t\tuseState,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n\tcomponents: {\n\t\tPlaceholder,\n\t\tDisabled,\n\t\tSandBox,\n\t\tButton,\n\t\tExternalLink,\n\t\tSpinner,\n\t\tToolbarGroup,\n\t\tToolbarButton,\n\t},\n\tcompose: {\n\t\tcompose,\n\t},\n\tdata: {\n\t\twithSelect,\n\t},\n\tblockEditor: {\n\t\tRichText,\n\t\tBlockControls,\n\t}\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\n const {\n\tblockData: {\n\t\tembedScriptURL,\n\t}\n} = bp;\n\nconst EditEmbedActivity = ( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tpreview,\n\tfetching\n} ) => {\n\tconst { url, caption } = attributes;\n\tconst label = __( 'BuddyPress Activity URL', 'buddypress' );\n\tconst [ value, setURL ] = useState( url );\n\tconst [ isEditingURL, setIsEditingURL ] = useState( ! url );\n\n\tconst onSubmit = ( event ) => {\n\t\tif ( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: value } );\n\t};\n\n\tconst switchBackToURLInput = ( event ) => {\n\t\tif ( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tsetIsEditingURL( true );\n\t};\n\n\tconst editToolbar = (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\ticon=\"edit\"\n\t\t\t\t\ttitle={ __( 'Edit URL', 'buddypress' ) }\n\t\t\t\t\tonClick={ switchBackToURLInput }\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tif ( isEditingURL ) {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon=\"buddicons-activity\"\n\t\t\t\tlabel={ label }\n\t\t\t\tclassName=\"wp-block-embed\"\n\t\t\t\tinstructions={ __( 'Paste the link to the activity content you want to display on your site.', 'buddypress' ) }\n\t\t\t>\n\t\t\t\t<form onSubmit={ onSubmit }>\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\tvalue={ value || '' }\n\t\t\t\t\t\tclassName=\"components-placeholder__input\"\n\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\tplaceholder={ __( 'Enter URL to embed here…', 'buddypress' ) }\n\t\t\t\t\t\tonChange={ ( event ) => setURL( event.target.value ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<Button isPrimary type=\"submit\">\n\t\t\t\t\t\t{ __( 'Embed', 'buddypress' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</form>\n\t\t\t\t<div className=\"components-placeholder__learn-more\">\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://codex.buddypress.org/activity-embeds/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Learn more about activity embeds', 'buddypress' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</div>\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<div className=\"wp-block-embed is-loading\">\n\t\t\t\t<Spinner />\n\t\t\t\t<p>{ __( 'Embedding…', 'buddypress' ) }</p>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( ! preview || ! preview['x_buddypress'] || 'activity' !== preview['x_buddypress'] ) {\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t{ editToolbar }\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon=\"buddicons-activity\"\n\t\t\t\t\tlabel={ label }\n\t\t\t\t>\n\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t{ __( 'The URL you provided is not a permalink to a public BuddyPress Activity. Please use another URL.', 'buddypress' ) }\n\t\t\t\t\t</p>\n\t\t\t\t</Placeholder>\n\t\t\t</Fragment>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t{ ! isEditingURL && editToolbar }\n\t\t\t<figure className=\"wp-block-embed is-type-bp-activity\">\n\t\t\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t\t\t<Disabled>\n\t\t\t\t\t\t<SandBox\n\t\t\t\t\t\t\thtml={ preview && preview.html ? preview.html : '' }\n\t\t\t\t\t\t\tscripts={ [ embedScriptURL ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Disabled>\n\t\t\t\t</div>\n\t\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\tplaceholder={ __( 'Write caption…', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ ( value ) => setAttributes( { caption: value } ) }\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</figure>\n\t\t</Fragment>\n\t);\n}\n\nconst editEmbedActivityBlock = compose( [\n\twithSelect( ( select, ownProps ) => {\n\t\tconst { url } = ownProps.attributes;\n\t\tconst {\n\t\t\tgetEmbedPreview,\n\t\t\tisRequestingEmbedPreview,\n\t\t} = select( 'core' );\n\n\t\tconst preview = !! url && getEmbedPreview( url );\n\t\tconst fetching = !! url && isRequestingEmbedPreview( url );\n\n\t\treturn {\n\t\t\tpreview: preview,\n\t\t\tfetching: fetching,\n\t\t};\n\t} ),\n] )( EditEmbedActivity );\n\nexport default editEmbedActivityBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tRichText,\n\t},\n\telement: {\n\t\tcreateElement,\n\t},\n} = wp;\n\nconst saveEmbedActivityBlock = ( { attributes } ) => {\n\tconst { url, caption } = attributes;\n\n\tif ( ! url ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t<figure className=\"wp-block-embed is-type-bp-activity\">\n\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t{\n\t\t\t`\\n${ url }\\n` /* URL needs to be on its own line. */\n\t\t}\n\t\t</div>\n\t\t{ ! RichText.isEmpty( caption ) && (\n\t\t\t<RichText.Content\n\t\t\t\ttagName=\"figcaption\"\n\t\t\t\tvalue={ caption }\n\t\t\t/>\n\t\t) }\n\t</figure>\n\t);\n};\n\nexport default saveEmbedActivityBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editEmbedActivityBlock from './embed-activity/edit';\nimport saveEmbedActivityBlock from './embed-activity/save';\n\nregisterBlockType( 'bp/embed-activity', {\n\ttitle: __( 'Embed an activity', 'buddypress' ),\n\tdescription: __( 'Add a block that displays the activity content pulled from this or other community sites.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'buddicons-activity',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\turl: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tcaption: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: 'figcaption',\n\t\t},\n\t},\n\tsupports: {\n\t\talign: true,\n\t},\n\tedit: editEmbedActivityBlock,\n\tsave: saveEmbedActivityBlock,\n} );\n"]}
bp-activity/js/blocks/latest-activities.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"DIzr":[function(require,module,exports) {
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blockEditor.InspectorControls,l=e.components,n=l.Disabled,i=l.PanelBody,o=l.RangeControl,s=l.SelectControl,a=l.TextControl,r=e.element,u=r.Fragment,p=r.createElement,d=e.i18n.__,c=bp,b=c.blockComponents.ServerSideRender,m=c.blockData,v=m.currentPostId,y=m.activityTypes,x=function(e){var l=e.attributes,r=e.setAttributes,c=l.postId,m=l.maxActivities,x=l.type,C=l.title,f=v(),g=y();return!c&&f&&r({postId:f}),p(u,null,p(t,null,p(i,{title:d("Settings","buddypress"),initialOpen:!0,className:"bp-latest-activities"},p(a,{label:d("Title","buddypress"),value:C,onChange:function(e){r({title:e})}}),p(o,{label:d("Maximum amount to display","buddypress"),value:m,onChange:function(e){return r({maxActivities:e})},min:1,max:10,required:!0}),p(s,{multiple:!0,label:d("Type","buddypress"),value:x,options:g,onChange:function(e){r({type:e})}}))),p(n,null,p(b,{block:"bp/latest-activities",attributes:l})))},C=x;exports.default=C;
3
+ },{}],"yqpU":[function(require,module,exports) {
4
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=wp,e=t.blocks.createBlock,a={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:function(t){var e=t.idBase,a=t.instance;return!(null==a||!a.raw)&&"bp_latest_activities"===e},transform:function(t){for(var a,i=t.instance,r=/i:\d*;s:\d*:"(.*?)";/gim,s=[];null!==(a=r.exec(i.raw.type));)a.index===r.lastIndex&&r.lastIndex++,a.forEach(function(t,e){1===e&&s.push(t)});return e("bp/latest-activities",{title:i.raw.title,maxActivities:parseInt(i.raw.max,10),type:s})}}]},i=a;exports.default=i;
5
+ },{}],"q3eE":[function(require,module,exports) {
6
+ "use strict";var t=i(require("./latest-activities/edit")),e=i(require("./latest-activities/transforms"));function i(t){return t&&t.__esModule?t:{default:t}}var s=wp,r=s.blocks.registerBlockType,a=s.i18n.__;r("bp/latest-activities",{title:a("Latest Activities","buddypress"),description:a("Display the latest updates of the post author (when used into a page or post), of the displayed user (when viewing their profile) or of your community.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"buddicons-activity"},category:"buddypress",attributes:{title:{type:"string",default:a("Latest updates","buddypress")},maxActivities:{type:"number",default:5},type:{type:"array",default:["activity_update"]},postId:{type:"number",default:0}},edit:t.default,transforms:e.default});
7
+ },{"./latest-activities/edit":"DIzr","./latest-activities/transforms":"yqpU"}]},{},["q3eE"], null)
8
+ //# sourceMappingURL=/bp-activity/js/blocks/latest-activities.js.map
bp-activity/js/blocks/latest-activities.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-activity/js/blocks/latest-activities/edit.js","bp-activity/js/blocks/latest-activities/transforms.js","bp-activity/js/blocks/latest-activities.js"],"names":["editDynamicActivitiesBlock","wp","InspectorControls","blockEditor","components","Disabled","PanelBody","RangeControl","SelectControl","TextControl","element","Fragment","createElement","__","i18n","bp","ServerSideRender","blockComponents","blockData","currentPostId","activityTypes","attributes","setAttributes","postId","maxActivities","type","title","post","types","text","value","option","transforms","createBlock","blocks","from","isMatch","idBase","instance","raw","transform","matches","regex","exec","index","lastIndex","forEach","match","groupIndex","push","parseInt","max","registerBlockType","description","icon","background","foreground","src","category","default","edit"],"mappings":";AAoFeA,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAA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,OAAQ,CACPE,KAAM,SACNkC,QAAS,IAGXC,KAAM5D,EA3BoC,QA4B1CgC,WAAYA,EAAAA","file":"latest-activities.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tPanelBody,\n\t\tRangeControl,\n\t\tSelectControl,\n\t\tTextControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tServerSideRender,\n\t},\n\tblockData: {\n\t\tcurrentPostId,\n\t\tactivityTypes,\n\t}\n} = bp;\n\nconst editDynamicActivitiesBlock = ( { attributes, setAttributes } ) => {\n\tconst { postId, maxActivities, type, title } = attributes;\n\tconst post = currentPostId();\n\tconst types = activityTypes();\n\n\tif ( ! postId && post ) {\n\t\tsetAttributes( { postId: post } );\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true } className=\"bp-latest-activities\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( text ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: text } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Maximum amount to display', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ maxActivities }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { maxActivities: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ 10 }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tmultiple\n\t\t\t\t\t\tlabel={ __( 'Type', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ type }\n\t\t\t\t\t\toptions={ types }\n\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\tsetAttributes( { type: option } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/latest-activities\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editDynamicActivitiesBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Nouveau Activity Widget to Activity Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_latest_activities';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\tconst regex = /i:\\d*;s:\\d*:\"(.*?)\";/gmi;\n\t\t\t\tlet types = [];\n\t\t\t\tlet matches;\n\n\t\t\t\twhile ( ( matches = regex.exec( instance.raw.type ) ) !== null ) {\n\t\t\t\t\tif ( matches.index === regex.lastIndex ) {\n\t\t\t\t\t\tregex.lastIndex++;\n\t\t\t\t\t}\n\n\t\t\t\t\tmatches.forEach( ( match, groupIndex ) => {\n\t\t\t\t\t\tif ( 1 === groupIndex ) {\n\t\t\t\t\t\t\ttypes.push( match );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\treturn createBlock( 'bp/latest-activities', {\n\t\t\t\t\ttitle: instance.raw.title,\n\t\t\t\t\tmaxActivities: parseInt( instance.raw.max, 10 ),\n\t\t\t\t\ttype: types,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editDynamicActivitiesBlock from './latest-activities/edit';\nimport transforms from './latest-activities/transforms';\n\nregisterBlockType( 'bp/latest-activities', {\n\ttitle: __( 'Latest Activities', 'buddypress' ),\n\tdescription: __( 'Display the latest updates of the post author (when used into a page or post), of the displayed user (when viewing their profile) or of your community.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'buddicons-activity',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t\tdefault: __( 'Latest updates', 'buddypress' ),\n\t\t},\n\t\tmaxActivities: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 5\n\t\t},\n\t\ttype: {\n\t\t\ttype: 'array',\n\t\t\tdefault: ['activity_update'],\n\t\t},\n\t\tpostId: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 0,\n\t\t},\n\t},\n\tedit: editDynamicActivitiesBlock,\n\ttransforms: transforms,\n} );\n"]}
bp-activity/sass/blocks/latest-activities.scss ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-latest-activities {
2
+
3
+ .components-flex.components-select-control {
4
+
5
+ select[multiple] {
6
+ height: auto;
7
+ padding: 0 8px;
8
+
9
+ + .components-input-control__suffix svg {
10
+ display: none;
11
+ }
12
+ }
13
+ }
14
+ }
15
+
16
+ .bp-latest-activities-block {
17
+
18
+ a,
19
+ .entry .entry-content & a {
20
+ border: none;
21
+ text-decoration: none;
22
+ }
23
+
24
+ .activity-list.item-list {
25
+
26
+ blockquote {
27
+ padding: 0;
28
+ border: none;
29
+
30
+ .activity-item {
31
+
32
+ &:not(.mini) {
33
+ position: relative;
34
+ box-shadow: 1px 0 4px rgba(0, 0, 0, 0.15);
35
+ padding: 0 1em;
36
+
37
+ &:after,
38
+ &:before {
39
+ position: absolute;
40
+ left: 15px;
41
+ display: block;
42
+ width: 0;
43
+ height: 0;
44
+ border-style: solid;
45
+ border-color: transparent;
46
+ content: "";
47
+ }
48
+
49
+ &:before {
50
+ bottom: -18px;
51
+ border-top-color: rgba(0, 0, 0, 0.15);
52
+ border-width: 9px;
53
+ left: 14px;
54
+ }
55
+
56
+ &:after {
57
+ bottom: -16px;
58
+ border-top-color: #fff;
59
+ border-width: 8px;
60
+ }
61
+ }
62
+
63
+ &.mini {
64
+
65
+ .avatar {
66
+ display: inline-block;
67
+ width: 20px;
68
+ height: 20px;
69
+ vertical-align: middle;
70
+ margin-right: 2px;
71
+ }
72
+ }
73
+ }
74
+ }
75
+
76
+ footer {
77
+ display: flex;
78
+ align-items: center;
79
+
80
+ img.avatar {
81
+ display: inline-block;
82
+ border: none;
83
+ margin-right: 0.5em;
84
+ }
85
+
86
+ .activity-time-since {
87
+ font-size: 90%;
88
+ }
89
+ }
90
+ }
91
+
92
+ .widget-error {
93
+ border-left: solid 4px #0b80a4;
94
+ box-shadow: 1px 0 4px rgba(0, 0, 0, 0.15);
95
+
96
+ p {
97
+ padding: 0 1em;
98
+ }
99
+ }
100
+ }
bp-blogs/bp-blogs-blocks.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BP Blogs Blocks Functions.
4
+ *
5
+ * @package BuddyPress
6
+ * @subpackage BlogsBlocks
7
+ * @since 9.0.0
8
+ */
9
+
10
+ // Exit if accessed directly.
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * Callback function to render the Recent Posts Block.
17
+ *
18
+ * @since 9.0.0
19
+ *
20
+ * @param array $attributes The block attributes.
21
+ * @return string HTML output.
22
+ */
23
+ function bp_blogs_render_recent_posts_block( $attributes = array() ) {
24
+ $block_args = wp_parse_args(
25
+ $attributes,
26
+ array(
27
+ 'title' => __( 'Recent Networkwide Posts', 'buddypress' ),
28
+ 'maxPosts' => 10,
29
+ 'linkTitle' => false,
30
+ )
31
+ );
32
+
33
+ $classnames = 'widget_bp_blogs_widget buddypress widget';
34
+ $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
35
+ $blogs_directory_link = bp_get_blogs_directory_permalink();
36
+ $max_posts = (int) $block_args['maxPosts'];
37
+ $no_posts = __( 'Sorry, there were no posts found.', 'buddypress' );
38
+
39
+ // Set the Block's title.
40
+ if ( true === $block_args['linkTitle'] ) {
41
+ $widget_content = sprintf(
42
+ '<h2 class="widget-title"><a href="%1$s">%2$s</a></h2>',
43
+ esc_url( $blogs_directory_link ),
44
+ esc_html( $block_args['title'] )
45
+ );
46
+ } else {
47
+ $widget_content = sprintf( '<h2 class="widget-title">%s</h2>', esc_html( $block_args['title'] ) );
48
+ }
49
+
50
+ $blog_activities = bp_activity_get(
51
+ array(
52
+ 'max' => $max_posts,
53
+ 'per_page' => $max_posts,
54
+ 'user_id' => 0,
55
+ 'scope' => false,
56
+ 'filter' => array(
57
+ 'object' => false,
58
+ 'primary_id' => false,
59
+ 'action' => 'new_blog_post',
60
+ ),
61
+ )
62
+ );
63
+
64
+ $blog_activities = reset( $blog_activities );
65
+
66
+ if ( ! $blog_activities ) {
67
+ $widget_content .= sprintf( '<div class="widget-error">%s</div>', $no_posts );
68
+ } else {
69
+ // Avoid conflicts with other activity loops.
70
+ $reset_activities_template = null;
71
+ if ( ! empty( $GLOBALS['activities_template'] ) ) {
72
+ $reset_activities_template = $GLOBALS['activities_template'];
73
+ }
74
+
75
+ $GLOBALS['activities_template'] = new \stdClass();
76
+ $activities = array();
77
+
78
+ foreach ( $blog_activities as $blog_activity ) {
79
+ $activity_content = '';
80
+ $GLOBALS['activities_template']->activity = $blog_activity;
81
+
82
+ if ( $blog_activity->content ) {
83
+ /** This filter is documented in bp-activity/bp-activity-template.php. */
84
+ $activity_content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $blog_activity->content, &$blog_activity ) );
85
+ $activity_content = sprintf(
86
+ '<div class="activity-inner">%s</div>',
87
+ $activity_content
88
+ );
89
+ }
90
+
91
+ /** This filter is documented in bp-activity/bp-activity-template.php. */
92
+ $actity_action = apply_filters_ref_array(
93
+ 'bp_get_activity_action',
94
+ array(
95
+ bp_insert_activity_meta( $blog_activity->action ),
96
+ &$blog_activity,
97
+ array( 'no_timestamp' => false ),
98
+ )
99
+ );
100
+
101
+ $activities[] = sprintf(
102
+ '<li>
103
+ <div class="activity-content">
104
+ <div class="activity-header">%1$s</div>
105
+ %2$s
106
+ </div>
107
+ </li>',
108
+ $actity_action,
109
+ $activity_content
110
+ );
111
+ }
112
+
113
+ // Reset the global template loop.
114
+ $GLOBALS['activities_template'] = $reset_activities_template;
115
+
116
+ $widget_content .= sprintf(
117
+ '<ul class="activity-list item-list">
118
+ %s
119
+ </ul>',
120
+ implode( "\n", $activities )
121
+ );
122
+ }
123
+
124
+ // Adds a container to make sure the block is styled even when used into the Columns parent block.
125
+ $widget_content = sprintf( '<div class="bp-recent-posts-block-container">%s</div>', "\n" . $widget_content . "\n" );
126
+
127
+ // Only add a block wrapper if not loaded into a Widgets sidebar.
128
+ if ( ! did_action( 'dynamic_sidebar_before' ) ) {
129
+ return sprintf(
130
+ '<div %1$s>%2$s</div>',
131
+ $wrapper_attributes,
132
+ $widget_content
133
+ );
134
+ }
135
+
136
+ return $widget_content;
137
+ }
bp-blogs/classes/class-bp-blogs-component.php CHANGED
@@ -81,6 +81,11 @@ class BP_Blogs_Component extends BP_Component {
81
  'autocomplete_all' => defined( 'BP_MESSAGES_AUTOCOMPLETE_ALL' ),
82
  'global_tables' => $global_tables,
83
  'meta_tables' => $meta_tables,
 
 
 
 
 
84
  );
85
 
86
  // Setup the globals.
@@ -132,10 +137,11 @@ class BP_Blogs_Component extends BP_Component {
132
 
133
  if ( bp_is_active( 'activity' ) ) {
134
  $includes[] = 'activity';
135
- }
136
 
137
- if ( is_multisite() ) {
138
- $includes[] = 'widgets';
 
 
139
  }
140
 
141
  // Include the files.
@@ -379,4 +385,51 @@ class BP_Blogs_Component extends BP_Component {
379
 
380
  parent::rest_api_init( $controllers );
381
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
  }
81
  'autocomplete_all' => defined( 'BP_MESSAGES_AUTOCOMPLETE_ALL' ),
82
  'global_tables' => $global_tables,
83
  'meta_tables' => $meta_tables,
84
+ 'block_globals' => array(
85
+ 'bp/recent-posts' => array(
86
+ 'widget_classnames' => array( 'widget_bp_blogs_widget', 'buddypress' ),
87
+ ),
88
+ ),
89
  );
90
 
91
  // Setup the globals.
137
 
138
  if ( bp_is_active( 'activity' ) ) {
139
  $includes[] = 'activity';
 
140
 
141
+ if ( is_multisite() ) {
142
+ $includes[] = 'widgets';
143
+ $includes[] = 'blocks';
144
+ }
145
  }
146
 
147
  // Include the files.
385
 
386
  parent::rest_api_init( $controllers );
387
  }
388
+
389
+ /**
390
+ * Register the BP Blogs Blocks.
391
+ *
392
+ * @since 9.0.0
393
+ *
394
+ * @param array $blocks Optional. See BP_Component::blocks_init() for
395
+ * description.
396
+ */
397
+ public function blocks_init( $blocks = array() ) {
398
+ $blocks = array();
399
+
400
+ if ( is_multisite() && bp_is_active( 'activity' ) ) {
401
+ $blocks['bp/recent-posts'] = array(
402
+ 'name' => 'bp/recent-posts',
403
+ 'editor_script' => 'bp-recent-posts-block',
404
+ 'editor_script_url' => plugins_url( 'js/blocks/recent-posts.js', dirname( __FILE__ ) ),
405
+ 'editor_script_deps' => array(
406
+ 'wp-blocks',
407
+ 'wp-element',
408
+ 'wp-components',
409
+ 'wp-i18n',
410
+ 'wp-block-editor',
411
+ 'bp-block-components',
412
+ ),
413
+ 'style' => 'bp-recent-posts-block',
414
+ 'style_url' => plugins_url( 'css/blocks/recent-posts.css', dirname( __FILE__ ) ),
415
+ 'attributes' => array(
416
+ 'title' => array(
417
+ 'type' => 'string',
418
+ 'default' => __( 'Recent Networkwide Posts', 'buddypress' ),
419
+ ),
420
+ 'maxPosts' => array(
421
+ 'type' => 'number',
422
+ 'default' => 10,
423
+ ),
424
+ 'linkTitle' => array(
425
+ 'type' => 'boolean',
426
+ 'default' => false,
427
+ ),
428
+ ),
429
+ 'render_callback' => 'bp_blogs_render_recent_posts_block',
430
+ );
431
+ }
432
+
433
+ parent::blocks_init( $blocks );
434
+ }
435
  }
bp-blogs/classes/class-bp-blogs-recent-posts-widget.php CHANGED
@@ -12,17 +12,23 @@ defined( 'ABSPATH' ) || exit;
12
 
13
  /**
14
  * The Recent Networkwide Posts widget.
 
 
15
  */
16
  class BP_Blogs_Recent_Posts_Widget extends WP_Widget {
17
 
18
  /**
19
  * Constructor method.
 
 
 
20
  */
21
  public function __construct() {
22
  $widget_ops = array(
23
  'description' => __( 'A list of recently published posts from across your network.', 'buddypress' ),
24
  'classname' => 'widget_bp_blogs_widget buddypress widget',
25
  'customize_selective_refresh' => true,
 
26
  );
27
  parent::__construct( false, $name = _x( '(BuddyPress) Recent Networkwide Posts', 'widget name', 'buddypress' ), $widget_ops );
28
  }
12
 
13
  /**
14
  * The Recent Networkwide Posts widget.
15
+ *
16
+ * @since 1.0.0
17
  */
18
  class BP_Blogs_Recent_Posts_Widget extends WP_Widget {
19
 
20
  /**
21
  * Constructor method.
22
+ *
23
+ * @since 1.5.0
24
+ * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options.
25
  */
26
  public function __construct() {
27
  $widget_ops = array(
28
  'description' => __( 'A list of recently published posts from across your network.', 'buddypress' ),
29
  'classname' => 'widget_bp_blogs_widget buddypress widget',
30
  'customize_selective_refresh' => true,
31
+ 'show_instance_in_rest' => true,
32
  );
33
  parent::__construct( false, $name = _x( '(BuddyPress) Recent Networkwide Posts', 'widget name', 'buddypress' ), $widget_ops );
34
  }
bp-blogs/classes/class-bp-rest-attachments-blog-avatar-endpoint.php CHANGED
@@ -97,13 +97,13 @@ class BP_REST_Attachments_Blog_Avatar_Endpoint extends WP_REST_Controller {
97
 
98
  // Set the requested args.
99
  $requested_args = array(
100
- 'blog_id' => $request['id'],
101
  'no_grav' => $no_user_grav,
102
- 'html' => (bool) $request['html'],
103
  );
104
 
105
- if ( $request['alt'] ) {
106
- $requested_args['alt'] = $request['alt'];
107
  }
108
 
109
  if ( ! $no_user_grav ) {
@@ -172,7 +172,7 @@ class BP_REST_Attachments_Blog_Avatar_Endpoint extends WP_REST_Controller {
172
  )
173
  );
174
 
175
- $this->blog = $this->blogs_endpoint->get_blog_object( $request['id'] );
176
 
177
  if ( ! is_object( $this->blog ) ) {
178
  $retval = new WP_Error(
@@ -220,7 +220,7 @@ class BP_REST_Attachments_Blog_Avatar_Endpoint extends WP_REST_Controller {
220
  'thumb' => $avatar->thumb,
221
  );
222
 
223
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
224
  $data = $this->add_additional_fields_to_object( $data, $request );
225
  $data = $this->filter_response_by_context( $data, $context );
226
  $response = rest_ensure_response( $data );
97
 
98
  // Set the requested args.
99
  $requested_args = array(
100
+ 'blog_id' => $request->get_param( 'id' ),
101
  'no_grav' => $no_user_grav,
102
+ 'html' => (bool) $request->get_param( 'html' ),
103
  );
104
 
105
+ if ( ! empty( $request->get_param( 'alt' ) ) ) {
106
+ $requested_args['alt'] = $request->get_param( 'alt' );
107
  }
108
 
109
  if ( ! $no_user_grav ) {
172
  )
173
  );
174
 
175
+ $this->blog = $this->blogs_endpoint->get_blog_object( $request->get_param( 'id' ) );
176
 
177
  if ( ! is_object( $this->blog ) ) {
178
  $retval = new WP_Error(
220
  'thumb' => $avatar->thumb,
221
  );
222
 
223
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
224
  $data = $this->add_additional_fields_to_object( $data, $request );
225
  $data = $this->filter_response_by_context( $data, $context );
226
  $response = rest_ensure_response( $data );
bp-blogs/classes/class-bp-rest-blogs-endpoint.php CHANGED
@@ -91,12 +91,12 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
91
  */
92
  public function get_items( $request ) {
93
  $args = array(
94
- 'type' => $request['type'],
95
- 'include_blog_ids' => $request['include'],
96
- 'user_id' => $request['user_id'],
97
- 'search_terms' => $request['search'],
98
- 'page' => $request['page'],
99
- 'per_page' => $request['per_page'],
100
  );
101
 
102
  /**
@@ -131,8 +131,7 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
131
  }
132
 
133
  // Actually, query it.
134
- $blogs = bp_blogs_get_blogs( $args );
135
-
136
  $retval = array();
137
  foreach ( (array) $blogs['blogs'] as $blog ) {
138
  $retval[] = $this->prepare_response_for_collection(
@@ -404,16 +403,24 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
404
  */
405
  public function prepare_item_for_response( $blog, $request ) {
406
  $data = array(
407
- 'id' => $blog->blog_id,
408
- 'user_id' => $blog->admin_user_id,
409
- 'name' => $blog->name,
410
- 'domain' => $blog->domain,
411
- 'path' => $blog->path,
412
- 'permalink' => $this->get_blog_domain( $blog ),
413
- 'description' => stripslashes( $blog->description ),
414
- 'last_activity' => bp_rest_prepare_date_response( $blog->last_activity ),
 
 
 
 
415
  );
416
 
 
 
 
 
417
  // Blog Avatars.
418
  if ( true === buddypress()->avatar->show_avatars ) {
419
  $data['avatar_urls'] = array(
@@ -421,7 +428,6 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
421
  array(
422
  'type' => 'thumb',
423
  'blog_id' => $blog->blog_id,
424
- 'admin_user_id' => $blog->admin_user_id,
425
  'html' => false,
426
  )
427
  ),
@@ -429,14 +435,13 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
429
  array(
430
  'type' => 'full',
431
  'blog_id' => $blog->blog_id,
432
- 'admin_user_id' => $blog->admin_user_id,
433
  'html' => false,
434
  )
435
  ),
436
  );
437
  }
438
 
439
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
440
  $data = $this->add_additional_fields_to_object( $data, $request );
441
  $data = $this->filter_response_by_context( $data, $context );
442
  $response = rest_ensure_response( $data );
@@ -465,29 +470,43 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
465
  */
466
  protected function prepare_links( $blog ) {
467
  $base = sprintf( '/%s/%s/', $this->namespace, $this->rest_base );
468
- $url = $base . $blog->blog_id;
469
 
470
  // Entity meta.
471
  $links = array(
472
  'self' => array(
473
- 'href' => rest_url( $url ),
474
  ),
475
  'collection' => array(
476
  'href' => rest_url( $base ),
477
  ),
478
- 'user' => array(
479
- 'href' => rest_url( bp_rest_get_user_url( $blog->admin_user_id ) ),
480
- 'embeddable' => true,
481
- ),
482
  );
483
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  /**
485
  * Filter links prepared for the REST response.
486
  *
487
  * @since 5.0.0
488
  *
489
  * @param array $links The prepared links of the REST response.
490
- * @param stdClass $blog Blog object.
491
  */
492
  return apply_filters( 'bp_rest_blogs_prepare_links', $links, $blog );
493
  }
@@ -653,11 +672,27 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
653
  'type' => 'string',
654
  'format' => 'uri',
655
  ),
656
- 'description' => array(
657
  'context' => array( 'view', 'edit', 'embed' ),
658
  'description' => __( 'The description of the blog.', 'buddypress' ),
659
- 'readonly' => true,
660
- 'type' => 'string',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
661
  ),
662
  'path' => array(
663
  'context' => array( 'view', 'edit', 'embed' ),
@@ -667,7 +702,7 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
667
  ),
668
  'domain' => array(
669
  'context' => array( 'view', 'edit', 'embed' ),
670
- 'description' => __( 'the domain of the blog.', 'buddypress' ),
671
  'readonly' => true,
672
  'type' => 'string',
673
  ),
@@ -677,6 +712,12 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
677
  'type' => 'string',
678
  'format' => 'date-time',
679
  ),
 
 
 
 
 
 
680
  ),
681
  );
682
 
91
  */
92
  public function get_items( $request ) {
93
  $args = array(
94
+ 'type' => $request->get_param( 'type' ),
95
+ 'include_blog_ids' => $request->get_param( 'include' ),
96
+ 'user_id' => $request->get_param( 'user_id' ),
97
+ 'search_terms' => $request->get_param( 'search' ),
98
+ 'page' => $request->get_param( 'page' ),
99
+ 'per_page' => $request->get_param( 'per_page' ),
100
  );
101
 
102
  /**
131
  }
132
 
133
  // Actually, query it.
134
+ $blogs = bp_blogs_get_blogs( $args );
 
135
  $retval = array();
136
  foreach ( (array) $blogs['blogs'] as $blog ) {
137
  $retval[] = $this->prepare_response_for_collection(
403
  */
404
  public function prepare_item_for_response( $blog, $request ) {
405
  $data = array(
406
+ 'id' => absint( $blog->blog_id ),
407
+ 'user_id' => absint( $blog->admin_user_id ),
408
+ 'name' => apply_filters( 'bp_get_blog_name', $blog->name ),
409
+ 'domain' => (string) $blog->domain,
410
+ 'path' => (string) $blog->path,
411
+ 'permalink' => $this->get_blog_domain( $blog ),
412
+ 'description' => array(
413
+ 'raw' => $blog->description,
414
+ 'rendered' => apply_filters( 'bp_get_blog_description', $blog->description ),
415
+ ),
416
+ 'last_activity' => bp_rest_prepare_date_response( $blog->last_activity ),
417
+ 'lastest_post_id' => 0,
418
  );
419
 
420
+ if ( ! empty( $blog->latest_post->ID ) ) {
421
+ $data['lastest_post_id'] = absint( $blog->latest_post->ID );
422
+ }
423
+
424
  // Blog Avatars.
425
  if ( true === buddypress()->avatar->show_avatars ) {
426
  $data['avatar_urls'] = array(
428
  array(
429
  'type' => 'thumb',
430
  'blog_id' => $blog->blog_id,
 
431
  'html' => false,
432
  )
433
  ),
435
  array(
436
  'type' => 'full',
437
  'blog_id' => $blog->blog_id,
 
438
  'html' => false,
439
  )
440
  ),
441
  );
442
  }
443
 
444
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
445
  $data = $this->add_additional_fields_to_object( $data, $request );
446
  $data = $this->filter_response_by_context( $data, $context );
447
  $response = rest_ensure_response( $data );
470
  */
471
  protected function prepare_links( $blog ) {
472
  $base = sprintf( '/%s/%s/', $this->namespace, $this->rest_base );
 
473
 
474
  // Entity meta.
475
  $links = array(
476
  'self' => array(
477
+ 'href' => rest_url( $base . $blog->blog_id ),
478
  ),
479
  'collection' => array(
480
  'href' => rest_url( $base ),
481
  ),
 
 
 
 
482
  );
483
 
484
+ if ( ! empty( $blog->admin_user_id ) ) {
485
+ $links['user'] = array(
486
+ 'href' => bp_rest_get_object_url( absint( $blog->admin_user_id ), 'members' ),
487
+ 'embeddable' => true,
488
+ );
489
+ }
490
+
491
+ // Embed latest blog post.
492
+ if ( ! empty( $blog->latest_post->ID ) ) {
493
+ $links['post'] = array(
494
+ 'embeddable' => true,
495
+ 'href' => sprintf(
496
+ '%s/%d',
497
+ get_rest_url( absint( $blog->blog_id ), 'wp/v2/posts' ),
498
+ absint( $blog->latest_post->ID )
499
+ ),
500
+ );
501
+ }
502
+
503
  /**
504
  * Filter links prepared for the REST response.
505
  *
506
  * @since 5.0.0
507
  *
508
  * @param array $links The prepared links of the REST response.
509
+ * @param stdClass $blog The blog object.
510
  */
511
  return apply_filters( 'bp_rest_blogs_prepare_links', $links, $blog );
512
  }
672
  'type' => 'string',
673
  'format' => 'uri',
674
  ),
675
+ 'description' => array(
676
  'context' => array( 'view', 'edit', 'embed' ),
677
  'description' => __( 'The description of the blog.', 'buddypress' ),
678
+ 'type' => 'object',
679
+ 'arg_options' => array(
680
+ 'sanitize_callback' => null,
681
+ 'validate_callback' => null,
682
+ ),
683
+ 'properties' => array(
684
+ 'raw' => array(
685
+ 'description' => __( 'Content for the description of the blog, as it exists in the database.', 'buddypress' ),
686
+ 'type' => 'string',
687
+ 'context' => array( 'view', 'edit' ),
688
+ ),
689
+ 'rendered' => array(
690
+ 'description' => __( 'HTML content for the description of the blog, transformed for display.', 'buddypress' ),
691
+ 'type' => 'string',
692
+ 'context' => array( 'view', 'edit', 'embed' ),
693
+ 'readonly' => true,
694
+ ),
695
+ ),
696
  ),
697
  'path' => array(
698
  'context' => array( 'view', 'edit', 'embed' ),
702
  ),
703
  'domain' => array(
704
  'context' => array( 'view', 'edit', 'embed' ),
705
+ 'description' => __( 'The domain of the blog.', 'buddypress' ),
706
  'readonly' => true,
707
  'type' => 'string',
708
  ),
712
  'type' => 'string',
713
  'format' => 'date-time',
714
  ),
715
+ 'lastest_post_id' => array(
716
+ 'context' => array( 'view', 'edit', 'embed' ),
717
+ 'description' => __( 'The latest post ID from the blog', 'buddypress' ),
718
+ 'type' => 'integer',
719
+ 'readonly' => true,
720
+ ),
721
  ),
722
  );
723
 
bp-blogs/css/blocks/recent-posts-rtl.css ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-recent-posts-block-container a {
2
+ box-shadow: none;
3
+ text-decoration: none;
4
+ }
5
+
6
+ .bp-recent-posts-block-container ul.item-list {
7
+ list-style: none;
8
+ margin: 10px 0;
9
+ }
10
+
11
+ .bp-recent-posts-block-container ul.activity-list {
12
+ padding: 0;
13
+ }
14
+
15
+ .bp-recent-posts-block-container ul.activity-list blockquote {
16
+ margin: 0 0 1.5em;
17
+ overflow: visible;
18
+ padding: 0 0.75em 0.75em 0;
19
+ }
20
+
21
+ .bp-recent-posts-block-container ul.activity-list img {
22
+ margin-bottom: 0.5em;
23
+ }
24
+
25
+ .bp-recent-posts-block-container ul.activity-list li {
26
+ border-bottom: 1px solid #ccc;
27
+ margin-bottom: 1em;
28
+ }
29
+
30
+ .bp-recent-posts-block-container ul.activity-list li .activity-header p {
31
+ margin-bottom: 0.5em;
32
+ }
33
+
34
+ .bp-recent-posts-block-container ul.activity-list li .activity-header p .time-since {
35
+ font-size: 80%;
36
+ color: #767676;
37
+ text-decoration: none;
38
+ }
39
+
40
+ .bp-recent-posts-block-container ul.activity-list li:last-child {
41
+ border-bottom: 0;
42
+ }
bp-blogs/css/blocks/recent-posts-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .bp-recent-posts-block-container a{box-shadow:none;text-decoration:none}.bp-recent-posts-block-container ul.item-list{list-style:none;margin:10px 0}.bp-recent-posts-block-container ul.activity-list{padding:0}.bp-recent-posts-block-container ul.activity-list blockquote{margin:0 0 1.5em;overflow:visible;padding:0 .75em .75em 0}.bp-recent-posts-block-container ul.activity-list img{margin-bottom:.5em}.bp-recent-posts-block-container ul.activity-list li{border-bottom:1px solid #ccc;margin-bottom:1em}.bp-recent-posts-block-container ul.activity-list li .activity-header p{margin-bottom:.5em}.bp-recent-posts-block-container ul.activity-list li .activity-header p .time-since{font-size:80%;color:#767676;text-decoration:none}.bp-recent-posts-block-container ul.activity-list li:last-child{border-bottom:0}
bp-blogs/css/blocks/recent-posts.css ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-recent-posts-block-container a {
2
+ box-shadow: none;
3
+ text-decoration: none;
4
+ }
5
+
6
+ .bp-recent-posts-block-container ul.item-list {
7
+ list-style: none;
8
+ margin: 10px 0;
9
+ }
10
+
11
+ .bp-recent-posts-block-container ul.activity-list {
12
+ padding: 0;
13
+ }
14
+
15
+ .bp-recent-posts-block-container ul.activity-list blockquote {
16
+ margin: 0 0 1.5em;
17
+ overflow: visible;
18
+ padding: 0 0 0.75em 0.75em;
19
+ }
20
+
21
+ .bp-recent-posts-block-container ul.activity-list img {
22
+ margin-bottom: 0.5em;
23
+ }
24
+
25
+ .bp-recent-posts-block-container ul.activity-list li {
26
+ border-bottom: 1px solid #ccc;
27
+ margin-bottom: 1em;
28
+ }
29
+
30
+ .bp-recent-posts-block-container ul.activity-list li .activity-header p {
31
+ margin-bottom: 0.5em;
32
+ }
33
+
34
+ .bp-recent-posts-block-container ul.activity-list li .activity-header p .time-since {
35
+ font-size: 80%;
36
+ color: #767676;
37
+ text-decoration: none;
38
+ }
39
+
40
+ .bp-recent-posts-block-container ul.activity-list li:last-child {
41
+ border-bottom: 0;
42
+ }
bp-blogs/css/blocks/recent-posts.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .bp-recent-posts-block-container a{box-shadow:none;text-decoration:none}.bp-recent-posts-block-container ul.item-list{list-style:none;margin:10px 0}.bp-recent-posts-block-container ul.activity-list{padding:0}.bp-recent-posts-block-container ul.activity-list blockquote{margin:0 0 1.5em;overflow:visible;padding:0 0 .75em .75em}.bp-recent-posts-block-container ul.activity-list img{margin-bottom:.5em}.bp-recent-posts-block-container ul.activity-list li{border-bottom:1px solid #ccc;margin-bottom:1em}.bp-recent-posts-block-container ul.activity-list li .activity-header p{margin-bottom:.5em}.bp-recent-posts-block-container ul.activity-list li .activity-header p .time-since{font-size:80%;color:#767676;text-decoration:none}.bp-recent-posts-block-container ul.activity-list li:last-child{border-bottom:0}
bp-blogs/js/blocks/recent-posts.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Pfcj":[function(require,module,exports) {
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blockEditor.InspectorControls,n=e.components,l=n.Disabled,o=n.PanelBody,r=n.RangeControl,s=n.TextControl,i=n.ToggleControl,a=e.element,u=a.Fragment,d=a.createElement,b=e.i18n.__,c=bp,p=c.blockComponents.ServerSideRender,g=function(e){var n=e.attributes,a=e.setAttributes,c=n.title,g=n.maxPosts,m=n.linkTitle;return d(u,null,d(t,null,d(o,{title:b("Settings","buddypress"),initialOpen:!0},d(s,{label:b("Title","buddypress"),value:c,onChange:function(e){a({title:e})}}),d(r,{label:b("Max posts to show","buddypress"),value:g,onChange:function(e){return a({maxPosts:e})},min:1,max:10,required:!0}),d(i,{label:b("Link block title to Blogs directory","buddypress"),checked:!!m,onChange:function(){a({linkTitle:!m})}}))),d(l,null,d(p,{block:"bp/recent-posts",attributes:n})))},m=g;exports.default=m;
3
+ },{}],"D8sC":[function(require,module,exports) {
4
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=wp,e=t.blocks.createBlock,r={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:function(t){var e=t.idBase,r=t.instance;return!(null==r||!r.raw)&&"bp_blogs_recent_posts_widget"===e},transform:function(t){var r=t.instance;return e("bp/recent-posts",{title:r.raw.title,maxPosts:r.raw.max_posts,linkTitle:r.raw.link_title})}}]},s=r;exports.default=s;
5
+ },{}],"PMBS":[function(require,module,exports) {
6
+ "use strict";var e=s(require("./recent-posts/edit")),t=s(require("./recent-posts/transforms"));function s(e){return e&&e.__esModule?e:{default:e}}var r=wp,o=r.blocks.registerBlockType,d=r.i18n.__;o("bp/recent-posts",{title:d("Recent Networkwide Posts","buddypress"),description:d("A list of recently published posts from across your network.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"wordpress"},category:"buddypress",attributes:{title:{type:"string",default:d("Recent Networkwide Posts","buddypress")},maxPosts:{type:"number",default:10},linkTitle:{type:"boolean",default:!1}},edit:e.default,transforms:t.default});
7
+ },{"./recent-posts/edit":"Pfcj","./recent-posts/transforms":"D8sC"}]},{},["PMBS"], null)
8
+ //# sourceMappingURL=/bp-blogs/js/blocks/recent-posts.js.map
bp-blogs/js/blocks/recent-posts.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-blogs/js/blocks/recent-posts/edit.js","bp-blogs/js/blocks/recent-posts/transforms.js","bp-blogs/js/blocks/recent-posts.js"],"names":["editRecentPostsBlock","wp","InspectorControls","blockEditor","components","Disabled","PanelBody","RangeControl","TextControl","ToggleControl","element","Fragment","createElement","__","i18n","bp","ServerSideRender","blockComponents","attributes","setAttributes","title","maxPosts","linkTitle","text","value","transforms","createBlock","blocks","from","type","isMatch","idBase","instance","raw","transform","max_posts","link_title","registerBlockType","description","icon","background","foreground","src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ASID,EAAa,CAClBG,KAAM,CACL,CACCC,KAAM,QACNF,OAAQ,CAAE,sBACVG,QAAS,SAA4B,GAAxBC,IAAAA,EAAAA,EAAAA,OAAQC,EAAAA,EAAAA,SACf,QAAEA,MAAAA,IAAAA,EAAUC,MAIC,iCAAXF,GAERG,UAAW,SAAoB,GAAhBF,IAAAA,EAAAA,EAAAA,SACPN,OAAAA,EAAa,kBAAmB,CACtCN,MAAOY,EAASC,IAAIb,MACpBC,SAAUW,EAASC,IAAIE,UACvBb,UAAWU,EAASC,IAAIG,iBAOdX,EAAAA,EAAAA,QAAAA,QAAAA;;ACnBf,aAHA,IAAA,EAAA,EAAA,QAAA,wBACA,EAAA,EAAA,QAAA,8BAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAfA,IAOIxB,EAAAA,GALFoC,EADDV,EAAAA,OACCU,kBAGAxB,EADDC,EAAAA,KACCD,GAUFwB,EAAmB,kBAAmB,CACrCjB,MAAOP,EAAI,2BAA4B,cACvCyB,YAAazB,EAAI,+DAAgE,cACjF0B,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,aAENC,SAAU,aACVzB,WAAY,CACXE,MAAO,CACNS,KAAM,SACNe,QAAS/B,EAAI,2BAA4B,eAE1CQ,SAAU,CACTQ,KAAM,SACNe,QAAS,IAEVtB,UAAW,CACVO,KAAM,UACNe,SAAS,IAGXC,KAAM7C,EAvB+B,QAwBrCyB,WAAYA,EAAAA","file":"recent-posts.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tPanelBody,\n\t\tRangeControl,\n\t\tTextControl,\n\t\tToggleControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tServerSideRender,\n\t},\n} = bp;\n\nconst editRecentPostsBlock = ( { attributes, setAttributes } ) => {\n\tconst { title, maxPosts, linkTitle } = attributes;\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( text ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: text } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max posts to show', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ maxPosts }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { maxPosts: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ 10 }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link block title to Blogs directory', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! linkTitle }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { linkTitle: ! linkTitle } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/recent-posts\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editRecentPostsBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Legacy Widget to Recent Posts Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_blogs_recent_posts_widget';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\treturn createBlock( 'bp/recent-posts', {\n\t\t\t\t\ttitle: instance.raw.title,\n\t\t\t\t\tmaxPosts: instance.raw.max_posts,\n\t\t\t\t\tlinkTitle: instance.raw.link_title,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editRecentPostsBlock from './recent-posts/edit';\nimport transforms from './recent-posts/transforms';\n\nregisterBlockType( 'bp/recent-posts', {\n\ttitle: __( 'Recent Networkwide Posts', 'buddypress' ),\n\tdescription: __( 'A list of recently published posts from across your network.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'wordpress',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t\tdefault: __( 'Recent Networkwide Posts', 'buddypress' ),\n\t\t},\n\t\tmaxPosts: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 10\n\t\t},\n\t\tlinkTitle: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tedit: editRecentPostsBlock,\n\ttransforms: transforms,\n} );\n"]}
bp-blogs/sass/blocks/recent-posts.scss ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-recent-posts-block-container {
2
+
3
+ a {
4
+ box-shadow: none;
5
+ text-decoration: none;
6
+ }
7
+
8
+ ul.item-list {
9
+ list-style: none;
10
+ margin: 10px 0;
11
+ }
12
+
13
+ ul.activity-list {
14
+
15
+ padding: 0;
16
+
17
+ blockquote {
18
+ margin: 0 0 1.5em;
19
+ overflow: visible;
20
+ padding: 0 0 0.75em 0.75em;
21
+ }
22
+
23
+ img {
24
+ margin-bottom: 0.5em;
25
+ }
26
+
27
+ li {
28
+ border-bottom: 1px solid #ccc;
29
+ margin-bottom: 1em;
30
+
31
+ .activity-header p {
32
+ margin-bottom: 0.5em;
33
+
34
+ .time-since {
35
+ font-size: 80%;
36
+ color: #767676;
37
+ text-decoration: none;
38
+ }
39
+ }
40
+
41
+ &:last-child {
42
+ border-bottom: 0;
43
+ }
44
+ }
45
+ }
46
+ }
bp-core/admin/bp-core-admin-slugs.php CHANGED
@@ -198,7 +198,7 @@ function bp_core_admin_slugs_options() {
198
  <?php
199
  printf(
200
  /* translators: %s: the link to the Network settings page */
201
- esc_html_x( 'Registration is currently disabled. Before associating a page is allowed, please enable registration by selecting either the "User accounts may be registered" or "Both sites and user accounts can be registered" option on %s.', 'Disabled registration message for multisite config', 'buddypress' ),
202
  sprintf(
203
  '<a href="%1$s">%2$s</a>',
204
  esc_url( network_admin_url( 'settings.php' ) ),
@@ -212,7 +212,7 @@ function bp_core_admin_slugs_options() {
212
  <?php
213
  printf(
214
  /* translators: %s: the link to the Site general options page */
215
- esc_html_x( 'Registration is currently disabled. Before associating a page is allowed, please enable registration by clicking on the "Anyone can register" checkbox on %s.', 'Disabled registration message for regular site config', 'buddypress' ),
216
  sprintf(
217
  '<a href="%1$s">%2$s</a>',
218
  esc_url( admin_url( 'options-general.php' ) ),
198
  <?php
199
  printf(
200
  /* translators: %s: the link to the Network settings page */
201
+ esc_html_x( 'Registration is currently disabled. Before associating a page is allowed, please enable registration by selecting either the "User accounts may be registered" or "Both sites and user accounts can be registered" option on %s.', 'Disabled registration message for multisite config', 'buddypress' ),
202
  sprintf(
203
  '<a href="%1$s">%2$s</a>',
204
  esc_url( network_admin_url( 'settings.php' ) ),
212
  <?php
213
  printf(
214
  /* translators: %s: the link to the Site general options page */
215
+ esc_html_x( 'Registration is currently disabled. Before associating a page is allowed, please enable registration by clicking on the "Anyone can register" checkbox on %s.', 'Disabled registration message for regular site config', 'buddypress' ),
216
  sprintf(
217
  '<a href="%1$s">%2$s</a>',
218
  esc_url( admin_url( 'options-general.php' ) ),
bp-core/admin/css/common-rtl.css CHANGED
@@ -21,7 +21,8 @@ TABLE OF CONTENTS:
21
  3.1 Users List
22
  3.2 Site Notices
23
  4.0 Emails - Edit page
24
- 5.0 Plugins page
 
25
  ------------------------------------------------------------------------------*/
26
 
27
  /*------------------------------------------------------------------------------
@@ -538,7 +539,14 @@ body.post-type-bp-email .categorydiv label {
538
  }
539
 
540
  /*------------------------------------------------------------------------------
541
- * 5.0 Plugins page
 
 
 
 
 
 
 
542
  *----------------------------------------------------------------------------*/
543
  #buddypress-update.not-shiny .update-message {
544
  border-right: 0;
21
  3.1 Users List
22
  3.2 Site Notices
23
  4.0 Emails - Edit page
24
+ 5.0 Block Editor
25
+ 6.0 Plugins page
26
  ------------------------------------------------------------------------------*/
27
 
28
  /*------------------------------------------------------------------------------
539
  }
540
 
541
  /*------------------------------------------------------------------------------
542
+ * 5.0 Block Editor
543
+ *----------------------------------------------------------------------------*/
544
+ .block-editor-inserter__panel-header span.dashicons-buddicons-buddypress-logo {
545
+ color: #d84800;
546
+ }
547
+
548
+ /*------------------------------------------------------------------------------
549
+ * 6.0 Plugins page
550
  *----------------------------------------------------------------------------*/
551
  #buddypress-update.not-shiny .update-message {
552
  border-right: 0;
bp-core/admin/css/common-rtl.min.css CHANGED
@@ -1 +1 @@
1
- .bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons!important}.bp-badge:before{content:"\f448"}.index_page_bp-about code,.settings_page_bp-credits code{background-color:#e0e0e0;color:#636363;font-size:1em}.bp-about-wrap{position:relative;max-width:1050px;font-size:15px}.bp-about-wrap img{margin:0;max-width:100%;height:auto;vertical-align:middle}.bp-about-wrap p{line-height:1.5;font-size:14px}.bp-about-wrap h2{margin:40px 0 .6em;font-size:2.7em;line-height:1.3;font-weight:300;text-align:center}.bp-about-wrap h3{margin:1.25em 0 .6em;font-size:1.4em;line-height:1.5}.bp-about-wrap code{font-size:14px;font-weight:400}.bp-about-wrap .about-description{margin-top:1.4em;font-weight:400;line-height:1.6;font-size:19px}.bp-about-wrap h3.wp-people-group{margin:2.6em 0 1.33em;padding:0;font-size:16px;line-height:inherit}.bp-about-wrap .wp-people-group{padding:0 5px;margin:0 -5px 0 -15px}.bp-about-wrap .compact{margin-bottom:0}.bp-about-wrap .wp-person{display:inline-block;vertical-align:top;margin-left:10px;padding-bottom:15px;height:70px;width:280px}.bp-about-wrap .compact .wp-person{height:auto;width:180px;padding-bottom:0;margin-bottom:0}.bp-about-wrap .wp-person .gravatar{float:right;margin:0 0 10px 10px;padding:1px;width:60px;height:60px}.bp-about-wrap .compact .wp-person .gravatar{width:30px;height:30px}.bp-about-wrap .wp-person .web{margin:6px 0 2px;font-size:16px;font-weight:400;line-height:2;text-decoration:none}.bp-about-wrap .wp-person .title{display:block}.bp-about-wrap p.wp-credits-list a{white-space:nowrap}@media only screen and (max-width:500px){.bp-about-wrap{margin-left:20px;margin-right:10px}.bp-about-wrap .bp-about-wrap h1{margin-left:0}}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}.settings_page_bp-components td.plugin-title span{float:right;width:18px;height:18px;margin-left:5px}.settings_page_bp-components td.plugin-title span:before{font-family:dashicons;font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}.settings_page_bp-components tr.core td.plugin-title span:before{content:"\f448"}.settings_page_bp-components tr.members td.plugin-title span:before{content:"\f307"}.settings_page_bp-page-settings .button-secondary .dashicons{position:relative;top:3px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{width:25%}@media screen and (max-width:782px){.settings_page_bp-components td.plugin-title span{margin-top:5px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{display:block;width:auto}#bp-admin-component-form .subsubsub{margin-bottom:0;padding-bottom:35px}}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}body.tools-php .bp-tools dt{font-size:1.1em;color:#646970;font-weight:600;margin:1em 0 .5em 0}body.tools-php .bp-tools dd{margin:0}body.tools_page_bp-members-invitations .nav-tab-wrapper,body.tools_page_bp-optouts .nav-tab-wrapper{margin-bottom:1em}.bp-tooltip{position:relative}.bp-tooltip:after{background:#fff;border:1px solid #aaa;border-collapse:separate;border-radius:1px;box-shadow:-1px 1px 0 1px rgba(132,132,132,.3);color:#000;content:attr(data-bp-tooltip);display:none;font-family:sans-serif;font-size:11px;font-weight:400;letter-spacing:normal;line-height:1.5;margin-top:10px;max-width:240px;opacity:0;padding:3px 6px;position:absolute;left:50%;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;top:100%;transform:translateX(-50%);transition:opacity 2s ease-out;white-space:pre;word-wrap:break-word;z-index:998}.bp-hello-close .bp-tooltip:after{left:0;text-align:left;transform:translateX(0)}.bp-hello-social .bp-tooltip:after{bottom:120%;margin-bottom:20px;margin-top:0;top:auto;transform:translateX(-15%)}.bp-tooltip:active:after,.bp-tooltip:focus:after,.bp-tooltip:hover:after{display:inline-block;opacity:1;overflow:visible;text-decoration:none;z-index:999}body.site-users-php th#role,body.users-php th#role,body.users_page_bp-signups th#count_sent{width:10%}body.site-users-php th#email,body.site-users-php th#name,body.users-php th#email,body.users-php th#name,body.users-php th#registered,body.users_page_bp-signups th#date_sent,body.users_page_bp-signups th#email,body.users_page_bp-signups th#name,body.users_page_bp-signups th#registered{width:15%}body.users-php th#blogs,body.users_page_bp-signups th#blogs{width:20%}body.users_page_bp-signups td.count_sent,body.users_page_bp-signups th.column-count_sent{text-align:center}.bp-signups-list table{margin:1em 0}.bp-signups-list .column-fields{font-weight:700}.bp-new-notice-panel{background:#fff;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,.04);font-size:13px;line-height:2.1;margin:1.5em 0 3em;overflow:auto;padding:10px 25px 25px;position:relative}.bp-new-notice-panel label{clear:both;float:right;margin-left:3%;width:20%}.bp-new-notice-panel input,.bp-new-notice-panel textarea{clear:none;margin-bottom:1em;width:75%}.bp-new-notice-panel input[type=text]:after,.bp-new-notice-panel textarea:after{clear:both;content:" ";display:table}.bp-new-notice-panel .button-primary{margin-right:23%;width:auto}.bp-notice-about{font-size:1em;margin-bottom:1em}.bp-new-notice{margin-bottom:1em;margin-top:0}.bp-notices-list{margin-bottom:0}@media screen and (max-width:782px){.bp-new-notice-panel{margin-bottom:1.5em}.bp-new-notice-panel input,.bp-new-notice-panel textarea{margin-right:0;width:100%}.bp-new-notice-panel .button-primary{margin-right:0;width:auto}.bp-new-notice-panel .button{max-width:45%;word-wrap:break-word}.bp-notice-about{margin-top:0;margin-bottom:1em}.bp-new-notice{margin-bottom:.5em}}body.post-type-bp-email #excerpt{height:auto}body.post-type-bp-email th#situation{width:20%}body.post-type-bp-email td.column-situation ul{margin:0}body.post-type-bp-email .categorydiv label{display:block;float:right;padding-right:25px;text-indent:-25px}#buddypress-update.not-shiny .update-message{border-right:0;padding-right:36px}#buddypress-update.not-shiny .update-message:before{content:"\f534"}
1
+ .bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons!important}.bp-badge:before{content:"\f448"}.index_page_bp-about code,.settings_page_bp-credits code{background-color:#e0e0e0;color:#636363;font-size:1em}.bp-about-wrap{position:relative;max-width:1050px;font-size:15px}.bp-about-wrap img{margin:0;max-width:100%;height:auto;vertical-align:middle}.bp-about-wrap p{line-height:1.5;font-size:14px}.bp-about-wrap h2{margin:40px 0 .6em;font-size:2.7em;line-height:1.3;font-weight:300;text-align:center}.bp-about-wrap h3{margin:1.25em 0 .6em;font-size:1.4em;line-height:1.5}.bp-about-wrap code{font-size:14px;font-weight:400}.bp-about-wrap .about-description{margin-top:1.4em;font-weight:400;line-height:1.6;font-size:19px}.bp-about-wrap h3.wp-people-group{margin:2.6em 0 1.33em;padding:0;font-size:16px;line-height:inherit}.bp-about-wrap .wp-people-group{padding:0 5px;margin:0 -5px 0 -15px}.bp-about-wrap .compact{margin-bottom:0}.bp-about-wrap .wp-person{display:inline-block;vertical-align:top;margin-left:10px;padding-bottom:15px;height:70px;width:280px}.bp-about-wrap .compact .wp-person{height:auto;width:180px;padding-bottom:0;margin-bottom:0}.bp-about-wrap .wp-person .gravatar{float:right;margin:0 0 10px 10px;padding:1px;width:60px;height:60px}.bp-about-wrap .compact .wp-person .gravatar{width:30px;height:30px}.bp-about-wrap .wp-person .web{margin:6px 0 2px;font-size:16px;font-weight:400;line-height:2;text-decoration:none}.bp-about-wrap .wp-person .title{display:block}.bp-about-wrap p.wp-credits-list a{white-space:nowrap}@media only screen and (max-width:500px){.bp-about-wrap{margin-left:20px;margin-right:10px}.bp-about-wrap .bp-about-wrap h1{margin-left:0}}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}.settings_page_bp-components td.plugin-title span{float:right;width:18px;height:18px;margin-left:5px}.settings_page_bp-components td.plugin-title span:before{font-family:dashicons;font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}.settings_page_bp-components tr.core td.plugin-title span:before{content:"\f448"}.settings_page_bp-components tr.members td.plugin-title span:before{content:"\f307"}.settings_page_bp-page-settings .button-secondary .dashicons{position:relative;top:3px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{width:25%}@media screen and (max-width:782px){.settings_page_bp-components td.plugin-title span{margin-top:5px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{display:block;width:auto}#bp-admin-component-form .subsubsub{margin-bottom:0;padding-bottom:35px}}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}body.tools-php .bp-tools dt{font-size:1.1em;color:#646970;font-weight:600;margin:1em 0 .5em 0}body.tools-php .bp-tools dd{margin:0}body.tools_page_bp-members-invitations .nav-tab-wrapper,body.tools_page_bp-optouts .nav-tab-wrapper{margin-bottom:1em}.bp-tooltip{position:relative}.bp-tooltip:after{background:#fff;border:1px solid #aaa;border-collapse:separate;border-radius:1px;box-shadow:-1px 1px 0 1px rgba(132,132,132,.3);color:#000;content:attr(data-bp-tooltip);display:none;font-family:sans-serif;font-size:11px;font-weight:400;letter-spacing:normal;line-height:1.5;margin-top:10px;max-width:240px;opacity:0;padding:3px 6px;position:absolute;left:50%;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;top:100%;transform:translateX(-50%);transition:opacity 2s ease-out;white-space:pre;word-wrap:break-word;z-index:998}.bp-hello-close .bp-tooltip:after{left:0;text-align:left;transform:translateX(0)}.bp-hello-social .bp-tooltip:after{bottom:120%;margin-bottom:20px;margin-top:0;top:auto;transform:translateX(-15%)}.bp-tooltip:active:after,.bp-tooltip:focus:after,.bp-tooltip:hover:after{display:inline-block;opacity:1;overflow:visible;text-decoration:none;z-index:999}body.site-users-php th#role,body.users-php th#role,body.users_page_bp-signups th#count_sent{width:10%}body.site-users-php th#email,body.site-users-php th#name,body.users-php th#email,body.users-php th#name,body.users-php th#registered,body.users_page_bp-signups th#date_sent,body.users_page_bp-signups th#email,body.users_page_bp-signups th#name,body.users_page_bp-signups th#registered{width:15%}body.users-php th#blogs,body.users_page_bp-signups th#blogs{width:20%}body.users_page_bp-signups td.count_sent,body.users_page_bp-signups th.column-count_sent{text-align:center}.bp-signups-list table{margin:1em 0}.bp-signups-list .column-fields{font-weight:700}.bp-new-notice-panel{background:#fff;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,.04);font-size:13px;line-height:2.1;margin:1.5em 0 3em;overflow:auto;padding:10px 25px 25px;position:relative}.bp-new-notice-panel label{clear:both;float:right;margin-left:3%;width:20%}.bp-new-notice-panel input,.bp-new-notice-panel textarea{clear:none;margin-bottom:1em;width:75%}.bp-new-notice-panel input[type=text]:after,.bp-new-notice-panel textarea:after{clear:both;content:" ";display:table}.bp-new-notice-panel .button-primary{margin-right:23%;width:auto}.bp-notice-about{font-size:1em;margin-bottom:1em}.bp-new-notice{margin-bottom:1em;margin-top:0}.bp-notices-list{margin-bottom:0}@media screen and (max-width:782px){.bp-new-notice-panel{margin-bottom:1.5em}.bp-new-notice-panel input,.bp-new-notice-panel textarea{margin-right:0;width:100%}.bp-new-notice-panel .button-primary{margin-right:0;width:auto}.bp-new-notice-panel .button{max-width:45%;word-wrap:break-word}.bp-notice-about{margin-top:0;margin-bottom:1em}.bp-new-notice{margin-bottom:.5em}}body.post-type-bp-email #excerpt{height:auto}body.post-type-bp-email th#situation{width:20%}body.post-type-bp-email td.column-situation ul{margin:0}body.post-type-bp-email .categorydiv label{display:block;float:right;padding-right:25px;text-indent:-25px}.block-editor-inserter__panel-header span.dashicons-buddicons-buddypress-logo{color:#d84800}#buddypress-update.not-shiny .update-message{border-right:0;padding-right:36px}#buddypress-update.not-shiny .update-message:before{content:"\f534"}
bp-core/admin/css/common.css CHANGED
@@ -21,7 +21,8 @@ TABLE OF CONTENTS:
21
  3.1 Users List
22
  3.2 Site Notices
23
  4.0 Emails - Edit page
24
- 5.0 Plugins page
 
25
  ------------------------------------------------------------------------------*/
26
 
27
  /*------------------------------------------------------------------------------
@@ -538,7 +539,14 @@ body.post-type-bp-email .categorydiv label {
538
  }
539
 
540
  /*------------------------------------------------------------------------------
541
- * 5.0 Plugins page
 
 
 
 
 
 
 
542
  *----------------------------------------------------------------------------*/
543
  #buddypress-update.not-shiny .update-message {
544
  border-left: 0;
21
  3.1 Users List
22
  3.2 Site Notices
23
  4.0 Emails - Edit page
24
+ 5.0 Block Editor
25
+ 6.0 Plugins page
26
  ------------------------------------------------------------------------------*/
27
 
28
  /*------------------------------------------------------------------------------
539
  }
540
 
541
  /*------------------------------------------------------------------------------
542
+ * 5.0 Block Editor
543
+ *----------------------------------------------------------------------------*/
544
+ .block-editor-inserter__panel-header span.dashicons-buddicons-buddypress-logo {
545
+ color: #d84800;
546
+ }
547
+
548
+ /*------------------------------------------------------------------------------
549
+ * 6.0 Plugins page
550
  *----------------------------------------------------------------------------*/
551
  #buddypress-update.not-shiny .update-message {
552
  border-left: 0;
bp-core/admin/css/common.min.css CHANGED
@@ -1 +1 @@
1
- .bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons!important}.bp-badge:before{content:"\f448"}.index_page_bp-about code,.settings_page_bp-credits code{background-color:#e0e0e0;color:#636363;font-size:1em}.bp-about-wrap{position:relative;max-width:1050px;font-size:15px}.bp-about-wrap img{margin:0;max-width:100%;height:auto;vertical-align:middle}.bp-about-wrap p{line-height:1.5;font-size:14px}.bp-about-wrap h2{margin:40px 0 .6em;font-size:2.7em;line-height:1.3;font-weight:300;text-align:center}.bp-about-wrap h3{margin:1.25em 0 .6em;font-size:1.4em;line-height:1.5}.bp-about-wrap code{font-size:14px;font-weight:400}.bp-about-wrap .about-description{margin-top:1.4em;font-weight:400;line-height:1.6;font-size:19px}.bp-about-wrap h3.wp-people-group{margin:2.6em 0 1.33em;padding:0;font-size:16px;line-height:inherit}.bp-about-wrap .wp-people-group{padding:0 5px;margin:0 -15px 0 -5px}.bp-about-wrap .compact{margin-bottom:0}.bp-about-wrap .wp-person{display:inline-block;vertical-align:top;margin-right:10px;padding-bottom:15px;height:70px;width:280px}.bp-about-wrap .compact .wp-person{height:auto;width:180px;padding-bottom:0;margin-bottom:0}.bp-about-wrap .wp-person .gravatar{float:left;margin:0 10px 10px 0;padding:1px;width:60px;height:60px}.bp-about-wrap .compact .wp-person .gravatar{width:30px;height:30px}.bp-about-wrap .wp-person .web{margin:6px 0 2px;font-size:16px;font-weight:400;line-height:2;text-decoration:none}.bp-about-wrap .wp-person .title{display:block}.bp-about-wrap p.wp-credits-list a{white-space:nowrap}@media only screen and (max-width:500px){.bp-about-wrap{margin-right:20px;margin-left:10px}.bp-about-wrap .bp-about-wrap h1{margin-right:0}}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}.settings_page_bp-components td.plugin-title span{float:left;width:18px;height:18px;margin-right:5px}.settings_page_bp-components td.plugin-title span:before{font-family:dashicons;font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}.settings_page_bp-components tr.core td.plugin-title span:before{content:"\f448"}.settings_page_bp-components tr.members td.plugin-title span:before{content:"\f307"}.settings_page_bp-page-settings .button-secondary .dashicons{position:relative;top:3px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{width:25%}@media screen and (max-width:782px){.settings_page_bp-components td.plugin-title span{margin-top:5px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{display:block;width:auto}#bp-admin-component-form .subsubsub{margin-bottom:0;padding-bottom:35px}}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}body.tools-php .bp-tools dt{font-size:1.1em;color:#646970;font-weight:600;margin:1em 0 .5em 0}body.tools-php .bp-tools dd{margin:0}body.tools_page_bp-members-invitations .nav-tab-wrapper,body.tools_page_bp-optouts .nav-tab-wrapper{margin-bottom:1em}.bp-tooltip{position:relative}.bp-tooltip:after{background:#fff;border:1px solid #aaa;border-collapse:separate;border-radius:1px;box-shadow:1px 1px 0 1px rgba(132,132,132,.3);color:#000;content:attr(data-bp-tooltip);display:none;font-family:sans-serif;font-size:11px;font-weight:400;letter-spacing:normal;line-height:1.5;margin-top:10px;max-width:240px;opacity:0;padding:3px 6px;position:absolute;right:50%;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;top:100%;transform:translateX(50%);transition:opacity 2s ease-out;white-space:pre;word-wrap:break-word;z-index:998}.bp-hello-close .bp-tooltip:after{right:0;text-align:right;transform:translateX(0)}.bp-hello-social .bp-tooltip:after{bottom:120%;margin-bottom:20px;margin-top:0;top:auto;transform:translateX(15%)}.bp-tooltip:active:after,.bp-tooltip:focus:after,.bp-tooltip:hover:after{display:inline-block;opacity:1;overflow:visible;text-decoration:none;z-index:999}body.site-users-php th#role,body.users-php th#role,body.users_page_bp-signups th#count_sent{width:10%}body.site-users-php th#email,body.site-users-php th#name,body.users-php th#email,body.users-php th#name,body.users-php th#registered,body.users_page_bp-signups th#date_sent,body.users_page_bp-signups th#email,body.users_page_bp-signups th#name,body.users_page_bp-signups th#registered{width:15%}body.users-php th#blogs,body.users_page_bp-signups th#blogs{width:20%}body.users_page_bp-signups td.count_sent,body.users_page_bp-signups th.column-count_sent{text-align:center}.bp-signups-list table{margin:1em 0}.bp-signups-list .column-fields{font-weight:700}.bp-new-notice-panel{background:#fff;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,.04);font-size:13px;line-height:2.1;margin:1.5em 0 3em;overflow:auto;padding:10px 25px 25px;position:relative}.bp-new-notice-panel label{clear:both;float:left;margin-right:3%;width:20%}.bp-new-notice-panel input,.bp-new-notice-panel textarea{clear:none;margin-bottom:1em;width:75%}.bp-new-notice-panel input[type=text]:after,.bp-new-notice-panel textarea:after{clear:both;content:" ";display:table}.bp-new-notice-panel .button-primary{margin-left:23%;width:auto}.bp-notice-about{font-size:1em;margin-bottom:1em}.bp-new-notice{margin-bottom:1em;margin-top:0}.bp-notices-list{margin-bottom:0}@media screen and (max-width:782px){.bp-new-notice-panel{margin-bottom:1.5em}.bp-new-notice-panel input,.bp-new-notice-panel textarea{margin-left:0;width:100%}.bp-new-notice-panel .button-primary{margin-left:0;width:auto}.bp-new-notice-panel .button{max-width:45%;word-wrap:break-word}.bp-notice-about{margin-top:0;margin-bottom:1em}.bp-new-notice{margin-bottom:.5em}}body.post-type-bp-email #excerpt{height:auto}body.post-type-bp-email th#situation{width:20%}body.post-type-bp-email td.column-situation ul{margin:0}body.post-type-bp-email .categorydiv label{display:block;float:left;padding-left:25px;text-indent:-25px}#buddypress-update.not-shiny .update-message{border-left:0;padding-left:36px}#buddypress-update.not-shiny .update-message:before{content:"\f534"}
1
+ .bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons!important}.bp-badge:before{content:"\f448"}.index_page_bp-about code,.settings_page_bp-credits code{background-color:#e0e0e0;color:#636363;font-size:1em}.bp-about-wrap{position:relative;max-width:1050px;font-size:15px}.bp-about-wrap img{margin:0;max-width:100%;height:auto;vertical-align:middle}.bp-about-wrap p{line-height:1.5;font-size:14px}.bp-about-wrap h2{margin:40px 0 .6em;font-size:2.7em;line-height:1.3;font-weight:300;text-align:center}.bp-about-wrap h3{margin:1.25em 0 .6em;font-size:1.4em;line-height:1.5}.bp-about-wrap code{font-size:14px;font-weight:400}.bp-about-wrap .about-description{margin-top:1.4em;font-weight:400;line-height:1.6;font-size:19px}.bp-about-wrap h3.wp-people-group{margin:2.6em 0 1.33em;padding:0;font-size:16px;line-height:inherit}.bp-about-wrap .wp-people-group{padding:0 5px;margin:0 -15px 0 -5px}.bp-about-wrap .compact{margin-bottom:0}.bp-about-wrap .wp-person{display:inline-block;vertical-align:top;margin-right:10px;padding-bottom:15px;height:70px;width:280px}.bp-about-wrap .compact .wp-person{height:auto;width:180px;padding-bottom:0;margin-bottom:0}.bp-about-wrap .wp-person .gravatar{float:left;margin:0 10px 10px 0;padding:1px;width:60px;height:60px}.bp-about-wrap .compact .wp-person .gravatar{width:30px;height:30px}.bp-about-wrap .wp-person .web{margin:6px 0 2px;font-size:16px;font-weight:400;line-height:2;text-decoration:none}.bp-about-wrap .wp-person .title{display:block}.bp-about-wrap p.wp-credits-list a{white-space:nowrap}@media only screen and (max-width:500px){.bp-about-wrap{margin-right:20px;margin-left:10px}.bp-about-wrap .bp-about-wrap h1{margin-right:0}}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}.settings_page_bp-components td.plugin-title span{float:left;width:18px;height:18px;margin-right:5px}.settings_page_bp-components td.plugin-title span:before{font-family:dashicons;font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}.settings_page_bp-components tr.core td.plugin-title span:before{content:"\f448"}.settings_page_bp-components tr.members td.plugin-title span:before{content:"\f307"}.settings_page_bp-page-settings .button-secondary .dashicons{position:relative;top:3px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{width:25%}@media screen and (max-width:782px){.settings_page_bp-components td.plugin-title span{margin-top:5px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{display:block;width:auto}#bp-admin-component-form .subsubsub{margin-bottom:0;padding-bottom:35px}}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}body.tools-php .bp-tools dt{font-size:1.1em;color:#646970;font-weight:600;margin:1em 0 .5em 0}body.tools-php .bp-tools dd{margin:0}body.tools_page_bp-members-invitations .nav-tab-wrapper,body.tools_page_bp-optouts .nav-tab-wrapper{margin-bottom:1em}.bp-tooltip{position:relative}.bp-tooltip:after{background:#fff;border:1px solid #aaa;border-collapse:separate;border-radius:1px;box-shadow:1px 1px 0 1px rgba(132,132,132,.3);color:#000;content:attr(data-bp-tooltip);display:none;font-family:sans-serif;font-size:11px;font-weight:400;letter-spacing:normal;line-height:1.5;margin-top:10px;max-width:240px;opacity:0;padding:3px 6px;position:absolute;right:50%;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;top:100%;transform:translateX(50%);transition:opacity 2s ease-out;white-space:pre;word-wrap:break-word;z-index:998}.bp-hello-close .bp-tooltip:after{right:0;text-align:right;transform:translateX(0)}.bp-hello-social .bp-tooltip:after{bottom:120%;margin-bottom:20px;margin-top:0;top:auto;transform:translateX(15%)}.bp-tooltip:active:after,.bp-tooltip:focus:after,.bp-tooltip:hover:after{display:inline-block;opacity:1;overflow:visible;text-decoration:none;z-index:999}body.site-users-php th#role,body.users-php th#role,body.users_page_bp-signups th#count_sent{width:10%}body.site-users-php th#email,body.site-users-php th#name,body.users-php th#email,body.users-php th#name,body.users-php th#registered,body.users_page_bp-signups th#date_sent,body.users_page_bp-signups th#email,body.users_page_bp-signups th#name,body.users_page_bp-signups th#registered{width:15%}body.users-php th#blogs,body.users_page_bp-signups th#blogs{width:20%}body.users_page_bp-signups td.count_sent,body.users_page_bp-signups th.column-count_sent{text-align:center}.bp-signups-list table{margin:1em 0}.bp-signups-list .column-fields{font-weight:700}.bp-new-notice-panel{background:#fff;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,.04);font-size:13px;line-height:2.1;margin:1.5em 0 3em;overflow:auto;padding:10px 25px 25px;position:relative}.bp-new-notice-panel label{clear:both;float:left;margin-right:3%;width:20%}.bp-new-notice-panel input,.bp-new-notice-panel textarea{clear:none;margin-bottom:1em;width:75%}.bp-new-notice-panel input[type=text]:after,.bp-new-notice-panel textarea:after{clear:both;content:" ";display:table}.bp-new-notice-panel .button-primary{margin-left:23%;width:auto}.bp-notice-about{font-size:1em;margin-bottom:1em}.bp-new-notice{margin-bottom:1em;margin-top:0}.bp-notices-list{margin-bottom:0}@media screen and (max-width:782px){.bp-new-notice-panel{margin-bottom:1.5em}.bp-new-notice-panel input,.bp-new-notice-panel textarea{margin-left:0;width:100%}.bp-new-notice-panel .button-primary{margin-left:0;width:auto}.bp-new-notice-panel .button{max-width:45%;word-wrap:break-word}.bp-notice-about{margin-top:0;margin-bottom:1em}.bp-new-notice{margin-bottom:.5em}}body.post-type-bp-email #excerpt{height:auto}body.post-type-bp-email th#situation{width:20%}body.post-type-bp-email td.column-situation ul{margin:0}body.post-type-bp-email .categorydiv label{display:block;float:left;padding-left:25px;text-indent:-25px}.block-editor-inserter__panel-header span.dashicons-buddicons-buddypress-logo{color:#d84800}#buddypress-update.not-shiny .update-message{border-left:0;padding-left:36px}#buddypress-update.not-shiny .update-message:before{content:"\f534"}
bp-core/admin/css/hello-rtl.css CHANGED
@@ -70,7 +70,6 @@ TABLE OF CONTENTS:
70
  }
71
 
72
  div.dashicons {
73
- width: -webkit-fit-content;
74
  width: fit-content;
75
  }
76
 
70
  }
71
 
72
  div.dashicons {
 
73
  width: fit-content;
74
  }
75
 
bp-core/admin/css/hello-rtl.min.css CHANGED
@@ -1 +1 @@
1
- :root{--bp-hello-color-primary:#d34600;--bp-hello-color-secondary:#e5e5e5;--bp-hello-container-size:15%}.bp-hello-content p{font-size:16px}.bp-hello-content ol,.bp-hello-content ul{list-style:inherit}.bp-hello-content h3{font-size:1.1em;font-weight:500}.bp-hello-social li a:before{color:#23282d;font:400 30px/.6 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-image:none!important}.bp-hello-social li a:hover:before{transition:all .1s ease-in-out;color:var(--bp-hello-color-primary)}.bp-hello-social li a.support:before{content:"\f448"}.bp-hello-social li a.twitter:before{content:"\f301"}div.dashicons{width:-webkit-fit-content;width:fit-content}div.dashicons.big{font-size:128px;display:block;color:var(--bp-hello-color-primary);height:128px;width:128px}#plugin-information-footer{display:flex;flex-wrap:wrap;padding:0 16px;height:auto}#plugin-information-footer .dashicons-heart{color:#be3631}.bp-hello-social-cta,.bp-hello-social-links{flex-basis:50%}.bp-hello-social-links ul{display:inline-block}.bp-hello-social li{position:relative;bottom:-5px;display:inline-block;list-style-type:none;margin-bottom:0}.bp-hello-social li:last-child a{margin-right:4px}#bp-hello-container{display:none}.bp-hello-content{padding:0 25px;padding-bottom:20px}#dynamic-content{padding-bottom:40px;display:none}#dynamic-content.show{display:block}.plugin-details-modal #TB_title{height:0;background:0 0;border:none}#TB_window.plugin-details-modal.thickbox-loading:before{z-index:10;margin-top:40px;background-color:none}.bp-hello-aligncenter *{margin:10px auto}.bp-hello-alignleft{float:right}.bp-hello-alignleft:after{content:"";clear:right}.bp-hello-alignright{float:left}.bp-hello-alignright:after{content:"";clear:left}.bp-hello-divider{clear:both;border:none;margin-bottom:20px}.bp-hello-social-cta{text-align:right}.bp-hello-social-links{text-align:left}.bp-hello-social li a{text-decoration:none}#plugin-information-title.with-banner{background-image:url(https://ps.w.org/buddypress/assets/banner-772x250.png)}#plugin-information-title h1{font-size:1em;font-weight:600;padding:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#plugin-information-title.with-banner h1{position:relative;font-family:"Helvetica Neue",sans-serif;display:inline-block;font-size:20px;line-height:1.68;box-sizing:border-box;max-width:85%;padding:0 15px;margin-top:30px;color:#fff;background:rgba(30,30,30,.9);text-shadow:0 1px 3px rgba(0,0,0,.4);box-shadow:0 0 30px rgba(255,255,255,.1);border-radius:8px}.bp-hello-content{background-color:#fff}.bp-hello-content img{border-radius:2px;max-width:100%}.bp-hello-content iframe{width:100%}.bp-hello-content .bp-hello-alignleft img,.bp-hello-content .bp-hello-alignright img{max-width:200px}@media screen and (min-width:770px){#plugin-information-title.with-banner h1{font-size:30px;line-height:2;margin-top:174px;max-width:100%}}@media only screen and (min-width:1024px){.bp-hello-content{padding:0 30px 20px}.bp-hello-content p{font-size:14px}}@media only screen and (-webkit-min-device-pixel-ratio:1.5){#plugin-information-title.with-banner{background-image:url(https://ps.w.org/buddypress/assets/banner-1544x500.png)}}
1
+ :root{--bp-hello-color-primary:#d34600;--bp-hello-color-secondary:#e5e5e5;--bp-hello-container-size:15%}.bp-hello-content p{font-size:16px}.bp-hello-content ol,.bp-hello-content ul{list-style:inherit}.bp-hello-content h3{font-size:1.1em;font-weight:500}.bp-hello-social li a:before{color:#23282d;font:400 30px/.6 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-image:none!important}.bp-hello-social li a:hover:before{transition:all .1s ease-in-out;color:var(--bp-hello-color-primary)}.bp-hello-social li a.support:before{content:"\f448"}.bp-hello-social li a.twitter:before{content:"\f301"}div.dashicons{width:fit-content}div.dashicons.big{font-size:128px;display:block;color:var(--bp-hello-color-primary);height:128px;width:128px}#plugin-information-footer{display:flex;flex-wrap:wrap;padding:0 16px;height:auto}#plugin-information-footer .dashicons-heart{color:#be3631}.bp-hello-social-cta,.bp-hello-social-links{flex-basis:50%}.bp-hello-social-links ul{display:inline-block}.bp-hello-social li{position:relative;bottom:-5px;display:inline-block;list-style-type:none;margin-bottom:0}.bp-hello-social li:last-child a{margin-right:4px}#bp-hello-container{display:none}.bp-hello-content{padding:0 25px;padding-bottom:20px}#dynamic-content{padding-bottom:40px;display:none}#dynamic-content.show{display:block}.plugin-details-modal #TB_title{height:0;background:0 0;border:none}#TB_window.plugin-details-modal.thickbox-loading:before{z-index:10;margin-top:40px;background-color:none}.bp-hello-aligncenter *{margin:10px auto}.bp-hello-alignleft{float:right}.bp-hello-alignleft:after{content:"";clear:right}.bp-hello-alignright{float:left}.bp-hello-alignright:after{content:"";clear:left}.bp-hello-divider{clear:both;border:none;margin-bottom:20px}.bp-hello-social-cta{text-align:right}.bp-hello-social-links{text-align:left}.bp-hello-social li a{text-decoration:none}#plugin-information-title.with-banner{background-image:url(https://ps.w.org/buddypress/assets/banner-772x250.png)}#plugin-information-title h1{font-size:1em;font-weight:600;padding:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#plugin-information-title.with-banner h1{position:relative;font-family:"Helvetica Neue",sans-serif;display:inline-block;font-size:20px;line-height:1.68;box-sizing:border-box;max-width:85%;padding:0 15px;margin-top:30px;color:#fff;background:rgba(30,30,30,.9);text-shadow:0 1px 3px rgba(0,0,0,.4);box-shadow:0 0 30px rgba(255,255,255,.1);border-radius:8px}.bp-hello-content{background-color:#fff}.bp-hello-content img{border-radius:2px;max-width:100%}.bp-hello-content iframe{width:100%}.bp-hello-content .bp-hello-alignleft img,.bp-hello-content .bp-hello-alignright img{max-width:200px}@media screen and (min-width:770px){#plugin-information-title.with-banner h1{font-size:30px;line-height:2;margin-top:174px;max-width:100%}}@media only screen and (min-width:1024px){.bp-hello-content{padding:0 30px 20px}.bp-hello-content p{font-size:14px}}@media only screen and (-webkit-min-device-pixel-ratio:1.5){#plugin-information-title.with-banner{background-image:url(https://ps.w.org/buddypress/assets/banner-1544x500.png)}}
bp-core/admin/css/hello.css CHANGED
@@ -70,7 +70,6 @@ TABLE OF CONTENTS:
70
  }
71
 
72
  div.dashicons {
73
- width: -webkit-fit-content;
74
  width: fit-content;
75
  }
76
 
70
  }
71
 
72
  div.dashicons {
 
73
  width: fit-content;
74
  }
75
 
bp-core/admin/css/hello.min.css CHANGED
@@ -1 +1 @@
1
- :root{--bp-hello-color-primary:#d34600;--bp-hello-color-secondary:#e5e5e5;--bp-hello-container-size:15%}.bp-hello-content p{font-size:16px}.bp-hello-content ol,.bp-hello-content ul{list-style:inherit}.bp-hello-content h3{font-size:1.1em;font-weight:500}.bp-hello-social li a:before{color:#23282d;font:400 30px/.6 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-image:none!important}.bp-hello-social li a:hover:before{transition:all .1s ease-in-out;color:var(--bp-hello-color-primary)}.bp-hello-social li a.support:before{content:"\f448"}.bp-hello-social li a.twitter:before{content:"\f301"}div.dashicons{width:-webkit-fit-content;width:fit-content}div.dashicons.big{font-size:128px;display:block;color:var(--bp-hello-color-primary);height:128px;width:128px}#plugin-information-footer{display:flex;flex-wrap:wrap;padding:0 16px;height:auto}#plugin-information-footer .dashicons-heart{color:#be3631}.bp-hello-social-cta,.bp-hello-social-links{flex-basis:50%}.bp-hello-social-links ul{display:inline-block}.bp-hello-social li{position:relative;bottom:-5px;display:inline-block;list-style-type:none;margin-bottom:0}.bp-hello-social li:last-child a{margin-left:4px}#bp-hello-container{display:none}.bp-hello-content{padding:0 25px;padding-bottom:20px}#dynamic-content{padding-bottom:40px;display:none}#dynamic-content.show{display:block}.plugin-details-modal #TB_title{height:0;background:0 0;border:none}#TB_window.plugin-details-modal.thickbox-loading:before{z-index:10;margin-top:40px;background-color:none}.bp-hello-aligncenter *{margin:10px auto}.bp-hello-alignleft{float:left}.bp-hello-alignleft:after{content:"";clear:left}.bp-hello-alignright{float:right}.bp-hello-alignright:after{content:"";clear:right}.bp-hello-divider{clear:both;border:none;margin-bottom:20px}.bp-hello-social-cta{text-align:left}.bp-hello-social-links{text-align:right}.bp-hello-social li a{text-decoration:none}#plugin-information-title.with-banner{background-image:url(https://ps.w.org/buddypress/assets/banner-772x250.png)}#plugin-information-title h1{font-size:1em;font-weight:600;padding:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#plugin-information-title.with-banner h1{position:relative;font-family:"Helvetica Neue",sans-serif;display:inline-block;font-size:20px;line-height:1.68;box-sizing:border-box;max-width:85%;padding:0 15px;margin-top:30px;color:#fff;background:rgba(30,30,30,.9);text-shadow:0 1px 3px rgba(0,0,0,.4);box-shadow:0 0 30px rgba(255,255,255,.1);border-radius:8px}.bp-hello-content{background-color:#fff}.bp-hello-content img{border-radius:2px;max-width:100%}.bp-hello-content iframe{width:100%}.bp-hello-content .bp-hello-alignleft img,.bp-hello-content .bp-hello-alignright img{max-width:200px}@media screen and (min-width:770px){#plugin-information-title.with-banner h1{font-size:30px;line-height:2;margin-top:174px;max-width:100%}}@media only screen and (min-width:1024px){.bp-hello-content{padding:0 30px 20px}.bp-hello-content p{font-size:14px}}@media only screen and (-webkit-min-device-pixel-ratio:1.5){#plugin-information-title.with-banner{background-image:url(https://ps.w.org/buddypress/assets/banner-1544x500.png)}}
1
+ :root{--bp-hello-color-primary:#d34600;--bp-hello-color-secondary:#e5e5e5;--bp-hello-container-size:15%}.bp-hello-content p{font-size:16px}.bp-hello-content ol,.bp-hello-content ul{list-style:inherit}.bp-hello-content h3{font-size:1.1em;font-weight:500}.bp-hello-social li a:before{color:#23282d;font:400 30px/.6 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-image:none!important}.bp-hello-social li a:hover:before{transition:all .1s ease-in-out;color:var(--bp-hello-color-primary)}.bp-hello-social li a.support:before{content:"\f448"}.bp-hello-social li a.twitter:before{content:"\f301"}div.dashicons{width:fit-content}div.dashicons.big{font-size:128px;display:block;color:var(--bp-hello-color-primary);height:128px;width:128px}#plugin-information-footer{display:flex;flex-wrap:wrap;padding:0 16px;height:auto}#plugin-information-footer .dashicons-heart{color:#be3631}.bp-hello-social-cta,.bp-hello-social-links{flex-basis:50%}.bp-hello-social-links ul{display:inline-block}.bp-hello-social li{position:relative;bottom:-5px;display:inline-block;list-style-type:none;margin-bottom:0}.bp-hello-social li:last-child a{margin-left:4px}#bp-hello-container{display:none}.bp-hello-content{padding:0 25px;padding-bottom:20px}#dynamic-content{padding-bottom:40px;display:none}#dynamic-content.show{display:block}.plugin-details-modal #TB_title{height:0;background:0 0;border:none}#TB_window.plugin-details-modal.thickbox-loading:before{z-index:10;margin-top:40px;background-color:none}.bp-hello-aligncenter *{margin:10px auto}.bp-hello-alignleft{float:left}.bp-hello-alignleft:after{content:"";clear:left}.bp-hello-alignright{float:right}.bp-hello-alignright:after{content:"";clear:right}.bp-hello-divider{clear:both;border:none;margin-bottom:20px}.bp-hello-social-cta{text-align:left}.bp-hello-social-links{text-align:right}.bp-hello-social li a{text-decoration:none}#plugin-information-title.with-banner{background-image:url(https://ps.w.org/buddypress/assets/banner-772x250.png)}#plugin-information-title h1{font-size:1em;font-weight:600;padding:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#plugin-information-title.with-banner h1{position:relative;font-family:"Helvetica Neue",sans-serif;display:inline-block;font-size:20px;line-height:1.68;box-sizing:border-box;max-width:85%;padding:0 15px;margin-top:30px;color:#fff;background:rgba(30,30,30,.9);text-shadow:0 1px 3px rgba(0,0,0,.4);box-shadow:0 0 30px rgba(255,255,255,.1);border-radius:8px}.bp-hello-content{background-color:#fff}.bp-hello-content img{border-radius:2px;max-width:100%}.bp-hello-content iframe{width:100%}.bp-hello-content .bp-hello-alignleft img,.bp-hello-content .bp-hello-alignright img{max-width:200px}@media screen and (min-width:770px){#plugin-information-title.with-banner h1{font-size:30px;line-height:2;margin-top:174px;max-width:100%}}@media only screen and (min-width:1024px){.bp-hello-content{padding:0 30px 20px}.bp-hello-content p{font-size:14px}}@media only screen and (-webkit-min-device-pixel-ratio:1.5){#plugin-information-title.with-banner{background-image:url(https://ps.w.org/buddypress/assets/banner-1544x500.png)}}
bp-core/bp-core-blocks.php CHANGED
@@ -26,8 +26,15 @@ function bp_support_blocks() {
26
  * Registers the BP Block components.
27
  *
28
  * @since 6.0.0
 
 
29
  */
30
  function bp_register_block_components() {
 
 
 
 
 
31
  wp_register_script(
32
  'bp-block-components',
33
  plugins_url( 'js/block-components.js', __FILE__ ),
@@ -37,12 +44,56 @@ function bp_register_block_components() {
37
  'wp-i18n',
38
  'wp-api-fetch',
39
  'wp-url',
 
40
  ),
41
- bp_get_version()
 
 
 
 
 
 
 
 
 
 
42
  );
43
  }
44
  add_action( 'bp_blocks_init', 'bp_register_block_components', 1 );
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * Filters the Block Editor settings to gather BuddyPress ones into a `bp` key.
48
  *
@@ -82,6 +133,24 @@ function bp_block_init_editor_settings_filter() {
82
  }
83
  add_action( 'bp_init', 'bp_block_init_editor_settings_filter' );
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  /**
86
  * Register a BuddyPress block type.
87
  *
@@ -93,3 +162,238 @@ add_action( 'bp_init', 'bp_block_init_editor_settings_filter' );
93
  function bp_register_block( $args = array() ) {
94
  return new BP_Block( $args );
95
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  * Registers the BP Block components.
27
  *
28
  * @since 6.0.0
29
+ * @since 9.0.0 Adds a dependency to `wp-server-side-render` if WP >= 5.3.
30
+ * Uses a dependency to `wp-editor` otherwise.
31
  */
32
  function bp_register_block_components() {
33
+ $server_side_renderer_dep = 'wp-server-side-render';
34
+ if ( bp_is_running_wp( '5.3.0', '<' ) ) {
35
+ $server_side_renderer_dep = 'wp-editor';
36
+ }
37
+
38
  wp_register_script(
39
  'bp-block-components',
40
  plugins_url( 'js/block-components.js', __FILE__ ),
44
  'wp-i18n',
45
  'wp-api-fetch',
46
  'wp-url',
47
+ $server_side_renderer_dep,
48
  ),
49
+ bp_get_version(),
50
+ false
51
+ );
52
+
53
+ // Adds BP Block Components to the `bp` global.
54
+ wp_add_inline_script(
55
+ 'bp-block-components',
56
+ 'window.bp = window.bp || {};
57
+ bp.blockComponents = bpBlock.blockComponents;
58
+ delete bpBlock;',
59
+ 'after'
60
  );
61
  }
62
  add_action( 'bp_blocks_init', 'bp_register_block_components', 1 );
63
 
64
+ /**
65
+ * Registers the BP Block Assets.
66
+ *
67
+ * @since 9.0.0
68
+ */
69
+ function bp_register_block_assets() {
70
+ wp_register_script(
71
+ 'bp-block-data',
72
+ plugins_url( 'js/block-data.js', __FILE__ ),
73
+ array(
74
+ 'wp-data',
75
+ 'wp-api-fetch',
76
+ 'lodash',
77
+ ),
78
+ bp_get_version(),
79
+ false
80
+ );
81
+
82
+ // Adds BP Block Assets to the `bp` global.
83
+ wp_add_inline_script(
84
+ 'bp-block-data',
85
+ sprintf(
86
+ 'window.bp = window.bp || {};
87
+ bp.blockData = bpBlock.blockData;
88
+ bp.blockData.embedScriptURL = \'%s\';
89
+ delete bpBlock;',
90
+ esc_url_raw( includes_url( 'js/wp-embed.min.js' ) )
91
+ ),
92
+ 'after'
93
+ );
94
+ }
95
+ add_action( 'bp_blocks_init', 'bp_register_block_assets', 2 );
96
+
97
  /**
98
  * Filters the Block Editor settings to gather BuddyPress ones into a `bp` key.
99
  *
133
  }
134
  add_action( 'bp_init', 'bp_block_init_editor_settings_filter' );
135
 
136
+ /**
137
+ * Preload the Active BuddyPress Components.
138
+ *
139
+ * @since 9.0.0
140
+ *
141
+ * @param string[] $paths The Block Editors preload paths.
142
+ * @return string[] The Block Editors preload paths.
143
+ */
144
+ function bp_blocks_preload_paths( $paths = array() ) {
145
+ return array_merge(
146
+ $paths,
147
+ array(
148
+ '/buddypress/v1/components?status=active',
149
+ )
150
+ );
151
+ }
152
+ add_filter( 'block_editor_rest_api_preload_paths', 'bp_blocks_preload_paths' );
153
+
154
  /**
155
  * Register a BuddyPress block type.
156
  *
162
  function bp_register_block( $args = array() ) {
163
  return new BP_Block( $args );
164
  }
165
+
166
+ /**
167
+ * Gets a Widget Block list of classnames.
168
+ *
169
+ * @since 9.0.0
170
+ *
171
+ * @param string $block_name The Block name.
172
+ * @return array The list of widget classnames for the Block.
173
+ */
174
+ function bp_blocks_get_widget_block_classnames( $block_name = '' ) {
175
+ $components = bp_core_get_active_components( array(), 'objects' );
176
+ $components['core'] = buddypress()->core;
177
+ $classnames = array();
178
+
179
+ foreach ( $components as $component ) {
180
+ if ( isset( $component->block_globals[ $block_name ] ) ) {
181
+ $block_props = $component->block_globals[ $block_name ]->props;
182
+
183
+ if ( isset( $block_props['widget_classnames'] ) && $block_props['widget_classnames'] ) {
184
+ $classnames = (array) $block_props['widget_classnames'];
185
+ break;
186
+ }
187
+ }
188
+ }
189
+
190
+ return $classnames;
191
+ }
192
+
193
+ /**
194
+ * Make sure the BP Widget Block classnames are included into Widget Blocks.
195
+ *
196
+ * @since 9.0.0
197
+ *
198
+ * @param string $classname The classname to be used in the block widget's container HTML.
199
+ * @param string $block_name The name of the block.
200
+ * @return string The classname to be used in the block widget's container HTML.
201
+ */
202
+ function bp_widget_block_dynamic_classname( $classname, $block_name ) {
203
+ $bp_classnames = bp_blocks_get_widget_block_classnames( $block_name );
204
+
205
+ if ( $bp_classnames ) {
206
+ $bp_classnames = array_map( 'sanitize_html_class', $bp_classnames );
207
+ $classname .= ' ' . implode( ' ', $bp_classnames );
208
+ }
209
+
210
+ return $classname;
211
+ }
212
+ add_filter( 'widget_block_dynamic_classname', 'bp_widget_block_dynamic_classname', 10, 2 );
213
+
214
+ /**
215
+ * Create a link to the registration form for use on the bottom of the login form widget.
216
+ *
217
+ * @since 9.0.0
218
+ *
219
+ * @param string $content Content to display. Default empty.
220
+ * @param array $args Array of login form arguments.
221
+ * @return string HTML output.
222
+ */
223
+ function bp_blocks_get_login_widget_registration_link( $content = '', $args = array() ) {
224
+ if ( isset( $args['form_id'] ) && 'bp-login-widget-form' === $args['form_id'] && bp_get_signup_allowed() ) {
225
+ $content .= sprintf(
226
+ '<p class="bp-login-widget-register-link"><a href="%1$s">%2$s</a></p>',
227
+ esc_url( bp_get_signup_page() ),
228
+ esc_html__( 'Register', 'buddypress' )
229
+ );
230
+ }
231
+
232
+ $action_output = '';
233
+ if ( has_action( 'bp_login_widget_form' ) ) {
234
+ ob_start();
235
+ /**
236
+ * Fires inside the display of the login widget form.
237
+ *
238
+ * @since 2.4.0
239
+ */
240
+ do_action( 'bp_login_widget_form' );
241
+ $action_output = ob_get_clean();
242
+ }
243
+
244
+ if ( $action_output ) {
245
+ $content .= $action_output;
246
+ }
247
+
248
+ return $content;
249
+ }
250
+
251
+ /**
252
+ * Callback function to render the BP Login Form.
253
+ *
254
+ * @since 9.0.0
255
+ *
256
+ * @param array $attributes The block attributes.
257
+ * @return string HTML output.
258
+ */
259
+ function bp_block_render_login_form_block( $attributes = array() ) {
260
+ $block_args = wp_parse_args(
261
+ $attributes,
262
+ array(
263
+ 'title' => '',
264
+ )
265
+ );
266
+
267
+ $title = $block_args['title'];
268
+
269
+ $classnames = 'widget_bp_core_login_widget buddypress widget';
270
+ $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
271
+
272
+ $widget_content = '';
273
+
274
+ if ( $title ) {
275
+ $widget_content .= sprintf(
276
+ '<h2 class="widget-title">%s</h2>',
277
+ esc_html( $title )
278
+ );
279
+ }
280
+
281
+ if ( is_user_logged_in() ) {
282
+ $action_output = '';
283
+ if ( has_action( 'bp_before_login_widget_loggedin' ) ) {
284
+ ob_start();
285
+ /**
286
+ * Fires before the display of widget content if logged in.
287
+ *
288
+ * @since 1.9.0
289
+ */
290
+ do_action( 'bp_before_login_widget_loggedin' );
291
+ $action_output = ob_get_clean();
292
+ }
293
+
294
+ if ( $action_output ) {
295
+ $widget_content .= $action_output;
296
+ }
297
+
298
+ $widget_content .= sprintf(
299
+ '<div class="bp-login-widget-user-avatar">
300
+ <a href="%1$s">
301
+ %2$s
302
+ </a>
303
+ </div>',
304
+ bp_loggedin_user_domain(),
305
+ bp_get_loggedin_user_avatar(
306
+ array(
307
+ 'type' => 'thumb',
308
+ 'width' => 50,
309
+ 'height' => 50,
310
+ )
311
+ )
312
+ );
313
+
314
+ $widget_content .= sprintf(
315
+ '<div class="bp-login-widget-user-links">
316
+ <div class="bp-login-widget-user-link">%1$s</div>
317
+ <div class="bp-login-widget-user-logout"><a class="logout" href="%2$s">%3$s</a></div>
318
+ </div>',
319
+ bp_core_get_userlink( bp_loggedin_user_id() ),
320
+ wp_logout_url( bp_get_requested_url() ),
321
+ __( 'Log Out', 'buddypress' )
322
+ );
323
+
324
+ $action_output = '';
325
+ if ( has_action( 'bp_after_login_widget_loggedin' ) ) {
326
+ ob_start();
327
+ /**
328
+ * Fires after the display of widget content if logged in.
329
+ *
330
+ * @since 1.9.0
331
+ */
332
+ do_action( 'bp_after_login_widget_loggedin' );
333
+ $action_output = ob_get_clean();
334
+ }
335
+
336
+ if ( $action_output ) {
337
+ $widget_content .= $action_output;
338
+ }
339
+ } else {
340
+ $action_output = '';
341
+ if ( has_action( 'bp_before_login_widget_loggedout' ) ) {
342
+ ob_start();
343
+ /**
344
+ * Fires before the display of widget content if logged out.
345
+ *
346
+ * @since 1.9.0
347
+ */
348
+ do_action( 'bp_before_login_widget_loggedout' );
349
+ $action_output = ob_get_clean();
350
+ }
351
+
352
+ if ( $action_output ) {
353
+ $widget_content .= $action_output;
354
+ }
355
+
356
+ add_filter( 'login_form_bottom', 'bp_blocks_get_login_widget_registration_link', 10, 2 );
357
+
358
+ $widget_content .= wp_login_form(
359
+ array(
360
+ 'echo' => false,
361
+ 'form_id' => 'bp-login-widget-form',
362
+ 'id_username' => 'bp-login-widget-user-login',
363
+ 'label_username' => __( 'Username', 'buddypress' ),
364
+ 'id_password' => 'bp-login-widget-user-pass',
365
+ 'label_password' => __( 'Password', 'buddypress' ),
366
+ 'id_remember' => 'bp-login-widget-rememberme',
367
+ 'id_submit' => 'bp-login-widget-submit',
368
+ )
369
+ );
370
+
371
+ remove_filter( 'login_form_bottom', 'bp_blocks_get_login_widget_registration_link', 10, 2 );
372
+
373
+ $action_output = '';
374
+ if ( has_action( 'bp_after_login_widget_loggedout' ) ) {
375
+ ob_start();
376
+ /**
377
+ * Fires after the display of widget content if logged out.
378
+ *
379
+ * @since 1.9.0
380
+ */
381
+ do_action( 'bp_after_login_widget_loggedout' );
382
+ $action_output = ob_get_clean();
383
+ }
384
+
385
+ if ( $action_output ) {
386
+ $widget_content .= $action_output;
387
+ }
388
+ }
389
+
390
+ if ( ! did_action( 'dynamic_sidebar_before' ) ) {
391
+ return sprintf(
392
+ '<div %1$s>%2$s</div>',
393
+ $wrapper_attributes,
394
+ $widget_content
395
+ );
396
+ }
397
+
398
+ return $widget_content;
399
+ }
bp-core/bp-core-cssjs.php CHANGED
@@ -85,6 +85,9 @@ function bp_core_register_common_scripts() {
85
  // Version 2.7.
86
  'bp-moment' => array( 'file' => "{$url}vendor/moment-js/moment{$min}.js", 'dependencies' => array(), 'footer' => true ),
87
  'bp-livestamp' => array( 'file' => "{$url}vendor/livestamp{$min}.js", 'dependencies' => array( 'jquery', 'bp-moment' ), 'footer' => true ),
 
 
 
88
  );
89
 
90
  // Version 2.7 - Add Moment.js locale to our $scripts array if we found one.
85
  // Version 2.7.
86
  'bp-moment' => array( 'file' => "{$url}vendor/moment-js/moment{$min}.js", 'dependencies' => array(), 'footer' => true ),
87
  'bp-livestamp' => array( 'file' => "{$url}vendor/livestamp{$min}.js", 'dependencies' => array( 'jquery', 'bp-moment' ), 'footer' => true ),
88
+
89
+ // Version 9.0.
90
+ 'bp-dynamic-widget-block-script' => array( 'file' => "{$url}dynamic-widget-block.js", 'dependencies' => array( 'lodash', 'wp-url' ), 'footer' => true ),
91
  );
92
 
93
  // Version 2.7 - Add Moment.js locale to our $scripts array if we found one.
bp-core/bp-core-rest-api.php CHANGED
@@ -135,19 +135,23 @@ function bp_rest_version() {
135
  }
136
 
137
  /**
138
- * Get user URL.
139
  *
140
- * @since 5.0.0
141
  *
142
- * @param int $user_id User ID.
 
143
  * @return string
144
  */
145
- function bp_rest_get_user_url( $user_id ) {
146
- return sprintf(
147
- '/%s/%s/members/%d',
148
- bp_rest_namespace(),
149
- bp_rest_version(),
150
- $user_id
 
 
 
151
  );
152
  }
153
 
135
  }
136
 
137
  /**
138
+ * Get a REST API object URL from a component.
139
  *
140
+ * @since 9.0.0
141
  *
142
+ * @param integer $object_id Object ID.
143
+ * @param string $object_path Path of the component endpoint.
144
  * @return string
145
  */
146
+ function bp_rest_get_object_url( $object_id, $object_path ) {
147
+ return rest_url(
148
+ sprintf(
149
+ '/%1$s/%2$s/%3$s/%4$d',
150
+ bp_rest_namespace(),
151
+ bp_rest_version(),
152
+ $object_path,
153
+ $object_id
154
+ )
155
  );
156
  }
157
 
bp-core/bp-core-template-loader.php CHANGED
@@ -87,6 +87,63 @@ function bp_get_asset_template_part( $slug, $name = null, $args = array() ) {
87
  return bp_get_template_part( "assets/{$slug}", $name, $args );
88
  }
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  /**
91
  * Retrieve the name of the highest priority template file that exists.
92
  *
87
  return bp_get_template_part( "assets/{$slug}", $name, $args );
88
  }
89
 
90
+ /**
91
+ * Get a dynamic template part.
92
+ *
93
+ * @since 9.0.0
94
+ *
95
+ * @param string $template The Template Pack's relative path to the templata.
96
+ * Optional.
97
+ * @param string $type Whether to use the template for JavaScript or PHP.
98
+ * Optional. Defaults to `js`.
99
+ * @param array $tokens The data to use to customize the template. Optional.
100
+ * @param array $allowed_tags The allowed tags to use. Optional.
101
+ * @return string HTML/JS output.
102
+ */
103
+ function bp_get_dynamic_template_part( $template = '', $type = 'js', $tokens = array(), $allowed_tags = array() ) {
104
+ $template_string = '';
105
+
106
+ if ( ! $template ) {
107
+ return '';
108
+ }
109
+
110
+ // Use the BP Theme Compat API to allow template override.
111
+ $template_path = bp_locate_template( $template );
112
+ if ( $template_path ) {
113
+ $template_string = file_get_contents( $template_path );
114
+ }
115
+
116
+ if ( ! $template_string ) {
117
+ return '';
118
+ }
119
+
120
+ if ( ! $allowed_tags ) {
121
+ $allowed_tags = array(
122
+ 'li' => array( 'class' => true ),
123
+ 'div' => array( 'class' => true ),
124
+ 'span' => array( 'class' => true ),
125
+ 'a' => array(
126
+ 'href' => true,
127
+ 'class' => true,
128
+ 'data-bp-tooltip' => true,
129
+ ),
130
+ 'img' => array(
131
+ 'src' => true,
132
+ 'class' => true,
133
+ 'loading' => true,
134
+ ),
135
+ );
136
+ }
137
+
138
+ if ( 'js' !== $type ) {
139
+ $template_string = wp_kses( $template_string, $allowed_tags );
140
+
141
+ return bp_core_replace_tokens_in_text( $template_string, $tokens );
142
+ }
143
+
144
+ return $template_string;
145
+ }
146
+
147
  /**
148
  * Retrieve the name of the highest priority template file that exists.
149
  *
bp-core/bp-core-template.php CHANGED
@@ -3856,3 +3856,54 @@ function bp_email_the_salutation( $settings = array() ) {
3856
 
3857
  return $salutation;
3858
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3856
 
3857
  return $salutation;
3858
  }
3859
+
3860
+ /**
3861
+ * Checks if a Widget/Block is active.
3862
+ *
3863
+ * @since 9.0.0
3864
+ *
3865
+ * @param string $block_name The Block name to check (eg: 'bp/sitewide-notices'). Optional.
3866
+ * @param string $widget_id_base The Widget ID base to check (eg: 'bp_messages_sitewide_notices_widget' ). Optional.
3867
+ * @return boolean True if the Widget/Block is active. False otherwise.
3868
+ */
3869
+ function bp_is_widget_block_active( $block_name = '', $widget_id_base = '' ) {
3870
+ $is_active = array(
3871
+ 'widget' => false,
3872
+ 'block' => false,
3873
+ );
3874
+
3875
+ if ( $block_name && bp_is_running_wp( '5.0.0', '>=' ) ) {
3876
+ $widget_blocks = get_option( 'widget_block', array() );
3877
+ $sidebars = wp_get_sidebars_widgets();
3878
+
3879
+ if ( ! $widget_blocks || ! $sidebars ) {
3880
+ return false;
3881
+ }
3882
+
3883
+ // Neutralize inactive sidebar.
3884
+ unset( $sidebars['wp_inactive_widgets'] );
3885
+
3886
+ $widgets_content = '';
3887
+ foreach ( $widget_blocks as $key => $widget_block ) {
3888
+ $widget_block_reference = 'block-' . $key;
3889
+
3890
+ if ( ! isset( $widget_block['content'] ) || ! $widget_block['content'] ) {
3891
+ continue;
3892
+ }
3893
+
3894
+ foreach ( $sidebars as $sidebar ) {
3895
+ if ( is_array( $sidebar ) && in_array( $widget_block_reference, $sidebar, true ) ) {
3896
+ $widgets_content .= $widget_block['content'] . "\n";
3897
+ }
3898
+ }
3899
+ }
3900
+
3901
+ $is_active['block'] = has_block( $block_name, $widgets_content );
3902
+ }
3903
+
3904
+ if ( $widget_id_base ) {
3905
+ $is_active['widget'] = is_active_widget( false, false, $widget_id_base, true );
3906
+ }
3907
+
3908
+ return 0 !== count( array_filter( $is_active ) );
3909
+ }
bp-core/classes/class-bp-admin.php CHANGED
@@ -668,104 +668,56 @@ class BP_Admin {
668
  <div class="bp-hello-content">
669
  <div id="dynamic-content"></div>
670
  <div id="top-features">
671
- <h2><?php esc_html_e( 'Your current members are the best way to recruit fantastic new members for your community.', 'buddypress' ); ?></h2>
672
- <p>
673
- <?php esc_html_e( 'Whether public registration is enabled or not, you can activate this great new opt-in feature from your site\'s BuddyPress settings; with it, your trusted members will handpick new members who will enrich your community', 'buddypress' ); ?>
674
- </p>
675
  <figure class="bp-hello-aligncenter">
676
- <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/bp-members-invitations-invite-screen.png' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the Members Invite Screen.', 'buddypress' ); ?>" />
677
- </figure>
678
- <p><?php esc_html_e( 'Once activated, each member will be able to send new Member Invitation emails and manage the pending invitations directly from his or her profile area.', 'buddypress' ); ?>
679
- <figure class="bp-hello-aligncenter">
680
- <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/bp-members-invitations-manage-admin-screen.png' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the Members Invite Screen.', 'buddypress' ); ?>" />
681
  </figure>
682
  <p>
683
- <?php esc_html_e( 'You keep control of everything thanks to two new screens we added to the BuddyPress Tools dashboard: invitations and opt-outs management.', 'buddypress' ); ?>
684
- <?php printf(
685
- /* translators: %s is the placeholder for the link to the BP Members Invitations developer note. */
686
- esc_html__( 'Read more about the feature in this %s.', 'buddypress' ),
687
- sprintf(
688
- '<a href="%1$s">%2$s</a>',
689
- esc_url( 'https://bpdevel.wordpress.com/2021/05/26/bp-8-0-introduces-site-membership-invitations/' ),
690
- esc_html__( 'developer note', 'buddypress' )
691
- )
692
- ); ?>
693
  </p>
694
-
695
- <hr class="bp-hello-divider"/>
696
-
697
- <h2><?php esc_html_e( 'Improved registration experience.', 'buddypress' ); ?></h2>
698
  <p>
699
- <?php esc_html_e( 'First, you can select any xProfile field from any xProfile field group to use on your site\'s registration form.', 'buddypress' ); ?>
700
- <?php printf(
701
- /* translators: %s is the placeholder for the link to the Selectable Signup Fields developer note. */
702
- esc_html__( 'Learn more about it reading this %s.', 'buddypress' ),
703
- sprintf(
704
- '<a href="%1$s">%2$s</a>',
705
- esc_url( 'https://bpdevel.wordpress.com/2021/05/06/selectable-xprofile-sign-up-fields-in-8-0-0/' ),
706
- esc_html__( 'developer note', 'buddypress' )
707
- )
708
- ); ?>
709
  </p>
710
  <figure class="bp-hello-aligncenter">
711
- <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/bp-xprofile-admin-signup-fields.png' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the xProfile Administration Screen.', 'buddypress' ); ?>" />
712
  </figure>
713
  <p>
714
- <?php esc_html_e( 'Second, if your site requires that users accept specific rules such as terms of service or a code of conduct, you can now take advantage of the new Checkbox Acceptance xProfile Field type to record their agreement.', 'buddypress' ); ?>
715
- <?php printf(
716
- /* translators: %s is the placeholder for the link to the Checkbox Acceptance field type developer note. */
717
- esc_html__( 'This %s will teach you more about it.', 'buddypress' ),
718
- sprintf(
719
- '<a href="%1$s">%2$s</a>',
720
- esc_url( 'https://bpdevel.wordpress.com/2021/05/05/new-xprofile-field-type-checkbox-acceptance-will-be-introduced-in-buddypress-8-0-0/' ),
721
- esc_html__( 'developer note', 'buddypress' )
722
- )
723
- ); ?>
724
  </p>
 
 
 
 
 
 
 
 
 
725
  <figure class="bp-hello-aligncenter">
726
- <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/bp-xprofile-checkbox-acceptance-field-type.png' ); ?>" alt="<?php esc_attr_e( 'Illustration showing an example of Checkbox Acceptance xProfile field type display.', 'buddypress' ); ?>" />
727
  </figure>
728
  <p>
729
- <?php esc_html_e( 'Third, once a user activates his or her account, BuddyPress will send a welcome email to help get him or her engaged with your community.', 'buddypress' ); ?>
730
- <?php esc_html_e( 'You can customize the content of this email from the Emails menu of your WordPress dashboard.', 'buddypress' ); ?>
731
- <?php printf(
732
- /* translators: %s is the placeholder for the link to the Welcome Email developer note. */
733
- esc_html__( 'Have a look to this %s to find out more about it.', 'buddypress' ),
734
- sprintf(
735
- '<a href="%1$s">%2$s</a>',
736
- esc_url( 'https://bpdevel.wordpress.com/2021/05/24/8-0-0-will-include-a-bp-email-to-welcome-new-community-members/' ),
737
- esc_html__( 'developer note', 'buddypress' )
738
- )
739
- ); ?>
740
  </p>
741
 
742
  <hr class="bp-hello-divider"/>
743
 
744
- <h2><?php esc_html_e( 'WP xProfile field types.', 'buddypress' ); ?></h2>
745
  <p>
746
- <?php esc_html_e( 'Two new field types can now be used to include WordPress-specific information about the member in xProfile field loops without duplicating data.', 'buddypress' ); ?>
747
  </p>
748
- <figure class="bp-hello-aligncenter">
749
- <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/bp-xprofile-wp-field-type.png' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the xProfile Field Edit Screen.', 'buddypress' ); ?>" />
750
- </figure>
751
  <p>
752
- <?php esc_html_e( 'The WP Biography field type lets you include the user\'s Biographical Info and thanks to the WP Textbox field you can include the first & last name, the Website URL as well as any of the custom contact methods of your users.', 'buddypress' ); ?>
753
- <?php printf(
754
- /* translators: %s is the placeholder for the link to the WP xProfile Field Type developer note. */
755
- esc_html__( 'Read more about it in this %s.', 'buddypress' ),
756
- sprintf(
757
- '<a href="%1$s">%2$s</a>',
758
- esc_url( 'https://bpdevel.wordpress.com/2021/03/24/wordpress-xprofile-field-types/' ),
759
- esc_html__( 'developer note', 'buddypress' )
760
- )
761
- ); ?>
762
  </p>
763
 
764
  <hr class="bp-hello-divider"/>
765
 
766
  <h2><?php esc_html_e( 'Under the hood', 'buddypress' ); ?></h2>
767
  <p>
768
- <?php esc_html_e( '8.0.0 includes more than 45 changes to improve the Activity component, BP Nouveau Template pack, the BP REST API and many more components and features.', 'buddypress' ); ?>
769
  <?php esc_html_e( 'Click on the "Changelog" tab to discover them all!', 'buddypress' ); ?>
770
  </p>
771
  <figure class="bp-hello-aligncenter">
@@ -789,7 +741,15 @@ class BP_Admin {
789
  );
790
  ?>
791
  </p>
792
- <p><?php esc_html_e( 'Thank you for using BuddyPress! 😊', 'buddypress' ); ?></p>
 
 
 
 
 
 
 
 
793
 
794
  <br /><br />
795
  </div>
@@ -801,10 +761,10 @@ class BP_Admin {
801
  <?php
802
  printf(
803
  /* translators: 1: heart dashicons. 2: BP Credits screen url. 3: number of BuddyPress contributors to this version. */
804
- _n( 'Built with %1$s by <a href="%2$s">%3$d volunteer</a>.', 'Built with %1$s by <a href="%2$s">%3$d volunteers</a>.', 55, 'buddypress' ),
805
  '<span class="dashicons dashicons-heart"></span>',
806
  esc_url( bp_get_admin_url( 'admin.php?page=bp-credits' ) ),
807
- number_format_i18n( 47 )
808
  );
809
  ?>
810
  </p>
@@ -972,10 +932,6 @@ class BP_Admin {
972
  <a class="web" href="https://profiles.wordpress.org/sbrajesh/"><img alt="" class="gravatar" src="//gravatar.com/avatar/2106622ee90d53d15ac1402806616aca?s=120">
973
  Brajesh Singh</a>
974
  </li>
975
- <li class="wp-person" id="wp-person-oztaser">
976
- <a class="web" href="https://profiles.wordpress.org/oztaser/"><img alt="" class="gravatar" src="//gravatar.com/avatar/06eb4dd13c0113bf826968ae16a13e52?s=120">
977
- Adil Oztaser</a>
978
- </li>
979
  </ul>
980
 
981
  <h3 class="wp-people-group">
@@ -988,53 +944,30 @@ class BP_Admin {
988
  ?>
989
  </h3>
990
  <p class="wp-credits-list">
991
- <a href="https://profiles.wordpress.org/oztaser/">Adil Oztaser (oztaser)</a>,
992
- <a href="https://profiles.wordpress.org/chaion07/">Ahmed Chaion (chaion07)</a>,
993
- <a href="https://profiles.wordpress.org/dontdream/">Andrea Tarantini (dontdream)</a>,
994
  <a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
995
  <a href="https://profiles.wordpress.org/sbrajesh/">Brajesh Singh (sbrajesh)</a>,
996
- <a href="https://profiles.wordpress.org/thee17/">Charles E. Frees-Melvin (thee17)</a>,
997
- <a href="https://profiles.wordpress.org/needle/">Christian Wach (needle)</a>,
998
- <a href="https://profiles.wordpress.org/comminski/">comminski</a>,
999
- <a href="https://profiles.wordpress.org/dancaragea/">Dan Caragea (dancaragea)</a>,
1000
  <a href="https://profiles.wordpress.org/dcavins/">David Cavins (dcavins)</a>,
1001
- <a href="https://github.com/dominic-ks/">dominic-ks</a>,
1002
- <a href="https://github.com/edusperoni/">Eduardo Speroni (edusperoni)</a>,
1003
- <a href="https://profiles.wordpress.org/fernandot/">Fernando Tellado (fernandot)</a>,
1004
- <a href="https://profiles.wordpress.org/mociofiletto/">Giuseppe (mociofiletto)</a>,
1005
- <a href="https://profiles.wordpress.org/hz_i3/">hz_i3</a>,
1006
  <a href="https://profiles.wordpress.org/ianbarnes/">Ian Barnes (ianbarnes)</a>,
1007
- <a href="https://profiles.wordpress.org/atxamart/">Iker Garaialde (atxamart)</a>,
1008
  <a href="https://profiles.wordpress.org/nobnob/">Javier Esteban (nobnob)</a>,
1009
  <a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
1010
- <a href="https://profiles.wordpress.org/krupajnanda/">Krupa (krupajnanda)</a>,
1011
- <a href="https://profiles.wordpress.org/offereins/">Laurens Offereins</a>,
1012
- <a href="https://profiles.wordpress.org/mahdiar/">mahdiar</a>,
1013
  <a href="https://profiles.wordpress.org/markscottrobson/">Mark Robson (markscottrobson)</a>,
1014
  <a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
1015
- <a href="https://profiles.wordpress.org/mattneil/">mattneil</a>,
1016
- <a href="https://profiles.wordpress.org/meijioro/">meijioro</a>,
1017
- <a href="https://profiles.wordpress.org/kalich5/">Michal Janata (kalich5)</a>,
1018
  <a href="https://profiles.wordpress.org/modemlooper/">modemlooper</a>,
 
1019
  <a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
1020
- <a href="https://profiles.wordpress.org/podporawebu/">podporawebu</a>,
1021
- <a href="https://profiles.wordpress.org/psmits1567/">Peter Smits (psmits1567)</a>,
1022
  <a href="https://profiles.wordpress.org/nekojonez/">Pieterjan Deneys (nekojonez)</a>,
1023
  <a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
1024
  <a href="https://profiles.wordpress.org/espellcaste/">Renato Alves (espellcaste)</a>,
1025
- <a href="https://profiles.wordpress.org/renegade1/">renegade1</a>,
 
1026
  <a href="https://profiles.wordpress.org/slaffik/">Slava Abakumov (slaffik)</a>,
1027
- <a href="https://profiles.wordpress.org/sabernhardt/">Stephen Bernhardt (sabernhardt)</a>,
1028
  <a href="https://profiles.wordpress.org/netweb/">Stephen Edgar (netweb)</a>,
1029
- <a href="https://profiles.wordpress.org/studiocrafted/">studiocrafted</a>,
1030
- <a href="https://profiles.wordpress.org/sippis/">Timi Wahalahti (sippis)</a>,
1031
- <a href="https://profiles.wordpress.org/mobby2561/">Tomas (mobby2561)</a>,
1032
- <a href="https://profiles.wordpress.org/topher1kenobe/">Topher (topher1kenobe)</a>,
1033
- <a href="https://profiles.wordpress.org/utsav72640/">Utsav tilava (utsav72640)</a>,
1034
- <a href="https://profiles.wordpress.org/vapvarun/">Varun Dubey (vapvarun)</a>,
1035
- <a href="https://profiles.wordpress.org/venutius/">Venutius</a>,
1036
- <a href="https://profiles.wordpress.org/weddywood/">WeddyWood</a>,
1037
- <a href="https://profiles.wordpress.org/yordansoares/">Yordan Soares (yordansoares)</a>.
1038
  </p>
1039
 
1040
  <h3 class="wp-people-group"><?php esc_html_e( 'With our thanks to these Open Source projects', 'buddypress' ); ?></h3>
@@ -1054,7 +987,7 @@ class BP_Admin {
1054
  <h3 class="wp-people-group"><?php esc_html_e( 'Contributor Emeriti', 'buddypress' ); ?></h3>
1055
  <ul class="wp-people-group " id="wp-people-group-emeriti">
1056
  <li class="wp-person" id="wp-person-apeatling">
1057
- <a class="web" href="https://profiles.wordpress.org/johnjamesjacoby"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/bb29d699b5cba218c313b61aa82249da?s=120">
1058
  Andy Peatling</a>
1059
  <span class="title"><?php esc_html_e( 'Project Founder', 'buddypress' ); ?></span>
1060
  </li>
668
  <div class="bp-hello-content">
669
  <div id="dynamic-content"></div>
670
  <div id="top-features">
671
+ <h2><?php esc_html_e( 'It’s all about Widget Blocks!', 'buddypress' ); ?></h2>
 
 
 
672
  <figure class="bp-hello-aligncenter">
673
+ <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/latest-activities.jpg' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the Latest Activities Widget Block.', 'buddypress' ); ?>" />
 
 
 
 
674
  </figure>
675
  <p>
676
+ <?php esc_html_e( 'WordPress 5.8 is right around the corner and debuts a brand new way to manage widgets: the Widget Block Editor. With BuddyPress 9.0.0, we have introduced 10 new BuddyPress Blocks, so you can continue to use your favorite BP Widgets with the new WP Block approach.', 'buddypress' ); ?>
 
 
 
 
 
 
 
 
 
677
  </p>
 
 
 
 
678
  <p>
679
+ <?php esc_html_e( 'The new BP Widget Blocks are simply Legacy Widgets we’ve rebuilt as BP Blocks, which means you can also access them in the Block Editor for use in your posts or pages!', 'buddypress' ); ?>
 
 
 
 
 
 
 
 
 
680
  </p>
681
  <figure class="bp-hello-aligncenter">
682
+ <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/bp-widget-blocks.jpg' ); ?>" alt="<?php esc_attr_e( 'Illustration showing BP Blocks collection.', 'buddypress' ); ?>" />
683
  </figure>
684
  <p>
685
+ <em><?php esc_html_e( 'PS: Have you noticed that the icons for BuddyPress Blocks are now bright red?', 'buddypress' ); ?></em>
 
 
 
 
 
 
 
 
 
686
  </p>
687
+ <h3>
688
+ <?php
689
+ printf(
690
+ /* Translators: %s is a smiling face with sunglasses emoji. */
691
+ esc_html__( 'Convert a Legacy Widget into a Block Widget in two clicks %s', 'buddypress' ),
692
+ wp_staticize_emoji( '😎' )
693
+ );
694
+ ?>
695
+ </h3>
696
  <figure class="bp-hello-aligncenter">
697
+ <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/legacy-widget-to-block.jpg' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the Legacy Widget to Widget Block transformation.', 'buddypress' ); ?>" />
698
  </figure>
699
  <p>
700
+ <?php esc_html_e( 'As shown in the image above, it’s very easy to transform a Widget into a Block. Your existing Widget settings will automagically be imported into your shiny, new BP Block.', 'buddypress' ); ?>
701
+ </p>
702
+ <p>
703
+ <?php esc_html_e( 'NB: Creating a BP Block for each existing BP Legacy Widget marks the first step toward the progressive retirement of these tiny pieces of BuddyPress content.', 'buddypress' ); ?>
 
 
 
 
 
 
 
704
  </p>
705
 
706
  <hr class="bp-hello-divider"/>
707
 
708
+ <h2><?php esc_html_e( 'The BP REST API: Improved endpoints and a new one!', 'buddypress' ); ?></h2>
709
  <p>
710
+ <?php esc_html_e( 'This BuddyPress release was built in a short time frame to be ready for the release of WordPress 5.8.', 'buddypress' ); ?>
711
  </p>
 
 
 
712
  <p>
713
+ <?php esc_html_e( 'While doing the work on BP Widget Blocks, we’ve also manipulated many of our REST API endpoints and took this opportunity to improve several of them. We’re also introducing a new Sitewide Notices endpoint to allow site admins to create, edit, or delete notices and let all of your users fetch the active notice.', 'buddypress' ); ?>
 
 
 
 
 
 
 
 
 
714
  </p>
715
 
716
  <hr class="bp-hello-divider"/>
717
 
718
  <h2><?php esc_html_e( 'Under the hood', 'buddypress' ); ?></h2>
719
  <p>
720
+ <?php esc_html_e( '9.0.0 comes with fewer changes than most of our releases but includes fixes for issues which appeared in 8.0.0 and BP Nouveau Template Pack improvements.', 'buddypress' ); ?>
721
  <?php esc_html_e( 'Click on the "Changelog" tab to discover them all!', 'buddypress' ); ?>
722
  </p>
723
  <figure class="bp-hello-aligncenter">
741
  );
742
  ?>
743
  </p>
744
+ <p>
745
+ <?php
746
+ printf(
747
+ /* Translators: %s is a hugging face emoji. */
748
+ esc_html__( 'Thank you for using BuddyPress! %s', 'buddypress' ),
749
+ wp_staticize_emoji( '🤗' )
750
+ );
751
+ ?>
752
+ </p>
753
 
754
  <br /><br />
755
  </div>
761
  <?php
762
  printf(
763
  /* translators: 1: heart dashicons. 2: BP Credits screen url. 3: number of BuddyPress contributors to this version. */
764
+ _n( 'Built with %1$s by <a href="%2$s">%3$d volunteer</a>.', 'Built with %1$s by <a href="%2$s">%3$d volunteers</a>.', 24, 'buddypress' ),
765
  '<span class="dashicons dashicons-heart"></span>',
766
  esc_url( bp_get_admin_url( 'admin.php?page=bp-credits' ) ),
767
+ number_format_i18n( 24 )
768
  );
769
  ?>
770
  </p>
932
  <a class="web" href="https://profiles.wordpress.org/sbrajesh/"><img alt="" class="gravatar" src="//gravatar.com/avatar/2106622ee90d53d15ac1402806616aca?s=120">
933
  Brajesh Singh</a>
934
  </li>
 
 
 
 
935
  </ul>
936
 
937
  <h3 class="wp-people-group">
944
  ?>
945
  </h3>
946
  <p class="wp-credits-list">
 
 
 
947
  <a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
948
  <a href="https://profiles.wordpress.org/sbrajesh/">Brajesh Singh (sbrajesh)</a>,
 
 
 
 
949
  <a href="https://profiles.wordpress.org/dcavins/">David Cavins (dcavins)</a>,
950
+ <a href="https://profiles.wordpress.org/dancaragea/">Dan Caragea (dancaragea)</a>,
 
 
 
 
951
  <a href="https://profiles.wordpress.org/ianbarnes/">Ian Barnes (ianbarnes)</a>,
 
952
  <a href="https://profiles.wordpress.org/nobnob/">Javier Esteban (nobnob)</a>,
953
  <a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
954
+ <a href="https://profiles.wordpress.org/leahkoerper/">leahkoerper</a>,
955
+ <a href="https://profiles.wordpress.org/marbaque/">marbaque</a>,
 
956
  <a href="https://profiles.wordpress.org/markscottrobson/">Mark Robson (markscottrobson)</a>,
957
  <a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
 
 
 
958
  <a href="https://profiles.wordpress.org/modemlooper/">modemlooper</a>,
959
+ <a href="https://profiles.wordpress.org/niftythree/">Nifty (niftythree)</a>,
960
  <a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
 
 
961
  <a href="https://profiles.wordpress.org/nekojonez/">Pieterjan Deneys (nekojonez)</a>,
962
  <a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
963
  <a href="https://profiles.wordpress.org/espellcaste/">Renato Alves (espellcaste)</a>,
964
+ <a href="https://profiles.wordpress.org/shanebp">shanebp</a>,
965
+ <a href="https://profiles.wordpress.org/shawfactor/">shawfactor</a>,
966
  <a href="https://profiles.wordpress.org/slaffik/">Slava Abakumov (slaffik)</a>,
 
967
  <a href="https://profiles.wordpress.org/netweb/">Stephen Edgar (netweb)</a>,
968
+ <a href="https://profiles.wordpress.org/tamarazambrana/">tamarazambrana</a>,
969
+ <a href="https://github.com/tkserver">TKServer</a>,
970
+ <a href="https://profiles.wordpress.org/vapvarun/">Varun Dubey (vapvarun)</a>.
 
 
 
 
 
 
971
  </p>
972
 
973
  <h3 class="wp-people-group"><?php esc_html_e( 'With our thanks to these Open Source projects', 'buddypress' ); ?></h3>
987
  <h3 class="wp-people-group"><?php esc_html_e( 'Contributor Emeriti', 'buddypress' ); ?></h3>
988
  <ul class="wp-people-group " id="wp-people-group-emeriti">
989
  <li class="wp-person" id="wp-person-apeatling">
990
+ <a class="web" href="https://profiles.wordpress.org/apeatling/"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/bb29d699b5cba218c313b61aa82249da?s=120">
991
  Andy Peatling</a>
992
  <span class="title"><?php esc_html_e( 'Project Founder', 'buddypress' ); ?></span>
993
  </li>
bp-core/classes/class-bp-block.php CHANGED
@@ -47,7 +47,29 @@ class BP_Block {
47
  *
48
  * @since 6.0.0
49
  *
50
- * @param array $args The registration arguments for the BP Block.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  */
52
  public function __construct( $args ) {
53
  if ( ! did_action( 'bp_blocks_init' ) ) {
47
  *
48
  * @since 6.0.0
49
  *
50
+ * @param array $args {
51
+ * The registration arguments for the BP Block. Part of the arguments are the ones
52
+ * used by `WP_Block_Type`. Below are BP specific arguments.
53
+ *
54
+ * @type string $name The name of the block (eg: `bp/member`).
55
+ * @type string $editor_script_url URL to the JavaScript main file of the BP Block
56
+ * to load into the Block Editor.
57
+ * @type array $editor_script_deps The list of JavaScript dependency handles for the
58
+ * BP Block main file.
59
+ * @type string $script_url URL to the JavaScript file to load into the Block
60
+ * Editor and on front-end.
61
+ * @type array $script_deps The list of JavaScript dependency handles for the
62
+ * JavaScript file to load into the Block Editor and
63
+ * on front-end.
64
+ * @type string $editor_style_url URL to the CSS main file of the BP Block to load
65
+ * into the Block Editor.
66
+ * @type array $editor_style_deps The list of CSS dependency handles for the
67
+ * CSS main file.
68
+ * @type string $style_url URL to the CSS file to load into the Block Editor
69
+ * and on front-end.
70
+ * @type array $style_deps The list of CSS dependency handles for the CSS file
71
+ * to load into the Block Editor and on front-end.
72
+ * }
73
  */
74
  public function __construct( $args ) {
75
  if ( ! did_action( 'bp_blocks_init' ) ) {
bp-core/classes/class-bp-button.php CHANGED
@@ -324,6 +324,17 @@ class BP_Button {
324
  // Button properties.
325
  $button = '';
326
  if ( ! empty( $r['button_element'] ) ) {
 
 
 
 
 
 
 
 
 
 
 
327
  $button = new BP_Core_HTML_Element( array(
328
  'element' => $r['button_element'],
329
  'attr' => $r['button_attr'],
324
  // Button properties.
325
  $button = '';
326
  if ( ! empty( $r['button_element'] ) ) {
327
+ // Ensure the `href` attribute is not wrongly used inside buttons.
328
+ if ( 'button' === $r['button_element'] && ! empty( $r['button_attr']['href'] ) ) {
329
+ _doing_it_wrong(
330
+ __CLASS__,
331
+ __( 'The `href` attribute is not available inside the `&lt;button&gt;` tag. Please use a `data-*` attribute to transport a link into this tag.', 'buddypress' ),
332
+ '9.0.0'
333
+ );
334
+
335
+ unset( $r['button_attr']['href'] );
336
+ }
337
+
338
  $button = new BP_Core_HTML_Element( array(
339
  'element' => $r['button_element'],
340
  'attr' => $r['button_attr'],
bp-core/classes/class-bp-component.php CHANGED
@@ -140,6 +140,15 @@ class BP_Component {
140
  */
141
  public $search_query_arg = 's';
142
 
 
 
 
 
 
 
 
 
 
143
  /** Methods ***************************************************************/
144
 
145
  /**
@@ -205,7 +214,7 @@ class BP_Component {
205
  * Set up component global variables.
206
  *
207
  * @since 1.5.0
208
- *
209
  *
210
  * @param array $args {
211
  * All values are optional.
@@ -221,98 +230,124 @@ class BP_Component {
221
  * 'Search Groups...'.
222
  * @type array $global_tables Optional. An array of database table names.
223
  * @type array $meta_tables Optional. An array of metadata table names.
 
224
  * }
225
  */
226
  public function setup_globals( $args = array() ) {
227
-
228
- /** Slugs ************************************************************
229
- */
230
-
231
- // If a WP directory page exists for the component, it should
232
- // be the default value of 'root_slug'.
233
- $default_root_slug = isset( buddypress()->pages->{$this->id}->slug ) ? buddypress()->pages->{$this->id}->slug : '';
234
-
235
  $r = wp_parse_args( $args, array(
236
  'slug' => $this->id,
237
- 'root_slug' => $default_root_slug,
238
  'has_directory' => false,
239
  'directory_title' => '',
240
  'notification_callback' => '',
241
  'search_string' => '',
242
  'global_tables' => '',
243
  'meta_tables' => '',
 
244
  ) );
245
 
246
- /**
247
- * Filters the slug to be used for the permalink URI chunk after root.
248
- *
249
- * @since 1.5.0
250
- *
251
- * @param string $value Slug to use in permalink URI chunk.
252
  */
253
- $this->slug = apply_filters( 'bp_' . $this->id . '_slug', $r['slug'] );
254
 
255
- /**
256
- * Filters the slug used for root directory.
257
- *
258
- * @since 1.5.0
259
- *
260
- * @param string $value Root directory slug.
261
- */
262
- $this->root_slug = apply_filters( 'bp_' . $this->id . '_root_slug', $r['root_slug'] );
 
263
 
264
- /**
265
- * Filters the component's top-level directory if available.
266
- *
267
- * @since 1.5.0
268
- *
269
- * @param bool $value Whether or not there is a top-level directory.
270
- */
271
- $this->has_directory = apply_filters( 'bp_' . $this->id . '_has_directory', $r['has_directory'] );
272
 
273
- /**
274
- * Filters the component's directory title.
275
- *
276
- * @since 2.0.0
277
- *
278
- * @param string $value Title to use for the directory.
279
- */
280
- $this->directory_title = apply_filters( 'bp_' . $this->id . '_directory_title', $r['directory_title'] );
281
 
282
- /**
283
- * Filters the placeholder text for search inputs for component.
284
- *
285
- * @since 1.5.0
286
- *
287
- * @param string $value Name to use in search input placeholders.
288
- */
289
- $this->search_string = apply_filters( 'bp_' . $this->id . '_search_string', $r['search_string'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
 
291
  /**
292
- * Filters the callable function that formats the component's notifications.
293
  *
294
- * @since 1.5.0
295
  *
296
- * @param string $value Function callback.
 
297
  */
298
- $this->notification_callback = apply_filters( 'bp_' . $this->id . '_notification_callback', $r['notification_callback'] );
 
 
 
299
 
300
- // Set the global table names, if applicable.
301
- if ( ! empty( $r['global_tables'] ) ) {
302
- $this->register_global_tables( $r['global_tables'] );
303
- }
304
 
305
- // Set the metadata table, if applicable.
306
- if ( ! empty( $r['meta_tables'] ) ) {
307
- $this->register_meta_tables( $r['meta_tables'] );
308
  }
309
 
310
- /** BuddyPress *******************************************************
311
- */
312
-
313
- // Register this component in the loaded components array.
314
- buddypress()->loaded_components[$this->slug] = $this->id;
315
-
316
  /**
317
  * Fires at the end of the setup_globals method inside BP_Component.
318
  *
@@ -917,21 +952,24 @@ class BP_Component {
917
  *
918
  * @since 6.0.0
919
  *
 
 
920
  * @param array $blocks The list of BP Blocks to register.
921
  */
922
  public function blocks_init( $blocks = array() ) {
923
- if ( is_array( $blocks ) && $blocks ) {
924
- /**
925
- * Filter here to disable all or some BP Blocks for a component.
926
- *
927
- * This is a dynamic hook that is based on the component string ID.
928
- *
929
- * @since 6.0.0
930
- *
931
- * @param array $blocks The list of BP Blocks for the component.
932
- */
933
- $blocks = (array) apply_filters( 'bp_' . $this->id . '_register_blocks', $blocks );
934
 
 
935
  foreach ( $blocks as $block ) {
936
  bp_register_block( $block );
937
  }
140
  */
141
  public $search_query_arg = 's';
142
 
143
+ /**
144
+ * An array of globalized data for BP Blocks.
145
+ *
146
+ * @since 9.0.0
147
+ *
148
+ * @var array
149
+ */
150
+ public $block_globals = array();
151
+
152
  /** Methods ***************************************************************/
153
 
154
  /**
214
  * Set up component global variables.
215
  *
216
  * @since 1.5.0
217
+ * @since 9.0.0 Adds the `$block_globals` argument to the `$args` parameter.
218
  *
219
  * @param array $args {
220
  * All values are optional.
230
  * 'Search Groups...'.
231
  * @type array $global_tables Optional. An array of database table names.
232
  * @type array $meta_tables Optional. An array of metadata table names.
233
+ * @type array $block_globals Optional. An array of globalized data for BP Blocks.
234
  * }
235
  */
236
  public function setup_globals( $args = array() ) {
 
 
 
 
 
 
 
 
237
  $r = wp_parse_args( $args, array(
238
  'slug' => $this->id,
239
+ 'root_slug' => '',
240
  'has_directory' => false,
241
  'directory_title' => '',
242
  'notification_callback' => '',
243
  'search_string' => '',
244
  'global_tables' => '',
245
  'meta_tables' => '',
246
+ 'block_globals' => array(),
247
  ) );
248
 
249
+ /** Slugs ************************************************************
 
 
 
 
 
250
  */
 
251
 
252
+ // For all Components except Core.
253
+ if ( 'core' !== $this->id ) {
254
+ /**
255
+ * If a WP directory page exists for the component, it should
256
+ * be the default value of 'root_slug'.
257
+ */
258
+ if ( isset( buddypress()->pages->{$this->id}->slug ) ) {
259
+ $r['root_slug'] = buddypress()->pages->{$this->id}->slug;
260
+ }
261
 
262
+ /**
263
+ * Filters the slug to be used for the permalink URI chunk after root.
264
+ *
265
+ * @since 1.5.0
266
+ *
267
+ * @param string $value Slug to use in permalink URI chunk.
268
+ */
269
+ $this->slug = apply_filters( 'bp_' . $this->id . '_slug', $r['slug'] );
270
 
271
+ /**
272
+ * Filters the slug used for root directory.
273
+ *
274
+ * @since 1.5.0
275
+ *
276
+ * @param string $value Root directory slug.
277
+ */
278
+ $this->root_slug = apply_filters( 'bp_' . $this->id . '_root_slug', $r['root_slug'] );
279
 
280
+ /**
281
+ * Filters the component's top-level directory if available.
282
+ *
283
+ * @since 1.5.0
284
+ *
285
+ * @param bool $value Whether or not there is a top-level directory.
286
+ */
287
+ $this->has_directory = apply_filters( 'bp_' . $this->id . '_has_directory', $r['has_directory'] );
288
+
289
+ /**
290
+ * Filters the component's directory title.
291
+ *
292
+ * @since 2.0.0
293
+ *
294
+ * @param string $value Title to use for the directory.
295
+ */
296
+ $this->directory_title = apply_filters( 'bp_' . $this->id . '_directory_title', $r['directory_title'] );
297
+
298
+ /**
299
+ * Filters the placeholder text for search inputs for component.
300
+ *
301
+ * @since 1.5.0
302
+ *
303
+ * @param string $value Name to use in search input placeholders.
304
+ */
305
+ $this->search_string = apply_filters( 'bp_' . $this->id . '_search_string', $r['search_string'] );
306
+
307
+ /**
308
+ * Filters the callable function that formats the component's notifications.
309
+ *
310
+ * @since 1.5.0
311
+ *
312
+ * @param string $value Function callback.
313
+ */
314
+ $this->notification_callback = apply_filters( 'bp_' . $this->id . '_notification_callback', $r['notification_callback'] );
315
+
316
+ // Set the global table names, if applicable.
317
+ if ( ! empty( $r['global_tables'] ) ) {
318
+ $this->register_global_tables( $r['global_tables'] );
319
+ }
320
+
321
+ // Set the metadata table, if applicable.
322
+ if ( ! empty( $r['meta_tables'] ) ) {
323
+ $this->register_meta_tables( $r['meta_tables'] );
324
+ }
325
+
326
+ // Register this component in the loaded components array.
327
+ buddypress()->loaded_components[ $this->slug ] = $this->id;
328
+ }
329
 
330
  /**
331
+ * Filters the $blocks global value.
332
  *
333
+ * @since 9.0.0
334
  *
335
+ * @param array $blocks a list of global properties for blocks keyed
336
+ * by their corresponding block name.
337
  */
338
+ $block_globals = apply_filters( 'bp_' . $this->id . '_block_globals', $r['block_globals'] );
339
+ if ( is_array( $block_globals ) && array_filter( $block_globals ) ) {
340
+ foreach ( $block_globals as $block_name => $block_props ) {
341
+ $this->block_globals[ $block_name ] = new stdClass();
342
 
343
+ // Initialize an `items` property for Widget Block occurrences.
344
+ $this->block_globals[ $block_name ]->items = array();
 
 
345
 
346
+ // Set the global properties for the Block.
347
+ $this->block_globals[ $block_name ]->props = (array) $block_props;
348
+ }
349
  }
350
 
 
 
 
 
 
 
351
  /**
352
  * Fires at the end of the setup_globals method inside BP_Component.
353
  *
952
  *
953
  * @since 6.0.0
954
  *
955
+ * @see `BP_Block->construct()` for a full description of a BP Block arguments.
956
+ *
957
  * @param array $blocks The list of BP Blocks to register.
958
  */
959
  public function blocks_init( $blocks = array() ) {
960
+ /**
961
+ * Filter here to add new BP Blocks, disable some or all BP Blocks for a component.
962
+ *
963
+ * This is a dynamic hook that is based on the component string ID.
964
+ *
965
+ * @since 6.0.0
966
+ *
967
+ * @param array $blocks The list of BP Blocks for the component.
968
+ */
969
+ $blocks = (array) apply_filters( 'bp_' . $this->id . '_register_blocks', $blocks );
970
+ $blocks = array_filter( $blocks );
971
 
972
+ if ( $blocks ) {
973
  foreach ( $blocks as $block ) {
974
  bp_register_block( $block );
975
  }
bp-core/classes/class-bp-core-login-widget.php CHANGED
@@ -21,6 +21,7 @@ class BP_Core_Login_Widget extends WP_Widget {
21
  * Constructor method.
22
  *
23
  * @since 1.9.0
 
24
  */
25
  public function __construct() {
26
  parent::__construct(
@@ -30,6 +31,7 @@ class BP_Core_Login_Widget extends WP_Widget {
30
  'description' => __( 'Show a Log In form to logged-out visitors, and a Log Out link to those who are logged in.', 'buddypress' ),
31
  'classname' => 'widget_bp_core_login_widget buddypress widget',
32
  'customize_selective_refresh' => true,
 
33
  )
34
  );
35
  }
21
  * Constructor method.
22
  *
23
  * @since 1.9.0
24
+ * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options.
25
  */
26
  public function __construct() {
27
  parent::__construct(
31
  'description' => __( 'Show a Log In form to logged-out visitors, and a Log Out link to those who are logged in.', 'buddypress' ),
32
  'classname' => 'widget_bp_core_login_widget buddypress widget',
33
  'customize_selective_refresh' => true,
34
+ 'show_instance_in_rest' => true,
35
  )
36
  );
37
  }
bp-core/classes/class-bp-core.php CHANGED
@@ -289,14 +289,17 @@ class BP_Core extends BP_Component {
289
  bp_update_is_item_admin( bp_user_has_access(), 'core' );
290
 
291
  // Is the logged in user is a mod for the current item?
292
- bp_update_is_item_mod( false, 'core' );
293
 
294
- /**
295
- * Fires at the end of the setup of bp-core globals setting.
296
- *
297
- * @since 1.1.0
298
- */
299
- do_action( 'bp_core_setup_globals' );
 
 
 
300
  }
301
 
302
  /**
@@ -351,4 +354,57 @@ class BP_Core extends BP_Component {
351
 
352
  parent::register_post_types();
353
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  }
289
  bp_update_is_item_admin( bp_user_has_access(), 'core' );
290
 
291
  // Is the logged in user is a mod for the current item?
292
+ bp_update_is_item_mod( false, 'core' );
293
 
294
+ parent::setup_globals(
295
+ array(
296
+ 'block_globals' => array(
297
+ 'bp/login-form' => array(
298
+ 'widget_classnames' => array( 'widget_bp_core_login_widget', 'buddypress' ),
299
+ ),
300
+ ),
301
+ )
302
+ );
303
  }
304
 
305
  /**
354
 
355
  parent::register_post_types();
356
  }
357
+
358
+ /**
359
+ * Init the Core controllers of the BP REST API.
360
+ *
361
+ * @since 9.0.0
362
+ *
363
+ * @param array $controllers Optional. See BP_Component::rest_api_init() for
364
+ * description.
365
+ */
366
+ public function rest_api_init( $controllers = array() ) {
367
+ $controllers = array(
368
+ 'BP_REST_Components_Endpoint',
369
+ );
370
+
371
+ parent::rest_api_init( $controllers );
372
+ }
373
+
374
+ /**
375
+ * Register the BP Core Blocks.
376
+ *
377
+ * @since 9.0.0
378
+ *
379
+ * @param array $blocks Optional. See BP_Component::blocks_init() for
380
+ * description.
381
+ */
382
+ public function blocks_init( $blocks = array() ) {
383
+ parent::blocks_init(
384
+ array(
385
+ 'bp/login-form' => array(
386
+ 'name' => 'bp/login-form',
387
+ 'editor_script' => 'bp-login-form-block',
388
+ 'editor_script_url' => plugins_url( 'js/blocks/login-form.js', dirname( __FILE__ ) ),
389
+ 'editor_script_deps' => array(
390
+ 'wp-blocks',
391
+ 'wp-element',
392
+ 'wp-components',
393
+ 'wp-i18n',
394
+ 'wp-block-editor',
395
+ 'bp-block-components',
396
+ ),
397
+ 'style' => 'bp-login-form-block',
398
+ 'style_url' => plugins_url( 'css/blocks/login-form.css', dirname( __FILE__ ) ),
399
+ 'attributes' => array(
400
+ 'title' => array(
401
+ 'type' => 'string',
402
+ 'default' => '',
403
+ ),
404
+ ),
405
+ 'render_callback' => 'bp_block_render_login_form_block',
406
+ ),
407
+ )
408
+ );
409
+ }
410
  }
bp-core/classes/class-bp-rest-components-endpoint.php CHANGED
@@ -74,9 +74,9 @@ class BP_REST_Components_Endpoint extends WP_REST_Controller {
74
  */
75
  public function get_items( $request ) {
76
  $args = array(
77
- 'type' => $request['type'],
78
- 'status' => $request['status'],
79
- 'per_page' => $request['per_page'],
80
  );
81
 
82
  /**
@@ -167,7 +167,8 @@ class BP_REST_Components_Endpoint extends WP_REST_Controller {
167
  )
168
  );
169
 
170
- if ( bp_current_user_can( 'manage_options' ) ) {
 
171
  $retval = true;
172
  }
173
 
@@ -191,7 +192,7 @@ class BP_REST_Components_Endpoint extends WP_REST_Controller {
191
  * @return WP_REST_Response|WP_Error
192
  */
193
  public function update_item( $request ) {
194
- $component = $request['name'];
195
 
196
  if ( ! $this->component_exists( $component ) ) {
197
  return new WP_Error(
@@ -203,7 +204,7 @@ class BP_REST_Components_Endpoint extends WP_REST_Controller {
203
  );
204
  }
205
 
206
- if ( 'activate' === $request['action'] ) {
207
  if ( bp_is_active( $component ) ) {
208
  return new WP_Error(
209
  'bp_rest_component_already_active',
@@ -293,7 +294,7 @@ class BP_REST_Components_Endpoint extends WP_REST_Controller {
293
  * @return WP_REST_Response
294
  */
295
  public function prepare_item_for_response( $component, $request ) {
296
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
297
  $data = $this->add_additional_fields_to_object( $component, $request );
298
  $data = $this->filter_response_by_context( $data, $context );
299
  $response = rest_ensure_response( $data );
@@ -314,16 +315,34 @@ class BP_REST_Components_Endpoint extends WP_REST_Controller {
314
  * Verify Component Status.
315
  *
316
  * @since 5.0.0
 
317
  *
318
- * @param string $name Component name.
319
- * @return string
 
 
 
 
 
320
  */
321
- protected function verify_component_status( $name ) {
 
 
 
 
 
322
  if ( 'core' === $name || bp_is_active( $name ) ) {
323
- return __( 'active', 'buddypress' );
 
 
 
324
  }
325
 
326
- return __( 'inactive', 'buddypress' );
 
 
 
 
327
  }
328
 
329
  /**
@@ -383,6 +402,7 @@ class BP_REST_Components_Endpoint extends WP_REST_Controller {
383
  * Get component info helper.
384
  *
385
  * @since 5.0.0
 
386
  *
387
  * @param string $component Component id.
388
  * @return array
@@ -393,19 +413,85 @@ class BP_REST_Components_Endpoint extends WP_REST_Controller {
393
  $components = bp_core_get_components();
394
 
395
  // Get specific component info.
396
- $info = $components[ $component ];
397
 
398
  // Return empty early.
399
- if ( empty( $info ) ) {
400
  return array();
401
  }
402
 
403
- return array(
 
 
 
 
 
 
 
404
  'name' => $component,
405
- 'status' => $this->verify_component_status( $component ),
406
- 'title' => $info['title'],
407
- 'description' => $info['description'],
 
 
408
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  }
410
 
411
  /**
@@ -439,11 +525,21 @@ class BP_REST_Components_Endpoint extends WP_REST_Controller {
439
  'description' => __( 'Name of the object.', 'buddypress' ),
440
  'type' => 'string',
441
  ),
 
 
 
 
 
 
442
  'status' => array(
443
  'context' => array( 'view', 'edit' ),
444
  'description' => __( 'Whether the object is active or inactive.', 'buddypress' ),
445
  'type' => 'string',
446
- 'enum' => array( 'active', 'inactive' ),
 
 
 
 
447
  ),
448
  'title' => array(
449
  'context' => array( 'view', 'edit' ),
@@ -455,6 +551,12 @@ class BP_REST_Components_Endpoint extends WP_REST_Controller {
455
  'description' => __( 'HTML description of the object.', 'buddypress' ),
456
  'type' => 'string',
457
  ),
 
 
 
 
 
 
458
  ),
459
  );
460
  }
74
  */
75
  public function get_items( $request ) {
76
  $args = array(
77
+ 'type' => $request->get_param( 'type' ),
78
+ 'status' => $request->get_param( 'status' ),
79
+ 'per_page' => $request->get_param( 'per_page' ),
80
  );
81
 
82
  /**
167
  )
168
  );
169
 
170
+ // The `get_items` endpoint can be used by BP Blocks to check whether some component's features are active or not.
171
+ if ( bp_current_user_can( 'manage_options' ) || ( 'active' === $request->get_param( 'status' ) && current_user_can( 'publish_posts' ) ) ) {
172
  $retval = true;
173
  }
174
 
192
  * @return WP_REST_Response|WP_Error
193
  */
194
  public function update_item( $request ) {
195
+ $component = $request->get_param( 'name' );
196
 
197
  if ( ! $this->component_exists( $component ) ) {
198
  return new WP_Error(
204
  );
205
  }
206
 
207
+ if ( 'activate' === $request->get_param( 'action' ) ) {
208
  if ( bp_is_active( $component ) ) {
209
  return new WP_Error(
210
  'bp_rest_component_already_active',
294
  * @return WP_REST_Response
295
  */
296
  public function prepare_item_for_response( $component, $request ) {
297
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
298
  $data = $this->add_additional_fields_to_object( $component, $request );
299
  $data = $this->filter_response_by_context( $data, $context );
300
  $response = rest_ensure_response( $data );
315
  * Verify Component Status.
316
  *
317
  * @since 5.0.0
318
+ * @since 9.0.0 Adds the `$return_type` parameter.
319
  *
320
+ * @param string $name Component name.
321
+ * @param string $return_type Use `string` to get the l10n string. Default.
322
+ * Use `bool` to get whether the component is active or not.
323
+ * Use `array` to get both information.
324
+ * @return string|bool|array By default a l10n string is returned.
325
+ * True if the component is active, false otherwise when 'bool' is requested.
326
+ * An array containing both information when 'array' is requested.
327
  */
328
+ protected function verify_component_status( $name, $return_type = 'string' ) {
329
+ $retval = array(
330
+ 'string' => __( 'inactive', 'buddypress' ),
331
+ 'bool' => false,
332
+ );
333
+
334
  if ( 'core' === $name || bp_is_active( $name ) ) {
335
+ $retval = array(
336
+ 'string' => __( 'active', 'buddypress' ),
337
+ 'bool' => true,
338
+ );
339
  }
340
 
341
+ if ( isset( $retval[ $return_type ] ) ) {
342
+ return $retval[ $return_type ];
343
+ }
344
+
345
+ return $retval;
346
  }
347
 
348
  /**
402
  * Get component info helper.
403
  *
404
  * @since 5.0.0
405
+ * @since 9.0.0 Adds a `features` property to component's info.
406
  *
407
  * @param string $component Component id.
408
  * @return array
413
  $components = bp_core_get_components();
414
 
415
  // Get specific component info.
416
+ $data = $components[ $component ];
417
 
418
  // Return empty early.
419
+ if ( empty( $data ) ) {
420
  return array();
421
  }
422
 
423
+ // Get BuddyPress main instance.
424
+ $bp = buddypress();
425
+
426
+ // Get status data.
427
+ $status = $this->verify_component_status( $component, 'array' );
428
+
429
+ // Set component's basic information.
430
+ $info = array(
431
  'name' => $component,
432
+ 'status' => $status['string'],
433
+ 'is_active' => $status['bool'],
434
+ 'title' => $data['title'],
435
+ 'description' => $data['description'],
436
+ 'features' => array(),
437
  );
438
+
439
+ // Set component's features.
440
+ if ( $status['bool'] ) {
441
+ // @todo check the features list is exhaustive.
442
+ switch ( $component ) {
443
+ case 'groups':
444
+ $features = array(
445
+ 'avatar' => $bp->avatar && $bp->avatar->show_avatars && ! bp_disable_group_avatar_uploads(),
446
+ 'cover' => bp_is_active( 'groups', 'cover_image' ),
447
+ 'group_creation' => bp_restrict_group_creation() ? 'adminsonly' : 'members',
448
+ );
449
+ break;
450
+ case 'members':
451
+ $features = array(
452
+ 'account_deletion' => ! bp_disable_account_deletion(),
453
+ 'avatar' => $bp->avatar && $bp->avatar->show_avatars,
454
+ 'cover' => bp_is_active( 'members', 'cover_image' ),
455
+ 'invitations' => bp_get_members_invitations_allowed(),
456
+ );
457
+ break;
458
+ case 'activity':
459
+ $features = array(
460
+ 'auto_refresh' => bp_is_activity_heartbeat_active(),
461
+ 'embeds' => bp_is_active( 'activity', 'embeds' ),
462
+ 'favorite' => bp_activity_can_favorite(),
463
+ 'mentions' => bp_activity_do_mentions(),
464
+ 'types' => bp_activity_get_types_list(),
465
+ );
466
+ break;
467
+ case 'blogs':
468
+ $features = array(
469
+ 'site_icon' => bp_is_active( 'blogs', 'site-icon' ),
470
+ );
471
+ break;
472
+ case 'messages':
473
+ $features = array(
474
+ 'star' => bp_is_active( 'messages', 'star' ),
475
+ );
476
+ break;
477
+ default:
478
+ $features = array();
479
+ break;
480
+ }
481
+
482
+ /**
483
+ * Filter here to edit component's features.
484
+ *
485
+ * The dynamic portion of the filter is filled with the component's ID.
486
+ *
487
+ * @since 9.0.0
488
+ *
489
+ * @param array $features The component's features.
490
+ */
491
+ $info['features'] = apply_filters( 'bp_rest_' . $component . '_component_features', $features );
492
+ }
493
+
494
+ return $info;
495
  }
496
 
497
  /**
525
  'description' => __( 'Name of the object.', 'buddypress' ),
526
  'type' => 'string',
527
  ),
528
+ 'is_active' => array(
529
+ 'context' => array( 'view', 'edit' ),
530
+ 'description' => __( 'Whether the component is active or not.', 'buddypress' ),
531
+ 'type' => 'boolean',
532
+ 'default' => false,
533
+ ),
534
  'status' => array(
535
  'context' => array( 'view', 'edit' ),
536
  'description' => __( 'Whether the object is active or inactive.', 'buddypress' ),
537
  'type' => 'string',
538
+ // We need to use what returns `$this->verify_component_status()` by default here.
539
+ 'enum' => array(
540
+ __( 'active', 'buddypress' ),
541
+ __( 'inactive', 'buddypress' ),
542
+ ),
543
  ),
544
  'title' => array(
545
  'context' => array( 'view', 'edit' ),
551
  'description' => __( 'HTML description of the object.', 'buddypress' ),
552
  'type' => 'string',
553
  ),
554
+ 'features' => array(
555
+ 'description' => __( 'Information about active features for the component.', 'buddypress' ),
556
+ 'type' => 'array',
557
+ 'context' => array( 'view', 'edit' ),
558
+ 'default' => array(),
559
+ ),
560
  ),
561
  );
562
  }
bp-core/classes/class-bp-theme-compat.php CHANGED
@@ -117,4 +117,16 @@ class BP_Theme_Compat {
117
  public function __get( $property ) {
118
  return array_key_exists( $property, $this->_data ) ? $this->_data[$property] : '';
119
  }
 
 
 
 
 
 
 
 
 
 
 
 
120
  }
117
  public function __get( $property ) {
118
  return array_key_exists( $property, $this->_data ) ? $this->_data[$property] : '';
119
  }
120
+
121
+ /**
122
+ * Check a theme's property exists.
123
+ *
124
+ * @since 9.0.0
125
+ *
126
+ * @param string $property Property name.
127
+ * @return bool True if the property exists. False otherwise.
128
+ */
129
+ public function __isset( $property ) {
130
+ return array_key_exists( $property, $this->_data );
131
+ }
132
  }
bp-core/css/blocks/login-form-rtl.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .widget_bp_core_login_widget .bp-login-widget-user-avatar {
2
+ float: right;
3
+ }
4
+
5
+ .widget_bp_core_login_widget .bp-login-widget-user-links {
6
+ margin-right: 70px;
7
+ }
8
+
9
+ #bp-login-widget-form label {
10
+ display: block;
11
+ font-weight: 600;
12
+ margin: 15px 0 5px;
13
+ width: auto;
14
+ }
15
+
16
+ #bp-login-widget-form input[type="text"],
17
+ #bp-login-widget-form input[type="password"] {
18
+ width: 100%;
19
+ background-color: #fafafa;
20
+ border: 1px solid #d6d6d6;
21
+ border-radius: 0;
22
+ font: inherit;
23
+ font-size: 100%;
24
+ padding: 0.5em;
25
+ }
26
+
27
+ #bp-login-widget-form .login-submit,
28
+ #bp-login-widget-form .bp-login-widget-register-link {
29
+ width: fit-content;
30
+ display: inline;
31
+ }
32
+
33
+ #bp-login-widget-form .bp-login-widget-register-link {
34
+ margin-right: 1em;
35
+ vertical-align: super;
36
+ }
bp-core/css/blocks/login-form-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .widget_bp_core_login_widget .bp-login-widget-user-avatar{float:right}.widget_bp_core_login_widget .bp-login-widget-user-links{margin-right:70px}#bp-login-widget-form label{display:block;font-weight:600;margin:15px 0 5px;width:auto}#bp-login-widget-form input[type=password],#bp-login-widget-form input[type=text]{width:100%;background-color:#fafafa;border:1px solid #d6d6d6;border-radius:0;font:inherit;font-size:100%;padding:.5em}#bp-login-widget-form .bp-login-widget-register-link,#bp-login-widget-form .login-submit{width:fit-content;display:inline}#bp-login-widget-form .bp-login-widget-register-link{margin-right:1em;vertical-align:super}
bp-core/css/blocks/login-form.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .widget_bp_core_login_widget .bp-login-widget-user-avatar {
2
+ float: left;
3
+ }
4
+
5
+ .widget_bp_core_login_widget .bp-login-widget-user-links {
6
+ margin-left: 70px;
7
+ }
8
+
9
+ #bp-login-widget-form label {
10
+ display: block;
11
+ font-weight: 600;
12
+ margin: 15px 0 5px;
13
+ width: auto;
14
+ }
15
+
16
+ #bp-login-widget-form input[type="text"],
17
+ #bp-login-widget-form input[type="password"] {
18
+ width: 100%;
19
+ background-color: #fafafa;
20
+ border: 1px solid #d6d6d6;
21
+ border-radius: 0;
22
+ font: inherit;
23
+ font-size: 100%;
24
+ padding: 0.5em;
25
+ }
26
+
27
+ #bp-login-widget-form .login-submit,
28
+ #bp-login-widget-form .bp-login-widget-register-link {
29
+ width: fit-content;
30
+ display: inline;
31
+ }
32
+
33
+ #bp-login-widget-form .bp-login-widget-register-link {
34
+ margin-left: 1em;
35
+ vertical-align: super;
36
+ }
bp-core/css/blocks/login-form.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .widget_bp_core_login_widget .bp-login-widget-user-avatar{float:left}.widget_bp_core_login_widget .bp-login-widget-user-links{margin-left:70px}#bp-login-widget-form label{display:block;font-weight:600;margin:15px 0 5px;width:auto}#bp-login-widget-form input[type=password],#bp-login-widget-form input[type=text]{width:100%;background-color:#fafafa;border:1px solid #d6d6d6;border-radius:0;font:inherit;font-size:100%;padding:.5em}#bp-login-widget-form .bp-login-widget-register-link,#bp-login-widget-form .login-submit{width:fit-content;display:inline}#bp-login-widget-form .bp-login-widget-register-link{margin-left:1em;vertical-align:super}
bp-core/deprecated/9.0.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Deprecated functions.
4
+ *
5
+ * @package BuddyPress
6
+ * @deprecated 9.0.0
7
+ */
8
+
9
+ // Exit if accessed directly.
10
+ defined( 'ABSPATH' ) || exit;
11
+
12
+ /**
13
+ * Get user URL.
14
+ *
15
+ * @since 5.0.0
16
+ * @deprecated 9.0.0
17
+ *
18
+ * @param int $user_id User ID.
19
+ * @return string
20
+ */
21
+ function bp_rest_get_user_url( $user_id ) {
22
+ _deprecated_function( __FUNCTION__, '9.0.0', 'bp_rest_get_object_url( $user_id, \'members\' )' );
23
+ return bp_rest_get_object_url( $user_id, 'members' );
24
+ }
bp-core/images/bp-members-invitations-invite-screen.png DELETED
Binary file
bp-core/images/bp-members-invitations-manage-admin-screen.png DELETED
Binary file
bp-core/images/bp-widget-blocks.jpg ADDED
Binary file
bp-core/images/bp-xprofile-admin-signup-fields.png DELETED
Binary file
bp-core/images/bp-xprofile-checkbox-acceptance-field-type.png DELETED
Binary file
bp-core/images/bp-xprofile-wp-field-type.png DELETED
Binary file
bp-core/images/latest-activities.jpg ADDED
Binary file
bp-core/images/legacy-widget-to-block.jpg ADDED
Binary file
bp-core/js/block-components.js CHANGED
@@ -4,21 +4,23 @@ function n(n,o){if(!(n instanceof o))throw new TypeError("Cannot call a class as
4
  function e(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function r(r,n,t){return n&&e(r.prototype,n),t&&e(r,t),r}module.exports=r;
5
  },{}],"NS7G":[function(require,module,exports) {
6
  function e(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}module.exports=e;
7
- },{}],"xOn8":[function(require,module,exports) {
 
 
 
 
8
  function o(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?module.exports=o=function(o){return typeof o}:module.exports=o=function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},o(t)}module.exports=o;
9
  },{}],"oXYo":[function(require,module,exports) {
10
  var e=require("../helpers/typeof"),r=require("./assertThisInitialized");function t(t,i){return!i||"object"!==e(i)&&"function"!=typeof i?r(t):i}module.exports=t;
11
  },{"../helpers/typeof":"xOn8","./assertThisInitialized":"NS7G"}],"goD2":[function(require,module,exports) {
12
  function t(e){return module.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},t(e)}module.exports=t;
13
- },{}],"zqo5":[function(require,module,exports) {
14
- function t(o,e){return module.exports=t=Object.setPrototypeOf||function(t,o){return t.__proto__=o,t},t(o,e)}module.exports=t;
15
- },{}],"RISo":[function(require,module,exports) {
16
- var e=require("./setPrototypeOf");function r(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&e(r,t)}module.exports=r;
17
- },{"./setPrototypeOf":"zqo5"}],"W80x":[function(require,module,exports) {
18
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=o(require("@babel/runtime/helpers/classCallCheck")),t=o(require("@babel/runtime/helpers/createClass")),r=o(require("@babel/runtime/helpers/assertThisInitialized")),a=o(require("@babel/runtime/helpers/possibleConstructorReturn")),s=o(require("@babel/runtime/helpers/getPrototypeOf")),n=o(require("@babel/runtime/helpers/inherits"));function o(e){return e&&e.__esModule?e:{default:e}}function u(e){var t=l();return function(){var r,n=(0,s.default)(e);if(t){var o=(0,s.default)(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return(0,a.default)(this,r)}}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}var c=wp,i=c.apiFetch,m=c.components.Popover,p=c.element,h=p.Component,f=p.Fragment,d=p.createElement,b=c.i18n.__,v=c.url.addQueryArgs,_=function(a){(0,n.default)(o,a);var s=u(o);function o(){var t;return(0,e.default)(this,o),(t=s.apply(this,arguments)).state={search:"",items:[],error:""},t.searchItemName=t.searchItemName.bind((0,r.default)(t)),t.selectItemName=t.selectItemName.bind((0,r.default)(t)),t}return(0,t.default)(o,[{key:"searchItemName",value:function(e){var t=this,r=this.state.search,a=this.props,s=a.component,n=a.objectQueryArgs;this.setState({search:e}),e.length<r.length&&this.setState({items:[]});var o="/buddypress/v1/"+s,u={};e&&(u.search=encodeURIComponent(e)),n&&(u=Object.assign(u,n)),i({path:v(o,u)}).then(function(e){t.setState({items:e})},function(e){t.setState({error:e.message})})}},{key:"selectItemName",value:function(e,t){var r=this.props.onSelectItem;return e.preventDefault(),this.setState({search:"",items:[],error:""}),r({itemID:t})}},{key:"render",value:function(){var e,t=this,r=this.state,a=r.search,s=r.items,n=this.props,o=n.ariaLabel,u=n.placeholder,l=n.useAvatar,c=n.slugValue;return o||(o=b("Item's name","buddypress")),u||(u=b("Enter Item's name here…","buddypress")),s.length&&(e=s.map(function(e){return d("button",{type:"button",key:"editor-autocompleters__item-item-"+e.id,role:"option","aria-selected":"true",className:"components-button components-autocomplete__result editor-autocompleters__user",onClick:function(r){return t.selectItemName(r,e.id)}},l&&d("img",{key:"avatar",className:"editor-autocompleters__user-avatar",alt:"",src:e.avatar_urls.thumb}),d("span",{key:"name",className:"editor-autocompleters__user-name"},e.name),c&&null!==c(e)&&d("span",{key:"slug",className:"editor-autocompleters__user-slug"},c(e)))})),d(f,null,d("input",{type:"text",value:a,className:"components-placeholder__input","aria-label":o,placeholder:u,onChange:function(e){return t.searchItemName(e.target.value)}}),0!==s.length&&d(m,{className:"components-autocomplete__popover",focusOnMount:!1,position:"bottom left"},d("div",{className:"components-autocomplete__results"},e)))}}]),o}(h),y=_;exports.default=y;
19
- },{"@babel/runtime/helpers/classCallCheck":"IC7x","@babel/runtime/helpers/createClass":"WiqS","@babel/runtime/helpers/assertThisInitialized":"NS7G","@babel/runtime/helpers/possibleConstructorReturn":"oXYo","@babel/runtime/helpers/getPrototypeOf":"goD2","@babel/runtime/helpers/inherits":"RISo"}],"iA92":[function(require,module,exports) {
20
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("./autocompleter"));function t(e){return e&&e.__esModule?e:{default:e}}var r={AutoCompleter:e.default};exports.default=r;
21
- },{"./autocompleter":"W80x"}],"Ee8M":[function(require,module,exports) {
22
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"blockComponents",{enumerable:!0,get:function(){return e.default}});var e=t(require("./components"));function t(e){return e&&e.__esModule?e:{default:e}}
23
- },{"./components":"iA92"}]},{},["Ee8M"], "bp")
24
  //# sourceMappingURL=/block-components.js.map
4
  function e(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function r(r,n,t){return n&&e(r.prototype,n),t&&e(r,t),r}module.exports=r;
5
  },{}],"NS7G":[function(require,module,exports) {
6
  function e(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}module.exports=e;
7
+ },{}],"zqo5":[function(require,module,exports) {
8
+ function t(o,e){return module.exports=t=Object.setPrototypeOf||function(t,o){return t.__proto__=o,t},t(o,e)}module.exports=t;
9
+ },{}],"RISo":[function(require,module,exports) {
10
+ var e=require("./setPrototypeOf");function r(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&e(r,t)}module.exports=r;
11
+ },{"./setPrototypeOf":"zqo5"}],"xOn8":[function(require,module,exports) {
12
  function o(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?module.exports=o=function(o){return typeof o}:module.exports=o=function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},o(t)}module.exports=o;
13
  },{}],"oXYo":[function(require,module,exports) {
14
  var e=require("../helpers/typeof"),r=require("./assertThisInitialized");function t(t,i){return!i||"object"!==e(i)&&"function"!=typeof i?r(t):i}module.exports=t;
15
  },{"../helpers/typeof":"xOn8","./assertThisInitialized":"NS7G"}],"goD2":[function(require,module,exports) {
16
  function t(e){return module.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},t(e)}module.exports=t;
17
+ },{}],"W80x":[function(require,module,exports) {
18
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=o(require("@babel/runtime/helpers/classCallCheck")),t=o(require("@babel/runtime/helpers/createClass")),r=o(require("@babel/runtime/helpers/assertThisInitialized")),a=o(require("@babel/runtime/helpers/inherits")),s=o(require("@babel/runtime/helpers/possibleConstructorReturn")),n=o(require("@babel/runtime/helpers/getPrototypeOf"));function o(e){return e&&e.__esModule?e:{default:e}}function u(e){var t=l();return function(){var r,a=(0,n.default)(e);if(t){var o=(0,n.default)(this).constructor;r=Reflect.construct(a,arguments,o)}else r=a.apply(this,arguments);return(0,s.default)(this,r)}}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}var c=wp,i=c.apiFetch,m=c.components.Popover,p=c.element,h=p.Component,f=p.Fragment,d=p.createElement,b=c.i18n.__,v=c.url.addQueryArgs,_=function(s){(0,a.default)(o,s);var n=u(o);function o(){var t;return(0,e.default)(this,o),(t=n.apply(this,arguments)).state={search:"",items:[],error:""},t.searchItemName=t.searchItemName.bind((0,r.default)(t)),t.selectItemName=t.selectItemName.bind((0,r.default)(t)),t}return(0,t.default)(o,[{key:"searchItemName",value:function(e){var t=this,r=this.state.search,a=this.props,s=a.component,n=a.objectQueryArgs;this.setState({search:e}),e.length<r.length&&this.setState({items:[]});var o="/buddypress/v1/"+s,u={};e&&(u.search=encodeURIComponent(e)),n&&(u=Object.assign(u,n)),i({path:v(o,u)}).then(function(e){t.setState({items:e})},function(e){t.setState({error:e.message})})}},{key:"selectItemName",value:function(e,t){var r=this.props.onSelectItem;return e.preventDefault(),this.setState({search:"",items:[],error:""}),r({itemID:t})}},{key:"render",value:function(){var e,t=this,r=this.state,a=r.search,s=r.items,n=this.props,o=n.ariaLabel,u=n.placeholder,l=n.useAvatar,c=n.slugValue;return o||(o=b("Item's name","buddypress")),u||(u=b("Enter Item's name here…","buddypress")),s.length&&(e=s.map(function(e){return d("button",{type:"button",key:"editor-autocompleters__item-item-"+e.id,role:"option","aria-selected":"true",className:"components-button components-autocomplete__result editor-autocompleters__user",onClick:function(r){return t.selectItemName(r,e.id)}},l&&d("img",{key:"avatar",className:"editor-autocompleters__user-avatar",alt:"",src:e.avatar_urls.thumb.replaceAll("&#038;","&")}),d("span",{key:"name",className:"editor-autocompleters__user-name"},e.name),c&&null!==c(e)&&d("span",{key:"slug",className:"editor-autocompleters__user-slug"},c(e)))})),d(f,null,d("input",{type:"text",value:a,className:"components-placeholder__input","aria-label":o,placeholder:u,onChange:function(e){return t.searchItemName(e.target.value)}}),0!==s.length&&d(m,{className:"components-autocomplete__popover",focusOnMount:!1,position:"bottom left"},d("div",{className:"components-autocomplete__results"},e)))}}]),o}(h),y=_;exports.default=y;
19
+ },{"@babel/runtime/helpers/classCallCheck":"IC7x","@babel/runtime/helpers/createClass":"WiqS","@babel/runtime/helpers/assertThisInitialized":"NS7G","@babel/runtime/helpers/inherits":"RISo","@babel/runtime/helpers/possibleConstructorReturn":"oXYo","@babel/runtime/helpers/getPrototypeOf":"goD2"}],"fOJU":[function(require,module,exports) {
20
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var e=wp,r=e.element.createElement;function t(e){var t=wp.serverSideRender?wp.serverSideRender:wp.editor.ServerSideRender;return r(t,e)}
21
+ },{}],"iA92":[function(require,module,exports) {
22
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("./autocompleter")),r=t(require("./server-side-render"));function t(e){return e&&e.__esModule?e:{default:e}}var u={AutoCompleter:e.default,ServerSideRender:r.default};exports.default=u;
23
+ },{"./autocompleter":"W80x","./server-side-render":"fOJU"}],"Ee8M":[function(require,module,exports) {
 
 
24
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"blockComponents",{enumerable:!0,get:function(){return e.default}});var e=t(require("./components"));function t(e){return e&&e.__esModule?e:{default:e}}
25
+ },{"./components":"iA92"}]},{},["Ee8M"], "bpBlock")
26
  //# sourceMappingURL=/block-components.js.map
bp-core/js/block-components.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../../../../node_modules/@babel/runtime/helpers/createClass.js","../../../../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../../../../node_modules/@babel/runtime/helpers/typeof.js","../../../../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../../../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../../../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../../../../node_modules/@babel/runtime/helpers/inherits.js","components/autocompleter.js","components/index.js","block-components.js"],"names":["AutoCompleter","wp","apiFetch","Popover","components","element","Component","Fragment","createElement","__","i18n","addQueryArgs","url","arguments","state","search","items","error","searchItemName","bind","selectItemName","value","props","component","objectQueryArgs","setState","length","path","queryArgs","encodeURIComponent","Object","assign","then","message","event","itemID","onSelectItem","preventDefault","itemsList","ariaLabel","placeholder","useAvatar","slugValue","map","item","id","avatar_urls","thumb","name","target"],"mappings":";AAAA,SAAA,EAAA,EAAA,GACA,KAAA,aAAA,GACA,MAAA,IAAA,UAAA,qCAIA,OAAA,QAAA;;ACNA,SAAA,EAAA,EAAA,GACA,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,OAAA,IAAA,CACA,IAAA,EAAA,EAAA,GACA,EAAA,WAAA,EAAA,aAAA,EACA,EAAA,cAAA,EACA,UAAA,IAAA,EAAA,UAAA,GACA,OAAA,eAAA,EAAA,EAAA,IAAA,IAIA,SAAA,EAAA,EAAA,EAAA,GAGA,OAFA,GAAA,EAAA,EAAA,UAAA,GACA,GAAA,EAAA,EAAA,GACA,EAGA,OAAA,QAAA;;AChBA,SAAA,EAAA,GACA,QAAA,IAAA,EACA,MAAA,IAAA,eAAA,6DAGA,OAAA,EAGA,OAAA,QAAA;;ACRA,SAAA,EAAA,GAaA,MAVA,mBAAA,QAAA,iBAAA,OAAA,SACA,OAAA,QAAA,EAAA,SAAA,GACA,cAAA,GAGA,OAAA,QAAA,EAAA,SAAA,GACA,OAAA,GAAA,mBAAA,QAAA,EAAA,cAAA,QAAA,IAAA,OAAA,UAAA,gBAAA,GAIA,EAAA,GAGA,OAAA,QAAA;;AChBA,IAAA,EAAA,QAAA,qBAE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AAC,EACA,KAAA,EAAA,QAAA,CACC,KAAK,OACL,MAAQ7B,EACR,UAAU,gCACGwB,aAAAA,EACb,YAAcC,EACd,SAAW,SAAEN,GAAW,OAAA,EAAKhB,eAAgBgB,EAAMe,OAAO5B,UAEzD,IAAML,EAAMU,QACb,EAAC,EAAD,CACC,UAAU,mCACV,cAAe,EACf,SAAS,eAET,EAAA,MAAA,CAAK,UAAU,oCACZY,SASMtC,EArHTA,CAAsBM,GAqHbN,EAAAA,EAAAA,QAAAA,QAAAA;;ACvIA,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,aAAA,EAFf,IAAA,EAAA,EAAA,QAAA,oBAEe,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAAA,IAAA,EAAA,CACdA,cAAAA,EAAAA,SADc,QAAA,QAAA;;ACHf,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,OAAA,eAAA,QAAA,kBAAA,CAAA,YAAA,EAAA,IAAA,WAAA,OAAA,EAAA,WAAA,IAAA,EAAA,EAAA,QAAA,iBAAA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA","file":"block-components.js","sourceRoot":"../../../src/js/bp-core/js/block-components","sourcesContent":["function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","/**\n * WordPress dependencies.\n */\nconst {\n\tapiFetch,\n\tcomponents: {\n\t\tPopover,\n\t},\n\telement: {\n\t\tComponent,\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n\turl: {\n\t\taddQueryArgs,\n\t},\n} = wp;\n\nclass AutoCompleter extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\tsearch: '',\n\t\t\titems: [],\n\t\t\terror: '',\n\t\t};\n\n\t\tthis.searchItemName = this.searchItemName.bind( this );\n\t\tthis.selectItemName = this.selectItemName.bind( this );\n\t}\n\n\tsearchItemName( value ) {\n\t\tconst { search } = this.state;\n\t\tconst { component, objectQueryArgs } = this.props;\n\t\tthis.setState( { search: value } );\n\n\t\tif ( value.length < search.length ) {\n\t\t\tthis.setState( { items: [] } );\n\t\t}\n\n\t\tlet path= '/buddypress/v1/' + component;\n\t\tlet queryArgs = {};\n\n\t\tif ( value ) {\n\t\t\tqueryArgs.search = encodeURIComponent( value );\n\t\t}\n\n\t\tif ( objectQueryArgs ) {\n\t\t\tqueryArgs = Object.assign( queryArgs, objectQueryArgs );\n\t\t}\n\n\t\tapiFetch( { path: addQueryArgs( path, queryArgs ) } ).then( items => {\n\t\t\tthis.setState( { items: items } );\n\t\t}, error => {\n\t\t\tthis.setState( { error: error.message } );\n\t\t} );\n\t}\n\n\tselectItemName( event, itemID ) {\n\t\tconst { onSelectItem } = this.props;\n\t\tevent.preventDefault();\n\n\t\tthis.setState( {\n\t\t\tsearch: '',\n\t\t\titems: [],\n\t\t\terror: '',\n\t\t} );\n\n\t\treturn onSelectItem( { itemID: itemID } );\n\t}\n\n\trender() {\n\t\tconst { search, items } = this.state;\n\t\tlet { ariaLabel, placeholder, useAvatar, slugValue } = this.props;\n\t\tlet itemsList;\n\n\t\tif ( ! ariaLabel ) {\n\t\t\tariaLabel = __( 'Item\\'s name', 'buddypress' );\n\t\t}\n\n\t\tif ( ! placeholder ) {\n\t\t\tplaceholder = __( 'Enter Item\\'s name here…', 'buddypress' );\n\t\t}\n\n\t\tif ( items.length ) {\n\t\t\titemsList = items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\" key={ 'editor-autocompleters__item-item-' + item.id }\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\taria-selected=\"true\"\n\t\t\t\t\t\tclassName=\"components-button components-autocomplete__result editor-autocompleters__user\"\n\t\t\t\t\t\tonClick={ ( event ) => this.selectItemName( event, item.id ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ useAvatar && (\n\t\t\t\t\t\t\t<img key=\"avatar\" className=\"editor-autocompleters__user-avatar\" alt=\"\" src={ item.avatar_urls.thumb } />\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<span key=\"name\" className=\"editor-autocompleters__user-name\">{ item.name }</span>\n\n\t\t\t\t\t\t{ slugValue && null !== slugValue( item ) && (\n\t\t\t\t\t\t\t<span key=\"slug\" className=\"editor-autocompleters__user-slug\">{ slugValue( item ) }</span>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</button>\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t<input\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={ search }\n\t\t\t\t\tclassName=\"components-placeholder__input\"\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tonChange={ ( event ) => this.searchItemName( event.target.value ) }\n\t\t\t\t/>\n\t\t\t\t{ 0 !== items.length &&\n\t\t\t\t\t<Popover\n\t\t\t\t\t\tclassName=\"components-autocomplete__popover\"\n\t\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\t\tposition=\"bottom left\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"components-autocomplete__results\">\n\t\t\t\t\t\t\t{ itemsList }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Popover>\n\t\t\t\t}\n\t\t\t</Fragment>\n\t\t);\n\t}\n}\n\nexport default AutoCompleter;\n","// Components\nimport AutoCompleter from './autocompleter'\n\nexport default {\n\tAutoCompleter\n};\n","export { default as blockComponents } from './components';\n"]}
1
+ {"version":3,"sources":["../../../../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../../../../node_modules/@babel/runtime/helpers/createClass.js","../../../../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../../../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../../../../node_modules/@babel/runtime/helpers/inherits.js","../../../../../node_modules/@babel/runtime/helpers/typeof.js","../../../../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../../../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","components/autocompleter.js","components/server-side-render.js","components/index.js","block-components.js"],"names":["AutoCompleter","wp","apiFetch","Popover","components","element","Component","Fragment","createElement","__","i18n","addQueryArgs","url","arguments","state","search","items","error","searchItemName","bind","selectItemName","value","props","component","objectQueryArgs","setState","length","path","queryArgs","encodeURIComponent","Object","assign","then","message","event","itemID","onSelectItem","preventDefault","itemsList","ariaLabel","placeholder","useAvatar","slugValue","map","item","id","avatar_urls","thumb","replaceAll","name","target","ServerSideRender","CompatibiltyServerSideRender","serverSideRender","editor"],"mappings":";AAAA,SAAA,EAAA,EAAA,GACA,KAAA,aAAA,GACA,MAAA,IAAA,UAAA,qCAIA,OAAA,QAAA;;ACNA,SAAA,EAAA,EAAA,GACA,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,OAAA,IAAA,CACA,IAAA,EAAA,EAAA,GACA,EAAA,WAAA,EAAA,aAAA,EACA,EAAA,cAAA,EACA,UAAA,IAAA,EAAA,UAAA,GACA,OAAA,eAAA,EAAA,EAAA,IAAA,IAIA,SAAA,EAAA,EAAA,EAAA,GAGA,OAFA,GAAA,EAAA,EAAA,UAAA,GACA,GAAA,EAAA,EAAA,GACA,EAGA,OAAA,QAAA;;AChBA,SAAA,EAAA,GACA,QAAA,IAAA,EACA,MAAA,IAAA,eAAA,6DAGA,OAAA,EAGA,OAAA,QAAA;;ACRA,SAAA,E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,WAAA,IAAA,EAAA,EAAA,QAAA,iBAAA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA","file":"block-components.js","sourceRoot":"../../../src/js/bp-core/js/block-components","sourcesContent":["function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","/**\n * WordPress dependencies.\n */\nconst {\n\tapiFetch,\n\tcomponents: {\n\t\tPopover,\n\t},\n\telement: {\n\t\tComponent,\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n\turl: {\n\t\taddQueryArgs,\n\t},\n} = wp;\n\nclass AutoCompleter extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\tsearch: '',\n\t\t\titems: [],\n\t\t\terror: '',\n\t\t};\n\n\t\tthis.searchItemName = this.searchItemName.bind( this );\n\t\tthis.selectItemName = this.selectItemName.bind( this );\n\t}\n\n\tsearchItemName( value ) {\n\t\tconst { search } = this.state;\n\t\tconst { component, objectQueryArgs } = this.props;\n\t\tthis.setState( { search: value } );\n\n\t\tif ( value.length < search.length ) {\n\t\t\tthis.setState( { items: [] } );\n\t\t}\n\n\t\tlet path= '/buddypress/v1/' + component;\n\t\tlet queryArgs = {};\n\n\t\tif ( value ) {\n\t\t\tqueryArgs.search = encodeURIComponent( value );\n\t\t}\n\n\t\tif ( objectQueryArgs ) {\n\t\t\tqueryArgs = Object.assign( queryArgs, objectQueryArgs );\n\t\t}\n\n\t\tapiFetch( { path: addQueryArgs( path, queryArgs ) } ).then( items => {\n\t\t\tthis.setState( { items: items } );\n\t\t}, error => {\n\t\t\tthis.setState( { error: error.message } );\n\t\t} );\n\t}\n\n\tselectItemName( event, itemID ) {\n\t\tconst { onSelectItem } = this.props;\n\t\tevent.preventDefault();\n\n\t\tthis.setState( {\n\t\t\tsearch: '',\n\t\t\titems: [],\n\t\t\terror: '',\n\t\t} );\n\n\t\treturn onSelectItem( { itemID: itemID } );\n\t}\n\n\trender() {\n\t\tconst { search, items } = this.state;\n\t\tlet { ariaLabel, placeholder, useAvatar, slugValue } = this.props;\n\t\tlet itemsList;\n\n\t\tif ( ! ariaLabel ) {\n\t\t\tariaLabel = __( 'Item\\'s name', 'buddypress' );\n\t\t}\n\n\t\tif ( ! placeholder ) {\n\t\t\tplaceholder = __( 'Enter Item\\'s name here…', 'buddypress' );\n\t\t}\n\n\t\tif ( items.length ) {\n\t\t\titemsList = items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\" key={ 'editor-autocompleters__item-item-' + item.id }\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\taria-selected=\"true\"\n\t\t\t\t\t\tclassName=\"components-button components-autocomplete__result editor-autocompleters__user\"\n\t\t\t\t\t\tonClick={ ( event ) => this.selectItemName( event, item.id ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ useAvatar && (\n\t\t\t\t\t\t\t<img key=\"avatar\" className=\"editor-autocompleters__user-avatar\" alt=\"\" src={ item.avatar_urls.thumb.replaceAll( '&#038;', '&' ) } />\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<span key=\"name\" className=\"editor-autocompleters__user-name\">{ item.name }</span>\n\n\t\t\t\t\t\t{ slugValue && null !== slugValue( item ) && (\n\t\t\t\t\t\t\t<span key=\"slug\" className=\"editor-autocompleters__user-slug\">{ slugValue( item ) }</span>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</button>\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t<input\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={ search }\n\t\t\t\t\tclassName=\"components-placeholder__input\"\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tonChange={ ( event ) => this.searchItemName( event.target.value ) }\n\t\t\t\t/>\n\t\t\t\t{ 0 !== items.length &&\n\t\t\t\t\t<Popover\n\t\t\t\t\t\tclassName=\"components-autocomplete__popover\"\n\t\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\t\tposition=\"bottom left\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"components-autocomplete__results\">\n\t\t\t\t\t\t\t{ itemsList }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Popover>\n\t\t\t\t}\n\t\t\t</Fragment>\n\t\t);\n\t}\n}\n\nexport default AutoCompleter;\n","/**\n * WordPress dependencies.\n */\nconst {\n\telement: {\n\t\tcreateElement,\n\t},\n} = wp;\n\n/**\n * Compatibility Server Side Render.\n *\n * @since 9.0.0\n */\n export default function ServerSideRender( props ) {\n\tconst CompatibiltyServerSideRender = wp.serverSideRender ? wp.serverSideRender : wp.editor.ServerSideRender;\n\n\treturn (\n\t\t<CompatibiltyServerSideRender { ...props } />\n\t);\n}\n","/**\n * BuddyPress components.\n */\nimport AutoCompleter from './autocompleter';\nimport ServerSideRender from './server-side-render';\n\nexport default {\n\tAutoCompleter,\n\tServerSideRender,\n};\n","export { default as blockComponents } from './components';\n"]}
bp-core/js/block-data.js ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"DCTP":[function(require,module,exports) {
2
+ function r(r){if(Array.isArray(r))return r}module.exports=r;
3
+ },{}],"LoeL":[function(require,module,exports) {
4
+ function r(r,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var e=[],n=!0,o=!1,l=void 0;try{for(var i,u=r[Symbol.iterator]();!(n=(i=u.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(a){o=!0,l=a}finally{try{n||null==u.return||u.return()}finally{if(o)throw l}}return e}}module.exports=r;
5
+ },{}],"jEQo":[function(require,module,exports) {
6
+ function n(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,l=new Array(r);e<r;e++)l[e]=n[e];return l}module.exports=n;
7
+ },{}],"Dbv9":[function(require,module,exports) {
8
+ var r=require("./arrayLikeToArray");function t(t,e){if(t){if("string"==typeof t)return r(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(o):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(t,e):void 0}}module.exports=t;
9
+ },{"./arrayLikeToArray":"jEQo"}],"MWEO":[function(require,module,exports) {
10
+ function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
11
+ },{}],"DERy":[function(require,module,exports) {
12
+ var r=require("./arrayWithHoles"),e=require("./iterableToArrayLimit"),t=require("./unsupportedIterableToArray"),i=require("./nonIterableRest");function u(u,a){return r(u)||e(u,a)||t(u,a)||i()}module.exports=u;
13
+ },{"./arrayWithHoles":"DCTP","./iterableToArrayLimit":"LoeL","./unsupportedIterableToArray":"Dbv9","./nonIterableRest":"MWEO"}],"Ih1j":[function(require,module,exports) {
14
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.STORE_KEY=void 0;var e="bp/core";exports.STORE_KEY=e;
15
+ },{}],"DDtj":[function(require,module,exports) {
16
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getActiveComponents=void 0;var e=function(e){return e.components||[]};exports.getActiveComponents=e;
17
+ },{}],"gg2v":[function(require,module,exports) {
18
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TYPES=void 0;var e={GET_ACTIVE_COMPONENTS:"GET_ACTIVE_COMPONENTS",FETCH_FROM_API:"FETCH_FROM_API"};exports.TYPES=e;
19
+ },{}],"NTbX":[function(require,module,exports) {
20
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getActiveComponents=t,exports.fetchFromAPI=r;var e=require("./action-types");function t(t){return{type:e.TYPES.GET_ACTIVE_COMPONENTS,list:t}}function r(t,r){return{type:e.TYPES.FETCH_FROM_API,path:t,parse:r}}
21
+ },{"./action-types":"gg2v"}],"rqzK":[function(require,module,exports) {
22
+ var t=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e,n){var o=r&&r.prototype instanceof v?r:v,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,r,e){var n=f;return function(o,i){if(n===l)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw i;return N()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=_(a,e);if(c){if(c===y)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===f)throw n=p,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=l;var u=h(t,r,e);if("normal"===u.type){if(n=e.done?p:s,u.arg===y)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=p,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(n){return{type:"throw",arg:n}}}t.wrap=u;var f="suspendedStart",s="suspendedYield",l="executing",p="completed",y={};function v(){}function d(){}function g(){}var m={};m[i]=function(){return this};var w=Object.getPrototypeOf,L=w&&w(w(G([])));L&&L!==e&&n.call(L,i)&&(m=L);var x=g.prototype=v.prototype=Object.create(m);function E(t){["next","throw","return"].forEach(function(r){t[r]=function(t){return this._invoke(r,t)}})}function b(t,r){var e;this._invoke=function(o,i){function a(){return new r(function(e,a){!function e(o,i,a,c){var u=h(t[o],t,i);if("throw"!==u.type){var f=u.arg,s=f.value;return s&&"object"==typeof s&&n.call(s,"__await")?r.resolve(s.__await).then(function(t){e("next",t,a,c)},function(t){e("throw",t,a,c)}):r.resolve(s).then(function(t){f.value=t,a(f)},function(t){return e("throw",t,a,c)})}c(u.arg)}(o,i,e,a)})}return e=e?e.then(a,a):a()}}function _(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,_(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,y;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,y):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function j(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function O(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function G(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:N}}function N(){return{value:r,done:!0}}return d.prototype=x.constructor=g,g.constructor=d,g[c]=d.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===d||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},E(b.prototype),b.prototype[a]=function(){return this},t.AsyncIterator=b,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new b(u(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},E(x),x[c]="Generator",x[i]=function(){return this},x.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=G,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),y},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),O(e),y}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:G(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),y}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=t}catch(r){Function("r","regeneratorRuntime = r")(t)}
23
+ },{}],"BxGn":[function(require,module,exports) {
24
+ module.exports=require("regenerator-runtime");
25
+ },{"regenerator-runtime":"rqzK"}],"SaI5":[function(require,module,exports) {
26
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getActiveComponents=s;var e=r(require("@babel/runtime/regenerator")),t=require("./actions");function r(e){return e&&e.__esModule?e:{default:e}}var n=e.default.mark(s);function s(){var r;return e.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,t.fetchFromAPI)("/buddypress/v1/components?status=active",!0);case 2:return r=e.sent,e.next=5,(0,t.getActiveComponents)(r);case 5:case"end":return e.stop()}},n)}
27
+ },{"@babel/runtime/regenerator":"BxGn","./actions":"NTbX"}],"cQfh":[function(require,module,exports) {
28
+ function e(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}module.exports=e;
29
+ },{}],"yrui":[function(require,module,exports) {
30
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=r(require("@babel/runtime/helpers/defineProperty")),t=require("./action-types");function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function o(t){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach(function(r){(0,e.default)(t,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}var c={components:[]},i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case t.TYPES.GET_ACTIVE_COMPONENTS:return o(o({},e),{},{components:r.list})}return e},u=i;exports.default=u;
31
+ },{"@babel/runtime/helpers/defineProperty":"cQfh","./action-types":"gg2v"}],"KdPQ":[function(require,module,exports) {
32
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.controls=void 0;var e=wp,r=e.apiFetch,t={FETCH_FROM_API:function(e){var t=e.path,o=e.parse;return r({path:t,parse:o})}};exports.controls=t;
33
+ },{}],"QFc2":[function(require,module,exports) {
34
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.BP_CORE_STORE_KEY=void 0;var e=require("./constants"),r=i(require("./selectors")),t=i(require("./actions")),o=i(require("./resolvers")),n=s(require("./reducers")),u=require("./controls");function s(e){return e&&e.__esModule?e:{default:e}}function a(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,t=new WeakMap;return(a=function(e){return e?t:r})(e)}function i(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=a(r);if(t&&t.has(e))return t.get(e);var o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var s=n?Object.getOwnPropertyDescriptor(e,u):null;s&&(s.get||s.set)?Object.defineProperty(o,u,s):o[u]=e[u]}return o.default=e,t&&t.set(e,o),o}var c=wp,l=c.data.registerStore;l(e.STORE_KEY,{reducer:n.default,actions:t,selectors:r,controls:u.controls,resolvers:o});var f=e.STORE_KEY;exports.BP_CORE_STORE_KEY=f;var p=f;exports.default=p;
35
+ },{"./constants":"Ih1j","./selectors":"DDtj","./actions":"NTbX","./resolvers":"SaI5","./reducers":"yrui","./controls":"KdPQ"}],"qcHp":[function(require,module,exports) {
36
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isActive=a,exports.activityTypes=d,exports.loggedInUser=f,exports.postAuhor=l,exports.currentPostId=v,exports.getCurrentWidgetsSidebar=p,exports.default=void 0;var e=r(require("@babel/runtime/helpers/slicedToArray")),t=r(require("./register"));function r(e){return e&&e.__esModule?e:{default:e}}var n=wp,u=n.data.useSelect,o=lodash,i=o.find,s=o.get;function a(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=u(function(e){return e(t.default).getActiveComponents()},[]),o=i(n,["name",e]);return r?s(o,["features",r]):!!o}var c=a;function d(){var r=u(function(e){return e(t.default).getActiveComponents()},[]),n=i(r,["name","activity"]);if(!n)return[];var o=s(n,["features","types"]),a=[];return Object.entries(o).forEach(function(t){var r=(0,e.default)(t,2),n=r[0],u=r[1];a.push({label:u,value:n})}),a}function f(){return u(function(e){return e("core")?e("core").getCurrentUser():{}},[])}function l(){return u(function(e){var t=e("core/editor"),r=e("core");if(t&&r){var n=t.getCurrentPostAttribute("author"),u=r.getAuthors();return i(u,["id",n])}return{}},[])}function v(){return u(function(e){var t=e("core/editor");return t?t.getCurrentPostId():0},[])}function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return u(function(t){var r=t("core/block-editor"),n=t("core/edit-widgets");if(e&&n&&r){var u=r.getBlocks(),o=r.getBlockParents(e),s=[];return u.forEach(function(e){var t=e.clientId,r=e.attributes;s.push({id:r.id,isCurrent:-1!==o.indexOf(t)})}),i(s,["isCurrent",!0])}return{}},[])}exports.default=c;
37
+ },{"@babel/runtime/helpers/slicedToArray":"DERy","./register":"QFc2"}],"xHVY":[function(require,module,exports) {
38
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=r(require("./utils"));function t(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(t=function(e){return e?n:r})(e)}function r(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=t(r);if(n&&n.has(e))return n.get(e);var o={},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=u?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(o,i,a):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}var n={isActive:e.default,activityTypes:e.activityTypes,loggedInUser:e.loggedInUser,postAuhor:e.postAuhor,currentPostId:e.currentPostId,getCurrentWidgetsSidebar:e.getCurrentWidgetsSidebar};exports.default=n;
39
+ },{"./utils":"qcHp"}],"tYf0":[function(require,module,exports) {
40
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"blockData",{enumerable:!0,get:function(){return e.default}});var e=t(require("./data"));function t(e){return e&&e.__esModule?e:{default:e}}
41
+ },{"./data":"xHVY"}]},{},["tYf0"], "bpBlock")
42
+ //# sourceMappingURL=/block-data.js.map
bp-core/js/block-data.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["../../../../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../../../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../../../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../../../../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../../../../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../../../../node_modules/@babel/runtime/helpers/slicedToArray.js","data/constants.js","data/selectors.js","data/action-types.js","data/actions.js","../../../../../node_modules/regenerator-runtime/runtime.js","../../../../../node_modules/@babel/runtime/regenerator/index.js","data/resolvers.js","../../../../../node_modules/@babel/runtime/helpers/defineProperty.js","data/reducers.js","data/controls.js","data/register.js","data/utils.js","data/index.js","block-data.js"],"names":["STORE_KEY","getActiveComponents","state","components","TYPES","GET_ACTIVE_COMPONENTS","FETCH_FROM_API","list","type","types","fetchFromAPI","path","parse","reducer","DEFAULT_STATE","action","wp","apiFetch","controls","BP_CORE_STORE_KEY","registerStore","data","actions","selectors","resolvers","useSelect","lodash","find","get","isActive","component","feature","select","activeComponent","activityTypes","activityComponent","activityTypesList","Object","entries","forEach","label","push","value","loggedInUser","store","getCurrentUser","postAuhor","editorStore","coreStore","postAuthorId","getCurrentPostAttribute","authorsList","getAuthors","currentPostId","getCurrentPostId","getCurrentWidgetsSidebar","widgetClientId","currentWidgetsSidebar","blockEditorStore","widgetsStore","areas","getBlocks","parents","getBlockParents","sidebars","clientId","attributes","id","isCurrent","indexOf"],"mappings":";AAAA,SAAA,EAAA,GACA,GAAA,MAAA,QAAA,GAAA,OAAA,EAGA,OAAA,QAAA;;ACJA,SAAA,EAAA,EAAA,GACA,GAAA,oBAAA,QAAA,OAAA,YAAA,OAAA,GAAA,CACA,IAAA,EAAA,GACA,GAAA,EACA,GAAA,EACA,OAAA,EAEA,IACA,IAAA,IAAA,EAAA,EAAA,EAAA,OAAA,cAAA,GAAA,EAAA,EAAA,QAAA,QACA,EAAA,KAAA,EAAA,QAEA,GAAA,EAAA,SAAA,GAHA,GAAA,IAKA,MAAA,GACA,GAAA,EACA,EAAA,EACA,QACA,IACA,GAAA,MAAA,EAAA,QAAA,EAAA,SACA,QACA,GAAA,EAAA,MAAA,GAIA,OAAA,GAGA,OAAA,QAAA;;AC3BA,SAAA,EAAA,EAAA,IACA,MAAA,GAAA,EAAA,EAAA,UAAA,EAAA,EAAA,QAEA,IAAA,IAAA,EAAA,EAAA,EAAA,IAAA,MAAA,GAAA,EAAA,EAAA,IACA,EAAA,GAAA,EAAA,GAGA,OAAA,EAGA,OAAA,QAAA;;ACVA,IAAA,EAAA,QAAA,sBAEA,SAAA,EAAA,EAAA,GACA,GAAA,EAAA,CACA,GAAA,iBAAA,EAAA,OAAA,EAAA,EAAA,GACA,IAAA,EAAA,OAAA,UAAA,SAAA,KAAA,GAAA,MAAA,GAAA,GAEA,MADA,WAAA,GAAA,EAAA,cAAA,EAAA,EAAA,YAAA,MACA,QAAA,GAAA,QAAA,EAAA,MAAA,KAAA,GACA,cAAA,GAAA,2CAAA,KAAA,GAAA,EAAA,EAAA,QAAA,GAGA,OAAA,QAAA;;ACXA,SAAA,IACA,MAAA,IAAA,UAAA,6IAGA,OAAA,QAAA;;ACJA,IAAA,EAAA,QAAA,oBAEA,EAA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AA,OAAA,EAAA,QAAA,EAAA,GAAA,EAAA,IAAA,EAAA,GAAA,EAAA,IAAA,EAAA,CACdnC,SAAAA,EADc,QAEdK,cAAAA,EAFc,cAGdS,aAAAA,EAHc,aAIdG,UAAAA,EAJc,UAKdO,cAAAA,EALc,cAMdE,yBAAAA,EAAAA,0BANc,QAAA,QAAA;;ACHf,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,OAAA,eAAA,QAAA,YAAA,CAAA,YAAA,EAAA,IAAA,WAAA,OAAA,EAAA,WAAA,IAAA,EAAA,EAAA,QAAA,WAAA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA","file":"block-data.js","sourceRoot":"../../../src/js/bp-core/js/block-assets","sourcesContent":["function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","/**\n * Identifier key for BP Core store reducer.\n *\n * @type {string}\n */\nexport const STORE_KEY = 'bp/core';\n","/**\n * Returns the list of Active BP Components.\n *\n * @param {Object} state The current state.\n * @return {array} The list of Active BP Components.\n */\nexport const getActiveComponents = ( state ) => {\n\treturn state.components || [];\n};\n","\n/**\n * Action types.\n *\n * @type {Object}\n */\nexport const TYPES = {\n\tGET_ACTIVE_COMPONENTS: 'GET_ACTIVE_COMPONENTS',\n\tFETCH_FROM_API: 'FETCH_FROM_API',\n};\n","/**\n * Internal dependencies.\n */\nimport { TYPES as types } from './action-types';\n\n/**\n * Returns the list of active components.\n *\n * @return {Object} Object for action.\n */\n export function getActiveComponents( list ) {\n\treturn {\n\t\ttype: types.GET_ACTIVE_COMPONENTS,\n\t\tlist,\n\t};\n}\n\n/**\n * Returns an action object used to fetch something from the API.\n *\n * @param {string} path Endpoint path.\n * @param {boolean} parse Should we parse the request.\n * @return {Object} Object for action.\n */\nexport function fetchFromAPI( path, parse ) {\n\treturn {\n\t\ttype: types.FETCH_FROM_API,\n\t\tpath,\n\t\tparse,\n\t};\n}\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n Gp[toStringTagSymbol] = \"Generator\";\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","module.exports = require(\"regenerator-runtime\");\n","/**\n * Internal dependencies.\n */\nimport {\n\tfetchFromAPI,\n\tgetActiveComponents as getActiveComponentsList,\n} from './actions';\n\n/**\n * Resolver for retrieving active BP Components.\n */\nexport function* getActiveComponents() {\n\tconst list = yield fetchFromAPI(\n\t\t'/buddypress/v1/components?status=active',\n\t\ttrue\n\t);\n\tyield getActiveComponentsList( list );\n}\n","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","/**\n * Internal dependencies\n */\nimport { TYPES as types } from './action-types';\n\n/**\n * Default state.\n */\nconst DEFAULT_STATE = {\n\tcomponents: [],\n};\n\n/**\n * Reducer for the BuddyPress data store.\n *\n * @param {Object} state The current state in the store.\n * @param {Object} action Action object.\n *\n * @return {Object} New or existing state.\n */\nconst reducer = ( state = DEFAULT_STATE, action ) => {\n\tswitch ( action.type ) {\n\t\tcase types.GET_ACTIVE_COMPONENTS:\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tcomponents: action.list,\n\t\t\t};\n\t}\n\n\treturn state;\n};\n\nexport default reducer;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tapiFetch,\n} = wp;\n\n/**\n * Default export for registering the controls with the store.\n *\n * @return {Object} An object with the controls to register with the store on\n * the controls property of the registration object.\n */\nexport const controls = {\n\tFETCH_FROM_API( { path, parse } ) {\n\t\treturn apiFetch( { path, parse } );\n\t},\n};\n","/**\n * WordPress dependencies.\n */\nconst {\n\tdata: {\n\t\tregisterStore,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport { STORE_KEY } from './constants';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport * as resolvers from './resolvers';\nimport reducer from './reducers';\nimport { controls } from './controls';\n\nregisterStore( STORE_KEY, {\n\treducer,\n\tactions,\n\tselectors,\n\tcontrols,\n\tresolvers,\n} );\n\nexport const BP_CORE_STORE_KEY = STORE_KEY;\n\nexport default BP_CORE_STORE_KEY;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tdata: {\n\t\tuseSelect,\n\t},\n} = wp;\n\n/**\n * External dependencies.\n */\nconst {\n\tfind,\n\tget,\n} = lodash;\n\n/**\n * Internal dependencies.\n */\nimport BP_CORE_STORE_KEY from './register';\n\n/**\n * Checks whether a component or the feature of an active component is enabled.\n *\n * @since 9.0.0\n *\n * @param {string} component (required) The component to check.\n * @param {string} feature (optional) The feature to check.\n * @return {boolean} Whether a component or the feature of an active component is enabled.\n */\nexport function isActive( component, feature = '' ) {\n\tconst components = useSelect( ( select ) => {\n\t\treturn select( BP_CORE_STORE_KEY ).getActiveComponents();\n\t}, [] );\n\n\tconst activeComponent = find( components, ['name', component] );\n\n\tif ( ! feature ) {\n\t\treturn !! activeComponent;\n\t}\n\n\treturn get( activeComponent, [ 'features', feature ] );\n}\n\nexport default isActive;\n\n/**\n * Checks whether a component or the feature of an active component is enabled.\n *\n * @since 9.0.0\n *\n * @return {array} An array of objects keyed by activity types.\n */\n export function activityTypes() {\n\tconst components = useSelect( ( select ) => {\n\t\treturn select( BP_CORE_STORE_KEY ).getActiveComponents();\n\t}, [] );\n\n\tconst activityComponent = find( components, ['name', 'activity'] );\n\n\tif ( ! activityComponent ) {\n\t\treturn [];\n\t}\n\n\tconst activityTypes = get( activityComponent, [ 'features', 'types' ] );\n\tlet activityTypesList = [];\n\n\tObject.entries( activityTypes ).forEach( ( [ type, label ] ) => {\n\t\tactivityTypesList.push(\n\t\t\t{\n\t\t\t\tlabel: label,\n\t\t\t\tvalue: type,\n\t\t\t}\n\t\t)\n\t} );\n\n\treturn activityTypesList;\n}\n\n/**\n * Returns the logged in user object.\n *\n * @since 9.0.0\n *\n * @return {Object} The logged in user object.\n */\nexport function loggedInUser() {\n\tconst loggedInUser = useSelect( ( select ) => {\n\t\tconst store = select( 'core' );\n\n\t\tif ( store ) {\n\t\t\treturn select( 'core' ).getCurrentUser();\n\t\t}\n\n\t\treturn {};\n\t}, [] );\n\n\treturn loggedInUser;\n}\n\n/**\n * Returns the post author user object.\n *\n * @since 9.0.0\n *\n * @return {Object} The post author user object.\n */\nexport function postAuhor() {\n\tconst postAuhor = useSelect( ( select ) => {\n\t\tconst editorStore = select( 'core/editor' );\n\t\tconst coreStore = select( 'core' );\n\n\t\tif ( editorStore && coreStore ) {\n\t\t\tconst postAuthorId = editorStore.getCurrentPostAttribute( 'author' );\n\t\t\tconst authorsList = coreStore.getAuthors();\n\n\t\t\treturn find( authorsList, ['id', postAuthorId] );\n\t\t}\n\n\t\treturn {};\n\t}, [] );\n\n\treturn postAuhor;\n}\n\n/**\n * Returns the current post ID.\n *\n * @since 9.0.0\n *\n * @return {integer} The current post ID.\n */\nexport function currentPostId() {\n\tconst currentPostId = useSelect( ( select ) => {\n\t\tconst store = select( 'core/editor' );\n\n\t\tif ( store ) {\n\t\t\treturn store.getCurrentPostId();\n\t\t}\n\n\t\treturn 0;\n\t}, [] );\n\n\treturn currentPostId;\n}\n\n/**\n * Get the current sidebar of a Widget Block.\n *\n * @since 9.0.0\n *\n * @param {string} widgetClientId clientId of the sidebar widget.\n * @return {object} An object containing the sidebar Id.\n */\nexport function getCurrentWidgetsSidebar( widgetClientId = '' ) {\n\tconst currentWidgetsSidebar = useSelect( ( select ) => {\n\t\tconst blockEditorStore = select( 'core/block-editor' );\n\t\tconst widgetsStore = select( 'core/edit-widgets' );\n\n\t\tif ( widgetClientId && widgetsStore && blockEditorStore ) {\n\t\t\tconst areas = blockEditorStore.getBlocks();\n\t\t\tconst parents = blockEditorStore.getBlockParents( widgetClientId );\n\t\t\tlet sidebars = [];\n\n\t\t\tareas.forEach( ( { clientId, attributes } ) => {\n\t\t\t\tsidebars.push( {\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tisCurrent: -1 !== parents.indexOf( clientId ),\n\t\t\t\t} );\n\t\t\t} );\n\n\t\t\treturn find( sidebars, ['isCurrent', true ] );\n\t\t}\n\n\t\treturn {};\n\t}, [] );\n\n\treturn currentWidgetsSidebar;\n}\n","// Data.\nimport isActive, { activityTypes, loggedInUser, postAuhor, currentPostId, getCurrentWidgetsSidebar } from './utils';\n\nexport default {\n\tisActive,\n\tactivityTypes,\n\tloggedInUser,\n\tpostAuhor,\n\tcurrentPostId,\n\tgetCurrentWidgetsSidebar,\n};\n","export { default as blockData } from './data';\n"]}
bp-core/js/blocks/login-form.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"ploe":[function(require,module,exports) {
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blockEditor.InspectorControls,l=e.components,n=l.Disabled,o=l.PanelBody,r=l.TextControl,i=e.element,s=i.Fragment,u=i.createElement,a=e.i18n.__,d=bp,b=d.blockComponents.ServerSideRender,p=function(e){var l=e.attributes,i=e.setAttributes,d=l.title;return u(s,null,u(t,null,u(o,{title:a("Settings","buddypress"),initialOpen:!0},u(r,{label:a("Title","buddypress"),value:d,onChange:function(e){i({title:e})}}))),u(n,null,u(b,{block:"bp/login-form",attributes:l})))},c=p;exports.default=c;
3
+ },{}],"RDNZ":[function(require,module,exports) {
4
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blocks.createBlock,r={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:function(e){var t=e.idBase,r=e.instance;return!(null==r||!r.raw)&&"bp_core_login_widget"===t},transform:function(e){var r=e.instance;return t("bp/login-form",{title:r.raw.title})}}]},o=r;exports.default=o;
5
+ },{}],"A1QM":[function(require,module,exports) {
6
+ "use strict";var r=o(require("./login-form/edit")),e=o(require("./login-form/transforms"));function o(r){return r&&r.__esModule?r:{default:r}}var t=wp,i=t.blocks.registerBlockType,s=t.i18n.__;i("bp/login-form",{title:s("Login Form","buddypress"),description:s("Show a Log In form to logged-out visitors, and a Log Out link to those who are logged in.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"admin-users"},category:"buddypress",attributes:{title:{type:"string",default:""}},edit:r.default,transforms:e.default});
7
+ },{"./login-form/edit":"ploe","./login-form/transforms":"RDNZ"}]},{},["A1QM"], null)
8
+ //# sourceMappingURL=/bp-core/js/blocks/login-form.js.map
bp-core/js/blocks/login-form.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-core/js/blocks/login-form/edit.js","bp-core/js/blocks/login-form/transforms.js","bp-core/js/blocks/login-form.js"],"names":["editLoginForm","wp","InspectorControls","blockEditor","components","Disabled","PanelBody","TextControl","element","Fragment","createElement","__","i18n","bp","ServerSideRender","blockComponents","attributes","setAttributes","title","text","transforms","createBlock","blocks","from","type","isMatch","idBase","instance","raw","transform","registerBlockType","description","icon","background","foreground","src","category","default","edit"],"mappings":";AAqDeA,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAlDf,IAgBIC,EAAAA,GAdFC,EADDC,EAAAA,YACCD,kBAEDE,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,YAEDC,EAAAA,EAAAA,QACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,cAGAC,EAD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WAAY,UACZC,IAAK,eAENC,SAAU,aACVpB,WAAY,CACXE,MAAO,CACNM,KAAM,SACNa,QAAS,KAGXC,KAAMtC,EAf6B,QAgBnCoB,WAAYA,EAAAA","file":"login-form.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tPanelBody,\n\t\tTextControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tServerSideRender,\n\t},\n} = bp;\n\nconst editLoginForm = ( { attributes, setAttributes } ) => {\n\tconst { title } = attributes;\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( text ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: text } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/login-form\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editLoginForm;\n","/**\n * WordPress dependencies.\n */\n const {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Legacy Login Form Widget to Login Form Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_core_login_widget';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\treturn createBlock( 'bp/login-form', {\n\t\t\t\t\ttitle: instance.raw.title,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editLoginForm from './login-form/edit';\nimport transforms from './login-form/transforms';\n\nregisterBlockType( 'bp/login-form', {\n\ttitle: __( 'Login Form', 'buddypress' ),\n\tdescription: __( 'Show a Log In form to logged-out visitors, and a Log Out link to those who are logged in.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'admin-users',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t},\n\t},\n\tedit: editLoginForm,\n\ttransforms: transforms,\n} );\n"]}
bp-core/js/blocks/primary-nav.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Sw79":[function(require,module,exports) {
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blockEditor.InspectorControls,i=e.components,s=i.Disabled,r=i.Notice,l=i.PanelBody,n=i.ToggleControl,d=e.element,o=d.Fragment,a=d.createElement,u=e.i18n.__,b=bp,p=b.blockComponents.ServerSideRender,c=b.blockData.getCurrentWidgetsSidebar,y=function(e){var i=e.attributes,d=e.setAttributes,b=e.clientId,y=i.displayTitle,g=c(b);return g&&g.id&&-1!==["sidebar-buddypress-members","sidebar-buddypress-groups"].indexOf(g.id)?a(r,{status:"error",isDismissible:!1},a("p",null,u("The BuddyPress Primary Navigation block shouldn't be used into this widget area. Please remove it.","buddypress"))):a(o,null,a(t,null,a(l,{title:u("Settings","buddypress"),initialOpen:!0},a(n,{label:u("Include navigation title","buddypress"),checked:!!y,onChange:function(){d({displayTitle:!y})}}))),a(s,null,a(p,{block:"bp/primary-nav",attributes:i})))},g=y;exports.default=g;
3
+ },{}],"uKqo":[function(require,module,exports) {
4
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blocks.createBlock,r={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:function(e){var t=e.idBase,r=e.instance;return!(null==r||!r.raw)&&"bp_nouveau_sidebar_object_nav_widget"===t},transform:function(e){var r=e.instance;return t("bp/primary-nav",{displayTitle:r.raw.bp_nouveau_widget_title})}}]},a=r;exports.default=a;
5
+ },{}],"ygAa":[function(require,module,exports) {
6
+ "use strict";var r=i(require("./primary-nav/edit")),e=i(require("./primary-nav/transforms"));function i(r){return r&&r.__esModule?r:{default:r}}var t=wp,s=t.blocks.registerBlockType,a=t.i18n.__;s("bp/primary-nav",{title:a("Primary navigation","buddypress"),description:a("Displays BuddyPress primary nav in the sidebar of your site. Make sure to use it as the first widget of the sidebar and only once.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"buddicons-community"},category:"buddypress",attributes:{displayTitle:{type:"boolean",default:!0}},edit:r.default,transforms:e.default});
7
+ },{"./primary-nav/edit":"Sw79","./primary-nav/transforms":"uKqo"}]},{},["ygAa"], null)
8
+ //# sourceMappingURL=/bp-core/js/blocks/primary-nav.js.map
bp-core/js/blocks/primary-nav.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-core/js/blocks/primary-nav/edit.js","bp-core/js/blocks/primary-nav/transforms.js","bp-core/js/blocks/primary-nav.js"],"names":["editPrimaryNavBlock","wp","InspectorControls","blockEditor","components","Disabled","Notice","PanelBody","ToggleControl","element","Fragment","createElement","__","i18n","bp","ServerSideRender","blockComponents","getCurrentWidgetsSidebar","blockData","attributes","setAttributes","clientId","displayTitle","currentSidebar","id","indexOf","transforms","createBlock","blocks","from","type","isMatch","idBase","instance","raw","transform","bp_nouveau_widget_title","registerBlockType","title","description","icon","background","foreground","src","category","default","edit"],"mappings":";AAqEeA,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAlEf,IAiBIC,EAAAA,GAfFC,EADDC,EAAAA,YACCD,kBAEDE,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,OACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,cAEDC,EAAAA,EAAAA,QACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,cAGAC,EADDC,EAAAA,KACCD,GAcEE,EAAAA,GALFC,EADDC,EAAAA,gBACCD,iBAGAE,EADDC,EAAAA,UACCD,yBAIIjB,EAAsB,SAA+C,GAA3CmB,IAAAA,EAAAA,EAAAA,WAAYC,EAAAA,EAAAA,cAAeC,EAAAA,EAAAA,SAClD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Aa3B,EAAI,qIAAsI,cACvJ4B,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,uBAENC,SAAU,aACVzB,WAAY,CACXG,aAAc,CACbQ,KAAM,UACNe,SAAS,IAGXC,KAAM9C,EAf8B,QAgBpC0B,WAAYA,EAAAA","file":"primary-nav.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tNotice,\n\t\tPanelBody,\n\t\tToggleControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tServerSideRender,\n\t},\n\tblockData: {\n\t\tgetCurrentWidgetsSidebar,\n\t}\n} = bp;\n\nconst editPrimaryNavBlock = ( { attributes, setAttributes, clientId } ) => {\n\tconst { displayTitle } = attributes;\n\tconst currentSidebar = getCurrentWidgetsSidebar( clientId );\n\tconst disabledSidebars = ['sidebar-buddypress-members', 'sidebar-buddypress-groups'];\n\n\tif ( currentSidebar && currentSidebar.id && -1 !== disabledSidebars.indexOf( currentSidebar.id ) ) {\n\t\treturn (\n\t\t\t<Notice status=\"error\" isDismissible={ false }>\n\t\t\t\t<p>\n\t\t\t\t\t{ __( 'The BuddyPress Primary Navigation block shouldn\\'t be used into this widget area. Please remove it.', 'buddypress' ) }\n\t\t\t\t</p>\n\t\t\t</Notice>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Include navigation title', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! displayTitle }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { displayTitle: ! displayTitle } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/primary-nav\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editPrimaryNavBlock;\n","/**\n * WordPress dependencies.\n */\n const {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Legacy Widget to Primary Nav Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_nouveau_sidebar_object_nav_widget';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\treturn createBlock( 'bp/primary-nav', {\n\t\t\t\t\tdisplayTitle: instance.raw.bp_nouveau_widget_title,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editPrimaryNavBlock from './primary-nav/edit';\nimport transforms from './primary-nav/transforms';\n\nregisterBlockType( 'bp/primary-nav', {\n\ttitle: __( 'Primary navigation', 'buddypress' ),\n\tdescription: __( 'Displays BuddyPress primary nav in the sidebar of your site. Make sure to use it as the first widget of the sidebar and only once.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'buddicons-community',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\tdisplayTitle: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t},\n\tedit: editPrimaryNavBlock,\n\ttransforms: transforms,\n} );\n"]}
bp-core/js/dynamic-widget-block.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"eNhW":[function(require,module,exports) {
2
+ function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,o,n){return o&&t(e.prototype,o),n&&t(e,n),e}var n=wp,s=n.url.addQueryArgs,i=lodash,a=i.template;window.bp=window.bp||{},bp.dynamicWidgetBlock=function(){function t(o,n){var s=this;e(this,t);var i=o.path,a=o.root,r=o.nonce;this.path=i,this.root=a,this.nonce=r,this.blocks=n,this.blocks.forEach(function(e,t){var o=(e.query_args||"active").type,n=(e.preloaded||[]).body;s.blocks[t].items={active:[],newest:[],popular:[],alphabetical:[]},!s.blocks[t].items[o].length&&n&&n.length&&(s.blocks[t].items[o]=n)})}return o(t,[{key:"useTemplate",value:function(e){return a(document.querySelector("#tmpl-"+e).innerHTML,{evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"})}},{key:"loop",value:function(){}},{key:"getItems",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"active",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.blocks[o].query_args.type=t,this.blocks[o].items[t].length?this.loop(this.blocks[o].items[t],this.blocks[o].selector,t):fetch(s(this.root+this.path,this.blocks[o].query_args),{method:"GET",headers:{"X-WP-Nonce":this.nonce}}).then(function(e){return e.json()}).then(function(n){e.blocks[o].items[t]=n,e.loop(e.blocks[o].items[t],e.blocks[o].selector,t)})}}]),t}();
3
+ },{}]},{},["eNhW"], null)
4
+ //# sourceMappingURL=/bp-core/js/dynamic-widget-block.js.map
bp-core/js/dynamic-widget-block.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-core/js/dynamic-widget-block.js"],"names":["wp","addQueryArgs","url","lodash","template","window","bp","dynamicWidgetBlock","settings","blocks","path","root","nonce","forEach","block","i","type","query_args","body","preloaded","items","length","tmpl","document","querySelector","innerHTML","evaluate","interpolate","escape","variable","blockIndex","loop","selector","fetch","method","headers","then","response","json","data"],"mappings":";AAwBA,SAAA,EAAA,EAAA,GAAA,KAAA,aAAA,GAAA,MAAA,IAAA,UAAA,qCAAA,SAAA,EAAA,EAAA,GAAA,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,OAAA,IAAA,CAAA,IAAA,EAAA,EAAA,GAAA,EAAA,WAAA,EAAA,aAAA,EAAA,EAAA,cAAA,EAAA,UAAA,IAAA,EAAA,UAAA,GAAA,OAAA,eAAA,EAAA,EAAA,IAAA,IAAA,SAAA,EAAA,EAAA,EAAA,GAAA,OAAA,GAAA,E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,GAAQ,KAAKP,OAAQqB,GAAaE,SAAUhB,GAExFiB,MAAOhC,EAAc,KAAKU,KAAO,KAAKD,KAAM,KAAKD,OAAQqB,GAAab,YAAc,CACnFiB,OAAQ,MACRC,QAAS,CACO,aAAA,KAAKvB,SAElBwB,KACH,SAAEC,GAAcA,OAAAA,EAASC,SACxBF,KACD,SAAEG,GACD,EAAK9B,OAAQqB,GAAaV,MAAOJ,GAASuB,EAC1C,EAAKR,KAAM,EAAKtB,OAAQqB,GAAaV,MAAOJ,GAAQ,EAAKP,OAAQqB,GAAaE,SAAUhB,SAxD7F,EAAA","file":"dynamic-widget-block.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\turl: {\n\t\taddQueryArgs,\n\t},\n} = wp;\n\n/**\n * External dependencies.\n */\nconst {\n\ttemplate,\n} = lodash;\n\n// Use the bp global.\nwindow.bp = window.bp || {};\n\n/**\n * Generic class to be used by Dynamic Widget Blocks.\n *\n * @since 9.0.0\n */\nbp.dynamicWidgetBlock = class bpDynamicWidgetBlock {\n\tconstructor( settings, blocks ) {\n\t\tconst { path, root, nonce } = settings;\n\t\tthis.path = path;\n\t\tthis.root = root;\n\t\tthis.nonce = nonce,\n\t\tthis.blocks = blocks;\n\n\t\tthis.blocks.forEach( ( block, i ) => {\n\t\t\tconst { type } = block.query_args || 'active';\n\t\t\tconst { body } = block.preloaded || [];\n\n\t\t\tthis.blocks[ i ].items = {\n\t\t\t\t'active': [],\n\t\t\t\t'newest': [],\n\t\t\t\t'popular': [],\n\t\t\t\t'alphabetical': [],\n\t\t\t}\n\n\t\t\tif ( ! this.blocks[ i ].items[ type ].length && body && body.length ) {\n\t\t\t\tthis.blocks[ i ].items[ type ] = body;\n\t\t\t}\n\t\t} );\n\t}\n\n\tuseTemplate( tmpl ) {\n\t\tconst options = {\n\t\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\t\tinterpolate: /\\{\\{\\{([\\s\\S]+?)\\}\\}\\}/g,\n\t\t\tescape: /\\{\\{([^\\}]+?)\\}\\}(?!\\})/g,\n\t\t\tvariable: 'data'\n\t\t};\n\n\t\treturn template( document.querySelector( '#tmpl-' + tmpl ).innerHTML, options );\n\t}\n\n\tloop() {\n\t\t// This method needs to be overriden.\n\t}\n\n\tgetItems( type = 'active', blockIndex = 0 ) {\n\t\tthis.blocks[ blockIndex ].query_args.type = type;\n\n\t\tif ( this.blocks[ blockIndex ].items[ type ].length ) {\n\t\t\tthis.loop( this.blocks[ blockIndex ].items[ type ], this.blocks[ blockIndex ].selector, type );\n\t\t} else {\n\t\t\tfetch( addQueryArgs( this.root + this.path, this.blocks[ blockIndex ].query_args ), {\n\t\t\t\tmethod: 'GET',\n\t\t\t\theaders: {\n\t\t\t\t\t'X-WP-Nonce' : this.nonce,\n\t\t\t\t}\n\t\t\t} ).then(\n\t\t\t\t( response ) => response.json()\n\t\t\t).then(\n\t\t\t\t( data ) => {\n\t\t\t\t\tthis.blocks[ blockIndex ].items[ type ] = data;\n\t\t\t\t\tthis.loop( this.blocks[ blockIndex ].items[ type ], this.blocks[ blockIndex ].selector, type );\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n};\n"]}
bp-core/sass/blocks/login-form.scss ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // BP login form widget
2
+ .widget_bp_core_login_widget {
3
+
4
+ .bp-login-widget-user-avatar {
5
+ float: left;
6
+ }
7
+
8
+ .bp-login-widget-user-links {
9
+ margin-left: 70px;
10
+ }
11
+ }
12
+
13
+ #bp-login-widget-form {
14
+
15
+ label {
16
+ display: block;
17
+ font-weight: 600;
18
+ margin: 15px 0 5px;
19
+ width: auto;
20
+ }
21
+
22
+ input[type="text"],
23
+ input[type="password"] {
24
+ width: 100%;
25
+ background-color: #fafafa;
26
+ border: 1px solid #d6d6d6;
27
+ border-radius: 0;
28
+ font: inherit;
29
+ font-size: 100%;
30
+ padding: 0.5em;
31
+ }
32
+
33
+ .login-submit,
34
+ .bp-login-widget-register-link {
35
+ width: fit-content;
36
+ display: inline;
37
+ }
38
+
39
+ .bp-login-widget-register-link {
40
+ margin-left: 1em;
41
+ vertical-align: super;
42
+ }
43
+ }
bp-friends/bp-friends-blocks.php ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BP Friends Blocks Functions.
4
+ *
5
+ * @package BuddyPress
6
+ * @subpackage FriendsBlocks
7
+ * @since 9.0.0
8
+ */
9
+
10
+ // Exit if accessed directly.
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * Adds specific script data for the BP Friends blocks.
17
+ *
18
+ * Only used for the BP Friends block.
19
+ *
20
+ * @since 9.0.0
21
+ */
22
+ function bp_friends_blocks_add_script_data() {
23
+ $friends_blocks = array_filter( buddypress()->friends->block_globals['bp/friends']->items );
24
+
25
+ if ( ! $friends_blocks ) {
26
+ return;
27
+ }
28
+
29
+ // Include the common JS template.
30
+ echo bp_get_dynamic_template_part( 'assets/widgets/friends.php' );
31
+
32
+ // List the block specific props.
33
+ wp_add_inline_script(
34
+ 'bp-friends-script',
35
+ sprintf( 'var bpFriendsBlocks = %s;', wp_json_encode( array_values( $friends_blocks ) ) ),
36
+ 'before'
37
+ );
38
+ }
39
+
40
+ /**
41
+ * Callback function to render the BP Friends Block.
42
+ *
43
+ * @since 9.0.0
44
+ *
45
+ * @param array $attributes The block attributes.
46
+ * @return string HTML output.
47
+ */
48
+ function bp_friends_render_friends_block( $attributes = array() ) {
49
+ $block_args = wp_parse_args(
50
+ $attributes,
51
+ array(
52
+ 'maxFriends' => 5,
53
+ 'friendDefault' => 'active',
54
+ 'linkTitle' => false,
55
+ 'postId' => 0, // If the postId attribute is defined, post author friends are needed.
56
+ )
57
+ );
58
+
59
+ $user_id = 0;
60
+ if ( $block_args['postId'] ) {
61
+ $user_id = (int) get_post_field( 'post_author', $block_args['postId'] );
62
+ } else {
63
+ $user_id = bp_displayed_user_id();
64
+
65
+ if ( ! $user_id && isset( $_SERVER['REQUEST_URI'] ) ) {
66
+ $request_uri = esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) );
67
+ $request_path = wp_parse_url( $request_uri, PHP_URL_PATH );
68
+ $regex = addcslashes( sprintf( '%s/.*bp/friends', rest_get_url_prefix() ), '/' );
69
+
70
+ if ( preg_match( "/{$regex}/", $request_path ) ) {
71
+ $user_id = bp_loggedin_user_id();
72
+ }
73
+ }
74
+ }
75
+
76
+ if ( ! $user_id ) {
77
+ return '';
78
+ }
79
+
80
+ $classnames = 'widget_bp_core_friends_widget buddypress widget';
81
+ $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
82
+
83
+ $max_friends = (int) $block_args['maxFriends'];
84
+ $no_friends = __( 'Sorry, no members were found.', 'buddypress' );
85
+
86
+ /**
87
+ * Filters the separator of the friends block nav links.
88
+ *
89
+ * @since 9.0.0
90
+ *
91
+ * @param string $separator Separator string. Default '|'.
92
+ */
93
+ $separator = apply_filters( 'bp_friends_block_nav_links_separator', '|' );
94
+
95
+ // Make sure the widget ID is unique.
96
+ $widget_id = uniqid( 'friends-list-' );
97
+
98
+ $link = trailingslashit( bp_core_get_user_domain( $user_id ) . bp_get_friends_slug() );
99
+
100
+ /* translators: %s is the member's display name */
101
+ $title = sprintf( __( '%s\'s Friends', 'buddypress' ), bp_core_get_user_displayname( $user_id ) );
102
+
103
+ // Set the Block's title.
104
+ if ( true === $block_args['linkTitle'] ) {
105
+ $widget_content = sprintf(
106
+ '<h2 class="widget-title"><a href="%1$s">%2$s</a></h2>',
107
+ esc_url( $link ),
108
+ esc_html( $title )
109
+ );
110
+ } else {
111
+ $widget_content = sprintf( '<h2 class="widget-title">%s</h2>', esc_html( $title ) );
112
+ }
113
+
114
+ $item_options = array(
115
+ 'newest' => array(
116
+ 'class' => '',
117
+ 'label' => __( 'Newest', 'buddypress' ),
118
+ ),
119
+ 'active' => array(
120
+ 'class' => '',
121
+ 'label' => __( 'Active', 'buddypress' ),
122
+ ),
123
+ 'popular' => array(
124
+ 'class' => '',
125
+ 'label' => __( 'Popular', 'buddypress' ),
126
+ ),
127
+ );
128
+
129
+ $item_options_output = array();
130
+ $separator_output = sprintf( ' <span class="bp-separator" role="separator">%s</span> ', esc_html( $separator ) );
131
+
132
+ foreach ( $item_options as $item_type => $item_attr ) {
133
+ if ( $block_args['friendDefault'] === $item_type ) {
134
+ $item_attr['class'] = ' class="selected"';
135
+ }
136
+
137
+ $item_options_output[] = sprintf(
138
+ '<a href="%1$s" data-bp-sort="%2$s"%3$s>%4$s</a>',
139
+ esc_url( $link ),
140
+ esc_attr( $item_type ),
141
+ $item_attr['class'],
142
+ esc_html( $item_attr['label'] )
143
+ );
144
+ }
145
+
146
+ $preview = '';
147
+ $default_args = array(
148
+ 'user_id' => $user_id,
149
+ 'type' => $block_args['friendDefault'],
150
+ 'per_page' => $max_friends,
151
+ 'populate_extras' => true,
152
+ );
153
+
154
+ // Previewing the Block inside the editor.
155
+ if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
156
+ $bp_query = bp_core_get_users( $default_args );
157
+ $preview = sprintf( '<div class="widget-error">%s</div>', $no_friends );
158
+
159
+ if ( is_array( $bp_query['users'] ) && 0 < count( $bp_query['users'] ) ) {
160
+ $preview = '';
161
+ foreach ( $bp_query['users'] as $user ) {
162
+ if ( 'newest' === $block_args['friendDefault'] ) {
163
+ /* translators: %s is time elapsed since the registration date happened */
164
+ $extra = sprintf( _x( 'Registered %s', 'The timestamp when the user registered', 'buddypress' ), bp_core_time_since( $user->user_registered ) );
165
+ } elseif ( 'popular' === $block_args['friendDefault'] && isset( $item_options['popular'] ) && isset( $user->total_friend_count ) ) {
166
+ /* translators: %s: total friend count */
167
+ $extra = sprintf( _n( '%s friend', '%s friends', $user->total_friend_count, 'buddypress' ), number_format_i18n( $user->total_friend_count ) );
168
+ } else {
169
+ /* translators: %s: a human time diff. */
170
+ $extra = sprintf( __( 'Active %s', 'buddypress' ), bp_core_time_since( $user->last_activity ) );
171
+ }
172
+
173
+ $preview .= bp_get_dynamic_template_part(
174
+ 'assets/widgets/friends.php',
175
+ 'php',
176
+ array(
177
+ 'data.link' => bp_core_get_user_domain( $user->ID, $user->user_nicename, $user->user_login ),
178
+ 'data.name' => $user->display_name,
179
+ 'data.avatar_urls.thumb' => bp_core_fetch_avatar(
180
+ array(
181
+ 'item_id' => $user->ID,
182
+ 'html' => false,
183
+ )
184
+ ),
185
+ 'data.avatar_alt' => esc_attr(
186
+ sprintf(
187
+ /* translators: %s: member name */
188
+ __( 'Profile picture of %s', 'buddypress' ),
189
+ $user->display_name
190
+ )
191
+ ),
192
+ 'data.id' => $user->ID,
193
+ 'data.extra' => $extra,
194
+ )
195
+ );
196
+ }
197
+ }
198
+ } else {
199
+ // Get corresponding friends.
200
+ $path = sprintf(
201
+ '/%1$s/%2$s/%3$s',
202
+ bp_rest_namespace(),
203
+ bp_rest_version(),
204
+ buddypress()->members->id
205
+ );
206
+
207
+ $default_path = add_query_arg(
208
+ $default_args,
209
+ $path
210
+ );
211
+
212
+ $preloaded_friends = array();
213
+ if ( bp_is_running_wp( '5.0.0' ) ) {
214
+ $preloaded_friends = rest_preload_api_request( '', $default_path );
215
+ }
216
+
217
+ buddypress()->friends->block_globals['bp/friends']->items[ $widget_id ] = (object) array(
218
+ 'selector' => $widget_id,
219
+ 'query_args' => $default_args,
220
+ 'preloaded' => reset( $preloaded_friends ),
221
+ );
222
+
223
+ // Only enqueue common/specific scripts and data once per page load.
224
+ if ( ! has_action( 'wp_footer', 'bp_friends_blocks_add_script_data', 1 ) ) {
225
+ wp_set_script_translations( 'bp-friends-script', 'buddypress' );
226
+ wp_enqueue_script( 'bp-friends-script' );
227
+ wp_localize_script(
228
+ 'bp-friends-script',
229
+ 'bpFriendsSettings',
230
+ array(
231
+ 'path' => ltrim( $path, '/' ),
232
+ 'root' => esc_url_raw( get_rest_url() ),
233
+ 'nonce' => wp_create_nonce( 'wp_rest' ),
234
+ )
235
+ );
236
+
237
+ add_action( 'wp_footer', 'bp_friends_blocks_add_script_data', 1 );
238
+ }
239
+ }
240
+
241
+ $widget_content .= sprintf(
242
+ '<div class="item-options">
243
+ %1$s
244
+ </div>
245
+ <ul id="%2$s" class="item-list" aria-live="polite" aria-relevant="all" aria-atomic="true">
246
+ %3$s
247
+ </ul>',
248
+ implode( $separator_output, $item_options_output ),
249
+ esc_attr( $widget_id ),
250
+ $preview
251
+ );
252
+
253
+ // Adds a container to make sure the block is styled even when used into the Columns parent block.
254
+ $widget_content = sprintf( '<div class="bp-dynamic-block-container">%s</div>', "\n" . $widget_content . "\n" );
255
+
256
+ // Only add a block wrapper if not loaded into a Widgets sidebar.
257
+ if ( ! did_action( 'dynamic_sidebar_before' ) ) {
258
+ return sprintf(
259
+ '<div %1$s>%2$s</div>',
260
+ $wrapper_attributes,
261
+ $widget_content
262
+ );
263
+ }
264
+
265
+ return $widget_content;
266
+ }
bp-friends/bp-friends-cssjs.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BP Friends component CSS/JS.
4
+ *
5
+ * @package BuddyPress
6
+ * @subpackage FriendsScripts
7
+ * @since 9.0.0
8
+ */
9
+
10
+ // Exit if accessed directly.
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * Registers the script to manage the dynamic part of the Friends widget/block.
17
+ *
18
+ * @since 9.0.0
19
+ *
20
+ * @param array $scripts Data about the scripts to register.
21
+ * @return array Data about the scripts to register.
22
+ */
23
+ function bp_friends_register_scripts( $scripts = array() ) {
24
+ $scripts['bp-friends-script'] = array(
25
+ 'file' => plugins_url( 'js/friends.js', __FILE__ ),
26
+ 'dependencies' => array(
27
+ 'bp-dynamic-widget-block-script',
28
+ 'wp-i18n',
29
+ ),
30
+ 'footer' => true,
31
+ );
32
+
33
+ return $scripts;
34
+ }
35
+ add_filter( 'bp_core_register_common_scripts', 'bp_friends_register_scripts', 9, 1 );
bp-friends/classes/class-bp-core-friends-widget.php CHANGED
@@ -21,16 +21,18 @@ class BP_Core_Friends_Widget extends WP_Widget {
21
  * Class constructor.
22
  *
23
  * @since 1.9.0
 
24
  */
25
  function __construct() {
26
  $widget_ops = array(
27
- 'description' => __( 'A dynamic list of recently active, popular, and newest Friends of the displayed member. Widget is only shown when viewing a member profile.', 'buddypress' ),
28
  'classname' => 'widget_bp_core_friends_widget buddypress widget',
29
  'customize_selective_refresh' => true,
 
30
  );
31
  parent::__construct( false, $name = _x( '(BuddyPress) Friends', 'widget name', 'buddypress' ), $widget_ops );
32
 
33
- if ( is_customize_preview() || is_active_widget( false, false, $this->id_base ) ) {
34
  add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
35
  }
36
  }
21
  * Class constructor.
22
  *
23
  * @since 1.9.0
24
+ * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options.
25
  */
26
  function __construct() {
27
  $widget_ops = array(
28
+ 'description' => __( 'A dynamic list of recently active, popular, and newest Friends of the displayed member. Widget is only shown when viewing a member profile.', 'buddypress' ),
29
  'classname' => 'widget_bp_core_friends_widget buddypress widget',
30
  'customize_selective_refresh' => true,
31
+ 'show_instance_in_rest' => true,
32
  );
33
  parent::__construct( false, $name = _x( '(BuddyPress) Friends', 'widget name', 'buddypress' ), $widget_ops );
34
 
35
+ if ( is_customize_preview() || bp_is_widget_block_active( '', $this->id_base ) ) {
36
  add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
37
  }
38
  }
bp-friends/classes/class-bp-friends-component.php CHANGED
@@ -46,11 +46,13 @@ class BP_Friends_Component extends BP_Component {
46
  */
47
  public function includes( $includes = array() ) {
48
  $includes = array(
 
49
  'cache',
50
  'filters',
51
  'template',
52
  'functions',
53
  'widgets',
 
54
  );
55
 
56
  // Conditional includes.
@@ -133,7 +135,12 @@ class BP_Friends_Component extends BP_Component {
133
  'has_directory' => false,
134
  'search_string' => __( 'Search Friends...', 'buddypress' ),
135
  'notification_callback' => 'friends_format_notifications',
136
- 'global_tables' => $global_tables
 
 
 
 
 
137
  );
138
 
139
  parent::setup_globals( $args );
@@ -337,4 +344,54 @@ class BP_Friends_Component extends BP_Component {
337
  public function rest_api_init( $controllers = array() ) {
338
  parent::rest_api_init( array( 'BP_REST_Friends_Endpoint' ) );
339
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  }
46
  */
47
  public function includes( $includes = array() ) {
48
  $includes = array(
49
+ 'cssjs',
50
  'cache',
51
  'filters',
52
  'template',
53
  'functions',
54
  'widgets',
55
+ 'blocks',
56
  );
57
 
58
  // Conditional includes.
135
  'has_directory' => false,
136
  'search_string' => __( 'Search Friends...', 'buddypress' ),
137
  'notification_callback' => 'friends_format_notifications',
138
+ 'global_tables' => $global_tables,
139
+ 'block_globals' => array(
140
+ 'bp/friends' => array(
141
+ 'widget_classnames' => array( 'widget_bp_core_friends_widget', 'buddypress' ),
142
+ )
143
+ ),
144
  );
145
 
146
  parent::setup_globals( $args );
344
  public function rest_api_init( $controllers = array() ) {
345
  parent::rest_api_init( array( 'BP_REST_Friends_Endpoint' ) );
346
  }
347
+
348
+ /**
349
+ * Register the BP Friends Blocks.
350
+ *
351
+ * @since 9.0.0
352
+ *
353
+ * @param array $blocks Optional. See BP_Component::blocks_init() for
354
+ * description.
355
+ */
356
+ public function blocks_init( $blocks = array() ) {
357
+ parent::blocks_init(
358
+ array(
359
+ 'bp/friends' => array(
360
+ 'name' => 'bp/friends',
361
+ 'editor_script' => 'bp-friends-block',
362
+ 'editor_script_url' => plugins_url( 'js/blocks/friends.js', dirname( __FILE__ ) ),
363
+ 'editor_script_deps' => array(
364
+ 'wp-blocks',
365
+ 'wp-element',
366
+ 'wp-components',
367
+ 'wp-i18n',
368
+ 'wp-block-editor',
369
+ 'bp-block-data',
370
+ 'bp-block-components',
371
+ ),
372
+ 'style' => 'bp-friends-block',
373
+ 'style_url' => plugins_url( 'css/blocks/friends.css', dirname( __FILE__ ) ),
374
+ 'attributes' => array(
375
+ 'maxFriends' => array(
376
+ 'type' => 'number',
377
+ 'default' => 5,
378
+ ),
379
+ 'friendDefault' => array(
380
+ 'type' => 'string',
381
+ 'default' => 'active',
382
+ ),
383
+ 'linkTitle' => array(
384
+ 'type' => 'boolean',
385
+ 'default' => false,
386
+ ),
387
+ 'postId' => array(
388
+ 'type' => 'number',
389
+ 'default' => 0,
390
+ ),
391
+ ),
392
+ 'render_callback' => 'bp_friends_render_friends_block',
393
+ ),
394
+ )
395
+ );
396
+ }
397
  }
bp-friends/classes/class-bp-rest-friends-endpoint.php CHANGED
@@ -644,7 +644,7 @@ class BP_REST_Friends_Endpoint extends WP_REST_Controller {
644
  'date_created' => bp_rest_prepare_date_response( $friendship->date_created ),
645
  );
646
 
647
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
648
  $data = $this->add_additional_fields_to_object( $data, $request );
649
  $data = $this->filter_response_by_context( $data, $context );
650
  $response = rest_ensure_response( $data );
@@ -684,11 +684,11 @@ class BP_REST_Friends_Endpoint extends WP_REST_Controller {
684
  'href' => rest_url( $base ),
685
  ),
686
  'initiator' => array(
687
- 'href' => rest_url( bp_rest_get_user_url( $friendship->initiator_user_id ) ),
688
  'embeddable' => true,
689
  ),
690
  'friend' => array(
691
- 'href' => rest_url( bp_rest_get_user_url( $friendship->friend_user_id ) ),
692
  'embeddable' => true,
693
  ),
694
  );
644
  'date_created' => bp_rest_prepare_date_response( $friendship->date_created ),
645
  );
646
 
647
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
648
  $data = $this->add_additional_fields_to_object( $data, $request );
649
  $data = $this->filter_response_by_context( $data, $context );
650
  $response = rest_ensure_response( $data );
684
  'href' => rest_url( $base ),
685
  ),
686
  'initiator' => array(
687
+ 'href' => bp_rest_get_object_url( $friendship->initiator_user_id, 'members' ),
688
  'embeddable' => true,
689
  ),
690
  'friend' => array(
691
+ 'href' => bp_rest_get_object_url( $friendship->friend_user_id, 'members' ),
692
  'embeddable' => true,
693
  ),
694
  );
bp-friends/css/blocks/friends-rtl.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-dynamic-block-container .item-options {
2
+ font-size: 0.5em;
3
+ margin: 0 0 1em;
4
+ padding: 1em 0;
5
+ }
6
+
7
+ .bp-dynamic-block-container .item-options a.selected {
8
+ font-weight: 600;
9
+ }
10
+
11
+ .bp-dynamic-block-container ul.item-list {
12
+ list-style: none;
13
+ margin: 1em 0;
14
+ }
15
+
16
+ .bp-dynamic-block-container ul.item-list li {
17
+ margin-bottom: 1em;
18
+ }
19
+
20
+ .bp-dynamic-block-container ul.item-list li:before, .bp-dynamic-block-container ul.item-list li:after {
21
+ content: " ";
22
+ display: table;
23
+ }
24
+
25
+ .bp-dynamic-block-container ul.item-list li:after {
26
+ clear: both;
27
+ }
28
+
29
+ .bp-dynamic-block-container ul.item-list li .item-avatar {
30
+ float: right;
31
+ width: 60px;
32
+ }
33
+
34
+ .bp-dynamic-block-container ul.item-list li .item {
35
+ margin-right: 70px;
36
+ }
bp-friends/css/blocks/friends-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .bp-dynamic-block-container .item-options{font-size:.5em;margin:0 0 1em;padding:1em 0}.bp-dynamic-block-container .item-options a.selected{font-weight:600}.bp-dynamic-block-container ul.item-list{list-style:none;margin:1em 0}.bp-dynamic-block-container ul.item-list li{margin-bottom:1em}.bp-dynamic-block-container ul.item-list li:after,.bp-dynamic-block-container ul.item-list li:before{content:" ";display:table}.bp-dynamic-block-container ul.item-list li:after{clear:both}.bp-dynamic-block-container ul.item-list li .item-avatar{float:right;width:60px}.bp-dynamic-block-container ul.item-list li .item{margin-right:70px}
bp-friends/css/blocks/friends.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-dynamic-block-container .item-options {
2
+ font-size: 0.5em;
3
+ margin: 0 0 1em;
4
+ padding: 1em 0;
5
+ }
6
+
7
+ .bp-dynamic-block-container .item-options a.selected {
8
+ font-weight: 600;
9
+ }
10
+
11
+ .bp-dynamic-block-container ul.item-list {
12
+ list-style: none;
13
+ margin: 1em 0;
14
+ }
15
+
16
+ .bp-dynamic-block-container ul.item-list li {
17
+ margin-bottom: 1em;
18
+ }
19
+
20
+ .bp-dynamic-block-container ul.item-list li:before, .bp-dynamic-block-container ul.item-list li:after {
21
+ content: " ";
22
+ display: table;
23
+ }
24
+
25
+ .bp-dynamic-block-container ul.item-list li:after {
26
+ clear: both;
27
+ }
28
+
29
+ .bp-dynamic-block-container ul.item-list li .item-avatar {
30
+ float: left;
31
+ width: 60px;
32
+ }
33
+
34
+ .bp-dynamic-block-container ul.item-list li .item {
35
+ margin-left: 70px;
36
+ }
bp-friends/css/blocks/friends.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .bp-dynamic-block-container .item-options{font-size:.5em;margin:0 0 1em;padding:1em 0}.bp-dynamic-block-container .item-options a.selected{font-weight:600}.bp-dynamic-block-container ul.item-list{list-style:none;margin:1em 0}.bp-dynamic-block-container ul.item-list li{margin-bottom:1em}.bp-dynamic-block-container ul.item-list li:after,.bp-dynamic-block-container ul.item-list li:before{content:" ";display:table}.bp-dynamic-block-container ul.item-list li:after{clear:both}.bp-dynamic-block-container ul.item-list li .item-avatar{float:left;width:60px}.bp-dynamic-block-container ul.item-list li .item{margin-left:70px}
bp-friends/js/blocks/friends.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"CSIX":[function(require,module,exports) {
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TYPES=void 0;var e=wp,s=e.i18n.__,l=[{label:s("Newest","buddypress"),value:"newest"},{label:s("Active","buddypress"),value:"active"},{label:s("Popular","buddypress"),value:"popular"}];exports.TYPES=l;
3
+ },{}],"qXsY":[function(require,module,exports) {
4
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./constants"),t=wp,n=t.blockEditor.InspectorControls,o=t.components,r=o.Disabled,l=o.PanelBody,s=o.RangeControl,i=o.SelectControl,a=o.ToggleControl,d=t.element,u=d.Fragment,b=d.createElement,p=t.i18n.__,c=bp,f=c.blockComponents.ServerSideRender,m=c.blockData.currentPostId,g=function(t){var o=t.attributes,d=t.setAttributes,c=o.postId,g=o.maxFriends,k=o.friendDefault,C=o.linkTitle,v=m();return!c&&v&&d({postId:v}),b(u,null,b(n,null,b(l,{title:p("Settings","buddypress"),initialOpen:!0},b(s,{label:p("Max friends to show","buddypress"),value:g,onChange:function(e){return d({maxFriends:e})},min:1,max:10,required:!0}),b(i,{label:p("Default members to show","buddypress"),value:k,options:e.TYPES,onChange:function(e){d({friendDefault:e})}}),b(a,{label:p("Link block title to Member's profile friends page","buddypress"),checked:!!C,onChange:function(){d({linkTitle:!C})}}))),b(r,null,b(f,{block:"bp/friends",attributes:o})))},k=g;exports.default=k;
5
+ },{"./constants":"CSIX"}],"fch3":[function(require,module,exports) {
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,r=e.blocks.createBlock,t={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:function(e){var r=e.idBase,t=e.instance;return!(null==t||!t.raw)&&"bp_core_friends_widget"===r},transform:function(e){var t=e.instance;return r("bp/friends",{maxFriends:t.raw.max_friends,friendDefault:t.raw.friend_default,linkTitle:t.raw.link_title})}}]},a=t;exports.default=a;
7
+ },{}],"Z2R5":[function(require,module,exports) {
8
+ "use strict";var e=r(require("./friends/edit")),t=r(require("./friends/transforms"));function r(e){return e&&e.__esModule?e:{default:e}}var d=wp,i=d.blocks.registerBlockType,s=d.i18n.__;i("bp/friends",{title:s("Friends List","buddypress"),description:s("A dynamic list of recently active, popular, and newest friends of the post author (when used into a page or post) or of the displayed member (when used in a widgetized area). If author/member data is not available the block is not displayed.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"buddicons-friends"},category:"buddypress",attributes:{maxFriends:{type:"number",default:5},friendDefault:{type:"string",default:"active"},linkTitle:{type:"boolean",default:!1},postId:{type:"number",default:0}},edit:e.default,transforms:t.default});
9
+ },{"./friends/edit":"qXsY","./friends/transforms":"fch3"}]},{},["Z2R5"], null)
10
+ //# sourceMappingURL=/bp-friends/js/blocks/friends.js.map
bp-friends/js/blocks/friends.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-friends/js/blocks/friends/constants.js","bp-friends/js/blocks/friends/edit.js","bp-friends/js/blocks/friends/transforms.js","bp-friends/js/blocks/friends.js"],"names":["wp","__","i18n","TYPES","label","value","editDynamicFriendsBlock","InspectorControls","blockEditor","components","Disabled","PanelBody","RangeControl","SelectControl","ToggleControl","element","Fragment","createElement","bp","ServerSideRender","blockComponents","currentPostId","blockData","attributes","setAttributes","postId","maxFriends","friendDefault","linkTitle","post","option","transforms","createBlock","blocks","from","type","isMatch","idBase","instance","raw","transform","max_friends","friend_default","link_title","registerBlockType","title","description","icon","background","foreground","src","category","default","edit"],"mappings":";AAcO,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,WAAA,EAXP,IAIIA,EAAAA,GAFFC,EADDC,EAAAA,KACCD,GASWE,EAAQ,CACpB,CACCC,MAAOH,EAAI,SAAU,cACrBI,MAAO,UAER,CACCD,MAAOH,EAAI,SAAU,cACrBI,M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n\t\t__,\n\t},\n} = wp;\n\n/**\n * Friends ordering types.\n *\n * @type {Array}\n */\nexport const TYPES = [\n\t{\n\t\tlabel: __( 'Newest', 'buddypress' ),\n\t\tvalue: 'newest',\n\t},\n\t{\n\t\tlabel: __( 'Active', 'buddypress' ),\n\t\tvalue: 'active',\n\t},\n\t{\n\t\tlabel: __( 'Popular', 'buddypress' ),\n\t\tvalue: 'popular',\n\t},\n];\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tPanelBody,\n\t\tRangeControl,\n\t\tSelectControl,\n\t\tToggleControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tServerSideRender,\n\t},\n\tblockData: {\n\t\tcurrentPostId,\n\t}\n} = bp;\n\n/**\n * Internal dependencies.\n */\nimport { TYPES } from './constants';\n\nconst editDynamicFriendsBlock = ( { attributes, setAttributes } ) => {\n\tconst { postId, maxFriends, friendDefault, linkTitle } = attributes;\n\tconst post = currentPostId();\n\n\tif ( ! postId && post ) {\n\t\tsetAttributes( { postId: post } );\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max friends to show', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ maxFriends }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { maxFriends: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ 10 }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Default members to show', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ friendDefault }\n\t\t\t\t\t\toptions={ TYPES }\n\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\tsetAttributes( { friendDefault: option } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link block title to Member\\'s profile friends page', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! linkTitle }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { linkTitle: ! linkTitle } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/friends\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editDynamicFriendsBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Legacy Widget to Friends Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_core_friends_widget';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\treturn createBlock( 'bp/friends', {\n\t\t\t\t\tmaxFriends: instance.raw.max_friends,\n\t\t\t\t\tfriendDefault: instance.raw.friend_default,\n\t\t\t\t\tlinkTitle: instance.raw.link_title,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editDynamicFriendsBlock from './friends/edit';\nimport transforms from './friends/transforms';\n\nregisterBlockType( 'bp/friends', {\n\ttitle: __( 'Friends List', 'buddypress' ),\n\tdescription: __( 'A dynamic list of recently active, popular, and newest friends of the post author (when used into a page or post) or of the displayed member (when used in a widgetized area). If author/member data is not available the block is not displayed.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'buddicons-friends',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\tmaxFriends: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 5\n\t\t},\n\t\tfriendDefault: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'active',\n\t\t},\n\t\tlinkTitle: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\tpostId: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 0,\n\t\t},\n\t},\n\tedit: editDynamicFriendsBlock,\n\ttransforms: transforms,\n} );\n"]}
bp-friends/js/friends.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"pMhP":[function(require,module,exports) {
2
+ function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function n(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=i(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function i(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=f();return function(){var r,n=p(t);if(e){var o=p(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return a(this,r)}}function a(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?l(e):r}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=wp,y=d.i18n,b=y.__,v=y.sprintf,g=bp,m=g.dynamicWidgetBlock,h=function(t){c(i,m);var r=s(i);function i(){return e(this,i),r.apply(this,arguments)}return n(i,[{key:"loop",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"active",n=o(p(i.prototype),"useTemplate",this).call(this,"bp-friends-item"),c=document.querySelector("#"+e),u="";t&&t.length?t.forEach(function(t){if("active"===r&&t.last_activity)t.extra=v(b("Active %s","buddypress"),t.last_activity.timediff);else if("popular"===r&&t.total_friend_count){var e=parseInt(t.total_friend_count,10);t.extra=0===e?b("No friends","buddypress"):1===e?b("1 friend","buddypress"):v(b("%s friends","buddypress"),t.total_friend_count)}else"newest"===r&&t.registered_since&&(t.extra=v(b("Registered %s","buddypress"),t.registered_since));t.avatar_alt=v(b("Profile picture of %s","buddypress"),t.name),u+=n(t)}):u='<div class="widget-error">'+b("Sorry, no members were found.","buddypress")+"</div>",c.innerHTML=u}},{key:"start",value:function(){var t=this;this.blocks.forEach(function(e,r){var n=e.selector,c=e.query_args.type,u=document.querySelector("#"+n).closest(".bp-dynamic-block-container");o(p(i.prototype),"getItems",t).call(t,c,r),u.querySelectorAll(".item-options a").forEach(function(e){e.addEventListener("click",function(e){e.preventDefault(),e.target.closest(".item-options").querySelector(".selected").classList.remove("selected"),e.target.classList.add("selected");var n=e.target.getAttribute("data-bp-sort");n!==t.blocks[r].query_args.type&&o(p(i.prototype),"getItems",t).call(t,n,r)})})})}}]),i}(),_=window.bpFriendsSettings||{},w=window.bpFriendsBlocks||{},O=new h(_,w);"loading"===document.readyState?document.addEventListener("DOMContentLoaded",O.start()):O.start();
3
+ },{}]},{},["pMhP"], null)
4
+ //# sourceMappingURL=/bp-friends/js/friends.js.map
bp-friends/js/friends.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-friends/js/friends.js"],"names":["wp","i18n","__","sprintf","bp","dynamicWidgetBlock","bpFriendsWidgetBlock","friends","container","type","tmpl","selector","document","querySelector","output","length","forEach","friend","last_activity","extra","timediff","total_friend_count","friendsCount","parseInt","registered_since","avatar_alt","name","innerHTML","blocks","block","i","query_args","list","closest","querySelectorAll","navItem","addEventListener","event","preventDefault","target","classList","remove","add","newType","getAttribute","settings","window","bpFriendsSettings","bpFriendsBlocks","bpFriends","readyState","start"],"mappings":";AAgGC,SAAA,EAAA,GAAA,OAAA,EAAA,mBAAA,QAAA,iBAAA,OAAA,SAAA,SAAA,GAAA,cAAA,GAAA,SAAA,GAAA,OAAA,GAAA,mBAAA,QAAA,EAAA,cAAA,QAAA,IAAA,OAAA,UAAA,gBAAA,IAAA,GAAA,SAAA,EAAA,EAAA,GAAA,KAAA,aAAA,GAAA,MAAA,IAAA,UAAA,qCAAA,SAAA,EAAA,EAAA,GAAA,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,OAAA,IAAA,CAAA,IAAA,EAAA,EAAA,GAAA,EAAA,WAAA,EAAA,aAAA,EAAA,EAAA,cAAA,EAAA,UAAA,IAAA,EAAA,UAAA,GAAA,OAAA,eAAA,EAAA,EAAA,IAAA,IAAA,SAAA,EAAA,EAAA,EAAA,GAAA,OAAA,GAAA,EAAA,EAAA,UAAA,GAAA,GAAA,EAAA,EAAA,GAAA,EAAA,SAAA,EAAA,EAAA,EAAA,GAAA,OAAA,EAAA,oBAAA,SAAA,QAAA,IAAA,QAAA,IAAA,SAAA,EAAA,EAAA,GAAA,IAAA,EAAA,EAAA,EAAA,GAAA,GAAA,EAAA,CAAA,IAAA,EAAA,OAAA,yBAAA,EAAA,GAAA,OAAA,EAAA,IAAA,EAAA,IAAA,KAAA,GAAA,EAAA,SAAA,EAAA,EAAA,GAAA,GAAA,SAAA,EAAA,EAAA,GAAA,MAAA,OAAA,UAAA,eAAA,KAAA,EAAA,IAAA,QAAA,EAAA,EAAA,MAAA,OAAA,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WAAAA,WAAAA,GAAAA,KAAAA,EAAAA,EAAMqB,GAGtBE,EAAKE,iBAAkB,mBAAoBlB,QAAS,SAAEmB,GACrDA,EAAQC,iBAAkB,QAAS,SAAEC,GACpCA,EAAMC,iBAGND,EAAME,OAAON,QAAS,iBAAkBpB,cAAe,aAAc2B,UAAUC,OAAQ,YACvFJ,EAAME,OAAOC,UAAUE,IAAK,YAEtBC,IAAAA,EAAUN,EAAME,OAAOK,aAAc,gBAEtCD,IAAY,EAAKf,OAAQE,GAAIC,WAAWtB,MAC5BkC,EAAAA,EAAAA,EAAAA,WAAAA,WAAAA,GAAAA,KAAAA,EAAAA,EAASb,aAgB9B,EA5EKxB,GAoEAuC,EAAWC,OAAOC,mBAAqB,GACvCnB,EAASkB,OAAOE,iBAAmB,GACnCC,EAAY,IAAI3C,EAAsBuC,EAAUjB,GAEjD,YAAchB,SAASsC,WAC3BtC,SAASwB,iBAAkB,mBAAoBa,EAAUE,SAEzDF,EAAUE","file":"friends.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t\tsprintf,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tdynamicWidgetBlock,\n} = bp;\n\n/**\n * Front-end Friends block class.\n */\nclass bpFriendsWidgetBlock extends dynamicWidgetBlock {\n\tloop( friends = [], container = '', type = 'active' ) {\n\t\tconst tmpl = super.useTemplate( 'bp-friends-item' );\n\t\tconst selector = document.querySelector( '#' + container );\n\t\tlet output = '';\n\n\t\tif ( friends && friends.length ) {\n\t\t\tfriends.forEach( ( friend ) => {\n\t\t\t\tif ( 'active' === type && friend.last_activity ) {\n\t\t\t\t\t/* translators: %s: a human time diff. */\n\t\t\t\t\tfriend.extra = sprintf( __( 'Active %s', 'buddypress' ), friend.last_activity.timediff );\n\t\t\t\t} else if ( 'popular' === type && friend.total_friend_count ) {\n\t\t\t\t\tconst friendsCount = parseInt( friend.total_friend_count, 10 );\n\n\t\t\t\t\tif ( 0 === friendsCount ) {\n\t\t\t\t\t\tfriend.extra = __( 'No friends', 'buddypress' );\n\t\t\t\t\t} else if ( 1 === friendsCount ) {\n\t\t\t\t\t\tfriend.extra = __( '1 friend', 'buddypress' );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* translators: %s: total friend count (more than 1). */\n\t\t\t\t\t\tfriend.extra = sprintf( __( '%s friends', 'buddypress' ), friend.total_friend_count );\n\t\t\t\t\t}\n\t\t\t\t} else if ( 'newest' === type && friend.registered_since ) {\n\t\t\t\t\t/* translators: %s is time elapsed since the registration date happened */\n\t\t\t\t\tfriend.extra = sprintf( __( 'Registered %s', 'buddypress' ), friend.registered_since );\n\t\t\t\t}\n\n\t\t\t\t/* translators: %s: member name */\n\t\t\t\tfriend.avatar_alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), friend.name );\n\n\t\t\t\toutput += tmpl( friend );\n\t\t\t} );\n\t\t} else {\n\t\t\toutput = '<div class=\"widget-error\">' + __( 'Sorry, no members were found.', 'buddypress' ) + '</div>';\n\t\t}\n\n\t\tselector.innerHTML = output;\n\t}\n\n\tstart() {\n\t\tthis.blocks.forEach( ( block, i ) => {\n\t\t\tconst { selector } = block;\n\t\t\tconst { type } = block.query_args;\n\t\t\tconst list = document.querySelector( '#' + selector ).closest( '.bp-dynamic-block-container' );\n\n\t\t\t// Get default Block's type friends.\n\t\t\tsuper.getItems( type, i );\n\n\t\t\t// Listen to Block's Nav item clics\n\t\t\tlist.querySelectorAll( '.item-options a' ).forEach( ( navItem ) => {\n\t\t\t\tnavItem.addEventListener( 'click', ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t// Changes the displayed filter.\n\t\t\t\t\tevent.target.closest( '.item-options' ).querySelector( '.selected' ).classList.remove( 'selected' );\n\t\t\t\t\tevent.target.classList.add( 'selected' );\n\n\t\t\t\t\tconst newType = event.target.getAttribute( 'data-bp-sort' );\n\n\t\t\t\t\tif ( newType !== this.blocks[ i ].query_args.type ) {\n\t\t\t\t\t\tsuper.getItems( newType, i );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\t}\n}\n\nconst settings = window.bpFriendsSettings || {};\nconst blocks = window.bpFriendsBlocks || {};\nconst bpFriends = new bpFriendsWidgetBlock( settings, blocks );\n\nif ( 'loading' === document.readyState ) {\n\tdocument.addEventListener( 'DOMContentLoaded', bpFriends.start() );\n} else {\n\tbpFriends.start();\n}\n"]}
bp-friends/sass/blocks/friends.scss ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-dynamic-block-container {
2
+
3
+ .item-options {
4
+ font-size: 0.5em;
5
+ margin: 0 0 1em;
6
+ padding: 1em 0;
7
+
8
+ a.selected {
9
+ font-weight: 600;
10
+ }
11
+ }
12
+
13
+ ul.item-list {
14
+ list-style: none;
15
+ margin: 1em 0;
16
+
17
+ li {
18
+ margin-bottom: 1em;
19
+
20
+ &:before,
21
+ &:after {
22
+ content: " ";
23
+ display: table;
24
+ }
25
+
26
+ &:after {
27
+ clear: both;
28
+ }
29
+
30
+ .item-avatar {
31
+ float: left;
32
+ width: 60px;
33
+ }
34
+
35
+ .item {
36
+ margin-left: 70px;
37
+ }
38
+ }
39
+ }
40
+ }
bp-groups/bp-groups-blocks.php CHANGED
@@ -12,29 +12,6 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  exit;
13
  }
14
 
15
- /**
16
- * Add BP Groups blocks specific settings to the BP Blocks Editor ones.
17
- *
18
- * @since 6.0.0
19
- *
20
- * @param array $bp_editor_settings BP blocks editor settings.
21
- * @return array BP Groups blocks editor settings.
22
- */
23
- function bp_groups_editor_settings( $bp_editor_settings = array() ) {
24
- $bp = buddypress();
25
-
26
- return array_merge(
27
- $bp_editor_settings,
28
- array(
29
- 'groups' => array(
30
- 'isAvatarEnabled' => $bp->avatar && $bp->avatar->show_avatars && ! bp_disable_group_avatar_uploads(),
31
- 'isCoverImageEnabled' => bp_is_active( 'groups', 'cover_image' ),
32
- ),
33
- )
34
- );
35
- }
36
- add_filter( 'bp_blocks_editor_settings', 'bp_groups_editor_settings' );
37
-
38
  /**
39
  * Callback function to render the BP Group Block.
40
  *
@@ -116,7 +93,7 @@ function bp_groups_render_group_block( $attributes = array() ) {
116
  esc_url( $group_link ),
117
  esc_url( $avatar ),
118
  /* Translators: %s is the group's name. */
119
- sprintf( esc_html__( 'Group Profile photo of %s', 'buddypress' ), $group_name )
120
  );
121
  }
122
 
@@ -264,12 +241,10 @@ function bp_groups_render_groups_block( $attributes = array() ) {
264
  $output .= sprintf(
265
  '<div class="item-header-avatar">
266
  <a href="%1$s">
267
- <img class="avatar" alt="%2$s" src="%3$s" />
268
  </a>
269
  </div>',
270
  esc_url( $group_link ),
271
- /* Translators: %s is the group's name. */
272
- sprintf( esc_attr__( 'Group Profile photo of %s', 'buddypress' ), $group->display_name ),
273
  esc_url(
274
  bp_core_fetch_avatar(
275
  array(
@@ -279,7 +254,9 @@ function bp_groups_render_groups_block( $attributes = array() ) {
279
  'html' => false,
280
  )
281
  )
282
- )
 
 
283
  );
284
  }
285
 
@@ -333,3 +310,231 @@ function bp_groups_render_groups_block( $attributes = array() ) {
333
  */
334
  return apply_filters( 'bp_groups_render_groups_block_output', $output, $block_args, $groups );
335
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  exit;
13
  }
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  /**
16
  * Callback function to render the BP Group Block.
17
  *
93
  esc_url( $group_link ),
94
  esc_url( $avatar ),
95
  /* Translators: %s is the group's name. */
96
+ sprintf( esc_attr__( 'Group Profile photo of %s', 'buddypress' ), esc_html( $group_name ) )
97
  );
98
  }
99
 
241
  $output .= sprintf(
242
  '<div class="item-header-avatar">
243
  <a href="%1$s">
244
+ <img loading="lazy" src="%2$s" alt="%3$s" class="avatar">
245
  </a>
246
  </div>',
247
  esc_url( $group_link ),
 
 
248
  esc_url(
249
  bp_core_fetch_avatar(
250
  array(
254
  'html' => false,
255
  )
256
  )
257
+ ),
258
+ /* Translators: %s is the group's name. */
259
+ sprintf( esc_attr__( 'Group Profile photo of %s', 'buddypress' ), esc_html( $group->name ) )
260
  );
261
  }
262
 
310
  */
311
  return apply_filters( 'bp_groups_render_groups_block_output', $output, $block_args, $groups );
312
  }
313
+
314
+ /**
315
+ * Adds specific script data for the BP Groups blocks.
316
+ *
317
+ * Only used for the BP Dynamic Groups block.
318
+ *
319
+ * @since 9.0.0
320
+ */
321
+ function bp_groups_blocks_add_script_data() {
322
+ $dynamic_groups_blocks = array_filter( buddypress()->groups->block_globals['bp/dynamic-groups']->items );
323
+
324
+ if ( ! $dynamic_groups_blocks ) {
325
+ return;
326
+ }
327
+
328
+ // Include the common JS template.
329
+ echo bp_get_dynamic_template_part( 'assets/widgets/dynamic-groups.php' );
330
+
331
+ // List the block specific props.
332
+ wp_add_inline_script(
333
+ 'bp-dynamic-groups-script',
334
+ sprintf( 'var bpDynamicGroupsBlocks = %s;', wp_json_encode( array_values( $dynamic_groups_blocks ) ) ),
335
+ 'before'
336
+ );
337
+ }
338
+
339
+ /**
340
+ * Callback function to render the Dynamic Groups Block.
341
+ *
342
+ * @since 9.0.0
343
+ *
344
+ * @param array $attributes The block attributes.
345
+ * @return string HTML output.
346
+ */
347
+ function bp_groups_render_dynamic_groups_block( $attributes = array() ) {
348
+ $block_args = wp_parse_args(
349
+ $attributes,
350
+ array(
351
+ 'title' => __( 'Groups', 'buddypress' ),
352
+ 'maxGroups' => 5,
353
+ 'groupDefault' => 'active',
354
+ 'linkTitle' => false,
355
+ )
356
+ );
357
+
358
+ $classnames = 'widget_bp_groups_widget buddypress widget';
359
+ $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
360
+
361
+ $max_groups = (int) $block_args['maxGroups'];
362
+ $no_groups = __( 'There are no groups to display.', 'buddypress' );
363
+
364
+ /** This filter is documented in buddypress/src/bp-groups/classes/class-bp-groups-widget.php */
365
+ $separator = apply_filters( 'bp_groups_widget_separator', '|' );
366
+
367
+ // Make sure the widget ID is unique.
368
+ $widget_id = uniqid( 'groups-list-' );
369
+ $groups_directory_link = bp_get_groups_directory_permalink();
370
+
371
+ // Set the Block's title.
372
+ if ( true === $block_args['linkTitle'] ) {
373
+ $widget_content = sprintf(
374
+ '<h2 class="widget-title"><a href="%1$s">%2$s</a></h2>',
375
+ esc_url( $groups_directory_link ),
376
+ esc_html( $block_args['title'] )
377
+ );
378
+ } else {
379
+ $widget_content = sprintf( '<h2 class="widget-title">%s</h2>', esc_html( $block_args['title'] ) );
380
+ }
381
+
382
+ $item_options = array(
383
+ 'newest' => array(
384
+ 'class' => '',
385
+ 'label' => __( 'Newest', 'buddypress' ),
386
+ ),
387
+ 'active' => array(
388
+ 'class' => '',
389
+ 'label' => __( 'Active', 'buddypress' ),
390
+ ),
391
+ 'popular' => array(
392
+ 'class' => '',
393
+ 'label' => __( 'Popular', 'buddypress' ),
394
+ ),
395
+ 'alphabetical' => array(
396
+ 'class' => '',
397
+ 'label' => __( 'Alphabetical', 'buddypress' ),
398
+ ),
399
+ );
400
+
401
+ $item_options_output = array();
402
+ $separator_output = sprintf( ' <span class="bp-separator" role="separator">%s</span> ', esc_html( $separator ) );
403
+
404
+ foreach ( $item_options as $item_type => $item_attr ) {
405
+ if ( $block_args['groupDefault'] === $item_type ) {
406
+ $item_attr['class'] = ' class="selected"';
407
+ }
408
+
409
+ $item_options_output[] = sprintf(
410
+ '<a href="%1$s" data-bp-sort="%2$s"%3$s>%4$s</a>',
411
+ esc_url( $groups_directory_link ),
412
+ esc_attr( $item_type ),
413
+ $item_attr['class'],
414
+ esc_html( $item_attr['label'] )
415
+ );
416
+ }
417
+
418
+ $preview = '';
419
+ $default_args = array(
420
+ 'type' => $block_args['groupDefault'],
421
+ 'per_page' => $max_groups,
422
+ 'populate_extras' => true,
423
+ );
424
+
425
+ // Previewing the Block inside the editor.
426
+ if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
427
+ $bp_query = groups_get_groups( $default_args );
428
+ $preview = sprintf( '<div class="widget-error">%s</div>', $no_groups );
429
+
430
+ if ( is_array( $bp_query['groups'] ) && 0 < count( $bp_query['groups'] ) ) {
431
+ $preview = '';
432
+ foreach ( $bp_query['groups'] as $group ) {
433
+ if ( 'newest' === $block_args['groupDefault'] ) {
434
+ /* translators: %s is time elapsed since the group was created */
435
+ $extra = sprintf( __( 'Created %s', 'buddypress' ), bp_get_group_date_created( $group ) );
436
+ } elseif ( 'popular' === $block_args['groupDefault'] ) {
437
+ $count = (int) $group->total_member_count;
438
+
439
+ /* translators: %s is the number of Group members */
440
+ $extra = sprintf( _n( '%s member', '%s members', $count, 'buddypress' ), bp_core_number_format( $count ) );
441
+ } else {
442
+ /* translators: %s: a human time diff. */
443
+ $extra = sprintf( __( 'Active %s', 'buddypress' ), bp_get_group_last_active( $group ) );
444
+ }
445
+
446
+ $preview .= bp_get_dynamic_template_part(
447
+ 'assets/widgets/dynamic-groups.php',
448
+ 'php',
449
+ array(
450
+ 'data.link' => bp_get_group_permalink( $group ),
451
+ 'data.name' => bp_get_group_name( $group ),
452
+ 'data.avatar_urls.thumb' => bp_core_fetch_avatar(
453
+ array(
454
+ 'item_id' => $group->id,
455
+ 'html' => false,
456
+ 'object' => 'group',
457
+ )
458
+ ),
459
+ 'data.avatar_alt' => esc_attr(
460
+ sprintf(
461
+ /* Translators: %s is the group's name. */
462
+ __( 'Group Profile photo of %s', 'buddypress' ),
463
+ $group->name
464
+ )
465
+ ),
466
+ 'data.id' => $group->id,
467
+ 'data.extra' => $extra,
468
+ )
469
+ );
470
+ }
471
+ }
472
+ } else {
473
+ // Get corresponding members.
474
+ $path = sprintf(
475
+ '/%1$s/%2$s/%3$s',
476
+ bp_rest_namespace(),
477
+ bp_rest_version(),
478
+ buddypress()->groups->id
479
+ );
480
+
481
+ $default_path = add_query_arg(
482
+ $default_args,
483
+ $path
484
+ );
485
+
486
+ $preloaded_groups = array();
487
+ if ( bp_is_running_wp( '5.0.0' ) ) {
488
+ $preloaded_groups = rest_preload_api_request( '', $default_path );
489
+ }
490
+
491
+ buddypress()->groups->block_globals['bp/dynamic-groups']->items[ $widget_id ] = (object) array(
492
+ 'selector' => $widget_id,
493
+ 'query_args' => $default_args,
494
+ 'preloaded' => reset( $preloaded_groups ),
495
+ );
496
+
497
+ // Only enqueue common/specific scripts and data once per page load.
498
+ if ( ! has_action( 'wp_footer', 'bp_groups_blocks_add_script_data', 1 ) ) {
499
+ wp_set_script_translations( 'bp-dynamic-groups-script', 'buddypress' );
500
+ wp_enqueue_script( 'bp-dynamic-groups-script' );
501
+ wp_localize_script(
502
+ 'bp-dynamic-groups-script',
503
+ 'bpDynamicGroupsSettings',
504
+ array(
505
+ 'path' => ltrim( $path, '/' ),
506
+ 'root' => esc_url_raw( get_rest_url() ),
507
+ 'nonce' => wp_create_nonce( 'wp_rest' ),
508
+ )
509
+ );
510
+
511
+ add_action( 'wp_footer', 'bp_groups_blocks_add_script_data', 1 );
512
+ }
513
+ }
514
+
515
+ $widget_content .= sprintf(
516
+ '<div class="item-options">
517
+ %1$s
518
+ </div>
519
+ <ul id="%2$s" class="item-list" aria-live="polite" aria-relevant="all" aria-atomic="true">
520
+ %3$s
521
+ </ul>',
522
+ implode( $separator_output, $item_options_output ),
523
+ esc_attr( $widget_id ),
524
+ $preview
525
+ );
526
+
527
+ // Adds a container to make sure the block is styled even when used into the Columns parent block.
528
+ $widget_content = sprintf( '<div class="bp-dynamic-block-container">%s</div>', "\n" . $widget_content . "\n" );
529
+
530
+ // Only add a block wrapper if not loaded into a Widgets sidebar.
531
+ if ( ! did_action( 'dynamic_sidebar_before' ) ) {
532
+ return sprintf(
533
+ '<div %1$s>%2$s</div>',
534
+ $wrapper_attributes,
535
+ $widget_content
536
+ );
537
+ }
538
+
539
+ return $widget_content;
540
+ }
bp-groups/bp-groups-cssjs.php CHANGED
@@ -63,3 +63,25 @@ function bp_groups_get_group_manage_members_script_data( $group_id = 0 ) {
63
  ),
64
  );
65
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  ),
64
  );
65
  }
66
+
67
+ /**
68
+ * Registers a new script to manage the dynamic part of the Dynamic groups widget/block.
69
+ *
70
+ * @since 9.0.0
71
+ *
72
+ * @param array $scripts Data about the scripts to register.
73
+ * @return array Data about the scripts to register.
74
+ */
75
+ function bp_groups_register_widget_block_scripts( $scripts = array() ) {
76
+ $scripts['bp-dynamic-groups-script'] = array(
77
+ 'file' => plugins_url( 'js/dynamic-groups.js', __FILE__ ),
78
+ 'dependencies' => array(
79
+ 'bp-dynamic-widget-block-script',
80
+ 'wp-i18n',
81
+ ),
82
+ 'footer' => true,
83
+ );
84
+
85
+ return $scripts;
86
+ }
87
+ add_filter( 'bp_core_register_common_scripts', 'bp_groups_register_widget_block_scripts', 9, 1 );
bp-groups/bp-groups-functions.php CHANGED
@@ -2117,7 +2117,7 @@ function groups_accept_membership_request( $membership_id, $user_id = 0, $group_
2117
  function groups_reject_membership_request( $membership_id, $user_id = 0, $group_id = 0 ) {
2118
 
2119
  if ( ! empty( $membership_id ) ){
2120
- _deprecated_argument( __METHOD__, '5.0.0', sprintf( __( 'Argument `membership_id` passed to %1$s is deprecated. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
2121
  }
2122
 
2123
  if ( ! groups_delete_membership_request( false, $user_id, $group_id ) ) {
@@ -2155,7 +2155,7 @@ function groups_reject_membership_request( $membership_id, $user_id = 0, $group_
2155
  function groups_delete_membership_request( $membership_id, $user_id = 0, $group_id = 0 ) {
2156
  if ( ! empty( $membership_id ) ){
2157
  /* translators: 1: method name. 2: file name. */
2158
- _deprecated_argument( __METHOD__, '5.0.0', sprintf( __( 'Argument `membership_id` passed to %1$s is deprecated. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
2159
  }
2160
 
2161
  if ( empty( $user_id ) || empty( $group_id ) ) {
2117
  function groups_reject_membership_request( $membership_id, $user_id = 0, $group_id = 0 ) {
2118
 
2119
  if ( ! empty( $membership_id ) ){
2120
+ _deprecated_argument( __METHOD__, '5.0.0', sprintf( __( 'Argument `membership_id` passed to %1$s is deprecated. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
2121
  }
2122
 
2123
  if ( ! groups_delete_membership_request( false, $user_id, $group_id ) ) {
2155
  function groups_delete_membership_request( $membership_id, $user_id = 0, $group_id = 0 ) {
2156
  if ( ! empty( $membership_id ) ){
2157
  /* translators: 1: method name. 2: file name. */
2158
+ _deprecated_argument( __METHOD__, '5.0.0', sprintf( __( 'Argument `membership_id` passed to %1$s is deprecated. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
2159
  }
2160
 
2161
  if ( empty( $user_id ) || empty( $group_id ) ) {
bp-groups/classes/class-bp-groups-component.php CHANGED
@@ -261,6 +261,11 @@ class BP_Groups_Component extends BP_Component {
261
  'search_string' => _x( 'Search Groups...', 'Component directory search', 'buddypress' ),
262
  'global_tables' => $global_tables,
263
  'meta_tables' => $meta_tables,
 
 
 
 
 
264
  );
265
 
266
  parent::setup_globals( $args );
@@ -978,11 +983,9 @@ class BP_Groups_Component extends BP_Component {
978
  'wp-element',
979
  'wp-components',
980
  'wp-i18n',
981
- 'wp-editor',
982
- 'wp-compose',
983
- 'wp-data',
984
  'wp-block-editor',
985
  'bp-block-components',
 
986
  ),
987
  'style' => 'bp-group-block',
988
  'style_url' => plugins_url( 'css/blocks/group.css', dirname( __FILE__ ) ),
@@ -1019,12 +1022,11 @@ class BP_Groups_Component extends BP_Component {
1019
  'wp-element',
1020
  'wp-components',
1021
  'wp-i18n',
1022
- 'wp-compose',
1023
- 'wp-data',
1024
  'wp-api-fetch',
1025
  'wp-url',
1026
  'wp-block-editor',
1027
  'bp-block-components',
 
1028
  'lodash',
1029
  ),
1030
  'style' => 'bp-groups-block',
@@ -1061,6 +1063,40 @@ class BP_Groups_Component extends BP_Component {
1061
  ),
1062
  'render_callback' => 'bp_groups_render_groups_block',
1063
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1064
  )
1065
  );
1066
  }
261
  'search_string' => _x( 'Search Groups...', 'Component directory search', 'buddypress' ),
262
  'global_tables' => $global_tables,
263
  'meta_tables' => $meta_tables,
264
+ 'block_globals' => array(
265
+ 'bp/dynamic-groups' => array(
266
+ 'widget_classnames' => array( 'widget_bp_groups_widget', 'buddypress' ),
267
+ ),
268
+ ),
269
  );
270
 
271
  parent::setup_globals( $args );
983
  'wp-element',
984
  'wp-components',
985
  'wp-i18n',
 
 
 
986
  'wp-block-editor',
987
  'bp-block-components',
988
+ 'bp-block-data',
989
  ),
990
  'style' => 'bp-group-block',
991
  'style_url' => plugins_url( 'css/blocks/group.css', dirname( __FILE__ ) ),
1022
  'wp-element',
1023
  'wp-components',
1024
  'wp-i18n',
 
 
1025
  'wp-api-fetch',
1026
  'wp-url',
1027
  'wp-block-editor',
1028
  'bp-block-components',
1029
+ 'bp-block-data',
1030
  'lodash',
1031
  ),
1032
  'style' => 'bp-groups-block',
1063
  ),
1064
  'render_callback' => 'bp_groups_render_groups_block',
1065
  ),
1066
+ 'bp/dynamic-groups' => array(
1067
+ 'name' => 'bp/dynamic-groups',
1068
+ 'editor_script' => 'bp-dynamic-groups-block',
1069
+ 'editor_script_url' => plugins_url( 'js/blocks/dynamic-groups.js', dirname( __FILE__ ) ),
1070
+ 'editor_script_deps' => array(
1071
+ 'wp-blocks',
1072
+ 'wp-element',
1073
+ 'wp-components',
1074
+ 'wp-i18n',
1075
+ 'wp-block-editor',
1076
+ 'bp-block-components',
1077
+ ),
1078
+ 'style' => 'bp-dynamic-groups-block',
1079
+ 'style_url' => plugins_url( 'css/blocks/dynamic-groups.css', dirname( __FILE__ ) ),
1080
+ 'attributes' => array(
1081
+ 'title' => array(
1082
+ 'type' => 'string',
1083
+ 'default' => __( 'Groups', 'buddypress' ),
1084
+ ),
1085
+ 'maxGroups' => array(
1086
+ 'type' => 'number',
1087
+ 'default' => 5,
1088
+ ),
1089
+ 'groupDefault' => array(
1090
+ 'type' => 'string',
1091
+ 'default' => 'active',
1092
+ ),
1093
+ 'linkTitle' => array(
1094
+ 'type' => 'boolean',
1095
+ 'default' => false,
1096
+ ),
1097
+ ),
1098
+ 'render_callback' => 'bp_groups_render_dynamic_groups_block',
1099
+ ),
1100
  )
1101
  );
1102
  }
bp-groups/classes/class-bp-groups-widget.php CHANGED
@@ -21,16 +21,18 @@ class BP_Groups_Widget extends WP_Widget {
21
  * Working as a group, we get things done better.
22
  *
23
  * @since 1.0.3
 
24
  */
25
  public function __construct() {
26
  $widget_ops = array(
27
  'description' => __( 'A dynamic list of recently active, popular, newest, or alphabetical groups', 'buddypress' ),
28
  'classname' => 'widget_bp_groups_widget buddypress widget',
29
  'customize_selective_refresh' => true,
 
30
  );
31
  parent::__construct( false, _x( '(BuddyPress) Groups', 'widget name', 'buddypress' ), $widget_ops );
32
 
33
- if ( is_customize_preview() || is_active_widget( false, false, $this->id_base ) ) {
34
  add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
35
  }
36
  }
21
  * Working as a group, we get things done better.
22
  *
23
  * @since 1.0.3
24
+ * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options.
25
  */
26
  public function __construct() {
27
  $widget_ops = array(
28
  'description' => __( 'A dynamic list of recently active, popular, newest, or alphabetical groups', 'buddypress' ),
29
  'classname' => 'widget_bp_groups_widget buddypress widget',
30
  'customize_selective_refresh' => true,
31
+ 'show_instance_in_rest' => true,
32
  );
33
  parent::__construct( false, _x( '(BuddyPress) Groups', 'widget name', 'buddypress' ), $widget_ops );
34
 
35
+ if ( is_customize_preview() || bp_is_widget_block_active( '', $this->id_base ) ) {
36
  add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
37
  }
38
  }
bp-groups/classes/class-bp-rest-attachments-group-avatar-endpoint.php CHANGED
@@ -119,8 +119,8 @@ class BP_REST_Attachments_Group_Avatar_Endpoint extends WP_REST_Controller {
119
  'object' => $this->object,
120
  'type' => $type,
121
  'item_id' => (int) $this->group->id,
122
- 'html' => (bool) $request['html'],
123
- 'alt' => $request['alt'],
124
  )
125
  );
126
  }
@@ -403,7 +403,7 @@ class BP_REST_Attachments_Group_Avatar_Endpoint extends WP_REST_Controller {
403
  'thumb' => $avatar->thumb,
404
  );
405
 
406
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
407
  $data = $this->add_additional_fields_to_object( $data, $request );
408
  $data = $this->filter_response_by_context( $data, $context );
409
  $response = rest_ensure_response( $data );
119
  'object' => $this->object,
120
  'type' => $type,
121
  'item_id' => (int) $this->group->id,
122
+ 'html' => (bool) $request->get_param( 'html' ),
123
+ 'alt' => $request->get_param( 'alt' ),
124
  )
125
  );
126
  }
403
  'thumb' => $avatar->thumb,
404
  );
405
 
406
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
407
  $data = $this->add_additional_fields_to_object( $data, $request );
408
  $data = $this->filter_response_by_context( $data, $context );
409
  $response = rest_ensure_response( $data );
bp-groups/classes/class-bp-rest-attachments-group-cover-endpoint.php CHANGED
@@ -386,7 +386,7 @@ class BP_REST_Attachments_Group_Cover_Endpoint extends WP_REST_Controller {
386
  'image' => $cover_url,
387
  );
388
 
389
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
390
  $data = $this->add_additional_fields_to_object( $data, $request );
391
  $data = $this->filter_response_by_context( $data, $context );
392
  $response = rest_ensure_response( $data );
386
  'image' => $cover_url,
387
  );
388
 
389
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
390
  $data = $this->add_additional_fields_to_object( $data, $request );
391
  $data = $this->filter_response_by_context( $data, $context );
392
  $response = rest_ensure_response( $data );
bp-groups/classes/class-bp-rest-group-invites-endpoint.php CHANGED
@@ -113,11 +113,11 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
113
  */
114
  public function get_items( $request ) {
115
  $args = array(
116
- 'item_id' => $request['group_id'],
117
- 'user_id' => $request['user_id'],
118
- 'invite_sent' => $request['invite_sent'],
119
- 'per_page' => $request['per_page'],
120
- 'page' => $request['page'],
121
  );
122
 
123
  /**
@@ -125,8 +125,8 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
125
  * but if it is zero for invitations, we can safely ignore it and should.
126
  * So, only apply non-zero inviter_ids.
127
  */
128
- if ( $request['inviter_id'] ) {
129
- $args['inviter_id'] = $request['inviter_id'];
130
  }
131
 
132
  // If the query is not restricted by group, user or inviter, limit it to the current user, if not an admin.
@@ -190,10 +190,10 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
190
  )
191
  );
192
  $retval = $error;
193
- $group_id = (int) $request['group_id'];
194
  $current_user_id = (int) bp_loggedin_user_id();
195
- $user_id_arg = (int) $request['user_id'];
196
- $inviter_id = (int) $request['inviter_id'];
197
 
198
  if ( ! is_user_logged_in() ) {
199
  $retval = new WP_Error(
@@ -264,8 +264,8 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
264
  } else {
265
  $retval = $error;
266
  }
267
- } elseif ( $request['inviter_id'] ) {
268
- $inviter = bp_rest_get_user( $request['inviter_id'] );
269
 
270
  // Check the inviter is valid.
271
  if ( ! $inviter instanceof WP_User ) {
@@ -308,7 +308,7 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
308
  * @return WP_REST_Response|WP_Error
309
  */
310
  public function get_item( $request ) {
311
- $invite = $this->fetch_single_invite( $request['invite_id'] );
312
  $retval = $this->prepare_response_for_collection(
313
  $this->prepare_item_for_response( $invite, $request )
314
  );
@@ -356,7 +356,7 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
356
  )
357
  );
358
  } else {
359
- $invite = $this->fetch_single_invite( $request['invite_id'] );
360
 
361
  if ( ! $invite ) {
362
  $retval = new WP_Error(
@@ -406,9 +406,9 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
406
  * @return WP_REST_Response|WP_Error
407
  */
408
  public function create_item( $request ) {
409
- $inviter_id_arg = $request['inviter_id'] ? $request['inviter_id'] : bp_loggedin_user_id();
410
- $group = $this->groups_endpoint->get_group_object( $request['group_id'] );
411
- $user = bp_rest_get_user( $request['user_id'] );
412
  $inviter = bp_rest_get_user( $inviter_id_arg );
413
 
414
  $invite_id = groups_invite_user(
@@ -416,8 +416,8 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
416
  'user_id' => $user->ID,
417
  'group_id' => $group->id,
418
  'inviter_id' => $inviter->ID,
419
- 'send_invite' => isset( $request['invite_sent'] ) ? (bool) $request['invite_sent'] : 1,
420
- 'content' => $request['message'],
421
  )
422
  );
423
 
@@ -470,7 +470,7 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
470
  * @return true|WP_Error
471
  */
472
  public function create_item_permissions_check( $request ) {
473
- $inviter_id_arg = $request['inviter_id'] ? $request['inviter_id'] : bp_loggedin_user_id();
474
  $retval = new WP_Error(
475
  'bp_rest_authorization_required',
476
  __( 'Sorry, you are not allowed to perform this action.', 'buddypress' ),
@@ -488,7 +488,7 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
488
  )
489
  );
490
  } else {
491
- $user = bp_rest_get_user( $request['user_id'] );
492
  $inviter = bp_rest_get_user( $inviter_id_arg );
493
 
494
  if ( empty( $user->ID ) || empty( $inviter->ID ) || $user->ID === $inviter->ID ) {
@@ -500,7 +500,7 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
500
  )
501
  );
502
  } else {
503
- $group = $this->groups_endpoint->get_group_object( $request['group_id'] );
504
 
505
  if ( empty( $group->id ) ) {
506
  $retval = new WP_Error(
@@ -548,7 +548,7 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
548
  public function update_item( $request ) {
549
  $request->set_param( 'context', 'edit' );
550
 
551
- $invite = $this->fetch_single_invite( $request['invite_id'] );
552
  $accept = groups_accept_invite( $invite->user_id, $invite->item_id );
553
  if ( ! $accept ) {
554
  return new WP_Error(
@@ -613,7 +613,7 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
613
  )
614
  );
615
  } else {
616
- $invite = $this->fetch_single_invite( $request['invite_id'] );
617
 
618
  if ( ! $invite ) {
619
  $retval = new WP_Error(
@@ -659,7 +659,7 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
659
  $request->set_param( 'context', 'edit' );
660
 
661
  $user_id = bp_loggedin_user_id();
662
- $invite = $this->fetch_single_invite( $request['invite_id'] );
663
 
664
  // Set the invite response before it is deleted.
665
  $previous = $this->prepare_item_for_response( $invite, $request );
@@ -726,7 +726,7 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
726
  public function delete_item_permissions_check( $request ) {
727
  $retval = true;
728
  $user_id = bp_loggedin_user_id();
729
- $invite = $this->fetch_single_invite( $request['invite_id'] );
730
 
731
  if ( ! $user_id ) {
732
  $retval = new WP_Error(
@@ -798,7 +798,7 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
798
  ),
799
  );
800
 
801
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
802
  $data = $this->add_additional_fields_to_object( $data, $request );
803
  $data = $this->filter_response_by_context( $data, $context );
804
  $response = rest_ensure_response( $data );
@@ -838,7 +838,7 @@ class BP_REST_Group_Invites_Endpoint extends WP_REST_Controller {
838
  'href' => rest_url( $base ),
839
  ),
840
  'user' => array(
841
- 'href' => rest_url( bp_rest_get_user_url( $invite->user_id ) ),
842
  'embeddable' => true,
843
  ),
844
  );
113
  */
114
  public function get_items( $request ) {
115
  $args = array(
116
+ 'item_id' => $request->get_param( 'group_id' ),
117
+ 'user_id' => $request->get_param( 'user_id' ),
118
+ 'invite_sent' => $request->get_param( 'invite_sent' ),
119
+ 'per_page' => $request->get_param( 'per_page' ),
120
+ 'page' => $request->get_param( 'page' ),
121
  );
122
 
123
  /**
125
  * but if it is zero for invitations, we can safely ignore it and should.
126
  * So, only apply non-zero inviter_ids.
127
  */
128
+ if ( $request->get_param( 'inviter_id' ) ) {
129
+ $args['inviter_id'] = $request->get_param( 'inviter_id' );
130
  }
131
 
132
  // If the query is not restricted by group, user or inviter, limit it to the current user, if not an admin.
190
  )
191
  );
192
  $retval = $error;
193
+ $group_id = (int) $request->get_param( 'group_id' );
194
  $current_user_id = (int) bp_loggedin_user_id();
195
+ $user_id_arg = (int) $request->get_param( 'user_id' );
196
+ $inviter_id = (int) $request->get_param( 'inviter_id' );
197
 
198
  if ( ! is_user_logged_in() ) {
199
  $retval = new WP_Error(
264
  } else {
265
  $retval = $error;
266
  }
267
+ } elseif ( $inviter_id ) {
268
+ $inviter = bp_rest_get_user( $inviter_id );
269
 
270
  // Check the inviter is valid.
271
  if ( ! $inviter instanceof WP_User ) {
308
  * @return WP_REST_Response|WP_Error
309
  */
310
  public function get_item( $request ) {
311
+ $invite = $this->fetch_single_invite( $request->get_param( 'invite_id' ) );
312
  $retval = $this->prepare_response_for_collection(
313
  $this->prepare_item_for_response( $invite, $request )
314
  );
356
  )
357
  );
358
  } else {
359
+ $invite = $this->fetch_single_invite( $request->get_param( 'invite_id' ) );
360
 
361
  if ( ! $invite ) {
362
  $retval = new WP_Error(
406
  * @return WP_REST_Response|WP_Error
407
  */
408
  public function create_item( $request ) {
409
+ $inviter_id_arg = ! empty( $request->get_param( 'inviter_id' ) ) ? $request->get_param( 'inviter_id' ) : bp_loggedin_user_id();
410
+ $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
411
+ $user = bp_rest_get_user( $request->get_param( 'user_id' ) );
412
  $inviter = bp_rest_get_user( $inviter_id_arg );
413
 
414
  $invite_id = groups_invite_user(
416
  'user_id' => $user->ID,
417
  'group_id' => $group->id,
418
  'inviter_id' => $inviter->ID,
419
+ 'send_invite' => ! empty( $request->get_param( 'invite_sent' ) ) ? (bool) $request->get_param( 'invite_sent' ) : 1,
420
+ 'content' => $request->get_param( 'message' ),
421
  )
422
  );
423
 
470
  * @return true|WP_Error
471
  */
472
  public function create_item_permissions_check( $request ) {
473
+ $inviter_id_arg = ! empty( $request->get_param( 'inviter_id' ) ) ? $request->get_param( 'inviter_id' ) : bp_loggedin_user_id();
474
  $retval = new WP_Error(
475
  'bp_rest_authorization_required',
476
  __( 'Sorry, you are not allowed to perform this action.', 'buddypress' ),
488
  )
489
  );
490
  } else {
491
+ $user = bp_rest_get_user( $request->get_param( 'user_id' ) );
492
  $inviter = bp_rest_get_user( $inviter_id_arg );
493
 
494
  if ( empty( $user->ID ) || empty( $inviter->ID ) || $user->ID === $inviter->ID ) {
500
  )
501
  );
502
  } else {
503
+ $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
504
 
505
  if ( empty( $group->id ) ) {
506
  $retval = new WP_Error(
548
  public function update_item( $request ) {
549
  $request->set_param( 'context', 'edit' );
550
 
551
+ $invite = $this->fetch_single_invite( $request->get_param( 'invite_id' ) );
552
  $accept = groups_accept_invite( $invite->user_id, $invite->item_id );
553
  if ( ! $accept ) {
554
  return new WP_Error(
613
  )
614
  );
615
  } else {
616
+ $invite = $this->fetch_single_invite( $request->get_param( 'invite_id' ) );
617
 
618
  if ( ! $invite ) {
619
  $retval = new WP_Error(
659
  $request->set_param( 'context', 'edit' );
660
 
661
  $user_id = bp_loggedin_user_id();
662
+ $invite = $this->fetch_single_invite( $request->get_param( 'invite_id' ) );
663
 
664
  // Set the invite response before it is deleted.
665
  $previous = $this->prepare_item_for_response( $invite, $request );
726
  public function delete_item_permissions_check( $request ) {
727
  $retval = true;
728
  $user_id = bp_loggedin_user_id();
729
+ $invite = $this->fetch_single_invite( $request->get_param( 'invite_id' ) );
730
 
731
  if ( ! $user_id ) {
732
  $retval = new WP_Error(
798
  ),
799
  );
800
 
801
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
802
  $data = $this->add_additional_fields_to_object( $data, $request );
803
  $data = $this->filter_response_by_context( $data, $context );
804
  $response = rest_ensure_response( $data );
838
  'href' => rest_url( $base ),
839
  ),
840
  'user' => array(
841
+ 'href' => bp_rest_get_object_url( $invite->user_id, 'members' ),
842
  'embeddable' => true,
843
  ),
844
  );
bp-groups/classes/class-bp-rest-group-membership-endpoint.php CHANGED
@@ -123,14 +123,14 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
123
  $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
124
  $args = array(
125
  'group_id' => $group->id,
126
- 'group_role' => $request['roles'],
127
- 'type' => $request['status'],
128
- 'per_page' => $request['per_page'],
129
- 'page' => $request['page'],
130
- 'search_terms' => $request['search'],
131
- 'exclude' => $request['exclude'],
132
- 'exclude_admins_mods' => (bool) $request['exclude_admins'],
133
- 'exclude_banned' => (bool) $request['exclude_banned'],
134
  );
135
 
136
  if ( empty( $args['exclude'] ) ) {
@@ -197,7 +197,7 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
197
  'status' => rest_authorization_required_code(),
198
  )
199
  );
200
- $group = $this->groups_endpoint->get_group_object( $request['group_id'] );
201
 
202
  if ( empty( $group->id ) ) {
203
  $retval = new WP_Error(
@@ -231,10 +231,10 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
231
  * @return WP_REST_Response|WP_Error
232
  */
233
  public function create_item( $request ) {
234
- $user = bp_rest_get_user( $request['user_id'] );
235
- $group = $this->groups_endpoint->get_group_object( $request['group_id'] );
236
 
237
- if ( ! $request['context'] || 'view' === $request['context'] ) {
238
  if ( ! groups_join_group( $group->id, $user->ID ) ) {
239
  return new WP_Error(
240
  'bp_rest_group_member_failed_to_join',
@@ -248,7 +248,7 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
248
  // Get the group member.
249
  $group_member = new BP_Groups_Member( $user->ID, $group->id );
250
  } else {
251
- $role = $request['role'];
252
  $group_id = $group->id;
253
  $group_member = new BP_Groups_Member( $user->ID, $group_id );
254
 
@@ -332,7 +332,7 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
332
  )
333
  );
334
  } else {
335
- $user = bp_rest_get_user( $request['user_id'] );
336
  $loggedin_user_id = bp_loggedin_user_id();
337
 
338
  if ( ! $user instanceof WP_User ) {
@@ -344,7 +344,7 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
344
  )
345
  );
346
  } else {
347
- $group = $this->groups_endpoint->get_group_object( $request['group_id'] );
348
 
349
  if ( ! $group instanceof BP_Groups_Group ) {
350
  $retval = new WP_Error(
@@ -388,10 +388,10 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
388
  * @return WP_REST_Response|WP_Error
389
  */
390
  public function update_item( $request ) {
391
- $user = bp_rest_get_user( $request['user_id'] );
392
- $group = $this->groups_endpoint->get_group_object( $request['group_id'] );
393
- $action = $request['action'];
394
- $role = $request['role'];
395
  $group_id = $group->id;
396
  $group_member = new BP_Groups_Member( $user->ID, $group_id );
397
 
@@ -487,7 +487,7 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
487
  )
488
  );
489
  } else {
490
- $user = bp_rest_get_user( $request['user_id'] );
491
  $loggedin_user_id = bp_loggedin_user_id();
492
 
493
  if ( ! $user instanceof WP_User ) {
@@ -499,7 +499,7 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
499
  )
500
  );
501
  } else {
502
- $group = $this->groups_endpoint->get_group_object( $request['group_id'] );
503
 
504
  if ( ! $group instanceof BP_Groups_Group ) {
505
  $retval = new WP_Error(
@@ -511,7 +511,7 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
511
  );
512
  } elseif ( bp_current_user_can( 'bp_moderate' ) ) {
513
  $retval = true;
514
- } elseif ( in_array( $request['action'], array( 'ban', 'unban', 'promote', 'demote' ), true ) ) {
515
  if ( groups_is_user_admin( $loggedin_user_id, $group->id ) ) {
516
  if ( $loggedin_user_id !== $user->ID ) {
517
  $retval = true;
@@ -533,8 +533,8 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
533
  );
534
 
535
  $retval = new WP_Error(
536
- 'bp_rest_group_member_cannot_' . $request['action'],
537
- $messages[ $request['action'] ],
538
  array(
539
  'status' => rest_authorization_required_code(),
540
  )
@@ -568,7 +568,7 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
568
  $request->set_param( 'context', 'edit' );
569
 
570
  // Get the Group member before it's removed.
571
- $member = new BP_Groups_Member( $request['user_id'], $request['group_id'] );
572
  $previous = $this->prepare_item_for_response( $member, $request );
573
 
574
  if ( ! $member->remove() ) {
@@ -590,8 +590,8 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
590
  )
591
  );
592
 
593
- $user = bp_rest_get_user( $request['user_id'] );
594
- $group = $this->groups_endpoint->get_group_object( $request['group_id'] );
595
 
596
  /**
597
  * Fires after a group member is deleted via the REST API.
@@ -636,7 +636,7 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
636
  )
637
  );
638
  } else {
639
- $user = bp_rest_get_user( $request['user_id'] );
640
  $loggedin_user_id = bp_loggedin_user_id();
641
 
642
  if ( ! $user instanceof WP_User ) {
@@ -648,7 +648,7 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
648
  )
649
  );
650
  } else {
651
- $group = $this->groups_endpoint->get_group_object( $request['group_id'] );
652
 
653
  if ( ! $group instanceof BP_Groups_Group ) {
654
  $retval = new WP_Error(
@@ -699,7 +699,7 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
699
  */
700
  public function prepare_item_for_response( $group_member, $request ) {
701
  $user = bp_rest_get_user( $group_member->user_id );
702
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
703
  $member_data = $this->members_endpoint->user_data( $user, $context, $request );
704
  $group_member->group_id = $request->get_param( 'group_id' );
705
 
@@ -748,7 +748,7 @@ class BP_REST_Group_Membership_Endpoint extends WP_REST_Controller {
748
  // Entity meta.
749
  $links = array(
750
  'self' => array(
751
- 'href' => rest_url( bp_rest_get_user_url( $group_member->user_id ) ),
752
  ),
753
  'collection' => array(
754
  'href' => rest_url( sprintf( '/%s/%d/members', $base, $group_member->group_id ) ),
123
  $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
124
  $args = array(
125
  'group_id' => $group->id,
126
+ 'group_role' => $request->get_param( 'roles' ),
127
+ 'type' => $request->get_param( 'status' ),
128
+ 'per_page' => $request->get_param( 'per_page' ),
129
+ 'page' => $request->get_param( 'page' ),
130
+ 'search_terms' => $request->get_param( 'search' ),
131
+ 'exclude' => $request->get_param( 'exclude' ),
132
+ 'exclude_admins_mods' => (bool) $request->get_param( 'exclude_admins' ),
133
+ 'exclude_banned' => (bool) $request->get_param( 'exclude_banned' ),
134
  );
135
 
136
  if ( empty( $args['exclude'] ) ) {
197
  'status' => rest_authorization_required_code(),
198
  )
199
  );
200
+ $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
201
 
202
  if ( empty( $group->id ) ) {
203
  $retval = new WP_Error(
231
  * @return WP_REST_Response|WP_Error
232
  */
233
  public function create_item( $request ) {
234
+ $user = bp_rest_get_user( $request->get_param( 'user_id' ) );
235
+ $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
236
 
237
+ if ( ! $request->get_param( 'context' ) || 'view' === $request->get_param( 'context' ) ) {
238
  if ( ! groups_join_group( $group->id, $user->ID ) ) {
239
  return new WP_Error(
240
  'bp_rest_group_member_failed_to_join',
248
  // Get the group member.
249
  $group_member = new BP_Groups_Member( $user->ID, $group->id );
250
  } else {
251
+ $role = $request->get_param( 'role' );
252
  $group_id = $group->id;
253
  $group_member = new BP_Groups_Member( $user->ID, $group_id );
254
 
332
  )
333
  );
334
  } else {
335
+ $user = bp_rest_get_user( $request->get_param( 'user_id' ) );
336
  $loggedin_user_id = bp_loggedin_user_id();
337
 
338
  if ( ! $user instanceof WP_User ) {
344
  )
345
  );
346
  } else {
347
+ $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
348
 
349
  if ( ! $group instanceof BP_Groups_Group ) {
350
  $retval = new WP_Error(
388
  * @return WP_REST_Response|WP_Error
389
  */
390
  public function update_item( $request ) {
391
+ $user = bp_rest_get_user( $request->get_param( 'user_id' ) );
392
+ $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
393
+ $action = $request->get_param( 'action' );
394
+ $role = $request->get_param( 'role' );
395
  $group_id = $group->id;
396
  $group_member = new BP_Groups_Member( $user->ID, $group_id );
397
 
487
  )
488
  );
489
  } else {
490
+ $user = bp_rest_get_user( $request->get_param( 'user_id' ) );
491
  $loggedin_user_id = bp_loggedin_user_id();
492
 
493
  if ( ! $user instanceof WP_User ) {
499
  )
500
  );
501
  } else {
502
+ $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
503
 
504
  if ( ! $group instanceof BP_Groups_Group ) {
505
  $retval = new WP_Error(
511
  );
512
  } elseif ( bp_current_user_can( 'bp_moderate' ) ) {
513
  $retval = true;
514
+ } elseif ( in_array( $request->get_param( 'action' ), array( 'ban', 'unban', 'promote', 'demote' ), true ) ) {
515
  if ( groups_is_user_admin( $loggedin_user_id, $group->id ) ) {
516
  if ( $loggedin_user_id !== $user->ID ) {
517
  $retval = true;
533
  );
534
 
535
  $retval = new WP_Error(
536
+ 'bp_rest_group_member_cannot_' . $request->get_param( 'action' ),
537
+ $messages[ $request->get_param( 'action' ) ],
538
  array(
539
  'status' => rest_authorization_required_code(),
540
  )
568
  $request->set_param( 'context', 'edit' );
569
 
570
  // Get the Group member before it's removed.
571
+ $member = new BP_Groups_Member( $request->get_param( 'user_id' ), $request->get_param( 'group_id' ) );
572
  $previous = $this->prepare_item_for_response( $member, $request );
573
 
574
  if ( ! $member->remove() ) {
590
  )
591
  );
592
 
593
+ $user = bp_rest_get_user( $request->get_param( 'user_id' ) );
594
+ $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
595
 
596
  /**
597
  * Fires after a group member is deleted via the REST API.
636
  )
637
  );
638
  } else {
639
+ $user = bp_rest_get_user( $request->get_param( 'user_id' ) );
640
  $loggedin_user_id = bp_loggedin_user_id();
641
 
642
  if ( ! $user instanceof WP_User ) {
648
  )
649
  );
650
  } else {
651
+ $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
652
 
653
  if ( ! $group instanceof BP_Groups_Group ) {
654
  $retval = new WP_Error(
699
  */
700
  public function prepare_item_for_response( $group_member, $request ) {
701
  $user = bp_rest_get_user( $group_member->user_id );
702
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
703
  $member_data = $this->members_endpoint->user_data( $user, $context, $request );
704
  $group_member->group_id = $request->get_param( 'group_id' );
705
 
748
  // Entity meta.
749
  $links = array(
750
  'self' => array(
751
+ 'href' => bp_rest_get_object_url( $group_member->user_id, 'members' ),
752
  ),
753
  'collection' => array(
754
  'href' => rest_url( sprintf( '/%s/%d/members', $base, $group_member->group_id ) ),
bp-groups/classes/class-bp-rest-group-membership-request-endpoint.php CHANGED
@@ -123,10 +123,10 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
123
  */
124
  public function get_items( $request ) {
125
  $args = array(
126
- 'item_id' => $request['group_id'],
127
- 'user_id' => $request['user_id'],
128
- 'per_page' => $request['per_page'],
129
- 'page' => $request['page'],
130
  );
131
 
132
  // If the query is not restricted by group or user, limit it to the current user, if not an admin.
@@ -187,11 +187,11 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
187
  )
188
  );
189
  $user_id = bp_loggedin_user_id();
190
- $user_id_arg = $request['user_id'];
191
- $group = $this->groups_endpoint->get_group_object( $request['group_id'] );
192
 
193
  // If the query is not restricted by group or user, limit it to the current user, if not an admin.
194
- if ( ! $request['group_id'] && ! $request['user_id'] && ! bp_current_user_can( 'bp_moderate' ) ) {
195
  $user_id_arg = $user_id;
196
  }
197
  $user = bp_rest_get_user( $user_id_arg );
@@ -204,7 +204,7 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
204
  'status' => rest_authorization_required_code(),
205
  )
206
  );
207
- } elseif ( $request['group_id'] && ! $group instanceof BP_Groups_Group ) {
208
  $retval = new WP_Error(
209
  'bp_rest_group_invalid_id',
210
  __( 'Invalid group ID.', 'buddypress' ),
@@ -220,7 +220,11 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
220
  'status' => 404,
221
  )
222
  );
223
- } elseif ( bp_current_user_can( 'bp_moderate' ) || ( $request['group_id'] && groups_is_user_admin( $user_id, $request['group_id'] ) ) || $user_id_arg === $user_id ) {
 
 
 
 
224
  $retval = true;
225
  } else {
226
  $retval = new WP_Error(
@@ -252,7 +256,7 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
252
  * @return WP_REST_Response|WP_Error
253
  */
254
  public function get_item( $request ) {
255
- $group_request = $this->fetch_single_membership_request( $request['request_id'] );
256
  $retval = $this->prepare_response_for_collection(
257
  $this->prepare_item_for_response( $group_request, $request )
258
  );
@@ -290,7 +294,7 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
290
  )
291
  );
292
  $user_id = bp_loggedin_user_id();
293
- $group_request = $this->fetch_single_membership_request( $request['request_id'] );
294
 
295
  if ( ! $user_id ) {
296
  $retval = new WP_Error(
@@ -340,9 +344,9 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
340
  * @return WP_REST_Response|WP_Error
341
  */
342
  public function create_item( $request ) {
343
- $user_id_arg = $request['user_id'] ? $request['user_id'] : bp_loggedin_user_id();
344
  $user = bp_rest_get_user( $user_id_arg );
345
- $group = $this->groups_endpoint->get_group_object( $request['group_id'] );
346
 
347
  // Avoid duplicate requests.
348
  if ( groups_check_for_membership_request( $user->ID, $group->id ) ) {
@@ -359,7 +363,7 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
359
  array(
360
  'group_id' => $group->id,
361
  'user_id' => $user->ID,
362
- 'content' => $request['message'],
363
  )
364
  );
365
 
@@ -419,9 +423,9 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
419
  )
420
  );
421
  $user_id = bp_loggedin_user_id();
422
- $user_id_arg = $request['user_id'] ? $request['user_id'] : $user_id;
423
  $user = bp_rest_get_user( $user_id_arg );
424
- $group = $this->groups_endpoint->get_group_object( $request['group_id'] );
425
 
426
  // User must be logged in.
427
  if ( ! is_user_logged_in() ) {
@@ -480,7 +484,7 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
480
  * @return WP_REST_Response|WP_Error
481
  */
482
  public function update_item( $request ) {
483
- $group_request = $this->fetch_single_membership_request( $request['request_id'] );
484
  $success = groups_accept_membership_request( false, $group_request->user_id, $group_request->item_id );
485
  if ( ! $success ) {
486
  return new WP_Error(
@@ -538,7 +542,7 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
538
  )
539
  );
540
  $user_id = bp_loggedin_user_id();
541
- $group_request = $this->fetch_single_membership_request( $request['request_id'] );
542
 
543
  if ( ! $user_id ) {
544
  $retval = new WP_Error(
@@ -593,7 +597,7 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
593
  $request->set_param( 'context', 'edit' );
594
 
595
  // Get invite.
596
- $group_request = $this->fetch_single_membership_request( $request['request_id'] );
597
 
598
  // Set the invite response before it is deleted.
599
  $previous = $this->prepare_item_for_response( $group_request, $request );
@@ -666,7 +670,7 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
666
  )
667
  );
668
  $user_id = bp_loggedin_user_id();
669
- $group_request = $this->fetch_single_membership_request( $request['request_id'] );
670
 
671
  if ( ! $user_id ) {
672
  $retval = new WP_Error(
@@ -731,7 +735,7 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
731
  ),
732
  );
733
 
734
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
735
  $data = $this->add_additional_fields_to_object( $data, $request );
736
  $data = $this->filter_response_by_context( $data, $context );
737
  $response = rest_ensure_response( $data );
@@ -771,7 +775,7 @@ class BP_REST_Group_Membership_Request_Endpoint extends WP_REST_Controller {
771
  'href' => rest_url( $base ),
772
  ),
773
  'user' => array(
774
- 'href' => rest_url( bp_rest_get_user_url( $invite->user_id ) ),
775
  'embeddable' => true,
776
  ),
777
  );
123
  */
124
  public function get_items( $request ) {
125
  $args = array(
126
+ 'item_id' => $request->get_param( 'group_id' ),
127
+ 'user_id' => $request->get_param( 'user_id' ),
128
+ 'per_page' => $request->get_param( 'per_page' ),
129
+ 'page' => $request->get_param( 'page' ),
130
  );
131
 
132
  // If the query is not restricted by group or user, limit it to the current user, if not an admin.
187
  )
188
  );
189
  $user_id = bp_loggedin_user_id();
190
+ $user_id_arg = $request->get_param( 'user_id' );
191
+ $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
192
 
193
  // If the query is not restricted by group or user, limit it to the current user, if not an admin.
194
+ if ( ! $request->get_param( 'group_id' ) && ! $request->get_param( 'user_id' ) && ! bp_current_user_can( 'bp_moderate' ) ) {
195
  $user_id_arg = $user_id;
196
  }
197
  $user = bp_rest_get_user( $user_id_arg );
204
  'status' => rest_authorization_required_code(),
205
  )
206
  );
207
+ } elseif ( $request->get_param( 'group_id' ) && ! $group instanceof BP_Groups_Group ) {
208
  $retval = new WP_Error(
209
  'bp_rest_group_invalid_id',
210
  __( 'Invalid group ID.', 'buddypress' ),
220
  'status' => 404,
221
  )
222
  );
223
+ } elseif (
224
+ bp_current_user_can( 'bp_moderate' )
225
+ || ( $request->get_param( 'group_id' ) && groups_is_user_admin( $user_id, $request->get_param( 'group_id' ) ) )
226
+ || $user_id_arg === $user_id
227
+ ) {
228
  $retval = true;
229
  } else {
230
  $retval = new WP_Error(
256
  * @return WP_REST_Response|WP_Error
257
  */
258
  public function get_item( $request ) {
259
+ $group_request = $this->fetch_single_membership_request( $request->get_param( 'request_id' ) );
260
  $retval = $this->prepare_response_for_collection(
261
  $this->prepare_item_for_response( $group_request, $request )
262
  );
294
  )
295
  );
296
  $user_id = bp_loggedin_user_id();
297
+ $group_request = $this->fetch_single_membership_request( $request->get_param( 'request_id' ) );
298
 
299
  if ( ! $user_id ) {
300
  $retval = new WP_Error(
344
  * @return WP_REST_Response|WP_Error
345
  */
346
  public function create_item( $request ) {
347
+ $user_id_arg = ! empty( $request->get_param( 'user_id' ) ) ? $request->get_param( 'user_id' ) : bp_loggedin_user_id();
348
  $user = bp_rest_get_user( $user_id_arg );
349
+ $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
350
 
351
  // Avoid duplicate requests.
352
  if ( groups_check_for_membership_request( $user->ID, $group->id ) ) {
363
  array(
364
  'group_id' => $group->id,
365
  'user_id' => $user->ID,
366
+ 'content' => $request->get_param( 'message' ),
367
  )
368
  );
369
 
423
  )
424
  );
425
  $user_id = bp_loggedin_user_id();
426
+ $user_id_arg = ! empty( $request->get_param( 'user_id' ) ) ? $request->get_param( 'user_id' ) : $user_id;
427
  $user = bp_rest_get_user( $user_id_arg );
428
+ $group = $this->groups_endpoint->get_group_object( $request->get_param( 'group_id' ) );
429
 
430
  // User must be logged in.
431
  if ( ! is_user_logged_in() ) {
484
  * @return WP_REST_Response|WP_Error
485
  */
486
  public function update_item( $request ) {
487
+ $group_request = $this->fetch_single_membership_request( $request->get_param( 'request_id' ) );
488
  $success = groups_accept_membership_request( false, $group_request->user_id, $group_request->item_id );
489
  if ( ! $success ) {
490
  return new WP_Error(
542
  )
543
  );
544
  $user_id = bp_loggedin_user_id();
545
+ $group_request = $this->fetch_single_membership_request( $request->get_param( 'request_id' ) );
546
 
547
  if ( ! $user_id ) {
548
  $retval = new WP_Error(
597
  $request->set_param( 'context', 'edit' );
598
 
599
  // Get invite.
600
+ $group_request = $this->fetch_single_membership_request( $request->get_param( 'request_id' ) );
601
 
602
  // Set the invite response before it is deleted.
603
  $previous = $this->prepare_item_for_response( $group_request, $request );
670
  )
671
  );
672
  $user_id = bp_loggedin_user_id();
673
+ $group_request = $this->fetch_single_membership_request( $request->get_param( 'request_id' ) );
674
 
675
  if ( ! $user_id ) {
676
  $retval = new WP_Error(
735
  ),
736
  );
737
 
738
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
739
  $data = $this->add_additional_fields_to_object( $data, $request );
740
  $data = $this->filter_response_by_context( $data, $context );
741
  $response = rest_ensure_response( $data );
775
  'href' => rest_url( $base ),
776
  ),
777
  'user' => array(
778
+ 'href' => bp_rest_get_object_url( $invite->user_id, 'members' ),
779
  'embeddable' => true,
780
  ),
781
  );
bp-groups/classes/class-bp-rest-groups-endpoint.php CHANGED
@@ -130,29 +130,29 @@ class BP_REST_Groups_Endpoint extends WP_REST_Controller {
130
  */
131
  public function get_items( $request ) {
132
  $args = array(
133
- 'type' => $request['type'],
134
- 'order' => $request['order'],
135
- 'fields' => $request['fields'],
136
- 'orderby' => $request['orderby'],
137
- 'user_id' => $request['user_id'],
138
- 'include' => $request['include'],
139
- 'parent_id' => $request['parent_id'],
140
- 'exclude' => $request['exclude'],
141
- 'search_terms' => $request['search'],
142
- 'meta_query' => $request['meta'], // phpcs:ignore
143
- 'group_type' => $request['group_type'],
144
- 'show_hidden' => $request['show_hidden'],
145
- 'per_page' => $request['per_page'],
146
- 'status' => $request['status'],
147
- 'page' => $request['page'],
148
  );
149
 
150
- if ( empty( $request['parent_id'] ) ) {
151
  $args['parent_id'] = null;
152
  }
153
 
154
  // See if the user can see hidden groups.
155
- if ( isset( $request['show_hidden'] ) && true === (bool) $request['show_hidden'] && ! $this->can_see_hidden_groups( $request ) ) {
156
  $args['show_hidden'] = false;
157
  }
158
 
@@ -311,7 +311,7 @@ class BP_REST_Groups_Endpoint extends WP_REST_Controller {
311
  $request->set_param( 'context', 'edit' );
312
 
313
  // If no group name.
314
- if ( empty( $request['name'] ) ) {
315
  return new WP_Error(
316
  'bp_rest_create_group_empty_name',
317
  __( 'Please, enter the name of group.', 'buddypress' ),
@@ -341,8 +341,8 @@ class BP_REST_Groups_Endpoint extends WP_REST_Controller {
341
  }
342
 
343
  // Set group type(s).
344
- if ( ! empty( $request['types'] ) ) {
345
- bp_groups_set_group_type( $group_id, $request['types'] );
346
  }
347
 
348
  $retval = array(
@@ -723,6 +723,7 @@ class BP_REST_Groups_Endpoint extends WP_REST_Controller {
723
  'creator_id' => bp_get_group_creator_id( $item ),
724
  'parent_id' => $item->parent_id,
725
  'date_created' => bp_rest_prepare_date_response( $item->date_created ),
 
726
  'description' => array(
727
  'raw' => $item->description,
728
  'rendered' => bp_get_group_description( $item ),
@@ -767,7 +768,7 @@ class BP_REST_Groups_Endpoint extends WP_REST_Controller {
767
  $data['types'] = array();
768
  }
769
 
770
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
771
 
772
  // If this is the 'edit' context or 'populate_extras' has been requested.
773
  if ( 'edit' === $context || true === $request->get_param( 'populate_extras' ) ) {
@@ -854,8 +855,8 @@ class BP_REST_Groups_Endpoint extends WP_REST_Controller {
854
  }
855
 
856
  // Group Creator ID.
857
- if ( ! empty( $schema['properties']['creator_id'] ) && isset( $request['creator_id'] ) ) {
858
- $prepared_group->creator_id = (int) $request['creator_id'];
859
 
860
  // Fallback on the current user otherwise.
861
  } else {
@@ -863,13 +864,13 @@ class BP_REST_Groups_Endpoint extends WP_REST_Controller {
863
  }
864
 
865
  // Group Slug.
866
- if ( ! empty( $schema['properties']['slug'] ) && isset( $request['slug'] ) ) {
867
- $prepared_group->slug = $request['slug'];
868
  }
869
 
870
  // Group Name.
871
- if ( ! empty( $schema['properties']['name'] ) && isset( $request['name'] ) ) {
872
- $prepared_group->name = $request['name'];
873
  }
874
 
875
  // Do additional checks for the Group's slug.
@@ -884,47 +885,47 @@ class BP_REST_Groups_Endpoint extends WP_REST_Controller {
884
  }
885
 
886
  // Group description.
887
- if ( ! empty( $schema['properties']['description'] ) && isset( $request['description'] ) ) {
888
- if ( is_string( $request['description'] ) ) {
889
- $prepared_group->description = $request['description'];
890
  } elseif ( isset( $request['description']['raw'] ) ) {
891
  $prepared_group->description = $request['description']['raw'];
892
  }
893
  }
894
 
895
  // Group status.
896
- if ( ! empty( $schema['properties']['status'] ) && isset( $request['status'] ) ) {
897
- $prepared_group->status = $request['status'];
898
  }
899
 
900
  // Group Forum Enabled.
901
- if ( ! empty( $schema['properties']['enable_forum'] ) && isset( $request['enable_forum'] ) ) {
902
- $prepared_group->enable_forum = (bool) $request['enable_forum'];
903
  }
904
 
905
  // Group Parent ID.
906
- if ( ! empty( $schema['properties']['parent_id'] ) && isset( $request['parent_id'] ) ) {
907
- $prepared_group->parent_id = $request['parent_id'];
908
  }
909
 
910
  // Update group type(s).
911
- if ( isset( $prepared_group->group_id ) && isset( $request['types'] ) ) {
912
- bp_groups_set_group_type( $prepared_group->group_id, $request['types'], false );
913
  }
914
 
915
  // Remove group type(s).
916
- if ( isset( $prepared_group->group_id ) && isset( $request['remove_types'] ) ) {
917
  array_map(
918
  function( $type ) use ( $prepared_group ) {
919
  bp_groups_remove_group_type( $prepared_group->group_id, $type );
920
  },
921
- $request['remove_types']
922
  );
923
  }
924
 
925
  // Append group type(s).
926
- if ( isset( $prepared_group->group_id ) && isset( $request['append_types'] ) ) {
927
- bp_groups_set_group_type( $prepared_group->group_id, $request['append_types'], true );
928
  }
929
 
930
  /**
@@ -958,7 +959,7 @@ class BP_REST_Groups_Endpoint extends WP_REST_Controller {
958
  'href' => rest_url( $base ),
959
  ),
960
  'user' => array(
961
- 'href' => rest_url( bp_rest_get_user_url( $group->creator_id ) ),
962
  'embeddable' => true,
963
  ),
964
  );
@@ -1028,8 +1029,8 @@ class BP_REST_Groups_Endpoint extends WP_REST_Controller {
1028
 
1029
  return (
1030
  is_user_logged_in()
1031
- && isset( $request['user_id'] )
1032
- && absint( $request['user_id'] ) === bp_loggedin_user_id()
1033
  );
1034
  }
1035
 
@@ -1038,16 +1039,18 @@ class BP_REST_Groups_Endpoint extends WP_REST_Controller {
1038
  *
1039
  * @since 5.0.0
1040
  *
1041
- * @param WP_REST_Request $request Full details about the request.
1042
- * @return bool|BP_Groups_Group
1043
  */
1044
  public function get_group_object( $request ) {
1045
- if ( ! empty( $request['group_id'] ) ) {
1046
- $group_id = (int) $request['group_id'];
 
 
 
 
1047
  } elseif ( is_numeric( $request ) ) {
1048
- $group_id = $request;
1049
- } else {
1050
- $group_id = (int) $request['id'];
1051
  }
1052
 
1053
  $group = groups_get_group( $group_id );
@@ -1221,6 +1224,13 @@ class BP_REST_Groups_Endpoint extends WP_REST_Controller {
1221
  'type' => 'string',
1222
  'format' => 'date-time',
1223
  ),
 
 
 
 
 
 
 
1224
  'types' => array(
1225
  'context' => array( 'view', 'edit', 'embed' ),
1226
  'description' => __( 'The type(s) of the Group.', 'buddypress' ),
130
  */
131
  public function get_items( $request ) {
132
  $args = array(
133
+ 'type' => $request->get_param( 'type' ),
134
+ 'order' => $request->get_param( 'order' ),
135
+ 'fields' => $request->get_param( 'fields' ),
136
+ 'orderby' => $request->get_param( 'orderby' ),
137
+ 'user_id' => $request->get_param( 'user_id' ),
138
+ 'include' => $request->get_param( 'include' ),
139
+ 'parent_id' => $request->get_param( 'parent_id' ),
140
+ 'exclude' => $request->get_param( 'exclude' ),
141
+ 'search_terms' => $request->get_param( 'search' ),
142
+ 'meta_query' => $request->get_param( 'meta' ), // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
143
+ 'group_type' => $request->get_param( 'group_type' ),
144
+ 'show_hidden' => $request->get_param( 'show_hidden' ),
145
+ 'per_page' => $request->get_param( 'per_page' ),
146
+ 'status' => $request->get_param( 'status' ),
147
+ 'page' => $request->get_param( 'page' ),
148
  );
149
 
150
+ if ( empty( $request->get_param( 'parent_id' ) ) ) {
151
  $args['parent_id'] = null;
152
  }
153
 
154
  // See if the user can see hidden groups.
155
+ if ( ! empty( $request->get_param( 'show_hidden' ) ) && true === (bool) $request->get_param( 'show_hidden' ) && ! $this->can_see_hidden_groups( $request ) ) {
156
  $args['show_hidden'] = false;
157
  }
158
 
311
  $request->set_param( 'context', 'edit' );
312
 
313
  // If no group name.
314
+ if ( empty( $request->get_param( 'name' ) ) ) {
315
  return new WP_Error(
316
  'bp_rest_create_group_empty_name',
317
  __( 'Please, enter the name of group.', 'buddypress' ),
341
  }
342
 
343
  // Set group type(s).
344
+ if ( ! empty( $request->get_param( 'types' ) ) ) {
345
+ bp_groups_set_group_type( $group_id, $request->get_param( 'types' ) );
346
  }
347
 
348
  $retval = array(
723
  'creator_id' => bp_get_group_creator_id( $item ),
724
  'parent_id' => $item->parent_id,
725
  'date_created' => bp_rest_prepare_date_response( $item->date_created ),
726
+ 'created_since' => bp_core_time_since( $item->date_created ),
727
  'description' => array(
728
  'raw' => $item->description,
729
  'rendered' => bp_get_group_description( $item ),
768
  $data['types'] = array();
769
  }
770
 
771
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
772
 
773
  // If this is the 'edit' context or 'populate_extras' has been requested.
774
  if ( 'edit' === $context || true === $request->get_param( 'populate_extras' ) ) {
855
  }
856
 
857
  // Group Creator ID.
858
+ if ( ! empty( $schema['properties']['creator_id'] ) && ! empty( $request->get_param( 'creator_id' ) ) ) {
859
+ $prepared_group->creator_id = (int) $request->get_param( 'creator_id' );
860
 
861
  // Fallback on the current user otherwise.
862
  } else {
864
  }
865
 
866
  // Group Slug.
867
+ if ( ! empty( $schema['properties']['slug'] ) && ! empty( $request->get_param( 'slug' ) ) ) {
868
+ $prepared_group->slug = $request->get_param( 'slug' );
869
  }
870
 
871
  // Group Name.
872
+ if ( ! empty( $schema['properties']['name'] ) && ! empty( $request->get_param( 'name' ) ) ) {
873
+ $prepared_group->name = $request->get_param( 'name' );
874
  }
875
 
876
  // Do additional checks for the Group's slug.
885
  }
886
 
887
  // Group description.
888
+ if ( ! empty( $schema['properties']['description'] ) && ! empty( $request->get_param( 'description' ) ) ) {
889
+ if ( is_string( $request->get_param( 'description' ) ) ) {
890
+ $prepared_group->description = $request->get_param( 'description' );
891
  } elseif ( isset( $request['description']['raw'] ) ) {
892
  $prepared_group->description = $request['description']['raw'];
893
  }
894
  }
895
 
896
  // Group status.
897
+ if ( ! empty( $schema['properties']['status'] ) && ! empty( $request->get_param( 'status' ) ) ) {
898
+ $prepared_group->status = $request->get_param( 'status' );
899
  }
900
 
901
  // Group Forum Enabled.
902
+ if ( ! empty( $schema['properties']['enable_forum'] ) && ! empty( $request->get_param( 'enable_forum' ) ) ) {
903
+ $prepared_group->enable_forum = (bool) $request->get_param( 'enable_forum' );
904
  }
905
 
906
  // Group Parent ID.
907
+ if ( ! empty( $schema['properties']['parent_id'] ) && ! empty( $request->get_param( 'parent_id' ) ) ) {
908
+ $prepared_group->parent_id = $request->get_param( 'parent_id' );
909
  }
910
 
911
  // Update group type(s).
912
+ if ( isset( $prepared_group->group_id ) && ! empty( $request->get_param( 'types' ) ) ) {
913
+ bp_groups_set_group_type( $prepared_group->group_id, $request->get_param( 'types' ), false );
914
  }
915
 
916
  // Remove group type(s).
917
+ if ( isset( $prepared_group->group_id ) && ! empty( $request->get_param( 'remove_types' ) ) ) {
918
  array_map(
919
  function( $type ) use ( $prepared_group ) {
920
  bp_groups_remove_group_type( $prepared_group->group_id, $type );
921
  },
922
+ $request->get_param( 'remove_types' )
923
  );
924
  }
925
 
926
  // Append group type(s).
927
+ if ( isset( $prepared_group->group_id ) && ! empty( $request->get_param( 'append_types' ) ) ) {
928
+ bp_groups_set_group_type( $prepared_group->group_id, $request->get_param( 'append_types' ), true );
929
  }
930
 
931
  /**
959
  'href' => rest_url( $base ),
960
  ),
961
  'user' => array(
962
+ 'href' => bp_rest_get_object_url( $group->creator_id, 'members' ),
963
  'embeddable' => true,
964
  ),
965
  );
1029
 
1030
  return (
1031
  is_user_logged_in()
1032
+ && ! empty( $request->get_param( 'user_id' ) )
1033
+ && absint( $request->get_param( 'user_id' ) ) === bp_loggedin_user_id()
1034
  );
1035
  }
1036
 
1039
  *
1040
  * @since 5.0.0
1041
  *
1042
+ * @param int|WP_REST_Request $request Full details about the request or an group integer.
1043
+ * @return false|BP_Groups_Group
1044
  */
1045
  public function get_group_object( $request ) {
1046
+ if ( $request instanceof WP_REST_Request ) {
1047
+ if ( ! empty( $request->get_param( 'group_id' ) ) ) {
1048
+ $group_id = (int) $request->get_param( 'group_id' );
1049
+ } else {
1050
+ $group_id = (int) $request->get_param( 'id' );
1051
+ }
1052
  } elseif ( is_numeric( $request ) ) {
1053
+ $group_id = (int) $request;
 
 
1054
  }
1055
 
1056
  $group = groups_get_group( $group_id );
1224
  'type' => 'string',
1225
  'format' => 'date-time',
1226
  ),
1227
+ 'created_since' => array(
1228
+ 'context' => array( 'view', 'edit', 'embed' ),
1229
+ 'description' => __( 'Time elapsed since the Group was created, in the site\'s timezone.', 'buddypress' ),
1230
+ 'readonly' => true,
1231
+ 'type' => 'string',
1232
+ 'default' => '',
1233
+ ),
1234
  'types' => array(
1235
  'context' => array( 'view', 'edit', 'embed' ),
1236
  'description' => __( 'The type(s) of the Group.', 'buddypress' ),
bp-groups/css/blocks/dynamic-groups-rtl.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-dynamic-block-container .item-options {
2
+ font-size: 0.5em;
3
+ margin: 0 0 1em;
4
+ padding: 1em 0;
5
+ }
6
+
7
+ .bp-dynamic-block-container .item-options a.selected {
8
+ font-weight: 600;
9
+ }
10
+
11
+ .bp-dynamic-block-container ul.item-list {
12
+ list-style: none;
13
+ margin: 1em 0;
14
+ }
15
+
16
+ .bp-dynamic-block-container ul.item-list li {
17
+ margin-bottom: 1em;
18
+ }
19
+
20
+ .bp-dynamic-block-container ul.item-list li:before, .bp-dynamic-block-container ul.item-list li:after {
21
+ content: " ";
22
+ display: table;
23
+ }
24
+
25
+ .bp-dynamic-block-container ul.item-list li:after {
26
+ clear: both;
27
+ }
28
+
29
+ .bp-dynamic-block-container ul.item-list li .item-avatar {
30
+ float: right;
31
+ width: 60px;
32
+ }
33
+
34
+ .bp-dynamic-block-container ul.item-list li .item {
35
+ margin-right: 70px;
36
+ }
bp-groups/css/blocks/dynamic-groups-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .bp-dynamic-block-container .item-options{font-size:.5em;margin:0 0 1em;padding:1em 0}.bp-dynamic-block-container .item-options a.selected{font-weight:600}.bp-dynamic-block-container ul.item-list{list-style:none;margin:1em 0}.bp-dynamic-block-container ul.item-list li{margin-bottom:1em}.bp-dynamic-block-container ul.item-list li:after,.bp-dynamic-block-container ul.item-list li:before{content:" ";display:table}.bp-dynamic-block-container ul.item-list li:after{clear:both}.bp-dynamic-block-container ul.item-list li .item-avatar{float:right;width:60px}.bp-dynamic-block-container ul.item-list li .item{margin-right:70px}
bp-groups/css/blocks/dynamic-groups.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-dynamic-block-container .item-options {
2
+ font-size: 0.5em;
3
+ margin: 0 0 1em;
4
+ padding: 1em 0;
5
+ }
6
+
7
+ .bp-dynamic-block-container .item-options a.selected {
8
+ font-weight: 600;
9
+ }
10
+
11
+ .bp-dynamic-block-container ul.item-list {
12
+ list-style: none;
13
+ margin: 1em 0;
14
+ }
15
+
16
+ .bp-dynamic-block-container ul.item-list li {
17
+ margin-bottom: 1em;
18
+ }
19
+
20
+ .bp-dynamic-block-container ul.item-list li:before, .bp-dynamic-block-container ul.item-list li:after {
21
+ content: " ";
22
+ display: table;
23
+ }
24
+
25
+ .bp-dynamic-block-container ul.item-list li:after {
26
+ clear: both;
27
+ }
28
+
29
+ .bp-dynamic-block-container ul.item-list li .item-avatar {
30
+ float: left;
31
+ width: 60px;
32
+ }
33
+
34
+ .bp-dynamic-block-container ul.item-list li .item {
35
+ margin-left: 70px;
36
+ }
bp-groups/css/blocks/dynamic-groups.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .bp-dynamic-block-container .item-options{font-size:.5em;margin:0 0 1em;padding:1em 0}.bp-dynamic-block-container .item-options a.selected{font-weight:600}.bp-dynamic-block-container ul.item-list{list-style:none;margin:1em 0}.bp-dynamic-block-container ul.item-list li{margin-bottom:1em}.bp-dynamic-block-container ul.item-list li:after,.bp-dynamic-block-container ul.item-list li:before{content:" ";display:table}.bp-dynamic-block-container ul.item-list li:after{clear:both}.bp-dynamic-block-container ul.item-list li .item-avatar{float:left;width:60px}.bp-dynamic-block-container ul.item-list li .item{margin-left:70px}
bp-groups/css/blocks/groups-rtl.css CHANGED
@@ -159,7 +159,6 @@
159
  .bp-block-groups img.avatar {
160
  width: auto;
161
  height: auto;
162
- max-width: -webkit-fit-content;
163
  max-width: fit-content;
164
  }
165
 
159
  .bp-block-groups img.avatar {
160
  width: auto;
161
  height: auto;
 
162
  max-width: fit-content;
163
  }
164
 
bp-groups/css/blocks/groups-rtl.min.css CHANGED
@@ -1 +1 @@
1
- [data-type="bp/groups"] .components-placeholder.is-appender{min-height:0}[data-type="bp/groups"] .components-placeholder.is-appender .components-placeholder__label:empty{display:none}[data-type="bp/groups"] .components-placeholder input.components-placeholder__input{flex:1 1 auto;border-radius:2px;border:1px solid #757575;padding:6px 8px}[data-type="bp/groups"].avatar-none .group-description{width:calc(100% - 44px)}[data-type="bp/groups"].avatar-full .group-description{width:calc(100% - 224px)}[data-type="bp/groups"].avatar-thumb .group-description{width:calc(100% - 114px)}[data-type="bp/groups"] .group-content{position:relative}[data-type="bp/groups"] .group-content .is-right{position:absolute;top:2px;left:2px}[data-type="bp/groups"] .columns-2 .group-content .group-description,[data-type="bp/groups"] .columns-3 .group-content .group-description,[data-type="bp/groups"] .columns-4 .group-content .group-description{padding-right:44px;width:calc(100% - 44px)}[data-type="bp/groups"] .columns-3 .is-right{left:-10px}[data-type="bp/groups"] .columns-4 .is-right{left:-50px}.bp-block-groups.is-grid{display:flex;flex-wrap:wrap;padding:0}.bp-block-groups.is-grid .group-content{margin:0 0 1.25em 1.25em;width:100%}@media (min-width:600px){.bp-block-groups.columns-2 .group-content{width:calc((100% / 2) - 1.25em + (1.25em / 2))}.bp-block-groups.columns-2 .group-content:nth-child(2n){margin-left:0}.bp-block-groups.columns-3 .group-content{width:calc((100% / 3) - 1.25em + (1.25em / 3))}.bp-block-groups.columns-3 .group-content:nth-child(3n){margin-left:0}.bp-block-groups.columns-4 .group-content{width:calc((100% / 4) - 1.25em + (1.25em / 4))}.bp-block-groups.columns-4 .group-content:nth-child(4n){margin-left:0}}.bp-block-groups .group-content{display:flex;flex-direction:column;padding-bottom:1em;text-align:center}.bp-block-groups .group-content .group-description,.bp-block-groups .group-content .item-header-avatar{width:100%}.bp-block-groups .group-content .item-header-avatar{margin:0 auto}.bp-block-groups .group-content .item-header-avatar img.avatar{display:inline-block}@media (min-width:600px){.bp-block-groups .group-content{flex-direction:row;text-align:right}.bp-block-groups .group-content .group-description,.bp-block-groups .group-content .item-header-avatar{width:auto}.bp-block-groups .group-content .item-header-avatar{margin:0}}.bp-block-groups .group-content time{display:block;font-size:80%;color:#767676}.bp-block-groups.avatar-none .item-header-avatar{display:none}.bp-block-groups.avatar-full{min-height:190px}.bp-block-groups.avatar-full .item-header-avatar{width:180px}.bp-block-groups.avatar-thumb .group-content{min-height:80px}.bp-block-groups.avatar-thumb .item-header-avatar{width:70px}.bp-block-groups.columns-2 .group-content,.bp-block-groups.columns-3 .group-content,.bp-block-groups.columns-4 .group-content{display:block;text-align:center}.bp-block-groups.columns-2 .group-content .item-header-avatar,.bp-block-groups.columns-3 .group-content .item-header-avatar,.bp-block-groups.columns-4 .group-content .item-header-avatar{margin:0 auto}.bp-block-groups img.avatar{width:auto;height:auto;max-width:-webkit-fit-content;max-width:fit-content}.bp-block-groups .member-content.has-description{align-items:center}.bp-block-groups .member-content.has-description .item-header-avatar{padding-left:1em}.bp-block-groups .member-content.has-description .group-description-content{margin-bottom:0;text-align:right}
1
+ [data-type="bp/groups"] .components-placeholder.is-appender{min-height:0}[data-type="bp/groups"] .components-placeholder.is-appender .components-placeholder__label:empty{display:none}[data-type="bp/groups"] .components-placeholder input.components-placeholder__input{flex:1 1 auto;border-radius:2px;border:1px solid #757575;padding:6px 8px}[data-type="bp/groups"].avatar-none .group-description{width:calc(100% - 44px)}[data-type="bp/groups"].avatar-full .group-description{width:calc(100% - 224px)}[data-type="bp/groups"].avatar-thumb .group-description{width:calc(100% - 114px)}[data-type="bp/groups"] .group-content{position:relative}[data-type="bp/groups"] .group-content .is-right{position:absolute;top:2px;left:2px}[data-type="bp/groups"] .columns-2 .group-content .group-description,[data-type="bp/groups"] .columns-3 .group-content .group-description,[data-type="bp/groups"] .columns-4 .group-content .group-description{padding-right:44px;width:calc(100% - 44px)}[data-type="bp/groups"] .columns-3 .is-right{left:-10px}[data-type="bp/groups"] .columns-4 .is-right{left:-50px}.bp-block-groups.is-grid{display:flex;flex-wrap:wrap;padding:0}.bp-block-groups.is-grid .group-content{margin:0 0 1.25em 1.25em;width:100%}@media (min-width:600px){.bp-block-groups.columns-2 .group-content{width:calc((100% / 2) - 1.25em + (1.25em / 2))}.bp-block-groups.columns-2 .group-content:nth-child(2n){margin-left:0}.bp-block-groups.columns-3 .group-content{width:calc((100% / 3) - 1.25em + (1.25em / 3))}.bp-block-groups.columns-3 .group-content:nth-child(3n){margin-left:0}.bp-block-groups.columns-4 .group-content{width:calc((100% / 4) - 1.25em + (1.25em / 4))}.bp-block-groups.columns-4 .group-content:nth-child(4n){margin-left:0}}.bp-block-groups .group-content{display:flex;flex-direction:column;padding-bottom:1em;text-align:center}.bp-block-groups .group-content .group-description,.bp-block-groups .group-content .item-header-avatar{width:100%}.bp-block-groups .group-content .item-header-avatar{margin:0 auto}.bp-block-groups .group-content .item-header-avatar img.avatar{display:inline-block}@media (min-width:600px){.bp-block-groups .group-content{flex-direction:row;text-align:right}.bp-block-groups .group-content .group-description,.bp-block-groups .group-content .item-header-avatar{width:auto}.bp-block-groups .group-content .item-header-avatar{margin:0}}.bp-block-groups .group-content time{display:block;font-size:80%;color:#767676}.bp-block-groups.avatar-none .item-header-avatar{display:none}.bp-block-groups.avatar-full{min-height:190px}.bp-block-groups.avatar-full .item-header-avatar{width:180px}.bp-block-groups.avatar-thumb .group-content{min-height:80px}.bp-block-groups.avatar-thumb .item-header-avatar{width:70px}.bp-block-groups.columns-2 .group-content,.bp-block-groups.columns-3 .group-content,.bp-block-groups.columns-4 .group-content{display:block;text-align:center}.bp-block-groups.columns-2 .group-content .item-header-avatar,.bp-block-groups.columns-3 .group-content .item-header-avatar,.bp-block-groups.columns-4 .group-content .item-header-avatar{margin:0 auto}.bp-block-groups img.avatar{width:auto;height:auto;max-width:fit-content}.bp-block-groups .member-content.has-description{align-items:center}.bp-block-groups .member-content.has-description .item-header-avatar{padding-left:1em}.bp-block-groups .member-content.has-description .group-description-content{margin-bottom:0;text-align:right}
bp-groups/css/blocks/groups.css CHANGED
@@ -159,7 +159,6 @@
159
  .bp-block-groups img.avatar {
160
  width: auto;
161
  height: auto;
162
- max-width: -webkit-fit-content;
163
  max-width: fit-content;
164
  }
165
 
159
  .bp-block-groups img.avatar {
160
  width: auto;
161
  height: auto;
 
162
  max-width: fit-content;
163
  }
164
 
bp-groups/css/blocks/groups.min.css CHANGED
@@ -1 +1 @@
1
- [data-type="bp/groups"] .components-placeholder.is-appender{min-height:0}[data-type="bp/groups"] .components-placeholder.is-appender .components-placeholder__label:empty{display:none}[data-type="bp/groups"] .components-placeholder input.components-placeholder__input{flex:1 1 auto;border-radius:2px;border:1px solid #757575;padding:6px 8px}[data-type="bp/groups"].avatar-none .group-description{width:calc(100% - 44px)}[data-type="bp/groups"].avatar-full .group-description{width:calc(100% - 224px)}[data-type="bp/groups"].avatar-thumb .group-description{width:calc(100% - 114px)}[data-type="bp/groups"] .group-content{position:relative}[data-type="bp/groups"] .group-content .is-right{position:absolute;top:2px;right:2px}[data-type="bp/groups"] .columns-2 .group-content .group-description,[data-type="bp/groups"] .columns-3 .group-content .group-description,[data-type="bp/groups"] .columns-4 .group-content .group-description{padding-left:44px;width:calc(100% - 44px)}[data-type="bp/groups"] .columns-3 .is-right{right:-10px}[data-type="bp/groups"] .columns-4 .is-right{right:-50px}.bp-block-groups.is-grid{display:flex;flex-wrap:wrap;padding:0}.bp-block-groups.is-grid .group-content{margin:0 1.25em 1.25em 0;width:100%}@media (min-width:600px){.bp-block-groups.columns-2 .group-content{width:calc((100% / 2) - 1.25em + (1.25em / 2))}.bp-block-groups.columns-2 .group-content:nth-child(2n){margin-right:0}.bp-block-groups.columns-3 .group-content{width:calc((100% / 3) - 1.25em + (1.25em / 3))}.bp-block-groups.columns-3 .group-content:nth-child(3n){margin-right:0}.bp-block-groups.columns-4 .group-content{width:calc((100% / 4) - 1.25em + (1.25em / 4))}.bp-block-groups.columns-4 .group-content:nth-child(4n){margin-right:0}}.bp-block-groups .group-content{display:flex;flex-direction:column;padding-bottom:1em;text-align:center}.bp-block-groups .group-content .group-description,.bp-block-groups .group-content .item-header-avatar{width:100%}.bp-block-groups .group-content .item-header-avatar{margin:0 auto}.bp-block-groups .group-content .item-header-avatar img.avatar{display:inline-block}@media (min-width:600px){.bp-block-groups .group-content{flex-direction:row;text-align:left}.bp-block-groups .group-content .group-description,.bp-block-groups .group-content .item-header-avatar{width:auto}.bp-block-groups .group-content .item-header-avatar{margin:0}}.bp-block-groups .group-content time{display:block;font-size:80%;color:#767676}.bp-block-groups.avatar-none .item-header-avatar{display:none}.bp-block-groups.avatar-full{min-height:190px}.bp-block-groups.avatar-full .item-header-avatar{width:180px}.bp-block-groups.avatar-thumb .group-content{min-height:80px}.bp-block-groups.avatar-thumb .item-header-avatar{width:70px}.bp-block-groups.columns-2 .group-content,.bp-block-groups.columns-3 .group-content,.bp-block-groups.columns-4 .group-content{display:block;text-align:center}.bp-block-groups.columns-2 .group-content .item-header-avatar,.bp-block-groups.columns-3 .group-content .item-header-avatar,.bp-block-groups.columns-4 .group-content .item-header-avatar{margin:0 auto}.bp-block-groups img.avatar{width:auto;height:auto;max-width:-webkit-fit-content;max-width:fit-content}.bp-block-groups .member-content.has-description{align-items:center}.bp-block-groups .member-content.has-description .item-header-avatar{padding-right:1em}.bp-block-groups .member-content.has-description .group-description-content{margin-bottom:0;text-align:left}
1
+ [data-type="bp/groups"] .components-placeholder.is-appender{min-height:0}[data-type="bp/groups"] .components-placeholder.is-appender .components-placeholder__label:empty{display:none}[data-type="bp/groups"] .components-placeholder input.components-placeholder__input{flex:1 1 auto;border-radius:2px;border:1px solid #757575;padding:6px 8px}[data-type="bp/groups"].avatar-none .group-description{width:calc(100% - 44px)}[data-type="bp/groups"].avatar-full .group-description{width:calc(100% - 224px)}[data-type="bp/groups"].avatar-thumb .group-description{width:calc(100% - 114px)}[data-type="bp/groups"] .group-content{position:relative}[data-type="bp/groups"] .group-content .is-right{position:absolute;top:2px;right:2px}[data-type="bp/groups"] .columns-2 .group-content .group-description,[data-type="bp/groups"] .columns-3 .group-content .group-description,[data-type="bp/groups"] .columns-4 .group-content .group-description{padding-left:44px;width:calc(100% - 44px)}[data-type="bp/groups"] .columns-3 .is-right{right:-10px}[data-type="bp/groups"] .columns-4 .is-right{right:-50px}.bp-block-groups.is-grid{display:flex;flex-wrap:wrap;padding:0}.bp-block-groups.is-grid .group-content{margin:0 1.25em 1.25em 0;width:100%}@media (min-width:600px){.bp-block-groups.columns-2 .group-content{width:calc((100% / 2) - 1.25em + (1.25em / 2))}.bp-block-groups.columns-2 .group-content:nth-child(2n){margin-right:0}.bp-block-groups.columns-3 .group-content{width:calc((100% / 3) - 1.25em + (1.25em / 3))}.bp-block-groups.columns-3 .group-content:nth-child(3n){margin-right:0}.bp-block-groups.columns-4 .group-content{width:calc((100% / 4) - 1.25em + (1.25em / 4))}.bp-block-groups.columns-4 .group-content:nth-child(4n){margin-right:0}}.bp-block-groups .group-content{display:flex;flex-direction:column;padding-bottom:1em;text-align:center}.bp-block-groups .group-content .group-description,.bp-block-groups .group-content .item-header-avatar{width:100%}.bp-block-groups .group-content .item-header-avatar{margin:0 auto}.bp-block-groups .group-content .item-header-avatar img.avatar{display:inline-block}@media (min-width:600px){.bp-block-groups .group-content{flex-direction:row;text-align:left}.bp-block-groups .group-content .group-description,.bp-block-groups .group-content .item-header-avatar{width:auto}.bp-block-groups .group-content .item-header-avatar{margin:0}}.bp-block-groups .group-content time{display:block;font-size:80%;color:#767676}.bp-block-groups.avatar-none .item-header-avatar{display:none}.bp-block-groups.avatar-full{min-height:190px}.bp-block-groups.avatar-full .item-header-avatar{width:180px}.bp-block-groups.avatar-thumb .group-content{min-height:80px}.bp-block-groups.avatar-thumb .item-header-avatar{width:70px}.bp-block-groups.columns-2 .group-content,.bp-block-groups.columns-3 .group-content,.bp-block-groups.columns-4 .group-content{display:block;text-align:center}.bp-block-groups.columns-2 .group-content .item-header-avatar,.bp-block-groups.columns-3 .group-content .item-header-avatar,.bp-block-groups.columns-4 .group-content .item-header-avatar{margin:0 auto}.bp-block-groups img.avatar{width:auto;height:auto;max-width:fit-content}.bp-block-groups .member-content.has-description{align-items:center}.bp-block-groups .member-content.has-description .item-header-avatar{padding-right:1em}.bp-block-groups .member-content.has-description .group-description-content{margin-bottom:0;text-align:left}
bp-groups/js/blocks/dynamic-groups.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Ra3s":[function(require,module,exports) {
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TYPES=void 0;var e=wp,l=e.i18n.__,a=[{label:l("Newest","buddypress"),value:"newest"},{label:l("Active","buddypress"),value:"active"},{label:l("Popular","buddypress"),value:"popular"},{label:l("Alphabetical","buddypress"),value:"alphabetical"}];exports.TYPES=a;
3
+ },{}],"l8fw":[function(require,module,exports) {
4
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./constants"),t=wp,o=t.blockEditor.InspectorControls,n=t.components,l=n.Disabled,r=n.PanelBody,u=n.RangeControl,s=n.SelectControl,i=n.TextControl,a=n.ToggleControl,p=t.element,d=p.Fragment,b=p.createElement,c=t.i18n.__,g=bp,f=g.blockComponents.ServerSideRender,m=function(t){var n=t.attributes,p=t.setAttributes,g=n.title,m=n.maxGroups,C=n.groupDefault,y=n.linkTitle;return b(d,null,b(o,null,b(r,{title:c("Settings","buddypress"),initialOpen:!0},b(i,{label:c("Title","buddypress"),value:g,onChange:function(e){p({title:e})}}),b(u,{label:c("Max groups to show","buddypress"),value:m,onChange:function(e){return p({maxGroups:e})},min:1,max:10,required:!0}),b(s,{label:c("Default groups to show","buddypress"),value:C,options:e.TYPES,onChange:function(e){p({groupDefault:e})}}),b(a,{label:c("Link block title to Groups directory","buddypress"),checked:!!y,onChange:function(){p({linkTitle:!y})}}))),b(l,null,b(f,{block:"bp/dynamic-groups",attributes:n})))},C=m;exports.default=C;
5
+ },{"./constants":"Ra3s"}],"SJlW":[function(require,module,exports) {
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blocks.createBlock,r={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:function(e){var t=e.idBase,r=e.instance;return!(null==r||!r.raw)&&"bp_groups_widget"===t},transform:function(e){var r=e.instance;return t("bp/dynamic-groups",{title:r.raw.title,maxGroups:r.raw.max_groups,groupDefault:r.raw.group_default,linkTitle:r.raw.link_title})}}]},a=r;exports.default=a;
7
+ },{}],"lVvR":[function(require,module,exports) {
8
+ "use strict";var e=t(require("./dynamic-groups/edit")),r=t(require("./dynamic-groups/transforms"));function t(e){return e&&e.__esModule?e:{default:e}}var s=wp,u=s.blocks.registerBlockType,i=s.i18n.__;u("bp/dynamic-groups",{title:i("Dynamic Groups List","buddypress"),description:i("A dynamic list of recently active, popular, newest, or alphabetical groups.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"buddicons-groups"},category:"buddypress",attributes:{title:{type:"string",default:i("Groups","buddypress")},maxGroups:{type:"number",default:5},groupDefault:{type:"string",default:"active"},linkTitle:{type:"boolean",default:!1}},edit:e.default,transforms:r.default});
9
+ },{"./dynamic-groups/edit":"l8fw","./dynamic-groups/transforms":"SJlW"}]},{},["lVvR"], null)
10
+ //# sourceMappingURL=/bp-groups/js/blocks/dynamic-groups.js.map
bp-groups/js/blocks/dynamic-groups.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-groups/js/blocks/dynamic-groups/constants.js","bp-groups/js/blocks/dynamic-groups/edit.js","bp-groups/js/blocks/dynamic-groups/transforms.js","bp-groups/js/blocks/dynamic-groups.js"],"names":["wp","__","i18n","TYPES","label","value","editDynamicGroupsBlock","InspectorControls","blockEditor","components","Disabled","PanelBody","RangeControl","SelectControl","TextControl","ToggleControl","element","Fragment","createElement","bp","ServerSideRender","blockComponents","attributes","setAttributes","title","maxGroups","groupDefault","linkTitle","text","option","transforms","createBlock","blocks","from","type","isMatch","idBase","instance","raw","transform","max_groups","group_default","link_title","registerBlockType","description","icon","background","foreground","src","category","default","edit"],"mappings":";AAcO,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,WAAA,EAXP,IAIIA,EAAAA,GAFFC,EADDC,EAAAA,KACCD,GASWE,EAAQ,CACpB,CACCC,MAAOH,EAAI,SAAU,cACrBI,MAAO,UAER,CACCD,MAAOH,EAAI,SAAU,cACrBI,MAAO,UAER,CACCD,MAAOH,EAAI,UAAW,cACtBI,MAAO,WAER,CACCD,MAAOH,EAAG,eAAgB,cAC1BI,MAAO,iBAfF,QAAA,MAAA;;ACwEQC,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAlDf,IAAA,EAAA,QAAA,eAdIN,EAAAA,GAjBFO,EADDC,EAAAA,YACCD,kBAEDE,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,aACAC,EAAAA,EA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AAS,SAA4B,GAAxBC,IAAAA,EAAAA,EAAAA,OAAQC,EAAAA,EAAAA,SACf,QAAEA,MAAAA,IAAAA,EAAUC,MAIC,qBAAXF,GAERG,UAAW,SAAoB,GAAhBF,IAAAA,EAAAA,EAAAA,SACPN,OAAAA,EAAa,oBAAqB,CACxCP,MAAOa,EAASC,IAAId,MACpBC,UAAWY,EAASC,IAAIE,WACxBd,aAAcW,EAASC,IAAIG,cAC3Bd,UAAWU,EAASC,IAAII,iBAOdZ,EAAAA,EAAAA,QAAAA,QAAAA;;ACpBf,aAHA,IAAA,EAAA,EAAA,QAAA,0BACA,EAAA,EAAA,QAAA,gCAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAfA,IAOI9B,EAAAA,GALF2C,EADDX,EAAAA,OACCW,kBAGA1C,EADDC,EAAAA,KACCD,GAUF0C,EAAmB,oBAAqB,CACvCnB,MAAOvB,EAAI,sBAAuB,cAClC2C,YAAa3C,EAAI,8EAA+E,cAChG4C,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,oBAENC,SAAU,aACV3B,WAAY,CACXE,MAAO,CACNU,KAAM,SACNgB,QAASjD,EAAI,SAAU,eAExBwB,UAAW,CACVS,KAAM,SACNgB,QAAS,GAEVxB,aAAc,CACbQ,KAAM,SACNgB,QAAS,UAEVvB,UAAW,CACVO,KAAM,UACNgB,SAAS,IAGXC,KAAM7C,EA3BiC,QA4BvCwB,WAAYA,EAAAA","file":"dynamic-groups.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Groups ordering types.\n *\n * @type {Array}\n */\nexport const TYPES = [\n\t{\n\t\tlabel: __( 'Newest', 'buddypress' ),\n\t\tvalue: 'newest',\n\t},\n\t{\n\t\tlabel: __( 'Active', 'buddypress' ),\n\t\tvalue: 'active',\n\t},\n\t{\n\t\tlabel: __( 'Popular', 'buddypress' ),\n\t\tvalue: 'popular',\n\t},\n\t{\n\t\tlabel: __('Alphabetical', 'buddypress' ),\n\t\tvalue: 'alphabetical',\n\t},\n];\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tPanelBody,\n\t\tRangeControl,\n\t\tSelectControl,\n\t\tTextControl,\n\t\tToggleControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tServerSideRender,\n\t},\n} = bp;\n\n/**\n * Internal dependencies.\n */\nimport { TYPES } from './constants';\n\nconst editDynamicGroupsBlock = ( { attributes, setAttributes } ) => {\n\tconst { title, maxGroups, groupDefault, linkTitle } = attributes;\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( text ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: text } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max groups to show', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ maxGroups }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { maxGroups: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ 10 }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Default groups to show', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ groupDefault }\n\t\t\t\t\t\toptions={ TYPES }\n\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\tsetAttributes( { groupDefault: option } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link block title to Groups directory', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! linkTitle }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { linkTitle: ! linkTitle } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/dynamic-groups\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editDynamicGroupsBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Legacy Widget to Dynamic Groups Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_groups_widget';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\treturn createBlock( 'bp/dynamic-groups', {\n\t\t\t\t\ttitle: instance.raw.title,\n\t\t\t\t\tmaxGroups: instance.raw.max_groups,\n\t\t\t\t\tgroupDefault: instance.raw.group_default,\n\t\t\t\t\tlinkTitle: instance.raw.link_title,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editDynamicGroupsBlock from './dynamic-groups/edit';\nimport transforms from './dynamic-groups/transforms';\n\nregisterBlockType( 'bp/dynamic-groups', {\n\ttitle: __( 'Dynamic Groups List', 'buddypress' ),\n\tdescription: __( 'A dynamic list of recently active, popular, newest, or alphabetical groups.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'buddicons-groups',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t\tdefault: __( 'Groups', 'buddypress' ),\n\t\t},\n\t\tmaxGroups: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 5\n\t\t},\n\t\tgroupDefault: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'active',\n\t\t},\n\t\tlinkTitle: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tedit: editDynamicGroupsBlock,\n\ttransforms: transforms,\n} );\n"]}
bp-groups/js/blocks/group.js CHANGED
@@ -1,8 +1,8 @@
1
  parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"atl5":[function(require,module,exports) {
2
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GROUP_STATI=exports.AVATAR_SIZES=void 0;var e=wp,s=e.i18n.__,d=[{label:s("None","buddypress"),value:"none"},{label:s("Thumb","buddypress"),value:"thumb"},{label:s("Full","buddypress"),value:"full"}];exports.AVATAR_SIZES=d;var r={public:s("Public","buddypress"),private:s("Private","buddypress"),hidden:s("Hidden","buddypress")};exports.GROUP_STATI=r;
3
  },{}],"cCC3":[function(require,module,exports) {
4
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./constants"),t=wp,o=t.blockEditor,r=o.InspectorControls,n=o.BlockControls,s=t.components,a=s.Placeholder,i=s.Disabled,l=s.PanelBody,u=s.SelectControl,d=s.ToggleControl,p=s.Toolbar,c=s.ToolbarButton,g=t.compose.compose,b=t.data.withSelect,h=t.editor.ServerSideRender,y=t.element,m=y.Fragment,v=y.createElement,S=t.i18n.__,C=bp.blockComponents.AutoCompleter,I=function(t){return t&&t.status&&e.GROUP_STATI[t.status]?e.GROUP_STATI[t.status]:null},f=function(t){var o=t.attributes,s=t.setAttributes,g=t.bpSettings,b=g.isAvatarEnabled,y=g.isCoverImageEnabled,f=o.avatarSize,A=o.displayDescription,T=o.displayActionButton,k=o.displayCoverImage;return o.itemID?v(m,null,v(n,null,v(p,null,v(c,{icon:"edit",title:S("Select another group","buddypress"),onClick:function(){s({itemID:0})}}))),v(r,null,v(l,{title:S("Settings","buddypress"),initialOpen:!0},v(d,{label:S("Display Group's home button","buddypress"),checked:!!T,onChange:function(){s({displayActionButton:!T})},help:S(T?"Include a link to the group's home page under their name.":"Toggle to display a link to the group's home page under their name.","buddypress")}),v(d,{label:S("Display group's description","buddypress"),checked:!!A,onChange:function(){s({displayDescription:!A})},help:S(A?"Include the group's description under their name.":"Toggle to display the group's description under their name.","buddypress")}),b&&v(u,{label:S("Avatar size","buddypress"),value:f,options:e.AVATAR_SIZES,help:S('Select "None" to disable the avatar.',"buddypress"),onChange:function(e){s({avatarSize:e})}}),y&&v(d,{label:S("Display Cover Image","buddypress"),checked:!!k,onChange:function(){s({displayCoverImage:!k})},help:S(k?"Include the group's cover image over their name.":"Toggle to display the group's cover image over their name.","buddypress")}))),v(i,null,v(h,{block:"bp/group",attributes:o}))):v(a,{icon:"buddicons-groups",label:S("BuddyPress Group","buddypress"),instructions:S("Start typing the name of the group you want to feature into this post.","buddypress")},v(C,{component:"groups",objectQueryArgs:{show_hidden:!1},slugValue:I,ariaLabel:S("Group's name","buddypress"),placeholder:S("Enter Group's name here…","buddypress"),onSelectItem:s,useAvatar:b}))},A=g([b(function(e){return{bpSettings:e("core/editor").getEditorSettings().bp.groups||{}}})])(f),T=A;exports.default=T;
5
  },{"./constants":"atl5"}],"pvse":[function(require,module,exports) {
6
- "use strict";var e=t(require("./group/edit"));function t(e){return e&&e.__esModule?e:{default:e}}var r=wp,u=r.blocks.registerBlockType,d=r.i18n.__;u("bp/group",{title:d("Group","buddypress"),description:d("BuddyPress Group.","buddypress"),icon:"buddicons-groups",category:"buddypress",attributes:{itemID:{type:"integer",default:0},avatarSize:{type:"string",default:"full"},displayDescription:{type:"boolean",default:!0},displayActionButton:{type:"boolean",default:!0},displayCoverImage:{type:"boolean",default:!0}},edit:e.default});
7
  },{"./group/edit":"cCC3"}]},{},["pvse"], null)
8
  //# sourceMappingURL=/bp-groups/js/blocks/group.js.map
1
  parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"atl5":[function(require,module,exports) {
2
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GROUP_STATI=exports.AVATAR_SIZES=void 0;var e=wp,s=e.i18n.__,d=[{label:s("None","buddypress"),value:"none"},{label:s("Thumb","buddypress"),value:"thumb"},{label:s("Full","buddypress"),value:"full"}];exports.AVATAR_SIZES=d;var r={public:s("Public","buddypress"),private:s("Private","buddypress"),hidden:s("Hidden","buddypress")};exports.GROUP_STATI=r;
3
  },{}],"cCC3":[function(require,module,exports) {
4
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./constants"),t=wp,o=t.blockEditor,r=o.InspectorControls,s=o.BlockControls,n=t.components,a=n.Placeholder,l=n.Disabled,u=n.PanelBody,i=n.SelectControl,p=n.ToggleControl,d=n.Toolbar,c=n.ToolbarButton,b=t.element,g=b.Fragment,h=b.createElement,y=t.i18n.__,m=bp,v=m.blockComponents,C=v.AutoCompleter,S=v.ServerSideRender,A=m.blockData.isActive,I=function(t){return t&&t.status&&e.GROUP_STATI[t.status]?e.GROUP_STATI[t.status]:null},f=function(t){var o=t.attributes,n=t.setAttributes,b=A("groups","avatar"),m=A("groups","cover"),v=o.avatarSize,f=o.displayDescription,k=o.displayActionButton,T=o.displayCoverImage;return o.itemID?h(g,null,h(s,null,h(d,{label:y("Block toolbar","buddypress")},h(c,{icon:"edit",title:y("Select another group","buddypress"),onClick:function(){n({itemID:0})}}))),h(r,null,h(u,{title:y("Settings","buddypress"),initialOpen:!0},h(p,{label:y("Display Group's home button","buddypress"),checked:!!k,onChange:function(){n({displayActionButton:!k})},help:y(k?"Include a link to the group's home page under their name.":"Toggle to display a link to the group's home page under their name.","buddypress")}),h(p,{label:y("Display group's description","buddypress"),checked:!!f,onChange:function(){n({displayDescription:!f})},help:y(f?"Include the group's description under their name.":"Toggle to display the group's description under their name.","buddypress")}),b&&h(i,{label:y("Avatar size","buddypress"),value:v,options:e.AVATAR_SIZES,help:y('Select "None" to disable the avatar.',"buddypress"),onChange:function(e){n({avatarSize:e})}}),m&&h(p,{label:y("Display Cover Image","buddypress"),checked:!!T,onChange:function(){n({displayCoverImage:!T})},help:y(T?"Include the group's cover image over their name.":"Toggle to display the group's cover image over their name.","buddypress")}))),h(l,null,h(S,{block:"bp/group",attributes:o}))):h(a,{icon:"buddicons-groups",label:y("BuddyPress Group","buddypress"),instructions:y("Start typing the name of the group you want to feature into this post.","buddypress")},h(C,{component:"groups",objectQueryArgs:{show_hidden:!1},slugValue:I,ariaLabel:y("Group's name","buddypress"),placeholder:y("Enter Group's name here…","buddypress"),onSelectItem:n,useAvatar:b}))},k=f;exports.default=k;
5
  },{"./constants":"atl5"}],"pvse":[function(require,module,exports) {
6
+ "use strict";var e=t(require("./group/edit"));function t(e){return e&&e.__esModule?e:{default:e}}var r=wp,d=r.blocks.registerBlockType,u=r.i18n.__;d("bp/group",{title:u("Group","buddypress"),description:u("BuddyPress Group.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"buddicons-groups"},category:"buddypress",attributes:{itemID:{type:"integer",default:0},avatarSize:{type:"string",default:"full"},displayDescription:{type:"boolean",default:!0},displayActionButton:{type:"boolean",default:!0},displayCoverImage:{type:"boolean",default:!0}},edit:e.default});
7
  },{"./group/edit":"cCC3"}]},{},["pvse"], null)
8
  //# sourceMappingURL=/bp-groups/js/blocks/group.js.map
bp-groups/js/blocks/group.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["bp-groups/js/blocks/group/constants.js","bp-groups/js/blocks/group/edit.js","bp-groups/js/blocks/group.js"],"names":["wp","__","i18n","AVATAR_SIZES","label","value","GROUP_STATI","public","private","hidden","editGroupBlock","blockEditor","InspectorControls","BlockControls","components","Placeholder","Disabled","PanelBody","SelectControl","ToggleControl","Toolbar","ToolbarButton","compose","withSelect","data","ServerSideRender","editor","element","Fragment","createElement","AutoCompleter","bp","blockComponents","getSlugValue","item","status","editGroup","attributes","setAttributes","bpSettings","isAvatarEnabled","isCoverImageEnabled","avatarSize","displayDescription","displayActionButton","displayCoverImage","itemID","option","select","getEditorSettings","groups","registerBlockType","blocks","title","description","icon","category","type","default","edit"],"mappings":";AAkCO,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,YAAA,QAAA,kBAAA,EA3BHA,IAAAA,EAAAA,GAFFC,EADDC,EAAAA,KACCD,GASWE,EAAe,CAC3B,CACCC,MAAOH,EAAI,OAAQ,cACnBI,MAAO,QAER,CACCD,MAAOH,EAAI,QAAS,cACpBI,MAAO,SAER,CACCD,MAAOH,EAAI,OAAQ,cACnBI,MAAO,SASF,QAAA,aAAA,EAAA,IAAMC,EAAc,CAC1BC,OAAQN,EAAI,SAAU,cACtBO,QAASP,EAAI,UAAW,cACxBQ,OAAQR,EAAI,SAAU,eAHhB,QAAA,YAAA;;ACgIQS,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAvHf,IAAA,EAAA,QAAA,eAVIV,EAAAA,GA7BHW,EAAAA,EAAAA,YACCC,EAAAA,EAAAA,kBACAC,EAAAA,EAAAA,cAEDC,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,YACAC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,cACAC,EAAAA,EAAAA,cACAC,EAAAA,EAAAA,QACAC,EAAAA,EAAAA,cAGAC,EADDA,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\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Avatar sizes.\n *\n * @type {Array}\n */\nexport const AVATAR_SIZES = [\n\t{\n\t\tlabel: __( 'None', 'buddypress' ),\n\t\tvalue: 'none',\n\t},\n\t{\n\t\tlabel: __( 'Thumb', 'buddypress' ),\n\t\tvalue: 'thumb',\n\t},\n\t{\n\t\tlabel: __( 'Full', 'buddypress' ),\n\t\tvalue: 'full',\n\t},\n];\n\n/**\n * Group stati.\n *\n * @type {Object}\n */\nexport const GROUP_STATI = {\n\tpublic: __( 'Public', 'buddypress' ),\n\tprivate: __( 'Private', 'buddypress' ),\n\thidden: __( 'Hidden', 'buddypress' ),\n};\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t\tBlockControls,\n\t},\n\tcomponents: {\n\t\tPlaceholder,\n\t\tDisabled,\n\t\tPanelBody,\n\t\tSelectControl,\n\t\tToggleControl,\n\t\tToolbar,\n\t\tToolbarButton,\n\t},\n\tcompose: {\n\t\tcompose,\n\t},\n\tdata: {\n\t\twithSelect,\n\t},\n\teditor: {\n\t\tServerSideRender,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst { AutoCompleter } = bp.blockComponents;\n\n/**\n * Internal dependencies.\n */\nimport { AVATAR_SIZES, GROUP_STATI } from './constants';\n\nconst getSlugValue = ( item ) => {\n\tif ( item && item.status && GROUP_STATI[ item.status ] ) {\n\t\treturn GROUP_STATI[ item.status ];\n\t}\n\n\treturn null;\n}\n\nconst editGroup = ( { attributes, setAttributes, bpSettings } ) => {\n\tconst { isAvatarEnabled, isCoverImageEnabled } = bpSettings;\n\tconst { avatarSize, displayDescription, displayActionButton, displayCoverImage } = attributes;\n\n\tif ( ! attributes.itemID ) {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon=\"buddicons-groups\"\n\t\t\t\tlabel={ __( 'BuddyPress Group', 'buddypress' ) }\n\t\t\t\tinstructions={ __( 'Start typing the name of the group you want to feature into this post.', 'buddypress' ) }\n\t\t\t>\n\t\t\t\t<AutoCompleter\n\t\t\t\t\tcomponent=\"groups\"\n\t\t\t\t\tobjectQueryArgs={ { 'show_hidden': false } }\n\t\t\t\t\tslugValue={ getSlugValue }\n\t\t\t\t\tariaLabel={ __( 'Group\\'s name', 'buddypress' ) }\n\t\t\t\t\tplaceholder={ __( 'Enter Group\\'s name here…', 'buddypress' ) }\n\t\t\t\t\tonSelectItem={ setAttributes }\n\t\t\t\t\tuseAvatar={ isAvatarEnabled }\n\t\t\t\t/>\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<Toolbar>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon=\"edit\"\n\t\t\t\t\t\ttitle={ __( 'Select another group', 'buddypress' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetAttributes( { itemID: 0 } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Toolbar>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display Group\\'s home button', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! displayActionButton }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { displayActionButton: ! displayActionButton } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tdisplayActionButton\n\t\t\t\t\t\t\t\t? __( 'Include a link to the group\\'s home page under their name.', 'buddypress' )\n\t\t\t\t\t\t\t\t: __( 'Toggle to display a link to the group\\'s home page under their name.', 'buddypress' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display group\\'s description', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! displayDescription }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { displayDescription: ! displayDescription } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tdisplayDescription\n\t\t\t\t\t\t\t\t? __( 'Include the group\\'s description under their name.', 'buddypress' )\n\t\t\t\t\t\t\t\t: __( 'Toggle to display the group\\'s description under their name.', 'buddypress' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ isAvatarEnabled && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size', 'buddypress' ) }\n\t\t\t\t\t\t\tvalue={ avatarSize }\n\t\t\t\t\t\t\toptions={ AVATAR_SIZES }\n\t\t\t\t\t\t\thelp={ __( 'Select \"None\" to disable the avatar.', 'buddypress' ) }\n\t\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { avatarSize: option } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isCoverImageEnabled && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display Cover Image', 'buddypress' ) }\n\t\t\t\t\t\t\tchecked={ !! displayCoverImage }\n\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { displayCoverImage: ! displayCoverImage } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tdisplayCoverImage\n\t\t\t\t\t\t\t\t\t? __( 'Include the group\\'s cover image over their name.', 'buddypress' )\n\t\t\t\t\t\t\t\t\t: __( 'Toggle to display the group\\'s cover image over their name.', 'buddypress' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/group\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nconst editGroupBlock = compose( [\n\twithSelect( ( select ) => {\n\t\tconst editorSettings = select( 'core/editor' ).getEditorSettings();\n\t\treturn {\n\t\t\tbpSettings: editorSettings.bp.groups || {},\n\t\t};\n\t} ),\n] )( editGroup );\n\nexport default editGroupBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editGroupBlock from './group/edit';\n\nregisterBlockType( 'bp/group', {\n\ttitle: __( 'Group', 'buddypress' ),\n\tdescription: __( 'BuddyPress Group.', 'buddypress' ),\n\ticon: 'buddicons-groups',\n\tcategory: 'buddypress',\n\tattributes: {\n\t\titemID: {\n\t\t\ttype: 'integer',\n\t\t\tdefault: 0,\n\t\t},\n\t\tavatarSize: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'full',\n\t\t},\n\t\tdisplayDescription: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\tdisplayActionButton: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\tdisplayCoverImage: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t},\n\tedit: editGroupBlock,\n} );\n"]}
1
+ {"version":3,"sources":["bp-groups/js/blocks/group/constants.js","bp-groups/js/blocks/group/edit.js","bp-groups/js/blocks/group.js"],"names":["wp","__","i18n","AVATAR_SIZES","label","value","GROUP_STATI","public","private","hidden","editGroupBlock","blockEditor","InspectorControls","BlockControls","components","Placeholder","Disabled","PanelBody","SelectControl","ToggleControl","Toolbar","ToolbarButton","element","Fragment","createElement","bp","blockComponents","AutoCompleter","ServerSideRender","isActive","blockData","getSlugValue","item","status","attributes","setAttributes","isAvatarEnabled","isCoverImageEnabled","avatarSize","displayDescription","displayActionButton","displayCoverImage","itemID","option","registerBlockType","blocks","title","description","icon","background","foreground","src","category","type","default","edit"],"mappings":";AAkCO,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,YAAA,QAAA,kBAAA,EA/BP,IAIIA,EAAAA,GAFFC,EADDC,EAAAA,KACCD,GASWE,EAAe,CAC3B,CACCC,MAAOH,EAAI,OAAQ,cACnBI,MAAO,QAER,CACCD,MAAOH,EAAI,QAAS,cACpBI,MAAO,SAER,CACCD,MAAOH,EAAI,OAAQ,cACnBI,MAAO,SASF,QAAA,aAAA,EAAA,IAAMC,EAAc,CAC1BC,OAAQN,EAAI,SAAU,cACtBO,QAASP,EAAI,UAAW,cACxBQ,OAAQR,EAAI,SAAU,eAHhB,QAAA,YAAA;;ACuHQS,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EA/Gf,IAAA,EAAA,QAAA,eAlBIV,EAAAA,GApBHW,EAAAA,EAAAA,YACCC,EAAAA,EAAAA,kBACAC,EAAAA,EAAAA,cAEDC,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,YACAC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,cACAC,EAAAA,EAAAA,cACAC,EAAAA,EAAAA,QACAC,EAAAA,EAAAA,cAEDC,EAAAA,EAAAA,QACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,cAGAvB,EADDC,EAAAA,KACCD,GAeEwB,EAAAA,GAPHC,EAAAA,EAAAA,gBACCC,EAAAA,EAAAA,cACAC,EAAAA,EAAAA,iBAGAC,EADDC,EAAAA,UACCD,SASIE,EAAe,SAAEC,GACjBA,OAAAA,GAAQA,EAAKC,QAAU3B,EAAa0B,YAAAA,EAAKC,QACtC3B,EAAa0B,YAAAA,EA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AAoB,cAChC,aAAeA,EAAI,yEAA0E,eAE7F,EAAC,EAAD,CACC,UAAU,SACV,gBAAkB,CAAiB,aAAA,GACnC,UAAY8B,EACZ,UAAY9B,EAAI,eAAiB,cACjC,YAAcA,EAAI,2BAA6B,cAC/C,aAAekC,EACf,UAAYC,MAkFF1B,EAAAA,EAAAA,QAAAA,QAAAA;;ACxIf,aAFA,IAAA,EAAA,EAAA,QAAA,iBAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAdA,IAOIV,EAAAA,GALF4C,EADDC,EAAAA,OACCD,kBAGA3C,EADDC,EAAAA,KACCD,GASF2C,EAAmB,WAAY,CAC9BE,MAAO7C,EAAI,QAAS,cACpB8C,YAAa9C,EAAI,oBAAqB,cACtC+C,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,oBAENC,SAAU,aACVlB,WAAY,CACXQ,OAAQ,CACPW,KAAM,UACNC,QAAS,GAEVhB,WAAY,CACXe,KAAM,SACNC,QAAS,QAEVf,mBAAoB,CACnBc,KAAM,UACNC,SAAS,GAEVd,oBAAqB,CACpBa,KAAM,UACNC,SAAS,GAEVb,kBAAmB,CAClBY,KAAM,UACNC,SAAS,IAGXC,KAAM7C,EAAAA","file":"group.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Avatar sizes.\n *\n * @type {Array}\n */\nexport const AVATAR_SIZES = [\n\t{\n\t\tlabel: __( 'None', 'buddypress' ),\n\t\tvalue: 'none',\n\t},\n\t{\n\t\tlabel: __( 'Thumb', 'buddypress' ),\n\t\tvalue: 'thumb',\n\t},\n\t{\n\t\tlabel: __( 'Full', 'buddypress' ),\n\t\tvalue: 'full',\n\t},\n];\n\n/**\n * Group stati.\n *\n * @type {Object}\n */\nexport const GROUP_STATI = {\n\tpublic: __( 'Public', 'buddypress' ),\n\tprivate: __( 'Private', 'buddypress' ),\n\thidden: __( 'Hidden', 'buddypress' ),\n};\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t\tBlockControls,\n\t},\n\tcomponents: {\n\t\tPlaceholder,\n\t\tDisabled,\n\t\tPanelBody,\n\t\tSelectControl,\n\t\tToggleControl,\n\t\tToolbar,\n\t\tToolbarButton,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tAutoCompleter,\n\t\tServerSideRender,\n\t},\n\tblockData: {\n\t\tisActive,\n\t}\n} = bp;\n\n/**\n * Internal dependencies.\n */\nimport { AVATAR_SIZES, GROUP_STATI } from './constants';\n\nconst getSlugValue = ( item ) => {\n\tif ( item && item.status && GROUP_STATI[ item.status ] ) {\n\t\treturn GROUP_STATI[ item.status ];\n\t}\n\n\treturn null;\n}\n\nconst editGroupBlock = ( { attributes, setAttributes } ) => {\n\tconst isAvatarEnabled = isActive( 'groups', 'avatar' );\n\tconst isCoverImageEnabled = isActive( 'groups', 'cover' );\n\tconst { avatarSize, displayDescription, displayActionButton, displayCoverImage } = attributes;\n\n\tif ( ! attributes.itemID ) {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon=\"buddicons-groups\"\n\t\t\t\tlabel={ __( 'BuddyPress Group', 'buddypress' ) }\n\t\t\t\tinstructions={ __( 'Start typing the name of the group you want to feature into this post.', 'buddypress' ) }\n\t\t\t>\n\t\t\t\t<AutoCompleter\n\t\t\t\t\tcomponent=\"groups\"\n\t\t\t\t\tobjectQueryArgs={ { 'show_hidden': false } }\n\t\t\t\t\tslugValue={ getSlugValue }\n\t\t\t\t\tariaLabel={ __( 'Group\\'s name', 'buddypress' ) }\n\t\t\t\t\tplaceholder={ __( 'Enter Group\\'s name here…', 'buddypress' ) }\n\t\t\t\t\tonSelectItem={ setAttributes }\n\t\t\t\t\tuseAvatar={ isAvatarEnabled }\n\t\t\t\t/>\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<Toolbar label={ __( 'Block toolbar', 'buddypress' ) }>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon=\"edit\"\n\t\t\t\t\t\ttitle={ __( 'Select another group', 'buddypress' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetAttributes( { itemID: 0 } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Toolbar>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display Group\\'s home button', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! displayActionButton }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { displayActionButton: ! displayActionButton } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tdisplayActionButton\n\t\t\t\t\t\t\t\t? __( 'Include a link to the group\\'s home page under their name.', 'buddypress' )\n\t\t\t\t\t\t\t\t: __( 'Toggle to display a link to the group\\'s home page under their name.', 'buddypress' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display group\\'s description', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! displayDescription }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { displayDescription: ! displayDescription } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tdisplayDescription\n\t\t\t\t\t\t\t\t? __( 'Include the group\\'s description under their name.', 'buddypress' )\n\t\t\t\t\t\t\t\t: __( 'Toggle to display the group\\'s description under their name.', 'buddypress' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ isAvatarEnabled && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size', 'buddypress' ) }\n\t\t\t\t\t\t\tvalue={ avatarSize }\n\t\t\t\t\t\t\toptions={ AVATAR_SIZES }\n\t\t\t\t\t\t\thelp={ __( 'Select \"None\" to disable the avatar.', 'buddypress' ) }\n\t\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { avatarSize: option } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isCoverImageEnabled && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display Cover Image', 'buddypress' ) }\n\t\t\t\t\t\t\tchecked={ !! displayCoverImage }\n\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { displayCoverImage: ! displayCoverImage } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tdisplayCoverImage\n\t\t\t\t\t\t\t\t\t? __( 'Include the group\\'s cover image over their name.', 'buddypress' )\n\t\t\t\t\t\t\t\t\t: __( 'Toggle to display the group\\'s cover image over their name.', 'buddypress' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/group\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editGroupBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editGroupBlock from './group/edit';\n\nregisterBlockType( 'bp/group', {\n\ttitle: __( 'Group', 'buddypress' ),\n\tdescription: __( 'BuddyPress Group.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'buddicons-groups',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\titemID: {\n\t\t\ttype: 'integer',\n\t\t\tdefault: 0,\n\t\t},\n\t\tavatarSize: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'full',\n\t\t},\n\t\tdisplayDescription: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\tdisplayActionButton: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\tdisplayCoverImage: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t},\n\tedit: editGroupBlock,\n} );\n"]}
bp-groups/js/blocks/groups.js CHANGED
@@ -1,28 +1,28 @@
1
- parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"LGpM":[function(require,module,exports) {
2
  function n(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,l=new Array(r);e<r;e++)l[e]=n[e];return l}module.exports=n;
3
  },{}],"o3SL":[function(require,module,exports) {
4
  var r=require("./arrayLikeToArray");function a(a){if(Array.isArray(a))return r(a)}module.exports=a;
5
- },{"./arrayLikeToArray":"LGpM"}],"lZpU":[function(require,module,exports) {
6
  function e(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}module.exports=e;
7
- },{}],"Vzqv":[function(require,module,exports) {
8
  var r=require("./arrayLikeToArray");function t(t,e){if(t){if("string"==typeof t)return r(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(o):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(t,e):void 0}}module.exports=t;
9
- },{"./arrayLikeToArray":"LGpM"}],"NCaH":[function(require,module,exports) {
10
  function e(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
11
  },{}],"I9dH":[function(require,module,exports) {
12
  var r=require("./arrayWithoutHoles"),e=require("./iterableToArray"),u=require("./unsupportedIterableToArray"),a=require("./nonIterableSpread");function o(o){return r(o)||e(o)||u(o)||a()}module.exports=o;
13
- },{"./arrayWithoutHoles":"o3SL","./iterableToArray":"lZpU","./unsupportedIterableToArray":"Vzqv","./nonIterableSpread":"NCaH"}],"dEOc":[function(require,module,exports) {
14
  function r(r){if(Array.isArray(r))return r}module.exports=r;
15
- },{}],"RonT":[function(require,module,exports) {
16
  function r(r,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var e=[],n=!0,o=!1,l=void 0;try{for(var i,u=r[Symbol.iterator]();!(n=(i=u.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(a){o=!0,l=a}finally{try{n||null==u.return||u.return()}finally{if(o)throw l}}return e}}module.exports=r;
17
- },{}],"sa4T":[function(require,module,exports) {
18
  function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
19
- },{}],"xkYc":[function(require,module,exports) {
20
  var r=require("./arrayWithHoles"),e=require("./iterableToArrayLimit"),t=require("./unsupportedIterableToArray"),i=require("./nonIterableRest");function u(u,a){return r(u)||e(u,a)||t(u,a)||i()}module.exports=u;
21
- },{"./arrayWithHoles":"dEOc","./iterableToArrayLimit":"RonT","./unsupportedIterableToArray":"Vzqv","./nonIterableRest":"sa4T"}],"jS06":[function(require,module,exports) {
22
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EXTRA_INFO=exports.GROUP_STATI=exports.AVATAR_SIZES=void 0;var e=wp,s=e.i18n.__,r=[{label:s("None","buddypress"),value:"none"},{label:s("Thumb","buddypress"),value:"thumb"},{label:s("Full","buddypress"),value:"full"}];exports.AVATAR_SIZES=r;var u={public:s("Public","buddypress"),private:s("Private","buddypress"),hidden:s("Hidden","buddypress")};exports.GROUP_STATI=u;var l=[{label:s("None","buddypress"),value:"none"},{label:s("Group's description","buddypress"),value:"description"},{label:s("Last time the group was active","buddypress"),value:"active"},{label:s("Amount of group members","buddypress"),value:"popular"}];exports.EXTRA_INFO=l;
23
  },{}],"Ccmh":[function(require,module,exports) {
24
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("@babel/runtime/helpers/toConsumableArray")),t=n(require("@babel/runtime/helpers/slicedToArray")),r=require("./constants");function n(e){return e&&e.__esModule?e:{default:e}}var o=wp,s=o.blockEditor,a=s.InspectorControls,i=s.BlockControls,l=o.components,u=l.Placeholder,d=l.PanelBody,c=l.SelectControl,p=l.ToggleControl,m=l.Button,b=l.Dashicon,g=l.Tooltip,f=l.ToolbarGroup,v=l.RangeControl,y=o.compose.compose,h=o.data.withSelect,_=o.element,A=_.createElement,S=_.Fragment,C=_.useState,I=o.i18n,x=I.__,N=I.sprintf,k=I._n,T=o.apiFetch,G=o.url.addQueryArgs,P=bp.blockComponents.AutoCompleter,O=lodash,E=O.reject,R=O.remove,w=O.sortBy,D=function(e){return e&&e.status&&r.GROUP_STATI[e.status]?r.GROUP_STATI[e.status]:null},B=function(n){var o,s=n.attributes,l=n.setAttributes,y=n.isSelected,h=n.bpSettings.isAvatarEnabled,_=s.itemIDs,I=s.avatarSize,O=s.displayGroupName,B=s.extraInfo,q=s.layoutPreference,F=s.columns,j=0!==_.length,z=C([]),L=(0,t.default)(z,2),M=L[0],Q=L[1],U=[{icon:"text",title:x("List view","buddypress"),onClick:function(){return l({layoutPreference:"list"})},isActive:"list"===q},{icon:"screenoptions",title:x("Grid view","buddypress"),onClick:function(){return l({layoutPreference:"grid"})},isActive:"grid"===q}],V="bp-block-groups avatar-"+I,X=r.EXTRA_INFO;"grid"===q&&(V+=" is-grid columns-"+F,X=r.EXTRA_INFO.filter(function(e){return"description"!==e.value}));return j&&_.length!==M.length&&T({path:G("/buddypress/v1/groups",{populate_extras:!0,include:_})}).then(function(e){Q(w(e,[function(e){return _.indexOf(e.id)}]))}),M.length&&(o=M.map(function(e){var t=!1,r="group-content";return"list"===q&&"description"===B&&e.description&&e.description.rendered&&(t=!0,r="group-content has-description"),A("div",{key:"bp-group-"+e.id,className:r},y&&A(g,{text:x("Remove group","buddypress")},A(m,{className:"is-right",onClick:function(){var t;(t=e.id)&&-1!==_.indexOf(t)&&(Q(E(M,["id",t])),l({itemIDs:R(_,function(e){return e!==t})}))},label:x("Remove group","buddypress")},A(b,{icon:"no"}))),h&&"none"!==I&&A("div",{className:"item-header-avatar"},A("a",{href:e.link,target:"_blank"},A("img",{key:"avatar-"+e.id,className:"avatar",alt:N(x("Profile photo of %s","buddypress"),e.name),src:e.avatar_urls[I]}))),A("div",{className:"group-description"},O&&A("strong",null,A("a",{href:e.link,target:"_blank"},e.name)),t&&A("div",{className:"group-description-content",dangerouslySetInnerHTML:{__html:e.description.rendered}}),"active"===B&&e.last_activity&&e.last_activity_diff&&A("time",{dateTime:e.last_activity},N(x("Active %s","buddypress"),e.last_activity_diff)),"popular"===B&&e.total_member_count&&A("div",{className:"group-meta"},N(k("%1$d member","%1$d members",e.total_member_count,"buddypress"),e.total_member_count))))})),A(S,null,A(a,null,A(d,{title:x("Settings","buddypress"),initialOpen:!0},A(p,{label:x("Display the group's name","buddypress"),checked:!!O,onChange:function(){l({displayGroupName:!O})},help:x(O?"Include the group's name.":"Toggle to include group's name.","buddypress")}),h&&A(c,{label:x("Avatar size","buddypress"),value:I,options:r.AVATAR_SIZES,help:x('Select "None" to disable the avatar.',"buddypress"),onChange:function(e){l({avatarSize:e})}}),A(c,{label:x("Group extra information","buddypress"),value:B,options:X,help:x('Select "None" to show no extra information.',"buddypress"),onChange:function(e){l({extraInfo:e})}}),"grid"===q&&A(v,{label:x("Columns","buddypress"),value:F,onChange:function(e){return l({columns:e})},min:2,max:4,required:!0}))),A(i,null,A(f,{controls:U})),j&&A("div",{className:V},o),(y||0===_.length)&&A(u,{icon:j?"":"groups",label:j?"":x("BuddyPress Groups","buddypress"),instructions:x("Start typing the name of the group you want to add to the groups list.","buddypress"),className:0!==_.length?"is-appender":"is-large"},A(P,{component:"groups",objectQueryArgs:{show_hidden:!1,exclude:_},slugValue:D,ariaLabel:x("Group's name","buddypress"),placeholder:x("Enter Group's name here…","buddypress"),onSelectItem:function(t){var r=t.itemID;r&&-1===_.indexOf(r)&&l({itemIDs:[].concat((0,e.default)(_),[parseInt(r,10)])})},useAvatar:h})))},q=y([h(function(e){return{bpSettings:e("core/editor").getEditorSettings().bp.groups||{}}})])(B),F=q;exports.default=F;
25
- },{"@babel/runtime/helpers/toConsumableArray":"I9dH","@babel/runtime/helpers/slicedToArray":"xkYc","./constants":"jS06"}],"jcTh":[function(require,module,exports) {
26
- "use strict";var e=t(require("./groups/edit"));function t(e){return e&&e.__esModule?e:{default:e}}var r=wp,s=r.blocks.registerBlockType,u=r.i18n.__;s("bp/groups",{title:u("Groups","buddypress"),description:u("BuddyPress Groups.","buddypress"),icon:"buddicons-groups",category:"buddypress",attributes:{itemIDs:{type:"array",items:{type:"integer"},default:[]},avatarSize:{type:"string",default:"full"},displayGroupName:{type:"boolean",default:!0},extraInfo:{type:"string",default:"none"},layoutPreference:{type:"string",default:"list"},columns:{type:"number",default:2}},edit:e.default});
27
  },{"./groups/edit":"Ccmh"}]},{},["jcTh"], null)
28
  //# sourceMappingURL=/bp-groups/js/blocks/groups.js.map
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"jEQo":[function(require,module,exports) {
2
  function n(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,l=new Array(r);e<r;e++)l[e]=n[e];return l}module.exports=n;
3
  },{}],"o3SL":[function(require,module,exports) {
4
  var r=require("./arrayLikeToArray");function a(a){if(Array.isArray(a))return r(a)}module.exports=a;
5
+ },{"./arrayLikeToArray":"jEQo"}],"lZpU":[function(require,module,exports) {
6
  function e(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}module.exports=e;
7
+ },{}],"Dbv9":[function(require,module,exports) {
8
  var r=require("./arrayLikeToArray");function t(t,e){if(t){if("string"==typeof t)return r(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(o):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(t,e):void 0}}module.exports=t;
9
+ },{"./arrayLikeToArray":"jEQo"}],"NCaH":[function(require,module,exports) {
10
  function e(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
11
  },{}],"I9dH":[function(require,module,exports) {
12
  var r=require("./arrayWithoutHoles"),e=require("./iterableToArray"),u=require("./unsupportedIterableToArray"),a=require("./nonIterableSpread");function o(o){return r(o)||e(o)||u(o)||a()}module.exports=o;
13
+ },{"./arrayWithoutHoles":"o3SL","./iterableToArray":"lZpU","./unsupportedIterableToArray":"Dbv9","./nonIterableSpread":"NCaH"}],"DCTP":[function(require,module,exports) {
14
  function r(r){if(Array.isArray(r))return r}module.exports=r;
15
+ },{}],"LoeL":[function(require,module,exports) {
16
  function r(r,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var e=[],n=!0,o=!1,l=void 0;try{for(var i,u=r[Symbol.iterator]();!(n=(i=u.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(a){o=!0,l=a}finally{try{n||null==u.return||u.return()}finally{if(o)throw l}}return e}}module.exports=r;
17
+ },{}],"MWEO":[function(require,module,exports) {
18
  function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
19
+ },{}],"DERy":[function(require,module,exports) {
20
  var r=require("./arrayWithHoles"),e=require("./iterableToArrayLimit"),t=require("./unsupportedIterableToArray"),i=require("./nonIterableRest");function u(u,a){return r(u)||e(u,a)||t(u,a)||i()}module.exports=u;
21
+ },{"./arrayWithHoles":"DCTP","./iterableToArrayLimit":"LoeL","./unsupportedIterableToArray":"Dbv9","./nonIterableRest":"MWEO"}],"jS06":[function(require,module,exports) {
22
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EXTRA_INFO=exports.GROUP_STATI=exports.AVATAR_SIZES=void 0;var e=wp,s=e.i18n.__,r=[{label:s("None","buddypress"),value:"none"},{label:s("Thumb","buddypress"),value:"thumb"},{label:s("Full","buddypress"),value:"full"}];exports.AVATAR_SIZES=r;var u={public:s("Public","buddypress"),private:s("Private","buddypress"),hidden:s("Hidden","buddypress")};exports.GROUP_STATI=u;var l=[{label:s("None","buddypress"),value:"none"},{label:s("Group's description","buddypress"),value:"description"},{label:s("Last time the group was active","buddypress"),value:"active"},{label:s("Amount of group members","buddypress"),value:"popular"}];exports.EXTRA_INFO=l;
23
  },{}],"Ccmh":[function(require,module,exports) {
24
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("@babel/runtime/helpers/toConsumableArray")),t=n(require("@babel/runtime/helpers/slicedToArray")),r=require("./constants");function n(e){return e&&e.__esModule?e:{default:e}}var o=wp,s=o.blockEditor,a=s.InspectorControls,i=s.BlockControls,l=o.components,u=l.Placeholder,d=l.PanelBody,c=l.SelectControl,p=l.ToggleControl,m=l.Button,b=l.Dashicon,g=l.Tooltip,v=l.ToolbarGroup,f=l.RangeControl,y=o.element,h=y.createElement,_=y.Fragment,A=y.useState,C=o.i18n,I=C.__,k=C.sprintf,x=C._n,N=o.apiFetch,S=o.url.addQueryArgs,T=bp,G=T.blockComponents.AutoCompleter,P=T.blockData.isActive,O=lodash,R=O.reject,D=O.remove,w=O.sortBy,E=function(e){return e&&e.status&&r.GROUP_STATI[e.status]?r.GROUP_STATI[e.status]:null},B=function(n){var o,s=n.attributes,l=n.setAttributes,y=n.isSelected,C=P("groups","avatar"),T=s.itemIDs,O=s.avatarSize,B=s.displayGroupName,q=s.extraInfo,F=s.layoutPreference,j=s.columns,z=0!==T.length,L=A([]),M=(0,t.default)(L,2),Q=M[0],U=M[1],V=[{icon:"text",title:I("List view","buddypress"),onClick:function(){return l({layoutPreference:"list"})},isActive:"list"===F},{icon:"screenoptions",title:I("Grid view","buddypress"),onClick:function(){return l({layoutPreference:"grid"})},isActive:"grid"===F}],X="bp-block-groups avatar-"+O,$=r.EXTRA_INFO;"grid"===F&&(X+=" is-grid columns-"+j,$=r.EXTRA_INFO.filter(function(e){return"description"!==e.value}));return z&&T.length!==Q.length&&N({path:S("/buddypress/v1/groups",{populate_extras:!0,include:T})}).then(function(e){U(w(e,[function(e){return T.indexOf(e.id)}]))}),Q.length&&(o=Q.map(function(e){var t=!1,r="group-content";return"list"===F&&"description"===q&&e.description&&e.description.rendered&&(t=!0,r="group-content has-description"),h("div",{key:"bp-group-"+e.id,className:r},y&&h(g,{text:I("Remove group","buddypress")},h(m,{className:"is-right",onClick:function(){var t;(t=e.id)&&-1!==T.indexOf(t)&&(U(R(Q,["id",t])),l({itemIDs:D(T,function(e){return e!==t})}))},label:I("Remove group","buddypress")},h(b,{icon:"no"}))),C&&"none"!==O&&h("div",{className:"item-header-avatar"},h("a",{href:e.link,target:"_blank"},h("img",{key:"avatar-"+e.id,className:"avatar",alt:k(I("Profile photo of %s","buddypress"),e.name),src:e.avatar_urls[O]}))),h("div",{className:"group-description"},B&&h("strong",null,h("a",{href:e.link,target:"_blank"},e.name)),t&&h("div",{className:"group-description-content",dangerouslySetInnerHTML:{__html:e.description.rendered}}),"active"===q&&e.last_activity&&e.last_activity_diff&&h("time",{dateTime:e.last_activity},k(I("Active %s","buddypress"),e.last_activity_diff)),"popular"===q&&e.total_member_count&&h("div",{className:"group-meta"},k(x("%1$d member","%1$d members",e.total_member_count,"buddypress"),e.total_member_count))))})),h(_,null,h(a,null,h(d,{title:I("Settings","buddypress"),initialOpen:!0},h(p,{label:I("Display the group's name","buddypress"),checked:!!B,onChange:function(){l({displayGroupName:!B})},help:I(B?"Include the group's name.":"Toggle to include group's name.","buddypress")}),C&&h(c,{label:I("Avatar size","buddypress"),value:O,options:r.AVATAR_SIZES,help:I('Select "None" to disable the avatar.',"buddypress"),onChange:function(e){l({avatarSize:e})}}),h(c,{label:I("Group extra information","buddypress"),value:q,options:$,help:I('Select "None" to show no extra information.',"buddypress"),onChange:function(e){l({extraInfo:e})}}),"grid"===F&&h(f,{label:I("Columns","buddypress"),value:j,onChange:function(e){return l({columns:e})},min:2,max:4,required:!0}))),h(i,null,h(v,{controls:V})),z&&h("div",{className:X},o),(y||0===T.length)&&h(u,{icon:z?"":"groups",label:z?"":I("BuddyPress Groups","buddypress"),instructions:I("Start typing the name of the group you want to add to the groups list.","buddypress"),className:0!==T.length?"is-appender":"is-large"},h(G,{component:"groups",objectQueryArgs:{show_hidden:!1,exclude:T},slugValue:E,ariaLabel:I("Group's name","buddypress"),placeholder:I("Enter Group's name here…","buddypress"),onSelectItem:function(t){var r=t.itemID;r&&-1===T.indexOf(r)&&l({itemIDs:[].concat((0,e.default)(T),[parseInt(r,10)])})},useAvatar:C})))},q=B;exports.default=q;
25
+ },{"@babel/runtime/helpers/toConsumableArray":"I9dH","@babel/runtime/helpers/slicedToArray":"DERy","./constants":"jS06"}],"jcTh":[function(require,module,exports) {
26
+ "use strict";var e=t(require("./groups/edit"));function t(e){return e&&e.__esModule?e:{default:e}}var r=wp,u=r.blocks.registerBlockType,s=r.i18n.__;u("bp/groups",{title:s("Groups","buddypress"),description:s("BuddyPress Groups.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"buddicons-groups"},category:"buddypress",attributes:{itemIDs:{type:"array",items:{type:"integer"},default:[]},avatarSize:{type:"string",default:"full"},displayGroupName:{type:"boolean",default:!0},extraInfo:{type:"string",default:"none"},layoutPreference:{type:"string",default:"list"},columns:{type:"number",default:2}},edit:e.default});
27
  },{"./groups/edit":"Ccmh"}]},{},["jcTh"], null)
28
  //# sourceMappingURL=/bp-groups/js/blocks/groups.js.map
bp-groups/js/blocks/groups.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArray.js","../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../../node_modules/@babel/runtime/helpers/toConsumableArray.js","../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","bp-groups/js/blocks/groups/constants.js","bp-groups/js/blocks/groups/edit.js","bp-groups/js/blocks/groups.js"],"names":["wp","__","i18n","AVATAR_SIZES","label","value","GROUP_STATI","public","private","hidden","EXTRA_INFO","editGroupsBlock","blockEditor","InspectorControls","BlockControls","components","Placeholder","PanelBody","SelectControl","ToggleControl","Button","Dashicon","Tooltip","ToolbarGroup","RangeControl","compose","withSelect","data","element","createElement","Fragment","useState","sprintf","_n","apiFetch","addQueryArgs","url","AutoCompleter","bp","blockComponents","lodash","reject","remove","sortBy","getSlugValue","item","status","editGroups","attributes","groupsList","setAttributes","isSelected","isAvatarEnabled","bpSettings","itemIDs","avatarSize","displayGroupName","extraInfo","layoutPreference","columns","hasGroups","length","groups","setGroups","layoutControls","icon","title","onClick","isActive","containerClasses","extraInfoOptions","filter","extra","path","populate_extras","include","then","items","indexOf","id","map","group","hasDescription","groupItemClasses","description","rendered","itemID","link","name","avatar_urls","__html","last_activity","last_activity_diff","total_member_count","option","exclude","parseInt","select","getEditorSettings","registerBlockType","blocks","category","type","default","edit"],"mappings":";AAAA,SAAA,EAAA,EAAA,IACA,MAAA,GAAA,EAAA,EAAA,UAAA,EAAA,EAAA,QAEA,IAAA,IAAA,EAAA,EAAA,EAAA,IAAA,MAAA,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gD,KAAM,QACNzB,MAAO,CACNyB,KAAM,WAEPC,QAAS,IAEVhD,WAAY,CACX+C,KAAM,SACNC,QAAS,QAEV/C,iBAAkB,CACjB8C,KAAM,UACNC,SAAS,GAEV9C,UAAW,CACV6C,KAAM,SACNC,QAAS,QAEV7C,iBAAkB,CACjB4C,KAAM,SACNC,QAAS,QAEV5C,QAAS,CACR2C,KAAM,SACNC,QAAS,IAGXC,KAAM7F,EAAAA","file":"groups.js","sourceRoot":"../src/js","sourcesContent":["function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles;","function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableSpread;","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Avatar sizes.\n *\n * @type {Array}\n */\nexport const AVATAR_SIZES = [\n\t{\n\t\tlabel: __( 'None', 'buddypress' ),\n\t\tvalue: 'none',\n\t},\n\t{\n\t\tlabel: __( 'Thumb', 'buddypress' ),\n\t\tvalue: 'thumb',\n\t},\n\t{\n\t\tlabel: __( 'Full', 'buddypress' ),\n\t\tvalue: 'full',\n\t},\n];\n\n/**\n * Group stati.\n *\n * @type {Object}\n */\nexport const GROUP_STATI = {\n\tpublic: __( 'Public', 'buddypress' ),\n\tprivate: __( 'Private', 'buddypress' ),\n\thidden: __( 'Hidden', 'buddypress' ),\n};\n\n/**\n * Group Extra data.\n *\n * @type {Array}\n */\nexport const EXTRA_INFO = [\n\t{\n\t\tlabel: __( 'None', 'buddypress' ),\n\t\tvalue: 'none',\n\t},\n\t{\n\t\tlabel: __( 'Group\\'s description', 'buddypress' ),\n\t\tvalue: 'description',\n\t},\n\t{\n\t\tlabel: __( 'Last time the group was active', 'buddypress' ),\n\t\tvalue: 'active',\n\t},\n\t{\n\t\tlabel: __( 'Amount of group members', 'buddypress' ),\n\t\tvalue: 'popular',\n\t},\n];\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t\tBlockControls,\n\t},\n\tcomponents: {\n\t\tPlaceholder,\n\t\tPanelBody,\n\t\tSelectControl,\n\t\tToggleControl,\n\t\tButton,\n\t\tDashicon,\n\t\tTooltip,\n\t\tToolbarGroup,\n\t\tRangeControl,\n\t},\n\tcompose: {\n\t\tcompose,\n\t},\n\tdata: {\n\t\twithSelect,\n\t},\n\telement: {\n\t\tcreateElement,\n\t\tFragment,\n\t\tuseState,\n\t},\n\ti18n: {\n\t\t__,\n\t\tsprintf,\n\t\t_n,\n\t},\n\tapiFetch,\n\turl: {\n\t\taddQueryArgs,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst { AutoCompleter } = bp.blockComponents;\n\n/**\n * Internal dependencies.\n */\nimport { AVATAR_SIZES, EXTRA_INFO, GROUP_STATI } from './constants';\n\n/**\n * External dependencies.\n */\nconst {\n\treject,\n\tremove,\n\tsortBy,\n} = lodash;\n\nconst getSlugValue = ( item ) => {\n\tif ( item && item.status && GROUP_STATI[ item.status ] ) {\n\t\treturn GROUP_STATI[ item.status ];\n\t}\n\n\treturn null;\n}\n\nconst editGroups = ( { attributes, setAttributes, isSelected, bpSettings } ) => {\n\tconst {\n\t\tisAvatarEnabled,\n\t} = bpSettings;\n\tconst {\n\t\titemIDs,\n\t\tavatarSize,\n\t\tdisplayGroupName,\n\t\textraInfo,\n\t\tlayoutPreference,\n\t\tcolumns,\n\t} = attributes;\n\tconst hasGroups = 0 !== itemIDs.length;\n\tconst [ groups, setGroups ] = useState( [] );\n\tconst layoutControls = [\n\t\t{\n\t\t\ticon: 'text',\n\t\t\ttitle: __( 'List view', 'buddypress' ),\n\t\t\tonClick: () => setAttributes( { layoutPreference: 'list' } ),\n\t\t\tisActive: layoutPreference === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: 'screenoptions',\n\t\t\ttitle: __( 'Grid view', 'buddypress' ),\n\t\t\tonClick: () => setAttributes( { layoutPreference: 'grid' } ),\n\t\t\tisActive: layoutPreference === 'grid',\n\t\t},\n\t];\n\tlet groupsList;\n\tlet containerClasses = 'bp-block-groups avatar-' + avatarSize;\n\tlet extraInfoOptions = EXTRA_INFO;\n\n\tif ( layoutPreference === 'grid' ) {\n\t\tcontainerClasses += ' is-grid columns-' + columns;\n\t\textraInfoOptions = EXTRA_INFO.filter( ( extra ) => {\n\t\t\treturn 'description' !== extra.value;\n\t\t} );\n\t}\n\n\tconst onSelectedGroup = ( { itemID } ) => {\n\t\tif ( itemID && -1 === itemIDs.indexOf( itemID ) ) {\n\t\t\tsetAttributes( {\n\t\t\t\titemIDs: [...itemIDs, parseInt( itemID, 10 ) ]\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst onRemoveGroup = ( ( itemID ) => {\n\t\tif ( itemID && -1 !== itemIDs.indexOf( itemID ) ) {\n\t\t\tsetGroups( reject( groups, ['id', itemID ] ) );\n\t\t\tsetAttributes( {\n\t\t\t\titemIDs: remove( itemIDs, ( value ) => { return value !== itemID } )\n\t\t\t} );\n\t\t}\n\t} );\n\n\tif ( hasGroups && itemIDs.length !== groups.length ) {\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( `/buddypress/v1/groups`, { populate_extras: true, include: itemIDs } ),\n\t\t} ).then( items => {\n\t\t\tsetGroups(\n\t\t\t\tsortBy( items, [ ( item ) => {\n\t\t\t\t\treturn itemIDs.indexOf( item.id );\n\t\t\t\t} ] )\n\t\t\t);\n\t\t} )\n\t}\n\n\tif ( groups.length ) {\n\t\tgroupsList = groups.map( ( group ) => {\n\t\t\tlet hasDescription = false;\n\t\t\tlet groupItemClasses = 'group-content';\n\n\t\t\tif ( layoutPreference === 'list' && 'description' === extraInfo && group.description && group.description.rendered ) {\n\t\t\t\thasDescription = true;\n\t\t\t\tgroupItemClasses = 'group-content has-description';\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div key={ 'bp-group-' + group.id } className={ groupItemClasses }>\n\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t<Tooltip text={ __( 'Remove group', 'buddypress' ) }>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"is-right\"\n\t\t\t\t\t\t\t\tonClick={ () => onRemoveGroup( group.id ) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove group', 'buddypress' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Dashicon icon=\"no\"/>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isAvatarEnabled && 'none' !== avatarSize && (\n\t\t\t\t\t\t<div className=\"item-header-avatar\">\n\t\t\t\t\t\t\t<a href={ group.link } target=\"_blank\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tkey={ 'avatar-' + group.id }\n\t\t\t\t\t\t\t\t\tclassName=\"avatar\"\n\t\t\t\t\t\t\t\t\talt={ sprintf( __( 'Profile photo of %s', 'buddypress' ), group.name ) }\n\t\t\t\t\t\t\t\t\tsrc={ group.avatar_urls[ avatarSize ] }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<div className=\"group-description\">\n\t\t\t\t\t\t{ displayGroupName && (\n\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t<a href={ group.link } target=\"_blank\">\n\t\t\t\t\t\t\t\t\t{ group.name }\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ hasDescription && (\n\t\t\t\t\t\t\t<div className=\"group-description-content\" dangerouslySetInnerHTML={ { __html: group.description.rendered } } />\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ 'active' === extraInfo && group.last_activity && group.last_activity_diff && (\n\t\t\t\t\t\t\t<time dateTime={ group.last_activity }>\n\t\t\t\t\t\t\t\t{ sprintf( __( 'Active %s', 'buddypress' ), group.last_activity_diff ) }\n\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ 'popular' === extraInfo && group.total_member_count && (\n\t\t\t\t\t\t\t<div className=\"group-meta\">\n\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: number of group memberss. */\n\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t'%1$d member',\n\t\t\t\t\t\t\t\t\t\t'%1$d members',\n\t\t\t\t\t\t\t\t\t\tgroup.total_member_count,\n\t\t\t\t\t\t\t\t\t\t'buddypress'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tgroup.total_member_count\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t} );\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display the group\\'s name', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! displayGroupName }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { displayGroupName: ! displayGroupName } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tdisplayGroupName\n\t\t\t\t\t\t\t\t? __( 'Include the group\\'s name.', 'buddypress' )\n\t\t\t\t\t\t\t\t: __( 'Toggle to include group\\'s name.', 'buddypress' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ isAvatarEnabled && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size', 'buddypress' ) }\n\t\t\t\t\t\t\tvalue={ avatarSize }\n\t\t\t\t\t\t\toptions={ AVATAR_SIZES }\n\t\t\t\t\t\t\thelp={ __( 'Select \"None\" to disable the avatar.', 'buddypress' ) }\n\t\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { avatarSize: option } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Group extra information', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ extraInfo }\n\t\t\t\t\t\toptions={ extraInfoOptions }\n\t\t\t\t\t\thelp={ __( 'Select \"None\" to show no extra information.', 'buddypress' ) }\n\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\tsetAttributes( { extraInfo: option } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ layoutPreference === 'grid' && (\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Columns', 'buddypress' ) }\n\t\t\t\t\t\t\tvalue={ columns }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { columns: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\tmax={ 4 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ layoutControls } />\n\t\t\t</BlockControls>\n\n\t\t\t{ hasGroups && (\n\t\t\t\t<div className={ containerClasses }>\n\t\t\t\t\t{ groupsList }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ ( isSelected || 0 === itemIDs.length ) && (\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ hasGroups ? '' : 'groups' }\n\t\t\t\t\tlabel={ hasGroups ? '' : __( 'BuddyPress Groups', 'buddypress' ) }\n\t\t\t\t\tinstructions={ __( 'Start typing the name of the group you want to add to the groups list.', 'buddypress' ) }\n\t\t\t\t\tclassName={ 0 !== itemIDs.length ? 'is-appender' : 'is-large' }\n\t\t\t\t>\n\t\t\t\t\t<AutoCompleter\n\t\t\t\t\t\tcomponent=\"groups\"\n\t\t\t\t\t\tobjectQueryArgs={ { 'show_hidden': false, exclude: itemIDs } }\n\t\t\t\t\t\tslugValue={ getSlugValue }\n\t\t\t\t\t\tariaLabel={ __( 'Group\\'s name', 'buddypress' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Enter Group\\'s name here…', 'buddypress' ) }\n\t\t\t\t\t\tonSelectItem={ onSelectedGroup }\n\t\t\t\t\t\tuseAvatar={ isAvatarEnabled }\n\t\t\t\t\t/>\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t</Fragment>\n\t);\n};\n\nconst editGroupsBlock = compose( [\n\twithSelect( ( select ) => {\n\t\tconst editorSettings = select( 'core/editor' ).getEditorSettings();\n\n\t\treturn {\n\t\t\tbpSettings: editorSettings.bp.groups || {},\n\t\t};\n\t} ),\n] )( editGroups );\n\nexport default editGroupsBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n blocks: {\n registerBlockType,\n },\n i18n: {\n __,\n },\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editGroupsBlock from './groups/edit';\n\nregisterBlockType( 'bp/groups', {\n\ttitle: __( 'Groups', 'buddypress' ),\n\tdescription: __( 'BuddyPress Groups.', 'buddypress' ),\n\ticon: 'buddicons-groups',\n\tcategory: 'buddypress',\n\tattributes: {\n\t\titemIDs: {\n\t\t\ttype: 'array',\n\t\t\titems: {\n\t\t\t\ttype: 'integer',\n\t\t\t},\n\t\t\tdefault: [],\n\t\t},\n\t\tavatarSize: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'full',\n\t\t},\n\t\tdisplayGroupName: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\textraInfo: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'none',\n\t\t},\n\t\tlayoutPreference: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'list',\n\t\t},\n\t\tcolumns: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 2\n\t\t},\n\t},\n\tedit: editGroupsBlock,\n} );\n"]}
1
+ {"version":3,"sources":["../../../../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArray.js","../../../../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../../node_modules/@babel/runtime/helpers/toConsumableArray.js","../../../../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../../../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../../../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../../../../node_modules/@babel/runtime/helpers/slicedToArray.js","bp-groups/js/blocks/groups/constants.js","bp-groups/js/blocks/groups/edit.js","bp-groups/js/blocks/groups.js"],"names":["wp","__","i18n","AVATAR_SIZES","label","value","GROUP_STATI","public","private","hidden","EXTRA_INFO","editGroupsBlock","blockEditor","InspectorControls","BlockControls","components","Placeholder","PanelBody","SelectControl","ToggleControl","Button","Dashicon","Tooltip","ToolbarGroup","RangeControl","element","createElement","Fragment","useState","sprintf","_n","apiFetch","addQueryArgs","url","bp","AutoCompleter","blockComponents","isActive","blockData","lodash","reject","remove","sortBy","getSlugValue","item","status","attributes","groupsList","setAttributes","isSelected","isAvatarEnabled","itemIDs","avatarSize","displayGroupName","extraInfo","layoutPreference","columns","hasGroups","length","groups","setGroups","layoutControls","icon","title","onClick","containerClasses","extraInfoOptions","filter","extra","path","populate_extras","include","then","items","indexOf","id","map","group","hasDescription","groupItemClasses","description","rendered","itemID","link","name","avatar_urls","__html","last_activity","last_activity_diff","total_member_count","option","exclude","parseInt","registerBlockType","blocks","background","foreground","src","category","type","default","edit"],"mappings":";AAAA,SAAA,EAAA,EAAA,IACA,MAAA,GAAA,EAAA,EAAA,UAAA,EAAA,EAAA,QAEA,IAAA,IAAA,EAAA,EAAA,EAAA,IAAA,MAAA,GAAA,EAAA,EAAA,IACA,EAAA,GAAA,EAAA,GAGA,OAAA,EAGA,OAAA,QAAA;;ACVA,IAAA,EAAA,QAAA,sBAEA,SAAA,EAAA,GACA,GAAA,MAAA,QAAA,GAAA,OAAA,EAAA,GAGA,OAAA,QAAA;;ACNA,SAAA,EAAA,GACA,GAAA,oBAAA,QAAA,OAAA,YAAA,OAAA,GAAA,OAAA,MAAA,KAAA,GAGA,OAAA,QAAA;;ACJA,IAAA,EAAA,QAAA,sBAEA,SAAA,EAAA,EAAA,GACA,GAAA,EAAA,CACA,GAAA,iBAAA,EAAA,OAAA,EAAA,EAAA,GACA,IAAA,EAAA,OAAA,UAAA,SAAA,KAAA,GAAA,MAAA,GAAA,GAEA,MADA,WAAA,GAAA,EAAA,cAAA,EAAA,EAAA,YAAA,MACA,QAAA,GAAA,QAAA,EAAA,MAAA,K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,SAAkB,GAAdiF,IAAAA,EAAAA,EAAAA,OACtBA,IAAW,IAAM/B,EAAQuB,QAASQ,IACtClC,EAAe,CACdG,QAAaA,GAAAA,QAAAA,EAAAA,EAAAA,SAAAA,GAASyC,CAAAA,SAAUV,EAAQ,SAkLtC,UAAYhC,OAQHvC,EAAAA,EAAAA,QAAAA,QAAAA;;ACtRf,aAFA,IAAA,EAAA,EAAA,QAAA,kBAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAdA,IAOIX,EAAAA,GALA6F,EADFC,EAAAA,OACED,kBAGA5F,EADFC,EAAAA,KACED,GASJ4F,EAAmB,YAAa,CAC/B9B,MAAO9D,EAAI,SAAU,cACrB+E,YAAa/E,EAAI,qBAAsB,cACvC6D,KAAM,CACLiC,WAAY,OACZC,WAAY,UACZC,IAAK,oBAENC,SAAU,aACVpD,WAAY,CACXK,QAAS,CACRgD,KAAM,QACN1B,MAAO,CACN0B,KAAM,WAEPC,QAAS,IAEVhD,WAAY,CACX+C,KAAM,SACNC,QAAS,QAEV/C,iBAAkB,CACjB8C,KAAM,UACNC,SAAS,GAEV9C,UAAW,CACV6C,KAAM,SACNC,QAAS,QAEV7C,iBAAkB,CACjB4C,KAAM,SACNC,QAAS,QAEV5C,QAAS,CACR2C,KAAM,SACNC,QAAS,IAGXC,KAAM1F,EAAAA","file":"groups.js","sourceRoot":"../src/js","sourcesContent":["function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles;","function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableSpread;","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Avatar sizes.\n *\n * @type {Array}\n */\nexport const AVATAR_SIZES = [\n\t{\n\t\tlabel: __( 'None', 'buddypress' ),\n\t\tvalue: 'none',\n\t},\n\t{\n\t\tlabel: __( 'Thumb', 'buddypress' ),\n\t\tvalue: 'thumb',\n\t},\n\t{\n\t\tlabel: __( 'Full', 'buddypress' ),\n\t\tvalue: 'full',\n\t},\n];\n\n/**\n * Group stati.\n *\n * @type {Object}\n */\nexport const GROUP_STATI = {\n\tpublic: __( 'Public', 'buddypress' ),\n\tprivate: __( 'Private', 'buddypress' ),\n\thidden: __( 'Hidden', 'buddypress' ),\n};\n\n/**\n * Group Extra data.\n *\n * @type {Array}\n */\nexport const EXTRA_INFO = [\n\t{\n\t\tlabel: __( 'None', 'buddypress' ),\n\t\tvalue: 'none',\n\t},\n\t{\n\t\tlabel: __( 'Group\\'s description', 'buddypress' ),\n\t\tvalue: 'description',\n\t},\n\t{\n\t\tlabel: __( 'Last time the group was active', 'buddypress' ),\n\t\tvalue: 'active',\n\t},\n\t{\n\t\tlabel: __( 'Amount of group members', 'buddypress' ),\n\t\tvalue: 'popular',\n\t},\n];\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t\tBlockControls,\n\t},\n\tcomponents: {\n\t\tPlaceholder,\n\t\tPanelBody,\n\t\tSelectControl,\n\t\tToggleControl,\n\t\tButton,\n\t\tDashicon,\n\t\tTooltip,\n\t\tToolbarGroup,\n\t\tRangeControl,\n\t},\n\telement: {\n\t\tcreateElement,\n\t\tFragment,\n\t\tuseState,\n\t},\n\ti18n: {\n\t\t__,\n\t\tsprintf,\n\t\t_n,\n\t},\n\tapiFetch,\n\turl: {\n\t\taddQueryArgs,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tAutoCompleter,\n\t},\n\tblockData: {\n\t\tisActive,\n\t}\n} = bp;\n\n/**\n * Internal dependencies.\n */\nimport { AVATAR_SIZES, EXTRA_INFO, GROUP_STATI } from './constants';\n\n/**\n * External dependencies.\n */\nconst {\n\treject,\n\tremove,\n\tsortBy,\n} = lodash;\n\nconst getSlugValue = ( item ) => {\n\tif ( item && item.status && GROUP_STATI[ item.status ] ) {\n\t\treturn GROUP_STATI[ item.status ];\n\t}\n\n\treturn null;\n}\n\nconst editGroupsBlock = ( { attributes, setAttributes, isSelected } ) => {\n\tconst isAvatarEnabled = isActive( 'groups', 'avatar' );\n\tconst {\n\t\titemIDs,\n\t\tavatarSize,\n\t\tdisplayGroupName,\n\t\textraInfo,\n\t\tlayoutPreference,\n\t\tcolumns,\n\t} = attributes;\n\tconst hasGroups = 0 !== itemIDs.length;\n\tconst [ groups, setGroups ] = useState( [] );\n\tconst layoutControls = [\n\t\t{\n\t\t\ticon: 'text',\n\t\t\ttitle: __( 'List view', 'buddypress' ),\n\t\t\tonClick: () => setAttributes( { layoutPreference: 'list' } ),\n\t\t\tisActive: layoutPreference === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: 'screenoptions',\n\t\t\ttitle: __( 'Grid view', 'buddypress' ),\n\t\t\tonClick: () => setAttributes( { layoutPreference: 'grid' } ),\n\t\t\tisActive: layoutPreference === 'grid',\n\t\t},\n\t];\n\tlet groupsList;\n\tlet containerClasses = 'bp-block-groups avatar-' + avatarSize;\n\tlet extraInfoOptions = EXTRA_INFO;\n\n\tif ( layoutPreference === 'grid' ) {\n\t\tcontainerClasses += ' is-grid columns-' + columns;\n\t\textraInfoOptions = EXTRA_INFO.filter( ( extra ) => {\n\t\t\treturn 'description' !== extra.value;\n\t\t} );\n\t}\n\n\tconst onSelectedGroup = ( { itemID } ) => {\n\t\tif ( itemID && -1 === itemIDs.indexOf( itemID ) ) {\n\t\t\tsetAttributes( {\n\t\t\t\titemIDs: [...itemIDs, parseInt( itemID, 10 ) ]\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst onRemoveGroup = ( ( itemID ) => {\n\t\tif ( itemID && -1 !== itemIDs.indexOf( itemID ) ) {\n\t\t\tsetGroups( reject( groups, ['id', itemID ] ) );\n\t\t\tsetAttributes( {\n\t\t\t\titemIDs: remove( itemIDs, ( value ) => { return value !== itemID } )\n\t\t\t} );\n\t\t}\n\t} );\n\n\tif ( hasGroups && itemIDs.length !== groups.length ) {\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( `/buddypress/v1/groups`, { populate_extras: true, include: itemIDs } ),\n\t\t} ).then( items => {\n\t\t\tsetGroups(\n\t\t\t\tsortBy( items, [ ( item ) => {\n\t\t\t\t\treturn itemIDs.indexOf( item.id );\n\t\t\t\t} ] )\n\t\t\t);\n\t\t} )\n\t}\n\n\tif ( groups.length ) {\n\t\tgroupsList = groups.map( ( group ) => {\n\t\t\tlet hasDescription = false;\n\t\t\tlet groupItemClasses = 'group-content';\n\n\t\t\tif ( layoutPreference === 'list' && 'description' === extraInfo && group.description && group.description.rendered ) {\n\t\t\t\thasDescription = true;\n\t\t\t\tgroupItemClasses = 'group-content has-description';\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div key={ 'bp-group-' + group.id } className={ groupItemClasses }>\n\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t<Tooltip text={ __( 'Remove group', 'buddypress' ) }>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"is-right\"\n\t\t\t\t\t\t\t\tonClick={ () => onRemoveGroup( group.id ) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove group', 'buddypress' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Dashicon icon=\"no\"/>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isAvatarEnabled && 'none' !== avatarSize && (\n\t\t\t\t\t\t<div className=\"item-header-avatar\">\n\t\t\t\t\t\t\t<a href={ group.link } target=\"_blank\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tkey={ 'avatar-' + group.id }\n\t\t\t\t\t\t\t\t\tclassName=\"avatar\"\n\t\t\t\t\t\t\t\t\talt={ sprintf( __( 'Profile photo of %s', 'buddypress' ), group.name ) }\n\t\t\t\t\t\t\t\t\tsrc={ group.avatar_urls[ avatarSize ] }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<div className=\"group-description\">\n\t\t\t\t\t\t{ displayGroupName && (\n\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t<a href={ group.link } target=\"_blank\">\n\t\t\t\t\t\t\t\t\t{ group.name }\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ hasDescription && (\n\t\t\t\t\t\t\t<div className=\"group-description-content\" dangerouslySetInnerHTML={ { __html: group.description.rendered } } />\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ 'active' === extraInfo && group.last_activity && group.last_activity_diff && (\n\t\t\t\t\t\t\t<time dateTime={ group.last_activity }>\n\t\t\t\t\t\t\t\t{ sprintf( __( 'Active %s', 'buddypress' ), group.last_activity_diff ) }\n\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ 'popular' === extraInfo && group.total_member_count && (\n\t\t\t\t\t\t\t<div className=\"group-meta\">\n\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: number of group memberss. */\n\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t'%1$d member',\n\t\t\t\t\t\t\t\t\t\t'%1$d members',\n\t\t\t\t\t\t\t\t\t\tgroup.total_member_count,\n\t\t\t\t\t\t\t\t\t\t'buddypress'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tgroup.total_member_count\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t} );\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display the group\\'s name', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! displayGroupName }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { displayGroupName: ! displayGroupName } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tdisplayGroupName\n\t\t\t\t\t\t\t\t? __( 'Include the group\\'s name.', 'buddypress' )\n\t\t\t\t\t\t\t\t: __( 'Toggle to include group\\'s name.', 'buddypress' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ isAvatarEnabled && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size', 'buddypress' ) }\n\t\t\t\t\t\t\tvalue={ avatarSize }\n\t\t\t\t\t\t\toptions={ AVATAR_SIZES }\n\t\t\t\t\t\t\thelp={ __( 'Select \"None\" to disable the avatar.', 'buddypress' ) }\n\t\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { avatarSize: option } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Group extra information', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ extraInfo }\n\t\t\t\t\t\toptions={ extraInfoOptions }\n\t\t\t\t\t\thelp={ __( 'Select \"None\" to show no extra information.', 'buddypress' ) }\n\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\tsetAttributes( { extraInfo: option } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ layoutPreference === 'grid' && (\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Columns', 'buddypress' ) }\n\t\t\t\t\t\t\tvalue={ columns }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { columns: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\tmax={ 4 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ layoutControls } />\n\t\t\t</BlockControls>\n\n\t\t\t{ hasGroups && (\n\t\t\t\t<div className={ containerClasses }>\n\t\t\t\t\t{ groupsList }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ ( isSelected || 0 === itemIDs.length ) && (\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ hasGroups ? '' : 'groups' }\n\t\t\t\t\tlabel={ hasGroups ? '' : __( 'BuddyPress Groups', 'buddypress' ) }\n\t\t\t\t\tinstructions={ __( 'Start typing the name of the group you want to add to the groups list.', 'buddypress' ) }\n\t\t\t\t\tclassName={ 0 !== itemIDs.length ? 'is-appender' : 'is-large' }\n\t\t\t\t>\n\t\t\t\t\t<AutoCompleter\n\t\t\t\t\t\tcomponent=\"groups\"\n\t\t\t\t\t\tobjectQueryArgs={ { 'show_hidden': false, exclude: itemIDs } }\n\t\t\t\t\t\tslugValue={ getSlugValue }\n\t\t\t\t\t\tariaLabel={ __( 'Group\\'s name', 'buddypress' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Enter Group\\'s name here…', 'buddypress' ) }\n\t\t\t\t\t\tonSelectItem={ onSelectedGroup }\n\t\t\t\t\t\tuseAvatar={ isAvatarEnabled }\n\t\t\t\t\t/>\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t</Fragment>\n\t);\n};\n\nexport default editGroupsBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n blocks: {\n registerBlockType,\n },\n i18n: {\n __,\n },\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editGroupsBlock from './groups/edit';\n\nregisterBlockType( 'bp/groups', {\n\ttitle: __( 'Groups', 'buddypress' ),\n\tdescription: __( 'BuddyPress Groups.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'buddicons-groups',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\titemIDs: {\n\t\t\ttype: 'array',\n\t\t\titems: {\n\t\t\t\ttype: 'integer',\n\t\t\t},\n\t\t\tdefault: [],\n\t\t},\n\t\tavatarSize: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'full',\n\t\t},\n\t\tdisplayGroupName: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\textraInfo: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'none',\n\t\t},\n\t\tlayoutPreference: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'list',\n\t\t},\n\t\tcolumns: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 2\n\t\t},\n\t},\n\tedit: editGroupsBlock,\n} );\n"]}
bp-groups/js/dynamic-groups.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"UOvc":[function(require,module,exports) {
2
+ function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function o(t,e,o){return e&&r(t.prototype,e),o&&r(t,o),t}function n(t,e,r){return(n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var o=c(t,e);if(o){var n=Object.getOwnPropertyDescriptor(o,e);return n.get?n.get.call(r):n.value}})(t,e,r||t)}function c(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=f();return function(){var r,o=p(t);if(e){var n=p(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return s(this,r)}}function s(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?l(e):r}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=wp,d=y.i18n,b=d.__,m=d.sprintf,v=bp,h=v.dynamicWidgetBlock,g=function(t){i(c,h);var r=a(c);function c(){return e(this,c),r.apply(this,arguments)}return o(c,[{key:"loop",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"active",o=n(p(c.prototype),"useTemplate",this).call(this,"bp-dynamic-groups-item"),i=document.querySelector("#"+e),u="";t&&t.length?t.forEach(function(t){if("newest"===r&&t.created_since)t.extra=m(b("Created %s","buddypress"),t.created_since);else if("popular"===r&&t.total_member_count){var e=parseInt(t.total_member_count,10);t.extra=0===e?b("No members","buddypress"):1===e?b("1 member","buddypress"):m(b("%s members","buddypress"),t.total_member_count)}else t.extra=m(b("Active %s","buddypress"),t.last_activity_diff);t.avatar_alt=m(b("Group Profile photo of %s","buddypress"),t.name),u+=o(t)}):u='<div class="widget-error">'+b("There are no groups to display.","buddypress")+"</div>",i.innerHTML=u}},{key:"start",value:function(){var t=this;this.blocks.forEach(function(e,r){var o=e.selector,i=e.query_args.type,u=document.querySelector("#"+o).closest(".bp-dynamic-block-container");n(p(c.prototype),"getItems",t).call(t,i,r),u.querySelectorAll(".item-options a").forEach(function(e){e.addEventListener("click",function(e){e.preventDefault(),e.target.closest(".item-options").querySelector(".selected").classList.remove("selected"),e.target.classList.add("selected");var o=e.target.getAttribute("data-bp-sort");o!==t.blocks[r].query_args.type&&n(p(c.prototype),"getItems",t).call(t,o,r)})})})}}]),c}(),_=window.bpDynamicGroupsSettings||{},w=window.bpDynamicGroupsBlocks||[],O=new g(_,w);"loading"===document.readyState?document.addEventListener("DOMContentLoaded",O.start()):O.start();
3
+ },{}]},{},["UOvc"], null)
4
+ //# sourceMappingURL=/bp-groups/js/dynamic-groups.js.map
bp-groups/js/dynamic-groups.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-groups/js/dynamic-groups.js"],"names":["wp","i18n","__","sprintf","bp","dynamicWidgetBlock","bpGroupsWidgetBlock","groups","container","type","tmpl","selector","document","querySelector","output","length","forEach","group","created_since","extra","total_member_count","membersCount","parseInt","last_activity_diff","avatar_alt","name","innerHTML","blocks","block","i","query_args","list","closest","querySelectorAll","navItem","addEventListener","event","preventDefault","target","classList","remove","add","newType","getAttribute","settings","window","bpDynamicGroupsSettings","bpDynamicGroupsBlocks","bpDynamicGroups","readyState","start"],"mappings":";AAkGC,SAAA,EAAA,GAAA,OAAA,EAAA,mBAAA,QAAA,iBAAA,OAAA,SAAA,SAAA,GAAA,cAAA,GAAA,SAAA,GAAA,OAAA,GAAA,mBAAA,QAAA,EAAA,cAAA,QAAA,IAAA,OAAA,UAAA,gBAAA,IAAA,GAAA,SAAA,EAAA,EAAA,GAAA,KAAA,aAAA,GAAA,MAAA,IAAA,UAAA,qCAAA,SAAA,EAAA,EAAA,GAAA,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,OAAA,IAAA,C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st {\n\ti18n: {\n\t\t__,\n\t\tsprintf,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tdynamicWidgetBlock,\n} = bp;\n\n/**\n * Front-end Dynamic Groups Widget Block class.\n *\n * @since 9.0.0\n */\nclass bpGroupsWidgetBlock extends dynamicWidgetBlock {\n\tloop( groups = [], container = '', type = 'active' ) {\n\t\tconst tmpl = super.useTemplate( 'bp-dynamic-groups-item' );\n\t\tconst selector = document.querySelector( '#' + container );\n\t\tlet output = '';\n\n\t\tif ( groups && groups.length ) {\n\t\t\tgroups.forEach( ( group ) => {\n\t\t\t\tif ( 'newest' === type && group.created_since ) {\n\t\t\t\t\t/* translators: %s is time elapsed since the group was created */\n\t\t\t\t\tgroup.extra = sprintf( __( 'Created %s', 'buddypress' ), group.created_since );\n\t\t\t\t} else if ( 'popular' === type && group.total_member_count ) {\n\t\t\t\t\tconst membersCount = parseInt( group.total_member_count, 10 );\n\n\t\t\t\t\tif ( 0 === membersCount ) {\n\t\t\t\t\t\tgroup.extra = __( 'No members', 'buddypress' );\n\t\t\t\t\t} else if ( 1 === membersCount ) {\n\t\t\t\t\t\tgroup.extra = __( '1 member', 'buddypress' );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* translators: %s is the number of Group members (more than 1). */\n\t\t\t\t\t\tgroup.extra = sprintf( __( '%s members', 'buddypress' ), group.total_member_count );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t/* translators: %s: a human time diff. */\n\t\t\t\t\tgroup.extra = sprintf( __( 'Active %s', 'buddypress' ), group.last_activity_diff );\n\t\t\t\t}\n\n\t\t\t\t/* Translators: %s is the group's name. */\n\t\t\t\tgroup.avatar_alt = sprintf( __( 'Group Profile photo of %s', 'buddypress' ), group.name );\n\n\t\t\t\toutput += tmpl( group );\n\t\t\t} );\n\t\t} else {\n\t\t\toutput = '<div class=\"widget-error\">' + __( 'There are no groups to display.', 'buddypress' ) + '</div>';\n\t\t}\n\n\t\tselector.innerHTML = output;\n\t}\n\n\tstart() {\n\t\tthis.blocks.forEach( ( block, i ) => {\n\t\t\tconst { selector } = block;\n\t\t\tconst { type } = block.query_args;\n\t\t\tconst list = document.querySelector( '#' + selector ).closest( '.bp-dynamic-block-container' );\n\n\t\t\t// Get default Block's type groups.\n\t\t\tsuper.getItems( type, i );\n\n\t\t\t// Listen to Block's Nav item clics\n\t\t\tlist.querySelectorAll( '.item-options a' ).forEach( ( navItem ) => {\n\t\t\t\tnavItem.addEventListener( 'click', ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t// Changes the displayed filter.\n\t\t\t\t\tevent.target.closest( '.item-options' ).querySelector( '.selected' ).classList.remove( 'selected' );\n\t\t\t\t\tevent.target.classList.add( 'selected' );\n\n\t\t\t\t\tconst newType = event.target.getAttribute( 'data-bp-sort' );\n\n\t\t\t\t\tif ( newType !== this.blocks[ i ].query_args.type ) {\n\t\t\t\t\t\tsuper.getItems( newType, i );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\t}\n}\n\nconst settings = window.bpDynamicGroupsSettings || {};\nconst blocks = window.bpDynamicGroupsBlocks || [];\nconst bpDynamicGroups = new bpGroupsWidgetBlock( settings, blocks );\n\nif ( 'loading' === document.readyState ) {\n\tdocument.addEventListener( 'DOMContentLoaded', bpDynamicGroups.start() );\n} else {\n\tbpDynamicGroups.start();\n}\n"]}
bp-groups/sass/blocks/dynamic-groups.scss ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-dynamic-block-container {
2
+
3
+ .item-options {
4
+ font-size: 0.5em;
5
+ margin: 0 0 1em;
6
+ padding: 1em 0;
7
+
8
+ a.selected {
9
+ font-weight: 600;
10
+ }
11
+ }
12
+
13
+ ul.item-list {
14
+ list-style: none;
15
+ margin: 1em 0;
16
+
17
+ li {
18
+ margin-bottom: 1em;
19
+
20
+ &:before,
21
+ &:after {
22
+ content: " ";
23
+ display: table;
24
+ }
25
+
26
+ &:after {
27
+ clear: both;
28
+ }
29
+
30
+ .item-avatar {
31
+ float: left;
32
+ width: 60px;
33
+ }
34
+
35
+ .item {
36
+ margin-left: 70px;
37
+ }
38
+ }
39
+ }
40
+ }
bp-loader.php CHANGED
@@ -15,7 +15,7 @@
15
  * Description: BuddyPress adds community features to WordPress. Member Profiles, Activity Streams, Direct Messaging, Notifications, and more!
16
  * Author: The BuddyPress Community
17
  * Author URI: https://buddypress.org/
18
- * Version: 8.0.2
19
  * Text Domain: buddypress
20
  * Domain Path: /bp-languages/
21
  * License: GPLv2 or later (license.txt)
15
  * Description: BuddyPress adds community features to WordPress. Member Profiles, Activity Streams, Direct Messaging, Notifications, and more!
16
  * Author: The BuddyPress Community
17
  * Author URI: https://buddypress.org/
18
+ * Version: 9.1.1
19
  * Text Domain: buddypress
20
  * Domain Path: /bp-languages/
21
  * License: GPLv2 or later (license.txt)
bp-members/admin/js/admin.js CHANGED
@@ -2,26 +2,25 @@
2
 
3
  ( function( $ ) {
4
  // Profile Visibility Settings
5
-
6
  $( '.visibility-toggle-link' ).on( 'click', function( event ) {
7
  event.preventDefault();
8
 
9
  $( this ).attr( 'aria-expanded', 'true' ).parent().hide()
10
- .siblings( '.field-visibility-settings' ).show();
11
  } );
12
 
13
  $( '.field-visibility-settings-close' ).on( 'click', function( event ) {
14
  event.preventDefault();
15
 
16
- $( '.visibility-toggle-link' ).attr( 'aria-expanded', 'false' );
17
 
18
- var settings_div = $(this).parent(),
19
- vis_setting_text = settings_div.find( 'input:checked' ).parent().text();
20
 
21
  settings_div.hide()
22
- .siblings( '.field-visibility-settings-toggle' )
23
- .children( '.current-visibility-level' ).text( vis_setting_text ).end()
24
- .show();
25
  } );
26
 
27
  } )( jQuery );
2
 
3
  ( function( $ ) {
4
  // Profile Visibility Settings
 
5
  $( '.visibility-toggle-link' ).on( 'click', function( event ) {
6
  event.preventDefault();
7
 
8
  $( this ).attr( 'aria-expanded', 'true' ).parent().hide()
9
+ .siblings( '.field-visibility-settings' ).show();
10
  } );
11
 
12
  $( '.field-visibility-settings-close' ).on( 'click', function( event ) {
13
  event.preventDefault();
14
 
15
+ $( '.visibility-toggle-link' ).attr( 'aria-expanded', 'false' );
16
 
17
+ var settings_div = $( this ).parent(),
18
+ vis_setting_text = settings_div.find( 'input:checked' ).parent().text();
19
 
20
  settings_div.hide()
21
+ .siblings( '.field-visibility-settings-toggle' )
22
+ .find( '.current-visibility-level' ).text( vis_setting_text ).end()
23
+ .show();
24
  } );
25
 
26
  } )( jQuery );
bp-members/admin/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- function clear(e){if(e=document.getElementById(e)){var i=e.getElementsByTagName("INPUT"),t=e.getElementsByTagName("OPTION"),n=0;if(i)for(n=0;n<i.length;n++)i[n].checked="";if(t)for(n=0;n<t.length;n++)t[n].selected=!1}}!function(t){t(".visibility-toggle-link").on("click",function(e){e.preventDefault(),t(this).attr("aria-expanded","true").parent().hide().siblings(".field-visibility-settings").show()}),t(".field-visibility-settings-close").on("click",function(e){e.preventDefault(),t(".visibility-toggle-link").attr("aria-expanded","false");var i=t(this).parent(),e=i.find("input:checked").parent().text();i.hide().siblings(".field-visibility-settings-toggle").children(".current-visibility-level").text(e).end().show()})}(jQuery);
1
+ function clear(e){if(e=document.getElementById(e)){var i=e.getElementsByTagName("INPUT"),t=e.getElementsByTagName("OPTION"),n=0;if(i)for(n=0;n<i.length;n++)i[n].checked="";if(t)for(n=0;n<t.length;n++)t[n].selected=!1}}!function(t){t(".visibility-toggle-link").on("click",function(e){e.preventDefault(),t(this).attr("aria-expanded","true").parent().hide().siblings(".field-visibility-settings").show()}),t(".field-visibility-settings-close").on("click",function(e){e.preventDefault(),t(".visibility-toggle-link").attr("aria-expanded","false");var i=t(this).parent(),e=i.find("input:checked").parent().text();i.hide().siblings(".field-visibility-settings-toggle").find(".current-visibility-level").text(e).end().show()})}(jQuery);
bp-members/bp-members-blocks.php CHANGED
@@ -12,30 +12,6 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  exit;
13
  }
14
 
15
- /**
16
- * Add BP Members blocks specific settings to the BP Blocks Editor ones.
17
- *
18
- * @since 6.0.0
19
- *
20
- * @param array $bp_editor_settings BP blocks editor settings.
21
- * @return array BP Members blocks editor settings.
22
- */
23
- function bp_members_editor_settings( $bp_editor_settings = array() ) {
24
- $bp = buddypress();
25
-
26
- return array_merge(
27
- $bp_editor_settings,
28
- array(
29
- 'members' => array(
30
- 'isMentionEnabled' => bp_is_active( 'activity' ) && bp_activity_do_mentions(),
31
- 'isAvatarEnabled' => $bp->avatar && $bp->avatar->show_avatars,
32
- 'isCoverImageEnabled' => bp_is_active( 'members', 'cover_image' ),
33
- ),
34
- )
35
- );
36
- }
37
- add_filter( 'bp_blocks_editor_settings', 'bp_members_editor_settings' );
38
-
39
  /**
40
  * Callback function to render the BP Member Block.
41
  *
@@ -260,7 +236,7 @@ function bp_members_render_members_block( $attributes = array() ) {
260
  $output .= sprintf(
261
  '<div class="item-header-avatar">
262
  <a href="%1$s">
263
- <img class="avatar" alt="%2$s" src="%3$s" />
264
  </a>
265
  </div>',
266
  esc_url( $member_link ),
@@ -355,3 +331,394 @@ function bp_members_render_members_block( $attributes = array() ) {
355
  */
356
  return apply_filters( 'bp_members_render_members_block_output', $output, $block_args, $members );
357
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  exit;
13
  }
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  /**
16
  * Callback function to render the BP Member Block.
17
  *
236
  $output .= sprintf(
237
  '<div class="item-header-avatar">
238
  <a href="%1$s">
239
+ <img loading="lazy" class="avatar" alt="%2$s" src="%3$s" />
240
  </a>
241
  </div>',
242
  esc_url( $member_link ),
331
  */
332
  return apply_filters( 'bp_members_render_members_block_output', $output, $block_args, $members );
333
  }
334
+
335
+ /**
336
+ * Adds specific script data for the BP Members blocks.
337
+ *
338
+ * Only used for the BP Dynamic Members block.
339
+ *
340
+ * @since 9.0.0
341
+ */
342
+ function bp_members_blocks_add_script_data() {
343
+ $dynamic_members_blocks = array_filter( buddypress()->members->block_globals['bp/dynamic-members']->items );
344
+
345
+ if ( ! $dynamic_members_blocks ) {
346
+ return;
347
+ }
348
+
349
+ // Include the common JS template.
350
+ echo bp_get_dynamic_template_part( 'assets/widgets/dynamic-members.php' );
351
+
352
+ // List the block specific props.
353
+ wp_add_inline_script(
354
+ 'bp-dynamic-members-script',
355
+ sprintf( 'var bpDynamicMembersBlocks = %s;', wp_json_encode( array_values( $dynamic_members_blocks ) ) ),
356
+ 'before'
357
+ );
358
+ }
359
+
360
+ /**
361
+ * Callback function to render the Dynamic Members Block.
362
+ *
363
+ * @since 9.0.0
364
+ *
365
+ * @param array $attributes The block attributes.
366
+ * @return string HTML output.
367
+ */
368
+ function bp_members_render_dynamic_members_block( $attributes = array() ) {
369
+ $block_args = wp_parse_args(
370
+ $attributes,
371
+ array(
372
+ 'title' => __( 'Members', 'buddypress' ),
373
+ 'maxMembers' => 5,
374
+ 'memberDefault' => 'active',
375
+ 'linkTitle' => false,
376
+ )
377
+ );
378
+
379
+ $classnames = 'widget_bp_core_members_widget buddypress widget';
380
+ $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
381
+
382
+ $max_members = (int) $block_args['maxMembers'];
383
+ $no_members = __( 'No members found.', 'buddypress' );
384
+
385
+ /** This filter is documented in buddypress/src/bp-members/classes/class-bp-core-members-widget.php */
386
+ $separator = apply_filters( 'bp_members_widget_separator', '|' );
387
+
388
+ // Make sure the widget ID is unique.
389
+ $widget_id = uniqid( 'members-list-' );
390
+ $members_directory_link = bp_get_members_directory_permalink();
391
+
392
+ // Set the Block's title.
393
+ if ( true === $block_args['linkTitle'] ) {
394
+ $widget_content = sprintf(
395
+ '<h2 class="widget-title"><a href="%1$s">%2$s</a></h2>',
396
+ esc_url( $members_directory_link ),
397
+ esc_html( $block_args['title'] )
398
+ );
399
+ } else {
400
+ $widget_content = sprintf( '<h2 class="widget-title">%s</h2>', esc_html( $block_args['title'] ) );
401
+ }
402
+
403
+ $item_options = array(
404
+ 'newest' => array(
405
+ 'class' => '',
406
+ 'label' => __( 'Newest', 'buddypress' ),
407
+ ),
408
+ 'active' => array(
409
+ 'class' => '',
410
+ 'label' => __( 'Active', 'buddypress' ),
411
+ ),
412
+ );
413
+
414
+ if ( bp_is_active( 'friends' ) ) {
415
+ $item_options['popular'] = array(
416
+ 'class' => '',
417
+ 'label' => __( 'Popular', 'buddypress' ),
418
+ );
419
+ }
420
+
421
+ $item_options_output = array();
422
+ $separator_output = sprintf( ' <span class="bp-separator" role="separator">%s</span> ', esc_html( $separator ) );
423
+
424
+ foreach ( $item_options as $item_type => $item_attr ) {
425
+ if ( $block_args['memberDefault'] === $item_type ) {
426
+ $item_attr['class'] = ' class="selected"';
427
+ }
428
+
429
+ $item_options_output[] = sprintf(
430
+ '<a href="%1$s" data-bp-sort="%2$s"%3$s>%4$s</a>',
431
+ esc_url( $members_directory_link ),
432
+ esc_attr( $item_type ),
433
+ $item_attr['class'],
434
+ esc_html( $item_attr['label'] )
435
+ );
436
+ }
437
+
438
+ $preview = '';
439
+ $default_args = array(
440
+ 'type' => $block_args['memberDefault'],
441
+ 'per_page' => $max_members,
442
+ 'populate_extras' => true,
443
+ );
444
+
445
+ // Previewing the Block inside the editor.
446
+ if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
447
+ $bp_query = bp_core_get_users( $default_args );
448
+ $preview = sprintf( '<div class="widget-error">%s</div>', $no_members );
449
+
450
+ if ( is_array( $bp_query['users'] ) && 0 < count( $bp_query['users'] ) ) {
451
+ $preview = '';
452
+ foreach ( $bp_query['users'] as $user ) {
453
+ if ( 'newest' === $block_args['memberDefault'] ) {
454
+ /* translators: %s is time elapsed since the registration date happened */
455
+ $extra = sprintf( _x( 'Registered %s', 'The timestamp when the user registered', 'buddypress' ), bp_core_time_since( $user->user_registered ) );
456
+ } elseif ( 'popular' === $block_args['memberDefault'] && isset( $item_options['popular'] ) && isset( $user->total_friend_count ) ) {
457
+ /* translators: %s: total friend count */
458
+ $extra = sprintf( _n( '%s friend', '%s friends', $user->total_friend_count, 'buddypress' ), number_format_i18n( $user->total_friend_count ) );
459
+ } else {
460
+ /* translators: %s: a human time diff. */
461
+ $extra = sprintf( __( 'Active %s', 'buddypress' ), bp_core_time_since( $user->last_activity ) );
462
+ }
463
+
464
+ $preview .= bp_get_dynamic_template_part(
465
+ 'assets/widgets/dynamic-members.php',
466
+ 'php',
467
+ array(
468
+ 'data.link' => bp_core_get_user_domain( $user->ID, $user->user_nicename, $user->user_login ),
469
+ 'data.name' => $user->display_name,
470
+ 'data.avatar_urls.thumb' => bp_core_fetch_avatar(
471
+ array(
472
+ 'item_id' => $user->ID,
473
+ 'html' => false,
474
+ )
475
+ ),
476
+ 'data.avatar_alt' => esc_attr(
477
+ sprintf(
478
+ /* translators: %s: member name */
479
+ __( 'Profile picture of %s', 'buddypress' ),
480
+ $user->display_name
481
+ )
482
+ ),
483
+ 'data.id' => $user->ID,
484
+ 'data.extra' => $extra,
485
+ )
486
+ );
487
+ }
488
+ }
489
+ } else {
490
+ // Get corresponding members.
491
+ $path = sprintf(
492
+ '/%1$s/%2$s/%3$s',
493
+ bp_rest_namespace(),
494
+ bp_rest_version(),
495
+ buddypress()->members->id
496
+ );
497
+
498
+ $default_path = add_query_arg(
499
+ $default_args,
500
+ $path
501
+ );
502
+
503
+ $preloaded_members = array();
504
+ if ( bp_is_running_wp( '5.0.0' ) ) {
505
+ $preloaded_members = rest_preload_api_request( '', $default_path );
506
+ }
507
+
508
+ buddypress()->members->block_globals['bp/dynamic-members']->items[ $widget_id ] = (object) array(
509
+ 'selector' => $widget_id,
510
+ 'query_args' => $default_args,
511
+ 'preloaded' => reset( $preloaded_members ),
512
+ );
513
+
514
+ // Only enqueue common/specific scripts and data once per page load.
515
+ if ( ! has_action( 'wp_footer', 'bp_members_blocks_add_script_data', 1 ) ) {
516
+ wp_set_script_translations( 'bp-dynamic-members-script', 'buddypress' );
517
+ wp_enqueue_script( 'bp-dynamic-members-script' );
518
+ wp_localize_script(
519
+ 'bp-dynamic-members-script',
520
+ 'bpDynamicMembersSettings',
521
+ array(
522
+ 'path' => ltrim( $path, '/' ),
523
+ 'root' => esc_url_raw( get_rest_url() ),
524
+ 'nonce' => wp_create_nonce( 'wp_rest' ),
525
+ )
526
+ );
527
+
528
+ add_action( 'wp_footer', 'bp_members_blocks_add_script_data', 1 );
529
+ }
530
+ }
531
+
532
+ $widget_content .= sprintf(
533
+ '<div class="item-options">
534
+ %1$s
535
+ </div>
536
+ <ul id="%2$s" class="item-list" aria-live="polite" aria-relevant="all" aria-atomic="true">
537
+ %3$s
538
+ </ul>',
539
+ implode( $separator_output, $item_options_output ),
540
+ esc_attr( $widget_id ),
541
+ $preview
542
+ );
543
+
544
+ // Adds a container to make sure the block is styled even when used into the Columns parent block.
545
+ $widget_content = sprintf( '<div class="bp-dynamic-block-container">%s</div>', "\n" . $widget_content . "\n" );
546
+
547
+ // Only add a block wrapper if not loaded into a Widgets sidebar.
548
+ if ( ! did_action( 'dynamic_sidebar_before' ) ) {
549
+ return sprintf(
550
+ '<div %1$s>%2$s</div>',
551
+ $wrapper_attributes,
552
+ $widget_content
553
+ );
554
+ }
555
+
556
+ return $widget_content;
557
+ }
558
+
559
+ /**
560
+ * Common function to render the Recently Active & Online Members Blocks.
561
+ *
562
+ * @since 9.0.0
563
+ *
564
+ * @param array $block_args {
565
+ * Optional. An array of Block arguments.
566
+ *
567
+ * @type string $title The title of the Block.
568
+ * @type int $maxMembers The maximum number of members to show. Defaults to `0`.
569
+ * @type string $noMembers The string to output when there are no members to show.
570
+ * @type string $classname The name of the CSS class to use.
571
+ * @type string $type The type of filter to perform. Possible values are `online`, `active`,
572
+ * `newest`, `alphabetical`, `random` or `popular`.
573
+ * }
574
+ * @return string HTML output.
575
+ */
576
+ function bp_members_render_members_avatars_block( $block_args = array() ) {
577
+ $args = bp_parse_args(
578
+ $block_args,
579
+ array(
580
+ 'title' => '',
581
+ 'maxMembers' => 0,
582
+ 'noMembers' => '',
583
+ 'classname' => '',
584
+ 'type' => 'active',
585
+ ),
586
+ ''
587
+ );
588
+
589
+ $title = $args['title'];
590
+ $max_members = (int) $args['maxMembers'];
591
+ $no_members = $args['noMembers'];
592
+ $classname = sanitize_key( $args['classname'] );
593
+ $wrapper_attributes = get_block_wrapper_attributes(
594
+ array(
595
+ 'class' => sprintf( '%s buddypress widget', $classname ),
596
+ )
597
+ );
598
+ $type = sanitize_key( $args['type'] );
599
+
600
+ if ( $title ) {
601
+ $widget_content = sprintf( '<h2 class="widget-title">%s</h2>', esc_html( $title ) );
602
+ } else {
603
+ $widget_content = '';
604
+ }
605
+
606
+ // Query Users.
607
+ $query = bp_core_get_users(
608
+ array(
609
+ 'user_id' => 0,
610
+ 'type' => $type,
611
+ 'per_page' => $max_members,
612
+ 'max' => $max_members,
613
+ 'populate_extras' => true,
614
+ 'search_terms' => false,
615
+ )
616
+ );
617
+
618
+ // Build the output for online members.
619
+ if ( isset( $query['total'] ) && 1 <= (int) $query['total'] ) {
620
+ $members = $query['users'];
621
+ $member_avatars = array();
622
+
623
+ foreach ( $members as $member ) {
624
+ $member_avatars[] = sprintf(
625
+ '<div class="item-avatar">
626
+ <a href="%1$s" class="bp-tooltip" data-bp-tooltip="%2$s">
627
+ <img loading="lazy" src="%3$s" class="avatar user-%4$s-avatar avatar-50 photo" width="50" height="50" alt="%5$s">
628
+ </a>
629
+ </div>',
630
+ esc_url( bp_core_get_user_domain( $member->ID, $member->user_nicename, $member->user_login ) ),
631
+ esc_html( $member->display_name ),
632
+ bp_core_fetch_avatar(
633
+ array(
634
+ 'item_id' => $member->ID,
635
+ 'html' => false,
636
+ )
637
+ ),
638
+ esc_attr( $member->ID ),
639
+ esc_html(
640
+ sprintf(
641
+ /* translators: %s: member name */
642
+ __( 'Profile picture of %s', 'buddypress' ),
643
+ $member->display_name
644
+ )
645
+ )
646
+ );
647
+ }
648
+
649
+ $widget_content .= sprintf(
650
+ '<div class="avatar-block">
651
+ %s
652
+ </div>',
653
+ implode( "\n", $member_avatars )
654
+ );
655
+ } else {
656
+ $widget_content .= sprintf(
657
+ '<div class="widget-error">
658
+ %s
659
+ </div>',
660
+ esc_html( $no_members )
661
+ );
662
+ }
663
+
664
+ // Only add a block wrapper if not loaded into a Widgets sidebar.
665
+ if ( ! did_action( 'dynamic_sidebar_before' ) ) {
666
+ return sprintf(
667
+ '<div %1$s>%2$s</div>',
668
+ $wrapper_attributes,
669
+ $widget_content
670
+ );
671
+ }
672
+
673
+ return $widget_content;
674
+ }
675
+
676
+ /**
677
+ * Callback function to render the Online Members Block.
678
+ *
679
+ * @since 9.0.0
680
+ *
681
+ * @param array $attributes The block attributes.
682
+ * @return string HTML output.
683
+ */
684
+ function bp_members_render_online_members_block( $attributes = array() ) {
685
+ $block_args = bp_parse_args(
686
+ $attributes,
687
+ array(
688
+ 'title' => __( 'Who\'s Online', 'buddypress' ),
689
+ 'maxMembers' => 15,
690
+ 'noMembers' => __( 'There are no users currently online', 'buddypress' ),
691
+ 'classname' => 'widget_bp_core_whos_online_widget',
692
+ ),
693
+ 'members_widget_settings'
694
+ );
695
+
696
+ $block_args['type'] = 'online';
697
+
698
+ return bp_members_render_members_avatars_block( $block_args );
699
+ }
700
+
701
+ /**
702
+ * Callback function to render the Recently Active Members Block.
703
+ *
704
+ * @since 9.0.0
705
+ *
706
+ * @param array $attributes The block attributes.
707
+ * @return string HTML output.
708
+ */
709
+ function bp_members_render_active_members_block( $attributes = array() ) {
710
+ $block_args = bp_parse_args(
711
+ $attributes,
712
+ array(
713
+ 'title' => __( 'Recently Active Members', 'buddypress' ),
714
+ 'maxMembers' => 15,
715
+ 'noMembers' => __( 'There are no recently active members', 'buddypress' ),
716
+ 'classname' => 'widget_bp_core_recently_active_widget',
717
+ ),
718
+ 'recently_active_members_widget_settings'
719
+ );
720
+
721
+ $block_args['type'] = 'active';
722
+
723
+ return bp_members_render_members_avatars_block( $block_args );
724
+ }
bp-members/bp-members-cssjs.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BP Members component CSS/JS.
4
+ *
5
+ * @package BuddyPress
6
+ * @subpackage MembersScripts
7
+ * @since 9.0.0
8
+ */
9
+
10
+ // Exit if accessed directly.
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * Registers the script to manage the dynamic part of the Dynamic Members widget/block.
17
+ *
18
+ * @since 9.0.0
19
+ *
20
+ * @param array $scripts Data about the scripts to register.
21
+ * @return array Data about the scripts to register.
22
+ */
23
+ function bp_members_register_scripts( $scripts = array() ) {
24
+ $scripts['bp-dynamic-members-script'] = array(
25
+ 'file' => plugins_url( 'js/dynamic-members.js', __FILE__ ),
26
+ 'dependencies' => array(
27
+ 'bp-dynamic-widget-block-script',
28
+ 'wp-i18n',
29
+ ),
30
+ 'footer' => true,
31
+ );
32
+
33
+ return $scripts;
34
+ }
35
+ add_filter( 'bp_core_register_common_scripts', 'bp_members_register_scripts', 9, 1 );
bp-members/classes/class-bp-core-members-widget.php CHANGED
@@ -21,6 +21,7 @@ class BP_Core_Members_Widget extends WP_Widget {
21
  * Constructor method.
22
  *
23
  * @since 1.5.0
 
24
  */
25
  public function __construct() {
26
 
@@ -33,9 +34,10 @@ class BP_Core_Members_Widget extends WP_Widget {
33
  'description' => $description,
34
  'classname' => 'widget_bp_core_members_widget buddypress widget',
35
  'customize_selective_refresh' => true,
 
36
  ) );
37
 
38
- if ( is_customize_preview() || is_active_widget( false, false, $this->id_base ) ) {
39
  add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
40
  }
41
  }
21
  * Constructor method.
22
  *
23
  * @since 1.5.0
24
+ * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options.
25
  */
26
  public function __construct() {
27
 
34
  'description' => $description,
35
  'classname' => 'widget_bp_core_members_widget buddypress widget',
36
  'customize_selective_refresh' => true,
37
+ 'show_instance_in_rest' => true,
38
  ) );
39
 
40
+ if ( is_customize_preview() || bp_is_widget_block_active( '', $this->id_base ) ) {
41
  add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
42
  }
43
  }
bp-members/classes/class-bp-core-recently-active-widget.php CHANGED
@@ -21,6 +21,7 @@ class BP_Core_Recently_Active_Widget extends WP_Widget {
21
  * Constructor method.
22
  *
23
  * @since 1.5.0
 
24
  */
25
  public function __construct() {
26
  $name = _x( '(BuddyPress) Recently Active Members', 'widget name', 'buddypress' );
@@ -29,6 +30,7 @@ class BP_Core_Recently_Active_Widget extends WP_Widget {
29
  'description' => $description,
30
  'classname' => 'widget_bp_core_recently_active_widget buddypress widget',
31
  'customize_selective_refresh' => true,
 
32
  ) );
33
  }
34
 
21
  * Constructor method.
22
  *
23
  * @since 1.5.0
24
+ * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options.
25
  */
26
  public function __construct() {
27
  $name = _x( '(BuddyPress) Recently Active Members', 'widget name', 'buddypress' );
30
  'description' => $description,
31
  'classname' => 'widget_bp_core_recently_active_widget buddypress widget',
32
  'customize_selective_refresh' => true,
33
+ 'show_instance_in_rest' => true,
34
  ) );
35
  }
36
 
bp-members/classes/class-bp-core-whos-online-widget.php CHANGED
@@ -14,6 +14,7 @@ defined( 'ABSPATH' ) || exit;
14
  * Who's Online Widget.
15
  *
16
  * @since 1.0.3
 
17
  */
18
  class BP_Core_Whos_Online_Widget extends WP_Widget {
19
 
@@ -21,6 +22,7 @@ class BP_Core_Whos_Online_Widget extends WP_Widget {
21
  * Constructor method.
22
  *
23
  * @since 1.5.0
 
24
  */
25
  public function __construct() {
26
  $name = _x( "(BuddyPress) Who's Online", 'widget name', 'buddypress' );
@@ -29,6 +31,7 @@ class BP_Core_Whos_Online_Widget extends WP_Widget {
29
  'description' => $description,
30
  'classname' => 'widget_bp_core_whos_online_widget buddypress widget',
31
  'customize_selective_refresh' => true,
 
32
  ) );
33
  }
34
 
14
  * Who's Online Widget.
15
  *
16
  * @since 1.0.3
17
+ * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options.
18
  */
19
  class BP_Core_Whos_Online_Widget extends WP_Widget {
20
 
22
  * Constructor method.
23
  *
24
  * @since 1.5.0
25
+ * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options.
26
  */
27
  public function __construct() {
28
  $name = _x( "(BuddyPress) Who's Online", 'widget name', 'buddypress' );
31
  'description' => $description,
32
  'classname' => 'widget_bp_core_whos_online_widget buddypress widget',
33
  'customize_selective_refresh' => true,
34
+ 'show_instance_in_rest' => true,
35
  ) );
36
  }
37
 
bp-members/classes/class-bp-members-component.php CHANGED
@@ -58,6 +58,7 @@ class BP_Members_Component extends BP_Component {
58
 
59
  // Always include these files.
60
  $includes = array(
 
61
  'filters',
62
  'template',
63
  'adminbar',
@@ -196,6 +197,17 @@ class BP_Members_Component extends BP_Component {
196
  'table_name_signups' => $wpdb->base_prefix . 'signups', // Signups is a global WordPress table.
197
  ),
198
  'notification_callback' => 'members_format_notifications',
 
 
 
 
 
 
 
 
 
 
 
199
  );
200
 
201
  parent::setup_globals( $args );
@@ -695,17 +707,13 @@ class BP_Members_Component extends BP_Component {
695
  *
696
  * @since 5.0.0
697
  * @since 6.0.0 Adds the Member Cover and Signup REST endpoints.
 
698
  *
699
  * @param array $controllers Optional. See BP_Component::rest_api_init() for
700
  * description.
701
  */
702
  public function rest_api_init( $controllers = array() ) {
703
  $controllers = array(
704
- /**
705
- * As the Members component is always loaded,
706
- * let's register the Components endpoint here.
707
- */
708
- 'BP_REST_Components_Endpoint',
709
  'BP_REST_Members_Endpoint',
710
  'BP_REST_Attachments_Member_Avatar_Endpoint',
711
  );
@@ -741,11 +749,9 @@ class BP_Members_Component extends BP_Component {
741
  'wp-element',
742
  'wp-components',
743
  'wp-i18n',
744
- 'wp-editor',
745
- 'wp-compose',
746
- 'wp-data',
747
  'wp-block-editor',
748
  'bp-block-components',
 
749
  ),
750
  'style' => 'bp-member-block',
751
  'style_url' => plugins_url( 'css/blocks/member.css', dirname( __FILE__ ) ),
@@ -782,12 +788,11 @@ class BP_Members_Component extends BP_Component {
782
  'wp-element',
783
  'wp-components',
784
  'wp-i18n',
785
- 'wp-compose',
786
- 'wp-data',
787
  'wp-api-fetch',
788
  'wp-url',
789
  'wp-block-editor',
790
  'bp-block-components',
 
791
  'lodash',
792
  ),
793
  'style' => 'bp-members-block',
@@ -828,6 +833,93 @@ class BP_Members_Component extends BP_Component {
828
  ),
829
  'render_callback' => 'bp_members_render_members_block',
830
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
831
  )
832
  );
833
  }
58
 
59
  // Always include these files.
60
  $includes = array(
61
+ 'cssjs',
62
  'filters',
63
  'template',
64
  'adminbar',
197
  'table_name_signups' => $wpdb->base_prefix . 'signups', // Signups is a global WordPress table.
198
  ),
199
  'notification_callback' => 'members_format_notifications',
200
+ 'block_globals' => array(
201
+ 'bp/dynamic-members' => array(
202
+ 'widget_classnames' => array( 'widget_bp_core_members_widget', 'buddypress' ),
203
+ ),
204
+ 'bp/online-members' => array(
205
+ 'widget_classnames' => array( 'widget_bp_core_whos_online_widget', 'buddypress' ),
206
+ ),
207
+ 'bp/active-members' => array(
208
+ 'widget_classnames' => array( 'widget_bp_core_recently_active_widget', 'buddypress' ),
209
+ ),
210
+ ),
211
  );
212
 
213
  parent::setup_globals( $args );
707
  *
708
  * @since 5.0.0
709
  * @since 6.0.0 Adds the Member Cover and Signup REST endpoints.
710
+ * @since 9.0.0 Moves the `BP_REST_Components_Endpoint` controller in `BP_Core` component.
711
  *
712
  * @param array $controllers Optional. See BP_Component::rest_api_init() for
713
  * description.
714
  */
715
  public function rest_api_init( $controllers = array() ) {
716
  $controllers = array(
 
 
 
 
 
717
  'BP_REST_Members_Endpoint',
718
  'BP_REST_Attachments_Member_Avatar_Endpoint',
719
  );
749
  'wp-element',
750
  'wp-components',
751
  'wp-i18n',
 
 
 
752
  'wp-block-editor',
753
  'bp-block-components',
754
+ 'bp-block-data',
755
  ),
756
  'style' => 'bp-member-block',
757
  'style_url' => plugins_url( 'css/blocks/member.css', dirname( __FILE__ ) ),
788
  'wp-element',
789
  'wp-components',
790
  'wp-i18n',
 
 
791
  'wp-api-fetch',
792
  'wp-url',
793
  'wp-block-editor',
794
  'bp-block-components',
795
+ 'bp-block-data',
796
  'lodash',
797
  ),
798
  'style' => 'bp-members-block',
833
  ),
834
  'render_callback' => 'bp_members_render_members_block',
835
  ),
836
+ 'bp/dynamic-members' => array(
837
+ 'name' => 'bp/dynamic-members',
838
+ 'editor_script' => 'bp-dynamic-members-block',
839
+ 'editor_script_url' => plugins_url( 'js/blocks/dynamic-members.js', dirname( __FILE__ ) ),
840
+ 'editor_script_deps' => array(
841
+ 'wp-blocks',
842
+ 'wp-element',
843
+ 'wp-components',
844
+ 'wp-i18n',
845
+ 'wp-block-editor',
846
+ 'bp-block-data',
847
+ 'bp-block-components',
848
+ ),
849
+ 'style' => 'bp-dynamic-members-block',
850
+ 'style_url' => plugins_url( 'css/blocks/dynamic-members.css', dirname( __FILE__ ) ),
851
+ 'attributes' => array(
852
+ 'title' => array(
853
+ 'type' => 'string',
854
+ 'default' => __( 'Members', 'buddypress' ),
855
+ ),
856
+ 'maxMembers' => array(
857
+ 'type' => 'number',
858
+ 'default' => 5,
859
+ ),
860
+ 'memberDefault' => array(
861
+ 'type' => 'string',
862
+ 'default' => 'active',
863
+ ),
864
+ 'linkTitle' => array(
865
+ 'type' => 'boolean',
866
+ 'default' => false,
867
+ ),
868
+ ),
869
+ 'render_callback' => 'bp_members_render_dynamic_members_block',
870
+ ),
871
+ 'bp/online-members' => array(
872
+ 'name' => 'bp/online-members',
873
+ 'editor_script' => 'bp-online-members-block',
874
+ 'editor_script_url' => plugins_url( 'js/blocks/online-members.js', dirname( __FILE__ ) ),
875
+ 'editor_script_deps' => array(
876
+ 'wp-blocks',
877
+ 'wp-element',
878
+ 'wp-components',
879
+ 'wp-i18n',
880
+ 'wp-block-editor',
881
+ 'bp-block-components',
882
+ ),
883
+ 'editor_style' => 'bp-member-avatar-blocks',
884
+ 'editor_style_url' => plugins_url( 'css/blocks/member-avatar-blocks.css', dirname( __FILE__ ) ),
885
+ 'attributes' => array(
886
+ 'title' => array(
887
+ 'type' => 'string',
888
+ 'default' => __( 'Who\'s Online', 'buddypress' ),
889
+ ),
890
+ 'maxMembers' => array(
891
+ 'type' => 'number',
892
+ 'default' => 15,
893
+ ),
894
+ ),
895
+ 'render_callback' => 'bp_members_render_online_members_block',
896
+ ),
897
+ 'bp/active-members' => array(
898
+ 'name' => 'bp/active-members',
899
+ 'editor_script' => 'bp-active-members-block',
900
+ 'editor_script_url' => plugins_url( 'js/blocks/active-members.js', dirname( __FILE__ ) ),
901
+ 'editor_script_deps' => array(
902
+ 'wp-blocks',
903
+ 'wp-element',
904
+ 'wp-components',
905
+ 'wp-i18n',
906
+ 'wp-block-editor',
907
+ 'bp-block-components',
908
+ ),
909
+ 'editor_style' => 'bp-member-avatar-blocks',
910
+ 'editor_style_url' => plugins_url( 'css/blocks/member-avatar-blocks.css', dirname( __FILE__ ) ),
911
+ 'attributes' => array(
912
+ 'title' => array(
913
+ 'type' => 'string',
914
+ 'default' => __( 'Recently Active Members', 'buddypress' ),
915
+ ),
916
+ 'maxMembers' => array(
917
+ 'type' => 'number',
918
+ 'default' => 15,
919
+ ),
920
+ ),
921
+ 'render_callback' => 'bp_members_render_active_members_block',
922
+ ),
923
  )
924
  );
925
  }
bp-members/classes/class-bp-rest-attachments-member-avatar-endpoint.php CHANGED
@@ -109,9 +109,9 @@ class BP_REST_Attachments_Member_Avatar_Endpoint extends WP_REST_Controller {
109
  'object' => $this->object,
110
  'type' => $type,
111
  'item_id' => (int) $this->user->ID,
112
- 'html' => (bool) $request['html'],
113
- 'alt' => $request['alt'],
114
- 'no_grav' => (bool) $request['no_gravatar'],
115
  )
116
  );
117
  }
@@ -167,7 +167,7 @@ class BP_REST_Attachments_Member_Avatar_Endpoint extends WP_REST_Controller {
167
  'status' => 404,
168
  )
169
  );
170
- $this->user = bp_rest_get_user( $request['user_id'] );
171
 
172
  if ( $this->user instanceof WP_User ) {
173
  $retval = true;
@@ -414,7 +414,7 @@ class BP_REST_Attachments_Member_Avatar_Endpoint extends WP_REST_Controller {
414
  'thumb' => $avatar->thumb,
415
  );
416
 
417
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
418
  $data = $this->add_additional_fields_to_object( $data, $request );
419
  $data = $this->filter_response_by_context( $data, $context );
420
  $response = rest_ensure_response( $data );
109
  'object' => $this->object,
110
  'type' => $type,
111
  'item_id' => (int) $this->user->ID,
112
+ 'html' => (bool) $request->get_param( 'html' ),
113
+ 'alt' => $request->get_param( 'alt' ),
114
+ 'no_grav' => (bool) $request->get_param( 'no_gravatar' ),
115
  )
116
  );
117
  }
167
  'status' => 404,
168
  )
169
  );
170
+ $this->user = bp_rest_get_user( $request->get_param( 'user_id' ) );
171
 
172
  if ( $this->user instanceof WP_User ) {
173
  $retval = true;
414
  'thumb' => $avatar->thumb,
415
  );
416
 
417
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
418
  $data = $this->add_additional_fields_to_object( $data, $request );
419
  $data = $this->filter_response_by_context( $data, $context );
420
  $response = rest_ensure_response( $data );
bp-members/classes/class-bp-rest-attachments-member-cover-endpoint.php CHANGED
@@ -157,7 +157,7 @@ class BP_REST_Attachments_Member_Cover_Endpoint extends WP_REST_Controller {
157
  'status' => 404,
158
  )
159
  );
160
- $this->user = bp_rest_get_user( $request['user_id'] );
161
 
162
  if ( $this->user instanceof WP_User ) {
163
  $retval = true;
@@ -385,7 +385,7 @@ class BP_REST_Attachments_Member_Cover_Endpoint extends WP_REST_Controller {
385
  'image' => $cover_url,
386
  );
387
 
388
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
389
  $data = $this->add_additional_fields_to_object( $data, $request );
390
  $data = $this->filter_response_by_context( $data, $context );
391
 
157
  'status' => 404,
158
  )
159
  );
160
+ $this->user = bp_rest_get_user( $request->get_param( 'user_id' ) );
161
 
162
  if ( $this->user instanceof WP_User ) {
163
  $retval = true;
385
  'image' => $cover_url,
386
  );
387
 
388
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
389
  $data = $this->add_additional_fields_to_object( $data, $request );
390
  $data = $this->filter_response_by_context( $data, $context );
391
 
bp-members/classes/class-bp-rest-members-endpoint.php CHANGED
@@ -101,36 +101,36 @@ class BP_REST_Members_Endpoint extends WP_REST_Users_Controller {
101
  */
102
  public function get_items( $request ) {
103
  $args = array(
104
- 'type' => $request['type'],
105
- 'user_id' => $request['user_id'],
106
- 'user_ids' => $request['user_ids'],
107
- 'xprofile_query' => $request['xprofile'],
108
- 'include' => $request['include'],
109
- 'exclude' => $request['exclude'],
110
- 'populate_extras' => $request['populate_extras'],
111
- 'member_type' => $request['member_type'],
112
- 'search_terms' => $request['search'],
113
- 'per_page' => $request['per_page'],
114
- 'page' => $request['page'],
115
  );
116
 
117
- if ( empty( $request['user_ids'] ) ) {
118
  $args['user_ids'] = false;
119
  }
120
 
121
- if ( empty( $request['exclude'] ) ) {
122
  $args['exclude'] = false;
123
  }
124
 
125
- if ( empty( $request['include'] ) ) {
126
  $args['include'] = false;
127
  }
128
 
129
- if ( empty( $request['xprofile'] ) ) {
130
  $args['xprofile_query'] = false;
131
  }
132
 
133
- if ( empty( $request['member_type'] ) ) {
134
  $args['member_type'] = '';
135
  }
136
 
@@ -206,9 +206,9 @@ class BP_REST_Members_Endpoint extends WP_REST_Users_Controller {
206
  * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
207
  */
208
  public function get_item( $request ) {
209
- if ( true === $request['populate_extras'] ) {
210
  $args = array(
211
- 'user_ids' => array( $request['id'] ),
212
  'populate_extras' => true,
213
  );
214
 
@@ -242,7 +242,7 @@ class BP_REST_Members_Endpoint extends WP_REST_Users_Controller {
242
  )
243
  );
244
 
245
- $user = bp_rest_get_user( $request['id'] );
246
 
247
  if ( ! $user instanceof WP_User ) {
248
  $retval = new WP_Error(
@@ -252,7 +252,7 @@ class BP_REST_Members_Endpoint extends WP_REST_Users_Controller {
252
  'status' => 404,
253
  )
254
  );
255
- } elseif ( 'edit' === $request['context'] ) {
256
  if ( get_current_user_id() === $user->ID || bp_current_user_can( 'list_users' ) ) {
257
  $retval = true;
258
  } else {
@@ -319,8 +319,8 @@ class BP_REST_Members_Endpoint extends WP_REST_Users_Controller {
319
  );
320
  $retval = $error;
321
 
322
- $user = bp_rest_get_user( $request['id'] );
323
- $member_type_edit = isset( $request['member_type'] );
324
 
325
  if ( ! $user instanceof WP_User ) {
326
  $retval = new WP_Error(
@@ -441,7 +441,7 @@ class BP_REST_Members_Endpoint extends WP_REST_Users_Controller {
441
  * @return WP_REST_Response
442
  */
443
  public function prepare_item_for_response( $user, $request ) {
444
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
445
  $data = $this->user_data( $user, $context, $request );
446
  $data = $this->add_additional_fields_to_object( $data, $request );
447
  $data = $this->filter_response_by_context( $data, $context );
@@ -488,20 +488,47 @@ class BP_REST_Members_Endpoint extends WP_REST_Users_Controller {
488
  'id' => $user->ID,
489
  'name' => $user->display_name,
490
  'user_login' => $user->user_login,
491
- 'link' => bp_core_get_user_domain( $user->ID, $user->user_nicename, $user->user_login ),
492
- 'member_types' => bp_get_member_type( $user->ID, false ),
493
  'roles' => array(),
494
  'capabilities' => array(),
495
  'extra_capabilities' => array(),
496
  'registered_date' => '',
497
- 'xprofile' => $this->xprofile_data( $user->ID ),
498
  'friendship_status' => false,
499
  'friendship_status_slug' => '',
500
  );
501
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
502
  if ( $request->get_param( 'populate_extras' ) ) {
503
- $data['last_activity']['timediff'] = '';
504
- $data['last_activity']['date'] = '';
 
 
 
 
505
 
506
  if ( get_current_user_id() === $user->ID ) {
507
  $right_now = gmdate( 'Y-m-d H:i:s', bp_core_current_time( true, 'timestamp' ) );
@@ -538,10 +565,14 @@ class BP_REST_Members_Endpoint extends WP_REST_Users_Controller {
538
 
539
  // Friends related fields.
540
  if ( bp_is_active( 'friends' ) && get_current_user_id() !== $user->ID ) {
541
- $friendship_status = friends_check_friendship_status( get_current_user_id(), $user->ID );
 
 
 
542
 
543
- $data['friendship_status_slug'] = $friendship_status;
544
- $data['friendship_status'] = ( 'is_friend' === $friendship_status );
 
545
  }
546
 
547
  if ( 'edit' === $context && current_user_can( 'list_users' ) ) {
@@ -552,12 +583,16 @@ class BP_REST_Members_Endpoint extends WP_REST_Users_Controller {
552
  }
553
 
554
  // The name used for that user in @-mentions.
555
- if ( bp_is_active( 'activity' ) ) {
 
 
556
  $data['mention_name'] = bp_activity_get_user_mentionname( $user->ID );
557
  }
558
 
559
  // Avatars.
560
- if ( true === buddypress()->avatar->show_avatars ) {
 
 
561
  $data['avatar_urls'] = array(
562
  'full' => bp_core_fetch_avatar(
563
  array(
@@ -598,8 +633,8 @@ class BP_REST_Members_Endpoint extends WP_REST_Users_Controller {
598
  $prepared_user = parent::prepare_item_for_database( $request );
599
 
600
  // The parent class uses username instead of user_login.
601
- if ( ! isset( $prepared_user->user_login ) && isset( $request['user_login'] ) ) {
602
- $prepared_user->user_login = $request['user_login'];
603
  }
604
 
605
  /**
@@ -612,12 +647,12 @@ class BP_REST_Members_Endpoint extends WP_REST_Users_Controller {
612
  }
613
 
614
  // Set member type.
615
- if ( isset( $prepared_user->ID ) && isset( $request['member_type'] ) ) {
616
 
617
  // Append on update. Add on creation.
618
  $append = WP_REST_Server::EDITABLE === $request->get_method();
619
 
620
- bp_set_member_type( $prepared_user->ID, $request['member_type'], $append );
621
  }
622
 
623
  /**
@@ -859,6 +894,12 @@ class BP_REST_Members_Endpoint extends WP_REST_Users_Controller {
859
  'context' => array( 'edit' ),
860
  'readonly' => true,
861
  ),
 
 
 
 
 
 
862
  'password' => array(
863
  'description' => __( 'Password for the member (never included).', 'buddypress' ),
864
  'type' => 'string',
101
  */
102
  public function get_items( $request ) {
103
  $args = array(
104
+ 'type' => $request->get_param( 'type' ),
105
+ 'user_id' => $request->get_param( 'user_id' ),
106
+ 'user_ids' => $request->get_param( 'user_ids' ),
107
+ 'xprofile_query' => $request->get_param( 'xprofile' ),
108
+ 'include' => $request->get_param( 'include' ),
109
+ 'exclude' => $request->get_param( 'exclude' ),
110
+ 'populate_extras' => $request->get_param( 'populate_extras' ),
111
+ 'member_type' => $request->get_param( 'member_type' ),
112
+ 'search_terms' => $request->get_param( 'search' ),
113
+ 'per_page' => $request->get_param( 'per_page' ),
114
+ 'page' => $request->get_param( 'page' ),
115
  );
116
 
117
+ if ( empty( $request->get_param( 'user_ids' ) ) ) {
118
  $args['user_ids'] = false;
119
  }
120
 
121
+ if ( empty( $request->get_param( 'exclude' ) ) ) {
122
  $args['exclude'] = false;
123
  }
124
 
125
+ if ( empty( $request->get_param( 'include' ) ) ) {
126
  $args['include'] = false;
127
  }
128
 
129
+ if ( empty( $request->get_param( 'xprofile' ) ) ) {
130
  $args['xprofile_query'] = false;
131
  }
132
 
133
+ if ( empty( $request->get_param( 'member_type' ) ) ) {
134
  $args['member_type'] = '';
135
  }
136
 
206
  * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
207
  */
208
  public function get_item( $request ) {
209
+ if ( true === $request->get_param( 'populate_extras' ) ) {
210
  $args = array(
211
+ 'user_ids' => array( $request->get_param( 'id' ) ),
212
  'populate_extras' => true,
213
  );
214
 
242
  )
243
  );
244
 
245
+ $user = bp_rest_get_user( $request->get_param( 'id' ) );
246
 
247
  if ( ! $user instanceof WP_User ) {
248
  $retval = new WP_Error(
252
  'status' => 404,
253
  )
254
  );
255
+ } elseif ( 'edit' === $request->get_param( 'context' ) ) {
256
  if ( get_current_user_id() === $user->ID || bp_current_user_can( 'list_users' ) ) {
257
  $retval = true;
258
  } else {
319
  );
320
  $retval = $error;
321
 
322
+ $user = bp_rest_get_user( $request->get_param( 'id' ) );
323
+ $member_type_edit = ! empty( $request->get_param( 'member_type' ) );
324
 
325
  if ( ! $user instanceof WP_User ) {
326
  $retval = new WP_Error(
441
  * @return WP_REST_Response
442
  */
443
  public function prepare_item_for_response( $user, $request ) {
444
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
445
  $data = $this->user_data( $user, $context, $request );
446
  $data = $this->add_additional_fields_to_object( $data, $request );
447
  $data = $this->filter_response_by_context( $data, $context );
488
  'id' => $user->ID,
489
  'name' => $user->display_name,
490
  'user_login' => $user->user_login,
 
 
491
  'roles' => array(),
492
  'capabilities' => array(),
493
  'extra_capabilities' => array(),
494
  'registered_date' => '',
 
495
  'friendship_status' => false,
496
  'friendship_status_slug' => '',
497
  );
498
 
499
+ // Get fields to output for REST endpoint.
500
+ $fields = $request->get_param( '_fields' );
501
+
502
+ // If comma-delimited, explode into array.
503
+ if ( ! empty( $fields ) && ! is_array( $fields ) ) {
504
+ $fields = explode( ',', $fields );
505
+ }
506
+
507
+ $fields = array_flip( (array) $fields );
508
+
509
+ // Link.
510
+ if ( empty( $fields ) || ! empty( $fields['link'] ) ) {
511
+ $data['link'] = bp_core_get_user_domain( $user->ID, $user->user_nicename, $user->user_login );
512
+ }
513
+
514
+ // Member types.
515
+ if ( empty( $fields ) || ! empty( $fields['member_types'] ) ) {
516
+ $data['member_types'] = bp_get_member_type( $user->ID, false );
517
+ }
518
+
519
+ // Xprofile data.
520
+ if ( empty( $fields ) || ! empty( $fields['xprofile'] ) ) {
521
+ $data['xprofile'] = $this->xprofile_data( $user->ID );
522
+ }
523
+
524
+ // Populate extras.
525
  if ( $request->get_param( 'populate_extras' ) ) {
526
+ $data['registered_since'] = bp_core_time_since( $user->user_registered );
527
+
528
+ $data['last_activity'] = array(
529
+ 'timediff' => '',
530
+ 'date' => '',
531
+ );
532
 
533
  if ( get_current_user_id() === $user->ID ) {
534
  $right_now = gmdate( 'Y-m-d H:i:s', bp_core_current_time( true, 'timestamp' ) );
565
 
566
  // Friends related fields.
567
  if ( bp_is_active( 'friends' ) && get_current_user_id() !== $user->ID ) {
568
+ if ( empty( $fields ) ||
569
+ ( ! empty( $fields['friendship_status_slug'] ) || ! empty( $fields['friendship_status'] ) )
570
+ ) {
571
+ $friendship_status = friends_check_friendship_status( get_current_user_id(), $user->ID );
572
 
573
+ $data['friendship_status_slug'] = $friendship_status;
574
+ $data['friendship_status'] = ( 'is_friend' === $friendship_status );
575
+ }
576
  }
577
 
578
  if ( 'edit' === $context && current_user_can( 'list_users' ) ) {
583
  }
584
 
585
  // The name used for that user in @-mentions.
586
+ if ( bp_is_active( 'activity' ) &&
587
+ ( empty( $fields ) || ! empty( $fields['mention_name'] ) )
588
+ ) {
589
  $data['mention_name'] = bp_activity_get_user_mentionname( $user->ID );
590
  }
591
 
592
  // Avatars.
593
+ if ( true === buddypress()->avatar->show_avatars &&
594
+ ( empty( $fields ) || ! empty( $fields['avatar_urls'] ) )
595
+ ) {
596
  $data['avatar_urls'] = array(
597
  'full' => bp_core_fetch_avatar(
598
  array(
633
  $prepared_user = parent::prepare_item_for_database( $request );
634
 
635
  // The parent class uses username instead of user_login.
636
+ if ( ! isset( $prepared_user->user_login ) && ! empty( $request->get_param( 'user_login' ) ) ) {
637
+ $prepared_user->user_login = $request->get_param( 'user_login' );
638
  }
639
 
640
  /**
647
  }
648
 
649
  // Set member type.
650
+ if ( isset( $prepared_user->ID ) && ! empty( $request->get_param( 'member_type' ) ) ) {
651
 
652
  // Append on update. Add on creation.
653
  $append = WP_REST_Server::EDITABLE === $request->get_method();
654
 
655
+ bp_set_member_type( $prepared_user->ID, $request->get_param( 'member_type' ), $append );
656
  }
657
 
658
  /**
894
  'context' => array( 'edit' ),
895
  'readonly' => true,
896
  ),
897
+ 'registered_since' => array(
898
+ 'description' => __( 'Elapsed time since the member registered.', 'buddypress' ),
899
+ 'type' => 'string',
900
+ 'context' => array( 'view', 'edit' ),
901
+ 'readonly' => true,
902
+ ),
903
  'password' => array(
904
  'description' => __( 'Password for the member (never included).', 'buddypress' ),
905
  'type' => 'string',
bp-members/classes/class-bp-rest-signup-endpoint.php CHANGED
@@ -124,15 +124,15 @@ class BP_REST_Signup_Endpoint extends WP_REST_Controller {
124
  */
125
  public function get_items( $request ) {
126
  $args = array(
127
- 'include' => $request['include'],
128
- 'order' => $request['order'],
129
- 'orderby' => $request['orderby'],
130
- 'user_login' => $request['user_login'],
131
- 'number' => $request['number'],
132
- 'offset' => $request['offset'],
133
  );
134
 
135
- if ( empty( $request['include'] ) ) {
136
  $args['include'] = false;
137
  }
138
 
@@ -231,8 +231,7 @@ class BP_REST_Signup_Endpoint extends WP_REST_Controller {
231
  */
232
  public function get_item( $request ) {
233
  // Get signup.
234
- $signup = $this->get_signup_object( $request['id'] );
235
-
236
  $retval = array(
237
  $this->prepare_response_for_collection(
238
  $this->prepare_item_for_response( $signup, $request )
@@ -267,7 +266,7 @@ class BP_REST_Signup_Endpoint extends WP_REST_Controller {
267
  $retval = $this->get_items_permissions_check( $request );
268
 
269
  if ( ! is_wp_error( $retval ) ) {
270
- $signup = $this->get_signup_object( $request['id'] );
271
 
272
  if ( empty( $signup ) ) {
273
  $retval = new WP_Error(
@@ -303,7 +302,7 @@ class BP_REST_Signup_Endpoint extends WP_REST_Controller {
303
  $request->set_param( 'context', 'edit' );
304
 
305
  // Validate user signup.
306
- $signup_validation = bp_core_validate_user_signup( $request['user_login'], $request['user_email'] );
307
  if ( is_wp_error( $signup_validation['errors'] ) && $signup_validation['errors']->get_error_messages() ) {
308
  // Return the first error.
309
  return new WP_Error(
@@ -522,7 +521,7 @@ class BP_REST_Signup_Endpoint extends WP_REST_Controller {
522
  $request->set_param( 'context', 'edit' );
523
 
524
  // Get the signup before it's deleted.
525
- $signup = $this->get_signup_object( $request['id'] );
526
  $previous = $this->prepare_item_for_response( $signup, $request );
527
  $deleted = BP_Signup::delete( array( $signup->id ) );
528
 
@@ -688,7 +687,7 @@ class BP_REST_Signup_Endpoint extends WP_REST_Controller {
688
  $data['user_name'] = $signup->user_name;
689
  }
690
 
691
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
692
 
693
  if ( 'edit' === $context ) {
694
  $data['activation_key'] = $signup->activation_key;
@@ -958,14 +957,14 @@ class BP_REST_Signup_Endpoint extends WP_REST_Controller {
958
 
959
  $schema['properties']['site_public'] = array(
960
  'context' => array( 'edit' ),
961
- 'description' => __( 'Search engine visibility of the new user\'s site.', 'buddypress' ),
962
  'type' => 'boolean',
963
  'default' => true,
964
  );
965
 
966
  $schema['properties']['site_language'] = array(
967
  'context' => array( 'edit' ),
968
- 'description' => __( 'Language to use for the new user\'s site.', 'buddypress' ),
969
  'type' => 'string',
970
  'default' => get_locale(),
971
  'enum' => array_merge( array( get_locale() ), $this->get_available_languages() ),
124
  */
125
  public function get_items( $request ) {
126
  $args = array(
127
+ 'include' => $request->get_param( 'include' ),
128
+ 'order' => $request->get_param( 'order' ),
129
+ 'orderby' => $request->get_param( 'orderby' ),
130
+ 'user_login' => $request->get_param( 'user_login' ),
131
+ 'number' => $request->get_param( 'number' ),
132
+ 'offset' => $request->get_param( 'offset' ),
133
  );
134
 
135
+ if ( empty( $request->get_param( 'include' ) ) ) {
136
  $args['include'] = false;
137
  }
138
 
231
  */
232
  public function get_item( $request ) {
233
  // Get signup.
234
+ $signup = $this->get_signup_object( $request->get_param( 'id' ) );
 
235
  $retval = array(
236
  $this->prepare_response_for_collection(
237
  $this->prepare_item_for_response( $signup, $request )
266
  $retval = $this->get_items_permissions_check( $request );
267
 
268
  if ( ! is_wp_error( $retval ) ) {
269
+ $signup = $this->get_signup_object( $request->get_param( 'id' ) );
270
 
271
  if ( empty( $signup ) ) {
272
  $retval = new WP_Error(
302
  $request->set_param( 'context', 'edit' );
303
 
304
  // Validate user signup.
305
+ $signup_validation = bp_core_validate_user_signup( $request->get_param( 'user_login' ), $request->get_param( 'user_email' ) );
306
  if ( is_wp_error( $signup_validation['errors'] ) && $signup_validation['errors']->get_error_messages() ) {
307
  // Return the first error.
308
  return new WP_Error(
521
  $request->set_param( 'context', 'edit' );
522
 
523
  // Get the signup before it's deleted.
524
+ $signup = $this->get_signup_object( $request->get_param( 'id' ) );
525
  $previous = $this->prepare_item_for_response( $signup, $request );
526
  $deleted = BP_Signup::delete( array( $signup->id ) );
527
 
687
  $data['user_name'] = $signup->user_name;
688
  }
689
 
690
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
691
 
692
  if ( 'edit' === $context ) {
693
  $data['activation_key'] = $signup->activation_key;
957
 
958
  $schema['properties']['site_public'] = array(
959
  'context' => array( 'edit' ),
960
+ 'description' => __( 'Search engine visibility of the new user\'s site.', 'buddypress' ),
961
  'type' => 'boolean',
962
  'default' => true,
963
  );
964
 
965
  $schema['properties']['site_language'] = array(
966
  'context' => array( 'edit' ),
967
+ 'description' => __( 'Language to use for the new user\'s site.', 'buddypress' ),
968
  'type' => 'string',
969
  'default' => get_locale(),
970
  'enum' => array_merge( array( get_locale() ), $this->get_available_languages() ),
bp-members/css/blocks/dynamic-members-rtl.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-dynamic-block-container .item-options {
2
+ font-size: 0.5em;
3
+ margin: 0 0 1em;
4
+ padding: 1em 0;
5
+ }
6
+
7
+ .bp-dynamic-block-container .item-options a.selected {
8
+ font-weight: 600;
9
+ }
10
+
11
+ .bp-dynamic-block-container ul.item-list {
12
+ list-style: none;
13
+ margin: 1em 0;
14
+ }
15
+
16
+ .bp-dynamic-block-container ul.item-list li {
17
+ margin-bottom: 1em;
18
+ }
19
+
20
+ .bp-dynamic-block-container ul.item-list li:before, .bp-dynamic-block-container ul.item-list li:after {
21
+ content: " ";
22
+ display: table;
23
+ }
24
+
25
+ .bp-dynamic-block-container ul.item-list li:after {
26
+ clear: both;
27
+ }
28
+
29
+ .bp-dynamic-block-container ul.item-list li .item-avatar {
30
+ float: right;
31
+ width: 60px;
32
+ }
33
+
34
+ .bp-dynamic-block-container ul.item-list li .item {
35
+ margin-right: 70px;
36
+ }
bp-members/css/blocks/dynamic-members-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .bp-dynamic-block-container .item-options{font-size:.5em;margin:0 0 1em;padding:1em 0}.bp-dynamic-block-container .item-options a.selected{font-weight:600}.bp-dynamic-block-container ul.item-list{list-style:none;margin:1em 0}.bp-dynamic-block-container ul.item-list li{margin-bottom:1em}.bp-dynamic-block-container ul.item-list li:after,.bp-dynamic-block-container ul.item-list li:before{content:" ";display:table}.bp-dynamic-block-container ul.item-list li:after{clear:both}.bp-dynamic-block-container ul.item-list li .item-avatar{float:right;width:60px}.bp-dynamic-block-container ul.item-list li .item{margin-right:70px}
bp-members/css/blocks/dynamic-members.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-dynamic-block-container .item-options {
2
+ font-size: 0.5em;
3
+ margin: 0 0 1em;
4
+ padding: 1em 0;
5
+ }
6
+
7
+ .bp-dynamic-block-container .item-options a.selected {
8
+ font-weight: 600;
9
+ }
10
+
11
+ .bp-dynamic-block-container ul.item-list {
12
+ list-style: none;
13
+ margin: 1em 0;
14
+ }
15
+
16
+ .bp-dynamic-block-container ul.item-list li {
17
+ margin-bottom: 1em;
18
+ }
19
+
20
+ .bp-dynamic-block-container ul.item-list li:before, .bp-dynamic-block-container ul.item-list li:after {
21
+ content: " ";
22
+ display: table;
23
+ }
24
+
25
+ .bp-dynamic-block-container ul.item-list li:after {
26
+ clear: both;
27
+ }
28
+
29
+ .bp-dynamic-block-container ul.item-list li .item-avatar {
30
+ float: left;
31
+ width: 60px;
32
+ }
33
+
34
+ .bp-dynamic-block-container ul.item-list li .item {
35
+ margin-left: 70px;
36
+ }
bp-members/css/blocks/dynamic-members.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .bp-dynamic-block-container .item-options{font-size:.5em;margin:0 0 1em;padding:1em 0}.bp-dynamic-block-container .item-options a.selected{font-weight:600}.bp-dynamic-block-container ul.item-list{list-style:none;margin:1em 0}.bp-dynamic-block-container ul.item-list li{margin-bottom:1em}.bp-dynamic-block-container ul.item-list li:after,.bp-dynamic-block-container ul.item-list li:before{content:" ";display:table}.bp-dynamic-block-container ul.item-list li:after{clear:both}.bp-dynamic-block-container ul.item-list li .item-avatar{float:left;width:60px}.bp-dynamic-block-container ul.item-list li .item{margin-left:70px}
bp-members/css/blocks/member-avatar-blocks-rtl.css ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ [data-type="bp/active-members"] .avatar-block,
2
+ [data-type="bp/online-members"] .avatar-block {
3
+ display: flex;
4
+ flex-flow: row wrap;
5
+ }
6
+
7
+ [data-type="bp/active-members"] .avatar-block img,
8
+ [data-type="bp/online-members"] .avatar-block img {
9
+ margin: 0.5em;
10
+ }
bp-members/css/blocks/member-avatar-blocks-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ [data-type="bp/active-members"] .avatar-block,[data-type="bp/online-members"] .avatar-block{display:flex;flex-flow:row wrap}[data-type="bp/active-members"] .avatar-block img,[data-type="bp/online-members"] .avatar-block img{margin:.5em}
bp-members/css/blocks/member-avatar-blocks.css ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ [data-type="bp/active-members"] .avatar-block,
2
+ [data-type="bp/online-members"] .avatar-block {
3
+ display: flex;
4
+ flex-flow: row wrap;
5
+ }
6
+
7
+ [data-type="bp/active-members"] .avatar-block img,
8
+ [data-type="bp/online-members"] .avatar-block img {
9
+ margin: 0.5em;
10
+ }
bp-members/css/blocks/member-avatar-blocks.min.css ADDED
@@ -0,0 +1 @@
 
1
+ [data-type="bp/active-members"] .avatar-block,[data-type="bp/online-members"] .avatar-block{display:flex;flex-flow:row wrap}[data-type="bp/active-members"] .avatar-block img,[data-type="bp/online-members"] .avatar-block img{margin:.5em}
bp-members/css/blocks/members-rtl.css CHANGED
@@ -169,7 +169,6 @@
169
  .bp-block-members img.avatar {
170
  width: auto;
171
  height: auto;
172
- max-width: -webkit-fit-content;
173
  max-width: fit-content;
174
  }
175
 
169
  .bp-block-members img.avatar {
170
  width: auto;
171
  height: auto;
 
172
  max-width: fit-content;
173
  }
174
 
bp-members/css/blocks/members-rtl.min.css CHANGED
@@ -1 +1 @@
1
- [data-type="bp/members"] .components-placeholder.is-appender{min-height:0}[data-type="bp/members"] .components-placeholder.is-appender .components-placeholder__label:empty{display:none}[data-type="bp/members"] .components-placeholder input.components-placeholder__input{flex:1 1 auto;border-radius:2px;border:1px solid #757575;padding:6px 8px}[data-type="bp/members"].avatar-none .member-description{width:calc(100% - 44px)}[data-type="bp/members"].avatar-full .member-description{width:calc(100% - 224px)}[data-type="bp/members"].avatar-thumb .member-description{width:calc(100% - 114px)}[data-type="bp/members"] .member-content{position:relative}[data-type="bp/members"] .member-content .is-right{position:absolute;top:2px;left:2px}[data-type="bp/members"] .columns-2 .member-content .member-description,[data-type="bp/members"] .columns-3 .member-content .member-description,[data-type="bp/members"] .columns-4 .member-content .member-description{padding-right:44px;width:calc(100% - 44px)}[data-type="bp/members"] .columns-3 .is-right{left:-10px}[data-type="bp/members"] .columns-4 .is-right{left:-50px}.bp-block-members.is-grid{display:flex;flex-wrap:wrap;padding:0}.bp-block-members.is-grid .member-content{margin:0 0 1.25em 1.25em;width:100%}@media (min-width:600px){.bp-block-members.columns-2 .member-content{width:calc((100% / 2) - 1.25em + (1.25em / 2))}.bp-block-members.columns-2 .member-content:nth-child(2n){margin-left:0}.bp-block-members.columns-3 .member-content{width:calc((100% / 3) - 1.25em + (1.25em / 3))}.bp-block-members.columns-3 .member-content:nth-child(3n){margin-left:0}.bp-block-members.columns-4 .member-content{width:calc((100% / 4) - 1.25em + (1.25em / 4))}.bp-block-members.columns-4 .member-content:nth-child(4n){margin-left:0}}.bp-block-members .member-content{display:flex;flex-direction:column;padding-bottom:1em;text-align:center}.bp-block-members .member-content .item-header-avatar,.bp-block-members .member-content .member-description{width:100%}.bp-block-members .member-content .item-header-avatar{margin:0 auto}.bp-block-members .member-content .item-header-avatar img.avatar{display:inline-block}@media (min-width:600px){.bp-block-members .member-content{flex-direction:row;text-align:right}.bp-block-members .member-content .item-header-avatar,.bp-block-members .member-content .member-description{width:auto}.bp-block-members .member-content .item-header-avatar{margin:0}}.bp-block-members .member-content .user-nicename{display:block}.bp-block-members .member-content .user-nicename a{color:currentColor;text-decoration:none;border:none}.bp-block-members .member-content time{display:block;font-size:80%;color:#767676}.bp-block-members.avatar-none .item-header-avatar{display:none}.bp-block-members.avatar-full{min-height:190px}.bp-block-members.avatar-full .item-header-avatar{width:180px}.bp-block-members.avatar-thumb .member-content{min-height:80px}.bp-block-members.avatar-thumb .item-header-avatar{width:70px}.bp-block-members.columns-2 .member-content,.bp-block-members.columns-3 .member-content,.bp-block-members.columns-4 .member-content{display:block;text-align:center}.bp-block-members.columns-2 .member-content .item-header-avatar,.bp-block-members.columns-3 .member-content .item-header-avatar,.bp-block-members.columns-4 .member-content .item-header-avatar{margin:0 auto}.bp-block-members img.avatar{width:auto;height:auto;max-width:-webkit-fit-content;max-width:fit-content}.bp-block-members .member-content.has-activity{align-items:center}.bp-block-members .member-content.has-activity .item-header-avatar{padding-left:1em}.bp-block-members .member-content.has-activity .wp-block-quote{margin-bottom:0;text-align:right}.bp-block-members .member-content.has-activity .wp-block-quote cite a{color:currentColor;text-decoration:none;border:none}.entry .entry-content .bp-block-members .user-nicename a{color:currentColor;text-decoration:none;border:none}
1
+ [data-type="bp/members"] .components-placeholder.is-appender{min-height:0}[data-type="bp/members"] .components-placeholder.is-appender .components-placeholder__label:empty{display:none}[data-type="bp/members"] .components-placeholder input.components-placeholder__input{flex:1 1 auto;border-radius:2px;border:1px solid #757575;padding:6px 8px}[data-type="bp/members"].avatar-none .member-description{width:calc(100% - 44px)}[data-type="bp/members"].avatar-full .member-description{width:calc(100% - 224px)}[data-type="bp/members"].avatar-thumb .member-description{width:calc(100% - 114px)}[data-type="bp/members"] .member-content{position:relative}[data-type="bp/members"] .member-content .is-right{position:absolute;top:2px;left:2px}[data-type="bp/members"] .columns-2 .member-content .member-description,[data-type="bp/members"] .columns-3 .member-content .member-description,[data-type="bp/members"] .columns-4 .member-content .member-description{padding-right:44px;width:calc(100% - 44px)}[data-type="bp/members"] .columns-3 .is-right{left:-10px}[data-type="bp/members"] .columns-4 .is-right{left:-50px}.bp-block-members.is-grid{display:flex;flex-wrap:wrap;padding:0}.bp-block-members.is-grid .member-content{margin:0 0 1.25em 1.25em;width:100%}@media (min-width:600px){.bp-block-members.columns-2 .member-content{width:calc((100% / 2) - 1.25em + (1.25em / 2))}.bp-block-members.columns-2 .member-content:nth-child(2n){margin-left:0}.bp-block-members.columns-3 .member-content{width:calc((100% / 3) - 1.25em + (1.25em / 3))}.bp-block-members.columns-3 .member-content:nth-child(3n){margin-left:0}.bp-block-members.columns-4 .member-content{width:calc((100% / 4) - 1.25em + (1.25em / 4))}.bp-block-members.columns-4 .member-content:nth-child(4n){margin-left:0}}.bp-block-members .member-content{display:flex;flex-direction:column;padding-bottom:1em;text-align:center}.bp-block-members .member-content .item-header-avatar,.bp-block-members .member-content .member-description{width:100%}.bp-block-members .member-content .item-header-avatar{margin:0 auto}.bp-block-members .member-content .item-header-avatar img.avatar{display:inline-block}@media (min-width:600px){.bp-block-members .member-content{flex-direction:row;text-align:right}.bp-block-members .member-content .item-header-avatar,.bp-block-members .member-content .member-description{width:auto}.bp-block-members .member-content .item-header-avatar{margin:0}}.bp-block-members .member-content .user-nicename{display:block}.bp-block-members .member-content .user-nicename a{color:currentColor;text-decoration:none;border:none}.bp-block-members .member-content time{display:block;font-size:80%;color:#767676}.bp-block-members.avatar-none .item-header-avatar{display:none}.bp-block-members.avatar-full{min-height:190px}.bp-block-members.avatar-full .item-header-avatar{width:180px}.bp-block-members.avatar-thumb .member-content{min-height:80px}.bp-block-members.avatar-thumb .item-header-avatar{width:70px}.bp-block-members.columns-2 .member-content,.bp-block-members.columns-3 .member-content,.bp-block-members.columns-4 .member-content{display:block;text-align:center}.bp-block-members.columns-2 .member-content .item-header-avatar,.bp-block-members.columns-3 .member-content .item-header-avatar,.bp-block-members.columns-4 .member-content .item-header-avatar{margin:0 auto}.bp-block-members img.avatar{width:auto;height:auto;max-width:fit-content}.bp-block-members .member-content.has-activity{align-items:center}.bp-block-members .member-content.has-activity .item-header-avatar{padding-left:1em}.bp-block-members .member-content.has-activity .wp-block-quote{margin-bottom:0;text-align:right}.bp-block-members .member-content.has-activity .wp-block-quote cite a{color:currentColor;text-decoration:none;border:none}.entry .entry-content .bp-block-members .user-nicename a{color:currentColor;text-decoration:none;border:none}
bp-members/css/blocks/members.css CHANGED
@@ -169,7 +169,6 @@
169
  .bp-block-members img.avatar {
170
  width: auto;
171
  height: auto;
172
- max-width: -webkit-fit-content;
173
  max-width: fit-content;
174
  }
175
 
169
  .bp-block-members img.avatar {
170
  width: auto;
171
  height: auto;
 
172
  max-width: fit-content;
173
  }
174
 
bp-members/css/blocks/members.min.css CHANGED
@@ -1 +1 @@
1
- [data-type="bp/members"] .components-placeholder.is-appender{min-height:0}[data-type="bp/members"] .components-placeholder.is-appender .components-placeholder__label:empty{display:none}[data-type="bp/members"] .components-placeholder input.components-placeholder__input{flex:1 1 auto;border-radius:2px;border:1px solid #757575;padding:6px 8px}[data-type="bp/members"].avatar-none .member-description{width:calc(100% - 44px)}[data-type="bp/members"].avatar-full .member-description{width:calc(100% - 224px)}[data-type="bp/members"].avatar-thumb .member-description{width:calc(100% - 114px)}[data-type="bp/members"] .member-content{position:relative}[data-type="bp/members"] .member-content .is-right{position:absolute;top:2px;right:2px}[data-type="bp/members"] .columns-2 .member-content .member-description,[data-type="bp/members"] .columns-3 .member-content .member-description,[data-type="bp/members"] .columns-4 .member-content .member-description{padding-left:44px;width:calc(100% - 44px)}[data-type="bp/members"] .columns-3 .is-right{right:-10px}[data-type="bp/members"] .columns-4 .is-right{right:-50px}.bp-block-members.is-grid{display:flex;flex-wrap:wrap;padding:0}.bp-block-members.is-grid .member-content{margin:0 1.25em 1.25em 0;width:100%}@media (min-width:600px){.bp-block-members.columns-2 .member-content{width:calc((100% / 2) - 1.25em + (1.25em / 2))}.bp-block-members.columns-2 .member-content:nth-child(2n){margin-right:0}.bp-block-members.columns-3 .member-content{width:calc((100% / 3) - 1.25em + (1.25em / 3))}.bp-block-members.columns-3 .member-content:nth-child(3n){margin-right:0}.bp-block-members.columns-4 .member-content{width:calc((100% / 4) - 1.25em + (1.25em / 4))}.bp-block-members.columns-4 .member-content:nth-child(4n){margin-right:0}}.bp-block-members .member-content{display:flex;flex-direction:column;padding-bottom:1em;text-align:center}.bp-block-members .member-content .item-header-avatar,.bp-block-members .member-content .member-description{width:100%}.bp-block-members .member-content .item-header-avatar{margin:0 auto}.bp-block-members .member-content .item-header-avatar img.avatar{display:inline-block}@media (min-width:600px){.bp-block-members .member-content{flex-direction:row;text-align:left}.bp-block-members .member-content .item-header-avatar,.bp-block-members .member-content .member-description{width:auto}.bp-block-members .member-content .item-header-avatar{margin:0}}.bp-block-members .member-content .user-nicename{display:block}.bp-block-members .member-content .user-nicename a{color:currentColor;text-decoration:none;border:none}.bp-block-members .member-content time{display:block;font-size:80%;color:#767676}.bp-block-members.avatar-none .item-header-avatar{display:none}.bp-block-members.avatar-full{min-height:190px}.bp-block-members.avatar-full .item-header-avatar{width:180px}.bp-block-members.avatar-thumb .member-content{min-height:80px}.bp-block-members.avatar-thumb .item-header-avatar{width:70px}.bp-block-members.columns-2 .member-content,.bp-block-members.columns-3 .member-content,.bp-block-members.columns-4 .member-content{display:block;text-align:center}.bp-block-members.columns-2 .member-content .item-header-avatar,.bp-block-members.columns-3 .member-content .item-header-avatar,.bp-block-members.columns-4 .member-content .item-header-avatar{margin:0 auto}.bp-block-members img.avatar{width:auto;height:auto;max-width:-webkit-fit-content;max-width:fit-content}.bp-block-members .member-content.has-activity{align-items:center}.bp-block-members .member-content.has-activity .item-header-avatar{padding-right:1em}.bp-block-members .member-content.has-activity .wp-block-quote{margin-bottom:0;text-align:left}.bp-block-members .member-content.has-activity .wp-block-quote cite a{color:currentColor;text-decoration:none;border:none}.entry .entry-content .bp-block-members .user-nicename a{color:currentColor;text-decoration:none;border:none}
1
+ [data-type="bp/members"] .components-placeholder.is-appender{min-height:0}[data-type="bp/members"] .components-placeholder.is-appender .components-placeholder__label:empty{display:none}[data-type="bp/members"] .components-placeholder input.components-placeholder__input{flex:1 1 auto;border-radius:2px;border:1px solid #757575;padding:6px 8px}[data-type="bp/members"].avatar-none .member-description{width:calc(100% - 44px)}[data-type="bp/members"].avatar-full .member-description{width:calc(100% - 224px)}[data-type="bp/members"].avatar-thumb .member-description{width:calc(100% - 114px)}[data-type="bp/members"] .member-content{position:relative}[data-type="bp/members"] .member-content .is-right{position:absolute;top:2px;right:2px}[data-type="bp/members"] .columns-2 .member-content .member-description,[data-type="bp/members"] .columns-3 .member-content .member-description,[data-type="bp/members"] .columns-4 .member-content .member-description{padding-left:44px;width:calc(100% - 44px)}[data-type="bp/members"] .columns-3 .is-right{right:-10px}[data-type="bp/members"] .columns-4 .is-right{right:-50px}.bp-block-members.is-grid{display:flex;flex-wrap:wrap;padding:0}.bp-block-members.is-grid .member-content{margin:0 1.25em 1.25em 0;width:100%}@media (min-width:600px){.bp-block-members.columns-2 .member-content{width:calc((100% / 2) - 1.25em + (1.25em / 2))}.bp-block-members.columns-2 .member-content:nth-child(2n){margin-right:0}.bp-block-members.columns-3 .member-content{width:calc((100% / 3) - 1.25em + (1.25em / 3))}.bp-block-members.columns-3 .member-content:nth-child(3n){margin-right:0}.bp-block-members.columns-4 .member-content{width:calc((100% / 4) - 1.25em + (1.25em / 4))}.bp-block-members.columns-4 .member-content:nth-child(4n){margin-right:0}}.bp-block-members .member-content{display:flex;flex-direction:column;padding-bottom:1em;text-align:center}.bp-block-members .member-content .item-header-avatar,.bp-block-members .member-content .member-description{width:100%}.bp-block-members .member-content .item-header-avatar{margin:0 auto}.bp-block-members .member-content .item-header-avatar img.avatar{display:inline-block}@media (min-width:600px){.bp-block-members .member-content{flex-direction:row;text-align:left}.bp-block-members .member-content .item-header-avatar,.bp-block-members .member-content .member-description{width:auto}.bp-block-members .member-content .item-header-avatar{margin:0}}.bp-block-members .member-content .user-nicename{display:block}.bp-block-members .member-content .user-nicename a{color:currentColor;text-decoration:none;border:none}.bp-block-members .member-content time{display:block;font-size:80%;color:#767676}.bp-block-members.avatar-none .item-header-avatar{display:none}.bp-block-members.avatar-full{min-height:190px}.bp-block-members.avatar-full .item-header-avatar{width:180px}.bp-block-members.avatar-thumb .member-content{min-height:80px}.bp-block-members.avatar-thumb .item-header-avatar{width:70px}.bp-block-members.columns-2 .member-content,.bp-block-members.columns-3 .member-content,.bp-block-members.columns-4 .member-content{display:block;text-align:center}.bp-block-members.columns-2 .member-content .item-header-avatar,.bp-block-members.columns-3 .member-content .item-header-avatar,.bp-block-members.columns-4 .member-content .item-header-avatar{margin:0 auto}.bp-block-members img.avatar{width:auto;height:auto;max-width:fit-content}.bp-block-members .member-content.has-activity{align-items:center}.bp-block-members .member-content.has-activity .item-header-avatar{padding-right:1em}.bp-block-members .member-content.has-activity .wp-block-quote{margin-bottom:0;text-align:left}.bp-block-members .member-content.has-activity .wp-block-quote cite a{color:currentColor;text-decoration:none;border:none}.entry .entry-content .bp-block-members .user-nicename a{color:currentColor;text-decoration:none;border:none}
bp-members/js/blocks/active-members.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"TOWc":[function(require,module,exports) {
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blockEditor.InspectorControls,n=e.components,r=n.Disabled,l=n.PanelBody,o=n.RangeControl,s=n.TextControl,a=e.element,i=a.Fragment,u=a.createElement,b=e.i18n.__,d=bp,m=d.blockComponents.ServerSideRender,p=function(e){var n=e.attributes,a=e.setAttributes,d=n.title,p=n.maxMembers;return u(i,null,u(t,null,u(l,{title:b("Settings","buddypress"),initialOpen:!0},u(s,{label:b("Title","buddypress"),value:d,onChange:function(e){a({title:e})}}),u(o,{label:b("Max members to show","buddypress"),value:p,onChange:function(e){return a({maxMembers:e})},min:1,max:15,required:!0}))),u(r,null,u(m,{block:"bp/active-members",attributes:n})))},c=p;exports.default=c;
3
+ },{}],"y7A5":[function(require,module,exports) {
4
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blocks.createBlock,r={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:function(e){var t=e.idBase,r=e.instance;return!(null==r||!r.raw)&&"bp_core_recently_active_widget"===t},transform:function(e){var r=e.instance;return t("bp/active-members",{title:r.raw.title,maxMembers:r.raw.max_members})}}]},a=r;exports.default=a;
5
+ },{}],"dkrW":[function(require,module,exports) {
6
+ "use strict";var e=t(require("./active-members/edit")),r=t(require("./active-members/transforms"));function t(e){return e&&e.__esModule?e:{default:e}}var s=wp,i=s.blocks.registerBlockType,d=s.i18n.__;i("bp/active-members",{title:d("Recently Active Members","buddypress"),description:d("Profile photos of recently active members.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"groups"},category:"buddypress",attributes:{title:{type:"string",default:d("Recently Active Members","buddypress")},maxMembers:{type:"number",default:15}},edit:e.default,transforms:r.default});
7
+ },{"./active-members/edit":"TOWc","./active-members/transforms":"y7A5"}]},{},["dkrW"], null)
8
+ //# sourceMappingURL=/bp-members/js/blocks/active-members.js.map
bp-members/js/blocks/active-members.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-members/js/blocks/active-members/edit.js","bp-members/js/blocks/active-members/transforms.js","bp-members/js/blocks/active-members.js"],"names":["editActiveMembersBlock","wp","InspectorControls","blockEditor","components","Disabled","PanelBody","RangeControl","TextControl","element","Fragment","createElement","__","i18n","bp","ServerSideRender","blockComponents","attributes","setAttributes","title","maxMembers","text","value","transforms","createBlock","blocks","from","type","isMatch","idBase","instance","raw","transform","max_members","registerBlockType","description","icon","background","foreground","src","category","default","edit"],"mappings":";AAgEeA,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EA7Df,IAiBIC,EAAAA,GAfFC,EADDC,EAAAA,YACCD,kBAEDE,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,aACAC,EAAAA,EAAAA,YAEDC,EAAAA,EAAAA,QACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,cAGAC,EADDC,EAAAA,KACCD,GAWEE,EAAAA,GAFFC,EADDC,EAAAA,gBACCD,iBAIIf,EAAyB,SAAqC,GAAjCiB,IAAAA,EAAAA,EAAAA,WAAYC,EAAAA,EAAAA,cACtCC,EAAsBF,EAAtBE,MAAOC,EAAeH,EAAfG,WAGd,OAAA,EAAC,EACA,KAAA,EAAC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AAK,UAENC,SAAU,aACVvB,WAAY,CACXE,MAAO,CACNQ,KAAM,SACNc,QAAS7B,EAAI,0BAA2B,eAEzCQ,WAAY,CACXO,KAAM,SACNc,QAAS,KAGXC,KAAM1C,EAnBiC,QAoBvCuB,WAAYA,EAAAA","file":"active-members.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tPanelBody,\n\t\tRangeControl,\n\t\tTextControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tServerSideRender,\n\t},\n} = bp;\n\nconst editActiveMembersBlock = ( { attributes, setAttributes } ) => {\n\tconst { title, maxMembers } = attributes;\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( text ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: text } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max members to show', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ maxMembers }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { maxMembers: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ 15 }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/active-members\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editActiveMembersBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Legacy Widget to Active Members Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_core_recently_active_widget';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\treturn createBlock( 'bp/active-members', {\n\t\t\t\t\ttitle: instance.raw.title,\n\t\t\t\t\tmaxMembers: instance.raw.max_members,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editActiveMembersBlock from './active-members/edit';\nimport transforms from './active-members/transforms';\n\nregisterBlockType( 'bp/active-members', {\n\ttitle: __( 'Recently Active Members', 'buddypress' ),\n\tdescription: __( 'Profile photos of recently active members.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'groups',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t\tdefault: __( 'Recently Active Members', 'buddypress' ),\n\t\t},\n\t\tmaxMembers: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 15\n\t\t},\n\t},\n\tedit: editActiveMembersBlock,\n\ttransforms: transforms,\n} );\n"]}
bp-members/js/blocks/dynamic-members.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"gOka":[function(require,module,exports) {
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TYPES=void 0;var e=wp,s=e.i18n.__,l=[{label:s("Newest","buddypress"),value:"newest"},{label:s("Active","buddypress"),value:"active"},{label:s("Popular","buddypress"),value:"popular"}];exports.TYPES=l;
3
+ },{}],"z0p7":[function(require,module,exports) {
4
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./constants"),t=wp,n=t.blockEditor.InspectorControls,l=t.components,r=l.Disabled,o=l.PanelBody,i=l.RangeControl,s=l.SelectControl,a=l.TextControl,u=l.ToggleControl,b=t.element,d=b.Fragment,c=b.createElement,m=t.i18n.__,p=bp,f=p.blockComponents.ServerSideRender,v=p.blockData.isActive,C=function(t){var l=t.attributes,b=t.setAttributes,p=l.title,C=l.maxMembers,g=l.memberDefault,k=l.linkTitle,y=v("friends")?e.TYPES:e.TYPES.filter(function(e){return"popular"!==e.value});return c(d,null,c(n,null,c(o,{title:m("Settings","buddypress"),initialOpen:!0},c(a,{label:m("Title","buddypress"),value:p,onChange:function(e){b({title:e})}}),c(i,{label:m("Max members to show","buddypress"),value:C,onChange:function(e){return b({maxMembers:e})},min:1,max:10,required:!0}),c(s,{label:m("Default members to show","buddypress"),value:g,options:y,onChange:function(e){b({memberDefault:e})}}),c(u,{label:m("Link block title to Members directory","buddypress"),checked:!!k,onChange:function(){b({linkTitle:!k})}}))),c(r,null,c(f,{block:"bp/dynamic-members",attributes:l})))},g=C;exports.default=g;
5
+ },{"./constants":"gOka"}],"qfGr":[function(require,module,exports) {
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,r=e.blocks.createBlock,t={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:function(e){var r=e.idBase,t=e.instance;return!(null==t||!t.raw)&&"bp_core_members_widget"===r},transform:function(e){var t=e.instance;return r("bp/dynamic-members",{title:t.raw.title,maxMembers:t.raw.max_members,memberDefault:t.raw.member_default,linkTitle:t.raw.link_title})}}]},a=t;exports.default=a;
7
+ },{}],"Znbi":[function(require,module,exports) {
8
+ "use strict";var e=t(require("./dynamic-members/edit")),r=t(require("./dynamic-members/transforms"));function t(e){return e&&e.__esModule?e:{default:e}}var s=wp,d=s.blocks.registerBlockType,i=s.i18n.__;d("bp/dynamic-members",{title:i("Dynamic Members List","buddypress"),description:i("A dynamic list of recently active, popular, and newest members.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"groups"},category:"buddypress",attributes:{title:{type:"string",default:i("Members","buddypress")},maxMembers:{type:"number",default:5},memberDefault:{type:"string",default:"active"},linkTitle:{type:"boolean",default:!1}},edit:e.default,transforms:r.default});
9
+ },{"./dynamic-members/edit":"z0p7","./dynamic-members/transforms":"qfGr"}]},{},["Znbi"], null)
10
+ //# sourceMappingURL=/bp-members/js/blocks/dynamic-members.js.map
bp-members/js/blocks/dynamic-members.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-members/js/blocks/dynamic-members/constants.js","bp-members/js/blocks/dynamic-members/edit.js","bp-members/js/blocks/dynamic-members/transforms.js","bp-members/js/blocks/dynamic-members.js"],"names":["wp","__","i18n","TYPES","label","value","editDynamicMembersBlock","InspectorControls","blockEditor","components","Disabled","PanelBody","RangeControl","SelectControl","TextControl","ToggleControl","element","Fragment","createElement","bp","ServerSideRender","blockComponents","isActive","blockData","attributes","setAttributes","title","maxMembers","memberDefault","linkTitle","sortTypes","filter","type","text","option","transforms","createBlock","blocks","from","isMatch","idBase","instance","raw","transform","max_members","member_default","link_title","registerBlockType","description","icon","background","foreground","src","category","default","edit"],"mappings":";AAcO,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,WAAA,EAXP,IAIIA,EAAAA,GAFFC,EADDC,EAAAA,KACCD,GASWE,EAAQ,CACpB,CACCC,MAAOH,EAAI,SAAU,cACrBI,MAAO,UAER,CACCD,MAAOH,EAAI,SAAU,cACrBI,MAAO,UAER,CACCD,MAAOH,EAAI,UAAW,cACtBI,MAAO,YAXF,QAAA,MAAA;;AC4EQC,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAnDf,IAAA,EAAA,QAAA,eAjBIN,EAAAA,GAjBFO,EADDC,EAAAA,YACCD,kBAEDE,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,aACAC,EAAAA,EAAAA,cACAC,EAAAA,EAAAA,YACAC,EAAAA,EAAAA,cAEDC,EAAAA,EAAAA,QACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,cAGAjB,EADDC,EAAAA,KACCD,GAcEkB,EAAAA,GALFC,EADDC,EAAAA,gBACCD,iBAGAE,EADDC,EAAAA,UACCD,SASIhB,EAA0B,SAAqC,GAAjCkB,IAAAA,EAAAA,EAAAA,WAAYC,EAAAA,EAAAA,cAC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ACPL,OAAAA,EAAa,qBAAsB,CACzCV,MAAOe,EAASC,IAAIhB,MACpBC,WAAYc,EAASC,IAAIE,YACzBhB,cAAea,EAASC,IAAIG,eAC5BhB,UAAWY,EAASC,IAAII,iBAOdX,EAAAA,EAAAA,QAAAA,QAAAA;;ACpBf,aAHA,IAAA,EAAA,EAAA,QAAA,2BACA,EAAA,EAAA,QAAA,iCAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAfA,IAOInC,EAAAA,GALF+C,EADDV,EAAAA,OACCU,kBAGA9C,EADDC,EAAAA,KACCD,GAUF8C,EAAmB,qBAAsB,CACxCrB,MAAOzB,EAAI,uBAAwB,cACnC+C,YAAa/C,EAAI,kEAAmE,cACpFgD,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,UAENC,SAAU,aACV7B,WAAY,CACXE,MAAO,CACNM,KAAM,SACNsB,QAASrD,EAAI,UAAW,eAEzB0B,WAAY,CACXK,KAAM,SACNsB,QAAS,GAEV1B,cAAe,CACdI,KAAM,SACNsB,QAAS,UAEVzB,UAAW,CACVG,KAAM,UACNsB,SAAS,IAGXC,KAAMjD,EA3BkC,QA4BxC6B,WAAYA,EAAAA","file":"dynamic-members.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Members ordering types.\n *\n * @type {Array}\n */\nexport const TYPES = [\n\t{\n\t\tlabel: __( 'Newest', 'buddypress' ),\n\t\tvalue: 'newest',\n\t},\n\t{\n\t\tlabel: __( 'Active', 'buddypress' ),\n\t\tvalue: 'active',\n\t},\n\t{\n\t\tlabel: __( 'Popular', 'buddypress' ),\n\t\tvalue: 'popular',\n\t},\n];\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tPanelBody,\n\t\tRangeControl,\n\t\tSelectControl,\n\t\tTextControl,\n\t\tToggleControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tServerSideRender,\n\t},\n\tblockData: {\n\t\tisActive,\n\t}\n} = bp;\n\n/**\n * Internal dependencies.\n */\nimport { TYPES } from './constants';\n\nconst editDynamicMembersBlock = ( { attributes, setAttributes } ) => {\n\tconst { title, maxMembers, memberDefault, linkTitle } = attributes;\n\tconst sortTypes = !! isActive( 'friends' ) ? TYPES : TYPES.filter( ( type ) => 'popular' !== type.value );\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( text ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: text } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max members to show', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ maxMembers }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { maxMembers: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ 10 }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Default members to show', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ memberDefault }\n\t\t\t\t\t\toptions={ sortTypes }\n\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\tsetAttributes( { memberDefault: option } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link block title to Members directory', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! linkTitle }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { linkTitle: ! linkTitle } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/dynamic-members\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editDynamicMembersBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Legacy Widget to Dynamic Members Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_core_members_widget';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\treturn createBlock( 'bp/dynamic-members', {\n\t\t\t\t\ttitle: instance.raw.title,\n\t\t\t\t\tmaxMembers: instance.raw.max_members,\n\t\t\t\t\tmemberDefault: instance.raw.member_default,\n\t\t\t\t\tlinkTitle: instance.raw.link_title,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editDynamicMembersBlock from './dynamic-members/edit';\nimport transforms from './dynamic-members/transforms';\n\nregisterBlockType( 'bp/dynamic-members', {\n\ttitle: __( 'Dynamic Members List', 'buddypress' ),\n\tdescription: __( 'A dynamic list of recently active, popular, and newest members.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'groups',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t\tdefault: __( 'Members', 'buddypress' ),\n\t\t},\n\t\tmaxMembers: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 5\n\t\t},\n\t\tmemberDefault: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'active',\n\t\t},\n\t\tlinkTitle: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tedit: editDynamicMembersBlock,\n\ttransforms: transforms,\n} );\n"]}
bp-members/js/blocks/member.js CHANGED
@@ -1,8 +1,8 @@
1
  parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"AE3e":[function(require,module,exports) {
2
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AVATAR_SIZES=void 0;var e=wp,l=e.i18n.__,u=[{label:l("None","buddypress"),value:"none"},{label:l("Thumb","buddypress"),value:"thumb"},{label:l("Full","buddypress"),value:"full"}];exports.AVATAR_SIZES=u;
3
  },{}],"YNTp":[function(require,module,exports) {
4
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./constants"),t=wp,n=t.blockEditor,o=n.InspectorControls,r=n.BlockControls,s=t.components,l=s.Placeholder,a=s.Disabled,i=s.PanelBody,d=s.SelectControl,u=s.ToggleControl,p=s.Toolbar,m=s.ToolbarButton,b=t.compose.compose,c=t.data.withSelect,y=t.editor.ServerSideRender,h=t.element,g=h.Fragment,v=h.createElement,S=t.i18n.__,f=bp.blockComponents.AutoCompleter,C=function(e){return e&&e.mention_name?e.mention_name:null},I=function(t){var n=t.attributes,s=t.setAttributes,b=t.bpSettings,c=b.isAvatarEnabled,h=b.isMentionEnabled,I=b.isCoverImageEnabled,k=n.avatarSize,A=n.displayMentionSlug,E=n.displayActionButton,M=n.displayCoverImage;return n.itemID?v(g,null,v(r,null,v(p,null,v(m,{icon:"edit",title:S("Select another member","buddypress"),onClick:function(){s({itemID:0})}}))),v(o,null,v(i,{title:S("Settings","buddypress"),initialOpen:!0},v(u,{label:S("Display Profile button","buddypress"),checked:!!E,onChange:function(){s({displayActionButton:!E})},help:S(E?"Include a link to the user's profile page under their display name.":"Toggle to display a link to the user's profile page under their display name.","buddypress")}),c&&v(d,{label:S("Avatar size","buddypress"),value:k,options:e.AVATAR_SIZES,help:S('Select "None" to disable the avatar.',"buddypress"),onChange:function(e){s({avatarSize:e})}}),I&&v(u,{label:S("Display Cover Image","buddypress"),checked:!!M,onChange:function(){s({displayCoverImage:!M})},help:S(M?"Include the user's cover image over their display name.":"Toggle to display the user's cover image over their display name.","buddypress")}),h&&v(u,{label:S("Display Mention slug","buddypress"),checked:!!A,onChange:function(){s({displayMentionSlug:!A})},help:S(A?"Include the user's mention name under their display name.":"Toggle to display the user's mention name under their display name.","buddypress")}))),v(a,null,v(y,{block:"bp/member",attributes:n}))):v(l,{icon:"admin-users",label:S("BuddyPress Member","buddypress"),instructions:S("Start typing the name of the member you want to feature into this post.","buddypress")},v(f,{component:"members",slugValue:C,ariaLabel:S("Member's username","buddypress"),placeholder:S("Enter Member's username here…","buddypress"),onSelectItem:s,useAvatar:c}))},k=b([c(function(e){return{bpSettings:e("core/editor").getEditorSettings().bp.members||{}}})])(I),A=k;exports.default=A;
5
  },{"./constants":"AE3e"}],"TmUL":[function(require,module,exports) {
6
- "use strict";var e=t(require("./member/edit"));function t(e){return e&&e.__esModule?e:{default:e}}var r=wp,d=r.blocks.registerBlockType,a=r.i18n.__;d("bp/member",{title:a("Member","buddypress"),description:a("BuddyPress Member.","buddypress"),icon:"admin-users",category:"buddypress",attributes:{itemID:{type:"integer",default:0},avatarSize:{type:"string",default:"full"},displayMentionSlug:{type:"boolean",default:!0},displayActionButton:{type:"boolean",default:!0},displayCoverImage:{type:"boolean",default:!0}},edit:e.default});
7
  },{"./member/edit":"YNTp"}]},{},["TmUL"], null)
8
  //# sourceMappingURL=/bp-members/js/blocks/member.js.map
1
  parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"AE3e":[function(require,module,exports) {
2
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AVATAR_SIZES=void 0;var e=wp,l=e.i18n.__,u=[{label:l("None","buddypress"),value:"none"},{label:l("Thumb","buddypress"),value:"thumb"},{label:l("Full","buddypress"),value:"full"}];exports.AVATAR_SIZES=u;
3
  },{}],"YNTp":[function(require,module,exports) {
4
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./constants"),t=wp,n=t.blockEditor,r=n.InspectorControls,s=n.BlockControls,o=t.components,a=o.Placeholder,l=o.Disabled,i=o.PanelBody,d=o.SelectControl,u=o.ToggleControl,p=o.Toolbar,m=o.ToolbarButton,b=t.element,c=b.Fragment,y=b.createElement,h=t.i18n.__,g=bp,v=g.blockComponents,f=v.AutoCompleter,C=v.ServerSideRender,S=g.blockData.isActive,k=function(e){return e&&e.mention_name?e.mention_name:null},I=function(t){var n=t.attributes,o=t.setAttributes,b=S("members","avatar"),g=S("activity","mentions"),v=S("members","cover"),I=n.avatarSize,A=n.displayMentionSlug,B=n.displayActionButton,D=n.displayCoverImage;return n.itemID?y(c,null,y(s,null,y(p,{label:h("Block toolbar","buddypress")},y(m,{icon:"edit",title:h("Select another member","buddypress"),onClick:function(){o({itemID:0})}}))),y(r,null,y(i,{title:h("Settings","buddypress"),initialOpen:!0},y(u,{label:h("Display Profile button","buddypress"),checked:!!B,onChange:function(){o({displayActionButton:!B})},help:h(B?"Include a link to the user's profile page under their display name.":"Toggle to display a link to the user's profile page under their display name.","buddypress")}),b&&y(d,{label:h("Avatar size","buddypress"),value:I,options:e.AVATAR_SIZES,help:h('Select "None" to disable the avatar.',"buddypress"),onChange:function(e){o({avatarSize:e})}}),v&&y(u,{label:h("Display Cover Image","buddypress"),checked:!!D,onChange:function(){o({displayCoverImage:!D})},help:h(D?"Include the user's cover image over their display name.":"Toggle to display the user's cover image over their display name.","buddypress")}),g&&y(u,{label:h("Display Mention slug","buddypress"),checked:!!A,onChange:function(){o({displayMentionSlug:!A})},help:h(A?"Include the user's mention name under their display name.":"Toggle to display the user's mention name under their display name.","buddypress")}))),y(l,null,y(C,{block:"bp/member",attributes:n}))):y(a,{icon:"admin-users",label:h("BuddyPress Member","buddypress"),instructions:h("Start typing the name of the member you want to feature into this post.","buddypress")},y(f,{component:"members",slugValue:k,ariaLabel:h("Member's username","buddypress"),placeholder:h("Enter Member's username here…","buddypress"),onSelectItem:o,useAvatar:b}))},A=I;exports.default=A;
5
  },{"./constants":"AE3e"}],"TmUL":[function(require,module,exports) {
6
+ "use strict";var e=t(require("./member/edit"));function t(e){return e&&e.__esModule?e:{default:e}}var r=wp,d=r.blocks.registerBlockType,a=r.i18n.__;d("bp/member",{title:a("Member","buddypress"),description:a("BuddyPress Member.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"admin-users"},category:"buddypress",attributes:{itemID:{type:"integer",default:0},avatarSize:{type:"string",default:"full"},displayMentionSlug:{type:"boolean",default:!0},displayActionButton:{type:"boolean",default:!0},displayCoverImage:{type:"boolean",default:!0}},edit:e.default});
7
  },{"./member/edit":"YNTp"}]},{},["TmUL"], null)
8
  //# sourceMappingURL=/bp-members/js/blocks/member.js.map
bp-members/js/blocks/member.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["bp-members/js/blocks/member/constants.js","bp-members/js/blocks/member/edit.js","bp-members/js/blocks/member.js"],"names":["wp","__","i18n","AVATAR_SIZES","label","value","editMemberBlock","blockEditor","InspectorControls","BlockControls","components","Placeholder","Disabled","PanelBody","SelectControl","ToggleControl","Toolbar","ToolbarButton","compose","withSelect","data","ServerSideRender","editor","element","Fragment","createElement","AutoCompleter","bp","blockComponents","getSlugValue","item","mention_name","editMember","attributes","setAttributes","bpSettings","isAvatarEnabled","isMentionEnabled","isCoverImageEnabled","avatarSize","displayMentionSlug","displayActionButton","displayCoverImage","itemID","option","select","getEditorSettings","members","registerBlockType","blocks","title","description","icon","category","type","default","edit"],"mappings":";AAcO,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,kBAAA,EAPHA,IAAAA,EAAAA,GAFFC,EADDC,EAAAA,KACCD,GASWE,EAAe,CAC3B,CACCC,MAAOH,EAAI,OAAQ,cACnBI,MAAO,QAER,CACCD,MAAOH,EAAI,QAAS,cACpBI,MAAO,SAER,CACCD,MAAOH,EAAI,OAAQ,cACnBI,MAAO,SAXF,QAAA,aAAA;;ACqJQC,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAxHf,IAAA,EAAA,QAAA,eAVIN,EAAAA,GA7BHO,EAAAA,EAAAA,YACCC,EAAAA,EAAAA,kBACAC,EAAAA,EAAAA,cAEDC,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,YACAC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,cACAC,EAAAA,EAAAA,cACAC,EAAAA,EAAAA,QACAC,EAAAA,EAAAA,cAGAC,EADDA,EAAAA,QACCA,QAGAC,EADDC,EAAAA,KACCD,WAGAE,EADDC,EAAAA,OACCD,iBAEDE,EAAAA,EAAAA,QACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,cAGAxB,EADDC,EAAAA,KACCD,GAOMyB,EAAkBC,GAAGC,gBAArBF,cAOFG,EAAe,SAAEC,GACjBA,OAAAA,GAAQA,EAAKC,aACVD,EAAKC,aAGN,MAGFC,EAAa,SAAiD,GAA7CC,IAAAA,EAAAA,EAAAA,WAAYC,EAAAA,EAAAA,cAAeC,EAAAA,EAAAA,WACzCC,EAA2DD,EAA3DC,gBAAiBC,EAA0CF,EAA1CE,iBAAkBC,EAAwBH,EAAxBG,oBACnCC,EAA2EN,EAA3EM,WAAYC,EAA+DP,EAA/DO,mBAAoBC,EAA2CR,EAA3CQ,o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,oBAEnBnB,GAAGoB,SAAW,OAJpB7B,CAOnBc,GAEU1B,EAAAA,EAAAA,QAAAA,QAAAA;;AClJf,aAFA,IAAA,EAAA,EAAA,QAAA,kBAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAPIN,IAAAA,EAAAA,GALFgD,EADDC,EAAAA,OACCD,kBAGA/C,EADDC,EAAAA,KACCD,GASF+C,EAAmB,YAAa,CAC/BE,MAAOjD,EAAI,SAAU,cACrBkD,YAAalD,EAAI,qBAAsB,cACvCmD,KAAM,cACNC,SAAU,aACVpB,WAAY,CACXU,OAAQ,CACPW,KAAM,UACNC,QAAS,GAEVhB,WAAY,CACXe,KAAM,SACNC,QAAS,QAEVf,mBAAoB,CACnBc,KAAM,UACNC,SAAS,GAEVd,oBAAqB,CACpBa,KAAM,UACNC,SAAS,GAEVb,kBAAmB,CAClBY,KAAM,UACNC,SAAS,IAGXC,KAAMlD,EAAAA","file":"member.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Avatar sizes.\n *\n * @type {Array}\n */\nexport const AVATAR_SIZES = [\n\t{\n\t\tlabel: __( 'None', 'buddypress' ),\n\t\tvalue: 'none',\n\t},\n\t{\n\t\tlabel: __( 'Thumb', 'buddypress' ),\n\t\tvalue: 'thumb',\n\t},\n\t{\n\t\tlabel: __( 'Full', 'buddypress' ),\n\t\tvalue: 'full',\n\t},\n];\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t\tBlockControls,\n\t},\n\tcomponents: {\n\t\tPlaceholder,\n\t\tDisabled,\n\t\tPanelBody,\n\t\tSelectControl,\n\t\tToggleControl,\n\t\tToolbar,\n\t\tToolbarButton,\n\t},\n\tcompose: {\n\t\tcompose,\n\t},\n\tdata: {\n\t\twithSelect,\n\t},\n\teditor: {\n\t\tServerSideRender,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst { AutoCompleter } = bp.blockComponents;\n\n/**\n * Internal dependencies.\n */\nimport { AVATAR_SIZES } from './constants';\n\nconst getSlugValue = ( item ) => {\n\tif ( item && item.mention_name ) {\n\t\treturn item.mention_name;\n\t}\n\n\treturn null;\n}\n\nconst editMember = ( { attributes, setAttributes, bpSettings } ) => {\n\tconst { isAvatarEnabled, isMentionEnabled, isCoverImageEnabled } = bpSettings;\n\tconst { avatarSize, displayMentionSlug, displayActionButton, displayCoverImage } = attributes;\n\n\tif ( ! attributes.itemID ) {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon=\"admin-users\"\n\t\t\t\tlabel={ __( 'BuddyPress Member', 'buddypress' ) }\n\t\t\t\tinstructions={ __( 'Start typing the name of the member you want to feature into this post.', 'buddypress' ) }\n\t\t\t>\n\t\t\t\t<AutoCompleter\n\t\t\t\t\tcomponent=\"members\"\n\t\t\t\t\tslugValue={ getSlugValue }\n\t\t\t\t\tariaLabel={ __( 'Member\\'s username', 'buddypress' ) }\n\t\t\t\t\tplaceholder={ __( 'Enter Member\\'s username here…', 'buddypress' ) }\n\t\t\t\t\tonSelectItem={ setAttributes }\n\t\t\t\t\tuseAvatar={ isAvatarEnabled }\n\t\t\t\t/>\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<Toolbar>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon=\"edit\"\n\t\t\t\t\t\ttitle={ __( 'Select another member', 'buddypress' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetAttributes( { itemID: 0 } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Toolbar>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display Profile button', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! displayActionButton }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { displayActionButton: ! displayActionButton } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tdisplayActionButton\n\t\t\t\t\t\t\t\t? __( 'Include a link to the user\\'s profile page under their display name.', 'buddypress' )\n\t\t\t\t\t\t\t\t: __( 'Toggle to display a link to the user\\'s profile page under their display name.', 'buddypress' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ isAvatarEnabled && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size', 'buddypress' ) }\n\t\t\t\t\t\t\tvalue={ avatarSize }\n\t\t\t\t\t\t\toptions={ AVATAR_SIZES }\n\t\t\t\t\t\t\thelp={ __( 'Select \"None\" to disable the avatar.', 'buddypress' ) }\n\t\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { avatarSize: option } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isCoverImageEnabled && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display Cover Image', 'buddypress' ) }\n\t\t\t\t\t\t\tchecked={ !! displayCoverImage }\n\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { displayCoverImage: ! displayCoverImage } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tdisplayCoverImage\n\t\t\t\t\t\t\t\t\t? __( 'Include the user\\'s cover image over their display name.', 'buddypress' )\n\t\t\t\t\t\t\t\t\t: __( 'Toggle to display the user\\'s cover image over their display name.', 'buddypress' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isMentionEnabled && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display Mention slug', 'buddypress' ) }\n\t\t\t\t\t\t\tchecked={ !! displayMentionSlug }\n\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { displayMentionSlug: ! displayMentionSlug } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tdisplayMentionSlug\n\t\t\t\t\t\t\t\t\t? __( 'Include the user\\'s mention name under their display name.', 'buddypress' )\n\t\t\t\t\t\t\t\t\t: __( 'Toggle to display the user\\'s mention name under their display name.', 'buddypress' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/member\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nconst editMemberBlock = compose( [\n\twithSelect( ( select ) => {\n\t\tconst editorSettings = select( 'core/editor' ).getEditorSettings();\n\t\treturn {\n\t\t\tbpSettings: editorSettings.bp.members || {},\n\t\t};\n\t} ),\n] )( editMember );\n\nexport default editMemberBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editMemberBlock from './member/edit';\n\nregisterBlockType( 'bp/member', {\n\ttitle: __( 'Member', 'buddypress' ),\n\tdescription: __( 'BuddyPress Member.', 'buddypress' ),\n\ticon: 'admin-users',\n\tcategory: 'buddypress',\n\tattributes: {\n\t\titemID: {\n\t\t\ttype: 'integer',\n\t\t\tdefault: 0,\n\t\t},\n\t\tavatarSize: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'full',\n\t\t},\n\t\tdisplayMentionSlug: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\tdisplayActionButton: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\tdisplayCoverImage: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t},\n\tedit: editMemberBlock,\n} );\n"]}
1
+ {"version":3,"sources":["bp-members/js/blocks/member/constants.js","bp-members/js/blocks/member/edit.js","bp-members/js/blocks/member.js"],"names":["wp","__","i18n","AVATAR_SIZES","label","value","editMemberBlock","blockEditor","InspectorControls","BlockControls","components","Placeholder","Disabled","PanelBody","SelectControl","ToggleControl","Toolbar","ToolbarButton","element","Fragment","createElement","bp","blockComponents","AutoCompleter","ServerSideRender","isActive","blockData","getSlugValue","item","mention_name","attributes","setAttributes","isAvatarEnabled","isMentionEnabled","isCoverImageEnabled","avatarSize","displayMentionSlug","displayActionButton","displayCoverImage","itemID","option","registerBlockType","blocks","title","description","icon","background","foreground","src","category","type","default","edit"],"mappings":";AAcO,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,kBAAA,EAXP,IAIIA,EAAAA,GAFFC,EADDC,EAAAA,KACCD,GASWE,EAAe,CAC3B,CACCC,MAAOH,EAAI,OAAQ,cACnBI,MAAO,QAER,CACCD,MAAOH,EAAI,QAAS,cACpBI,MAAO,SAER,CACCD,MAAOH,EAAI,OAAQ,cACnBI,MAAO,SAXF,QAAA,aAAA;;AC6IQC,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAjHf,IAAA,EAAA,QAAA,eAlBIN,EAAAA,GApBHO,EAAAA,EAAAA,YACCC,EAAAA,EAAAA,kBACAC,EAAAA,EAAAA,cAEDC,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,YACAC,EAAAA,EAAA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D,CACC,MAAQjC,EAAI,sBAAuB,cACnC,UAAaqC,EACb,SAAW,WACVP,EAAe,CAAEO,mBAAqBA,KAEvC,KAEIrC,EADHqC,EACO,0DACA,oEAD4D,gBAMpEL,GACD,EAAC,EAAD,CACC,MAAQhC,EAAI,uBAAwB,cACpC,UAAamC,EACb,SAAW,WACVL,EAAe,CAAEK,oBAAsBA,KAExC,KAEInC,EADHmC,EACO,4DACA,sEAD8D,kBAO1E,EAAC,EACA,KAAA,EAAC,EAAD,CAAkB,MAAM,YAAY,WAAaN,MAzFlD,EAAC,EAAD,CACC,KAAK,cACL,MAAQ7B,EAAI,oBAAqB,cACjC,aAAeA,EAAI,0EAA2E,eAE9F,EAAC,EAAD,CACC,UAAU,UACV,UAAY0B,EACZ,UAAY1B,EAAI,oBAAsB,cACtC,YAAcA,EAAI,gCAAkC,cACpD,aAAe8B,EACf,UAAYC,MAoFF1B,EAAAA,EAAAA,QAAAA,QAAAA;;AC1If,aAFA,IAAA,EAAA,EAAA,QAAA,kBAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAdA,IAOIN,EAAAA,GALFyC,EADDC,EAAAA,OACCD,kBAGAxC,EADDC,EAAAA,KACCD,GASFwC,EAAmB,YAAa,CAC/BE,MAAO1C,EAAI,SAAU,cACrB2C,YAAa3C,EAAI,qBAAsB,cACvC4C,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,eAENC,SAAU,aACVnB,WAAY,CACXS,OAAQ,CACPW,KAAM,UACNC,QAAS,GAEVhB,WAAY,CACXe,KAAM,SACNC,QAAS,QAEVf,mBAAoB,CACnBc,KAAM,UACNC,SAAS,GAEVd,oBAAqB,CACpBa,KAAM,UACNC,SAAS,GAEVb,kBAAmB,CAClBY,KAAM,UACNC,SAAS,IAGXC,KAAM9C,EAAAA","file":"member.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Avatar sizes.\n *\n * @type {Array}\n */\nexport const AVATAR_SIZES = [\n\t{\n\t\tlabel: __( 'None', 'buddypress' ),\n\t\tvalue: 'none',\n\t},\n\t{\n\t\tlabel: __( 'Thumb', 'buddypress' ),\n\t\tvalue: 'thumb',\n\t},\n\t{\n\t\tlabel: __( 'Full', 'buddypress' ),\n\t\tvalue: 'full',\n\t},\n];\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t\tBlockControls,\n\t},\n\tcomponents: {\n\t\tPlaceholder,\n\t\tDisabled,\n\t\tPanelBody,\n\t\tSelectControl,\n\t\tToggleControl,\n\t\tToolbar,\n\t\tToolbarButton,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tAutoCompleter,\n\t\tServerSideRender,\n\t},\n\tblockData: {\n\t\tisActive,\n\t}\n} = bp;\n\n/**\n * Internal dependencies.\n */\nimport { AVATAR_SIZES } from './constants';\n\nconst getSlugValue = ( item ) => {\n\tif ( item && item.mention_name ) {\n\t\treturn item.mention_name;\n\t}\n\n\treturn null;\n}\n\nconst editMemberBlock = ( { attributes, setAttributes } ) => {\n\tconst isAvatarEnabled = isActive( 'members', 'avatar' );\n\tconst isMentionEnabled = isActive( 'activity', 'mentions' );\n\tconst isCoverImageEnabled = isActive( 'members', 'cover' );\n\tconst { avatarSize, displayMentionSlug, displayActionButton, displayCoverImage } = attributes;\n\n\tif ( ! attributes.itemID ) {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon=\"admin-users\"\n\t\t\t\tlabel={ __( 'BuddyPress Member', 'buddypress' ) }\n\t\t\t\tinstructions={ __( 'Start typing the name of the member you want to feature into this post.', 'buddypress' ) }\n\t\t\t>\n\t\t\t\t<AutoCompleter\n\t\t\t\t\tcomponent=\"members\"\n\t\t\t\t\tslugValue={ getSlugValue }\n\t\t\t\t\tariaLabel={ __( 'Member\\'s username', 'buddypress' ) }\n\t\t\t\t\tplaceholder={ __( 'Enter Member\\'s username here…', 'buddypress' ) }\n\t\t\t\t\tonSelectItem={ setAttributes }\n\t\t\t\t\tuseAvatar={ isAvatarEnabled }\n\t\t\t\t/>\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<Toolbar label={ __( 'Block toolbar', 'buddypress' ) }>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon=\"edit\"\n\t\t\t\t\t\ttitle={ __( 'Select another member', 'buddypress' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetAttributes( { itemID: 0 } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Toolbar>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display Profile button', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! displayActionButton }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { displayActionButton: ! displayActionButton } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tdisplayActionButton\n\t\t\t\t\t\t\t\t? __( 'Include a link to the user\\'s profile page under their display name.', 'buddypress' )\n\t\t\t\t\t\t\t\t: __( 'Toggle to display a link to the user\\'s profile page under their display name.', 'buddypress' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ isAvatarEnabled && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size', 'buddypress' ) }\n\t\t\t\t\t\t\tvalue={ avatarSize }\n\t\t\t\t\t\t\toptions={ AVATAR_SIZES }\n\t\t\t\t\t\t\thelp={ __( 'Select \"None\" to disable the avatar.', 'buddypress' ) }\n\t\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { avatarSize: option } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isCoverImageEnabled && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display Cover Image', 'buddypress' ) }\n\t\t\t\t\t\t\tchecked={ !! displayCoverImage }\n\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { displayCoverImage: ! displayCoverImage } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tdisplayCoverImage\n\t\t\t\t\t\t\t\t\t? __( 'Include the user\\'s cover image over their display name.', 'buddypress' )\n\t\t\t\t\t\t\t\t\t: __( 'Toggle to display the user\\'s cover image over their display name.', 'buddypress' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isMentionEnabled && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display Mention slug', 'buddypress' ) }\n\t\t\t\t\t\t\tchecked={ !! displayMentionSlug }\n\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { displayMentionSlug: ! displayMentionSlug } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tdisplayMentionSlug\n\t\t\t\t\t\t\t\t\t? __( 'Include the user\\'s mention name under their display name.', 'buddypress' )\n\t\t\t\t\t\t\t\t\t: __( 'Toggle to display the user\\'s mention name under their display name.', 'buddypress' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/member\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editMemberBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editMemberBlock from './member/edit';\n\nregisterBlockType( 'bp/member', {\n\ttitle: __( 'Member', 'buddypress' ),\n\tdescription: __( 'BuddyPress Member.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'admin-users',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\titemID: {\n\t\t\ttype: 'integer',\n\t\t\tdefault: 0,\n\t\t},\n\t\tavatarSize: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'full',\n\t\t},\n\t\tdisplayMentionSlug: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\tdisplayActionButton: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\tdisplayCoverImage: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t},\n\tedit: editMemberBlock,\n} );\n"]}
bp-members/js/blocks/members.js CHANGED
@@ -1,28 +1,28 @@
1
- parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"LGpM":[function(require,module,exports) {
2
  function n(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,l=new Array(r);e<r;e++)l[e]=n[e];return l}module.exports=n;
3
  },{}],"o3SL":[function(require,module,exports) {
4
  var r=require("./arrayLikeToArray");function a(a){if(Array.isArray(a))return r(a)}module.exports=a;
5
- },{"./arrayLikeToArray":"LGpM"}],"lZpU":[function(require,module,exports) {
6
  function e(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}module.exports=e;
7
- },{}],"Vzqv":[function(require,module,exports) {
8
  var r=require("./arrayLikeToArray");function t(t,e){if(t){if("string"==typeof t)return r(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(o):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(t,e):void 0}}module.exports=t;
9
- },{"./arrayLikeToArray":"LGpM"}],"NCaH":[function(require,module,exports) {
10
  function e(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
11
  },{}],"I9dH":[function(require,module,exports) {
12
  var r=require("./arrayWithoutHoles"),e=require("./iterableToArray"),u=require("./unsupportedIterableToArray"),a=require("./nonIterableSpread");function o(o){return r(o)||e(o)||u(o)||a()}module.exports=o;
13
- },{"./arrayWithoutHoles":"o3SL","./iterableToArray":"lZpU","./unsupportedIterableToArray":"Vzqv","./nonIterableSpread":"NCaH"}],"dEOc":[function(require,module,exports) {
14
  function r(r){if(Array.isArray(r))return r}module.exports=r;
15
- },{}],"RonT":[function(require,module,exports) {
16
  function r(r,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var e=[],n=!0,o=!1,l=void 0;try{for(var i,u=r[Symbol.iterator]();!(n=(i=u.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(a){o=!0,l=a}finally{try{n||null==u.return||u.return()}finally{if(o)throw l}}return e}}module.exports=r;
17
- },{}],"sa4T":[function(require,module,exports) {
18
  function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
19
- },{}],"xkYc":[function(require,module,exports) {
20
  var r=require("./arrayWithHoles"),e=require("./iterableToArrayLimit"),t=require("./unsupportedIterableToArray"),i=require("./nonIterableRest");function u(u,a){return r(u)||e(u,a)||t(u,a)||i()}module.exports=u;
21
- },{"./arrayWithHoles":"dEOc","./iterableToArrayLimit":"RonT","./unsupportedIterableToArray":"Vzqv","./nonIterableRest":"sa4T"}],"gr8I":[function(require,module,exports) {
22
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EXTRA_DATA=exports.AVATAR_SIZES=void 0;var e=wp,s=e.i18n.__,l=[{label:s("None","buddypress"),value:"none"},{label:s("Thumb","buddypress"),value:"thumb"},{label:s("Full","buddypress"),value:"full"}];exports.AVATAR_SIZES=l;var t=[{label:s("None","buddypress"),value:"none"},{label:s("Last time the user was active","buddypress"),value:"last_activity"},{label:s("Latest activity the user posted","buddypress"),value:"latest_update"}];exports.EXTRA_DATA=t;
23
  },{}],"PZSE":[function(require,module,exports) {
24
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=a(require("@babel/runtime/helpers/toConsumableArray")),t=a(require("@babel/runtime/helpers/slicedToArray")),n=require("./constants");function a(e){return e&&e.__esModule?e:{default:e}}var r=wp,s=r.blockEditor,i=s.InspectorControls,l=s.BlockControls,o=r.components,u=o.Placeholder,d=o.PanelBody,c=o.SelectControl,m=o.ToggleControl,p=o.Button,b=o.Dashicon,y=o.Tooltip,h=o.ToolbarGroup,g=o.RangeControl,v=r.compose.compose,f=r.data.withSelect,_=r.element,A=_.createElement,k=_.Fragment,S=_.useState,C=r.i18n,x=C.__,N=C.sprintf,T=r.apiFetch,D=r.url.addQueryArgs,I=bp.blockComponents.AutoCompleter,M=lodash,E=M.reject,P=M.remove,w=M.sortBy,q=function(e){return e&&e.mention_name?e.mention_name:null},B=function(a){var r,s=a.attributes,o=a.setAttributes,v=a.isSelected,f=a.bpSettings,_=f.isAvatarEnabled,C=f.isMentionEnabled,M=s.itemIDs,B=s.avatarSize,R=s.displayMentionSlug,O=s.displayUserName,j=s.extraData,z=s.layoutPreference,L=s.columns,F=0!==M.length,G=S([]),Q=(0,t.default)(G,2),U=Q[0],V=Q[1],X=[{icon:"text",title:x("List view","buddypress"),onClick:function(){return o({layoutPreference:"list"})},isActive:"list"===z},{icon:"screenoptions",title:x("Grid view","buddypress"),onClick:function(){return o({layoutPreference:"grid"})},isActive:"grid"===z}],H="bp-block-members avatar-"+B,Z=n.EXTRA_DATA;"grid"===z&&(H+=" is-grid columns-"+L,Z=n.EXTRA_DATA.filter(function(e){return"latest_update"!==e.value}));return F&&M.length!==U.length&&T({path:D("/buddypress/v1/members",{populate_extras:!0,include:M})}).then(function(e){V(w(e,[function(e){return M.indexOf(e.id)}]))}),U.length&&(r=U.map(function(e){var t=!1,n="member-content";return"list"===z&&"latest_update"===j&&e.latest_update&&e.latest_update.rendered&&(t=!0,n="member-content has-activity"),A("div",{key:"bp-member-"+e.id,className:n},v&&A(y,{text:x("Remove member","buddypress")},A(p,{className:"is-right",onClick:function(){var t;(t=e.id)&&-1!==M.indexOf(t)&&(V(E(U,["id",t])),o({itemIDs:P(M,function(e){return e!==t})}))},label:x("Remove member","buddypress")},A(b,{icon:"no"}))),_&&"none"!==B&&A("div",{className:"item-header-avatar"},A("a",{href:e.link,target:"_blank"},A("img",{key:"avatar-"+e.id,className:"avatar",alt:N(x("Profile photo of %s","buddypress"),e.name),src:e.avatar_urls[B]}))),A("div",{className:"member-description"},t&&A("blockquote",{className:"wp-block-quote"},A("div",{dangerouslySetInnerHTML:{__html:e.latest_update.rendered}}),A("cite",null,O&&A("span",null,e.name)," ",C&&R&&A("a",{href:e.link,target:"_blank"},"(@",e.mention_name,")"))),!t&&O&&A("strong",null,A("a",{href:e.link,target:"_blank"},e.name)),!t&&C&&R&&A("span",{className:"user-nicename"},"@",e.mention_name),"last_activity"===j&&e.last_activity&&e.last_activity.date&&A("time",{dateTime:e.last_activity.date},N(x("Active %s","buddypress"),e.last_activity.timediff))))})),A(k,null,A(i,null,A(d,{title:x("Settings","buddypress"),initialOpen:!0},A(m,{label:x("Display the user name","buddypress"),checked:!!O,onChange:function(){o({displayUserName:!O})},help:x(O?"Include the user's display name.":"Toggle to include user's display name.","buddypress")}),C&&A(m,{label:x("Display Mention slug","buddypress"),checked:!!R,onChange:function(){o({displayMentionSlug:!R})},help:x(R?"Include the user's mention name under their display name.":"Toggle to display the user's mention name under their display name.","buddypress")}),_&&A(c,{label:x("Avatar size","buddypress"),value:B,options:n.AVATAR_SIZES,help:x('Select "None" to disable the avatar.',"buddypress"),onChange:function(e){o({avatarSize:e})}}),A(c,{label:x("BuddyPress extra information","buddypress"),value:j,options:Z,help:x('Select "None" to show no extra information.',"buddypress"),onChange:function(e){o({extraData:e})}}),"grid"===z&&A(g,{label:x("Columns","buddypress"),value:L,onChange:function(e){return o({columns:e})},min:2,max:4,required:!0}))),A(l,null,A(h,{controls:X})),F&&A("div",{className:H},r),(v||0===M.length)&&A(u,{icon:F?"":"groups",label:F?"":x("BuddyPress Members","buddypress"),instructions:x("Start typing the name of the member you want to add to the members list.","buddypress"),className:0!==M.length?"is-appender":"is-large"},A(I,{component:"members",objectQueryArgs:{exclude:M},slugValue:q,ariaLabel:x("Member's username","buddypress"),placeholder:x("Enter Member's username here…","buddypress"),onSelectItem:function(t){var n=t.itemID;n&&-1===M.indexOf(n)&&o({itemIDs:[].concat((0,e.default)(M),[parseInt(n,10)])})},useAvatar:_})))},R=v([f(function(e){return{bpSettings:e("core/editor").getEditorSettings().bp.members||{}}})])(B),O=R;exports.default=O;
25
- },{"@babel/runtime/helpers/toConsumableArray":"I9dH","@babel/runtime/helpers/slicedToArray":"xkYc","./constants":"gr8I"}],"XEHU":[function(require,module,exports) {
26
- "use strict";var e=t(require("./members/edit"));function t(e){return e&&e.__esModule?e:{default:e}}var r=wp,s=r.blocks.registerBlockType,a=r.i18n.__;s("bp/members",{title:a("Members","buddypress"),description:a("BuddyPress Members.","buddypress"),icon:"groups",category:"buddypress",attributes:{itemIDs:{type:"array",items:{type:"integer"},default:[]},avatarSize:{type:"string",default:"full"},displayMentionSlug:{type:"boolean",default:!0},displayUserName:{type:"boolean",default:!0},extraData:{type:"string",default:"none"},layoutPreference:{type:"string",default:"list"},columns:{type:"number",default:2}},edit:e.default});
27
  },{"./members/edit":"PZSE"}]},{},["XEHU"], null)
28
  //# sourceMappingURL=/bp-members/js/blocks/members.js.map
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"jEQo":[function(require,module,exports) {
2
  function n(n,r){(null==r||r>n.length)&&(r=n.length);for(var e=0,l=new Array(r);e<r;e++)l[e]=n[e];return l}module.exports=n;
3
  },{}],"o3SL":[function(require,module,exports) {
4
  var r=require("./arrayLikeToArray");function a(a){if(Array.isArray(a))return r(a)}module.exports=a;
5
+ },{"./arrayLikeToArray":"jEQo"}],"lZpU":[function(require,module,exports) {
6
  function e(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}module.exports=e;
7
+ },{}],"Dbv9":[function(require,module,exports) {
8
  var r=require("./arrayLikeToArray");function t(t,e){if(t){if("string"==typeof t)return r(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(o):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(t,e):void 0}}module.exports=t;
9
+ },{"./arrayLikeToArray":"jEQo"}],"NCaH":[function(require,module,exports) {
10
  function e(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
11
  },{}],"I9dH":[function(require,module,exports) {
12
  var r=require("./arrayWithoutHoles"),e=require("./iterableToArray"),u=require("./unsupportedIterableToArray"),a=require("./nonIterableSpread");function o(o){return r(o)||e(o)||u(o)||a()}module.exports=o;
13
+ },{"./arrayWithoutHoles":"o3SL","./iterableToArray":"lZpU","./unsupportedIterableToArray":"Dbv9","./nonIterableSpread":"NCaH"}],"DCTP":[function(require,module,exports) {
14
  function r(r){if(Array.isArray(r))return r}module.exports=r;
15
+ },{}],"LoeL":[function(require,module,exports) {
16
  function r(r,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var e=[],n=!0,o=!1,l=void 0;try{for(var i,u=r[Symbol.iterator]();!(n=(i=u.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(a){o=!0,l=a}finally{try{n||null==u.return||u.return()}finally{if(o)throw l}}return e}}module.exports=r;
17
+ },{}],"MWEO":[function(require,module,exports) {
18
  function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e;
19
+ },{}],"DERy":[function(require,module,exports) {
20
  var r=require("./arrayWithHoles"),e=require("./iterableToArrayLimit"),t=require("./unsupportedIterableToArray"),i=require("./nonIterableRest");function u(u,a){return r(u)||e(u,a)||t(u,a)||i()}module.exports=u;
21
+ },{"./arrayWithHoles":"DCTP","./iterableToArrayLimit":"LoeL","./unsupportedIterableToArray":"Dbv9","./nonIterableRest":"MWEO"}],"gr8I":[function(require,module,exports) {
22
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EXTRA_DATA=exports.AVATAR_SIZES=void 0;var e=wp,s=e.i18n.__,l=[{label:s("None","buddypress"),value:"none"},{label:s("Thumb","buddypress"),value:"thumb"},{label:s("Full","buddypress"),value:"full"}];exports.AVATAR_SIZES=l;var t=[{label:s("None","buddypress"),value:"none"},{label:s("Last time the user was active","buddypress"),value:"last_activity"},{label:s("Latest activity the user posted","buddypress"),value:"latest_update"}];exports.EXTRA_DATA=t;
23
  },{}],"PZSE":[function(require,module,exports) {
24
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=a(require("@babel/runtime/helpers/toConsumableArray")),t=a(require("@babel/runtime/helpers/slicedToArray")),n=require("./constants");function a(e){return e&&e.__esModule?e:{default:e}}var r=wp,s=r.blockEditor,l=s.InspectorControls,i=s.BlockControls,o=r.components,u=o.Placeholder,d=o.PanelBody,c=o.SelectControl,m=o.ToggleControl,p=o.Button,b=o.Dashicon,y=o.Tooltip,h=o.ToolbarGroup,v=o.RangeControl,f=r.element,g=f.createElement,_=f.Fragment,A=f.useState,k=r.i18n,C=k.__,x=k.sprintf,S=r.apiFetch,N=r.url.addQueryArgs,T=bp,D=T.blockComponents.AutoCompleter,I=T.blockData.isActive,M=lodash,P=M.reject,q=M.remove,w=M.sortBy,B=function(e){return e&&e.mention_name?e.mention_name:null},E=function(a){var r,s=a.attributes,o=a.setAttributes,f=a.isSelected,k=I("members","avatar"),T=I("activity","mentions"),M=s.itemIDs,E=s.avatarSize,R=s.displayMentionSlug,O=s.displayUserName,j=s.extraData,z=s.layoutPreference,L=s.columns,F=0!==M.length,G=A([]),Q=(0,t.default)(G,2),U=Q[0],V=Q[1],X=[{icon:"text",title:C("List view","buddypress"),onClick:function(){return o({layoutPreference:"list"})},isActive:"list"===z},{icon:"screenoptions",title:C("Grid view","buddypress"),onClick:function(){return o({layoutPreference:"grid"})},isActive:"grid"===z}],H="bp-block-members avatar-"+E,Z=n.EXTRA_DATA;"grid"===z&&(H+=" is-grid columns-"+L,Z=n.EXTRA_DATA.filter(function(e){return"latest_update"!==e.value}));return F&&M.length!==U.length&&S({path:N("/buddypress/v1/members",{populate_extras:!0,include:M})}).then(function(e){V(w(e,[function(e){return M.indexOf(e.id)}]))}),U.length&&(r=U.map(function(e){var t=!1,n="member-content";return"list"===z&&"latest_update"===j&&e.latest_update&&e.latest_update.rendered&&(t=!0,n="member-content has-activity"),g("div",{key:"bp-member-"+e.id,className:n},f&&g(y,{text:C("Remove member","buddypress")},g(p,{className:"is-right",onClick:function(){var t;(t=e.id)&&-1!==M.indexOf(t)&&(V(P(U,["id",t])),o({itemIDs:q(M,function(e){return e!==t})}))},label:C("Remove member","buddypress")},g(b,{icon:"no"}))),k&&"none"!==E&&g("div",{className:"item-header-avatar"},g("a",{href:e.link,target:"_blank"},g("img",{key:"avatar-"+e.id,className:"avatar",alt:x(C("Profile photo of %s","buddypress"),e.name),src:e.avatar_urls[E]}))),g("div",{className:"member-description"},t&&g("blockquote",{className:"wp-block-quote"},g("div",{dangerouslySetInnerHTML:{__html:e.latest_update.rendered}}),g("cite",null,O&&g("span",null,e.name)," ",T&&R&&g("a",{href:e.link,target:"_blank"},"(@",e.mention_name,")"))),!t&&O&&g("strong",null,g("a",{href:e.link,target:"_blank"},e.name)),!t&&T&&R&&g("span",{className:"user-nicename"},"@",e.mention_name),"last_activity"===j&&e.last_activity&&e.last_activity.date&&g("time",{dateTime:e.last_activity.date},x(C("Active %s","buddypress"),e.last_activity.timediff))))})),g(_,null,g(l,null,g(d,{title:C("Settings","buddypress"),initialOpen:!0},g(m,{label:C("Display the user name","buddypress"),checked:!!O,onChange:function(){o({displayUserName:!O})},help:C(O?"Include the user's display name.":"Toggle to include user's display name.","buddypress")}),T&&g(m,{label:C("Display Mention slug","buddypress"),checked:!!R,onChange:function(){o({displayMentionSlug:!R})},help:C(R?"Include the user's mention name under their display name.":"Toggle to display the user's mention name under their display name.","buddypress")}),k&&g(c,{label:C("Avatar size","buddypress"),value:E,options:n.AVATAR_SIZES,help:C('Select "None" to disable the avatar.',"buddypress"),onChange:function(e){o({avatarSize:e})}}),g(c,{label:C("BuddyPress extra information","buddypress"),value:j,options:Z,help:C('Select "None" to show no extra information.',"buddypress"),onChange:function(e){o({extraData:e})}}),"grid"===z&&g(v,{label:C("Columns","buddypress"),value:L,onChange:function(e){return o({columns:e})},min:2,max:4,required:!0}))),g(i,null,g(h,{controls:X})),F&&g("div",{className:H},r),(f||0===M.length)&&g(u,{icon:F?"":"groups",label:F?"":C("BuddyPress Members","buddypress"),instructions:C("Start typing the name of the member you want to add to the members list.","buddypress"),className:0!==M.length?"is-appender":"is-large"},g(D,{component:"members",objectQueryArgs:{exclude:M},slugValue:B,ariaLabel:C("Member's username","buddypress"),placeholder:C("Enter Member's username here…","buddypress"),onSelectItem:function(t){var n=t.itemID;n&&-1===M.indexOf(n)&&o({itemIDs:[].concat((0,e.default)(M),[parseInt(n,10)])})},useAvatar:k})))},R=E;exports.default=R;
25
+ },{"@babel/runtime/helpers/toConsumableArray":"I9dH","@babel/runtime/helpers/slicedToArray":"DERy","./constants":"gr8I"}],"XEHU":[function(require,module,exports) {
26
+ "use strict";var e=t(require("./members/edit"));function t(e){return e&&e.__esModule?e:{default:e}}var r=wp,s=r.blocks.registerBlockType,a=r.i18n.__;s("bp/members",{title:a("Members","buddypress"),description:a("BuddyPress Members.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"groups"},category:"buddypress",attributes:{itemIDs:{type:"array",items:{type:"integer"},default:[]},avatarSize:{type:"string",default:"full"},displayMentionSlug:{type:"boolean",default:!0},displayUserName:{type:"boolean",default:!0},extraData:{type:"string",default:"none"},layoutPreference:{type:"string",default:"list"},columns:{type:"number",default:2}},edit:e.default});
27
  },{"./members/edit":"PZSE"}]},{},["XEHU"], null)
28
  //# sourceMappingURL=/bp-members/js/blocks/members.js.map
bp-members/js/blocks/members.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArray.js","../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../../node_modules/@babel/runtime/helpers/toConsumableArray.js","../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","bp-members/js/blocks/members/constants.js","bp-members/js/blocks/members/edit.js","bp-members/js/blocks/members.js"],"names":["wp","__","i18n","AVATAR_SIZES","label","value","EXTRA_DATA","editMembersBlock","blockEditor","InspectorControls","BlockControls","components","Placeholder","PanelBody","SelectControl","ToggleControl","Button","Dashicon","Tooltip","ToolbarGroup","RangeControl","compose","withSelect","data","element","createElement","Fragment","useState","sprintf","apiFetch","addQueryArgs","url","AutoCompleter","bp","blockComponents","lodash","reject","remove","sortBy","getSlugValue","item","mention_name","editMembers","attributes","membersList","setAttributes","isSelected","bpSettings","isAvatarEnabled","isMentionEnabled","itemIDs","avatarSize","displayMentionSlug","displayUserName","extraData","layoutPreference","columns","hasMembers","length","members","setMembers","layoutControls","icon","title","onClick","isActive","containerClasses","extraDataOptions","filter","extra","path","populate_extras","include","then","items","indexOf","id","map","member","hasActivity","memberItemClasses","latest_update","rendered","itemID","link","name","avatar_urls","__html","last_activity","date","timediff","option","exclude","parseInt","select","getEditorSettings","registerBlockType","blocks","description","category","type","default","edit"],"mappings":";AAAA,SAAA,EAAA,EAAA,IACA,MAAA,GAAA,EAAA,EAAA,UAAA,EAAA,EAAA,QAEA,IAAA,IAAA,EAAA,EAAA,EAAA,IAAA,MAAA,GAAA,EAAA,EAAA,IACA,EAAA,GAAA,EAAA,GAGA,OAAA,EAGA,OAAA,QAAA;;ACVA,IAAA,EAAA,QAAA,sBAEA,SAAA,EAAA,GACA,GAAA,MAAA,QAAA,GAAA,OAAA,EAAA,GAGA,OAAA,QAAA;;ACNA,SAAA,EAAA,GACA,GAAA,oBAAA,QAAA,OAAA,YAAA,OAAA,GAAA,OAAA,MAAA,KAAA,GAGA,OAAA,QAAA;;ACJA,IAAA,EAAA,QAAA,sBAEA,SAAA,EAAA,EAAA,GACA,GAAA,EAAA,CACA,GAAA,iBAAA,EAAA,OAAA,EAAA,EAAA,GACA,IAAA,EAAA,OAAA,UAAA,SAAA,KAAA,GAAA,MAAA,GAAA,GAEA,MADA,WAAA,GAAA,EAAA,cAAA,EAAA,EAAA,YAAA,MACA,QAAA,GAAA,QAAA,EAAA,MAAA,KAAA,GACA,cAAA,GAAA,2CAAA,KAAA,GAAA,EAAA,EAAA,QAAA,GAGA,OAAA,QAAA;;ACXA,SAAA,IACA,MAAA,IAAA,UAAA,wIAGA,OAAA,QAAA;;ACJA,IAAA,EAAA,QAAA,uBAEA,EAAA,QAAA,qBAEA,EAAA,QAAA,gCAEA,EAAA,QAAA,uBAEA,SAAA,EAAA,GACA,OAAA,EAAA,IAAA,EAAA,IAAA,EAAA,IAAA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AAA,GAAS2C,CAAAA,SAAUV,EAAQ,SAoMtC,UAAYnC,OAQZzC,EAAmBc,EAAS,CACjCC,EAAY,SAAEwE,GAGN,MAAA,CACN/C,WAHsB+C,EAAQ,eAAgBC,oBAGnB9D,GAAG0B,SAAW,OALnBtC,CAQpBqB,GAEUnC,EAAAA,EAAAA,QAAAA,QAAAA;;ACpTf,aAFA,IAAA,EAAA,EAAA,QAAA,mBAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAPIP,IAAAA,EAAAA,GALFgG,EADDC,EAAAA,OACCD,kBAGA/F,EADDC,EAAAA,KACCD,GASF+F,EAAmB,aAAc,CAChCjC,MAAO9D,EAAI,UAAW,cACtBiG,YAAajG,EAAI,sBAAuB,cACxC6D,KAAM,SACNqC,SAAU,aACVxD,WAAY,CACXO,QAAS,CACRkD,KAAM,QACN1B,MAAO,CACN0B,KAAM,WAEPC,QAAS,IAEVlD,WAAY,CACXiD,KAAM,SACNC,QAAS,QAEVjD,mBAAoB,CACnBgD,KAAM,UACNC,SAAS,GAEVhD,gBAAiB,CAChB+C,KAAM,UACNC,SAAS,GAEV/C,UAAW,CACV8C,KAAM,SACNC,QAAS,QAEV9C,iBAAkB,CACjB6C,KAAM,SACNC,QAAS,QAEV7C,QAAS,CACR4C,KAAM,SACNC,QAAS,IAGXC,KAAM/F,EAAAA","file":"members.js","sourceRoot":"../src/js","sourcesContent":["function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles;","function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableSpread;","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Avatar sizes.\n *\n * @type {Array}\n */\nexport const AVATAR_SIZES = [\n\t{\n\t\tlabel: __( 'None', 'buddypress' ),\n\t\tvalue: 'none',\n\t},\n\t{\n\t\tlabel: __( 'Thumb', 'buddypress' ),\n\t\tvalue: 'thumb',\n\t},\n\t{\n\t\tlabel: __( 'Full', 'buddypress' ),\n\t\tvalue: 'full',\n\t},\n];\n\n/**\n * BuddyPress Extra data.\n *\n * @type {Array}\n */\nexport const EXTRA_DATA = [\n\t{\n\t\tlabel: __( 'None', 'buddypress' ),\n\t\tvalue: 'none',\n\t},\n\t{\n\t\tlabel: __( 'Last time the user was active', 'buddypress' ),\n\t\tvalue: 'last_activity',\n\t},\n\t{\n\t\tlabel: __( 'Latest activity the user posted', 'buddypress' ),\n\t\tvalue: 'latest_update',\n\t},\n];\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t\tBlockControls,\n\t},\n\tcomponents: {\n\t\tPlaceholder,\n\t\tPanelBody,\n\t\tSelectControl,\n\t\tToggleControl,\n\t\tButton,\n\t\tDashicon,\n\t\tTooltip,\n\t\tToolbarGroup,\n\t\tRangeControl,\n\t},\n\tcompose: {\n\t\tcompose,\n\t},\n\tdata: {\n\t\twithSelect,\n\t},\n\telement: {\n\t\tcreateElement,\n\t\tFragment,\n\t\tuseState,\n\t},\n\ti18n: {\n\t\t__,\n\t\tsprintf,\n\t},\n\tapiFetch,\n\turl: {\n\t\taddQueryArgs,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst { AutoCompleter } = bp.blockComponents;\n\n/**\n * Internal dependencies.\n */\nimport { AVATAR_SIZES, EXTRA_DATA } from './constants';\n\n/**\n * External dependencies.\n */\nconst {\n\treject,\n\tremove,\n\tsortBy,\n} = lodash;\n\nconst getSlugValue = ( item ) => {\n\tif ( item && item.mention_name ) {\n\t\treturn item.mention_name;\n\t}\n\n\treturn null;\n}\n\nconst editMembers = ( { attributes, setAttributes, isSelected, bpSettings } ) => {\n\tconst {\n\t\tisAvatarEnabled,\n\t\tisMentionEnabled,\n\t} = bpSettings;\n\tconst {\n\t\titemIDs,\n\t\tavatarSize,\n\t\tdisplayMentionSlug,\n\t\tdisplayUserName,\n\t\textraData,\n\t\tlayoutPreference,\n\t\tcolumns,\n\t} = attributes;\n\tconst hasMembers = 0 !== itemIDs.length;\n\tconst [ members, setMembers ] = useState( [] );\n\tconst layoutControls = [\n\t\t{\n\t\t\ticon: 'text',\n\t\t\ttitle: __( 'List view', 'buddypress' ),\n\t\t\tonClick: () => setAttributes( { layoutPreference: 'list' } ),\n\t\t\tisActive: layoutPreference === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: 'screenoptions',\n\t\t\ttitle: __( 'Grid view', 'buddypress' ),\n\t\t\tonClick: () => setAttributes( { layoutPreference: 'grid' } ),\n\t\t\tisActive: layoutPreference === 'grid',\n\t\t},\n\t];\n\tlet membersList;\n\tlet containerClasses = 'bp-block-members avatar-' + avatarSize;\n\tlet extraDataOptions = EXTRA_DATA;\n\n\tif ( layoutPreference === 'grid' ) {\n\t\tcontainerClasses += ' is-grid columns-' + columns;\n\t\textraDataOptions = EXTRA_DATA.filter( ( extra ) => {\n\t\t\treturn 'latest_update' !== extra.value;\n\t\t} );\n\t}\n\n\tconst onSelectedMember = ( { itemID } ) => {\n\t\tif ( itemID && -1 === itemIDs.indexOf( itemID ) ) {\n\t\t\tsetAttributes( {\n\t\t\t\titemIDs: [...itemIDs, parseInt( itemID, 10 ) ]\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst onRemoveMember = ( ( itemID ) => {\n\t\tif ( itemID && -1 !== itemIDs.indexOf( itemID ) ) {\n\t\t\tsetMembers( reject( members, ['id', itemID ] ) );\n\t\t\tsetAttributes( {\n\t\t\t\titemIDs: remove( itemIDs, ( value ) => { return value !== itemID } )\n\t\t\t} );\n\t\t}\n\t} );\n\n\tif ( hasMembers && itemIDs.length !== members.length ) {\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( `/buddypress/v1/members`, { populate_extras: true, include: itemIDs } ),\n\t\t} ).then( items => {\n\t\t\tsetMembers(\n\t\t\t\tsortBy( items, [ ( item ) => {\n\t\t\t\t\treturn itemIDs.indexOf( item.id );\n\t\t\t\t} ] )\n\t\t\t);\n\t\t} )\n\t}\n\n\tif ( members.length ) {\n\t\tmembersList = members.map( ( member ) => {\n\t\t\tlet hasActivity = false;\n\t\t\tlet memberItemClasses = 'member-content';\n\n\t\t\tif ( layoutPreference === 'list' && 'latest_update' === extraData && member.latest_update && member.latest_update.rendered ) {\n\t\t\t\thasActivity = true;\n\t\t\t\tmemberItemClasses = 'member-content has-activity';\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div key={ 'bp-member-' + member.id } className={ memberItemClasses }>\n\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t<Tooltip text={ __( 'Remove member', 'buddypress' ) }>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"is-right\"\n\t\t\t\t\t\t\t\tonClick={ () => onRemoveMember( member.id ) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove member', 'buddypress' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Dashicon icon=\"no\"/>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isAvatarEnabled && 'none' !== avatarSize && (\n\t\t\t\t\t\t<div className=\"item-header-avatar\">\n\t\t\t\t\t\t\t<a href={ member.link } target=\"_blank\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tkey={ 'avatar-' + member.id }\n\t\t\t\t\t\t\t\t\tclassName=\"avatar\"\n\t\t\t\t\t\t\t\t\talt={ sprintf( __( 'Profile photo of %s', 'buddypress' ), member.name ) }\n\t\t\t\t\t\t\t\t\tsrc={ member.avatar_urls[ avatarSize ] }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<div className=\"member-description\">\n\t\t\t\t\t\t{ hasActivity && (\n\t\t\t\t\t\t\t<blockquote className=\"wp-block-quote\">\n\t\t\t\t\t\t\t\t<div dangerouslySetInnerHTML={ { __html: member.latest_update.rendered } } />\n\t\t\t\t\t\t\t\t<cite>\n\t\t\t\t\t\t\t\t\t{ displayUserName && (\n\t\t\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t\t\t{ member.name }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t&nbsp;\n\t\t\t\t\t\t\t\t\t{ isMentionEnabled && displayMentionSlug && (\n\t\t\t\t\t\t\t\t\t\t<a href={ member.link } target=\"_blank\">\n\t\t\t\t\t\t\t\t\t\t\t(@{ member.mention_name })\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</cite>\n\t\t\t\t\t\t\t</blockquote>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! hasActivity && displayUserName && (\n\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t<a href={ member.link } target=\"_blank\">\n\t\t\t\t\t\t\t\t\t{ member.name }\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ ! hasActivity && isMentionEnabled && displayMentionSlug && (\n\t\t\t\t\t\t\t<span className=\"user-nicename\">@{ member.mention_name }</span>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ 'last_activity' === extraData && member.last_activity && member.last_activity.date && (\n\t\t\t\t\t\t\t<time dateTime={ member.last_activity.date }>\n\t\t\t\t\t\t\t\t{ sprintf( __( 'Active %s', 'buddypress' ), member.last_activity.timediff ) }\n\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t} );\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display the user name', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! displayUserName }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { displayUserName: ! displayUserName } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tdisplayUserName\n\t\t\t\t\t\t\t\t? __( 'Include the user\\'s display name.', 'buddypress' )\n\t\t\t\t\t\t\t\t: __( 'Toggle to include user\\'s display name.', 'buddypress' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ isMentionEnabled && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display Mention slug', 'buddypress' ) }\n\t\t\t\t\t\t\tchecked={ !! displayMentionSlug }\n\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { displayMentionSlug: ! displayMentionSlug } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tdisplayMentionSlug\n\t\t\t\t\t\t\t\t\t? __( 'Include the user\\'s mention name under their display name.', 'buddypress' )\n\t\t\t\t\t\t\t\t\t: __( 'Toggle to display the user\\'s mention name under their display name.', 'buddypress' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isAvatarEnabled && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size', 'buddypress' ) }\n\t\t\t\t\t\t\tvalue={ avatarSize }\n\t\t\t\t\t\t\toptions={ AVATAR_SIZES }\n\t\t\t\t\t\t\thelp={ __( 'Select \"None\" to disable the avatar.', 'buddypress' ) }\n\t\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { avatarSize: option } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'BuddyPress extra information', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ extraData }\n\t\t\t\t\t\toptions={ extraDataOptions }\n\t\t\t\t\t\thelp={ __( 'Select \"None\" to show no extra information.', 'buddypress' ) }\n\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\tsetAttributes( { extraData: option } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ layoutPreference === 'grid' && (\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Columns', 'buddypress' ) }\n\t\t\t\t\t\t\tvalue={ columns }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { columns: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\tmax={ 4 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ layoutControls } />\n\t\t\t</BlockControls>\n\n\t\t\t{ hasMembers && (\n\t\t\t\t<div className={ containerClasses }>\n\t\t\t\t\t{ membersList }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ ( isSelected || 0 === itemIDs.length ) && (\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ hasMembers ? '' : 'groups' }\n\t\t\t\t\tlabel={ hasMembers ? '' : __( 'BuddyPress Members', 'buddypress' ) }\n\t\t\t\t\tinstructions={ __( 'Start typing the name of the member you want to add to the members list.', 'buddypress' ) }\n\t\t\t\t\tclassName={ 0 !== itemIDs.length ? 'is-appender' : 'is-large' }\n\t\t\t\t>\n\t\t\t\t\t<AutoCompleter\n\t\t\t\t\t\tcomponent=\"members\"\n\t\t\t\t\t\tobjectQueryArgs={ { exclude: itemIDs } }\n\t\t\t\t\t\tslugValue={ getSlugValue }\n\t\t\t\t\t\tariaLabel={ __( 'Member\\'s username', 'buddypress' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Enter Member\\'s username here…', 'buddypress' ) }\n\t\t\t\t\t\tonSelectItem={ onSelectedMember }\n\t\t\t\t\t\tuseAvatar={ isAvatarEnabled }\n\t\t\t\t\t/>\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t</Fragment>\n\t);\n};\n\nconst editMembersBlock = compose( [\n\twithSelect( ( select ) => {\n\t\tconst editorSettings = select( 'core/editor' ).getEditorSettings();\n\n\t\treturn {\n\t\t\tbpSettings: editorSettings.bp.members || {},\n\t\t};\n\t} ),\n] )( editMembers );\n\nexport default editMembersBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editMembersBlock from './members/edit';\n\nregisterBlockType( 'bp/members', {\n\ttitle: __( 'Members', 'buddypress' ),\n\tdescription: __( 'BuddyPress Members.', 'buddypress' ),\n\ticon: 'groups',\n\tcategory: 'buddypress',\n\tattributes: {\n\t\titemIDs: {\n\t\t\ttype: 'array',\n\t\t\titems: {\n\t\t\t\ttype: 'integer',\n\t\t\t},\n\t\t\tdefault: [],\n\t\t},\n\t\tavatarSize: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'full',\n\t\t},\n\t\tdisplayMentionSlug: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\tdisplayUserName: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\textraData: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'none',\n\t\t},\n\t\tlayoutPreference: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'list',\n\t\t},\n\t\tcolumns: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 2\n\t\t},\n\t},\n\tedit: editMembersBlock,\n} );\n"]}
1
+ {"version":3,"sources":["../../../../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArray.js","../../../../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../../node_modules/@babel/runtime/helpers/toConsumableArray.js","../../../../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../../../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../../../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../../../../node_modules/@babel/runtime/helpers/slicedToArray.js","bp-members/js/blocks/members/constants.js","bp-members/js/blocks/members/edit.js","bp-members/js/blocks/members.js"],"names":["wp","__","i18n","AVATAR_SIZES","label","value","EXTRA_DATA","editMembersBlock","blockEditor","InspectorControls","BlockControls","components","Placeholder","PanelBody","SelectControl","ToggleControl","Button","Dashicon","Tooltip","ToolbarGroup","RangeControl","element","createElement","Fragment","useState","sprintf","apiFetch","addQueryArgs","url","bp","AutoCompleter","blockComponents","isActive","blockData","lodash","reject","remove","sortBy","getSlugValue","item","mention_name","attributes","membersList","setAttributes","isSelected","isAvatarEnabled","isMentionEnabled","itemIDs","avatarSize","displayMentionSlug","displayUserName","extraData","layoutPreference","columns","hasMembers","length","members","setMembers","layoutControls","icon","title","onClick","containerClasses","extraDataOptions","filter","extra","path","populate_extras","include","then","items","indexOf","id","map","member","hasActivity","memberItemClasses","latest_update","rendered","itemID","link","name","avatar_urls","__html","last_activity","date","timediff","option","exclude","parseInt","registerBlockType","blocks","description","background","foreground","src","category","type","default","edit"],"mappings":";AAAA,SAAA,EAAA,EAAA,IACA,MAAA,GAAA,EAAA,EAAA,UAAA,EAAA,EAAA,QAEA,IAAA,IAAA,EAAA,EAAA,EAAA,IAAA,MAAA,GAAA,EAAA,EAAA,IACA,EAAA,GAAA,EAAA,GAGA,OAAA,EAGA,OAAA,QAAA;;ACVA,IAAA,EAAA,QAAA,sBAEA,SAAA,EAAA,GACA,GAAA,MAAA,QAAA,GAAA,OAAA,EAAA,GAGA,OAAA,QAAA;;ACNA,SAAA,EAAA,GACA,GAAA,oBAAA,QAAA,OAAA,YAAA,OAAA,GAAA,OAAA,MAAA,KAAA,GAGA,OAAA,QAAA;;ACJA,IAAA,EAAA,QAAA,sBAEA,SAAA,EAAA,EAAA,GACA,GAAA,EAAA,CACA,GAAA,iBAAA,EAAA,OAAA,EAAA,EAAA,GACA,IAAA,EAAA,OAAA,UAAA,SAAA,KAAA,GAAA,MAAA,GAAA,GAEA,MADA,WAAA,GAAA,EAAA,cAAA,EAAA,EAAA,YAAA,MACA,QAAA,GAAA,QAAA,EAAA,MAAA,KAAA,GACA,cAAA,GAAA,2CAAA,KAAA,GAAA,EAAA,EAAA,QAAA,GAGA,OAAA,QAAA;;ACXA,SAAA,IACA,MAAA,IAAA,UAAA,wIAGA,OAAA,QAAA;;ACJA,IAAA,EAAA,QAAA,uBAEA,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OACvBA,IAAW,IAAMhC,EAAQwB,QAASQ,IACtCpC,EAAe,CACdI,QAAaA,GAAAA,QAAAA,EAAAA,EAAAA,SAAAA,GAAS0C,CAAAA,SAAUV,EAAQ,SAoMtC,UAAYlC,OAQHtC,EAAAA,EAAAA,QAAAA,QAAAA;;ACzSf,aAFA,IAAA,EAAA,EAAA,QAAA,mBAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAdA,IAOIP,EAAAA,GALF0F,EADDC,EAAAA,OACCD,kBAGAzF,EADDC,EAAAA,KACCD,GASFyF,EAAmB,aAAc,CAChC9B,MAAO3D,EAAI,UAAW,cACtB2F,YAAa3F,EAAI,sBAAuB,cACxC0D,KAAM,CACLkC,WAAY,OACZC,WAAY,UACZC,IAAK,UAENC,SAAU,aACVvD,WAAY,CACXM,QAAS,CACRkD,KAAM,QACN3B,MAAO,CACN2B,KAAM,WAEPC,QAAS,IAEVlD,WAAY,CACXiD,KAAM,SACNC,QAAS,QAEVjD,mBAAoB,CACnBgD,KAAM,UACNC,SAAS,GAEVhD,gBAAiB,CAChB+C,KAAM,UACNC,SAAS,GAEV/C,UAAW,CACV8C,KAAM,SACNC,QAAS,QAEV9C,iBAAkB,CACjB6C,KAAM,SACNC,QAAS,QAEV7C,QAAS,CACR4C,KAAM,SACNC,QAAS,IAGXC,KAAM5F,EAAAA","file":"members.js","sourceRoot":"../src/js","sourcesContent":["function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles;","function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableSpread;","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Avatar sizes.\n *\n * @type {Array}\n */\nexport const AVATAR_SIZES = [\n\t{\n\t\tlabel: __( 'None', 'buddypress' ),\n\t\tvalue: 'none',\n\t},\n\t{\n\t\tlabel: __( 'Thumb', 'buddypress' ),\n\t\tvalue: 'thumb',\n\t},\n\t{\n\t\tlabel: __( 'Full', 'buddypress' ),\n\t\tvalue: 'full',\n\t},\n];\n\n/**\n * BuddyPress Extra data.\n *\n * @type {Array}\n */\nexport const EXTRA_DATA = [\n\t{\n\t\tlabel: __( 'None', 'buddypress' ),\n\t\tvalue: 'none',\n\t},\n\t{\n\t\tlabel: __( 'Last time the user was active', 'buddypress' ),\n\t\tvalue: 'last_activity',\n\t},\n\t{\n\t\tlabel: __( 'Latest activity the user posted', 'buddypress' ),\n\t\tvalue: 'latest_update',\n\t},\n];\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t\tBlockControls,\n\t},\n\tcomponents: {\n\t\tPlaceholder,\n\t\tPanelBody,\n\t\tSelectControl,\n\t\tToggleControl,\n\t\tButton,\n\t\tDashicon,\n\t\tTooltip,\n\t\tToolbarGroup,\n\t\tRangeControl,\n\t},\n\telement: {\n\t\tcreateElement,\n\t\tFragment,\n\t\tuseState,\n\t},\n\ti18n: {\n\t\t__,\n\t\tsprintf,\n\t},\n\tapiFetch,\n\turl: {\n\t\taddQueryArgs,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tAutoCompleter,\n\t},\n\tblockData: {\n\t\tisActive,\n\t}\n} = bp;\n\n/**\n * Internal dependencies.\n */\nimport { AVATAR_SIZES, EXTRA_DATA } from './constants';\n\n/**\n * External dependencies.\n */\nconst {\n\treject,\n\tremove,\n\tsortBy,\n} = lodash;\n\nconst getSlugValue = ( item ) => {\n\tif ( item && item.mention_name ) {\n\t\treturn item.mention_name;\n\t}\n\n\treturn null;\n}\n\nconst editMembersBlock = ( { attributes, setAttributes, isSelected } ) => {\n\tconst isAvatarEnabled = isActive( 'members', 'avatar' );\n\tconst isMentionEnabled = isActive( 'activity', 'mentions' );\n\tconst {\n\t\titemIDs,\n\t\tavatarSize,\n\t\tdisplayMentionSlug,\n\t\tdisplayUserName,\n\t\textraData,\n\t\tlayoutPreference,\n\t\tcolumns,\n\t} = attributes;\n\tconst hasMembers = 0 !== itemIDs.length;\n\tconst [ members, setMembers ] = useState( [] );\n\tconst layoutControls = [\n\t\t{\n\t\t\ticon: 'text',\n\t\t\ttitle: __( 'List view', 'buddypress' ),\n\t\t\tonClick: () => setAttributes( { layoutPreference: 'list' } ),\n\t\t\tisActive: layoutPreference === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: 'screenoptions',\n\t\t\ttitle: __( 'Grid view', 'buddypress' ),\n\t\t\tonClick: () => setAttributes( { layoutPreference: 'grid' } ),\n\t\t\tisActive: layoutPreference === 'grid',\n\t\t},\n\t];\n\tlet membersList;\n\tlet containerClasses = 'bp-block-members avatar-' + avatarSize;\n\tlet extraDataOptions = EXTRA_DATA;\n\n\tif ( layoutPreference === 'grid' ) {\n\t\tcontainerClasses += ' is-grid columns-' + columns;\n\t\textraDataOptions = EXTRA_DATA.filter( ( extra ) => {\n\t\t\treturn 'latest_update' !== extra.value;\n\t\t} );\n\t}\n\n\tconst onSelectedMember = ( { itemID } ) => {\n\t\tif ( itemID && -1 === itemIDs.indexOf( itemID ) ) {\n\t\t\tsetAttributes( {\n\t\t\t\titemIDs: [...itemIDs, parseInt( itemID, 10 ) ]\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst onRemoveMember = ( ( itemID ) => {\n\t\tif ( itemID && -1 !== itemIDs.indexOf( itemID ) ) {\n\t\t\tsetMembers( reject( members, ['id', itemID ] ) );\n\t\t\tsetAttributes( {\n\t\t\t\titemIDs: remove( itemIDs, ( value ) => { return value !== itemID } )\n\t\t\t} );\n\t\t}\n\t} );\n\n\tif ( hasMembers && itemIDs.length !== members.length ) {\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( `/buddypress/v1/members`, { populate_extras: true, include: itemIDs } ),\n\t\t} ).then( items => {\n\t\t\tsetMembers(\n\t\t\t\tsortBy( items, [ ( item ) => {\n\t\t\t\t\treturn itemIDs.indexOf( item.id );\n\t\t\t\t} ] )\n\t\t\t);\n\t\t} )\n\t}\n\n\tif ( members.length ) {\n\t\tmembersList = members.map( ( member ) => {\n\t\t\tlet hasActivity = false;\n\t\t\tlet memberItemClasses = 'member-content';\n\n\t\t\tif ( layoutPreference === 'list' && 'latest_update' === extraData && member.latest_update && member.latest_update.rendered ) {\n\t\t\t\thasActivity = true;\n\t\t\t\tmemberItemClasses = 'member-content has-activity';\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div key={ 'bp-member-' + member.id } className={ memberItemClasses }>\n\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t<Tooltip text={ __( 'Remove member', 'buddypress' ) }>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"is-right\"\n\t\t\t\t\t\t\t\tonClick={ () => onRemoveMember( member.id ) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove member', 'buddypress' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Dashicon icon=\"no\"/>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isAvatarEnabled && 'none' !== avatarSize && (\n\t\t\t\t\t\t<div className=\"item-header-avatar\">\n\t\t\t\t\t\t\t<a href={ member.link } target=\"_blank\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tkey={ 'avatar-' + member.id }\n\t\t\t\t\t\t\t\t\tclassName=\"avatar\"\n\t\t\t\t\t\t\t\t\talt={ sprintf( __( 'Profile photo of %s', 'buddypress' ), member.name ) }\n\t\t\t\t\t\t\t\t\tsrc={ member.avatar_urls[ avatarSize ] }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<div className=\"member-description\">\n\t\t\t\t\t\t{ hasActivity && (\n\t\t\t\t\t\t\t<blockquote className=\"wp-block-quote\">\n\t\t\t\t\t\t\t\t<div dangerouslySetInnerHTML={ { __html: member.latest_update.rendered } } />\n\t\t\t\t\t\t\t\t<cite>\n\t\t\t\t\t\t\t\t\t{ displayUserName && (\n\t\t\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t\t\t{ member.name }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t&nbsp;\n\t\t\t\t\t\t\t\t\t{ isMentionEnabled && displayMentionSlug && (\n\t\t\t\t\t\t\t\t\t\t<a href={ member.link } target=\"_blank\">\n\t\t\t\t\t\t\t\t\t\t\t(@{ member.mention_name })\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</cite>\n\t\t\t\t\t\t\t</blockquote>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! hasActivity && displayUserName && (\n\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t<a href={ member.link } target=\"_blank\">\n\t\t\t\t\t\t\t\t\t{ member.name }\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ ! hasActivity && isMentionEnabled && displayMentionSlug && (\n\t\t\t\t\t\t\t<span className=\"user-nicename\">@{ member.mention_name }</span>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ 'last_activity' === extraData && member.last_activity && member.last_activity.date && (\n\t\t\t\t\t\t\t<time dateTime={ member.last_activity.date }>\n\t\t\t\t\t\t\t\t{ sprintf( __( 'Active %s', 'buddypress' ), member.last_activity.timediff ) }\n\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t} );\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display the user name', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! displayUserName }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { displayUserName: ! displayUserName } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tdisplayUserName\n\t\t\t\t\t\t\t\t? __( 'Include the user\\'s display name.', 'buddypress' )\n\t\t\t\t\t\t\t\t: __( 'Toggle to include user\\'s display name.', 'buddypress' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ isMentionEnabled && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display Mention slug', 'buddypress' ) }\n\t\t\t\t\t\t\tchecked={ !! displayMentionSlug }\n\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { displayMentionSlug: ! displayMentionSlug } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tdisplayMentionSlug\n\t\t\t\t\t\t\t\t\t? __( 'Include the user\\'s mention name under their display name.', 'buddypress' )\n\t\t\t\t\t\t\t\t\t: __( 'Toggle to display the user\\'s mention name under their display name.', 'buddypress' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isAvatarEnabled && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size', 'buddypress' ) }\n\t\t\t\t\t\t\tvalue={ avatarSize }\n\t\t\t\t\t\t\toptions={ AVATAR_SIZES }\n\t\t\t\t\t\t\thelp={ __( 'Select \"None\" to disable the avatar.', 'buddypress' ) }\n\t\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { avatarSize: option } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'BuddyPress extra information', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ extraData }\n\t\t\t\t\t\toptions={ extraDataOptions }\n\t\t\t\t\t\thelp={ __( 'Select \"None\" to show no extra information.', 'buddypress' ) }\n\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\tsetAttributes( { extraData: option } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ layoutPreference === 'grid' && (\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Columns', 'buddypress' ) }\n\t\t\t\t\t\t\tvalue={ columns }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { columns: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\tmax={ 4 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ layoutControls } />\n\t\t\t</BlockControls>\n\n\t\t\t{ hasMembers && (\n\t\t\t\t<div className={ containerClasses }>\n\t\t\t\t\t{ membersList }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ ( isSelected || 0 === itemIDs.length ) && (\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ hasMembers ? '' : 'groups' }\n\t\t\t\t\tlabel={ hasMembers ? '' : __( 'BuddyPress Members', 'buddypress' ) }\n\t\t\t\t\tinstructions={ __( 'Start typing the name of the member you want to add to the members list.', 'buddypress' ) }\n\t\t\t\t\tclassName={ 0 !== itemIDs.length ? 'is-appender' : 'is-large' }\n\t\t\t\t>\n\t\t\t\t\t<AutoCompleter\n\t\t\t\t\t\tcomponent=\"members\"\n\t\t\t\t\t\tobjectQueryArgs={ { exclude: itemIDs } }\n\t\t\t\t\t\tslugValue={ getSlugValue }\n\t\t\t\t\t\tariaLabel={ __( 'Member\\'s username', 'buddypress' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Enter Member\\'s username here…', 'buddypress' ) }\n\t\t\t\t\t\tonSelectItem={ onSelectedMember }\n\t\t\t\t\t\tuseAvatar={ isAvatarEnabled }\n\t\t\t\t\t/>\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t</Fragment>\n\t);\n};\n\nexport default editMembersBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editMembersBlock from './members/edit';\n\nregisterBlockType( 'bp/members', {\n\ttitle: __( 'Members', 'buddypress' ),\n\tdescription: __( 'BuddyPress Members.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'groups',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\titemIDs: {\n\t\t\ttype: 'array',\n\t\t\titems: {\n\t\t\t\ttype: 'integer',\n\t\t\t},\n\t\t\tdefault: [],\n\t\t},\n\t\tavatarSize: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'full',\n\t\t},\n\t\tdisplayMentionSlug: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\tdisplayUserName: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\textraData: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'none',\n\t\t},\n\t\tlayoutPreference: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'list',\n\t\t},\n\t\tcolumns: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 2\n\t\t},\n\t},\n\tedit: editMembersBlock,\n} );\n"]}
bp-members/js/blocks/online-members.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"l6vy":[function(require,module,exports) {
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blockEditor.InspectorControls,n=e.components,r=n.Disabled,l=n.PanelBody,o=n.RangeControl,s=n.TextControl,i=e.element,a=i.Fragment,u=i.createElement,b=e.i18n.__,d=bp,m=d.blockComponents.ServerSideRender,p=function(e){var n=e.attributes,i=e.setAttributes,d=n.title,p=n.maxMembers;return u(a,null,u(t,null,u(l,{title:b("Settings","buddypress"),initialOpen:!0},u(s,{label:b("Title","buddypress"),value:d,onChange:function(e){i({title:e})}}),u(o,{label:b("Max members to show","buddypress"),value:p,onChange:function(e){return i({maxMembers:e})},min:1,max:15,required:!0}))),u(r,null,u(m,{block:"bp/online-members",attributes:n})))},c=p;exports.default=c;
3
+ },{}],"VbKe":[function(require,module,exports) {
4
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,r=e.blocks.createBlock,t={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:function(e){var r=e.idBase,t=e.instance;return!(null==t||!t.raw)&&"bp_core_whos_online_widget"===r},transform:function(e){var t=e.instance;return r("bp/online-members",{title:t.raw.title,maxMembers:t.raw.max_members})}}]},o=t;exports.default=o;
5
+ },{}],"to6R":[function(require,module,exports) {
6
+ "use strict";var e=s(require("./online-members/edit")),r=s(require("./online-members/transforms"));function s(e){return e&&e.__esModule?e:{default:e}}var t=wp,n=t.blocks.registerBlockType,i=t.i18n.__;n("bp/online-members",{title:i("Online Members","buddypress"),description:i("Profile photos of online users.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"groups"},category:"buddypress",attributes:{title:{type:"string",default:i("Who's Online","buddypress")},maxMembers:{type:"number",default:15}},edit:e.default,transforms:r.default});
7
+ },{"./online-members/edit":"l6vy","./online-members/transforms":"VbKe"}]},{},["to6R"], null)
8
+ //# sourceMappingURL=/bp-members/js/blocks/online-members.js.map
bp-members/js/blocks/online-members.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-members/js/blocks/online-members/edit.js","bp-members/js/blocks/online-members/transforms.js","bp-members/js/blocks/online-members.js"],"names":["editOnlineMembersBlock","wp","InspectorControls","blockEditor","components","Disabled","PanelBody","RangeControl","TextControl","element","Fragment","createElement","__","i18n","bp","ServerSideRender","blockComponents","attributes","setAttributes","title","maxMembers","text","value","transforms","createBlock","blocks","from","type","isMatch","idBase","instance","raw","transform","max_members","registerBlockType","description","icon","background","foreground","src","category","default","edit"],"mappings":";AAgEeA,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EA7Df,IAiBIC,EAAAA,GAfFC,EADDC,EAAAA,YACCD,kBAEDE,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,aACAC,EAAAA,EAAAA,YAEDC,EAAAA,EAAAA,QACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,cAGAC,EADDC,EAAAA,KACCD,GAWEE,EAAAA,GAFFC,EADDC,EAAAA,gBACCD,iBAIIf,EAAyB,SAAqC,GAAjCiB,IAAAA,EAAAA,EAAAA,WAAYC,EAAAA,EAAAA,cACtCC,EAAsBF,EAAtBE,MAAOC,EAAeH,EAAfG,WAGd,OAAA,EAAC,EACA,KAAA,EAAC,EACA,KAAA,EAAC,EAAD,CAAW,MAAQR,EAAI,WAAY,cAAiB,aAAc,GACjE,EAAC,EAAD,CACC,MAAQA,EAAI,QAAS,cACrB,MAAQO,EACR,SAAW,SAAEE,GACZH,EAAe,CAAEC,MAAOE,OAG1B,EAAC,EAAD,CACC,MAAQT,EAAI,sBAAuB,cACnC,MAAQQ,EACR,SAAW,SAAEE,GACZJ,OAAAA,EAAe,CAAEE,WAAYE,KAE9B,IAAM,EACN,IAAM,GACN,UAAQ,MAIX,EAAC,EACA,KAAA,EAAC,EAAD,CAAkB,MAAM,oBAAoB,WAAaL,OAM9CjB,EAAAA,EAAAA,QAAAA,QAAAA;;AC5BAuB,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAjCf,IAIItB,EAAAA,GAFFuB,EADDC,EAAAA,OACCD,YASID,EAAa,CAClBG,KAAM,CACL,CACCC,KAAM,QACNF,OAAQ,CAAE,sBACVG,QAAS,SAA4B,GAAxBC,IAAAA,EAAAA,EAAAA,OAAQC,EAAAA,EAAAA,SACf,QAAEA,MAAAA,IAAAA,EAAUC,MAIC,+BAAXF,GAERG,UAAW,SAAoB,GAAhBF,IAAAA,EAAAA,EAAAA,SACPN,OAAAA,EAAa,oBAAqB,CACxCL,MAAOW,EAASC,IAAIZ,MACpBC,WAAYU,EAASC,IAAIE,kBAOfV,EAAAA,EAAAA,QAAAA,QAAAA;;AClBf,aAHA,IAAA,EAAA,EAAA,QAAA,0BACA,EAAA,EAAA,QAAA,gCAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAfA,IAOItB,EAAAA,GALFiC,EADDT,EAAAA,OACCS,kBAGAtB,EADDC,EAAAA,KACCD,GAUFsB,EAAmB,oBAAqB,CACvCf,MAAOP,EAAI,iBAAkB,cAC7BuB,YAAavB,EAAI,kCAAmC,cACpDwB,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,UAENC,SAAU,aACVvB,WAAY,CACXE,MAAO,CACNQ,KAAM,SACNc,QAAS7B,EAAI,eAAiB,eAE/BQ,WAAY,CACXO,KAAM,SACNc,QAAS,KAGXC,KAAM1C,EAnBiC,QAoBvCuB,WAAYA,EAAAA","file":"online-members.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tPanelBody,\n\t\tRangeControl,\n\t\tTextControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockComponents: {\n\t\tServerSideRender,\n\t},\n} = bp;\n\nconst editOnlineMembersBlock = ( { attributes, setAttributes } ) => {\n\tconst { title, maxMembers } = attributes;\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( text ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: text } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max members to show', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ maxMembers }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { maxMembers: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ 15 }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/online-members\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editOnlineMembersBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Legacy Widget to Online Members Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_core_whos_online_widget';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\treturn createBlock( 'bp/online-members', {\n\t\t\t\t\ttitle: instance.raw.title,\n\t\t\t\t\tmaxMembers: instance.raw.max_members,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editOnlineMembersBlock from './online-members/edit';\nimport transforms from './online-members/transforms';\n\nregisterBlockType( 'bp/online-members', {\n\ttitle: __( 'Online Members', 'buddypress' ),\n\tdescription: __( 'Profile photos of online users.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'groups',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t\tdefault: __( 'Who\\'s Online', 'buddypress' ),\n\t\t},\n\t\tmaxMembers: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 15\n\t\t},\n\t},\n\tedit: editOnlineMembersBlock,\n\ttransforms: transforms,\n} );\n"]}
bp-members/js/dynamic-members.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"k5We":[function(require,module,exports) {
2
+ function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function n(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function o(t,e,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=c(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(r):o.value}})(t,e,r||t)}function c(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=f();return function(){var r,n=p(t);if(e){var o=p(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return a(this,r)}}function a(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?l(e):r}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=wp,d=y.i18n,b=d.__,v=d.sprintf,m=bp,g=m.dynamicWidgetBlock,h=function(t){i(c,g);var r=s(c);function c(){return e(this,c),r.apply(this,arguments)}return n(c,[{key:"loop",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"active",n=o(p(c.prototype),"useTemplate",this).call(this,"bp-dynamic-members-item"),i=document.querySelector("#"+e),u="";t&&t.length?t.forEach(function(t){if("active"===r&&t.last_activity)t.extra=v(b("Active %s","buddypress"),t.last_activity.timediff);else if("popular"===r&&t.total_friend_count){var e=parseInt(t.total_friend_count,10);t.extra=0===e?b("No friends","buddypress"):1===e?b("1 friend","buddypress"):v(b("%s friends","buddypress"),t.total_friend_count)}else"newest"===r&&t.registered_since&&(t.extra=v(b("Registered %s","buddypress"),t.registered_since));t.avatar_alt=v(b("Profile picture of %s","buddypress"),t.name),u+=n(t)}):u='<div class="widget-error">'+b("No members found.","buddypress")+"</div>",i.innerHTML=u}},{key:"start",value:function(){var t=this;this.blocks.forEach(function(e,r){var n=e.selector,i=e.query_args.type,u=document.querySelector("#"+n).closest(".bp-dynamic-block-container");o(p(c.prototype),"getItems",t).call(t,i,r),u.querySelectorAll(".item-options a").forEach(function(e){e.addEventListener("click",function(e){e.preventDefault(),e.target.closest(".item-options").querySelector(".selected").classList.remove("selected"),e.target.classList.add("selected");var n=e.target.getAttribute("data-bp-sort");n!==t.blocks[r].query_args.type&&o(p(c.prototype),"getItems",t).call(t,n,r)})})})}}]),c}(),_=window.bpDynamicMembersSettings||{},w=window.bpDynamicMembersBlocks||{},O=new h(_,w);"loading"===document.readyState?document.addEventListener("DOMContentLoaded",O.start()):O.start();
3
+ },{}]},{},["k5We"], null)
4
+ //# sourceMappingURL=/bp-members/js/dynamic-members.js.map
bp-members/js/dynamic-members.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-members/js/dynamic-members.js"],"names":["wp","i18n","__","sprintf","bp","dynamicWidgetBlock","bpMembersWidgetBlock","members","container","type","tmpl","selector","document","querySelector","output","length","forEach","member","last_activity","extra","timediff","total_friend_count","friendsCount","parseInt","registered_since","avatar_alt","name","innerHTML","blocks","block","i","query_args","list","closest","querySelectorAll","navItem","addEventListener","event","preventDefault","target","classList","remove","add","newType","getAttribute","settings","window","bpDynamicMembersSettings","bpDynamicMembersBlocks","bpDynamicMembers","readyState","start"],"mappings":";AAkGC,SAAA,EAAA,GAAA,OAAA,EAAA,mBAAA,QAAA,iBAAA,OAAA,SAAA,SAAA,GAAA,cAAA,GAAA,SAAA,GAAA,OAAA,GAAA,mBAAA,QAAA,EAAA,cAAA,QAAA,IAAA,OAAA,UAAA,gBAAA,IAAA,GAAA,SAAA,EAAA,EAAA,GAAA,KAAA,aAAA,GAAA,MAAA,IAAA,UAAA,qCAAA,SAAA,EAAA,EAAA,GAAA,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,OAAA,IAAA,CAAA,IAAA,EAAA,EAAA,GAAA,EAAA,WAAA,EAAA,aAAA,EAAA,EAAA,cAAA,EAAA,UAAA,IAAA,EAAA,UAAA,GAAA,OAAA,eAAA,EAAA,EAAA,IAAA,IAAA,SAAA,EAAA,EAAA,EAAA,GAAA,OAAA,GAAA,EAAA,EAAA,UAAA,GAAA,GAAA,EAAA,EAAA,GAAA,EAAA,SAAA,EAAA,EAAA,EAAA,GAAA,OAAA,EAAA,oBAAA,SAAA,QAAA,IAAA,QAAA,IAAA,SAAA,EAAA,EAAA,GAAA,IAAA,EAAA,EAAA,EAAA,GAAA,GAAA,EAAA,CAAA,IAAA,EAAA,OAAA,yBAAA,EAAA,GAAA,OAAA,EAAA,IAAA,EAAA,IA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a,EAAOC,GACrBnB,IAAAA,EAAakB,EAAblB,SACAF,EAASoB,EAAME,WAAftB,KACFuB,EAAOpB,SAASC,cAAe,IAAMF,GAAWsB,QAAS,+BAG/CxB,EAAAA,EAAAA,EAAAA,WAAAA,WAAAA,GAAAA,KAAAA,EAAAA,EAAMqB,GAGtBE,EAAKE,iBAAkB,mBAAoBlB,QAAS,SAAEmB,GACrDA,EAAQC,iBAAkB,QAAS,SAAEC,GACpCA,EAAMC,iBAGND,EAAME,OAAON,QAAS,iBAAkBpB,cAAe,aAAc2B,UAAUC,OAAQ,YACvFJ,EAAME,OAAOC,UAAUE,IAAK,YAEtBC,IAAAA,EAAUN,EAAME,OAAOK,aAAc,gBAEtCD,IAAY,EAAKf,OAAQE,GAAIC,WAAWtB,MAC5BkC,EAAAA,EAAAA,EAAAA,WAAAA,WAAAA,GAAAA,KAAAA,EAAAA,EAASb,aAgB9B,EA5EKxB,GAoEAuC,EAAWC,OAAOC,0BAA4B,GAC9CnB,EAASkB,OAAOE,wBAA0B,GAC1CC,EAAmB,IAAI3C,EAAsBuC,EAAUjB,GAExD,YAAchB,SAASsC,WAC3BtC,SAASwB,iBAAkB,mBAAoBa,EAAiBE,SAEhEF,EAAiBE","file":"dynamic-members.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t\tsprintf,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tdynamicWidgetBlock,\n} = bp;\n\n/**\n * Front-end Dynamic Members Widget Block class.\n *\n * @since 9.0.0\n */\nclass bpMembersWidgetBlock extends dynamicWidgetBlock {\n\tloop( members = [], container = '', type = 'active' ) {\n\t\tconst tmpl = super.useTemplate( 'bp-dynamic-members-item' );\n\t\tconst selector = document.querySelector( '#' + container );\n\t\tlet output = '';\n\n\t\tif ( members && members.length ) {\n\t\t\tmembers.forEach( ( member ) => {\n\t\t\t\tif ( 'active' === type && member.last_activity ) {\n\t\t\t\t\t/* translators: %s: a human time diff. */\n\t\t\t\t\tmember.extra = sprintf( __( 'Active %s', 'buddypress' ), member.last_activity.timediff );\n\t\t\t\t} else if ( 'popular' === type && member.total_friend_count ) {\n\t\t\t\t\tconst friendsCount = parseInt( member.total_friend_count, 10 );\n\n\t\t\t\t\tif ( 0 === friendsCount ) {\n\t\t\t\t\t\tmember.extra = __( 'No friends', 'buddypress' );\n\t\t\t\t\t} else if ( 1 === friendsCount ) {\n\t\t\t\t\t\tmember.extra = __( '1 friend', 'buddypress' );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* translators: %s: total friend count (more than 1). */\n\t\t\t\t\t\tmember.extra = sprintf( __( '%s friends', 'buddypress' ), member.total_friend_count );\n\t\t\t\t\t}\n\t\t\t\t} else if ( 'newest' === type && member.registered_since ) {\n\t\t\t\t\t/* translators: %s is time elapsed since the registration date happened */\n\t\t\t\t\tmember.extra = sprintf( __( 'Registered %s', 'buddypress' ), member.registered_since );\n\t\t\t\t}\n\n\t\t\t\t/* translators: %s: member name */\n\t\t\t\tmember.avatar_alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), member.name );\n\n\t\t\t\toutput += tmpl( member );\n\t\t\t} );\n\t\t} else {\n\t\t\toutput = '<div class=\"widget-error\">' + __( 'No members found.', 'buddypress' ) + '</div>';\n\t\t}\n\n\t\tselector.innerHTML = output;\n\t}\n\n\tstart() {\n\t\tthis.blocks.forEach( ( block, i ) => {\n\t\t\tconst { selector } = block;\n\t\t\tconst { type } = block.query_args;\n\t\t\tconst list = document.querySelector( '#' + selector ).closest( '.bp-dynamic-block-container' );\n\n\t\t\t// Get default Block's type members.\n\t\t\tsuper.getItems( type, i );\n\n\t\t\t// Listen to Block's Nav item clics\n\t\t\tlist.querySelectorAll( '.item-options a' ).forEach( ( navItem ) => {\n\t\t\t\tnavItem.addEventListener( 'click', ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t// Changes the displayed filter.\n\t\t\t\t\tevent.target.closest( '.item-options' ).querySelector( '.selected' ).classList.remove( 'selected' );\n\t\t\t\t\tevent.target.classList.add( 'selected' );\n\n\t\t\t\t\tconst newType = event.target.getAttribute( 'data-bp-sort' );\n\n\t\t\t\t\tif ( newType !== this.blocks[ i ].query_args.type ) {\n\t\t\t\t\t\tsuper.getItems( newType, i );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\t}\n}\n\nconst settings = window.bpDynamicMembersSettings || {};\nconst blocks = window.bpDynamicMembersBlocks || {};\nconst bpDynamicMembers = new bpMembersWidgetBlock( settings, blocks );\n\nif ( 'loading' === document.readyState ) {\n\tdocument.addEventListener( 'DOMContentLoaded', bpDynamicMembers.start() );\n} else {\n\tbpDynamicMembers.start();\n}\n"]}
bp-members/sass/blocks/dynamic-members.scss ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .bp-dynamic-block-container {
2
+
3
+ .item-options {
4
+ font-size: 0.5em;
5
+ margin: 0 0 1em;
6
+ padding: 1em 0;
7
+
8
+ a.selected {
9
+ font-weight: 600;
10
+ }
11
+ }
12
+
13
+ ul.item-list {
14
+ list-style: none;
15
+ margin: 1em 0;
16
+
17
+ li {
18
+ margin-bottom: 1em;
19
+
20
+ &:before,
21
+ &:after {
22
+ content: " ";
23
+ display: table;
24
+ }
25
+
26
+ &:after {
27
+ clear: both;
28
+ }
29
+
30
+ .item-avatar {
31
+ float: left;
32
+ width: 60px;
33
+ }
34
+
35
+ .item {
36
+ margin-left: 70px;
37
+ }
38
+ }
39
+ }
40
+ }
bp-members/sass/blocks/member-avatar-blocks.scss ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // BP Who's online & active members blocks.
2
+ [data-type="bp/active-members"],
3
+ [data-type="bp/online-members"] {
4
+
5
+ .avatar-block {
6
+ display: flex;
7
+ flex-flow: row wrap;
8
+
9
+ img {
10
+ margin: 0.5em;
11
+ }
12
+ }
13
+ }
bp-messages/actions/notices.php CHANGED
@@ -91,4 +91,48 @@ function bp_messages_action_edit_notice() {
91
 
92
  bp_core_redirect( $redirect_to );
93
  }
94
- add_action( 'bp_actions', 'bp_messages_action_edit_notice' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  bp_core_redirect( $redirect_to );
93
  }
94
+ add_action( 'bp_actions', 'bp_messages_action_edit_notice' );
95
+
96
+ /**
97
+ * Handle user dismissal of sitewide notices.
98
+ *
99
+ * @since 9.0.0
100
+ *
101
+ * @return bool False on failure.
102
+ */
103
+ function bp_messages_action_dismiss_notice() {
104
+
105
+ // Bail if not viewing a notice dismissal URL.
106
+ if ( ! bp_is_messages_component() || ! bp_is_current_action( 'notices' ) || 'dismiss' !== sanitize_key( bp_action_variable( 0 ) ) ) {
107
+ return false;
108
+ }
109
+
110
+ // Bail if the current user isn't logged in.
111
+ if ( ! is_user_logged_in() ) {
112
+ return false;
113
+ }
114
+
115
+ // Check the nonce.
116
+ check_admin_referer( 'messages_dismiss_notice' );
117
+
118
+ // Dismiss the notice.
119
+ $success = bp_messages_dismiss_sitewide_notice();
120
+
121
+ // User feedback.
122
+ if ( $success ) {
123
+ $feedback = __( 'Notice has been dismissed.', 'buddypress' );
124
+ $type = 'success';
125
+ } else {
126
+ $feedback = __( 'There was a problem dismissing the notice.', 'buddypress');
127
+ $type = 'error';
128
+ }
129
+
130
+ // Add feedback message.
131
+ bp_core_add_message( $feedback, $type );
132
+
133
+ // Redirect.
134
+ $redirect_to = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() );
135
+
136
+ bp_core_redirect( $redirect_to );
137
+ }
138
+ add_action( 'bp_actions', 'bp_messages_action_dismiss_notice' );
bp-messages/bp-messages-blocks.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BP Messages Blocks Functions.
4
+ *
5
+ * @package BuddyPress
6
+ * @subpackage MessagesBlocks
7
+ * @since 9.0.0
8
+ */
9
+
10
+ // Exit if accessed directly.
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ /**
16
+ * Callback function to render the BP Sitewide Notices Block.
17
+ *
18
+ * @since 9.0.0
19
+ *
20
+ * @param array $attributes The block attributes.
21
+ * @return string HTML output.
22
+ */
23
+ function bp_messages_render_sitewide_notices_block( $attributes = array() ) {
24
+ $block_args = bp_parse_args(
25
+ $attributes,
26
+ array(
27
+ 'title' => '',
28
+ ),
29
+ 'widget_object_sitewide_messages'
30
+ );
31
+
32
+ if ( ! is_user_logged_in() ) {
33
+ return;
34
+ }
35
+
36
+ $feedback_tpl = '<div class="components-placeholder">' . "\n";
37
+ $feedback_tpl .= '<div class="components-placeholder__label">%1$s</div>' . "\n";
38
+ $feedback_tpl .= '<div class="components-placeholder__fieldset">%2$s</div>' . "\n";
39
+ $feedback_tpl .= '</div>';
40
+
41
+ // Don't display the block if there are no Notices to show.
42
+ $notice = \BP_Messages_Notice::get_active();
43
+ if ( empty( $notice->id ) ) {
44
+ // Previewing the Block inside the editor.
45
+ if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
46
+ return sprintf(
47
+ $feedback_tpl,
48
+ esc_html__( 'Preview unavailable', 'buddypress' ),
49
+ esc_html__( 'No active sitewide notices.', 'buddypress' )
50
+ );
51
+ }
52
+
53
+ return;
54
+ }
55
+
56
+ // Only enqueue common/specific scripts and data once per page load.
57
+ if ( ! wp_script_is( 'bp-sitewide-notices-script', 'enqueued' ) ) {
58
+ $path = sprintf(
59
+ '/%1$s/%2$s/sitewide-notices/',
60
+ bp_rest_namespace(),
61
+ bp_rest_version()
62
+ );
63
+ wp_enqueue_script( 'bp-sitewide-notices-script' );
64
+ wp_localize_script(
65
+ 'bp-sitewide-notices-script',
66
+ 'bpSitewideNoticeBlockSettings',
67
+ array(
68
+ 'path' => ltrim( $path, '/' ),
69
+ 'dismissPath' => ltrim( $path, '/' ) . 'dismiss',
70
+ 'root' => esc_url_raw( get_rest_url() ),
71
+ 'nonce' => wp_create_nonce( 'wp_rest' ),
72
+ )
73
+ );
74
+ }
75
+
76
+ $closed_notices = (array) bp_get_user_meta( bp_loggedin_user_id(), 'closed_notices', true );
77
+
78
+ if ( in_array( $notice->id, $closed_notices, true ) ) {
79
+ // Previewing the Block inside the editor.
80
+ if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
81
+ return sprintf(
82
+ $feedback_tpl,
83
+ esc_html__( 'Preview unavailable', 'buddypress' ),
84
+ esc_html__( 'You dismissed the sitewide notice.', 'buddypress' )
85
+ );
86
+ }
87
+
88
+ return;
89
+ }
90
+
91
+ // There is an active, non-dismissed notice to show.
92
+ $title = $block_args['title'];
93
+
94
+ $classnames = 'widget_bp_core_sitewide_messages buddypress widget';
95
+ $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
96
+
97
+ $widget_content = '<div class="bp-sitewide-notice-block">';
98
+
99
+ if ( $title ) {
100
+ $widget_content .= sprintf(
101
+ '<h2 class="widget-title">%s</h2>',
102
+ esc_html( $title )
103
+ );
104
+ }
105
+
106
+ $widget_content .= sprintf(
107
+ '<div class="bp-sitewide-notice-message info bp-notice" rel="n-%1$d">
108
+ <strong>%2$s</strong>
109
+ <a href="%3$s" class="bp-tooltip button dismiss-notice" data-bp-tooltip="%4$s" data-bp-sitewide-notice-id="%5$d"><span class="bp-screen-reader-text">%6$s</span> <span aria-hidden="true">&#x2716;</span></a>
110
+ %7$s
111
+ </div>',
112
+ esc_attr( $notice->id ),
113
+ bp_get_message_notice_subject( $notice ),
114
+ esc_url( bp_get_message_notice_dismiss_link() ),
115
+ esc_attr__( 'Dismiss this notice', 'buddypress' ),
116
+ esc_attr( $notice->id ),
117
+ esc_html__( 'Dismiss this notice', 'buddypress' ),
118
+ bp_get_message_notice_text( $notice )
119
+ );
120
+
121
+ $widget_content .= '</div>';
122
+
123
+ if ( ! did_action( 'dynamic_sidebar_before' ) ) {
124
+ return sprintf(
125
+ '<div %1$s>%2$s</div>',
126
+ $wrapper_attributes,
127
+ $widget_content
128
+ );
129
+ }
130
+
131
+ return $widget_content;
132
+ }
bp-messages/bp-messages-cssjs.php CHANGED
@@ -73,3 +73,22 @@ function messages_autocomplete_init_jsblock() {
73
 
74
  <?php
75
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  <?php
75
  }
76
+
77
+ /**
78
+ * Registers a new script to manage the dismissal action for the Sitewide notice widget/block.
79
+ *
80
+ * @since 9.0.0
81
+ *
82
+ * @param array $scripts Data about the scripts to register.
83
+ * @return array Data about the scripts to register.
84
+ */
85
+ function bp_messages_register_scripts( $scripts = array() ) {
86
+ $scripts['bp-sitewide-notices-script'] = array(
87
+ 'file' => plugins_url( 'js/sitewide-notices.js', __FILE__ ),
88
+ 'dependencies' => array(),
89
+ 'footer' => true,
90
+ );
91
+
92
+ return $scripts;
93
+ }
94
+ add_filter( 'bp_core_register_common_scripts', 'bp_messages_register_scripts', 9, 1 );
bp-messages/bp-messages-functions.php CHANGED
@@ -324,12 +324,15 @@ function messages_check_thread_access( $thread_id, $user_id = 0 ) {
324
  *
325
  * Wrapper for {@link BP_Messages_Thread::mark_as_read()}.
326
  *
327
- * @param int $thread_id ID of the thread.
 
 
 
328
  *
329
  * @return false|int Number of threads marked as read or false on error.
330
  */
331
- function messages_mark_thread_read( $thread_id ) {
332
- return BP_Messages_Thread::mark_as_read( $thread_id );
333
  }
334
 
335
  /**
@@ -337,12 +340,15 @@ function messages_mark_thread_read( $thread_id ) {
337
  *
338
  * Wrapper for {@link BP_Messages_Thread::mark_as_unread()}.
339
  *
340
- * @param int $thread_id ID of the thread.
 
 
 
341
  *
342
  * @return false|int Number of threads marked as unread or false on error.
343
  */
344
- function messages_mark_thread_unread( $thread_id ) {
345
- return BP_Messages_Thread::mark_as_unread( $thread_id );
346
  }
347
 
348
  /**
@@ -733,3 +739,57 @@ function bp_messages_personal_data_exporter( $email_address, $page ) {
733
  'done' => true,
734
  );
735
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  *
325
  * Wrapper for {@link BP_Messages_Thread::mark_as_read()}.
326
  *
327
+ * @since 9.0.0 Added the `user_id` parameter.
328
+ *
329
+ * @param int $thread_id The message thread ID.
330
+ * @param int $user_id Optional. The user the thread will be marked as read.
331
  *
332
  * @return false|int Number of threads marked as read or false on error.
333
  */
334
+ function messages_mark_thread_read( $thread_id, $user_id = 0 ) {
335
+ return BP_Messages_Thread::mark_as_read( $thread_id, $user_id );
336
  }
337
 
338
  /**
340
  *
341
  * Wrapper for {@link BP_Messages_Thread::mark_as_unread()}.
342
  *
343
+ * @since 9.0.0 Added the `user_id` parameter.
344
+ *
345
+ * @param int $thread_id The message thread ID.
346
+ * @param int $user_id Optional. The user the thread will be marked as unread.
347
  *
348
  * @return false|int Number of threads marked as unread or false on error.
349
  */
350
+ function messages_mark_thread_unread( $thread_id, $user_id = 0 ) {
351
+ return BP_Messages_Thread::mark_as_unread( $thread_id, $user_id );
352
  }
353
 
354
  /**
739
  'done' => true,
740
  );
741
  }
742
+
743
+ /**
744
+ * Dismiss a sitewide notice for a user.
745
+ *
746
+ * @since 9.0.0
747
+ *
748
+ * @param int $user_id ID of the user to dismiss the notice for.
749
+ * Defaults to the logged-in user.
750
+ * @param int $notice_id ID of the notice to be dismissed.
751
+ * Defaults to the currently active notice.
752
+ * @return bool False on failure, true if notice is dismissed
753
+ * (or was already dismissed).
754
+ */
755
+ function bp_messages_dismiss_sitewide_notice( $user_id = 0, $notice_id = 0 ) {
756
+ $retval = false;
757
+ if ( ! $user_id ) {
758
+ $user_id = bp_loggedin_user_id();
759
+ }
760
+
761
+ // Bail if no user is set.
762
+ if ( ! $user_id ) {
763
+ return $retval;
764
+ }
765
+
766
+ if ( $notice_id ) {
767
+ $notice = new BP_Messages_Notice( $notice_id );
768
+ } else {
769
+ $notice = BP_Messages_Notice::get_active();
770
+ }
771
+
772
+ // Bail if no notice is set.
773
+ if ( empty( $notice->id ) ) {
774
+ return $retval;
775
+ }
776
+
777
+ // Fetch the user's closed notices and add the new item.
778
+ $closed_notices = (array) bp_get_user_meta( $user_id, 'closed_notices', true );
779
+ $closed_notices = array_filter( $closed_notices );
780
+
781
+ if ( in_array( (int) $notice->id, $closed_notices, true ) ) {
782
+ // The notice has already been dismissed, so there's nothing to do.
783
+ $retval = true;
784
+ } else {
785
+ // Add the notice to the closed_notices meta.
786
+ $closed_notices[] = (int) $notice->id;
787
+ $closed_notices = array_map( 'absint', array_unique( $closed_notices ) );
788
+ $success = bp_update_user_meta( $user_id, 'closed_notices', $closed_notices );
789
+
790
+ // The return value from update_user_meta() could be an integer or a boolean.
791
+ $retval = (bool) $success;
792
+ }
793
+
794
+ return $retval;
795
+ }
bp-messages/bp-messages-template.php CHANGED
@@ -1310,6 +1310,35 @@ function bp_message_activate_deactivate_text() {
1310
  return apply_filters( 'bp_message_activate_deactivate_text', $text );
1311
  }
1312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1313
  /**
1314
  * Output the messages component slug.
1315
  *
@@ -1359,7 +1388,7 @@ function bp_message_get_notices() {
1359
  ?>
1360
  <div id="message" class="info notice" rel="n-<?php echo esc_attr( $notice->id ); ?>">
1361
  <strong><?php bp_message_notice_subject( $notice ); ?></strong>
1362
- <button type="button" id="close-notice" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( 'Dismiss this notice', 'buddypress' ) ?>"><span class="bp-screen-reader-text"><?php _e( 'Dismiss this notice', 'buddypress' ) ?></span> <span aria-hidden="true">&Chi;</span></button>
1363
  <?php bp_message_notice_text( $notice ); ?>
1364
  <?php wp_nonce_field( 'bp_messages_close_notice', 'close-notice-nonce' ); ?>
1365
  </div>
1310
  return apply_filters( 'bp_message_activate_deactivate_text', $text );
1311
  }
1312
 
1313
+ /**
1314
+ * Output the URL for dismissing the current notice for the current user.
1315
+ *
1316
+ * @since 9.0.0
1317
+ * @return string URL for dismissing the current notice for the current user.
1318
+ */
1319
+ function bp_message_notice_dismiss_link() {
1320
+ echo esc_url( bp_get_message_notice_dismiss_link() );
1321
+ }
1322
+ /**
1323
+ * Get the URL for dismissing the current notice for the current user.
1324
+ *
1325
+ * @since 9.0.0
1326
+ * @return string URL for dismissing the current notice for the current user.
1327
+ */
1328
+ function bp_get_message_notice_dismiss_link() {
1329
+
1330
+ $link = wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices/dismiss/' ), 'messages_dismiss_notice' );
1331
+
1332
+ /**
1333
+ * Filters the URL for dismissing the current notice for the current user.
1334
+ *
1335
+ * @since 9.0.0
1336
+ *
1337
+ * @param string $link URL for dismissing the current notice.
1338
+ */
1339
+ return apply_filters( 'bp_get_message_notice_dismiss_link', $link );
1340
+ }
1341
+
1342
  /**
1343
  * Output the messages component slug.
1344
  *
1388
  ?>
1389
  <div id="message" class="info notice" rel="n-<?php echo esc_attr( $notice->id ); ?>">
1390
  <strong><?php bp_message_notice_subject( $notice ); ?></strong>
1391
+ <a href="<?php bp_message_notice_dismiss_link(); ?>" id="close-notice" class="bp-tooltip button" data-bp-tooltip="<?php esc_attr_e( 'Dismiss this notice', 'buddypress' ) ?>"><span class="bp-screen-reader-text"><?php _e( 'Dismiss this notice', 'buddypress' ) ?></span> <span aria-hidden="true">&Chi;</span></a>
1392
  <?php bp_message_notice_text( $notice ); ?>
1393
  <?php wp_nonce_field( 'bp_messages_close_notice', 'close-notice-nonce' ); ?>
1394
  </div>
bp-messages/classes/class-bp-messages-component.php CHANGED
@@ -62,6 +62,7 @@ class BP_Messages_Component extends BP_Component {
62
  'template',
63
  'functions',
64
  'widgets',
 
65
  );
66
 
67
  // Conditional includes.
@@ -445,4 +446,42 @@ class BP_Messages_Component extends BP_Component {
445
  public function rest_api_init( $controllers = array() ) {
446
  parent::rest_api_init( array( 'BP_REST_Messages_Endpoint' ) );
447
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
  }
62
  'template',
63
  'functions',
64
  'widgets',
65
+ 'blocks',
66
  );
67
 
68
  // Conditional includes.
446
  public function rest_api_init( $controllers = array() ) {
447
  parent::rest_api_init( array( 'BP_REST_Messages_Endpoint' ) );
448
  }
449
+
450
+ /**
451
+ * Register the BP Messages Blocks.
452
+ *
453
+ * @since 9.0.0
454
+ *
455
+ * @param array $blocks Optional. See BP_Component::blocks_init() for
456
+ * description.
457
+ */
458
+ public function blocks_init( $blocks = array() ) {
459
+ parent::blocks_init(
460
+ array(
461
+ 'bp/sitewide-notices' => array(
462
+ 'name' => 'bp/sitewide-notices',
463
+ 'editor_script' => 'bp-sitewide-notices-block',
464
+ 'editor_script_url' => plugins_url( 'js/blocks/sitewide-notices.js', dirname( __FILE__ ) ),
465
+ 'editor_script_deps' => array(
466
+ 'wp-blocks',
467
+ 'wp-element',
468
+ 'wp-components',
469
+ 'wp-i18n',
470
+ 'wp-block-editor',
471
+ 'bp-block-data',
472
+ 'bp-block-components',
473
+ ),
474
+ 'style' => 'bp-sitewide-notices-block',
475
+ 'style_url' => plugins_url( 'css/blocks/sitewide-notices.css', dirname( __FILE__ ) ),
476
+ 'attributes' => array(
477
+ 'title' => array(
478
+ 'type' => 'string',
479
+ 'default' => '',
480
+ ),
481
+ ),
482
+ 'render_callback' => 'bp_messages_render_sitewide_notices_block',
483
+ ),
484
+ )
485
+ );
486
+ }
487
  }
bp-messages/classes/class-bp-messages-sitewide-notices-widget.php CHANGED
@@ -19,6 +19,9 @@ class BP_Messages_Sitewide_Notices_Widget extends WP_Widget {
19
 
20
  /**
21
  * Constructor method.
 
 
 
22
  */
23
  function __construct() {
24
  parent::__construct(
@@ -28,6 +31,7 @@ class BP_Messages_Sitewide_Notices_Widget extends WP_Widget {
28
  'classname' => 'widget_bp_core_sitewide_messages buddypress widget',
29
  'description' => __( 'Display Sitewide Notices posted by the site administrator', 'buddypress' ),
30
  'customize_selective_refresh' => true,
 
31
  )
32
  );
33
  }
19
 
20
  /**
21
  * Constructor method.
22
+ *
23
+ * @since 1.9.0
24
+ * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options.
25
  */
26
  function __construct() {
27
  parent::__construct(
31
  'classname' => 'widget_bp_core_sitewide_messages buddypress widget',
32
  'description' => __( 'Display Sitewide Notices posted by the site administrator', 'buddypress' ),
33
  'customize_selective_refresh' => true,
34
+ 'show_instance_in_rest' => true,
35
  )
36
  );
37
  }
bp-messages/classes/class-bp-messages-thread.php CHANGED
@@ -612,18 +612,22 @@ class BP_Messages_Thread {
612
  * Mark a thread as read.
613
  *
614
  * @since 1.0.0
 
615
  *
616
  * @param int $thread_id The message thread ID.
 
617
  *
618
  * @return false|int Number of threads marked as read or false on error.
619
  */
620
- public static function mark_as_read( $thread_id = 0 ) {
621
  global $wpdb;
622
 
623
- $user_id =
624
- bp_displayed_user_id() ?
625
- bp_displayed_user_id() :
626
- bp_loggedin_user_id();
 
 
627
 
628
  $bp = buddypress();
629
  $retval = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 0 WHERE user_id = %d AND thread_id = %d", $user_id, $thread_id ) );
@@ -635,10 +639,12 @@ class BP_Messages_Thread {
635
  * Fires when messages thread was marked as read.
636
  *
637
  * @since 2.8.0
 
638
  *
639
  * @param int $thread_id The message thread ID.
 
640
  */
641
- do_action( 'messages_thread_mark_as_read', $thread_id );
642
 
643
  return $retval;
644
  }
@@ -647,18 +653,22 @@ class BP_Messages_Thread {
647
  * Mark a thread as unread.
648
  *
649
  * @since 1.0.0
 
650
  *
651
  * @param int $thread_id The message thread ID.
 
652
  *
653
  * @return false|int Number of threads marked as unread or false on error.
654
  */
655
- public static function mark_as_unread( $thread_id = 0 ) {
656
  global $wpdb;
657
 
658
- $user_id =
659
- bp_displayed_user_id() ?
660
- bp_displayed_user_id() :
661
- bp_loggedin_user_id();
 
 
662
 
663
  $bp = buddypress();
664
  $retval = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 1 WHERE user_id = %d AND thread_id = %d", $user_id, $thread_id ) );
@@ -670,10 +680,12 @@ class BP_Messages_Thread {
670
  * Fires when messages thread was marked as unread.
671
  *
672
  * @since 2.8.0
 
673
  *
674
  * @param int $thread_id The message thread ID.
 
675
  */
676
- do_action( 'messages_thread_mark_as_unread', $thread_id );
677
 
678
  return $retval;
679
  }
612
  * Mark a thread as read.
613
  *
614
  * @since 1.0.0
615
+ * @since 9.0.0 Added the `user_id` parameter.
616
  *
617
  * @param int $thread_id The message thread ID.
618
+ * @param int $user_id The user the thread will be marked as read.
619
  *
620
  * @return false|int Number of threads marked as read or false on error.
621
  */
622
+ public static function mark_as_read( $thread_id = 0, $user_id = 0 ) {
623
  global $wpdb;
624
 
625
+ if ( empty( $user_id ) ) {
626
+ $user_id =
627
+ bp_displayed_user_id() ?
628
+ bp_displayed_user_id() :
629
+ bp_loggedin_user_id();
630
+ }
631
 
632
  $bp = buddypress();
633
  $retval = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 0 WHERE user_id = %d AND thread_id = %d", $user_id, $thread_id ) );
639
  * Fires when messages thread was marked as read.
640
  *
641
  * @since 2.8.0
642
+ * @since 9.0.0 Added the `user_id` parameter.
643
  *
644
  * @param int $thread_id The message thread ID.
645
+ * @param int $user_id The user the thread will be marked as read.
646
  */
647
+ do_action( 'messages_thread_mark_as_read', $thread_id, $user_id );
648
 
649
  return $retval;
650
  }
653
  * Mark a thread as unread.
654
  *
655
  * @since 1.0.0
656
+ * @since 9.0.0 Added the `user_id` parameter.
657
  *
658
  * @param int $thread_id The message thread ID.
659
+ * @param int $user_id The user the thread will be marked as unread.
660
  *
661
  * @return false|int Number of threads marked as unread or false on error.
662
  */
663
+ public static function mark_as_unread( $thread_id = 0, $user_id = 0 ) {
664
  global $wpdb;
665
 
666
+ if ( empty( $user_id ) ) {
667
+ $user_id =
668
+ bp_displayed_user_id() ?
669
+ bp_displayed_user_id() :
670
+ bp_loggedin_user_id();
671
+ }
672
 
673
  $bp = buddypress();
674
  $retval = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET unread_count = 1 WHERE user_id = %d AND thread_id = %d", $user_id, $thread_id ) );
680
  * Fires when messages thread was marked as unread.
681
  *
682
  * @since 2.8.0
683
+ * @since 9.0.0 Added the `user_id` parameter.
684
  *
685
  * @param int $thread_id The message thread ID.
686
+ * @param int $user_id The user the thread will be marked as unread.
687
  */
688
+ do_action( 'messages_thread_mark_as_unread', $thread_id, $user_id );
689
 
690
  return $retval;
691
  }
bp-messages/classes/class-bp-rest-messages-endpoint.php CHANGED
@@ -116,12 +116,12 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
116
  */
117
  public function get_items( $request ) {
118
  $args = array(
119
- 'user_id' => $request['user_id'],
120
- 'box' => $request['box'],
121
- 'type' => $request['type'],
122
- 'page' => $request['page'],
123
- 'per_page' => $request['per_page'],
124
- 'search_terms' => $request['search'],
125
  );
126
 
127
  // Include the meta_query for starred messages.
@@ -189,7 +189,7 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
189
  );
190
 
191
  if ( is_user_logged_in() ) {
192
- $user = bp_rest_get_user( $request['user_id'] );
193
 
194
  if ( ! $user instanceof WP_User ) {
195
  $retval = new WP_Error(
@@ -232,8 +232,12 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
232
  * @return WP_REST_Response
233
  */
234
  public function get_item( $request ) {
235
- $thread = $this->get_thread_object( $request['id'] );
 
 
 
236
 
 
237
  $retval = array(
238
  $this->prepare_response_for_collection(
239
  $this->prepare_item_for_response( $thread, $request )
@@ -247,9 +251,9 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
247
  *
248
  * @since 5.0.0
249
  *
250
- * @param BP_Messages_Thread $thread Thread object.
251
- * @param WP_REST_Response $retval The response data.
252
- * @param WP_REST_Request $request The request sent to the API.
253
  */
254
  do_action( 'bp_rest_messages_get_item', $thread, $response, $request );
255
 
@@ -265,19 +269,24 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
265
  * @return true|WP_Error
266
  */
267
  public function get_item_permissions_check( $request ) {
268
- $error = new WP_Error(
269
  'bp_rest_authorization_required',
270
  __( 'Sorry, you are not allowed to see this thread.', 'buddypress' ),
271
  array(
272
  'status' => rest_authorization_required_code(),
273
  )
274
  );
275
- $retval = $error;
 
 
 
 
 
276
 
277
  if ( is_user_logged_in() ) {
278
- $thread = $this->get_thread_object( $request['id'] );
279
 
280
- if ( empty( $thread->thread_id ) ) {
281
  $retval = new WP_Error(
282
  'bp_rest_invalid_id',
283
  __( 'Sorry, this thread does not exist.', 'buddypress' ),
@@ -285,7 +294,7 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
285
  'status' => 404,
286
  )
287
  );
288
- } elseif ( bp_current_user_can( 'bp_moderate' ) || messages_check_thread_access( $thread->thread_id ) ) {
289
  $retval = true;
290
  } else {
291
  $retval = $error;
@@ -352,9 +361,9 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
352
  *
353
  * @since 5.0.0
354
  *
355
- * @param BP_Messages_Thread $thread Thread object.
356
- * @param WP_REST_Response $retval The response data.
357
- * @param WP_REST_Request $request The request sent to the API.
358
  */
359
  do_action( 'bp_rest_messages_create_item', $thread, $response, $request );
360
 
@@ -423,8 +432,14 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
423
  // Setting context.
424
  $request->set_param( 'context', 'edit' );
425
 
 
 
 
 
 
 
426
  // Get the thread.
427
- $thread = $this->get_thread_object( $request['id'] );
428
  $error = new WP_Error(
429
  'bp_rest_messages_update_failed',
430
  __( 'There was an error trying to update the message.', 'buddypress' ),
@@ -433,14 +448,23 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
433
  )
434
  );
435
 
436
- if ( ! $thread->thread_id ) {
437
- return $error;
 
 
 
 
 
 
 
 
 
438
  }
439
 
440
  // By default use the last message.
441
  $message_id = $thread->last_message_id;
442
- if ( $request['message_id'] ) {
443
- $message_id = $request['message_id'];
444
  }
445
 
446
  $updated_message = wp_list_filter( $thread->messages, array( 'id' => $message_id ) );
@@ -454,7 +478,7 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
454
  * @param boolean $value Whether the user can edit the message meta.
455
  * By default: only the sender and a community moderator can.
456
  * @param BP_Messages_Message $updated_message The updated message object.
457
- * @param WP_REST_Request $request The request sent to the API.
458
  */
459
  $can_edit_item_meta = apply_filters(
460
  'bp_rest_messages_can_edit_item_meta',
@@ -464,7 +488,14 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
464
  );
465
 
466
  // The message must exist in the thread, and the logged in user must be the sender.
467
- if ( ! isset( $updated_message->id ) || ! $updated_message->id || ! $can_edit_item_meta ) {
 
 
 
 
 
 
 
468
  return $error;
469
  }
470
 
@@ -473,6 +504,8 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
473
  return $fields_update;
474
  }
475
 
 
 
476
  $retval = array(
477
  $this->prepare_response_for_collection(
478
  $this->prepare_item_for_response( $thread, $request )
@@ -482,7 +515,7 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
482
  $response = rest_ensure_response( $retval );
483
 
484
  /**
485
- * Fires after a message is updated via the REST API.
486
  *
487
  * @since 5.0.0
488
  *
@@ -526,7 +559,7 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
526
  * @return WP_REST_Response|WP_Error
527
  */
528
  public function update_starred( $request ) {
529
- $message = $this->get_message_object( $request['id'] );
530
 
531
  if ( empty( $message->id ) ) {
532
  return new WP_Error(
@@ -609,7 +642,7 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
609
  );
610
 
611
  if ( is_user_logged_in() ) {
612
- $thread_id = messages_get_message_thread_id( $request['id'] );
613
 
614
  if ( messages_check_thread_access( $thread_id ) ) {
615
  $retval = true;
@@ -639,20 +672,28 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
639
  // Setting context.
640
  $request->set_param( 'context', 'edit' );
641
 
642
- // Get the thread before it's deleted.
643
- $thread = $this->get_thread_object( $request['id'] );
644
- $previous = $this->prepare_item_for_response( $thread, $request );
645
-
646
  $user_id = bp_loggedin_user_id();
647
- if ( ! empty( $request['user_id'] ) ) {
648
- $user_id = $request['user_id'];
649
  }
650
 
 
 
 
 
651
  // Check the user is one of the recipients.
652
- $recipient_ids = wp_parse_id_list( wp_list_pluck( $thread->recipients, 'user_id' ) );
 
 
 
 
 
 
 
 
653
 
654
  // Delete a thread.
655
- if ( ! in_array( $user_id, $recipient_ids, true ) || ! messages_delete_thread( $thread->thread_id, $user_id ) ) {
656
  return new WP_Error(
657
  'bp_rest_messages_delete_thread_failed',
658
  __( 'There was an error trying to delete the thread.', 'buddypress' ),
@@ -676,7 +717,7 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
676
  *
677
  * @since 5.0.0
678
  *
679
- * @param BP_Messages_Thread $thread Thread object.
680
  * @param WP_REST_Response $response The response data.
681
  * @param WP_REST_Request $request The request sent to the API.
682
  */
@@ -718,15 +759,15 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
718
  protected function prepare_item_for_database( $request ) {
719
  $prepared_thread = new stdClass();
720
  $schema = $this->get_item_schema();
721
- $thread = $this->get_thread_object( $request['id'] );
722
 
723
- if ( ! empty( $schema['properties']['id'] ) && ! empty( $request['id'] ) ) {
724
- $prepared_thread->thread_id = $request['id'];
725
  } elseif ( ! empty( $thread->thread_id ) ) {
726
  $prepared_thread->thread_id = $thread->thread_id;
727
  }
728
 
729
- if ( ! empty( $schema['properties']['sender_id'] ) && ! empty( $request['sender_id'] ) ) {
730
  $prepared_thread->sender_id = $thread->sender_id;
731
  } elseif ( ! empty( $thread->sender_id ) ) {
732
  $prepared_thread->sender_id = $thread->sender_id;
@@ -734,20 +775,20 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
734
  $prepared_thread->sender_id = bp_loggedin_user_id();
735
  }
736
 
737
- if ( ! empty( $schema['properties']['message'] ) && ! empty( $request['message'] ) ) {
738
- $prepared_thread->content = $request['message'];
739
  } elseif ( ! empty( $thread->message ) ) {
740
  $prepared_thread->message = $thread->message;
741
  }
742
 
743
- if ( ! empty( $schema['properties']['subject'] ) && ! empty( $request['subject'] ) ) {
744
- $prepared_thread->subject = $request['subject'];
745
  } elseif ( ! empty( $thread->subject ) ) {
746
  $prepared_thread->subject = $thread->subject;
747
  }
748
 
749
- if ( ! empty( $schema['properties']['recipients'] ) && ! empty( $request['recipients'] ) ) {
750
- $prepared_thread->recipients = $request['recipients'];
751
  } elseif ( ! empty( $thread->recipients ) ) {
752
  $prepared_thread->recipients = wp_parse_id_list( wp_list_pluck( $thread->recipients, 'user_id' ) );
753
  }
@@ -791,8 +832,8 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
791
  if ( bp_is_active( 'messages', 'star' ) ) {
792
  $user_id = bp_loggedin_user_id();
793
 
794
- if ( isset( $request['user_id'] ) && $request['user_id'] ) {
795
- $user_id = (int) $request['user_id'];
796
  }
797
 
798
  $data['is_starred'] = bp_messages_is_message_starred( $data['id'], $user_id );
@@ -896,7 +937,7 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
896
  'rendered' => apply_filters( 'bp_get_message_thread_content', wp_staticize_emoji( $thread->last_message_content ) ),
897
  ),
898
  'date' => bp_rest_prepare_date_response( $thread->last_message_date ),
899
- 'unread_count' => ! empty( $thread->unread_count ) ? $thread->unread_count : 0,
900
  'sender_ids' => $thread->sender_ids,
901
  'recipients' => array(),
902
  'messages' => array(),
@@ -908,14 +949,14 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
908
  }
909
 
910
  // Loop through recipients to prepare them for the response.
911
- foreach ( $thread->recipients as $recipient ) {
912
  $data['recipients'][ $recipient->user_id ] = $this->prepare_recipient_for_response( $recipient, $request );
913
  }
914
 
915
  // Pluck starred message ids.
916
  $data['starred_message_ids'] = array_keys( array_filter( wp_list_pluck( $data['messages'], 'is_starred', 'id' ) ) );
917
 
918
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
919
  $data = $this->add_additional_fields_to_object( $data, $request );
920
  $data = $this->filter_response_by_context( $data, $context );
921
  $response = rest_ensure_response( $data );
@@ -978,27 +1019,45 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
978
  }
979
 
980
  /**
981
- * Get thread object.
982
  *
983
  * @since 5.0.0
984
  *
985
  * @param int $thread_id Thread ID.
986
- * @return BP_Messages_Thread
 
987
  */
988
- public function get_thread_object( $thread_id ) {
989
- return new BP_Messages_Thread( (int) $thread_id );
 
 
 
 
 
 
 
 
 
 
 
990
  }
991
 
992
  /**
993
- * Get the message object thanks to its ID.
994
  *
995
  * @since 5.0.0
996
  *
997
  * @param int $message_id Message ID.
998
- * @return BP_Messages_Message
999
  */
1000
  public function get_message_object( $message_id ) {
1001
- return new BP_Messages_Message( (int) $message_id );
 
 
 
 
 
 
1002
  }
1003
 
1004
  /**
@@ -1056,6 +1115,24 @@ class BP_REST_Messages_Endpoint extends WP_REST_Controller {
1056
  if ( WP_REST_Server::EDITABLE === $method ) {
1057
  $key = 'update_item';
1058
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1059
  $args['message_id'] = array(
1060
  'description' => __( 'By default the latest message of the thread will be updated. Specify this message ID to edit another message of the thread.', 'buddypress' ),
1061
  'required' => false,
116
  */
117
  public function get_items( $request ) {
118
  $args = array(
119
+ 'user_id' => $request->get_param( 'user_id' ),
120
+ 'box' => $request->get_param( 'box' ),
121
+ 'type' => $request->get_param( 'type' ),
122
+ 'page' => $request->get_param( 'page' ),
123
+ 'per_page' => $request->get_param( 'per_page' ),
124
+ 'search_terms' => $request->get_param( 'search' ),
125
  );
126
 
127
  // Include the meta_query for starred messages.
189
  );
190
 
191
  if ( is_user_logged_in() ) {
192
+ $user = bp_rest_get_user( $request->get_param( 'user_id' ) );
193
 
194
  if ( ! $user instanceof WP_User ) {
195
  $retval = new WP_Error(
232
  * @return WP_REST_Response
233
  */
234
  public function get_item( $request ) {
235
+ $user_id = bp_loggedin_user_id();
236
+ if ( ! empty( $request->get_param( 'user_id' ) ) ) {
237
+ $user_id = $request->get_param( 'user_id' );
238
+ }
239
 
240
+ $thread = $this->get_thread_object( $request->get_param( 'id' ), $user_id );
241
  $retval = array(
242
  $this->prepare_response_for_collection(
243
  $this->prepare_item_for_response( $thread, $request )
251
  *
252
  * @since 5.0.0
253
  *
254
+ * @param BP_Messages_Thread $thread Thread object.
255
+ * @param WP_REST_Response $response The response data.
256
+ * @param WP_REST_Request $request The request sent to the API.
257
  */
258
  do_action( 'bp_rest_messages_get_item', $thread, $response, $request );
259
 
269
  * @return true|WP_Error
270
  */
271
  public function get_item_permissions_check( $request ) {
272
+ $error = new WP_Error(
273
  'bp_rest_authorization_required',
274
  __( 'Sorry, you are not allowed to see this thread.', 'buddypress' ),
275
  array(
276
  'status' => rest_authorization_required_code(),
277
  )
278
  );
279
+
280
+ $retval = $error;
281
+ $user_id = bp_loggedin_user_id();
282
+ if ( ! empty( $request->get_param( 'user_id' ) ) ) {
283
+ $user_id = $request->get_param( 'user_id' );
284
+ }
285
 
286
  if ( is_user_logged_in() ) {
287
+ $thread = $this->get_thread_object( $request->get_param( 'id' ), $user_id );
288
 
289
+ if ( empty( $thread ) ) {
290
  $retval = new WP_Error(
291
  'bp_rest_invalid_id',
292
  __( 'Sorry, this thread does not exist.', 'buddypress' ),
294
  'status' => 404,
295
  )
296
  );
297
+ } elseif ( bp_current_user_can( 'bp_moderate' ) || messages_check_thread_access( $thread->thread_id, $user_id ) ) {
298
  $retval = true;
299
  } else {
300
  $retval = $error;
361
  *
362
  * @since 5.0.0
363
  *
364
+ * @param BP_Messages_Thread $thread Thread object.
365
+ * @param WP_REST_Response $response The response data.
366
+ * @param WP_REST_Request $request The request sent to the API.
367
  */
368
  do_action( 'bp_rest_messages_create_item', $thread, $response, $request );
369
 
432
  // Setting context.
433
  $request->set_param( 'context', 'edit' );
434
 
435
+ // Updated user id.
436
+ $updated_user_id = bp_loggedin_user_id();
437
+ if ( ! empty( $request->get_param( 'user_id' ) ) ) {
438
+ $updated_user_id = $request->get_param( 'user_id' );
439
+ }
440
+
441
  // Get the thread.
442
+ $thread = $this->get_thread_object( $request->get_param( 'id' ), $updated_user_id );
443
  $error = new WP_Error(
444
  'bp_rest_messages_update_failed',
445
  __( 'There was an error trying to update the message.', 'buddypress' ),
448
  )
449
  );
450
 
451
+ // Is someone updating the thread status?
452
+ $thread_status_update = ( (bool) $request->get_param( 'read' ) || (bool) $request->get_param( 'unread' ) );
453
+
454
+ // Mark thread as read.
455
+ if ( true === (bool) $request->get_param( 'read' ) ) {
456
+ messages_mark_thread_read( $thread->thread_id, $updated_user_id );
457
+ }
458
+
459
+ // Mark thread as unread.
460
+ if ( true === (bool) $request->get_param( 'unread' ) ) {
461
+ messages_mark_thread_unread( $thread->thread_id, $updated_user_id );
462
  }
463
 
464
  // By default use the last message.
465
  $message_id = $thread->last_message_id;
466
+ if ( $request->get_param( 'message_id' ) ) {
467
+ $message_id = $request->get_param( 'message_id' );
468
  }
469
 
470
  $updated_message = wp_list_filter( $thread->messages, array( 'id' => $message_id ) );
478
  * @param boolean $value Whether the user can edit the message meta.
479
  * By default: only the sender and a community moderator can.
480
  * @param BP_Messages_Message $updated_message The updated message object.
481
+ * @param WP_REST_Request $request Full details about the request.
482
  */
483
  $can_edit_item_meta = apply_filters(
484
  'bp_rest_messages_can_edit_item_meta',
488
  );
489
 
490
  // The message must exist in the thread, and the logged in user must be the sender.
491
+ if (
492
+ false === $thread_status_update
493
+ && (
494
+ ! isset( $updated_message->id )
495
+ || ! $updated_message->id
496
+ || ! $can_edit_item_meta
497
+ )
498
+ ) {
499
  return $error;
500
  }
501
 
504
  return $fields_update;
505
  }
506
 
507
+ // Get the updated thread object.
508
+ $thread = $this->get_thread_object( $thread->thread_id, $updated_user_id );
509
  $retval = array(
510
  $this->prepare_response_for_collection(
511
  $this->prepare_item_for_response( $thread, $request )
515
  $response = rest_ensure_response( $retval );
516
 
517
  /**
518
+ * Fires after a thread or a message is updated via the REST API.
519
  *
520
  * @since 5.0.0
521
  *
559
  * @return WP_REST_Response|WP_Error
560
  */
561
  public function update_starred( $request ) {
562
+ $message = $this->get_message_object( $request->get_param( 'id' ) );
563
 
564
  if ( empty( $message->id ) ) {
565
  return new WP_Error(
642
  );
643
 
644
  if ( is_user_logged_in() ) {
645
+ $thread_id = messages_get_message_thread_id( $request->get_param( 'id' ) );
646
 
647
  if ( messages_check_thread_access( $thread_id ) ) {
648
  $retval = true;
672
  // Setting context.
673
  $request->set_param( 'context', 'edit' );
674
 
 
 
 
 
675
  $user_id = bp_loggedin_user_id();
676
+ if ( ! empty( $request->get_param( 'user_id' ) ) ) {
677
+ $user_id = $request->get_param( 'user_id' );
678
  }
679
 
680
+ // Get the thread before it's deleted.
681
+ $thread = $this->get_thread_object( $request->get_param( 'id' ), $user_id );
682
+ $previous = $this->prepare_item_for_response( $thread, $request );
683
+
684
  // Check the user is one of the recipients.
685
+ if ( ! in_array( $user_id, wp_parse_id_list( wp_list_pluck( $thread->get_recipients(), 'user_id' ) ), true ) ) {
686
+ return new WP_Error(
687
+ 'bp_rest_authorization_required',
688
+ __( 'Sorry, you are not allowed to perform this action.', 'buddypress' ),
689
+ array(
690
+ 'status' => rest_authorization_required_code(),
691
+ )
692
+ );
693
+ }
694
 
695
  // Delete a thread.
696
+ if ( false === messages_delete_thread( $thread->thread_id, $user_id ) ) {
697
  return new WP_Error(
698
  'bp_rest_messages_delete_thread_failed',
699
  __( 'There was an error trying to delete the thread.', 'buddypress' ),
717
  *
718
  * @since 5.0.0
719
  *
720
+ * @param BP_Messages_Thread $thread The thread object.
721
  * @param WP_REST_Response $response The response data.
722
  * @param WP_REST_Request $request The request sent to the API.
723
  */
759
  protected function prepare_item_for_database( $request ) {
760
  $prepared_thread = new stdClass();
761
  $schema = $this->get_item_schema();
762
+ $thread = $this->get_thread_object( $request->get_param( 'id' ) );
763
 
764
+ if ( ! empty( $schema['properties']['id'] ) && ! empty( $request->get_param( 'id' ) ) ) {
765
+ $prepared_thread->thread_id = $request->get_param( 'id' );
766
  } elseif ( ! empty( $thread->thread_id ) ) {
767
  $prepared_thread->thread_id = $thread->thread_id;
768
  }
769
 
770
+ if ( ! empty( $schema['properties']['sender_id'] ) && ! empty( $request->get_param( 'sender_id' ) ) ) {
771
  $prepared_thread->sender_id = $thread->sender_id;
772
  } elseif ( ! empty( $thread->sender_id ) ) {
773
  $prepared_thread->sender_id = $thread->sender_id;
775
  $prepared_thread->sender_id = bp_loggedin_user_id();
776
  }
777
 
778
+ if ( ! empty( $schema['properties']['message'] ) && ! empty( $request->get_param( 'message' ) ) ) {
779
+ $prepared_thread->content = $request->get_param( 'message' );
780
  } elseif ( ! empty( $thread->message ) ) {
781
  $prepared_thread->message = $thread->message;
782
  }
783
 
784
+ if ( ! empty( $schema['properties']['subject'] ) && ! empty( $request->get_param( 'subject' ) ) ) {
785
+ $prepared_thread->subject = $request->get_param( 'subject' );
786
  } elseif ( ! empty( $thread->subject ) ) {
787
  $prepared_thread->subject = $thread->subject;
788
  }
789
 
790
+ if ( ! empty( $schema['properties']['recipients'] ) && ! empty( $request->get_param( 'recipients' ) ) ) {
791
+ $prepared_thread->recipients = $request->get_param( 'recipients' );
792
  } elseif ( ! empty( $thread->recipients ) ) {
793
  $prepared_thread->recipients = wp_parse_id_list( wp_list_pluck( $thread->recipients, 'user_id' ) );
794
  }
832
  if ( bp_is_active( 'messages', 'star' ) ) {
833
  $user_id = bp_loggedin_user_id();
834
 
835
+ if ( ! empty( $request->get_param( 'user_id' ) ) ) {
836
+ $user_id = (int) $request->get_param( 'user_id' );
837
  }
838
 
839
  $data['is_starred'] = bp_messages_is_message_starred( $data['id'], $user_id );
937
  'rendered' => apply_filters( 'bp_get_message_thread_content', wp_staticize_emoji( $thread->last_message_content ) ),
938
  ),
939
  'date' => bp_rest_prepare_date_response( $thread->last_message_date ),
940
+ 'unread_count' => ! empty( $thread->unread_count ) ? absint( $thread->unread_count ) : 0,
941
  'sender_ids' => $thread->sender_ids,
942
  'recipients' => array(),
943
  'messages' => array(),
949
  }
950
 
951
  // Loop through recipients to prepare them for the response.
952
+ foreach ( $thread->get_recipients() as $recipient ) {
953
  $data['recipients'][ $recipient->user_id ] = $this->prepare_recipient_for_response( $recipient, $request );
954
  }
955
 
956
  // Pluck starred message ids.
957
  $data['starred_message_ids'] = array_keys( array_filter( wp_list_pluck( $data['messages'], 'is_starred', 'id' ) ) );
958
 
959
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
960
  $data = $this->add_additional_fields_to_object( $data, $request );
961
  $data = $this->filter_response_by_context( $data, $context );
962
  $response = rest_ensure_response( $data );
1019
  }
1020
 
1021
  /**
1022
+ * Get the thread object.
1023
  *
1024
  * @since 5.0.0
1025
  *
1026
  * @param int $thread_id Thread ID.
1027
+ * @param int $user_id User ID.
1028
+ * @return BP_Messages_Thread|string
1029
  */
1030
+ public function get_thread_object( $thread_id, $user_id = 0 ) {
1031
+ $args = array();
1032
+ if ( ! empty( $user_id ) ) {
1033
+ $args = array( 'user_id' => $user_id );
1034
+ }
1035
+
1036
+ $thread_object = new BP_Messages_Thread( (int) $thread_id, 'ASC', $args );
1037
+
1038
+ if ( false === (bool) $thread_object::is_valid( $thread_id ) ) {
1039
+ return '';
1040
+ }
1041
+
1042
+ return $thread_object;
1043
  }
1044
 
1045
  /**
1046
+ * Get the message object.
1047
  *
1048
  * @since 5.0.0
1049
  *
1050
  * @param int $message_id Message ID.
1051
+ * @return BP_Messages_Message|string
1052
  */
1053
  public function get_message_object( $message_id ) {
1054
+ $message_object = new BP_Messages_Message( (int) $message_id );
1055
+
1056
+ if ( empty( $message_object->id ) ) {
1057
+ return '';
1058
+ }
1059
+
1060
+ return $message_object;
1061
  }
1062
 
1063
  /**
1115
  if ( WP_REST_Server::EDITABLE === $method ) {
1116
  $key = 'update_item';
1117
 
1118
+ $args['read'] = array(
1119
+ 'description' => __( 'Whether to mark the thread as read.', 'buddypress' ),
1120
+ 'required' => false,
1121
+ 'default' => false,
1122
+ 'type' => 'boolean',
1123
+ 'sanitize_callback' => 'rest_sanitize_boolean',
1124
+ 'validate_callback' => 'rest_validate_request_arg',
1125
+ );
1126
+
1127
+ $args['unread'] = array(
1128
+ 'description' => __( 'Whether to mark the thread as unread.', 'buddypress' ),
1129
+ 'required' => false,
1130
+ 'default' => false,
1131
+ 'type' => 'boolean',
1132
+ 'sanitize_callback' => 'rest_sanitize_boolean',
1133
+ 'validate_callback' => 'rest_validate_request_arg',
1134
+ );
1135
+
1136
  $args['message_id'] = array(
1137
  'description' => __( 'By default the latest message of the thread will be updated. Specify this message ID to edit another message of the thread.', 'buddypress' ),
1138
  'required' => false,
bp-messages/classes/class-bp-rest-sitewide-notices-endpoint.php ADDED
@@ -0,0 +1,976 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BP REST: BP_REST_Sitewide_Notices_Endpoint class
4
+ *
5
+ * @package BuddyPress
6
+ * @since 9.0.0
7
+ */
8
+
9
+ defined( 'ABSPATH' ) || exit;
10
+
11
+ /**
12
+ * Sitewide Notices endpoints.
13
+ *
14
+ * @since 9.0.0
15
+ */
16
+ class BP_REST_Sitewide_Notices_Endpoint extends WP_REST_Controller {
17
+
18
+ /**
19
+ * Constructor.
20
+ *
21
+ * @since 9.0.0
22
+ */
23
+ public function __construct() {
24
+ $this->namespace = bp_rest_namespace() . '/' . bp_rest_version();
25
+ $this->rest_base = 'sitewide-notices';
26
+ }
27
+
28
+ /**
29
+ * Register the component routes.
30
+ *
31
+ * @since 9.0.0
32
+ */
33
+ public function register_routes() {
34
+ register_rest_route(
35
+ $this->namespace,
36
+ '/' . $this->rest_base,
37
+ array(
38
+ array(
39
+ 'methods' => WP_REST_Server::READABLE,
40
+ 'callback' => array( $this, 'get_items' ),
41
+ 'permission_callback' => array( $this, 'get_items_permissions_check' ),
42
+ 'args' => $this->get_collection_params(),
43
+ ),
44
+ array(
45
+ 'methods' => WP_REST_Server::CREATABLE,
46
+ 'callback' => array( $this, 'create_item' ),
47
+ 'permission_callback' => array( $this, 'create_item_permissions_check' ),
48
+ 'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ),
49
+ ),
50
+ 'schema' => array( $this, 'get_item_schema' ),
51
+ )
52
+ );
53
+
54
+ register_rest_route(
55
+ $this->namespace,
56
+ '/' . $this->rest_base . '/(?P<id>[\d]+)',
57
+ array(
58
+ 'args' => array(
59
+ 'id' => array(
60
+ 'description' => __( 'A unique numeric ID for the Sitewide notice.', 'buddypress' ),
61
+ 'type' => 'integer',
62
+ ),
63
+ ),
64
+ array(
65
+ 'methods' => WP_REST_Server::READABLE,
66
+ 'callback' => array( $this, 'get_item' ),
67
+ 'permission_callback' => array( $this, 'get_item_permissions_check' ),
68
+ 'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::READABLE ),
69
+ ),
70
+ array(
71
+ 'methods' => WP_REST_Server::EDITABLE,
72
+ 'callback' => array( $this, 'update_item' ),
73
+ 'permission_callback' => array( $this, 'update_item_permissions_check' ),
74
+ 'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
75
+ ),
76
+ array(
77
+ 'methods' => WP_REST_Server::DELETABLE,
78
+ 'callback' => array( $this, 'delete_item' ),
79
+ 'permission_callback' => array( $this, 'delete_item_permissions_check' ),
80
+ 'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::DELETABLE ),
81
+ ),
82
+ 'schema' => array( $this, 'get_item_schema' ),
83
+ )
84
+ );
85
+
86
+ register_rest_route(
87
+ $this->namespace,
88
+ '/' . $this->rest_base . '/dismiss',
89
+ array(
90
+ array(
91
+ 'methods' => WP_REST_Server::EDITABLE,
92
+ 'callback' => array( $this, 'dismiss_notice' ),
93
+ 'permission_callback' => array( $this, 'dismiss_notice_permissions_check' ), // Anyone who can get items can dismiss them.
94
+ ),
95
+ 'schema' => array( $this, 'get_item_schema' ),
96
+ )
97
+ );
98
+ }
99
+
100
+ /**
101
+ * Retrieve sitewide notices.
102
+ *
103
+ * @since 9.0.0
104
+ *
105
+ * @param WP_REST_Request $request Full details about the request.
106
+ * @return WP_REST_Response
107
+ */
108
+ public function get_items( $request ) {
109
+ $context = $request->get_param( 'context' );
110
+
111
+ if ( 'edit' === $context && bp_current_user_can( 'bp_moderate' ) ) {
112
+
113
+ $args = array(
114
+ 'pag_page' => $request->get_param( 'page' ),
115
+ 'pag_num' => $request->get_param( 'per_page' ),
116
+ );
117
+
118
+ /**
119
+ * Filter the query arguments for the request.
120
+ *
121
+ * @since 9.0.0
122
+ *
123
+ * @param array $args Key value array of query var to query value.
124
+ * @param WP_REST_Request $request The request sent to the API.
125
+ */
126
+ $args = apply_filters( 'bp_rest_sitewide_notices_get_items_query_args', $args, $request );
127
+
128
+ $notices = BP_Messages_Notice::get_notices( $args );
129
+
130
+ $retval = array();
131
+ foreach ( (array) $notices as $notice ) {
132
+ $retval[] = $this->prepare_response_for_collection(
133
+ $this->prepare_item_for_response( $notice, $request )
134
+ );
135
+ }
136
+
137
+ $response = rest_ensure_response( $retval );
138
+ $response = bp_rest_response_add_total_headers( $response, BP_Messages_Notice::get_total_notice_count(), $args['pag_num'] );
139
+
140
+ } else {
141
+ // Ordinary users, or Admins who aren't currently managing notices, only get the most recent notice.
142
+ $retval = array();
143
+ $notice = BP_Messages_Notice::get_active();
144
+ $notices = array();
145
+ if ( ! empty( $notice ) ) {
146
+ // Make sure the user hasn't already dismissed it.
147
+ $closed_notices = bp_get_user_meta( bp_loggedin_user_id(), 'closed_notices', true );
148
+ if ( empty( $closed_notices ) ) {
149
+ $closed_notices = array();
150
+ }
151
+ if ( $notice->id && is_array( $closed_notices ) && ! in_array( $notice->id, $closed_notices, true ) ) {
152
+ $retval[] = $this->prepare_response_for_collection(
153
+ $this->prepare_item_for_response( $notice, $request )
154
+ );
155
+ // Add the item to the notices array used in the filter.
156
+ $notices[] = $notice;
157
+ }
158
+ }
159
+ $response = rest_ensure_response( $retval );
160
+ // The count is either 0 or 1, since there can only be one active notice at a time.
161
+ $response = bp_rest_response_add_total_headers( $response, count( $retval ), 1 );
162
+ }
163
+
164
+ /**
165
+ * Fires after notices are fetched via the REST API.
166
+ *
167
+ * @since 9.0.0
168
+ *
169
+ * @param array $notices Fetched notices.
170
+ * @param WP_REST_Response $response The response data.
171
+ * @param WP_REST_Request $request The request sent to the API.
172
+ */
173
+ do_action( 'bp_rest_sitewide_notices_get_items', $notices, $response, $request );
174
+
175
+ return $response;
176
+ }
177
+
178
+ /**
179
+ * Check if a given request is allowed to get notices.
180
+ *
181
+ * @since 9.0.0
182
+ *
183
+ * @param WP_REST_Request $request Full data about the request.
184
+ * @return WP_Error|bool
185
+ */
186
+ public function get_items_permissions_check( $request ) {
187
+ $context = $request->get_param( 'context' );
188
+ $retval = new WP_Error(
189
+ 'bp_rest_authorization_required',
190
+ __( 'Sorry, you are not allowed to see the notices.', 'buddypress' ),
191
+ array(
192
+ 'status' => rest_authorization_required_code(),
193
+ )
194
+ );
195
+
196
+ if ( is_user_logged_in() ) {
197
+ if ( 'view' === $context ) {
198
+ $retval = true;
199
+ } elseif ( 'edit' === $context ) {
200
+ $retval = bp_current_user_can( 'bp_moderate' );
201
+ }
202
+ }
203
+
204
+ /**
205
+ * Filter the messages `get_items` permissions check.
206
+ *
207
+ * @since 9.0.0
208
+ *
209
+ * @param bool|WP_Error $retval Returned value.
210
+ * @param WP_REST_Request $request The request sent to the API.
211
+ */
212
+ return apply_filters( 'bp_rest_sitewide_notices_get_items_permissions_check', $retval, $request );
213
+ }
214
+
215
+ /**
216
+ * Get a single notice by ID.
217
+ *
218
+ * @since 9.0.0
219
+ *
220
+ * @param WP_REST_Request $request Full data about the request.
221
+ * @return WP_REST_Response
222
+ */
223
+ public function get_item( $request ) {
224
+ $notice = $this->get_notice_object( $request->get_param( 'id' ) );
225
+
226
+ $retval = $this->prepare_item_for_response( $notice, $request );
227
+ $response = rest_ensure_response( $retval );
228
+
229
+ /**
230
+ * Fires after a sitewide notice is fetched via the REST API.
231
+ *
232
+ * @since 9.0.0
233
+ *
234
+ * @param BP_Messages_Notice $notice Notice object.
235
+ * @param WP_REST_Response $retval The response data.
236
+ * @param WP_REST_Request $request The request sent to the API.
237
+ */
238
+ do_action( 'bp_rest_sitewide_notices_get_item', $notice, $response, $request );
239
+
240
+ return $response;
241
+ }
242
+
243
+ /**
244
+ * Check if a given request is allowed to get a sitewide notice.
245
+ *
246
+ * @since 9.0.0
247
+ *
248
+ * @param WP_REST_Request $request Full data about the request.
249
+ * @return WP_Error|bool
250
+ */
251
+ public function get_item_permissions_check( $request ) {
252
+ $error = new WP_Error(
253
+ 'bp_rest_authorization_required',
254
+ __( 'Sorry, you are not allowed to see this notice.', 'buddypress' ),
255
+ array(
256
+ 'status' => rest_authorization_required_code(),
257
+ )
258
+ );
259
+ $retval = $error;
260
+
261
+ if ( is_user_logged_in() ) {
262
+ $notice = $this->get_notice_object( $request->get_param( 'id' ) );
263
+ if ( empty( $notice->id ) ) {
264
+ $retval = new WP_Error(
265
+ 'bp_rest_invalid_id',
266
+ __( 'Sorry, this notice does not exist.', 'buddypress' ),
267
+ array(
268
+ 'status' => 404,
269
+ )
270
+ );
271
+ } else {
272
+ if ( bp_current_user_can( 'bp_moderate' ) ) {
273
+ $retval = true;
274
+ } else {
275
+ // Non-admin users can only see the active notice.
276
+ $is_active = isset( $notice->is_active ) ? $notice->is_active : false;
277
+ if ( ! $is_active ) {
278
+ $retval = $error;
279
+ } else {
280
+ $retval = true;
281
+ }
282
+ }
283
+ }
284
+ }
285
+
286
+ /**
287
+ * Filter the sitewide notices `get_item` permissions check.
288
+ *
289
+ * @since 9.0.0
290
+ *
291
+ * @param bool|WP_Error $retval Returned value.
292
+ * @param WP_REST_Request $request The request sent to the API.
293
+ */
294
+ return apply_filters( 'bp_rest_sitewide_notices_get_item_permissions_check', $retval, $request, $notice );
295
+ }
296
+
297
+ /**
298
+ * Create a sitewide notice.
299
+ *
300
+ * @since 9.0.0
301
+ *
302
+ * @param WP_REST_Request $request Full details about the request.
303
+ * @return WP_REST_Response|WP_Error
304
+ */
305
+ public function create_item( $request ) {
306
+ // Setting context.
307
+ $request->set_param( 'context', 'edit' );
308
+
309
+ $subject = $request->get_param( 'subject' );
310
+ $message = $request->get_param( 'message' );
311
+ $success = messages_send_notice( $subject, $message );
312
+
313
+ if ( ! $success ) {
314
+ return new WP_Error(
315
+ 'bp_rest_user_cannot_create_sitewide_notice',
316
+ __( 'Cannot create new sitewide notice.', 'buddypress' ),
317
+ array(
318
+ 'status' => 500,
319
+ )
320
+ );
321
+ }
322
+
323
+ // The notice we just created will be active.
324
+ $notice = BP_Messages_Notice::get_active();
325
+ $fields_update = $this->update_additional_fields_for_object( $notice, $request );
326
+
327
+ if ( is_wp_error( $fields_update ) ) {
328
+ return $fields_update;
329
+ }
330
+
331
+ $retval = $this->prepare_item_for_response( $notice, $request );
332
+ $response = rest_ensure_response( $retval );
333
+
334
+ /**
335
+ * Fires after a sitewide notice is created via the REST API.
336
+ *
337
+ * @since 9.0.0
338
+ *
339
+ * @param BP_Messages_Notice $notice Notice object.
340
+ * @param WP_REST_Response $response The response data.
341
+ * @param WP_REST_Request $request The request sent to the API.
342
+ */
343
+ do_action( 'bp_rest_sitewide_notices_create_item', $notice, $response, $request );
344
+
345
+ return $response;
346
+ }
347
+
348
+ /**
349
+ * Check if a given request has access to create a notice.
350
+ *
351
+ * @since 9.0.0
352
+ *
353
+ * @param WP_REST_Request $request Full details about the request.
354
+ * @return WP_Error|bool
355
+ */
356
+ public function create_item_permissions_check( $request ) {
357
+ $retval = $this->manage_item_permissions_check( $request );
358
+
359
+ /**
360
+ * Filter the sitewide notices `create_item` permissions check.
361
+ *
362
+ * @since 9.0.0
363
+ *
364
+ * @param bool|WP_Error $retval Returned value.
365
+ * @param WP_REST_Request $request The request sent to the API.
366
+ */
367
+ return apply_filters( 'bp_rest_sitewide_notices_create_item_permissions_check', $retval, $request );
368
+ }
369
+
370
+ /**
371
+ * Update a notice.
372
+ *
373
+ * @since 9.0.0
374
+ *
375
+ * @param WP_REST_Request $request Full details about the request.
376
+ * @return WP_REST_Response|WP_Error
377
+ */
378
+ public function update_item( $request ) {
379
+ // Setting context.
380
+ $request->set_param( 'context', 'edit' );
381
+
382
+ // Check the notice exists.
383
+ $notice = $this->get_notice_object( $request->get_param( 'id' ) );
384
+ if ( ! $notice->id ) {
385
+ return new WP_Error(
386
+ 'bp_rest_invalid_id',
387
+ __( 'Sorry, this notice does not exist.', 'buddypress' ),
388
+ array(
389
+ 'status' => 404,
390
+ )
391
+ );
392
+ }
393
+
394
+ // Update the notice.
395
+ $updated_notice = $this->prepare_item_for_database( $request );
396
+ if ( ! $updated_notice->save() ) {
397
+ return new WP_Error(
398
+ 'bp_rest_sitewide_notices_update_failed',
399
+ __( 'There was an error trying to update the notice.', 'buddypress' ),
400
+ array(
401
+ 'status' => 500,
402
+ )
403
+ );
404
+ }
405
+
406
+ $fields_update = $this->update_additional_fields_for_object( $updated_notice, $request );
407
+ if ( is_wp_error( $fields_update ) ) {
408
+ return $fields_update;
409
+ }
410
+
411
+ $retval = $this->prepare_item_for_response( $updated_notice, $request );
412
+ $response = rest_ensure_response( $retval );
413
+
414
+ /**
415
+ * Fires after a sitewide notice is updated via the REST API.
416
+ *
417
+ * @since 9.0.0
418
+ *
419
+ * @param BP_Messages_Notice $updated_notice The notice object.
420
+ * @param WP_REST_Response $response The response data.
421
+ * @param WP_REST_Request $request The request sent to the API.
422
+ */
423
+ do_action( 'bp_rest_sitewide_notices_update_item', $updated_notice, $response, $request );
424
+
425
+ return $response;
426
+ }
427
+
428
+ /**
429
+ * Check if a given request has access to update a notice.
430
+ *
431
+ * @since 9.0.0
432
+ *
433
+ * @param WP_REST_Request $request Full details about the request.
434
+ * @return WP_Error|bool
435
+ */
436
+ public function update_item_permissions_check( $request ) {
437
+ $retval = $this->manage_item_permissions_check( $request );
438
+
439
+ /**
440
+ * Filter the sitewide notices `update_item` permissions check.
441
+ *
442
+ * @since 9.0.0
443
+ *
444
+ * @param bool|WP_Error $retval Returned value.
445
+ * @param WP_REST_Request $request The request sent to the API.
446
+ */
447
+ return apply_filters( 'bp_rest_sitewide_notices_update_item_permissions_check', $retval, $request );
448
+ }
449
+
450
+ /**
451
+ * Dismisses the currently active notice for the current user.
452
+ *
453
+ * @since 9.0.0
454
+ *
455
+ * @param WP_REST_Request $request Full details about the request.
456
+ * @return WP_REST_Response|WP_Error
457
+ */
458
+ public function dismiss_notice( $request ) {
459
+ // Mark the active notice as closed.
460
+ $notice = BP_Messages_Notice::get_active();
461
+
462
+ if ( ! $notice->id ) {
463
+ return new WP_Error(
464
+ 'bp_rest_invalid_id',
465
+ __( 'Sorry, this notice does not exist.', 'buddypress' ),
466
+ array(
467
+ 'status' => 404,
468
+ )
469
+ );
470
+ }
471
+
472
+ // Get Previous active notice.
473
+ $previous = $this->prepare_item_for_response( $notice, $request );
474
+
475
+ // Dismiss the active notice for the current user.
476
+ $dismissed = bp_messages_dismiss_sitewide_notice();
477
+
478
+ // Build the response.
479
+ $response = new WP_REST_Response();
480
+ $response->set_data(
481
+ array(
482
+ 'dismissed' => $dismissed,
483
+ 'previous' => $previous->get_data(),
484
+ )
485
+ );
486
+
487
+ /**
488
+ * Fires after a sitewide notice is dismissed via the REST API.
489
+ *
490
+ * @since 9.0.0
491
+ *
492
+ * @param BP_Messages_Notice $notice Notice object.
493
+ * @param WP_REST_Response $response The response data.
494
+ * @param WP_REST_Request $request The request sent to the API.
495
+ */
496
+ do_action( 'bp_rest_sitewide_notices_dismiss_notice', $notice, $response, $request );
497
+
498
+ return $response;
499
+ }
500
+
501
+ /**
502
+ * Check if a given request has access to dismiss the current notice.
503
+ *
504
+ * @since 9.0.0
505
+ *
506
+ * @param WP_REST_Request $request Full details about the request.
507
+ * @return WP_Error|bool
508
+ */
509
+ public function dismiss_notice_permissions_check( $request ) {
510
+ $retval = new WP_Error(
511
+ 'bp_rest_authorization_required',
512
+ __( 'Sorry, you are not allowed to dismiss notices.', 'buddypress' ),
513
+ array(
514
+ 'status' => rest_authorization_required_code(),
515
+ )
516
+ );
517
+
518
+ if ( is_user_logged_in() ) {
519
+ $retval = true;
520
+ }
521
+
522
+ /**
523
+ * Filter the sitewide notices `dismiss_notice` permissions check.
524
+ *
525
+ * @since 9.0.0
526
+ *
527
+ * @param bool|WP_Error $retval Returned value.
528
+ * @param WP_REST_Request $request The request sent to the API.
529
+ */
530
+ return apply_filters( 'bp_rest_sitewide_notices_dismiss_notice_permissions_check', $retval, $request );
531
+ }
532
+
533
+ /**
534
+ * Delete a sitewide notice.
535
+ *
536
+ * @since 9.0.0
537
+ *
538
+ * @param WP_REST_Request $request Full details about the request.
539
+ * @return WP_REST_Response|WP_Error
540
+ */
541
+ public function delete_item( $request ) {
542
+ // Setting context.
543
+ $request->set_param( 'context', 'edit' );
544
+
545
+ // Get the notice before it's deleted.
546
+ $notice = $this->get_notice_object( $request->get_param( 'id' ) );
547
+ if ( ! $notice->id ) {
548
+ return new WP_Error(
549
+ 'bp_rest_invalid_id',
550
+ __( 'Sorry, this notice does not exist.', 'buddypress' ),
551
+ array(
552
+ 'status' => 404,
553
+ )
554
+ );
555
+ }
556
+
557
+ $previous = $this->prepare_item_for_response( $notice, $request );
558
+
559
+ // Delete a sitewide notice.
560
+ if ( ! $notice->delete() ) {
561
+ return new WP_Error(
562
+ 'bp_rest_sitewide_notice_delete_failed',
563
+ __( 'There was an error trying to delete a notice.', 'buddypress' ),
564
+ array(
565
+ 'status' => 500,
566
+ )
567
+ );
568
+ }
569
+
570
+ // Build the response.
571
+ $response = new WP_REST_Response();
572
+ $response->set_data(
573
+ array(
574
+ 'deleted' => true,
575
+ 'previous' => $previous->get_data(),
576
+ )
577
+ );
578
+
579
+ /**
580
+ * Fires after a sitewide notice is deleted via the REST API.
581
+ *
582
+ * @since 9.0.0
583
+ *
584
+ * @param BP_Messages_Notice $notice Notice object.
585
+ * @param WP_REST_Response $response The response data.
586
+ * @param WP_REST_Request $request The request sent to the API.
587
+ */
588
+ do_action( 'bp_rest_sitewide_notices_delete_item', $notice, $response, $request );
589
+
590
+ return $response;
591
+ }
592
+
593
+ /**
594
+ * Check if a given request has access to generally manage a notice.
595
+ * Granular filters are provided in the edit_, create_, and delete_
596
+ * permissions checks.
597
+ *
598
+ * @since 9.0.0
599
+ *
600
+ * @param WP_REST_Request $request Full details about the request.
601
+ * @return WP_Error|bool
602
+ */
603
+ public function manage_item_permissions_check( $request ) {
604
+ $retval = new WP_Error(
605
+ 'bp_rest_authorization_required',
606
+ __( 'Sorry, you are not allowed to perform this action.', 'buddypress' ),
607
+ array(
608
+ 'status' => rest_authorization_required_code(),
609
+ )
610
+ );
611
+
612
+ if ( bp_current_user_can( 'bp_moderate' ) ) {
613
+ $retval = true;
614
+ }
615
+
616
+ /**
617
+ * Filter the notice `manage_item` permissions check.
618
+ *
619
+ * @since 9.0.0
620
+ *
621
+ * @param bool|WP_Error $retval Returned value.
622
+ * @param WP_REST_Request $request The request sent to the API.
623
+ */
624
+ return apply_filters( 'bp_rest_sitewide_notices_manage_item_permissions_check', $retval, $request );
625
+ }
626
+
627
+ /**
628
+ * Check if a given request has access to delete a notice.
629
+ *
630
+ * @since 9.0.0
631
+ *
632
+ * @param WP_REST_Request $request Full details about the request.
633
+ * @return WP_Error|bool
634
+ */
635
+ public function delete_item_permissions_check( $request ) {
636
+ $retval = $this->manage_item_permissions_check( $request );
637
+
638
+ /**
639
+ * Filter the sitewide notices `create_item` permissions check.
640
+ *
641
+ * @since 9.0.0
642
+ *
643
+ * @param bool|WP_Error $retval Returned value.
644
+ * @param WP_REST_Request $request The request sent to the API.
645
+ */
646
+ return apply_filters( 'bp_rest_sitewide_notices_delete_item_permissions_check', $retval, $request );
647
+ }
648
+
649
+ /**
650
+ * Prepare links for the request.
651
+ *
652
+ * @since 9.0.0
653
+ *
654
+ * @param BP_Messages_Notice $notice Notice object.
655
+ * @return array Links for the given notice.
656
+ */
657
+ protected function prepare_links( $notice ) {
658
+ $base = sprintf( '/%s/%s/', $this->namespace, $this->rest_base );
659
+
660
+ // Entity meta.
661
+ $links = array(
662
+ 'self' => array(
663
+ 'href' => rest_url( $base . $notice->id ),
664
+ ),
665
+ 'collection' => array(
666
+ 'href' => rest_url( $base ),
667
+ ),
668
+ );
669
+
670
+ /**
671
+ * Filter links prepared for the REST response.
672
+ *
673
+ * @since 9.0.0
674
+ *
675
+ * @param array $links The prepared links of the REST response.
676
+ * @param BP_Messages_Notice $notice Notice object.
677
+ */
678
+ return apply_filters( 'bp_rest_sitewide_notices_prepare_links', $links, $notice );
679
+ }
680
+
681
+ /**
682
+ * Prepares sitewide notice data for return as an object.
683
+ *
684
+ * @since 9.0.0
685
+ *
686
+ * @param BP_Messages_Notice $notice Notice object.
687
+ * @param WP_REST_Request $request Full details about the request.
688
+ * @return WP_REST_Response
689
+ */
690
+ public function prepare_item_for_response( $notice, $request ) {
691
+ $data = array(
692
+ 'id' => $notice->id,
693
+ 'subject' => array(
694
+ 'raw' => $notice->subject,
695
+ 'rendered' => apply_filters( 'bp_get_message_notice_subject', wp_staticize_emoji( $notice->subject ) ),
696
+ ),
697
+ 'message' => array(
698
+ 'raw' => $notice->message,
699
+ 'rendered' => apply_filters( 'bp_get_message_notice_text', wp_staticize_emoji( $notice->message ) ),
700
+ ),
701
+ 'date' => bp_rest_prepare_date_response( $notice->date_sent ),
702
+ 'is_active' => (bool) $notice->is_active,
703
+ );
704
+
705
+ $context = $request->get_param( 'context' );
706
+ if ( ! $context ) {
707
+ $context = 'view';
708
+ }
709
+
710
+ $data = $this->add_additional_fields_to_object( $data, $request );
711
+ $data = $this->filter_response_by_context( $data, $context );
712
+ $response = rest_ensure_response( $data );
713
+
714
+ $response->add_links( $this->prepare_links( $notice ) );
715
+
716
+ /**
717
+ * Filter sitewide notice data returned from the API.
718
+ *
719
+ * @since 9.0.0
720
+ *
721
+ * @param WP_REST_Response $response Response generated by the request.
722
+ * @param WP_REST_Request $request Request used to generate the response.
723
+ * @param BP_Messages_Notice $notice Notice object.
724
+ */
725
+ return apply_filters( 'bp_rest_sitewide_notices_prepare_value', $response, $request, $notice );
726
+ }
727
+
728
+ /**
729
+ * Get sitewide notice object.
730
+ *
731
+ * @since 9.0.0
732
+ *
733
+ * @param int $id Notice ID.
734
+ * @return BP_Messages_Notice
735
+ */
736
+ public function get_notice_object( $id ) {
737
+ $notice = new BP_Messages_Notice( $id );
738
+
739
+ if ( ! $notice->date_sent ) {
740
+ $notice->id = null;
741
+ }
742
+
743
+ return $notice;
744
+ }
745
+
746
+ /**
747
+ * Select the item schema arguments needed for the CREATABLE, EDITABLE and DELETABLE methods.
748
+ *
749
+ * @since 9.0.0
750
+ *
751
+ * @param string $method Optional. HTTP method of the request.
752
+ * @return array Endpoint arguments.
753
+ */
754
+ public function get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE ) {
755
+ $key = 'get_item';
756
+ $args = WP_REST_Controller::get_endpoint_args_for_item_schema( $method );
757
+ $args['id']['description'] = __( 'ID of the sitewide notice.', 'buddypress' );
758
+
759
+ if ( WP_REST_Server::CREATABLE === $method ) {
760
+ $key = 'create_item';
761
+
762
+ // Edit the Sitewide Notice ID description and default properties.
763
+ $args['id']['description'] = __( 'ID of the sitewide notice. Required when editing an existing notice.', 'buddypress' );
764
+ $args['id']['default'] = 0;
765
+
766
+ // Edit subject's properties.
767
+ $args['subject']['type'] = 'string';
768
+ $args['subject']['default'] = false;
769
+ $args['subject']['description'] = __( 'Subject of the sitewide notice.', 'buddypress' );
770
+
771
+ // Edit message's properties.
772
+ $args['message']['type'] = 'string';
773
+ $args['message']['description'] = __( 'Content of the sitewide notice.', 'buddypress' );
774
+
775
+ } else {
776
+ unset( $args['subject'], $args['message'] );
777
+ $args['id']['required'] = true;
778
+
779
+ if ( WP_REST_Server::EDITABLE === $method ) {
780
+ $key = 'update_item';
781
+
782
+ // Edit the Sitewide Notice ID description and default properties.
783
+ $args['id']['description'] = __( 'ID of the sitewide notice to update. Required when editing an existing notice.', 'buddypress' );
784
+ }
785
+
786
+ if ( WP_REST_Server::DELETABLE === $method ) {
787
+ $key = 'delete_item';
788
+
789
+ // Edit the Sitewide Notice ID description and default properties.
790
+ $args['id']['description'] = __( 'ID of the sitewide notice to delete. Required when deleting an existing notice.', 'buddypress' );
791
+ }
792
+ }
793
+
794
+ /**
795
+ * Filters the method query arguments.
796
+ *
797
+ * @since 9.0.0
798
+ *
799
+ * @param array $args Query arguments.
800
+ * @param string $method HTTP method of the request.
801
+ */
802
+ return apply_filters( "bp_rest_sitewide_notices_{$key}_query_arguments", $args, $method );
803
+ }
804
+
805
+ /**
806
+ * Get the message schema, conforming to JSON Schema.
807
+ *
808
+ * @since 9.0.0
809
+ *
810
+ * @return array
811
+ */
812
+ public function get_item_schema() {
813
+ if ( is_null( $this->schema ) ) {
814
+ $this->schema = array(
815
+ '$schema' => 'http://json-schema.org/draft-04/schema#',
816
+ 'title' => 'bp_sitewide_notices',
817
+ 'type' => 'object',
818
+ 'properties' => array(
819
+ 'id' => array(
820
+ 'context' => array( 'view', 'edit' ),
821
+ 'description' => __( 'A unique numeric ID for the sitewide notice.', 'buddypress' ),
822
+ 'type' => 'integer',
823
+ ),
824
+ 'subject' => array(
825
+ 'context' => array( 'view', 'edit' ),
826
+ 'description' => __( 'Subject of the sitewide notice.', 'buddypress' ),
827
+ 'type' => 'object',
828
+ 'arg_options' => array(
829
+ 'sanitize_callback' => null,
830
+ 'validate_callback' => null,
831
+ ),
832
+ 'properties' => array(
833
+ 'raw' => array(
834
+ 'description' => __( 'Title of the sitewide notice, as it exists in the database.', 'buddypress' ),
835
+ 'type' => 'string',
836
+ 'context' => array( 'edit' ),
837
+ 'default' => false,
838
+ ),
839
+ 'rendered' => array(
840
+ 'description' => __( 'Title of the sitewide notice, transformed for display.', 'buddypress' ),
841
+ 'type' => 'string',
842
+ 'context' => array( 'view', 'edit' ),
843
+ 'readonly' => true,
844
+ 'default' => false,
845
+ ),
846
+ ),
847
+ ),
848
+ 'message' => array(
849
+ 'context' => array( 'view', 'edit' ),
850
+ 'description' => __( 'Content of the sitewide notice.', 'buddypress' ),
851
+ 'type' => 'object',
852
+ 'required' => true,
853
+ 'arg_options' => array(
854
+ 'sanitize_callback' => null,
855
+ 'validate_callback' => null,
856
+ ),
857
+ 'properties' => array(
858
+ 'raw' => array(
859
+ 'description' => __( 'Content for the sitewide notice, as it exists in the database.', 'buddypress' ),
860
+ 'type' => 'string',
861
+ 'context' => array( 'edit' ),
862
+ ),
863
+ 'rendered' => array(
864
+ 'description' => __( 'HTML content for the sitewide notice, transformed for display.', 'buddypress' ),
865
+ 'type' => 'string',
866
+ 'context' => array( 'view', 'edit' ),
867
+ 'readonly' => true,
868
+ ),
869
+ ),
870
+ ),
871
+ 'date' => array(
872
+ 'context' => array( 'view', 'edit' ),
873
+ 'description' => __( "The date of the sitewide notice, in the site's timezone.", 'buddypress' ),
874
+ 'readonly' => true,
875
+ 'type' => 'string',
876
+ 'format' => 'date-time',
877
+ ),
878
+ 'is_active' => array(
879
+ 'context' => array( 'edit' ),
880
+ 'description' => __( 'Whether this notice is active or not.', 'buddypress' ),
881
+ 'readonly' => true,
882
+ 'type' => 'boolean',
883
+ ),
884
+ ),
885
+ );
886
+ }
887
+
888
+ /**
889
+ * Filters the notice schema.
890
+ *
891
+ * @since 9.0.0
892
+ *
893
+ * @param array $schema The endpoint schema.
894
+ */
895
+ return apply_filters( 'bp_rest_sitewide_notices_schema', $this->add_additional_fields_schema( $this->schema ) );
896
+ }
897
+
898
+ /**
899
+ * Get the query params for sitewide notices collections.
900
+ *
901
+ * @since 9.0.0
902
+ *
903
+ * @return array
904
+ */
905
+ public function get_collection_params() {
906
+ $params = parent::get_collection_params();
907
+ $params['context']['default'] = 'view';
908
+
909
+ /**
910
+ * Filters the collection query params.
911
+ *
912
+ * @since 9.0.0
913
+ *
914
+ * @param array $params Query params.
915
+ */
916
+ return apply_filters( 'bp_rest_sitewide_notices_collection_params', $params );
917
+ }
918
+
919
+ /**
920
+ * Prepare a notice for creation or update.
921
+ *
922
+ * @since 9.0.0
923
+ *
924
+ * @param WP_REST_Request $request Request object.
925
+ * @return BP_Messages_Notice|WP_Error Object or WP_Error.
926
+ */
927
+ protected function prepare_item_for_database( $request ) {
928
+ $schema = $this->get_item_schema();
929
+ $notice_id = $request->get_param( 'id' );
930
+ $prepared_item = $this->get_notice_object( $notice_id );
931
+
932
+ // Notice ID.
933
+ if ( ! empty( $schema['properties']['id'] ) && ! empty( $prepared_item->id ) ) {
934
+ $prepared_item->id = $prepared_item->id;
935
+ }
936
+
937
+ // Notice subject.
938
+ $subject = $request->get_param( 'subject' );
939
+ if ( ! empty( $schema['properties']['subject'] ) && $subject ) {
940
+ if ( is_string( $subject ) ) {
941
+ $prepared_item->subject = $subject;
942
+ } elseif ( isset( $subject['raw'] ) ) {
943
+ $prepared_item->subject = $subject['raw'];
944
+ }
945
+ }
946
+
947
+ // Notice message.
948
+ $message = $request->get_param( 'message' );
949
+ if ( ! empty( $schema['properties']['message'] ) && $message ) {
950
+ if ( is_string( $message ) ) {
951
+ $prepared_item->message = $message;
952
+ } elseif ( isset( $message['raw'] ) ) {
953
+ $prepared_item->message = $message['raw'];
954
+ }
955
+ }
956
+
957
+ // Date_sent is set at creation, so nothing to do.
958
+
959
+ // Is active.
960
+ $is_active = $request->get_param( 'is_active' );
961
+ if ( ! empty( $schema['properties']['is_active'] ) && ! is_null( $is_active ) ) {
962
+ // The method get_param() returns a string, so we must convert to an integer.
963
+ $prepared_item->is_active = absint( $is_active );
964
+ }
965
+
966
+ /**
967
+ * Filters a notice before it is updated via the REST API.
968
+ *
969
+ * @since 9.0.0
970
+ *
971
+ * @param BP_Messages_Notice $prepared_item A BP_Messages_Notice object prepared for inserting or updating the database.
972
+ * @param WP_REST_Request $request Request object.
973
+ */
974
+ return apply_filters( 'bp_rest_sitewide_notices_pre_update_value', $prepared_item, $request );
975
+ }
976
+ }
bp-messages/css/blocks/sitewide-notices-rtl.css ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [data-type="bp/sitewide-notices"] .bp-screen-reader-text {
2
+ border: 0;
3
+ clip: rect(0 0 0 0);
4
+ height: 1px;
5
+ margin: -1px;
6
+ overflow: hidden;
7
+ padding: 0;
8
+ position: absolute;
9
+ width: 1px;
10
+ word-wrap: normal !important;
11
+ }
12
+
13
+ [data-type="bp/sitewide-notices"] [data-bp-tooltip]::after {
14
+ background-color: #fff;
15
+ display: none;
16
+ opacity: 0;
17
+ position: absolute;
18
+ transform: translate3d(0, 0, 0);
19
+ visibility: hidden;
20
+ }
21
+
22
+ [data-type="bp/sitewide-notices"] [data-bp-tooltip]::after {
23
+ border: 1px solid #737373;
24
+ border-radius: 1px;
25
+ box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.2);
26
+ color: #333;
27
+ content: attr(data-bp-tooltip);
28
+ font-family: "Helvetica Neue", helvetica, arial, san-serif;
29
+ font-size: 12px;
30
+ font-weight: 400;
31
+ letter-spacing: normal;
32
+ line-height: 1.25;
33
+ max-width: 200px;
34
+ padding: 5px 8px;
35
+ pointer-events: none;
36
+ text-shadow: none;
37
+ text-transform: none;
38
+ transition: all 1.5s ease;
39
+ white-space: nowrap;
40
+ word-wrap: break-word;
41
+ z-index: 100000;
42
+ }
43
+
44
+ [data-type="bp/sitewide-notices"] .bp-tooltip::after {
45
+ right: 50%;
46
+ margin-top: 7px;
47
+ top: 110%;
48
+ transform: translate(50%, 0);
49
+ }
50
+
51
+ .bp-sitewide-notice-block {
52
+ position: relative;
53
+ padding-right: 1em;
54
+ border-right: solid 4px #ff853c;
55
+ }
56
+
57
+ .bp-sitewide-notice-block h2:before {
58
+ border: none;
59
+ background: none;
60
+ }
61
+
62
+ .bp-sitewide-notice-block .dismiss-notice {
63
+ display: block;
64
+ background-color: transparent;
65
+ border: solid 1px #ff853c;
66
+ color: #ff853c;
67
+ padding: 0.2em 0.5em;
68
+ width: fit-content;
69
+ position: absolute;
70
+ top: 0.5em;
71
+ left: 0.5em;
72
+ }
73
+
74
+ .bp-sitewide-notice-block .dismiss-notice:hover {
75
+ background-color: #ff853c;
76
+ color: #fff;
77
+ }
bp-messages/css/blocks/sitewide-notices-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ [data-type="bp/sitewide-notices"] .bp-screen-reader-text{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}[data-type="bp/sitewide-notices"] [data-bp-tooltip]::after{background-color:#fff;display:none;opacity:0;position:absolute;transform:translate3d(0,0,0);visibility:hidden}[data-type="bp/sitewide-notices"] [data-bp-tooltip]::after{border:1px solid #737373;border-radius:1px;box-shadow:-4px 4px 8px rgba(0,0,0,.2);color:#333;content:attr(data-bp-tooltip);font-family:"Helvetica Neue",helvetica,arial,san-serif;font-size:12px;font-weight:400;letter-spacing:normal;line-height:1.25;max-width:200px;padding:5px 8px;pointer-events:none;text-shadow:none;text-transform:none;transition:all 1.5s ease;white-space:nowrap;word-wrap:break-word;z-index:100000}[data-type="bp/sitewide-notices"] .bp-tooltip::after{right:50%;margin-top:7px;top:110%;transform:translate(50%,0)}.bp-sitewide-notice-block{position:relative;padding-right:1em;border-right:solid 4px #ff853c}.bp-sitewide-notice-block h2:before{border:none;background:0 0}.bp-sitewide-notice-block .dismiss-notice{display:block;background-color:transparent;border:solid 1px #ff853c;color:#ff853c;padding:.2em .5em;width:fit-content;position:absolute;top:.5em;left:.5em}.bp-sitewide-notice-block .dismiss-notice:hover{background-color:#ff853c;color:#fff}
bp-messages/css/blocks/sitewide-notices.css ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [data-type="bp/sitewide-notices"] .bp-screen-reader-text {
2
+ border: 0;
3
+ clip: rect(0 0 0 0);
4
+ height: 1px;
5
+ margin: -1px;
6
+ overflow: hidden;
7
+ padding: 0;
8
+ position: absolute;
9
+ width: 1px;
10
+ word-wrap: normal !important;
11
+ }
12
+
13
+ [data-type="bp/sitewide-notices"] [data-bp-tooltip]::after {
14
+ background-color: #fff;
15
+ display: none;
16
+ opacity: 0;
17
+ position: absolute;
18
+ transform: translate3d(0, 0, 0);
19
+ visibility: hidden;
20
+ }
21
+
22
+ [data-type="bp/sitewide-notices"] [data-bp-tooltip]::after {
23
+ border: 1px solid #737373;
24
+ border-radius: 1px;
25
+ box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2);
26
+ color: #333;
27
+ content: attr(data-bp-tooltip);
28
+ font-family: "Helvetica Neue", helvetica, arial, san-serif;
29
+ font-size: 12px;
30
+ font-weight: 400;
31
+ letter-spacing: normal;
32
+ line-height: 1.25;
33
+ max-width: 200px;
34
+ padding: 5px 8px;
35
+ pointer-events: none;
36
+ text-shadow: none;
37
+ text-transform: none;
38
+ transition: all 1.5s ease;
39
+ white-space: nowrap;
40
+ word-wrap: break-word;
41
+ z-index: 100000;
42
+ }
43
+
44
+ [data-type="bp/sitewide-notices"] .bp-tooltip::after {
45
+ left: 50%;
46
+ margin-top: 7px;
47
+ top: 110%;
48
+ transform: translate(-50%, 0);
49
+ }
50
+
51
+ .bp-sitewide-notice-block {
52
+ position: relative;
53
+ padding-left: 1em;
54
+ border-left: solid 4px #ff853c;
55
+ }
56
+
57
+ .bp-sitewide-notice-block h2:before {
58
+ border: none;
59
+ background: none;
60
+ }
61
+
62
+ .bp-sitewide-notice-block .dismiss-notice {
63
+ display: block;
64
+ background-color: transparent;
65
+ border: solid 1px #ff853c;
66
+ color: #ff853c;
67
+ padding: 0.2em 0.5em;
68
+ width: fit-content;
69
+ position: absolute;
70
+ top: 0.5em;
71
+ right: 0.5em;
72
+ }
73
+
74
+ .bp-sitewide-notice-block .dismiss-notice:hover {
75
+ background-color: #ff853c;
76
+ color: #fff;
77
+ }
bp-messages/css/blocks/sitewide-notices.min.css ADDED
@@ -0,0 +1 @@
 
1
+ [data-type="bp/sitewide-notices"] .bp-screen-reader-text{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}[data-type="bp/sitewide-notices"] [data-bp-tooltip]::after{background-color:#fff;display:none;opacity:0;position:absolute;transform:translate3d(0,0,0);visibility:hidden}[data-type="bp/sitewide-notices"] [data-bp-tooltip]::after{border:1px solid #737373;border-radius:1px;box-shadow:4px 4px 8px rgba(0,0,0,.2);color:#333;content:attr(data-bp-tooltip);font-family:"Helvetica Neue",helvetica,arial,san-serif;font-size:12px;font-weight:400;letter-spacing:normal;line-height:1.25;max-width:200px;padding:5px 8px;pointer-events:none;text-shadow:none;text-transform:none;transition:all 1.5s ease;white-space:nowrap;word-wrap:break-word;z-index:100000}[data-type="bp/sitewide-notices"] .bp-tooltip::after{left:50%;margin-top:7px;top:110%;transform:translate(-50%,0)}.bp-sitewide-notice-block{position:relative;padding-left:1em;border-left:solid 4px #ff853c}.bp-sitewide-notice-block h2:before{border:none;background:0 0}.bp-sitewide-notice-block .dismiss-notice{display:block;background-color:transparent;border:solid 1px #ff853c;color:#ff853c;padding:.2em .5em;width:fit-content;position:absolute;top:.5em;right:.5em}.bp-sitewide-notice-block .dismiss-notice:hover{background-color:#ff853c;color:#fff}
bp-messages/js/blocks/sitewide-notices.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"HPdN":[function(require,module,exports) {
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blockEditor.InspectorControls,n=e.components,l=n.Disabled,o=n.PanelBody,r=n.TextControl,i=e.element,s=i.Fragment,u=i.createElement,a=e.i18n.__,d=bp,b=d.blockComponents.ServerSideRender,p=function(e){var n=e.attributes,i=e.setAttributes,d=n.title;return u(s,null,u(t,null,u(o,{title:a("Settings","buddypress"),initialOpen:!0},u(r,{label:a("Title","buddypress"),value:d,onChange:function(e){i({title:e})}}))),u(l,null,u(b,{block:"bp/sitewide-notices",attributes:n})))},c=p;exports.default=c;
3
+ },{}],"lnNZ":[function(require,module,exports) {
4
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blocks.createBlock,r={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:function(e){var t=e.idBase,r=e.instance;return!(null==r||!r.raw)&&"bp_messages_sitewide_notices_widget"===t},transform:function(e){var r=e.instance;return t("bp/sitewide-notices",{title:r.raw.title})}}]},s=r;exports.default=s;
5
+ },{}],"kd3Z":[function(require,module,exports) {
6
+ "use strict";var e=i(require("./sitewide-notices/edit")),t=i(require("./sitewide-notices/transforms"));function i(e){return e&&e.__esModule?e:{default:e}}var s=wp,r=s.blocks.registerBlockType,d=s.i18n.__;r("bp/sitewide-notices",{title:d("Sitewide Notices","buddypress"),description:d("Display Sitewide Notices posted by the site administrator","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"megaphone"},category:"buddypress",attributes:{title:{type:"string",default:""}},edit:e.default,transforms:t.default});
7
+ },{"./sitewide-notices/edit":"HPdN","./sitewide-notices/transforms":"lnNZ"}]},{},["kd3Z"], null)
8
+ //# sourceMappingURL=/bp-messages/js/blocks/sitewide-notices.js.map
bp-messages/js/blocks/sitewide-notices.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-messages/js/blocks/sitewide-notices/edit.js","bp-messages/js/blocks/sitewide-notices/transforms.js","bp-messages/js/blocks/sitewide-notices.js"],"names":["editSitewideNoticesBlock","wp","InspectorControls","blockEditor","components","Disabled","PanelBody","TextControl","element","Fragment","createElement","__","i18n","bp","ServerSideRender","blockComponents","attributes","setAttributes","title","text","transforms","createBlock","blocks","from","type","isMatch","idBase","instance","raw","transform","registerBlockType","description","icon","background","foreground","src","category","default","edit"],"mappings":";AAqDeA,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAA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A,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAfA,IAOInB,EAAAA,GALF6B,EADDR,EAAAA,OACCQ,kBAGAnB,EADDC,EAAAA,KACCD,GAUFmB,EAAmB,sBAAuB,CACzCZ,MAAOP,EAAI,mBAAoB,cAC/BoB,YAAapB,EAAI,4DAA6D,cAC9EqB,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,aAENC,SAAU,aACVpB,WAAY,CACXE,MAAO,CACNM,KAAM,SACNa,QAAS,KAGXC,KAAMtC,EAfmC,QAgBzCoB,WAAYA,EAAAA","file":"sitewide-notices.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\n const {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tPanelBody,\n\t\tTextControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\n const {\n\tblockComponents: {\n\t\tServerSideRender,\n\t},\n} = bp;\n\nconst editSitewideNoticesBlock = ( { attributes, setAttributes } ) => {\n\tconst { title } = attributes;\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( text ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: text } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/sitewide-notices\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editSitewideNoticesBlock;\n","/**\n * WordPress dependencies.\n */\n const {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Legacy Widget to Friends Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_messages_sitewide_notices_widget';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\treturn createBlock( 'bp/sitewide-notices', {\n\t\t\t\t\ttitle: instance.raw.title\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editSitewideNoticesBlock from './sitewide-notices/edit';\nimport transforms from './sitewide-notices/transforms';\n\nregisterBlockType( 'bp/sitewide-notices', {\n\ttitle: __( 'Sitewide Notices', 'buddypress' ),\n\tdescription: __( 'Display Sitewide Notices posted by the site administrator', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'megaphone',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t},\n\t},\n\tedit: editSitewideNoticesBlock,\n\ttransforms: transforms,\n} );\n"]}
bp-messages/js/sitewide-notices.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"nIsC":[function(require,module,exports) {
2
+ function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function n(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}var o=function(){function t(n){e(this,t);var o=n.path,i=n.dismissPath,r=n.root,c=n.nonce;this.path=o,this.dismissPath=i,this.root=r,this.nonce=c}return n(t,[{key:"start",value:function(){var e=this;document.querySelectorAll(".bp-sitewide-notice-block a.dismiss-notice").forEach(function(t){t.addEventListener("click",function(t){t.preventDefault(),fetch(e.root+e.dismissPath,{method:"POST",headers:{"X-WP-Nonce":e.nonce}}).then(function(e){return e.json()}).then(function(e){void 0!==e&&void 0!==e.dismissed&&e.dismissed&&document.querySelectorAll(".bp-sitewide-notice-block").forEach(function(e){e.remove()})})})})}}]),t}(),i=window.bpSitewideNoticeBlockSettings||{},r=new o(i);"loading"===document.readyState?document.addEventListener("DOMContentLoaded",r.start()):r.start();
3
+ },{}]},{},["nIsC"], null)
4
+ //# sourceMappingURL=/bp-messages/js/sitewide-notices.js.map
bp-messages/js/sitewide-notices.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["bp-messages/js/sitewide-notices.js"],"names":["bpSitewideNoticeBlock","settings","path","dismissPath","root","nonce","document","querySelectorAll","forEach","dismissButton","addEventListener","event","preventDefault","fetch","method","headers","then","response","json","data","dismissed","elem","remove","window","bpSitewideNoticeBlockSettings","bpSitewideNotice","readyState","start"],"mappings":";AAiDC,SAAA,EAAA,EAAA,GAAA,KAAA,aAAA,GAAA,MAAA,IAAA,UAAA,qCAAA,SAAA,EAAA,EAAA,GAAA,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,OAAA,IAAA,CAAA,IAAA,EAAA,EAAA,GAAA,EAAA,WAAA,EAAA,aAAA,EAAA,EAAA,cAAA,EAAA,UAAA,IAAA,EAAA,UAAA,GAAA,OAAA,eAAA,EAAA,EAAA,IAAA,IAAA,SAAA,EAAA,EAAA,EAAA,GAAA,OAAA,GAAA,EAAA,EAAA,UAAA,GAAA,GAAA,EAAA,EAAA,GAAA,EA5CKA,IAAAA,EAAAA,WACQC,SAAAA,EAAAA,GAAW,EAAA,KAAA,GACfC,IAAAA,EAAmCD,EAAnCC,KAAMC,EAA6BF,EAA7BE,YAAaC,EAAgBH,EAAhBG,KAAMC,EAAUJ,EAAVI,MAC5BH,KAAAA,KAAOA,EACPC,KAAAA,YAAcA,EACdC,KAAAA,KAAOA,EACPC,KAAAA,MAAQA,EAsCd,OAAA,EAAA,EAAA,CAAA,CAAA,IAAA,QAnCA,MAAA,WAAQ,IAAA,EAAA,KAEPC,SAASC,iBAAkB,8CAA+CC,QAAS,SAAEC,GACpFA,EAAcC,iBAAkB,QAAS,SAAEC,GAC1CA,EAAMC,iBAENC,MAAO,EAAKT,KAAO,EAAKD,YAAa,CACpCW,OAAQ,OACRC,QAAS,CACO,aAAA,EAAKV,SAElBW,KACH,SAAEC,GAAcA,OAAAA,EAASC,SACxBF,KACD,SAAEG,QACI,IAAuBA,QAAQ,IAAuBA,EAAKC,WAAaD,EAAKC,WACjFd,SAASC,iBAAkB,6BAA8BC,QAAS,SAAEa,GACnEA,EAAKC,qBAkBZ,EA5CKtB,GAqCAC,EAAWsB,OAAOC,+BAAiC,GACnDC,EAAmB,IAAIzB,EAAuBC,GAE/C,YAAcK,SAASoB,WAC3BpB,SAASI,iBAAkB,mBAAoBe,EAAiBE,SAEhEF,EAAiBE","file":"sitewide-notices.js","sourceRoot":"../src/js","sourcesContent":["/**\n * Front-end Sitewide notices block class.\n *\n * @since 9.0.0\n */\nclass bpSitewideNoticeBlock {\n\tconstructor( settings ) {\n\t\tconst { path, dismissPath, root, nonce } = settings;\n\t\tthis.path = path;\n\t\tthis.dismissPath = dismissPath;\n\t\tthis.root = root;\n\t\tthis.nonce = nonce;\n\t}\n\n\tstart() {\n\t\t// Listen to each Block's dismiss button clicks\n\t\tdocument.querySelectorAll( '.bp-sitewide-notice-block a.dismiss-notice' ).forEach( ( dismissButton ) => {\n\t\t\tdismissButton.addEventListener( 'click', ( event ) => {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tfetch( this.root + this.dismissPath, {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t'X-WP-Nonce' : this.nonce,\n\t\t\t\t\t}\n\t\t\t\t} ).then(\n\t\t\t\t\t( response ) => response.json()\n\t\t\t\t).then(\n\t\t\t\t\t( data ) => {\n\t\t\t\t\t\tif ( 'undefined' !== typeof data && 'undefined' !== typeof data.dismissed && data.dismissed ) {\n\t\t\t\t\t\t\tdocument.querySelectorAll( '.bp-sitewide-notice-block' ).forEach( ( elem ) => {\n\t\t\t\t\t\t\t\telem.remove();\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t\t} );\n\t}\n}\n\n// widget_bp_core_sitewide_messages buddypress widget wp-block-bp-sitewide-notices > bp-sitewide-notice > a.dismiss-notice\nconst settings = window.bpSitewideNoticeBlockSettings || {};\nconst bpSitewideNotice = new bpSitewideNoticeBlock( settings );\n\nif ( 'loading' === document.readyState ) {\n\tdocument.addEventListener( 'DOMContentLoaded', bpSitewideNotice.start() );\n} else {\n\tbpSitewideNotice.start();\n}\n"]}
bp-messages/sass/blocks/sitewide-notices.scss ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [data-type="bp/sitewide-notices"] {
2
+
3
+ .bp-screen-reader-text {
4
+ border: 0;
5
+ clip: rect(0 0 0 0);
6
+ height: 1px;
7
+ margin: -1px;
8
+ overflow: hidden;
9
+ padding: 0;
10
+ position: absolute;
11
+ width: 1px;
12
+ word-wrap: normal !important;
13
+ }
14
+
15
+ [data-bp-tooltip]::after {
16
+ background-color: #fff;
17
+ display: none;
18
+ opacity: 0;
19
+ position: absolute;
20
+ transform: translate3d(0, 0, 0);
21
+ visibility: hidden;
22
+ }
23
+
24
+ [data-bp-tooltip]::after {
25
+ border: 1px solid #737373;
26
+ border-radius: 1px;
27
+ box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2);
28
+ color: #333;
29
+ content: attr(data-bp-tooltip);
30
+ font-family: "Helvetica Neue", helvetica, arial, san-serif;
31
+ font-size: 12px;
32
+ font-weight: 400;
33
+ letter-spacing: normal;
34
+ line-height: 1.25;
35
+ max-width: 200px;
36
+ padding: 5px 8px;
37
+ pointer-events: none;
38
+ text-shadow: none;
39
+ text-transform: none;
40
+ transition: all 1.5s ease;
41
+ white-space: nowrap;
42
+ word-wrap: break-word;
43
+ z-index: 100000;
44
+ }
45
+
46
+ .bp-tooltip::after {
47
+ left: 50%;
48
+ margin-top: 7px;
49
+ top: 110%;
50
+ transform: translate(-50%, 0);
51
+ }
52
+ }
53
+
54
+ .bp-sitewide-notice-block {
55
+ position: relative;
56
+ padding-left: 1em;
57
+ border-left: solid 4px #ff853c;
58
+
59
+ h2:before {
60
+ border: none;
61
+ background: none;
62
+ }
63
+
64
+ .dismiss-notice {
65
+ display: block;
66
+ background-color: transparent;
67
+ border: solid 1px #ff853c;
68
+ color: #ff853c;
69
+ padding: 0.2em 0.5em;
70
+ width: fit-content;
71
+ position: absolute;
72
+ top: 0.5em;
73
+ right: 0.5em;
74
+
75
+ &:hover {
76
+ background-color: #ff853c;
77
+ color: #fff;
78
+ }
79
+ }
80
+ }
bp-notifications/classes/class-bp-rest-notifications-endpoint.php CHANGED
@@ -99,20 +99,20 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
99
  */
100
  public function get_items( $request ) {
101
  $args = array(
102
- 'user_id' => $request['user_id'],
103
- 'user_ids' => $request['user_ids'],
104
- 'item_id' => $request['item_id'],
105
- 'secondary_item_id' => $request['secondary_item_id'],
106
- 'component_name' => $request['component_name'],
107
- 'component_action' => $request['component_action'],
108
- 'order_by' => $request['order_by'],
109
- 'sort_order' => strtoupper( $request['sort_order'] ),
110
- 'is_new' => $request['is_new'],
111
- 'page' => $request['page'],
112
- 'per_page' => $request['per_page'],
113
  );
114
 
115
- if ( empty( $request['component_action'] ) ) {
116
  $args['component_action'] = false;
117
  }
118
 
@@ -124,7 +124,7 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
124
  }
125
  }
126
 
127
- if ( empty( $request['component_name'] ) ) {
128
  $args['component_name'] = false;
129
  }
130
 
@@ -204,8 +204,7 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
204
  */
205
  public function get_item( $request ) {
206
  $notification = $this->get_notification_object( $request );
207
-
208
- $retval = array(
209
  $this->prepare_response_for_collection(
210
  $this->prepare_item_for_response( $notification, $request )
211
  ),
@@ -247,7 +246,7 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
247
  if ( is_user_logged_in() ) {
248
  $notification = $this->get_notification_object( $request );
249
 
250
- if ( is_null( $notification->item_id ) ) {
251
  $retval = new WP_Error(
252
  'bp_rest_notification_invalid_id',
253
  __( 'Invalid notification ID.', 'buddypress' ),
@@ -418,8 +417,8 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
418
  * @since 5.0.0
419
  *
420
  * @param BP_Notifications_Notification $notification The updated notification.
421
- * @param WP_REST_Response $response The response data.
422
- * @param WP_REST_Request $request The request sent to the API.
423
  */
424
  do_action( 'bp_rest_notifications_update_item', $notification, $response, $request );
425
 
@@ -524,8 +523,8 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
524
  *
525
  * @since 5.0.0
526
  *
527
- * @param BP_Notifications_Notification $notification Notification data.
528
- * @param WP_REST_Request $request Full details about the request.
529
  * @return WP_REST_Response
530
  */
531
  public function prepare_item_for_response( $notification, $request ) {
@@ -540,7 +539,7 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
540
  'is_new' => $notification->is_new,
541
  );
542
 
543
- $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
544
  $data = $this->add_additional_fields_to_object( $data, $request );
545
  $data = $this->filter_response_by_context( $data, $context );
546
  $response = rest_ensure_response( $data );
@@ -552,8 +551,8 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
552
  *
553
  * @since 5.0.0
554
  *
555
- * @param WP_REST_Response $response The response data.
556
- * @param WP_REST_Request $request Request used to generate the response.
557
  * @param BP_Notifications_Notification $notification Notification object.
558
  */
559
  return apply_filters( 'bp_rest_notifications_prepare_value', $response, $request, $notification );
@@ -564,7 +563,7 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
564
  *
565
  * @since 5.0.0
566
  *
567
- * @param WP_REST_Request $request Request object.
568
  * @return stdClass
569
  */
570
  protected function prepare_item_for_database( $request ) {
@@ -576,46 +575,46 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
576
  $prepared_notification->id = $notification->id;
577
  }
578
 
579
- if ( ! empty( $schema['properties']['user_id'] ) && isset( $request['user_id'] ) ) {
580
- $prepared_notification->user_id = (int) $request['user_id'];
581
  } elseif ( isset( $notification->user_id ) ) {
582
  $prepared_notification->user_id = $notification->user_id;
583
  } else {
584
  $prepared_notification->user_id = bp_loggedin_user_id();
585
  }
586
 
587
- if ( ! empty( $schema['properties']['item_id'] ) && isset( $request['item_id'] ) ) {
588
- $prepared_notification->item_id = $request['item_id'];
589
  } elseif ( isset( $notification->item_id ) ) {
590
  $prepared_notification->item_id = $notification->item_id;
591
  }
592
 
593
- if ( ! empty( $schema['properties']['secondary_item_id'] ) && isset( $request['secondary_item_id'] ) ) {
594
- $prepared_notification->secondary_item_id = $request['secondary_item_id'];
595
  } elseif ( isset( $notification->secondary_item_id ) ) {
596
  $prepared_notification->secondary_item_id = $notification->secondary_item_id;
597
  }
598
 
599
- if ( ! empty( $schema['properties']['component'] ) && isset( $request['component'] ) ) {
600
- $prepared_notification->component_name = $request['component'];
601
  } elseif ( isset( $notification->component_name ) ) {
602
  $prepared_notification->component_name = $notification->component_name;
603
  }
604
 
605
- if ( ! empty( $schema['properties']['action'] ) && isset( $request['action'] ) ) {
606
- $prepared_notification->component_action = $request['action'];
607
  } elseif ( isset( $notification->component_action ) ) {
608
  $prepared_notification->component_action = $notification->component_action;
609
  }
610
 
611
- if ( ! empty( $schema['properties']['is_new'] ) && isset( $request['is_new'] ) ) {
612
- $prepared_notification->is_new = $request['is_new'];
613
  } elseif ( isset( $notification->is_new ) ) {
614
  $prepared_notification->is_new = $notification->is_new;
615
  }
616
 
617
- if ( ! empty( $schema['properties']['date'] ) && isset( $request['date'] ) ) {
618
- $prepared_notification->date_notified = $request['date'];
619
  } elseif ( isset( $notification->date_notified ) ) {
620
  $prepared_notification->date_notified = $notification->date_notified;
621
  }
@@ -626,7 +625,7 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
626
  * @since 5.0.0
627
  *
628
  * @param stdClass $prepared_notification An object prepared for inserting or updating the database.
629
- * @param WP_REST_Request $request Request object.
630
  */
631
  return apply_filters( 'bp_rest_notifications_pre_insert_value', $prepared_notification, $request );
632
  }
@@ -640,7 +639,7 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
640
  * @return array Links for the given plugin.
641
  */
642
  protected function prepare_links( $notification ) {
643
- $base = sprintf( '/%s/%s/', $this->namespace, $this->rest_base );
644
 
645
  // Entity meta.
646
  $links = array(
@@ -650,12 +649,61 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
650
  'collection' => array(
651
  'href' => rest_url( $base ),
652
  ),
653
- 'user' => array(
654
- 'href' => rest_url( bp_rest_get_user_url( $notification->user_id ) ),
655
- 'embeddable' => true,
656
- ),
657
  );
658
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  /**
660
  * Filter links prepared for the REST response.
661
  *
@@ -683,27 +731,23 @@ class BP_REST_Notifications_Endpoint extends WP_REST_Controller {
683
  }
684
 
685
  // Moderators as well.
686
- if ( bp_current_user_can( 'bp_moderate' ) ) {
687
- return true;
688
- }
689
-
690
- return false;
691
  }
692
 
693
  /**
694
- * Get notification object.
695
  *
696
  * @since 5.0.0
697
  *
698
- * @param WP_REST_Request $request Full details about the request.
699
  * @return BP_Notifications_Notification|string A notification object|Empty string.
700
  */
701
  public function get_notification_object( $request ) {
702
- $notification_id = is_numeric( $request ) ? $request : (int) $request['id'];
703
-
704
- $notification = bp_notifications_get_notification( $notification_id );
705
 
706
- if ( empty( $notification->id ) ) {
 
707
  return '';
708
  }
709
 
99
  */
100
  public function get_items( $request ) {
101
  $args = array(
102
+ 'user_id' => $request->get_param( 'user_id' ),
103
+ 'user_ids' => $request->get_param( 'user_ids' ),
104
+ 'item_id' => $request->get_param( 'item_id' ),
105
+ 'secondary_item_id' => $request->get_param( 'secondary_item_id' ),
106
+ 'component_name' => $request->get_param( 'component_name' ),
107
+ 'component_action' => $request->get_param( 'component_action' ),
108
+ 'order_by' => $request->get_param( 'order_by' ),
109
+ 'sort_order' => strtoupper( $request->get_param( 'sort_order' ) ),
110
+ 'is_new' => $request->get_param( 'is_new' ),
111
+ 'page' => $request->get_param( 'page' ),
112
+ 'per_page' => $request->get_param( 'per_page' ),
113
  );
114
 
115
+ if ( empty( $request->get_param( 'component_action' ) ) ) {
116
  $args['component_action'] = false;
117
  }
118
 
124
  }
125
  }
126
 
127
+ if ( empty( $request->get_param( 'component_name' ) ) ) {
128
  $args['component_name'] = false;
129
  }
130
 
204
  */
205
  public function get_item( $request ) {
206
  $notification = $this->get_notification_object( $request );
207
+ $retval = array(
 
208
  $this->prepare_response_for_collection(
209
  $this->prepare_item_for_response( $notification, $request )
210
  ),
246
  if ( is_user_logged_in() ) {
247
  $notification = $this->get_notification_object( $request );
248
 
249
+ if ( empty( $notification ) ) {
250
  $retval = new WP_Error(
251
  'bp_rest_notification_invalid_id',
252
  __( 'Invalid notification ID.', 'buddypress' ),
417
  * @since 5.0.0
418
  *
419
  * @param BP_Notifications_Notification $notification The updated notification.
420
+ * @param WP_REST_Response $response The response data.
421
+ * @param WP_REST_Request $request The request sent to the API.
422
  */
423
  do_action( 'bp_rest_notifications_update_item', $notification, $response, $request );
424
 
523
  *
524
  * @since 5.0.0
525
  *
526
+ * @param BP_Notifications_Notification $notification Notification object.
527
+ * @param WP_REST_Request $request Full details about the request.
528
  * @return WP_REST_Response
529
  */
530
  public function prepare_item_for_response( $notification, $request ) {
539
  'is_new' => $notification->is_new,
540
  );
541
 
542
+ $context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
543
  $data = $this->add_additional_fields_to_object( $data, $request );
544
  $data = $this->filter_response_by_context( $data, $context );
545
  $response = rest_ensure_response( $data );
551
  *
552
  * @since 5.0.0
553
  *
554
+ * @param WP_REST_Response $response The response data.
555
+ * @param WP_REST_Request $request Request used to generate the response.
556
  * @param BP_Notifications_Notification $notification Notification object.
557
  */
558
  return apply_filters( 'bp_rest_notifications_prepare_value', $response, $request, $notification );
563
  *
564
  * @since 5.0.0
565
  *
566
+ * @param WP_REST_Request $request Full details about the request.
567
  * @return stdClass
568
  */
569
  protected function prepare_item_for_database( $request ) {
575
  $prepared_notification->id = $notification->id;
576
  }
577
 
578
+ if ( ! empty( $schema['properties']['user_id'] ) && ! empty( $request->get_param( 'user_id' ) ) ) {
579
+ $prepared_notification->user_id = (int) $request->get_param( 'user_id' );
580
  } elseif ( isset( $notification->user_id ) ) {
581
  $prepared_notification->user_id = $notification->user_id;
582
  } else {
583
  $prepared_notification->user_id = bp_loggedin_user_id();
584
  }
585
 
586
+ if ( ! empty( $schema['properties']['item_id'] ) && ! empty( $request->get_param( 'item_id' ) ) ) {
587
+ $prepared_notification->item_id = $request->get_param( 'item_id' );
588
  } elseif ( isset( $notification->item_id ) ) {
589
  $prepared_notification->item_id = $notification->item_id;
590
  }
591
 
592
+ if ( ! empty( $schema['properties']['secondary_item_id'] ) && ! empty( $request->get_param( 'secondary_item_id' ) ) ) {
593
+ $prepared_notification->secondary_item_id = $request->get_param( 'secondary_item_id' );
594
  } elseif ( isset( $notification->secondary_item_id ) ) {
595
  $prepared_notification->secondary_item_id = $notification->secondary_item_id;
596
  }
597
 
598
+ if ( ! empty( $schema['properties']['component'] ) && ! empty( $request->get_param( 'component' ) ) ) {
599
+ $prepared_notification->component_name = $request->get_param( 'component' );
600
  } elseif ( isset( $notification->component_name ) ) {
601
  $prepared_notification->component_name = $notification->component_name;
602
  }
603
 
604
+ if ( ! empty( $schema['properties']['action'] ) && ! empty( $request->get_param( 'action' ) ) ) {
605
+ $prepared_notification->component_action = $request->get_param( 'action' );
606
  } elseif ( isset( $notification->component_action ) ) {
607
  $prepared_notification->component_action = $notification->component_action;
608
  }
609
 
610
+ if ( ! empty( $schema['properties']['is_new'] ) && ! empty( $request->get_param( 'is_new' ) ) ) {
611
+ $prepared_notification->is_new = $request->get_param( 'is_new' );
612
  } elseif ( isset( $notification->is_new ) ) {
613
  $prepared_notification->is_new = $notification->is_new;
614
  }
615
 
616
+ if ( ! empty( $schema['properties']['date'] ) && ! empty( $request->get_param( 'date' ) ) ) {
617
+ $prepared_notification->date_notified = $request->get_param( 'date' );
618
  } elseif ( isset( $notification->date_notified ) ) {
619
  $prepared_notification->date_notified = $notification->date_notified;
620
  }
625
  * @since 5.0.0
626
  *
627
  * @param stdClass $prepared_notification An object prepared for inserting or updating the database.
628
+ * @param WP_REST_Request $request Full details about the request.
629
  */
630
  return apply_filters( 'bp_rest_notifications_pre_insert_value', $prepared_notification, $request );
631
  }
639
  * @return array Links for the given plugin.
640
  */
641
  protected function prepare_links( $notification ) {
642
+ $base = sprintf( '/%1$s/%2$s/', $this->namespace, $this->rest_base );
643
 
644
  // Entity meta.
645
  $links = array(
649
  'collection' => array(
650
  'href' => rest_url( $base ),
651
  ),
 
 
 
 
652
  );
653
 
654
+ // Embed User.
655
+ if ( ! empty( $notification->user_id ) ) {
656
+ $links['user'] = array(
657
+ 'embeddable' => true,
658
+ 'href' => bp_rest_get_object_url( absint( $notification->user_id ), 'members' ),
659
+ );
660
+ }
661
+
662
+ // Embed Activity.
663
+ if ( bp_is_active( 'activity' ) && buddypress()->activity->id === $notification->component_name && ! empty( $notification->item_id ) ) {
664
+ $links[ buddypress()->activity->id ] = array(
665
+ 'embeddable' => true,
666
+ 'href' => rest_url(
667
+ sprintf(
668
+ '/%1$s/%2$s/%3$d',
669
+ $this->namespace,
670
+ buddypress()->activity->id,
671
+ absint( $notification->item_id )
672
+ )
673
+ ),
674
+ );
675
+ }
676
+
677
+ // Embed Group.
678
+ if ( bp_is_active( 'groups' ) && buddypress()->groups->id === $notification->component_name && ! empty( $notification->item_id ) ) {
679
+ $links['group'] = array(
680
+ 'embeddable' => true,
681
+ 'href' => rest_url(
682
+ sprintf(
683
+ '/%1$s/%2$s/%3$d',
684
+ $this->namespace,
685
+ buddypress()->groups->id,
686
+ absint( $notification->item_id )
687
+ )
688
+ ),
689
+ );
690
+ }
691
+
692
+ // Embed Blog.
693
+ if ( bp_is_active( 'blogs' ) && buddypress()->blogs->id === $notification->component_name && ! empty( $notification->item_id ) ) {
694
+ $links['blog'] = array(
695
+ 'embeddable' => true,
696
+ 'href' => rest_url(
697
+ sprintf(
698
+ '/%1$s/%2$s/%3$d',
699
+ $this->namespace,
700
+ buddypress()->blogs->id,
701
+ absint( $notification->item_id )
702
+ )
703
+ ),
704
+ );
705
+ }
706
+
707
  /**
708
  * Filter links prepared for the REST response.
709
  *
731
  }
732
 
733
  // Moderators as well.
734
+ return bp_current_user_can( 'bp_moderate' );
 
 
 
 
735
  }
736
 
737
  /**
738
+ * Get a notification object.
739
  *
740
  * @since 5.0.0
741
  *
742
+ * @param int|WP_REST_Request $request Full details about the request or an integer.
743
  * @return BP_Notifications_Notification|string A notification object|Empty string.
744
  */
745
  public function get_notification_object( $request ) {
746
+ $notification_id = is_numeric( $request ) ? $request : $request->get_param( 'id' );
747
+ $notification = bp_notifications_get_notification( absint( $notification_id ) );
 
748
 
749
+ // Inexistent notification objects return the id being checked, so confirm another field is present.
750
+ if ( empty( $notification->id ) || is_null( $notification->item_id ) ) {
751
  return '';
752
  }
753
 
bp-settings/actions/general.php CHANGED
@@ -58,11 +58,13 @@ function bp_settings_action_general() {
58
  // Validate the user again for the current password when making a big change.
59
  if ( ( is_super_admin() ) || ( !empty( $_POST['pwd'] ) && wp_check_password( $_POST['pwd'], $bp->displayed_user->userdata->user_pass, bp_displayed_user_id() ) ) ) {
60
 
61
- $update_user = get_userdata( bp_displayed_user_id() );
 
 
62
 
63
  /* Email Change Attempt ******************************************/
64
 
65
- if ( !empty( $_POST['email'] ) ) {
66
 
67
  // What is missing from the profile page vs signup -
68
  // let's double check the goodies.
@@ -70,7 +72,7 @@ function bp_settings_action_general() {
70
  $old_user_email = $bp->displayed_user->userdata->user_email;
71
 
72
  // User is changing email address.
73
- if ( $old_user_email != $user_email ) {
74
 
75
  // Run some tests on the email address.
76
  $email_checks = bp_core_validate_email_address( $user_email );
@@ -114,7 +116,6 @@ function bp_settings_action_general() {
114
 
115
  // We mark that the change has taken place so as to ensure a
116
  // success message, even though verification is still required.
117
- $_POST['email'] = $update_user->user_email;
118
  $email_changed = true;
119
  }
120
 
@@ -138,9 +139,9 @@ function bp_settings_action_general() {
138
  if ( ! $pass_error->get_error_message() ) {
139
  // Password change attempt is successful.
140
  if ( ( ! empty( $_POST['pwd'] ) && wp_unslash( $_POST['pwd'] ) !== $pass ) || is_super_admin() ) {
141
- $update_user->user_pass = $_POST['pass1'];
142
- $pass_error = false;
143
- $pass_changed = true;
144
 
145
  // The new password is the same as the current password.
146
  } else {
@@ -157,18 +158,10 @@ function bp_settings_action_general() {
157
  $pass_error = new WP_Error( 'empty_user_password', __( 'One of the password fields was empty.', 'buddypress' ) );
158
  }
159
 
160
- // The structure of the $update_user object changed in WP 3.3, but
161
- // wp_update_user() still expects the old format.
162
- if ( isset( $update_user->data ) && is_object( $update_user->data ) ) {
163
- $update_user = $update_user->data;
164
- $update_user = get_object_vars( $update_user );
165
-
166
- // Unset the password field to prevent it from emptying out the
167
- // user's user_pass field in the database.
168
- // @see wp_update_user().
169
- if ( false === $pass_changed ) {
170
- unset( $update_user['user_pass'] );
171
- }
172
  }
173
 
174
  // Clear cached data, so that the changed settings take effect
@@ -252,7 +245,25 @@ function bp_settings_verify_email_change() {
252
 
253
  // Email change is being verified.
254
  if ( isset( $_GET['verify_email_change'] ) ) {
255
- $pending_email = bp_get_user_meta( bp_displayed_user_id(), 'pending_email_change', true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
 
257
  // Bail if the hash provided doesn't match the one saved in the database.
258
  if ( ! hash_equals( urldecode( $_GET['verify_email_change'] ), $pending_email['hash'] ) ) {
@@ -260,14 +271,24 @@ function bp_settings_verify_email_change() {
260
  }
261
 
262
  $email_changed = wp_update_user( array(
263
- 'ID' => bp_displayed_user_id(),
264
  'user_email' => trim( $pending_email['newemail'] ),
265
  ) );
266
 
267
  if ( $email_changed ) {
268
-
269
  // Delete the pending email change key.
270
- bp_delete_user_meta( bp_displayed_user_id(), 'pending_email_change' );
 
 
 
 
 
 
 
 
 
 
 
271
 
272
  // Post a success message and redirect.
273
  bp_core_add_message( __( 'You have successfully verified your new email address.', 'buddypress' ) );
@@ -277,19 +298,30 @@ function bp_settings_verify_email_change() {
277
  }
278
 
279
  bp_core_redirect( $redirect_to );
280
- die();
281
 
282
  // Email change is being dismissed.
283
  } elseif ( ! empty( $_GET['dismiss_email_change'] ) ) {
284
  $nonce_check = isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), 'bp_dismiss_email_change' );
285
 
286
  if ( $nonce_check ) {
287
- bp_delete_user_meta( bp_displayed_user_id(), 'pending_email_change' );
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  bp_core_add_message( __( 'You have successfully dismissed your pending email change.', 'buddypress' ) );
289
  }
290
 
291
  bp_core_redirect( $redirect_to );
292
- die();
293
  }
294
  }
295
  add_action( 'bp_actions', 'bp_settings_verify_email_change' );
58
  // Validate the user again for the current password when making a big change.
59
  if ( ( is_super_admin() ) || ( !empty( $_POST['pwd'] ) && wp_check_password( $_POST['pwd'], $bp->displayed_user->userdata->user_pass, bp_displayed_user_id() ) ) ) {
60
 
61
+ $update_user = array(
62
+ 'ID' => (int) bp_displayed_user_id(),
63
+ );
64
 
65
  /* Email Change Attempt ******************************************/
66
 
67
+ if ( ! empty( $_POST['email'] ) ) {
68
 
69
  // What is missing from the profile page vs signup -
70
  // let's double check the goodies.
72
  $old_user_email = $bp->displayed_user->userdata->user_email;
73
 
74
  // User is changing email address.
75
+ if ( $old_user_email !== $user_email ) {
76
 
77
  // Run some tests on the email address.
78
  $email_checks = bp_core_validate_email_address( $user_email );
116
 
117
  // We mark that the change has taken place so as to ensure a
118
  // success message, even though verification is still required.
 
119
  $email_changed = true;
120
  }
121
 
139
  if ( ! $pass_error->get_error_message() ) {
140
  // Password change attempt is successful.
141
  if ( ( ! empty( $_POST['pwd'] ) && wp_unslash( $_POST['pwd'] ) !== $pass ) || is_super_admin() ) {
142
+ $update_user['user_pass'] = $_POST['pass1'];
143
+ $pass_error = false;
144
+ $pass_changed = true;
145
 
146
  // The new password is the same as the current password.
147
  } else {
158
  $pass_error = new WP_Error( 'empty_user_password', __( 'One of the password fields was empty.', 'buddypress' ) );
159
  }
160
 
161
+ // Unset the password field to prevent it from emptying out the
162
+ // user's user_pass field in the database.
163
+ if ( false === $pass_changed ) {
164
+ unset( $update_user['user_pass'] );
 
 
 
 
 
 
 
 
165
  }
166
 
167
  // Clear cached data, so that the changed settings take effect
245
 
246
  // Email change is being verified.
247
  if ( isset( $_GET['verify_email_change'] ) ) {
248
+ $user_id = bp_displayed_user_id();
249
+ $pending_email = (array) bp_get_user_meta( $user_id, 'pending_email_change', true );
250
+
251
+ // The user may have dismissed the email change.
252
+ if ( ! array_filter( $pending_email ) ) {
253
+ /**
254
+ * Fires when a Pending Email Change is missing and before
255
+ * BuddyPress redirects the user to an error message.
256
+ *
257
+ * @since 9.1.0
258
+ *
259
+ * @param int $user_id The user ID.
260
+ * @param string $redirect_to The Default Front-end Settings Screen URL.
261
+ */
262
+ do_action( 'bp_settings_missing_pending_email_change_hash', $user_id, $redirect_to );
263
+
264
+ bp_core_add_message( __( 'There was a problem verifying your new email address. If you haven’t dismissed the pending email change, please request a new email update.', 'buddypress' ), 'error' );
265
+ bp_core_redirect( $redirect_to );
266
+ }
267
 
268
  // Bail if the hash provided doesn't match the one saved in the database.
269
  if ( ! hash_equals( urldecode( $_GET['verify_email_change'] ), $pending_email['hash'] ) ) {
271
  }
272
 
273
  $email_changed = wp_update_user( array(
274
+ 'ID' => $user_id,
275
  'user_email' => trim( $pending_email['newemail'] ),
276
  ) );
277
 
278
  if ( $email_changed ) {
 
279
  // Delete the pending email change key.
280
+ bp_delete_user_meta( $user_id, 'pending_email_change' );
281
+
282
+ /**
283
+ * Fires when a Pending Email Change has been validated and before
284
+ * BuddyPress redirects the user to a success message.
285
+ *
286
+ * @since 9.1.0
287
+ *
288
+ * @param int $user_id The user ID.
289
+ * @param string $redirect_to The Default Front-end Settings Screen URL.
290
+ */
291
+ do_action( 'bp_settings_email_changed', $user_id, $redirect_to );
292
 
293
  // Post a success message and redirect.
294
  bp_core_add_message( __( 'You have successfully verified your new email address.', 'buddypress' ) );
298
  }
299
 
300
  bp_core_redirect( $redirect_to );
 
301
 
302
  // Email change is being dismissed.
303
  } elseif ( ! empty( $_GET['dismiss_email_change'] ) ) {
304
  $nonce_check = isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), 'bp_dismiss_email_change' );
305
 
306
  if ( $nonce_check ) {
307
+ $user_id = bp_displayed_user_id();
308
+ bp_delete_user_meta( $user_id, 'pending_email_change' );
309
+
310
+ /**
311
+ * Fires when a Pending Email Change has been dismissed and before
312
+ * BuddyPress redirects the user to a success message.
313
+ *
314
+ * @since 9.1.0
315
+ *
316
+ * @param int $user_id The user ID.
317
+ * @param string $redirect_to The Default Front-end Settings Screen URL.
318
+ */
319
+ do_action( 'bp_settings_email_change_dismissed', $user_id, $redirect_to );
320
+
321
  bp_core_add_message( __( 'You have successfully dismissed your pending email change.', 'buddypress' ) );
322
  }
323
 
324
  bp_core_redirect( $redirect_to );
 
325
  }
326
  }
327
  add_action( 'bp_actions', 'bp_settings_verify_email_change' );
bp-settings/classes/class-bp-settings-component.php CHANGED
@@ -292,4 +292,16 @@ class BP_Settings_Component extends BP_Component {
292
 
293
  parent::setup_admin_bar( $wp_admin_nav );
294
  }
 
 
 
 
 
 
 
 
 
 
 
 
295
  }
292
 
293
  parent::setup_admin_bar( $wp_admin_nav );
294
  }
295
+
296
+ /**
297
+ * Register the BP Settings Blocks.
298
+ *
299
+ * @since 9.0.0
300
+ *
301
+ * @param array $blocks Optional. See BP_Component::blocks_init() for
302
+ * description.
303
+ */
304
+ public function blocks_init( $blocks = array() ) {
305
+ parent::blocks_init( array() );
306
+ }
307
  }
bp-templates/bp-legacy/buddypress-functions.php CHANGED
@@ -124,7 +124,7 @@ class BP_Legacy extends BP_Theme_Compat {
124
 
125
  // Only hook the 'sitewide_notices' overlay if the Sitewide
126
  // Notices widget is not in use (to avoid duplicate content).
127
- if ( bp_is_active( 'messages' ) && ! is_active_widget( false, false, 'bp_messages_sitewide_notices_widget', true ) ) {
128
  add_action( 'wp_footer', array( $this, 'sitewide_notices' ), 9999 );
129
  }
130
 
@@ -490,8 +490,9 @@ class BP_Legacy extends BP_Theme_Compat {
490
  */
491
  public function sitewide_notices() {
492
  // Do not show notices if user is not logged in.
493
- if ( ! is_user_logged_in() )
494
  return;
 
495
 
496
  // Add a class to determine if the admin bar is on or not.
497
  $class = did_action( 'admin_bar_menu' ) ? 'admin-bar-on' : 'admin-bar-off';
@@ -1623,15 +1624,7 @@ function bp_legacy_theme_ajax_close_notice() {
1623
  echo "-1<div id='message' class='error'><p>" . __( 'There was a problem closing the notice.', 'buddypress' ) . '</p></div>';
1624
 
1625
  } else {
1626
- $user_id = get_current_user_id();
1627
- $notice_ids = bp_get_user_meta( $user_id, 'closed_notices', true );
1628
- if ( ! is_array( $notice_ids ) ) {
1629
- $notice_ids = array();
1630
- }
1631
-
1632
- $notice_ids[] = (int) $_POST['notice_id'];
1633
-
1634
- bp_update_user_meta( $user_id, 'closed_notices', $notice_ids );
1635
  }
1636
 
1637
  exit;
124
 
125
  // Only hook the 'sitewide_notices' overlay if the Sitewide
126
  // Notices widget is not in use (to avoid duplicate content).
127
+ if ( bp_is_active( 'messages' ) && ! bp_is_widget_block_active( 'bp/sitewide-notices', 'bp_messages_sitewide_notices_widget', true ) ) {
128
  add_action( 'wp_footer', array( $this, 'sitewide_notices' ), 9999 );
129
  }
130
 
490
  */
491
  public function sitewide_notices() {
492
  // Do not show notices if user is not logged in.
493
+ if ( ! is_user_logged_in() || is_admin() ) {
494
  return;
495
+ }
496
 
497
  // Add a class to determine if the admin bar is on or not.
498
  $class = did_action( 'admin_bar_menu' ) ? 'admin-bar-on' : 'admin-bar-off';
1624
  echo "-1<div id='message' class='error'><p>" . __( 'There was a problem closing the notice.', 'buddypress' ) . '</p></div>';
1625
 
1626
  } else {
1627
+ bp_messages_dismiss_sitewide_notice( bp_loggedin_user_id(), (int) $_POST['notice_id'] );
 
 
 
 
 
 
 
 
1628
  }
1629
 
1630
  exit;
bp-templates/bp-legacy/buddypress/assets/widgets/dynamic-groups.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Dynamic Groups Widget Block template.
4
+ *
5
+ * @since 9.0.0
6
+ *
7
+ * @package BuddyPress
8
+ * @subpackage bp-legacy
9
+ * @version 9.0.0
10
+ */
11
+ ?>
12
+ <script type="html/template" id="tmpl-bp-dynamic-groups-item">
13
+ <li class="vcard">
14
+ <div class="item-avatar">
15
+ <a href="{{{data.link}}}" class="bp-tooltip" data-bp-tooltip="{{data.name}}">
16
+ <img loading="lazy" src="{{{data.avatar_urls.thumb}}}" class="avatar group-{{data.id}}-avatar avatar-50 photo" width="50" height="50" alt="{{{data.avatar_alt}}}">
17
+ </a>
18
+ </div>
19
+
20
+ <div class="item">
21
+ <div class="item-title fn"><a href="{{{data.link}}}">{{data.name}}</a></div>
22
+ <div class="item-meta">
23
+ <span class="activity">{{data.extra}}</span>
24
+ </div>
25
+ </div>
26
+ </li>
27
+ </script>
bp-templates/bp-legacy/buddypress/assets/widgets/dynamic-members.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Dynamic Members Widget Block template.
4
+ *
5
+ * @since 9.0.0
6
+ *
7
+ * @package BuddyPress
8
+ * @subpackage bp-legacy
9
+ * @version 9.0.0
10
+ */
11
+ ?>
12
+ <script type="html/template" id="tmpl-bp-dynamic-members-item">
13
+ <li class="vcard">
14
+ <div class="item-avatar">
15
+ <a href="{{{data.link}}}" class="bp-tooltip" data-bp-tooltip="{{data.name}}">
16
+ <img loading="lazy" src="{{{data.avatar_urls.thumb}}}" class="avatar user-{{data.id}}-avatar avatar-50 photo" width="50" height="50" alt="{{{data.avatar_alt}}}">
17
+ </a>
18
+ </div>
19
+
20
+ <div class="item">
21
+ <div class="item-title fn"><a href="{{{data.link}}}">{{data.name}}</a></div>
22
+ <div class="item-meta">
23
+ <span class="activity">{{data.extra}}</span>
24
+ </div>
25
+ </div>
26
+ </li>
27
+ </script>
bp-templates/bp-legacy/buddypress/assets/widgets/friends.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Friends Widget Block template.
4
+ *
5
+ * @since 9.0.0
6
+ *
7
+ * @package BuddyPress
8
+ * @subpackage bp-legacy
9
+ * @version 9.0.0
10
+ */
11
+ ?>
12
+ <script type="html/template" id="tmpl-bp-friends-item">
13
+ <li class="vcard">
14
+ <div class="item-avatar">
15
+ <a href="{{{data.link}}}" class="bp-tooltip" data-bp-tooltip="{{data.name}}">
16
+ <img loading="lazy" src="{{{data.avatar_urls.thumb}}}" class="avatar user-{{data.id}}-avatar avatar-50 photo" width="50" height="50" alt="{{{data.avatar_alt}}}">
17
+ </a>
18
+ </div>
19
+
20
+ <div class="item">
21
+ <div class="item-title fn"><a href="{{{data.link}}}">{{data.name}}</a></div>
22
+ <div class="item-meta">
23
+ <span class="activity">{{data.extra}}</span>
24
+ </div>
25
+ </div>
26
+ </li>
27
+ </script>
bp-templates/bp-legacy/css/buddypress-rtl.css CHANGED
@@ -1428,7 +1428,9 @@ fieldset.create-site label {
1428
  }
1429
 
1430
  .bp-site-wide-message #message button,
1431
- .admin-bar-on #message button {
 
 
1432
  font-size: 0.8em;
1433
  padding: 2px 4px;
1434
  position: absolute;
@@ -1436,7 +1438,8 @@ fieldset.create-site label {
1436
  top: 0;
1437
  }
1438
 
1439
- .admin-bar-on #message button {
 
1440
  left: 10px;
1441
  top: 7px;
1442
  }
1428
  }
1429
 
1430
  .bp-site-wide-message #message button,
1431
+ .bp-site-wide-message #message a.button,
1432
+ .admin-bar-on #message button,
1433
+ .admin-bar-on #message a.button {
1434
  font-size: 0.8em;
1435
  padding: 2px 4px;
1436
  position: absolute;
1438
  top: 0;
1439
  }
1440
 
1441
+ .admin-bar-on #message button,
1442
+ .admin-bar-on #message a.button {
1443
  left: 10px;
1444
  top: 7px;
1445
  }
bp-templates/bp-legacy/css/buddypress-rtl.min.css CHANGED
@@ -1 +1 @@
1
- #buddypress div.pagination{background:0 0;border:none;color:#767676;font-size:small;margin:0;position:relative;display:block;float:right;width:100%;padding:10px 0}#buddypress div.pagination .pag-count{float:right;margin-right:10px}#buddypress div.pagination .pagination-links{float:left;margin-left:10px}#buddypress div.pagination .pagination-links a,#buddypress div.pagination .pagination-links span{font-size:90%;padding:0 5px}#buddypress div.pagination .pagination-links a:hover{font-weight:700}#buddypress noscript div.pagination{margin-bottom:15px}#buddypress #nav-above{display:none}#buddypress .paged #nav-above{display:block}#buddypress img.wp-smiley{border:none!important;clear:none!important;float:none!important;margin:0!important;padding:0!important}#buddypress .clear{clear:right}#buddypress #activity-stream{margin-top:-5px}#buddypress #activity-stream p{margin:5px 0}#buddypress #item-body form#whats-new-form{margin:0;padding:0}#buddypress .home-page form#whats-new-form{border-bottom:none;padding-bottom:0}#buddypress form#whats-new-form #whats-new-avatar{float:right}#buddypress form#whats-new-form #whats-new-content{margin-right:55px;padding:0 20px 20px 0}#buddypress form#whats-new-form p.activity-greeting{line-height:.5;margin-bottom:15px;margin-right:75px}#buddypress form#whats-new-form textarea{background:#fff;box-sizing:border-box;color:#555;font-family:inherit;font-size:medium;height:2.2em;line-height:1.4;padding:6px;width:100%}body.no-js #buddypress form#whats-new-form textarea{height:50px}#buddypress form#whats-new-form #whats-new-options select{max-width:200px;margin-top:12px}#buddypress form#whats-new-form #whats-new-submit{float:left;margin-top:12px}#buddypress #whats-new-options:after{clear:both;content:"";display:table}body.no-js #buddypress #whats-new-options{height:auto}#buddypress #whats-new:focus{border-color:rgba(31,179,221,.9)!important;outline-color:rgba(31,179,221,.9)}#buddypress ul.activity-list li{overflow:hidden;padding:15px 0 0;list-style:none}#buddypress .activity-list .activity-avatar{float:right}#buddypress ul.item-list.activity-list li.has-comments{padding-bottom:15px}body.activity-permalink #buddypress ul.activity-list li.has-comments{padding-bottom:0}#buddypress .activity-list li.mini{font-size:80%;position:relative}#buddypress .activity-list li.mini .activity-avatar img.FB_profile_pic,#buddypress .activity-list li.mini .activity-avatar img.avatar{height:20px;margin-right:30px;width:20px}#buddypress .activity-permalink .activity-list li.mini .activity-avatar img.FB_profile_pic,#buddypress .activity-permalink .activity-list li.mini .activity-avatar img.avatar{height:auto;margin-right:0;width:auto}body.activity-permalink #buddypress .activity-list>li:first-child{padding-top:0}#buddypress .activity-list li .activity-content{position:relative}#buddypress .activity-list li.mini .activity-content p{margin:0}#buddypress .activity-list li.mini .activity-comments{clear:both;font-size:120%}body.activity-permalink #buddypress li.mini .activity-meta{margin-top:4px}#buddypress .activity-list li .activity-inreplyto{color:#767676;font-size:80%}#buddypress .activity-list li .activity-inreplyto>p{margin:0;display:inline}#buddypress .activity-list li .activity-inreplyto blockquote,#buddypress .activity-list li .activity-inreplyto div.activity-inner{background:0 0;border:none;display:inline;margin:0;overflow:hidden;padding:0}#buddypress .activity-list .activity-content{margin:0 70px 0 0}body.activity-permalink #buddypress .activity-list li .activity-content{border:none;font-size:100%;line-height:1.5;margin-right:170px;margin-left:0;padding:0}body.activity-permalink #buddypress .activity-list li .activity-header>p{margin:0;padding:5px 0 0}#buddypress .activity-list .activity-content .activity-header,#buddypress .activity-list .activity-content .comment-header{color:#767676;line-height:2.2}#buddypress .activity-header{margin-left:20px}#buddypress .acomment-meta a,#buddypress .activity-header a,#buddypress .comment-meta a{text-decoration:none}#buddypress .activity-list .activity-content .activity-header img.avatar{float:none!important;margin:0 0 -8px 5px!important}#buddypress a.bp-secondary-action,#buddypress span.highlight{font-size:80%;padding:0;margin-left:5px;text-decoration:none}#buddypress .activity-list .activity-content .activity-inner,#buddypress .activity-list .activity-content blockquote{margin:10px 0 5px 10px;overflow:hidden}#buddypress .activity-list li.new_forum_post .activity-content .activity-inner,#buddypress .activity-list li.new_forum_topic .activity-content .activity-inner{border-right:2px solid #eaeaea;margin-right:5px;padding-right:10px}body.activity-permalink #buddypress .activity-content .activity-inner,body.activity-permalink #buddypress .activity-content blockquote{margin-right:0;margin-top:5px}#buddypress .activity-inner>p{word-wrap:break-word}#buddypress .activity-inner>.activity-inner{margin:0}#buddypress .activity-inner>blockquote{margin:0}#buddypress .activity-list .activity-content img.thumbnail{border:2px solid #eee;float:right;margin:0 0 5px 10px}#buddypress .activity-read-more{margin-right:1em;white-space:nowrap}#buddypress .activity-list li.load-more,#buddypress .activity-list li.load-newest{background:#f0f0f0;font-size:110%;margin:15px 0;padding:10px 15px;text-align:center}#buddypress .activity-list li.load-more a,#buddypress .activity-list li.load-newest a{color:#4d4d4d}#buddypress div.activity-meta{margin:18px 0 0}body.activity-permalink #buddypress div.activity-meta{margin-bottom:6px}#buddypress div.activity-meta a{padding:4px 8px}#buddypress a.activity-time-since{color:#767676;text-decoration:none}#buddypress a.activity-time-since:hover{color:#767676;text-decoration:underline}#buddypress #reply-title small a,#buddypress a.bp-primary-action{font-size:80%;margin-left:5px;text-decoration:none}#buddypress #reply-title small a span,#buddypress a.bp-primary-action span{background:#767676;color:#fff;font-size:90%;margin-right:2px;padding:0 5px}#buddypress #reply-title small a:hover span,#buddypress a.bp-primary-action:hover span{background:#555;color:#fff}#buddypress div.activity-comments{margin:0 70px 0 0;overflow:hidden;position:relative;width:auto;clear:both}body.activity-permalink #buddypress div.activity-comments{background:0 0;margin-right:170px;width:auto}#buddypress div.activity-comments>ul{padding:0 10px 0 0}#buddypress div.activity-comments ul,#buddypress div.activity-comments ul li{border:none;list-style:none}#buddypress div.activity-comments ul{clear:both;margin:0}#buddypress div.activity-comments ul li{border-top:1px solid #eee;padding:10px 0 0}body.activity-permalink #buddypress .activity-list li.mini .activity-comments{clear:none;margin-top:0}body.activity-permalink #buddypress div.activity-comments ul li{border-width:1px;padding:10px 0 0}#buddypress div.activity-comments>ul>li:first-child{border-top:none}#buddypress div.activity-comments ul li:last-child{margin-bottom:0}#buddypress div.activity-comments ul li>ul{margin-right:30px;margin-top:0;padding-right:10px}body.activity-permalink #buddypress div.activity-comments ul li>ul{margin-top:10px}body.activity-permalink #buddypress div.activity-comments>ul{padding:0 15px 0 10px}#buddypress div.activity-comments div.acomment-avatar img{border-width:1px;float:right;height:25px;margin-left:10px;width:25px}#buddypress div.activity-comments div.acomment-content{font-size:80%;margin:5px 40px 0 0}#buddypress div.acomment-content .activity-delete-link,#buddypress div.acomment-content .comment-header,#buddypress div.acomment-content .time-since{display:none}body.activity-permalink #buddypress div.activity-comments div.acomment-content{font-size:90%}#buddypress div.activity-comments div.acomment-meta{color:#767676;font-size:80%}#buddypress div.activity-comments form.ac-form{display:none;padding:10px}#buddypress div.activity-comments li form.ac-form{margin-left:15px;clear:both}#buddypress div.activity-comments form.root{margin-right:0}#buddypress div.activity-comments div#message{margin-top:15px;margin-bottom:0}#buddypress div.activity-comments form .ac-textarea{background:#fff;border:1px inset #ccc;margin-bottom:10px;padding:8px}#buddypress div.activity-comments form textarea{border:none;background:0 0;box-shadow:none;outline:0;color:#555;font-family:inherit;font-size:100%;height:60px;padding:0;margin:0;width:100%}#buddypress div.activity-comments form input{margin-top:5px}#buddypress div.activity-comments form div.ac-reply-avatar{float:right}#buddypress div.ac-reply-avatar img{border:1px solid #eee}#buddypress div.activity-comments form div.ac-reply-content{color:#767676;margin-right:50px;padding-right:15px}#buddypress div.activity-comments form div.ac-reply-content a{text-decoration:none}#buddypress .acomment-options{float:right;margin:5px 40px 5px 0}#buddypress .acomment-options a{color:#767676}#buddypress .acomment-options a:hover{color:inherit}#buddypress div.dir-search{float:left;margin:-39px 0 0 0}#buddypress div.dir-search input[type=text],#buddypress li.groups-members-search input[type=text]{font-size:90%;padding:1px 3px}#buddypress .current-member-type{font-style:italic}#buddypress .dir-form{clear:both}#buddypress div#message{margin:0 0 15px}#buddypress #message.info{margin-bottom:0}#buddypress div#message.updated{clear:both;display:block}#buddypress div#message p,#sitewide-notice p,#sitewide-notice strong:first-child{font-size:90%;display:block;padding:10px 15px}#buddypress div#message.error p{background-color:#fdc;border:1px solid #a00;clear:right;color:#800}#buddypress div#message.warning p{background-color:#ffe0af;border:1px solid #ffd087;clear:right;color:#800}#buddypress div#message.updated p{background-color:#efc;border:1px solid #591;color:#250}#buddypress #pass-strength-result{background-color:#eee;border-color:#ddd;border-style:solid;border-width:1px;display:none;margin:5px 0 5px 5px;padding:5px;text-align:center;width:150px}#buddypress .standard-form #basic-details-section #pass-strength-result{width:35%}#buddypress #pass-strength-result.bad,#buddypress #pass-strength-result.error{background-color:#ffb78c;border-color:#ff853c!important;display:block}#buddypress #pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;display:block}#buddypress #pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;display:block}#buddypress #pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;display:block}#buddypress .standard-form#signup_form div div.error{background:#faa;color:#a00;margin:0 0 10px;padding:6px;width:90%}#buddypress div.accept,#buddypress div.reject{float:right;margin-right:10px}#buddypress ul.button-nav li{float:right;margin:0 0 10px 10px;list-style:none}#buddypress ul.button-nav li.current a{font-weight:700}#sitewide-notice #message{right:2%;position:fixed;top:1em;width:96%;z-index:9999}#sitewide-notice.admin-bar-on #message{top:3.3em}#sitewide-notice strong{display:block;margin-bottom:-1em}body.create-blog #buddypress .error{background-color:#fdc;border:1px solid #a00;color:#800;padding:10px 15px}body.create-blog #buddypress .success{background-color:#efc;border:1px solid #591;color:#250;padding:10px 15px}#buddypress form fieldset{border:0;padding:0}#buddypress .dir-search input[type=search],#buddypress .dir-search input[type=text],#buddypress .groups-members-search input[type=search],#buddypress .groups-members-search input[type=text],#buddypress .standard-form input[type=color],#buddypress .standard-form input[type=date],#buddypress .standard-form input[type=datetime-local],#buddypress .standard-form input[type=datetime],#buddypress .standard-form input[type=email],#buddypress .standard-form input[type=month],#buddypress .standard-form input[type=number],#buddypress .standard-form input[type=password],#buddypress .standard-form input[type=range],#buddypress .standard-form input[type=search],#buddypress .standard-form input[type=tel],#buddypress .standard-form input[type=text],#buddypress .standard-form input[type=time],#buddypress .standard-form input[type=url],#buddypress .standard-form input[type=week],#buddypress .standard-form select,#buddypress .standard-form textarea{border:1px solid #ccc;background:#fafafa;border-radius:0;color:#737373;font:inherit;font-size:100%;padding:6px}#buddypress .standard-form select{padding:3px}#buddypress .standard-form input[type=password]{margin-bottom:5px}#buddypress .standard-form label,#buddypress .standard-form legend,#buddypress .standard-form span.label{display:block;font-weight:700;margin:15px 0 5px;width:auto}#buddypress label.xprofile-field-label{display:inline}#buddypress .standard-form #invite-list label,#buddypress .standard-form p label{font-weight:400;margin:auto}#buddypress .standard-form .checkbox label,#buddypress .standard-form .radio label{color:#767676;font-size:100%;font-weight:400;margin:5px 0 0}#buddypress .standard-form .checkbox label input,#buddypress .standard-form .radio label input{margin-left:3px}#buddypress .standard-form#sidebar-login-form label{margin-top:5px}#buddypress .standard-form input[type=text]{width:75%}#buddypress .standard-form#sidebar-login-form input[type=password],#buddypress .standard-form#sidebar-login-form input[type=text]{padding:4px;width:95%}#buddypress .standard-form #basic-details-section input[type=password],#buddypress .standard-form #blog-details-section input#signup_blog_url{width:35%}#buddypress #commentform input[type=text],#buddypress #commentform textarea,#buddypress .form-allowed-tags,#buddypress .standard-form#signup_form input[type=text],#buddypress .standard-form#signup_form textarea{width:90%}#buddypress .standard-form#signup_form div.submit{float:left}#buddypress div#signup-avatar img{margin:0 0 10px 15px}#buddypress .standard-form textarea{width:75%;height:120px}#buddypress .standard-form textarea#message_content{height:200px}#buddypress .standard-form#send-reply textarea{width:97.5%}#buddypress .standard-form p.description{color:#767676;font-size:80%;margin:5px 0}#buddypress .standard-form div.submit{clear:both;padding:15px 0 0}#buddypress .standard-form p.submit{margin-bottom:0;padding:15px 0 0}#buddypress .standard-form div.submit input{margin-left:15px}#buddypress .standard-form div.radio ul{margin:10px 38px 15px 0;list-style:disc}#buddypress .standard-form div.radio ul li{margin-bottom:5px}#buddypress .standard-form a.clear-value{display:block;margin-top:5px;outline:0}#buddypress .standard-form #basic-details-section,#buddypress .standard-form #blog-details-section,#buddypress .standard-form #profile-details-section{float:right;width:48%}#buddypress .standard-form #profile-details-section{float:left}#buddypress #notifications-bulk-management,#buddypress .standard-form #blog-details-section{clear:right}body.no-js #buddypress #delete_inbox_messages,body.no-js #buddypress #delete_sentbox_messages,body.no-js #buddypress #message-type-select,body.no-js #buddypress #messages-bulk-management #select-all-messages,body.no-js #buddypress #notifications-bulk-management #select-all-notifications,body.no-js #buddypress label[for=message-type-select]{display:none}#buddypress .standard-form input:focus,#buddypress .standard-form select:focus,#buddypress .standard-form textarea:focus{background:#fafafa;color:#555}#buddypress form#send-invite-form{margin-top:20px}#buddypress div#invite-list{background:#f5f5f5;height:400px;margin:0 0 10px;overflow:auto;padding:5px;width:160px}#buddypress .comment-reply-link,#buddypress .generic-button a,#buddypress .standard-form button,#buddypress a.button,#buddypress input[type=button],#buddypress input[type=reset],#buddypress input[type=submit],#buddypress ul.button-nav li a,a.bp-title-button{background:#fff;border:1px solid #ccc;color:#767676;font-size:small;cursor:pointer;outline:0;padding:4px 10px;text-align:center;text-decoration:none}#buddypress .comment-reply-link:hover,#buddypress .standard-form button:hover,#buddypress a.button:focus,#buddypress a.button:hover,#buddypress div.generic-button a:hover,#buddypress input[type=button]:hover,#buddypress input[type=reset]:hover,#buddypress input[type=submit]:hover,#buddypress ul.button-nav li a:hover,#buddypress ul.button-nav li.current a{background:#ededed;border:1px solid #bbb;color:#555;outline:0;text-decoration:none}#buddypress form.standard-form .left-menu{float:right}#buddypress form.standard-form .left-menu #invite-list ul{margin:1%;list-style:none}#buddypress form.standard-form .left-menu #invite-list ul li{margin:0 1% 0 0}#buddypress form.standard-form .main-column{margin-right:190px}#buddypress form.standard-form .main-column ul#friend-list{clear:none;float:right}#buddypress form.standard-form .main-column ul#friend-list h3,#buddypress form.standard-form .main-column ul#friend-list h4{clear:none}#buddypress .wp-editor-wrap a.button,#buddypress .wp-editor-wrap button,#buddypress .wp-editor-wrap input[type=button],#buddypress .wp-editor-wrap input[type=reset],#buddypress .wp-editor-wrap input[type=submit]{padding:0 8px 1px}#buddypress form [disabled=disabled]{cursor:default;opacity:.4}fieldset.register-site{margin-top:1em}fieldset.create-site{margin-bottom:2em}fieldset.create-site legend{margin-bottom:1em}fieldset.create-site label{margin-left:3em}.bp-screen-reader-text{clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;position:absolute!important;width:1px;word-wrap:normal!important}.bp-screen-reader-text:focus{background-color:#f1f1f1;border-radius:3px;box-shadow:0 0 2px 2px rgba(0,0,0,.6);clip:auto!important;color:#21759b;display:block;font-size:14px;font-size:.875rem;font-weight:700;height:auto;right:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}#buddypress a.loading,#buddypress input.loading{-webkit-animation:loader-pulsate .5s infinite ease-in-out alternate;-moz-animation:loader-pulsate .5s infinite ease-in-out alternate;border-color:#aaa}#buddypress a.loading:hover,#buddypress input.loading:hover{color:#767676}#buddypress a.disabled,#buddypress button.disabled,#buddypress button.pending,#buddypress div.pending a,#buddypress input[type=button].disabled,#buddypress input[type=button].pending,#buddypress input[type=reset].disabled,#buddypress input[type=reset].pending,#buddypress input[type=submit].disabled,#buddypress input[type=submit].pending,#buddypress input[type=submit][disabled=disabled]{border-color:#eee;color:#bbb;cursor:default}#buddypress a.disabled:hover,#buddypress button.disabled:hover,#buddypress button.pending:hover,#buddypress div.pending a:hover,#buddypress input[type=button]:hover.disabled,#buddypress input[type=button]:hover.pending,#buddypress input[type=reset]:hover.disabled,#buddypress input[type=reset]:hover.pending,#buddypress input[type=submit]:hover.disabled,#buddypress input[type=submit]:hover.pending{border-color:#eee;color:#bbb}#buddypress ul#topic-post-list{margin:0;width:auto}#buddypress ul#topic-post-list li{padding:15px;position:relative}#buddypress ul#topic-post-list li.alt{background:#f5f5f5}#buddypress ul#topic-post-list li div.poster-meta{color:#767676;margin-bottom:10px}#buddypress ul#topic-post-list li div.post-content{margin-right:54px}#buddypress div.topic-tags{font-size:80%}#buddypress div.admin-links{color:#767676;font-size:80%;position:absolute;top:15px;left:25px}#buddypress div#topic-meta{margin:0;padding:5px 19px 30px;position:relative}#buddypress div#topic-meta div.admin-links{left:19px;top:-36px}#buddypress div#topic-meta h3{margin:5px 0}#buddypress div#new-topic-post{display:none;margin:20px 0 0;padding:1px 0 0}#buddypress table.forum,#buddypress table.messages-notices,#buddypress table.notifications,#buddypress table.notifications-settings,#buddypress table.profile-fields,#buddypress table.profile-settings,#buddypress table.wp-profile-fields{width:100%}#buddypress table.forum thead tr,#buddypress table.messages-notices thead tr,#buddypress table.notifications thead tr,#buddypress table.notifications-settings thead tr,#buddypress table.profile-fields thead tr,#buddypress table.profile-settings thead tr,#buddypress table.wp-profile-fields thead tr{background:#eaeaea}#buddypress table#message-threads{clear:both}#buddypress table.profile-fields{margin-bottom:20px}#buddypress table.profile-fields:last-child{margin-bottom:0}#buddypress table.profile-fields p{margin:0}#buddypress table.profile-fields p:last-child{margin-top:0}#buddypress table.forum tr td,#buddypress table.forum tr th,#buddypress table.messages-notices tr td,#buddypress table.messages-notices tr th,#buddypress table.notifications tr td,#buddypress table.notifications tr th,#buddypress table.notifications-settings tr td,#buddypress table.notifications-settings tr th,#buddypress table.profile-fields tr td,#buddypress table.profile-fields tr th,#buddypress table.profile-settings tr td,#buddypress table.wp-profile-fields tr td,#buddypress table.wp-profile-fields tr th{padding:8px;vertical-align:middle}#buddypress table.forum tr td.label,#buddypress table.messages-notices tr td.label,#buddypress table.notifications tr td.label,#buddypress table.notifications-settings tr td.label,#buddypress table.profile-fields tr td.label,#buddypress table.wp-profile-fields tr td.label{border-left:1px solid #eaeaea;font-weight:700;width:25%}#buddypress #message-threads .thread-info{min-width:40%}#buddypress table tr td.thread-info p{margin:0}#buddypress table tr td.thread-info p.thread-excerpt{color:#767676;font-size:80%;margin-top:3px}#buddypress table.forum td{text-align:center}#buddypress table.forum tr.alt td,#buddypress table.messages-notices tr.alt td,#buddypress table.notifications tr.alt td,#buddypress table.notifications-settings tr.alt td,#buddypress table.profile-fields tr.alt td,#buddypress table.profile-settings tr.alt td,#buddypress table.wp-profile-fields tr.alt td{background:#f5f5f5;color:#707070}#buddypress table.notification-settings{margin-bottom:20px;text-align:right}#buddypress #groups-notification-settings{margin-bottom:0}#buddypress table.notification-settings td:first-child,#buddypress table.notification-settings th.icon,#buddypress table.notifications td:first-child,#buddypress table.notifications th.icon{display:none}#buddypress table.notification-settings th.title,#buddypress table.profile-settings th.title{width:80%}#buddypress table.notification-settings .no,#buddypress table.notification-settings .yes{text-align:center;width:40px}#buddypress table.forum{margin:0;width:auto;clear:both}#buddypress table.forum tr.sticky td{font-size:110%;background:#fff9db;border-top:1px solid #ffe8c4;border-bottom:1px solid #ffe8c4}#buddypress table.forum tr.closed td.td-title{padding-right:35px}#buddypress table.forum td p.topic-text{color:#767676;font-size:100%}#buddypress table.forum tr>td:first-child,#buddypress table.forum tr>th:first-child{padding-right:15px}#buddypress table.forum tr>td:last-child,#buddypress table.forum tr>th:last-child{padding-left:15px}#buddypress table.forum td.td-group,#buddypress table.forum td.td-poster,#buddypress table.forum td.td-title,#buddypress table.forum tr th#th-group,#buddypress table.forum tr th#th-poster,#buddypress table.forum tr th#th-title{text-align:right}#buddypress table.forum tr td.td-title a.topic-title{font-size:110%}#buddypress table.forum td.td-freshness{white-space:nowrap}#buddypress table.forum td.td-freshness span.time-since{font-size:80%;color:#767676}#buddypress table.forum td img.avatar{float:none;margin:0 0 -8px 5px}#buddypress table.forum td.td-group,#buddypress table.forum td.td-poster{min-width:140px}#buddypress table.forum th#th-title{width:80%}#buddypress table.forum th#th-freshness{width:25%}#buddypress table.forum th#th-postcount{width:15%}#buddypress table.forum p.topic-meta{font-size:80%;margin:5px 0 0}#buddypress .item-body{margin:20px 0}#buddypress span.activity{display:inline-block;font-size:small;padding:0}#buddypress span.user-nicename{color:#767676;display:inline-block;font-size:120%;font-weight:700}#sitewide-notice,.bp-site-wide-message{position:relative}#buddypress div#message p,#sitewide-notice #message{background-color:#ffd;border:1px solid #cb2;color:#440;font-weight:400;margin-top:3px;text-decoration:none}.admin-bar-on #message p,.bp-site-wide-message #message p{padding-left:25px}.admin-bar-on #message button,.bp-site-wide-message #message button{font-size:.8em;padding:2px 4px;position:absolute;left:0;top:0}.admin-bar-on #message button{left:10px;top:7px}#buddypress #item-header:after{clear:both;content:"";display:table}#buddypress div#item-header div#item-header-content{float:right;margin-right:0}#buddypress div#item-header h2{line-height:1.2;margin:0 0 15px}#buddypress div#item-header h2 a{color:#767676;text-decoration:none}#buddypress div#item-header img.avatar{float:right;margin:0 0 19px 15px}#buddypress div#item-header h2{margin-bottom:5px}#buddypress div#item-header h2 span.highlight{font-size:60%;font-weight:400;line-height:1.7;vertical-align:middle;display:inline-block}#buddypress div#item-header h2 span.highlight span{background:#a1dcfa;color:#fff;cursor:pointer;font-weight:700;font-size:80%;margin-bottom:2px;padding:1px 4px;position:relative;left:-2px;top:-2px;vertical-align:middle}#buddypress div#item-header div#item-meta{font-size:80%;color:#767676;overflow:hidden;margin:15px 0 5px;padding-bottom:10px}#buddypress div#item-header div#item-actions{float:left;margin:0 15px 15px 0;text-align:left;width:20%}#buddypress div#item-header div#item-actions h2,#buddypress div#item-header div#item-actions h3{margin:0 0 5px}#buddypress div#item-header div#item-actions a{display:inline-block}#buddypress div#item-header ul{margin-bottom:15px}#buddypress div#item-header ul:after{clear:both;content:"";display:table}#buddypress div#item-header ul h5,#buddypress div#item-header ul hr,#buddypress div#item-header ul span{display:none}#buddypress div#item-header ul li{float:left;list-style:none}#buddypress div#item-header ul img.avatar,#buddypress div#item-header ul.avatars img.avatar{height:30px;margin:2px;width:30px}#buddypress div#item-header a.button,#buddypress div#item-header div.generic-button{float:right;margin:10px 0 0 10px}body.no-js #buddypress div#item-header .js-self-profile-button{display:none}#buddypress div#item-header div#message.info{line-height:.8}#buddypress ul.item-list{border-top:1px solid #eaeaea;width:100%;list-style:none;clear:both;margin:0;padding:0}body.activity-permalink #buddypress ul.item-list,body.activity-permalink #buddypress ul.item-list li.activity-item{border:none}#buddypress ul.item-list li{border-bottom:1px solid #eaeaea;padding:15px 0;margin:0;position:relative;list-style:none}#buddypress ul.single-line li{border:none}#buddypress ul.item-list li img.avatar{float:right;margin:0 0 0 10px}#buddypress ul.item-list li div.item-title,#buddypress ul.item-list li h3,#buddypress ul.item-list li h4{font-weight:400;font-size:90%;margin:0;width:75%}#buddypress ul.item-list li div.item-title span{color:#767676;font-size:80%}#buddypress ul.item-list li div.item-desc{color:#767676;font-size:80%;margin:10px 60px 0 0;width:50%}#buddypress ul.item-list li.group-no-avatar div.item-desc{margin-right:0}#buddypress ul.item-list li div.action{position:absolute;top:15px;left:0;text-align:left}#buddypress ul.item-list li div.meta{color:#767676;font-size:80%;margin-top:10px}#buddypress ul.item-list li h5 span.small{float:left;font-size:80%;font-weight:400}#buddypress div.item-list-tabs{background:0 0;clear:right;overflow:hidden}#buddypress div.item-list-tabs ul{margin:0;padding:0}#buddypress div.item-list-tabs ul li{float:right;margin:0;list-style:none}#buddypress div.item-list-tabs#subnav ul li{margin-top:0}#buddypress div.item-list-tabs ul li.last{float:left;margin:7px 0 0}#buddypress div.item-list-tabs#subnav ul li.last{margin-top:4px}#buddypress div.item-list-tabs ul li.last select{max-width:185px}#buddypress div.item-list-tabs ul li a,#buddypress div.item-list-tabs ul li span{display:block;padding:5px 10px;text-decoration:none}#buddypress div.item-list-tabs ul li a span{background:#eee;border-radius:50%;border:1px solid #ccc;color:#6c6c6c;display:inline;font-size:70%;margin-right:2px;padding:3px 6px;text-align:center;vertical-align:middle}#buddypress div.item-list-tabs ul li.current a,#buddypress div.item-list-tabs ul li.selected a{background-color:#eee;color:#555;opacity:.9;font-weight:700}#buddypress div.item-list-tabs ul li a:hover span,#buddypress div.item-list-tabs ul li.current a span,#buddypress div.item-list-tabs ul li.selected a span{background-color:#eee}#buddypress div.item-list-tabs ul li.current a span,#buddypress div.item-list-tabs ul li.selected a span{background-color:#fff}#buddypress div#item-nav ul li.loading a{background-position:12% 50%}#buddypress div.item-list-tabs#object-nav{margin-top:0}#buddypress div.item-list-tabs#subnav{background:0 0;margin:10px 0;overflow:hidden}#buddypress #admins-list li,#buddypress #members-list li,#buddypress #mods-list li{overflow:auto;list-style:none}#buddypress .group-members-list{width:100%;margin-top:1em;clear:both;overflow:auto}#buddypress #item-buttons:empty{display:none}#buddypress #cover-image-container{position:relative;z-index:0}#buddypress #header-cover-image{background-color:#c5c5c5;background-position:center top;background-repeat:no-repeat;background-size:cover;border:0;display:block;right:0;margin:0;padding:0;position:absolute;top:0;width:100%;z-index:1}#buddypress #item-header-cover-image{padding:0 1em;position:relative;z-index:2}#buddypress table#message-threads tr.unread td{background:#fff9db;border-top:1px solid #ffe8c4;border-bottom:1px solid #ffe8c4;font-weight:700}#buddypress table#message-threads tr.unread td .activity,#buddypress table#message-threads tr.unread td .thread-excerpt,#buddypress table#message-threads tr.unread td.thread-options{font-weight:400}#buddypress li span.unread-count,#buddypress tr.unread span.unread-count{background:#d00;color:#fff;font-weight:700;padding:2px 8px}#buddypress div.item-list-tabs ul li a span.unread-count{padding:1px 6px;color:#fff}#buddypress div#message-thread div.message-box{margin:0;padding:15px}#buddypress div#message-thread div.alt{background:#f4f4f4}#buddypress div#message-thread p#message-recipients{margin:10px 0 20px}#buddypress div#message-thread img.avatar{float:right;margin:0 0 0 10px;vertical-align:middle}#buddypress div#message-thread strong{font-size:100%;margin:0}#buddypress div#message-thread strong a{text-decoration:none}#buddypress div#message-thread strong span.activity{margin-top:4px}#buddypress div#message-thread div.message-metadata:after{clear:both;content:"";display:table}#buddypress div#message-thread div.message-content{margin-right:45px}#buddypress div#message-thread div.message-options{text-align:left}#buddypress #message-threads img.avatar{max-width:none}#buddypress div.message-search{float:left;margin:0 20px}.message-metadata{position:relative}.message-star-actions{position:absolute;left:0;top:0}#buddypress a.message-action-star,#buddypress a.message-action-unstar{border-bottom:0;text-decoration:none;outline:0}a.message-action-star{opacity:.7}a.message-action-star:hover{opacity:1}.message-action-star span.icon:before,.message-action-unstar span.icon:before{font-family:dashicons;font-size:18px}.message-action-star span.icon:before{color:#767676;content:"\f154"}.message-action-unstar span.icon:before{color:#fcdd77;content:"\f155"}#buddypress div.profile h2{margin-bottom:auto;margin-top:15px}#buddypress #profile-edit-form ul.button-nav{margin-top:15px}body.no-js #buddypress .field-visibility-settings-close,body.no-js #buddypress .field-visibility-settings-toggle{display:none}#buddypress .field-visibility-settings{display:none;margin-top:10px}body.no-js #buddypress .field-visibility-settings{display:block}#buddypress .current-visibility-level{font-weight:700;font-style:normal}#buddypress .field-visibility-settings,#buddypress .field-visibility-settings-notoggle,#buddypress .field-visibility-settings-toggle{color:#707070}#buddypress .field-visibility-settings a,#buddypress .field-visibility-settings-toggle a{font-size:80%}body.register #buddypress div.page ul{list-style:none}#buddypress .standard-form .field-visibility-settings label{margin:0;font-weight:400}#buddypress .field-visibility-settings legend,#buddypress .field-visibility-settings-toggle{font-style:italic}#buddypress .field-visibility-settings .radio{list-style:none;margin-bottom:0}#buddypress .field-visibility select{margin:0}#buddypress .wp-editor-container{border:1px solid #dedede}#buddypress .html-active button.switch-html{border-bottom-color:transparent;border-bottom-right-radius:0;border-bottom-left-radius:0;background:#f5f5f5;color:#707070}#buddypress .tmce-active button.switch-tmce{border-bottom-color:transparent;border-bottom-right-radius:0;border-bottom-left-radius:0;background:#f5f5f5;color:#707070}#buddypress .standard-form .wp-editor-container textarea{width:100%;padding-top:0;padding-bottom:0}.widget.buddypress span.activity{display:inline-block;font-size:small;padding:0}.widget.buddypress div.item-options{font-size:90%;margin:0 0 1em;padding:1em 0}.widget.buddypress div.item{margin:0 0 1em}.widget.buddypress div.item-content,.widget.buddypress div.item-meta{font-size:11px;margin-right:50px}.widget.buddypress div.avatar-block:after{clear:both;content:"";display:table}.widget.buddypress .item-avatar a{float:right;margin-bottom:15px;margin-left:10px}.widget.buddypress div.item-avatar img{display:inline-block;height:40px;margin:1px;width:40px}.widget.buddypress .item-avatar a,.widget.buddypress .item-avatar a img,.widget.buddypress .item-avatar a:active,.widget.buddypress .item-avatar a:focus,.widget.buddypress .item-avatar a:hover{box-shadow:none}.widget.buddypress #bp-login-widget-form label{display:block;margin:1rem 0 .5rem}.widget.buddypress #bp-login-widget-form #bp-login-widget-submit{margin-left:10px}.widget.buddypress .bp-login-widget-user-avatar{float:right}.bp-login-widget-user-avatar img.avatar{height:40px;width:40px}.widget.buddypress .bp-login-widget-user-links>div{padding-right:60px}.widget.buddypress .bp-login-widget-user-links>div{margin-bottom:.5rem}.widget.buddypress .bp-login-widget-user-links>div.bp-login-widget-user-link a{font-weight:700}.widget.buddypress #friends-list,.widget.buddypress #groups-list,.widget.buddypress #members-list{margin-right:0;padding-right:0}.widget.buddypress #friends-list li,.widget.buddypress #groups-list li,.widget.buddypress #members-list li{clear:both;list-style-type:none}.buddypress .bp-tooltip{position:relative}.bp-tooltip:after{background:#fff;border:1px solid #aaa;border-collapse:separate;border-radius:1px;box-shadow:-1px 1px 0 1px rgba(132,132,132,.3);color:#000;content:attr(data-bp-tooltip);display:none;font-family:sans-serif;font-size:11px;font-weight:400;letter-spacing:normal;line-height:1.5;margin-top:10px;max-width:240px;opacity:0;padding:3px 6px;position:absolute;left:50%;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;top:100%;transform:translateX(-50%);transition:opacity 2s ease-out;white-space:pre;word-wrap:break-word;z-index:998}.bp-tooltip:active:after,.bp-tooltip:focus:after,.bp-tooltip:hover:after{display:inline-block;opacity:1;overflow:visible;text-decoration:none;z-index:999}#group-admins .bp-tooltip:after,#group-mods .bp-tooltip:after,.message-metadata .bp-tooltip:after{left:0;text-align:left;transform:translateX(0)}.feed .bp-tooltip:after,.item-list .bp-tooltip:after,.messages-notices .bp-tooltip:after{right:0;left:auto;text-align:right;transform:translateX(0)}.admin-bar-on .bp-tooltip:after,.bp-site-wide-message .bp-tooltip:after{left:50px}@media only screen and (max-width:480px){#buddypress div.dir-search{float:left;margin-top:-50px;text-align:left}#buddypress div.dir-search input[type=text]{margin-bottom:1em;width:50%}a.bp-title-button{margin-right:10px}#buddypress form.standard-form .main-column div.action{position:relative;margin-bottom:1em}#buddypress form.standard-form .main-column ul#friend-list h3,#buddypress form.standard-form .main-column ul#friend-list h4{width:100%}}@media only screen and (max-width:320px){#buddypress div.dir-search{clear:right;float:right;margin-top:0;text-align:right}#buddypress li#groups-order-select{clear:right;float:right}#buddypress ul.item-list li div.action{clear:right;float:right;margin-top:0;margin-right:70px;position:relative;top:0;left:0;text-align:right}#buddypress ul.item-list li div.item-desc{clear:right;float:right;margin:10px 0 0;width:auto}#buddypress li div.item{margin-right:70px;width:auto}#buddypress ul.item-list li div.meta{margin-top:0}#buddypress .item-desc p{margin:0 0 10px}#buddypress div.pagination .pag-count{margin-right:0}}@media only screen and (max-width:240px){#buddypress div.dir-search{float:right;margin:0}#buddypress div.dir-search input[type=text]{width:50%}#buddypress li#groups-order-select{float:right}#buddypress ul.item-list li img.avatar{width:30px;height:auto}#buddypress li div.item,#buddypress ul.item-list li div.action{margin-right:45px}h1 a.bp-title-button{clear:right;float:right;margin:10px 0 20px}}
1
+ #buddypress div.pagination{background:0 0;border:none;color:#767676;font-size:small;margin:0;position:relative;display:block;float:right;width:100%;padding:10px 0}#buddypress div.pagination .pag-count{float:right;margin-right:10px}#buddypress div.pagination .pagination-links{float:left;margin-left:10px}#buddypress div.pagination .pagination-links a,#buddypress div.pagination .pagination-links span{font-size:90%;padding:0 5px}#buddypress div.pagination .pagination-links a:hover{font-weight:700}#buddypress noscript div.pagination{margin-bottom:15px}#buddypress #nav-above{display:none}#buddypress .paged #nav-above{display:block}#buddypress img.wp-smiley{border:none!important;clear:none!important;float:none!important;margin:0!important;padding:0!important}#buddypress .clear{clear:right}#buddypress #activity-stream{margin-top:-5px}#buddypress #activity-stream p{margin:5px 0}#buddypress #item-body form#whats-new-form{margin:0;padding:0}#buddypress .home-page form#whats-new-form{border-bottom:none;padding-bottom:0}#buddypress form#whats-new-form #whats-new-avatar{float:right}#buddypress form#whats-new-form #whats-new-content{margin-right:55px;padding:0 20px 20px 0}#buddypress form#whats-new-form p.activity-greeting{line-height:.5;margin-bottom:15px;margin-right:75px}#buddypress form#whats-new-form textarea{background:#fff;box-sizing:border-box;color:#555;font-family:inherit;font-size:medium;height:2.2em;line-height:1.4;padding:6px;width:100%}body.no-js #buddypress form#whats-new-form textarea{height:50px}#buddypress form#whats-new-form #whats-new-options select{max-width:200px;margin-top:12px}#buddypress form#whats-new-form #whats-new-submit{float:left;margin-top:12px}#buddypress #whats-new-options:after{clear:both;content:"";display:table}body.no-js #buddypress #whats-new-options{height:auto}#buddypress #whats-new:focus{border-color:rgba(31,179,221,.9)!important;outline-color:rgba(31,179,221,.9)}#buddypress ul.activity-list li{overflow:hidden;padding:15px 0 0;list-style:none}#buddypress .activity-list .activity-avatar{float:right}#buddypress ul.item-list.activity-list li.has-comments{padding-bottom:15px}body.activity-permalink #buddypress ul.activity-list li.has-comments{padding-bottom:0}#buddypress .activity-list li.mini{font-size:80%;position:relative}#buddypress .activity-list li.mini .activity-avatar img.FB_profile_pic,#buddypress .activity-list li.mini .activity-avatar img.avatar{height:20px;margin-right:30px;width:20px}#buddypress .activity-permalink .activity-list li.mini .activity-avatar img.FB_profile_pic,#buddypress .activity-permalink .activity-list li.mini .activity-avatar img.avatar{height:auto;margin-right:0;width:auto}body.activity-permalink #buddypress .activity-list>li:first-child{padding-top:0}#buddypress .activity-list li .activity-content{position:relative}#buddypress .activity-list li.mini .activity-content p{margin:0}#buddypress .activity-list li.mini .activity-comments{clear:both;font-size:120%}body.activity-permalink #buddypress li.mini .activity-meta{margin-top:4px}#buddypress .activity-list li .activity-inreplyto{color:#767676;font-size:80%}#buddypress .activity-list li .activity-inreplyto>p{margin:0;display:inline}#buddypress .activity-list li .activity-inreplyto blockquote,#buddypress .activity-list li .activity-inreplyto div.activity-inner{background:0 0;border:none;display:inline;margin:0;overflow:hidden;padding:0}#buddypress .activity-list .activity-content{margin:0 70px 0 0}body.activity-permalink #buddypress .activity-list li .activity-content{border:none;font-size:100%;line-height:1.5;margin-right:170px;margin-left:0;padding:0}body.activity-permalink #buddypress .activity-list li .activity-header>p{margin:0;padding:5px 0 0}#buddypress .activity-list .activity-content .activity-header,#buddypress .activity-list .activity-content .comment-header{color:#767676;line-height:2.2}#buddypress .activity-header{margin-left:20px}#buddypress .acomment-meta a,#buddypress .activity-header a,#buddypress .comment-meta a{text-decoration:none}#buddypress .activity-list .activity-content .activity-header img.avatar{float:none!important;margin:0 0 -8px 5px!important}#buddypress a.bp-secondary-action,#buddypress span.highlight{font-size:80%;padding:0;margin-left:5px;text-decoration:none}#buddypress .activity-list .activity-content .activity-inner,#buddypress .activity-list .activity-content blockquote{margin:10px 0 5px 10px;overflow:hidden}#buddypress .activity-list li.new_forum_post .activity-content .activity-inner,#buddypress .activity-list li.new_forum_topic .activity-content .activity-inner{border-right:2px solid #eaeaea;margin-right:5px;padding-right:10px}body.activity-permalink #buddypress .activity-content .activity-inner,body.activity-permalink #buddypress .activity-content blockquote{margin-right:0;margin-top:5px}#buddypress .activity-inner>p{word-wrap:break-word}#buddypress .activity-inner>.activity-inner{margin:0}#buddypress .activity-inner>blockquote{margin:0}#buddypress .activity-list .activity-content img.thumbnail{border:2px solid #eee;float:right;margin:0 0 5px 10px}#buddypress .activity-read-more{margin-right:1em;white-space:nowrap}#buddypress .activity-list li.load-more,#buddypress .activity-list li.load-newest{background:#f0f0f0;font-size:110%;margin:15px 0;padding:10px 15px;text-align:center}#buddypress .activity-list li.load-more a,#buddypress .activity-list li.load-newest a{color:#4d4d4d}#buddypress div.activity-meta{margin:18px 0 0}body.activity-permalink #buddypress div.activity-meta{margin-bottom:6px}#buddypress div.activity-meta a{padding:4px 8px}#buddypress a.activity-time-since{color:#767676;text-decoration:none}#buddypress a.activity-time-since:hover{color:#767676;text-decoration:underline}#buddypress #reply-title small a,#buddypress a.bp-primary-action{font-size:80%;margin-left:5px;text-decoration:none}#buddypress #reply-title small a span,#buddypress a.bp-primary-action span{background:#767676;color:#fff;font-size:90%;margin-right:2px;padding:0 5px}#buddypress #reply-title small a:hover span,#buddypress a.bp-primary-action:hover span{background:#555;color:#fff}#buddypress div.activity-comments{margin:0 70px 0 0;overflow:hidden;position:relative;width:auto;clear:both}body.activity-permalink #buddypress div.activity-comments{background:0 0;margin-right:170px;width:auto}#buddypress div.activity-comments>ul{padding:0 10px 0 0}#buddypress div.activity-comments ul,#buddypress div.activity-comments ul li{border:none;list-style:none}#buddypress div.activity-comments ul{clear:both;margin:0}#buddypress div.activity-comments ul li{border-top:1px solid #eee;padding:10px 0 0}body.activity-permalink #buddypress .activity-list li.mini .activity-comments{clear:none;margin-top:0}body.activity-permalink #buddypress div.activity-comments ul li{border-width:1px;padding:10px 0 0}#buddypress div.activity-comments>ul>li:first-child{border-top:none}#buddypress div.activity-comments ul li:last-child{margin-bottom:0}#buddypress div.activity-comments ul li>ul{margin-right:30px;margin-top:0;padding-right:10px}body.activity-permalink #buddypress div.activity-comments ul li>ul{margin-top:10px}body.activity-permalink #buddypress div.activity-comments>ul{padding:0 15px 0 10px}#buddypress div.activity-comments div.acomment-avatar img{border-width:1px;float:right;height:25px;margin-left:10px;width:25px}#buddypress div.activity-comments div.acomment-content{font-size:80%;margin:5px 40px 0 0}#buddypress div.acomment-content .activity-delete-link,#buddypress div.acomment-content .comment-header,#buddypress div.acomment-content .time-since{display:none}body.activity-permalink #buddypress div.activity-comments div.acomment-content{font-size:90%}#buddypress div.activity-comments div.acomment-meta{color:#767676;font-size:80%}#buddypress div.activity-comments form.ac-form{display:none;padding:10px}#buddypress div.activity-comments li form.ac-form{margin-left:15px;clear:both}#buddypress div.activity-comments form.root{margin-right:0}#buddypress div.activity-comments div#message{margin-top:15px;margin-bottom:0}#buddypress div.activity-comments form .ac-textarea{background:#fff;border:1px inset #ccc;margin-bottom:10px;padding:8px}#buddypress div.activity-comments form textarea{border:none;background:0 0;box-shadow:none;outline:0;color:#555;font-family:inherit;font-size:100%;height:60px;padding:0;margin:0;width:100%}#buddypress div.activity-comments form input{margin-top:5px}#buddypress div.activity-comments form div.ac-reply-avatar{float:right}#buddypress div.ac-reply-avatar img{border:1px solid #eee}#buddypress div.activity-comments form div.ac-reply-content{color:#767676;margin-right:50px;padding-right:15px}#buddypress div.activity-comments form div.ac-reply-content a{text-decoration:none}#buddypress .acomment-options{float:right;margin:5px 40px 5px 0}#buddypress .acomment-options a{color:#767676}#buddypress .acomment-options a:hover{color:inherit}#buddypress div.dir-search{float:left;margin:-39px 0 0 0}#buddypress div.dir-search input[type=text],#buddypress li.groups-members-search input[type=text]{font-size:90%;padding:1px 3px}#buddypress .current-member-type{font-style:italic}#buddypress .dir-form{clear:both}#buddypress div#message{margin:0 0 15px}#buddypress #message.info{margin-bottom:0}#buddypress div#message.updated{clear:both;display:block}#buddypress div#message p,#sitewide-notice p,#sitewide-notice strong:first-child{font-size:90%;display:block;padding:10px 15px}#buddypress div#message.error p{background-color:#fdc;border:1px solid #a00;clear:right;color:#800}#buddypress div#message.warning p{background-color:#ffe0af;border:1px solid #ffd087;clear:right;color:#800}#buddypress div#message.updated p{background-color:#efc;border:1px solid #591;color:#250}#buddypress #pass-strength-result{background-color:#eee;border-color:#ddd;border-style:solid;border-width:1px;display:none;margin:5px 0 5px 5px;padding:5px;text-align:center;width:150px}#buddypress .standard-form #basic-details-section #pass-strength-result{width:35%}#buddypress #pass-strength-result.bad,#buddypress #pass-strength-result.error{background-color:#ffb78c;border-color:#ff853c!important;display:block}#buddypress #pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;display:block}#buddypress #pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;display:block}#buddypress #pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;display:block}#buddypress .standard-form#signup_form div div.error{background:#faa;color:#a00;margin:0 0 10px;padding:6px;width:90%}#buddypress div.accept,#buddypress div.reject{float:right;margin-right:10px}#buddypress ul.button-nav li{float:right;margin:0 0 10px 10px;list-style:none}#buddypress ul.button-nav li.current a{font-weight:700}#sitewide-notice #message{right:2%;position:fixed;top:1em;width:96%;z-index:9999}#sitewide-notice.admin-bar-on #message{top:3.3em}#sitewide-notice strong{display:block;margin-bottom:-1em}body.create-blog #buddypress .error{background-color:#fdc;border:1px solid #a00;color:#800;padding:10px 15px}body.create-blog #buddypress .success{background-color:#efc;border:1px solid #591;color:#250;padding:10px 15px}#buddypress form fieldset{border:0;padding:0}#buddypress .dir-search input[type=search],#buddypress .dir-search input[type=text],#buddypress .groups-members-search input[type=search],#buddypress .groups-members-search input[type=text],#buddypress .standard-form input[type=color],#buddypress .standard-form input[type=date],#buddypress .standard-form input[type=datetime-local],#buddypress .standard-form input[type=datetime],#buddypress .standard-form input[type=email],#buddypress .standard-form input[type=month],#buddypress .standard-form input[type=number],#buddypress .standard-form input[type=password],#buddypress .standard-form input[type=range],#buddypress .standard-form input[type=search],#buddypress .standard-form input[type=tel],#buddypress .standard-form input[type=text],#buddypress .standard-form input[type=time],#buddypress .standard-form input[type=url],#buddypress .standard-form input[type=week],#buddypress .standard-form select,#buddypress .standard-form textarea{border:1px solid #ccc;background:#fafafa;border-radius:0;color:#737373;font:inherit;font-size:100%;padding:6px}#buddypress .standard-form select{padding:3px}#buddypress .standard-form input[type=password]{margin-bottom:5px}#buddypress .standard-form label,#buddypress .standard-form legend,#buddypress .standard-form span.label{display:block;font-weight:700;margin:15px 0 5px;width:auto}#buddypress label.xprofile-field-label{display:inline}#buddypress .standard-form #invite-list label,#buddypress .standard-form p label{font-weight:400;margin:auto}#buddypress .standard-form .checkbox label,#buddypress .standard-form .radio label{color:#767676;font-size:100%;font-weight:400;margin:5px 0 0}#buddypress .standard-form .checkbox label input,#buddypress .standard-form .radio label input{margin-left:3px}#buddypress .standard-form#sidebar-login-form label{margin-top:5px}#buddypress .standard-form input[type=text]{width:75%}#buddypress .standard-form#sidebar-login-form input[type=password],#buddypress .standard-form#sidebar-login-form input[type=text]{padding:4px;width:95%}#buddypress .standard-form #basic-details-section input[type=password],#buddypress .standard-form #blog-details-section input#signup_blog_url{width:35%}#buddypress #commentform input[type=text],#buddypress #commentform textarea,#buddypress .form-allowed-tags,#buddypress .standard-form#signup_form input[type=text],#buddypress .standard-form#signup_form textarea{width:90%}#buddypress .standard-form#signup_form div.submit{float:left}#buddypress div#signup-avatar img{margin:0 0 10px 15px}#buddypress .standard-form textarea{width:75%;height:120px}#buddypress .standard-form textarea#message_content{height:200px}#buddypress .standard-form#send-reply textarea{width:97.5%}#buddypress .standard-form p.description{color:#767676;font-size:80%;margin:5px 0}#buddypress .standard-form div.submit{clear:both;padding:15px 0 0}#buddypress .standard-form p.submit{margin-bottom:0;padding:15px 0 0}#buddypress .standard-form div.submit input{margin-left:15px}#buddypress .standard-form div.radio ul{margin:10px 38px 15px 0;list-style:disc}#buddypress .standard-form div.radio ul li{margin-bottom:5px}#buddypress .standard-form a.clear-value{display:block;margin-top:5px;outline:0}#buddypress .standard-form #basic-details-section,#buddypress .standard-form #blog-details-section,#buddypress .standard-form #profile-details-section{float:right;width:48%}#buddypress .standard-form #profile-details-section{float:left}#buddypress #notifications-bulk-management,#buddypress .standard-form #blog-details-section{clear:right}body.no-js #buddypress #delete_inbox_messages,body.no-js #buddypress #delete_sentbox_messages,body.no-js #buddypress #message-type-select,body.no-js #buddypress #messages-bulk-management #select-all-messages,body.no-js #buddypress #notifications-bulk-management #select-all-notifications,body.no-js #buddypress label[for=message-type-select]{display:none}#buddypress .standard-form input:focus,#buddypress .standard-form select:focus,#buddypress .standard-form textarea:focus{background:#fafafa;color:#555}#buddypress form#send-invite-form{margin-top:20px}#buddypress div#invite-list{background:#f5f5f5;height:400px;margin:0 0 10px;overflow:auto;padding:5px;width:160px}#buddypress .comment-reply-link,#buddypress .generic-button a,#buddypress .standard-form button,#buddypress a.button,#buddypress input[type=button],#buddypress input[type=reset],#buddypress input[type=submit],#buddypress ul.button-nav li a,a.bp-title-button{background:#fff;border:1px solid #ccc;color:#767676;font-size:small;cursor:pointer;outline:0;padding:4px 10px;text-align:center;text-decoration:none}#buddypress .comment-reply-link:hover,#buddypress .standard-form button:hover,#buddypress a.button:focus,#buddypress a.button:hover,#buddypress div.generic-button a:hover,#buddypress input[type=button]:hover,#buddypress input[type=reset]:hover,#buddypress input[type=submit]:hover,#buddypress ul.button-nav li a:hover,#buddypress ul.button-nav li.current a{background:#ededed;border:1px solid #bbb;color:#555;outline:0;text-decoration:none}#buddypress form.standard-form .left-menu{float:right}#buddypress form.standard-form .left-menu #invite-list ul{margin:1%;list-style:none}#buddypress form.standard-form .left-menu #invite-list ul li{margin:0 1% 0 0}#buddypress form.standard-form .main-column{margin-right:190px}#buddypress form.standard-form .main-column ul#friend-list{clear:none;float:right}#buddypress form.standard-form .main-column ul#friend-list h3,#buddypress form.standard-form .main-column ul#friend-list h4{clear:none}#buddypress .wp-editor-wrap a.button,#buddypress .wp-editor-wrap button,#buddypress .wp-editor-wrap input[type=button],#buddypress .wp-editor-wrap input[type=reset],#buddypress .wp-editor-wrap input[type=submit]{padding:0 8px 1px}#buddypress form [disabled=disabled]{cursor:default;opacity:.4}fieldset.register-site{margin-top:1em}fieldset.create-site{margin-bottom:2em}fieldset.create-site legend{margin-bottom:1em}fieldset.create-site label{margin-left:3em}.bp-screen-reader-text{clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;position:absolute!important;width:1px;word-wrap:normal!important}.bp-screen-reader-text:focus{background-color:#f1f1f1;border-radius:3px;box-shadow:0 0 2px 2px rgba(0,0,0,.6);clip:auto!important;color:#21759b;display:block;font-size:14px;font-size:.875rem;font-weight:700;height:auto;right:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}#buddypress a.loading,#buddypress input.loading{-webkit-animation:loader-pulsate .5s infinite ease-in-out alternate;-moz-animation:loader-pulsate .5s infinite ease-in-out alternate;border-color:#aaa}#buddypress a.loading:hover,#buddypress input.loading:hover{color:#767676}#buddypress a.disabled,#buddypress button.disabled,#buddypress button.pending,#buddypress div.pending a,#buddypress input[type=button].disabled,#buddypress input[type=button].pending,#buddypress input[type=reset].disabled,#buddypress input[type=reset].pending,#buddypress input[type=submit].disabled,#buddypress input[type=submit].pending,#buddypress input[type=submit][disabled=disabled]{border-color:#eee;color:#bbb;cursor:default}#buddypress a.disabled:hover,#buddypress button.disabled:hover,#buddypress button.pending:hover,#buddypress div.pending a:hover,#buddypress input[type=button]:hover.disabled,#buddypress input[type=button]:hover.pending,#buddypress input[type=reset]:hover.disabled,#buddypress input[type=reset]:hover.pending,#buddypress input[type=submit]:hover.disabled,#buddypress input[type=submit]:hover.pending{border-color:#eee;color:#bbb}#buddypress ul#topic-post-list{margin:0;width:auto}#buddypress ul#topic-post-list li{padding:15px;position:relative}#buddypress ul#topic-post-list li.alt{background:#f5f5f5}#buddypress ul#topic-post-list li div.poster-meta{color:#767676;margin-bottom:10px}#buddypress ul#topic-post-list li div.post-content{margin-right:54px}#buddypress div.topic-tags{font-size:80%}#buddypress div.admin-links{color:#767676;font-size:80%;position:absolute;top:15px;left:25px}#buddypress div#topic-meta{margin:0;padding:5px 19px 30px;position:relative}#buddypress div#topic-meta div.admin-links{left:19px;top:-36px}#buddypress div#topic-meta h3{margin:5px 0}#buddypress div#new-topic-post{display:none;margin:20px 0 0;padding:1px 0 0}#buddypress table.forum,#buddypress table.messages-notices,#buddypress table.notifications,#buddypress table.notifications-settings,#buddypress table.profile-fields,#buddypress table.profile-settings,#buddypress table.wp-profile-fields{width:100%}#buddypress table.forum thead tr,#buddypress table.messages-notices thead tr,#buddypress table.notifications thead tr,#buddypress table.notifications-settings thead tr,#buddypress table.profile-fields thead tr,#buddypress table.profile-settings thead tr,#buddypress table.wp-profile-fields thead tr{background:#eaeaea}#buddypress table#message-threads{clear:both}#buddypress table.profile-fields{margin-bottom:20px}#buddypress table.profile-fields:last-child{margin-bottom:0}#buddypress table.profile-fields p{margin:0}#buddypress table.profile-fields p:last-child{margin-top:0}#buddypress table.forum tr td,#buddypress table.forum tr th,#buddypress table.messages-notices tr td,#buddypress table.messages-notices tr th,#buddypress table.notifications tr td,#buddypress table.notifications tr th,#buddypress table.notifications-settings tr td,#buddypress table.notifications-settings tr th,#buddypress table.profile-fields tr td,#buddypress table.profile-fields tr th,#buddypress table.profile-settings tr td,#buddypress table.wp-profile-fields tr td,#buddypress table.wp-profile-fields tr th{padding:8px;vertical-align:middle}#buddypress table.forum tr td.label,#buddypress table.messages-notices tr td.label,#buddypress table.notifications tr td.label,#buddypress table.notifications-settings tr td.label,#buddypress table.profile-fields tr td.label,#buddypress table.wp-profile-fields tr td.label{border-left:1px solid #eaeaea;font-weight:700;width:25%}#buddypress #message-threads .thread-info{min-width:40%}#buddypress table tr td.thread-info p{margin:0}#buddypress table tr td.thread-info p.thread-excerpt{color:#767676;font-size:80%;margin-top:3px}#buddypress table.forum td{text-align:center}#buddypress table.forum tr.alt td,#buddypress table.messages-notices tr.alt td,#buddypress table.notifications tr.alt td,#buddypress table.notifications-settings tr.alt td,#buddypress table.profile-fields tr.alt td,#buddypress table.profile-settings tr.alt td,#buddypress table.wp-profile-fields tr.alt td{background:#f5f5f5;color:#707070}#buddypress table.notification-settings{margin-bottom:20px;text-align:right}#buddypress #groups-notification-settings{margin-bottom:0}#buddypress table.notification-settings td:first-child,#buddypress table.notification-settings th.icon,#buddypress table.notifications td:first-child,#buddypress table.notifications th.icon{display:none}#buddypress table.notification-settings th.title,#buddypress table.profile-settings th.title{width:80%}#buddypress table.notification-settings .no,#buddypress table.notification-settings .yes{text-align:center;width:40px}#buddypress table.forum{margin:0;width:auto;clear:both}#buddypress table.forum tr.sticky td{font-size:110%;background:#fff9db;border-top:1px solid #ffe8c4;border-bottom:1px solid #ffe8c4}#buddypress table.forum tr.closed td.td-title{padding-right:35px}#buddypress table.forum td p.topic-text{color:#767676;font-size:100%}#buddypress table.forum tr>td:first-child,#buddypress table.forum tr>th:first-child{padding-right:15px}#buddypress table.forum tr>td:last-child,#buddypress table.forum tr>th:last-child{padding-left:15px}#buddypress table.forum td.td-group,#buddypress table.forum td.td-poster,#buddypress table.forum td.td-title,#buddypress table.forum tr th#th-group,#buddypress table.forum tr th#th-poster,#buddypress table.forum tr th#th-title{text-align:right}#buddypress table.forum tr td.td-title a.topic-title{font-size:110%}#buddypress table.forum td.td-freshness{white-space:nowrap}#buddypress table.forum td.td-freshness span.time-since{font-size:80%;color:#767676}#buddypress table.forum td img.avatar{float:none;margin:0 0 -8px 5px}#buddypress table.forum td.td-group,#buddypress table.forum td.td-poster{min-width:140px}#buddypress table.forum th#th-title{width:80%}#buddypress table.forum th#th-freshness{width:25%}#buddypress table.forum th#th-postcount{width:15%}#buddypress table.forum p.topic-meta{font-size:80%;margin:5px 0 0}#buddypress .item-body{margin:20px 0}#buddypress span.activity{display:inline-block;font-size:small;padding:0}#buddypress span.user-nicename{color:#767676;display:inline-block;font-size:120%;font-weight:700}#sitewide-notice,.bp-site-wide-message{position:relative}#buddypress div#message p,#sitewide-notice #message{background-color:#ffd;border:1px solid #cb2;color:#440;font-weight:400;margin-top:3px;text-decoration:none}.admin-bar-on #message p,.bp-site-wide-message #message p{padding-left:25px}.admin-bar-on #message a.button,.admin-bar-on #message button,.bp-site-wide-message #message a.button,.bp-site-wide-message #message button{font-size:.8em;padding:2px 4px;position:absolute;left:0;top:0}.admin-bar-on #message a.button,.admin-bar-on #message button{left:10px;top:7px}#buddypress #item-header:after{clear:both;content:"";display:table}#buddypress div#item-header div#item-header-content{float:right;margin-right:0}#buddypress div#item-header h2{line-height:1.2;margin:0 0 15px}#buddypress div#item-header h2 a{color:#767676;text-decoration:none}#buddypress div#item-header img.avatar{float:right;margin:0 0 19px 15px}#buddypress div#item-header h2{margin-bottom:5px}#buddypress div#item-header h2 span.highlight{font-size:60%;font-weight:400;line-height:1.7;vertical-align:middle;display:inline-block}#buddypress div#item-header h2 span.highlight span{background:#a1dcfa;color:#fff;cursor:pointer;font-weight:700;font-size:80%;margin-bottom:2px;padding:1px 4px;position:relative;left:-2px;top:-2px;vertical-align:middle}#buddypress div#item-header div#item-meta{font-size:80%;color:#767676;overflow:hidden;margin:15px 0 5px;padding-bottom:10px}#buddypress div#item-header div#item-actions{float:left;margin:0 15px 15px 0;text-align:left;width:20%}#buddypress div#item-header div#item-actions h2,#buddypress div#item-header div#item-actions h3{margin:0 0 5px}#buddypress div#item-header div#item-actions a{display:inline-block}#buddypress div#item-header ul{margin-bottom:15px}#buddypress div#item-header ul:after{clear:both;content:"";display:table}#buddypress div#item-header ul h5,#buddypress div#item-header ul hr,#buddypress div#item-header ul span{display:none}#buddypress div#item-header ul li{float:left;list-style:none}#buddypress div#item-header ul img.avatar,#buddypress div#item-header ul.avatars img.avatar{height:30px;margin:2px;width:30px}#buddypress div#item-header a.button,#buddypress div#item-header div.generic-button{float:right;margin:10px 0 0 10px}body.no-js #buddypress div#item-header .js-self-profile-button{display:none}#buddypress div#item-header div#message.info{line-height:.8}#buddypress ul.item-list{border-top:1px solid #eaeaea;width:100%;list-style:none;clear:both;margin:0;padding:0}body.activity-permalink #buddypress ul.item-list,body.activity-permalink #buddypress ul.item-list li.activity-item{border:none}#buddypress ul.item-list li{border-bottom:1px solid #eaeaea;padding:15px 0;margin:0;position:relative;list-style:none}#buddypress ul.single-line li{border:none}#buddypress ul.item-list li img.avatar{float:right;margin:0 0 0 10px}#buddypress ul.item-list li div.item-title,#buddypress ul.item-list li h3,#buddypress ul.item-list li h4{font-weight:400;font-size:90%;margin:0;width:75%}#buddypress ul.item-list li div.item-title span{color:#767676;font-size:80%}#buddypress ul.item-list li div.item-desc{color:#767676;font-size:80%;margin:10px 60px 0 0;width:50%}#buddypress ul.item-list li.group-no-avatar div.item-desc{margin-right:0}#buddypress ul.item-list li div.action{position:absolute;top:15px;left:0;text-align:left}#buddypress ul.item-list li div.meta{color:#767676;font-size:80%;margin-top:10px}#buddypress ul.item-list li h5 span.small{float:left;font-size:80%;font-weight:400}#buddypress div.item-list-tabs{background:0 0;clear:right;overflow:hidden}#buddypress div.item-list-tabs ul{margin:0;padding:0}#buddypress div.item-list-tabs ul li{float:right;margin:0;list-style:none}#buddypress div.item-list-tabs#subnav ul li{margin-top:0}#buddypress div.item-list-tabs ul li.last{float:left;margin:7px 0 0}#buddypress div.item-list-tabs#subnav ul li.last{margin-top:4px}#buddypress div.item-list-tabs ul li.last select{max-width:185px}#buddypress div.item-list-tabs ul li a,#buddypress div.item-list-tabs ul li span{display:block;padding:5px 10px;text-decoration:none}#buddypress div.item-list-tabs ul li a span{background:#eee;border-radius:50%;border:1px solid #ccc;color:#6c6c6c;display:inline;font-size:70%;margin-right:2px;padding:3px 6px;text-align:center;vertical-align:middle}#buddypress div.item-list-tabs ul li.current a,#buddypress div.item-list-tabs ul li.selected a{background-color:#eee;color:#555;opacity:.9;font-weight:700}#buddypress div.item-list-tabs ul li a:hover span,#buddypress div.item-list-tabs ul li.current a span,#buddypress div.item-list-tabs ul li.selected a span{background-color:#eee}#buddypress div.item-list-tabs ul li.current a span,#buddypress div.item-list-tabs ul li.selected a span{background-color:#fff}#buddypress div#item-nav ul li.loading a{background-position:12% 50%}#buddypress div.item-list-tabs#object-nav{margin-top:0}#buddypress div.item-list-tabs#subnav{background:0 0;margin:10px 0;overflow:hidden}#buddypress #admins-list li,#buddypress #members-list li,#buddypress #mods-list li{overflow:auto;list-style:none}#buddypress .group-members-list{width:100%;margin-top:1em;clear:both;overflow:auto}#buddypress #item-buttons:empty{display:none}#buddypress #cover-image-container{position:relative;z-index:0}#buddypress #header-cover-image{background-color:#c5c5c5;background-position:center top;background-repeat:no-repeat;background-size:cover;border:0;display:block;right:0;margin:0;padding:0;position:absolute;top:0;width:100%;z-index:1}#buddypress #item-header-cover-image{padding:0 1em;position:relative;z-index:2}#buddypress table#message-threads tr.unread td{background:#fff9db;border-top:1px solid #ffe8c4;border-bottom:1px solid #ffe8c4;font-weight:700}#buddypress table#message-threads tr.unread td .activity,#buddypress table#message-threads tr.unread td .thread-excerpt,#buddypress table#message-threads tr.unread td.thread-options{font-weight:400}#buddypress li span.unread-count,#buddypress tr.unread span.unread-count{background:#d00;color:#fff;font-weight:700;padding:2px 8px}#buddypress div.item-list-tabs ul li a span.unread-count{padding:1px 6px;color:#fff}#buddypress div#message-thread div.message-box{margin:0;padding:15px}#buddypress div#message-thread div.alt{background:#f4f4f4}#buddypress div#message-thread p#message-recipients{margin:10px 0 20px}#buddypress div#message-thread img.avatar{float:right;margin:0 0 0 10px;vertical-align:middle}#buddypress div#message-thread strong{font-size:100%;margin:0}#buddypress div#message-thread strong a{text-decoration:none}#buddypress div#message-thread strong span.activity{margin-top:4px}#buddypress div#message-thread div.message-metadata:after{clear:both;content:"";display:table}#buddypress div#message-thread div.message-content{margin-right:45px}#buddypress div#message-thread div.message-options{text-align:left}#buddypress #message-threads img.avatar{max-width:none}#buddypress div.message-search{float:left;margin:0 20px}.message-metadata{position:relative}.message-star-actions{position:absolute;left:0;top:0}#buddypress a.message-action-star,#buddypress a.message-action-unstar{border-bottom:0;text-decoration:none;outline:0}a.message-action-star{opacity:.7}a.message-action-star:hover{opacity:1}.message-action-star span.icon:before,.message-action-unstar span.icon:before{font-family:dashicons;font-size:18px}.message-action-star span.icon:before{color:#767676;content:"\f154"}.message-action-unstar span.icon:before{color:#fcdd77;content:"\f155"}#buddypress div.profile h2{margin-bottom:auto;margin-top:15px}#buddypress #profile-edit-form ul.button-nav{margin-top:15px}body.no-js #buddypress .field-visibility-settings-close,body.no-js #buddypress .field-visibility-settings-toggle{display:none}#buddypress .field-visibility-settings{display:none;margin-top:10px}body.no-js #buddypress .field-visibility-settings{display:block}#buddypress .current-visibility-level{font-weight:700;font-style:normal}#buddypress .field-visibility-settings,#buddypress .field-visibility-settings-notoggle,#buddypress .field-visibility-settings-toggle{color:#707070}#buddypress .field-visibility-settings a,#buddypress .field-visibility-settings-toggle a{font-size:80%}body.register #buddypress div.page ul{list-style:none}#buddypress .standard-form .field-visibility-settings label{margin:0;font-weight:400}#buddypress .field-visibility-settings legend,#buddypress .field-visibility-settings-toggle{font-style:italic}#buddypress .field-visibility-settings .radio{list-style:none;margin-bottom:0}#buddypress .field-visibility select{margin:0}#buddypress .wp-editor-container{border:1px solid #dedede}#buddypress .html-active button.switch-html{border-bottom-color:transparent;border-bottom-right-radius:0;border-bottom-left-radius:0;background:#f5f5f5;color:#707070}#buddypress .tmce-active button.switch-tmce{border-bottom-color:transparent;border-bottom-right-radius:0;border-bottom-left-radius:0;background:#f5f5f5;color:#707070}#buddypress .standard-form .wp-editor-container textarea{width:100%;padding-top:0;padding-bottom:0}.widget.buddypress span.activity{display:inline-block;font-size:small;padding:0}.widget.buddypress div.item-options{font-size:90%;margin:0 0 1em;padding:1em 0}.widget.buddypress div.item{margin:0 0 1em}.widget.buddypress div.item-content,.widget.buddypress div.item-meta{font-size:11px;margin-right:50px}.widget.buddypress div.avatar-block:after{clear:both;content:"";display:table}.widget.buddypress .item-avatar a{float:right;margin-bottom:15px;margin-left:10px}.widget.buddypress div.item-avatar img{display:inline-block;height:40px;margin:1px;width:40px}.widget.buddypress .item-avatar a,.widget.buddypress .item-avatar a img,.widget.buddypress .item-avatar a:active,.widget.buddypress .item-avatar a:focus,.widget.buddypress .item-avatar a:hover{box-shadow:none}.widget.buddypress #bp-login-widget-form label{display:block;margin:1rem 0 .5rem}.widget.buddypress #bp-login-widget-form #bp-login-widget-submit{margin-left:10px}.widget.buddypress .bp-login-widget-user-avatar{float:right}.bp-login-widget-user-avatar img.avatar{height:40px;width:40px}.widget.buddypress .bp-login-widget-user-links>div{padding-right:60px}.widget.buddypress .bp-login-widget-user-links>div{margin-bottom:.5rem}.widget.buddypress .bp-login-widget-user-links>div.bp-login-widget-user-link a{font-weight:700}.widget.buddypress #friends-list,.widget.buddypress #groups-list,.widget.buddypress #members-list{margin-right:0;padding-right:0}.widget.buddypress #friends-list li,.widget.buddypress #groups-list li,.widget.buddypress #members-list li{clear:both;list-style-type:none}.buddypress .bp-tooltip{position:relative}.bp-tooltip:after{background:#fff;border:1px solid #aaa;border-collapse:separate;border-radius:1px;box-shadow:-1px 1px 0 1px rgba(132,132,132,.3);color:#000;content:attr(data-bp-tooltip);display:none;font-family:sans-serif;font-size:11px;font-weight:400;letter-spacing:normal;line-height:1.5;margin-top:10px;max-width:240px;opacity:0;padding:3px 6px;position:absolute;left:50%;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;top:100%;transform:translateX(-50%);transition:opacity 2s ease-out;white-space:pre;word-wrap:break-word;z-index:998}.bp-tooltip:active:after,.bp-tooltip:focus:after,.bp-tooltip:hover:after{display:inline-block;opacity:1;overflow:visible;text-decoration:none;z-index:999}#group-admins .bp-tooltip:after,#group-mods .bp-tooltip:after,.message-metadata .bp-tooltip:after{left:0;text-align:left;transform:translateX(0)}.feed .bp-tooltip:after,.item-list .bp-tooltip:after,.messages-notices .bp-tooltip:after{right:0;left:auto;text-align:right;transform:translateX(0)}.admin-bar-on .bp-tooltip:after,.bp-site-wide-message .bp-tooltip:after{left:50px}@media only screen and (max-width:480px){#buddypress div.dir-search{float:left;margin-top:-50px;text-align:left}#buddypress div.dir-search input[type=text]{margin-bottom:1em;width:50%}a.bp-title-button{margin-right:10px}#buddypress form.standard-form .main-column div.action{position:relative;margin-bottom:1em}#buddypress form.standard-form .main-column ul#friend-list h3,#buddypress form.standard-form .main-column ul#friend-list h4{width:100%}}@media only screen and (max-width:320px){#buddypress div.dir-search{clear:right;float:right;margin-top:0;text-align:right}#buddypress li#groups-order-select{clear:right;float:right}#buddypress ul.item-list li div.action{clear:right;float:right;margin-top:0;margin-right:70px;position:relative;top:0;left:0;text-align:right}#buddypress ul.item-list li div.item-desc{clear:right;float:right;margin:10px 0 0;width:auto}#buddypress li div.item{margin-right:70px;width:auto}#buddypress ul.item-list li div.meta{margin-top:0}#buddypress .item-desc p{margin:0 0 10px}#buddypress div.pagination .pag-count{margin-right:0}}@media only screen and (max-width:240px){#buddypress div.dir-search{float:right;margin:0}#buddypress div.dir-search input[type=text]{width:50%}#buddypress li#groups-order-select{float:right}#buddypress ul.item-list li img.avatar{width:30px;height:auto}#buddypress li div.item,#buddypress ul.item-list li div.action{margin-right:45px}h1 a.bp-title-button{clear:right;float:right;margin:10px 0 20px}}
bp-templates/bp-legacy/css/buddypress.css CHANGED
@@ -1428,7 +1428,9 @@ fieldset.create-site label {
1428
  }
1429
 
1430
  .bp-site-wide-message #message button,
1431
- .admin-bar-on #message button {
 
 
1432
  font-size: 0.8em;
1433
  padding: 2px 4px;
1434
  position: absolute;
@@ -1436,7 +1438,8 @@ fieldset.create-site label {
1436
  top: 0;
1437
  }
1438
 
1439
- .admin-bar-on #message button {
 
1440
  right: 10px;
1441
  top: 7px;
1442
  }
1428
  }
1429
 
1430
  .bp-site-wide-message #message button,
1431
+ .bp-site-wide-message #message a.button,
1432
+ .admin-bar-on #message button,
1433
+ .admin-bar-on #message a.button {
1434
  font-size: 0.8em;
1435
  padding: 2px 4px;
1436
  position: absolute;
1438
  top: 0;
1439
  }
1440
 
1441
+ .admin-bar-on #message button,
1442
+ .admin-bar-on #message a.button {
1443
  right: 10px;
1444
  top: 7px;
1445
  }
bp-templates/bp-legacy/css/buddypress.min.css CHANGED
@@ -1 +1 @@
1
- #buddypress div.pagination{background:0 0;border:none;color:#767676;font-size:small;margin:0;position:relative;display:block;float:left;width:100%;padding:10px 0}#buddypress div.pagination .pag-count{float:left;margin-left:10px}#buddypress div.pagination .pagination-links{float:right;margin-right:10px}#buddypress div.pagination .pagination-links a,#buddypress div.pagination .pagination-links span{font-size:90%;padding:0 5px}#buddypress div.pagination .pagination-links a:hover{font-weight:700}#buddypress noscript div.pagination{margin-bottom:15px}#buddypress #nav-above{display:none}#buddypress .paged #nav-above{display:block}#buddypress img.wp-smiley{border:none!important;clear:none!important;float:none!important;margin:0!important;padding:0!important}#buddypress .clear{clear:left}#buddypress #activity-stream{margin-top:-5px}#buddypress #activity-stream p{margin:5px 0}#buddypress #item-body form#whats-new-form{margin:0;padding:0}#buddypress .home-page form#whats-new-form{border-bottom:none;padding-bottom:0}#buddypress form#whats-new-form #whats-new-avatar{float:left}#buddypress form#whats-new-form #whats-new-content{margin-left:55px;padding:0 0 20px 20px}#buddypress form#whats-new-form p.activity-greeting{line-height:.5;margin-bottom:15px;margin-left:75px}#buddypress form#whats-new-form textarea{background:#fff;box-sizing:border-box;color:#555;font-family:inherit;font-size:medium;height:2.2em;line-height:1.4;padding:6px;width:100%}body.no-js #buddypress form#whats-new-form textarea{height:50px}#buddypress form#whats-new-form #whats-new-options select{max-width:200px;margin-top:12px}#buddypress form#whats-new-form #whats-new-submit{float:right;margin-top:12px}#buddypress #whats-new-options:after{clear:both;content:"";display:table}body.no-js #buddypress #whats-new-options{height:auto}#buddypress #whats-new:focus{border-color:rgba(31,179,221,.9)!important;outline-color:rgba(31,179,221,.9)}#buddypress ul.activity-list li{overflow:hidden;padding:15px 0 0;list-style:none}#buddypress .activity-list .activity-avatar{float:left}#buddypress ul.item-list.activity-list li.has-comments{padding-bottom:15px}body.activity-permalink #buddypress ul.activity-list li.has-comments{padding-bottom:0}#buddypress .activity-list li.mini{font-size:80%;position:relative}#buddypress .activity-list li.mini .activity-avatar img.FB_profile_pic,#buddypress .activity-list li.mini .activity-avatar img.avatar{height:20px;margin-left:30px;width:20px}#buddypress .activity-permalink .activity-list li.mini .activity-avatar img.FB_profile_pic,#buddypress .activity-permalink .activity-list li.mini .activity-avatar img.avatar{height:auto;margin-left:0;width:auto}body.activity-permalink #buddypress .activity-list>li:first-child{padding-top:0}#buddypress .activity-list li .activity-content{position:relative}#buddypress .activity-list li.mini .activity-content p{margin:0}#buddypress .activity-list li.mini .activity-comments{clear:both;font-size:120%}body.activity-permalink #buddypress li.mini .activity-meta{margin-top:4px}#buddypress .activity-list li .activity-inreplyto{color:#767676;font-size:80%}#buddypress .activity-list li .activity-inreplyto>p{margin:0;display:inline}#buddypress .activity-list li .activity-inreplyto blockquote,#buddypress .activity-list li .activity-inreplyto div.activity-inner{background:0 0;border:none;display:inline;margin:0;overflow:hidden;padding:0}#buddypress .activity-list .activity-content{margin:0 0 0 70px}body.activity-permalink #buddypress .activity-list li .activity-content{border:none;font-size:100%;line-height:1.5;margin-left:170px;margin-right:0;padding:0}body.activity-permalink #buddypress .activity-list li .activity-header>p{margin:0;padding:5px 0 0}#buddypress .activity-list .activity-content .activity-header,#buddypress .activity-list .activity-content .comment-header{color:#767676;line-height:2.2}#buddypress .activity-header{margin-right:20px}#buddypress .acomment-meta a,#buddypress .activity-header a,#buddypress .comment-meta a{text-decoration:none}#buddypress .activity-list .activity-content .activity-header img.avatar{float:none!important;margin:0 5px -8px 0!important}#buddypress a.bp-secondary-action,#buddypress span.highlight{font-size:80%;padding:0;margin-right:5px;text-decoration:none}#buddypress .activity-list .activity-content .activity-inner,#buddypress .activity-list .activity-content blockquote{margin:10px 10px 5px 0;overflow:hidden}#buddypress .activity-list li.new_forum_post .activity-content .activity-inner,#buddypress .activity-list li.new_forum_topic .activity-content .activity-inner{border-left:2px solid #eaeaea;margin-left:5px;padding-left:10px}body.activity-permalink #buddypress .activity-content .activity-inner,body.activity-permalink #buddypress .activity-content blockquote{margin-left:0;margin-top:5px}#buddypress .activity-inner>p{word-wrap:break-word}#buddypress .activity-inner>.activity-inner{margin:0}#buddypress .activity-inner>blockquote{margin:0}#buddypress .activity-list .activity-content img.thumbnail{border:2px solid #eee;float:left;margin:0 10px 5px 0}#buddypress .activity-read-more{margin-left:1em;white-space:nowrap}#buddypress .activity-list li.load-more,#buddypress .activity-list li.load-newest{background:#f0f0f0;font-size:110%;margin:15px 0;padding:10px 15px;text-align:center}#buddypress .activity-list li.load-more a,#buddypress .activity-list li.load-newest a{color:#4d4d4d}#buddypress div.activity-meta{margin:18px 0 0}body.activity-permalink #buddypress div.activity-meta{margin-bottom:6px}#buddypress div.activity-meta a{padding:4px 8px}#buddypress a.activity-time-since{color:#767676;text-decoration:none}#buddypress a.activity-time-since:hover{color:#767676;text-decoration:underline}#buddypress #reply-title small a,#buddypress a.bp-primary-action{font-size:80%;margin-right:5px;text-decoration:none}#buddypress #reply-title small a span,#buddypress a.bp-primary-action span{background:#767676;color:#fff;font-size:90%;margin-left:2px;padding:0 5px}#buddypress #reply-title small a:hover span,#buddypress a.bp-primary-action:hover span{background:#555;color:#fff}#buddypress div.activity-comments{margin:0 0 0 70px;overflow:hidden;position:relative;width:auto;clear:both}body.activity-permalink #buddypress div.activity-comments{background:0 0;margin-left:170px;width:auto}#buddypress div.activity-comments>ul{padding:0 0 0 10px}#buddypress div.activity-comments ul,#buddypress div.activity-comments ul li{border:none;list-style:none}#buddypress div.activity-comments ul{clear:both;margin:0}#buddypress div.activity-comments ul li{border-top:1px solid #eee;padding:10px 0 0}body.activity-permalink #buddypress .activity-list li.mini .activity-comments{clear:none;margin-top:0}body.activity-permalink #buddypress div.activity-comments ul li{border-width:1px;padding:10px 0 0}#buddypress div.activity-comments>ul>li:first-child{border-top:none}#buddypress div.activity-comments ul li:last-child{margin-bottom:0}#buddypress div.activity-comments ul li>ul{margin-left:30px;margin-top:0;padding-left:10px}body.activity-permalink #buddypress div.activity-comments ul li>ul{margin-top:10px}body.activity-permalink #buddypress div.activity-comments>ul{padding:0 10px 0 15px}#buddypress div.activity-comments div.acomment-avatar img{border-width:1px;float:left;height:25px;margin-right:10px;width:25px}#buddypress div.activity-comments div.acomment-content{font-size:80%;margin:5px 0 0 40px}#buddypress div.acomment-content .activity-delete-link,#buddypress div.acomment-content .comment-header,#buddypress div.acomment-content .time-since{display:none}body.activity-permalink #buddypress div.activity-comments div.acomment-content{font-size:90%}#buddypress div.activity-comments div.acomment-meta{color:#767676;font-size:80%}#buddypress div.activity-comments form.ac-form{display:none;padding:10px}#buddypress div.activity-comments li form.ac-form{margin-right:15px;clear:both}#buddypress div.activity-comments form.root{margin-left:0}#buddypress div.activity-comments div#message{margin-top:15px;margin-bottom:0}#buddypress div.activity-comments form .ac-textarea{background:#fff;border:1px inset #ccc;margin-bottom:10px;padding:8px}#buddypress div.activity-comments form textarea{border:none;background:0 0;box-shadow:none;outline:0;color:#555;font-family:inherit;font-size:100%;height:60px;padding:0;margin:0;width:100%}#buddypress div.activity-comments form input{margin-top:5px}#buddypress div.activity-comments form div.ac-reply-avatar{float:left}#buddypress div.ac-reply-avatar img{border:1px solid #eee}#buddypress div.activity-comments form div.ac-reply-content{color:#767676;margin-left:50px;padding-left:15px}#buddypress div.activity-comments form div.ac-reply-content a{text-decoration:none}#buddypress .acomment-options{float:left;margin:5px 0 5px 40px}#buddypress .acomment-options a{color:#767676}#buddypress .acomment-options a:hover{color:inherit}#buddypress div.dir-search{float:right;margin:-39px 0 0 0}#buddypress div.dir-search input[type=text],#buddypress li.groups-members-search input[type=text]{font-size:90%;padding:1px 3px}#buddypress .current-member-type{font-style:italic}#buddypress .dir-form{clear:both}#buddypress div#message{margin:0 0 15px}#buddypress #message.info{margin-bottom:0}#buddypress div#message.updated{clear:both;display:block}#buddypress div#message p,#sitewide-notice p,#sitewide-notice strong:first-child{font-size:90%;display:block;padding:10px 15px}#buddypress div#message.error p{background-color:#fdc;border:1px solid #a00;clear:left;color:#800}#buddypress div#message.warning p{background-color:#ffe0af;border:1px solid #ffd087;clear:left;color:#800}#buddypress div#message.updated p{background-color:#efc;border:1px solid #591;color:#250}#buddypress #pass-strength-result{background-color:#eee;border-color:#ddd;border-style:solid;border-width:1px;display:none;margin:5px 5px 5px 0;padding:5px;text-align:center;width:150px}#buddypress .standard-form #basic-details-section #pass-strength-result{width:35%}#buddypress #pass-strength-result.bad,#buddypress #pass-strength-result.error{background-color:#ffb78c;border-color:#ff853c!important;display:block}#buddypress #pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;display:block}#buddypress #pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;display:block}#buddypress #pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;display:block}#buddypress .standard-form#signup_form div div.error{background:#faa;color:#a00;margin:0 0 10px;padding:6px;width:90%}#buddypress div.accept,#buddypress div.reject{float:left;margin-left:10px}#buddypress ul.button-nav li{float:left;margin:0 10px 10px 0;list-style:none}#buddypress ul.button-nav li.current a{font-weight:700}#sitewide-notice #message{left:2%;position:fixed;top:1em;width:96%;z-index:9999}#sitewide-notice.admin-bar-on #message{top:3.3em}#sitewide-notice strong{display:block;margin-bottom:-1em}body.create-blog #buddypress .error{background-color:#fdc;border:1px solid #a00;color:#800;padding:10px 15px}body.create-blog #buddypress .success{background-color:#efc;border:1px solid #591;color:#250;padding:10px 15px}#buddypress form fieldset{border:0;padding:0}#buddypress .dir-search input[type=search],#buddypress .dir-search input[type=text],#buddypress .groups-members-search input[type=search],#buddypress .groups-members-search input[type=text],#buddypress .standard-form input[type=color],#buddypress .standard-form input[type=date],#buddypress .standard-form input[type=datetime-local],#buddypress .standard-form input[type=datetime],#buddypress .standard-form input[type=email],#buddypress .standard-form input[type=month],#buddypress .standard-form input[type=number],#buddypress .standard-form input[type=password],#buddypress .standard-form input[type=range],#buddypress .standard-form input[type=search],#buddypress .standard-form input[type=tel],#buddypress .standard-form input[type=text],#buddypress .standard-form input[type=time],#buddypress .standard-form input[type=url],#buddypress .standard-form input[type=week],#buddypress .standard-form select,#buddypress .standard-form textarea{border:1px solid #ccc;background:#fafafa;border-radius:0;color:#737373;font:inherit;font-size:100%;padding:6px}#buddypress .standard-form select{padding:3px}#buddypress .standard-form input[type=password]{margin-bottom:5px}#buddypress .standard-form label,#buddypress .standard-form legend,#buddypress .standard-form span.label{display:block;font-weight:700;margin:15px 0 5px;width:auto}#buddypress label.xprofile-field-label{display:inline}#buddypress .standard-form #invite-list label,#buddypress .standard-form p label{font-weight:400;margin:auto}#buddypress .standard-form .checkbox label,#buddypress .standard-form .radio label{color:#767676;font-size:100%;font-weight:400;margin:5px 0 0}#buddypress .standard-form .checkbox label input,#buddypress .standard-form .radio label input{margin-right:3px}#buddypress .standard-form#sidebar-login-form label{margin-top:5px}#buddypress .standard-form input[type=text]{width:75%}#buddypress .standard-form#sidebar-login-form input[type=password],#buddypress .standard-form#sidebar-login-form input[type=text]{padding:4px;width:95%}#buddypress .standard-form #basic-details-section input[type=password],#buddypress .standard-form #blog-details-section input#signup_blog_url{width:35%}#buddypress #commentform input[type=text],#buddypress #commentform textarea,#buddypress .form-allowed-tags,#buddypress .standard-form#signup_form input[type=text],#buddypress .standard-form#signup_form textarea{width:90%}#buddypress .standard-form#signup_form div.submit{float:right}#buddypress div#signup-avatar img{margin:0 15px 10px 0}#buddypress .standard-form textarea{width:75%;height:120px}#buddypress .standard-form textarea#message_content{height:200px}#buddypress .standard-form#send-reply textarea{width:97.5%}#buddypress .standard-form p.description{color:#767676;font-size:80%;margin:5px 0}#buddypress .standard-form div.submit{clear:both;padding:15px 0 0}#buddypress .standard-form p.submit{margin-bottom:0;padding:15px 0 0}#buddypress .standard-form div.submit input{margin-right:15px}#buddypress .standard-form div.radio ul{margin:10px 0 15px 38px;list-style:disc}#buddypress .standard-form div.radio ul li{margin-bottom:5px}#buddypress .standard-form a.clear-value{display:block;margin-top:5px;outline:0}#buddypress .standard-form #basic-details-section,#buddypress .standard-form #blog-details-section,#buddypress .standard-form #profile-details-section{float:left;width:48%}#buddypress .standard-form #profile-details-section{float:right}#buddypress #notifications-bulk-management,#buddypress .standard-form #blog-details-section{clear:left}body.no-js #buddypress #delete_inbox_messages,body.no-js #buddypress #delete_sentbox_messages,body.no-js #buddypress #message-type-select,body.no-js #buddypress #messages-bulk-management #select-all-messages,body.no-js #buddypress #notifications-bulk-management #select-all-notifications,body.no-js #buddypress label[for=message-type-select]{display:none}#buddypress .standard-form input:focus,#buddypress .standard-form select:focus,#buddypress .standard-form textarea:focus{background:#fafafa;color:#555}#buddypress form#send-invite-form{margin-top:20px}#buddypress div#invite-list{background:#f5f5f5;height:400px;margin:0 0 10px;overflow:auto;padding:5px;width:160px}#buddypress .comment-reply-link,#buddypress .generic-button a,#buddypress .standard-form button,#buddypress a.button,#buddypress input[type=button],#buddypress input[type=reset],#buddypress input[type=submit],#buddypress ul.button-nav li a,a.bp-title-button{background:#fff;border:1px solid #ccc;color:#767676;font-size:small;cursor:pointer;outline:0;padding:4px 10px;text-align:center;text-decoration:none}#buddypress .comment-reply-link:hover,#buddypress .standard-form button:hover,#buddypress a.button:focus,#buddypress a.button:hover,#buddypress div.generic-button a:hover,#buddypress input[type=button]:hover,#buddypress input[type=reset]:hover,#buddypress input[type=submit]:hover,#buddypress ul.button-nav li a:hover,#buddypress ul.button-nav li.current a{background:#ededed;border:1px solid #bbb;color:#555;outline:0;text-decoration:none}#buddypress form.standard-form .left-menu{float:left}#buddypress form.standard-form .left-menu #invite-list ul{margin:1%;list-style:none}#buddypress form.standard-form .left-menu #invite-list ul li{margin:0 0 0 1%}#buddypress form.standard-form .main-column{margin-left:190px}#buddypress form.standard-form .main-column ul#friend-list{clear:none;float:left}#buddypress form.standard-form .main-column ul#friend-list h3,#buddypress form.standard-form .main-column ul#friend-list h4{clear:none}#buddypress .wp-editor-wrap a.button,#buddypress .wp-editor-wrap button,#buddypress .wp-editor-wrap input[type=button],#buddypress .wp-editor-wrap input[type=reset],#buddypress .wp-editor-wrap input[type=submit]{padding:0 8px 1px}#buddypress form [disabled=disabled]{cursor:default;opacity:.4}fieldset.register-site{margin-top:1em}fieldset.create-site{margin-bottom:2em}fieldset.create-site legend{margin-bottom:1em}fieldset.create-site label{margin-right:3em}.bp-screen-reader-text{clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;position:absolute!important;width:1px;word-wrap:normal!important}.bp-screen-reader-text:focus{background-color:#f1f1f1;border-radius:3px;box-shadow:0 0 2px 2px rgba(0,0,0,.6);clip:auto!important;color:#21759b;display:block;font-size:14px;font-size:.875rem;font-weight:700;height:auto;left:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}#buddypress a.loading,#buddypress input.loading{-webkit-animation:loader-pulsate .5s infinite ease-in-out alternate;-moz-animation:loader-pulsate .5s infinite ease-in-out alternate;border-color:#aaa}#buddypress a.loading:hover,#buddypress input.loading:hover{color:#767676}#buddypress a.disabled,#buddypress button.disabled,#buddypress button.pending,#buddypress div.pending a,#buddypress input[type=button].disabled,#buddypress input[type=button].pending,#buddypress input[type=reset].disabled,#buddypress input[type=reset].pending,#buddypress input[type=submit].disabled,#buddypress input[type=submit].pending,#buddypress input[type=submit][disabled=disabled]{border-color:#eee;color:#bbb;cursor:default}#buddypress a.disabled:hover,#buddypress button.disabled:hover,#buddypress button.pending:hover,#buddypress div.pending a:hover,#buddypress input[type=button]:hover.disabled,#buddypress input[type=button]:hover.pending,#buddypress input[type=reset]:hover.disabled,#buddypress input[type=reset]:hover.pending,#buddypress input[type=submit]:hover.disabled,#buddypress input[type=submit]:hover.pending{border-color:#eee;color:#bbb}#buddypress ul#topic-post-list{margin:0;width:auto}#buddypress ul#topic-post-list li{padding:15px;position:relative}#buddypress ul#topic-post-list li.alt{background:#f5f5f5}#buddypress ul#topic-post-list li div.poster-meta{color:#767676;margin-bottom:10px}#buddypress ul#topic-post-list li div.post-content{margin-left:54px}#buddypress div.topic-tags{font-size:80%}#buddypress div.admin-links{color:#767676;font-size:80%;position:absolute;top:15px;right:25px}#buddypress div#topic-meta{margin:0;padding:5px 19px 30px;position:relative}#buddypress div#topic-meta div.admin-links{right:19px;top:-36px}#buddypress div#topic-meta h3{margin:5px 0}#buddypress div#new-topic-post{display:none;margin:20px 0 0;padding:1px 0 0}#buddypress table.forum,#buddypress table.messages-notices,#buddypress table.notifications,#buddypress table.notifications-settings,#buddypress table.profile-fields,#buddypress table.profile-settings,#buddypress table.wp-profile-fields{width:100%}#buddypress table.forum thead tr,#buddypress table.messages-notices thead tr,#buddypress table.notifications thead tr,#buddypress table.notifications-settings thead tr,#buddypress table.profile-fields thead tr,#buddypress table.profile-settings thead tr,#buddypress table.wp-profile-fields thead tr{background:#eaeaea}#buddypress table#message-threads{clear:both}#buddypress table.profile-fields{margin-bottom:20px}#buddypress table.profile-fields:last-child{margin-bottom:0}#buddypress table.profile-fields p{margin:0}#buddypress table.profile-fields p:last-child{margin-top:0}#buddypress table.forum tr td,#buddypress table.forum tr th,#buddypress table.messages-notices tr td,#buddypress table.messages-notices tr th,#buddypress table.notifications tr td,#buddypress table.notifications tr th,#buddypress table.notifications-settings tr td,#buddypress table.notifications-settings tr th,#buddypress table.profile-fields tr td,#buddypress table.profile-fields tr th,#buddypress table.profile-settings tr td,#buddypress table.wp-profile-fields tr td,#buddypress table.wp-profile-fields tr th{padding:8px;vertical-align:middle}#buddypress table.forum tr td.label,#buddypress table.messages-notices tr td.label,#buddypress table.notifications tr td.label,#buddypress table.notifications-settings tr td.label,#buddypress table.profile-fields tr td.label,#buddypress table.wp-profile-fields tr td.label{border-right:1px solid #eaeaea;font-weight:700;width:25%}#buddypress #message-threads .thread-info{min-width:40%}#buddypress table tr td.thread-info p{margin:0}#buddypress table tr td.thread-info p.thread-excerpt{color:#767676;font-size:80%;margin-top:3px}#buddypress table.forum td{text-align:center}#buddypress table.forum tr.alt td,#buddypress table.messages-notices tr.alt td,#buddypress table.notifications tr.alt td,#buddypress table.notifications-settings tr.alt td,#buddypress table.profile-fields tr.alt td,#buddypress table.profile-settings tr.alt td,#buddypress table.wp-profile-fields tr.alt td{background:#f5f5f5;color:#707070}#buddypress table.notification-settings{margin-bottom:20px;text-align:left}#buddypress #groups-notification-settings{margin-bottom:0}#buddypress table.notification-settings td:first-child,#buddypress table.notification-settings th.icon,#buddypress table.notifications td:first-child,#buddypress table.notifications th.icon{display:none}#buddypress table.notification-settings th.title,#buddypress table.profile-settings th.title{width:80%}#buddypress table.notification-settings .no,#buddypress table.notification-settings .yes{text-align:center;width:40px}#buddypress table.forum{margin:0;width:auto;clear:both}#buddypress table.forum tr.sticky td{font-size:110%;background:#fff9db;border-top:1px solid #ffe8c4;border-bottom:1px solid #ffe8c4}#buddypress table.forum tr.closed td.td-title{padding-left:35px}#buddypress table.forum td p.topic-text{color:#767676;font-size:100%}#buddypress table.forum tr>td:first-child,#buddypress table.forum tr>th:first-child{padding-left:15px}#buddypress table.forum tr>td:last-child,#buddypress table.forum tr>th:last-child{padding-right:15px}#buddypress table.forum td.td-group,#buddypress table.forum td.td-poster,#buddypress table.forum td.td-title,#buddypress table.forum tr th#th-group,#buddypress table.forum tr th#th-poster,#buddypress table.forum tr th#th-title{text-align:left}#buddypress table.forum tr td.td-title a.topic-title{font-size:110%}#buddypress table.forum td.td-freshness{white-space:nowrap}#buddypress table.forum td.td-freshness span.time-since{font-size:80%;color:#767676}#buddypress table.forum td img.avatar{float:none;margin:0 5px -8px 0}#buddypress table.forum td.td-group,#buddypress table.forum td.td-poster{min-width:140px}#buddypress table.forum th#th-title{width:80%}#buddypress table.forum th#th-freshness{width:25%}#buddypress table.forum th#th-postcount{width:15%}#buddypress table.forum p.topic-meta{font-size:80%;margin:5px 0 0}#buddypress .item-body{margin:20px 0}#buddypress span.activity{display:inline-block;font-size:small;padding:0}#buddypress span.user-nicename{color:#767676;display:inline-block;font-size:120%;font-weight:700}#sitewide-notice,.bp-site-wide-message{position:relative}#buddypress div#message p,#sitewide-notice #message{background-color:#ffd;border:1px solid #cb2;color:#440;font-weight:400;margin-top:3px;text-decoration:none}.admin-bar-on #message p,.bp-site-wide-message #message p{padding-right:25px}.admin-bar-on #message button,.bp-site-wide-message #message button{font-size:.8em;padding:2px 4px;position:absolute;right:0;top:0}.admin-bar-on #message button{right:10px;top:7px}#buddypress #item-header:after{clear:both;content:"";display:table}#buddypress div#item-header div#item-header-content{float:left;margin-left:0}#buddypress div#item-header h2{line-height:1.2;margin:0 0 15px}#buddypress div#item-header h2 a{color:#767676;text-decoration:none}#buddypress div#item-header img.avatar{float:left;margin:0 15px 19px 0}#buddypress div#item-header h2{margin-bottom:5px}#buddypress div#item-header h2 span.highlight{font-size:60%;font-weight:400;line-height:1.7;vertical-align:middle;display:inline-block}#buddypress div#item-header h2 span.highlight span{background:#a1dcfa;color:#fff;cursor:pointer;font-weight:700;font-size:80%;margin-bottom:2px;padding:1px 4px;position:relative;right:-2px;top:-2px;vertical-align:middle}#buddypress div#item-header div#item-meta{font-size:80%;color:#767676;overflow:hidden;margin:15px 0 5px;padding-bottom:10px}#buddypress div#item-header div#item-actions{float:right;margin:0 0 15px 15px;text-align:right;width:20%}#buddypress div#item-header div#item-actions h2,#buddypress div#item-header div#item-actions h3{margin:0 0 5px}#buddypress div#item-header div#item-actions a{display:inline-block}#buddypress div#item-header ul{margin-bottom:15px}#buddypress div#item-header ul:after{clear:both;content:"";display:table}#buddypress div#item-header ul h5,#buddypress div#item-header ul hr,#buddypress div#item-header ul span{display:none}#buddypress div#item-header ul li{float:right;list-style:none}#buddypress div#item-header ul img.avatar,#buddypress div#item-header ul.avatars img.avatar{height:30px;margin:2px;width:30px}#buddypress div#item-header a.button,#buddypress div#item-header div.generic-button{float:left;margin:10px 10px 0 0}body.no-js #buddypress div#item-header .js-self-profile-button{display:none}#buddypress div#item-header div#message.info{line-height:.8}#buddypress ul.item-list{border-top:1px solid #eaeaea;width:100%;list-style:none;clear:both;margin:0;padding:0}body.activity-permalink #buddypress ul.item-list,body.activity-permalink #buddypress ul.item-list li.activity-item{border:none}#buddypress ul.item-list li{border-bottom:1px solid #eaeaea;padding:15px 0;margin:0;position:relative;list-style:none}#buddypress ul.single-line li{border:none}#buddypress ul.item-list li img.avatar{float:left;margin:0 10px 0 0}#buddypress ul.item-list li div.item-title,#buddypress ul.item-list li h3,#buddypress ul.item-list li h4{font-weight:400;font-size:90%;margin:0;width:75%}#buddypress ul.item-list li div.item-title span{color:#767676;font-size:80%}#buddypress ul.item-list li div.item-desc{color:#767676;font-size:80%;margin:10px 0 0 60px;width:50%}#buddypress ul.item-list li.group-no-avatar div.item-desc{margin-left:0}#buddypress ul.item-list li div.action{position:absolute;top:15px;right:0;text-align:right}#buddypress ul.item-list li div.meta{color:#767676;font-size:80%;margin-top:10px}#buddypress ul.item-list li h5 span.small{float:right;font-size:80%;font-weight:400}#buddypress div.item-list-tabs{background:0 0;clear:left;overflow:hidden}#buddypress div.item-list-tabs ul{margin:0;padding:0}#buddypress div.item-list-tabs ul li{float:left;margin:0;list-style:none}#buddypress div.item-list-tabs#subnav ul li{margin-top:0}#buddypress div.item-list-tabs ul li.last{float:right;margin:7px 0 0}#buddypress div.item-list-tabs#subnav ul li.last{margin-top:4px}#buddypress div.item-list-tabs ul li.last select{max-width:185px}#buddypress div.item-list-tabs ul li a,#buddypress div.item-list-tabs ul li span{display:block;padding:5px 10px;text-decoration:none}#buddypress div.item-list-tabs ul li a span{background:#eee;border-radius:50%;border:1px solid #ccc;color:#6c6c6c;display:inline;font-size:70%;margin-left:2px;padding:3px 6px;text-align:center;vertical-align:middle}#buddypress div.item-list-tabs ul li.current a,#buddypress div.item-list-tabs ul li.selected a{background-color:#eee;color:#555;opacity:.9;font-weight:700}#buddypress div.item-list-tabs ul li a:hover span,#buddypress div.item-list-tabs ul li.current a span,#buddypress div.item-list-tabs ul li.selected a span{background-color:#eee}#buddypress div.item-list-tabs ul li.current a span,#buddypress div.item-list-tabs ul li.selected a span{background-color:#fff}#buddypress div#item-nav ul li.loading a{background-position:88% 50%}#buddypress div.item-list-tabs#object-nav{margin-top:0}#buddypress div.item-list-tabs#subnav{background:0 0;margin:10px 0;overflow:hidden}#buddypress #admins-list li,#buddypress #members-list li,#buddypress #mods-list li{overflow:auto;list-style:none}#buddypress .group-members-list{width:100%;margin-top:1em;clear:both;overflow:auto}#buddypress #item-buttons:empty{display:none}#buddypress #cover-image-container{position:relative;z-index:0}#buddypress #header-cover-image{background-color:#c5c5c5;background-position:center top;background-repeat:no-repeat;background-size:cover;border:0;display:block;left:0;margin:0;padding:0;position:absolute;top:0;width:100%;z-index:1}#buddypress #item-header-cover-image{padding:0 1em;position:relative;z-index:2}#buddypress table#message-threads tr.unread td{background:#fff9db;border-top:1px solid #ffe8c4;border-bottom:1px solid #ffe8c4;font-weight:700}#buddypress table#message-threads tr.unread td .activity,#buddypress table#message-threads tr.unread td .thread-excerpt,#buddypress table#message-threads tr.unread td.thread-options{font-weight:400}#buddypress li span.unread-count,#buddypress tr.unread span.unread-count{background:#d00;color:#fff;font-weight:700;padding:2px 8px}#buddypress div.item-list-tabs ul li a span.unread-count{padding:1px 6px;color:#fff}#buddypress div#message-thread div.message-box{margin:0;padding:15px}#buddypress div#message-thread div.alt{background:#f4f4f4}#buddypress div#message-thread p#message-recipients{margin:10px 0 20px}#buddypress div#message-thread img.avatar{float:left;margin:0 10px 0 0;vertical-align:middle}#buddypress div#message-thread strong{font-size:100%;margin:0}#buddypress div#message-thread strong a{text-decoration:none}#buddypress div#message-thread strong span.activity{margin-top:4px}#buddypress div#message-thread div.message-metadata:after{clear:both;content:"";display:table}#buddypress div#message-thread div.message-content{margin-left:45px}#buddypress div#message-thread div.message-options{text-align:right}#buddypress #message-threads img.avatar{max-width:none}#buddypress div.message-search{float:right;margin:0 20px}.message-metadata{position:relative}.message-star-actions{position:absolute;right:0;top:0}#buddypress a.message-action-star,#buddypress a.message-action-unstar{border-bottom:0;text-decoration:none;outline:0}a.message-action-star{opacity:.7}a.message-action-star:hover{opacity:1}.message-action-star span.icon:before,.message-action-unstar span.icon:before{font-family:dashicons;font-size:18px}.message-action-star span.icon:before{color:#767676;content:"\f154"}.message-action-unstar span.icon:before{color:#fcdd77;content:"\f155"}#buddypress div.profile h2{margin-bottom:auto;margin-top:15px}#buddypress #profile-edit-form ul.button-nav{margin-top:15px}body.no-js #buddypress .field-visibility-settings-close,body.no-js #buddypress .field-visibility-settings-toggle{display:none}#buddypress .field-visibility-settings{display:none;margin-top:10px}body.no-js #buddypress .field-visibility-settings{display:block}#buddypress .current-visibility-level{font-weight:700;font-style:normal}#buddypress .field-visibility-settings,#buddypress .field-visibility-settings-notoggle,#buddypress .field-visibility-settings-toggle{color:#707070}#buddypress .field-visibility-settings a,#buddypress .field-visibility-settings-toggle a{font-size:80%}body.register #buddypress div.page ul{list-style:none}#buddypress .standard-form .field-visibility-settings label{margin:0;font-weight:400}#buddypress .field-visibility-settings legend,#buddypress .field-visibility-settings-toggle{font-style:italic}#buddypress .field-visibility-settings .radio{list-style:none;margin-bottom:0}#buddypress .field-visibility select{margin:0}#buddypress .wp-editor-container{border:1px solid #dedede}#buddypress .html-active button.switch-html{border-bottom-color:transparent;border-bottom-left-radius:0;border-bottom-right-radius:0;background:#f5f5f5;color:#707070}#buddypress .tmce-active button.switch-tmce{border-bottom-color:transparent;border-bottom-left-radius:0;border-bottom-right-radius:0;background:#f5f5f5;color:#707070}#buddypress .standard-form .wp-editor-container textarea{width:100%;padding-top:0;padding-bottom:0}.widget.buddypress span.activity{display:inline-block;font-size:small;padding:0}.widget.buddypress div.item-options{font-size:90%;margin:0 0 1em;padding:1em 0}.widget.buddypress div.item{margin:0 0 1em}.widget.buddypress div.item-content,.widget.buddypress div.item-meta{font-size:11px;margin-left:50px}.widget.buddypress div.avatar-block:after{clear:both;content:"";display:table}.widget.buddypress .item-avatar a{float:left;margin-bottom:15px;margin-right:10px}.widget.buddypress div.item-avatar img{display:inline-block;height:40px;margin:1px;width:40px}.widget.buddypress .item-avatar a,.widget.buddypress .item-avatar a img,.widget.buddypress .item-avatar a:active,.widget.buddypress .item-avatar a:focus,.widget.buddypress .item-avatar a:hover{box-shadow:none}.widget.buddypress #bp-login-widget-form label{display:block;margin:1rem 0 .5rem}.widget.buddypress #bp-login-widget-form #bp-login-widget-submit{margin-right:10px}.widget.buddypress .bp-login-widget-user-avatar{float:left}.bp-login-widget-user-avatar img.avatar{height:40px;width:40px}.widget.buddypress .bp-login-widget-user-links>div{padding-left:60px}.widget.buddypress .bp-login-widget-user-links>div{margin-bottom:.5rem}.widget.buddypress .bp-login-widget-user-links>div.bp-login-widget-user-link a{font-weight:700}.widget.buddypress #friends-list,.widget.buddypress #groups-list,.widget.buddypress #members-list{margin-left:0;padding-left:0}.widget.buddypress #friends-list li,.widget.buddypress #groups-list li,.widget.buddypress #members-list li{clear:both;list-style-type:none}.buddypress .bp-tooltip{position:relative}.bp-tooltip:after{background:#fff;border:1px solid #aaa;border-collapse:separate;border-radius:1px;box-shadow:1px 1px 0 1px rgba(132,132,132,.3);color:#000;content:attr(data-bp-tooltip);display:none;font-family:sans-serif;font-size:11px;font-weight:400;letter-spacing:normal;line-height:1.5;margin-top:10px;max-width:240px;opacity:0;padding:3px 6px;position:absolute;right:50%;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;top:100%;transform:translateX(50%);transition:opacity 2s ease-out;white-space:pre;word-wrap:break-word;z-index:998}.bp-tooltip:active:after,.bp-tooltip:focus:after,.bp-tooltip:hover:after{display:inline-block;opacity:1;overflow:visible;text-decoration:none;z-index:999}#group-admins .bp-tooltip:after,#group-mods .bp-tooltip:after,.message-metadata .bp-tooltip:after{right:0;text-align:right;transform:translateX(0)}.feed .bp-tooltip:after,.item-list .bp-tooltip:after,.messages-notices .bp-tooltip:after{left:0;right:auto;text-align:left;transform:translateX(0)}.admin-bar-on .bp-tooltip:after,.bp-site-wide-message .bp-tooltip:after{right:50px}@media only screen and (max-width:480px){#buddypress div.dir-search{float:right;margin-top:-50px;text-align:right}#buddypress div.dir-search input[type=text]{margin-bottom:1em;width:50%}a.bp-title-button{margin-left:10px}#buddypress form.standard-form .main-column div.action{position:relative;margin-bottom:1em}#buddypress form.standard-form .main-column ul#friend-list h3,#buddypress form.standard-form .main-column ul#friend-list h4{width:100%}}@media only screen and (max-width:320px){#buddypress div.dir-search{clear:left;float:left;margin-top:0;text-align:left}#buddypress li#groups-order-select{clear:left;float:left}#buddypress ul.item-list li div.action{clear:left;float:left;margin-top:0;margin-left:70px;position:relative;top:0;right:0;text-align:left}#buddypress ul.item-list li div.item-desc{clear:left;float:left;margin:10px 0 0;width:auto}#buddypress li div.item{margin-left:70px;width:auto}#buddypress ul.item-list li div.meta{margin-top:0}#buddypress .item-desc p{margin:0 0 10px}#buddypress div.pagination .pag-count{margin-left:0}}@media only screen and (max-width:240px){#buddypress div.dir-search{float:left;margin:0}#buddypress div.dir-search input[type=text]{width:50%}#buddypress li#groups-order-select{float:left}#buddypress ul.item-list li img.avatar{width:30px;height:auto}#buddypress li div.item,#buddypress ul.item-list li div.action{margin-left:45px}h1 a.bp-title-button{clear:left;float:left;margin:10px 0 20px}}
1
+ #buddypress div.pagination{background:0 0;border:none;color:#767676;font-size:small;margin:0;position:relative;display:block;float:left;width:100%;padding:10px 0}#buddypress div.pagination .pag-count{float:left;margin-left:10px}#buddypress div.pagination .pagination-links{float:right;margin-right:10px}#buddypress div.pagination .pagination-links a,#buddypress div.pagination .pagination-links span{font-size:90%;padding:0 5px}#buddypress div.pagination .pagination-links a:hover{font-weight:700}#buddypress noscript div.pagination{margin-bottom:15px}#buddypress #nav-above{display:none}#buddypress .paged #nav-above{display:block}#buddypress img.wp-smiley{border:none!important;clear:none!important;float:none!important;margin:0!important;padding:0!important}#buddypress .clear{clear:left}#buddypress #activity-stream{margin-top:-5px}#buddypress #activity-stream p{margin:5px 0}#buddypress #item-body form#whats-new-form{margin:0;padding:0}#buddypress .home-page form#whats-new-form{border-bottom:none;padding-bottom:0}#buddypress form#whats-new-form #whats-new-avatar{float:left}#buddypress form#whats-new-form #whats-new-content{margin-left:55px;padding:0 0 20px 20px}#buddypress form#whats-new-form p.activity-greeting{line-height:.5;margin-bottom:15px;margin-left:75px}#buddypress form#whats-new-form textarea{background:#fff;box-sizing:border-box;color:#555;font-family:inherit;font-size:medium;height:2.2em;line-height:1.4;padding:6px;width:100%}body.no-js #buddypress form#whats-new-form textarea{height:50px}#buddypress form#whats-new-form #whats-new-options select{max-width:200px;margin-top:12px}#buddypress form#whats-new-form #whats-new-submit{float:right;margin-top:12px}#buddypress #whats-new-options:after{clear:both;content:"";display:table}body.no-js #buddypress #whats-new-options{height:auto}#buddypress #whats-new:focus{border-color:rgba(31,179,221,.9)!important;outline-color:rgba(31,179,221,.9)}#buddypress ul.activity-list li{overflow:hidden;padding:15px 0 0;list-style:none}#buddypress .activity-list .activity-avatar{float:left}#buddypress ul.item-list.activity-list li.has-comments{padding-bottom:15px}body.activity-permalink #buddypress ul.activity-list li.has-comments{padding-bottom:0}#buddypress .activity-list li.mini{font-size:80%;position:relative}#buddypress .activity-list li.mini .activity-avatar img.FB_profile_pic,#buddypress .activity-list li.mini .activity-avatar img.avatar{height:20px;margin-left:30px;width:20px}#buddypress .activity-permalink .activity-list li.mini .activity-avatar img.FB_profile_pic,#buddypress .activity-permalink .activity-list li.mini .activity-avatar img.avatar{height:auto;margin-left:0;width:auto}body.activity-permalink #buddypress .activity-list>li:first-child{padding-top:0}#buddypress .activity-list li .activity-content{position:relative}#buddypress .activity-list li.mini .activity-content p{margin:0}#buddypress .activity-list li.mini .activity-comments{clear:both;font-size:120%}body.activity-permalink #buddypress li.mini .activity-meta{margin-top:4px}#buddypress .activity-list li .activity-inreplyto{color:#767676;font-size:80%}#buddypress .activity-list li .activity-inreplyto>p{margin:0;display:inline}#buddypress .activity-list li .activity-inreplyto blockquote,#buddypress .activity-list li .activity-inreplyto div.activity-inner{background:0 0;border:none;display:inline;margin:0;overflow:hidden;padding:0}#buddypress .activity-list .activity-content{margin:0 0 0 70px}body.activity-permalink #buddypress .activity-list li .activity-content{border:none;font-size:100%;line-height:1.5;margin-left:170px;margin-right:0;padding:0}body.activity-permalink #buddypress .activity-list li .activity-header>p{margin:0;padding:5px 0 0}#buddypress .activity-list .activity-content .activity-header,#buddypress .activity-list .activity-content .comment-header{color:#767676;line-height:2.2}#buddypress .activity-header{margin-right:20px}#buddypress .acomment-meta a,#buddypress .activity-header a,#buddypress .comment-meta a{text-decoration:none}#buddypress .activity-list .activity-content .activity-header img.avatar{float:none!important;margin:0 5px -8px 0!important}#buddypress a.bp-secondary-action,#buddypress span.highlight{font-size:80%;padding:0;margin-right:5px;text-decoration:none}#buddypress .activity-list .activity-content .activity-inner,#buddypress .activity-list .activity-content blockquote{margin:10px 10px 5px 0;overflow:hidden}#buddypress .activity-list li.new_forum_post .activity-content .activity-inner,#buddypress .activity-list li.new_forum_topic .activity-content .activity-inner{border-left:2px solid #eaeaea;margin-left:5px;padding-left:10px}body.activity-permalink #buddypress .activity-content .activity-inner,body.activity-permalink #buddypress .activity-content blockquote{margin-left:0;margin-top:5px}#buddypress .activity-inner>p{word-wrap:break-word}#buddypress .activity-inner>.activity-inner{margin:0}#buddypress .activity-inner>blockquote{margin:0}#buddypress .activity-list .activity-content img.thumbnail{border:2px solid #eee;float:left;margin:0 10px 5px 0}#buddypress .activity-read-more{margin-left:1em;white-space:nowrap}#buddypress .activity-list li.load-more,#buddypress .activity-list li.load-newest{background:#f0f0f0;font-size:110%;margin:15px 0;padding:10px 15px;text-align:center}#buddypress .activity-list li.load-more a,#buddypress .activity-list li.load-newest a{color:#4d4d4d}#buddypress div.activity-meta{margin:18px 0 0}body.activity-permalink #buddypress div.activity-meta{margin-bottom:6px}#buddypress div.activity-meta a{padding:4px 8px}#buddypress a.activity-time-since{color:#767676;text-decoration:none}#buddypress a.activity-time-since:hover{color:#767676;text-decoration:underline}#buddypress #reply-title small a,#buddypress a.bp-primary-action{font-size:80%;margin-right:5px;text-decoration:none}#buddypress #reply-title small a span,#buddypress a.bp-primary-action span{background:#767676;color:#fff;font-size:90%;margin-left:2px;padding:0 5px}#buddypress #reply-title small a:hover span,#buddypress a.bp-primary-action:hover span{background:#555;color:#fff}#buddypress div.activity-comments{margin:0 0 0 70px;overflow:hidden;position:relative;width:auto;clear:both}body.activity-permalink #buddypress div.activity-comments{background:0 0;margin-left:170px;width:auto}#buddypress div.activity-comments>ul{padding:0 0 0 10px}#buddypress div.activity-comments ul,#buddypress div.activity-comments ul li{border:none;list-style:none}#buddypress div.activity-comments ul{clear:both;margin:0}#buddypress div.activity-comments ul li{border-top:1px solid #eee;padding:10px 0 0}body.activity-permalink #buddypress .activity-list li.mini .activity-comments{clear:none;margin-top:0}body.activity-permalink #buddypress div.activity-comments ul li{border-width:1px;padding:10px 0 0}#buddypress div.activity-comments>ul>li:first-child{border-top:none}#buddypress div.activity-comments ul li:last-child{margin-bottom:0}#buddypress div.activity-comments ul li>ul{margin-left:30px;margin-top:0;padding-left:10px}body.activity-permalink #buddypress div.activity-comments ul li>ul{margin-top:10px}body.activity-permalink #buddypress div.activity-comments>ul{padding:0 10px 0 15px}#buddypress div.activity-comments div.acomment-avatar img{border-width:1px;float:left;height:25px;margin-right:10px;width:25px}#buddypress div.activity-comments div.acomment-content{font-size:80%;margin:5px 0 0 40px}#buddypress div.acomment-content .activity-delete-link,#buddypress div.acomment-content .comment-header,#buddypress div.acomment-content .time-since{display:none}body.activity-permalink #buddypress div.activity-comments div.acomment-content{font-size:90%}#buddypress div.activity-comments div.acomment-meta{color:#767676;font-size:80%}#buddypress div.activity-comments form.ac-form{display:none;padding:10px}#buddypress div.activity-comments li form.ac-form{margin-right:15px;clear:both}#buddypress div.activity-comments form.root{margin-left:0}#buddypress div.activity-comments div#message{margin-top:15px;margin-bottom:0}#buddypress div.activity-comments form .ac-textarea{background:#fff;border:1px inset #ccc;margin-bottom:10px;padding:8px}#buddypress div.activity-comments form textarea{border:none;background:0 0;box-shadow:none;outline:0;color:#555;font-family:inherit;font-size:100%;height:60px;padding:0;margin:0;width:100%}#buddypress div.activity-comments form input{margin-top:5px}#buddypress div.activity-comments form div.ac-reply-avatar{float:left}#buddypress div.ac-reply-avatar img{border:1px solid #eee}#buddypress div.activity-comments form div.ac-reply-content{color:#767676;margin-left:50px;padding-left:15px}#buddypress div.activity-comments form div.ac-reply-content a{text-decoration:none}#buddypress .acomment-options{float:left;margin:5px 0 5px 40px}#buddypress .acomment-options a{color:#767676}#buddypress .acomment-options a:hover{color:inherit}#buddypress div.dir-search{float:right;margin:-39px 0 0 0}#buddypress div.dir-search input[type=text],#buddypress li.groups-members-search input[type=text]{font-size:90%;padding:1px 3px}#buddypress .current-member-type{font-style:italic}#buddypress .dir-form{clear:both}#buddypress div#message{margin:0 0 15px}#buddypress #message.info{margin-bottom:0}#buddypress div#message.updated{clear:both;display:block}#buddypress div#message p,#sitewide-notice p,#sitewide-notice strong:first-child{font-size:90%;display:block;padding:10px 15px}#buddypress div#message.error p{background-color:#fdc;border:1px solid #a00;clear:left;color:#800}#buddypress div#message.warning p{background-color:#ffe0af;border:1px solid #ffd087;clear:left;color:#800}#buddypress div#message.updated p{background-color:#efc;border:1px solid #591;color:#250}#buddypress #pass-strength-result{background-color:#eee;border-color:#ddd;border-style:solid;border-width:1px;display:none;margin:5px 5px 5px 0;padding:5px;text-align:center;width:150px}#buddypress .standard-form #basic-details-section #pass-strength-result{width:35%}#buddypress #pass-strength-result.bad,#buddypress #pass-strength-result.error{background-color:#ffb78c;border-color:#ff853c!important;display:block}#buddypress #pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important;display:block}#buddypress #pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important;display:block}#buddypress #pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important;display:block}#buddypress .standard-form#signup_form div div.error{background:#faa;color:#a00;margin:0 0 10px;padding:6px;width:90%}#buddypress div.accept,#buddypress div.reject{float:left;margin-left:10px}#buddypress ul.button-nav li{float:left;margin:0 10px 10px 0;list-style:none}#buddypress ul.button-nav li.current a{font-weight:700}#sitewide-notice #message{left:2%;position:fixed;top:1em;width:96%;z-index:9999}#sitewide-notice.admin-bar-on #message{top:3.3em}#sitewide-notice strong{display:block;margin-bottom:-1em}body.create-blog #buddypress .error{background-color:#fdc;border:1px solid #a00;color:#800;padding:10px 15px}body.create-blog #buddypress .success{background-color:#efc;border:1px solid #591;color:#250;padding:10px 15px}#buddypress form fieldset{border:0;padding:0}#buddypress .dir-search input[type=search],#buddypress .dir-search input[type=text],#buddypress .groups-members-search input[type=search],#buddypress .groups-members-search input[type=text],#buddypress .standard-form input[type=color],#buddypress .standard-form input[type=date],#buddypress .standard-form input[type=datetime-local],#buddypress .standard-form input[type=datetime],#buddypress .standard-form input[type=email],#buddypress .standard-form input[type=month],#buddypress .standard-form input[type=number],#buddypress .standard-form input[type=password],#buddypress .standard-form input[type=range],#buddypress .standard-form input[type=search],#buddypress .standard-form input[type=tel],#buddypress .standard-form input[type=text],#buddypress .standard-form input[type=time],#buddypress .standard-form input[type=url],#buddypress .standard-form input[type=week],#buddypress .standard-form select,#buddypress .standard-form textarea{border:1px solid #ccc;background:#fafafa;border-radius:0;color:#737373;font:inherit;font-size:100%;padding:6px}#buddypress .standard-form select{padding:3px}#buddypress .standard-form input[type=password]{margin-bottom:5px}#buddypress .standard-form label,#buddypress .standard-form legend,#buddypress .standard-form span.label{display:block;font-weight:700;margin:15px 0 5px;width:auto}#buddypress label.xprofile-field-label{display:inline}#buddypress .standard-form #invite-list label,#buddypress .standard-form p label{font-weight:400;margin:auto}#buddypress .standard-form .checkbox label,#buddypress .standard-form .radio label{color:#767676;font-size:100%;font-weight:400;margin:5px 0 0}#buddypress .standard-form .checkbox label input,#buddypress .standard-form .radio label input{margin-right:3px}#buddypress .standard-form#sidebar-login-form label{margin-top:5px}#buddypress .standard-form input[type=text]{width:75%}#buddypress .standard-form#sidebar-login-form input[type=password],#buddypress .standard-form#sidebar-login-form input[type=text]{padding:4px;width:95%}#buddypress .standard-form #basic-details-section input[type=password],#buddypress .standard-form #blog-details-section input#signup_blog_url{width:35%}#buddypress #commentform input[type=text],#buddypress #commentform textarea,#buddypress .form-allowed-tags,#buddypress .standard-form#signup_form input[type=text],#buddypress .standard-form#signup_form textarea{width:90%}#buddypress .standard-form#signup_form div.submit{float:right}#buddypress div#signup-avatar img{margin:0 15px 10px 0}#buddypress .standard-form textarea{width:75%;height:120px}#buddypress .standard-form textarea#message_content{height:200px}#buddypress .standard-form#send-reply textarea{width:97.5%}#buddypress .standard-form p.description{color:#767676;font-size:80%;margin:5px 0}#buddypress .standard-form div.submit{clear:both;padding:15px 0 0}#buddypress .standard-form p.submit{margin-bottom:0;padding:15px 0 0}#buddypress .standard-form div.submit input{margin-right:15px}#buddypress .standard-form div.radio ul{margin:10px 0 15px 38px;list-style:disc}#buddypress .standard-form div.radio ul li{margin-bottom:5px}#buddypress .standard-form a.clear-value{display:block;margin-top:5px;outline:0}#buddypress .standard-form #basic-details-section,#buddypress .standard-form #blog-details-section,#buddypress .standard-form #profile-details-section{float:left;width:48%}#buddypress .standard-form #profile-details-section{float:right}#buddypress #notifications-bulk-management,#buddypress .standard-form #blog-details-section{clear:left}body.no-js #buddypress #delete_inbox_messages,body.no-js #buddypress #delete_sentbox_messages,body.no-js #buddypress #message-type-select,body.no-js #buddypress #messages-bulk-management #select-all-messages,body.no-js #buddypress #notifications-bulk-management #select-all-notifications,body.no-js #buddypress label[for=message-type-select]{display:none}#buddypress .standard-form input:focus,#buddypress .standard-form select:focus,#buddypress .standard-form textarea:focus{background:#fafafa;color:#555}#buddypress form#send-invite-form{margin-top:20px}#buddypress div#invite-list{background:#f5f5f5;height:400px;margin:0 0 10px;overflow:auto;padding:5px;width:160px}#buddypress .comment-reply-link,#buddypress .generic-button a,#buddypress .standard-form button,#buddypress a.button,#buddypress input[type=button],#buddypress input[type=reset],#buddypress input[type=submit],#buddypress ul.button-nav li a,a.bp-title-button{background:#fff;border:1px solid #ccc;color:#767676;font-size:small;cursor:pointer;outline:0;padding:4px 10px;text-align:center;text-decoration:none}#buddypress .comment-reply-link:hover,#buddypress .standard-form button:hover,#buddypress a.button:focus,#buddypress a.button:hover,#buddypress div.generic-button a:hover,#buddypress input[type=button]:hover,#buddypress input[type=reset]:hover,#buddypress input[type=submit]:hover,#buddypress ul.button-nav li a:hover,#buddypress ul.button-nav li.current a{background:#ededed;border:1px solid #bbb;color:#555;outline:0;text-decoration:none}#buddypress form.standard-form .left-menu{float:left}#buddypress form.standard-form .left-menu #invite-list ul{margin:1%;list-style:none}#buddypress form.standard-form .left-menu #invite-list ul li{margin:0 0 0 1%}#buddypress form.standard-form .main-column{margin-left:190px}#buddypress form.standard-form .main-column ul#friend-list{clear:none;float:left}#buddypress form.standard-form .main-column ul#friend-list h3,#buddypress form.standard-form .main-column ul#friend-list h4{clear:none}#buddypress .wp-editor-wrap a.button,#buddypress .wp-editor-wrap button,#buddypress .wp-editor-wrap input[type=button],#buddypress .wp-editor-wrap input[type=reset],#buddypress .wp-editor-wrap input[type=submit]{padding:0 8px 1px}#buddypress form [disabled=disabled]{cursor:default;opacity:.4}fieldset.register-site{margin-top:1em}fieldset.create-site{margin-bottom:2em}fieldset.create-site legend{margin-bottom:1em}fieldset.create-site label{margin-right:3em}.bp-screen-reader-text{clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;position:absolute!important;width:1px;word-wrap:normal!important}.bp-screen-reader-text:focus{background-color:#f1f1f1;border-radius:3px;box-shadow:0 0 2px 2px rgba(0,0,0,.6);clip:auto!important;color:#21759b;display:block;font-size:14px;font-size:.875rem;font-weight:700;height:auto;left:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}#buddypress a.loading,#buddypress input.loading{-webkit-animation:loader-pulsate .5s infinite ease-in-out alternate;-moz-animation:loader-pulsate .5s infinite ease-in-out alternate;border-color:#aaa}#buddypress a.loading:hover,#buddypress input.loading:hover{color:#767676}#buddypress a.disabled,#buddypress button.disabled,#buddypress button.pending,#buddypress div.pending a,#buddypress input[type=button].disabled,#buddypress input[type=button].pending,#buddypress input[type=reset].disabled,#buddypress input[type=reset].pending,#buddypress input[type=submit].disabled,#buddypress input[type=submit].pending,#buddypress input[type=submit][disabled=disabled]{border-color:#eee;color:#bbb;cursor:default}#buddypress a.disabled:hover,#buddypress button.disabled:hover,#buddypress button.pending:hover,#buddypress div.pending a:hover,#buddypress input[type=button]:hover.disabled,#buddypress input[type=button]:hover.pending,#buddypress input[type=reset]:hover.disabled,#buddypress input[type=reset]:hover.pending,#buddypress input[type=submit]:hover.disabled,#buddypress input[type=submit]:hover.pending{border-color:#eee;color:#bbb}#buddypress ul#topic-post-list{margin:0;width:auto}#buddypress ul#topic-post-list li{padding:15px;position:relative}#buddypress ul#topic-post-list li.alt{background:#f5f5f5}#buddypress ul#topic-post-list li div.poster-meta{color:#767676;margin-bottom:10px}#buddypress ul#topic-post-list li div.post-content{margin-left:54px}#buddypress div.topic-tags{font-size:80%}#buddypress div.admin-links{color:#767676;font-size:80%;position:absolute;top:15px;right:25px}#buddypress div#topic-meta{margin:0;padding:5px 19px 30px;position:relative}#buddypress div#topic-meta div.admin-links{right:19px;top:-36px}#buddypress div#topic-meta h3{margin:5px 0}#buddypress div#new-topic-post{display:none;margin:20px 0 0;padding:1px 0 0}#buddypress table.forum,#buddypress table.messages-notices,#buddypress table.notifications,#buddypress table.notifications-settings,#buddypress table.profile-fields,#buddypress table.profile-settings,#buddypress table.wp-profile-fields{width:100%}#buddypress table.forum thead tr,#buddypress table.messages-notices thead tr,#buddypress table.notifications thead tr,#buddypress table.notifications-settings thead tr,#buddypress table.profile-fields thead tr,#buddypress table.profile-settings thead tr,#buddypress table.wp-profile-fields thead tr{background:#eaeaea}#buddypress table#message-threads{clear:both}#buddypress table.profile-fields{margin-bottom:20px}#buddypress table.profile-fields:last-child{margin-bottom:0}#buddypress table.profile-fields p{margin:0}#buddypress table.profile-fields p:last-child{margin-top:0}#buddypress table.forum tr td,#buddypress table.forum tr th,#buddypress table.messages-notices tr td,#buddypress table.messages-notices tr th,#buddypress table.notifications tr td,#buddypress table.notifications tr th,#buddypress table.notifications-settings tr td,#buddypress table.notifications-settings tr th,#buddypress table.profile-fields tr td,#buddypress table.profile-fields tr th,#buddypress table.profile-settings tr td,#buddypress table.wp-profile-fields tr td,#buddypress table.wp-profile-fields tr th{padding:8px;vertical-align:middle}#buddypress table.forum tr td.label,#buddypress table.messages-notices tr td.label,#buddypress table.notifications tr td.label,#buddypress table.notifications-settings tr td.label,#buddypress table.profile-fields tr td.label,#buddypress table.wp-profile-fields tr td.label{border-right:1px solid #eaeaea;font-weight:700;width:25%}#buddypress #message-threads .thread-info{min-width:40%}#buddypress table tr td.thread-info p{margin:0}#buddypress table tr td.thread-info p.thread-excerpt{color:#767676;font-size:80%;margin-top:3px}#buddypress table.forum td{text-align:center}#buddypress table.forum tr.alt td,#buddypress table.messages-notices tr.alt td,#buddypress table.notifications tr.alt td,#buddypress table.notifications-settings tr.alt td,#buddypress table.profile-fields tr.alt td,#buddypress table.profile-settings tr.alt td,#buddypress table.wp-profile-fields tr.alt td{background:#f5f5f5;color:#707070}#buddypress table.notification-settings{margin-bottom:20px;text-align:left}#buddypress #groups-notification-settings{margin-bottom:0}#buddypress table.notification-settings td:first-child,#buddypress table.notification-settings th.icon,#buddypress table.notifications td:first-child,#buddypress table.notifications th.icon{display:none}#buddypress table.notification-settings th.title,#buddypress table.profile-settings th.title{width:80%}#buddypress table.notification-settings .no,#buddypress table.notification-settings .yes{text-align:center;width:40px}#buddypress table.forum{margin:0;width:auto;clear:both}#buddypress table.forum tr.sticky td{font-size:110%;background:#fff9db;border-top:1px solid #ffe8c4;border-bottom:1px solid #ffe8c4}#buddypress table.forum tr.closed td.td-title{padding-left:35px}#buddypress table.forum td p.topic-text{color:#767676;font-size:100%}#buddypress table.forum tr>td:first-child,#buddypress table.forum tr>th:first-child{padding-left:15px}#buddypress table.forum tr>td:last-child,#buddypress table.forum tr>th:last-child{padding-right:15px}#buddypress table.forum td.td-group,#buddypress table.forum td.td-poster,#buddypress table.forum td.td-title,#buddypress table.forum tr th#th-group,#buddypress table.forum tr th#th-poster,#buddypress table.forum tr th#th-title{text-align:left}#buddypress table.forum tr td.td-title a.topic-title{font-size:110%}#buddypress table.forum td.td-freshness{white-space:nowrap}#buddypress table.forum td.td-freshness span.time-since{font-size:80%;color:#767676}#buddypress table.forum td img.avatar{float:none;margin:0 5px -8px 0}#buddypress table.forum td.td-group,#buddypress table.forum td.td-poster{min-width:140px}#buddypress table.forum th#th-title{width:80%}#buddypress table.forum th#th-freshness{width:25%}#buddypress table.forum th#th-postcount{width:15%}#buddypress table.forum p.topic-meta{font-size:80%;margin:5px 0 0}#buddypress .item-body{margin:20px 0}#buddypress span.activity{display:inline-block;font-size:small;padding:0}#buddypress span.user-nicename{color:#767676;display:inline-block;font-size:120%;font-weight:700}#sitewide-notice,.bp-site-wide-message{position:relative}#buddypress div#message p,#sitewide-notice #message{background-color:#ffd;border:1px solid #cb2;color:#440;font-weight:400;margin-top:3px;text-decoration:none}.admin-bar-on #message p,.bp-site-wide-message #message p{padding-right:25px}.admin-bar-on #message a.button,.admin-bar-on #message button,.bp-site-wide-message #message a.button,.bp-site-wide-message #message button{font-size:.8em;padding:2px 4px;position:absolute;right:0;top:0}.admin-bar-on #message a.button,.admin-bar-on #message button{right:10px;top:7px}#buddypress #item-header:after{clear:both;content:"";display:table}#buddypress div#item-header div#item-header-content{float:left;margin-left:0}#buddypress div#item-header h2{line-height:1.2;margin:0 0 15px}#buddypress div#item-header h2 a{color:#767676;text-decoration:none}#buddypress div#item-header img.avatar{float:left;margin:0 15px 19px 0}#buddypress div#item-header h2{margin-bottom:5px}#buddypress div#item-header h2 span.highlight{font-size:60%;font-weight:400;line-height:1.7;vertical-align:middle;display:inline-block}#buddypress div#item-header h2 span.highlight span{background:#a1dcfa;color:#fff;cursor:pointer;font-weight:700;font-size:80%;margin-bottom:2px;padding:1px 4px;position:relative;right:-2px;top:-2px;vertical-align:middle}#buddypress div#item-header div#item-meta{font-size:80%;color:#767676;overflow:hidden;margin:15px 0 5px;padding-bottom:10px}#buddypress div#item-header div#item-actions{float:right;margin:0 0 15px 15px;text-align:right;width:20%}#buddypress div#item-header div#item-actions h2,#buddypress div#item-header div#item-actions h3{margin:0 0 5px}#buddypress div#item-header div#item-actions a{display:inline-block}#buddypress div#item-header ul{margin-bottom:15px}#buddypress div#item-header ul:after{clear:both;content:"";display:table}#buddypress div#item-header ul h5,#buddypress div#item-header ul hr,#buddypress div#item-header ul span{display:none}#buddypress div#item-header ul li{float:right;list-style:none}#buddypress div#item-header ul img.avatar,#buddypress div#item-header ul.avatars img.avatar{height:30px;margin:2px;width:30px}#buddypress div#item-header a.button,#buddypress div#item-header div.generic-button{float:left;margin:10px 10px 0 0}body.no-js #buddypress div#item-header .js-self-profile-button{display:none}#buddypress div#item-header div#message.info{line-height:.8}#buddypress ul.item-list{border-top:1px solid #eaeaea;width:100%;list-style:none;clear:both;margin:0;padding:0}body.activity-permalink #buddypress ul.item-list,body.activity-permalink #buddypress ul.item-list li.activity-item{border:none}#buddypress ul.item-list li{border-bottom:1px solid #eaeaea;padding:15px 0;margin:0;position:relative;list-style:none}#buddypress ul.single-line li{border:none}#buddypress ul.item-list li img.avatar{float:left;margin:0 10px 0 0}#buddypress ul.item-list li div.item-title,#buddypress ul.item-list li h3,#buddypress ul.item-list li h4{font-weight:400;font-size:90%;margin:0;width:75%}#buddypress ul.item-list li div.item-title span{color:#767676;font-size:80%}#buddypress ul.item-list li div.item-desc{color:#767676;font-size:80%;margin:10px 0 0 60px;width:50%}#buddypress ul.item-list li.group-no-avatar div.item-desc{margin-left:0}#buddypress ul.item-list li div.action{position:absolute;top:15px;right:0;text-align:right}#buddypress ul.item-list li div.meta{color:#767676;font-size:80%;margin-top:10px}#buddypress ul.item-list li h5 span.small{float:right;font-size:80%;font-weight:400}#buddypress div.item-list-tabs{background:0 0;clear:left;overflow:hidden}#buddypress div.item-list-tabs ul{margin:0;padding:0}#buddypress div.item-list-tabs ul li{float:left;margin:0;list-style:none}#buddypress div.item-list-tabs#subnav ul li{margin-top:0}#buddypress div.item-list-tabs ul li.last{float:right;margin:7px 0 0}#buddypress div.item-list-tabs#subnav ul li.last{margin-top:4px}#buddypress div.item-list-tabs ul li.last select{max-width:185px}#buddypress div.item-list-tabs ul li a,#buddypress div.item-list-tabs ul li span{display:block;padding:5px 10px;text-decoration:none}#buddypress div.item-list-tabs ul li a span{background:#eee;border-radius:50%;border:1px solid #ccc;color:#6c6c6c;display:inline;font-size:70%;margin-left:2px;padding:3px 6px;text-align:center;vertical-align:middle}#buddypress div.item-list-tabs ul li.current a,#buddypress div.item-list-tabs ul li.selected a{background-color:#eee;color:#555;opacity:.9;font-weight:700}#buddypress div.item-list-tabs ul li a:hover span,#buddypress div.item-list-tabs ul li.current a span,#buddypress div.item-list-tabs ul li.selected a span{background-color:#eee}#buddypress div.item-list-tabs ul li.current a span,#buddypress div.item-list-tabs ul li.selected a span{background-color:#fff}#buddypress div#item-nav ul li.loading a{background-position:88% 50%}#buddypress div.item-list-tabs#object-nav{margin-top:0}#buddypress div.item-list-tabs#subnav{background:0 0;margin:10px 0;overflow:hidden}#buddypress #admins-list li,#buddypress #members-list li,#buddypress #mods-list li{overflow:auto;list-style:none}#buddypress .group-members-list{width:100%;margin-top:1em;clear:both;overflow:auto}#buddypress #item-buttons:empty{display:none}#buddypress #cover-image-container{position:relative;z-index:0}#buddypress #header-cover-image{background-color:#c5c5c5;background-position:center top;background-repeat:no-repeat;background-size:cover;border:0;display:block;left:0;margin:0;padding:0;position:absolute;top:0;width:100%;z-index:1}#buddypress #item-header-cover-image{padding:0 1em;position:relative;z-index:2}#buddypress table#message-threads tr.unread td{background:#fff9db;border-top:1px solid #ffe8c4;border-bottom:1px solid #ffe8c4;font-weight:700}#buddypress table#message-threads tr.unread td .activity,#buddypress table#message-threads tr.unread td .thread-excerpt,#buddypress table#message-threads tr.unread td.thread-options{font-weight:400}#buddypress li span.unread-count,#buddypress tr.unread span.unread-count{background:#d00;color:#fff;font-weight:700;padding:2px 8px}#buddypress div.item-list-tabs ul li a span.unread-count{padding:1px 6px;color:#fff}#buddypress div#message-thread div.message-box{margin:0;padding:15px}#buddypress div#message-thread div.alt{background:#f4f4f4}#buddypress div#message-thread p#message-recipients{margin:10px 0 20px}#buddypress div#message-thread img.avatar{float:left;margin:0 10px 0 0;vertical-align:middle}#buddypress div#message-thread strong{font-size:100%;margin:0}#buddypress div#message-thread strong a{text-decoration:none}#buddypress div#message-thread strong span.activity{margin-top:4px}#buddypress div#message-thread div.message-metadata:after{clear:both;content:"";display:table}#buddypress div#message-thread div.message-content{margin-left:45px}#buddypress div#message-thread div.message-options{text-align:right}#buddypress #message-threads img.avatar{max-width:none}#buddypress div.message-search{float:right;margin:0 20px}.message-metadata{position:relative}.message-star-actions{position:absolute;right:0;top:0}#buddypress a.message-action-star,#buddypress a.message-action-unstar{border-bottom:0;text-decoration:none;outline:0}a.message-action-star{opacity:.7}a.message-action-star:hover{opacity:1}.message-action-star span.icon:before,.message-action-unstar span.icon:before{font-family:dashicons;font-size:18px}.message-action-star span.icon:before{color:#767676;content:"\f154"}.message-action-unstar span.icon:before{color:#fcdd77;content:"\f155"}#buddypress div.profile h2{margin-bottom:auto;margin-top:15px}#buddypress #profile-edit-form ul.button-nav{margin-top:15px}body.no-js #buddypress .field-visibility-settings-close,body.no-js #buddypress .field-visibility-settings-toggle{display:none}#buddypress .field-visibility-settings{display:none;margin-top:10px}body.no-js #buddypress .field-visibility-settings{display:block}#buddypress .current-visibility-level{font-weight:700;font-style:normal}#buddypress .field-visibility-settings,#buddypress .field-visibility-settings-notoggle,#buddypress .field-visibility-settings-toggle{color:#707070}#buddypress .field-visibility-settings a,#buddypress .field-visibility-settings-toggle a{font-size:80%}body.register #buddypress div.page ul{list-style:none}#buddypress .standard-form .field-visibility-settings label{margin:0;font-weight:400}#buddypress .field-visibility-settings legend,#buddypress .field-visibility-settings-toggle{font-style:italic}#buddypress .field-visibility-settings .radio{list-style:none;margin-bottom:0}#buddypress .field-visibility select{margin:0}#buddypress .wp-editor-container{border:1px solid #dedede}#buddypress .html-active button.switch-html{border-bottom-color:transparent;border-bottom-left-radius:0;border-bottom-right-radius:0;background:#f5f5f5;color:#707070}#buddypress .tmce-active button.switch-tmce{border-bottom-color:transparent;border-bottom-left-radius:0;border-bottom-right-radius:0;background:#f5f5f5;color:#707070}#buddypress .standard-form .wp-editor-container textarea{width:100%;padding-top:0;padding-bottom:0}.widget.buddypress span.activity{display:inline-block;font-size:small;padding:0}.widget.buddypress div.item-options{font-size:90%;margin:0 0 1em;padding:1em 0}.widget.buddypress div.item{margin:0 0 1em}.widget.buddypress div.item-content,.widget.buddypress div.item-meta{font-size:11px;margin-left:50px}.widget.buddypress div.avatar-block:after{clear:both;content:"";display:table}.widget.buddypress .item-avatar a{float:left;margin-bottom:15px;margin-right:10px}.widget.buddypress div.item-avatar img{display:inline-block;height:40px;margin:1px;width:40px}.widget.buddypress .item-avatar a,.widget.buddypress .item-avatar a img,.widget.buddypress .item-avatar a:active,.widget.buddypress .item-avatar a:focus,.widget.buddypress .item-avatar a:hover{box-shadow:none}.widget.buddypress #bp-login-widget-form label{display:block;margin:1rem 0 .5rem}.widget.buddypress #bp-login-widget-form #bp-login-widget-submit{margin-right:10px}.widget.buddypress .bp-login-widget-user-avatar{float:left}.bp-login-widget-user-avatar img.avatar{height:40px;width:40px}.widget.buddypress .bp-login-widget-user-links>div{padding-left:60px}.widget.buddypress .bp-login-widget-user-links>div{margin-bottom:.5rem}.widget.buddypress .bp-login-widget-user-links>div.bp-login-widget-user-link a{font-weight:700}.widget.buddypress #friends-list,.wid