WordPress.org

Forums

Subscribe2
Send «only» private post notifications (4 posts)

  1. deugarte
    Member
    Posted 8 months ago #

    Hello!
    Thanks for your wonderful plugin. Could you help me to use it to send «only» private posts notifications «without» using an special category for them? Is there any possible filter to add to the template or any function I could change in the code?

    https://wordpress.org/plugins/subscribe2/

  2. mattyrob
    Member
    Posted 8 months ago #

    @deugarte,

    You could probably make use of these hooks:
    s2_send_plain_excerpt_subscribers
    s2_send_plain_fullcontent_subscribers
    s2_send_html_excerpt_subscribers
    s2_send_html_fullcontent_subscribers

    They are documented here. Each hook is passed an array of subscribers and a post ID. You could call get_post_status( $ID ) to check if it's 'private' and if it isn't return an empty array instead of the subscribers to ensure notifications don't get sent.

  3. deugarte
    Member
    Posted 8 months ago #

    Thanks! Checking the link you recommended I found s2member_filter(), I will try with it and report later here!

  4. deugarte
    Member
    Posted 8 months ago #

    Finally I took the easy way, in subscribe2/classes/class-s2-core.php I added an OR to the mail function. Now it only sends the messages if post is private.

    function mail($recipients = array(), $subject = '', $message = '', $type = 'text', $attachments = array()) {
    		if ( ( empty($recipients) || '' == $message ) OR ($post->post_status != 'private')){ return; }

Reply

You must log in to post.

About this Plugin

  • Subscribe2
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.