• Welcome to Simple Machines Community Forum. Please login or sign up.
September 21, 2021, 08:08:34 AM

News:

Follow SMF on Twitter.


@mention members

Started by Dragooon, May 02, 2014, 01:07:58 PM

Previous topic - Next topic

Adrek

Great modification! Good work Dragooon :)
Polskie wsparcie SMF na simplemachines.org

the simplest solution is most likely the right one

NoPasaran

Great mod ..


but there is a letter problem..


for example..


if i write


@nopasaran


is not going notice..


@NoPasaran is true spelling..


i think important problems
kralkartal.net SMF 2.0.8

Dragooon

Quote from: NoPasaran on May 04, 2014, 06:51:37 AM
Great mod ..


but there is a letter problem..


for example..


if i write


@nopasaran


is not going notice..


@NoPasaran is true spelling..


i think important problems
Fix for this:
Code (Find (Sources/Mentions.php)) Select
    foreach ($members as $member)
    {
        if (strpos($msgOptions['body'], '@' . $member['real_name']) === false
            || (!in_array(1, $member['groups']) && count(array_intersect($member['groups'], $member_groups)) == 0))
            continue;

        $msgOptions['body'] = str_replace('@' . $member['real_name'], '[member=' . $member['id'] . ']' . $member['original_name'] . '[/member]', $msgOptions['body']);

        // Why would an idiot mention themselves?
        if ($user_info['id'] == $member['id'])
            continue;

        $msgOptions['mentions'][] = $member;
    }

Code (Replace) Select
    foreach ($members as $member)
    {
        if (stripos($msgOptions['body'], '@' . $member['real_name']) === false
            || (!in_array(1, $member['groups']) && count(array_intersect($member['groups'], $member_groups)) == 0))
            continue;

        $msgOptions['body'] = str_ireplace('@' . $member['real_name'], '[member=' . $member['id'] . ']' . $member['original_name'] . '[/member]', $msgOptions['body']);

        // Why would an idiot mention themselves?
        if ($user_info['id'] == $member['id'])
            continue;

        $msgOptions['mentions'][] = $member;
    }

Biology Forums

I thought you were going to charge for this?

Dragooon

Quote from: Liam_michael on May 04, 2014, 11:23:40 AM
I thought you were going to charge for this?
Changed my mind

FrizzleFried

FYI - Mod does not seem to work when editing... example...

I wrote a post I forgot to add the @ before the name of the person... I edited and went back in and added the @... it didn't work.


Dragooon

Is the name correct? I fixed this issue while the mod was being reviewed. Remember that currently the name is case sensitive.

Tallypop


Rhindeer

You are my freakin' hero. *___*

Dragooon

Can anyone help me by testing my latest changes (they're in the mod's GitHub repository)? I've done light testing and I think they're fine, but I want to be sure before releasing it on the mod site. Here is a a summary of changes

- Add active suggestions while mentioning someone, works in quick reply as well as full post page (normal and WYSIWYG editor).
- Add Scheduled Task for removing seen mentions before specified days
- Allow setting whether e-mail mentions should be enabled by default or not (defaulted to enable)
- Fix for making mentions case insensitive (@admin = @AdMIn = @adMIN =@Admin)
- Some code cleanup

lurkalot

Quote from: Dragooon on May 05, 2014, 05:25:32 AM
Can anyone help me by testing my latest changes (they're in the mod's GitHub repository)?


Looking good from here, testing it on a local install atm.  Liking the "active suggestions while mentioning someone"  Nice work. ;)

Dragooon

Quote from: lurkalot on May 05, 2014, 07:07:06 AM
Quote from: Dragooon on May 05, 2014, 05:25:32 AM
Can anyone help me by testing my latest changes (they're in the mod's GitHub repository)?


Looking good from here, testing it on a local install atm.  Liking the "active suggestions while mentioning someone"  Nice work. ;)
Thanks! If you have any suggestions let me know

lurkalot

Thanks.  Have noticed, and this might just be my testbed.  If I uninstall the mod it leaves the tags in,

What was there when mod installed = @lurkapo how you doing?

When mod un-installed it shows = @lurkapo how you doing?

FrizzleFried

Quote from: Dragooon on May 05, 2014, 01:14:02 AM
Is the name correct? I fixed this issue while the mod was being reviewed. Remember that currently the name is case sensitive.

The name is correct and I used the code you posted above to fix "case sensitivity" issue which works when not in edit mode.  I'll test again though when I have time and get back to you.  Just something I noticed last night when I came across it.  Otherwise it seems to be working great.

FrizzleFried

I found another problem.  My membership are always looking for ways to screw with me and other members (it's the type of forum we have).  One of them mentioned a member "a bunch of times" in a single post.  I am trying to find out what "a bunch of times" means but it crashed the post to a white screen.  I can't get in to the post to determine how many times the jackwad mentioned the member but it appears that at a certain number it crashes the post to a white screen.  You might want to add a "limit" to the number of mentions permitted per post.

Dragooon

Can you check your error logs for any errors?

FrizzleFried

Quote from: Dragooon on May 05, 2014, 11:55:25 AM
Can you check your error logs for any errors?

I see nothing apparent... and accessing the post that "white screens" does not produce an error. 

FrizzleFried

OK... the user didn't know exactly how many times... 100 to 150 times was his estimate.

But you see how this could become a problem (even if it didn't white screen the post).... who wants 150 mentions sent to their profile from the same post?


Dragooon

There must be something else, because I just mentioned a member 300 times on my localhost and it worked fine. And an user will only get a single mention per post regardless of how many times they were mentioned

FrizzleFried

I will ask if he did anything else.  Any suggestion on how I can get in an read what he did if I am getting a white screen?

Advertisement: