2

So as the title states, I want to specify an order for the output of the {select_member_groups} tag pair within {exp:user:register}.

I am allowing users to register in one of three member groups with ids 5, 8 and 9. This displays in ID order, however I want to be able to have them output in the order 8, 9, 5.

So I tried to do:

{exp:user:register allowed_groups="8|9|5"}

but it still outputs in the order 5, 8, 9 on the front end. I've tried various parameters on the {select_member_groups} tag and none seem to work. Can't see anything about ordering it on the docs either.

Anyone know how I can do this?

Thanks in advance!

If it helps the EE version is 2.9.2 and User version is 3.5.0.

0

Unfortunately, as of this writing the ordering of the {select_member_groups} is based on default database order (i.e. increasing group_id), and not the order set in the allowed_groups="" parameter. I recommend submitting this as a Feature Request under the specific add-on category. It'll also give other users the option to vote up the feature request, and help us prioritize features to add in upcoming versions of this add-on. :) http://support.solspace.com/support/discussions

In the meantime, using EE's {exp:query} module could get you similar data. For example:

<select name="group_id">
{exp:query sql="SELECT DISTINCT group_id, group_title
                FROM    exp_member_groups
                WHERE   group_id IN (8,9,5)
                ORDER BY FIELD(group_id, 8,9,5)"}
   <option value="{group_id}"}>{group_title}</option>
{/exp:query}
</select>
0

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.