wp_notify_postauthor doesn't appear to be active (3 posts)

  1. traffas
    Posted 3 years ago #

    I've added mailing triggers to wp_notify_postauthor and wp_notify_moderator to know when each one is called.

    Testing procedure
    I create test user with role of author.
    I author test post by that user.
    I post anonymous comment on that post.

    Expected behavior
    I should receive an email to the admin/moderation account triggered by wp_notify_moderator and one to the test user triggered by wp_notify_postauthor.

    Experienced behavior
    I receive emails to both admin and author triggered by wp_notify_moderator. I can't get the wp_notify_postauthor to fire.

    Do I misunderstand the expected behavior of these functions? I really want to turn off author notifications, so I thought I could just redefine wp_notify_postauthor to return true but it doesn't seem to work.

  2. traffas
    Posted 3 years ago #

    So after further digging, it seems I was wrong about my expectations. It seems ( around line 1400 in wp_includes/comment.php) that wp_notify_postauthor is only triggered when the comment is a approved.

    So why, then, is the post author being notified by wp_notify_moderator? Shouldn't this function only notify the moderator and not the author?

  3. traffas
    Posted 3 years ago #

    I think I figured it out. The wp_notify_moderator checks to see if the post author (why?!?) can "edit_comment" - a capability that is listed as added in WordPress 3.1 but not explained in the Codex - http://codex.wordpress.org/Roles_and_Capabilities#edit_comment

    I ended up having to redefine wp_notify_moderator to disable author comment notifications.

    Hopefully this explanation helps someone else.

Topic Closed

This topic has been closed to new replies.

About this Topic