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.

Sampling Air Quality at a Seattle Goth Club

Following a pandemic-induced shutdown, local SeaGoth bar/dance club The Mercury has been reopened for just over a year now. I haven’t returned yet, but I’d heard through the grapevine that they’d done a lot of work on their HVAC system during their hiatus, and apparently have a system that meets or exceeds what’s expected for hospital grade systems.

Sounds pretty good — but I was curious as to just what that meant for their air quality, especially as this is a basement club, and with any such place, is likely to have a lot of people talking and breathing heavily when out on the dance floor. Plus, while I’ve been told that many people are wearing masks while they’re there, it’s by no means 100% (and, of course, it’s safe to assume that those who don’t/won’t mask are at higher risk than those who do).

I had a friend who was heading out there last Saturday night for a little while, and between the one-year re-opening anniversary and there being a merchandise table to distribute shirts and hoodies that people had purchased in a recent fundraiser, we could expect that there would be a good number of people there, even early in the evening. My friend was kind enough to carry along my Aranet4 CO2 monitor during their time there.

Though only there for about an hour, while there, in order to get the best possible “worst case” scenario, they made sure to sit near the merchandise table where people were gathering, and went out on the dance floor a few times. Yesterday I picked up the monitor and loaded its record to see the results.

The end result was, to be entirely honest, much better than I’d expected. The air quality stayed in the green the entire time they were there, averaging around 800 ppm. This is really impressive for that sort of situation.

A graph of CO2 measurements from roughly 9 to 10 p.m. Spikes at the beginning and end of the graph show when the carrier was in their car going to and from the club. The line between the spikes from when the carrier was in the club stays in the green. The displayed measurement point at 9:22 pm is 785 ppm.

Of course, there are some definite caveats to this:

  • It was the first hour, so even with their best efforts to find the most crowded areas, this may not be entirely indicative of what might be measured at peak times.
  • This is a measure of CO2 levels, not COVID or other viruses; you can still be exposed even in a well-ventilated space, even if the likelihood is reduced.
  • And because of that, however good the air quality is, there’s always the chance of talking with someone who is unmasked, asymptomatic, and exhaling their viral load directly into your face.

Since community transmission levels for the Seattle area are still pretty high, I’d still definitely recommend wearing a mask when out clubbing.

However, seeing measurements like this tells me that the money, time, and effort spent upgrading the club’s systems was well spent. I’m still keeping an eye on community transmission levels before I go out, but when I do, I’ll feel a lot more comfortable (though I will be staying masked as well).

(The spikes at the beginning and end of the graph are from when my friend was in their car going to and from the club.)