MyBB Community Forums

Full Version: Latest Posts On Index Sidebar [New Build 03-24-17]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13
Your template should not contain backslashes in it. The reason you see it in the plugin file is because you need to escape the single quote so it can be inserted into the database.
Hello, I have a little problem. I want to include this in the footer template but it doesn't work. :/
If I leave it in the index template it works fine, but when moved it doesn't show.
(2015-05-05, 07:56 PM)r3nt3r Wrote: [ -> ]Hello, I have a little problem. I want to include this in the footer template but it doesn't work. :/
If I leave it in the index template it works fine, but when moved it doesn't show.

This is because the footer template is evaluated before the code runs. You'd need to change the hook to global_start for it to work. I can't guarantee everything would work correctly though.
(2015-05-05, 08:06 PM)dragonexpert Wrote: [ -> ]
(2015-05-05, 07:56 PM)r3nt3r Wrote: [ -> ]Hello, I have a little problem. I want to include this in the footer template but it doesn't work. :/
If I leave it in the index template it works fine, but when moved it doesn't show.

This is because the footer template is evaluated before the code runs.  You'd need to change the hook to global_start for it to work.  I can't guarantee everything would work correctly though.

It works. Smile Thanks. I hope it won't cause other problems with this.
(2015-05-05, 11:21 AM)dragonexpert Wrote: [ -> ]Your template should not contain backslashes in it.  The reason you see it in the plugin file is because you need to escape the single quote so it can be inserted into the database.



How can I fix this?

I need help.
Hello, Daniel
Your pluggin affects the default breadcumb of mybb.
(more information here)
Could you fix it?
Also does anyone else have the same problem?
I am a bit confused. I downloaded this plugun from this address. After installing it it shows two apparent errors which are hard to miss.

Did I download it from the wrong place?
^ please post the errors so that someone can check them
First of all after unpacking the zip file, there are two files latestposts.php. Because one is outside the Upload folder, I used the one in the plugins folder. There are differences between the two, but not related to the matters discussed below.

Line 249 of latestpost.php reads:


$lang->latestposttime = $lang->sprintf($lang->latestposttime, $lastposttimeago);


This is within a loop over threads, and is evaluated for each thread. But the result remains the same for all threads, because after the 1-st sprintf the {1} in the language variable $lang->latestposttime is replaced bij the date of the 1-st thread. I therefore changed this into:


$latestposttime = $lang->sprintf($lang->latestposttime, $lastposttimeago);

Then in the template index_sidebar_post where this is used, I made the same change. Line 143:

{$lang->latest_post_by} {$lastposterlink} {$lang->latestposttime}

was changed into:


{$lang->latest_post_by} {$lastposterlink} {$latestposttime}

Now every thread shows its correct date and time.

Further it appears that the link to the thread brings you to the startpost, where at line 242 the link to the last post is evaluated:


$lastpostlink = get_thread_link($thread['tid'], "", "lastpost");


But when we look at the (same) template index_sidebar_post, line 142 we see:


<strong><a href="{$mybb->settings[\'bburl\']}/showthread.php?tid={$tid}">{$postname}</a></strong><br>


This is a link to the thread, without defining lastpost. So I changed this to:


<strong><a href="{$mybb->settings[\'bburl\']}/{$lastpostlink}">{$postname}</a></strong><br>

And now the link brings you to the last post of the thread.

What I mentioned before, 2 obvious bugs. Are we talking about the same builds, because this should have been noticed before!

EDIT
I see that these facts have been mentioned, but did not seem to bring the author to the idea to fix it. Clumsy, no other word for that.
^ Thank You for the detailed information & the corrections Smile
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13