capbiker Posted January 20, 2010 Posted January 20, 2010 File Name: (caps) Email Post NotificationFile Submitter: capbikerFile Submitted: 20 Jan 2010File Updated: 29 Jan 2010File Category: Hooks and Plugins This hook will enable you to decide on which members on your board will be able to receive emails about new topics being created and new replies to topics. You can select which forums you get these messages from. With in the emails as default you will receive a notification telling you the posters name and IP address, the topic title, the forum where the topic/post is located and the actual content of the post and a direct link for you to go and deal with it as necessary. I would recommend not to use this hook on a high posting board because you will be in undated with emails and also it could course problems on your server in the long run. 1.0.1 as a fix to a bug where with the right configuration within the settings pages all members on the board could receive email notifications. This as now been fixed. To upgrade the hook login to ACP->Manage Hooks->caps Email Post Notifications and select the down arrow next to the title and click on uninstall. Now you will just re-install it as the instructions states. You will need to check the Disabled Hook section because it might appear in there, if it does just click on the arrow next to it and select enable.Click here to download this file
airgunforum Posted January 21, 2010 Posted January 21, 2010 After installing this, I could no longer make posts, I receive a driver database error ? Everything else appeared to work, except posting.
capbiker Posted January 21, 2010 Author Posted January 21, 2010 What is the database error you are getting? Also what version of 3.0.X are you using? cap
airgunforum Posted January 22, 2010 Posted January 22, 2010 Version 3.0.1 I can't remember the exact error, however, after further checks, even though I received a database error, the post was still made ! I decided to remove the hook and reinstall it, that did the trick and it now works a treat. Many thanks for your time and effort.
XN-Matt Posted January 28, 2010 Posted January 28, 2010 Hi, Further to http://community.invisionpower.com/topic/302060-can-admin-receive-an-email-notification-after-every-post/page__pid__1905519__st__20&#entry1905519 I have removed and reinstalled but the same thing i'm afraid. IP.Board Version v3.0.5 (ID:30012) Only other hook installed was added after this one was first tested. Edit: Infact, the reason i'm getting two is I have two forum profiles. However, EVERYONE on the forum is getting one instead of just the UID i entered. Matt
capbiker Posted January 28, 2010 Author Posted January 28, 2010 Matt I have sent you a PM about this with an edited version of the hook to help me to hopefully diagnosed the problems that you are. I have just read the edited part, and somebody else today as reported the same thing and sent them the same edited version of the hook. Hopefully with two different boards it will help me work out where the problems are and correct it. cap
paulselhi_merged Posted February 15, 2010 Posted February 15, 2010 I get a similar problem the mod did not seem to be sending me any e-mail notifications so in it's ACP panel settings it disabled it. No onew could post until it was renabled however i doubt if i am getting any post notifications
iamreallyreilly Posted January 11, 2011 Posted January 11, 2011 Great Hook - just a quick note to say thanks.
zeepeg Posted March 7, 2011 Posted March 7, 2011 Gentlemen and Ladies The comments here only relate to the implementation of this hook and does not talk about the hooks functionality. [*]This is an "action overload hook"overloading means that the original IPB action (load) is replaced but the original action (load) can still be executed if desired ie Overloaded It is inadvisable to completely replace IPB action because IPB revision uplevels may add functionality This "(caps) Email Post Notification" hook does a complete replacementThe hook replaces the original class public_forums_post_post (we did a line difference comparison) This won't work at IPB 3.1.4 because the IPB 3.1.4 class public_forums_post_post now contains the following additional code" $permissions['softDelete'] = $this->registry->getClass('class_forums')->canSoftDeletePosts( $topic['forum_id'], $topic ); $permissions['softDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedPosts( $topic['forum_id'] ); and if ( $permissions['softDelete'] AND $permissions['softDeleteSee'] ) { $posts += $topic['topic_deleted_posts']; } Therefore installing this hook the functionality at IPB 3.1.4 will be lost!!!! parent::saveForm($type); [*] and the possibly correct implementation (to overload but not replace) and to make compatiable with IPB 3.1.4 and possible future revisions to the "class public_forums_post_post" "public function saveForm( $type )" would be as below public function saveForm($type) { $forums = array(); $email_forum = false; $email_member = false; $forum = 0; $post = false; $members = array(); $member = 0; $email_member = array(); $counter = 0; $select_members = ""; if ($this->settings['email_notification_on'] == false) { parent :: saveForm($type); } if ($type != 'new' AND $type != 'reply') { parent :: saveForm($type); } if ($this->settings['email_notification_forums'] != '*') { $forums = explode(",", $this->settings['email_notification_forums']); if (count($forums) > 0) { foreach ($forums as $forum) { if ($topic['forum_id'] == $forum) { $email = true; } } } } else { $email_forum = true; } if (preg_match("/,/i", $this->settings['email_notification_members'])) { $members = explode(",", $this->settings['email_notification_members']); } else { if ($this->settings['email_notification_members'] != $this->memberData['member_id']) { $select_members = "member_id = " . $this->settings['email_notification_members']; $email_member = true; } } if (count($members) > 0) { foreach ($members as $member) { if ($member != "" AND $member > 0) { if ($member != $this->memberData['member_id']) { $select_members .= ($select_members != "") ? " OR member_id = $member" : "member_id = " . $member; $email_member = true; } } } } if ($email_forum == false OR $email_member == false) { parent :: saveForm($type); } $topic = $this->_postClass->getTopicData(); $post = $this->_postClass->getPostData(); switch ($type) { case 'reply' : try { if (!$this->_postClass->addReply() === FALSE) { if (!$topic['_returnToMove'] AND !$this->settings['post_order_sort'] == 'desc') { $this->email_notification($topic, $post, $type, $select_members); parent :: saveForm($type); } } } catch (Exception $error) { parent :: saveForm($type); } break; case 'new' : try { if (!$this->_postClass->addTopic() === FALSE) { $this->email_notification($topic, $post, $type, $select_members); parent :: saveForm($type); } } catch (Exception $error) { parent :: saveForm($type); } break; } } [*]I took the liberty to rearrange the code for clarity and code reduction. [*]In regards to exceptions arising from "addTopic()" and "addReply()" and since "email_notification" does not have any new exceptions coded at this time, we merely call the parent and the exceptions will get handled and the appropriate redirect will be done. [*]This implementation has not been tested. [*]If I need the functionality of this hook I will debug and post any corrections here. [*]NOTE: The functionality of this hook would be better implemented as "Data Hook" in the Location "postFirstPost" which would require a rewrite of above implementation but would make all the exception handling go away [*]Thank you for the education. NOTE: I recommend that IPB implement a "postFirstPost" data hook point which passes both Topic and Post data. As it is the developer has to horse around with the DB or implement two hooks to get all the data needed to do what is being attempted with the "(caps) Email Post Notification" [*]Therefore This "(caps) Email Post Notification" appears to be not compatible with IPB 3.1.4 [*]Specifically looking at this "hooks.xml" code [*]and comparing it with the "post.php" at "class public_forums_post_post" "public function saveForm( $type ) " which this hook replaces [*]We note: [*]Now the "hook.xml" did illustrate how the overloading can work while preserving the original load [*] Reviewing the code ( and this ) we note that original "class public_forums_post_post" "public function saveForm( $type ) "can be executed with
TekMiL Posted April 18, 2011 Posted April 18, 2011 I cannot get this to work on my forum! I use 3.1.4 I have no idea what the previous poster is going on about..totally over my head. Simple question then..Does this work on 3.1.4? If so WHO has it operating properly. As I received NO emails after implementing and setting it up.
Don_Sync Posted July 9, 2012 Posted July 9, 2012 Does anyone know of a hook [that has this functionality] that works with 3.3.3?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.