SAML-Toolkits / wordpress-saml

OneLogin SAML plugin for Wordpress
MIT License
65 stars 74 forks source link

is_plugin_active #129

Open kevstev01 opened 2 years ago

kevstev01 commented 2 years ago

I've installed the wordpress-saml plugin (Word Press Version 5.9.1, PHP 7.4) and I'm seeing an error 'function not found : is_plugin_active' when I use the /wp-login.php?normal option (SAML wasn't configured correctly, so I was trying to get to a standard wordpress login).

I fudged the PHP code in saml_custom_login_footer() to get past the error by using :

if (1 || is_plugin_active('wps-hide-login/wps-hide-login.php')) {
    $login_page = str_replace( 'wp-login.php', get_site_option( 'whl_page', 'login' ), $login_page ) . '/';
}

but not being fluent in wordpress development, there's probably a better way...

Tea23 commented 2 years ago

Can confirm the issue in Wordpress 5.9.3, the above fix worked for me to get around it in two of my sites. But yeah - I'm also not fluent in Wordpress (or PHP) so it would be good to have a solid upstream fix.

gthayer commented 2 years ago

^ Submitted a patch for handling this.

michael-sumner commented 9 months ago

I've filed a similar PR to address where the function does not need to exist and instead relies on the active_plugins option:

This fixes the issue with:

PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function is_plugin_active() in /code/wp-content/plugins/onelogin-saml-sso/php/functions.php:108

Hope this helps!