Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Short urls not being (correctly/timely) generated for scheduled posts #15

Open
stayallive opened this issue Jan 11, 2016 · 30 comments
Open

Comments

@stayallive
Copy link

Hey Chris, it looks like this is still not fixed even after the latest update (and the discussion in #13). We are noticing ?id=123456 urls again used by our Twitter plugin for scheduled posts :(

@jphorn
Copy link

jphorn commented Jan 11, 2016

Example: https://twitter.com/iCulture/status/686199857682477060 (I'm the site owner)

We use WP to Twitter (Pro) for sending our articles to Twitter. This plugin is configured to use WP's internal shortlink mechanism.

2016-01-11_14_13_33

2016-01-11 14 15 16

This works perfectly for all posts and post types, except for articles which have been published on schedule.

@ChrisWiegman
Copy link
Contributor

Which twitter plugin are you using? I'm not seeing the same with mine.

@jphorn
Copy link

jphorn commented Jan 12, 2016

CW: Which twitter plugin are you using? I'm not seeing the same with mine.

JPH: We use WP to Twitter (Pro) for sending our articles to Twitter.

;-)

@ChrisWiegman
Copy link
Contributor

Thanks. I'll try to see if I can play with a free version of it to see where it is getting it's link.

@jphorn
Copy link

jphorn commented Jan 12, 2016

This should be the plugin in svn.
I believe the relevant part is in wp-to-twitter-shorteners.php.
The author is @joedolson.

@ChrisWiegman
Copy link
Contributor

Even better. Thank you!

@joedolson
Copy link

If there are any issues that you'd like my comments on, please let me know!

@ChrisWiegman
Copy link
Contributor

@jphorn I've tried this with just Better YOURLs and WP to Twitter and it is working just fine for me. I know this probably seems silly but can you please confirm YOURLs is configured correctly?

@joedolson I think this should work here, at least it is in my testing. In exchange for a sanity check I would gladly offer a PR or 3 in return.

@ChrisWiegman
Copy link
Contributor

@stayallive Which Twitter plugin are you using?

@joedolson
Copy link

Just tested, and it worked just fine for me, as well. Steps: Installed and enabled Better YOURLS, added my YOURLS install info. Set WP to Twitter to use WordPress as it's URL shortener. Published a post. URL returned was the YOURLS short URL as expected.

@ChrisWiegman
Copy link
Contributor

Thanks @joedolson ! I'll definitely return the favor here shortly.

@jphorn Can you please confirm?

@stayallive
Copy link
Author

@ChrisWiegman I work for iCulture so @jphorn an my problems are the same :)

Did you test by scheduling a post, since directly publishing works just fine?

@jphorn
Copy link

jphorn commented Jan 16, 2016 via email

@joedolson
Copy link

Yes, just realizing that - just a sec. Allowing scheduled post to trigger.

@joedolson
Copy link

Yes, confirmed - that didn't work. I'll look into it.

@ChrisWiegman
Copy link
Contributor

Oh. I'm sorry. I gotcha now. About to head out but I'll test shortly.

@joedolson
Copy link

I just took a look at the code, and at least on superficial glance it seems like everything should be fine. WP to Twitter does everything on save_post at priority 15; Better YOURLS is processing on transition_post_status at priority 10. The transition post status hook runs before save_post, so this really should always happen before WP to Twitter.

There are some cases where WP to Twitter would run on future_to_publish, but when it does that it runs at a slightly later priority (16), which should still happen after Better YOURLS.

Not sure what's off, here...

@ChrisWiegman
Copy link
Contributor

I've tested this as well with a few scheduled posts over the last few hours and all worked as expected. I can't help but wonder if perhaps something is conflicting here.

@jphorn
Copy link

jphorn commented Jan 17, 2016

Let me start by saying we appreciate the testing efforts very much. We'll take another look in our setup. The only other conflicting plugin I can remember from the top of my head right now is Mashshare, our sharing plugin.

@ChrisWiegman
Copy link
Contributor

@jphorn I'll take a look at it with that as well if it's a free plugin. Would love to find some way I can improve this if possible

@stayallive
Copy link
Author

Hey Guys, I have just set-up a totally clean WordPress and installed Better YOURLS and WP to Twitter from the plugin repository and created a dummy Twitter account to test this myself too, however... it breaks :( See: https://twitter.com/stayallive_test

If you guys want to take a look at that setup send me a email (listed on my GH profile)

@ChrisWiegman
Copy link
Contributor

Thanks @stayallive I'll give it another shot this week. I'm wondering if my install was perhaps running CRON weird.

@jphorn
Copy link

jphorn commented Jan 18, 2016

Please note: don't configure WP to Twitter with the YOURLS setting, but use 'WordPress' as seen in the image is this comment. We need to have it set to 'WordPress' to take advantage of Mashshare's ShortURL add-on.

@jphorn
Copy link

jphorn commented Feb 8, 2016

@ChrisWiegman Did you have a change to look into this again?

@ChrisWiegman
Copy link
Contributor

I'm afraid I haven't had a chance to circle back. It's still on my radar and after a few major projects finish up this weekend I'm hoping I can make this next

@jphorn
Copy link

jphorn commented Feb 18, 2016

Thanks, appreciated. Just wanted to check in :-)

@ChrisWiegman
Copy link
Contributor

I've finally (sorry about the delay) gotten to look back at this. Removing any missed post scheduled does indeed recreate the error however, WP to Twitter isn't even using the proper permalink (it's sharing the ?p=post_id version). As short links are based on permalinks this actually makes sense from Better YOURLs point of view.

@joedolson Could this be as I'm trying this with the free version? Would love to help dig deeper into the issue but don't want to waste my time if the code base here makes a difference.

@joedolson
Copy link

No, that shouldn't make any difference at all. When WP to Twitter operates with WordPress set as the shortener, it uses wp_get_shortlink() to fetch the URL, if that helps.

@ChrisWiegman
Copy link
Contributor

So after further investigation it appears wp-to-twitter isn't using the permalink at all in scheduled posts. This isn't the case in normally published posts. You can see this by looking at the tweets of each. As Better YOURLs will defer to the intended permalink it doesn't find anything to shorten in this case. I'm afraid this will probably necessitate opening an issue with wp-to-twitter.

@joedolson
Copy link

Based on this comment - what happens if the "no shortener" option is selected in WP to Twitter? When WordPress is selected as shortener, then WP to Twitter will use wp_get_shortlink(); but if you want to use the permalink, then that's what's passed if WP to Twitter doesn't use a shortener. The path by which it's passed is convoluted, but that's what you ultimately get.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants