Error when setting up ref program

front page Forums Community Error when setting up ref program

This topic contains 3 replies, has 2 voices, and was last updated by Avatar WPExperts 6 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4834
    Avatar
    Fitbobcat

    I get the error of Fatal error: Call to undefined function dd_action() in /home/fitbobcat/public_html/wp-content/themes/anarcho-notepad/functions.php on line 517 when i try setting up the ref program. This has happned twice to me before. Please help me fix it. I lost the working code when i updated my theme. This time i will make suire to backup my custom code. THanks

    // THIS IS INCORRECT! There is no such thing as dd_action
    dd_action( 'user_register', 'check_for_referral_at_signup' );
    function check_for_referral_at_signup( $user_id )
    {
    	// Check for cookie
    	if ( isset( $_COOKIE['signup_ref'] ) ) {
    		// Get the referrers ID
    		$ref_user_id = mycred_get_userid_from_ref( $_COOKIE['signup_ref'] );
    
    		// Make sure ref_id is valid, if not delete the cookie to avoid further checks
    		if ( $ref_user_id === false ) {
    			setcookie( 'signup_ref', $_COOKIE['signup_ref'], time()-3600 );
    			return;
    		}
    
    		// Load myCRED
    		$mycred = mycred_get_settings();
    
    		// Make sure this is unique
    		if ( !$mycred->has_entry( 'signup_referral', $user_id, $ref_user_id ) ) {
    			$mycred->add_creds(
    				'signup_referral',
    				$ref_user_id,
    				5,
    				'%plural% for signup referral of ',
    				$user_id,
    				array( 'ref_type' => 'user' )
    			);
    		}
    
    		// Remove Cookie by setting the expiration date in the past
    		setcookie( 'signup_ref', $ref_id, time()-3600 );
    	}
    }
    
    #4838
    Avatar
    WPExperts

    Hi.

    That error message is self explenetry. You are using a function that does not exists! There is no function called dd_action it supposed to be add_action. I think you missed an “a” there.

    Go though your code and make sure you are using the correct functions.

    EDIT: I edited your code to show where the issue is.

    #4839
    Avatar
    Fitbobcat

    So what is it sopose to be there?

    #4840
    Avatar
    WPExperts

    You missed the first character when you copied and pasted the code from the tutorial.

    It supposed to be “add_action” and not “dd_action”.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

11