XF 1.2 Link to a member with just their username?

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)
 
Back
Top Bottom