• Resolved DogHustler

    (@doghustler)


    Hey!

    I have several problems that seems to be connected to the same issue. When I try to view a profile I get a “fatal error” page. I activated the debug.log and I get the following:

    thrown in /customers/1/8/6/redacted-website.com/httpd.www/wp-content/plugins/ultimate-member/includes/um-short-functions.php on line 181

    [02-Dec-2022 15:34:25 UTC] PHP Fatal error: Uncaught ValueError: array_combine(): Argument #1 ($keys) and argument #2 ($values) must have the same number of elements in /customers/1/8/6/redacted-website.com/httpd.www/wp-content/plugins/ultimate-member/includes/um-short-functions.php:181

    Any idea what might be causing this?

    Thanks in advance!

    //Dan

Viewing 5 replies - 1 through 5 (of 5 total)
  • @doghustler

    Do you have any code snippet using either the um_template_tags_patterns_hook or um_template_tags_replaces_hook filter hooks?

    Thread Starter DogHustler

    (@doghustler)

    Yes, I have both in the functions.php file.

    //Dan

    Thread Starter DogHustler

    (@doghustler)

    This is what I have in the functions.php:

    add_filter( 'um_template_tags_patterns_hook', 'custom_um_template_tags_patterns_hook' );
    function custom_um_template_tags_patterns_hook( $search ) {
        $search[] = '{register_address}';
    	$search[] = '{register_zip}';
    	$search[] = '{register_city}';
    	$search[] = '{mobile_number}';
    	$search[] = '{register_family}';
    	$search[] = '{register_member-id}';
    	$search[] = '{register_confirm_family}';
    	return $search;
    }
    
    add_filter( 'um_template_tags_replaces_hook', 'custom_um_template_tags_replaces_hook' );
    function custom_um_template_tags_replaces_hook( $replace ) {
    	$replace[] = get_user_meta( um_user( 'ID' ), 'register_address', true );
    	$replace[] = get_user_meta( um_user( 'ID' ), 'register_zip', true );
    	$replace[] = get_user_meta( um_user( 'ID' ), 'register_city', true );
    	$replace[] = get_user_meta( um_user( 'ID' ), 'mobile_number', true );
    	$replace[] = get_user_meta( um_user( 'ID' ), 'register_family', true );
    	$replace[] = get_user_meta( um_user( 'ID' ), 'register_member-id', true );
    	if ( get_user_meta( um_user( 'ID' ), 'register_confirm_family', true ) ) {
    		$replace[] = implode( ',', get_user_meta( um_user( 'ID' ), 'register_confirm_family', true ) );
    	}
    	return $replace;
    }

    @doghustler

    Your issue is a missing else for get_user_meta false, which makes $search and $replace different in length.

    
    if ( get_user_meta( um_user( 'ID' ), 'register_confirm_family', true ) ) {
       $replace[] = implode( ',', get_user_meta( um_user( 'ID' ), 'register_confirm_family', true ) );
    } else {
       $replace[] = '';
    }
    Plugin Support andrewshu

    (@andrewshu)

    Hi @doghustler

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread if any other questions come up and we’d be happy to help. ??

    Regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can’t view user profiles’ is closed to new replies.