Okay
  Public Ticket #2794549
Conditional display and cookies
Open

Comments

  • Gordon started the conversation

    Is there a way to use cookie values or cookie exist check for conditional display. I need that to fully solve EU - GDPR only with Elementor. I use already unlimited elementor pro so with your unlimited lifetime version there is no need for other plugins.

    At your conditional display page you wrote "PHP Functions based Conditions" but in your demo video I don't see any option like this. A general PHP coding option for a function result would be realy powerful.

    Thanks for your help

  •  159
    Deekshit replied

    Hi Gordon,

    Thank you for contacting POSIMYTH support and please accept my apology for the misunderstanding. 

    That means, All our options are based on PHP functions so It will not have any issues cross-browser or anyway else as long as you have the proper PHP version. 

    You can not create custom rules based on PHP functions on your own in those options.

    But, That seems to be interesting, I am sharing that with our team to think about it. We will implement that in the future, Based on possibilities.

    Thanks,

    Warm Regards,
    Deekshit Nair

    I'm located in India. My timezone is IST.

  • Gordon replied

    I am a developer, but not explicit for elementor, more general php, sql, js, html, css. So my idea would be that you add an option like "PHP Condition" at the rule editor. If somebody select it there shows only a multiline text field in code view without any formater and a warning, that wrong use could force errors or complete site malfunction (like the warning for absolute positioning at elementor itself).

    The inputed code is not executed directly but in an "half-sandbox-function" captured in a try/catch block at the same position where all other conditional render functions are evalutated. For example:

    ...
    // realy simple php function or methode to execute php code in a clean as possible stack frame
    function checkPhpCondition($phpCondition) {
        // execute php condition with eval (including return command)
        eval($phpCondition);
    }
    // init as don't render it for better safety
    $renderIt = false;
    try {
        // load php condition form file or database
        $phpCondition = @file_get_contents('upload/theplus/saved_php_condition-xxx.php');
        // check php condition in an "sandbox stack frame" if not empty by itself
        $renderIt = !empty($phpCondition) && checkPhpCondition($phpCondition);
    }
    catch (Exception $exception) {
        // don't render if any error occured
        $renderIt = false;
    }
    // render it if it is true or hide it by ignoring code or render it with display none
    render($renderIt);

    Hope that helps a little bit. It's not super safe but it should work and can be used for many conditional checkups espacialy for cookie control.

  •  159
    Deekshit replied

    Hi Gordon,

    Thanks for holding and please accept my apology for the delay in reply.

    I have checked with our developer and also added it to our suggestion queue, If our team will approve it for any of our future versions, They will include that in the upcoming version of updates.

    You can follow the link here https://theplusaddons.com/client-feedback-and-suggestions/ where you can submit your request for the same.

    Thanks,

    Warm Regards,
    Deekshit Nair

    I'm located in India. My timezone is IST.

  • Gordon replied

    Hi Deekshit,

    No problem, we're all humans and need time. I will use the link to post my suggestion with a much better implementation, wich is easier, faster and more secure. Because if this functionality is added by anyway, I buy your addon-library like i posted before.

    Thanks,
    Gordon

    p.s.: Everybody need a weekend and for me it's part of my hobby and is fun to think about such ideas. ;)

  •   Gordon replied privately
  •  159
    Deekshit replied

    Hi Gordon,

    Thanks for sharing and we really appreciate the time and effort that you have taken to accomplish the task that you were looking for.

    I have forwarded the same to our developers and project manager and if they feel the code is perfectly cool and alright then we might add the same in the next major update of the plugin.

    Thanks,

    Warm Regards,
    Deekshit Nair

    I'm located in India. My timezone is IST.