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']);
|
unset($u['orig']);
|
||||||
$orig = $u;
|
$orig = $u;
|
||||||
$u['orig'] = $orig;
|
$u['orig'] = $orig;
|
||||||
|
$u['required_fields']=user_all_fields_required(array_keys($u['roles']));
|
||||||
return $u;
|
return $u;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,7 +818,7 @@ function user_fields_enabled($role)
|
|||||||
function user_fields_required($role)
|
function user_fields_required($role)
|
||||||
{
|
{
|
||||||
global $config, $user_fields_map;
|
global $config, $user_fields_map;
|
||||||
$ret = array('firstname','lastname','username');
|
$ret = array('firstname','lastname');
|
||||||
$required = $config["{$role}_personal_required"];
|
$required = $config["{$role}_personal_required"];
|
||||||
if($required != '') {
|
if($required != '') {
|
||||||
$fields = explode(',', $required);
|
$fields = explode(',', $required);
|
||||||
@ -833,6 +833,14 @@ function user_fields_required($role)
|
|||||||
return $ret;
|
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.
|
//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) {
|
function user_field_required($field,$redirect) {
|
||||||
$u=user_load($_SESSION['users_id']);
|
$u=user_load($_SESSION['users_id']);
|
||||||
|
Loading…
Reference in New Issue
Block a user