Advertisement:

Author Topic: Who Quoted Me  (Read 634 times)

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,480
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Who Quoted Me
« on: February 04, 2019, 05:06:19 PM »
Link to Mod

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.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline live627

  • Development Contributor
  • SMF Hero
  • *
  • Posts: 5,620
  • Gender: Male
    • live627 on Facebook
    • live627 on GitHub
    • live627 on LinkedIn
    • @live627 on Twitter
    • livemods
Re: Who Quoted Me
« Reply #1 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.
Try not to become a man of success, but rather try to become a man of value.
- Albert Einstein

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,480
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Who Quoted Me
« Reply #2 on: February 04, 2019, 06:55:06 PM »
You can treat it as BSD/same as SMF.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline live627

  • Development Contributor
  • SMF Hero
  • *
  • Posts: 5,620
  • Gender: Male
    • live627 on Facebook
    • live627 on GitHub
    • live627 on LinkedIn
    • @live627 on Twitter
    • livemods
Re: Who Quoted Me
« Reply #3 on: February 04, 2019, 08:03:13 PM »
oh okay.

I see a few problems (haven't tested)
  • The hooks must go into the code tag. The database tag only executes on uninstall if the checkmark is checked. See SimpleDesk  for a godo example.
  • Admin area, try manually writing an unknown subaaction in the url; may get an undefined index
  • The regex to get the quoted author assumes all parameters are present when they're all really optional. Just search for the author.
Try not to become a man of success, but rather try to become a man of value.
- Albert Einstein

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,480
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Who Quoted Me
« Reply #4 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.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline Rock Lee

  • Native Language Support Specialist
  • SMF Hero
  • *
  • Posts: 2,873
  • Gender: Male
  • I also speak english :D
    • BomberCode.Oficial on Facebook
    • RockLee-BC on GitHub
    • @Bomber_Code on Twitter
    • Bomber Code ~ La nueva era del conocimiento
Re: Who Quoted Me
« Reply #5 on: February 04, 2019, 08:29:52 PM »
Very good @vbgamer45 great work!!!
¡Regresando como cual Fenix! ~ Bomber Code © 2018
Ayudas - Aportes - Tutoriales - Y mucho mas!!!


Ayudame via PayPal

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,367
    • StoryBB/StoryBB on GitHub
Re: Who Quoted Me
« Reply #6 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?
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,480
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Who Quoted Me
« Reply #7 on: February 05, 2019, 08:26:13 AM »
didn't look at it. It looks like they do it differently
Code: [Select]
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;
}
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline live627

  • Development Contributor
  • SMF Hero
  • *
  • Posts: 5,620
  • Gender: Male
    • live627 on Facebook
    • live627 on GitHub
    • live627 on LinkedIn
    • @live627 on Twitter
    • livemods
Re: Who Quoted Me
« Reply #8 on: February 05, 2019, 04:27:35 PM »
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.
Try not to become a man of success, but rather try to become a man of value.
- Albert Einstein

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,480
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Who Quoted Me
« Reply #9 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.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline live627

  • Development Contributor
  • SMF Hero
  • *
  • Posts: 5,620
  • Gender: Male
    • live627 on Facebook
    • live627 on GitHub
    • live627 on LinkedIn
    • @live627 on Twitter
    • livemods
Re: Who Quoted Me
« Reply #10 on: February 05, 2019, 04:46:20 PM »
Of course. Some people actually do post a pm in public; rare, but it happens.
Try not to become a man of success, but rather try to become a man of value.
- Albert Einstein

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,367
    • StoryBB/StoryBB on GitHub
Re: Who Quoted Me
« Reply #11 on: February 05, 2019, 04:50:40 PM »
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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.