Description
Sometimes, you need to know when certain posts are being viewed/visited/discovered by users, be it guests or logged in users.
For example, in a Talent Discovery Directory you might want to inform the Talent or Talent Manager that someone is vieweing their Talent Profile right now. You might want to do that discretly, but reliably, without bloating the website with heavy (and Privacy problematic) user tracking.
This plugin has a solution to that problem.
It allows you to easily send an email to a given receiver, whenever a certain post is visited.
You can set a specific receiver for each post.
You can control on what posts the receiver should be set, and thus the email sent when the post is visited.
You can control what user Roles will trigger the notification when they visit the post.
You can also customize the email contents as well as other aspects of the email.
The entire plugin is very lightweight and thus renounces to any Backend Settings Screens.
It only adds a tiny Metabox to your posts (of choice) to save the receiver email.
The rest of the Plugin functionality is controlled with a set of Filters.
Screenshots
Installation
- Install and Activate like any other Plugin in WordPress.
- Head to the Plugin Settings Screen in the WordPress Dashboard > TukuToi > Send Email If. There you can control the Plugin settings such as determine which posts should trigger an email, and what action should send the email, and customize the email sent.
- Control the plugin settings with the provided Filters (see FAQ)
- Save the email for each specific post where you want an email being sent.
FAQ
-
This Plugin has no settings!
-
That’s right, in order to keep this lightweight, no settings or options pages where added in the backend.
Instead, a set of Filters will allow you to control the Plugin behaviour fully.
Read more about this in the below FAQ entries. -
This Plugin does not work after activating!
-
The plugin will not activate its features unless you tell it to do so, using the Filters documented below.
Mandatory filters you must use aretkt_sei_metabox_location
andtkt_sei_notify_on_role_visit
.
Read more in the below FAQs. -
How to modify the email “About”?
-
You can use the filter
tkt_sei_email_subject
in order to customize the “About” of the Email sent.
You just need to return a valid Email “About” (string) in the callback function:add_filter('tkt_sei_email_subject', 'my_custom_email_subject'); function my_custom_email_subject(){ $subject ='My Custom About'; return $subject; }
-
How to modify the email “Body”?
-
You can use the filter
tkt_sei_notification_content
in order to customize the “Body” of the Email sent.
You just need to return a valid Email “Body” (string or html with inline CSS) in the callback function:
The Filter passes 3 additional arguments for your convenience.add_filter('tkt_sei_notification_content', 'my_custom_notification_content', 10, 4); function my_custom_notification_content($default_message, $post, $current_user, $receiver_email){ //$post is the Post Object of the post which was visited. //$current_user is the User Object of the user who visited the post. Might be empty, if guest user. //$receiver_email is the email stored to the post visited (the email that will get the notification). $default_message = 'My new Custom Notification Content with <strong>valid HTML</strong>'; return $default_message; }
-
How to modify the email “To” (Receiver)?
-
You can use the filter
tkt_sei_receiver_email
in order to customize the “To” (Receiver) of the Email sent.
You just need to return a valid Email address in the callback function:add_filter('tkt_sei_receiver_email', 'my_custom_receiver_email'); function my_custom_receiver_email(){ $email = 'custom@receiver.com'; return $email; }
-
How can I control where the Metabox appears, and which posts should be observed/triggering the email?
-
You can use the filter
tkt_sei_metabox_location
in order to customize the “Location” where the metabox will appear.
In other words, with this filter you can decide on what Post Types you will want the plugin functionality active.
You just need to return an array of valid Post Types in the callback function:add_filter('tkt_sei_metabox_location', 'my_custom_metabox_location'); function my_custom_metabox_location(){ $posts = array('post', 'page');//Array of post Types where the functionality shoud be active. return $posts; }
-
How can I control what users (visitors) trigger the email?
-
You can use the filter
tkt_sei_notify_on_role_visit
in order to customize the “Visitor” Role that should trigger the email.
In other words, this allows you to determine what User Roles will actually trigger the emails, when an user of such role visits a post which is observed.
The filter expects an array of valid User Roles.
Pass 0 (int) if you want guests to trigger emails.
Empty array (default) triggers no email at all.add_filter('tkt_sei_notify_on_role_visit', 'my_custom_notify_on_role_visit'); function my_custom_notify_on_role_visit(){ $role = array( 'administrator', 0, 'subscriber' );// it sends the email if a user with role administrator, or subscriber, or even a guest is visiting. return $role; }
Reviews
There are no reviews for this plugin.
Contributors & Developers
“TukuToi Send Email If” is open source software. The following people have contributed to this plugin.
Contributors“TukuToi Send Email If” has been translated into 1 locale. Thank you to the translators for their contributions.
Translate “TukuToi Send Email If” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.0
- Initial Commit.