How @ references work

If you have found a bug, or have a suggestion/comment then leave it here

Post » Fri Feb 28, 2014 6:03 pm

We've improved the @ reference system on the forum.

If you post:

  • @Username in a thread and it exactly matches a registered user, they will be notified

If the @Username reference is too short, for example "@Usern", if anyone has posted in the thread whos username starts with "Usern" they will be referenced so long as they are the only match (and the @ reference has at least 3 characters in it)

If still no matches are found, it will look for mispellings of users who have posted in the thread you're posting in. For example, if "Username" has posted in the thread, and you make a reference to "@Usneram" they will be notified. This is based on a "similarity" function with a 70% match required.

Also, if posting in someones thread, if not already @ referenced, the OP will be notified there has been a reply.

Also, any @Username references to yourself that are exact will be highlighted in the thread as long as you are viewing with a Javascript enabled browser.
Image Image
Scirra Founder
B
173
S
41
G
34
Posts: 4,397
Reputation: 54,116

Post » Fri Feb 28, 2014 8:55 pm

I have always wondered about users with spaces in their names, does it actually respect the second part of the name or just use the first half?
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Fri Mar 07, 2014 8:40 am

I've seen it catching part of emails thinking its an username, like @gmail or @hotmail
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Fri Mar 07, 2014 8:57 am

Image Image
Scirra Founder
B
173
S
41
G
34
Posts: 4,397
Reputation: 54,116

Post » Fri Mar 07, 2014 8:57 am

@7Soul thanks, will fix today
Image Image
Scirra Founder
B
173
S
41
G
34
Posts: 4,397
Reputation: 54,116

Post » Fri Mar 07, 2014 9:58 am

Is now fixed. @anything will always turn into a link, but now [email protected] wont
Image Image
Scirra Founder
B
173
S
41
G
34
Posts: 4,397
Reputation: 54,116

Post » Fri Mar 07, 2014 11:31 am

How does this work?
I mean how did you implement this into phpBB?
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Fri Mar 07, 2014 1:17 pm

@Doc here's the code which replaces the @References with their links on the bottom of each page in this forum:

Code: Select all
var currentUserID = <!-- PHP -->echo( $user->data['user_id']);<!-- ENDPHP -->;
var currentUsername = '<!-- PHP -->echo( $user->data['username']);<!-- ENDPHP -->';

var regEx = new RegExp("@(" + currentUsername + ")( |\n|\r|!|\\,|\\.|\\)|;|:|\\?)", "ig");
var replaceMask = '<div class="self-ref">@$1</div>$2';   
var regEx2 = new RegExp("( |\n|\r|!|\\,|\\.|\\)|;|:|\\?)@([a-z0-9_-]{3,})( |\n|\r|!|\\,|\\.|\\)|;|:|\\?)", "ig");
var replaceMask2 = '$1<a href="../../handlers/fresh/newforum/profileredirect.ashx?u=$2" title="View $2\'s profile" class="ex-ref">@$2</a>$3';

$('.postbody').each(function(index) {
   var replaced = $(this).html();
   
   // Self refs
   if(currentUserID > 1)
      replaced = replaced.replace(regEx, replaceMask);
   
   // Other user refs
   replaced = replaced.replace(regEx2, replaceMask2);
   
   $(this).html(replaced);
});
Image Image
Scirra Founder
B
173
S
41
G
34
Posts: 4,397
Reputation: 54,116

Post » Fri Mar 07, 2014 2:45 pm

So I'll need this ProfileRedirect thing in the handlers/fresh/newforum ?
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Fri Mar 07, 2014 3:02 pm

That's just a small script that takes the username, and redirects to the correct profile URL.
Image Image
Scirra Founder
B
173
S
41
G
34
Posts: 4,397
Reputation: 54,116

Next

Return to Website Issues and Feedback

Who is online

Users browsing this forum: No registered users and 0 guests