polc1410 wrote:
OK, things get too messy trying to post lines of html on Joomla Board so I've written a HowTo and put it here:
http://www.wittongilbert.free-online.co.uk/FBHack/HowTo.html
Comments / changes / bugs / problems / praise back on this thread please. If I update it, I'll post here too...
My only suggestion is to change your new field name to category_id.
You might like to add the following hacks as well to get the User Profile working properly:
In template/default/plugin/myprofile/myprofile.php, about line 386
| Code: |
//get all subscriptions for this user
// <JXHACK>
//$database->setQuery("select thread from #__fb_subscriptions where userid=$my->id ORDER BY thread DESC LIMIT $limitstart, $limit");
// Replace with more efficient query so the subs template doesn't have to do as much work
$query = 'SELECT s.*, m.time, m.hits, m.name,' .
' CASE WHEN (s.thread = 0) THEN c.name ELSE m.subject END AS subject,' .
' CASE WHEN (s.thread = 0) THEN c.id ELSE m.catid END AS catid' .
' FROM #__fb_subscriptions AS s' .
' LEFT JOIN #__fb_messages AS m ON m.id = s.thread' .
' LEFT JOIN #__fb_categories AS c ON c.id = s.category' .
' WHERE s.userid='.(int) $my->id .
' ORDER BY s.thread, s.category DESC';
$database->setQuery( $query, $limitstart, $limit );
// </JXHACK>
$subslist = $database->loadObjectList();
|
This also makes the rendering in the subs template far more efficient. Note above I'm using the correct way to set the limit start and limit in setQuery, and also I am casting any input variables in the query just to be on the safe side (with respect to possible injection attacks).
Then, in template/default/plugin/myprofile/myprofile_subs.php, about line 65
| Code: |
// <JXHACK>
foreach ($subslist as $sub)
{ //get all message details for each subscription
// We got all this information in the main query
//$database->setQuery("select * from #__fb_messages where id=$subs->thread ");
//$subdet = $database->loadObjectList();
//foreach ($subdet as $sub)
{
$k = 1 - $k;
echo '<tr class="' . $boardclass . '' . $tabclass[$k] . '" >';
if ($sub->thread == 0) {
$link = JB_LIVEURLREL . '&func=showcat&catid=' . $sub->catid;
}
else {
$link = JB_LIVEURLREL . '&func=view&catid=' . $sub->catid . '&id=' . $sub->id;
}
echo '<td class="td-1" width="54%" align="left">' . $enum . ': <a href="' . sefRelToAbs( $link ) . '">' . $sub->subject;
// </JXHACK>
|
Removing that query in the loop should give that page a significant performance boost.
Anyone know if the authors are putting at least the original hack into the distro?