• Resolved wiloke

    (@wiloke)


    Hi,
    I’m facing this issue on my site: Fatal error: Uncaught Error: Call to a member function get() on null in /var/www/html/wp-content/plugins/dokan-lite/includes/functions.php:2010 Stack trace: #0 /var/www/html/wp-includes/class-wp-hook.php(286): dokan_get_avatar_url

    Please resolve this issue
    Thanks

Viewing 1 replies (of 1 total)
  • Hello @wiloke,

    I am so sorry for the unexpected inconvenience. Please replace the function using the reference below

    function dokan_get_avatar_url( $url, $id_or_email, $args ) {
    
        if ( is_numeric( $id_or_email ) ) {
            $user = get_user_by( 'id', $id_or_email );
        } elseif ( is_object( $id_or_email ) ) {
            if ( $id_or_email->user_id != '0' ) {
                $user = get_user_by( 'id', $id_or_email->user_id );
            } else {
                return $url;
            }
        } else {
            $user = get_user_by( 'email', $id_or_email );
        }
    
        if ( ! $user ) {
            return $url;
        }
    
        $vendor = dokan()->vendor;
    
        if ( ! $vendor instanceof Dokan_Vendor ) {
            return $url;
        }
    
        $vendor      = dokan()->vendor->get( $user->ID );
        $gravatar_id = $vendor->get_avatar_id();
    
        if ( ! $gravatar_id ) {
            return $url;
        }
    
        $dokan_avatar_url = wp_get_attachment_thumb_url( $gravatar_id );
    
        if ( empty( $dokan_avatar_url ) ) {
            return $url;
        }
    
        return esc_url( $dokan_avatar_url );
    }

    I hope this helps ??

Viewing 1 replies (of 1 total)
  • The topic ‘dokan_get_avatar_url issue’ is closed to new replies.