Create Account Settings Button Shortcode
To have account settings button short code, please use this snippet:
/**
* Youzify - Account Setting Icons Menu SHortcode [yzc_account_settings_icons_menu]
**/
add_shortcode( 'yzc_account_settings_icons_menu', 'yzc_account_settings_icons_menu');
function yzc_account_settings_icons_menu() {
?>
<link rel="stylesheet" id="custom-css" href="<?php echo YOUZIFY_ASSETS . 'css/youzify-account.min.css'; ?>" type="text/css">
<?php
// Get Data.
$user_id = bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id();
$icon_url = youzify_get_profile_settings_url( 'change-avatar' );
$profile_url = bp_core_get_user_domain( $user_id ) . bp_get_profile_slug() . '/';
$header_buttons = apply_filters( 'youzify_account_menu_header_buttons', array(
'home' => array(
'icon' => 'fas fa-home',
'title' => __( 'Home', 'youzify' ),
'url' => home_url()
),
'profile' => array(
'icon' => 'fas fa-user',
'title' => __( 'View Profile', 'youzify' ),
'url' => bp_core_get_user_domain( $user_id )
),
'networks' => array(
'icon' => 'fas fa-share-alt',
'title' => __( 'Social Networks', 'youzify' ),
'url' => $profile_url . 'social-networks'
),
'avatar' => array(
'icon' => 'fas fa-user-circle',
'title' => __( 'Profile Avatar', 'youzify' ),
'url' => $profile_url . 'change-avatar'
),
'cover' => array(
'icon' => 'fas fa-camera-retro',
'title' => __( 'Profile Cover', 'youzify' ),
'url' => $profile_url . 'change-cover-image'
),
'logout' => array(
'url' => wp_logout_url(),
'icon' => 'fas fa-power-off',
'title' => __( 'Logout', 'youzify' )
)
) );
if ( ! buddypress()->avatar->show_avatars ) {
if ( isset( $header_buttons['avatar'] ) ) {
unset( $header_buttons['avatar'] );
}
}
if ( ! bp_displayed_user_use_cover_image_header() ) {
if ( isset( $header_buttons['cover'] ) ) {
unset( $header_buttons['cover'] );
}
}
// if there's no networks don't show the networks form..
$networks = youzify_option( 'youzify_social_networks' );
if ( empty( $networks ) ) {
unset( $header_buttons['networks'] );
}
$count = count( $header_buttons );
ob_start();
?>
<div class="youzify-account-header">
<div class="youzify-head-buttons">
<div class="youzify-head-buttons-inner">
<?php foreach ( $header_buttons as $key => $button ) :?>
<div class="youzify-button-item youzify-<?php echo $key; ?>-button" style="width: <?php echo 100 / $count; ?>%;"><a href="<?php echo $button['url'] ?>" data-youzify-tooltip="<?php echo $button['title']; ?>" ><i class="<?php echo $button['icon'] ?>"></i></a></div>
<?php endforeach;?>
</div>
</div>
</div>
<?php
return ob_get_clean();
}
To find where you have to put that snippet, kindly check this article
How to Add Custom PHP Snippet?
And then, please use this short code
[yzc_account_settings_icons_menu]

