[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

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

   1  <?php
   2  /**
   3   * BuddyPress Member Template Tags.
   4   *
   5   * Functions that are safe to use inside your template files and themes.
   6   *
   7   * @package BuddyPress
   8   * @subpackage MembersTemplate
   9   * @since 1.5.0
  10   */
  11  
  12  // Exit if accessed directly.
  13  defined( 'ABSPATH' ) || exit;
  14  
  15  /**
  16   * Output the profile component slug.
  17   *
  18   * @since 2.4.0
  19   */
  20  function bp_profile_slug() {
  21      echo bp_get_profile_slug();
  22  }
  23      /**
  24       * Return the profile component slug.
  25       *
  26       * @since 2.4.0
  27       *
  28       * @return string
  29       */
  30  	function bp_get_profile_slug() {
  31  
  32          /**
  33           * Filters the profile component slug.
  34           *
  35           * @since 2.4.0
  36           *
  37           * @param string $slug Profile component slug.
  38           */
  39          return apply_filters( 'bp_get_profile_slug', buddypress()->profile->slug );
  40      }
  41  
  42  /**
  43   * Output the members component slug.
  44   *
  45   * @since 1.5.0
  46   */
  47  function bp_members_slug() {
  48      echo bp_get_members_slug();
  49  }
  50      /**
  51       * Return the members component slug.
  52       *
  53       * @since 1.5.0
  54       *
  55       * @return string
  56       */
  57  	function bp_get_members_slug() {
  58  
  59          /**
  60           * Filters the Members component slug.
  61           *
  62           * @since 1.5.0
  63           *
  64           * @param string $slug Members component slug.
  65           */
  66          return apply_filters( 'bp_get_members_slug', buddypress()->members->slug );
  67      }
  68  
  69  /**
  70   * Output the members component root slug.
  71   *
  72   * @since 1.5.0
  73   */
  74  function bp_members_root_slug() {
  75      echo bp_get_members_root_slug();
  76  }
  77      /**
  78       * Return the members component root slug.
  79       *
  80       * @since 1.5.0
  81       *
  82       * @return string
  83       */
  84  	function bp_get_members_root_slug() {
  85  
  86          /**
  87           * Filters the Members component root slug.
  88           *
  89           * @since 1.5.0
  90           *
  91           * @param string $root_slug Members component root slug.
  92           */
  93          return apply_filters( 'bp_get_members_root_slug', buddypress()->members->root_slug );
  94      }
  95  
  96  /**
  97   * Output the member type base slug.
  98   *
  99   * @since 2.5.0
 100   */
 101  function bp_members_member_type_base() {
 102      echo esc_url( bp_get_members_member_type_base() );
 103  }
 104      /**
 105       * Get the member type URL base.
 106       *
 107       * The base slug is the string used as the base prefix when generating member type directory URLs.
 108       * For example, in example.com/members/type/foo/, 'foo' is the member type and 'type' is the
 109       * base slug.
 110       *
 111       * @since 2.5.0
 112       *
 113       * @return string
 114       */
 115  	function bp_get_members_member_type_base() {
 116  
 117          /**
 118           * Filters the member type URL base.
 119           *
 120           * @since 2.3.0
 121           *
 122           * @param string $base Base slug for the member type.
 123           */
 124          return apply_filters( 'bp_members_member_type_base', _x( 'type', 'member type URL base', 'buddypress' ) );
 125      }
 126  
 127  /**
 128   * Output member directory permalink.
 129   *
 130   * @since 1.5.0
 131   */
 132  function bp_members_directory_permalink() {
 133      echo esc_url( bp_get_members_directory_permalink() );
 134  }
 135      /**
 136       * Return member directory permalink.
 137       *
 138       * @since 1.5.0
 139       *
 140       * @return string
 141       */
 142  	function bp_get_members_directory_permalink() {
 143  
 144          /**
 145           * Filters the member directory permalink.
 146           *
 147           * @since 1.5.0
 148           *
 149           * @param string $value Members directory permalink.
 150           */
 151          return apply_filters( 'bp_get_members_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_members_root_slug() ) );
 152      }
 153  
 154  /**
 155   * Output member type directory permalink.
 156   *
 157   * @since 2.5.0
 158   *
 159   * @param string $member_type Optional. Member type. Defaults to current member type.
 160   */
 161  function bp_member_type_directory_permalink( $member_type = '' ) {
 162      echo esc_url( bp_get_member_type_directory_permalink( $member_type ) );
 163  }
 164      /**
 165       * Return member type directory permalink.
 166       *
 167       * @since 2.5.0
 168       *
 169       * @param string $member_type Optional. Member type. Defaults to current member type.
 170       * @return string Member type directory URL on success, an empty string on failure.
 171       */
 172  	function bp_get_member_type_directory_permalink( $member_type = '' ) {
 173  
 174          if ( $member_type ) {
 175              $_member_type = $member_type;
 176          } else {
 177              // Fall back on the current member type.
 178              $_member_type = bp_get_current_member_type();
 179          }
 180  
 181          $type = bp_get_member_type_object( $_member_type );
 182  
 183          // Bail when member type is not found or has no directory.
 184          if ( ! $type || ! $type->has_directory ) {
 185              return '';
 186          }
 187  
 188          /**
 189           * Filters the member type directory permalink.
 190           *
 191           * @since 2.5.0
 192           *
 193           * @param string $value       Member type directory permalink.
 194           * @param object $type        Member type object.
 195           * @param string $member_type Member type name, as passed to the function.
 196           */
 197          return apply_filters( 'bp_get_member_type_directory_permalink', trailingslashit( bp_get_members_directory_permalink() . bp_get_members_member_type_base() . '/' . $type->directory_slug ), $type, $member_type );
 198      }
 199  
 200  /**
 201   * Output the sign-up slug.
 202   *
 203   * @since 1.5.0
 204   */
 205  function bp_signup_slug() {
 206      echo bp_get_signup_slug();
 207  }
 208      /**
 209       * Return the sign-up slug.
 210       *
 211       * @since 1.5.0
 212       *
 213       * @global BuddyPress $bp The one true BuddyPress instance.
 214       *
 215       * @return string
 216       */
 217  	function bp_get_signup_slug() {
 218          $bp = buddypress();
 219  
 220          if ( ! empty( $bp->pages->register->slug ) ) {
 221              $slug = $bp->pages->register->slug;
 222          } elseif ( defined( 'BP_REGISTER_SLUG' ) ) {
 223              $slug = BP_REGISTER_SLUG;
 224          } else {
 225              $slug = 'register';
 226          }
 227  
 228          /**
 229           * Filters the sign-up slug.
 230           *
 231           * @since 1.5.0
 232           *
 233           * @param string $slug Sign-up slug.
 234           */
 235          return apply_filters( 'bp_get_signup_slug', $slug );
 236      }
 237  
 238  /**
 239   * Output the activation slug.
 240   *
 241   * @since 1.5.0
 242   */
 243  function bp_activate_slug() {
 244      echo bp_get_activate_slug();
 245  }
 246      /**
 247       * Return the activation slug.
 248       *
 249       * @since 1.5.0
 250       *
 251       * @global BuddyPress $bp The one true BuddyPress instance.
 252       *
 253       * @return string
 254       */
 255  	function bp_get_activate_slug() {
 256          $bp = buddypress();
 257  
 258          if ( ! empty( $bp->pages->activate->slug ) ) {
 259              $slug = $bp->pages->activate->slug;
 260          } elseif ( defined( 'BP_ACTIVATION_SLUG' ) ) {
 261              $slug = BP_ACTIVATION_SLUG;
 262          } else {
 263              $slug = 'activate';
 264          }
 265  
 266          /**
 267           * Filters the activation slug.
 268           *
 269           * @since 1.5.0
 270           *
 271           * @param string $slug Activation slug.
 272           */
 273          return apply_filters( 'bp_get_activate_slug', $slug );
 274      }
 275  
 276  /**
 277   * Output the members invitation pane slug.
 278   *
 279   * @since 8.0.0
 280   */
 281  function bp_members_invitations_slug() {
 282      echo bp_get_members_invitations_slug();
 283  }
 284      /**
 285       * Return the members invitations root slug.
 286       *
 287       * @since 8.0.0
 288       *
 289       * @return string
 290       */
 291  	function bp_get_members_invitations_slug() {
 292  
 293          /**
 294           * Filters the Members invitations pane root slug.
 295           *
 296           * @since 8.0.0
 297           *
 298           * @param string $slug Members invitations pane root slug.
 299           */
 300          return apply_filters( 'bp_get_members_invitations_slug', _x( 'invitations', 'Member profile invitations pane URL base', 'buddypress' ) );
 301      }
 302  
 303  /**
 304   * Initialize the members loop.
 305   *
 306   * Based on the $args passed, bp_has_members() populates the $members_template
 307   * global, enabling the use of BuddyPress templates and template functions to
 308   * display a list of members.
 309   *
 310   * @since 1.2.0
 311   * @since 7.0.0 Added `xprofile_query` parameter. Added `user_ids` parameter.
 312   *
 313   * @global BP_Core_Members_Template $members_template
 314   *
 315   * @param array|string $args {
 316   *     Arguments for limiting the contents of the members loop. Most arguments
 317   *     are in the same format as {@link BP_User_Query}. However, because
 318   *     the format of the arguments accepted here differs in a number of ways,
 319   *     and because bp_has_members() determines some default arguments in a
 320   *     dynamic fashion, we list all accepted arguments here as well.
 321   *
 322   *     Arguments can be passed as an associative array, or as a URL query
 323   *     string (eg, 'user_id=4&per_page=3').
 324   *
 325   *     @type int                   $type                Sort order. Accepts 'active', 'random', 'newest', 'popular',
 326   *                                                      'online', 'alphabetical'. Default: 'active'.
 327   *     @type int|bool              $page                Page of results to display. Default: 1.
 328   *     @type int|bool              $per_page            Number of results per page. Default: 20.
 329   *     @type int|bool              $max                 Maximum number of results to return. Default: false (unlimited).
 330   *     @type string                $page_arg            The string used as a query parameter in pagination links.
 331   *                                                      Default: 'bpage'.
 332   *     @type array|int|string|bool $include             Limit results by a list of user IDs. Accepts an array, a
 333   *                                                      single integer, a comma-separated list of IDs, or false (to
 334   *                                                      disable this limiting). Accepts 'active', 'alphabetical',
 335   *                                                      'newest', or 'random'. Default: false.
 336   *     @type array|int|string|bool $exclude             Exclude users from results by ID. Accepts an array, a single
 337   *                                                      integer, a comma-separated list of IDs, or false (to disable
 338   *                                                      this limiting). Default: false.
 339   *     @type array|string|bool     $user_ids            An array or comma-separated list of IDs, or false (to
 340   *                                                      disable this limiting). Default: false.
 341   *     @type int                   $user_id             If provided, results are limited to the friends of the specified
 342   *                                                      user. When on a user's Friends page, defaults to the ID of the
 343   *                                                      displayed user. Otherwise defaults to 0.
 344   *     @type string|array          $member_type         Array or comma-separated list of member types to limit
 345   *                                                      results to.
 346   *     @type string|array          $member_type__in     Array or comma-separated list of member types to limit
 347   *                                                      results to.
 348   *     @type string|array          $member_type__not_in Array or comma-separated list of member types to exclude
 349   *                                                      from results.
 350   *     @type string                $search_terms        Limit results by a search term. Default: value of
 351   *                                                      `$_REQUEST['members_search']` or `$_REQUEST['s']`, if present.
 352   *                                                      Otherwise false.
 353   *     @type string                $meta_key            Limit results by the presence of a usermeta key.
 354   *                                                      Default: false.
 355   *     @type mixed                 $meta_value          When used with meta_key, limits results by the a matching
 356   *                                                      usermeta value. Default: false.
 357   *     @type array                 $xprofile_query      Filter results by xprofile data. Requires the xprofile
 358   *                                                      component. See {@see BP_XProfile_Query} for details.
 359   *     @type bool                  $populate_extras     Whether to fetch optional data, such as friend counts.
 360   *                                                      Default: true.
 361   * }
 362   * @return bool Returns true when blogs are found, otherwise false.
 363   */
 364  function bp_has_members( $args = '' ) {
 365      global $members_template;
 366  
 367      // Default user ID.
 368      $user_id = 0;
 369  
 370      // User filtering.
 371      if ( bp_is_user_friends() && ! bp_is_user_friend_requests() ) {
 372          $user_id = bp_displayed_user_id();
 373      }
 374  
 375      $member_type = bp_get_current_member_type();
 376      if ( ! $member_type && ! empty( $_GET['member_type'] ) ) {
 377          if ( is_array( $_GET['member_type'] ) ) {
 378              $member_type = $_GET['member_type'];
 379          } else {
 380              // Can be a comma-separated list.
 381              $member_type = explode( ',', $_GET['member_type'] );
 382          }
 383      }
 384  
 385      $search_terms_default = null;
 386      $search_query_arg = bp_core_get_component_search_query_arg( 'members' );
 387      if ( ! empty( $_REQUEST[ $search_query_arg ] ) ) {
 388          $search_terms_default = stripslashes( $_REQUEST[ $search_query_arg ] );
 389      }
 390  
 391      // Type: active ( default ) | random | newest | popular | online | alphabetical.
 392      $r = bp_parse_args(
 393          $args,
 394          array(
 395              'type'                => 'active',
 396              'page'                => 1,
 397              'per_page'            => 20,
 398              'max'                 => false,
 399  
 400              'page_arg'            => 'upage',  // See https://buddypress.trac.wordpress.org/ticket/3679.
 401  
 402              'include'             => false,    // Pass a user_id or a list (comma-separated or array) of user_ids to only show these users.
 403              'exclude'             => false,    // Pass a user_id or a list (comma-separated or array) of user_ids to exclude these users.
 404              'user_ids'            => false,
 405  
 406              'user_id'             => $user_id, // Pass a user_id to only show friends of this user.
 407              'member_type'         => $member_type,
 408              'member_type__in'     => '',
 409              'member_type__not_in' => '',
 410              'search_terms'        => $search_terms_default,
 411  
 412              'meta_key'            => false,    // Only return users with this usermeta.
 413              'meta_value'          => false,    // Only return users where the usermeta value matches. Requires meta_key.
 414  
 415              'xprofile_query'      => false,
 416              'populate_extras'     => true,     // Fetch usermeta? Friend count, last active etc.
 417          ),
 418          'has_members'
 419      );
 420  
 421      // Pass a filter if ?s= is set.
 422      if ( is_null( $r['search_terms'] ) ) {
 423          if ( !empty( $_REQUEST['s'] ) ) {
 424              $r['search_terms'] = $_REQUEST['s'];
 425          } else {
 426              $r['search_terms'] = false;
 427          }
 428      }
 429  
 430      // Set per_page to max if max is larger than per_page.
 431      if ( !empty( $r['max'] ) && ( $r['per_page'] > $r['max'] ) ) {
 432          $r['per_page'] = $r['max'];
 433      }
 434  
 435      // Query for members and populate $members_template global.
 436      $members_template = new BP_Core_Members_Template( $r );
 437  
 438      /**
 439       * Filters whether or not BuddyPress has members to iterate over.
 440       *
 441       * @since 1.2.4
 442       * @since 2.6.0 Added the `$r` parameter
 443       *
 444       * @param bool                     $value            Whether or not there are members to iterate over.
 445       * @param BP_Core_Members_Template $members_template Populated $members_template global.
 446       * @param array                    $r                Array of arguments passed into the BP_Core_Members_Template class.
 447       */
 448      return apply_filters( 'bp_has_members', $members_template->has_members(), $members_template, $r );
 449  }
 450  
 451  /**
 452   * Set up the current member inside the loop.
 453   *
 454   * @since 1.2.0
 455   *
 456   * @global BP_Core_Members_Template $members_template
 457   *
 458   * @return object
 459   */
 460  function bp_the_member() {
 461      global $members_template;
 462      return $members_template->the_member();
 463  }
 464  
 465  /**
 466   * Check whether there are more members to iterate over.
 467   *
 468   * @since 1.2.0
 469   *
 470   * @global BP_Core_Members_Template $members_template
 471   *
 472   * @return bool
 473   */
 474  function bp_members() {
 475      global $members_template;
 476      return $members_template->members();
 477  }
 478  
 479  /**
 480   * Output the members pagination count.
 481   *
 482   * @since 1.2.0
 483   */
 484  function bp_members_pagination_count() {
 485      echo bp_get_members_pagination_count();
 486  }
 487      /**
 488       * Generate the members pagination count.
 489       *
 490       * @since 1.5.0
 491       *
 492       * @global BP_Core_Members_Template $members_template
 493       *
 494       * @return string
 495       */
 496  	function bp_get_members_pagination_count() {
 497          global $members_template;
 498  
 499          if ( empty( $members_template->type ) ) {
 500              $members_template->type = '';
 501          }
 502  
 503          $start_num = intval( ( $members_template->pag_page - 1 ) * $members_template->pag_num ) + 1;
 504          $from_num  = bp_core_number_format( $start_num );
 505          $to_num    = bp_core_number_format( ( $start_num + ( $members_template->pag_num - 1 ) > $members_template->total_member_count ) ? $members_template->total_member_count : $start_num + ( $members_template->pag_num - 1 ) );
 506          $total     = bp_core_number_format( $members_template->total_member_count );
 507  
 508          if ( 'active' == $members_template->type ) {
 509              if ( 1 == $members_template->total_member_count ) {
 510                  $pag = __( 'Viewing 1 active member', 'buddypress' );
 511              } else {
 512                  /* translators: 1: active member from number. 2: active member to number. 3: total active members. */
 513                  $pag = sprintf( _n( 'Viewing %1$s - %2$s of %3$s active member', 'Viewing %1$s - %2$s of %3$s active members', $members_template->total_member_count, 'buddypress' ), $from_num, $to_num, $total );
 514              }
 515          } elseif ( 'popular' == $members_template->type ) {
 516              if ( 1 == $members_template->total_member_count ) {
 517                  $pag = __( 'Viewing 1 member with friends', 'buddypress' );
 518              } else {
 519                  /* translators: 1: member with friends from number. 2: member with friends to number. 3: total members with friends. */
 520                  $pag = sprintf( _n( 'Viewing %1$s - %2$s of %3$s member with friends', 'Viewing %1$s - %2$s of %3$s members with friends', $members_template->total_member_count, 'buddypress' ), $from_num, $to_num, $total );
 521              }
 522          } elseif ( 'online' == $members_template->type ) {
 523              if ( 1 == $members_template->total_member_count ) {
 524                  $pag = __( 'Viewing 1 online member', 'buddypress' );
 525              } else {
 526                  /* translators: 1: online member from number. 2: online member to number. 3: total online members. */
 527                  $pag = sprintf( _n( 'Viewing %1$s - %2$s of %3$s online member', 'Viewing %1$s - %2$s of %3$s online members', $members_template->total_member_count, 'buddypress' ), $from_num, $to_num, $total );
 528              }
 529          } else {
 530              if ( 1 == $members_template->total_member_count ) {
 531                  $pag = __( 'Viewing 1 member', 'buddypress' );
 532              } else {
 533                  /* translators: 1: member from number. 2: member to number. 3: total members. */
 534                  $pag = sprintf( _n( 'Viewing %1$s - %2$s of %3$s member', 'Viewing %1$s - %2$s of %3$s members', $members_template->total_member_count, 'buddypress' ), $from_num, $to_num, $total );
 535              }
 536          }
 537  
 538          /**
 539           * Filters the members pagination count.
 540           *
 541           * @since 1.5.0
 542           *
 543           * @param string $pag Pagination count string.
 544           */
 545          return apply_filters( 'bp_members_pagination_count', $pag );
 546      }
 547  
 548  /**
 549   * Output the members pagination links.
 550   *
 551   * @since 1.2.0
 552   */
 553  function bp_members_pagination_links() {
 554      echo bp_get_members_pagination_links();
 555  }
 556      /**
 557       * Fetch the members pagination links.
 558       *
 559       * @since 1.2.0
 560       *
 561       * @global BP_Core_Members_Template $members_template
 562       *
 563       * @return string
 564       */
 565  	function bp_get_members_pagination_links() {
 566          global $members_template;
 567  
 568          /**
 569           * Filters the members pagination link.
 570           *
 571           * @since 1.2.0
 572           *
 573           * @param string $pag_links HTML markup for pagination links.
 574           */
 575          return apply_filters( 'bp_get_members_pagination_links', $members_template->pag_links );
 576      }
 577  
 578  /**
 579   * Output the ID of the current member in the loop.
 580   *
 581   * @since 1.2.0
 582   */
 583  function bp_member_user_id() {
 584      echo bp_get_member_user_id();
 585  }
 586      /**
 587       * Get the ID of the current member in the loop.
 588       *
 589       * @since 1.2.0
 590       *
 591       * @global BP_Core_Members_Template $members_template
 592       *
 593       * @return int Member ID.
 594       */
 595  	function bp_get_member_user_id() {
 596          global $members_template;
 597  
 598          $member_id = isset( $members_template->member->id )
 599              ? (int) $members_template->member->id
 600              : 0;
 601  
 602          /**
 603           * Filters the ID of the current member in the loop.
 604           *
 605           * @since 1.2.0
 606           *
 607           * @param int $member_id ID of the member being iterated over.
 608           */
 609          return apply_filters( 'bp_get_member_user_id', (int) $member_id );
 610      }
 611  
 612  /**
 613   * Output the row class of the current member in the loop.
 614   *
 615   * @since 1.7.0
 616   *
 617   * @param array $classes Array of custom classes.
 618   */
 619  function bp_member_class( $classes = array() ) {
 620      echo bp_get_member_class( $classes );
 621  }
 622      /**
 623       * Return the row class of the current member in the loop.
 624       *
 625       * @since 1.7.0
 626       *
 627       * @global BP_Core_Members_Template $members_template
 628       *
 629       * @param array $classes Array of custom classes.
 630       *
 631       * @return string Row class of the member
 632       */
 633  	function bp_get_member_class( $classes = array() ) {
 634          global $members_template;
 635  
 636          // Add even/odd classes, but only if there's more than 1 member.
 637          if ( $members_template->member_count > 1 ) {
 638              $pos_in_loop = (int) $members_template->current_member;
 639              $classes[]   = ( $pos_in_loop % 2 ) ? 'even' : 'odd';
 640  
 641              // If we've only one member in the loop, don't bother with odd and even.
 642          } else {
 643              $classes[] = 'bp-single-member';
 644          }
 645  
 646          // Maybe add 'is-online' class.
 647          if ( ! empty( $members_template->member->last_activity ) ) {
 648  
 649              // Calculate some times.
 650              $current_time  = bp_core_current_time( true, 'timestamp' );
 651              $last_activity = strtotime( $members_template->member->last_activity );
 652              $still_online  = strtotime( '+5 minutes', $last_activity );
 653  
 654              // Has the user been active recently?
 655              if ( $current_time <= $still_online ) {
 656                  $classes[] = 'is-online';
 657              }
 658          }
 659  
 660          // Add current user class.
 661          if ( bp_loggedin_user_id() === (int) $members_template->member->id ) {
 662              $classes[] = 'is-current-user';
 663          }
 664  
 665          // Add current user member types.
 666          if ( $member_types = bp_get_member_type( $members_template->member->id, false ) ) {
 667              foreach ( $member_types as $member_type ) {
 668                  $classes[] = sprintf( 'member-type-%s', esc_attr( $member_type ) );
 669              }
 670          }
 671  
 672          /**
 673           * Filters the determined classes to add to the HTML element.
 674           *
 675           * @since 1.7.0
 676           *
 677           * @param string $classes Classes to be added to the HTML element.
 678           */
 679          $classes = apply_filters( 'bp_get_member_class', $classes );
 680          $classes = array_merge( $classes, array() );
 681          $retval  = 'class="' . join( ' ', $classes ) . '"';
 682  
 683          return $retval;
 684      }
 685  
 686  /**
 687   * Output nicename of current member in the loop.
 688   *
 689   * @since 1.2.5
 690   */
 691  function bp_member_user_nicename() {
 692      echo bp_get_member_user_nicename();
 693  }
 694      /**
 695       * Get the nicename of the current member in the loop.
 696       *
 697       * @since 1.2.5
 698       *
 699       * @global BP_Core_Members_Template $members_template
 700       *
 701       * @return string Members nicename.
 702       */
 703  	function bp_get_member_user_nicename() {
 704          global $members_template;
 705  
 706          /**
 707           * Filters the nicename of the current member in the loop.
 708           *
 709           * @since 1.2.5
 710           *
 711           * @param string $user_nicename Nicename for the current member.
 712           */
 713          return apply_filters( 'bp_get_member_user_nicename', $members_template->member->user_nicename );
 714      }
 715  
 716  /**
 717   * Output login for current member in the loop.
 718   *
 719   * @since 1.2.5
 720   */
 721  function bp_member_user_login() {
 722      echo bp_get_member_user_login();
 723  }
 724      /**
 725       * Get the login of the current member in the loop.
 726       *
 727       * @since 1.2.5
 728       *
 729       * @global BP_Core_Members_Template $members_template
 730       *
 731       * @return string Member's login.
 732       */
 733  	function bp_get_member_user_login() {
 734          global $members_template;
 735  
 736          /**
 737           * Filters the login of the current member in the loop.
 738           *
 739           * @since 1.2.5
 740           *
 741           * @param string $user_login Login for the current member.
 742           */
 743          return apply_filters( 'bp_get_member_user_login', $members_template->member->user_login );
 744      }
 745  
 746  /**
 747   * Output the email address for the current member in the loop.
 748   *
 749   * @since 1.2.5
 750   */
 751  function bp_member_user_email() {
 752      echo bp_get_member_user_email();
 753  }
 754      /**
 755       * Get the email address of the current member in the loop.
 756       *
 757       * @since 1.2.5
 758       *
 759       * @global BP_Core_Members_Template $members_template
 760       *
 761       * @return string Member's email address.
 762       */
 763  	function bp_get_member_user_email() {
 764          global $members_template;
 765  
 766          /**
 767           * Filters the email address of the current member in the loop.
 768           *
 769           * @since 1.2.5
 770           *
 771           * @param string $user_email Email address for the current member.
 772           */
 773          return apply_filters( 'bp_get_member_user_email', $members_template->member->user_email );
 774      }
 775  
 776  /**
 777   * Check whether the current member in the loop is the logged-in user.
 778   *
 779   * @since 1.2.5
 780   * @since 10.0.0 Updated to get member ID from `bp_get_member_user_id`.
 781   *
 782   * @return bool
 783   */
 784  function bp_member_is_loggedin_user() {
 785  
 786      /**
 787       * Filters whether the current member in the loop is the logged-in user.
 788       *
 789       * @since 1.2.5
 790       *
 791       * @param bool $value Whether current member in the loop is logged in.
 792       */
 793      return apply_filters( 'bp_member_is_loggedin_user', ( bp_loggedin_user_id() === bp_get_member_user_id() ) );
 794  }
 795  
 796  /**
 797   * Output a member's avatar.
 798   *
 799   * @since 1.2.0
 800   *
 801   * @see bp_get_member_avatar() for description of arguments.
 802   *
 803   * @param array|string $args See {@link bp_get_member_avatar()}.
 804   */
 805  function bp_member_avatar( $args = '' ) {
 806  
 807      /**
 808       * Filters a members avatar.
 809       *
 810       * @since 1.2.0
 811       * @since 2.6.0 Added the `$args` parameter.
 812       *
 813       * @param string       $value Formatted HTML <img> element, or raw avatar URL based on $html arg.
 814       * @param array|string $args  See {@link bp_get_member_avatar()}.
 815       */
 816      echo apply_filters( 'bp_member_avatar', bp_get_member_avatar( $args ), $args );
 817  }
 818      /**
 819       * Get a member's avatar.
 820       *
 821       * @since 1.2.0
 822       *
 823       * @global BP_Core_Members_Template $members_template
 824       *
 825       * @see bp_core_fetch_avatar() For a description of arguments and
 826       *      return values.
 827       *
 828       * @param array|string $args  {
 829       *     Arguments are listed here with an explanation of their defaults.
 830       *     For more information about the arguments, see
 831       *     {@link bp_core_fetch_avatar()}.
 832       *     @type string   $alt     Default: 'Profile picture of [user name]'.
 833       *     @type string   $class   Default: 'avatar'.
 834       *     @type string   $type    Default: 'thumb'.
 835       *     @type int|bool $width   Default: false.
 836       *     @type int|bool $height  Default: false.
 837       *     @type bool     $no_grav Default: false.
 838       *     @type bool     $id      Currently unused.
 839       * }
 840       * @return string User avatar string.
 841       */
 842  	function bp_get_member_avatar( $args = '' ) {
 843          global $members_template;
 844  
 845          $fullname = ! empty( $members_template->member->fullname )
 846              ? $members_template->member->fullname
 847              : $members_template->member->display_name;
 848  
 849          $r = bp_parse_args(
 850              $args,
 851              array(
 852                  'type'    => 'thumb',
 853                  'width'   => false,
 854                  'height'  => false,
 855                  'class'   => 'avatar',
 856                  'id'      => false,
 857                  'no_grav' => false,
 858                  // translators: %s is the full name of the user.
 859                  'alt'     => sprintf( __( 'Profile picture of %s', 'buddypress' ), $fullname ),
 860              )
 861          );
 862  
 863          $avatar = bp_core_fetch_avatar(
 864              array(
 865                  'email'   => bp_get_member_user_email(),
 866                  'item_id' => bp_get_member_user_id(),
 867                  'type'    => $r['type'],
 868                  'alt'     => $r['alt'],
 869                  'no_grav' => $r['no_grav'],
 870                  'css_id'  => $r['id'],
 871                  'class'   => $r['class'],
 872                  'width'   => $r['width'],
 873                  'height'  => $r['height'],
 874              )
 875          );
 876  
 877          /**
 878           * Filters a member's avatar.
 879           *
 880           * @since 1.2.0
 881           * @since 2.6.0 Added the `$r` parameter.
 882           *
 883           * @param string $value Formatted HTML <img> element, or raw avatar URL based on $html arg.
 884           * @param array  $r     Array of parsed arguments. See {@link bp_get_member_avatar()}.
 885           */
 886          return apply_filters( 'bp_get_member_avatar', $avatar, $r );
 887      }
 888  
 889  /**
 890   * Output the permalink for the current member in the loop.
 891   *
 892   * @since 1.2.0
 893   */
 894  function bp_member_permalink() {
 895      echo esc_url( bp_get_member_permalink() );
 896  }
 897      /**
 898       * Get the permalink for the current member in the loop.
 899       *
 900       * @since 1.2.0
 901       *
 902       * @global BP_Core_Members_Template $members_template
 903       *
 904       * @return string
 905       */
 906  	function bp_get_member_permalink() {
 907          global $members_template;
 908  
 909          $permalink = bp_core_get_user_domain(
 910              $members_template->member->id,
 911              $members_template->member->user_nicename,
 912              $members_template->member->user_login
 913          );
 914  
 915          /**
 916           * Filters the permalink for the current member in the loop.
 917           *
 918           * @since 1.2.0
 919           *
 920           * @param string $permalink Permalink for the current member in the loop.
 921           */
 922          return apply_filters( 'bp_get_member_permalink', $permalink );
 923      }
 924  
 925      /**
 926       * Alias of {@link bp_member_permalink()}.
 927       *
 928       * @since 1.2.0
 929       */
 930  	function bp_member_link() {
 931          echo esc_url( bp_get_member_permalink() );
 932      }
 933  
 934      /**
 935       * Alias of {@link bp_get_member_permalink()}.
 936       *
 937       * @since 1.2.0
 938       */
 939  	function bp_get_member_link() {
 940          return bp_get_member_permalink();
 941      }
 942  
 943  /**
 944   * Output display name of current member in the loop.
 945   *
 946   * @since 1.2.0
 947   */
 948  function bp_member_name() {
 949  
 950      /**
 951       * Filters the display name of current member in the loop.
 952       *
 953       * @since 1.2.0
 954       *
 955       * @param string $value Display name for current member.
 956       */
 957      echo apply_filters( 'bp_member_name', bp_get_member_name() );
 958  }
 959      /**
 960       * Get the display name of the current member in the loop.
 961       *
 962       * Full name is, by default, pulled from xprofile's Full Name field.
 963       * When this field is empty, we try to get an alternative name from the
 964       * WP users table, in the following order of preference: display_name,
 965       * user_nicename, user_login.
 966       *
 967       * @since 1.2.0
 968       *
 969       * @global BP_Core_Members_Template $members_template
 970       *
 971       * @return string The user's fullname for display.
 972       */
 973  	function bp_get_member_name() {
 974          global $members_template;
 975  
 976          // Generally, this only fires when xprofile is disabled.
 977          if ( empty( $members_template->member->fullname ) ) {
 978              // Our order of preference for alternative fullnames.
 979              $name_stack = array(
 980                  'display_name',
 981                  'user_nicename',
 982                  'user_login'
 983              );
 984  
 985              foreach ( $name_stack as $source ) {
 986                  if ( ! empty( $members_template->member->{$source} ) ) {
 987                      // When a value is found, set it as fullname and be done with it.
 988                      $members_template->member->fullname = $members_template->member->{$source};
 989                      break;
 990                  }
 991              }
 992          }
 993  
 994          /**
 995           * Filters the display name of current member in the loop.
 996           *
 997           * @since 1.2.0
 998           *
 999           * @param string $fullname Display name for current member.
1000           */
1001          return apply_filters( 'bp_get_member_name', $members_template->member->fullname );
1002      }
1003      add_filter( 'bp_get_member_name', 'wp_filter_kses' );
1004      add_filter( 'bp_get_member_name', 'stripslashes'   );
1005      add_filter( 'bp_get_member_name', 'strip_tags'     );
1006      add_filter( 'bp_get_member_name', 'esc_html'       );
1007  
1008  /**
1009   * Output the current member's last active time.
1010   *
1011   * @since 1.2.0
1012   *
1013   * @param array $args {@see bp_get_member_last_active()}.
1014   */
1015  function bp_member_last_active( $args = array() ) {
1016      echo bp_get_member_last_active( $args );
1017  }
1018      /**
1019       * Return the current member's last active time.
1020       *
1021       * @since 1.2.0
1022       * @since 2.7.0 Added 'relative' as a parameter to $args.
1023       *
1024       * @global BP_Core_Members_Template $members_template
1025       *
1026       * @param array $args {
1027       *     Array of optional arguments.
1028       *     @type mixed $active_format If true, formatted "active 5 minutes ago". If false, formatted "5 minutes
1029       *                                ago". If string, should be sprintf'able like 'last seen %s ago'.
1030       *     @type bool  $relative      If true, will return relative time "5 minutes ago". If false, will return
1031       *                                date from database. Default: true.
1032       * }
1033       * @return string
1034       */
1035  	function bp_get_member_last_active( $args = array() ) {
1036          global $members_template;
1037  
1038          // Parse the activity format.
1039          $r = bp_parse_args(
1040              $args,
1041              array(
1042                  'active_format' => true,
1043                  'relative'      => true,
1044              )
1045          );
1046  
1047          // Backwards compatibility for anyone forcing a 'true' active_format.
1048          if ( true === $r['active_format'] ) {
1049              /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
1050              $r['active_format'] = __( 'Active %s', 'buddypress' );
1051          }
1052  
1053          // Member has logged in at least one time.
1054          if ( isset( $members_template->member->last_activity ) ) {
1055              // We do not want relative time, so return now.
1056              // @todo Should the 'bp_member_last_active' filter be applied here?
1057              if ( ! $r['relative'] ) {
1058                  return esc_attr( $members_template->member->last_activity );
1059              }
1060  
1061              // Backwards compatibility for pre 1.5 'ago' strings.
1062              $last_activity = ! empty( $r['active_format'] )
1063                  ? bp_core_get_last_activity( $members_template->member->last_activity, $r['active_format'] )
1064                  : bp_core_time_since( $members_template->member->last_activity );
1065  
1066          // Member has never logged in or been active.
1067          } else {
1068              $last_activity = __( 'Never active', 'buddypress' );
1069          }
1070  
1071          /**
1072           * Filters the current members last active time.
1073           *
1074           * @since 1.2.0
1075           *
1076           * @param string $last_activity Formatted time since last activity.
1077           * @param array  $r             Array of parsed arguments for query.
1078           */
1079          return apply_filters( 'bp_member_last_active', $last_activity, $r );
1080      }
1081  
1082  /**
1083   * Output the latest update of the current member in the loop.
1084   *
1085   * @since 1.2.0
1086   *
1087   * @param array|string $args {@see bp_get_member_latest_update()}.
1088   */
1089  function bp_member_latest_update( $args = '' ) {
1090      echo bp_get_member_latest_update( $args );
1091  }
1092      /**
1093       * Get the latest update from the current member in the loop.
1094       *
1095       * @since 1.2.0
1096       *
1097       * @global BP_Core_Members_Template $members_template
1098       *
1099       * @param array|string $args {
1100       *     Array of optional arguments.
1101       *     @type int  $length    Truncation length. Default: 225.
1102       *     @type bool $view_link Whether to provide a 'View' link for
1103       *                           truncated entries. Default: false.
1104       * }
1105       * @return string
1106       */
1107  	function bp_get_member_latest_update( $args = '' ) {
1108          global $members_template;
1109  
1110          $defaults = array(
1111              'length'    => 225,
1112              'view_link' => true,
1113          );
1114  
1115          $r = bp_parse_args(
1116              $args,
1117              $defaults
1118          );
1119  
1120          extract( $r );
1121  
1122          if ( !bp_is_active( 'activity' ) || empty( $members_template->member->latest_update ) || !$update = maybe_unserialize( $members_template->member->latest_update ) )
1123              return false;
1124  
1125          /**
1126           * Filters the excerpt of the latest update for current member in the loop.
1127           *
1128           * @since 1.2.5
1129           * @since 2.6.0 Added the `$r` parameter.
1130           *
1131           * @param string $value Excerpt of the latest update for current member in the loop.
1132           * @param array  $r     Array of parsed arguments.
1133           */
1134          $update_content = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], $length ) ) ), $r );
1135  
1136          /* translators: %s: the member latest activity update */
1137          $update_content = sprintf( _x( '- &quot;%s&quot;', 'member latest update in member directory', 'buddypress' ), $update_content );
1138  
1139          // If $view_link is true and the text returned by bp_create_excerpt() is different from the original text (ie it's
1140          // been truncated), add the "View" link.
1141          if ( $view_link && ( $update_content != $update['content'] ) ) {
1142              $view = __( 'View', 'buddypress' );
1143  
1144              $update_content .= '<span class="activity-read-more"><a href="' . bp_activity_get_permalink( $update['id'] ) . '" rel="nofollow">' . $view . '</a></span>';
1145          }
1146  
1147          /**
1148           * Filters the latest update from the current member in the loop.
1149           *
1150           * @since 1.2.0
1151           * @since 2.6.0 Added the `$r` parameter.
1152           *
1153           * @param string $update_content Formatted latest update for current member.
1154           * @param array  $r              Array of parsed arguments.
1155           */
1156          return apply_filters( 'bp_get_member_latest_update', $update_content, $r );
1157      }
1158  
1159  /**
1160   * Output a piece of user profile data.
1161   *
1162   * @since 1.2.0
1163   *
1164   * @see bp_get_member_profile_data() for a description of params.
1165   *
1166   * @param array|string $args See {@link bp_get_member_profile_data()}.
1167   */
1168  function bp_member_profile_data( $args = '' ) {
1169      echo bp_get_member_profile_data( $args );
1170  }
1171      /**
1172       * Get a piece of user profile data.
1173       *
1174       * When used in a bp_has_members() loop, this function will attempt
1175       * to fetch profile data cached in the template global. It is also safe
1176       * to use outside of the loop.
1177       *
1178       * @since 1.2.0
1179       *
1180       * @global BP_Core_Members_Template $members_template
1181       *
1182       * @param array|string $args {
1183       *     Array of config parameters.
1184       *     @type string $field   Name of the profile field.
1185       *     @type int    $user_id ID of the user whose data is being fetched.
1186       *                           Defaults to the current member in the loop, or if not
1187       *                           present, to the currently displayed user.
1188       * }
1189       * @return string|bool Profile data if found, otherwise false.
1190       */
1191  	function bp_get_member_profile_data( $args = '' ) {
1192          global $members_template;
1193  
1194          if ( ! bp_is_active( 'xprofile' ) ) {
1195              return false;
1196          }
1197  
1198          // Declare local variables.
1199          $data = false;
1200  
1201          // Guess at default $user_id.
1202          $default_user_id = 0;
1203          if ( ! empty( $members_template->member->id ) ) {
1204              $default_user_id = $members_template->member->id;
1205          } elseif ( bp_displayed_user_id() ) {
1206              $default_user_id = bp_displayed_user_id();
1207          }
1208  
1209          $defaults = array(
1210              'field'   => false,
1211              'user_id' => $default_user_id,
1212          );
1213  
1214          $r = bp_parse_args(
1215              $args,
1216              $defaults
1217          );
1218  
1219          // If we're in a members loop, get the data from the global.
1220          if ( ! empty( $members_template->member->profile_data ) ) {
1221              $profile_data = $members_template->member->profile_data;
1222          }
1223  
1224          // Otherwise query for the data.
1225          if ( empty( $profile_data ) && method_exists( 'BP_XProfile_ProfileData', 'get_all_for_user' ) ) {
1226              $profile_data = BP_XProfile_ProfileData::get_all_for_user( $r['user_id'] );
1227          }
1228  
1229          // If we're in the members loop, but the profile data has not
1230          // been loaded into the global, cache it there for later use.
1231          if ( ! empty( $members_template->member ) && empty( $members_template->member->profile_data ) ) {
1232              $members_template->member->profile_data = $profile_data;
1233          }
1234  
1235          // Get the data for the specific field requested.
1236          if ( ! empty( $profile_data ) && ! empty( $profile_data[ $r['field'] ]['field_type'] ) && ! empty( $profile_data[ $r['field'] ]['field_data'] ) ) {
1237              $data = xprofile_format_profile_field( $profile_data[ $r['field'] ]['field_type'], $profile_data[ $r['field'] ]['field_data'] );
1238          }
1239  
1240          /**
1241           * Filters resulting piece of member profile data.
1242           *
1243           * @since 1.2.0
1244           * @since 2.6.0 Added the `$r` parameter.
1245           *
1246           * @param string|bool $data Profile data if found, otherwise false.
1247           * @param array       $r    Array of parsed arguments.
1248           */
1249          $data = apply_filters( 'bp_get_member_profile_data', $data, $r );
1250  
1251          /**
1252           * Filters the resulting piece of member profile data by field type.
1253           *
1254           * This is a dynamic filter based on field type of the current field requested.
1255           *
1256           * @since 2.7.0
1257           *
1258           * @param string|bool $data Profile data if found, otherwise false.
1259           * @param array       $r    Array of parsed arguments.
1260           */
1261          if ( ! empty( $profile_data[ $r['field'] ]['field_type'] ) ) {
1262              $data = apply_filters( 'bp_get_member_profile_data_' . $profile_data[ $r['field'] ]['field_type'], $data, $r );
1263          }
1264  
1265          return $data;
1266      }
1267  
1268  /**
1269   * Output the 'registered [x days ago]' string for the current member.
1270   *
1271   * @since 1.2.0
1272   * @since 2.7.0 Added $args as a parameter.
1273   *
1274   * @param array $args Optional. {@see bp_get_member_registered()}.
1275   */
1276  function bp_member_registered( $args = array() ) {
1277      echo bp_get_member_registered( $args );
1278  }
1279      /**
1280       * Get the 'registered [x days ago]' string for the current member.
1281       *
1282       * @since 1.2.0
1283       * @since 2.7.0 Added `$args` as a parameter.
1284       *
1285       * @global BP_Core_Members_Template $members_template
1286       *
1287       * @param array $args {
1288       *     Array of optional parameters.
1289       *     @type bool $relative Optional. If true, returns relative registered date. eg. registered 5 months ago.
1290       *                          If false, returns registered date value from database.
1291       * }
1292       * @return string
1293       */
1294  	function bp_get_member_registered( $args = array() ) {
1295          global $members_template;
1296  
1297          $r = bp_parse_args(
1298              $args,
1299              array(
1300                  'relative' => true,
1301              )
1302          );
1303  
1304          // We do not want relative time, so return now.
1305          // @todo Should the 'bp_member_registered' filter be applied here?
1306          if ( ! $r['relative'] ) {
1307              return esc_attr( $members_template->member->user_registered );
1308          }
1309  
1310          /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */
1311          $registered = esc_attr( bp_core_get_last_activity( $members_template->member->user_registered, _x( 'registered %s', 'Records the timestamp that the user registered into the activity stream', 'buddypress' ) ) );
1312  
1313          /**
1314           * Filters the 'registered [x days ago]' string for the current member.
1315           *
1316           * @since 2.1.0
1317           *
1318           * @param string $registered The 'registered [x days ago]' string.
1319           * @param array  $r          Array of parsed arguments.
1320           */
1321          return apply_filters( 'bp_member_registered', $registered, $r );
1322      }
1323  
1324  /**
1325   * Output a random piece of profile data for the current member in the loop.
1326   *
1327   * @since 1.2.0
1328   * @since 10.0.0 Updated to get member ID using `bp_get_member_user_id`.
1329   */
1330  function bp_member_random_profile_data() {
1331      if ( bp_is_active( 'xprofile' ) ) { ?>
1332          <?php $random_data = xprofile_get_random_profile_data( bp_get_member_user_id(), true ); ?>
1333              <strong><?php echo wp_filter_kses( $random_data[0]->name ) ?></strong>
1334              <?php echo wp_filter_kses( $random_data[0]->value ) ?>
1335      <?php }
1336  }
1337  
1338  /**
1339   * Output hidden input for preserving member search params on form submit.
1340   *
1341   * @since 1.2.0
1342   */
1343  function bp_member_hidden_fields() {
1344      $query_arg = bp_core_get_component_search_query_arg( 'members' );
1345  
1346      if ( isset( $_REQUEST[ $query_arg ] ) ) {
1347          echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST[ $query_arg ] ) . '" name="search_terms" />';
1348      }
1349  
1350      if ( isset( $_REQUEST['letter'] ) ) {
1351          echo '<input type="hidden" id="selected_letter" value="' . esc_attr( $_REQUEST['letter'] ) . '" name="selected_letter" />';
1352      }
1353  
1354      if ( isset( $_REQUEST['members_search'] ) ) {
1355          echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['members_search'] ) . '" name="search_terms" />';
1356      }
1357  }
1358  
1359  /**
1360   * Output the Members directory search form.
1361   *
1362   * @since 1.0.0
1363   */
1364  function bp_directory_members_search_form() {
1365  
1366      $query_arg = bp_core_get_component_search_query_arg( 'members' );
1367  
1368      if ( ! empty( $_REQUEST[ $query_arg ] ) ) {
1369          $search_value = stripslashes( $_REQUEST[ $query_arg ] );
1370      } else {
1371          $search_value = bp_get_search_default_text( 'members' );
1372      }
1373  
1374      $search_form_html = '<form action="" method="get" id="search-members-form">
1375          <label for="members_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="members_search" placeholder="'. esc_attr( $search_value ) .'" /></label>
1376          <input type="submit" id="members_search_submit" name="members_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />
1377      </form>';
1378  
1379      /**
1380       * Filters the Members component search form.
1381       *
1382       * @since 1.9.0
1383       *
1384       * @param string $search_form_html HTML markup for the member search form.
1385       */
1386      echo apply_filters( 'bp_directory_members_search_form', $search_form_html );
1387  }
1388  
1389  /**
1390   * Output the total member count.
1391   *
1392   * @since 1.2.0
1393   */
1394  function bp_total_site_member_count() {
1395      echo bp_get_total_site_member_count();
1396  }
1397      /**
1398       * Get the total site member count.
1399       *
1400       * @since 1.2.0
1401       *
1402       * @return string
1403       */
1404  	function bp_get_total_site_member_count() {
1405  
1406          /**
1407           * Filters the total site member count.
1408           *
1409           * @since 1.2.0
1410           *
1411           * @param string $value Number-formatted total site member count.
1412           */
1413          return apply_filters( 'bp_get_total_site_member_count', bp_core_number_format( bp_core_get_total_member_count() ) );
1414      }
1415  
1416  /** Navigation and other misc template tags ***********************************/
1417  
1418  /**
1419   * Render the navigation markup for the logged-in user.
1420   *
1421   * Each component adds to this navigation array within its own
1422   * [component_name]setup_nav() function.
1423   *
1424   * This navigation array is the top level navigation, so it contains items such as:
1425   *      [Blog, Profile, Messages, Groups, Friends] ...
1426   *
1427   * The function will also analyze the current component the user is in, to
1428   * determine whether or not to highlight a particular nav item.
1429   *
1430   * @since 1.1.0
1431   *
1432   * @global BuddyPress $bp The one true BuddyPress instance.
1433   *
1434   * @todo Move to a back-compat file?
1435   * @deprecated Does not seem to be called anywhere in BP core.
1436   */
1437  function bp_get_loggedin_user_nav() {
1438      $bp = buddypress();
1439  
1440      // Loop through each navigation item.
1441      foreach ( (array) $bp->members->nav->get_primary() as $nav_item ) {
1442  
1443          $selected = '';
1444  
1445          // If the current component matches the nav item id, then add a highlight CSS class.
1446          if ( ! bp_is_directory() && ! empty( $bp->active_components[ bp_current_component() ] ) && $bp->active_components[ bp_current_component() ] == $nav_item->css_id ) {
1447              $selected = ' class="current selected"';
1448          }
1449  
1450          // If we are viewing another person (current_userid does not equal
1451          // loggedin_user->id then check to see if the two users are friends.
1452          // if they are, add a highlight CSS class to the friends nav item
1453          // if it exists.
1454          if ( !bp_is_my_profile() && bp_displayed_user_id() ) {
1455              $selected = '';
1456  
1457              if ( bp_is_active( 'friends' ) ) {
1458                  if ( $nav_item->css_id == $bp->friends->id ) {
1459                      if ( friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() ) ) {
1460                          $selected = ' class="current selected"';
1461                      }
1462                  }
1463              }
1464          }
1465  
1466          // Echo out the final list item.
1467          echo apply_filters_ref_array( 'bp_get_loggedin_user_nav_' . $nav_item->css_id, array( '<li id="li-nav-' . $nav_item->css_id . '" ' . $selected . '><a id="my-' . $nav_item->css_id . '" href="' . $nav_item->link . '">' . $nav_item->name . '</a></li>', &$nav_item ) );
1468      }
1469  
1470      // Always add a log out list item to the end of the navigation.
1471      $logout_link = '<li><a id="wp-logout" href="' .  wp_logout_url( bp_get_root_domain() ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
1472  
1473      echo apply_filters( 'bp_logout_nav_link', $logout_link );
1474  }
1475  
1476  /**
1477   * Output the contents of the current user's home page.
1478   *
1479   * @since 2.6.0
1480   */
1481  function bp_displayed_user_front_template_part() {
1482      $located = bp_displayed_user_get_front_template();
1483  
1484      if ( false !== $located ) {
1485          $slug = str_replace( '.php', '', $located );
1486          $name = null;
1487  
1488          /**
1489           * Let plugins adding an action to bp_get_template_part get it from here
1490           *
1491           * @param string $slug Template part slug requested.
1492           * @param string $name Template part name requested.
1493           */
1494          do_action( 'get_template_part_' . $slug, $slug, $name );
1495  
1496          load_template( $located, true );
1497      }
1498  
1499      return $located;
1500  }
1501  
1502  /**
1503   * Locate a custom user front template if it exists.
1504   *
1505   * @since 2.6.0
1506   *
1507   * @param  object|null $displayed_user Optional. Falls back to current user if not passed.
1508   * @return string|bool                 Path to front template on success; boolean false on failure.
1509   */
1510  function bp_displayed_user_get_front_template( $displayed_user = null ) {
1511      if ( ! is_object( $displayed_user ) || empty( $displayed_user->id ) ) {
1512          $displayed_user = bp_get_displayed_user();
1513      }
1514  
1515      if ( ! isset( $displayed_user->id ) ) {
1516          return false;
1517      }
1518  
1519      if ( isset( $displayed_user->front_template ) ) {
1520          return $displayed_user->front_template;
1521      }
1522  
1523      // Init the hierarchy.
1524      $template_names = array(
1525          'members/single/front-id-' . (int) $displayed_user->id . '.php',
1526          'members/single/front-nicename-' . sanitize_file_name( $displayed_user->userdata->user_nicename ) . '.php',
1527      );
1528  
1529      /**
1530       * Check for member types and add it to the hierarchy
1531       *
1532       * Make sure to register your member
1533       * type using the hook 'bp_register_member_types'
1534       */
1535      if ( bp_get_member_types() ) {
1536          $displayed_user_member_type = bp_get_member_type( $displayed_user->id );
1537          if ( ! $displayed_user_member_type ) {
1538              $displayed_user_member_type = 'none';
1539          }
1540  
1541          $template_names[] = 'members/single/front-member-type-' . sanitize_file_name( $displayed_user_member_type ) . '.php';
1542      }
1543  
1544      // Add The generic template to the end of the hierarchy.
1545      $template_names[] = 'members/single/front.php';
1546  
1547      /**
1548       * Filters the hierarchy of user front templates corresponding to a specific user.
1549       *
1550       * @since 2.6.0
1551       *
1552       * @param array $template_names Array of template paths.
1553       */
1554      $template_names = apply_filters( 'bp_displayed_user_get_front_template', $template_names );
1555  
1556      return bp_locate_template( $template_names, false, true );
1557  }
1558  
1559  /**
1560   * Check if the displayed user has a custom front template.
1561   *
1562   * @since 2.6.0
1563   */
1564  function bp_displayed_user_has_front_template() {
1565      $displayed_user = bp_get_displayed_user();
1566  
1567      return ! empty( $displayed_user->front_template );
1568  }
1569  
1570  /**
1571   * Render the navigation markup for the displayed user.
1572   *
1573   * @since 1.1.0
1574   *
1575   * @global BuddyPress $bp The one true BuddyPress instance.
1576   */
1577  function bp_get_displayed_user_nav() {
1578      $bp = buddypress();
1579  
1580      foreach ( $bp->members->nav->get_primary() as $user_nav_item ) {
1581          if ( empty( $user_nav_item->show_for_displayed_user ) && ! bp_is_my_profile() ) {
1582              continue;
1583          }
1584  
1585          $selected = '';
1586          if ( bp_is_current_component( $user_nav_item->slug ) ) {
1587              $selected = ' class="current selected"';
1588          }
1589  
1590          if ( bp_loggedin_user_domain() ) {
1591              $link = str_replace( bp_loggedin_user_domain(), bp_displayed_user_domain(), $user_nav_item->link );
1592          } else {
1593              $link = trailingslashit( bp_displayed_user_domain() . $user_nav_item->link );
1594          }
1595  
1596          /**
1597           * Filters the navigation markup for the displayed user.
1598           *
1599           * This is a dynamic filter that is dependent on the navigation tab component being rendered.
1600           *
1601           * @since 1.1.0
1602           *
1603           * @param string $value         Markup for the tab list item including link.
1604           * @param array  $user_nav_item Array holding parts used to construct tab list item.
1605           *                              Passed by reference.
1606           */
1607          echo apply_filters_ref_array( 'bp_get_displayed_user_nav_' . $user_nav_item->css_id, array( '<li id="' . $user_nav_item->css_id . '-personal-li" ' . $selected . '><a id="user-' . $user_nav_item->css_id . '" href="' . $link . '">' . $user_nav_item->name . '</a></li>', &$user_nav_item ) );
1608      }
1609  }
1610  
1611  /** Cover image ***************************************************************/
1612  
1613  /**
1614   * Should we use the cover image header
1615   *
1616   * @since 2.4.0
1617   *
1618   * @return bool True if the displayed user has a cover image,
1619   *              False otherwise
1620   */
1621  function bp_displayed_user_use_cover_image_header() {
1622      return (bool) bp_is_active( 'members', 'cover_image' ) && ! bp_disable_cover_image_uploads();
1623  }
1624  
1625  /** Avatars *******************************************************************/
1626  
1627  /**
1628   * Output the logged-in user's avatar.
1629   *
1630   * @since 1.1.0
1631   *
1632   * @see bp_get_loggedin_user_avatar() for a description of params.
1633   *
1634   * @param array|string $args {@see bp_get_loggedin_user_avatar()}.
1635   */
1636  function bp_loggedin_user_avatar( $args = '' ) {
1637      echo bp_get_loggedin_user_avatar( $args );
1638  }
1639      /**
1640       * Get the logged-in user's avatar.
1641       *
1642       * @since 1.1.0
1643       *
1644       * @see bp_core_fetch_avatar() For a description of arguments and
1645       *      return values.
1646       *
1647       * @param array|string $args  {
1648       *     Arguments are listed here with an explanation of their defaults.
1649       *     For more information about the arguments, see
1650       *     {@link bp_core_fetch_avatar()}.
1651       *     @type string   $alt    Default: 'Profile picture of [user name]'.
1652       *     @type bool     $html   Default: true.
1653       *     @type string   $type   Default: 'thumb'.
1654       *     @type int|bool $width  Default: false.
1655       *     @type int|bool $height Default: false.
1656       * }
1657       * @return string User avatar string.
1658       */
1659  	function bp_get_loggedin_user_avatar( $args = '' ) {
1660  
1661          $r = bp_parse_args(
1662              $args,
1663              array(
1664                  'item_id' => bp_loggedin_user_id(),
1665                  'type'    => 'thumb',
1666                  'width'   => false,
1667                  'height'  => false,
1668                  'html'    => true,
1669                  'alt'     => sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_get_loggedin_user_fullname() )
1670              )
1671          );
1672  
1673          /**
1674           * Filters the logged in user's avatar.
1675           *
1676           * @since 1.1.0
1677           *
1678           * @param string $value User avatar string.
1679           * @param array  $r     Array of parsed arguments.
1680           * @param array  $args  Array of initial arguments.
1681           */
1682          return apply_filters( 'bp_get_loggedin_user_avatar', bp_core_fetch_avatar( $r ), $r, $args );
1683      }
1684  
1685  /**
1686   * Output the displayed user's avatar.
1687   *
1688   * @since 1.1.0
1689   *
1690   * @see bp_get_displayed_user_avatar() for a description of params.
1691   *
1692   * @param array|string $args {@see bp_get_displayed_user_avatar()}.
1693   */
1694  function bp_displayed_user_avatar( $args = '' ) {
1695      echo bp_get_displayed_user_avatar( $args );
1696  }
1697      /**
1698       * Get the displayed user's avatar.
1699       *
1700       * @since 1.1.0
1701       *
1702       * @see bp_core_fetch_avatar() For a description of arguments and
1703       *      return values.
1704       *
1705       * @param array|string $args  {
1706       *     Arguments are listed here with an explanation of their defaults.
1707       *     For more information about the arguments, see
1708       *     {@link bp_core_fetch_avatar()}.
1709       *     @type string   $alt    Default: 'Profile picture of [user name]'.
1710       *     @type bool     $html   Default: true.
1711       *     @type string   $type   Default: 'thumb'.
1712       *     @type int|bool $width  Default: false.
1713       *     @type int|bool $height Default: false.
1714       * }
1715       * @return string User avatar string.
1716       */
1717  	function bp_get_displayed_user_avatar( $args = '' ) {
1718  
1719          $r = bp_parse_args(
1720              $args,
1721              array(
1722                  'item_id' => bp_displayed_user_id(),
1723                  'type'    => 'thumb',
1724                  'width'   => false,
1725                  'height'  => false,
1726                  'html'    => true,
1727                  'alt'     => sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_get_displayed_user_fullname() )
1728              )
1729          );
1730  
1731          /**
1732           * Filters the displayed user's avatar.
1733           *
1734           * @since 1.1.0
1735           *
1736           * @param string $value User avatar string.
1737           * @param array  $r     Array of parsed arguments.
1738           * @param array  $args  Array of initial arguments.
1739           */
1740          return apply_filters( 'bp_get_displayed_user_avatar', bp_core_fetch_avatar( $r ), $r, $args );
1741      }
1742  
1743  /**
1744   * Output the email address of the displayed user.
1745   *
1746   * @since 1.5.0
1747   */
1748  function bp_displayed_user_email() {
1749      echo bp_get_displayed_user_email();
1750  }
1751      /**
1752       * Get the email address of the displayed user.
1753       *
1754       * @since 1.5.0
1755       *
1756       * @global BuddyPress $bp The one true BuddyPress instance.
1757       *
1758       * @return string
1759       */
1760  	function bp_get_displayed_user_email() {
1761          $bp = buddypress();
1762  
1763          // If displayed user exists, return email address.
1764          if ( isset( $bp->displayed_user->userdata->user_email ) ) {
1765              $retval = $bp->displayed_user->userdata->user_email;
1766          } else {
1767              $retval = '';
1768          }
1769  
1770          /**
1771           * Filters the email address of the displayed user.
1772           *
1773           * @since 1.5.0
1774           *
1775           * @param string $retval Email address for displayed user.
1776           */
1777          return apply_filters( 'bp_get_displayed_user_email', esc_attr( $retval ) );
1778      }
1779  
1780  /**
1781   * Output the "active [x days ago]" string for a user.
1782   *
1783   * @since 1.0.0
1784   *
1785   * @see bp_get_last_activity() for a description of parameters.
1786   *
1787   * @param int $user_id See {@link bp_get_last_activity()}.
1788   */
1789  function bp_last_activity( $user_id = 0 ) {
1790      echo bp_get_last_activity( $user_id );
1791  }
1792      /**
1793       * Get the "active [x days ago]" string for a user.
1794       *
1795       * @since 1.5.0
1796       *
1797       * @param int $user_id ID of the user. Default: displayed user ID.
1798       * @return string
1799       */
1800  	function bp_get_last_activity( $user_id = 0 ) {
1801  
1802          if ( empty( $user_id ) ) {
1803              $user_id = bp_displayed_user_id();
1804          }
1805  
1806          /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
1807          $last_activity = bp_core_get_last_activity( bp_get_user_last_activity( $user_id ), __( 'Active %s', 'buddypress') );
1808  
1809          /**
1810           * Filters the 'active [x days ago]' string for a user.
1811           *
1812           * @since 1.5.0
1813           * @since 2.6.0 Added the `$user_id` parameter.
1814           *
1815           * @param string $value   Formatted 'active [x days ago]' string.
1816           * @param int    $user_id ID of the user.
1817           */
1818          return apply_filters( 'bp_get_last_activity', $last_activity, $user_id );
1819      }
1820  
1821  /**
1822   * Output the calculated first name of the displayed or logged-in user.
1823   *
1824   * @since 1.2.0
1825   */
1826  function bp_user_firstname() {
1827      echo bp_get_user_firstname();
1828  }
1829      /**
1830       * Output the first name of a user.
1831       *
1832       * Simply takes all the characters before the first space in a name.
1833       *
1834       * @since 1.2.0
1835       *
1836       * @param string|bool $name Full name to use when generating first name.
1837       *                          Defaults to displayed user's first name, or to
1838       *                          logged-in user's first name if it's unavailable.
1839       * @return string
1840       */
1841  	function bp_get_user_firstname( $name = false ) {
1842  
1843          // Try to get displayed user.
1844          if ( empty( $name ) ) {
1845              $name = bp_get_displayed_user_fullname();
1846          }
1847  
1848          // Fall back on logged in user.
1849          if ( empty( $name ) ) {
1850              $name = bp_get_loggedin_user_fullname();
1851          }
1852  
1853          $fullname = (array) explode( ' ', $name );
1854  
1855          /**
1856           * Filters the first name of a user.
1857           *
1858           * @since 1.2.0
1859           *
1860           * @param string $value    First name of user.
1861           * @param string $fullname Full name of user.
1862           */
1863          return apply_filters( 'bp_get_user_firstname', $fullname[0], $fullname );
1864      }
1865  
1866  /**
1867   * Output the link for the logged-in user's profile.
1868   *
1869   * @since 1.2.4
1870   */
1871  function bp_loggedin_user_link() {
1872      echo esc_url( bp_get_loggedin_user_link() );
1873  }
1874      /**
1875       * Get the link for the logged-in user's profile.
1876       *
1877       * @since 1.0.0
1878       *
1879       * @return string
1880       */
1881  	function bp_get_loggedin_user_link() {
1882  
1883          /**
1884           * Filters the link for the logged-in user's profile.
1885           *
1886           * @since 1.2.4
1887           *
1888           * @param string $value Link for the logged-in user's profile.
1889           */
1890          return apply_filters( 'bp_get_loggedin_user_link', bp_loggedin_user_domain() );
1891      }
1892  
1893  /**
1894   * Output the link for the displayed user's profile.
1895   *
1896   * @since 1.2.4
1897   */
1898  function bp_displayed_user_link() {
1899      echo esc_url( bp_get_displayed_user_link() );
1900  }
1901      /**
1902       * Get the link for the displayed user's profile.
1903       *
1904       * @since 1.0.0
1905       *
1906       * @return string
1907       */
1908  	function bp_get_displayed_user_link() {
1909  
1910          /**
1911           * Filters the link for the displayed user's profile.
1912           *
1913           * @since 1.2.4
1914           *
1915           * @param string $value Link for the displayed user's profile.
1916           */
1917          return apply_filters( 'bp_get_displayed_user_link', bp_displayed_user_domain() );
1918      }
1919  
1920      /**
1921       * Alias of {@link bp_displayed_user_domain()}.
1922       *
1923       * @deprecated
1924       */
1925  	function bp_user_link() {
1926          bp_displayed_user_domain();
1927      }
1928  
1929  /**
1930   * Alias of {@link bp_displayed_user_id()}.
1931   *
1932   * @since 1.0.0
1933   */
1934  function bp_current_user_id() {
1935      return bp_displayed_user_id();
1936  }
1937  
1938  /**
1939   * Generate the link for the displayed user's profile.
1940   *
1941   * @since 1.0.0
1942   *
1943   * @global BuddyPress $bp The one true BuddyPress instance.
1944   *
1945   * @return string
1946   */
1947  function bp_displayed_user_domain() {
1948      $bp = buddypress();
1949  
1950      /**
1951       * Filters the generated link for the displayed user's profile.
1952       *
1953       * @since 1.0.0
1954       *
1955       * @param string $value Generated link for the displayed user's profile.
1956       */
1957      return apply_filters( 'bp_displayed_user_domain', isset( $bp->displayed_user->domain ) ? $bp->displayed_user->domain : '' );
1958  }
1959  
1960  /**
1961   * Generate the link for the logged-in user's profile.
1962   *
1963   * @since 1.0.0
1964   *
1965   * @global BuddyPress $bp The one true BuddyPress instance.
1966   *
1967   * @return string
1968   */
1969  function bp_loggedin_user_domain() {
1970      $bp = buddypress();
1971  
1972      /**
1973       * Filters the generated link for the logged-in user's profile.
1974       *
1975       * @since 1.0.0
1976       *
1977       * @param string $value Generated link for the logged-in user's profile.
1978       */
1979      return apply_filters( 'bp_loggedin_user_domain', isset( $bp->loggedin_user->domain ) ? $bp->loggedin_user->domain : '' );
1980  }
1981  
1982  /**
1983   * Output the displayed user's display name.
1984   *
1985   * @since 1.0.0
1986   */
1987  function bp_displayed_user_fullname() {
1988      echo bp_get_displayed_user_fullname();
1989  }
1990      /**
1991       * Get the displayed user's display name.
1992       *
1993       * @since 1.2.0
1994       *
1995       * @global BuddyPress $bp The one true BuddyPress instance.
1996       *
1997       * @return string
1998       */
1999  	function bp_get_displayed_user_fullname() {
2000          $bp = buddypress();
2001  
2002          /**
2003           * Filters the displayed user's display name.
2004           *
2005           * @since 1.2.0
2006           *
2007           * @param string $value Displayed user's display name.
2008           */
2009          return apply_filters( 'bp_displayed_user_fullname', isset( $bp->displayed_user->fullname ) ? $bp->displayed_user->fullname : '' );
2010      }
2011  
2012      /**
2013       * Alias of {@link bp_get_displayed_user_fullname()}.
2014       *
2015       * @since 1.0.0
2016       */
2017  	function bp_user_fullname() { echo bp_get_displayed_user_fullname(); }
2018  
2019  
2020  /**
2021   * Output the logged-in user's display name.
2022   *
2023   * @since 1.0.0
2024   */
2025  function bp_loggedin_user_fullname() {
2026      echo bp_get_loggedin_user_fullname();
2027  }
2028      /**
2029       * Get the logged-in user's display name.
2030       *
2031       * @since 1.0.0
2032       *
2033       * @global BuddyPress $bp The one true BuddyPress instance.
2034       *
2035       * @return string
2036       */
2037  	function bp_get_loggedin_user_fullname() {
2038          $bp = buddypress();
2039  
2040          /**
2041           * Filters the logged-in user's display name.
2042           *
2043           * @since 1.0.0
2044           *
2045           * @param string $value Logged-in user's display name.
2046           */
2047          return apply_filters( 'bp_get_loggedin_user_fullname', isset( $bp->loggedin_user->fullname ) ? $bp->loggedin_user->fullname : '' );
2048      }
2049  
2050  /**
2051   * Output the username of the displayed user.
2052   *
2053   * @since 1.2.0
2054   */
2055  function bp_displayed_user_username() {
2056      echo bp_get_displayed_user_username();
2057  }
2058      /**
2059       * Get the username of the displayed user.
2060       *
2061       * @since 1.2.0
2062       *
2063       * @global BuddyPress $bp The one true BuddyPress instance.
2064       *
2065       * @return string
2066       */
2067  	function bp_get_displayed_user_username() {
2068          $bp = buddypress();
2069  
2070          if ( bp_displayed_user_id() ) {
2071              $username = bp_core_get_username( bp_displayed_user_id(), $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login );
2072          } else {
2073              $username = '';
2074          }
2075  
2076          /**
2077           * Filters the username of the displayed user.
2078           *
2079           * @since 1.2.0
2080           *
2081           * @param string $username Username of the displayed user.
2082           */
2083          return apply_filters( 'bp_get_displayed_user_username', $username );
2084      }
2085  
2086  /**
2087   * Output the username of the logged-in user.
2088   *
2089   * @since 1.2.0
2090   */
2091  function bp_loggedin_user_username() {
2092      echo bp_get_loggedin_user_username();
2093  }
2094      /**
2095       * Get the username of the logged-in user.
2096       *
2097       * @since 1.2.0
2098       *
2099       * @global BuddyPress $bp The one true BuddyPress instance.
2100       *
2101       * @return string
2102       */
2103  	function bp_get_loggedin_user_username() {
2104          $bp = buddypress();
2105  
2106          if ( bp_loggedin_user_id() ) {
2107              $username = bp_core_get_username( bp_loggedin_user_id(), $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login );
2108          } else {
2109              $username = '';
2110          }
2111  
2112          /**
2113           * Filters the username of the logged-in user.
2114           *
2115           * @since 1.2.0
2116           *
2117           * @param string $username Username of the logged-in user.
2118           */
2119          return apply_filters( 'bp_get_loggedin_user_username', $username );
2120      }
2121  
2122  /**
2123   * Echo the current member type message.
2124   *
2125   * @since 2.3.0
2126   */
2127  function bp_current_member_type_message() {
2128      echo bp_get_current_member_type_message();
2129  }
2130      /**
2131       * Generate the current member type message.
2132       *
2133       * @since 2.3.0
2134       *
2135       * @return string
2136       */
2137  	function bp_get_current_member_type_message() {
2138          $type_object = bp_get_member_type_object( bp_get_current_member_type() );
2139  
2140          /* translators: %s: member type singular name */
2141          $message = sprintf( __( 'Viewing members of the type: %s', 'buddypress' ), '<strong>' . $type_object->labels['singular_name'] . '</strong>' );
2142  
2143          /**
2144           * Filters the current member type message.
2145           *
2146           * @since 2.3.0
2147           *
2148           * @param string $message Message to filter.
2149           */
2150          return apply_filters( 'bp_get_current_member_type_message', $message );
2151      }
2152  
2153  /**
2154   * Output member type directory link.
2155   *
2156   * @since 7.0.0
2157   *
2158   * @param string $member_type Unique member type identifier as used in bp_register_member_type().
2159   */
2160  function bp_member_type_directory_link( $member_type = '' ) {
2161      echo bp_get_member_type_directory_link( $member_type );
2162  }
2163      /**
2164       * Return member type directory link.
2165       *
2166       * @since 7.0.0
2167       *
2168       * @param string $member_type Unique member type identifier as used in bp_register_member_type().
2169       * @return string
2170       */
2171  	function bp_get_member_type_directory_link( $member_type = '' ) {
2172          if ( empty( $member_type ) ) {
2173              return '';
2174          }
2175  
2176          $member_type_object = bp_get_member_type_object( $member_type );
2177  
2178          if ( ! isset( $member_type_object->labels['name'] ) ) {
2179              return '';
2180          }
2181  
2182          $member_type_text = $member_type_object->labels['name'];
2183          if ( isset( $member_type_object->labels['singular_name'] ) && $member_type_object->labels['singular_name'] ) {
2184              $member_type_text = $member_type_object->labels['singular_name'];
2185          }
2186  
2187          if ( empty( $member_type_object->has_directory ) ) {
2188              return esc_html( $member_type_text );
2189          }
2190  
2191          return sprintf(
2192              '<a href="%1$s">%2$s</a>',
2193              esc_url( bp_get_member_type_directory_permalink( $member_type ) ),
2194              esc_html( $member_type_text )
2195          );
2196      }
2197  
2198  /**
2199   * Output a comma-delimited list of member types.
2200   *
2201   * @since 7.0.0
2202   *
2203   * @see bp_get_member_type_list() For additional information on default arguments.
2204   *
2205   * @param int   $user_id User ID.
2206   * @param array $r       Optional. Member type list arguments. Default empty array.
2207   */
2208  function bp_member_type_list( $user_id = 0, $r = array() ) {
2209      echo bp_get_member_type_list( $user_id, $r );
2210  }
2211      /**
2212       * Return a comma-delimited list of member types.
2213       *
2214       * @since 7.0.0
2215       *
2216       * @param int          $user_id User ID. Defaults to displayed user ID if on a member page.
2217       * @param array|string $r       {
2218       *     Array of parameters. All items are optional.
2219       *     @type string $parent_element     Element to wrap around the list. Defaults to 'p'.
2220       *     @type array  $parent_attr        Element attributes for parent element. Defaults to
2221       *                                      array( 'class' => 'bp-member-type-list' ).
2222       *     @type array  $label              Plural and singular labels to use before the list. Defaults to
2223       *                                      array( 'plural' => 'Member Types:', 'singular' => 'Member Type:' ).
2224       *     @type string $label_element      Element to wrap around the label. Defaults to 'strong'.
2225       *     @type array  $label_attr         Element attributes for label element. Defaults to array().
2226       *     @type bool   $show_all           Whether to show all registered group types. Defaults to 'false'. If
2227       *                                      'false', only shows member types with the 'show_in_list' parameter set to
2228       *                                      true. See bp_register_member_type() for more info.
2229       *     @type string $list_element       Element to wrap around the comma separated list of membet types. Defaults to ''.
2230       *     @type string $list_element_attr  Element attributes for list element. Defaults to array().
2231       * }
2232       * @return string
2233       */
2234  	function bp_get_member_type_list( $user_id = 0, $r = array() ) {
2235          if ( empty( $user_id ) ) {
2236              $user_id = bp_displayed_user_id();
2237          }
2238  
2239          $r = bp_parse_args(
2240              $r,
2241              array(
2242                  'parent_element'    => 'p',
2243                  'parent_attr'       => array(
2244                      'class' => 'bp-member-type-list',
2245                  ),
2246                  'label'             => array(),
2247                  'label_element'     => 'strong',
2248                  'label_attr'        => array(),
2249                  'show_all'          => false,
2250                  'list_element'      => '',
2251                  'list_element_attr' => array(),
2252              ),
2253              'member_type_list'
2254          );
2255  
2256          // Should the label be output?
2257          $has_label = ! empty( $r['label'] );
2258  
2259          $labels = bp_parse_args(
2260              $r['label'],
2261              array(
2262                  'plural'   => __( 'Member Types:', 'buddypress' ),
2263                  'singular' => __( 'Member Type:', 'buddypress' ),
2264              )
2265          );
2266  
2267          $retval = '';
2268          $types  = bp_get_member_type( $user_id, false );
2269  
2270          if ( $types ) {
2271              // Make sure we can show the type in the list.
2272              if ( false === $r['show_all'] ) {
2273                  $types = array_intersect( bp_get_member_types( array( 'show_in_list' => true ) ), $types );
2274                  if ( empty( $types ) ) {
2275                      return $retval;
2276                  }
2277              }
2278  
2279              $before = $after = $label = '';
2280              $count  = count( $types );
2281  
2282              if ( 1 === $count ) {
2283                  $label_text = $labels['singular'];
2284              } else {
2285                  $label_text = $labels['plural'];
2286              }
2287  
2288              // Render parent element.
2289              if ( ! empty( $r['parent_element'] ) ) {
2290                  $parent_elem = new BP_Core_HTML_Element( array(
2291                      'element' => $r['parent_element'],
2292                      'attr'    => $r['parent_attr'],
2293                  ) );
2294  
2295                  // Set before and after.
2296                  $before = $parent_elem->get( 'open_tag' );
2297                  $after  = $parent_elem->get( 'close_tag' );
2298              }
2299  
2300              // Render label element.
2301              if ( ! empty( $r['label_element'] ) ) {
2302                  $label = new BP_Core_HTML_Element( array(
2303                      'element'    => $r['label_element'],
2304                      'attr'       => $r['label_attr'],
2305                      'inner_html' => esc_html( $label_text ),
2306                  ) );
2307                  $label = $label->contents() . ' ';
2308  
2309              // No element, just the label.
2310              } elseif ( $has_label ) {
2311                  $label = esc_html( $label_text );
2312              }
2313  
2314              // The list of types.
2315              $list = implode( ', ', array_map( 'bp_get_member_type_directory_link', $types ) );
2316  
2317              // Render the list of types element.
2318              if ( ! empty( $r['list_element'] ) ) {
2319                  $list_element = new BP_Core_HTML_Element( array(
2320                      'element'    => $r['list_element'],
2321                      'attr'       => $r['list_element_attr'],
2322                      'inner_html' => $list,
2323                  ) );
2324  
2325                  $list = $list_element->contents();
2326              }
2327  
2328              // Comma-delimit each type into the group type directory link.
2329              $label .= $list;
2330  
2331              // Retval time!
2332              $retval = $before . $label . $after;
2333          }
2334  
2335          return $retval;
2336      }
2337  
2338  /** Signup Form ***************************************************************/
2339  
2340  /**
2341   * Do we have a working custom sign up page?
2342   *
2343   * @since 1.5.0
2344   *
2345   * @return bool True if page and template exist, false if not.
2346   */
2347  function bp_has_custom_signup_page() {
2348      static $has_page = false;
2349  
2350      if ( empty( $has_page ) ) {
2351          $has_page = bp_get_signup_slug() && bp_locate_template( array( 'registration/register.php', 'members/register.php', 'register.php' ), false );
2352      }
2353  
2354      return (bool) $has_page;
2355  }
2356  
2357  /**
2358   * Output the URL to the signup page.
2359   *
2360   * @since 1.0.0
2361   */
2362  function bp_signup_page() {
2363      echo esc_url( bp_get_signup_page() );
2364  }
2365      /**
2366       * Get the URL to the signup page.
2367       *
2368       * @since 1.1.0
2369       *
2370       * @return string
2371       */
2372  	function bp_get_signup_page() {
2373          if ( bp_has_custom_signup_page() ) {
2374              $page = trailingslashit( bp_get_root_domain() . '/' . bp_get_signup_slug() );
2375          } else {
2376              $page = bp_get_root_domain() . '/wp-signup.php';
2377          }
2378  
2379          /**
2380           * Filters the URL to the signup page.
2381           *
2382           * @since 1.1.0
2383           *
2384           * @param string $page URL to the signup page.
2385           */
2386          return apply_filters( 'bp_get_signup_page', $page );
2387      }
2388  
2389  /**
2390   * Do we have a working custom activation page?
2391   *
2392   * @since 1.5.0
2393   *
2394   * @return bool True if page and template exist, false if not.
2395   */
2396  function bp_has_custom_activation_page() {
2397      static $has_page = false;
2398  
2399      if ( empty( $has_page ) ) {
2400          $has_page = bp_get_activate_slug() && bp_locate_template( array( 'registration/activate.php', 'members/activate.php', 'activate.php' ), false );
2401      }
2402  
2403      return (bool) $has_page;
2404  }
2405  
2406  /**
2407   * Output the URL of the activation page.
2408   *
2409   * @since 1.0.0
2410   */
2411  function bp_activation_page() {
2412      echo esc_url( bp_get_activation_page() );
2413  }
2414      /**
2415       * Get the URL of the activation page.
2416       *
2417       * @since 1.2.0
2418       *
2419       * @return string
2420       */
2421  	function bp_get_activation_page() {
2422          if ( bp_has_custom_activation_page() ) {
2423              $page = trailingslashit( bp_get_root_domain() . '/' . bp_get_activate_slug() );
2424          } else {
2425              $page = trailingslashit( bp_get_root_domain() ) . 'wp-activate.php';
2426          }
2427  
2428          /**
2429           * Filters the URL of the activation page.
2430           *
2431           * @since 1.2.0
2432           *
2433           * @param string $page URL to the activation page.
2434           */
2435          return apply_filters( 'bp_get_activation_page', $page );
2436      }
2437  
2438  /**
2439   * Get the activation key from the current request URL.
2440   *
2441   * @since 3.0.0
2442   *
2443   * @return string
2444   */
2445  function bp_get_current_activation_key() {
2446      $key = '';
2447  
2448      if ( bp_is_current_component( 'activate' ) ) {
2449          if ( isset( $_GET['key'] ) ) {
2450              $key = wp_unslash( $_GET['key'] );
2451          } else {
2452              $key = bp_current_action();
2453          }
2454      }
2455  
2456      /**
2457       * Filters the activation key from the current request URL.
2458       *
2459       * @since 3.0.0
2460       *
2461       * @param string $key Activation key.
2462       */
2463      return apply_filters( 'bp_get_current_activation_key', $key );
2464  }
2465  
2466  /**
2467   * Output the username submitted during signup.
2468   *
2469   * @since 1.1.0
2470   */
2471  function bp_signup_username_value() {
2472      echo bp_get_signup_username_value();
2473  }
2474      /**
2475       * Get the username submitted during signup.
2476       *
2477       * @since 1.1.0
2478       *
2479       * @todo This should be properly escaped.
2480       *
2481       * @return string
2482       */
2483  	function bp_get_signup_username_value() {
2484          $value = '';
2485          if ( isset( $_POST['signup_username'] ) )
2486              $value = $_POST['signup_username'];
2487  
2488          /**
2489           * Filters the username submitted during signup.
2490           *
2491           * @since 1.1.0
2492           *
2493           * @param string $value Username submitted during signup.
2494           */
2495          return apply_filters( 'bp_get_signup_username_value', $value );
2496      }
2497  
2498  /**
2499   * Output the user email address submitted during signup.
2500   *
2501   * @since 1.1.0
2502   */
2503  function bp_signup_email_value() {
2504      echo bp_get_signup_email_value();
2505  }
2506      /**
2507       * Get the email address submitted during signup.
2508       *
2509       * @since 1.1.0
2510       *
2511       * @todo This should be properly escaped.
2512       *
2513       * @return string
2514       */
2515  	function bp_get_signup_email_value() {
2516          $value = '';
2517          if ( isset( $_POST['signup_email'] ) ) {
2518              $value = $_POST['signup_email'];
2519          } else if ( bp_get_members_invitations_allowed() ) {
2520              $invite = bp_get_members_invitation_from_request();
2521              if ( $invite ) {
2522                  $value = $invite->invitee_email;
2523              }
2524          }
2525  
2526          /**
2527           * Filters the email address submitted during signup.
2528           *
2529           * @since 1.1.0
2530           *
2531           * @param string $value Email address submitted during signup.
2532           */
2533          return apply_filters( 'bp_get_signup_email_value', $value );
2534      }
2535  
2536  /**
2537   * Output the 'signup_with_blog' value submitted during signup.
2538   *
2539   * @since 1.1.0
2540   */
2541  function bp_signup_with_blog_value() {
2542      echo bp_get_signup_with_blog_value();
2543  }
2544      /**
2545       * Get the 'signup_with_blog' value submitted during signup.
2546       *
2547       * @since 1.1.0
2548       *
2549       * @return string
2550       */
2551  	function bp_get_signup_with_blog_value() {
2552          $value = '';
2553          if ( isset( $_POST['signup_with_blog'] ) )
2554              $value = $_POST['signup_with_blog'];
2555  
2556          /**
2557           * Filters the 'signup_with_blog' value submitted during signup.
2558           *
2559           * @since 1.1.0
2560           *
2561           * @param string $value 'signup_with_blog' value submitted during signup.
2562           */
2563          return apply_filters( 'bp_get_signup_with_blog_value', $value );
2564      }
2565  
2566  /**
2567   * Output the 'signup_blog_url' value submitted at signup.
2568   *
2569   * @since 1.1.0
2570   */
2571  function bp_signup_blog_url_value() {
2572      echo bp_get_signup_blog_url_value();
2573  }
2574      /**
2575       * Get the 'signup_blog_url' value submitted at signup.
2576       *
2577       * @since 1.1.0
2578       *
2579       * @todo Should be properly escaped.
2580       *
2581       * @return string
2582       */
2583  	function bp_get_signup_blog_url_value() {
2584          $value = '';
2585          if ( isset( $_POST['signup_blog_url'] ) )
2586              $value = $_POST['signup_blog_url'];
2587  
2588          /**
2589           * Filters the 'signup_blog_url' value submitted during signup.
2590           *
2591           * @since 1.1.0
2592           *
2593           * @param string $value 'signup_blog_url' value submitted during signup.
2594           */
2595          return apply_filters( 'bp_get_signup_blog_url_value', $value );
2596      }
2597  
2598  /**
2599   * Output the base URL for subdomain installations of WordPress Multisite.
2600   *
2601   * @since 2.1.0
2602   */
2603  function bp_signup_subdomain_base() {
2604      echo bp_signup_get_subdomain_base();
2605  }
2606      /**
2607       * Return the base URL for subdomain installations of WordPress Multisite.
2608       *
2609       * Replaces bp_blogs_get_subdomain_base()
2610       *
2611       * @since 2.1.0
2612       *
2613       * @global WP_Network $current_site
2614       *
2615       * @return string The base URL - eg, 'example.com' for site_url() example.com or www.example.com.
2616       */
2617  	function bp_signup_get_subdomain_base() {
2618          global $current_site;
2619  
2620          // In case plugins are still using this filter.
2621          $subdomain_base = apply_filters( 'bp_blogs_subdomain_base', preg_replace( '|^www\.|', '', $current_site->domain ) . $current_site->path );
2622  
2623          /**
2624           * Filters the base URL for subdomain installations of WordPress Multisite.
2625           *
2626           * @since 2.1.0
2627           *
2628           * @param string $subdomain_base The base URL - eg, 'example.com' for
2629           *                               site_url() example.com or www.example.com.
2630           */
2631          return apply_filters( 'bp_signup_subdomain_base', $subdomain_base );
2632      }
2633  
2634  /**
2635   * Output the 'signup_blog_titl' value submitted at signup.
2636   *
2637   * @since 1.1.0
2638   */
2639  function bp_signup_blog_title_value() {
2640      echo bp_get_signup_blog_title_value();
2641  }
2642      /**
2643       * Get the 'signup_blog_title' value submitted at signup.
2644       *
2645       * @since 1.1.0
2646       *
2647       * @todo Should be properly escaped.
2648       *
2649       * @return string
2650       */
2651  	function bp_get_signup_blog_title_value() {
2652          $value = '';
2653          if ( isset( $_POST['signup_blog_title'] ) )
2654              $value = $_POST['signup_blog_title'];
2655  
2656          /**
2657           * Filters the 'signup_blog_title' value submitted during signup.
2658           *
2659           * @since 1.1.0
2660           *
2661           * @param string $value 'signup_blog_title' value submitted during signup.
2662           */
2663          return apply_filters( 'bp_get_signup_blog_title_value', $value );
2664      }
2665  
2666  /**
2667   * Output the 'signup_blog_privacy' value submitted at signup.
2668   *
2669   * @since 1.1.0
2670   */
2671  function bp_signup_blog_privacy_value() {
2672      echo bp_get_signup_blog_privacy_value();
2673  }
2674      /**
2675       * Get the 'signup_blog_privacy' value submitted at signup.
2676       *
2677       * @since 1.1.0
2678       *
2679       * @todo Should be properly escaped.
2680       *
2681       * @return string
2682       */
2683  	function bp_get_signup_blog_privacy_value() {
2684          $value = '';
2685          if ( isset( $_POST['signup_blog_privacy'] ) )
2686              $value = $_POST['signup_blog_privacy'];
2687  
2688          /**
2689           * Filters the 'signup_blog_privacy' value submitted during signup.
2690           *
2691           * @since 1.1.0
2692           *
2693           * @param string $value 'signup_blog_privacy' value submitted during signup.
2694           */
2695          return apply_filters( 'bp_get_signup_blog_privacy_value', $value );
2696      }
2697  
2698  /**
2699   * Output the avatar dir used during signup.
2700   *
2701   * @since 1.1.0
2702   */
2703  function bp_signup_avatar_dir_value() {
2704      echo bp_get_signup_avatar_dir_value();
2705  }
2706      /**
2707       * Get the avatar dir used during signup.
2708       *
2709       * @since 1.1.0
2710       *
2711       * @global BuddyPress $bp The one true BuddyPress instance.
2712       *
2713       * @return string
2714       */
2715  	function bp_get_signup_avatar_dir_value() {
2716          $bp = buddypress();
2717  
2718          // Check if signup_avatar_dir is passed.
2719          if ( !empty( $_POST['signup_avatar_dir'] ) )
2720              $signup_avatar_dir = $_POST['signup_avatar_dir'];
2721  
2722          // If not, check if global is set.
2723          elseif ( !empty( $bp->signup->avatar_dir ) )
2724              $signup_avatar_dir = $bp->signup->avatar_dir;
2725  
2726          // If not, set false.
2727          else
2728              $signup_avatar_dir = false;
2729  
2730          /**
2731           * Filters the avatar dir used during signup.
2732           *
2733           * @since 1.1.0
2734           *
2735           * @param string|bool $signup_avatar_dir Avatar dir used during signup or false.
2736           */
2737          return apply_filters( 'bp_get_signup_avatar_dir_value', $signup_avatar_dir );
2738      }
2739  
2740  /**
2741   * Determines whether privacy policy acceptance is required for registration.
2742   *
2743   * @since 4.0.0
2744   *
2745   * @return bool
2746   */
2747  function bp_signup_requires_privacy_policy_acceptance() {
2748      // Bail if we're running a version of WP that doesn't have the Privacy Policy feature.
2749      if ( bp_is_running_wp( '4.9.6', '<' ) ) {
2750          return false;
2751      }
2752  
2753      // Default to true when a published Privacy Policy page exists.
2754      $privacy_policy_url = get_privacy_policy_url();
2755      $required           = ! empty( $privacy_policy_url );
2756  
2757      /**
2758       * Filters whether privacy policy acceptance is required for registration.
2759       *
2760       * @since 4.0.0
2761       *
2762       * @param bool $required Whether privacy policy acceptance is required.
2763       */
2764      return (bool) apply_filters( 'bp_signup_requires_privacy_policy_acceptance', $required );
2765  }
2766  
2767  /**
2768   * Output the current signup step.
2769   *
2770   * @since 1.1.0
2771   */
2772  function bp_current_signup_step() {
2773      echo bp_get_current_signup_step();
2774  }
2775      /**
2776       * Get the current signup step.
2777       *
2778       * @since 1.1.0
2779       *
2780       * @global BuddyPress $bp The one true BuddyPress instance.
2781       *
2782       * @return string
2783       */
2784  	function bp_get_current_signup_step() {
2785          return (string) buddypress()->signup->step;
2786      }
2787  
2788  /**
2789   * Output the user avatar during signup.
2790   *
2791   * @since 1.1.0
2792   *
2793   * @see bp_get_signup_avatar() for description of arguments.
2794   *
2795   * @param array|string $args See {@link bp_get_signup_avatar(}.
2796   */
2797  function bp_signup_avatar( $args = '' ) {
2798      echo bp_get_signup_avatar( $args );
2799  }
2800      /**
2801       * Get the user avatar during signup.
2802       *
2803       * @since 1.1.0
2804       *
2805       * @global BuddyPress $bp The one true BuddyPress instance.
2806       *
2807       * @see bp_core_fetch_avatar() for description of arguments.
2808       *
2809       * @param array|string $args {
2810       *     Array of optional arguments.
2811       *     @type int    $size  Height/weight in pixels. Default: value of
2812       *                         bp_core_avatar_full_width().
2813       *     @type string $class CSS class. Default: 'avatar'.
2814       *     @type string $alt   HTML 'alt' attribute. Default: 'Your Avatar'.
2815       * }
2816       * @return string
2817       */
2818  	function bp_get_signup_avatar( $args = '' ) {
2819          $bp = buddypress();
2820          $r  = bp_parse_args(
2821              $args,
2822              array(
2823                  'size'  => bp_core_avatar_full_width(),
2824                  'class' => 'avatar',
2825                  'alt'   => __( 'Your Profile Photo', 'buddypress' ),
2826              )
2827          );
2828  
2829          extract( $r, EXTR_SKIP );
2830  
2831          $signup_avatar_dir = bp_get_signup_avatar_dir_value();
2832  
2833          // Avatar DIR is found.
2834          if ( $signup_avatar_dir ) {
2835              $gravatar_img = bp_core_fetch_avatar( array(
2836                  'item_id'    => $signup_avatar_dir,
2837                  'object'     => 'signup',
2838                  'avatar_dir' => 'avatars/signups',
2839                  'type'       => 'full',
2840                  'width'      => $size,
2841                  'height'     => $size,
2842                  'alt'        => $alt,
2843                  'class'      => $class,
2844              ) );
2845  
2846              // No avatar DIR was found.
2847          } else {
2848  
2849              // Set default gravatar type.
2850              if ( empty( $bp->grav_default->user ) ) {
2851                  $default_grav = 'wavatar';
2852              } elseif ( 'mystery' === $bp->grav_default->user ) {
2853                  $default_grav = $bp->plugin_url . 'bp-core/images/mystery-man.jpg';
2854              } else {
2855                  $default_grav = $bp->grav_default->user;
2856              }
2857  
2858              /**
2859               * Filters the base Gravatar url used for signup avatars when no avatar dir found.
2860               *
2861               * @since 1.0.2
2862               *
2863               * @param string $value Gravatar url to use.
2864               */
2865              $gravatar_url    = apply_filters( 'bp_gravatar_url', '//www.gravatar.com/avatar/' );
2866              $md5_lcase_email = md5( strtolower( bp_get_signup_email_value() ) );
2867              $gravatar_img    = '<img src="' . $gravatar_url . $md5_lcase_email . '?d=' . $default_grav . '&amp;s=' . $size . '" width="' . $size . '" height="' . $size . '" alt="' . $alt . '" class="' . $class . '" />';
2868          }
2869  
2870          /**
2871           * Filters the user avatar during signup.
2872           *
2873           * @since 1.1.0
2874           *
2875           * @param string $gravatar_img Avatar HTML image tag.
2876           * @param array  $args         Array of parsed args for avatar query.
2877           */
2878          return apply_filters( 'bp_get_signup_avatar', $gravatar_img, $args );
2879      }
2880  
2881  /**
2882   * Output whether signup is allowed.
2883   *
2884   * @since 1.1.0
2885   *
2886   * @todo Remove this function. Echoing a bool is pointless.
2887   */
2888  function bp_signup_allowed() {
2889      echo bp_get_signup_allowed();
2890  }
2891      /**
2892       * Is user signup allowed?
2893       *
2894       * @since 1.1.0
2895       *
2896       * @return bool
2897       */
2898  	function bp_get_signup_allowed() {
2899  
2900          /**
2901           * Filters whether or not new signups are allowed.
2902           *
2903           * @since 1.5.0
2904           *
2905           * @param bool $signup_allowed Whether or not new signups are allowed.
2906           */
2907          return apply_filters( 'bp_get_signup_allowed', (bool) bp_get_option( 'users_can_register' ) );
2908      }
2909  
2910  /**
2911   * Are users allowed to invite users to join this site?
2912   *
2913   * @since 8.0.0
2914   *
2915   * @return bool
2916   */
2917  function bp_get_members_invitations_allowed() {
2918      /**
2919       * Filters whether or not community invitations are allowed.
2920       *
2921       * @since 8.0.0
2922       *
2923       * @param bool $allowed Whether or not community invitations are allowed.
2924       */
2925      return apply_filters( 'bp_get_members_invitations_allowed', bp_is_active( 'members', 'invitations' ) && (bool) bp_get_option( 'bp-enable-members-invitations' ) );
2926  }
2927  
2928  /**
2929   * Should the system create and allow access
2930   * to the Register and Activate pages?
2931   *
2932   * @since 10.0.0
2933   *
2934   * @return bool
2935   */
2936  function bp_allow_access_to_registration_pages() {
2937      $retval = bp_get_signup_allowed() || bp_get_members_invitations_allowed();
2938  
2939      /**
2940       * Filters whether or not the system should create and allow access
2941       * to the Register and Activate pages.
2942       *
2943       * @since 10.0.0
2944       *
2945       * @param bool $retval Whether or not to allow access to
2946       *                     the Register and Activate pages.
2947       */
2948      return apply_filters( 'bp_allow_access_to_registration_pages', $retval );
2949  }
2950  
2951  /**
2952   * Hook member activity feed to <head>.
2953   *
2954   * @since 1.5.0
2955   */
2956  function bp_members_activity_feed() {
2957      if ( !bp_is_active( 'activity' ) || !bp_is_user() )
2958          return; ?>
2959  
2960      <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php bp_displayed_user_fullname() ?> | <?php _e( 'Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_member_activity_feed_link() ?>" />
2961  
2962  <?php
2963  }
2964  add_action( 'bp_head', 'bp_members_activity_feed' );
2965  
2966  /**
2967   * Output a link to a members component subpage.
2968   *
2969   * @since 1.5.0
2970   *
2971   * @see bp_get_members_component_link() for description of parameters.
2972   *
2973   * @param string      $component See {@bp_get_members_component_link()}.
2974   * @param string      $action See {@bp_get_members_component_link()}.
2975   * @param string      $query_args See {@bp_get_members_component_link()}.
2976   * @param string|bool $nonce See {@bp_get_members_component_link()}.
2977   */
2978  function bp_members_component_link( $component, $action = '', $query_args = '', $nonce = false ) {
2979      echo esc_url( bp_get_members_component_link( $component, $action, $query_args, $nonce ) );
2980  }
2981      /**
2982       * Generate a link to a members component subpage.
2983       *
2984       * @since 1.5.0
2985       *
2986       * @global BuddyPress $bp The one true BuddyPress instance.
2987       *
2988       * @param string       $component  ID of the component (eg 'friends').
2989       * @param string       $action     Optional. 'action' slug (eg 'invites').
2990       * @param array|string $query_args Optional. Array of URL params to add to the
2991       *                                 URL. See {@link add_query_arg()} for format.
2992       * @param array|bool   $nonce      Optional. If provided, the URL will be passed
2993       *                                 through wp_nonce_url() with $nonce as the
2994       *                                 action string.
2995       * @return string
2996       */
2997  	function bp_get_members_component_link( $component, $action = '', $query_args = '', $nonce = false ) {
2998          // Must be displayed user.
2999          if ( ! bp_displayed_user_id() ) {
3000              return;
3001          }
3002  
3003          $bp = buddypress();
3004  
3005          if ( 'xprofile' === $component ) {
3006              $component = 'profile';
3007          }
3008  
3009          // Append $action to $url if there is no $type.
3010          if ( ! empty( $action ) ) {
3011              $url = bp_displayed_user_domain() . $bp->{$component}->slug . '/' . $action;
3012          } else {
3013              $url = bp_displayed_user_domain() . $bp->{$component}->slug;
3014          }
3015  
3016          // Add a slash at the end of our user url.
3017          $url = trailingslashit( $url );
3018  
3019          // Add possible query arg.
3020          if ( ! empty( $query_args ) && is_array( $query_args ) ) {
3021              $url = add_query_arg( $query_args, $url );
3022          }
3023  
3024          // To nonce, or not to nonce...
3025          if ( true === $nonce ) {
3026              $url = wp_nonce_url( $url );
3027          } elseif ( is_string( $nonce ) ) {
3028              $url = wp_nonce_url( $url, $nonce );
3029          }
3030  
3031          // Return the url, if there is one.
3032          if ( ! empty( $url ) ) {
3033              return $url;
3034          }
3035      }
3036  
3037  
3038  /**
3039   * Render an avatar delete link.
3040   *
3041   * @since 1.1.0
3042   * @since 6.0.0 Moved from /bp-xprofile/bp-xprofile-template.php to this file.
3043   */
3044  function bp_avatar_delete_link() {
3045      echo bp_get_avatar_delete_link();
3046  }
3047      /**
3048       * Return an avatar delete link.
3049       *
3050       * @since 1.1.0
3051       * @since 6.0.0 Moved from /bp-xprofile/bp-xprofile-template.php to this file.
3052       *
3053       * @return string
3054       */
3055  	function bp_get_avatar_delete_link() {
3056  
3057          /**
3058           * Filters the link used for deleting an avatar.
3059           *
3060           * @since 1.1.0
3061           *
3062           * @param string $value Nonced URL used for deleting an avatar.
3063           */
3064          return apply_filters( 'bp_get_avatar_delete_link', wp_nonce_url( bp_displayed_user_domain() . bp_get_profile_slug() . '/change-avatar/delete-avatar/', 'bp_delete_avatar_link' ) );
3065      }
3066  
3067  
3068  /** The Members Invitations Loop ******************************************************************/
3069  
3070  /**
3071   * Initialize the community invitations loop.
3072   *
3073   * Based on the $args passed, bp_has_invitations() populates
3074   * buddypress()->invitations->query_loop global, enabling the use of BP
3075   * templates and template functions to display a list of invitations.
3076   *
3077   * @since 8.0.0
3078   *
3079   * @global BuddyPress $bp The one true BuddyPress instance.
3080   *
3081   * @param array|string $args {
3082   *     Arguments for limiting the contents of the invitations loop. Can be
3083   *     passed as an associative array, or as a URL query string.
3084   *
3085   *     See {@link BP_Invitations_Invitation::get()} for detailed
3086   *     information on the arguments.  In addition, also supports:
3087   *
3088   *     @type int    $max      Optional. Max items to display. Default: false.
3089   *     @type string $page_arg URL argument to use for pagination.
3090   *                            Default: 'ipage'.
3091   * }
3092   * @return bool
3093   */
3094  function bp_has_members_invitations( $args = '' ) {
3095      $bp = buddypress();
3096  
3097      // Get the user ID.
3098      if ( bp_displayed_user_id() ) {
3099          $user_id = bp_displayed_user_id();
3100      } else {
3101          $user_id = bp_loggedin_user_id();
3102      }
3103  
3104      // Set the search terms (by default an empty string to get all notifications).
3105      $search_terms = '';
3106  
3107      if ( isset( $_REQUEST['s'] ) ) {
3108          $search_terms = stripslashes( $_REQUEST['s'] );
3109      }
3110  
3111      // Parse the args.
3112      $r = bp_parse_args(
3113          $args,
3114          array(
3115              'id'            => false,
3116              'inviter_id'    => $user_id,
3117              'invitee_email' => false,
3118              'item_id'       => false,
3119              'type'          => 'invite',
3120              'invite_sent'   => 'all',
3121              'accepted'      => 'pending',
3122              'search_terms'  => $search_terms,
3123              'order_by'      => 'date_modified',
3124              'sort_order'    => 'DESC',
3125              'page'          => 1,
3126              'per_page'      => 25,
3127              'fields'        => 'all',
3128  
3129              // These are additional arguments that are not available in
3130              // BP_Invitations_Invitation::get().
3131              'page_arg'      => 'ipage',
3132          ),
3133          'has_members_invitations'
3134      );
3135  
3136      // Get the notifications.
3137      $query_loop = new BP_Members_Invitations_Template( $r );
3138  
3139      // Setup the global query loop.
3140      $bp->members->invitations->query_loop = $query_loop;
3141  
3142      /**
3143       * Filters whether or not the user has network invitations to display.
3144       *
3145       * @since 8.0.0
3146       *
3147       * @param bool                      $value      Whether or not there are network invitations to display.
3148       * @param BP_Notifications_Template $query_loop BP_Members_Invitations_Template object instance.
3149       * @param array                     $r          Array of arguments passed into the BP_Members_Invitations_Template class.
3150       */
3151      return apply_filters( 'bp_has_members_invitations', $query_loop->has_invitations(), $query_loop, $r );
3152  }
3153  
3154  /**
3155   * Get the network invitations returned by the template loop.
3156   *
3157   * @since 8.0.0
3158   *
3159   * @global BuddyPress $bp The one true BuddyPress instance.
3160   *
3161   * @return array List of network invitations.
3162   */
3163  function bp_the_members_invitations() {
3164      return buddypress()->members->invitations->query_loop->invitations();
3165  }
3166  
3167  /**
3168   * Get the current network invitation object in the loop.
3169   *
3170   * @since 8.0.0
3171   *
3172   * @global BuddyPress $bp The one true BuddyPress instance.
3173   *
3174   * @return object The current network invitation within the loop.
3175   */
3176  function bp_the_members_invitation() {
3177      return buddypress()->members->invitations->query_loop->the_invitation();
3178  }
3179  
3180  /**
3181   * Output the pagination count for the current network invitations loop.
3182   *
3183   * @since 8.0.0
3184   */
3185  function bp_members_invitations_pagination_count() {
3186      echo bp_get_members_invitations_pagination_count();
3187  }
3188      /**
3189       * Return the pagination count for the current network invitation loop.
3190       *
3191       * @since 8.0.0
3192       *
3193       * @global BuddyPress $bp The one true BuddyPress instance.
3194       *
3195       * @return string HTML for the pagination count.
3196       */
3197  	function bp_get_members_invitations_pagination_count() {
3198          $bp         = buddypress();
3199          $query_loop = $bp->members->invitations->query_loop;
3200          $start_num  = intval( ( $query_loop->pag_page - 1 ) * $query_loop->pag_num ) + 1;
3201          $from_num   = bp_core_number_format( $start_num );
3202          $to_num     = bp_core_number_format( ( $start_num + ( $query_loop->pag_num - 1 ) > $query_loop->total_invitation_count ) ? $query_loop->total_invitation_count : $start_num + ( $query_loop->pag_num - 1 ) );
3203          $total      = bp_core_number_format( $query_loop->total_invitation_count );
3204  
3205          if ( 1 == $query_loop->total_invitation_count ) {
3206              $pag = __( 'Viewing 1 invitation', 'buddypress' );
3207          } else {
3208              /* translators: 1: Invitations from number. 2: Invitations to number. 3: Total invitations. */
3209              $pag = sprintf( _nx( 'Viewing %1$s - %2$s of %3$s invitation', 'Viewing %1$s - %2$s of %3$s invitations', $query_loop->total_invitation_count, 'Community invites pagination', 'buddypress' ), $from_num, $to_num, $total );
3210          }
3211  
3212          /**
3213           * Filters the pagination count for the current network invitation loop.
3214           *
3215           * @since 8.0.0
3216           *
3217           * @param string $pag HTML for the pagination count.
3218           */
3219          return apply_filters( 'bp_get_members_invitations_pagination_count', $pag );
3220      }
3221  
3222  /**
3223   * Output the pagination links for the current network invitation loop.
3224   *
3225   * @since 8.0.0
3226   */
3227  function bp_members_invitations_pagination_links() {
3228      echo bp_get_members_invitations_pagination_links();
3229  }
3230      /**
3231       * Return the pagination links for the current network invitations loop.
3232       *
3233       * @since 8.0.0
3234       *
3235       * @global BuddyPress $bp The one true BuddyPress instance.
3236       *
3237       * @return string HTML for the pagination links.
3238       */
3239  	function bp_get_members_invitations_pagination_links() {
3240          $bp = buddypress();
3241  
3242          /**
3243           * Filters the pagination links for the current network invitations loop.
3244           *
3245           * @since 8.0.0
3246           *
3247           * @param string $pag_links HTML for the pagination links.
3248           */
3249          return apply_filters( 'bp_get_members_invitations_pagination_links', $bp->members->invitations->query_loop->pag_links );
3250      }
3251  
3252  /**
3253   * Output the requested property of the invitation currently being iterated on.
3254   *
3255   * @since 8.0.0
3256   *
3257   * @param string $property The name of the property to display.
3258   * @param string $context  The context of display.
3259   *                         Possible values are 'attribute' and 'html'.
3260   */
3261  function bp_the_members_invitation_property( $property = '', $context = 'html' ) {
3262      if ( ! $property ) {
3263          return;
3264      }
3265  
3266      /**
3267       * Use this filter to sanitize the output.
3268       *
3269       * @since 8.0.0
3270       *
3271       * @param int|string $value    The value for the requested property.
3272       * @param string     $property The name of the requested property.
3273       * @param string     $context  The context of display.
3274       */
3275      echo apply_filters( 'bp_the_members_invitation_property', bp_get_the_members_invitation_property( $property ), $property, $context );
3276  }
3277      /**
3278       * Return the value for a property of the network invitation currently being iterated on.
3279       *
3280       * @since 8.0.0
3281       *
3282       * @return int ID of the current network invitation.
3283       */
3284  	function bp_get_the_members_invitation_property( $property = 'id' ) {
3285  
3286          switch ( $property ) {
3287              case 'id':
3288              case 'user_id':
3289              case 'item_id':
3290              case 'secondary_item_id':
3291              case 'invite_sent':
3292              case 'accepted':
3293                  $value = 0;
3294                  break;
3295              case 'invitee_email':
3296              case 'type':
3297              case 'content':
3298              case 'date_modified':
3299                  $value = '';
3300                  break;
3301              default:
3302                  // A known property has not been specified.
3303                  $property = null;
3304                  $value = '';
3305                  break;
3306          }
3307  
3308          if ( isset( buddypress()->members->invitations->query_loop->invitation->{$property} ) ) {
3309              $value = buddypress()->members->invitations->query_loop->invitation->{$property};
3310          }
3311  
3312          /**
3313           * Filters the property of the network invitation currently being iterated on.
3314           *
3315           * @since 8.0.0
3316           *
3317           * @param int|string $value Property value of the network invitation being iterated on.
3318           */
3319          return apply_filters( 'bp_get_the_members_invitation_property_' . $property, $value );
3320      }
3321  
3322  /**
3323   * Output the action links for the current invitation.
3324   *
3325   * @since 8.0.0
3326   *
3327   * @param array|string $args Array of arguments.
3328   */
3329  function bp_the_members_invitation_action_links( $args = '' ) {
3330      echo bp_get_the_members_invitation_action_links( $args );
3331  }
3332      /**
3333       * Return the action links for the current invitation.
3334       *
3335       * @since 8.0.0
3336       *
3337       * @param array|string $args {
3338       *     @type string $before  HTML before the links.
3339       *     @type string $after   HTML after the links.
3340       *     @type string $sep     HTML between the links.
3341       *     @type array  $links   Array of links to implode by 'sep'.
3342       *     @type int    $user_id User ID to fetch action links for. Defaults to displayed user ID.
3343       * }
3344       * @return string HTML links for actions to take on single notifications.
3345       */
3346  	function bp_get_the_members_invitation_action_links( $args = '' ) {
3347          // Set default user ID to use.
3348          $inviter_id = isset( $args['inviter_id'] ) ? $args['inviter_id'] : bp_displayed_user_id();
3349  
3350          // Parse.
3351          $r = bp_parse_args(
3352              $args,
3353              array(
3354                  'before' => '',
3355                  'after'  => '',
3356                  'sep'    => ' | ',
3357                  'links'  => array(
3358                      bp_get_the_members_invitation_resend_link( $inviter_id ),
3359                      bp_get_the_members_invitation_delete_link( $inviter_id )
3360                  )
3361              )
3362          );
3363  
3364          // Build the links.
3365          $retval = $r['before'] . implode( $r['sep'], $r['links'] ) . $r['after'];
3366  
3367          /**
3368           * Filters the action links for the current invitation.
3369           *
3370           * @since 8.0.0
3371           *
3372           * @param string $retval HTML links for actions to take on single invitation.
3373           * @param array  $r      Array of parsed arguments.
3374           */
3375          return apply_filters( 'bp_get_the_members_invitation_action_links', $retval, $r );
3376      }
3377  
3378  /**
3379   * Output the resend link for the current invitation.
3380   *
3381   * @since 8.0.0
3382   *
3383   * @param int $user_id The user ID.
3384   */
3385  function bp_the_members_invitations_resend_link( $user_id = 0 ) {
3386      echo bp_get_the_members_invitation_delete_link( $user_id );
3387  }
3388      /**
3389       * Return the resend link for the current notification.
3390       *
3391       * @since 8.0.0
3392       *
3393       * @param int $user_id The user ID.
3394       * @return string
3395       */
3396  	function bp_get_the_members_invitation_resend_link( $user_id = 0 ) {
3397          // Set default user ID to use.
3398          $user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
3399  
3400          // Don't allow resending of accepted invitations.
3401          if ( bp_get_the_members_invitation_property( 'accepted' ) ) {
3402              return;
3403          }
3404  
3405          $retval = sprintf( '<a href="%1$s" class="resend secondary confirm bp-tooltip">%2$s</a>', esc_url( bp_get_the_members_invitations_resend_url( $user_id ) ), __( 'Resend', 'buddypress' ) );
3406  
3407          /**
3408           * Filters the resend link for the current invitation.
3409           *
3410           * @since 8.0.0
3411           *
3412           * @param string $retval  HTML for the delete link for the current notification.
3413           * @param int    $user_id The user ID.
3414           */
3415          return apply_filters( 'bp_get_the_members_invitation_resend_link', $retval, $user_id );
3416      }
3417  
3418  /**
3419   * Output the URL used for resending a single invitation.
3420   *
3421   * Since this function directly outputs a URL, it is escaped.
3422   *
3423   * @since 8.0.0
3424   *
3425   * @param int $user_id The user ID.
3426   */
3427  function bp_the_members_invitations_resend_url( $user_id = 0 ) {
3428      echo esc_url( bp_get_the_members_invitations_resend_url( $user_id ) );
3429  }
3430      /**
3431       * Return the URL used for resending a single invitation.
3432       *
3433       * @since 8.0.0
3434       *
3435       * @param int $user_id The user ID.
3436       * @return string
3437       */
3438  	function bp_get_the_members_invitations_resend_url( $user_id = 0 ) {
3439          // Set default user ID to use.
3440          $user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
3441          $link = bp_get_members_invitations_list_invites_permalink( $user_id );
3442  
3443          // Get the ID.
3444          $id = bp_get_the_members_invitation_property( 'id' );
3445  
3446          // Get the args to add to the URL.
3447          $args = array(
3448              'action'        => 'resend',
3449              'invitation_id' => $id
3450          );
3451  
3452          // Add the args.
3453          $url = add_query_arg( $args, $link );
3454  
3455          // Add the nonce.
3456          $url = wp_nonce_url( $url, 'bp_members_invitation_resend_' . $id );
3457  
3458          /**
3459           * Filters the URL used for resending a single invitation.
3460           *
3461           * @since 8.0.0
3462           *
3463           * @param string $url     URL used for deleting a single invitation.
3464           * @param int    $user_id The user ID.
3465           */
3466          return apply_filters( 'bp_get_the_members_invitations_resend_url', $url, $user_id );
3467      }
3468  
3469  /**
3470   * Output the delete link for the current invitation.
3471   *
3472   * @since 8.0.0
3473   *
3474   * @param int $user_id The user ID.
3475   */
3476  function bp_the_members_invitations_delete_link( $user_id = 0 ) {
3477      echo bp_get_the_members_invitation_delete_link( $user_id );
3478  }
3479      /**
3480       * Return the delete link for the current invitation.
3481       *
3482       * @since 8.0.0
3483       *
3484       * @param int $user_id The user ID.
3485       * @return string
3486       */
3487  	function bp_get_the_members_invitation_delete_link( $user_id = 0 ) {
3488          // Set default user ID to use.
3489          $user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
3490  
3491          // Modify the message for accepted/not accepted invitatons.
3492          if ( bp_get_the_members_invitation_property( 'accepted' ) ) {
3493              $message = __( 'Delete', 'buddypress' );
3494          } else {
3495              $message = __( 'Cancel', 'buddypress' );
3496          }
3497  
3498          $retval = sprintf(
3499              '<a href="%1$s" class="delete secondary confirm bp-tooltip">%2$s</a>',
3500              esc_url( bp_get_the_members_invitations_delete_url( $user_id ) ),
3501              esc_html( $message )
3502          );
3503  
3504          /**
3505           * Filters the delete link for the current invitation.
3506           *
3507           * @since 8.0.0
3508           *
3509           * @param string $retval  HTML for the delete link for the current notification.
3510           * @param int    $user_id The user ID.
3511           */
3512          return apply_filters( 'bp_get_the_members_invitation_delete_link', $retval, $user_id );
3513      }
3514  
3515  /**
3516   * Output the URL used for deleting a single invitation.
3517   *
3518   * Since this function directly outputs a URL, it is escaped.
3519   *
3520   * @since 8.0.0
3521   *
3522   * @param int $user_id The user ID.
3523   */
3524  function bp_the_members_invitations_delete_url( $user_id = 0 ) {
3525      echo esc_url( bp_get_the_members_invitations_delete_url( $user_id ) );
3526  }
3527      /**
3528       * Return the URL used for deleting a single invitation.
3529       *
3530       * @since 8.0.0
3531       *
3532       * @param int $user_id The user ID.
3533       * @return string
3534       */
3535  	function bp_get_the_members_invitations_delete_url( $user_id = 0 ) {
3536          // Set default user ID to use.
3537          $user_id = 0 === $user_id ? bp_displayed_user_id() : $user_id;
3538          $link = bp_get_members_invitations_list_invites_permalink( $user_id );
3539  
3540          // Get the ID.
3541          $id = bp_get_the_members_invitation_property( 'id' );
3542  
3543          // Get the args to add to the URL.
3544          $args = array(
3545              'action'        => 'cancel',
3546              'invitation_id' => $id
3547          );
3548  
3549          // Add the args.
3550          $url = add_query_arg( $args, $link );
3551  
3552          // Add the nonce.
3553          $url = wp_nonce_url( $url, 'bp_members_invitations_cancel_' . $id );
3554  
3555          /**
3556           * Filters the URL used for deleting a single invitation.
3557           *
3558           * @since 8.0.0
3559           *
3560           * @param string $url     URL used for deleting a single invitation.
3561           * @param int    $user_id The user ID.
3562           */
3563          return apply_filters( 'bp_get_the_members_invitations_delete_url', $url, $user_id );
3564      }
3565  
3566  /**
3567   * Output the members invitations list permalink for a user.
3568   *
3569   * @since 8.0.0
3570   *
3571   * @param int $user_id The user ID.
3572   */
3573  function bp_members_invitations_list_invites_permalink( $user_id = 0 ) {
3574      echo bp_get_members_invitations_list_invites_permalink( $user_id );
3575  }
3576      /**
3577       * Return the members invitations list permalink for a user.
3578       *
3579       * @since 8.0.0
3580       *
3581       * @return string Members invitations list permalink for a user.
3582       */
3583      function bp_get_members_invitations_list_invites_permalink( $user_id = 0 ) {
3584          if ( 0 === $user_id ) {
3585              $user_id = bp_loggedin_user_id();
3586              $domain  = bp_loggedin_user_domain();
3587          } else {
3588              $domain = bp_core_get_user_domain( (int) $user_id );
3589          }
3590  
3591          $retval = trailingslashit( $domain . bp_get_members_invitations_slug() . '/list-invites' );
3592  
3593          /**
3594           * Filters the members invitations list permalink for a user.
3595           *
3596           * @since 8.0.0
3597           *
3598           * @param string $retval  Permalink for the sent invitation list screen.
3599           * @param int    $user_id The user ID.
3600           */
3601          return apply_filters( 'bp_get_members_invitations_list_invites_permalink', $retval, $user_id );
3602      }
3603  
3604  /**
3605   * Output the send invitation permalink for a user.
3606   *
3607   * @since 8.0.0
3608   *
3609   * @param int $user_id The user ID.
3610   */
3611  function bp_members_invitations_send_invites_permalink( $user_id = 0 ) {
3612      echo bp_get_members_invitations_send_invites_permalink( $user_id );
3613  }
3614      /**
3615       * Return the send invitations permalink.
3616       *
3617       * @since 8.0.0
3618       *
3619       * @param int $user_id The user ID.
3620       * @return string      The send invitations permalink.
3621       */
3622      function bp_get_members_invitations_send_invites_permalink( $user_id = 0 ) {
3623          if ( 0 === $user_id ) {
3624              $user_id = bp_loggedin_user_id();
3625              $domain  = bp_loggedin_user_domain();
3626          } else {
3627              $domain = bp_core_get_user_domain( (int) $user_id );
3628          }
3629  
3630          $retval = trailingslashit( $domain . bp_get_members_invitations_slug() . '/send-invites' );
3631  
3632          /**
3633           * Filters the send invitations permalink.
3634           *
3635           * @since 8.0.0
3636           *
3637           * @param string $retval  Permalink for the sent invitation list screen.
3638           * @param int    $user_id The user ID.
3639           */
3640          return apply_filters( 'bp_get_members_invitations_send_invites_permalink', $retval, $user_id );
3641      }
3642  
3643  /**
3644   * Output the dropdown for bulk management of invitations.
3645   *
3646   * @since 8.0.0
3647   */
3648  function bp_members_invitations_bulk_management_dropdown() {
3649      ?>
3650      <label class="bp-screen-reader-text" for="invitation-select">
3651          <?php
3652          esc_html_e( 'Select Bulk Action', 'buddypress' );
3653          ?>
3654      </label>
3655  
3656      <select name="invitation_bulk_action" id="invitation-select">
3657          <option value="" selected="selected"><?php esc_html_e( 'Bulk Actions', 'buddypress' ); ?></option>
3658          <option value="resend"><?php echo esc_html_x( 'Resend', 'button', 'buddypress' ); ?></option>
3659          <option value="cancel"><?php echo esc_html_x( 'Cancel', 'button', 'buddypress' ); ?></option>
3660      </select>
3661  
3662      <input type="submit" id="invitation-bulk-manage" class="button action" value="<?php echo esc_attr_x( 'Apply', 'button', 'buddypress' ); ?>">
3663      <?php
3664  }


Generated: Thu Oct 28 01:00:59 2021 Cross-referenced by PHPXref 0.7.1