Recent Posts in menu bar

Started by riker, August 07, 2008, 02:30:25 PM

Previous topic - Next topic

riker

Does anyone know the code to add the Recent Posts link to the menu bar as it looks like SMF doesn't intend on adding it to the menu.  I've attached an image of what I mean as I have it on another board but forgot the code

niko

Websites: Madjoki || (2 links retracted by team, links out of date and taken over.)
Mods: SMF Arcade, Related topics, SMF Project Tools, Post History

WIP Mods: Bittorrent Tracker || SMF Wiki

riker

Quote from: Niko on August 07, 2008, 02:32:23 PM
How to add tabs to Core (NDT)?

Also you could copy code from another board?

Can't even remember what I'm looking for now lol

Nathaniel

This topic relates to adding the same thing for SMF 2 Beta:
http://www.simplemachines.org/community/index.php?topic=253683

If you have SMF 1.1.5, then I can show you how to do it for that version.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

riker

Quote from: LHVWB on August 07, 2008, 05:19:24 PM
This topic relates to adding the same thing for SMF 2 Beta:
http://www.simplemachines.org/community/index.php?topic=253683

If you have SMF 1.1.5, then I can show you how to do it for that version.

Thanks mate,  I searched my index template for "recent posts" and found this so just copied it to the new one :)

// Recent Post
echo ($current_action == 'recent' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'recent' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=recent">' , $txt[214] , '</a>
</td>' , $current_action == 'recent' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

riker

Sorry to come back with this but I have updated my sons site to SMF 2.0 and the code doesn't work with that so does anyone have updated code for 2.0 ?

Nathaniel

Have a read of this post:
http://www.simplemachines.org/community/index.php?topic=253683.msg1646707#msg1646707

You will need to have a look at the 'setupMenuContext()' from your Subs.php file.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

riker

Quote from: LHVWB on August 10, 2008, 05:13:14 PM
Have a read of this post:
http://www.simplemachines.org/community/index.php?topic=253683.msg1646707#msg1646707

You will need to have a look at the 'setupMenuContext()' from your Subs.php file.

Is that were the code needs adding now because I'm next to useless with php

Nathaniel

Okay, well these edits will work:

Find this code (subs.php):
         'login' => array(
            'title' => $txt['login'],
            'href' => $scripturl . '?action=login',
            'show' => $user_info['is_guest'],
            'sub_buttons' => array(
            ),
         ),


Add this code before it:
         'unread' => array(
             'title' => 'Unread Posts',
             'href' => $scripturl . '?action=unread',
             'show' =>  !$user_info['is_guest'],
             'sub_buttons' => array(
             ),
          ),
          'unreadreplies' => array(
              'title' => 'Unread Replies',
              'href' => $scripturl . '?action=unreadreplies',
              'show' =>  !$user_info['is_guest'],
              'sub_buttons' => array(
              ),
           ),


You may wish to replace 'title' => 'Unread Replies' and 'Unread Posts' with the titles that you want them to have. If you have multiple languages, then you may be able to find a SMF language string to do it for you, I can do that if necessary.

You may need to clear the file cache, under "Maintenance" -> "Forum Maintenance" -> "Empty the file cache".
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

riker

Thanks for your help LHVWB but as you can see that isn't Recent Posts, ending  "/index.php?action=recent"

You can see on this thread the code I used on SMF 1.1.x but it doesn't work on SMF 2.0

Nathaniel

Ah, okay. Sorry I obviously misinterpreted what you want.

Here is the code you will need to add for a Recent Posts button:
'recent' => array(
'title' => $txt['recent_posts'],
'href' => $scripturl . '?action=recent',
'show' => true,
'sub_buttons' => array(
),
),


I have used a SMF language string for the title, so it will work in any language that SMF is using.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

riker

Quote from: LHVWB on August 11, 2008, 06:52:08 AM
Ah, okay. Sorry I obviously misinterpreted what you want.

Here is the code you will need to add for a Recent Posts button:
'recent' => array(
'title' => $txt['recent_posts'],
'href' => $scripturl . '?action=recent',
'show' => true,
'sub_buttons' => array(
),
),


I have used a SMF language string for the title, so it will work in any language that SMF is using.

Thanks LHVWB your a star, I've managed to get it just as I like it now :)  Shame SMF couldn't have added such a widely used feature like this as standard on the menu bar

[SiNaN]

There is a link for that in welcome text for user.
Former SMF Core Developer | My Mods | SimplePortal

Advertisement: