A site manager can configure webmentions to be sent when content is published (not only on form save)

Created on 21 March 2022, over 2 years ago
Updated 1 March 2023, over 1 year ago

Problem/Motivation

We have a setup where content is placed in a "Ready" but unpublished state, and then automatically published on a schedule.

Presently, webmentions are only

Steps to reproduce

  1. Configure webmentions for a content type.
  2. Create an unpublished piece of content.
  3. Publish on cron.

Example code in a function running on cron:

  $node = Node::load($nid);
  if (meets_publish_criteria($node)) {
    // If node is already published we can skip it.
    if ($node->get('status')->value) {
      continue;
    }
    $node->moderation_state->value = 'published';
    $node->save();

The result will be no webmentions are sent.

Proposed resolution

I see two broad options:

One, use real fields rather than pseudo fields and a form alter for the webmention setting and (hidden) display. This would be the most robust and could even simplify the work of the site builder (only have to move one field to be displayed, though that would imply configuration options per instance of this field). The main change is that a content editor could save the content unpublished having checkmarked webmention target A and not target B and on programmatic publish it would only be send A, not B.

or:

Two, add another option "on publish" next to "cron" and this won't display the form fields for webmentions at all but will send to all available targets on publish.

Remaining tasks

Pick approach, if any.

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024