- This topic has 5 replies, 3 voices, and was last updated 8 years, 6 months ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.
WordPress Membership Plugin
Simple Membership Plugin › Forums › Simple Membership Plugin › Bug in Registration code? SWPM Version 3.5.6
In the class: class.swpm-permission.php
Their appears to be a bug…
I kept getting the message ‘Invalid Membership level!’ when registering, even though my membership value (19) was definitely valid.
The code in question looks like this:
if ($level_id == 1 || $level_id == md5(1)) {
wp_die('Invalid Membership level!');
}
The reason it fails is that it when passed in my membership level of 19 that’s MD5’d to ‘1f0e3dad99908345f7439f8ffabdffc4’, then the first check of
$level_id == 1
will be true, as this is not a strict === check, but a loose one that is just checking if the value is true (which a string would be, I believe).
I updated the code to use stricter checking (===) and it works fine.
Code:
if ($level_id === 1 || $level_id === md5(1)) {
wp_die('Invalid Membership level!');
}
Obviously I have had to modify a core file, so would rather you could check and fix this if it does indeed solve the issue, as any updates will revert this back.
Thanks
Hi, thank you for posting your issue and solution. The plugin developers will further investigate your code.
Kind regards
Thank you. We will apply a fix for this.
Great!
Thank you so much for the swift response and confirmation that it is the fix.
The current Version is 3.5.6, will this make it to the next release?
Hi,
Was there any update on if this will make the next update and when that might be?
Hi, version 3.5.7 fixes this issue. Please check and let us know.
Thank you