• Resolved hshah

    (@hshah)


    Is it possible to set up admin and user notification alerts when a custom post type has been published, but only have it triggered via a function that currently does other actions when said post type is published?

    Can functions be used to pass information like email subject, post title etc into the template?

    I have a custom field that is set depending on various post criteria and only want the emails to be triggered when that condition is met.

    I’m trying to make do without buying any of the addons, so am wondering what is and isn’t possible with just the free one.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter hshah

    (@hshah)

    I’ve made some progress with this now, but am struggling with one custom field which is only committed to the database later on.

    I know that the value is definitely available after either of these actions, but I can’t seem to work out how to create a custom trigger based on those 🙁

    add_action('um_user_photos_after_album_created', 'um_user_photos_rename', 25);
    add_action('um_user_photos_after_album_updated', 'um_user_photos_rename', 25);
    • This reply was modified 6 years, 4 months ago by hshah.
    Plugin Author Kuba Mikita

    (@kubitomakita)

    Hi, maybe others will be able to help but I’d suggest just purchasing the Custom Fields and Conditionals extensions to get it working out of the box.

    Thread Starter hshah

    (@hshah)

    I’m not sure if that will help me because I’ve already managed to do the conditional part and my issue is that the email is triggered before the field value is committed to the database.

    What I’ve not been able to figure out after spending hours adopting a trial and error method with the information in the documentation is how to create a custom trigger for this particular email and then invoke it from the function I have for the two actions I mentioned in my previous post.

    Plugin Author Kuba Mikita

    (@kubitomakita)

    I’ve created a new doc for you with a cron delaying approach. I’ve been using it successfully in such cases.

    See this: https://docs.bracketspace.com/notification/developer/triggers/delaying-trigger-execution-with-cron

    Thread Starter hshah

    (@hshah)

    I’m learning all this as I am going along, and am struggling to understand that document 🙁

    Since I am already doing a custom “um_user_photos_rename” function as part of “um_user_photos_after_album_created”, where I have “$post” etc, can I just not add something to that which will invoke the trigger?

    Can the trigger be disabled by default, and only executed manually when I call it from my “um_user_photos_rename” function?

    /Edit:
    Or I could just do this in the “um_user_photos_rename” function:
    https://docs.bracketspace.com/notification/developer/notifications/programmatic-notifications

    • This reply was modified 6 years, 4 months ago by hshah.
    Thread Starter hshah

    (@hshah)

    I may have sorted my issue by modifying the other plugin’s code. The field in question was custom one anyway, and I had added it to their code. I just moved what I had added, to take place earlier 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Triggering Emails from Functions’ is closed to new replies.