News:

Wondering if this will always be free?  See why free is better.

Main Menu

@mention members

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

Previous topic - Next topic

Kratos_ILM

Hey, I have a problem.

I install this mod, he told me installatin is ok and after thaI have this error :

Parse error: syntax error, unexpected T_ARRAY, expecting ')' in /home/nintendob/www/forum/Sources/Mentions.php on line 16

And I dont understand why :(

Can u help me ?

d3vcho

Hello!

Can you please attach your file so we can have a look?

Regards :)
"Greeting Death as an old friend, they departed this life as equals"

Kratos_ILM

Yes ! It's this file !

Thx for help !

d3vcho

The file seems correct in that line. Are you sure you didn't receive any errors while installing? I'd suggest reinstalling it.

Regards :)
"Greeting Death as an old friend, they departed this life as equals"

Kratos_ILM

I have this so I dont know why... :'(

And 4 installations, 4 fails !

Kratos_ILM


Kratos_ILM

Hello,

I up this topic, I dont have solution :(

Shambles

The file you attached above will not produce the error you are seeing. Did you just attach what was in the mod package? If so, we need to see what is being executed on your website.

memokal

Hello, i know i ask amateur questions. But it says you have to enable invidual members to mention others. But i cant find where can i enable it.

Help please

br360

Go to Admin>>Permissions>>General Permissions. Then under the General section, make sure that you check "Mention members." You are going to have to do this for each membergroup you have that you want to be able to @mention other members

Sigyn

Quote from: Paracelsus on June 17, 2016, 03:48:28 AM
Quote from: Gluz on June 01, 2016, 08:49:02 PM
Quote from: Miker1029 on May 23, 2016, 02:04:33 PM
I am Also Having this Problem, One of my test Accounts is "Black Death" and when you hit the Space the Drop-Down Goes away, I complete the Username (Death), and It doesn't send e-mail, Or make the "@Black Death" into a Clickable link...

Also, If I click the username in the drop down, It also Doesn't work, Same as above...

I searched here for "Space Username", and didn't see a fix.

Anyone have an Idea on how to fix this?

Thanks

Mike

Change the content of file /Themes/default/scripts/mentions.js to this (from the Github of the author):

/**
* Javascript interface for active suggestions while posting
*
* @author ******iz Garg <mail@dragooon.net>
* @copyright 2014 ******iz Garg
* @license Simplified BSD (2-Clause) License
*/

var mentionInit = function()
{
var fails = [];

var config = {
at: '@',
data: [],
show_the_at: true,
limit: 10,
callbacks: {
matcher: function(flag, subtext, should_start_with_space) {
var match = '', started = false;
var string = subtext.split('');
for (var i = 0; i < string.length; i++)
{
if (string[i] == flag && (!should_start_with_space || i == 0 || /[\s\n]/gi.test(string[i - 1])))
{
started = true;
match = '';
}
else if (started)
match = match + string[i];
}

if (match.length > 0)
return match;

return null;
},
remote_filter: function (query, callback) {
if (typeof query == 'undefined' || query.length < 2 || query.length > 60)
return;

for (i in fails)
if (query.substr(0, fails[i].length) == fails[i])
return;

$.ajax({
url: smf_scripturl + '?action=suggest;' + smf_sessvar + '=' + smf_sessid + ';xml',
method: 'GET',
data: {
search: query,
suggest_type: 'member'
},
success: function (data) {
var members = $(data).find('smf > items > item');
if (members.length == 0)
fails[fails.length] = query;

var callbackArray = [];
$.each(members, function (index, item) {
callbackArray[callbackArray.length] = {
name: $(item).text()
};
});

callback(callbackArray);
}
});
}
}
};

if (typeof $.fn.atwho == 'undefined' && typeof jQuery.fn.atwho != 'undefined')
{
var iframe = jQuery('#html_message');

if (typeof iframe[0] != 'undefined')
jQuery(iframe[0].contentDocument.body).atwho(config);
jQuery('textarea[name=message]').atwho(config);
}
else
{
var iframe = $('#html_message');
if (typeof iframe[0] != 'undefined')
$(iframe[0].contentDocument.body).atwho(config);
$('textarea[name=message]').atwho(config);
}
};

var atWhoElement = document.createElement('script');
atWhoElement.src = atwho_url;
atWhoElement.type = 'text/javascript';
atWhoElement.onload = mentionInit;

if (typeof $ == 'undefined' || (parseInt($.fn.jquery.substr(0, 1)) == 1 && parseInt($.fn.jquery.substr(2, 3)) < 8) || jQuery.fn.jquery != $.fn.jquery)
{
var scriptElement = document.createElement('script');
scriptElement.src = jquery_url;
scriptElement.type = 'text/javascript';

scriptElement.onload = function () {
document.body.appendChild(atWhoElement);
};

document.body.appendChild(scriptElement);
}
else
document.body.appendChild(atWhoElement);









Though this is not relevant for the issue with spaces in names, is worth to mention it and fix it (all from the author's Github).

In the /Sources/mentions.php file search:
if (count($matches[count($matches) - $i]) > 60)
{
$depth--;
break;
}


and replace for:
if (count($matches[count($matches) - $i]) > 60)
{
$depth--;
continue;
}



Find:
$subject = str_replace(array_keys($replacements), array_values($replacements), $txt['mentions_subject']);
$body = str_replace(array_keys($replacements), array_values($replacements), $txt['mentions_body']);
sendmail($mention['email_address'], $subject, $body);

and replace for:
$emailsubject = str_replace(array_keys($replacements), array_values($replacements), $txt['mentions_subject']);
$body = str_replace(array_keys($replacements), array_values($replacements), $txt['mentions_body']);
sendmail($mention['email_address'], $emailsubject, $body);



Find:
$subject = str_replace(array_keys($replacements), array_values($replacements), $txt['mentions_subject']);
$body = str_replace(array_keys($replacements), array_values($replacements), $txt['mentions_body']);
sendmail($row['email_address'], $subject, $body);

Replace for:
$emailsubject = str_replace(array_keys($replacements), array_values($replacements), $txt['mentions_subject']);
$body = str_replace(array_keys($replacements), array_values($replacements), $txt['mentions_body']);
sendmail($row['email_address'], $emailsubject, $body);



Find:
'base_href' => $scripturl . '?action=profile;area=tracking;sa=user;u=' . $memID,
Replace for:
'base_href' => $scripturl . '?action=profile;area=mentions;sa=user;u=' . $memID,


Hi, unfortunately these changes don't solve the problem on tagging those with ' in their names, which has been reported by other users.

Can anyone find an effective solution for this?


I apologize if I missed the response to this despite my reading to the end of the thread... Has there been a solution yet? I never received a response to my uploaded code on page 23? I believe it was.

James Gryphon

I have text at the top of the page in index.template.php that's designed to mimic the "You have x new messages" message from the Classic theme in SMF 1. That said, I've been trying to add mentions to it and it refuses to load the number. Have a look at the current code:

if ($context['user']['is_logged']) {
if ($context['user']['unread_messages'] == 0) {
if ($context['user']['is_logged'] == 0) // This is here for debugging purposes, to force the forum to use the second statement
echo '
<li id="name">', $txt['hello_member_ndt'], ' <em>', $context['user']['name'], '</em>! ', '<a href="', $scripturl, '?action=pm">', 'You have ', '0', ' new messages', '</a>', ' and ', '<a href="', $scripturl, '?action=profile;area=mentions">', '0', ' new mentions.', '</a></li>';
else echo '
<li id="name">', $txt['hello_member_ndt'], ' <em>', $context['user']['name'], '</em>! ', '<a href="', $scripturl, '?action=pm">', 'You have ', '0', ' new messages', '</a>', ' and ', ' <em>','<a href="', $scripturl, '?action=profile;area=mentions">', $context['member']['unread_mentions'], ' new mentions</em>.', '</a></li>'; }


If I substitute 'is_logged'  for 'unread_mentions' it reads it fine, displaying "1 new mentions". With 'unread_mentions', though, it's just left blank: "and new mentions".

What am I missing?

Kindred

not every variable is loaded into the context array at every point in the code...

unread_messages has probably not been loaded at the point that you trigger this display.
Слова
Украина

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

James Gryphon

Quote from: Kindred on December 16, 2016, 08:58:56 AM
unread_messages has probably not been loaded at the point that you trigger this display.
So, how can that be done?

Kindred

figure out where it is loaded and either move your display to that point or move the loading to sooner...

I have no idea how to program it... I just know how to debug issues. :P

or forget about it. :D
Слова
Украина

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

James Gryphon

Quote from: Kindred on December 16, 2016, 12:32:52 PM
figure out where it is loaded and either move your display to that point or move the loading to sooner...

I have no idea how to program it... I just know how to debug issues. :P

or forget about it. :D
I'm sorry to say that's not exactly helpful, when figuring out where/if it is loaded is my problem. ;)

Anyone else want to take a crack at it?

ninjawarrior

This is a great mod, makes it more interactive.

However, would like to have permissions:
1. Limit the members/membergroups that can use this function
2. Disable some members from being tagged (eg. admin, mods etc.)

B20

Possibility of mentioning an entire membergroup would be nice

Quote from: ninjawarrior on January 08, 2017, 11:17:51 AM
This is a great mod, makes it more interactive.

However, would like to have permissions:
1. Limit the members/membergroups that can use this function
2. Disable some members from being tagged (eg. admin, mods etc.)
1. You can limit membergroups. Toggle it on membergroup permissions (General)

Bob Perry of Web Presence Consulting

Quote from: B20 on January 09, 2017, 07:35:19 PM
Possibility of mentioning an entire membergroup would be nice

Quote from: ninjawarrior on January 08, 2017, 11:17:51 AM
This is a great mod, makes it more interactive.

However, would like to have permissions:
1. Limit the members/membergroups that can use this function
2. Disable some members from being tagged (eg. admin, mods etc.)
1. You can limit membergroups. Toggle it on membergroup permissions (General)

Yep, what he said, those options are already a part of the module located in the Permissions admin menu... each member group you have set up can be toggled on or off among other things if i remember, it is a great mod and you'll know if it is installed correctly if the auto-fill username lookup functions properly after you type in the @ sign and the first three characters of the user you wish to "mention"
Best Regards,
Bob Perry



"The world is moving so fast these days that the man who says it can't be done is generally interrupted by someone doing it." Elbert Hubbard

Bob Perry of Web Presence Consulting

Quote from: Bob Perry on January 11, 2017, 11:53:54 AM
Quote from: B20 on January 09, 2017, 07:35:19 PM
Possibility of mentioning an entire membergroup would be nice

Quote from: ninjawarrior on January 08, 2017, 11:17:51 AM
This is a great mod, makes it more interactive.

However, would like to have permissions:
1. Limit the members/membergroups that can use this function
2. Disable some members from being tagged (eg. admin, mods etc.)
1. You can limit membergroups. Toggle it on membergroup permissions (General)

Yep, what he said, those options are already a part of the module located in the Permissions admin menu... each member group you have set up can be toggled on or off among other things if i remember, it is a great mod and you'll know if it is installed correctly if the auto-fill username lookup functions properly after you type in the @ sign and the first three characters of the user you wish to "mention"

However, I don't think you can @membergroups by name of group, haven't tested that....
Best Regards,
Bob Perry



"The world is moving so fast these days that the man who says it can't be done is generally interrupted by someone doing it." Elbert Hubbard

Advertisement: