• Resolved Theunis Coetzee

    (@ipokkel)


    WP Job Manager has ‘Jobs’ as a CPT for WP and has custom post statuses, (other than draft, published, trashed), registered. One of these custom statuses is ‘expired’, which the notification plugin doesn’t pick up, and when WP Job Manager changes the post status to ‘expired’, Notifications sees this as post ‘updated’ and the end users and admin gets notified that the post was updated instead of that the post has expired.

    Is there any way I can expand on the Notifications plugin to pick up these custom post statuses so I can create a separate notification when status is changed to ‘expired’ and to prevent it from sending a notification of status ‘updated’ when the actual status is ‘expired’?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Kuba Mikita

    (@kubitomakita)

    You definitely can extend the plugin but I’m wondering if this isn’t worth to be implemented in the plugin’s core. I’d have to check how exactly the WPJM plugin handles the custom statuses as it always was a bit of a trouble for developers.

    The class responsible for the Post updated trigger is here: https://github.com/BracketSpace/Notification/blob/develop/class/Defaults/Trigger/Post/PostUpdated.php

    You could just copy it, tweak the action or the conditions and register new Trigger. Please see the docs for reference.

    On the other hand you can suppress the Post updated notification if status is expired with a single action. There are also docs to do that. The $trigger will have the $trigger->__paste_wpjm_job_cpt_slug__ property with the WP_Post object on which you can test the status.

    Anyways I’m putting this on my to-do list and I’ll see how it’s handled by them, but there’s a chance it’s a global issue and the fix will be applied in the next version of Notification plugin.

    Thread Starter Theunis Coetzee

    (@ipokkel)

    If you could at have a look at WPJM’s statuses for triggers that’d be awesome, like you said a bit tricky for most devs and my experience level isn’t close to WP dev status… yet.

    Thanks for the awesome reply, will work through the advice and might even, if necessary, try my hand at using the boilerplate to do an extension for WPJM.

    Will pass back the solution if I manage to solve it.

    Thanks again Kuba, Absolutely awesome support.

    Plugin Author Kuba Mikita

    (@kubitomakita)

    Thank you! I’ll also let you know if I’ll find anything about the custom statuses.

    Can take me a couple of days though as I have a ton of client’s work this week.

    Thread Starter Theunis Coetzee

    (@ipokkel)

    Thanks and No Hurry, in the same boat.

    Plugin Author Kuba Mikita

    (@kubitomakita)

    Hey Theuns, I’m wondering. If you do like the plugin would you mind to share it on your Twitter or Facebook? I’m trying to promote it and it would be a huge help.

    Thread Starter Theunis Coetzee

    (@ipokkel)

    Absolutely, think it’s an awesome intelligent plugin.

    Plugin Author Kuba Mikita

    (@kubitomakita)

    Hi @ipokkel,

    have you managed to get it working with custom status?

    I thought about this feature and I came to a conclusion that this is not something for the Notification core. It will be very difficult to cover all the cases and the default Trigger will be a huge mess.

    However, I have added a Post status merge tag which can be used in the Notification : Conditionals extension to control when the notification is send and when it’s not.

    The merge tag will be released in the next version.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘CPT with custom post status’ is closed to new replies.