CiviCRM Stack Exchange is a question and answer site for administrators and users of the CiviCRM Constituent Relationship Management software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We're on civicrm 4.5.8 and drupal 7.

I'm testing accepting donations including recurring, which means the contacts will need logins. When they login I think I'd like the landing place to be their contact dashboard or at the very least have a direct link to it in the menu. Right now it seems that the users have to select My Account then after their name and address stuff there is a link for View Contact Dashboard.

Can I make it go their directly after they login?

Really, ideally, depending on their role I'd like them to be directed to different places, e.g. back office staff goes to the standard Civicrm home page normal users go to contact dashboard.

share|improve this question

Your best bet with Drupal is to use the Rules module. I think you also need to have CiviCRM Entity installed to get the proper tokens.

Add a new Rules Component:

  1. Component Plugin: Action Set
  2. Name the component (e.g.: Fetch CiviCRM ID of logged in user)
  3. You only need one variable, choose CiviCRM > CiviCRM Contact (may need the CiviCRM Entity module for this step). Give it a label (e.g.: Contact) and a machine name (e.g. civi_contact). For usage, leave it on Parameter.

For the actions in the Action Set:

Add new action (1):

  1. Entities > Fetch Entity by Property (not one of the many possibilities listed under CiviCRM headings)
  2. Value: User
  3. Property - Value: CiviCRM Contact
  4. For Value - Data Selector, choose whatever the machine name of your Variable above is (e.g. civi-contact).
  5. Limit the result count to 1.
  6. Save

Add new action (2):

  1. System > Page redirect
  2. Specify your URL - you should now be able to use the [your-machine-name:id] token (e.g. [civi-contact:id]) to fill in the logged in user's Civi Contact ID.
  3. Save

Then create a new rule

  1. Reacts on Event: User > User has logged in
  2. Add a condition: User > User has role(s); specify which role(s)
  3. Set actions: use the Rules component that you just created (all the way at the bottom of the list).

Lastly, clone the rule component and rule as much as you need depending on how many different roles are going to different places.

share|improve this answer
    
Great. I think to display the contact dashboard I'll need the token for civi contact_id unless there is some link between the drupal id and the civi one. I'm not finding a token for any of the civi things on the drupal side. What might it be? – Paul-Tahoe Jan 9 at 3:20
    
Great catch. I've edited my answer a bit. I've got the CiviCRM Entity module installed, so I've got more Civi Tokens that I know what to do with. I'm playing with Step 3-1 in order to get the right recipe to pull the Linked CiviCRM contact ID. – Allen Hutchison Jan 9 at 3:43
    
Okay, got it! Re-editing... you have to create a component for the rule first... – Allen Hutchison Jan 9 at 4:06

Allen has a great explanation for how to do this, particularly for anytime anyone logs in. Just for completeness, I wanted to make sure this simple option was documented, too.

You may not really want all logins to go to the contact dashboard. It may be really that you want certain links to lead people there, but others logging in (you and other admins, for example) should end up somewhere else. In that case, you can link to

http://example.org/user?destination=civicrm/user

(replacing http://example.org with your base URL) wherever you want people to log in and end up at the user dashboard.

Note that this does not work well with additional parameters, so a redirect to a particular contribution page won't work well, since the page ID isn't in the main Drupal path.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.