Falcon::notify_invalid PHP Метод

notify_invalid() публичный статический Метод

Notify the user of an invalid reply
public static notify_invalid ( WP_User $user, $title )
$user WP_User User that supposedly sent the email
    public static function notify_invalid($user, $title)
    {
        // Build email
        $text = 'Hi %1$s,' . "\n";
        $text .= 'Someone just tried to post to the "%2$s" topic as you, but were unable to' . "\n";
        $text .= 'authenticate as you. If you recently tried to reply to this topic, try' . "\n";
        $text .= 'replying to the original topic again. If that doesn\'t work, post on the' . "\n";
        $text .= 'forums via your browser and ask an admin.' . "\n";
        $text .= '---' . "\n" . 'The admins at %3$s' . "\n\n";
        $text = sprintf($text, $user->display_name, $title, get_option('blogname'));
        $text = apply_filters('bbsub_email_message_invalid', $text, $user->ID);
        $subject = apply_filters('bbsub_email_subject_invalid', '[' . get_option('blogname') . '] Invalid Reply Received', $user->ID);
        wp_mail($user->use_email, $subject, $text);
    }

Usage Example

Пример #1
0
 public function handle_insert($value, Falcon_Reply $reply)
 {
     if (!empty($value)) {
         return $value;
     }
     $post = get_post($reply->post);
     if (!$this->is_allowed_type($post->post_type)) {
         return $value;
     }
     $user = $reply->get_user();
     if ($reply->is_valid()) {
         Falcon::notify_invalid($user, bbp_get_topic_title($reply->post));
         return false;
     }
     $new_reply = array('post_parent' => $reply->post, 'post_author' => $user->ID, 'post_content' => $reply->parse_body(), 'post_title' => $reply->subject);
     $meta = array('author_ip' => '127.0.0.1', 'forum_id' => bbp_get_topic_forum_id($reply->post), 'topic_id' => $reply->post);
     $reply_id = bbp_insert_reply($new_reply, $meta);
     do_action('bbp_new_reply', $reply_id, $meta['topic_id'], $meta['forum_id'], false, $new_reply['post_author']);
     // bbPress removes the user's subscription because bbp_update_reply() is hooked to 'bbp_new_reply' and it checks for $_POST['bbp_topic_subscription']
     bbp_add_user_subscription($new_reply['post_author'], $meta['topic_id']);
     return $reply_id;
 }
All Usage Examples Of Falcon::notify_invalid