Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { "rules_redirect_to_logout_except_for_role_id3" : {
- "LABEL" : "Redirect to logout except for role ID3",
- "PLUGIN" : "reaction rule",
- "ACTIVE" : false,
- "OWNER" : "rules",
- "REQUIRES" : [ "rules" ],
- "ON" : { "user_login" : [] },
- "IF" : [
- { "NOT user_has_role" : { "account" : [ "account" ], "roles" : { "value" : { "3" : "3" } } } }
- ],
- "DO" : [
- { "mail" : {
- "to" : "[account:mail]",
- "subject" : "No login allowed",
- "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.",
- "language" : [ "" ]
- }
- },
- { "redirect" : { "url" : "user/logout" } }
- ]
- }
- }
- /**
- * Implementation of hook_form_alter().
- */
- function YOUR_MODULE_form_alter(&$form, $form_state, $form_id) {
- if ($form_id == 'user_login') {
- array_unshift($form['#validate'], 'YOUR_MODULE_login_form_validate');
- }
- }
- function YOUR_MODULE_login_form_validate($form, $form_state) {
- form_set_error('','Your user is not enabled to login');
- }
Add Comment
Please, Sign In to add comment