User login

Create a link for anonymous users only to proceed on to create content after registration

Dan Hak (smoothblendz) (5:49:46 PM): register?destination=node
Dan Hak (smoothblendz) (5:49:48 PM): !!!
Dan Hak (smoothblendz) (5:50:05 PM): doesnt goto create page like user/regiter would
I3IVIIVI (5:50:18 PM): well, in the meantime I'm still getting the register link for logged in users
Dan Hak (smoothblendz) (5:50:53 PM): <?php
 
if ($user->uid==0) {
  print l('<span class="buttn3">' . t('Present Action') . '</span>', 'user/register?destination=node/add/action', array(), NULL, NULL, FALSE, TRUE);
} else {
  print l('<span class="buttn3">' . t('Present Action') . '</span>', 'node/add/action', array(), NULL, NULL, FALSE, TRUE);
}
?>

Dan Hak (smoothblendz) (5:50:59 PM): is what I'm using
I3IVIIVI (5:53:02 PM): well, on the possibility that $user->uid, being zero, always evaluates to false
I3IVIIVI (5:53:41 PM): uh, no
I3IVIIVI (5:53:48 PM): where is this code? in page.tpl.php?
Dan Hak (smoothblendz) (5:54:04 PM): http://dev.wsf2008.net/eng/admin/build/block/configure/block/1
Dan Hak (smoothblendz) (5:54:09 PM): let me get out of it
Dan Hak (smoothblendz) (5:54:11 PM): one sec
Dan Hak (smoothblendz) (5:54:29 PM): ok
Dan Hak (smoothblendz) (5:54:31 PM): I'm out
Dan Hak (smoothblendz) (5:54:55 PM): why put it in there when blocks and panels is easier
Dan Hak (smoothblendz) (5:55:00 PM): :)
Dan Hak (smoothblendz) (5:55:09 PM): its the drupal way
I3IVIIVI (5:55:53 PM): ah
I3IVIIVI (5:55:56 PM): your problem is
I3IVIIVI (5:56:02 PM): you need a global $user;
I3IVIIVI (5:56:04 PM): first
I3IVIIVI (5:56:18 PM): as far as listing
Dan Hak (smoothblendz) (5:56:21 PM): ok?
I3IVIIVI (5:56:24 PM): and it's not the drupal way
I3IVIIVI (5:56:34 PM): php should be in code, not database
Dan Hak (smoothblendz) (5:57:11 PM): i can put it in there, no prob
Dan Hak (smoothblendz) (5:57:25 PM): but it's low priority right now
I3IVIIVI (5:57:26 PM): http://api.drupal.org/?q=api/function/l/5
I3IVIIVI (5:57:34 PM): I fixed the global $user
Dan Hak (smoothblendz) (5:57:38 PM): cool
I3IVIIVI (5:57:38 PM): now put the fragment in
I3IVIIVI (5:57:40 PM): as an array
I3IVIIVI (5:57:43 PM): the Drupal way
Dan Hak (smoothblendz) (5:57:51 PM): huh?
I3IVIIVI (5:58:11 PM): read the API
I3IVIIVI (5:58:36 PM): oh, actually it's not an array
I3IVIIVI (5:58:38 PM): $query A query string to append to the link.
I3IVIIVI (5:59:11 PM): l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE)
I3IVIIVI (5:59:16 PM): so array stays a blank array()
I3IVIIVI (5:59:26 PM): but instead of NULL in the $query spot
I3IVIIVI (6:00:02 PM): you stick in destination=node/add/action
I3IVIIVI (6:01:03 PM): Capiche?

Resolution

Searched words: 
Drupal l link function redirect query string create account page

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.