Filter Messages By Poster

Started by dougiefresh, May 20, 2018, 03:11:32 PM

Previous topic - Next topic

dougiefresh

Link to Mod



FILTER MESSAGES BY POSTER v1.4
By Dougiefresh -> Link to Mod



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

Changelog
The changelog can be viewed at XPtsp.com.

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.

-Rock Lee-

Great contribution, as always :D. I leave the translation to Latin Spanish!

Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

dougiefresh

Uploaded v1.1 - May 21st, 2018
o Added support for SMF 2.1 Beta 3.
o Added Spanish Latin translation, courtsey of Rock Lee.




@Rock Lee:  Thank you for the translation!  It's been included in this version!

sam666

What a great feature addition. Thanks very muchly Dougie  :)

digger


dougiefresh

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!

ORIONzitos

Total of translations: 10

dougiefresh

Uploaded v1.3 - October 18th, 2018
o Added Brazilian Portugese translation, courtsey of ORIONzitos!




@ORIONzitos:  Thanks for the translation!  It's been included in this version!

landyvlad

Does this replace / include the functionality of the Show only OP replies mod you previously created?
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

dougiefresh

Quote from: 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?
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 thread.  It'll give you a better idea why/how it changed.....

landyvlad

"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

dougiefresh

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:
QuoteMixing 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!

digger

There is no member parameter in link to all pages.

Display.php
$context['page_index'] .= '&nbsp;<a href="' . $scripturl . '?topic=' . $topic . '.0;all">' . $txt['all'] . '</a> ';
should be replaced with
$context['page_index'] .= '&nbsp;<a href="' . $scripturl . '?topic=' . $topic . '.0;all' . (isset($_GET['member']) ? ';member=' . $_GET['member'] : ''). '">' . $txt['all'] . '</a> ';

@rjen

This MOD has more issues.

Below was on SMF2.1

Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
File: xxxxxx/public_html/test2/Sources/Display.php
Line: 157
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Arantor

@rjen what version of MySQL/Maria?
Holder of controversial views, all of which my own.

@rjen

mysqlnd 5.0.12-dev - 20150407
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Arantor

No, the actual server version.
Holder of controversial views, all of which my own.

@rjen

Quote from: Arantor on June 22, 2020, 08:19:44 AM
No, the actual server version.

Just curious: where do I find that?

php-info does not provide more than what I gave you....
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Arantor

The SMF admin panel should give you that. As would phpmyadmin.

mysqlnd is just the version of the PHP-MySQL connector.
Holder of controversial views, all of which my own.

@rjen

Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Advertisement: