[support] Path does not work

Jason Flatt drupal at oadae.net
Mon Jul 3 17:19:08 UTC 2006


You appear to be asking several different questions, but I'm also not entirely 
sure I understand your English. I will attempt to answer as best as I can.

On Sunday 02 July 2006 11:57, Gina Rydland wrote:
> Hi
>
> I have tried using php script as described on the drupal site to make new
> blocks I make to only show up after the user has logged in.

On your block configuration page in the "Page specific visibility settings" 
area, select the PHP option (the third one) and try something like the 
following:

<?php
  global $user;
  if ($user->uid) {
    return TRUE;
  }
  else {
    return FALSE;
  }
?>

That will show the block with the content you specified in the "Block body" 
area on every page only after the user has logged in. If you also want to 
exclude the admin account, change "if ($user->uid) {" to "if ($user->uid > 1) 
{".

Also, if you want brevity, the following will work:
<?php
  global $user;
  return $user->uid;
?>

>
> I have tried to use path to make blocks not appear or appear only on the
> front side before people have logged in.

Using the above example, you would place the code in the "Block body" instead, 
but change it like so:

<?php
  global $user;
  if (!$user->uid) {
    --PUT YOUR BLOCK CONTENT HERE AS PHP CODE--
  }
?>

Make sure your "Input format" is set to "PHP Code". Next, in the "Page 
specific visibility settings" area, select the "Show on only the listed 
pages." option and put the following in the textarea:
<front>

That will show the block ONLY on the front page, and only if the user is NOT 
logged in.

All of this is outlined in the "Controlling block visibility with PHP" 
handbook page: http://drupal.org/node/64135

>
> Non of it works.
>
> I have my alias url enabled, I have php enabled, nothing works.
>
> I also have a problem with the front page that shows up with the URL
> followed by this: /?q= The path configuration will not accept this as a
> path, yet this is the only "path" showing up at the front before you have
> logged in and at the  first page (home page) after you have logged in.

You should only use the part after the ?q= when ever referencing a path. i.e.: 
if the path is:
http://www.domain.com/?q=admin/settings
use
admin/settings

For situations where you are referencing the front page, then either 
http://www.domain.com/ or / will do.

Also, if your Web server can handle it, you might want to enable Clean URLs 
(which can be found on the above admin/settings path). This page explains 
Clean URLs: http://drupal.org/node/15365

>
> Tips anybody?
>
> Best Gina

Hopefully, that helps you out.

-- 
Jason Flatt
http://www.oadae.net/
Father of Six:  http://www.flattfamily.com/ (Joseph, 13; Cramer, 11; Travis, 
9; Angela; Harry, 5; and William, 12:04 am, 12-29-2005)
Linux User:     http://www.sourcemage.org/
Drupal Fanatic: http://drupal.org/


More information about the support mailing list