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

XF 1.2 Link to a member with just their username?

Discussion in 'XenForo Questions and Support' started by altgg, Dec 31, 2013.

  1. altgg

    altgg New Member

  2. altgg

    altgg New Member

    Nevermind. I'm on the same server as the forum, and accessing the full forum news feed via rss (I don't need images this time), but I decided that it was quicker to just write another function to return the user id so that I can actually link to the user.

    PHP:
    function get_forum_user_id_by_username($username){
           
            
    $username mysql_real_escape_string($username);
           
            
    $query "SELECT user_id
                            FROM xf_user
                            WHERE username = '
    $username'
                            LIMIT 1"
    ;
           
            
    $result mysql_query($query);
           
            if(
    mysql_num_rows($result) <= 0)
            {
                
    //echo mysql_errno() . ": " . mysql_error(). "\n";
                //echo $query;
                
    return false;
            }
            else
            {   
               
                
    $data mysql_fetch_array($result);
               
                return 
    $data['user_id'];
                                       
            }
    // else num rows
       
           
        
    }// get_forum_user_id_by_username($username)
     
  3. rour

    rour Member

    Use stringId instead intId in _Route_Prefix_
     

Share This Page