VMG Chosen Member
ExpressionEngine 2, ExpressionEngine 3
Back to this add-on's main page
View Other Add-ons From Luke Wilkins
Can you order by custom member fields?
Support Request
PellucheCreative
|
Posted: 07 August 2017 10:44 AM |
|
|
|
I’m trying to display all the VMG Chosen Members based off custom fields, but I get a page error when I try to do anything besides basic email.
I’m displaying custom fields in the loop with {cm_player_rating} and {cm_full_name} but if I try to add those 2 in the orderby paramater it crashes page. I tried it without the cm_ prefix as well
|
|
|
Luke Wilkins
|
Posted: 07 August 2017 04:09 PM |
# 1
|
|
Developer
|
PellucheCreative, can you paste your template logic here so that I can have a look. Just want to make sure I’m following what you’re trying to do.
|
|
|
PellucheCreative
|
Posted: 07 August 2017 04:20 PM |
# 2
|
|
|
Here’s part of the code… Right now Chosen displays all the players based on when they were selected or by ID… in my table, i want to list all the “member_players” ordered by their custom member fields of “player_rating” and then by “full_name”. So players are listed based off A, A-, B, C, etc. “player_rating” is a text field with whatever rating they are.
<tbody> {exp:channel:entries channel="teams" limit="1" entry_id="{embed:team-id}" disable="pagination" dynamic="no" } <? $playerCount = 1; ?>
{member_players} {if {cm_member_id} != {team_captain}} <tr> <td><? echo $playerCount; ?></td> <td>{cm_full_name}</td> <td>{cm_player_rating}</td> <td>{cm_gender}</td> <td>Yes</td> <td>No</td> </tr> <? $playerCount++; ?> {/if} {/member_players}
|
|
|
PellucheCreative
|
Posted: 10 August 2017 10:50 AM |
# 3
|
|
|
any idea if i can do this?
|
|
|
Luke Wilkins
|
Posted: 11 August 2017 09:05 AM |
# 4
|
|
Developer
|
You should be able to add “order_by” and “sort” parameters to you chosen tags to handle that.
Custom member fields: {member_players order_by="m_field_id_3" sort="asc"}...{/member_players}
Note that you’ll want to use the raw field name from the exp_member_data table if you are wanting to sort by those.
|
|
|
PellucheCreative
|
Posted: 11 August 2017 09:34 AM |
# 5
|
|
|
ahh, the raw field id . I’ll test that out. thank you so much!
|
|
|