• Since upgrading to WP 2.7 and S2 10.21, emails which should go to 10 registered users because of subscribed category are going to every registered user (>700 in my case).
    I have found that the wp_get_object_terms() in line 402 of class-s2-core.php returns an array with zero items, even though the post has 1 category. Further, when I later cause the post to be re-published, an array of one item is correctly returned, and S2 performs as expected.
    Could this be a WP timing issue? Because post creation is still being processed when S2 initially gets called?
    If so, I’m not sure what S2 can do about it. But I do think S2 should protect against it. If S2 discovers that a post has zero categories, then it should send zero emails, not send emails to every registered user.

Viewing 5 replies - 1 through 5 (of 5 total)
  • @flymike

    I’m not seeing this issue myself. Do you usually save the post as draft before publishing?

    Also, are you using any other plugins that affect categories or publication? Have you checked for conflicts?

    Thread Starter flymike

    (@flymike)

    I have found that the cause of wp_get_object_terms() in line 402 of class-s2-core.php returning an array with zero items was caused by an interaction between WP 4.7 and an unrelated plugin.
    But the issue with S2 remains. wp_get_object_terms() can legitimately return an empty array and, in that case, S2’s get_registered() when called with format=html will return an array of the majority of registered users – when it should return an empty array. In my case, a confidential post intended for a handful of users was sent to almost 700 users. My client was NOT happy!

    @flymike

    Any code changes there would also need to account for Pages (as opposed to Posts) and perhaps also Custom Post Types that may legitimately return an empty array for wp_get_object_terms() but that should still result in a post notification.

    Thread Starter flymike

    (@flymike)

    But a post notification to who? If notification is being determined by category and no category is available?

    @flymike

    Pages (and perhaps Custom Post Types) are not assigned to a category.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘emails going to every registered user, regardless of post category’ is closed to new replies.