[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-templates/bp-nouveau/includes/groups/ -> template-tags.php (source)

   1  <?php
   2  /**
   3   * Groups Template tags
   4   *
   5   * @since 3.0.0
   6   * @version 6.0.0
   7   */
   8  
   9  // Exit if accessed directly.
  10  defined( 'ABSPATH' ) || exit;
  11  
  12  /**
  13   * Template tag to wrap all Legacy actions that was used
  14   * before the groups directory content
  15   *
  16   * @since 3.0.0
  17   */
  18  function bp_nouveau_before_groups_directory_content() {
  19      /**
  20       * Fires at the begining of the templates BP injected content.
  21       *
  22       * @since 2.3.0
  23       */
  24      do_action( 'bp_before_directory_groups_page' );
  25  
  26      /**
  27       * Fires before the display of the groups.
  28       *
  29       * @since 1.1.0
  30       */
  31      do_action( 'bp_before_directory_groups' );
  32  
  33      /**
  34       * Fires before the display of the groups content.
  35       *
  36       * @since 1.1.0
  37       */
  38      do_action( 'bp_before_directory_groups_content' );
  39  }
  40  
  41  /**
  42   * Template tag to wrap all Legacy actions that was used
  43   * after the groups directory content
  44   *
  45   * @since 3.0.0
  46   */
  47  function bp_nouveau_after_groups_directory_content() {
  48      /**
  49       * Fires and displays the group content.
  50       *
  51       * @since 1.1.0
  52       */
  53      do_action( 'bp_directory_groups_content' );
  54  
  55      /**
  56       * Fires after the display of the groups content.
  57       *
  58       * @since 1.1.0
  59       */
  60      do_action( 'bp_after_directory_groups_content' );
  61  
  62      /**
  63       * Fires after the display of the groups.
  64       *
  65       * @since 1.1.0
  66       */
  67      do_action( 'bp_after_directory_groups' );
  68  }
  69  
  70  /**
  71   * Fire specific hooks into the groups create template.
  72   *
  73   * @since 3.0.0
  74   *
  75   * @param string $when   Optional. Either 'before' or 'after'.
  76   * @param string $suffix Optional. Use it to add terms at the end of the hook name.
  77   */
  78  function bp_nouveau_groups_create_hook( $when = '', $suffix = '' ) {
  79      $hook = array( 'bp' );
  80  
  81      if ( $when ) {
  82          $hook[] = $when;
  83      }
  84  
  85      // It's a create group hook
  86      $hook[] = 'create_group';
  87  
  88      if ( $suffix ) {
  89          $hook[] = $suffix;
  90      }
  91  
  92      bp_nouveau_hook( $hook );
  93  }
  94  
  95  /**
  96   * Fire specific hooks into the single groups templates.
  97   *
  98   * @since 3.0.0
  99   *
 100   * @param string $when   Optional. Either 'before' or 'after'.
 101   * @param string $suffix Optional. Use it to add terms at the end of the hook name.
 102   */
 103  function bp_nouveau_group_hook( $when = '', $suffix = '' ) {
 104      $hook = array( 'bp' );
 105  
 106      if ( $when ) {
 107          $hook[] = $when;
 108      }
 109  
 110      // It's a group hook
 111      $hook[] = 'group';
 112  
 113      if ( $suffix ) {
 114          $hook[] = $suffix;
 115      }
 116  
 117      bp_nouveau_hook( $hook );
 118  }
 119  
 120  /**
 121   * Fire an isolated hook inside the groups loop
 122   *
 123   * @since 3.0.0
 124   */
 125  function bp_nouveau_groups_loop_item() {
 126      /**
 127       * Fires inside the listing of an individual group listing item.
 128       *
 129       * @since 1.1.0
 130       */
 131      do_action( 'bp_directory_groups_item' );
 132  }
 133  
 134  /**
 135   * Display the current group activity post form if needed
 136   *
 137   * @since 3.0.0
 138   */
 139  function bp_nouveau_groups_activity_post_form() {
 140      /**
 141       * Fires before the display of the group activity post form.
 142       *
 143       * @since 1.2.0
 144       */
 145      do_action( 'bp_before_group_activity_post_form' );
 146  
 147      if ( is_user_logged_in() && bp_group_is_member() ) {
 148          bp_get_template_part( 'activity/post-form' );
 149      }
 150  
 151      /**
 152       * Fires after the display of the group activity post form.
 153       *
 154       * @since 1.2.0
 155       */
 156      do_action( 'bp_after_group_activity_post_form' );
 157  }
 158  
 159  /**
 160   * Load the Group Invites UI.
 161   *
 162   * @since 3.0.0
 163   *
 164   * @return string HTML Output.
 165   */
 166  function bp_nouveau_group_invites_interface() {
 167      /**
 168       * Fires before the send invites content.
 169       *
 170       * @since 1.1.0
 171       */
 172      do_action( 'bp_before_group_send_invites_content' );
 173  
 174      bp_get_template_part( 'common/js-templates/invites/index' );
 175  
 176      /**
 177       * Fires after the send invites content.
 178       *
 179       * @since 1.2.0
 180       */
 181      do_action( 'bp_after_group_send_invites_content' );
 182  }
 183  
 184  /**
 185   * Gets the displayed user group invites preferences
 186   *
 187   * @since 3.0.0
 188   * @since 4.4.0
 189   *
 190   * @param  int $user_id The user ID to check group invites preference for.
 191   * @return int          Returns 1 if user chose to restrict to friends, 0 otherwise.
 192   */
 193  function bp_nouveau_groups_get_group_invites_setting( $user_id = 0 ) {
 194      if ( ! $user_id ) {
 195          $user_id = bp_displayed_user_id();
 196      }
 197  
 198      return (int) bp_get_user_meta( $user_id, '_bp_nouveau_restrict_invites_to_friends' );
 199  }
 200  
 201  /**
 202   * Outputs the group creation numbered steps navbar
 203   *
 204   * @since 3.0.0
 205   *
 206   * @todo This output isn't localised correctly.
 207   */
 208  function bp_nouveau_group_creation_tabs() {
 209      $bp = buddypress();
 210  
 211      if ( ! is_array( $bp->groups->group_creation_steps ) ) {
 212          return;
 213      }
 214  
 215      if ( ! bp_get_groups_current_create_step() ) {
 216          $keys                            = array_keys( $bp->groups->group_creation_steps );
 217          $bp->groups->current_create_step = array_shift( $keys );
 218      }
 219  
 220      $counter = 1;
 221  
 222      foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) {
 223          $is_enabled = bp_are_previous_group_creation_steps_complete( $slug ); ?>
 224  
 225          <li<?php if ( bp_get_groups_current_create_step() === $slug ) : ?> class="current"<?php endif; ?>>
 226              <?php if ( $is_enabled ) : ?>
 227                  <a href="<?php echo esc_url( bp_groups_directory_permalink() . 'create/step/' . $slug . '/' ); ?>">
 228                      <?php echo (int) $counter; ?> <?php echo esc_html( $step['name'] ); ?>
 229                  </a>
 230              <?php else : ?>
 231                  <?php echo (int) $counter; ?>. <?php echo esc_html( $step['name'] ); ?>
 232              <?php endif ?>
 233          </li>
 234              <?php
 235          $counter++;
 236      }
 237  
 238      unset( $is_enabled );
 239  
 240      /**
 241       * Fires at the end of the creation of the group tabs.
 242       *
 243       * @since 1.0.0
 244       */
 245      do_action( 'groups_creation_tabs' );
 246  }
 247  
 248  /**
 249   * Load the requested Create Screen for the new group.
 250   *
 251   * @since 3.0.0
 252   */
 253  function bp_nouveau_group_creation_screen() {
 254      return bp_nouveau_group_manage_screen();
 255  }
 256  
 257  /**
 258   * Load the requested Manage Screen for the current group.
 259   *
 260   * @since 3.0.0
 261   */
 262  
 263  function bp_nouveau_group_manage_screen() {
 264      $action          = bp_action_variable( 0 );
 265      $is_group_create = bp_is_group_create();
 266      $output          = '';
 267  
 268      if ( $is_group_create ) {
 269          $action = bp_action_variable( 1 );
 270      }
 271  
 272      $screen_id = sanitize_file_name( $action );
 273      if ( ! bp_is_group_admin_screen( $screen_id ) && ! bp_is_group_creation_step( $screen_id ) ) {
 274          return;
 275      }
 276  
 277      if ( ! $is_group_create ) {
 278          /**
 279           * Fires inside the group admin form and before the content.
 280           *
 281           * @since 1.1.0
 282           */
 283          do_action( 'bp_before_group_admin_content' );
 284  
 285          $core_screen = bp_nouveau_group_get_core_manage_screens( $screen_id );
 286  
 287      // It's a group step, get the creation screens.
 288      } else {
 289          $core_screen = bp_nouveau_group_get_core_create_screens( $screen_id );
 290      }
 291  
 292      if ( ! $core_screen ) {
 293          if ( ! $is_group_create ) {
 294              /**
 295               * Fires inside the group admin template.
 296               *
 297               * Allows plugins to add custom group edit screens.
 298               *
 299               * @since 1.1.0
 300               */
 301              do_action( 'groups_custom_edit_steps' );
 302  
 303          // Else use the group create hook
 304          } else {
 305              /**
 306               * Fires inside the group admin template.
 307               *
 308               * Allows plugins to add custom group creation steps.
 309               *
 310               * @since 1.1.0
 311               */
 312              do_action( 'groups_custom_create_steps' );
 313          }
 314  
 315      // Else we load the core screen.
 316      } else {
 317          if ( ! empty( $core_screen['hook'] ) ) {
 318              /**
 319               * Fires before the display of group delete admin.
 320               *
 321               * @since 1.1.0 For most hooks.
 322               * @since 2.4.0 For the cover image hook.
 323               */
 324              do_action( 'bp_before_' . $core_screen['hook'] );
 325          }
 326  
 327          $template = 'groups/single/admin/' . $screen_id;
 328  
 329          if ( ! empty( $core_screen['template'] ) ) {
 330              $template = $core_screen['template'];
 331          }
 332  
 333          bp_get_template_part( $template );
 334  
 335          if ( ! empty( $core_screen['hook'] ) ) {
 336  
 337              // Group's "Manage > Details" page.
 338              if ( 'group_details_admin' === $core_screen['hook'] ) {
 339                  /**
 340                   * Fires after the group description admin details.
 341                   *
 342                   * @since 1.0.0
 343                   */
 344                  do_action( 'groups_custom_group_fields_editable' );
 345              }
 346  
 347              /**
 348               * Fires before the display of group delete admin.
 349               *
 350               * @since 1.1.0 For most hooks.
 351               * @since 2.4.0 For the cover image hook.
 352               */
 353              do_action( 'bp_after_' . $core_screen['hook'] );
 354          }
 355  
 356          if ( ! empty( $core_screen['nonce'] ) ) {
 357              if ( ! $is_group_create ) {
 358                  $output = sprintf( '<p><input type="submit" value="%s" id="save" name="save" /></p>', esc_attr__( 'Save Changes', 'buddypress' ) );
 359  
 360                  // Specific case for the delete group screen
 361                  if ( 'delete-group' === $screen_id ) {
 362                      $output = sprintf(
 363                          '<div class="submit">
 364                              <input type="submit" disabled="disabled" value="%s" id="delete-group-button" name="delete-group-button" />
 365                          </div>',
 366                          esc_attr__( 'Delete Group', 'buddypress' )
 367                      );
 368                  }
 369              }
 370          }
 371      }
 372  
 373      if ( $is_group_create ) {
 374          /**
 375           * Fires before the display of the group creation step buttons.
 376           *
 377           * @since 1.1.0
 378           */
 379          do_action( 'bp_before_group_creation_step_buttons' );
 380  
 381          if ( 'crop-image' !== bp_get_avatar_admin_step() ) {
 382              $creation_step_buttons = '';
 383  
 384              if ( ! bp_is_first_group_creation_step() ) {
 385                  $creation_step_buttons .= sprintf(
 386                      '<input type="button" value="%1$s" id="group-creation-previous" name="previous" onclick="%2$s" />',
 387                      esc_attr__( 'Back to Previous Step', 'buddypress' ),
 388                      "location.href='" . esc_js( esc_url_raw( bp_get_group_creation_previous_link() ) ) . "'"
 389                  );
 390              }
 391  
 392              if ( ! bp_is_last_group_creation_step() && ! bp_is_first_group_creation_step() ) {
 393                  $creation_step_buttons .= sprintf(
 394                      '<input type="submit" value="%s" id="group-creation-next" name="save" />',
 395                      esc_attr__( 'Next Step', 'buddypress' )
 396                  );
 397              }
 398  
 399              if ( bp_is_first_group_creation_step() ) {
 400                  $creation_step_buttons .= sprintf(
 401                      '<input type="submit" value="%s" id="group-creation-create" name="save" />',
 402                      esc_attr__( 'Create Group and Continue', 'buddypress' )
 403                  );
 404              }
 405  
 406              if ( bp_is_last_group_creation_step() ) {
 407                  $creation_step_buttons .= sprintf(
 408                      '<input type="submit" value="%s" id="group-creation-finish" name="save" />',
 409                      esc_attr__( 'Finish', 'buddypress' )
 410                  );
 411              }
 412  
 413              // Set the output for the buttons
 414              $output = sprintf( '<div class="submit" id="previous-next">%s</div>', $creation_step_buttons );
 415          }
 416  
 417          /**
 418           * Fires after the display of the group creation step buttons.
 419           *
 420           * @since 1.1.0
 421           */
 422          do_action( 'bp_after_group_creation_step_buttons' );
 423      }
 424  
 425      /**
 426       * Avoid nested forms with the Backbone views for the group invites step.
 427       */
 428      if ( 'group-invites' === bp_get_groups_current_create_step() ) {
 429          printf(
 430              '<form action="%s" method="post" enctype="multipart/form-data">',
 431              bp_get_group_creation_form_action()
 432          );
 433      }
 434  
 435      if ( ! empty( $core_screen['nonce'] ) ) {
 436          wp_nonce_field( $core_screen['nonce'] );
 437      }
 438  
 439      printf(
 440          '<input type="hidden" name="group-id" id="group-id" value="%s" />',
 441          $is_group_create ? esc_attr( bp_get_new_group_id() ) : esc_attr( bp_get_group_id() )
 442      );
 443  
 444      // The submit actions
 445      echo $output;
 446  
 447      if ( ! $is_group_create ) {
 448          /**
 449           * Fires inside the group admin form and after the content.
 450           *
 451           * @since 1.1.0
 452           */
 453          do_action( 'bp_after_group_admin_content' );
 454  
 455      } else {
 456          /**
 457           * Fires and displays the groups directory content.
 458           *
 459           * @since 1.1.0
 460           */
 461          do_action( 'bp_directory_groups_content' );
 462      }
 463  
 464      /**
 465       * Avoid nested forms with the Backbone views for the group invites step.
 466       */
 467      if ( 'group-invites' === bp_get_groups_current_create_step() ) {
 468          echo '</form>';
 469      }
 470  }
 471  
 472  /**
 473   * Output the action buttons for the displayed group
 474   *
 475   * @since 3.0.0
 476   *
 477   * @param array $args Optional. See bp_nouveau_wrapper() for the description of parameters.
 478   */
 479  function bp_nouveau_group_header_buttons( $args = array() ) {
 480      $bp_nouveau = bp_nouveau();
 481  
 482      $output = join( ' ', bp_nouveau_get_groups_buttons( $args ) );
 483  
 484      // On the group's header we need to reset the group button's global.
 485      if ( ! empty( $bp_nouveau->groups->group_buttons ) ) {
 486          unset( $bp_nouveau->groups->group_buttons );
 487      }
 488  
 489      ob_start();
 490      /**
 491       * Fires in the group header actions section.
 492       *
 493       * @since 1.2.6
 494       */
 495      do_action( 'bp_group_header_actions' );
 496      $output .= ob_get_clean();
 497  
 498      if ( ! $output ) {
 499          return;
 500      }
 501  
 502      if ( ! $args ) {
 503          $args = array( 'classes' => array( 'item-buttons' ) );
 504      }
 505  
 506      bp_nouveau_wrapper( array_merge( $args, array( 'output' => $output ) ) );
 507  }
 508  
 509  /**
 510   * Output the action buttons inside the groups loop.
 511   *
 512   * @since 3.0.0
 513   *
 514   * @param array $args Optional. See bp_nouveau_wrapper() for the description of parameters.
 515   */
 516  function bp_nouveau_groups_loop_buttons( $args = array() ) {
 517      if ( empty( $GLOBALS['groups_template'] ) ) {
 518          return;
 519      }
 520  
 521      $args['type'] = 'loop';
 522  
 523      $output = join( ' ', bp_nouveau_get_groups_buttons( $args ) );
 524  
 525      ob_start();
 526      /**
 527       * Fires inside the action section of an individual group listing item.
 528       *
 529       * @since 1.1.0
 530       */
 531      do_action( 'bp_directory_groups_actions' );
 532      $output .= ob_get_clean();
 533  
 534      if ( ! $output ) {
 535          return;
 536      }
 537  
 538      bp_nouveau_wrapper( array_merge( $args, array( 'output' => $output ) ) );
 539  }
 540  
 541  /**
 542   * Output the action buttons inside the invites loop of the displayed user.
 543   *
 544   * @since 3.0.0
 545   *
 546   * @param array $args Optional. See bp_nouveau_wrapper() for the description of parameters.
 547   */
 548  function bp_nouveau_groups_invite_buttons( $args = array() ) {
 549      if ( empty( $GLOBALS['groups_template'] ) ) {
 550          return;
 551      }
 552  
 553      $args['type'] = 'invite';
 554  
 555      $output = join( ' ', bp_nouveau_get_groups_buttons( $args ) );
 556  
 557      ob_start();
 558      /**
 559       * Fires inside the member group item action markup.
 560       *
 561       * @since 1.1.0
 562       */
 563      do_action( 'bp_group_invites_item_action' );
 564      $output .= ob_get_clean();
 565  
 566      if ( ! $output ) {
 567          return;
 568      }
 569  
 570      bp_nouveau_wrapper( array_merge( $args, array( 'output' => $output ) ) );
 571  }
 572  
 573  /**
 574   * Output the action buttons inside the requests loop of the group's manage screen.
 575   *
 576   * @since 3.0.0
 577   *
 578   * @param array $args Optional. See bp_nouveau_wrapper() for the description of parameters.
 579   */
 580  function bp_nouveau_groups_request_buttons( $args = array() ) {
 581      if ( empty( $GLOBALS['requests_template'] ) ) {
 582          return;
 583      }
 584  
 585      $args['type'] = 'request';
 586  
 587      $output = join( ' ', bp_nouveau_get_groups_buttons( $args ) );
 588  
 589      ob_start();
 590      /**
 591       * Fires inside the list of membership request actions.
 592       *
 593       * @since 1.1.0
 594       */
 595      do_action( 'bp_group_membership_requests_admin_item_action' );
 596      $output .= ob_get_clean();
 597  
 598      if ( ! $output ) {
 599          return;
 600      }
 601  
 602      bp_nouveau_wrapper( array_merge( $args, array( 'output' => $output ) ) );
 603  }
 604  
 605  /**
 606   * Output the action buttons inside the manage members loop of the group's manage screen.
 607   *
 608   * @since 3.0.0
 609   *
 610   * @param array $args Optional. See bp_nouveau_wrapper() for the description of parameters.
 611   */
 612  function bp_nouveau_groups_manage_members_buttons( $args = array() ) {
 613      if ( empty( $GLOBALS['members_template'] ) ) {
 614          return;
 615      }
 616  
 617      $args['type'] = 'manage_members';
 618  
 619      $output = join( ' ', bp_nouveau_get_groups_buttons( $args ) );
 620  
 621      ob_start();
 622      /**
 623       * Fires inside the display of a member admin item in group management area.
 624       *
 625       * @since 1.1.0
 626       */
 627      do_action( 'bp_group_manage_members_admin_item' );
 628      $output .= ob_get_clean();
 629  
 630      if ( ! $output ) {
 631          return;
 632      }
 633  
 634      if ( ! $args ) {
 635          $args = array(
 636              'wrapper' => 'span',
 637              'classes' => array( 'small' ),
 638          );
 639      }
 640  
 641      bp_nouveau_wrapper( array_merge( $args, array( 'output' => $output ) ) );
 642  }
 643  
 644      /**
 645       * Get the action buttons for the current group in the loop,
 646       * or the current displayed group.
 647       *
 648       * @since 3.0.0
 649       *
 650       * @param array $args Optional. See bp_nouveau_wrapper() for the description of parameters.
 651       */
 652  	function bp_nouveau_get_groups_buttons( $args = array() ) {
 653          $type = ( ! empty( $args['type'] ) ) ? $args['type'] : 'group';
 654  
 655          // @todo Not really sure why BP Legacy needed to do this...
 656          if ( 'group' === $type && is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
 657              return;
 658          }
 659  
 660          $buttons = array();
 661  
 662          if ( ( 'loop' === $type || 'invite' === $type ) && isset( $GLOBALS['groups_template']->group ) ) {
 663              $group = $GLOBALS['groups_template']->group;
 664          } else {
 665              $group = groups_get_current_group();
 666          }
 667  
 668          if ( empty( $group->id ) ) {
 669              return $buttons;
 670          }
 671  
 672          /*
 673           * If the 'container' is set to 'ul' set $parent_element to li,
 674           * otherwise simply pass any value found in $args or set var false.
 675           */
 676          if ( ! empty( $args['container'] ) && 'ul' === $args['container']  ) {
 677              $parent_element = 'li';
 678          } elseif ( ! empty( $args['parent_element'] ) ) {
 679              $parent_element = $args['parent_element'];
 680          } else {
 681              $parent_element = false;
 682          }
 683  
 684          /*
 685           * If we have a arg value for $button_element passed through
 686           * use it to default all the $buttons['button_element'] values
 687           * otherwise default to 'a' (anchor) o override & hardcode the
 688           * 'element' string on $buttons array.
 689           *
 690           * Icons sets a class for icon display if not using the button element
 691           */
 692          $icons = '';
 693          if ( ! empty( $args['button_element'] ) ) {
 694              $button_element = $args['button_element'] ;
 695          } else {
 696              $button_element = 'a';
 697              $icons = ' icons';
 698          }
 699  
 700          // If we pass through parent classes add them to $button array
 701          $parent_class = '';
 702          if ( ! empty( $args['parent_attr']['class'] ) ) {
 703              $parent_class = $args['parent_attr']['class'];
 704          }
 705  
 706          // Invite buttons on member's invites screen
 707          if ( 'invite' === $type ) {
 708              // Don't show button if not logged in or previously banned
 709              if ( ! is_user_logged_in() || bp_group_is_user_banned( $group ) || empty( $group->status ) ) {
 710                  return $buttons;
 711              }
 712  
 713              // Setup Accept button attributes
 714              $buttons['accept_invite'] =  array(
 715                  'id'                => 'accept_invite',
 716                  'position'          => 5,
 717                  'component'         => 'groups',
 718                  'must_be_logged_in' => true,
 719                  'parent_element'    => $parent_element,
 720                  'link_text'         => esc_html__( 'Accept', 'buddypress' ),
 721                  'button_element'    => $button_element,
 722                  'parent_attr'       => array(
 723                      'id'    => '',
 724                      'class' => $parent_class . ' ' . 'accept',
 725                  ),
 726                  'button_attr'       => array(
 727                      'id'    => '',
 728                      'class' => 'button accept group-button accept-invite',
 729                      'rel'   => '',
 730                  ),
 731              );
 732  
 733              // If button element set add nonce link to data-attr attr
 734              if ( 'button' === $button_element ) {
 735                  $buttons['accept_invite']['button_attr']['data-bp-nonce'] = esc_url( bp_get_group_accept_invite_link() );
 736              } else {
 737                  $buttons['accept_invite']['button_attr']['href'] = esc_url( bp_get_group_accept_invite_link() );
 738              }
 739  
 740              // Setup Reject button attributes
 741              $buttons['reject_invite'] = array(
 742                  'id'                => 'reject_invite',
 743                  'position'          => 15,
 744                  'component'         => 'groups',
 745                  'must_be_logged_in' => true,
 746                  'parent_element'    => $parent_element,
 747                  'link_text'         => __( 'Reject', 'buddypress' ),
 748                  'parent_attr'       => array(
 749                      'id'    => '',
 750                      'class' => $parent_class . ' ' . 'reject',
 751                  ),
 752                  'button_element'    => $button_element,
 753                  'button_attr'       => array(
 754                      'id'    => '',
 755                      'class' => 'button reject group-button reject-invite',
 756                      'rel'   => '',
 757                  ),
 758              );
 759  
 760              // If button element set add nonce link to formaction attr
 761              if ( 'button' === $button_element ) {
 762                  $buttons['reject_invite']['button_attr']['data-bp-nonce'] = esc_url( bp_get_group_reject_invite_link() );
 763              } else {
 764                  $buttons['reject_invite']['button_attr']['href'] = esc_url( bp_get_group_reject_invite_link() );
 765              }
 766  
 767          // Request button for the group's manage screen
 768          } elseif ( 'request' === $type ) {
 769              // Setup Accept button attributes
 770              $buttons['group_membership_accept'] =  array(
 771                  'id'                => 'group_membership_accept',
 772                  'position'          => 5,
 773                  'component'         => 'groups',
 774                  'must_be_logged_in' => true,
 775                  'parent_element'    => $parent_element,
 776                  'link_text'         => esc_html__( 'Accept', 'buddypress' ),
 777                  'button_element'    => $button_element,
 778                  'parent_attr'       => array(
 779                      'id'    => '',
 780                      'class' => $parent_class,
 781                  ),
 782                  'button_attr'       => array(
 783                      'id'    => '',
 784                      'class' => 'button accept',
 785                      'rel'   => '',
 786                  ),
 787              );
 788  
 789              // If button element set add nonce link to data-attr attr
 790              if ( 'button' === $button_element ) {
 791                  $buttons['group_membership_accept']['button_attr']['data-bp-nonce'] = esc_url( bp_get_group_request_accept_link() );
 792              } else {
 793                  $buttons['group_membership_accept']['button_attr']['href'] = esc_url( bp_get_group_request_accept_link() );
 794              }
 795  
 796              $buttons['group_membership_reject'] = array(
 797                  'id'                => 'group_membership_reject',
 798                  'position'          => 15,
 799                  'component'         => 'groups',
 800                  'must_be_logged_in' => true,
 801                  'parent_element'    => $parent_element,
 802                  'button_element'    => $button_element,
 803                  'link_text'         => __( 'Reject', 'buddypress' ),
 804                  'parent_attr'       => array(
 805                      'id'    => '',
 806                      'class' => $parent_class,
 807                  ),
 808                  'button_attr'       => array(
 809                      'id'    => '',
 810                      'class' => 'button reject',
 811                      'rel'   => '',
 812                  ),
 813              );
 814  
 815              // If button element set add nonce link to data-attr attr
 816              if ( 'button' === $button_element ) {
 817                  $buttons['group_membership_reject']['button_attr']['data-bp-nonce'] = esc_url( bp_get_group_request_reject_link() );
 818              } else {
 819                  $buttons['group_membership_reject']['button_attr']['href'] = esc_url( bp_get_group_request_reject_link() );
 820              }
 821  
 822          /*
 823           * Manage group members for the group's manage screen.
 824           * The 'button_attr' keys 'href' & 'formaction' are set at the end of this array block
 825           */
 826          } elseif ( 'manage_members' === $type && isset( $GLOBALS['members_template']->member->user_id ) ) {
 827              $user_id = $GLOBALS['members_template']->member->user_id;
 828  
 829              $buttons = array(
 830                  'unban_member' => array(
 831                      'id'                => 'unban_member',
 832                      'position'          => 5,
 833                      'component'         => 'groups',
 834                      'must_be_logged_in' => true,
 835                      'parent_element'    => $parent_element,
 836                      'button_element'    => $button_element,
 837                      'link_text'         => __( 'Remove Ban', 'buddypress' ),
 838                      'parent_attr'       => array(
 839                          'id'    => '',
 840                          'class' => $parent_class,
 841                      ),
 842                      'button_attr'       => array(
 843                          'id'    => '',
 844                          'class' => 'button confirm member-unban',
 845                          'rel'   => '',
 846                          'title' => '',
 847                      ),
 848                  ),
 849                  'ban_member' => array(
 850                      'id'                => 'ban_member',
 851                      'position'          => 15,
 852                      'component'         => 'groups',
 853                      'must_be_logged_in' => true,
 854                      'parent_element'    => $parent_element,
 855                      'button_element'    => $button_element,
 856                      'link_text'         => __( 'Kick &amp; Ban', 'buddypress' ),
 857                      'parent_attr'       => array(
 858                          'id'    => '',
 859                          'class' => $parent_class,
 860                      ),
 861                      'button_attr'       => array(
 862                          'id'    => '',
 863                          'class' => 'button confirm member-ban',
 864                          'rel'   => '',
 865                          'title' => '',
 866                      ),
 867                  ),
 868                  'promote_mod' => array(
 869                      'id'                => 'promote_mod',
 870                      'position'          => 25,
 871                      'component'         => 'groups',
 872                      'must_be_logged_in' => true,
 873                      'parent_element'    => $parent_element,
 874                      'parent_attr'       => array(
 875                          'id'    => '',
 876                          'class' => $parent_class,
 877                      ),
 878                      'button_element'    => $button_element,
 879                      'button_attr'       => array(
 880                          'id'               => '',
 881                          'class'            => 'button confirm member-promote-to-mod',
 882                          'rel'              => '',
 883                          'title'            => '',
 884                      ),
 885                      'link_text'         => __( 'Promote to Mod', 'buddypress' ),
 886                  ),
 887                  'promote_admin' => array(
 888                      'id'                => 'promote_admin',
 889                      'position'          => 35,
 890                      'component'         => 'groups',
 891                      'must_be_logged_in' => true,
 892                      'parent_element'    => $parent_element,
 893                      'button_element'    => $button_element,
 894                      'link_text'         => __( 'Promote to Admin', 'buddypress' ),
 895                      'parent_attr'       => array(
 896                          'id'    => '',
 897                          'class' => $parent_class,
 898                      ),
 899                      'button_attr'       => array(
 900                          'href'  => esc_url( bp_get_group_member_promote_admin_link() ),
 901                          'id'    => '',
 902                          'class' => 'button confirm member-promote-to-admin',
 903                          'rel'   => '',
 904                          'title' => '',
 905                      ),
 906                  ),
 907                  'remove_member' => array(
 908                      'id'                => 'remove_member',
 909                      'position'          => 45,
 910                      'component'         => 'groups',
 911                      'must_be_logged_in' => true,
 912                      'parent_element'    => $parent_element,
 913                      'button_element'    => $button_element,
 914                      'link_text'         => __( 'Remove from group', 'buddypress' ),
 915                      'parent_attr'       => array(
 916                          'id'    => '',
 917                          'class' => $parent_class,
 918                      ),
 919                      'button_attr'       => array(
 920                          'id'    => '',
 921                          'class' => 'button confirm',
 922                          'rel'   => '',
 923                          'title' => '',
 924                      ),
 925                  ),
 926              );
 927  
 928              // If 'button' element is set add the nonce link to data-attr attr, else add it to the href.
 929              if ( 'button' === $button_element ) {
 930                  $buttons['unban_member']['button_attr']['data-bp-nonce'] = bp_get_group_member_unban_link( $user_id );
 931                  $buttons['ban_member']['button_attr']['data-bp-nonce'] = bp_get_group_member_ban_link( $user_id );
 932                  $buttons['promote_mod']['button_attr']['data-bp-nonce'] = bp_get_group_member_promote_mod_link();
 933                  $buttons['promote_admin']['button_attr']['data-bp-nonce'] = bp_get_group_member_promote_admin_link();
 934                  $buttons['remove_member']['button_attr']['data-bp-nonce'] = bp_get_group_member_remove_link( $user_id );
 935              } else {
 936                  $buttons['unban_member']['button_attr']['href'] = bp_get_group_member_unban_link( $user_id );
 937                  $buttons['ban_member']['button_attr']['href'] = bp_get_group_member_ban_link( $user_id );
 938                  $buttons['promote_mod']['button_attr']['href'] = bp_get_group_member_promote_mod_link();
 939                  $buttons['promote_admin']['button_attr']['href'] = bp_get_group_member_promote_admin_link();
 940                  $buttons['remove_member']['button_attr']['href'] = bp_get_group_member_remove_link( $user_id );
 941              }
 942  
 943          // Membership button on groups loop or single group's header
 944          } else {
 945              /*
 946               * This filter workaround is waiting for a core adaptation
 947               * so that we can directly get the groups button arguments
 948               * instead of the button.
 949               *
 950               * See https://buddypress.trac.wordpress.org/ticket/7126
 951               */
 952              add_filter( 'bp_get_group_join_button', 'bp_nouveau_groups_catch_button_args', 100, 1 );
 953  
 954              bp_get_group_join_button( $group );
 955  
 956              remove_filter( 'bp_get_group_join_button', 'bp_nouveau_groups_catch_button_args', 100, 1 );
 957  
 958              if ( isset( bp_nouveau()->groups->button_args ) && bp_nouveau()->groups->button_args ) {
 959                  $button_args = bp_nouveau()->groups->button_args;
 960  
 961                  // If we pass through parent classes merge those into the existing ones
 962                  if ( $parent_class ) {
 963                      $parent_class .= ' ' . $button_args['wrapper_class'];
 964                  }
 965  
 966                  // The join or leave group header button should default to 'button'
 967                  // Reverse the earler button var to set default as 'button' not 'a'
 968                  if ( empty( $args['button_element'] ) ) {
 969                      $button_element = 'button';
 970                  }
 971  
 972                  $buttons['group_membership'] = array(
 973                      'id'                => 'group_membership',
 974                      'position'          => 5,
 975                      'component'         => $button_args['component'],
 976                      'must_be_logged_in' => $button_args['must_be_logged_in'],
 977                      'block_self'        => $button_args['block_self'],
 978                      'parent_element'    => $parent_element,
 979                      'button_element'    => $button_element,
 980                      'link_text'         => $button_args['link_text'],
 981                      'parent_attr'       => array(
 982                              'id'    => $button_args['wrapper_id'],
 983                              'class' => $parent_class,
 984                      ),
 985                      'button_attr'       => array(
 986                          'id'    => ! empty( $button_args['link_id'] ) ? $button_args['link_id'] : '',
 987                          'class' => $button_args['link_class'] . ' button',
 988                          'rel'   => ! empty( $button_args['link_rel'] ) ? $button_args['link_rel'] : '',
 989                          'title' => '',
 990                      ),
 991                  );
 992  
 993              // If button element set add nonce 'href' link to data-attr attr.
 994              if ( 'button' === $button_element ) {
 995                  $buttons['group_membership']['button_attr']['data-bp-nonce'] = $button_args['link_href'];
 996              } else {
 997              // Else this is an anchor so use an 'href' attr.
 998                  $buttons['group_membership']['button_attr']['href'] = $button_args['link_href'];
 999              }
1000  
1001                  unset( bp_nouveau()->groups->button_args );
1002              }
1003          }
1004  
1005          /**
1006           * Filter to add your buttons, use the position argument to choose where to insert it.
1007           *
1008           * @since 3.0.0
1009           *
1010           * @param array  $buttons The list of buttons.
1011           * @param int    $group   The current group object.
1012           * @param string $type    Whether we're displaying a groups loop or a groups single item.
1013           */
1014          $buttons_group = apply_filters( 'bp_nouveau_get_groups_buttons', $buttons, $group, $type );
1015  
1016          if ( ! $buttons_group ) {
1017              return $buttons;
1018          }
1019  
1020          // It's the first entry of the loop, so build the Group and sort it
1021          if ( ! isset( bp_nouveau()->groups->group_buttons ) || ! is_a( bp_nouveau()->groups->group_buttons, 'BP_Buttons_Group' ) ) {
1022              $sort = true;
1023              bp_nouveau()->groups->group_buttons = new BP_Buttons_Group( $buttons_group );
1024  
1025          // It's not the first entry, the order is set, we simply need to update the Buttons Group
1026          } else {
1027              $sort = false;
1028              bp_nouveau()->groups->group_buttons->update( $buttons_group );
1029          }
1030  
1031          $return = bp_nouveau()->groups->group_buttons->get( $sort );
1032  
1033          if ( ! $return ) {
1034              return array();
1035          }
1036  
1037          // Remove buttons according to the user's membership type.
1038          if ( 'manage_members' === $type && isset( $GLOBALS['members_template'] ) ) {
1039              if ( bp_get_group_member_is_banned() ) {
1040                  unset( $return['ban_member'], $return['promote_mod'], $return['promote_admin'] );
1041              } else {
1042                  unset( $return['unban_member'] );
1043              }
1044          }
1045  
1046          /**
1047           * Leave a chance to adjust the $return
1048           *
1049           * @since 3.0.0
1050           *
1051           * @param array  $return  The list of buttons.
1052           * @param int    $group   The current group object.
1053           * @parem string $type    Whether we're displaying a groups loop or a groups single item.
1054           */
1055          do_action_ref_array( 'bp_nouveau_return_groups_buttons', array( &$return, $group, $type ) );
1056  
1057          return $return;
1058      }
1059  
1060  /**
1061   * Does the group has metas or a specific meta value.
1062   *
1063   * @since 3.0.0
1064   * @since 3.2.0 Adds the $meta_key argument.
1065   *
1066   * @param  string $meta_key The key of the meta to check the value for.
1067   * @return bool             True if the group has meta. False otherwise.
1068   */
1069  function bp_nouveau_group_has_meta( $meta_key = '' ) {
1070      if ( ! $meta_key ) {
1071          $meta_keys = array( 'status', 'count' );
1072      } else {
1073          $meta_keys = array( $meta_key );
1074      }
1075  
1076      $group_meta = bp_nouveau_get_group_meta( $meta_keys );
1077      $group_meta = array_filter( $group_meta );
1078  
1079      return ! empty( $group_meta );
1080  }
1081  
1082  /**
1083   * Does the group have extra meta?
1084   *
1085   * @since 3.0.0
1086   *
1087   * @return bool True if the group has meta. False otherwise.
1088   */
1089  function bp_nouveau_group_has_meta_extra() {
1090      return false !== bp_nouveau_get_hooked_group_meta();
1091  }
1092  
1093  /**
1094   * Display the group meta.
1095   *
1096   * @since 3.0.0
1097   * @deprecated 7.0.0 Use bp_nouveau_the_group_meta()
1098   * @see bp_nouveau_the_group_meta()
1099   *
1100   * @return string HTML Output.
1101   */
1102  function bp_nouveau_group_meta() {
1103      _deprecated_function( __FUNCTION__, '7.0.0', 'bp_nouveau_the_group_meta()' );
1104      $group_meta = new BP_Nouveau_Group_Meta();
1105  
1106      if ( ! bp_is_group() ) {
1107          echo $group_meta->meta;
1108      } else {
1109          return $group_meta;
1110      }
1111  }
1112  
1113  /**
1114   * Outputs or returns the group meta(s).
1115   *
1116   * @since 7.0.0
1117   *
1118   * @param array $args {
1119   *     Optional. An array of arguments.
1120   *
1121   *     @type array   $keys      The list of template meta keys.
1122   *     @type string  $delimeter The delimeter to use in case there is more than
1123   *                              one key to output.
1124   *     @type boolean $echo      True to output the template meta value. False otherwise.
1125   * }
1126   * @return string HTML Output.
1127   */
1128  function bp_nouveau_the_group_meta( $args = array() ) {
1129      $r = bp_parse_args( $args, array(
1130          'keys'      => array(),
1131          'delimeter' => '/',
1132          'echo'      => true,
1133      ), 'nouveau_the_group_meta' );
1134  
1135      $group_meta = (array) bp_nouveau_get_group_meta( $r['keys'] );
1136  
1137      if ( ! $group_meta ) {
1138          return;
1139      }
1140  
1141      $meta = '';
1142      if ( 1 < count( $group_meta ) ) {
1143          $group_meta = array_filter( $group_meta );
1144          $meta       = join( ' ' . $r['delimeter'] . ' ', array_map( 'esc_html', $group_meta ) );
1145      } else {
1146          $meta = reset( $group_meta );
1147      }
1148  
1149      if ( ! $r['echo'] ) {
1150          return $meta;
1151      }
1152  
1153      echo $meta;
1154  }
1155  
1156      /**
1157       * Get the group template meta.
1158       *
1159       * @since 3.0.0
1160       * @since 7.0.0 Adds the `$keys` parameter.
1161       *
1162       * @param array $keys One or more template meta keys to populate with their values.
1163       *                    Possible keys are `status`, `count`, `group_type_list`, `description`, `extra`.
1164       * @return array      The corresponding group template meta values.
1165       */
1166  	function bp_nouveau_get_group_meta( $keys = array() ) {
1167          $keys       = (array) $keys;
1168          $group      = false;
1169          $group_meta = array();
1170          $is_group   = bp_is_group();
1171  
1172          if ( isset( $GLOBALS['groups_template']->group ) ) {
1173              $group = $GLOBALS['groups_template']->group;
1174          } else {
1175              $group = groups_get_current_group();
1176          }
1177  
1178          if ( ! $group ) {
1179              return '';
1180          }
1181  
1182          if ( ! $keys && ! $is_group ) {
1183              $keys = array( 'status', 'count' );
1184          }
1185  
1186          foreach ( $keys as $key ) {
1187              switch ( $key ) {
1188                  case 'status' :
1189                      $group_meta['status'] = bp_get_group_type( $group );
1190                      break;
1191  
1192                  case 'count' :
1193                      $group_meta['count'] = bp_get_group_member_count( $group );
1194                      break;
1195  
1196                  case 'group_type_list' :
1197                      $group_meta['group_type_list'] = bp_get_group_type_list( $group->id );
1198                      break;
1199  
1200                  case 'description' :
1201                      $group_meta['description'] = bp_get_group_description( $group );
1202                      break;
1203  
1204                  case 'extra' :
1205                      $group_meta['extra'] = '';
1206  
1207                      if ( $is_group ) {
1208                          $group_meta['extra'] = bp_nouveau_get_hooked_group_meta();
1209                      }
1210                      break;
1211              }
1212          }
1213  
1214          /**
1215           * Filter to add/remove Group template meta.
1216           *
1217           * @since 3.0.0
1218           *
1219           * @param array  $group_meta The list of meta to output.
1220           * @param object $group      The current Group of the loop object.
1221           * @param bool   $is_group   True if a single group is displayed. False otherwise.
1222           */
1223          return apply_filters( 'bp_nouveau_get_group_meta', $group_meta, $group, $is_group );
1224      }
1225  
1226  /**
1227   * Load the appropriate content for the single group pages
1228   *
1229   * @since 3.0.0
1230   */
1231  function bp_nouveau_group_template_part() {
1232      /**
1233       * Fires before the display of the group home body.
1234       *
1235       * @since 1.2.0
1236       */
1237      do_action( 'bp_before_group_body' );
1238  
1239      $bp_is_group_home = bp_is_group_home();
1240  
1241      if ( $bp_is_group_home && ! bp_current_user_can( 'groups_access_group' ) ) {
1242          /**
1243           * Fires before the display of the group status message.
1244           *
1245           * @since 1.1.0
1246           */
1247          do_action( 'bp_before_group_status_message' );
1248          ?>
1249  
1250          <div id="message" class="info">
1251              <p><?php bp_group_status_message(); ?></p>
1252          </div>
1253  
1254          <?php
1255  
1256          /**
1257           * Fires after the display of the group status message.
1258           *
1259           * @since 1.1.0
1260           */
1261          do_action( 'bp_after_group_status_message' );
1262  
1263      // We have a front template, Use BuddyPress function to load it.
1264      } elseif ( $bp_is_group_home && false !== bp_groups_get_front_template() ) {
1265          bp_groups_front_template_part();
1266  
1267      // Otherwise use BP_Nouveau template hierarchy
1268      } else {
1269          $template = 'plugins';
1270  
1271          // the home page
1272          if ( $bp_is_group_home ) {
1273              if ( bp_is_active( 'activity' ) ) {
1274                  $template = 'activity';
1275              } else {
1276                  $template = 'members';
1277              }
1278  
1279          // Not the home page
1280          } elseif ( bp_is_group_admin_page() ) {
1281              $template = 'admin';
1282          } elseif ( bp_is_group_activity() ) {
1283              $template = 'activity';
1284          } elseif ( bp_is_group_members() ) {
1285              $template = 'members';
1286          } elseif ( bp_is_group_invites() ) {
1287              $template = 'send-invites';
1288          } elseif ( bp_is_group_membership_request() ) {
1289              $template = 'request-membership';
1290          }
1291  
1292          bp_nouveau_group_get_template_part( $template );
1293      }
1294  
1295      /**
1296       * Fires after the display of the group home body.
1297       *
1298       * @since 1.2.0
1299       */
1300      do_action( 'bp_after_group_body' );
1301  }
1302  
1303  /**
1304   * Use the appropriate Group header and enjoy a template hierarchy
1305   *
1306   * @since 3.0.0
1307   */
1308  function bp_nouveau_group_header_template_part() {
1309      $template = 'group-header';
1310  
1311      if ( bp_group_use_cover_image_header() ) {
1312          $template = 'cover-image-header';
1313      }
1314  
1315      /**
1316       * Fires before the display of a group's header.
1317       *
1318       * @since 1.2.0
1319       */
1320      do_action( 'bp_before_group_header' );
1321  
1322      // Get the template part for the header
1323      bp_nouveau_group_get_template_part( $template );
1324  
1325      /**
1326       * Fires after the display of a group's header.
1327       *
1328       * @since 1.2.0
1329       */
1330      do_action( 'bp_after_group_header' );
1331  
1332      bp_nouveau_template_notices();
1333  }
1334  
1335  /**
1336   * Get a link to set the Group's default front page and directly
1337   * reach the Customizer section where it's possible to do it.
1338   *
1339   * @since 3.0.0
1340   *
1341   * @return string HTML Output
1342   */
1343  function bp_nouveau_groups_get_customizer_option_link() {
1344      return bp_nouveau_get_customizer_link(
1345          array(
1346              'object'    => 'group',
1347              'autofocus' => 'bp_nouveau_group_front_page',
1348              'text'      => __( 'Groups default front page', 'buddypress' ),
1349          )
1350      );
1351  }
1352  
1353  /**
1354   * Get a link to set the Group's front page widgets and directly
1355   * reach the Customizer section where it's possible to do it.
1356   *
1357   * @since 3.0.0
1358   *
1359   * @return string HTML Output
1360   */
1361  function bp_nouveau_groups_get_customizer_widgets_link() {
1362      return bp_nouveau_get_customizer_link(
1363          array(
1364              'object'    => 'group',
1365              'autofocus' => 'sidebar-widgets-sidebar-buddypress-groups',
1366              'text'      => __( '(BuddyPress) Widgets', 'buddypress' ),
1367          )
1368      );
1369  }
1370  
1371  /**
1372   * Output the group description excerpt
1373   *
1374   * @since 3.0.0
1375   *
1376   * @param object $group Optional. The group being referenced.
1377   *                      Defaults to the group currently being iterated on in the groups loop.
1378   * @param int $length   Optional. Length of returned string, including ellipsis. Default: 100.
1379   *
1380   * @return string Excerpt.
1381   */
1382  function bp_nouveau_group_description_excerpt( $group = null, $length = null ) {
1383      echo bp_nouveau_get_group_description_excerpt( $group, $length );
1384  }
1385  
1386  /**
1387   * Filters the excerpt of a group description.
1388   *
1389   * Checks if the group loop is set as a 'Grid' layout and returns a reduced excerpt.
1390   *
1391   * @since 3.0.0
1392   *
1393   * @param object $group Optional. The group being referenced. Defaults to the group currently being
1394   *                      iterated on in the groups loop.
1395   * @param int $length   Optional. Length of returned string, including ellipsis. Default: 100.
1396   *
1397   * @return string Excerpt.
1398   */
1399  function bp_nouveau_get_group_description_excerpt( $group = null, $length = null ) {
1400      global $groups_template;
1401  
1402      if ( ! $group ) {
1403          $group =& $groups_template->group;
1404      }
1405  
1406      /**
1407       * If this is a grid layout but no length is passed in set a shorter
1408       * default value otherwise use the passed in value.
1409       * If not a grid then the BP core default is used or passed in value.
1410       */
1411      if ( bp_nouveau_loop_is_grid() && 'groups' === bp_current_component() ) {
1412          if ( ! $length ) {
1413              $length = 100;
1414          } else {
1415              $length = $length;
1416          }
1417      }
1418  
1419      /**
1420       * Filters the excerpt of a group description.
1421       *
1422       * @since 3.0.0
1423       *
1424       * @param string $value Excerpt of a group description.
1425       * @param object $group Object for group whose description is made into an excerpt.
1426       */
1427      return apply_filters( 'bp_nouveau_get_group_description_excerpt', bp_create_excerpt( $group->description, $length ), $group );
1428  }
1429  
1430  /**
1431   * Output "checked" attribute to determine if the group type should be checked.
1432   *
1433   * @since 3.2.0
1434   *
1435   * @param object $type Group type object. See bp_groups_get_group_type_object().
1436   */
1437  function bp_nouveau_group_type_checked( $type = null ) {
1438      if ( ! is_object( $type ) ) {
1439          return;
1440      }
1441  
1442      // Group creation screen requires a different check.
1443      if ( bp_is_group_create() ) {
1444          checked( true, ! empty( $type->create_screen_checked ) );
1445      } elseif ( bp_is_group() ) {
1446          checked( bp_groups_has_group_type( bp_get_current_group_id(), $type->name ) );
1447      }
1448  }
1449  
1450  /**
1451   * Adds the "Notify group members of these changes" checkbox to the Manage > Details panel.
1452   *
1453   * See #7837 for background on why this technique is required.
1454   *
1455   * @since 4.0.0
1456   */
1457  function bp_nouveau_add_notify_group_members_checkbox() {
1458      printf( '<p class="bp-controls-wrap">
1459          <label for="group-notify-members" class="bp-label-text">
1460              <input type="checkbox" name="group-notify-members" id="group-notify-members" value="1" /> %s
1461          </label>
1462      </p>', esc_html__( 'Notify group members of these changes via email', 'buddypress' ) );
1463  }
1464  add_action( 'groups_custom_group_fields_editable', 'bp_nouveau_add_notify_group_members_checkbox', 20 );


Generated: Wed Dec 2 01:01:35 2020 Cross-referenced by PHPXref 0.7.1