Error notices appearing in backend

  • Mabul

    #51174

    Hi, after updating to the latest WordPress today, I have received error warnings in the backend when trying to create a new post. The warnings appear just above “Add title”.

    Warning: strlen() expects parameter 1 to be string, object given in /home4/xxxxxx/public_html/xxxxxx.com/wp-includes/formatting.php on line 3380
    Warning: strlen() expects parameter 1 to be string, object given in /home4/xxxxxx/public_html/xxxxxx.com/wp-includes/formatting.php on line 3380
    Warning: strlen() expects parameter 1 to be string, object given in /home4/xxxxxx/public_html/xxxxxx.com/wp-includes/formatting.php on line 3380
    Warning: Cannot modify header information – headers already sent by (output started at /home4/xxxxxx/public_html/xxxxxx.com/wp-includes/formatting.php:3380) in /home4/xxxxxx/public_html/xxxxxx.com/wp-admin/admin-header.php on line 9

    Thankfully the front end seems okay, I was able to create the post. However, the notices in the backend won’t go away. Please advice, thank you.

    Admin

    Syahir Hakim

    #51175

    Thanks for the report. This is indeed a bug and we’ll release an update shortly to fix the issue.

    In the mean time, if you’d like to apply the fix yourself, follow these steps:

    1. Edit the file graphene/inc/user.php.
    2. Replace the function called graphene_pre_get_avatar_data with the following code:
    /**
    * Replace the user's Gravatar with custom user avatar
    */
    function graphene_pre_get_avatar_data( $args, $id_or_email ) {
    
    	$user_id = 0;
    
    	
    	if ( is_object( $id_or_email ) ) {
    
    		/* If this is a comment object, check if user is registered */
    		if ( isset( $id_or_email->comment_ID ) ) {
    			if ( $id_or_email->user_id ) $user_id = $id_or_email->user_id;
    			else {
    				$user = get_user_by( 'email', $id_or_email->comment_author_email );
    				if ( $user ) $user_id = $user->ID;
    			}
    		} else {
    			$user_id = $id_or_email->ID;
    		}
    	
    	} else if ( is_numeric( $id_or_email ) ) {
    		/* If this is the user ID, set it as such */
    		$user_id = $id_or_email;
    
    	} else if ( is_string( $id_or_email ) && is_email( $id_or_email ) ) {
    		/* If this is email, see if it's a registered user */
    		$user = get_user_by( 'email', $id_or_email );
    		if ( $user ) $user_id = $user->ID;
    	}
    
    	/* Get the custom user image, if available */
    	if ( $user_id ) {
    		$user_image = get_user_meta( $user_id, 'graphene_author_imgurl', true );
    		if ( $user_image ) $args['url'] = esc_url( $user_image );
    	}
    
    	return $args;
    }
    add_filter( 'pre_get_avatar_data', 'graphene_pre_get_avatar_data', 10, 2 );
    

    Mabul

    #51182

    It’s now fixed, thank you as always for your help.

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

  • You must be logged in to reply to this topic.