maybe this is a stupid mistake (I'm new to this module) , but I cannot set simple rule redirecting user depending on his/her role.

1. I've created rule based on event "User has logged in", make it active
2. Added condition (without group): "User has role(s)", selected 2 roles, choose "match against any" and save
4. added redirect action, put "node/add" in the path (leaving parameters blank), checked "force redirecting"
5. save
6. logged as a user with one of the rules mentioned above,

... nothing happens

so I've removed condition, to check if redirection will work for anybody.

logged as the same user as above

...nothing happens, no redirecion

what am I missing?

Comments

cyc’s picture

Category: support » bug

update:

rule doesn't work when logging in from "mysite/user" path, and works when logging in from standard drupal login block

So, I'm marking this a s a bug
(or this is a feature?..)

What I'm trying to achieve now is the following:

1. drupal login block is not visible in any region by default, on any page, except:
2. a custom login page, when this block is visible

cyc’s picture

Title: redirecting after login seems to not working.. » redirecting after login not working when triggered from /user form

As to my previous comment:
kind of workaround for my goal is to add page with 'login' alias, put login block in main page region and configure block t show only on 'login' page.

pro's:
The only method at this moment, but works

con's:
I won't be able to use login block on any other page
I cannot redirect admin (user no.1) to different page - condition is alowed only to roles, not to specific user

Should I open another issue related to 2nd con?

fago’s picture

Status: Active » Postponed (maintainer needs more info)

hm, I just gave it a try and it works fine for me. I tested user-login block + role condition + page redirect action with "Force redirecting to the given path, even if a destination parameter is given" enabled and "immediate" option off. So I'm sry, I cannot reproduce it.

Perhaps you could test if it works on another clean installation on your server? Are you using php4?

cyc’s picture

@fago

pls read my comment #1 again

"rule doesn't work when logging in from "mysite/user" path, and works when logging in from standard drupal login block"

and the php number is 5.2.6;-)

fago’s picture

damn, sry. If you turn on the debug log, do you see the debug of the rule evaluation? If not, probably mysite doesn't invoke hook_user op login.

cyc’s picture

@fago

debug log is shown when login action is taken from standard drupal login block, but is not visible at /user path page.

these forms are different.
standard login block is designed to work at left/right column (and works as it should), while /user path page is designed to be displayed at main content area, and 'by design' redirects users to their profiles. seems to me that 'rules' module cannot overwrite this.

problem is that in 95% posts found at drupal.org, you can find general advice: "to login, enter /user path"...

fago’s picture

When I log in through "/user" my rules get evaluated -> "# 0 ms "User has logged in" has been invoked.". ?

adamcarsonb’s picture

I was having similar problems with setting up a login rule. The problem ended up being that I still had the Login Destination module enabled. I disabled it and my rules started working as expected. Hope this helps.

fago’s picture

Project: Rules » MySite
Version: 6.x-1.0 » 5.x-3.3
Component: Rules Engine » Code
Status: Postponed (maintainer needs more info) » Active

As written in #5, it looks mysite doesn't issue hook_user op = 'login' when a user logs in?

agentrickard’s picture

Category: bug » support

MySite doesn't handle user logins in any way, so has no need to implement a 'login' op.

This module is no longer under active development. If you want paid services, drop me a note.

agentrickard’s picture

Status: Active » Closed (won't fix)