Comments (7)
I know that, with Gutenberg, the action is run at least twice.
I'm guessing the first time, wp_is_post_revision( $post->ID ) || wp_is_post_autosave( $post->ID )
is somehow true
, and the second time, it sees an update and decides not to crosspost.
from share-on-mastodon.
You could, potentially, prevent older posts from being shared (at all). Untested, but this may work (I mean, it's just an idea):
add_filter( 'share_on_mastodon_enabled', function( $is_enabled, $post_id ) {
if ( get_post_timestamp( $post_id ) < strtotime( '2022-11-27' ) ) {
return false;
}
return $is_enabled;
}, 10, 2 );
Should not affect any newer posts. (Note: get_post_timestamp()
was introduced in WP 5.3.)
I could also limit sharing to when a post is first published by comparing its new post status with the previous one, but this is tricky. The old status could be non-existent, or draft, or even trashed. Plus, I kinda like that I can go back and syndicate old posts (kind of like "retweeting" your old stuff) when I feel like it. (I mean, I could've always done that, manually, but if I let the plugin do it [again], it stores the syndication link for me, which I can then display on my site, and so on.)
from share-on-mastodon.
Oh, and it is of course possible to just untick the checkbox ... :-)
If I'm going back and editing an old post, I wouldn't normally expect updating a change to trigger publication on Mastodon.
Or have it disabled by default (so that it would only syndicate after you explicitly checking it):
add_filter( 'share_on_mastodon_optin', '__return_true' );
from share-on-mastodon.
Thanks. I can see that the best solution would be for me to pay better attention to what I'm doing. I understand now why it works the way it does and how changing that doesn't look easy.
Great plugin!
from share-on-mastodon.
I'm going to reinvestigate this, comparing post dates to the most recent plugin activation date (or similar). But that approach still won't prevent "3rd-party" posts from being mass-crossposted if (1) share always is enabled programmatically AND (2) these posts were first published after the plugin was (re)activated AND (3) they are later on mass-updated.
But it would (I think?) override "Share Always" and the checkbox---this is a risk, as we'd basically be overriding site authors' choices here---for posts deemed too old.
from share-on-mastodon.
Current implementation fails with Gutenberg.
from share-on-mastodon.
Some quick logging
[06-Apr-2023 14:38:22 UTC] transition_post_status
[06-Apr-2023 14:38:22 UTC] New status: auto-draft
[06-Apr-2023 14:38:22 UTC] Old status: new
<< This must be where I click publish >>
[06-Apr-2023 14:38:35 UTC] transition_post_status
[06-Apr-2023 14:38:35 UTC] New status: publish
[06-Apr-2023 14:38:35 UTC] Old status: auto-draft
[06-Apr-2023 14:38:35 UTC] transition_post_status
[06-Apr-2023 14:38:35 UTC] New status: publish
[06-Apr-2023 14:38:35 UTC] Old status: publish
[06-Apr-2023 14:38:35 UTC] Not a new message
from share-on-mastodon.
Related Issues (20)
- Smarter default excerpt length HOT 1
- is_int instead of ctype_digit HOT 1
- Uncaught (in promise) Error: The "Get URL" request failed. HOT 3
- Max. No. of Images resets to 4 HOT 3
- Increase wp_remote_post() and wp_remote_get() time-out
- Authorize "code" not recognized? HOT 1
- "Validation failed" when posting through JetPack with hook HOT 7
- Support replies HOT 2
- Support favorites HOT 1
- Support reblogs
- Fix share_on_mastodon_enabled filter
- Does share on mastodon work with scheduled posting? HOT 1
- Multiple account support HOT 4
- Store client details "centrally" HOT 1
- Toot args filter gets custom field too late HOT 4
- Error message: Uncaught Error: Call to undefined function Share_On_Mastodon\mime_content_type() HOT 2
- Block editor toggle gets auto-enabled even for old posts HOT 1
- Gutenberg lets posts through even when the toggle is disabled HOT 1
- Look into "update_{$meta_type}_metadata" HOT 1
- Scheduled posts are not automatically shared HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from share-on-mastodon.