Guest User

Untitled

a guest
Jun 19th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. $gid = current($form['group_ids']['#value']);
  2. $node = node_load($gid);
  3.  
  4. $form['massadd'] = array(
  5. '#type' => 'select',
  6. '#title' => t('Select students to add to the group'),
  7. '#required' => TRUE,
  8. '#multiple' => TRUE,
  9. );
  10.  
  11. $users = entity_load('user');
  12. foreach ($users as $uid => $account) {
  13. if ($uid && !in_array($uid, $exclude)) {
  14. $form['massadd']['#options'][$account->uid] = $account->name; // tried realname instead
  15. }
  16. }
  17.  
  18. ...
  19.  
  20. $form['submit']['#weight'] = 0;
  21. // We validate our own way.
  22. unset($form['#validate']);
  23. $form['#submit'][] = 'opigno_simple_ui_form_og_massadd_massadd_form_add_roles';
  24. $form['#submit'][] = 'opigno_simple_ui_form_og_massadd_massadd_form_add_state';
  25. $form['#submit'] = array_merge(array('opigno_simple_ui_form_og_massadd_massadd_form_prepare'), $form['#submit']);
  26.  
  27. $query = db_select('realname','rn');
  28. $query->join('users','usr','usr.uid=rn.uid');
  29. $query->fields('rn', array('uid'));
  30. $query->condition('rn.realname',$mail,'=');
  31. $result =$query->execute()->fetchAll();
  32.  
  33. if (!empty($result)) {
  34. $uids =array($result[0]->uid);
  35. $account = user_load_multiple($uids);
  36. $account = array_shift($account);
  37. }
Add Comment
Please, Sign In to add comment