This topic has 1 reply, 2 voices, and was last updated 10 years by SQadmin.

  • Author
  • #7472
     bananalust
    Participant

    I was looking at the functions.php file regarding sidebars
    //get the global sidebar
    if (!function_exists(‘kleo_sidebar’)):
    function kleo_sidebar()
    {
    get_sidebar();
    }
    endif;

    //Buddypress SIDEBAR ACTION
    if (sq_option(‘buddypress_sidebar’,’right’) == ‘left’)
    {
    add_action(‘kleo_buddypress_before_content’, ‘kleo_buddypress_sidebar’);
    }
    elseif (sq_option(‘buddypress_sidebar’,’right’) == ‘right’)
    {
    add_action(‘kleo_buddypress_after_content’, ‘kleo_buddypress_sidebar’);
    }

    //get buddypress sidebar
    if (!function_exists(‘kleo_buddypress_sidebar’)):
    function kleo_buddypress_sidebar()
    {
    get_sidebar(‘buddypress’);
    }
    endif;

    I would like to add a function that calls a certain sidebar on the buddypress member profile page depending on an xprofile field

    Here is an example
    function hide_blog_from_community() {
    $role = xprofile_get_field_data( ‘Membership’ );
    //echo ‘role: ‘ . $role . ‘<br>’;
    if( $role !=’Expert’ )
    bp_core_remove_nav_item(‘blog’);
    }
    add_action( ‘bp_setup_nav’, ‘hide_blog_from_community’, 99 );

    So if the role is expert I would want to load sidebar-expert and if not I would like to load sidebar-community or the default sidebar. I can’t figure out where get_sidebar(‘buddypress’); is coming from????

    Thank you for your insight and help on this!

    #7524
     SQadmin
    Keymaster

    Hi, That is the code responsible with buddypress sidebar. You can check if is a profile page with this function: bp_is_member()

    get_sidebar(‘buddypress’) looks for sidebar-buddypress.php file in the theme so you can create your own template

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?