News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Recent posts with specific icon

Started by ehsizzup, November 17, 2010, 12:26:24 PM

Previous topic - Next topic

ehsizzup

Hello all.

I would like to create a new SSI function that will return posts with a specific message icon only.

Using the function ssi_recentTopics as a starting point, can someone tell me how to add the code required to filter out the topic with the other icons.



Thanks in advance.


IchBin™

Inside the function look for this part:

        // Build the array.
        $posts[] = array(


Add before that function the check you want for which icon (I used "smiley").
if ($row['icon'] == 'smiley') {
        // Build the array.
        $posts[] = array(


Don't forget to add the closing bracket at the end of the array.
Find:
            'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
        );


Replace with:            'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
        );
    }

IchBin™        TinyPortal

ehsizzup

This will be a huge time saver for me!

Thank you so much.

g.

ehsizzup

Thanks a lot for this bit....but....

It seems this isnt exactly what I need.

The current code will list off all the recent topics with a specific message icon, but if there is a reply to one of those topics without the icon it will skip them both with the icon it will only return the reply not the original topic.

Is there a way to return the topics with specific icons only, while ignoring all the replies?


Advertisement: