Support » Plugin: Better Notifications for WP » Support for o2 plugin used with P2 theme

  • Resolved Patrick Jackson

    (@pjackson1972)


    Great work on the plugin!

    I found that I wasn’t receiving notifications when users added new posts on the front end with the o2 plugin. O2 is the (fairly) new plugin, still in Beta, that adds front-end functionality to the P2 theme.

    I added the following to bnfw.php that seemed to do the trick.

    /*
     * Add support for o2 plugin that adds front-end features to P2 theme
     */
    $active_plugins = get_option('active_plugins');
    foreach( $active_plugins as $active_plugin){
        if ( false !== strpos($active_plugin, 'o2.php') ){
            add_action( 'o2_writeapi_post_created'        , array( $this, 'publish_post_o2' ) );
            break;
        }
    }
    
    /**
     * Fires when a post is created for the first time via o2 plugin.
     *
     * @since 1.3.9.5-pj
     * @param int $post_id  post id
     *
     */
    function publish_post_o2( $post_id ) {
            $post = get_post($post_id);
            $post_type = $post->post_type;
    
            if ( BNFW_Notification::POST_TYPE != $post_type ) {
                    $this->send_notification_async( 'new-' . $post_type, $post_id );
            }
    }

    Note that comment notifications seemed to work as expected.

    Hope that’s helpful!

    Cheers,
    Patrick

    https://wordpress.org/plugins/bnfw/

Viewing 1 replies (of 1 total)
  • Plugin Author bnfw

    (@voltronik)

    Hi Patrick,
    Thanks for sending this over! I’ll do some testing and if all good, will release as part of an update soon.

    Thanks,
    Jack

Viewing 1 replies (of 1 total)
  • The topic ‘Support for o2 plugin used with P2 theme’ is closed to new replies.