drupal - How to update the value of a single field invoking appropriate validation -
i'm making module allow users update single fields on in case, user entity.
the code below example of method have been using working , test other elements of module
global $user; $account = user_load($user->uid); $edit = (array) $account; $edit['field_lastname']['und'][0]['value'] = 'test'; user_save($account, $edit);
however bypasses field validation defined elsewhere in drupal. don't want reproduce validation written elsewhere - it's not drupal way!
my question is: there function in drupal 7 can called update value of single field. imagine such function clear appropriate caches, invoke fields validation etc.
i aware solution totally different current user object based one. can't life of me find appropriate function in api. wander whether fact looking save function alone problem - , there other necessary steps come before.
any gratefully appreciated.
check out drupal_form_submit function. lets submit forms code. in case, use user edit form, fire appropriate validation.
Comments
Post a Comment