Add custom xprofile links
-
Hi guys!
You already helped me to remove the xprofile links and to display a filtered view of all members on my homepage (https://buddypress.org/support/topic/display-filtered-overview-of-members/#post-231596).
So I hope you can help me once again.
I’ve build a network for athletes. Among many other profile fields every athlete have a profile field called “gender” and “sport”. As already mentioned I’ve filtered this on my landing page for a nice overview. The code for female athletes looks like this:<?php $sports = array('Archery', 'Badminton', 'Baseball', 'Basketball', 'Bowling', 'Equestrian', 'Fencing', 'Field Hockey', 'Football', 'Golf', 'Gymnastics', 'Ice Hockey', 'Lacrosse', 'Rifle', 'Rowing', 'Skiing (Cross Country)', 'Skiing (Downhill)', 'Soccer', 'Softball', 'Squash', 'Swimming and Diving', 'Tennis', 'Track and Field', 'Volleyball', 'Water Polo', 'Wrestling'); $sportsSize = sizeof($sports); $femaleCounter = 0; for ($i = 0; $i < $sportsSize; $i++) { $femaleSport = $wpdb->get_var( "SELECT COUNT(user_id) FROM ar_bp_xprofile_data WHERE value = 'female' AND user_id IN (SELECT user_id FROM ar_bp_xprofile_data WHERE value = '" . $sports[$i] . "')" ); if ($femaleSport != 0) { echo '<p>' . $sports[$i] . ' (' . $femaleSport . ')</p>'; $femaleCounter++; } } if ($femaleCounter == 0) { echo '<p>Sorry, there are no female athletes registered yet.</p>'; } ?>
In the Frontend it could look like this:
Female:
Baseball(4)
Basketball(2)
Soccer(8)Male:
Baseball(20)
Basketball(30)
Tennis(5)Now I would like to generate links on the sports as it’s automatically done with profile fields.
I think there are two problems:
1) I have already removed xprofile links in profile/members loop.
2) The sports are not in the members or profile loop.Can you help me?
- The topic ‘Add custom xprofile links’ is closed to new replies.