Support » Plugin: Agy - Age verification for WooCommerce » How to dont show this box to logged in users?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Jerry

    (@phyrax)

    How can I do that thing?

    Could you please change that code for logged-in users? My php experience is so weak. Please help me.

    /**
     * Maybe Show Dialog
     * @param  bool $bool    Default true
     * @param  WP_Post  $post_ob A WP_Post object
     * @return bool           True to show the dialog, false to hide it.
     */
    function maybe_show_dialog( $bool = true, $post_ob = null ) {
        if ( is_user_logged_in() ) {
            return false;
        }
    
        return $bool;
    }
    add_filter( 'cwv3_should_gate', 'maybe_show_dialog', 10, 2 );

    Ive changed that code with this , is that correct for logged-in users?
    and where to put it? in functions.php?

    Jerry

    (@phyrax)

    Looks about right yes.

    I put it in plugins file.
    Shall I put it in my child theme’s function php?

    It works when I put that code into plugin’s file footer.
    But it doesnt work when I put that code into my child theme functions.php.

    If you update your plugin my code will be removed. How can I prevent this?

    Jerry

    (@phyrax)

    If you update the plugin, yes, it will be removed. It should be put in the theme functions.php file. If it does not work with your current theme try the default to see if it’s theme related.

    I am already using twenty fifteen theme so its a default theme. Which place should I put that code into my child theme functions php ?
    Or is there a way to create child plugin?

    Jerry

    (@phyrax)

    The code should go in your functions.php file, and there is no easy way to create a child plugin.

    In which location on functions.php? upper ones or below? thanks maybe i cannot put the code into the correct place in child theme functions.php, thats why its not working on functions..?

    Or could you please add this code as an option in the future release of this plugin? I am ready to help you to improve this plugin .

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How to dont show this box to logged in users?’ is closed to new replies.