Last active
February 9, 2016 07:31
-
-
Save miteshmap/41f43f8e0105bcb07574 to your computer and use it in GitHub Desktop.
Autocomplete uid to name and name to uid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function axelerant_custom_username_form($form, &$form_state) { | |
| $default_user = user_load(3); | |
| $form['name'] = array( | |
| '#type' => 'textfield', | |
| '#title' => t('Search for Contributor'), | |
| '#autocomplete_path' => 'user/autocomplete', | |
| '#default_value' => $default_user->name, | |
| '#required' => TRUE, | |
| ); | |
| return $form; | |
| } | |
| /** | |
| * Implements hook_actions_delete(). | |
| */ | |
| function axelerant_custom_username_form_submit($form, &$form_state) { | |
| $name = trim($form_state['values']['name']); | |
| $user = user_load_by_name($name); | |
| // form_set_value($form['name'], $user->uid, $form_state); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment