1

I have this conditional

{if '{logged_in_group_id}' == '{exp:config_variables:get name="xxxxx"}'}...

where {logged_in_group_id} is equal to 3

and {exp:config_variables:get name="xxxxx"} is equal to 3

But why does this conditional return false?

I have also tried using a literal value

{if '{logged_in_group_id}' == '3'}... {if '3' == '{exp:config_variables:get name="xxxxx"}'}...

but they still returned false.

What is wrong with this?

1
4

Your problem is parse order, and there may be several workarounds for that... however, (and I'm guessing a bit at what you're trying to do) I would suggest that instead of using this unusual exp:config_variables add-on and faffing about with parse order that you use the assign_to_config array to create your own early-parsed global variables. Then you can do a nice clean:

{if logged_in_group_id == {gv_special-group-id}}...{/if}

You can achieve this as documented either in the main index.php file, or if you prefer with a little trickery you can do it in your config.php file like this.

0

Have you tried it without using quotes around the variables?

For example, instead of '{logged_in_group}' you should just say {logged_in_group}

If you use quotes, I believe you are actually comparing strings, instead of comparing the values, and that means you are literally comparing the string {logged_in_group} to 3 instead of getting the value and comparing the two integers.

4
  • I tried it without quotes and even without the curly braces. It still evaluated the conditional wrong. Jan 6 '14 at 23:07
  • I assume you probably have, but have you output the contents of those variables to ensure they are actually returning the integer 3 as expected?
    – enga
    Jan 6 '14 at 23:24
  • Yes, I have and they are exactly what I expected Jan 7 '14 at 0:10
  • I gave a vote to the answer from James, as I feel parse order makes sense as the likely culprit then.
    – enga
    Jan 8 '14 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.