Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: dougiefresh on May 20, 2018, 03:11:32 PM

Title: Filter Messages By Poster
Post by: dougiefresh on May 20, 2018, 03:11:32 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=4174)


FILTER MESSAGES BY POSTER v1.4
By Dougiefresh (http://www.simplemachines.org/community/index.php?action=profile;u=253913) -> Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=4174)


Introduction
This mod allows the user to restrict the displaying of messages by any poster by using the filter icon in the poster area in the messages display.  The filtering can be stopped using the unfilter icon in the poster area in the messages display (or using the back button, naturally).

Admin Settings
There are no admin settings.  To disable it, you must remove this mod.

Compatibility Notes
This mod was tested on SMF 2.0.15 and SMF 2.1 RC2, but should work on SMF 2.0 and up.  SMF 2.1 Beta 1, SMF 2.1 Beta 2, and SMF 1.x is not and will not be supported.

Related Discussion
o Toggle replies to show OP replies only (https://www.simplemachines.org/community/index.php?topic=559341.0)

Changelog
The changelog can be viewed at XPtsp.com (http://www.xptsp.com/board/free-modifications/filter-messages-by-poster/?tab=1).

License
Copyright (c) 2018 - 2019, Douglas Orend
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Title: Re: Filter Messages By Poster
Post by: Rock Lee on May 20, 2018, 07:16:44 PM
Great contribution, as always :D. I leave the translation to Latin Spanish!

Regards!
Title: Re: Filter Messages By Poster
Post by: dougiefresh on May 21, 2018, 09:48:30 PM
Uploaded v1.1 - May 21st, 2018
o Added support for SMF 2.1 Beta 3.
o Added Spanish Latin translation, courtsey of Rock Lee (https://www.simplemachines.org/community/index.php?action=profile;u=322597).



@Rock Lee:  Thank you for the translation!  It's been included in this version!
Title: Re: Filter Messages By Poster
Post by: stoneageman on May 26, 2018, 06:17:01 AM
What a great feature addition. Thanks very muchly Dougie  :)
Title: Re: Filter Messages By Poster
Post by: digger on May 26, 2018, 11:42:51 AM
Russian translation
Title: Re: Filter Messages By Poster
Post by: dougiefresh on October 16, 2018, 12:11:20 PM
Uploaded v1.2 - October 15th, 2018
o No functionality change.
o Updated documentation to point to new website.
o Added Russian translation, courtsey of digger (https://www.simplemachines.org/community/index.php?action=profile;u=97557)!
Title: Re: Filter Messages By Poster
Post by: ORIONzitos on October 17, 2018, 01:07:41 PM
PT-BR translate AGAIN  :D
Title: Re: Filter Messages By Poster
Post by: dougiefresh on October 18, 2018, 09:01:20 PM
Uploaded v1.3 - October 18th, 2018
o Added Brazilian Portugese translation, courtsey of ORIONzitos (https://www.simplemachines.org/community/index.php?action=profile;u=598068)!



@ORIONzitos:  Thanks for the translation!  It's been included in this version!
Title: Re: Filter Messages By Poster
Post by: landyvlad on October 21, 2018, 09:05:12 PM
Does this replace / include the functionality of the Show only OP replies mod you previously created?
Title: Re: Filter Messages By Poster
Post by: dougiefresh on October 22, 2018, 10:15:38 AM
Does this replace / include the functionality of the Show only OP replies mod you previously created?
It replaces that mod.  Somehow it evolved into the mod it is now.....

For an idea how/why it changed, please read the Toggle replies to show OP replies only (https://www.simplemachines.org/community/index.php?topic=559341.0) thread.  It'll give you a better idea why/how it changed.....
Title: Re: Filter Messages By Poster
Post by: landyvlad on January 01, 2019, 11:43:47 PM
Cool, cheers dougie.
Title: Re: Filter Messages By Poster
Post by: dougiefresh on May 22, 2019, 06:21:03 PM
Uploaded v1.4 - May 22nd, 2018
o Added support for SMF 2.1 RC2.
o Removed support for SMF 2.1 Beta 3.
o Fixed line of code to make sure element is set before checking it's value.
o SMF 2.1: Added new query to get number of posters when member ID not specified.



@Everybody:  In SMF 2.1 RC2, I came upon a strange error message.  It was:
Quote
Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
File: D:\Website\clean21\Sources\Display.php
Line: 177
It referenced this query, with the offending line in bold (and arrow before it):
Quote
   $request = $smcFunc['db_query']('', '
      SELECT
         ' . (isset($_GET['member']) ? 'COUNT(msgs.id_msg) AS ' : 't.') . 'num_replies, t.num_views, t.locked, ms.subject, t.is_sticky, t.id_poll,
         t.id_member_started, t.id_first_msg, t.id_last_msg, t.approved, t.unapproved_posts, t.id_redirect_topic,
         COALESCE(mem.real_name, ms.poster_name) AS topic_started_name, ms.poster_time AS topic_started_time,
         ' . ($user_info['is_guest'] ? 't.id_last_msg + 1' : 'COALESCE(lt.id_msg, lmr.id_msg, -1) + 1') . ' AS new_from
         ' . (!empty($board_info['recycle']) ? ', id_previous_board, id_previous_topic' : '') . '
         ' . (!empty($topic_selects) ? (', ' . implode(', ', $topic_selects)) : '') . '
         ' . (!$user_info['is_guest'] ? ', COALESCE(lt.unwatched, 0) as unwatched' : '') . ',
-->            COUNT(DISTINCT msgs.id_member) AS num_posters
      FROM {db_prefix}topics AS t
         INNER JOIN {db_prefix}messages AS msgs ON (msgs.id_topic = t.id_topic' . (isset($_GET['member']) ? ' AND msgs.id_member = {int:filter_by}' : '') . ')
         INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
         LEFT JOIN {db_prefix}members AS mem on (mem.id_member = t.id_member_started)' . ($user_info['is_guest'] ? '' : '
         LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = {int:current_topic} AND lt.id_member = {int:current_member})
         LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = {int:current_board} AND lmr.id_member = {int:current_member})') . '
         ' . (!empty($topic_tables) ? implode("\n\t", $topic_tables) : '') . '
      WHERE t.id_topic = {int:current_topic}
      LIMIT 1',
      $topic_parameters
   );
The only way I could get rid of this irritating error message was to seperate the query getting the topic information from the query getting the number of posters in that topic.  If you know of a way to merge the queries back together without triggering that error message, please drop me a line.  Thanks for assisting!