Ok, I got the user avatars to show up on the CBB Recent Topics, and Recent Topic Replies blocks (CBB 3.07). I could probably add it to the recent posts one too, I just don't use that block on my site, so I didn't bother. But here's the hacks for those two if anyone's interested:
In newbb/blocks/newbb_block.php:
function b_newbb_show($options) (this is the function for the block that shows recently replied topics) Add the lines in red (there are 3):
le="color: #000000"><?php function b_newbb_show($options) { global $xoopsConfig; global $access_forums; $db =& Database::getInstance(); $myts =& MyTextSanitizer::getInstance(); $block = array(); $i = 0; $order = ""; $extra_criteria = ""; if(!empty($options[2])) { $time_criteria = time() - newbb_getSinceTime($options[2]); $extra_criteria = " AND p.post_time>".$time_criteria; } $time_criteria = null; switch ($options[0]) { case 'time': default: $order = 'p.post_time'; $extra_criteria .= " AND p.approved=1"; break; } $newbbConfig = getConfigForBlock(); if(!isset($access_forums)){ $forum_handler =& xoops_getmodulehandler('forum', 'newbb'); if(!$access_obj =& $forum_handler->getForums(0, 'access', array('forum_id', 'cat_id', 'forum_type')) ){ return null; } $access_forums = array_keys( $access_obj ); // get all accessible forums unset($access_obj ); } if (!empty($options[6])) { $allowedforums = array_filter(array_slice($options, 6), "b_newbb_array_filter"); // get allowed forums $allowed_forums = array_intersect($allowedforums, $access_forums); }else{ $allowed_forums = $access_forums; } $forum_criteria = ' AND t.forum_id IN (' . implode(',', $allowed_forums) . ')'; $approve_criteria = ' AND t.approved = 1'; $query = 'SELECT'. ' DISTINCT t.topic_id, t.topic_replies, t.forum_id, t.topic_title, t.topic_views, t.topic_subject,'. ' f.forum_name, f.allow_subject_prefix,'. [color=FF0000] ' u.user_avatar,'. [/color] ' p.post_id, p.post_time, p.icon, p.uid, p.poster_name'. ' FROM ' . $db->prefix('bb_posts') . ' AS p '. ' LEFT JOIN ' . $db->prefix('bb_topics') . ' AS t ON t.topic_last_post_id=p.post_id'. ' LEFT JOIN ' . $db->prefix('bb_forums') . ' AS f ON f.forum_id=t.forum_id'. [color=FF0000] ' LEFT JOIN ' . $db->prefix('users') . ' AS u ON u.uid=p.uid'. [/color] ' WHERE 1=1 ' . $forum_criteria . $approve_criteria . $extra_criteria . ' ORDER BY ' . $order . ' DESC'; $result = $db->query($query, $options[1], 0); if (!$result) { newbb_message("newbb block query error: ".$query); return false; } $block['disp_mode'] = $options[3]; // 0 - full view; 1 - compact view; 2 - lite view; $rows = array(); $author = array(); while ($row = $db->fetchArray($result)) { $rows[] = $row; $author[$row["uid"]] = 1; } if (count($rows) < 1) return false; $author_name = newbb_getUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); foreach ($rows as $arr) { $topic_page_jump = ''; if ($arr['allow_subject_prefix']) { $subjectpres = explode(',', $newbbConfig['subject_prefix']); if (count($subjectpres) > 1) { foreach($subjectpres as $subjectpre) { $subject_array[] = $subjectpre; } $subject_array[0] = null; } $topic['topic_subject'] = $subject_array[$arr['topic_subject']]; } else { $topic['topic_subject'] = ""; } $topic['post_id'] = $arr['post_id']; $topic['forum_id'] = $arr['forum_id']; $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); $topic['id'] = $arr['topic_id']; [color=FF0000] $topic['poster_avatar'] = $arr['user_avatar']; [/color] $title = $myts->htmlSpecialChars($arr['topic_title']); if(!empty($options[5])){ $title = xoops_substr($title, 0, $options[5]); } $topic['title'] = $title; $topic['replies'] = $arr['topic_replies']; $topic['views'] = $arr['topic_views']; $topic['time'] = newbb_formatTimestamp($arr['post_time']); if (!empty($author_name[$arr['uid']])) { $topic_poster = $author_name[$arr['uid']]; } else { $topic_poster = $myts->htmlSpecialChars( ($arr['poster_name'])?$arr['poster_name']:$GLOBALS["xoopsConfig"]["anonymous"] ); } $topic['topic_poster'] = $topic_poster; $topic['topic_page_jump'] = $topic_page_jump; $block['topics'][] = $topic; unset($topic); } $block['indexNav'] = intval($options[4]); return $block; }
And for
function b_newbb_topic_show($options) (shows the most recently created topics) within the same file (also 3 lines, very similar to the first 3):
le="color: #000000"><?php function b_newbb_topic_show($options) { global $xoopsConfig; global $access_forums; $db = &Database::getInstance(); $myts = &MyTextSanitizer::getInstance(); $block = array(); $i = 0; $order = ""; $extra_criteria = ""; $time_criteria = null; if(!empty($options[2])) { $time_criteria = time() - newbb_getSinceTime($options[2]); $extra_criteria = " AND t.topic_time>".$time_criteria; } switch ($options[0]) { case 'views': $order = 't.topic_views'; break; case 'replies': $order = 't.topic_replies'; break; case 'digest': $order = 't.digest_time'; $extra_criteria = " AND t.topic_digest=1"; if($time_criteria) $extra_criteria .= " AND t.digest_time>".$time_criteria; break; case 'sticky': $order = 't.topic_time'; $extra_criteria .= " AND t.topic_sticky=1"; break; case 'time': default: $order = 't.topic_time'; break; } $newbbConfig = getConfigForBlock(); if(!isset($access_forums)){ $forum_handler =& xoops_getmodulehandler('forum', 'newbb'); if(!$access_obj =& $forum_handler->getForums(0, 'access', array('forum_id', 'cat_id', 'forum_type')) ){ return null; } $access_forums = array_keys( $access_obj ); // get all accessible forums unset($access_obj ); } if (!empty($options[6])) { $allowedforums = array_filter(array_slice($options, 6), "b_newbb_array_filter"); // get allowed forums $allowed_forums = array_intersect($allowedforums, $access_forums); }else{ $allowed_forums = $access_forums; } $forum_criteria = ' AND t.forum_id IN (' . implode(',', $allowed_forums) . ')'; $approve_criteria = ' AND t.approved = 1'; $query = 'SELECT'. ' t.topic_id, t.topic_replies, t.forum_id, t.topic_title, t.topic_views, t.topic_subject, t.topic_time, t.topic_poster, t.poster_name,'. [color=FF0000] ' u.user_avatar,'. [/color] ' f.forum_name, f.allow_subject_prefix'. ' FROM ' . $db->prefix('bb_topics') . ' AS t '. ' LEFT JOIN ' . $db->prefix('bb_forums') . ' AS f ON f.forum_id=t.forum_id'. [color=FF0000] ' LEFT JOIN ' . $db->prefix('users') . ' AS u ON u.uid=t.topic_poster'. [/color] ' WHERE 1=1 ' . $forum_criteria . $approve_criteria . $extra_criteria . ' ORDER BY ' . $order . ' DESC'; $result = $db->query($query, $options[1], 0); if (!$result) { newbb_message("newbb block query error: ".$query); return false; } $block['disp_mode'] = $options[3]; // 0 - full view; 1 - compact view; 2 - lite view; $rows = array(); $author = array(); while ($row = $db->fetchArray($result)) { $rows[] = $row; $author[$row["topic_poster"]] = 1; } if (count($rows) < 1) return false; $author_name = newbb_getUnameFromIds(array_keys($author), $newbbConfig['show_realname'], true); foreach ($rows as $arr) { $topic_page_jump = ''; if ($arr['allow_subject_prefix']) { $subjectpres = explode(',', $newbbConfig['subject_prefix']); if (count($subjectpres) > 1) { foreach($subjectpres as $subjectpre) { $subject_array[] = $subjectpre; } $subject_array[0] = null; } $topic['topic_subject'] = $subject_array[$arr['topic_subject']]; } else { $topic['topic_subject'] = ""; } $topic['forum_id'] = $arr['forum_id']; $topic['forum_name'] = $myts->htmlSpecialChars($arr['forum_name']); $topic['id'] = $arr['topic_id']; [color=FF0000] $topic['poster_avatar'] = $arr['user_avatar']; [/color] $title = $myts->htmlSpecialChars($arr['topic_title']); if(!empty($options[5])){ $title = xoops_substr($title, 0, $options[5]); } $topic['title'] = $title; $topic['replies'] = $arr['topic_replies']; $topic['views'] = $arr['topic_views']; $topic['time'] = newbb_formatTimestamp($arr['topic_time']); if (!empty($author_name[$arr['topic_poster']])) { $topic_poster = $author_name[$arr['topic_poster']]; } else { $topic_poster = $myts->htmlSpecialChars( ($arr['poster_name'])?$arr['poster_name']:$GLOBALS["xoopsConfig"]["anonymous"] ); } $topic['topic_poster'] = $topic_poster; $topic['topic_page_jump'] = $topic_page_jump; $block['topics'][] = $topic; unset($topic); } $block['indexNav'] = intval($options[4]); return $block; }
Then, you will be able to add this code to newbb/templates/blocks/newbb_block.html and newbb/templates/blocks/newbb_block_topic.html wherever you want the posters' avatars to appear in the template:
le="color: #000000"><?php <img src="<{xoops_url}>/uploads/<{topic.poster_avatar}>" width="50px" alt="" />
And you're done!