Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
is_plugin_active error
Avatar
rb22
Member
sp_UserOfflineSmall Offline
Sep 29, 2015 - 4:14 pm

I see this is being discussed again ... in relation to a post by Robert V.

To review what I said previously see here:

https://simple-press.com/suppo.....ion-error/

Like Robert, I too just notice this error today on the forum admin profiles page.

Fatal error: Call to undefined function is_plugin_active() in /home/XXXXX/public_html/XXXX/wp-content/plugins/simple-press/admin/panel-profiles/forms/spa-profiles-options-form.php on line 71

However, if I insert

 include_once(ABSPATH.'wp-admin/includes/plugin.php');

into sp-load-admin.php

I don't get the error.

I was on this profile admin page because I was trying to set the profile display mode to use buddypress the buddypress member profile. I was puzzled because I had done a virgin in stall of wp/sp/buddypress to see if I got the is_plugin_active error and I did not. Therefore I thought something was wrong with my normal installation.

However, now I think that in fact is_plugin_active is not visible to simple-press. If I insert the function is_plugin_active into a random simple press file that is not subject to if/then conditions, I get the error. 

I think the reason you/I were not getting the error on test installations was because you/I weren't using mode = 3 .... i.e.  for buddypress/mingle profiles.

you can test whether is_plugin_active is visible regardless of the mode by inserting

echo is_plugin_active('buddypress/bp-loader.php');

above

    if (($mode == 3 && !is_plugin_active('buddypress/bp-loader.php')) || ($mode == 6 && !is_plugin_active('mingle/mingle.php'))) {
        $mode = 1;
    }

in the file:

sp-api/sp-api-common-display.php

(I think you'll get the error.)

I also did not get the error on the virgin install initially because I had no forums posts and thus not user profile link would be displayed and therefore the offending function would not be called.

Finally, it further seems that is_plugin_active is not supposed to be visible. Perhaps wp increased security recently?

https://codex.wordpress.org/Fu.....gin_active

"NOTE: defined in wp-admin/includes/plugin.php, so this is only available from within the admin pages, and any references to this function must be hooked to admin_init or a later action. If you want to use this function from within a template, you will need to manually require plugin.php, an example is below. "

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 30, 2015 - 12:18 am

quite strange... and not sure why it wouldnt be more widespread as we have many users (including our tests) that would hit the code you mention...

but the wp docs you link to is pretty clear...  thanks for that info...

will open a ticket and do some testing...  and see if we need to get a fix in place (the docs do indicate we do)...  and since we use that function elsewhere too, will check those...

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 3, 2015 - 10:20 am

okay, so have fixed this up for the next version - thanks for the great help!

you of course already have a fix in place, but for those that may find this, in sp-api-common-display, php, around line 309 (will vary by version), find

    if (($mode == 3 && !is_plugin_active('buddypress/bp-loader.php')) || ($mode == 6 && !is_plugin_active('mingle/mingle.php'))) {

and change it to

    include_once(ABSPATH.'wp-admin/includes/plugin.php');
    if (($mode == 3 && !is_plugin_active('buddypress/bp-loader.php')) || ($mode == 6 && !is_plugin_active('mingle/mingle.php'))) {

thanks again....

Avatar
rb22
Member
sp_UserOfflineSmall Offline
Oct 16, 2015 - 10:39 am

Cool. As always you guys are quick to resolve issues. Thanks for the feedback.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 16, 2015 - 10:41 am

With thanks from us to the people who helped us resolve things...

andy-signature.png
YELLOW
SWORDFISH
Avatar
FidoSysop
Clearwater Florida
Member

VIP
sp_UserOfflineSmall Offline
Nov 19, 2015 - 11:47 am

Fixed my problem.. Much obliged!

  • Doc ~ An old Fidonet SysOp. Just hanging out in cyberspace keeping up with tech.
Avatar
Ike
Sawtry, UK
Member
Free Members
sp_UserOfflineSmall Offline
Nov 19, 2015 - 6:07 pm

Glad this helped!

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626