• Resolved oferlaor

    (@oferlaor)


    for some reason, there’s only one checkbox for both sending notifications on publish and on update posts.

    These are two separate functions and both need their own checkbox. On our site, we regularly update posts, which shouldn’t trigger a push notification, but the default for publish *should* be on…

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support jon1signal

    (@jon1signal)

    We will take this into consideration, but my suggestion is to either check or uncheck the box before you publish or update the post depending on if you want to send a push notification or not.

    The concept of clicking a checkbox to send a push when a post is published or updated should be a relatively simple and small decision to make without needing complexity around whether it should be checked or unchecked by default.

    Thread Starter oferlaor

    (@oferlaor)

    in many sites, you are right. In our case, the decision is up to the admin. We don’t want updates to trigger notifications and the current setup means we aren’t really using push notifications (because most updates are minor corrections and we can’t trust our contributors to remember to turn it off each time).

    • This reply was modified 10 months, 1 week ago by oferlaor.
    Thread Starter oferlaor

    (@oferlaor)

    I added a post-update.js script:

    document.addEventListener("DOMContentLoaded", () => {
    const checkbox = document.querySelector("#os_update");

    if (!checkbox) return;
    // Get the element that shows the post status (e.g., "Published")
    const statusEl = document.querySelector("#post-status-display");
    const isPublished =
    statusEl &&
    (statusEl.textContent.trim().toLowerCase() === "published");

    // only turn it off it if it's on and post is already published.
    if (checkbox.checked && isPublished) checkbox.checked = false;

    });

    and then in the theme’s functions.php:

    if (('post.php' === $hook) || ('post-new.php' === $hook)) {

    wp_enqueue_script('htadmin', get_template_directory_uri() . '/assets/js/post-update.js', array(), '1.14', true);

    }
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘separate notification on publish vs update post’ is closed to new replies.