Cross-posting from WordPress to Mastodon

I’ve finally got WordPress to Mastodon cross-posting working the way I want: automatically, whether I’m posting through the WordPress web interface or through a desktop or mobile client like MarsEdit or the WordPress mobile app, and with the format that I want:

Title: Excerpt (#tags)

Full post on Eclecticism: URL

I’d been using the Autopost to Mastodon plugin, which works great, and I can recommend it — as long as you only or primarily post using the WordPress web interface.

However, the plug-in is only triggered when publishing a post through the WordPress web interface. Any time I posted through a client, nothing went to Mastodon. So I either had to go into the web interface and manually trigger an update to the post with the “Send to Mastodon” option checked, or just skip out on using anything but the web interface at all, which I’m not a fan of (especially on mobile).

I’d asked the plug-in author, and they’ve said that this is just the way it is.

So I put out a call for help on Mastodon, and got some kind tips from Elephantidae, who pointed out the Share on Mastodon plugin. This looked promising, as its documentation specifically mentions being able to configure it to work with externally created posts. However, looking through the docs made it clear that most of this plugin’s configuration, including changing the format of the text it sends to Mastodon, is done through adding and tweaking PHP functions…and as with most of my coding knowledge, my PHP knowledge is roughly at the “I can usually get a vauge idea of what it’s doing when I read the code, but actually creating something is a whole different ballgame” territory. Plus, dumping PHP code into my theme’s files risks losing those changes the next time the theme files are updated.

Retaining the code through theme updates can be managed through creating a site-specific plugin, however — a handy trick which, somewhat amusingly, I’d never had exactly the right combination of “I want to do this” and “how do I do it” in the past to discover until now.

So, after a bit of fumbling around with the Share on Mastodon plugin documentation and figuring out the right PHP and WordPress function calls, here’s what I’ve ended up adding to my site-specific plugin:

/* Tweaks for the Share on Mastodon plugin */

/* Customize sharing text */

add_filter( 'share_on_mastodon_status', function( $status, $post ) {
  $tags = get_the_tags( $post->ID );

  $status = get_the_title( $post ) . ": " . get_the_excerpt( $post );

  if ( $tags ) {
    $status .= " (";

    foreach ( $tags as $tag ) {
        $status .= '#' . preg_replace( '/\s/', '', $tag->name ) . ' ';
        }

    $status = trim( $status );  
    $status .= ")";
    }

  $status .= "\n\nFull post on Eclecticism: " . get_permalink( $post );
  return html_entity_decode( $status );
  return $status;
}, 10, 2 );

/* Share if sent through XML-RPC */

add_filter ('share_on_mastodon_enabled', '__return_true');

/* End Share on Mastodon tweaks */

And after a few tests to fine-tune everything, it all seems to work just the way I wanted. Success!

(Also, re-reading through this, I’ve realized that since I like to give the background of why and how I stumble my way through things, I end up writing posts that are basically a slightly geekier version of the “stop telling me about your childhood vacations to Europe and just post the damn recipe!” posts that are commonly mocked. And I don’t even have ad blocks all over my site! At least I’m not making you click through several slideshow pages of inane chatter before I get to the good stuff. My inane chatter is easy to scroll through.)

📚 Killing Blow by Kevin Ryan

64/2022 – ⭐️⭐️⭐️

As with many mid-points of trilogies, not quite as strong as the first, though still better than average. Some flashback scenes are written in with the main narrative and occasionally mildly confusing when scenes switch between present and past battles, and there are a few unfortunate typos swapping similarly named characters. Once those are accounted for, though, a decent enough middle chapter.

Michael holding Killing Blow.

📚 The Edge of the Sword by Kevin Ryan

63/2022 – ⭐️⭐️⭐️

TOS events as seen trough the eyes of a disguised Klingon operative serving as part of the Enterprise’s security crew. On the one hand, it’s a combination of common tropes: the outsider/enemy coming to understand humanity through living among them and a “lower decks” view of life on a starship. On the other hand, it’s done quite well, without being too “wink-wink, nudge-nudge, remember this bit?” when the book’s events intersect with known missions. A good start to the trilogy (or hexology, I suppose, as there is another trilogy following the events of this one).

Michael holding The Edge of the Sword.

Don’t ever stop talking to each other

This is a long rant by Cat Valente – and it’s really, really good. Though I’m quoting a particularly good bit from the end, it’s worth reading the whole thing.

Don’t ever stop talking to each other. It’s what the internet is really and truly for. Talk to each other and listen to each other. But don’t ever stop connecting. Be a prodigy of the new world. Stand up for the truth no matter how often they take our voices away and try to replace the idea of reality with fucking insane Lovecraftian shit. Don’t give up, don’t let them have this world. Love things. Love people. Love the small and the weird and the new.

Because that’s what fascists can’t do. They don’t love white people or straight people or silent women or binary enforced gender or forced birth or even really money. They want those things to be the only acceptable or even visible choices, but they don’t love them. They don’t even want to think about them. They want them to be automatically considered superior and universally mandated so they don’t have to think about them—or else what do you think the fury over other people wearing masks was ever about? The need to be right without thinking about it, and never have to see anything that wakens a spark of doubt in their own choices.

Obey, do not imagine, do not differ.

That’s nothing to do with love. Love is gentle, love is kind, remember? They need the attention being terrible brings them, but they don’t love it any more than a car loves gas. Sometimes I don’t even think they love themselves. Sometimes I’m pretty sure of it. They certainly never seem happy, even when they win. Musk doesn’t seem happy at all.

Geeks, though. Us weird geeks making communities in the ether? We love. We love so stupidly hard. We try to be happy. We get enthusiastic and devote ourselves to saving whales and trees and cancelled science fiction shows and each other. The energy we make in these spaces, the energy we make when we support and uplift and encourage and excite each other is something people like Musk can never understand or experience, which is why they keep smashing the windows in to try and get it, only to find the light they hungered for is already gone. Moved on, always a little beyond their reach.

📚 Joy to the Worlds by Maia Chance, Janine A. Southard, Raven Oak, and G. Clemans

62/2022 – ⭐️⭐️⭐️

Eight tales of holiday-themed speculative fiction mysteries by four authors, all from the Seattle area (at least at the time of publication, according to their bios), each contributing two stories. Space Santa and the mob, time traveling through Germanic folklore, a retro-future pageant mystery…quite a few of the offering here were very enjoyable. G. Clemans’ ‘Bevel & Turn’ and Raven Oak’s ‘The Ringers’ were my particular favorites.

Michael holding Joy to the Worlds

🎥 Spirited

Spirited (2022): ⭐️⭐️: This shouldn’t have been a musical.

It’s a good cast, an amusing take on the Christmas Carol story, some very clever lines, and several fun nods to several other famous Christmas Carol adaptations (plus at least one other famous Christmas film). And yet, every time they break into song (with one exception), it all drags down to a rather painful slog — and they break into song a lot.

It’s not a bad film, but it’s also not nearly as good as it could have been. It either needed to be just a comedy, or perhaps different songwriters, but the most enjoyable parts — save for a very rousing “good afternoon” — were the non-musical parts.

📚 Bimbos of the Death Sun by Sharyn McCrumb

60/2022 – ⭐️⭐️⭐️

I’d call this a guilty pleasure, except that I don’t think I need to feel guilt about the things I enjoy, even if they have their issues…which this book definitely has. I first discovered it in the early ‘00s, and loved its lighthearted take on a murder mystery at a SF/F convention. At some point I lost my copy, but recently found one at a used bookstore. Re-reading it now, its flaws are a little more apparent, but it’s still mostly enjoyable fluff.

Pros: The general sense of weirdness of the con atmosphere, with its disparate groups of fans connected by their overall fandom. The surreality of the mix of costumes and mundanes, and what it must be like for people unconnected to a con to find themselves in the middle of it. And, yes, the recognizable tendency for some fen to be a little too wrapped up in things. Plus, I really enjoy that because the book was written in the late ‘80s, this is a con of the time, with things like video programming rooms and a “high tech” room with things like demonstrations of personal computers.

Cons: There is a relatively heavy reliance on the “poorly socialized misfits” trope that’s often seen when cons or SF/F fans are part of the setting or plot; though the main characters tend to be real-people-who-are-fans, most of the peripheral characters fall solidly into barely-functional-in-the-real-world territory. But the biggest flaw is the ongoing fat-shaming, where one character exists entirely as an extended “laugh at the overweight woman and her quest to find a partner socially inept enough to accept her” joke. Nothing about this plot line advances or even really engages with the main plot, and it really stands out as a misstep.

Michael holding Bimbos of the Death Sun