Duplicating a variable group failing with Replace Suffix
Is there a known limit to the field name length in Low Variables?
We have an install where we are trying to duplicate a group (Save as a new group > Duplicate variables > Replace Suffix).
It seems that when duplicating a group with an existing long suffix, the new group is created but the variables are not duplicated. However, groups with more normal-length suffixes duplicate as expected.
Is this potentially related to field name length limits (and silently failing on duplicating the fields)? Any other suggestions to follow?
Replies
Low 18 Sep 2014 07:02
The variable_name column in the exp_global_variables table (on which LV builds) has a limit of 50 characters. Any variable name longer than that will be truncated by MySQL to 50.
What are the names in your group? Can you give me some examples?
Shanan Galligan 18 Sep 2014 10:34
A good example:
If I duplicate a group with the name "Desert West - CA" with the suffix "desert-west-california" to a group with the name "Desert West - Test" using the suffix "desert-west-test", a new group is created but no variables are carried over. Full variables names from the first group include:
• uss-nonabcdef-product_desert-west-california
• uss-welcome-slideshow_desert-west-california
However, duplicating the same group with the name "Chicago" with the suffix "chicago" to a group with the name "Desert West - Test" using the suffix "desert-west-test" works as you would expect, with a new group created that carries over all the new variables. Full variables from this Chicago group include:
• uss-nonabcdef-product_chicago
• uss-welcome-slideshow_chicago
Low 18 Sep 2014 12:19
Looks like the suffix check doesn't allow dashes in the suffix, so those are skipped.
To fix, open up mcp.low_variables.php and look up line 1671, which reads
and change that to
...which should fix it.
Shanan Galligan 19 Sep 2014 17:18
Fantastic -- thank you for the fix!