Skip to:
Content
Pages
Categories
Search
Top
Bottom

Subscribe to topics not send email


  • liderxlt
    Participant

    @liderxlt

    Hello!
    First of all I want to clarify that the notifications by email if they arrive if a response is made in the subject from the frontend, in that there is no problem.

    I feed the forum with external information, the updates of new and old topics are published daily. This I do by means of an import code. When users subscribe to a topic and receive new answers, email does not arrive.

    I suspect that is the replic’s import code.

    At the beginning of the code, I identified the id of the theme to link the replic, then updated the data.

    $old_topic_id = get_post_meta( $post_id, '_bbp_topic_id', true );
    		$post = get_posts( array(
    			'post_type' => 'topic',
    			'meta_key' => '_old_topic_id',
    			'meta_value' => $old_topic_id
    			) );
    		if ( $post ) {
    			$new_topic_id = $post[0]->ID;
    			$args = array(
    				'ID' => $post_id,
    				'post_parent' => $new_topic_id
    				);
    			wp_update_post( $args );
    			update_post_meta( $post_id, '_bbp_topic_id', $new_topic_id );
    			update_post_meta( $post_id, '_edit_last', 1 );
    		}

    The import of topic and replic is a success, except for the detail that does not motivate users subscribed to forum and topic.

    Regards!

Viewing 1 replies (of 1 total)

  • liderxlt
    Participant

    @liderxlt

    Update with more information, I am using the wpallimport plugin, it allows to use PHP functions.

    Which allow to add hooks before, during and after importing.
    All the information here >> http://www.wpallimport.com/documentation/advanced/action-reference/

    <?php
    
    add_action( 'pmxi_saved_post', 'soflyy_forum_data', 10, 3 );
    
    function soflyy_forum_data( $post_id, $xml_record, $is_update ) {
    	$exped = array('1','3','5','7','9','11');//ID OF THE FILE OF TOPIC
    	$actualiz = array('2','4','6','8','10','12');//ID OF THE FILE OF REPLY
    	$import_id = ( isset( $_GET['id'] ) ? $_GET['id'] : ( isset( $_GET['import_id'] ) ? $_GET['import_id'] : 'new' ) );
    
    	if ( in_array($import_id,$exped) ) {
    		// Topics import - 1 esel id de la importacion
    		$parent_forum = get_post_meta( $post_id, '_bbp_forum_id', true );
    		if ( $parent_forum != 0 ) {
    			$args = array(
    				'ID' => $post_id,
    				'post_parent' => $parent_forum
    				);
    			wp_update_post( $args );
    			update_post_meta( $post_id, '_bbp_topic_id', $post_id );
    			update_post_meta( $post_id, 'post_alter_id', $post_id );
    			update_post_meta( $post_id, '_bbp_last_active_time', date( "Y-m-d H:i:s", time() ) );
    		}
    	} elseif ( in_array($import_id,$actualiz) ) {
    		// Replies import - 2 esel id de la importacion
    		$old_topic_id = get_post_meta( $post_id, '_bbp_topic_id', true );
    		$post = get_posts( array(
    			'post_type' => 'topic',
    			'meta_key' => '_old_topic_id',
    			'meta_value' => $old_topic_id
    			) );
    		if ( $post ) {
    			$new_topic_id = $post[0]->ID;
    			$args = array(
    				'ID' => $post_id,
    				'post_parent' => $new_topic_id
    				);
    			wp_update_post( $args );
    			update_post_meta( $post_id, '_bbp_topic_id', $new_topic_id );
    			update_post_meta( $post_id, '_edit_last', 1 );
    			
    			//wp_update_post( $post_id,'post_parent',$new_topic_id );
    		}
    	}
    }
    ?>
    

    I have tried adding hooks like

    add_action( 'pmxi_update_post_meta','bbp_notify_subscribers',10,3);
    add_action( 'bbp_new_reply','bbp_notify_topic_subscribers', 10, 3 );
    add_action( 'bbp_new_reply','bbp_notify_topic_subscribers', 10, 3 );

    But without success.

    I hope this information is useful.

    regards…

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar