Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: 1nstan7 on December 08, 2014, 02:30:59 PM

Title: Recent post
Post by: 1nstan7 on December 08, 2014, 02:30:59 PM
Hello,

Well I tried looking for a a feedback section but I couldnt find it. This is my first post and I join to tell the guys at SMF that I love it. I seriously tried a few free forums and this one works like how I want it. Its also free! I just used it for a few hours. I check out functions, layout and etc before making a decision and I think im going to stay (hopefully).

Well I seen the recent post function which display the recent post. I was wondering is there a plugin that I can control which part of the topics is uses. For example the recent posts will only display recent posts in the "welcome section" and the "great gamers sections"? (this is a example lol) 

If so will it possible to add another one with a mod?

Lastly will be able to control the layout of the "recent post"? making it smaller? Would I have the change the CSS?
Title: Re: Recent post
Post by: Kindred on December 08, 2014, 02:54:59 PM
when you refer to "recent posts", what section do you mean?

The recent posts list on the main boardindex?
If so - then no... without some manual coding, there is no mod or feature to limit what is displayed there

If you have a homepage (outside the forum or like a portal) then you can do it, using ssi_recentPosts

as for the layout or sizing...    that is determined in boardindex.template.php and the CSS.
Title: Re: Recent post
Post by: 1nstan7 on December 08, 2014, 03:00:18 PM
Thanks for the response :)

A section on SMF.org for users to give positive feedback :)

Is there a way I can view that code for the recent posts?

Edit : just saw "simple portal" which looks really handy. Damn this SMF is surprisingly good
Title: Re: Recent post
Post by: Arantor on December 09, 2014, 08:22:14 AM
There used to be such a board but it ended up getting support questions instead of the proper board getting them, so the board was closed.
Title: Re: Recent post
Post by: Kindred on December 09, 2014, 09:22:37 AM
code for recent posts on the boardindex is pulled (not surprisingly) in Sources/boardindex.php and displayed in Themes/default/boardindex.template.php
Title: Re: Recent post
Post by: margarett on December 09, 2014, 10:07:43 AM
I was looking at the code and there's really no direct way to do that.

Function is called in BoardIndex.php
// Retrieve the latest posts if the theme settings require it.
if (isset($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1)
{
$latestPostOptions = array(
'number_posts' => $settings['number_recent_posts'],
);
$context['latest_posts'] = cache_quick_get('boardindex-latest_posts:' . md5($user_info['query_wanna_see_board'] . $user_info['language']), 'Subs-Recent.php', 'cache_getLastPosts', array($latestPostOptions));
}

That uses
cache_getLastPosts
from Subs-Recent.php. This is actually a callback for getLastPosts in the same file.

A dirty trick to do it would be to mess with "query_wanna_see_board" when this function is called, methinks. Or, add a new element to $latestPostOptions and deal with it in the query...
Title: Re: Recent post
Post by: Kindred on December 09, 2014, 10:09:32 AM
there used to be a mod which specifically REMOVED posts in specific board(s) from displaying on the recent posts list...   this would sort of be the opposite and shouldn't be too difficult (require a modification to the SQL query WHERE statement)