Tried something else. First, I changed to file based avatars instead of dbase based. I then edited class_bbcode.php with code below in the 'handle_bbcode_quote' function to get the userid (which worked fine).
Code:
$result = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "post");
while ($row = $vbulletin->db->fetch_array($result)) {
if ($row['postid'] == $postid) {
$userid = $row['userid'];
}
}
I also added the below code to display the avatar (underneath the above code). It 'works'. However, the avatar is not updated if the user changes their avatar. ie. avatar1_9.gif is the new avatar, but is still trying to display avatar1_8.gif.
Code:
require_once(DIR . '/includes/functions_user.php');
$quote_avatar_url = fetch_avatar_url($userid);
if ($quote_avatar_url) {
$quote_avatar_url = $quote_avatar_url[0];
} else {
$quote_avatar_url = "images/misc/unknown.gif";
}