PDA

View Full Version : Possible to convert widget to forum block?


wottech
06-15-2010, 02:09 AM
Is there a way to convert a widget to a forum block, without a complete recode? I want a section navigation block in my forum that matches the one in the CMS. I have looked at the PHP file for the section navigation widget, as well as a CMS Articles block, and have made some attempts at getting the widget code to work as a block, but haven't had any luck at getting anything to display. Any thoughts or ideas would be greatly appreciated!

ArchAngelz
08-04-2010, 02:34 PM
I'm having a similar requireemnt; how do we make a widget display as a forum block?

Videx
08-05-2010, 01:09 AM
This should be a simple matter programmatically, but the problem right now is a lack of documentation. And the fact that little bits of code change with every update. But I have no doubt someone will figure it out eventually.

ArchAngelz
08-05-2010, 02:21 AM
Oh, I always thought PHP is the same whether in a widget or forum block; but I'm not a programmer so I don't really know.

Would you be able to help me change the following from a php execution widget to a php forum block; this is my immediate need right now...

$posts = "Posts";
ob_start();
require_once('./includes/functions_user.php');
require_once('./includes/functions_bigthree.php');
// Current Week Top Posters
$starttime = mktime(0, 0, 0, date('n'), date('j'), date('Y')) - ((date('N')-1)*3600*24);
// Get Top Members for current week
$mostactiveweek_get = vB::$db->query_read("
SELECT ".TABLE_PREFIX."user.userid, ".TABLE_PREFIX."user.username, ".TABLE_PREFIX."user.usertitle,
COUNT(".TABLE_PREFIX."post.postid) AS postcount
FROM ".TABLE_PREFIX."user
LEFT JOIN ".TABLE_PREFIX."post
ON ".TABLE_PREFIX."post.userid=".TABLE_PREFIX."user.userid
AND dateline>'".$starttime."'
WHERE usergroupid=2
GROUP BY ".TABLE_PREFIX."user.userid
ORDER BY postcount DESC
LIMIT 5");
$topposter = true;
$output_bits = '';
while($user = vB::$db->fetch_array($mostactiveweek_get))
{
$percentage = round(($user[postcount]/$totalposts[postcount]) * 100);
if($topposter == true)
{
$avatarurl = fetch_avatar_url($user[userid]);
if (!$avatarurl) {
$useravatar = 'images/misc/avatar.png';
} else {
$useravatar = $avatarurl[0];
}
$output_bits .='<div align="center">
<img border="0" src="'.$useravatar.'"><br />
<a target="_blank" href="member.php?u='.$user[userid].'">'.$user[username].'</a><br />
'.$user[usertitle].'<br />
'.$posts.':&nbsp;'.$user[postcount].'<br />
</div><hr />';
$topposter = false;
} else {
$output_bits .= '<a target="_blank" href="member.php?u='.$user[userid].'">'.$user[username].'</a><div style="float: right;">'.$user[postcount].'</div><br />';
}
}
This should be a simple matter programmatically, but the problem right now is a lack of documentation. And the fact that little bits of code change with every update. But I have no doubt someone will figure it out eventually.

keithop
09-02-2010, 07:15 PM
Is there a way to convert a widget to a forum block, without a complete recode? I want a section navigation block in my forum that matches the one in the CMS. I have looked at the PHP file for the section navigation widget, as well as a CMS Articles block, and have made some attempts at getting the widget code to work as a block, but haven't had any luck at getting anything to display. Any thoughts or ideas would be greatly appreciated!

Me too! I'd certainly be willing to pay for a conversion of the section/category navigation widgets or anything that would enable them to display on every forum page

Lynne
09-02-2010, 09:41 PM
I have some code that I released as both a widget and a forum block. Download them both and compare the differences to see what you have to do.

wottech
09-02-2010, 09:55 PM
I have some code that I released as both a widget and a forum block. Download them both and compare the differences to see what you have to do.

Link? Or, at least a section in which you released it. Mods area, programming discussions, etc... Thanks!

--------------- Added 1283469206 at 1283469206 ---------------

Nevermind, I found them. Printing them out to compare, and then I'll take a look at the Section Navigation widget and see what I can do about creating a forum block out of it.