Version Description
= 8.0.0 = See: https://codex.buddypress.org/releases/version-8-0-0/
= 7.3.0 = See: https://codex.buddypress.org/releases/version-7-3-0/
= 7.2.1 = See: https://codex.buddypress.org/releases/version-7-2-1/
= 7.2.0 = See: https://codex.buddypress.org/releases/version-7-2-0/
= 7.1.0 = See: https://codex.buddypress.org/releases/version-7-1-0/
= 7.0.0 = See: https://codex.buddypress.org/releases/version-7-0-0/
= 6.4.0 = See: https://codex.buddypress.org/releases/version-6-4-0/
= 6.3.0 = See: https://codex.buddypress.org/releases/version-6-3-0/
= 6.2.0 = See: https://codex.buddypress.org/releases/version-6-2-0/
= 6.1.0 = See: https://codex.buddypress.org/releases/version-6-1-0/
= 6.0.0 = See: https://codex.buddypress.org/releases/version-6-0-0/
= 5.2.0 = See: https://codex.buddypress.org/releases/version-5-2-0/
= 5.1.2 = See: https://codex.buddypress.org/releases/version-5-1-2/
= 5.1.1 = See: https://codex.buddypress.org/releases/version-5-1-1/
= 5.1.0 = See: https://codex.buddypress.org/releases/version-5-1-0/
= 5.0.0 = See: https://codex.buddypress.org/releases/version-5-0-0/
= 4.4.0 = See: https://codex.buddypress.org/releases/version-4-4-0/
= 4.3.0 = See: https://codex.buddypress.org/releases/version-4-3-0/
= 4.2.0 = See: https://codex.buddypress.org/releases/version-4-2-0/
= 4.1.0 = See: https://codex.buddypress.org/releases/version-4-1-0/
= 4.0.0 = See: https://codex.buddypress.org/releases/version-4-0-0/
Release Info
Developer | imath |
Plugin | BuddyPress |
Version | 9.0.0-RC1 |
Comparing to | |
See all releases |
Code changes from version 8.0.0 to 9.0.0-RC1
- bp-activity/bp-activity-blocks.php +133 -11
- bp-activity/bp-activity-functions.php +46 -0
- bp-activity/classes/class-bp-activity-component.php +59 -15
- bp-activity/classes/class-bp-rest-activity-endpoint.php +100 -98
- bp-activity/css/blocks/latest-activities-rtl.css +81 -0
- bp-activity/css/blocks/latest-activities-rtl.min.css +1 -0
- bp-activity/css/blocks/latest-activities.css +81 -0
- bp-activity/css/blocks/latest-activities.min.css +1 -0
- bp-activity/js/blocks/embed-activity.js +10 -10
- bp-activity/js/blocks/embed-activity.js.map +1 -1
- bp-activity/js/blocks/latest-activities.js +8 -0
- bp-activity/js/blocks/latest-activities.js.map +1 -0
- bp-activity/sass/blocks/latest-activities.scss +100 -0
- bp-blogs/bp-blogs-blocks.php +137 -0
- bp-blogs/classes/class-bp-blogs-component.php +53 -0
- bp-blogs/classes/class-bp-blogs-recent-posts-widget.php +6 -0
- bp-blogs/classes/class-bp-rest-attachments-blog-avatar-endpoint.php +6 -6
- bp-blogs/classes/class-bp-rest-blogs-endpoint.php +71 -30
- bp-blogs/css/blocks/recent-posts-rtl.css +42 -0
- bp-blogs/css/blocks/recent-posts-rtl.min.css +1 -0
- bp-blogs/css/blocks/recent-posts.css +42 -0
- bp-blogs/css/blocks/recent-posts.min.css +1 -0
- bp-blogs/js/blocks/recent-posts.js +8 -0
- bp-blogs/js/blocks/recent-posts.js.map +1 -0
- bp-blogs/sass/blocks/recent-posts.scss +46 -0
- bp-core/admin/bp-core-admin-slugs.php +2 -2
- bp-core/admin/css/common-rtl.css +10 -2
- bp-core/admin/css/common-rtl.min.css +1 -1
- bp-core/admin/css/common.css +10 -2
- bp-core/admin/css/common.min.css +1 -1
- bp-core/admin/css/hello-rtl.css +0 -1
- bp-core/admin/css/hello-rtl.min.css +1 -1
- bp-core/admin/css/hello.css +0 -1
- bp-core/admin/css/hello.min.css +1 -1
- bp-core/bp-core-blocks.php +305 -1
- bp-core/bp-core-cssjs.php +3 -0
- bp-core/bp-core-rest-api.php +13 -9
- bp-core/bp-core-template-loader.php +57 -0
- bp-core/bp-core-template.php +51 -0
- bp-core/classes/class-bp-admin.php +43 -115
- bp-core/classes/class-bp-block.php +23 -1
- bp-core/classes/class-bp-button.php +11 -0
- bp-core/classes/class-bp-component.php +115 -77
- bp-core/classes/class-bp-core-login-widget.php +2 -0
- bp-core/classes/class-bp-core.php +63 -7
- bp-core/classes/class-bp-rest-components-endpoint.php +121 -19
- bp-core/classes/class-bp-theme-compat.php +12 -0
- bp-core/css/blocks/login-form-rtl.css +36 -0
- bp-core/css/blocks/login-form-rtl.min.css +1 -0
- bp-core/css/blocks/login-form.css +36 -0
- bp-core/css/blocks/login-form.min.css +1 -0
- bp-core/deprecated/9.0.php +24 -0
- bp-core/images/bp-members-invitations-invite-screen.png +0 -0
- bp-core/images/bp-members-invitations-manage-admin-screen.png +0 -0
- bp-core/images/bp-widget-blocks.jpg +0 -0
- bp-core/images/bp-xprofile-admin-signup-fields.png +0 -0
- bp-core/images/bp-xprofile-checkbox-acceptance-field-type.png +0 -0
- bp-core/images/bp-xprofile-wp-field-type.png +0 -0
- bp-core/images/latest-activities.jpg +0 -0
- bp-core/images/legacy-widget-to-block.jpg +0 -0
- bp-core/js/block-components.js +13 -11
- bp-core/js/block-components.js.map +1 -1
- bp-core/js/block-data.js +42 -0
- bp-core/js/block-data.js.map +1 -0
- bp-core/js/blocks/login-form.js +8 -0
- bp-core/js/blocks/login-form.js.map +1 -0
- bp-core/js/blocks/primary-nav.js +8 -0
- bp-core/js/blocks/primary-nav.js.map +1 -0
- bp-core/js/dynamic-widget-block.js +4 -0
- bp-core/js/dynamic-widget-block.js.map +1 -0
- bp-core/sass/blocks/login-form.scss +43 -0
- bp-friends/bp-friends-blocks.php +266 -0
- bp-friends/bp-friends-cssjs.php +35 -0
- bp-friends/classes/class-bp-core-friends-widget.php +4 -2
- bp-friends/classes/class-bp-friends-component.php +58 -1
- bp-friends/classes/class-bp-rest-friends-endpoint.php +3 -3
- bp-friends/css/blocks/friends-rtl.css +36 -0
- bp-friends/css/blocks/friends-rtl.min.css +1 -0
- bp-friends/css/blocks/friends.css +36 -0
- bp-friends/css/blocks/friends.min.css +1 -0
- bp-friends/js/blocks/friends.js +10 -0
- bp-friends/js/blocks/friends.js.map +1 -0
- bp-friends/js/friends.js +4 -0
- bp-friends/js/friends.js.map +1 -0
- bp-friends/sass/blocks/friends.scss +40 -0
- bp-groups/bp-groups-blocks.php +230 -25
- bp-groups/bp-groups-cssjs.php +22 -0
- bp-groups/bp-groups-functions.php +2 -2
- bp-groups/classes/class-bp-groups-component.php +41 -5
- bp-groups/classes/class-bp-groups-widget.php +3 -1
- bp-groups/classes/class-bp-rest-attachments-group-avatar-endpoint.php +3 -3
- bp-groups/classes/class-bp-rest-attachments-group-cover-endpoint.php +1 -1
- bp-groups/classes/class-bp-rest-group-invites-endpoint.php +28 -28
- bp-groups/classes/class-bp-rest-group-membership-endpoint.php +31 -31
- bp-groups/classes/class-bp-rest-group-membership-request-endpoint.php +26 -22
- bp-groups/classes/class-bp-rest-groups-endpoint.php +62 -52
- bp-groups/css/blocks/dynamic-groups-rtl.css +36 -0
- bp-groups/css/blocks/dynamic-groups-rtl.min.css +1 -0
- bp-groups/css/blocks/dynamic-groups.css +36 -0
- bp-groups/css/blocks/dynamic-groups.min.css +1 -0
- bp-groups/css/blocks/groups-rtl.css +0 -1
- bp-groups/css/blocks/groups-rtl.min.css +1 -1
- bp-groups/css/blocks/groups.css +0 -1
- bp-groups/css/blocks/groups.min.css +1 -1
- bp-groups/js/blocks/dynamic-groups.js +10 -0
- bp-groups/js/blocks/dynamic-groups.js.map +1 -0
- bp-groups/js/blocks/group.js +2 -2
- bp-groups/js/blocks/group.js.map +1 -1
- bp-groups/js/blocks/groups.js +12 -12
- bp-groups/js/blocks/groups.js.map +1 -1
- bp-groups/js/dynamic-groups.js +4 -0
- bp-groups/js/dynamic-groups.js.map +1 -0
- bp-groups/sass/blocks/dynamic-groups.scss +40 -0
- bp-loader.php +1 -1
- bp-members/admin/js/admin.js +7 -8
- bp-members/admin/js/admin.min.js +1 -1
- bp-members/bp-members-blocks.php +392 -25
- bp-members/bp-members-cssjs.php +35 -0
- bp-members/classes/class-bp-core-members-widget.php +3 -1
- bp-members/classes/class-bp-core-recently-active-widget.php +2 -0
- bp-members/classes/class-bp-core-whos-online-widget.php +3 -0
- bp-members/classes/class-bp-members-component.php +102 -10
- bp-members/classes/class-bp-rest-attachments-member-avatar-endpoint.php +5 -5
- bp-members/classes/class-bp-rest-attachments-member-cover-endpoint.php +2 -2
- bp-members/classes/class-bp-rest-members-endpoint.php +78 -37
- bp-members/classes/class-bp-rest-signup-endpoint.php +14 -15
- bp-members/css/blocks/active-members.css +8 -0
- bp-members/css/blocks/active-members.min.css +1 -0
- bp-members/css/blocks/dynamic-members-rtl.css +36 -0
- bp-members/css/blocks/dynamic-members-rtl.min.css +1 -0
- bp-members/css/blocks/dynamic-members.css +36 -0
- bp-members/css/blocks/dynamic-members.min.css +1 -0
- bp-members/css/blocks/members-rtl.css +0 -1
- bp-members/css/blocks/members-rtl.min.css +1 -1
- bp-members/css/blocks/members.css +0 -1
- bp-members/css/blocks/members.min.css +1 -1
- bp-members/css/blocks/online-members.css +8 -0
- bp-members/css/blocks/online-members.min.css +1 -0
- bp-members/js/blocks/active-members.js +8 -0
- bp-members/js/blocks/active-members.js.map +1 -0
- bp-members/js/blocks/dynamic-members.js +10 -0
- bp-members/js/blocks/dynamic-members.js.map +1 -0
- bp-members/js/blocks/member.js +2 -2
- bp-members/js/blocks/member.js.map +1 -1
- bp-members/js/blocks/members.js +12 -12
- bp-members/js/blocks/members.js.map +1 -1
- bp-members/js/blocks/online-members.js +8 -0
- bp-members/js/blocks/online-members.js.map +1 -0
- bp-members/js/dynamic-members.js +4 -0
- bp-members/js/dynamic-members.js.map +1 -0
- bp-members/sass/blocks/active-members.scss +12 -0
- bp-members/sass/blocks/dynamic-members.scss +40 -0
- bp-members/sass/blocks/online-members.scss +12 -0
- bp-messages/actions/notices.php +45 -1
- bp-messages/bp-messages-blocks.php +132 -0
- bp-messages/bp-messages-cssjs.php +19 -0
- bp-messages/bp-messages-functions.php +66 -6
- bp-messages/bp-messages-template.php +30 -1
- bp-messages/classes/class-bp-messages-component.php +39 -0
- bp-messages/classes/class-bp-messages-sitewide-notices-widget.php +4 -0
- bp-messages/classes/class-bp-messages-thread.php +24 -12
- bp-messages/classes/class-bp-rest-messages-endpoint.php +137 -60
- bp-messages/classes/class-bp-rest-sitewide-notices-endpoint.php +976 -0
- bp-messages/css/blocks/sitewide-notices-rtl.css +77 -0
- bp-messages/css/blocks/sitewide-notices-rtl.min.css +1 -0
- bp-messages/css/blocks/sitewide-notices.css +77 -0
- bp-messages/css/blocks/sitewide-notices.min.css +1 -0
- bp-messages/js/blocks/sitewide-notices.js +8 -0
- bp-messages/js/blocks/sitewide-notices.js.map +1 -0
- bp-messages/js/sitewide-notices.js +4 -0
- bp-messages/js/sitewide-notices.js.map +1 -0
- bp-messages/sass/blocks/sitewide-notices.scss +80 -0
- bp-notifications/classes/class-bp-rest-notifications-endpoint.php +99 -55
- bp-settings/classes/class-bp-settings-component.php +12 -0
- bp-templates/bp-legacy/buddypress-functions.php +4 -11
- bp-templates/bp-legacy/buddypress/assets/widgets/dynamic-groups.php +27 -0
- bp-templates/bp-legacy/buddypress/assets/widgets/dynamic-members.php +27 -0
- bp-templates/bp-legacy/buddypress/assets/widgets/friends.php +27 -0
- bp-templates/bp-legacy/css/buddypress-rtl.css +5 -2
- bp-templates/bp-legacy/css/buddypress-rtl.min.css +1 -1
- bp-templates/bp-legacy/css/buddypress.css +5 -2
- bp-templates/bp-legacy/css/buddypress.min.css +1 -1
@@ -13,21 +13,143 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
13 |
Â
}
|
14 |
Â
|
15 |
Â
/**
|
16 |
-
*
|
17 |
Â
*
|
18 |
-
* @since
|
19 |
Â
*
|
20 |
-
* @param array $
|
21 |
-
* @return
|
22 |
Â
*/
|
23 |
-
function
|
24 |
-
|
25 |
-
$
|
26 |
Â
array(
|
27 |
-
'
|
28 |
-
|
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 |
+
$widget_args = array(
|
59 |
+
'max' => $max_activities,
|
60 |
+
'scope' => 'all',
|
61 |
+
'user_id' => $member_id,
|
62 |
+
'object' => false,
|
63 |
+
'action' => implode( ',', $types ),
|
64 |
+
'primary_id' => 0,
|
65 |
+
'secondary_id' => 0,
|
66 |
+
);
|
67 |
+
|
68 |
+
// Build the activity loop.
|
69 |
+
if ( 'nouveau' === bp_get_theme_compat_id() ) {
|
70 |
+
$bp_nouveau = bp_nouveau();
|
71 |
+
|
72 |
+
// Globalize the activity widget arguments.
|
73 |
+
$bp_nouveau->activity->widget_args = $widget_args;
|
74 |
+
|
75 |
+
ob_start();
|
76 |
+
bp_get_template_part( 'activity/widget' );
|
77 |
+
$widget_content .= ob_get_clean();
|
78 |
+
|
79 |
+
// Reset the global.
|
80 |
+
$bp_nouveau->activity->widget_args = array();
|
81 |
+
} else {
|
82 |
+
$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' ) );
|
83 |
+
|
84 |
+
if ( bp_has_activities( $widget_args ) ) {
|
85 |
+
$activity_loop = '';
|
86 |
+
|
87 |
+
while ( bp_activities() ) {
|
88 |
+
bp_the_activity();
|
89 |
+
|
90 |
+
$activity_footer = '';
|
91 |
+
$activity_classes = 'activity-item';
|
92 |
+
if ( bp_activity_has_content() ) {
|
93 |
+
$activity_content = bp_get_activity_content_body();
|
94 |
+
$activity_footer = sprintf(
|
95 |
+
'<footer>
|
96 |
+
<cite>
|
97 |
+
<a href="%1$s" class="bp-tooltip" data-bp-tooltip="%2$s">
|
98 |
+
%3$s
|
99 |
+
</a>
|
100 |
+
</cite>
|
101 |
+
%4$s
|
102 |
+
</footer>',
|
103 |
+
bp_get_activity_user_link(),
|
104 |
+
bp_get_activity_member_display_name(),
|
105 |
+
bp_get_activity_avatar(
|
106 |
+
array(
|
107 |
+
'type' => 'thumb',
|
108 |
+
'width' => '40',
|
109 |
+
'height' => '40',
|
110 |
+
)
|
111 |
+
),
|
112 |
+
bp_insert_activity_meta()
|
113 |
+
);
|
114 |
+
} else {
|
115 |
+
$activity_classes .= ' mini';
|
116 |
+
$activity_content = bp_get_activity_action();
|
117 |
+
}
|
118 |
+
|
119 |
+
$activity_loop .= sprintf(
|
120 |
+
'<blockquote>
|
121 |
+
<div class="%1$s">%2$s</div>
|
122 |
+
%3$s
|
123 |
+
</blockquote>',
|
124 |
+
$activity_classes,
|
125 |
+
$activity_content,
|
126 |
+
$activity_footer
|
127 |
+
);
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
$widget_content .= sprintf(
|
132 |
+
'<div class="activity-list item-list">
|
133 |
+
%1$s
|
134 |
+
</div>',
|
135 |
+
$activity_loop
|
136 |
+
);
|
137 |
+
}
|
138 |
+
|
139 |
+
// Adds a container to make sure the block is styled even when used into the Columns parent block.
|
140 |
+
$widget_content = sprintf( '<div class="bp-latest-activities-block">%s</div>', "\n" . $widget_content . "\n" );
|
141 |
+
|
142 |
+
// Reset the global template loop.
|
143 |
+
$GLOBALS['activities_template'] = $reset_activities_template;
|
144 |
+
|
145 |
+
// Only add a block wrapper if not loaded into a Widgets sidebar.
|
146 |
+
if ( ! did_action( 'dynamic_sidebar_before' ) ) {
|
147 |
+
return sprintf(
|
148 |
+
'<div %1$s>%2$s</div>',
|
149 |
+
$wrapper_attributes,
|
150 |
+
$widget_content
|
151 |
+
);
|
152 |
+
}
|
153 |
+
|
154 |
+
return $widget_content;
|
155 |
Â
}
|
Â
|
@@ -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 |
Â
*
|
@@ -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 |
-
|
487 |
-
array(
|
488 |
-
'bp/
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
'
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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 |
Â
}
|
@@ -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
|
134 |
-
'in' => $request
|
135 |
-
'page' => $request
|
136 |
-
'per_page' => $request
|
137 |
-
'search_terms' => $request
|
138 |
-
'sort' => $request
|
139 |
-
'spam' => $request
|
140 |
-
'display_comments' => $request
|
141 |
-
'site_id' => $request
|
142 |
-
'group_id' => $request
|
143 |
-
'scope' => $request
|
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
|
156 |
Â
$args['exclude'] = false;
|
157 |
Â
}
|
158 |
Â
|
159 |
-
if ( empty( $request
|
160 |
Â
$args['in'] = false;
|
161 |
Â
}
|
162 |
Â
|
163 |
-
if (
|
164 |
-
$args['since'] = $request
|
165 |
Â
}
|
166 |
Â
|
167 |
-
if ( ! empty( $request
|
168 |
-
$args['filter']['user_id'] = $request
|
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
|
177 |
-
$request
|
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
|
192 |
-
$args['filter']['object'] = $request
|
193 |
Â
}
|
194 |
Â
|
195 |
-
if ( ! empty( $request
|
196 |
-
$item_id = $request
|
197 |
Â
$args['filter']['primary_id'] = $item_id;
|
198 |
Â
}
|
199 |
Â
}
|
200 |
Â
|
201 |
-
if ( empty( $request
|
202 |
Â
$args['scope'] = false;
|
203 |
Â
}
|
204 |
Â
|
205 |
-
if (
|
206 |
-
$args['filter']['action'] = $request
|
207 |
Â
}
|
208 |
Â
|
209 |
-
if ( ! empty( $request
|
210 |
-
$args['filter']['secondary_id'] = $request
|
211 |
Â
}
|
212 |
Â
|
213 |
Â
if ( $args['in'] ) {
|
214 |
Â
$args['count_total'] = false;
|
215 |
Â
}
|
216 |
Â
|
217 |
-
if ( $this->show_hidden( $request
|
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
|
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
|
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
|
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
|
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
|
380 |
-
$type = $request
|
381 |
Â
}
|
382 |
Â
|
383 |
-
$prime = $request
|
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 (
|
404 |
-
$prepared_activity->parent_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
|
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
|
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
|
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
|
952 |
-
$data
|
953 |
-
$data
|
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
|
976 |
-
* @param WP_REST_Request $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
|
999 |
-
* @param WP_REST_Request $request
|
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
|
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
|
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'] ) &&
|
1034 |
-
$prepared_activity->component = $request
|
1035 |
Â
} else {
|
1036 |
Â
$prepared_activity->component = buddypress()->activity->id;
|
1037 |
Â
}
|
1038 |
Â
|
1039 |
Â
// Activity Item ID.
|
1040 |
-
if ( ! empty( $schema['properties']['primary_item_id'] ) &&
|
1041 |
-
$item_id = (int) $request
|
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'] ) &&
|
1055 |
-
$prepared_activity->secondary_item_id = (int) $request
|
1056 |
Â
}
|
1057 |
Â
|
1058 |
Â
// Activity type.
|
1059 |
-
if ( ! empty( $schema['properties']['type'] ) &&
|
1060 |
-
$prepared_activity->type = $request
|
1061 |
Â
}
|
1062 |
Â
|
1063 |
Â
// Activity content.
|
1064 |
-
if ( ! empty( $schema['properties']['content'] ) &&
|
1065 |
-
if ( is_string( $request
|
1066 |
-
$prepared_activity->content = $request
|
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'] ) &&
|
1074 |
-
$prepared_activity->hide_sitewide = (bool) $request
|
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' ) &&
|
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' ) &&
|
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
|
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
|
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,
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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}({"
|
2 |
Â
function r(r){if(Array.isArray(r))return r}module.exports=r;
|
3 |
-
},{}],"
|
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 |
-
},{}],"
|
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 |
-
},{}],"
|
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":"
|
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 |
-
},{}],"
|
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":"
|
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
|
15 |
-
},{"@babel/runtime/helpers/slicedToArray":"
|
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
|
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
|
@@ -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,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,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F,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,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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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"]}
|
@@ -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
|
@@ -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,OAAAA,IAAAA,QAAAA,aAAAA,EAjFf,IAkBIC,EAAAA,GAhBFC,EADDC,EAAAA,YACCD,kBAEDE,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,aACAC,EAAAA,EAAAA,cACAC,EAAAA,EAAAA,YAEDC,EAAAA,EAAAA,QACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,cAGAC,EADDC,EAAAA,KACCD,GAeEE,EAAAA,GANFC,EADDC,EAAAA,gBACCD,iBAEDE,EAAAA,EAAAA,UACCC,EAAAA,EAAAA,cACAC,EAAAA,EAAAA,cAIIpB,EAA6B,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AUC,EAAMC,KAAML,EAASC,IAAId,QACvCgB,EAAQG,QAAUF,EAAMG,WAC5BH,EAAMG,YAGPJ,EAAQK,QAAS,SAAEC,EAAOC,GACpB,IAAMA,GACVpB,EAAMqB,KAAMF,KAKRd,OAAAA,EAAa,uBAAwB,CAC3CP,MAAOY,EAASC,IAAIb,MACpBF,cAAe0B,SAAUZ,EAASC,IAAIY,IAAK,IAC3C1B,KAAMG,QAOII,EAAAA,EAAAA,QAAAA,QAAAA;;ACnCf,aAHA,IAAA,EAAA,EAAA,QAAA,6BACA,EAAA,EAAA,QAAA,mCAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAfA,IAOI/B,EAAAA,GALFmD,EADDlB,EAAAA,OACCkB,kBAGAvC,EADDC,EAAAA,KACCD,GAUFuC,EAAmB,uBAAwB,CAC1C1B,MAAOb,EAAI,oBAAqB,cAChCwC,YAAaxC,EAAI,0JAA2J,cAC5KyC,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,sBAENC,SAAU,aACVrC,WAAY,CACXK,MAAO,CACND,KAAM,SACNkC,QAAS9C,EAAI,iBAAkB,eAEhCW,cAAe,CACdC,KAAM,SACNkC,QAAS,GAEVlC,KAAM,CACLA,KAAM,QACNkC,QAAS,CAAC,oBAEXpC,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"]}
|
@@ -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 |
+
}
|
@@ -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 |
+
}
|
@@ -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.
|
@@ -136,6 +141,7 @@ class BP_Blogs_Component extends BP_Component {
|
|
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.
|
141 |
Â
|
142 |
Â
if ( is_multisite() ) {
|
143 |
Â
$includes[] = 'widgets';
|
144 |
+
$includes[] = 'blocks';
|
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() ) {
|
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 |
Â
}
|
@@ -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 |
Â
}
|
@@ -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
|
101 |
Â
'no_grav' => $no_user_grav,
|
102 |
-
'html' => (bool) $request
|
103 |
Â
);
|
104 |
Â
|
105 |
-
if ( $request
|
106 |
-
$requested_args['alt'] = $request
|
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
|
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
|
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 );
|
@@ -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
|
95 |
-
'include_blog_ids' => $request
|
96 |
-
'user_id' => $request
|
97 |
-
'search_terms' => $request
|
98 |
-
'page' => $request
|
99 |
-
'per_page' => $request
|
100 |
Â
);
|
101 |
Â
|
102 |
Â
/**
|
@@ -131,8 +131,7 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
|
|
131 |
Â
}
|
132 |
Â
|
133 |
Â
// Actually, query it.
|
134 |
-
$blogs
|
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'
|
408 |
-
'user_id'
|
409 |
-
'name'
|
410 |
-
'domain'
|
411 |
-
'path'
|
412 |
-
'permalink'
|
413 |
-
'description'
|
414 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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
|
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( $
|
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
|
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'
|
657 |
Â
'context' => array( 'view', 'edit', 'embed' ),
|
658 |
Â
'description' => __( 'The description of the blog.', 'buddypress' ),
|
659 |
-
'
|
660 |
-
'
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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' => __( '
|
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 |
Â
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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
|
@@ -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","category","default","edit"],"mappings":";AAwEeA,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EArEf,IAkBIC,EAAAA,GAhBFC,EADDC,EAAAA,YACCD,kBAEDE,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,aACAC,EAAAA,EAAAA,YACAC,EAAAA,EAAAA,cAEDC,EAAAA,EAAAA,QACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,cAGAC,EADDC,EAAAA,KACCD,GAWEE,EAAAA,GAFFC,EADDC,EAAAA,gBACCD,iBAIIhB,EAAuB,SAAqC,GAAjCkB,IAAAA,EAAAA,EAAA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,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"]}
|
@@ -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 |
+
}
|
@@ -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.
|
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.
|
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' ) ),
|
@@ -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
|
Â
|
|
25 |
Â
------------------------------------------------------------------------------*/
|
26 |
Â
|
27 |
Â
/*------------------------------------------------------------------------------
|
@@ -538,7 +539,14 @@ body.post-type-bp-email .categorydiv label {
|
|
538 |
Â
}
|
539 |
Â
|
540 |
Â
/*------------------------------------------------------------------------------
|
541 |
-
* 5.0
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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;
|
@@ -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"}
|
@@ -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
|
Â
|
|
25 |
Â
------------------------------------------------------------------------------*/
|
26 |
Â
|
27 |
Â
/*------------------------------------------------------------------------------
|
@@ -538,7 +539,14 @@ body.post-type-bp-email .categorydiv label {
|
|
538 |
Â
}
|
539 |
Â
|
540 |
Â
/*------------------------------------------------------------------------------
|
541 |
-
* 5.0
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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;
|
@@ -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"}
|
@@ -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 |
Â
|
@@ -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
|
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)}}
|
@@ -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 |
Â
|
@@ -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
|
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)}}
|
@@ -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 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â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
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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 |
+
}
|
@@ -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.
|
@@ -135,19 +135,23 @@ function bp_rest_version() {
|
|
135 |
Â
}
|
136 |
Â
|
137 |
Â
/**
|
138 |
-
* Get
|
139 |
Â
*
|
140 |
-
* @since
|
141 |
Â
*
|
142 |
-
* @param
|
Â
|
|
143 |
Â
* @return string
|
144 |
Â
*/
|
145 |
-
function
|
146 |
-
return
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
Â
|
|
Â
|
|
Â
|
|
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 |
Â
|
@@ -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 |
Â
*
|
@@ -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 |
+
}
|
@@ -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( '
|
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/
|
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( '
|
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( '
|
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-
|
712 |
Â
</figure>
|
713 |
Â
<p>
|
714 |
-
|
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/
|
727 |
Â
</figure>
|
728 |
Â
<p>
|
729 |
-
<?php esc_html_e( '
|
730 |
-
|
731 |
-
|
732 |
-
|
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( '
|
745 |
Â
<p>
|
746 |
-
<?php esc_html_e( '
|
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( '
|
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( '
|
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
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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>.',
|
805 |
Â
'<span class="dashicons dashicons-heart"></span>',
|
806 |
Â
esc_url( bp_get_admin_url( 'admin.php?page=bp-credits' ) ),
|
807 |
-
number_format_i18n(
|
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,25 @@ 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/
|
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/
|
Â
|
|
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/
|
1030 |
-
<a href="https://
|
1031 |
-
<a href="https://profiles.wordpress.org/
|
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 +982,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/
|
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>.', 19, 'buddypress' ),
|
765 |
Â
'<span class="dashicons dashicons-heart"></span>',
|
766 |
Â
esc_url( bp_get_admin_url( 'admin.php?page=bp-credits' ) ),
|
767 |
+
number_format_i18n( 19 )
|
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/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
|
951 |
+
<a href="https://profiles.wordpress.org/leahkoerper/">leahkoerper</a>,
|
Â
|
|
Â
|
|
Â
|
|
952 |
Â
<a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
|
Â
|
|
Â
|
|
Â
|
|
953 |
Â
<a href="https://profiles.wordpress.org/modemlooper/">modemlooper</a>,
|
954 |
+
<a href="https://profiles.wordpress.org/niftythree/">Nifty (niftythree)</a>,
|
955 |
Â
<a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
|
Â
|
|
Â
|
|
956 |
Â
<a href="https://profiles.wordpress.org/nekojonez/">Pieterjan Deneys (nekojonez)</a>,
|
957 |
Â
<a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
|
958 |
Â
<a href="https://profiles.wordpress.org/espellcaste/">Renato Alves (espellcaste)</a>,
|
959 |
+
<a href="https://profiles.wordpress.org/shanebp">shanebp</a>,
|
960 |
+
<a href="https://profiles.wordpress.org/shawfactor/">shawfactor</a>,
|
961 |
Â
<a href="https://profiles.wordpress.org/slaffik/">Slava Abakumov (slaffik)</a>,
|
Â
|
|
962 |
Â
<a href="https://profiles.wordpress.org/netweb/">Stephen Edgar (netweb)</a>,
|
963 |
+
<a href="https://profiles.wordpress.org/tamarazambrana/">tamarazambrana</a>,
|
964 |
+
<a href="https://github.com/tkserver">TKServer</a>,
|
965 |
+
<a href="https://profiles.wordpress.org/vapvarun/">Varun Dubey (vapvarun)</a>.
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
966 |
Â
</p>
|
967 |
Â
|
968 |
Â
<h3 class="wp-people-group"><?php esc_html_e( 'With our thanks to these Open Source projects', 'buddypress' ); ?></h3>
|
982 |
Â
<h3 class="wp-people-group"><?php esc_html_e( 'Contributor Emeriti', 'buddypress' ); ?></h3>
|
983 |
Â
<ul class="wp-people-group " id="wp-people-group-emeriti">
|
984 |
Â
<li class="wp-person" id="wp-person-apeatling">
|
985 |
+
<a class="web" href="https://profiles.wordpress.org/apeatling/"><img alt="" class="gravatar" src="//www.gravatar.com/avatar/bb29d699b5cba218c313b61aa82249da?s=120">
|
986 |
Â
Andy Peatling</a>
|
987 |
Â
<span class="title"><?php esc_html_e( 'Project Founder', 'buddypress' ); ?></span>
|
988 |
Â
</li>
|
@@ -47,7 +47,29 @@ class BP_Block {
|
|
47 |
Â
*
|
48 |
Â
* @since 6.0.0
|
49 |
Â
*
|
50 |
-
* @param array $args
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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' ) ) {
|
@@ -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 `<button>` 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'],
|
@@ -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' =>
|
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 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
Â
|
|
263 |
Â
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
Â
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
Â
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
290 |
Â
|
291 |
Â
/**
|
292 |
-
* Filters the
|
293 |
Â
*
|
294 |
-
* @since
|
295 |
Â
*
|
296 |
-
* @param
|
Â
|
|
297 |
Â
*/
|
298 |
-
$
|
Â
|
|
Â
|
|
Â
|
|
299 |
Â
|
300 |
-
|
301 |
-
|
302 |
-
$this->register_global_tables( $r['global_tables'] );
|
303 |
-
}
|
304 |
Â
|
305 |
-
|
306 |
-
|
307 |
-
|
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 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
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 |
Â
}
|
@@ -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 |
Â
}
|
@@ -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,
|
293 |
Â
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
Â
|
|
Â
|
|
Â
|
|
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 |
Â
}
|
@@ -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
|
78 |
-
'status' => $request
|
79 |
-
'per_page' => $request
|
80 |
Â
);
|
81 |
Â
|
82 |
Â
/**
|
@@ -167,7 +167,8 @@ class BP_REST_Components_Endpoint extends WP_REST_Controller {
|
|
167 |
Â
)
|
168 |
Â
);
|
169 |
Â
|
170 |
-
|
Â
|
|
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
|
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
|
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
|
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
|
319 |
-
* @
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
320 |
Â
*/
|
321 |
-
protected function verify_component_status( $name ) {
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
322 |
Â
if ( 'core' === $name || bp_is_active( $name ) ) {
|
323 |
-
|
Â
|
|
Â
|
|
Â
|
|
324 |
Â
}
|
325 |
Â
|
326 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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 |
-
$
|
397 |
Â
|
398 |
Â
// Return empty early.
|
399 |
-
if ( empty( $
|
400 |
Â
return array();
|
401 |
Â
}
|
402 |
Â
|
403 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
404 |
Â
'name' => $component,
|
405 |
-
'status' => $
|
406 |
-
'
|
407 |
-
'
|
Â
|
|
Â
|
|
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 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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 |
Â
}
|
@@ -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 |
Â
}
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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 |
+
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -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 |
-
},{}],"
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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 |
-
},{}],"
|
14 |
-
|
15 |
-
},{}],"
|
16 |
-
|
17 |
-
},{
|
18 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=
|
19 |
-
},{"
|
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"], "
|
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("&","&")}),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
|
@@ -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,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,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,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,EAA+BnD,GAAGoD,iBAAmBpD,GAAGoD,iBAAmBpD,GAAGqD,OAAOH,iBAG1F,OAAA,EAAC,EAAkC7B;;ACZtB,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,aAAA,EAHf,IAAA,EAAA,EAAA,QAAA,oBACA,EAAA,EAAA,QAAA,yBAEe,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAAA,IAAA,EAAA,CACdtB,cAAAA,EADc,QAEdmD,iBAAAA,EAAAA,SAFc,QAAA,QAAA;;ACNf,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 _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( '&', '&' ) } />\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"]}
|
@@ -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
|
@@ -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,EAC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AA,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"]}
|
@@ -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
|
@@ -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,EADDC,EAAAA,KACCD,GAWEE,EAAAA,GAFFC,EADDC,EAAAA,gBACCD,iBAIId,EAAgB,SAAqC,GAAjCgB,IAAAA,EAAAA,EAAAA,WAAYC,EAAAA,EAAAA,cAC7BC,EAAUF,EAAVE,MAGP,OAAA,EAAC,EACA,KAAA,EAAC,EACA,KAAA,EAAC,EAAD,CAAW,MAAQP,EAAI,WAAY,cAAiB,aAAc,GACjE,EAAC,EAAD,CACC,MAAQA,EAAI,QAAS,cACrB,MAAQO,EACR,SAAW,SAAEC,GACZF,EAAe,CAAEC,MAAOC,SAK5B,EAAC,EACA,KAAA,EAAC,EAAD,CAAkB,MAAM,gBAAgB,WAAaH,OAM1ChB,EAAAA,EAAAA,QAAAA,QAAAA;;AClBAoB,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAhCd,IAIGnB,EAAAA,GAFFoB,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,yBAAXF,GAERG,UAAW,SAAoB,GAAhBF,IAAAA,EAAAA,EAAAA,SACPN,OAAAA,EAAa,gBAAiB,CACpCH,MAAOS,EAASC,IAAIV,YAOVE,EAAAA,EAAAA,QAAAA,QAAAA;;ACjBf,aAHA,IAAA,EAAA,EAAA,QAAA,sBACA,EAAA,EAAA,QAAA,4BAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAfA,IAOInB,EAAAA,GALF6B,EADDR,EAAAA,OACCQ,kBAGAnB,EADDC,EAAAA,KACCD,GAUFmB,EAAmB,gBAAiB,CACnCZ,MAAOP,EAAI,aAAc,cACzBoB,YAAapB,EAAI,4FAA6F,cAC9GqB,KAAM,CACLC,WAAY,OACZC,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"]}
|
@@ -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
|
@@ -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,SAClDC,EAAiBH,EAAjBG,aACFC,EAAiBN,EAA0BI,GAG5CE,OAAAA,GAAkBA,EAAeC,KAAO,IAFpB,CAAC,6BAA8B,6BAEYC,QAASF,EAAeC,IAE1F,EAAC,EAAD,CAAQ,OAAO,QAAQ,eAAgB,GACtC,EACGZ,IAAAA,KAAAA,EAAI,qGAAuG,gBAOhH,EAAC,EAC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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"]}
|
@@ -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
|
@@ -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,EAAA,EAAA,UAAA,GAAA,GAAA,EAAA,EAAA,GAAA,EArBA,IAIIA,EAAAA,GAFFC,EADDC,EAAAA,IACCD,aASEE,EAAAA,OADHC,EAAAA,EAAAA,SAIDC,OAAOC,GAAKD,OAAOC,IAAM,GAOzBA,GAAGC,mBAAH,WACcC,SAAAA,EAAAA,EAAUC,GAAS,IAAA,EA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,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"]}
|
@@ -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 |
+
}
|
@@ -0,0 +1,266 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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 |
+
}
|
@@ -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 );
|
@@ -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.
|
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() ||
|
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 |
Â
}
|
@@ -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 |
Â
}
|
@@ -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
|
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' =>
|
688 |
Â
'embeddable' => true,
|
689 |
Â
),
|
690 |
Â
'friend' => array(
|
691 |
-
'href' =>
|
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 |
Â
);
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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
|
@@ -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,MAAO,UAER,CACCD,MAAOH,EAAI,UAAW,cACtBI,MAAO,YAXF,QAAA,MAAA;;ACwEQC,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAhDf,IAAA,EAAA,QAAA,eAjBIN,EAAAA,GAhBFO,EADDC,EAAAA,YACCD,kBAEDE,EAAAA,EAAAA,WACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,aACAC,EAAAA,EAAAA,cACAC,EAAAA,EAAAA,cAEDC,EAAAA,EAAAA,QACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,cAGAhB,EADDC,EAAAA,KACCD,GAcEiB,EAAAA,GALFC,EADDC,EAAAA,gBACCD,iBAGAE,EADDC,EAAAA,UACCD,cASIf,EAA0B,SAAqC,GAAjCiB,IAAAA,EAAAA,EAAAA,WAAYC,EAAAA,EAAAA,cACvCC,EAAiDF,EAAjDE,OAAQC,EAAyCH,EAAzCG,WAAYC,EAA6BJ,EAA7BI,cAAeC,EAAcL,EAAdK,UACrCC,EAAOR,IAOZ,OALMI,GAAUI,GAChBL,EAAe,CAAEC,OAAQI,IAIzB,EAAC,EACA,KAAA,EAAC,EACA,KAAA,EAAC,EAAD,CAAW,MAAQ5B,EAAI,WAAY,cAAiB,aAAc,GACjE,EAAC,EAAD,CACC,MAAQA,EAAI,sBAAuB,cACnC,MAAQyB,EACR,SAAW,S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Y,OACZC,WAAY,UACZC,IAAK,qBAENC,SAAU,aACV5B,WAAY,CACXG,WAAY,CACXS,KAAM,SACNiB,QAAS,GAEVzB,cAAe,CACdQ,KAAM,SACNiB,QAAS,UAEVxB,UAAW,CACVO,KAAM,UACNiB,SAAS,GAEV3B,OAAQ,CACPU,KAAM,SACNiB,QAAS,IAGXC,KAAM/C,EA3B0B,QA4BhCyB,WAAYA,EAAAA","file":"friends.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\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"]}
|
@@ -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
|
@@ -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,E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BAAyB,cAAgBe,EAAOS,MAEjFZ,GAAUJ,EAAMO,KAGjBH,EAAS,6BAA+BZ,EAAI,gCAAiC,cAAiB,SAG/FS,EAASgB,UAAYb,IAwCtB,CAAA,IAAA,QArCA,MAAA,WAAQ,IAAA,EAAA,KACFc,KAAAA,OAAOZ,QAAS,SAAEa,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,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"]}
|
@@ -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 |
+
}
|
@@ -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 |
Â
*
|
@@ -264,12 +241,12 @@ function bp_groups_render_groups_block( $attributes = array() ) {
|
|
264 |
Â
$output .= sprintf(
|
265 |
Â
'<div class="item-header-avatar">
|
266 |
Â
<a href="%1$s">
|
267 |
-
<img
|
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->
|
273 |
Â
esc_url(
|
274 |
Â
bp_core_fetch_avatar(
|
275 |
Â
array(
|
@@ -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 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â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â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
15 |
Â
/**
|
16 |
Â
* Callback function to render the BP Group Block.
|
17 |
Â
*
|
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 |
Â
/* Translators: %s is the group's name. */
|
249 |
+
sprintf( esc_attr__( 'Group Profile photo of %s', 'buddypress' ), esc_html( $group->name ) ),
|
250 |
Â
esc_url(
|
251 |
Â
bp_core_fetch_avatar(
|
252 |
Â
array(
|
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 |
+
}
|
@@ -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 );
|
@@ -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
|
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
|
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 ) ) {
|
@@ -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 |
Â
}
|
@@ -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() ||
|
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 |
Â
}
|
@@ -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
|
123 |
-
'alt' => $request
|
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
|
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 );
|
@@ -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
|
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 );
|
@@ -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
|
117 |
-
'user_id' => $request
|
118 |
-
'invite_sent' => $request
|
119 |
-
'per_page' => $request
|
120 |
-
'page' => $request
|
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
|
129 |
-
$args['inviter_id'] = $request
|
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
|
194 |
Â
$current_user_id = (int) bp_loggedin_user_id();
|
195 |
-
$user_id_arg = (int) $request
|
196 |
-
$inviter_id = (int) $request
|
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 ( $
|
268 |
-
$inviter = bp_rest_get_user( $
|
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
|
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
|
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
|
410 |
-
$group = $this->groups_endpoint->get_group_object( $request
|
411 |
-
$user = bp_rest_get_user( $request
|
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' =>
|
420 |
-
'content' => $request
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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' =>
|
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 |
Â
);
|
@@ -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
|
127 |
-
'type' => $request
|
128 |
-
'per_page' => $request
|
129 |
-
'page' => $request
|
130 |
-
'search_terms' => $request
|
131 |
-
'exclude' => $request
|
132 |
-
'exclude_admins_mods' => (bool) $request
|
133 |
-
'exclude_banned' => (bool) $request
|
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
|
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
|
235 |
-
$group = $this->groups_endpoint->get_group_object( $request
|
236 |
Â
|
237 |
-
if ( ! $request
|
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
|
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
|
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
|
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
|
392 |
-
$group = $this->groups_endpoint->get_group_object( $request
|
393 |
-
$action = $request
|
394 |
-
$role = $request
|
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
|
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
|
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
|
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
|
537 |
-
$messages[ $request
|
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
|
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
|
594 |
-
$group = $this->groups_endpoint->get_group_object( $request
|
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
|
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
|
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
|
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' =>
|
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 ) ),
|
@@ -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
|
127 |
-
'user_id' => $request
|
128 |
-
'per_page' => $request
|
129 |
-
'page' => $request
|
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
|
191 |
-
$group = $this->groups_endpoint->get_group_object( $request
|
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
|
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
|
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 (
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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
|
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
|
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
|
344 |
Â
$user = bp_rest_get_user( $user_id_arg );
|
345 |
-
$group = $this->groups_endpoint->get_group_object( $request
|
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
|
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
|
423 |
Â
$user = bp_rest_get_user( $user_id_arg );
|
424 |
-
$group = $this->groups_endpoint->get_group_object( $request
|
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
|
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
|
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
|
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
|
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
|
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' =>
|
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 |
Â
);
|
@@ -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
|
134 |
-
'order' => $request
|
135 |
-
'fields' => $request
|
136 |
-
'orderby' => $request
|
137 |
-
'user_id' => $request
|
138 |
-
'include' => $request
|
139 |
-
'parent_id' => $request
|
140 |
-
'exclude' => $request
|
141 |
-
'search_terms' => $request
|
142 |
-
'meta_query' => $request
|
143 |
-
'group_type' => $request
|
144 |
-
'show_hidden' => $request
|
145 |
-
'per_page' => $request
|
146 |
-
'status' => $request
|
147 |
-
'page' => $request
|
148 |
Â
);
|
149 |
Â
|
150 |
-
if ( empty( $request
|
151 |
Â
$args['parent_id'] = null;
|
152 |
Â
}
|
153 |
Â
|
154 |
Â
// See if the user can see hidden groups.
|
155 |
-
if (
|
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
|
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
|
345 |
-
bp_groups_set_group_type( $group_id, $request
|
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
|
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'] ) &&
|
858 |
-
$prepared_group->creator_id = (int) $request
|
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'] ) &&
|
867 |
-
$prepared_group->slug = $request
|
868 |
Â
}
|
869 |
Â
|
870 |
Â
// Group Name.
|
871 |
-
if ( ! empty( $schema['properties']['name'] ) &&
|
872 |
-
$prepared_group->name = $request
|
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'] ) &&
|
888 |
-
if ( is_string( $request
|
889 |
-
$prepared_group->description = $request
|
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'] ) &&
|
897 |
-
$prepared_group->status = $request
|
898 |
Â
}
|
899 |
Â
|
900 |
Â
// Group Forum Enabled.
|
901 |
-
if ( ! empty( $schema['properties']['enable_forum'] ) &&
|
902 |
-
$prepared_group->enable_forum = (bool) $request
|
903 |
Â
}
|
904 |
Â
|
905 |
Â
// Group Parent ID.
|
906 |
-
if ( ! empty( $schema['properties']['parent_id'] ) &&
|
907 |
-
$prepared_group->parent_id = $request
|
908 |
Â
}
|
909 |
Â
|
910 |
Â
// Update group type(s).
|
911 |
-
if ( isset( $prepared_group->group_id ) &&
|
912 |
-
bp_groups_set_group_type( $prepared_group->group_id, $request
|
913 |
Â
}
|
914 |
Â
|
915 |
Â
// Remove group type(s).
|
916 |
-
if ( isset( $prepared_group->group_id ) &&
|
917 |
Â
array_map(
|
918 |
Â
function( $type ) use ( $prepared_group ) {
|
919 |
Â
bp_groups_remove_group_type( $prepared_group->group_id, $type );
|
920 |
Â
},
|
921 |
-
$request
|
922 |
Â
);
|
923 |
Â
}
|
924 |
Â
|
925 |
Â
// Append group type(s).
|
926 |
-
if ( isset( $prepared_group->group_id ) &&
|
927 |
-
bp_groups_set_group_type( $prepared_group->group_id, $request
|
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' =>
|
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 |
-
&&
|
1032 |
-
&& absint( $request
|
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
|
1043 |
Â
*/
|
1044 |
Â
public function get_group_object( $request ) {
|
1045 |
-
if (
|
1046 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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' ),
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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 |
Â
|
@@ -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
|
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}
|
@@ -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 |
Â
|
@@ -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
|
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}
|
@@ -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
|
@@ -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,EAAAA,cACAC,EAAAA,EAAAA,YACAC,EAAAA,EAAAA,cAEDC,EAAAA,EAAAA,QACCC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,cAG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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"]}
|
@@ -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,
|
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,
|
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
|
@@ -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","
|
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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,CAAEM,mBAAqBA,KAEvC,KAEIxC,EADHwC,EACO,mDACA,6DADqD,kBAOjE,EAAC,EACA,KAAA,EAAC,EAAD,CAAkB,MAAM,WAAW,WAAaP,MAxFjD,EAAC,EAAD,CACC,KAAK,mBACL,MAAQjC,EAAI,mBAAoB,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"]}
|
@@ -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}({"
|
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":"
|
6 |
Â
function e(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}module.exports=e;
|
7 |
-
},{}],"
|
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":"
|
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":"
|
14 |
Â
function r(r){if(Array.isArray(r))return r}module.exports=r;
|
15 |
-
},{}],"
|
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 |
-
},{}],"
|
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 |
-
},{}],"
|
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":"
|
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,
|
25 |
-
},{"@babel/runtime/helpers/toConsumableArray":"I9dH","@babel/runtime/helpers/slicedToArray":"
|
26 |
-
"use strict";var e=t(require("./groups/edit"));function t(e){return e&&e.__esModule?e:{default:e}}var r=wp,
|
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
|
@@ -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,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M,QAAS,CACRgD,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,QA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6B,cAC/C,aApLmB,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"]}
|
@@ -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
|
@@ -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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\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 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"]}
|
@@ -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 |
+
}
|
@@ -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:
|
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.0.0-RC1
|
19 |
Â
* Text Domain: buddypress
|
20 |
Â
* Domain Path: /bp-languages/
|
21 |
Â
* License: GPLv2 or later (license.txt)
|
@@ -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 |
-
|
11 |
Â
} );
|
12 |
Â
|
13 |
Â
$( '.field-visibility-settings-close' ).on( 'click', function( event ) {
|
14 |
Â
event.preventDefault();
|
15 |
Â
|
16 |
-
|
17 |
Â
|
18 |
-
var settings_div = $(this).parent(),
|
19 |
-
|
20 |
Â
|
21 |
Â
settings_div.hide()
|
22 |
-
|
23 |
-
|
24 |
-
|
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 );
|
@@ -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").
|
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);
|
@@ -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 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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 |
+
}
|
@@ -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 );
|
@@ -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() ||
|
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 |
Â
}
|
@@ -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 |
Â
|
@@ -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 |
Â
|
@@ -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-online-members-block',
|
884 |
+
'editor_style_url' => plugins_url( 'css/blocks/online-members.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-active-members-block',
|
910 |
+
'editor_style_url' => plugins_url( 'css/blocks/active-members.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 |
Â
}
|
@@ -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
|
113 |
-
'alt' => $request
|
114 |
-
'no_grav' => (bool) $request
|
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
|
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
|
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 );
|
@@ -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
|
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
|
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 |
Â
|
@@ -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
|
105 |
-
'user_id' => $request
|
106 |
-
'user_ids' => $request
|
107 |
-
'xprofile_query' => $request
|
108 |
-
'include' => $request
|
109 |
-
'exclude' => $request
|
110 |
-
'populate_extras' => $request
|
111 |
-
'member_type' => $request
|
112 |
-
'search_terms' => $request
|
113 |
-
'per_page' => $request
|
114 |
-
'page' => $request
|
115 |
Â
);
|
116 |
Â
|
117 |
-
if ( empty( $request
|
118 |
Â
$args['user_ids'] = false;
|
119 |
Â
}
|
120 |
Â
|
121 |
-
if ( empty( $request
|
122 |
Â
$args['exclude'] = false;
|
123 |
Â
}
|
124 |
Â
|
125 |
-
if ( empty( $request
|
126 |
Â
$args['include'] = false;
|
127 |
Â
}
|
128 |
Â
|
129 |
-
if ( empty( $request
|
130 |
Â
$args['xprofile_query'] = false;
|
131 |
Â
}
|
132 |
Â
|
133 |
-
if ( empty( $request
|
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
|
210 |
Â
$args = array(
|
211 |
-
'user_ids' => array( $request
|
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
|
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
|
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
|
323 |
-
$member_type_edit =
|
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
|
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['
|
504 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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 |
-
|
Â
|
|
Â
|
|
Â
|
|
542 |
Â
|
543 |
-
|
544 |
-
|
Â
|
|
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 ) &&
|
602 |
-
$prepared_user->user_login = $request
|
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 ) &&
|
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
|
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',
|
@@ -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
|
128 |
-
'order' => $request
|
129 |
-
'orderby' => $request
|
130 |
-
'user_login' => $request
|
131 |
-
'number' => $request
|
132 |
-
'offset' => $request
|
133 |
Â
);
|
134 |
Â
|
135 |
-
if ( empty( $request
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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() ),
|
@@ -0,0 +1,8 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
[data-type="bp/active-members"] .avatar-block {
|
2 |
+
display: flex;
|
3 |
+
flex-flow: row wrap;
|
4 |
+
}
|
5 |
+
|
6 |
+
[data-type="bp/active-members"] .avatar-block img {
|
7 |
+
margin: 0.5em;
|
8 |
+
}
|
@@ -0,0 +1 @@
|
|
Â
|
1 |
+
[data-type="bp/active-members"] .avatar-block{display:flex;flex-flow:row wrap}[data-type="bp/active-members"] .avatar-block img{margin:.5em}
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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 |
Â
|
@@ -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
|
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}
|
@@ -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 |
Â
|
@@ -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
|
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}
|
@@ -0,0 +1,8 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
[data-type="bp/online-members"] .avatar-block {
|
2 |
+
display: flex;
|
3 |
+
flex-flow: row wrap;
|
4 |
+
}
|
5 |
+
|
6 |
+
[data-type="bp/online-members"] .avatar-block img {
|
7 |
+
margin: 0.5em;
|
8 |
+
}
|
@@ -0,0 +1 @@
|
|
Â
|
1 |
+
[data-type="bp/online-members"] .avatar-block{display:flex;flex-flow:row wrap}[data-type="bp/online-members"] .avatar-block img{margin:.5em}
|
@@ -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
|
@@ -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,E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,WAAY,UACZC,IAAK,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"]}
|
@@ -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
|
@@ -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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AAAA,EAAUC,MAIC,2BAAXF,GAERG,UAAW,SAAoB,GAAhBF,IAAAA,EAAAA,EAAAA,SACPL,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"]}
|
@@ -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,
|
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
|
@@ -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","
|
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,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,cAGAnB,EADDC,EAAAA,KACCD,GAeEoB,EAAAA,GAPHC,EAAAA,EAAAA,gBACCC,EAAAA,EAAAA,cACAC,EAAAA,EAAAA,iBAGAC,EADDC,EAAAA,UACCD,SASIE,EAAe,SAAEC,GACjBA,OAAAA,G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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"]}
|
@@ -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}({"
|
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":"
|
6 |
Â
function e(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}module.exports=e;
|
7 |
-
},{}],"
|
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":"
|
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":"
|
14 |
Â
function r(r){if(Array.isArray(r))return r}module.exports=r;
|
15 |
-
},{}],"
|
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 |
-
},{}],"
|
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 |
-
},{}],"
|
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":"
|
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,
|
25 |
-
},{"@babel/runtime/helpers/toConsumableArray":"I9dH","@babel/runtime/helpers/slicedToArray":"
|
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
|
@@ -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,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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 \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,E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RkD,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 \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"]}
|
@@ -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
|
@@ -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,SACA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A,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"]}
|
@@ -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
|
@@ -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,m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,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"]}
|
@@ -0,0 +1,12 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
// BP Who's online widget
|
2 |
+
[data-type="bp/active-members"] {
|
3 |
+
|
4 |
+
.avatar-block {
|
5 |
+
display: flex;
|
6 |
+
flex-flow: row wrap;
|
7 |
+
|
8 |
+
img {
|
9 |
+
margin: 0.5em;
|
10 |
+
}
|
11 |
+
}
|
12 |
+
}
|
@@ -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 |
+
}
|
@@ -0,0 +1,12 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
// BP Who's online widget
|
2 |
+
[data-type="bp/online-members"] {
|
3 |
+
|
4 |
+
.avatar-block {
|
5 |
+
display: flex;
|
6 |
+
flex-flow: row wrap;
|
7 |
+
|
8 |
+
img {
|
9 |
+
margin: 0.5em;
|
10 |
+
}
|
11 |
+
}
|
12 |
+
}
|
@@ -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' );
|
@@ -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">✖</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 |
+
}
|
@@ -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 );
|
@@ -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 |
-
* @
|
Â
|
|
Â
|
|
Â
|
|
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 |
-
* @
|
Â
|
|
Â
|
|
Â
|
|
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 |
+
}
|
@@ -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 |
-
<
|
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">Χ</span></a>
|
1392 |
Â
<?php bp_message_notice_text( $notice ); ?>
|
1393 |
Â
<?php wp_nonce_field( 'bp_messages_close_notice', 'close-notice-nonce' ); ?>
|
1394 |
Â
</div>
|
@@ -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 |
Â
}
|
@@ -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 |
Â
}
|
@@ -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 |
-
|
625 |
-
|
626 |
-
|
Â
|
|
Â
|
|
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 |
-
|
660 |
-
|
661 |
-
|
Â
|
|
Â
|
|
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 |
Â
}
|
@@ -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
|
120 |
-
'box' => $request
|
121 |
-
'type' => $request
|
122 |
-
'page' => $request
|
123 |
-
'per_page' => $request
|
124 |
-
'search_terms' => $request
|
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
|
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 |
-
$
|
Â
|
|
Â
|
|
Â
|
|
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
|
251 |
-
* @param WP_REST_Response $
|
252 |
-
* @param WP_REST_Request $request
|
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
|
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 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
276 |
Â
|
277 |
Â
if ( is_user_logged_in() ) {
|
278 |
-
$thread = $this->get_thread_object( $request
|
279 |
Â
|
280 |
-
if ( empty( $thread
|
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
|
356 |
-
* @param WP_REST_Response $
|
357 |
-
* @param WP_REST_Request $request
|
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
|
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 |
-
|
437 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
438 |
Â
}
|
439 |
Â
|
440 |
Â
// By default use the last message.
|
441 |
Â
$message_id = $thread->last_message_id;
|
442 |
-
if ( $request
|
443 |
-
$message_id = $request
|
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
|
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 (
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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
|
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
|
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
|
648 |
-
$user_id = $request
|
649 |
Â
}
|
650 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
651 |
Â
// Check the user is one of the recipients.
|
652 |
-
$
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
653 |
Â
|
654 |
Â
// Delete a thread.
|
655 |
-
if (
|
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
|
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
|
722 |
Â
|
723 |
-
if ( ! empty( $schema['properties']['id'] ) && ! empty( $request
|
724 |
-
$prepared_thread->thread_id = $request
|
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
|
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
|
738 |
-
$prepared_thread->content = $request
|
739 |
Â
} elseif ( ! empty( $thread->message ) ) {
|
740 |
Â
$prepared_thread->message = $thread->message;
|
741 |
Â
}
|
742 |
Â
|
743 |
-
if ( ! empty( $schema['properties']['subject'] ) && ! empty( $request
|
744 |
-
$prepared_thread->subject = $request
|
745 |
Â
} elseif ( ! empty( $thread->subject ) ) {
|
746 |
Â
$prepared_thread->subject = $thread->subject;
|
747 |
Â
}
|
748 |
Â
|
749 |
-
if ( ! empty( $schema['properties']['recipients'] ) && ! empty( $request
|
750 |
-
$prepared_thread->recipients = $request
|
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 (
|
795 |
-
$user_id = (int) $request
|
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->
|
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
|
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 |
-
* @
|
Â
|
|
987 |
Â
*/
|
988 |
-
public function get_thread_object( $thread_id ) {
|
989 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
990 |
Â
}
|
991 |
Â
|
992 |
Â
/**
|
993 |
-
* Get the message object
|
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 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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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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 |
+
}
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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 |
+
}
|
@@ -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}
|
@@ -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
|
@@ -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,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAlDd,IAgBGC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AfA,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"]}
|
@@ -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
|
@@ -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"]}
|
@@ -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 |
+
}
|
@@ -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
|
103 |
-
'user_ids' => $request
|
104 |
-
'item_id' => $request
|
105 |
-
'secondary_item_id' => $request
|
106 |
-
'component_name' => $request
|
107 |
-
'component_action' => $request
|
108 |
-
'order_by' => $request
|
109 |
-
'sort_order' => strtoupper( $request
|
110 |
-
'is_new' => $request
|
111 |
-
'page' => $request
|
112 |
-
'per_page' => $request
|
113 |
Â
);
|
114 |
Â
|
115 |
-
if ( empty( $request
|
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
|
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 (
|
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
|
422 |
-
* @param WP_REST_Request
|
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
|
528 |
-
* @param WP_REST_Request $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
|
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
|
556 |
-
* @param WP_REST_Request
|
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
|
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'] ) &&
|
580 |
-
$prepared_notification->user_id = (int) $request
|
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'] ) &&
|
588 |
-
$prepared_notification->item_id = $request
|
589 |
Â
} elseif ( isset( $notification->item_id ) ) {
|
590 |
Â
$prepared_notification->item_id = $notification->item_id;
|
591 |
Â
}
|
592 |
Â
|
593 |
-
if ( ! empty( $schema['properties']['secondary_item_id'] ) &&
|
594 |
-
$prepared_notification->secondary_item_id = $request
|
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'] ) &&
|
600 |
-
$prepared_notification->component_name = $request
|
601 |
Â
} elseif ( isset( $notification->component_name ) ) {
|
602 |
Â
$prepared_notification->component_name = $notification->component_name;
|
603 |
Â
}
|
604 |
Â
|
605 |
-
if ( ! empty( $schema['properties']['action'] ) &&
|
606 |
-
$prepared_notification->component_action = $request
|
607 |
Â
} elseif ( isset( $notification->component_action ) ) {
|
608 |
Â
$prepared_notification->component_action = $notification->component_action;
|
609 |
Â
}
|
610 |
Â
|
611 |
-
if ( ! empty( $schema['properties']['is_new'] ) &&
|
612 |
-
$prepared_notification->is_new = $request
|
613 |
Â
} elseif ( isset( $notification->is_new ) ) {
|
614 |
Â
$prepared_notification->is_new = $notification->is_new;
|
615 |
Â
}
|
616 |
Â
|
617 |
-
if ( ! empty( $schema['properties']['date'] ) &&
|
618 |
-
$prepared_notification->date_notified = $request
|
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
|
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 |
-
|
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 : (
|
703 |
-
|
704 |
-
$notification = bp_notifications_get_notification( $notification_id );
|
705 |
Â
|
706 |
-
|
Â
|
|
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 |
Â
|
@@ -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 |
Â
}
|
@@ -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' ) && !
|
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 |
-
|
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;
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
@@ -1428,7 +1428,9 @@ fieldset.create-site label {
|
|
1428 |
Â
}
|
1429 |
Â
|
1430 |
Â
.bp-site-wide-message #message button,
|
1431 |
-
.
|
Â
|
|
Â
|
|
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 |
Â
}
|
@@ -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}}
|
@@ -1428,7 +1428,9 @@ fieldset.create-site label {
|
|
1428 |
Â
}
|
1429 |
Â
|
1430 |
Â
.bp-site-wide-message #message button,
|
1431 |
-
.
|
Â
|
|
Â
|
|
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 |
Â
}
|
@@ -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,.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;r
|