Page 1 of 1

vBulletin 4.x Topic Reply Notification Plugin

PostPosted: 22 Feb 2011, 04:21
by James
I couldn't find one readily available, so thought I would take it upon myself to create one :)

This plugin should be active for any threads where the user has requested to receive instant email notifications (this means it should also obey the rules about not sending two notifications if the user hasn't viewed the thread yet). Who knows, I might make a proper product where users can turn this off individually, we'll see how many people would be interested :)

I was going to make a plugin XML you can just import into vB but realised your notification type may differ to mine.


Firstly add the Notification in your ArrowChat admin control panel using the following code (or modify to suit your tastes, mine's based on the "new_facebook_full" theme):
Code: Select all
<div class="arrowchat_notification_box arrowchat_blue_link">
   <img src="/arrowchat/themes/new_facebook_full/images/icons/notification_wall_post.png" class="arrowchat_notification_icon" />
   <a href="#">{author_name}</a> has replied to the thread <a href="/{misc2}">{misc1}</a>.<br />
   <div class="arrowchat_received">Received {longago}</div>
</div>
<div class="arrowchat_notifications_divider"></div>

Notes:
Replace /{misc2} with the path to your forums, for example if you were mydomain.com/forums/ it would be: /forums/{misc2}
Make a note of the type ID you are given for the next stage

Then to add the plugin to vBulletin:
Go to: AdminCP > Plugin & Products > Add New Plugin

Product: vBulletin
Hook Location: newpost_notification_message
Title: Arrowchat Topic Reply Notification
Execution Order: Leave this as default
Plugin PHP Code:
Code: Select all
/* ARROWCHAT TOPIC REPLY NOTIFICATION - BY JAMES HARLAND */
$arrowchat_alert_type_id = 4; // Enter your Type Number here, this needs to be correct to use the correct template!

/* YOU SHOULDNT NEED TO EDIT BELOW THIS LINE */
   $vbulletin->db->query_write("
      INSERT INTO arrowchat_notifications
         (to_id, author_id, author_name, type, alert_time, misc1, misc2)
      VALUES
         ('".$touser[userid]."', '".$vbulletin->userinfo[userid]."', '".$vbulletin->userinfo[username]."', '".$arrowchat_alert_type_id."', '".time()."', '".mysql_real_escape_string($threadinfo[title])."'  ,'".$threadlink."')
      ");
/* END ARROWCHAT TOPIC REPLY NOTIFICATION */

You need to edit $arrowchat_alert_type_id to match the type ID given when you added the notification
Plugin is Active: Yes

Give it a test, but if all goes well, your users should receive notifications!

Just a warning I suppose, as this adds an entry for each user subscribed to each thread, this could add a bit of database load if there are hundreds of users subscribed to a thread, but I can't really think of an easier way around it!

Screenshots of it in action:
Image

Any questions, ask away :)

James.

PostPosted: 28 Mar 2011, 22:21
by TJones
Very nice, thanks for sharing!

PostPosted: 28 Mar 2011, 22:41
by TJones
Hmm, got the notification to pop when it should, but the thread text/URL aren't there to click on. Any ideas?

Re: vBulletin 4.x Topic Reply Notification Plugin

PostPosted: 10 Jul 2011, 00:58
by DMoney
Not working for me in vb4.1.4

PostPosted: 26 Jul 2011, 13:18
by BLifanovsky
Works fine, but is it possible to have an option for user to delete notifications? Or how to make a task in vb so that notifications were cleared, say, once a week - since they will really take a lot of space in DB I guess..

PostPosted: 15 May 2012, 04:37
by BLifanovsky
I wonder how come that in 1.51 there's still no notifications for vBulletin by default. Those that there are work wrong and worster than this one..

Topic Closed

PostPosted: 11 Nov 2012, 09:46
by Staff Bot
[b]This thread has been locked because the last post is greater than six months old. There is a good chance that the information in this thread is outdated. Please open a new topic if you wish to discuss this further.[/b]