Guest User

Untitled

a guest
Oct 20th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. { "rules_redirect_to_logout_except_for_role_id3" : {
  2. "LABEL" : "Redirect to logout except for role ID3",
  3. "PLUGIN" : "reaction rule",
  4. "ACTIVE" : false,
  5. "OWNER" : "rules",
  6. "REQUIRES" : [ "rules" ],
  7. "ON" : { "user_login" : [] },
  8. "IF" : [
  9. { "NOT user_has_role" : { "account" : [ "account" ], "roles" : { "value" : { "3" : "3" } } } }
  10. ],
  11. "DO" : [
  12. { "mail" : {
  13. "to" : "[account:mail]",
  14. "subject" : "No login allowed",
  15. "message" : "You just completed a login to [site:name], located at [site:url].rnrnHowever, at this time we do not allow any login ...rnrnThanks anyway for validating some of your account data, such as your eMail ID.",
  16. "language" : [ "" ]
  17. }
  18. },
  19. { "redirect" : { "url" : "user/logout" } }
  20. ]
  21. }
  22. }
  23.  
  24. /**
  25. * Implementation of hook_form_alter().
  26. */
  27. function YOUR_MODULE_form_alter(&$form, $form_state, $form_id) {
  28. if ($form_id == 'user_login') {
  29. array_unshift($form['#validate'], 'YOUR_MODULE_login_form_validate');
  30. }
  31. }
  32.  
  33. function YOUR_MODULE_login_form_validate($form, $form_state) {
  34. form_set_error('','Your user is not enabled to login');
  35. }
Add Comment
Please, Sign In to add comment