Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
I got this to work by theming comment.tpl.php
Make sure you go into vbulletin admin and change Avatar to serve off filesystem instead of database.
Here is the code I used to theme the comment.tpl.php
<?
//theme drupal comments with vb users' avatar
module_load_include('inc', 'drupalvb');
$vb_uid = db_result(db_query("SELECT userid FROM {drupalvb_users} WHERE uid = %d", $comment->uid));
if(!empty($vb_uid)) {
$avatar_id = db_result(drupalvb_db_query("SELECT avatarid FROM {user} WHERE userid = '%s'", $vb_uid));
}
if(!empty($avatar_id)) {
$avatar_picture = db_result(drupalvb_db_query("SELECT avatarpath FROM {avatar} WHERE avatarid = '%s'", $avatar_id));
echo "<img src='/forum/$avatar_picture'>";
}
?>
Note that the img link is hardcoded as /forum/ because my forum is located at mydomain.com/forum/
This works for me. My only concern is that this could severely hurt performance if the community gets very large (loading the drupalvb includes, and querying the database on every pageload with a comment). If anyone has any suggestions for how this could be done better please let me know...
Currently using this code at http://screplays.com
Comments
Comment #1
sunCurrently not. Feel free to re-open this issue if you want to provide a patch.
Comment #2
taylormm commentedI got this to work by theming comment.tpl.php
Make sure you go into vbulletin admin and change Avatar to serve off filesystem instead of database.
Here is the code I used to theme the comment.tpl.php
Under:
Add the following:
Note that the img link is hardcoded as /forum/ because my forum is located at mydomain.com/forum/
This works for me. My only concern is that this could severely hurt performance if the community gets very large (loading the drupalvb includes, and querying the database on every pageload with a comment). If anyone has any suggestions for how this could be done better please let me know...
Currently using this code at http://screplays.com
Comment #3
sunNo patch here. This should use a module_preprocess_HOOK() function to just expose the variables to the template.
Comment #4
sunOverall, I think this goes in a wrong direction. To display Drupal information inside of vB, you need a vB plugin.