You are here

function ldapdata_user_categories in LDAP integration 5.2

Same name and namespace in other branches
  1. 5 ldapdata.module \ldapdata_user_categories()

Implements hook_categories();

1 call to ldapdata_user_categories()
ldapdata_user in ./ldapdata.module
Implements hook_user()

File

./ldapdata.module, line 399

Code

function ldapdata_user_categories(&$user) {
  $ret = null;

  // we do this as opposed to calling _ldapdata_ldap_info() to save on the multiple sql queries
  $result = db_fetch_array(db_query("SELECT ldapdata_mappings, ldapdata_rwattrs FROM {ldapauth} WHERE name = '%s'", $user->ldap_config));
  $mappings = unserialize($result['ldapdata_mappings']);
  $mapping_type = $mappings['access'];
  $rwattrs = $result['ldapdata_rwattrs'];
  if ($mapping_type == LDAP_MAP_ATTRIBUTES && !empty($rwattrs) && arg(2) == 'edit') {
    $ret = array(
      array(
        'name' => LDAP_CATEGORY_USER_DATA,
        'title' => t(LDAP_USER_DATA_EDIT_TAB),
        'weight' => 50,
      ),
    );
  }
  return $ret;
}