Advertisement:

Author Topic: @mention members  (Read 134949 times)

Offline Kratos_ILM

  • Newbie
  • *
  • Posts: 8
Re: @mention members
« Reply #500 on: December 01, 2016, 12:05:02 PM »
Hey, I have a problem.

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

Code: [Select]
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 ?

Offline d3vcho();

  • On Hiatus
  • SMF Hero
  • *
  • Posts: 1,497
  • Gender: Male
    • d3vcho on GitHub
    • @SMF_ES on Twitter
    • WintxCoders
Re: @mention members
« Reply #501 on: December 01, 2016, 12:09:33 PM »
Hello!

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

Regards :)
Programmer (noun.)
A person who fixed a problem you don't know you have, in a way you don't understand.


¡Únete al canal IRC de SMF en español! #smf-es en Freenode
Sigue a @SMF_ES en Twitter para enterarte de todas las novedades de SMF

Offline Kratos_ILM

  • Newbie
  • *
  • Posts: 8
Re: @mention members
« Reply #502 on: December 01, 2016, 12:10:59 PM »
Yes ! It's this file !

Thx for help !

Offline d3vcho();

  • On Hiatus
  • SMF Hero
  • *
  • Posts: 1,497
  • Gender: Male
    • d3vcho on GitHub
    • @SMF_ES on Twitter
    • WintxCoders
Re: @mention members
« Reply #503 on: December 01, 2016, 12:16:44 PM »
The file seems correct in that line. Are you sure you didn't receive any errors while installing? I'd suggest reinstalling it.

Regards :)
Programmer (noun.)
A person who fixed a problem you don't know you have, in a way you don't understand.


¡Únete al canal IRC de SMF en español! #smf-es en Freenode
Sigue a @SMF_ES en Twitter para enterarte de todas las novedades de SMF

Offline Kratos_ILM

  • Newbie
  • *
  • Posts: 8
Re: @mention members
« Reply #504 on: December 01, 2016, 12:22:27 PM »
I have this so I dont know why... :'(

And 4 installations, 4 fails !

Offline Kratos_ILM

  • Newbie
  • *
  • Posts: 8
Re: @mention members
« Reply #505 on: December 01, 2016, 03:07:40 PM »
U can't help me ? :(

Offline Kratos_ILM

  • Newbie
  • *
  • Posts: 8
Re: @mention members
« Reply #506 on: December 03, 2016, 04:26:10 AM »
Hello,

I up this topic, I dont have solution :(

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 4,216
  • Gender: Male
    • i30 Owners Club
Re: @mention members
« Reply #507 on: December 03, 2016, 05:49:37 AM »
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.

Offline memokal

  • Semi-Newbie
  • *
  • Posts: 20
Re: @mention members
« Reply #508 on: December 05, 2016, 04:44:47 PM »
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

Offline br360

  • Lead Support Specialist
  • SMF Hero
  • *
  • Posts: 1,731
    • GenXcommunity
Re: @mention members
« Reply #509 on: December 05, 2016, 08:49:05 PM »
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

Offline Sigyn

  • Semi-Newbie
  • *
  • Posts: 85
  • Gender: Female
    • Dragon's Rise AU
Re: @mention members
« Reply #510 on: December 06, 2016, 05:18:35 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):

Code: [Select]
/**
 * 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:
Code: [Select]
if (count($matches[count($matches) - $i]) > 60)
{
$depth--;
break;
}

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

Find:
Code: [Select]
$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:
Code: [Select]
$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:
Code: [Select]
$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:
Code: [Select]
$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:
Code: [Select]
'base_href' => $scripturl . '?action=profile;area=tracking;sa=user;u=' . $memID,Replace for:
Code: [Select]
'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.

Offline James Gryphon

  • Semi-Newbie
  • *
  • Posts: 52
Re: @mention members
« Reply #511 on: December 16, 2016, 07:51:50 AM »
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:

Code: [Select]
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?

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 54,319
  • Gender: Male
    • Kindred-999 on GitHub
Re: @mention members
« Reply #512 on: December 16, 2016, 08:58:56 AM »
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.

Offline James Gryphon

  • Semi-Newbie
  • *
  • Posts: 52
Re: @mention members
« Reply #513 on: December 16, 2016, 11:44:37 AM »
unread_messages has probably not been loaded at the point that you trigger this display.
So, how can that be done?

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 54,319
  • Gender: Male
    • Kindred-999 on GitHub
Re: @mention members
« Reply #514 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
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline James Gryphon

  • Semi-Newbie
  • *
  • Posts: 52
Re: @mention members
« Reply #515 on: December 16, 2016, 05:43:45 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?

Offline ninjawarrior

  • Newbie
  • *
  • Posts: 9
Re: @mention members
« Reply #516 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.)

Offline B20

  • Newbie
  • *
  • Posts: 6
Re: @mention members
« Reply #517 on: January 09, 2017, 07:35:19 PM »
Possibility of mentioning an entire membergroup would be nice

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)

Offline Bob Perry

  • Sr. Member
  • ****
  • Posts: 897
  • Gender: Male
  • (T)ogether (E)veryone (A)chieves (M)ore
    • Bobert921 on Facebook
    • @bperry921 on Twitter
    • Web Presence Consulting
Re: @mention members
« Reply #518 on: January 11, 2017, 11:53:54 AM »
Possibility of mentioning an entire membergroup would be nice

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

Offline Bob Perry

  • Sr. Member
  • ****
  • Posts: 897
  • Gender: Male
  • (T)ogether (E)veryone (A)chieves (M)ore
    • Bobert921 on Facebook
    • @bperry921 on Twitter
    • Web Presence Consulting
Re: @mention members
« Reply #519 on: January 12, 2017, 04:33:09 AM »
Possibility of mentioning an entire membergroup would be nice

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