Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+12 votes
8.6k views
in Plugins by
edited by

So here it is. You can download the Portugues version or the English version from here:

mention-notifier-pt.rar

mention-notifier-en.rar

mention-notifier-pt.zip

mention-notifier-pt.zip

Question2Answer Minimum Version: 1.4

Installation

The installation is simple, just edit the file qa-mentions.sql and change the prefix of the table to match with your's database (default is qa_, so if your is the same you don't need to change), and then import it to your database.

The Plugin

The plugin has two widgets, one shows new mentions to the current logged on user, and the other is just available for question pages and shows the mentions in that question.

The plugin has alse one page which can be accessed by typing /mentions in the address bar. This shows all mention notifications for the current user. You can close the notifications.

The plugin also throws an event each time an user is mentioned, named "u_mentioned".

To mention someone, just type a @ before the username, like "@scorch"

Unfortunately, the plugins doesn't support usernames with spaces.

Look at the video.

 

Test it, enjoy it, and say if you liked it or dound any bugs. :)

by
It's only for Q2A 1.4  ? if yes you forgot to mention.
by
Thanks for sharing! Any sample you can show us please? Will be great to see how it looks like and acts like.
by
@Friendly one Yes, I forgot to mention on the post but it is specified in the file. I'll edit the mein post. :)

@webshimim I'll try to convince gidgreen to install it here. :D
by
Ok, and thanks for contribution , i will try as soon as 1.4 released :)
by
can you pls show demo of this plugin. Thanks.
by
@ProThoughts I'll make a video. :)
by
Video uploaded. :)
by
can you pls put .zip file.
by
It's done. :)
by
When I mention someone in comment, I got this error:
Question2Answer query failed:

INSERT INTO qa_mentions (to_id, from_id, question_id, post_id, post_type, date)
VALUES (3, 1, NULL, 2595, _utf8 'C', 1306999163)

Error 1048: Column 'question_id' cannot be null
by
Unknow bug. I'll check it and then gonna update the main files. :)
by
edited by
Got it. That just happens if you are commenting an question, because I need the question id, and to do that, I used to get the answer id the comment belongs, and then the parentid of that suposed "answer" to get the question ID. If the "answer" was already a question, it would return me null which is the value stored in the database. Now I check the type first. I'll update the main post. :)

Thanks for reporting. For those who want, just replace this below the line 94 of the file qa-mention-detect.php

$questionid = "SELECT parentid, type FROM ^posts WHERE postid = # LIMIT 1";
$questionid = qa_db_query_sub($questionid, $answerid);
$questionid = qa_db_read_one_assoc($questionid, false);
if ($questionid['type'] == 'Q'){
    $questionid = $answerid;
} else {
    $questionid = $questionid['parentid'];
}
by
Could you put code of the line 94 so I can search? Or specify more detail where to insert code above? Because I changed a bit your code to fit my need so maybe the line is not the same.
by
Another issue when I mention someone in the answer:
- Suppose that parameter setting in your system is just like that: Minimum characters in answer = 12.
- I mention @federik in the answer of a question and type the answer with less than 12 words.
- Because of that validation above answer data is not inserted into database but mention is done already.

Try this case and check. I will test and report more.
by
REPORT: Error 1048: Column 'question_id' cannot be null
- FIXED in case comment for the answer but got the same error if comment is for question.
by
This is the line:

$questionid = "SELECT parentid FROM ^posts WHERE postid = # LIMIT 1";

Delete it and the two lines above, and then paste the corrected code I posted.
by
Fatal error: Call to undefined function qa_get_userids_from_public() in /home/***/public_html/qa-plugin/mention-notifier/qa-mention-detect.php on line 63

qa_get_userids_from_public() is not implemented.
by
I still don't know if this plugin is fixed. I downloaded the  mention-notifier-en.rar  from your link above but received qa_get_userids_from_public() error again.
by
@scorch: Please update the post title to "Mention Notifier plugin". Otherwise it could be misunderstood as general notification plugin like this version here: http://www.question2answer.org/qa/33127/premium-notifications-facebook-stackoverflow-question2answer

7 Answers

0 votes
by

Question2Answer query failed:

SELECT value FROM qa_userlogs WHERE user_id = 1 and name = "mentions_last_update"

Error 1146: Table 'cookboo1_wanyuwang.qa_userlogs' doesn't exist

 

by
Thanks for reporting. I actually forgot to include the table userlogs in the sql file. If you import it again, it should work. I've also corrected one bug in the file qa-mentions.php, so you should update it too. The links are the same. :)
0 votes
by
when post a answer, the page is blank. answer is posted, but there is no mention. No data in qa_mentions database
0 votes
by
错误

SQL 查询:

CREATE TABLE IF NOT EXISTS `qa_mentions` (

`ID` int( 11 ) NOT NULL AUTO_INCREMENT ,
`to_id` int( 11 ) NOT NULL ,
`from_id` int( 11 ) NOT NULL ,
`question_id` int( 11 ) NOT NULL ,
`post_id` int( 11 ) NOT NULL ,
`post_type` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
`eliminated` tinyint( 1 ) NOT NULL DEFAULT '0',
`closed` tinyint( 1 ) NOT NULL DEFAULT '0',
`date` int( 11 ) NOT NULL ,
PRIMARY KEY ( `ID` ) ,
UNIQUE KEY `ID` ( `ID` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8_unicode_ci

 

MySQL 返回:

#1115 - Unknown character set: 'utf8_unicode_ci'  

When install the database, error.  so I change it to:

CREATE TABLE IF NOT EXISTS `qa_mentions` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `to_id` int(11) NOT NULL,
  `from_id` int(11) NOT NULL,
  `question_id` int(11) NOT NULL,
  `post_id` int(11) NOT NULL,
  `post_type` text CHARACTER SET utf8  NOT NULL,
  `eliminated` tinyint(1) NOT NULL DEFAULT '0',
  `closed` tinyint(1) NOT NULL DEFAULT '0',
  `date` int(11) NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID` (`ID`)
);

database was installed successfully, but the program not work.

by
just @username you can see here http://www.wanyuwang.com
by
Ok, I think I found the problem. That's because I use RegEx to get the posted usernames, and I'm not sure it works with other chars. You may fix this by probabily adding the chars you want in your usernames by editing the file qa-mentions-detect.php, and change the line 39. :)
by
I could see that It just works with external user db not bounded user db. Could use make an option so that it can work with both of db?
by
Unfortunately, I don't know how to do it now. I'm thinking in installing Q2A again, but with a embedded users database, so I can test the plugin and make it compatible.
0 votes
by

I would like to ask everyone who could test the plugin to test it, because it's hard to say if the plugin is compatible with many environments or there are incompatibilities.

Thanks,

Scorch

0 votes
by

Hi, I got this error message

Call to undefined function qa_get_userids_from_public() in /home/olimpiad/public_html/ask/qa-plugin/mention-notifier/qa-mention-detect.php

on line 63

by
nvm, I didn't read your instruction above. Let give me a try :).
by
It doesn't work!
The same case as abcute above
by
I got the same error


Fatal error: Call to undefined function qa_get_userids_from_public() in C:\webpub\qa4\qa-plugin\mention-notifier\qa-mention-detect.php on line 63
+2 votes
by

Thank to scorch for providing us an interesting plug-in. For the reason that the current version is not supported for bounded user database, I modified a bit to fix it.

Now it can work with BOUNDED user database. You can download here

If you find any bug, let me know.

by
That is a feature already implemented by Q2A main code. You can do that by checking the box "Email me" below the input box.
by
Yes, I know that. What I want is onsite notification. The idea is that if you are already on the site and someone reply to your old question/answer you don't want to go to your email first to know about this. You want to immediately respond to that. It something like in facebook.
by
Suggest that to gidgreen. My plugin is only for mentions, but that may be a good feature for Q2A itself. :)
by
edited by
I also tried yours but get this fatal error after each @user comment:


A Question2Answer database query failed when generating this page.

A full description of the failure is available in the web server's error log file.

Server error details:
Column 'from_id' cannot be null ...etc

I think the error comes from unregistered users comments.
0 votes
by
edited by
hello friend, sorry, I'm using your plugin mentions in version 1.4 is excellent I congratulate you.

I have only one problem that maybe you can help, the system works fine, but i when mention more than one user, the system only detects  a one mention and not the others, it's like I just detect only one @ and ignore the others, there is some how to make multiple mentions detected?

greetings and thanks in advance

--------

thank you very much for answering and for the help with this wonderful mention-plugin

I can not wait you can find a solution, I am a beginner in php, I'm learning this beautiful community.

also please if you make a new version fixing this bug,

add numbers "preg_match_all" for users that have numbers in your username, I could easily fix this by adding "0-9" :

"

$return = preg_match_all("/@([0-9a-zA-Z_\-][0-9a-zA-Z_\-]*)/", $params["text"], $text, PREG_SET_ORDER);

"

but to mention multiple users on a single post I have no idea how to fix it, for example if a response i mention 3 users, only recognizes one of them:  @user1 @user2 @user3, only one of theme its recognizes:S

greetings, thank you very much and sorry for my English I am Spanish-speaking
...