Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Vjekoslav Vu?i?

    (@vjekoslavvucic)

    Hi

    Commenting code directly in the plugin is one of my old bad habits.
    I use it as the fastest solution when something gets stuck. It is not sustainable in the long term because it is ugly and dirty.
    Meanwhile, I found a better solution.
    I dequeue and deregister the scripts and styles that are causing me problems.
    In this case, the script and style ‘tooltipster’ are enqueued in the MDTF plugin.
    It should be added to functions.php:

    
     * Dequeue JavaScript or Stylesheet.
     */
    function mdtf_dequeue_tooltipster()
    {
    	// Scripts
    	wp_dequeue_script( 'tooltipster' );
    	wp_deregister_script( 'tooltipster' );
    
    	// Styles
    	wp_dequeue_style( 'tooltipster' );
    	wp_deregister_style( 'tooltipster' );
    }
    add_action( 'wp_enqueue_scripts', 'mdtf_dequeue_tooltipster', 100 );

    By the way, the TEC plugin has a data filtering addon.
    Considering that I work as a volunteer on the ‘in memoriam’ project, I am looking for free solutions for all the victims who died in the war in Bosnia and Herzegovina from 1991 to 1995.
    I am volunteering to digitize some historical books, which is my contribution to peace as a war veteran, “Five for the Future” on my way.
    Otherwise, for a commercial project, I would pay for the PRO version of the TEC plugin and the filter addon and thus support the developers of this great plugin.
    I will mark this topic as solved. Maybe it was more appropriate to ask for help elsewhere. I apologize for that.

    Regards

    Thread Starter Vjekoslav Vu?i?

    (@vjekoslavvucic)

    I haven’t found the source of the bug because it’s a lot of nice code that someone else wrote.
    But I found a better workaround.
    I added a filter to functions.php:

    add_filter( "tribe_events_views_v2_view_list_public_views", function ($public_views) {
    	$url_day = remove_query_arg( 'paged', $public_views['day']->view_url );
    	$public_views['day']->view_url = $url_day;
    	return $public_views;
    });

    Maybe someone will come forward with a better workaround.
    Regards

    Thread Starter Vjekoslav Vu?i?

    (@vjekoslavvucic)

    Hi @jdbeacham!
    I have tested for plugin or theme conflict but the behavior is the same.
    I have deleted all plugins, not just deactivated ones. The active theme is Twenty Twenty, and after switching to the day view I can see that the URL parameter “paged” is still here. I don’t use any caching because the site I have created today is just for this testing.
    Only one plugin is installed and activated – The Events Calendar.
    Do you have any other ideas?
    Thanks for your help!
    Vjekoslav

    Thread Starter Vjekoslav Vu?i?

    (@vjekoslavvucic)

    Hi,
    Thanks again for your great job!
    I wish you all the best in your future work.
    I will mark it as resolved because you created Bug Ticket.

    Thread Starter Vjekoslav Vu?i?

    (@vjekoslavvucic)

    Good morning (afternoon?) from beautiful BA, from sunny Mostar.
    We say “The morning is smarter than the evening”.
    So here is my final refactor of the functions-recaptcha.php, release 2.0.4:

    1. Remove completely your added filter ‘lostpassword_post’ lines 240-262.
    2. Change function uv_wc_lostpassword_form_validate($validation_errors) lines 491-516 to:
    function uv_wc_lostpassword_form_validate($validation_errors)
    {
    
        $user_verification_settings = get_option('user_verification_settings');
        $wc_lostpassword_form = isset($user_verification_settings['recaptcha']['wc_lostpassword_form']) ? $user_verification_settings['recaptcha']['wc_lostpassword_form'] : '';
        $default_lostpassword_page = isset($user_verification_settings['recaptcha']['default_lostpassword_page']) ? $user_verification_settings['recaptcha']['default_lostpassword_page'] : '';
        $captcha_error = isset($user_verification_settings['messages']['captcha_error']) ? $user_verification_settings['messages']['captcha_error'] : __('Captcha Error. Please try again.', 'user-verification');
        $secretkey = isset($user_verification_settings['recaptcha']['secretkey']) ? $user_verification_settings['recaptcha']['secretkey'] : '';
        $res = isset($_POST['g-recaptcha-response']) ? sanitize_text_field($_POST['g-recaptcha-response']) : '';
    
        if ($wc_lostpassword_form == 'yes' || $default_lostpassword_page == 'yes' && isset($_POST['g-recaptcha-response'])) :
    
            $response = wp_remote_get("https://www.google.com/recaptcha/api/siteverify?secret=" . $secretkey . "&response=" . $res);
            $response = json_decode($response["body"], true);
    
            if ($response["success"] != true) {
                $validation_errors->add('registerCaptchaError', $captcha_error);
            };
    
        endif;
    }

    Hope that my small contribution is good enough because User Verification is really what I need.
    Mika Epstein, author of the Register IP’s wrote in the plugin description:
    “Spam is one thing, but trolls and sock puppets are another.
    Sometimes people just decide they’re going to be jerks and create multiple accounts with which to harass your honest users…”

    Please, don’t be too strict, I am new in the PHP world.

    Regards

    Thread Starter Vjekoslav Vu?i?

    (@vjekoslavvucic)

    Hi!
    
    I did it on my way, and I am sure that you can do it better.
    
    Commented out functions-recaptcha.php line 240, then modified function on line 491:
    
    function uv_wc_lostpassword_form_validate($validation_errors)
    
    So, now action hook and filter are merged into one function. If both last password forms reCAPTCHA are set to Yes, wp_remote_get("https://www.google.com/recaptcha/api/siteverify?...") will be executed only once. Maybe it is a dirty solution, but it works.
    
    Regards,
    
    function uv_wc_lostpassword_form_validate($validation_errors)
    
    {
    
        $user_verification_settings = get_option('user_verification_settings');
    
        $wc_lostpassword_form = isset($user_verification_settings['recaptcha']['wc_lostpassword_form']) ? $user_verification_settings['recaptcha']['wc_lostpassword_form'] : '';
    
        $default_lostpassword_page = isset($user_verification_settings['recaptcha']['default_lostpassword_page']) ? $user_verification_settings['recaptcha']['default_lostpassword_page'] : '';
    
        $captcha_error = isset($user_verification_settings['messages']['captcha_error']) ? $user_verification_settings['messages']['captcha_error'] : __('Captcha Error. Please try again.', 'user-verification');
    
        $secretkey = isset($user_verification_settings['recaptcha']['secretkey']) ? $user_verification_settings['recaptcha']['secretkey'] : '';
    
        $res = isset($_POST['g-recaptcha-response']) ? sanitize_text_field($_POST['g-recaptcha-response']) : '';
    
        if ($wc_lostpassword_form == 'yes' || $default_lostpassword_page == 'yes' && isset($_POST['g-recaptcha-response'])) :
    
            $response = wp_remote_get("https://www.google.com/recaptcha/api/siteverify?secret=" . $secretkey . "&response=" . $res);
    
            $response = json_decode($response["body"], true);
    
            if ($response["success"] != true) {
    
                $validation_errors->add('registerCaptchaError', $captcha_error);
    
            };
    
        endif;
    
        return $validation_errors;
    
    }
    Thread Starter Vjekoslav Vu?i?

    (@vjekoslavvucic)

    Hi!
    It was fantastic and a super fast reaction!
    As I can see at first sight everything is working as expected now.
    If something goes wrong in the future I’ll let you know.
    Regards

Viewing 7 replies - 1 through 7 (of 7 total)