Giter Club home page Giter Club logo

share-on-mastodon's People

Contributors

janboddez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

share-on-mastodon's Issues

Cut off long statuses

Using the various filters, it''s possible to POSSE entire articles. Which is nice, but posting anything over 500 characters will silently fail. I've long considered that a feature and not a bug, but it may make more sense to actually just cut off long notes.

Excluding categories

Thanks for your work on this plugin. Is it possible to exclude specified categories from posting to Mastodon?

Use public post types

Rather than fetch all post types and exclude a few ones explicitly, we should just get only the public ones. Anyone wants to use any kind of special, non-public CPT after all, they can use the filter.

Tag in post

This plugon take the tags of the publication and add it to the publication of mastodon

Fix upload media loop

If there's media to be uploaded, the loop will get executed 4 times, resulting in a notice/error (?) if there are less than 4 images.

"Quick Edit" turns off autopost

Love the plugin. Small glitch with scheduled posts.

  1. Create a new post
  2. Schedule the post for a future date
  3. On the Scheduled Posts page, click "Quick Edit"
  4. Change the date to later
  5. Click save

The post will not auto-share to Mastodon.

Happy to provide more details if necessary.

Add specific tags to Mastodon status

Hi Jan,

I'm using this code in our functions file, based on your examples:

// Post Excerpt with link add_filter( 'share_on_mastodon_status', function( $status, $post ) { $status = wp_strip_all_tags( $post->post_excerpt ); $status .= "\n\n" . get_permalink( $post ); return $status; }, 10, 2 );

It's working exactly as expected. I would like to add two specific tags that will be added with every status post, with a line break after the URL. Like this:

Text

Link

Tags

I can't quite figure this out. Could you point me in the right direction?

Improve token refresh

Requesting a new token, or changing hosts, isn't very straightforward and may take more than one try. Consider a button to do this more explicitly, or even completely erase the plugin's settings.

Verify auth status

Have the settings page verify WordPress's auth status rather than assume the presence of a token means it still has access.

Tags in Posts

I see this was opened about 2 years ago and closed as a possible option. Mastodon, like Twitter, is actually driven largely by the hashtags in the posts, so would be a very useful option to be added to the plugin. Is there any update on this, as not everyone wants to venture into editing their theme?

Apart from this, the plugin really works well, and it's a pity it is missing.

Unable to Authorise Access

Opens log-in for instance in browser as expected but once logged in, it does not permit authorisation and instead returns the following error: "Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method." Help greatly appreciated.

feature: post confirmation

please consider implementing some sort of message after a post is published that indicates the status of the mastodon post

Additional settings

Need additional settings for items that now exist only through filters:

  • Crosspost always (i.e., for those posting exclusively from mobile apps)
  • Enable/disable featured/attached images
  • Enable/disable delayed posting (in case, e.g., posts created through a mobile app don't go through)
  • Post privacy (lower prio, as we assume people share their posts to reach as wide as possible an audience)

No media upload when posted from the WordPress Android app.

I have explicitly used the hook share_on_mastodon_enabled to get posts published from the mobile app to be shared, and while it works and includes my custom content leveraging the share_on_mastodon_status hook the featured image isn't being included.

Update plugin in WP repo, support threading

Seems the official plugin is lagging a bit and doesn't support the share_on_mastodon_toot_args filter that is needed for correct threading and such (should anyone else be interested in that).

Micropub syndication targets

Why not add compatibility with the Micropub plugin? Most users wouldn't even notice, and the few that would could disable it (this is probably technical enough that it can go behind a filter).

Use publish->{$post->post_type}?

We currently use transition_post_status because it runs for every post type, then return early if the post type is not supported. Going for a more specific hook (we could foreach() over the supported post types array) may reduce this overhead.

Will require some of the (very few) tests to be rewritten.

Article title box not forming from link by default

So normally Mastodon takes an URL in the post and creates (presumably from OG tags) a little title box like at the bottom of this:

sample post

(https://zirk.us/@WISTquote/109439721919308303)

But if I post via Share On Mastodon, that doesn't automatically happen. The URL is there, but no title box. I have to Edit the post, save it, and then the little title box shows up.

You mention "Mastodon is smart enough to then try and find things like an Open Graph image and description for that URL." So I'm thinking this should work, I just don't know why it doesn't.

In my add_filter 'share_on_mastodon_status', I generate the link through this code:

$status .= "Full quote, sourcing, notes: \n" . get_permalink( $post ) . "\n\n";

Am I doing something wrong (or expecting something weird), or is this actually an issue?

Thanks for this great plugin!

alt text not transferring

Hi there,

Love the plugin, it's genuinely useful but I've noticed that alt-text on images does not get passed through to Mastodon. This results in posts getting flagged by accessibility bots.

For example this post: https://andywarburton.co.uk/2023/another-test/

Lost its alt text when transferring to Mastodon:
https://mastodon.social/@andy_warb/109627526479441029

Mastodon folks are really passionate about accessibility so I think this is an important fix. Let me know if I can help in any way.

no share if scheduled post is published

Hi,

in most case I schedule my posts, but the plugin doesn't share it if the publish time is reached and the post online.
If I edit and update the post, it works fine.

Alt Text on Images

New to Mastodon and enjoying using this to share from WordPress

I see Alt text on images is a big thing on Mastodon, is there a way to add this?

No reactivation after upgrade

On one of our partner's sites, the plugin auto-updated on 2022-12-20 and failed to reactivate after installation.

No PHP errors pertaining to the plugin were logged at that time.

Before the fact, the plugin was working as expected.

Let me know if I could help with more details.

Filter function to format your toots better

https://ajdg.solutions/blog/format-your-toots-on-mastodon-when-using-share-on-mastodon/

Over the past few days I’ve been making test posts and settled on a format for toots like so: https://home.social/@arnandegans/109684410554812887.
Clean, simple, easy to read.

If you want this layout as well, add the following code to your themes functions.php file.

// Reformat the toot format/template for Share to Mastodon
function ajdg_share_on_mastodon($status, $post) {
	$formatted_status  = wp_strip_all_tags(html_entity_decode(get_the_title($post->ID), ENT_QUOTES | ENT_HTML5, get_bloginfo('charset'))) . "\n\n";
	$formatted_status .= mb_substr(wp_strip_all_tags(html_entity_decode(get_the_excerpt($post->ID))), 0, 199, get_bloginfo('charset')) . "[…]\n";
	$formatted_status .= esc_url_raw(get_permalink($post->ID)) . "\n\n";
 
	$toot_tags = get_the_tags($post->ID);
	if($toot_tags) {
		foreach($toot_tags as $tag) {
			$tags[] = "#" . preg_replace("/[^a-z0-9]/i", '', $tag->name);
		}
		$formatted_status .= implode(" ", $tags);
		unset($tags, $toot_tags);
	}
 
	return $formatted_status;
}
add_filter( 'share_on_mastodon_status', 'ajdg_share_on_mastodon', 10, 2);

This basically does the same as the plugin does by default. But adds the except of the post (or a snippet if the excerpt doesn’t exist) and adds the tags. Tags with spaces do not work on Mastodon, so spaces are stripped out. And a few new lines are added for readability.

feature: include post excerpt

it looks like there currently isn't a way to include a post excerpt in the 'toots' - when i publish a post, i'm only seeing the headline on mastodon

can the filters be used for this?

Only share when post is newly published (not updated)

As I understand it, this plugin remembers if a post has ever been shared on Mastodon, and if it has, then simply updating the post will not re-publish it on Mastodon.

However, what about old posts that were published in the past before the plugin was installed? In that case, if posts were automatically publishing on Mastodon, then simply updating one of these old (previously published on WordPress but not on Mastodon) would trigger it to be published on Mastodon.

If I'm going back and editing an old post, I wouldn't normally expect updating a change to trigger publication on Mastodon.

Would it be possible to only publish on Mastodon if it is being published on WP for the first time? I realize that might mess up when you actually intend to republish on Mastodon. Not sure how that could be worked around.

Filtering out the title if it is a note

Since the notes have a generated title and I had my notes tooted I was getting redundant titles. I made this modification maybe it may be useful.

`add_filter( 'share_on_mastodon_status', function( $status, $post ) {
// Create a short preview of the post

// May be a better way to do this to check if the option is checked in the plugin.
if ( 'indieblocks_notes' === $post->post_type ) {
    $status = "From my notes\n\n";
    //excluding the title of the post, may want to get this from the plugin as well.
}

if ( 'post' === $post->post_type ) {
    $status .= "\"" . get_the_title($post) . "\"\n\n";
}


$status .= get_the_excerpt($post);
//  Remove the … forced by the excerpt and replace with the Unicode symbol
$status = html_entity_decode($status);
//  Add a link
$status .= "\n\n" . get_permalink( $post );
//  Add tags
$tags = get_the_tags( $post->ID );
if ( $tags ) {
    $status .= "\n\n";
    foreach ( $tags as $tag ) {
        $status .= '#' . preg_replace( '/\s/', '', $tag->name ) . ' ';
    }
}
$status = trim( $status );
return $status;

}, 10, 2 );`

Emoji in post titles (maybe bug? maybe my fault? maybe a feature request?)

I just got this installed and working, but have discovered a minor issue — I use emoji in my blog post titles, but they seem to be getting mangled and are instead just appearing in the Mastodon post as the raw HTML entity and partially turned into a Mastodon tag.

Example:

I'm not sure if this is a bug somewhere in the plugin, a bug of my own making in the PHP code I came up with for making the Mastodon post look the way I want, or if this is just something that could be resolved in a future update.

Any assistance would be appreciated! Thanks!

RFE: Content warnings

On some Mastodon instances it is considered polite to add a content warning for bot-posted toots like these. I would love to be able to have a configurable content warning, ideally one which allowed the CW to include the title of the Wordpress post.

Thanks for considering.

multiples mastodon sites

Hi,

more a feature request question.
Would be great to be able to post on multiple mastodon site.

Seems currently the plugin can connect to just one instance.

br

No posts withj WP Script Theme

Hello,

i have installed the Mastodon Wordpress Plugin and use with a WP Script Theme.

I want to autopost embbed video posts.

But the Plugin does not work for me. Also all other Mastodon Plugins don't work.

I can select "Videos" in the settings, but it has no effect.

I also enabled the debug, but there was no entry for this plugin.
Looked like it was not called after publishinig a new post.

br

Christian

Error status

Sometimes a post will simply not generate a share to my Mastodon account, and the only way I am aware of that is if (a) the post never shows up on Masto, and (b) the URL for the Masto link doesn't show up in the metabox. But ... there's indication of why it didn't work -- error communicating with server, or message was inexplicable too long or what. If there is a failure, could we get some sort of indication of the cause in the metabox?

Show in REST API

Like this, sort of.

public function register_meta() {
  $options = $this->options_handler->get_options();
  $post_types = $options['post_types'] ?? [];

  foreach ( $post_types as $post_type ) {
    register_post_meta( $post_type, '_share_on_mastodon_url', [
      'single'       => true,
      'show_in_rest' => true,
      'type'         => 'string',
    ] );
  }
}

Jetpack sometimes messes up image paths

May in fact be the root cause of #17.

Jetpack's Photon module changes the image URL of thumbnails (but not, it seems, the outcome of wp_get_attachment_url()).
This results in a broken image path, and the image is subsequently not uploaded.

This can be disabled: https://github.com/Automattic/jetpack/blob/master/projects/plugins/jetpack/class.photon.php#L707.
This may very well be the way to go. Alternatively, we could always upload the original image instead of the "large" thumbnail (when available, we fall back to the original anyways, in case it doesn't).

Note: This does normally not happen when posting from WP Admin. (It could, though, it depends.)

Provide status on post to Mastodon

Would it be possible to (optionally) add a status message on the WP post edit screen when a successful share is made? This would present similarly to the existing "Post published and sending emails to subscribers. View post" or "Post updated. View post" messages, in its own status box. (WP-to-Twitter, when I was using that, did something similar.) So, something like ...

Shared to Mastodon at ____________

... filling in the location site (as the meta box does).

This would provide positive confirmation the share worked or occured, without having to scroll to where the meta box is.

url validation

in configuration if the instance URL is given without https:// the process fails without any warning.

it would be better, if it automatically tried with https:// or warned it's required

Featured image gets posted twice

On older WP versions and ClassicPress, at least. If and only if the image is also one of the post's attached images (which will be the case if it was uploaded through the Create Post screen).

Solution: Cast thumbnail ID to int before comparing it to attached image ID.

Image alt text not sent?

When a Featured Image is sent along (shouldn't this be made optional?), its alt text seems missing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.