Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Add custom xprofile links

@henrywright

Moderator

Right. In that case, you can just modify the output of your for loop. For example:

for ( $i = 0; $i < $sportsSize; $i++) {

    // For this particular $i, get the URL here and store it in a $url variable. You may need to query the db again? i.e. where will you get the URL from, or where are you storing it?

    $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) {
        // Update the output of the loop to include hyperlink markup.
        echo '<p><a href="' . $url . '">' . $sports[$i] . ' (' . $femaleSport . ')</a></p>';
        $femaleCounter++;
    }
}
Skip to toolbar