[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-members/ -> bp-members-blocks.php (source)

   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.
  11  if ( ! 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   */
  23  function 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_core_get_username( $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_core_get_user_domain( $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" 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   */
 180  function 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      $container_classes = sprintf( 'bp-block-members avatar-%s', $block_args['avatarSize'] );
 202      if ( 'grid' === $block_args['layoutPreference'] ) {
 203          $container_classes .= sprintf( ' is-grid columns-%d', (int) $block_args['columns'] );
 204      }
 205  
 206      $query_args = array(
 207          'user_ids' => $member_ids,
 208      );
 209  
 210      if ( 'none' !== $block_args['extraData'] ) {
 211          $query_args['populate_extras'] = true;
 212      }
 213  
 214      $query = bp_core_get_users( $query_args );
 215  
 216      // Initialize the output and the members.
 217      $output  = '';
 218      $members = $query['users'];
 219  
 220      foreach ( $members as $member ) {
 221          $has_activity        = false;
 222          $member_item_classes = 'member-content';
 223  
 224          if ( 'list' === $block_args['layoutPreference'] && 'latest_update' === $block_args['extraData'] && isset( $member->latest_update ) && $member->latest_update ) {
 225              $has_activity        = true;
 226              $member_item_classes = 'member-content has-activity';
 227          }
 228  
 229          $output .= sprintf( '<div class="%s">', $member_item_classes );
 230  
 231          // Get Member link.
 232          $member_link = bp_core_get_user_domain( $member->ID );
 233  
 234          // Set the Avatar output.
 235          if ( $bp->avatar && $bp->avatar->show_avatars && 'none' !== $block_args['avatarSize'] ) {
 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 ),
 243                  /* translators: %s: member name */
 244                  sprintf( esc_attr__( 'Profile photo of %s', 'buddypress' ), $member->display_name ),
 245                  esc_url(
 246                      bp_core_fetch_avatar(
 247                          array(
 248                              'item_id' => $member->ID,
 249                              'object'  => 'user',
 250                              'type'    => $block_args['avatarSize'],
 251                              'html'    => false,
 252                          )
 253                      )
 254                  )
 255              );
 256          }
 257  
 258          $output .= '<div class="member-description">';
 259  
 260          // Add the latest activity the member posted.
 261          if ( $has_activity ) {
 262              $activity_content = '';
 263              $activity_data    = maybe_unserialize( $member->latest_update );
 264  
 265              if ( isset( $activity_data['content'] ) ) {
 266                  $activity_content = apply_filters( 'bp_get_activity_content', $activity_data['content'] );
 267              }
 268  
 269              $display_name = '';
 270              if ( $block_args['displayUserName'] ) {
 271                  $display_name = $member->display_name;
 272              }
 273  
 274              $mention_name = '';
 275              if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() && $block_args['displayMentionSlug'] ) {
 276                  $mention_name = '(@' . $member->user_nicename . ')';
 277              }
 278  
 279              $output .= sprintf(
 280                  '<blockquote class="wp-block-quote">
 281                      %1$s
 282                      <cite>
 283                          <span>%2$s</span>
 284                          %3$s
 285                      </cite>
 286                  </blockquote>',
 287                  $activity_content,
 288                  esc_html( $display_name ),
 289                  esc_html( $mention_name )
 290              );
 291          } else {
 292              if ( $block_args['displayUserName'] ) {
 293                  $output .= sprintf(
 294                      '<strong><a href="%1$s">%2$s</a></strong>',
 295                      esc_url( $member_link ),
 296                      esc_html( $member->display_name )
 297                  );
 298              }
 299  
 300              if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() && $block_args['displayMentionSlug'] ) {
 301                  $output .= sprintf(
 302                      '<span class="user-nicename">@%s</span>',
 303                      esc_html( $member->user_nicename )
 304                  );
 305              }
 306  
 307              if ( 'last_activity' === $block_args['extraData'] ) {
 308                  $output .= sprintf(
 309                      '<time datetime="%1$s">%2$s</time>',
 310                      esc_attr( bp_core_get_iso8601_date( $member->last_activity ) ),
 311                      /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
 312                      sprintf( esc_html__( 'Active %s', 'buddypress' ), bp_core_time_since( $member->last_activity ) )
 313                  );
 314              }
 315          }
 316  
 317          $output .= '</div></div>';
 318      }
 319  
 320      // Set the final output.
 321      $output = sprintf( '<div class="%1$s">%2$s</div>', $container_classes, $output );
 322  
 323      /**
 324       * Filter here to edit the output of the members block.
 325       *
 326       * @since 7.0.0
 327       *
 328       * @param string $output     The HTML output of the block.
 329       * @param array  $block_args The block arguments.
 330       * @param array  $members    The list of WP_User objects.
 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 = bp_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  }


Generated: Mon Oct 25 01:00:54 2021 Cross-referenced by PHPXref 0.7.1