Order of members results
I need some help with setting the results in a different order.
On two seperate locations I want to show the profiles with birthdays in different order.
location 1) I want to show all ‘members’ (I’ll style it in a 3 or 4 column grid), ordered by First name alphabeticly OR by birthdate excluding year. But I think the first option is easier and actually more natural to users.
From the documentation here I got this code, and took some stuff out and added the birthdate field.
This code works as in, it displays the members, add a link to the profile and adds the birthdate.
Now I just need this to be ordered by name alphabeticly.
<?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?> <?php do_action( 'bp_before_directory_members_list' ); ?> <ul id="members-list" class="item-list" role="main"> <?php while ( bp_members() ) : bp_the_member(); ?> <li> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar(); ?></a> </div> <div class="item"> <div class="item-title"> <a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a> </div> <?php do_action( 'bp_directory_members_item' ); ?> <?php echo bp_member_profile_data('field=geboortedatum');?> </div> <div class="action"> <?php do_action( 'bp_directory_members_actions' ); ?> </div> <div class="clear"></div> </li> <?php endwhile; ?> </ul> <?php do_action( 'bp_after_directory_members_list' ); ?> <?php bp_member_hidden_fields(); ?> <?php endif; ?>
Location 2) Show 5 profiles with the first upcoming birthdays.
Changing the above code with this:
if ( bp_has_members( bp_ajax_querystring( 'members' ).'&max=5' ) ) :
I get to limit the output of only 5 profiles. But I don’t know if this limit is can/will be applied before or after the order.
I would like to order these on dates after ‘today’
I now use a datepicker to add birthdate, but could add 2 seperate number fields for day and month, as I guess this will be easier to filter with.
So I did get some results, but the ordering is something I can’t figure out and would like some help with. I found a plugin before (buddypress birthday widget) but its not working as I would like it to and after earlier contact I have not received any response from the plugin def for some time now, so I’m trying to make something myself.
Hope someone can point me in the right direction.
- You must be logged in to reply to this topic.