forked from science-ation/science-ation
remove username
from the standard user fields
add 'required_fields' array to the user object so the API users know which fields are needed
This commit is contained in:
parent
c367656d02
commit
a792b763a1
12
user.inc.php
12
user.inc.php
@ -209,7 +209,7 @@ function user_load($users_id, $accounts_id = false)
|
||||
unset($u['orig']);
|
||||
$orig = $u;
|
||||
$u['orig'] = $orig;
|
||||
|
||||
$u['required_fields']=user_all_fields_required(array_keys($u['roles']));
|
||||
return $u;
|
||||
}
|
||||
|
||||
@ -818,7 +818,7 @@ function user_fields_enabled($role)
|
||||
function user_fields_required($role)
|
||||
{
|
||||
global $config, $user_fields_map;
|
||||
$ret = array('firstname','lastname','username');
|
||||
$ret = array('firstname','lastname');
|
||||
$required = $config["{$role}_personal_required"];
|
||||
if($required != '') {
|
||||
$fields = explode(',', $required);
|
||||
@ -833,6 +833,14 @@ function user_fields_required($role)
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function user_all_fields_required($roles) {
|
||||
$ret=array();
|
||||
foreach($roles AS $role) {
|
||||
$ret=array_merge($ret,user_fields_required($role));
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
//this function checks if $field is set in the user record, if it is, it returns it, otherwise, it returns false __AND__ redirects to the redirect page.
|
||||
function user_field_required($field,$redirect) {
|
||||
$u=user_load($_SESSION['users_id']);
|
||||
|
Loading…
Reference in New Issue
Block a user