Closed atomGit closed 4 years ago
Good idea.
Just FYI: if posting is successful, the post will get a _share_on_mastodon_url
(hidden) custom field (or post meta field) attached to it. (In it would be the Mastodon URL.)
I myself actually show all "hidden" custom fields on WP Admin's Edit Post screen, which allows me to actually see the resulting URL right underneath the post editor. If it's there, I know posting was successful. (If not, the status was probably too long, i.e., over 500 chars. Or Mastodon could be down, etc.)
But I agree that, ideally, users would be notified more clearly. (Also, if you now wanted to repost something, you'd have to delete the post meta and hit the "Update" button on the Edit Post screen. I guess it'd be nice if eventually you could just "unlink" a toot with the click of a single button.)
Somewhat related:
I also display links to toots on the frond end (like, in the post meta section, next to the post date or something).
That last bit requires something like displaying the outcome of get_post_meta( get_the_ID(), '_share_on_mastodon_url', true )
in one of your theme templates. (It's a bit more complicated than that, though. Might one day add a template function that you could just pop into your theme.)
WP seems to have an API for displaying messages right at the very top of wp-admin/, under the admin tool-bar - i've seen several plugs use this
going way off topic here, but i don't actually use WprdPress - i use ClassicPress which is a fork of WP 4.9 without the 'block/Gutenberg' editor - many millions of people (more than 5) did not like having this... crap, IMO... shoved down their throats and so CP was born with the edict of centering development around community input (like WP used to do way back when)
CP is a growing project - they just formed an LLC yesterday i believe - and i'm wondering if you'd be willing to support it - 'support' could be as little as fixing stuff with the WP version of your plug that breaks on CP, or as great as developing plugs for CP, etc.
if you search the WP repo for 'classicpress' you'll find quite a few devs that support it
Yeah, merely showing notifications should be fairly easy. Not sure if it's Gutenberg-compatible, tho. I'll have a look regardless.
I know about CP but haven't really tried it, ever. Anyway, I do use this plugin both with the Classic Editor and without, so I'd be surprised if it currently needs fixing. That said, if such a fix should ever be required and the effort is fairly minimal, I guess I'd be open to it.
so I'd be surprised if it currently needs fixing
it don't far as i know - i'm using it with CP which is TinyMCE only and it seems to work fine
Thinking of leveraging the meta box itself to indicate if sharing went okay: Still doubting about the "Unlink" link. I could just use the checkbox to find out if previously shared toots should be forgotten. (What I won't do just yet is use Mastodon's API to actually delete the toot, although that too wouldn't be very hard.)
In fact, "unlinking" a toot yet leaving the checkbox enabled would mean a new copy is posted to Mastodon ... Maybe it does make sense, then, to also delete the original toot. Hmm. Like for typos and stuff. (Advanced users that would want to somehow unlink toots but leave their Mastodon statuses untouched could always just delete the relevant _share_on_mastodon_url
fields.) I'd have to rename "Unlink" to "Undo," then. As in "Undo sharing," AKA "delete toot and forget it was ever there."
Might also add a simple function users could paste into their theme templates, to output a "syndication link" (i.e., a link to the relevant Mastodon status, in this case).
hey Jan - for the moment i switched to Mastodon Autopost since it offers more config options in the UI, but i would encourage you to go ahead and add the successful post notification - i like the way you did that in your last post - i'll let you close this as you see fit
No worries. What can I say, I'm a big fan of filter hooks for this kind of things. :-) Let you check in your code and keep track of changes, and once you start modding your site's theme--by means of a child theme, hopefully--it becomes almost a no-brainer to add snippets like these. Plus, less ("spaghetti") code on my end. Will close when the feature's delivered.
please consider implementing some sort of message after a post is published that indicates the status of the mastodon post