Bypass login page

admin2025-01-07  3

I have a WordPress website where being logged in is mandatory for direct access. The website offers video posts. So the user needs to login if they wants to watch the videos. Also I have provided an iframe link for every video. The user can't use the iframe until logging into WordPress, then refreshing the page that contains the iframe in order to play the video.

My question: is there a way to bypass the login page if the video is accessed not using an iframe? Note that, all the iframe links used are to another known website inside my organization.

Here is an iframe link example:

<iframe width="400" height="250" src="/?action=getembedcode&v=1851254" frameborder="0" allowfullscreen></iframe>

The plugin I use to force login is "Force Login".

I have a WordPress website where being logged in is mandatory for direct access. The website offers video posts. So the user needs to login if they wants to watch the videos. Also I have provided an iframe link for every video. The user can't use the iframe until logging into WordPress, then refreshing the page that contains the iframe in order to play the video.

My question: is there a way to bypass the login page if the video is accessed not using an iframe? Note that, all the iframe links used are to another known website inside my organization.

Here is an iframe link example:

<iframe width="400" height="250" src="https://example.com/?action=getembedcode&v=1851254" frameborder="0" allowfullscreen></iframe>

The plugin I use to force login is "Force Login".

Share Improve this question edited May 17, 2020 at 0:41 fuxia 107k38 gold badges255 silver badges459 bronze badges asked May 16, 2020 at 19:20 Jaifar Al ShizawiJaifar Al Shizawi 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

You can bypass Force Login based on any condition by adding the v_forcelogin_bypass filter to your theme's functions.php file. You may also use the WordPress Conditional Tags.

For example:

/**
 * Bypass Force Login to allow for exceptions.
 *
 * @param bool $bypass Whether to disable Force Login. Default false.
 * @return bool
 */
function my_forcelogin_bypass( $bypass ) {
  if ( is_single() ) {
    $bypass = true;
  }
  return $bypass;
}
add_filter( 'v_forcelogin_bypass', 'my_forcelogin_bypass' );

I suggest you try the following bypass method:

Method 3 – Page URL based on Query String Parameter(s) and/or Value(s)

For example:

// Allow iframe videos
if ( $_GET['action'] == 'getembedcode' && isset( $_GET['v'] ) ) {
  $bypass = true;
}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736265301a1035.html

最新回复(0)