2

I am trying to do a simple thing. Whenever an anonymous user views a content , I want to redirect the user to

node's-url/#overlay=signup

So, how do I modify the URL to use #overlay=signup at the end for anon users?

I tried to do so by implementing rules.
Event: Content is viewed
Condition: User role is anonymous
Action: Redirect url.

I don't know how to add the pathauto-url/#overlay=signup.

  • This probably not answering your question, but if you want to just redirect anonymous user to overlay login from nodes. You can use "Taxonomy Access Control"(or Content Access) module to control access to nodes, and "Ajax Login/Register" module for overlay login. – CocoSkin May 29 '15 at 15:34
1

You should be able to use your existing rule (see below), but in the Action for redirect URL put [site:current-page:path]/#overlay=signup or [node:url]/#overlay=signup if the former doesn't work.

Existing rule (just for reference) -

Event: Content is viewed

Condition: User role is anonymous

Action: Redirect url.

  • Both [site:current-page:path] and [node:url] , give the original url . e.g. node/114 and therefore, don't work with pathauto. :( – Nick Dave Sep 5 '12 at 11:12
  • I am getting too many redirects error. – Nick Dave Sep 5 '12 at 11:20
  • Ah - for the second bit, put a condition that the path is NOT signup. Didn't think of that. As it stands the rule will probably infinitely redirect to signup >_< – Chapabu Sep 5 '12 at 11:26
1

What's what Splash module does. See Thickbox option. More about the module:

Display any internal path, external URL or text as a splash page before going to the actual frontpage.

  • I am using drupal 7. – Nick Dave Sep 5 '12 at 9:45
1

You can use the module splashify You can determine how often the splash page should show up in the configuration areas (always, daily, weekly, monthly).I think its good for you and for altering your url you can use the theme_links, read the documentation. Best of luck.

<?php
  // $node = a given node object.
  // $term = a specific term object.
  $links[] = array(
    'href'  => 'node/' . $node->nid,
    'title' => $term->name,
    'query' => array('tag' => $term->tid),
  );
  // This will end up as e.g.:
  // <li><a href="node/123?tag=456">termname</a></li>
?>

above is the reference code wrap with anonymous user condition on node pre process function.

0

At least the event you're using for your rule needs to be corrected. Because what "Content is viewed" actually means, seems to be like so:

  • The event Content is viewed is what it is: the user has (already) started viewing the content.

  • The (system) event Drupal is initializing is what you should use instead (possible combined with other Events and/or Actions), if you want to trigger some Rules "Action(s)" BEFORE the user can start viewing (= looking at) the content.

For more details, and a working sample (in Rules 'export format'), refer to How to specify a Rules event like "Content is 'going to be' viewed"?

Be aware: this applies to D7 ... and D6 is another story (from the question context I'm not sure if this is for D6 or D7 ...).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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