Title: sameee49's Replies | WordPress.org

---

# sameee49

  [  ](https://wordpress.org/support/users/sameee49/)

 *   [Profile](https://wordpress.org/support/users/sameee49/)
 *   [Topics Started](https://wordpress.org/support/users/sameee49/topics/)
 *   [Replies Created](https://wordpress.org/support/users/sameee49/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/sameee49/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/sameee49/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/sameee49/engagements/)
 *   [Favorites](https://wordpress.org/support/users/sameee49/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Referral Code] WP Referral code with Ultimate Member](https://wordpress.org/support/topic/wp-referral-code-with-ultimate-member/)
 *  Thread Starter [sameee49](https://wordpress.org/support/users/sameee49/)
 * (@sameee49)
 * [5 years ago](https://wordpress.org/support/topic/wp-referral-code-with-ultimate-member/#post-14221577)
 * By default the plugin do nothing… whenever a person is registered after referring
   from another already registered member by link. The plugin still shows zero invites.
   User b is not invented by any user…
 * So for me. Plugin is showing me statis results of 0 invites and invited by none!
   
   How can i solve this issue?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Referral Code] WP Referral code with Ultimate Member](https://wordpress.org/support/topic/wp-referral-code-with-ultimate-member/)
 *  Thread Starter [sameee49](https://wordpress.org/support/users/sameee49/)
 * (@sameee49)
 * [5 years ago](https://wordpress.org/support/topic/wp-referral-code-with-ultimate-member/#post-14218915)
 *     ```
       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 );
       ```
   
 * This code👆
    How can i put this? Should i simple post this at the end of the 
   functions.php file???
 * What changes do i have to make before pasting this code?

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