PMPro with my Plugin – think I've found an error
-
Hi
I am using PMPro to restrict access to a plugin I am writing.
So for knowing the membership-level inside my own plugin, I call
pmpro_hasMembershipLevel('1')
where “1” is the ID of my only paid level.However, this always returns “false” even though the user is set to this level (manually). If I include the same code in my theme, it prints “true” which is correct.
I debugged your code and I’ve found that the error lies in
pmpro_getMembershipLevelForUser
. If I callpmpro_hasMembershipLevel('1')
from the theme, the $current_user->ID (line 1270 in functions.php of your plugin) returns “3” – which is correct for the currently logged in user. If the same function is called from my plugin, it returns “1” – which is the Admins ID.I’d really appreciate any insight into this. An easy fix would be if I could just pass
pmpro_hasMembershipLevel('1')
a 2nd attribute in the form of a user-id.Thanks
Raphael
- The topic ‘PMPro with my Plugin – think I've found an error’ is closed to new replies.