bp_dtheme_object_template_loader

Load the template loop for the current object.

Description

(string) bp_dtheme_object_template_loader(); 

Returns (string)

Prints template loop for the specified object


Usage

  1. if ( !function_exists( 'bp_dtheme_object_template_loader' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-themes/bp-default/_inc/ajax.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_dtheme_object_template_loader(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-themes/bp-default/_inc/ajax.php  
  1. function bp_dtheme_object_template_loader() { 
  2. // Bail if not a POST action 
  3. if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 
  4. return; 
  5.  
  6. // Bail if no object passed 
  7. if ( empty( $_POST['object'] ) ) 
  8. return; 
  9.  
  10. // Sanitize the object 
  11. $object = sanitize_title( $_POST['object'] ); 
  12.  
  13. // Bail if object is not an active component 
  14. if ( ! bp_is_active( $object ) ) 
  15. return; 
  16.  
  17. /** 
  18. * AJAXrequestshappen too early to be seen by bp_update_is_directory() 
  19. * so we do it manually here to ensure templates load with the correct 
  20. * context. Without this check, templates will load the 'single' version 
  21. * of themselves rather than the directory version. 
  22. */ 
  23. if ( ! bp_current_action() ) 
  24.  
  25. // Locate the object template 
  26. locate_template( array( "$object/$object-loop.php" ), true ); 
  27. exit;