get_groupblog_group_id

The BP Groupblog get groupblog group id function.

Description

get_groupblog_group_id( $blog_id ); 

Parameters (1)

0. $blog_id
The blog id.

Usage

  1. if ( !function_exists( 'get_groupblog_group_id' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-groupblog/bp-groupblog-templatetags.php'; 
  3.  
  4. // The blog id. 
  5. $blog_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_groupblog_group_id($blog_id); 
  9.  

Defined (1)

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

/bp-groupblog-templatetags.php  
  1. function get_groupblog_group_id( $blog_id ) { 
  2. global $bp, $wpdb; 
  3.  
  4. if ( !isset( $blog_id ) ) 
  5. return; 
  6.  
  7. // table_name_groupmeta is not defined on first install 
  8. if ( !isset( $bp->groups->table_name_groupmeta ) ) 
  9. return; 
  10.  
  11. if ( $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->groups->table_name_groupmeta} WHERE meta_key = 'groupblog_blog_id' AND meta_value = %d", $blog_id ) ) ) { 
  12. return $row->group_id; 
  13. }