bp_get_user_social_networks_urls( $user_id = null )
Add social networks button to the member header area.
Description
Return
(string)
Source
File: bp-xprofile/bp-xprofile-functions.php
1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 | function bp_get_user_social_networks_urls() { global $wpdb ; $social_networks_id = (int) $wpdb ->get_var( "SELECT a.id FROM {$wpdb->prefix}bp_xprofile_fields a WHERE parent_id = 0 AND type = 'socialnetworks' " ); $html = '' ; $original_option_values = array (); if ( $social_networks_id > 0 ) { $providers = social_network_provider(); $original_option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $social_networks_id , bp_displayed_user_id() ) ); if ( isset( $original_option_values ) && ! empty ( $original_option_values ) ) { foreach ( $original_option_values as $key => $original_option_value ) { if ( '' !== $original_option_value ) { $key = bp_social_network_search_key( $key , $providers ); $html .= '<span class="social ' . $providers [ $key ]->value . '"><a target="_blank" data-balloon-pos="up" data-balloon="' . $providers [ $key ]->name . '" href="' . esc_url( $original_option_value ) . '">' . $providers [ $key ]->svg . '</a></span>' ; } } } } else { $html = '' ; } if ( '' !== $html ) { $level = xprofile_get_field_visibility_level( $social_networks_id , bp_displayed_user_id() ); if ( bp_displayed_user_id() === bp_loggedin_user_id() ) { $html = '<div class="social-networks-wrap">' . $html . '</div>' ; } elseif ( 'public' === $level ) { $html = '<div class="social-networks-wrap">' . $html . '</div>' ; } elseif ( 'loggedin' === $level && is_user_logged_in() ) { $html = '<div class="social-networks-wrap">' . $html . '</div>' ; } elseif ( 'friends' === $level && is_user_logged_in() ) { $member_friend_status = friends_check_friendship_status( bp_loggedin_user_id(), bp_displayed_user_id() ); if ( 'is_friend' === $member_friend_status ) { $html = '<div class="social-networks-wrap">' . $html . '</div>' ; } else { $html = '' ; } } } return apply_filters( 'bp_get_user_social_networks_urls' , $html , $original_option_values , $social_networks_id ); } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.