1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I get the userid from the url?

Discussion in 'XenForo Development Discussions' started by grantus, Jun 9, 2013.

  1. grantus

    grantus Active Member

    I know how to get the userid of the member visiting, but what I'd like to know is how can I get the userid of a profile page?

    For example, my userid here is 13867, if I go to someone's profile page and their userid is 15000, how do I get 15000? I need the userid, username, etc of the profile page that's being viewed.

    Thanks.

    Edit: sorry, this should be in a Xenforo area.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. grantus

    grantus Active Member

    No that's not what I meant. I'm doing a custom code for the profile page and I need to check what profile page is being viewed. This gives me MY information:

    Code:
    $object = XenForo_Visitor::getInstance();
    $userid = $object['user_id'];
    I need something like that, but for the profile page that is being viewed. I can fetch the URL with $_SERVER but I'd rather not.
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    I misunderstood as you didn't post it in the dev questions forum, which I have now moved it to.
     
    Jeremy likes this.
  5. grantus

    grantus Active Member

    Ok thanks, I wasn't sure where it should go.
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There is a code example in the member controller:

    Code:
    		$userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT);
    
     
    LPH likes this.
  7. tyteen4a03

    tyteen4a03 Well-Known Member

    So my previous guess was correct, the router does insert a parameter for XenForo_Input use.
     
  8. grantus

    grantus Active Member

    Thanks, I'll look at this.
     

Share This Page