[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-groups/ -> bp-groups-cssjs.php (source)

   1  <?php
   2  /**
   3   * Groups component CSS/JS
   4   *
   5   * @package BuddyPress
   6   * @subpackage GroupsScripts
   7   * @since 5.0.0
   8   */
   9  
  10  // Exit if accessed directly.
  11  defined( 'ABSPATH' ) || exit;
  12  
  13  /**
  14   * Register Groups JavaScripts.
  15   *
  16   * @since 5.0.0
  17   */
  18  function bp_groups_register_scripts() {
  19      wp_register_script(
  20          'bp-group-manage-members',
  21          sprintf( '%1$sbp-groups/js/manage-members%2$s.js', buddypress()->plugin_url, bp_core_get_minified_asset_suffix() ),
  22          array( 'json2', 'wp-backbone', 'bp-api-request' ),
  23          bp_get_version(),
  24          true
  25      );
  26  }
  27  add_action( 'bp_enqueue_scripts',       'bp_groups_register_scripts', 1 );
  28  add_action( 'bp_admin_enqueue_scripts', 'bp_groups_register_scripts', 1 );
  29  
  30  /**
  31   * Get JavaScript data for the Manage Group Members UI.
  32   *
  33   * @since 5.0.0
  34   *
  35   * @param  integer $group_id Required. The Group ID whose members has to be managed.
  36   * @return array   The JavaScript data.
  37   */
  38  function bp_groups_get_group_manage_members_script_data( $group_id = 0 ) {
  39      if ( ! $group_id ) {
  40          return array();
  41      } else {
  42          $group_id = (int) $group_id;
  43      }
  44  
  45      $path = sprintf( '/%1$s/%2$s/%3$s/%4$s/members?exclude_admins=false',
  46          bp_rest_namespace(),
  47          bp_rest_version(),
  48          buddypress()->groups->id,
  49          $group_id
  50      );
  51  
  52      $preloaded_members = array();
  53      if ( function_exists( 'rest_preload_api_request' ) ) {
  54          $preloaded_members = rest_preload_api_request( '', $path );
  55      }
  56  
  57      return array(
  58          'path'      => remove_query_arg( 'exclude_admins', $path ),
  59          'preloaded' => reset( $preloaded_members ),
  60          'roles'     => bp_groups_get_group_roles(),
  61      );
  62  }


Generated: Wed Nov 13 01:01:39 2019 Cross-referenced by PHPXref 0.7.1