bb_gs_create_group_searchstring

The BuddyPress Global Search bb gs create group searchstring function.

Description

bb_gs_create_group_searchstring( $groupid ); 

Parameters (1)

0. $groupid
The groupid.

Usage

  1. if ( !function_exists( 'bb_gs_create_group_searchstring' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-global-search/includes/functions.php'; 
  3.  
  4. // The groupid. 
  5. $groupid = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_gs_create_group_searchstring($groupid); 
  9.  

Defined (1)

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

/includes/functions.php  
  1. function bb_gs_create_group_searchstring($groupid) { 
  2.  
  3. if( !function_exists( 'bp_is_active' ) || !bp_is_active( 'groups' ) ) { 
  4. return; 
  5.  
  6. if ( empty( $groupid ) ) { 
  7. global $bp; 
  8. $groupid = $bp->groups->new_group_id; 
  9.  
  10. $address = isset( $_POST['bpla-group-address'] ) ? $_POST['bpla-group-address'] : ''; 
  11. $street = isset( $_POST['bpla-group-street'] ) ? $_POST['bpla-group-street'] : ''; 
  12. $city = isset( $_POST['bpla-group-city'] ) ? $_POST['bpla-group-city'] : ''; 
  13. $state = isset( $_POST['bpla-group-state'] ) ? $_POST['bpla-group-state'] : '';  
  14. $zip = isset( $_POST['bpla-group-zip'] ) ? $_POST['bpla-group-zip'] : ''; 
  15. $country = isset( $_POST['bpla-group-country'] ) ? $_POST['bpla-group-country'] : ''; 
  16.  
  17. if ($address) { 
  18. groups_update_groupmeta($groupid, 'bbgs_group_search_string', $address); 
  19. if ($street) { 
  20. groups_update_groupmeta($groupid, 'bbgs_group_search_string', $address.' '.$street); 
  21. if ($city) { 
  22. groups_update_groupmeta($groupid, 'bbgs_group_search_string', $address.' '.$street.' '.$city); 
  23. if ($state) { 
  24. groups_update_groupmeta($groupid, 'bbgs_group_search_string', $address.' '.$street.' '.$city.' '.$state); 
  25. if ($zip) { 
  26. groups_update_groupmeta($groupid, 'bbgs_group_search_string', $address.' '.$street.' '.$city.' '.$state.' '.$zip); 
  27. if ($country) { 
  28. groups_update_groupmeta($groupid, 'bbgs_group_search_string', $address.' '.$street.' '.$city.' '.$state.' '.$zip.' '.$country); 
  29.  
  30.