Quote:
Originally Posted by Lionel
where does it take the journal id in postbit? it is showing all users with no journals because there are no id even for those who have a journal
|
Whoops! My bad.. :nervous:
I'll try and come up with a solution shortly.. There's got to be a better way than adding so many queries.
------------------------------------------------------------------
Ok, here it is.. The fix that will only show the menu item if the user has a journal, and grab the journal_id correctly with no additional queries added to your showthread.php page..
If you haven't already, remove this code from the
includes/functions_showthread.php file:
Code:
$journal= $DB_site->query_first("SELECT journal_id,journaldesc FROM ".TABLE_PREFIX."journals
WHERE journalist_id='".$post[userid]."'
");
if(empty($journal[journal_id]))
{
$show[journal]="false";
}
else
{
$show[journal]="true";
if(strlen($journal[journaldesc])>150)
{
$journal[journaldesc]= "".substr($journal[journaldesc], 0, 150)."...";
}
}
Now undo the changes that we made to the
postbit(_legacy) and
journal_journalpage templates earlier.. If you didn't use the previous fix, you obviously don't need to do this.
Now in the
postbit(_legacy) template, find:
HTML Code:
<if condition="$show[journal]=='true'">
<tr>
<td class="vbmenu_option"><a href="journal.php?do=showjournal&j=$journal[journal_id]" title="$journal[journaldesc]">Visit $post[musername]'s Journal</a></td>
</tr>
</if>
Replace it with:
HTML Code:
<if condition="$post['journal_id']">
<tr><td class="vbmenu_option"><a href="journal.php?$session[sessionurl]do=showjournal&j=$post[journal_id]" title="$journal[journaldesc]">Visit $post[musername]'s Journal</a></td></tr>
</if>
Now open the
showthread.php file, find (
1st instance of):
Code:
user.*, userfield.*, usertextfield.*,
On the same line next to it, add:
Code:
journal.journal_id,
Find (in the same query):
Code:
LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid = user.userid)
Below it add:
Code:
LEFT JOIN " . TABLE_PREFIX . "journals AS journal ON(journal.journalist_id = user.userid)
You should be set to go.! Please note that this fix is for the linear display mode only.. :ninja: