Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional Logic "User / logged in" not working #21

Open
eatse21 opened this issue May 17, 2024 · 0 comments
Open

Conditional Logic "User / logged in" not working #21

eatse21 opened this issue May 17, 2024 · 0 comments

Comments

@eatse21
Copy link

eatse21 commented May 17, 2024

The issue is here:

private function evaluateUserCondition($key, $operator, $value)
{
if ($key == 'authenticated') {
return is_user_logged_in();
}

It directly returns the value of is_user_logged_in() without applying any conditional logic.
So if the user is connected, the snippet always runs, and if not, it will never do

I quickly resolved that using this patch, but maybe you have a better way to do this in your codebase

if ($key == 'authenticated') {
  return $value == (is_user_logged_in() ? 'yes' : 'no');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant