• Hello and thank you very much for reading this.

    I am trying to modify a site and plugins I didn’t created. The plugin receives events from a paying system and basically I want to change the payment status on my site.

    My problem, I think, is that I can’t find the functions called below..
    The functions that I can’t find anywhere on the site for example are:

    should_update_payment_status Called through apply_filters

    and most important

    before_payment_status_change called with do_action

    Here is the code:

    function update_payment_status( $payment_id, $new_status = 'publish' ) {
    	if ( $new_status == 'completed' || $new_status == 'complete' ) {
    		$new_status = 'publish';
    	}
    
    	$payment = get_post( $payment_id );
    
    	if ( is_wp_error( $payment ) || !is_object( $payment ) )
    		return;
    
    	$old_status = $payment->post_status;
    
    	if ( $old_status === $new_status )
    		return; // Don't permit status changes that aren't changes
    
    	$do_change = apply_filters( 'should_update_payment_status', true, $payment_id, $new_status, $old_status );
    
    	if( $do_change ) {
    
    		do_action( 'before_payment_status_change', $payment_id, $new_status, $old_status );
    
    		$update_fields = array( 'ID' => $payment_id, 'post_status' => $new_status, 'edit_date' => current_time( 'mysql' ) );
    
    		wp_update_post( apply_filters( 'update_payment_status_fields', $update_fields ) );
    
    		do_action( 'update_payment_status', $payment_id, $new_status, $old_status );
    
    	}
    }

    Thank you again. If I am not clear at something please let me know.

  • The topic ‘I cant find the tag’ is closed to new replies.