Thank you for reporting this.
Are you by any chance using automators in your levels?
Can you see if this snippet works for you:
if(in_array(398, rua_get_user()->get_level_ids())) { ?>
<p>authorized</p>
<?php } else { ?>
<p>not authorized</p>
<?php } ?>
Hi, thanks to to you as well 😉
Are you by any chance using automators in your levels?
yep these ones:
- [Synchronized Role] Include user for as long as they are Administrator
- Include user for as long as they are Logged-in
Can you see if this snippet works for you:
Yep it does work just fine 🙂
Hi,
If I understood correctly with more than one automator there’s trouble? hence the array..
if(in_array(398, rua_get_user()->get_level_ids())) { ?>
Question: should I stick to the above code or should I wait till it works with
if(rua_get_user()->has_level(398)) { ?>
The has_level() method is a misnomer when it comes to Trait automators, because it only looks at levels that have specifically been given to the user.
So in your use case, the get_level_ids() is the way to go.
In the future I will probably combine these 2 methods into something that’s simpler to use as I acknowledge that is a bit confusing.