這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

TukuToi Send Email If

描述

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.

螢幕截圖

  • The Email MetaBox in the Post Edit Screen.
  • The Email as received (raw text, HTML will be expanded in real live case).

安裝

  1. Install and Activate like any other Plugin in WordPress.
  2. 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.
  3. Control the plugin settings with the provided Filters (see FAQ)
  4. Save the email for each specific post where you want an email being sent.

常見問題

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 are tkt_sei_metabox_location and tkt_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;

}

評價

There are no reviews for this plugin.

貢獻者及開發者

“TukuToi Send Email If” 是一個開源的軟體。以下的人對這個外掛作出了貢獻。

貢獻者

TukuToi Send Email If 外掛目前已有 1 個本地化語言版本。 感謝所有譯者為這個外掛做出的貢獻。

將 TukuToi Send Email If 外掛本地化為台灣繁體中文版。

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

修改日誌

1.0

  • Initial Commit.