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:


    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';   

    Helpful? Donate. Thanks!
    Buy me a coffeePayPal QR Code
    Fast VPS Host for vBulletin:
    A2 Hosting & IONOS

    Comment


      #3
      Did it work viorelepuran?
      Helpful? Donate. Thanks!
      Buy me a coffeePayPal QR Code
      Fast VPS Host for vBulletin:
      A2 Hosting & IONOS

      Comment

      Users Viewing This Page

      Collapse

      There is 1 user viewing this forum topic.

      • Guest Guest

      Latest Posts

      Collapse

      Working...
      X
      Searching...Please wait.
      An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

      Please push the back button and reload the previous window.'
      An unexpected error was returned: 'Your submission could not be processed because the token has expired.

      Please push the back button and reload the previous window.'
      An internal error has occurred and the module cannot be displayed.
      There are no results that meet this criteria.
      Search Result for "|||"