Plugin Directory

source: buddypress/tags/12.4.1/bp-members/bp-members-blocks.php

Last change on this file was 3079691, checked in by imath, 12 months ago

Update trunk & create 12.4.1, 11.4.1, 10.6.3 & 9.2.3 security releases

File size: 20.5 KB
Line 
1<?php
2/**
3 * BP Members Blocks Functions.
4 *
5 * @package BuddyPress
6 * @subpackage MembersBlocks
7 * @since 6.0.0
8 */
9
10// Exit if accessed directly.
11if ( ! defined( 'ABSPATH' ) ) {
12        exit;
13}
14
15/**
16 * Callback function to render the BP Member Block.
17 *
18 * @since 6.0.0
19 *
20 * @param array $attributes The block attributes.
21 * @return string           HTML output.
22 */
23function bp_members_render_member_block( $attributes = array() ) {
24        $bp = buddypress();
25
26        $block_args = bp_parse_args(
27                $attributes,
28                array(
29                        'itemID'              => 0,
30                        'avatarSize'          => 'full',
31                        'displayMentionSlug'  => true,
32                        'displayActionButton' => true,
33                        'displayCoverImage'   => true,
34                )
35        );
36
37        if ( ! $block_args['itemID'] ) {
38                return;
39        }
40
41        // Set the member ID and container classes.
42        $member_id         = (int) $block_args['itemID'];
43        $container_classes = array( 'bp-block-member' );
44
45        // Mention variables.
46        $username   = bp_members_get_user_slug( $member_id );
47        $at_mention = '';
48
49        // Avatar variables.
50        $avatar           = '';
51        $avatar_container = '';
52
53        // Cover image variable.
54        $cover_image     = '';
55        $cover_style     = '';
56        $cover_container = '';
57
58        // Member name variables.
59        $display_name = bp_core_get_user_displayname( $member_id );
60        $member_link  = bp_members_get_user_url( $member_id );
61
62        // Member action button.
63        $action_button         = '';
64        $display_action_button = (bool) $block_args['displayActionButton'];
65
66        if ( $bp->avatar && $bp->avatar->show_avatars && in_array( $block_args['avatarSize'], array( 'thumb', 'full' ), true ) ) {
67                $avatar = bp_core_fetch_avatar(
68                        array(
69                                'item_id' => $member_id,
70                                'object'  => 'user',
71                                'type'    => $block_args['avatarSize'],
72                                'html'    => false,
73                        )
74                );
75
76                $container_classes[] = 'avatar-' . $block_args['avatarSize'];
77        } else {
78                $container_classes[] = 'avatar-none';
79        }
80
81        if ( $avatar ) {
82                $avatar_container = sprintf(
83                        '<div class="item-header-avatar">
84                                <a href="%1$s">
85                                        <img loading="lazy" src="%2$s" alt="%3$s" class="avatar">
86                                </a>
87                        </div>',
88                        esc_url( $member_link ),
89                        esc_url( $avatar ),
90                        /* translators: %s: member name */
91                        sprintf( esc_html__( 'Profile photo of %s', 'buddypress' ), $display_name )
92                );
93        }
94
95        $display_cover_image = (bool) $block_args['displayCoverImage'];
96        if ( bp_is_active( 'members', 'cover_image' ) && $display_cover_image ) {
97                $cover_image = bp_attachments_get_attachment(
98                        'url',
99                        array(
100                                'item_id' => $member_id,
101                        )
102                );
103
104                if ( $cover_image ) {
105                        $cover_style = sprintf(
106                                ' style="background-image: url( %s );"',
107                                esc_url( $cover_image )
108                        );
109                }
110
111                $cover_container = sprintf(
112                        '<div class="bp-member-cover-image"%s></div>',
113                        $cover_style
114                );
115
116                $container_classes[] = 'has-cover';
117        }
118
119        $display_mention_slug = (bool) $block_args['displayMentionSlug'];
120        if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() && $display_mention_slug ) {
121                $at_mention = sprintf(
122                        '<span class="user-nicename">@%s</span>',
123                        esc_html( $username )
124                );
125        }
126
127        if ( $display_action_button ) {
128                $action_button = sprintf(
129                        '<div class="bp-profile-button">
130                                <a href="%1$s" class="button large primary button-primary wp-block-button__link wp-element-button" role="button">%2$s</a>
131                        </div>',
132                        esc_url( $member_link ),
133                        esc_html__( 'View Profile', 'buddypress' )
134                );
135        }
136
137        $output = sprintf(
138                '<div class="%1$s">
139                        %2$s
140                        <div class="member-content">
141                                %3$s
142                                <div class="member-description">
143                                        <strong><a href="%4$s">%5$s</a></strong>
144                                        %6$s
145                                        %7$s
146                                </div>
147                        </div>
148                </div>',
149                implode( ' ', array_map( 'sanitize_html_class', $container_classes ) ),
150                $cover_container,
151                $avatar_container,
152                esc_url( $member_link ),
153                esc_html( $display_name ),
154                $at_mention,
155                $action_button
156        );
157
158        // Compact all interesting parameters.
159        $params = array_merge( $block_args, compact( 'username', 'display_name', 'member_link', 'avatar', 'cover_image' ) );
160
161        /**
162         * Filter here to edit the output of the single member block.
163         *
164         * @since 6.0.0
165         *
166         * @param string          $output The HTML output of the block.
167         * @param array           $params The block extended parameters.
168         */
169        return apply_filters( 'bp_members_render_member_block_output', $output, $params );
170}
171
172/**
173 * Callback function to render the BP Members Block.
174 *
175 * @since 7.0.0
176 *
177 * @param array $attributes The block attributes.
178 * @return string           HTML output.
179 */
180function bp_members_render_members_block( $attributes = array() ) {
181        $bp = buddypress();
182
183        $block_args = bp_parse_args(
184                $attributes,
185                array(
186                        'itemIDs'            => array(),
187                        'avatarSize'         => 'full',
188                        'displayMentionSlug' => true,
189                        'displayUserName'    => true,
190                        'extraData'          => 'none',
191                        'layoutPreference'   => 'list',
192                        'columns'            => '2',
193                )
194        );
195
196        $member_ids = wp_parse_id_list( $block_args['itemIDs'] );
197        if ( ! array_filter( $member_ids ) ) {
198                return '';
199        }
200
201        // Make sure the avatar size exists.
202        if ( ! in_array( $block_args['avatarSize'], array( 'thumb', 'full' ), true ) ) {
203                $block_args['avatarSize'] = 'none';
204        }
205
206        $container_classes = sprintf( 'bp-block-members avatar-%s', $block_args['avatarSize'] );
207        if ( 'grid' === $block_args['layoutPreference'] ) {
208                $container_classes .= sprintf( ' is-grid columns-%d', (int) $block_args['columns'] );
209        }
210
211        $query_args = array(
212                'user_ids' => $member_ids,
213        );
214
215        if ( 'none' !== $block_args['extraData'] ) {
216                $query_args['populate_extras'] = true;
217        }
218
219        $query = bp_core_get_users( $query_args );
220
221        // Initialize the output and the members.
222        $output  = '';
223        $members = $query['users'];
224
225        foreach ( $members as $member ) {
226                $has_activity        = false;
227                $member_item_classes = 'member-content';
228
229                if ( 'list' === $block_args['layoutPreference'] && 'latest_update' === $block_args['extraData'] && isset( $member->latest_update ) && $member->latest_update ) {
230                        $has_activity        = true;
231                        $member_item_classes = 'member-content has-activity';
232                }
233
234                $output .= sprintf( '<div class="%s">', $member_item_classes );
235
236                // Get Member link.
237                $member_link = bp_members_get_user_url( $member->ID );
238
239                // Set the Avatar output.
240                if ( $bp->avatar && $bp->avatar->show_avatars && 'none' !== $block_args['avatarSize'] ) {
241                        $output .= sprintf(
242                                '<div class="item-header-avatar">
243                                        <a href="%1$s">
244                                                <img loading="lazy" class="avatar" alt="%2$s" src="%3$s" />
245                                        </a>
246                                </div>',
247                                esc_url( $member_link ),
248                                /* translators: %s: member name */
249                                sprintf( esc_attr__( 'Profile photo of %s', 'buddypress' ), $member->display_name ),
250                                esc_url(
251                                        bp_core_fetch_avatar(
252                                                array(
253                                                        'item_id' => $member->ID,
254                                                        'object'  => 'user',
255                                                        'type'    => $block_args['avatarSize'],
256                                                        'html'    => false,
257                                                )
258                                        )
259                                )
260                        );
261                }
262
263                $output .= '<div class="member-description">';
264
265                // Add the latest activity the member posted.
266                if ( $has_activity ) {
267                        $activity_content = '';
268                        $activity_data    = maybe_unserialize( $member->latest_update );
269
270                        if ( isset( $activity_data['content'] ) ) {
271                                $activity_content = apply_filters( 'bp_get_activity_content', $activity_data['content'] );
272                        }
273
274                        $display_name = '';
275                        if ( $block_args['displayUserName'] ) {
276                                $display_name = $member->display_name;
277                        }
278
279                        $mention_name = '';
280                        if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() && $block_args['displayMentionSlug'] ) {
281                                $mention_name = '(@' . $member->user_nicename . ')';
282                        }
283
284                        $output .= sprintf(
285                                '<blockquote class="wp-block-quote">
286                                        %1$s
287                                        <cite>
288                                                <span>%2$s</span>
289                                                %3$s
290                                        </cite>
291                                </blockquote>',
292                                $activity_content,
293                                esc_html( $display_name ),
294                                esc_html( $mention_name )
295                        );
296                } else {
297                        if ( $block_args['displayUserName'] ) {
298                                $output .= sprintf(
299                                        '<strong><a href="%1$s">%2$s</a></strong>',
300                                        esc_url( $member_link ),
301                                        esc_html( $member->display_name )
302                                );
303                        }
304
305                        if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() && $block_args['displayMentionSlug'] ) {
306                                $output .= sprintf(
307                                        '<span class="user-nicename">@%s</span>',
308                                        esc_html( $member->user_nicename )
309                                );
310                        }
311
312                        if ( 'last_activity' === $block_args['extraData'] ) {
313                                $output .= sprintf(
314                                        '<time datetime="%1$s">%2$s</time>',
315                                        esc_attr( bp_core_get_iso8601_date( $member->last_activity ) ),
316                                        /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
317                                        sprintf( esc_html__( 'Active %s', 'buddypress' ), bp_core_time_since( $member->last_activity ) )
318                                );
319                        }
320                }
321
322                $output .= '</div></div>';
323        }
324
325        // Set the final output.
326        $output = sprintf( '<div class="%1$s">%2$s</div>', $container_classes, $output );
327
328        /**
329         * Filter here to edit the output of the members block.
330         *
331         * @since 7.0.0
332         *
333         * @param string $output     The HTML output of the block.
334         * @param array  $block_args The block arguments.
335         * @param array  $members    The list of WP_User objects.
336         */
337        return apply_filters( 'bp_members_render_members_block_output', $output, $block_args, $members );
338}
339
340/**
341 * Adds specific script data for the BP Members blocks.
342 *
343 * Only used for the BP Dynamic Members block.
344 *
345 * @since 9.0.0
346 */
347function bp_members_blocks_add_script_data() {
348        $dynamic_members_blocks = array_filter( buddypress()->members->block_globals['bp/dynamic-members']->items );
349
350        if ( ! $dynamic_members_blocks ) {
351                return;
352        }
353
354        $path = sprintf(
355                '/%1$s/%2$s/%3$s',
356                bp_rest_namespace(),
357                bp_rest_version(),
358                buddypress()->members->id
359        );
360
361        wp_localize_script(
362                'bp-dynamic-members-script',
363                'bpDynamicMembersSettings',
364                array(
365                        'path'  => ltrim( $path, '/' ),
366                        'root'  => esc_url_raw( get_rest_url() ),
367                        'nonce' => wp_create_nonce( 'wp_rest' ),
368                )
369        );
370
371        // Include the common JS template (Escaping is done there).
372        // phpcs:ignore WordPress.Security.EscapeOutput
373        echo bp_get_dynamic_template_part( 'assets/widgets/dynamic-members.php' );
374
375        // List the block specific props.
376        wp_add_inline_script(
377                'bp-dynamic-members-script',
378                sprintf( 'var bpDynamicMembersBlocks = %s;', wp_json_encode( array_values( $dynamic_members_blocks ) ) ),
379                'before'
380        );
381}
382
383/**
384 * Callback function to render the Dynamic Members Block.
385 *
386 * @since 9.0.0
387 *
388 * @param array $attributes The block attributes.
389 * @return string           HTML output.
390 */
391function bp_members_render_dynamic_members_block( $attributes = array() ) {
392        $block_args = bp_parse_args(
393                $attributes,
394                array(
395                        'title'         => '',
396                        'maxMembers'    => 5,
397                        'memberDefault' => 'active',
398                        'linkTitle'     => false,
399                )
400        );
401
402        if ( ! $block_args['title'] ) {
403                $block_args['title'] = __( 'Members', 'buddypress' );
404        }
405
406        $classnames         = 'widget_bp_core_members_widget buddypress widget';
407        $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
408
409        $max_members = (int) $block_args['maxMembers'];
410        $no_members  = __( 'No members found.', 'buddypress' );
411
412        /** This filter is documented in buddypress/src/bp-members/classes/class-bp-core-members-widget.php */
413        $separator = apply_filters( 'bp_members_widget_separator', '|' );
414
415        // Make sure the widget ID is unique.
416        $widget_id              = uniqid( 'members-list-' );
417        $members_directory_link = bp_get_members_directory_permalink();
418
419        // Set the Block's title.
420        if ( true === $block_args['linkTitle'] ) {
421                $widget_content = sprintf(
422                        '<h2 class="widget-title"><a href="%1$s">%2$s</a></h2>',
423                        esc_url( $members_directory_link ),
424                        esc_html( $block_args['title'] )
425                );
426        } else {
427                $widget_content = sprintf( '<h2 class="widget-title">%s</h2>', esc_html( $block_args['title'] ) );
428        }
429
430        $item_options = array(
431                'newest' => array(
432                        'class' => '',
433                        'label' => _x( 'Newest', 'Members', 'buddypress' ),
434                ),
435                'active' => array(
436                        'class' => '',
437                        'label' => _x( 'Active', 'Members', 'buddypress' ),
438                ),
439        );
440
441        if ( bp_is_active( 'friends' ) ) {
442                $item_options['popular'] = array(
443                        'class' => '',
444                        'label' => _x( 'Popular', 'Members', 'buddypress' ),
445                );
446        }
447
448        $item_options_output = array();
449        $separator_output    = sprintf( ' <span class="bp-separator" role="separator">%s</span> ', esc_html( $separator ) );
450
451        foreach ( $item_options as $item_type => $item_attr ) {
452                if ( $block_args['memberDefault'] === $item_type ) {
453                        $item_attr['class'] = ' class="selected"';
454                }
455
456                $item_options_output[] = sprintf(
457                        '<a href="%1$s" data-bp-sort="%2$s"%3$s>%4$s</a>',
458                        esc_url( $members_directory_link ),
459                        esc_attr( $item_type ),
460                        $item_attr['class'],
461                        esc_html( $item_attr['label'] )
462                );
463        }
464
465        $preview      = '';
466        $default_args = array(
467                'type'            => $block_args['memberDefault'],
468                'per_page'        => $max_members,
469                'populate_extras' => true,
470        );
471
472        // Previewing the Block inside the editor.
473        if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
474                $bp_query = bp_core_get_users( $default_args );
475                $preview  = sprintf( '<div class="widget-error">%s</div>', $no_members );
476
477                if ( is_array( $bp_query['users'] ) && 0 < count( $bp_query['users'] ) ) {
478                        $preview = '';
479                        foreach ( $bp_query['users'] as $user ) {
480                                if ( 'newest' === $block_args['memberDefault'] ) {
481                                        /* translators: %s is time elapsed since the registration date happened */
482                                        $extra = sprintf( _x( 'Registered %s', 'The timestamp when the user registered', 'buddypress' ), bp_core_time_since( $user->user_registered ) );
483                                } elseif ( 'popular' === $block_args['memberDefault'] && isset( $item_options['popular'] ) && isset( $user->total_friend_count ) ) {
484                                        /* translators: %s: total friend count */
485                                        $extra = sprintf( _n( '%s friend', '%s friends', $user->total_friend_count, 'buddypress' ), number_format_i18n( $user->total_friend_count ) );
486                                } else {
487                                        /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
488                                        $extra = sprintf( __( 'Active %s', 'buddypress' ), bp_core_time_since( $user->last_activity ) );
489                                }
490
491                                $preview .= bp_get_dynamic_template_part(
492                                        'assets/widgets/dynamic-members.php',
493                                        'php',
494                                        array(
495                                                'data.link'              => esc_url( bp_members_get_user_url( $user->ID ) ),
496                                                'data.name'              => esc_html( $user->display_name ),
497                                                'data.avatar_urls.thumb' => bp_core_fetch_avatar(
498                                                        array(
499                                                                'item_id' => $user->ID,
500                                                                'html'    => false,
501                                                        )
502                                                ),
503                                                'data.avatar_alt'        => esc_attr(
504                                                        sprintf(
505                                                                /* translators: %s: member name */
506                                                                __( 'Profile picture of %s', 'buddypress' ),
507                                                                esc_html( $user->display_name )
508                                                        )
509                                                ),
510                                                'data.id'                => $user->ID,
511                                                'data.extra'             => esc_html( $extra ),
512                                        )
513                                );
514                        }
515                }
516        } elseif ( defined( 'WP_USE_THEMES' ) ) {
517                // Get corresponding members.
518                $path = sprintf(
519                        '/%1$s/%2$s/%3$s',
520                        bp_rest_namespace(),
521                        bp_rest_version(),
522                        buddypress()->members->id
523                );
524
525                $default_path = add_query_arg(
526                        $default_args,
527                        $path
528                );
529
530                $preloaded_members = rest_preload_api_request( '', $default_path );
531
532                buddypress()->members->block_globals['bp/dynamic-members']->items[ $widget_id ] = (object) array(
533                        'selector'   => $widget_id,
534                        'query_args' => $default_args,
535                        'preloaded'  => reset( $preloaded_members ),
536                );
537
538                // Only enqueue common/specific scripts and data once per page load.
539                if ( ! has_action( 'wp_footer', 'bp_members_blocks_add_script_data' ) ) {
540                        wp_set_script_translations( 'bp-dynamic-members-script', 'buddypress' );
541                        wp_enqueue_script( 'bp-dynamic-members-script' );
542
543                        add_action( 'wp_footer', 'bp_members_blocks_add_script_data', 1 );
544                }
545        }
546
547        $widget_content .= sprintf(
548                '<div class="item-options">
549                        %1$s
550                </div>
551                <ul id="%2$s" class="item-list" aria-live="polite" aria-relevant="all" aria-atomic="true">
552                        %3$s
553                </ul>',
554                implode( $separator_output, $item_options_output ),
555                esc_attr( $widget_id ),
556                $preview
557        );
558
559        // Adds a container to make sure the block is styled even when used into the Columns parent block.
560        $widget_content = sprintf( '<div class="bp-dynamic-block-container">%s</div>', "\n" . $widget_content . "\n" );
561
562        // Only add a block wrapper if not loaded into a Widgets sidebar.
563        if ( ! did_action( 'dynamic_sidebar_before' ) ) {
564                return sprintf(
565                        '<div %1$s>%2$s</div>',
566                        $wrapper_attributes,
567                        $widget_content
568                );
569        }
570
571        return $widget_content;
572}
573
574/**
575 * Common function to render the Recently Active & Online Members Blocks.
576 *
577 * @since 9.0.0
578 *
579 * @param array $block_args {
580 *    Optional. An array of Block arguments.
581 *
582 *    @type string $title      The title of the Block.
583 *    @type int    $maxMembers The maximum number of members to show. Defaults to `0`.
584 *    @type string $noMembers  The string to output when there are no members to show.
585 *    @type string $classname  The name of the CSS class to use.
586 *    @type string $type       The type of filter to perform. Possible values are `online`, `active`,
587 *                             `newest`, `alphabetical`, `random` or `popular`.
588 * }
589 * @return string HTML output.
590 */
591function bp_members_render_members_avatars_block( $block_args = array() ) {
592        $args = bp_parse_args(
593                $block_args,
594                array(
595                        'title'      => '',
596                        'maxMembers' => 0,
597                        'noMembers'  => '',
598                        'classname'  => '',
599                        'type'       => 'active',
600                ),
601                ''
602        );
603
604        $title              = $args['title'];
605        $max_members        = (int) $args['maxMembers'];
606        $no_members         = $args['noMembers'];
607        $classname          = sanitize_key( $args['classname'] );
608        $wrapper_attributes = get_block_wrapper_attributes(
609                array(
610                        'class' => sprintf( '%s buddypress widget', $classname ),
611                )
612        );
613        $type               = sanitize_key( $args['type'] );
614
615        if ( $title ) {
616                $widget_content = sprintf( '<h2 class="widget-title">%s</h2>', esc_html( $title ) );
617        } else {
618                $widget_content = '';
619        }
620
621        // Query Users.
622        $query = bp_core_get_users(
623                array(
624                        'user_id'         => 0,
625                        'type'            => $type,
626                        'per_page'        => $max_members,
627                        'max'             => $max_members,
628                        'populate_extras' => true,
629                        'search_terms'    => false,
630                )
631        );
632
633        // Build the output for online members.
634        if ( isset( $query['total'] ) && 1 <= (int) $query['total'] ) {
635                $members        = $query['users'];
636                $member_avatars = array();
637
638                foreach ( $members as $member ) {
639                        $member_avatars[] = sprintf(
640                                '<div class="item-avatar">
641                                        <a href="%1$s" class="bp-tooltip" data-bp-tooltip="%2$s">
642                                                <img loading="lazy" src="%3$s" class="avatar user-%4$s-avatar avatar-50 photo" width="50" height="50" alt="%5$s">
643                                        </a>
644                                </div>',
645                                esc_url( bp_members_get_user_url( $member->ID ) ),
646                                esc_html( $member->display_name ),
647                                bp_core_fetch_avatar(
648                                        array(
649                                                'item_id' => $member->ID,
650                                                'html'    => false,
651                                        )
652                                ),
653                                esc_attr( $member->ID ),
654                                esc_html(
655                                        sprintf(
656                                                /* translators: %s: member name */
657                                                __( 'Profile picture of %s', 'buddypress' ),
658                                                $member->display_name
659                                        )
660                                )
661                        );
662                }
663
664                $widget_content .= sprintf(
665                        '<div class="avatar-block">
666                                %s
667                        </div>',
668                        implode( "\n", $member_avatars )
669                );
670
671                // Only enqueue BP Tooltips if there is some content to style.
672                wp_enqueue_style( 'bp-tooltips' );
673        } else {
674                $widget_content .= sprintf(
675                        '<div class="widget-error">
676                                %s
677                        </div>',
678                        esc_html( $no_members )
679                );
680        }
681
682        // Only add a block wrapper if not loaded into a Widgets sidebar.
683        if ( ! did_action( 'dynamic_sidebar_before' ) ) {
684                return sprintf(
685                        '<div %1$s>%2$s</div>',
686                        $wrapper_attributes,
687                        $widget_content
688                );
689        }
690
691        return $widget_content;
692}
693
694/**
695 * Callback function to render the Online Members Block.
696 *
697 * @since 9.0.0
698 *
699 * @param array $attributes The block attributes.
700 * @return string           HTML output.
701 */
702function bp_members_render_online_members_block( $attributes = array() ) {
703        $block_args = bp_parse_args(
704                $attributes,
705                array(
706                        'title'      => '',
707                        'maxMembers' => 15,
708                        'noMembers'  => __( 'There are no users currently online', 'buddypress' ),
709                        'classname'  => 'widget_bp_core_whos_online_widget',
710                ),
711                'members_widget_settings'
712        );
713
714        $block_args['type'] = 'online';
715
716        if ( ! $block_args['title'] ) {
717                $block_args['title'] = __( 'Who\'s Online', 'buddypress' );
718        }
719
720        return bp_members_render_members_avatars_block( $block_args );
721}
722
723/**
724 * Callback function to render the Recently Active Members Block.
725 *
726 * @since 9.0.0
727 *
728 * @param array $attributes The block attributes.
729 * @return string           HTML output.
730 */
731function bp_members_render_active_members_block( $attributes = array() ) {
732        $block_args = bp_parse_args(
733                $attributes,
734                array(
735                        'title'      => '',
736                        'maxMembers' => 15,
737                        'noMembers'  => __( 'There are no recently active members', 'buddypress' ),
738                        'classname'  => 'widget_bp_core_recently_active_widget',
739                ),
740                'recently_active_members_widget_settings'
741        );
742
743        $block_args['type'] = 'active';
744
745        if ( ! $block_args['title'] ) {
746                $block_args['title'] = __( 'Recently Active Members', 'buddypress' );
747        }
748
749        return bp_members_render_members_avatars_block( $block_args );
750}
Note: See TracBrowser for help on using the repository browser.