Announcement

Collapse
No announcement yet.

Php echo user ID

Collapse
X
Collapse
First Prev Next Last
  • Filter
  • Time
  • Show
Clear All
new posts

    Php echo user ID

    Hello,

    I would like to display the user ID on the profile page, using php module.

    What code shoud i be using? if i use $vbulletin->userinfo[userid]; it echo's the current logged in user's ID, and not the ID of the user which page i am viewing.

    For example, i would like to visit this page:
    http://forum.motortopia.com/member/41579-viorelepuran

    And using php module to echo : "Hy. You are viewing the user ***USER_ID*** page", where USER_ID = 41579

    Is there any specific code for this?


    Thank you!

    #2

    Try getting the userid from the URL like this:

    PHP Code:
    $url $_SERVER['REQUEST_URI'];
    preg_match('/\/.*\/([0-9]+)\-.*/'$url$matches);
    if (
    count($matches) > 1) {
      echo 
    'Hey. You are viewing the user ' $matches[1] . ' page';   

    Comment


      #3
      Did it work viorelepuran?

      Comment

      Working...
      X