I am able to find the username. From the username I need to fill the user reference field.
Is there a way to get the user reference field value from username?
Example:
I have username: abc
I need Reference field value: Abc(201)
user_load_by_name('admin')
stdClass Object
(
[uid] => 1
[name] => admin
[pass] => $S$DYk/jJiQjg07cciSAeU2EeP3XVMm/WhWHG19rA1iQf/FIqdOmY5p
[mail] => [email protected]
[theme] =>
[signature] =>
[signature_format] =>
[created] => 1469189190
[access] => 1511853833
[login] => 1511853621
[status] => 1
[timezone] => Asia/Kolkata
[language] =>
[picture] =>
[init] => [email protected]
[data] =>
[uuid] => 77ef7473-31cd-432e-ace6-26f1b075abb5
[roles] => Array
(
[2] => authenticated user
[3] => administrator
)
[rdf_mapping] => Array
(
[rdftype] => Array
(
[0] => sioc:UserAccount
)
[name] => Array
(
[predicates] => Array
(
[0] => foaf:name
)
)
[homepage] => Array
(
[predicates] => Array
(
[0] => foaf:page
)
[type] => rel
)
)
)
$account = user_load_by_name($name); user_load($account->uid);
, does it give you the fields? I don't think you should need to load the user twice though.