[Resolved] P2 Theme Excluded Formats
I’m using the plugin with the P2 theme. I have the following post formats excluded in the plugin settings:-
However, whenever someone posts using one of these formats the emails still get sent. Can you help?
I cannot reproduce this issue using TwentyFourteen or P2 v1.5.2. If I have the format excluded in Subscribe2->Settings under the Registered Users tab the email doesn’t send. If the formats are all unchecked then the email sends as expected.
Have you checked for plugins conflicts?
Thx for the quick reply. It must be a conflict then I guess. Will start testing and let you know result.
Interestingly I’ve got exactly the same issue with a newly installed P2 today.
I set Subscribe2 to not email link & quote post formats, but it’s sending them out anyway.
@pcaweb – did you manage to find out what was causing it?
I have tested again with a vanilla install of WordPress 3.8 running P2 theme v1.5.2, Subscribe2 9.1, Email Log 1.6.1 and Akismet.
I excluded the Quote format in Subscribe2->Settings in the Registered Users tab and then made a post in that format. No email was registered in the Email Log. I then made a regular post and a notification was generated.
Oh cool! I really appreciate that extra work – really good of you. Sorry we didn’t find you a bug though 🙁
Seriously weird though… mine is pretty much the same thing – fresh install this morning with a couple of other minor plugins with I don’t *think* would affect anything email-related. Actually I tried disabling ALL plugins except for Email Log & Subscribe2 – it still sent the email out to all users.
[ Thanks for the mention of Email Log… I could have done with knowing about that a year ago 🙂 ]
I do have the settings page right don’t I? http://imgur.com/ol2yfTW
Looks like it’s not a bug or P2 interaction with Subscribe2 then… maybe something I’m missed or a setting that interferes with something. Fortunately it’s only a ‘friends & family’ site so I can live with it. If I get some time in the next week or two I’ll build a new P2 site with nobody else on it & try looking closer at the code.
Thanks for your help
You settings look fine to me. You might want to check those other plugins you are running just for a sanity check.
Thanks! Only other plugins the site has are Members, P2 Likes, Who’s Online & WP User Avatar – but I did try disabling all of them & running another test.
I’ve just tried adding P2 & Subscribe2 to a scratch site I’ve got… and that’s doing the same thing too. Most odd.
Did some poking around in class-s2-core.php, around line 443 where it’s checking post formats. get_post_format() is passed the correct post ID but returns false – ie it thinks the post is in standard format. Which is crazy because in both the P2 front-end display and in the back-end admin post editor it shows that the post is a quote.
OK.. did some debug in WP core and looked at get_post_format(). I think I know why your tests were different to ours. If you post in the back end from the admin post editor then it works as expected, but if you post from P2’s front page post box then it doesn’t work.
get_post_format() is called several times during the course of a post being committed & the first couple of times it has no information on the post format.
This may be a bug in P2, or it may be possible for you to hook into the posting process at a later point.
The issue seems to be that in the admin area when creating a post a placeholder is created in the database by a call to the get_default_post_to_edit() function. When adding new posts from the front side this isn’t called and so the post placeholder doesn’t exist.
A post must have a ID before a call to set_post_format() can be made but to get a post ID you need to call wp_insert_post() which creates an ID but also the content and fires the WordPress transition hooks that cause Subscribe2 to send an email.
In my opinion this need to be fixed in P2, they need to call get_default_post_to_edit() and follow the same publication route as the admin side.
I had a few minutes to look at this and the fix in P2 is relatively simple. I have not found a place to open tickets for the P2 theme so have posted my tested (and as far as I can tell working) enhancement / fix in their forum:
Nice work! Appreciate you taking the time to track that down. I see your patch has been passed to the devs… yay!
P2’s a great theme for its specific purpose & it strikes me that Subscribe2 makes a great pairing with it.
- The topic ‘[Resolved] P2 Theme Excluded Formats’ is closed to new replies.