Changeset 13087
- Timestamp:
- 08/22/2021 04:47:17 PM (3 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/classes/class-bp-groups-component.php
r13004 r13087 216 216 217 217 /** 218 * Set up component global data. 219 * 220 * The BP_GROUPS_SLUG constant is deprecated, and only used here for 221 * backwards compatibility. 222 * 223 * @since 1.5.0 224 * 225 * @see BP_Component::setup_globals() for a description of arguments. 226 * 227 * @param array $args See BP_Component::setup_globals() for a description. 228 */ 229 public function setup_globals( $args = array() ) { 218 * Set up additional globals for the component. 219 * 220 * @since 10.0.0 221 */ 222 public function setup_additional_globals() { 230 223 $bp = buddypress(); 231 232 // Define a slug, if necessary.233 if ( ! defined( 'BP_GROUPS_SLUG' ) ) {234 define( 'BP_GROUPS_SLUG', $this->id );235 }236 237 // Global tables for groups component.238 $global_tables = array(239 'table_name' => $bp->table_prefix . 'bp_groups',240 'table_name_members' => $bp->table_prefix . 'bp_groups_members',241 'table_name_groupmeta' => $bp->table_prefix . 'bp_groups_groupmeta'242 );243 244 // Metadata tables for groups component.245 $meta_tables = array(246 'group' => $bp->table_prefix . 'bp_groups_groupmeta',247 );248 249 // Fetch the default directory title.250 $default_directory_titles = bp_core_get_directory_page_default_titles();251 $default_directory_title = $default_directory_titles[$this->id];252 253 // All globals for groups component.254 // Note that global_tables is included in this array.255 $args = array(256 'slug' => BP_GROUPS_SLUG,257 'root_slug' => isset( $bp->pages->groups->slug ) ? $bp->pages->groups->slug : BP_GROUPS_SLUG,258 'has_directory' => true,259 'directory_title' => isset( $bp->pages->groups->title ) ? $bp->pages->groups->title : $default_directory_title,260 'notification_callback' => 'groups_format_notifications',261 'search_string' => _x( 'Search Groups...', 'Component directory search', 'buddypress' ),262 'global_tables' => $global_tables,263 'meta_tables' => $meta_tables,264 'block_globals' => array(265 'bp/dynamic-groups' => array(266 'widget_classnames' => array( 'widget_bp_groups_widget', 'buddypress' ),267 ),268 ),269 );270 271 parent::setup_globals( $args );272 224 273 225 /* Single Group Globals **********************************************/ … … 442 394 // Auto join group when non group member performs group activity. 443 395 $this->auto_join = defined( 'BP_DISABLE_AUTO_GROUP_JOIN' ) && BP_DISABLE_AUTO_GROUP_JOIN ? false : true; 396 } 397 398 /** 399 * Set up component global data. 400 * 401 * The BP_GROUPS_SLUG constant is deprecated, and only used here for 402 * backwards compatibility. 403 * 404 * @since 1.5.0 405 * 406 * @see BP_Component::setup_globals() for a description of arguments. 407 * 408 * @param array $args See BP_Component::setup_globals() for a description. 409 */ 410 public function setup_globals( $args = array() ) { 411 $bp = buddypress(); 412 413 // Define a slug, if necessary. 414 if ( ! defined( 'BP_GROUPS_SLUG' ) ) { 415 define( 'BP_GROUPS_SLUG', $this->id ); 416 } 417 418 // Global tables for groups component. 419 $global_tables = array( 420 'table_name' => $bp->table_prefix . 'bp_groups', 421 'table_name_members' => $bp->table_prefix . 'bp_groups_members', 422 'table_name_groupmeta' => $bp->table_prefix . 'bp_groups_groupmeta' 423 ); 424 425 // Metadata tables for groups component. 426 $meta_tables = array( 427 'group' => $bp->table_prefix . 'bp_groups_groupmeta', 428 ); 429 430 // Fetch the default directory title. 431 $default_directory_titles = bp_core_get_directory_page_default_titles(); 432 $default_directory_title = $default_directory_titles[$this->id]; 433 434 // All globals for groups component. 435 // Note that global_tables is included in this array. 436 $args = array( 437 'slug' => BP_GROUPS_SLUG, 438 'root_slug' => isset( $bp->pages->groups->slug ) ? $bp->pages->groups->slug : BP_GROUPS_SLUG, 439 'has_directory' => true, 440 'directory_title' => isset( $bp->pages->groups->title ) ? $bp->pages->groups->title : $default_directory_title, 441 'notification_callback' => 'groups_format_notifications', 442 'search_string' => _x( 'Search Groups...', 'Component directory search', 'buddypress' ), 443 'global_tables' => $global_tables, 444 'meta_tables' => $meta_tables, 445 'block_globals' => array( 446 'bp/dynamic-groups' => array( 447 'widget_classnames' => array( 'widget_bp_groups_widget', 'buddypress' ), 448 ), 449 ), 450 ); 451 452 parent::setup_globals( $args ); 453 454 // Additional globals. 455 $this->setup_additional_globals(); 444 456 } 445 457 -
trunk/src/bp-members/classes/class-bp-members-component.php
r13021 r13087 153 153 require $this->path . 'bp-members/screens/invitations.php'; 154 154 } 155 } 156 157 /** 158 * Set up additional globals for the component. 159 * 160 * @since 10.0.0 161 */ 162 public function setup_additional_globals() { 163 $bp = buddypress(); 164 165 /** Logged in user *************************************************** 166 */ 167 168 // The core userdata of the user who is currently logged in. 169 $bp->loggedin_user->userdata = bp_core_get_core_userdata( bp_loggedin_user_id() ); 170 171 // Fetch the full name for the logged in user. 172 $bp->loggedin_user->fullname = isset( $bp->loggedin_user->userdata->display_name ) ? $bp->loggedin_user->userdata->display_name : ''; 173 174 // Hits the DB on single WP installs so get this separately. 175 $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin( bp_loggedin_user_id() ); 176 177 // The domain for the user currently logged in. eg: http://example.com/members/andy. 178 $bp->loggedin_user->domain = bp_core_get_user_domain( bp_loggedin_user_id() ); 179 180 /** Displayed user *************************************************** 181 */ 182 183 // The core userdata of the user who is currently being displayed. 184 $bp->displayed_user->userdata = bp_core_get_core_userdata( bp_displayed_user_id() ); 185 186 // Fetch the full name displayed user. 187 $bp->displayed_user->fullname = isset( $bp->displayed_user->userdata->display_name ) ? $bp->displayed_user->userdata->display_name : ''; 188 189 // The domain for the user currently being displayed. 190 $bp->displayed_user->domain = bp_core_get_user_domain( bp_displayed_user_id() ); 191 192 // If A user is displayed, check if there is a front template 193 if ( bp_get_displayed_user() ) { 194 $bp->displayed_user->front_template = bp_displayed_user_get_front_template(); 195 } 196 197 /** Initialize the nav for the members component ********************* 198 */ 199 200 $this->nav = new BP_Core_Nav(); 201 202 /** Signup *********************************************************** 203 */ 204 205 $bp->signup = new stdClass; 206 207 /** Profiles Fallback ************************************************ 208 */ 209 210 if ( ! bp_is_active( 'xprofile' ) ) { 211 $bp->profile = new stdClass; 212 $bp->profile->slug = 'profile'; 213 $bp->profile->id = 'profile'; 214 } 215 216 /** Network Invitations ************************************************** 217 */ 218 219 $bp->members->invitations = new stdClass; 155 220 } 156 221 … … 213 278 parent::setup_globals( $args ); 214 279 215 /** Logged in user *************************************************** 216 */ 217 218 // The core userdata of the user who is currently logged in. 219 $bp->loggedin_user->userdata = bp_core_get_core_userdata( bp_loggedin_user_id() ); 220 221 // Fetch the full name for the logged in user. 222 $bp->loggedin_user->fullname = isset( $bp->loggedin_user->userdata->display_name ) ? $bp->loggedin_user->userdata->display_name : ''; 223 224 // Hits the DB on single WP installs so get this separately. 225 $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin( bp_loggedin_user_id() ); 226 227 // The domain for the user currently logged in. eg: http://example.com/members/andy. 228 $bp->loggedin_user->domain = bp_core_get_user_domain( bp_loggedin_user_id() ); 229 230 /** Displayed user *************************************************** 231 */ 232 233 // The core userdata of the user who is currently being displayed. 234 $bp->displayed_user->userdata = bp_core_get_core_userdata( bp_displayed_user_id() ); 235 236 // Fetch the full name displayed user. 237 $bp->displayed_user->fullname = isset( $bp->displayed_user->userdata->display_name ) ? $bp->displayed_user->userdata->display_name : ''; 238 239 // The domain for the user currently being displayed. 240 $bp->displayed_user->domain = bp_core_get_user_domain( bp_displayed_user_id() ); 241 242 // Initialize the nav for the members component. 243 $this->nav = new BP_Core_Nav(); 244 245 // If A user is displayed, check if there is a front template 246 if ( bp_get_displayed_user() ) { 247 $bp->displayed_user->front_template = bp_displayed_user_get_front_template(); 248 } 249 250 /** Signup *********************************************************** 251 */ 252 253 $bp->signup = new stdClass; 254 255 /** Profiles Fallback ************************************************ 256 */ 257 258 if ( ! bp_is_active( 'xprofile' ) ) { 259 $bp->profile = new stdClass; 260 $bp->profile->slug = 'profile'; 261 $bp->profile->id = 'profile'; 262 } 263 264 /** Network Invitations ************************************************** 265 */ 266 267 $bp->members->invitations = new stdClass; 280 // Additional globals. 281 $this->setup_additional_globals(); 268 282 } 269 283 -
trunk/src/bp-templates/bp-nouveau/buddypress-functions.php
r12930 r13087 4 4 * 5 5 * @since 3.0.0 6 * @version 3.1.06 * @version 10.0.0 7 7 * 8 8 * @buddypress-template-pack { … … 76 76 77 77 $this->includes_dir = trailingslashit( $this->dir ) . 'includes/'; 78 $this->directory_nav = new BP_Core_Nav( );78 $this->directory_nav = new BP_Core_Nav( bp_get_root_blog_id() ); 79 79 } 80 80
Note: See TracChangeset
for help on using the changeset viewer.