PDA

View Full Version : Latest 5 dynamic entries in profile


Lionel
09-10-2007, 11:39 PM
This is a very simple hack that will display the latest 5 entries in member info.

1- Create a template (replace blogs/ with your folder name) adv_dyna_last_entrybit<li><a class="smallfont" href="blogs/showentry.php?$session[sessionurl]?e=$lastentry[entryid]">$lastentry[title]</a> <span class="smallfont">($lastentry[entrydate])</span></li>2- Create a plugin at member_complete and put in there$who=$vbulletin->GPC['userid'];
$blogs= $db->query_read("SELECT * FROM " . TABLE_PREFIX . "_adv_dyna_entries WHERE userid='$who' AND valid='1' AND private='0' ORDER BY dateline DESC LIMIT 5");

if ($db->num_rows($blogs)==0)
{
$show['bloginfo'] = false;
}
else
{
$show['bloginfo'] = true;

while ($lastentry = $db->fetch_array($blogs))
{
$lastentry['entrydate']= vbdate($vbulletin->options['dateformat'] ,$lastentry['dateline'], 1);
eval('$last_five_entries .= "' . fetch_template('adv_dyna_last_entrybit') . '";');
}

}3-Finally, in memberinfo template (put in table as per your taste) add where you want to display it

<if condition="$show[bloginfo]">
<ul>$last_five_entries</ul>
</if>

tfw2005
09-10-2007, 11:51 PM
Any instructions on how to use this for multiple instances, so you could pull blogs, other types of entries, etc etc, into different blocks?

And, thanks!

Our Sponsors
 

Lionel
09-10-2007, 11:56 PM
I would assume that you would have to duplicate the plugin, template etc and call the correct table from db.

I would also change all names to avoid conflict e.g. $blogs2, $lastentry2, $show['bloginfo2'] etc... etc ...

angeljs
10-15-2011, 04:42 PM
This is weird. I'm getting an error that the table adv_dyna_entries doesn't exist, even though it does! :(