PHP error (warning)

UID:000000 PHP: Error (E_WARNING): “Undefined array key “level-1_label““ at ./wp-content/plugins/s2member/src/includes/classes/constants.inc.php:294

Seen this quite often in error logs of my server

That’d be this line:

				define ('S2MEMBER_CURRENT_USER_ACCESS_LABEL', ($c[] = (string)@$GLOBALS['WS_PLUGIN__']['s2member']['o']['level'.$level.'_label']));

Your warning mentions “level-1_label“, which seems to be wrong. The dash seems out of place, there isn’t a $level “-1”. The normal string would be “level1_label“.

I know you’ve done customizations to your site… Could this -1 thing be related to a customization you did? Do you have any users that would have that -1? it seems to be related to the current user (for the level’s label).

level=-1 is not logged in users in some of my plugins. level=0 subscribers, level=1 is s2member-level=1 but yeah that means maybe it’s related to my checkout page.

… deleted - irrelevant.

Actually I think it was a bug in my theme that caused it. ■■■■ bugs having effect on places you never think they will while being okay elsewhere.
my plugin is fine. After fixing the bug in my theme it disappeared.
Also had a site where I discovered that the payment form was loaded out of nowhere. Deleting all comments removed it. Still not sure how that can happen. Maybe someone copied a link to the payment form into a comment or similar. Of course causing loads of PHP bugs with the form loaded but not displayed (paginated commnents).

1 Like

Nice job! Thanks for the update!

:slight_smile: