• I am creating an online theatre that only shows the video footage people who are logged on as “Customers” or above.

    To set this up I have custom code in my template ie: is_user_logged_in() then show embed code.

    I would like the page to be shown to all ages and the gate only shown when someone is logged in and the age has been set on that particular.

    Could I do this by adding a hook or scrip with my video embed code to pull up the gateway if the person is logged in and the age has been set?

    Any help appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Phil

    (@philsbury)

    Hi @sprocker,

    If I understand right, you should be able to set the plugin to “Selected Content” mode and also selected the “Varied ages” option. This will allow you to choose what pages to restrict and what not to. Then to only show the age check for logged in users, you can indeed use a hook, something like this should do it:

    
    add_filter('age_gate_restricted', function($restricted){
      if (!is_user_logged_in()) {
        return false;
      }
      return $restricted;
    });
    

    Hope that’s what you need.

    Thanks
    Phil

    Thread Starter sprocker

    (@sprocker)

    Perfect!!! thanks!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Apply when a condition part of page loaded’ is closed to new replies.