How @ references work

0 favourites
From the Asset Store
_______ Huge collection of metal fixtures ________
  • 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.

  • 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?

  • I've seen it catching part of emails thinking its an username, like gmail or

  • Testing:

  • 7Soul thanks, will fix today

  • Is now fixed. Anything will always turn into a link, but now somethingpgi@something wont

  • How does this work?

    I mean how did you implement this into phpBB?

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

    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);
    });
    [/code:2c2sc29a]
  • So I'll need this ProfileRedirect thing in the handlers/fresh/newforum ?

  • That's just a small script that takes the username, and redirects to the correct profile URL.

  • Thank you

  • test

    doc

    Doc

    doc ei

    doc Ai

    Doc Ai

    Tom

    do i need more rep to do that?

    /test

  • LPC

    I have less rep than you

  • Doc ai

    yep. It's not the rep. but the didn't work when i've written them. Maybe Tom changed something.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's a problem with the space in the name. I'm thinking the best way to solve it is not allow spaces in names (replace them all with underscores). Will look into this this week.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)