You are here

function ldap_authorization_og1_entity_id_to_gid in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7 ldap_authorization/ldap_authorization_og/ldap_authorization_og.module \ldap_authorization_og1_entity_id_to_gid()

Convert entity id to group id

Parameters

int $entity_id as id of entity associated with organic group:

Return value

int og group id

2 calls to ldap_authorization_og1_entity_id_to_gid()
LdapAuthorizationConsumerOG::normalizeMappings in ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php
LdapAuthorizationOg1Tests::testBasicFunctionsAndApi in ldap_authorization/tests/Og1Tests.test
just make sure install succeeds and og and ldap_authorization_og functions work as designed

File

ldap_authorization/ldap_authorization_og/ldap_authorization_og.module, line 74
controls organic group membership based on LDAP values

Code

function ldap_authorization_og1_entity_id_to_gid($entity_id) {
  $gid = db_select('og', 'og')
    ->fields('og', array(
    'gid',
  ))
    ->condition('og.etid', $entity_id, '=')
    ->range(0, 1)
    ->execute()
    ->fetchField();
  return $gid && is_scalar($gid) ? $gid : FALSE;
}