Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'add profile tab to nav bar'

Viewing 25 results - 26 through 50 (of 53 total)
  • Author
    Search Results
  • Jeremy Pry
    Participant

    Under certain circumstances, there is an infinite loop inside the bp_legacy_theme_new_activity_comment() function. Specifically, when all of the secondary_item_id fields are zero, the $parent_id will continually be set to zero. An infinite loop ensues and eventually the script will time out. This causes new activity items to not display until the page is refreshed, as mentioned here: https://buddypress.org/support/topic/activity-comments-post-blank-until-refresh/.

    This error happens when attempting to add a comment to a group post. I believe this is a similar problem as the one expressed here: https://buddypress.org/support/topic/activity-comments-post-blank-until-refresh/

    For information:

    • WordPress 4.5.3
    • BuddyPress 2.6.1.1
    • Single site install in web root
    • There are indeed other plugins activated on this site. The full list is below. This site is for a client, and I’m unsure of which plugins can be safely deactivated to test.
    • We’re using a customized theme, but I have tested with the TwentySixteen theme and found the same results.
    • The core BuddyPress files have not been modified to my knowledge.
    • The site is hosted on Page.ly, but I can reproduce the problems in a local VVV install
    • The live site is http://www.lifeofdad.com/

    I believe that this may be a problem inside BuddyPress itself, as the function with the infinite loop is part of BuddyPress. The Javascript that makes the Ajax request is part of the BuddyPress Wall plugin, but from what I can tell the problem is in the aforementioned bp_legacy_theme_new_activity_comment() function.

    My specific concern is this loop:

    
    	// Load the new activity item into the $activities_template global.
    	bp_has_activities( 'display_comments=stream&hide_spam=false&show_hidden=true&include=' . $comment_id );
    
    	// Swap the current comment with the activity item we just loaded.
    	if ( isset( $activities_template->activities[0] ) ) {
    		$activities_template->activity = new stdClass();
    		$activities_template->activity->id              = $activities_template->activities[0]->item_id;
    		$activities_template->activity->current_comment = $activities_template->activities[0];
    
    		// Because the whole tree has not been loaded, we manually
    		// determine depth.
    		$depth = 1;
    		$parent_id = (int) $activities_template->activities[0]->secondary_item_id;
    		while ( $parent_id !== (int) $activities_template->activities[0]->item_id ) {
    			$depth++;
    			$p_obj = new BP_Activity_Activity( $parent_id );
    			$parent_id = (int) $p_obj->secondary_item_id;
    		}
    		$activities_template->activity->current_comment->depth = $depth;
    	}
    

    I’ve run XDebug locally to inspect the items in the loop as it is running. If some of the raw variable data is required, I can provide that.

    I have tried making some changes to the code in this loop to prevent the infinite loop from occurring. While successful in that endeavor with a few tweaks, the result is that the comment sent back through the Ajax response is the wrong comment, and a page refresh is still needed.

    I considered filing a bug in Trac, but I wasn’t certain whether something else could possibly be interfering.

    
    +--------------------------------------+--------+-----------+---------+
    | name                                 | status | update    | version |
    +--------------------------------------+--------+-----------+---------+
    | akismet                              | active | none      | 3.1.11  |
    | all-in-one-seo-pack                  | active | available | 2.3.7   |
    | appbuddy                             | active | available | 2.0.7   |
    | appcamera                            | active | available | 2.0.0   |
    | appfbconnect                         | active | none      | 2.3.0   |
    | apppresser                           | active | none      | 2.5.0   |
    | apppush                              | active | available | 2.1.0   |
    | appshare                             | active | none      | 2.1.0   |
    | appswiper                            | active | available | 2.2.1   |
    | bp-profile-search                    | active | none      | 4.5.2   |
    | buddypress                           | active | none      | 2.6.1.1 |
    | buddypress-activity-plus             | active | none      | 1.6.4   |
    | bp-moderation                        | active | none      | 0.1.7   |
    | buddypress-nocaptcha-register-box    | active | none      | 1.1.3   |
    | buddypress-toolbar                   | active | none      | 1.6.0   |
    | buddypress-wall                      | active | none      | 0.9.4   |
    | buddypress-xprofile-image-field      | active | none      | 2.0.1   |
    | category-posts                       | active | none      | 4.6.1   |
    | contact-form-7                       | active | none      | 4.4.2   |
    | contact-form-7-to-database-extension | active | none      | 2.10.20 |
    | cubell-themes-functionality          | active | none      | 3.1     |
    | envato-wordpress-toolkit             | active | none      | 1.7.3   |
    | hashbuddy                            | active | none      | 1.5.2   |
    | login-with-ajax                      | active | none      | 3.1.6   |
    | mailchimp-for-wp                     | active | none      | 3.1.11  |
    | nav-menu-roles                       | active | none      | 1.8.2   |
    | nextend-facebook-connect             | active | none      | 1.5.9   |
    | buddypress-media                     | active | none      | 4.0.4   |
    | vine-embed                           | active | none      | 0.2     |
    | wds-lod-automatic-friends            | active | none      | 0.1.0   |
    | wds-lod-base                         | active | none      | 0.1.0   |
    | wds-lod-bp                           | active | none      | 0.1.0   |
    | wds-lod-post-types                   | active | none      | 0.1.0   |
    | wds-lod-widgets                      | active | none      | 0.1.0   |
    | wordpress-importer                   | active | none      | 0.6.1   |
    +--------------------------------------+--------+-----------+---------+
    
    danbp
    Participant

    Merci @imath !

    The old way

    The following syntax to change the tab order is deprecated since 2.6 and will throw an error notice:

    function rt_change_profile_tab_order() {
    global $bp;
    $bp->bp_nav['profile']['position'] = 10;
    $bp->bp_nav['activity']['position'] = 20;
    }
    add_action( 'bp_setup_nav', 'rt_change_profile_tab_order', 999 );

    The new way

    Now the correct syntax to use for modifying – since 2.6 – the tabs position on the buddybar when you’re on a profile.

    This example list all BP related items who appear by default on a profile nav, in order of appearance and include also the forum tab (if you use bbPress for group forums).
    By default, activity tab comes as 1st. The snippet will move it to 4th position.

    To modify a position you simply change the numeric value.
    If you want to move only one item, you remove or comment (add // at begin of the line) the ones you don’t want to move.

    function bpex_primary_nav_tabs_position() {
    	buddypress()->members->nav->edit_nav( array( 'position' => 4,	), 'activity' 		);
    	buddypress()->members->nav->edit_nav( array( 'position' => 5, 	), 'profile' 		); 
    	buddypress()->members->nav->edit_nav( array( 'position' => 7, 	), 'notifications'	); 
    	buddypress()->members->nav->edit_nav( array( 'position' => 9,	), 'messages' 	  	);
    	buddypress()->members->nav->edit_nav( array( 'position' => 2,	), 'friends' 	  	);
    	buddypress()->members->nav->edit_nav( array( 'position' => 6,	), 'groups' 		);
    	buddypress()->members->nav->edit_nav( array( 'position' => 3, 	), 'forums' 		);
    	buddypress()->members->nav->edit_nav( array( 'position' => 1, 	), 'settings' 		);
    }
    add_action( 'bp_setup_nav', 'bpex_primary_nav_tabs_position', 999 );

    That’s it for the buddybar nav menu order on profile.

    danbp
    Participant

    Give this a try: (add to bp-custom.php) 1) & 2):

    function bpfr_hide_tabs() {
    global $bp;
    
    	if ( bp_is_user() && !is_super_admin() ) {
    		bp_core_remove_nav_item( 'notifications' );
    		bp_core_remove_subnav_item( 'messages', 'compose' );
    	}
    	
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );

    3) With BP and xprofile component activated, a user doesn’t need access to WP dashboard. He can change his profile credentials from front-end.
    Easiest way would be to use this plugin.

    Retrieving them the possibility to change their email is anyway not a good idea. What happen when a user changed from yahoo to gmail, but can’t login because he lost his password ? Where will the new pwd be sent ?

    Perhaps you have also to remove this from the BP usermenu on toolbar ?
    Here’s how you can do it:

    function admin_bar_remove_this(){
    global $wp_admin_bar;
    	$wp_admin_bar->remove_node('my-account-messages-compose');
    }
    add_action('wp_before_admin_bar_render','admin_bar_remove_this');
    #253437
    danbp
    Participant

    Hi @famous,

    anything directly related to URL for bp is listed here:
    http://hookr.io/plugins/buddypress/#index=l&search=url

    In most case, you can built a link by array, which generally extend pre existing parameters. It’s very variable and depend where and how the link shoud work.

    Here some exemple snippets to add a link to a member’s profile.

    /* add external link on buddy menu bar */
    function bpfr_menubar_link() {
    global $bp;
    
    if ( !is_user_logged_in() )
        return false;
    
    $link = bp_get_loggedin_user_link();
    
    	$bp->bp_nav[$slug] = array(
    			'name'                    => 'View my profile',
    			'slug'                    => 'super_link',
    			'link'                    => $link,
    			'css_id'                  => 'super-link',	
    			'position'                => 20
    		);
    }
    add_action( 'bp_core_new_nav_item', 'bpfr_menubar_link', 999 );
    
    /* link to profile on SWA page */
    function goto_my_profile_tab() {
      if ( !is_user_logged_in() )
        return false;
    
      if ( bp_is_active( 'xprofile' ) )
    
        echo '<li><a href="'. bp_get_loggedin_user_link() .'">View my profile</a></li>';
      
    }
    add_action( 'bp_activity_type_tabs', 'goto_my_profile_tab' ); // SWA page
    add_action( 'bp_members_directory_member_types', 'goto_my_profile_tab' ); // members directory page
    
    /* shortcode linking to profile [xyz] */
    function bpfr_link_to_profile() {	
    return '<a href="'. bp_get_loggedin_user_link() .'">View my profile</a>';			
    }
    add_shortcode( 'xyz', 'bpfr_link_to_profile' );

    Another technique for groups here.

    In hope this will help you to go further.

    #253221
    bertl11
    Participant

    Hello,

    I managed to add a new tab to the bp menu with the following code:

    function bpfr_menubar_link() {
    	global $bp;
    
    	$bp->bp_nav[$slug] = array(
    			
    			'name'     => 'Fotos, Videos',
    			'slug'     => 'super_link',
    			'link'     => 'http://test.com/test',
    			'css_id'   => 'super-link',	
    			'position' => 30
    		);
    }
    add_action( 'bp_core_new_nav_item', 'bpfr_menubar_link', 999 );

    But now I want to add this code as link:
    <a href="<?php echo home_url() . '/' . get_the_author_meta( 'user_login', wp_get_current_user()->ID ). '-kalender' ; ?>" >Kalender</a>

    How can I add this link so that it’s displayed as tab in the menu?

    Thanks a lot for your help

    #243147
    danbp
    Participant

    @seore, please search a bit before asking ! For example “add profile tab to nav bar”
    https://buddypress.org/support/search/add+profile+tab+to+nav+bar/

    BP use slgihtly same technique as WordPress to build menus.
    https://codex.wordpress.org/Function_Reference/wp_nav_menu

    #241429
    danbp
    Participant
    function bpfr_remove_change_avatar_tab() {
    global $bp;
    	bp_core_remove_subnav_item( 'profile', 'change-avatar' );
    
    }
    add_action( 'bp_ready', 'bpfr_remove_change_avatar_tab', 15 );

    BuddyBar items

    Source: bp-core-buddybar.php
    function bp_core_remove_subnav_item( $parent_id, $slug )
    and to remove a nav item
    function bp_core_remove_nav_item( $parent_id )

    #232729
    modemlooper
    Moderator

    This is for the admin bar:

    function custom_adminbar_titles() {
        global $wp_admin_bar;
    
            $wp_admin_bar->add_menu( array(
                    'id'    => 'my-account-groups-memberships',
                    'title' => 'new title here',
                )
    
            );
    }
    add_action( 'wp_before_admin_bar_render', 'custom_adminbar_titles' );

    This is for profile menu:

    function change_profile_submenu_tabs(){
    	global $bp;
    
    	$bp->bp_options_nav['groups']['my-groups']['name'] = 'new name here';
    }
    add_action('bp_setup_nav', 'change_profile_submenu_tabs', 999);
    #190937
    danbp
    Participant

    @durkk,

    IMHO you do it overcomplicated.

    Create a new page; call it “extra”
    Create eventually a template for it. Basically, you made a copy of your theme “page.php”, you rename it “my-extra_page.php” and in the file header, you remove the original page comment and replace it with the new template comment.

    /*
    * Template name: my extra page
    */

    Save !

    Back to the page “extra” > edit and asign it the new template.

    Now you can add a this page to each profile by using the abose snippet from the child-theme functions.php

    
    function bpfr_my_setup_nav() {
        global $bp;
    	
    	$mytab=array(
    	'name'            => 'My Tab',
    	'link'      	  => 'permalink_to_your_page', // the one under the page title on page editor
    	'slug'         	  => 'my-tab',
    	'css_id'          => 'my_custom_tab',
    	'position'        => 100,
    	'user_has_access' => 1,
        'screen_function' => 'xprofile_screen_my_tab'
    	);
    	$bp->bp_options_nav['profile']['my-tab'] = $mytab; 	
    }
    add_action('bp_setup_nav', 'bpfr_my_setup_nav');

    You can now add into this page template any code you want. To call a plugin, a specific content or what else.

    To avoid this page to be shown in the menu bar, you can use this old plugin (it still works with 4.0)

    To use a shortcode from within the text widget (this is not possible by default)
    you can add this to your child-theme functions.php add_filter('widget_text', 'do_shortcode', 11);
    Now you can use a shortcode in this widget !

    #185458
    danbp
    Participant

    @jejemo

    try by adding this at the begin of your function
    $user_id = bp_get_activity_user_id();

    If you’re working on the Toolbar, the correct way to add a menu is like on this example:

    
    /* add links/menus to the admin bar*/
    /* more details here: http://wpengineer.com/2113/add-menus-to-the-admin-bar-of-wordpress/ */
    
    function mytheme_admin_bar_render() {
    global $wp_admin_bar;
    
    	$wp_admin_bar->add_menu( array(
    		'parent' => 'new-content', // use 'false' for a root menu, or pass the ID of the parent menu
    		'id' => 'new_media', // link ID, defaults to a sanitized title value
    		'title' => __('Media'), // link title
    		'href' => admin_url( 'media-new.php') // name of file
    		'meta' => false // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' );
    		)
    	);
    }
    add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' ); 

    A similar method is used to add a tab. Here on a user profile.

    function bpfr_my_setup_nav() {
        global $bp;
    	
    	$mytab=array(
    	'name'            => 'My Tab',
    	'link'      	  => 'http://example.com/wp-content/themes/twentythirteen/my_extra_page.php',
    	'slug'         	  => 'my-tab',
    	'css_id'          => 'my_custom_tab',
    	'position'        => 100,
    	'user_has_access' => 1,
        'screen_function' => 'xprofile_screen_my_tab'
    	);
    	$bp->bp_options_nav['profile']['my-tab']=$mytab; 	
    }
    add_action('bp_setup_nav', 'bpfr_my_setup_nav');
    #180141
    shanebp
    Moderator

    For renaming things, the recommended practice is to use a language file:

    Customizing Labels, Messages, and URLs

    If you make a lot of changes, you should use that approach.

    The ‘counting bubble’ is filled using sprintf.
    You’re missing that call from your change.
    You could try
    $bp->bp_nav['messages']['name']='Mails <span>%d</span>';
    But I’d be surprised if it works.

    Here’s another method, that you can paste in your functions.php:

    function sundev_change_buddypress_profile_tabs( $translated, $original_text, $domain ) {
    
        if ( 'buddypress' !== $domain )  {
            return $translated; 
        }
    
        switch ( $original_text ) {
        
            case 'Messages <span>%d</span>':
                return 'Mails <span>%d</span>';
    
            case 'Messages':
                return 'Mails';
                			
            default:
                return $translated;
        }
    }
    add_filter( 'gettext', 'sundev_change_buddypress_profile_tabs', 10, 3 );

    Untested, but that should change the label in both a profile and the buddy-bar.

    bp-help
    Participant

    @fpats
    To comment out that block of code in your function just add /* after the opening php tag and before your function. After the last } then add */ before the closing php tag.
    Note comments basically prevents php from reading the function.
    Here is your function commented:

    
    <?php
    /* //Begin comment
    function redirect_group_home() {
      global $bp;
      $path = clean_url( $_SERVER['REQUEST_URI'] );
      $path = apply_filters( 'bp_uri', $path );
      if (bp_is_group_home() && strpos( $path, $bp->bp_options_nav['groups']['home']['slug'] ) === false ) {
        
        echo "HERE WE GO...";
        echo "<PRE>"; print_r($bp->groups->current_group); echo "</PRE>";
        echo $bp->groups->current_group->status;
        echo $bp->groups->current_group->is_user_member;
        
        if ($bp->groups->current_group->is_user_member || $bp->groups->current_group->status == 'public') {
          echo "<PRE>"; print_r($bp->bp_options_nav); echo "</pre>";
          exit();
          if ($bp->bp_options_nav['groups']['announcements']['slug']) {
            bp_core_redirect( $path . $bp->bp_options_nav['groups']['announcements']['slug'] . '/' );
          } else {
            bp_core_redirect( $path . $bp->bp_options_nav['groups']['forum']['slug'] . '/' );
          }
          bp_core_redirect( $path . 'welcome/' ); //quick hack for some other tab
        }
      }
    }
    */ //END COMMENT
    
    ?>
    
    azchipka
    Participant

    Ok so I managed to find a backwards way of doing it because I needed to be able to do the same thing. Your going to need two plugins.

    1. Your Preferred Role Management Plugin. I like Capacity Manager Enhanced
    2. Buddypress xProfiles ACL

    STEPS
    1. Use your role manager to create some new roles. Name them what ever you want.
    2. Go into the Users -> Profile Fields
    3. Create a Field Group for your Restricted Items (not the primary one).
    4. Go to the Settings -> xProfile ACL
    5. Put your Field Group that you only want the Admin to be able to edit for the admin only.
    6. Now this is important you need to modify the xProfile ACL php file (yes I know this makes it a hack, if xProfile ACL is updated you will lose this setting.)
    6a. Go to line 240 of the buddypress-xprofiles-acl.php file. Comment out lines 240 – 249, the code you are commenting out is:

    `
    function filter_xprofile_groups_with_acl() {
    global $bp, $profile_template, $current_user;
    get_currentuserinfo();
    foreach($profile_template->groups as $key => $profile_group) {
    if( ! in_array($profile_group->id, $this->user_allowed_xprofile_groups) ) {
    unset($profile_template->groups[$key]);
    }
    }
    }
    `

    6b. Below the code you just commented out add:
    ` function filter_xprofile_groups_with_acl() {}`

    7. Save your changes to the buddypress-xprofiles-acl.php file.

    8. Now when ever you need to modify the fields log in with your admin account navigate to the user profile in buddy press and select Edit Member Profile from the tool bar. You will see the fields from the private group. Users will see the fields but when they select edit they will not be displayed.

    Hope this helps.

    #150947
    danbpfr
    Participant

    hi @diondeville,

    to change the profile menu (on the top right of the ToolBar)
    <code>
    function my_change_profile_tab_order() {
    global $bp;

    $bp->bp_nav[‘settings’][‘position’] = 10;
    $bp->bp_nav[‘activity’][‘position’] = 20;
    $bp->bp_nav[‘friends’][‘position’] = 30;
    $bp->bp_nav[‘groups’][‘position’] = 40;
    $bp->bp_nav[‘blogs’][‘position’] = 50;
    $bp->bp_nav[‘messages’][‘position’] = 60;
    $bp->bp_nav[‘profile’][‘position’] = 70;
    }
    add_action( ‘bp_setup_nav’, ‘my_change_profile_tab_order’, 999 );</code>

    Take care with quotes when copy/pasting from here ! 😉

    #139174
    modemlooper
    Moderator

    Are you using a custom theme? Do you have a menu created in the admin and placed in the primary slot?

    Btw you can always get old versions of plugins by going to WordPress.org and on the plugins page there is a developer tab with links

    #139154
    charlietech
    Participant

    i updated the plugin from 1.6 to 1.6.1and the profile tab in my navigation bar disappeared. how can i downgrade to the previous one or fix the problem?

    #138930
    charlietech
    Participant

    I put the code at the bottom of the function.php in the parent theme and nothing happened. All i want is to add the profile tab to my original nav menu and its becoming an arduous task. I dont understand why the option isn’t built in the buddypress from the jump(just a check box option) but anyhow, can you suggest something please?

    #138921
    charlietech
    Participant

    if I create the menu, how do I link the profile menu? The easiest way(without coding) in my opinion is to change the members tab to the profile tab and link the tab to the profile page(www.mysite/members/jane-doe. how do i do this?

    #138586
    charlietech
    Participant

    Ok just making sure, I have updating the plugin but still no profile tab showing

    #138578
    modemlooper
    Moderator

    Go into the plugin file and edit term “profile”. Then remove the members tab linking to the member directory in the wordpress admin

    Fixed plugin is live.

    #138575
    charlietech
    Participant

    Cool! What if I wanted to use the members tab and change the name to profile…. how would i change the permalink to link to http://www.mysite.com/members/username?

    shanebp
    Moderator

    That error is due to the missing $bp global.

    >So I’m trying to add a new navigation under the “my profile” tab

    Do you mean in the admin bar at the top?
    Or on profile pages under ‘Profile’ in the ‘Activity Profile Messages’ etc nav ?

    if it’s the latter, you want to a subnav item, not a nav item.
    Try this (which assumes you don’t know about the other functions needed) :

    `

    add_action( ‘bp_setup_nav’, ‘add_feedback_subnav_tab’, 100 );
    function add_feedback_subnav_tab() {
    global $bp;
    bp_core_new_subnav_item( array(
    ‘name’ => ‘Feedback’,
    ‘slug’ => ‘feedback’,
    ‘parent_url’ => trailingslashit( bp_loggedin_user_domain() . ‘profile’ ),
    ‘parent_slug’ => ‘profile’,
    ‘screen_function’ => ‘profile_screen_feedback’,
    ‘position’ => 50
    )
    );
    }

    // show feedback when ‘Feedback’ tab is clicked
    function profile_screen_feedback() {
    add_action( ‘bp_template_content’, ‘profile_screen_feedback_show’ );
    bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
    }

    function profile_screen_feedback_show() {
    echo “Feedback Screen”;

    // call your feedback template
    //locate_template( array( ‘feedback-profile.php’ ), true );

    }

    `

    #106516
    austinfav
    Member

    I was looking EVERYWHERE for the same thing and nobody would answer my questions. I finally found out how to accomplish adding a tab to the nav bar.

    Paste this code into your bp-custom.php file located in your “plugin” directory:

    function my_test_setup_nav() {
    global $bp;
    bp_core_new_nav_item( array( ‘name’ => __( ‘test’ ), ‘slug’ => ‘test’, ‘parent_url’ => $bp->loggedin_user->domain . $bp->slug . ‘/’, ‘parent_slug’ => $bp->slug, ‘screen_function’ => ‘my_profile_page_function_to_show_screen’, ‘position’ => 40 ) );

    bp_core_new_subnav_item( array( ‘name’ => __( ‘Home’ ), ‘slug’ => ‘test_sub’, ‘parent_url’ => $bp->loggedin_user->domain . $bp->slug . ‘/’, ‘parent_slug’ => $bp->slug, ‘parent_slug’ => $bp->slug, ‘screen_function’ => ‘my_profile_page_function_to_show_screen’, ‘position’ => 20, ‘item_css_id’ => ‘test_activity’ ) );

    function my_profile_page_function_to_show_screen() {

    //add title and content here – last is to call the members plugin.php template
    add_action( ‘bp_template_title’, ‘my_profile_page_function_to_show_screen_title’ );
    add_action( ‘bp_template_content’, ‘my_profile_page_function_to_show_screen_content’ );
    bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
    }
    function my_profile_page_function_to_show_screen_title() {
    echo ‘something’;
    }
    function my_profile_page_function_to_show_screen_content() {

    echo ‘weee content’;

    }
    }
    add_action( ‘bp_setup_nav’, ‘my_test_setup_nav’ );

    This will add a button into the nav bar named “test” which redirects back to the profile page. It would only take a bit more tweaking to get it to display the page you want. Hope this helps.

    #93281
    Roger Coathup
    Participant

    @lumosnorge

    Hej Christine – the code is in the default theme, in the file: bp-default/members/single/home.php

    Did you create a child theme, or edit your changes directly over the default theme?

    Note: you shouldn’t edit the default theme directly – as you will run into problems when you upgrade BuddyPress.

    Have a search in Docs on here for details of creating a child theme.

    Anyway, the section of code (from the default theme) that creates the nav bar is:
    `

    `

    It goes between the item-header and item-body blocks.

    You need Harry and Hermione helping you write the code!

    newbie999
    Participant

    Hello again. I posted this question on a new topic, no responses. I’ll try asking the question here since I have received responses on this thread. Thank you. Here goes:

    I added the code below in wp-content/plugins/buddypress/bp-themes/bp-default/members/members-loop.php, to display additional profile fields in the member directory and to display the member’s role (either ‘Subscriber’ or ‘Provider’). In the code below, I specifically checked for the user’s role to determine whether I need to display ‘Subscriber’ or ‘Provider’.

    Questions:

    – is there a way to check for the capability instead – i.e., if the user can ‘edit posts’ then I will display ‘Subscriber’, otherwise I will display ‘Provider’? If so, can you please let me know how to do that as I have not been able to figure it out.

    – is there a way to display a newline so that ‘Subscriber’ or ‘Provider’ will display on the next line, below the member’s title and company name. I tried to echo “n” but it’s not outputting a newline and I have no idea why.

    Thank you for the help.

    <?php

    /***

    * If you want to show specific profile fields here you can,

    * but it’ll add an extra query for each member in the loop

    * (only one regadless of the number of fields you show):

    *

    * bp_member_profile_data( ‘field=the field name’ );

    */

    if( bp_get_member_profile_data ( ‘field=Title’ ) )

    echo bp_member_profile_data( ‘field=Title’ ), ‘ (‘, bp_member_profile_data( ‘field=Company’ ), ‘)’, ‘ – ‘;

    $user = new WP_User( bp_get_member_user_id() );

    if ( $user->roles[0] == ‘subscriber’ )

    echo ‘Subscriber’;

    else

    echo ‘Provider’;

    ?>

Viewing 25 results - 26 through 50 (of 53 total)
Skip to toolbar