Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter wpostest

    (@wpostest)

    I found a solution:

    <!DOCTYPE html>
    <html>
    <body>
    <h1>
    Hi %first_name%,
    </h1>
    </body>
    </html>
    Thread Starter wpostest

    (@wpostest)

    Hi @mrclayton,

    The redirect URL is working correctly. Clients are returned to the checkout page. When they cancel the order or if they successfully pay for the order.

    All the problem is there:
    I don’t want to show clients the checkout page and create orders when they cancel the order meanwhile payment because after that they cant pay again for this order.

    Maybe is there exists any hook that I can use to redirect clients after an unsuccessful payment and then prevent creating an order?

    Take care

    Thread Starter wpostest

    (@wpostest)

    Thread Starter wpostest

    (@wpostest)

    Thank you for fast replay. I hope you can help me.
    I use “Przelewy24” payment method.

    There is the visualisation
    1. https://prnt.sc/20ekk5b (Select payment and buy)
    2. https://prnt.sc/20el3ov (Cancel payment)
    3. https://prnt.sc/20el5wf (Back to shop)
    4. https://prnt.sc/20el71g (Back to shop)
    5. https://prnt.sc/20elehs (“orders/orders-recived” page)

    I dont want to show clients step 5 (order recived page) and set order in woocomerce when their cancel order. Is there any solution for that?

    Take care

    Thread Starter wpostest

    (@wpostest)

    Then is there any place to extend functionality plugin without write my own plugin ?

    And of course you get 5 stars from me ??

    Thread Starter wpostest

    (@wpostest)

    Thank you alot for your fast answer. It helped me very much. I spent some time to did it. I tried to different methods and finally i made it. Propably with not the best method but it work.

    I would also like to ask you if I did the right thing to edit the code of this plugin directly? Or should I include the following functions elsewhere? It would be nice if you answered this question for me ??

    I used the plugin Hook like you said and got the value there from that custom field.

    Now it looks like this, it may be useful to someone:

    function um_post_registration_approved_hook( $user_id, $args ) {
    	um_fetch_user( $user_id );
    	UM()->user()->approve();
    
    	//Referal System
    	$new_user_id = $user_id;
    	$ref_code = "";
    				
    	$new_user_ref_code = new WP_Refer_Code($new_user_id);
    	//Sprawdzamy czy textbox z jakiegos formularza zawiera kod referencyjny 
    	if($args["refferal"] != ""){
    		$ref_code = $args["refferal"];
    	}
    	else if($args["referal"] != ""){
    		$ref_code = $args["referal"];
    	}
    	else if($args["referall"] != ""){
    		$ref_code = $args["referall"];
    	}
    
    	if(!empty($ref_code) || $ref_code != ""){
    		$referrer_user_id = $new_user_ref_code->get_user_id_by_ref_code($ref_code);
    
    		do_action('wp_referral_code_before_refer_submitted', $new_user_id, $referrer_user_id, $ref_code, $new_user_ref_code);
    						
    		update_user_meta( $new_user_id, 'wrc_referrer_id', $referrer_user_id);
    						
    		$users_referred_by_referrer = get_user_meta( $referrer_user_id, 'wrc_invited_users', true );
    		if ( empty( $users_referred_by_referrer ) ) {
    			update_user_meta( $referrer_user_id, 'wrc_invited_users', [ $new_user_id ] );
    		} else {
    			$users_referred_by_referrer[] = $new_user_id;
    			update_user_meta( $referrer_user_id, 'wrc_invited_users', $users_referred_by_referrer );
    		}
    						
    		do_action( 'wp_referral_code_after_refer_submitted', $new_user_id, $referrer_user_id, $ref_code, $new_user_ref_code );
    	}
    }
    add_action( 'um_post_registration_approved_hook', 'um_post_registration_approved_hook', 10, 2 );

    And here is catching the exception:

    function um_custom_validate_reffcode( $key, $array, $args ) {
    	if ( isset( $args[$key] )) {
    		$ref_code = $args[$key];
    		$user_id = WP_Refer_Code::get_user_id_by_ref_code( $ref_code );
    
            if(empty($user_id)) {
                UM()->form()->add_error( $key, __( 'Podany kod referencyjny jest nieprawid?owy.', 'ultimate-member' ) );
    		}
    	}
    }
    add_action( 'um_custom_field_validation_ReffCode_Valid', 'um_custom_validate_reffcode', 30, 3 );
    Thread Starter wpostest

    (@wpostest)

    I have one more questions, is there any way to catch an error if the user gives the wrong reference code?

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