Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: vbgamer45 on February 04, 2019, 05:06:19 PM

Title: Who Quoted Me
Post by: vbgamer45 on February 04, 2019, 05:06:19 PM
Link to the mod (https://custom.simplemachines.org/index.php?mod=4203)

For SMF 2.0.x
Shows the user a list of people that have quoted them.
Has built in option to rebuild quote history for all old posts


Install Information:
Install via the SMF's Package Manager via upload package.

License: BSD License
Title: Re: Who Quoted Me
Post by: live627 on February 04, 2019, 06:40:48 PM
What's the license?  I want to add this to my site but with a slightly different implementation.
Title: Re: Who Quoted Me
Post by: vbgamer45 on February 04, 2019, 06:55:06 PM
You can treat it as BSD/same as SMF.
Title: Re: Who Quoted Me
Post by: live627 on February 04, 2019, 08:03:13 PM
oh okay.

I see a few problems (haven't tested)
Title: Re: Who Quoted Me
Post by: vbgamer45 on February 04, 2019, 08:15:23 PM
Fixed the first two.

Regex have to think about. Was just handling the quote button on posts when quoting someone.
Title: Re: Who Quoted Me
Post by: -Rock Lee- on February 04, 2019, 08:29:52 PM
Very good @vbgamer45 great work!!!
Title: Re: Who Quoted Me
Post by: Arantor on February 05, 2019, 02:47:42 AM
Interesting, why not use the approach that 2.1 does where it looks for a quite with a message id?
Title: Re: Who Quoted Me
Post by: vbgamer45 on February 05, 2019, 08:26:13 AM
didn't look at it. It looks like they do it differently

protected static function getQuotedMembers($msgOptions, $posterOptions)
{
global $smcFunc;

$blocks = preg_split('/(\[quote.*?\]|\[\/quote\])/i', $msgOptions['body'], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);

$quote_level = 0;
$message = '';

foreach ($blocks as $block)
{
if (preg_match('/\[quote(.*)?\]/i', $block, $matches))
{
if ($quote_level == 0)
$message .= '[quote' . $matches[1] . ']';
$quote_level++;
}
elseif (preg_match('/\[\/quote\]/i', $block))
{
if ($quote_level <= 1)
$message .= '[/quote]';
if ($quote_level >= 1)
{
$quote_level--;
$message .= "\n";
}
}
elseif ($quote_level <= 1)
$message .= $block;
}

preg_match_all('/\[quote.*?link=msg=([0-9]+).*?\]/i', $message, $matches);

$id_msgs = $matches[1];
foreach ($id_msgs as $k => $id_msg)
$id_msgs[$k] = (int) $id_msg;

if (empty($id_msgs))
return array();

// Get the messages
$request = $smcFunc['db_query']('', '
SELECT m.id_member, mem.email_address, mem.lngfile, mem.real_name
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE id_msg IN ({array_int:msgs})
LIMIT {int:count}',
array(
'msgs' => array_unique($id_msgs),
'count' => count(array_unique($id_msgs)),
)
);

$members = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if ($posterOptions['id'] == $row['id_member'])
continue;

$members[$row['id_member']] = $row;
}

return $members;
}
Title: Re: Who Quoted Me
Post by: live627 on February 05, 2019, 04:27:35 PM
Quote from: Arantor on February 05, 2019, 02:47:42 AM
Interesting, why not use the approach that 2.1 does where it looks for a quite with a message id?
because some quotes use only author, such as a quote from a pm.
Title: Re: Who Quoted Me
Post by: vbgamer45 on February 05, 2019, 04:42:18 PM
I will say this mod just handles quotes from messages in posts does not handle pm's or in other areas.
Title: Re: Who Quoted Me
Post by: live627 on February 05, 2019, 04:46:20 PM
Of course. Some people actually do post a pm in public; rare, but it happens.
Title: Re: Who Quoted Me
Post by: Arantor on February 05, 2019, 04:50:40 PM
Quote from: live627 on February 05, 2019, 04:27:35 PM
Quote from: Arantor on February 05, 2019, 02:47:42 AM
Interesting, why not use the approach that 2.1 does where it looks for a quite with a message id?
because some quotes use only author, such as a quote from a pm.

I'd honestly suggest it would be better not to rely on that (especially as users so rarely use it that way) but I can see why you might not.
Title: Re: Who Quoted Me
Post by: pocttopus on December 13, 2019, 10:22:07 AM
What is the changelog of todays update?  ???
Title: Re: Who Quoted Me
Post by: vbgamer45 on December 13, 2019, 10:26:22 AM
Nothing just changed the license.
Title: Re: Who Quoted Me
Post by: pocttopus on December 15, 2019, 07:18:33 AM
Thanks. :)


Nothing here on this post... move along.  ;D
Title: Re: Who Quoted Me
Post by: BellGab.com on January 14, 2020, 08:54:38 PM
Thanks for this mod. Quite useful. I went ahead and rebuilt the quote database after I installed it and with 1.3 million posts, well, let's just say that took a while, heh heh. Actually, about 30 hours to be precise.
Title: Re: Who Quoted Me
Post by: digger on April 22, 2020, 08:50:41 AM
Russian translation
Title: Re: Who Quoted Me
Post by: vbgamer45 on April 22, 2020, 10:59:12 AM
Added translation to mod. Thanks for making it easier. I will to try to get better adding them to my mods.
Title: Re: Who Quoted Me
Post by: aegersz on May 01, 2020, 11:22:34 AM
it's working for new quotes but the historical quotes don't show anything.
Title: Re: Who Quoted Me
Post by: vbgamer45 on May 01, 2020, 11:36:50 AM
You have to rebuild the old quote history in the mod's settings
go to "Click here to rebuild quote log history"
Title: Re: Who Quoted Me
Post by: aegersz on May 01, 2020, 11:53:37 AM
sorry, yeah i did that and it took about 1/2 hour.

and the new quotes seem to disappear over time (?)

is that right ? otherwise the list would be huge after time and require pruning, i'm expecting (?)
Title: Re: Who Quoted Me
Post by: vbgamer45 on May 01, 2020, 11:59:54 AM
No they don't' disappear. It's small log table that just logs the message id and member id.
Title: Re: Who Quoted Me
Post by: aegersz on May 01, 2020, 12:06:35 PM
well they did for me and i am sure of that.

strange.

it's working better now but i'm still wondering why the Historical quotes weren't found.

any idea ?
Title: Re: Who Quoted Me
Post by: aegersz on May 04, 2020, 07:19:50 PM
Now it's working with the historical data.

The only thing I did differently is to create some test quotes first.

Can you provide a pruning function please ?
Title: Re: Who Quoted Me
Post by: vbgamer45 on May 04, 2020, 07:29:14 PM
How would the pruning work? X amount of days old?
Title: Re: Who Quoted Me
Post by: aegersz on May 04, 2020, 07:37:08 PM
Either that or the last n number of quotes ... I like just a number rather than a data but either will do.

If you can make it a scheduled task like the Track User Logins mod then people can still have the option of keeping everything if they don't enable the Scheduled Task.
Title: Re: Who Quoted Me
Post by: aegersz on May 04, 2020, 07:41:31 PM
Oh, and one more thing - i feel that the list should be in reverse order so that latest are at the top. You could make the Date column sortable.

Sorry to give you all this extra work  :-[
Title: Re: Who Quoted Me
Post by: vbgamer45 on May 04, 2020, 07:55:16 PM
The latest quotes should always be at the top...Unless you had a old version. Which had a bug on on importing old data not keeping the post time.
The data is sorted by by post time desc by default
Title: Re: Who Quoted Me
Post by: aegersz on May 04, 2020, 08:22:43 PM
Actually, it is sorting correctly. Thank you.

Are you still interesting to coding a pruning facility so I can get rid of some of the bulk and unwanted quote information ?
Title: Re: Who Quoted Me
Post by: vbgamer45 on May 04, 2020, 08:32:07 PM
Possibly at some point.
Title: Re: Who Quoted Me
Post by: vbgamer45 on July 28, 2020, 06:32:05 PM
Now supports SMF 1.1.x
Title: Re: Who Quoted Me
Post by: Arantor on July 28, 2020, 06:39:55 PM
I hate to ask, but ... why?
Title: Re: Who Quoted Me
Post by: vbgamer45 on July 28, 2020, 06:58:13 PM
Was from client request job.
Title: Re: Who Quoted Me
Post by: Arantor on July 29, 2020, 02:14:38 AM
Understandable but it's things like this that hold back 2.1...