indieweb / wordpress-micropub

A Micropub Endpoint plugin for WordPress
https://wordpress.org/plugins/micropub
51 stars 12 forks source link

MicroPub stopped working after the plugin update #169

Closed lostfocus closed 6 years ago

lostfocus commented 6 years ago

Ever since I've updated the plugin I couldn't use MicroPub anymore - since I was busy with stuff, I only could start looking at the problem today and I noticed that ever since the update the IndieAuth headers seem to be gone, which is not really ideal.

I haven't quite followed along with the development for version 2.0.0 so I can't really tell what's going on, except for that it doesn't work, which is a bit of a bummer.

lostfocus commented 6 years ago

MICROPUB_LOCAL_AUTH isn't set and I don't have the IndieAuth plugin installed, so Micropub_Authorize should be used, right? Since neither MICROPUB_AUTHENTICATION_ENDPOINT nor MICROPUB_TOKEN_ENDPOINT are set I expected to see the same IndieAuth headers as before. They appear to be missing from both the http headers and the html head. The micropub endpoint is in there.

lostfocus commented 6 years ago

From what I gather from some basic debugging includes/class-micropub-authorize.php is being included, Micropub_Authorize::init() is never called, though. 🤔

dshanske commented 6 years ago

I tested that before I deployed. Odd. If I somehow reverted a load, I will release a version 2.0.1 quickly

dshanske commented 6 years ago

https://github.com/indieweb/wordpress-micropub/blob/master/includes/class-micropub-authorize.php#L14

dshanske commented 6 years ago

Yes it is

dshanske commented 6 years ago

So it can't be that, but lets figure out what it is

dshanske commented 6 years ago

Do you want to install the Indieauth plugin in the interim or you prefer Indieauth.com for your authentication needs?

lostfocus commented 6 years ago

Yeah, I've seen that it is called in the code. I debugged in the most basic way ever: I put a die() in the init function and the page still loads fine. I'll do some further research, with https://wordpress.org/plugins/query-monitor/ I couldn't see the actions added in init where they were supposed to be. Until then I'll just add the indieauth headers by hand.

lostfocus commented 6 years ago

A-ha! add_action( 'plugins_loaded', array( 'Micropub_Authorize', 'init' ) ); in class-micropub-authorize.php has priority 10, but that file only gets included when load_micropub_auth() is called - which happens with priority 20. This way Micropub_Authorize::init() is actually only added to the actions array after all the priority 10 actions are called and therefore never gets executed.

lostfocus commented 6 years ago

Pull request coming in 10 minutes. :)

snarfed commented 6 years ago

woo! i was actually hitting this too, and just hadn't found time to debug it. (i similarly don't use the IndieAuth plugin.) thank you for fixing it @lostfocus!!!

dshanske commented 6 years ago

Still mystified about why I didn't hit this problem when I tested it. I tried it with IndieAuth disabled. But, I'm heading to IWC Berlin, I'll see about creating and pushing a release as soon as I can.

lostfocus commented 6 years ago

¯\_(ツ)_/¯ Happens. Enjoy IWC Berlin - I was thinking about going but I have a family thing this weekend.

miklb commented 6 years ago

Wonder if this relates to the post kinda issues with firing order?

dshanske commented 6 years ago

@miklb Which one in particular? Firing order has been an issue in the past. If you remember, the original Micropub auth problem you had was a firing order issue.

miklb commented 6 years ago

Yes, firing order. My last test post kinds was still not working right with micropub, thought that’s been over week since I last test