[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
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', 'wp-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 = rest_preload_api_request( '', $path ); 53 54 return array( 55 'path' => remove_query_arg( 'exclude_admins', $path ), 56 'preloaded' => reset( $preloaded_members ), 57 'roles' => bp_groups_get_group_roles(), 58 'strings' => array( 59 'allMembers' => _x( 'All members', 'Group Manage Members dropdown default option', 'buddypress' ), 60 ), 61 ); 62 } 63 64 /** 65 * Registers a new script to manage the dynamic part of the Dynamic groups widget/block. 66 * 67 * @since 9.0.0 68 * 69 * @param array $scripts Data about the scripts to register. 70 * @return array Data about the scripts to register. 71 */ 72 function bp_groups_register_widget_block_scripts( $scripts = array() ) { 73 $scripts['bp-dynamic-groups-script'] = array( 74 'file' => plugins_url( 'js/dynamic-groups.js', __FILE__ ), 75 'dependencies' => array( 76 'bp-dynamic-widget-block-script', 77 'wp-i18n', 78 ), 79 'footer' => true, 80 ); 81 82 return $scripts; 83 } 84 add_filter( 'bp_core_register_common_scripts', 'bp_groups_register_widget_block_scripts', 9, 1 );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 24 01:00:53 2024 | Cross-referenced by PHPXref 0.7.1 |