Mar 24

MyBB Username Reference Notification Plugin

Tag: PHP,ProgrammingAbhijeet Maharana @ 5:15 pm

Jayant and I collaborated on the development of a MyBB plugin. It enables MyBB based forums to send out email notifications to users when their username is referenced in a post – preceded by the @ character. Of course, users have to opt in to receive such notification. So the plugin adds a checkbox to the User CP for this purpose.

Screenshot of the extra option added to User CP

This is how someone will reference the username in a post. This will not work for usernames with spaces and special characters. For handling these cases, the regex used in the get_users_to_notify() function will need improvement.

@jayant Hi this is a test post

This is the email notification that is sent to the user

jayant,
 
       abhijeet has just referenced you in a post on MyTestForum.
 
       To view the post, you can go to the following URL:
       http://localhost/mybb/showthread.php?tid=1&pid=14#pid14
 
       Thank you,
       MyTestForum Staff

You can download the plugin here. Extract the archive and copy urnotification.php to the inc/plugins folder. You can then enable it from the Admin Control Panel.

We referred the source of gtalk profile plugin by ssmol while developing this one. The “debugging” environment was NetBeans 6.8 with PHP bundle, XAMPP 1.7.3 and MyBB 1.4.11.

5 Responses to “MyBB Username Reference Notification Plugin”

  1. Mac says:

    Why not you submit this to mybb plugin category so that people can try it out and give comments? More visibility that way.

  2. Abhijeet Maharana says:

    Good idea Mac! Will try this.

  3. djdoubt03 says:

    Can you provide me with info on how to have this automatically enabled when new users register?

  4. djdoubt03 says:

    Have you by chance gotten this to work with users names that have spaces?

  5. Abhijeet Maharana says:

    Hi djdoubt3,

    Thanks for dropping by. For handling usernames with spaces and other special characters, you need to change the regex “/@(\w+)/i” in get_users_to_notify() to something that can handle such input which is enclosed within delimiters.

    To have this automatically enabled for new users, you can modify the alter table statement in urnotification_activate() function to set the default value to 1.

    I did not have the chance to work on this anymore but I hope the above works for you.

Leave a Reply