need the php to add to my user profile panel pane.
seems simple enough but the answer's eluding me. i've done some searching and explained it in the forums here:
http://drupal.org/node/250008

i randomly tried the handling code:

if (arg(0) == 'user' && is_numeric(arg(1))) {
    return array(arg(1));
}

but it was a shot in the dark that didn't work for me.

Comments

aterchin’s picture

Title: How to output UID for a views argument (on user's profile page) » panels and php filter

changed the title because its the same as another i posted on the forums and this is more important to figure out first:

I just made a test block like print $user->uid; set the filter to php, doesnt output anything. Yet print t('hello'); works fine. Why can't I get it to print the user id? I'm using panels with advanced profile where the argument is set to user id, same as the arg(1) i'm using with my view: videos-of-uid.

michelle’s picture

Try:

  $uid = arg(1);
  print $uid; 

$user->uid isn't being defined in your snippit so it's empty.

Michelle

aterchin’s picture

Status: Active » Closed (fixed)

michelle, i love you. i dont know why i couldn't find this on my own (for the last two days).

i put this at the top:

$uid = arg(1);

and to reference the views url with the argument:

 'file' => xspf_playlist_url('playlist/' . $uid),

done
now my videos_of_uid playlist appears on the userprofile page, containing just those vids authored by that user.
i'll reference this post in the forum as a followup.

thanks again.

michelle’s picture

LOL! Glad it's working for you.

Michelle

ChristieLuv’s picture

Hi! I'm having the same kind of problem. Can anyone help me out? I just want to make a simple link to display in an Advanced Profile's Pane that includes the users ID.

<a href="/user/UID/mygifts">Link</a>

But I need the "UID" in there to be unique to the current users page. I've tried out so many different things and I'm a PHP novice, so I'd really appreciate some help. If anyone can post the code so I can just add the "mygifts" address to it that would be great!

Thank you!
~Christie

ChristieLuv’s picture

Component: Miscellaneous » Code
Status: Closed (fixed) » Active

Whoops I forgot to mark the thread as active, I'll do that with this post and I'll subscribe. Thank you!

michelle’s picture

Untested, off the top of my head...

$uid = arg(1);
print l("Link", "user/$uid/mygifts");

Michelle

ChristieLuv’s picture

Yay! It worked! Thank you so very much! Its amazing how long I spent trying to look for how to do this! *lol* This helps a lot!

michelle’s picture

Status: Active » Fixed

Learning some basic PHP really goes a long way when working with Drupal. There's a lot of little things like this that are easier if you can do even a little bit of coding.

Glad it's working. Marking this fixed again.

Michelle

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.