Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 799 forks source link

Contact form pre-filling form fields with URL parameters not working for logged-in users #12975

Open leandroprz opened 5 years ago

leandroprz commented 5 years ago

Steps to reproduce the issue

  1. Click here: https://leandroperez.com.ar/en/contact/?id=contact-form-13184&g13184-subject=Prints

What I expected

The contact form should show Prints in Subject dropdown.

What happened instead

It doesn't select Prints, instead it shows the first option in the dropdown.

jeherve commented 5 years ago

https://leandroperez.com.ar/en/contact/?g13184-subject=Prints works well in my tests, Prints is selected in the dropdown as the page loads. Could you give it another try?

leandroprz commented 5 years ago

I tested using incognito mode, logged out, and that worked fine. But when I'm logged in it doesn't work.

jeherve commented 5 years ago

Do you happen to use other plugins to customize Jetpack's default behaviour on your site? Do you for example use the jetpack_auto_fill_logged_in_user filter on your site?

leandroprz commented 5 years ago

These are the filters I'm using on my site:

/**
 * Modificaciones Jetpack
 */

// Remove Related Posts from Fluxus galleries
function exclude_jetpack_related_from_products( $options ) {
    if ( is_singular( 'fluxus_portfolio' ) ) {
        $options['enabled'] = false;
    }

    return $options;
}
add_filter( 'jetpack_relatedposts_filter_options', 'exclude_jetpack_related_from_products' );

//Desactivar devicepx de Jetpack (https://ayudawp.com/quitar-devicepx-jetpack-js-acelerar-web/)
function remove_devicepx() {
    wp_dequeue_script( 'devicepx' );
}
add_action( 'wp_enqueue_scripts', 'remove_devicepx' );

// Agrega Jetpack shortlinks a WooCommerce (https://jetpack.com/support/wp-me-shortlinks/)
add_action('init', 'my_custom_init');
function my_custom_init() {
    add_post_type_support( 'product', 'shortlinks' );
}

// Hace funcionar Photon en WooCommerce short descriptions (https://github.com/Automattic/jetpack/issues/11732#issuecomment-477546113)
function jeherve_photonize_woo_short_description_images( $short_description ) {
    if ( class_exists( 'Jetpack_Photon' ) ) {
        $short_description = Jetpack_Photon::filter_the_content( $short_description );
    }

    return $short_description;
}
add_filter( 'woocommerce_short_description', 'jeherve_photonize_woo_short_description_images' );

// Desactiva Photon para algunas imagenes y post IDs (https://jetpack.com/2013/05/03/skip-a-image-with-photon/)
function my_photon_exception( $val, $src, $tag ) {
        if ( $src == 'https://leandroperez.com.ar/wp-content/uploads/2018/06/taller-fotografia-timelapse.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2018/06/taller-fotografia-nocturna.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2018/07/taller-fotografia-basica.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2018/06/taller-revelado-lightroom.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/custom-images/boton-yt.png' || $src == 'https://leandroperez.com.ar/wp-content/uploads/custom-images/boton-patreon-es.png' || $src == 'https://leandroperez.com.ar/wp-content/uploads/custom-images/boton-yt-en.png' || $src == 'https://leandroperez.com.ar/wp-content/uploads/custom-images/boton-patreon-en.png' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2018/11/timelapse-photography.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2018/11/astrophotography-workshop.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2018/11/introduction-to-photography-workshop.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2018/11/lightroom-workshop.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2019/06/curso-edicion-timelapse-inicial.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2019/02/curso-edicion-timelapse-intermedio.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2019/02/curso-edicion-timelapse-avanzado.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2019/06/introduction-timelapse-editing-course.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2019/02/intermediate-timelapse-editing-course.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2019/02/advanced-timelapse-editing-course.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2019/05/curso-timelapse-dia-a-noche-1.jpg' || $src == 'https://leandroperez.com.ar/wp-content/uploads/2019/05/day-to-night-timelapse.jpg') {
                return true;
        }
        return $val;
}
add_filter( 'jetpack_photon_skip_image', 'my_photon_exception', 10, 3 );

function no_photon_by_page() {
  if ( is_page( 144 ) || is_page( 13191 ) ) {
    add_filter( 'jetpack_photon_skip_image', '__return_true');
  }
}

add_action('wp', 'no_photon_by_page');

// Oculta publicidad Jetpack en el dashboard y en las busquedas (https://ayudawp.com/quitar-sugerencias-busqueda-jetpack/)
add_filter( 'can_display_jetpack_manage_notice', '__return_false', 20 );
add_filter( 'jetpack_just_in_time_msgs', '__return_false', 20 );
add_filter( 'jetpack_show_promotions', '__return_false', 20 );
jeherve commented 5 years ago

Thank you. None of this should cause any issues, so this is something we'll need to fix.

joendotcom commented 5 years ago

This seemingly only affects logged in users (updated title to reflect this).

Test case:

https://joentest1.mystagingwebsite.com/form-block-test/?g388-website=example.com

Logged in view:

Screen Shot 2019-10-30 at 12 06 01

Logged out view:

Screen Shot 2019-10-30 at 12 05 43

Interestingly, the default prefill values don't show either for logged in user.

stale[bot] commented 4 years ago

This issue has been marked as stale. This happened because:

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

leandroprz commented 4 years ago

This seemingly only affects logged in users (updated title to reflect this).

I can confirm this. I'm still experiencing this issue with Jetpack v8.4.2