* * Copyright 2008-2011 Crowd Favorite, Ltd. All rights reserved. * Released under the GPL license * http://www.opensource.org/licenses/gpl-license.php */ /** * Markup for subscription/notification */ function anno_subscription_fields($user) { $subscribe = get_user_meta($user->ID, '_anno_subscribe', true); _e('

Subscriptions

', 'anno'); ?>
/>
post_type == 'article') { $query = new WP_User_Query(array( 'meta_key' => '_anno_subscribe', 'meta_value' => '1', 'meta_compare' => '=', )); if (is_array($query->results) && !empty($query->results)) { $recipients = array(); foreach ($query->results as $user) { $recipients[] = $user->user_email; } $blogname = get_option('blogname'); $subscription_subject = apply_filters('anno_subscription_notification_subject', sprintf(__('A new article has been published on %s', 'anno'), $blogname)); $subscription_body = apply_filters('anno_subscription_notification_body', sprintf(_x(' %s was published on %s %s %s You may view this article in its entirety at the following link: %s You are receiving these notifications because you opted in. If you would like to no longer receive these notifications, please visit your profile at %s and update your settings. ', 'order of replacement: Post title, blog name, post title, post excerpt, post permalink, profile url', 'anno'), $post->post_title, $blogname, $post->post_title, $post->post_excerpt, get_permalink($post->ID), admin_url('profile.php'))); $headers = array('BCC: ' .implode(',', $recipients)); @wp_mail(null, $subscription_subject, $subscription_body, $headers); } } } add_action('transition_post_status', 'anno_send_subscription_notification', 10, 3); ?>