In short: I need to redirect authorized users - and authorized users only - from the user/register page to their user/[account:uid] page. I've only been successful in creating a URL or Page redirect, which insofar as it's created, breaks registration for anonymous users.

I believe Workflow should be able to work around this, but I have not been able to figure out how - perhaps someone can help.

Here's the scenario: I have a site where I people can register for a newsletter via CiviMail without needing to have a Drupal account. No problem. After Newsletter registration, there's a landing page where they're encouraged to open a Drupal account with a link to user/register. Again, no problem.

The problem arises when an already-authorized user registers for the newsletter and is returned to the landing page. This is a good opportunity to encourage them to add more information to their profile, but user/register results in Access Denied.

I presume a PHP command that would redirect "user/register" to "user/[account:uid]" for logged-in users would do the trick - I've tried all degrees of comparison to look at [account:path] and [account:url] to no avail. Any ideas? Thanks much!

Comments

bcobin’s picture

I have figured out a workaround for this using code adapted from here with some modifications. Newsletter "thank you" page has a link to a landing page with the PHP code below.

Interesting thing here is that this is a page that, once created, can never be viewed or edited - only deleted.

<?php
   global $user;
   if (intval($user->uid)>0)
     drupal_goto('user/'.$account[uid]);
   else
     drupal_goto('user/login');
?>

Easy enough when you see it, but I had a heck of a time figuring it out. I see lots of folks have had issues with the user/login thing - hope this saves somebody some time!

13rac1’s picture

Status: Active » Closed (fixed)

Works great thanks!

FYI: You can edit it via the /admin/content/node page.