function uif_plus_get_og_group in User Import Framework Plus 7
Helper function to get a group ID from the og table.
http://drupal.org/node/1615542#3 - "The og table is deprecated in the 2.x version, so it should stay empty"
Parameters
mixed $group:
boolean $og_version_1 - Is the version of the og module 1.x?:
Return value
int $gid
1 call to uif_plus_get_og_group()
- uif_plus_process_user_groups in ./
uif_plus.module - Process import of users into groups.
File
- ./
uif_plus.module, line 561 - Advanced user import from a CSV file.
Code
function uif_plus_get_og_group($group, $og_version_1) {
$gid = 0;
if ($og_version_1) {
$column = intval($group) > 0 ? 'g.gid' : 'g.label';
$gid = db_select('og', 'g')
->extend('PagerDefault')
->fields('g', array(
'gid',
))
->condition($column, $group)
->condition('g.state', 1)
->limit(1)
->execute()
->fetchField();
}
else {
$column = intval($group) > 0 ? 'n.nid' : 'n.title';
$gid = db_select('node', 'n')
->extend('PagerDefault')
->fields('n', array(
'nid',
))
->condition($column, $group)
->condition('n.status', 1)
->limit(1)
->execute()
->fetchField();
}
return $gid;
}