Grimnir9 on "[Plugin: Force Login] ok, what is wrong with my code for whitelist?"

ساخت وبلاگ

Here is the code I have for the whitelist:
----------------------------------------------------------------------
/**
* Filter Force Login to allow exceptions for specific URLs.
**/
function my_forcelogin_whitelist( $whitelist ) {
/**
* Allow for specific URLs
**/
$my_whitelist = array(
$whitelist[] = site_url( '/register-2/' ),
$whitelist[] = site_url( '/lostpassword/' ),
$whitelist[] = site_url( '/blogs/2016/03/10/rules/' ),
$whitelist[] = site_url( '/radio9/' )
);

/**
* Allow for Dynamic URLs for reset password
**/

$url_path = preg_replace('/?.*/', '', $_SERVER['REQUEST_URI']);
if( '/resetpass/' === $url_path ) {
$whitelist[] = site_url($_SERVER['REQUEST_URI']);
}
/**
* Allow all Blogs to be public
**/
$url_path2 = preg_replace('/?.*/', '', $_SERVER['REQUEST_URI']);
if( '/blogs/' === $url_path2 ) {
$whitelist[] = site_url($_SERVER['REQUEST_URI']);
}
retu $whitelist;
}
add_filter('v_forcelogin_whitelist', 'my_forcelogin_whitelist', 10, 1);
----------------------------------------------------------------------
The part that doesn't work is the last part to allow all blogs.
This is the website: https://www.freedomsnetwork.com
I have permalinks set to custom using:
/blogs/%year%/%monthnum%/%day%/%postname%/

It is the Frontier theme with WordPress and buddypress (latest versions of each).
I can add specific blog URLs to the 'specific' portion of the list and they work fine.

TIA

https://wordpress.org/plugins/wp-force-login/

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 261 تاريخ : چهارشنبه 19 خرداد 1395 ساعت: 2:31