Login Redirect

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by shawn.palmer on July 15, 2011 at 4:57pm

Needs some help being pointed in the right direction.

I am working on a Continuing Education ( CE ) hours manager for a non-profit Assocation, the issue I am coming up with is when a member completes a local workshop we are planing on handing them a business card with a QR code ( URL encoded: http://URL/workshop/WORKSHOP_ID/UNIQUE_ID ) as well as the workshop_ID and the Unique_ID and the name of the workshop for manual entry

what I need or more pointed in the right direction for is when they follow the QR ( most likely with a phone or other handled ) they will not already be login so I need the page to redirect them to a log-in page once login go to the confirmation page for the work they just completed or to a testing page

this is being developed on Drupal6 as pure custom modules due to performance reasons

Shawn

Comments

Thanks

Posted by shawn.palmer on July 15, 2011 at 7:57pm

No I hadn't really looked at in the modules page for an existing module. but at least I should be able to use it as reference to build what I need

Again Thanks
Shawn

Destination parameter

Posted by mradcliffe on July 15, 2011 at 6:49pm

You can also pass in the destination parameter in the URL, which user/login supports.

http://my.site/user/login?destination=some/path/to/a/page

On second thought, login destination is the way to go anyway because in your case you could already be logged in.

I will look into the

Posted by shawn.palmer on July 15, 2011 at 7:59pm

I will look into the ?destination args as well.

Thanks
Shawn

Drupal_goto

Posted by dougvann on July 17, 2011 at 11:56am

Shawn,
If you're going to write your own module to handle redirects you will probably end up using
drupal_goto()
see http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_go...

I rather imagine this will be a module that uses hook_init to get triggered on every page load. Here's some pseudo code for you that assumes your module name is "shawn."

shawn_init() {
global $user;
if ($user->uid ==0) drupal_goto(the loggin page);
return;
}

In this example NO anonymous user can ever land on any page except the log in page. Or more acurtaely any page the anonymous user goes to will immediately redirect them to the loggin page.
If that is what you want then the above code get's u almost there.
;-)

  • Doug Vann [Drupal Trainer, Consultant, Developer]
  • Synaptic Blue Inc. [President]
  • http://dougvann.com

Doug, here is what I think I

Posted by shawn.palmer on July 20, 2011 at 7:38pm

Doug,

here is what I think I am going to end up with

_init() {
global $user;
if ($user->uid ==0) drupal_goto("user/login" , "destination=workshops/$workshopID/$MyID" );
return;
}

see any reason why that wouldn't work or is it going to do what I expect it to?

Looks good

Posted by dougvann on July 21, 2011 at 1:39am

So long as $MyID is assigned somewhere.
Let me know how that goes.

  • Doug Vann [Drupal Trainer, Consultant, Developer]
  • Synaptic Blue Inc. [President]
  • http://dougvann.com

Thanks for your Help

Posted by shawn.palmer on July 27, 2011 at 7:40pm

Doug,

Just wanted to say thanks, its going to be a while before I can be sure that it works the way that I need it to as I still need to write 3 forms and a hand full custom interactions to get it all working

so, Thank you very much.

Shawn

Central Ohio

Group categories

Topics

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /