Member Directory: Nav that filters members by first letter of last name
I am developing a custom Buddypress theme, and I would like to add navigation in the member directory that mimics the functionality of this page on another site:
Ideally, it would work pretty similarly: the navigation would have a link for each letter of the alphabet, the links would generate bookmarkable urls with query strings, and the member directory would be filtered appropriately at those urls.
Code for the navigation would be something like this:
<?php for ($i=0; $i<26 ;++$i ): $this_letter = chr(ord('A') + $i); ?> <a href="<?php echo add_query_arg('Last+name+first+letter', $this_letter, bp_get_members_directory_permalink()); ?>"><?php echo $this_letter; ?></a> <?php endfor; ?>
What would be the most appropriate place to hook into to alter the member query? Again, ideally it would be able to grab the query string from the url to dynamically define the filter.
Right now, there is an XProfile ‘Last Name’ field, which is set up to sync with wp_usermeta#last_name through the plugin, “BP XProfile WordPress User Sync”.
Using WP 4.1 & BP 2.1.1
- The topic ‘Member Directory: Nav that filters members by first letter of last name’ is closed to new replies.