awangtay
Forum Replies Created
-
Thanks for your help. But it still not able to work.
We first follow your instruction by putting the code at the bottom of mycred code but it is not working.
remove_action('user_register','mycred_detect_referred_signups'); add_action('user_register','mycred_detect_referred_signups_verify'); function mycred_detect_referred_signups_verify(){ $current_user = wp_get_current_user(); $user_id = $current_user->ID; $approved_status = get_user_meta($user_id, 'user_activation_status', true); if ( $approved_status == 1 ){ do_action( 'mycred_referred_signup', $user_id ); } else{ // execute code for user not verified. } }
and then we try to replace
add_action( 'user_register', 'mycred_detect_referred_signups' );
withadd_action('user_register','mycred_detect_referred_signups_verify');
and shift the function part, shown below. However, it is not working so.<?php if ( ! defined( 'myCRED_VERSION' ) ) exit; /** * Load Referral Program * @since 1.5.3 * @version 1.0 */ if ( ! function_exists( 'mycred_load_referral_program' ) ) : function mycred_load_referral_program() { // BuddyPress: Hook into user activation if ( function_exists( 'buddypress' ) && apply_filters( 'bp_core_signup_send_activation_key', true ) === true ) add_action( 'bp_core_activated_user', 'mycred_detect_bp_user_activation' ); // Logged in users do not get points if ( is_user_logged_in() && apply_filters( 'mycred_affiliate_allow_members', false ) === false ) return; // Points for visits add_action( 'template_redirect', 'mycred_detect_referred_visits' ); // Points for signups add_action( 'user_register', 'mycred_detect_referred_signups_verify' ); } endif; add_action( 'mycred_init', 'mycred_load_referral_program' ); /** * Detect Referred Visits * @since 1.5.3 * @version 1.0.1 */ if ( ! function_exists( 'mycred_detect_referred_visits' ) ) : function mycred_detect_referred_visits() { do_action( 'mycred_referred_visit' ); $keys = apply_filters( 'mycred_referral_keys', array() ); if ( ! empty( $keys ) ) { wp_redirect( remove_query_arg( $keys ), 301 ); exit; } } endif; /** * Detect Referred Signups * @since 1.5.3 * @version 1.0 */ //if ( ! function_exists( 'mycred_detect_referred_signups' ) ) : // function mycred_detect_referred_signups( $new_user_id ) { // // do_action( 'mycred_referred_signup', $new_user_id ); // // } //endif; if ( ! function_exists( 'mycred_detect_referred_signups_verify' ) ) : function mycred_detect_referred_signups_verify( ){ $current_user = wp_get_current_user(); $user_id = $current_user->ID; $approved_status = get_user_meta($user_id, 'user_activation_status', true); //$approved_status = get_user_meta($new_user_id, 'user_activation_status', true); if ( $approved_status == 1 ){ do_action( 'mycred_referred_signup', $user_id ); //do_action( 'mycred_referred_signup', $new_user_id ); } else{ // execute code for user not verified. } } endif; /** * Detect Referred BP User Activation * @since 1.5.3 * @version 1.0 */ if ( ! function_exists( 'mycred_detect_bp_user_activation' ) ) : function mycred_detect_bp_user_activation( $user_id ) { do_action( 'mycred_bp_user_activated', $user_id ); } endif;
from referrel php file of the mycred plugin,
<?php if ( ! defined( 'myCRED_VERSION' ) ) exit; /** * Load Referral Program * @since 1.5.3 * @version 1.0 */ if ( ! function_exists( 'mycred_load_referral_program' ) ) : function mycred_load_referral_program() { // BuddyPress: Hook into user activation if ( function_exists( 'buddypress' ) && apply_filters( 'bp_core_signup_send_activation_key', true ) === true ) add_action( 'bp_core_activated_user', 'mycred_detect_bp_user_activation' ); // Logged in users do not get points if ( is_user_logged_in() && apply_filters( 'mycred_affiliate_allow_members', false ) === false ) return; // Points for visits add_action( 'template_redirect', 'mycred_detect_referred_visits' ); // Points for signups add_action( 'user_register', 'mycred_detect_referred_signups' ); } endif; add_action( 'mycred_init', 'mycred_load_referral_program' ); /** * Detect Referred Visits * @since 1.5.3 * @version 1.0.1 */ if ( ! function_exists( 'mycred_detect_referred_visits' ) ) : function mycred_detect_referred_visits() { do_action( 'mycred_referred_visit' ); $keys = apply_filters( 'mycred_referral_keys', array() ); if ( ! empty( $keys ) ) { wp_redirect( remove_query_arg( $keys ), 301 ); exit; } } endif; /** * Detect Referred Signups * @since 1.5.3 * @version 1.0 */ if ( ! function_exists( 'mycred_detect_referred_signups' ) ) : function mycred_detect_referred_signups( $new_user_id ) { do_action( 'mycred_referred_signup', $new_user_id ); } endif; /** * Detect Referred BP User Activation * @since 1.5.3 * @version 1.0 */ if ( ! function_exists( 'mycred_detect_bp_user_activation' ) ) : function mycred_detect_bp_user_activation( $user_id ) { do_action( 'mycred_bp_user_activated', $user_id ); } endif;
so can change directly from your suggested code in the part below? can you show me how to combine as I am not a real programmer.
if ( ! function_exists( 'mycred_detect_referred_signups' ) ) : function mycred_detect_referred_signups( $new_user_id ) { do_action( 'mycred_referred_signup', $new_user_id ); } endif;
Hi, the link of {ac_activaton_url} does not work fine to me. I clicked the link from my email address but it does not redirect back to my website. What should i do? Hope you can help me. Thanks.