• I would like to intercept if there is a variable in the GET for example “? nameofvar =” and, if present, display a module as an alternative to hide it

    if(isset($_GET['nameofvar'])) {
    ?>

    <style type="text/css">#iframeEstarGroupSlider{display:none;}</style>
    <style type="text/css">#iframeEstarGroup{display:visible;}</style>
    <?php

    }
    else {
    ?>
    <style type="text/css">#iframeEstarGroup{display:none;}</style>
    <style type="text/css">#iframeEstarGroupSlider{display:visible;}</style>

    this works but when I try to change the page in the admin section with divi-builder it gives me error loading framework. Everything works correctly in the frontend.

Viewing 1 replies (of 1 total)
  • I have had issue with DIV Builder, the newest version, and this plugin. What was happening is that with more complex challenges I was getting JS error and when trying to Update the post or page it would attempt to open the Preview view in a new tab.

    Very frustrating.

    So, to overcome this, I created custom functions to do the work in the child theme functions.php file. For example, I am using WPFORO as a discussion board and have a section at the top of the main forums page that will give “hints” as to what to do next when a user is not logged in.

    Here’s the function:

    function is_okay_to_show_login_hint()
    {
        $url = wpforo_get_request_uri();
        return !is_user_logged_in() && ($_GET['wpforo'] != 'signin' && $_GET['wpforo'] != 'signup') && !strpos($url, 'public-discussions');
    }

    Now, instead of doing a complex challenge within the “Visibility” part of DIVI, I simply add a call to my custom function.

    is_okay_to_show_login_hint()

    This method works well and while it may require that you create multiple purpose built functions, it seems to be the most reliable.

    Note:

    The real problem is that the script (content-visibility-for-divi-builder.php) is not effectively decoding the characters in the string $atts[‘cvdb_content_visibility_check’]. So when you have left/right brackets they fail the eval. To tackle this, I added my own set of decodes in content-visibility-for-divi-builder.php in the add_filter bit starting at line #352.

    // List of circumstances
    $ar_encoded_vals = array(
        '%22',
        '%5D',
        '%91',
        '%93'
    );
    // List of solutions
    $ar_decoded_vals = array(
        '"',
        ']',
        '[',
        ']'
    );
    
    // Do the solutions for the circumstances
    $fixed_cvdb_content_visibility_check = str_replace($ar_encoded_vals, $ar_decoded_vals, $atts['cvdb_content_visibility_check']);
    // eval and cross your fingers.
    eval('$visibility = ' . $fixed_cvdb_content_visibility_check . ';');

    I will, however, continue to use custom functions. It is update proof.

    • This reply was modified 5 years, 8 months ago by moongear.
    • This reply was modified 5 years, 8 months ago by moongear.
    • This reply was modified 5 years, 8 months ago by moongear.
Viewing 1 replies (of 1 total)
  • The topic ‘hide block when $ _GET variable intercept’ is closed to new replies.