add_suggestions_search_to_query

Creates the query for the loop and adds the hide suggestion button Prints an info message when we can't suggest groups.

Description

(string) add_suggestions_search_to_query( (string) $qs, (type) $object, (type) $object_filter, (type) $object_scope, (type) $object_page, (type) $object_search_terms, (type) $object_extras ); 

Returns (string)

Parameters (7)

0. $qs (string)
The qs.
1. $object (type)
The object.
2. $object_filter (type)
The object filter.
3. $object_scope (type)
The object scope.
4. $object_page (type)
The object page.
5. $object_search_terms (type)
The object search terms.
6. $object_extras (type)
The object extras.

Usage

  1. if ( !function_exists( 'add_suggestions_search_to_query' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-groups-suggestions/groups/suggested_groups.php'; 
  3.  
  4. // The qs. 
  5. $qs = ''; 
  6.  
  7. // The object. 
  8. $object = null; 
  9.  
  10. // The object filter. 
  11. $object_filter = null; 
  12.  
  13. // The object scope. 
  14. $object_scope = null; 
  15.  
  16. // The object page. 
  17. $object_page = null; 
  18.  
  19. // The object search terms. 
  20. $object_search_terms = null; 
  21.  
  22. // The object extras. 
  23. $object_extras = null; 
  24.  
  25. // NOTICE! Understand what this does before running. 
  26. $result = add_suggestions_search_to_query($qs, $object, $object_filter, $object_scope, $object_page, $object_search_terms, $object_extras); 
  27.  

Defined (1)

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

/groups/suggested_groups.php  
  1. function add_suggestions_search_to_query($qs, $object, $object_filter, $object_scope, $object_page, $object_search_terms, $object_extras) { 
  2. global $wpdb, $bp; 
  3. if (is_user_logged_in() && bp_is_directory()) { 
  4. if ($object_scope == 'lssuggestions') { 
  5. if (BPGroupSuggest::get_suggestions_groups_id()) { 
  6. $qs .= "&include=" . implode(', ', BPGroupSuggest::get_suggestions_groups_id()); 
  7. } else { 
  8. $qs .= "&include=0, 0"; 
  9. echo '<script> jQuery(document).ready(function() { 
  10. var j = jQuery;j(".info").html("<p>' . __("We don't have enough details to suggest a group yet.", 'bp_group_suggestions_ls') . '<br>' . __("Try make some more friends, first.", "bp_group_suggestions_ls") . '</p>");});</script>'; 
  11.  
  12. return $qs;