Search Results for 'add profile tab to nav bar'
-
AuthorSearch Results
-
June 4, 2016 at 7:30 pm #254137
danbp
ParticipantGive 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');May 17, 2016 at 7:07 am #253437In reply to: [Resolved] BuddyPress Links URLs
danbp
ParticipantHi @famous,
anything directly related to URL for bp is listed here:
http://hookr.io/plugins/buddypress/#index=l&search=urlIn 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.
August 13, 2015 at 2:00 pm #243147In reply to: Looking how to implement custom nav bars
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_menuJuly 3, 2015 at 6:38 pm #241429In reply to: [Resolved] How to unset submenu tab
danbp
Participantfunction 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 )January 22, 2015 at 1:57 am #232729In reply to: Sub Navigation renaming
modemlooper
ModeratorThis 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);September 8, 2014 at 2:27 pm #190937danbp
ParticipantIMHO 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.phpadd_filter('widget_text', 'do_shortcode', 11);
Now you can use a shortcode in this widget !July 23, 2014 at 12:39 pm #185458In reply to: $bp->bp_options_nav wrong user links
danbp
Participanttry 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');March 22, 2014 at 7:21 pm #180141In reply to: How I hide my un-wanted profile tabs
shanebp
ModeratorFor renaming things, the recommended practice is to use a language file:
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.
June 19, 2013 at 6:59 pm #166420bp-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 ?>April 8, 2013 at 10:59 pm #160409azchipka
ParticipantOk 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 ACLSTEPS
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.
January 17, 2013 at 6:10 pm #150947In reply to: Re-order profile menu items
danbpfr
Participanthi @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 ! 😉
August 12, 2012 at 2:54 am #139174In reply to: How to add a profile link to navigation bar
modemlooper
ModeratorAre 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
August 11, 2012 at 7:28 pm #139154In reply to: How to add a profile link to navigation bar
charlietech
Participanti 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?
August 9, 2012 at 3:19 am #138930In reply to: How to add a profile link to navigation bar
charlietech
ParticipantI 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?
August 9, 2012 at 2:18 am #138921In reply to: How to add a profile link to navigation bar
charlietech
Participantif 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?
August 7, 2012 at 12:48 am #138586In reply to: How to add a profile link to navigation bar
charlietech
ParticipantOk just making sure, I have updating the plugin but still no profile tab showing
August 6, 2012 at 11:35 pm #138578In reply to: How to add a profile link to navigation bar
modemlooper
ModeratorGo 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.
August 6, 2012 at 11:16 pm #138575In reply to: How to add a profile link to navigation bar
charlietech
ParticipantCool! 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?
July 9, 2012 at 8:23 pm #137029shanebp
ModeratorThat 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 );}
`
February 28, 2011 at 4:20 pm #106516In reply to: Add “Posts” Tab? Very frusterated
austinfav
MemberI 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.
September 24, 2010 at 9:10 am #93281In reply to: Add users profile fields to the activity page
Roger Coathup
ParticipantHej 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!
April 12, 2010 at 5:30 pm #73024newbie999
ParticipantHello 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’;
?>
April 12, 2010 at 5:30 pm #73124newbie999
ParticipantHello 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’;
?>
April 5, 2010 at 11:01 pm #71900newbie999
ParticipantThank you. After searching the forums for how to check the current user’s role, I added below to function.php and it’s working. Since I’m new to this, I’m very open to suggestions if there’s a better way to write this function.
function my_alter_bp_sidebar_login(){
global $bp;
$user = new WP_User( $bp->loggedin_user->id );
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role )
if ($role != ‘subscriber’) {
echo ‘root_domain . ‘/wp-admin/”>Dashboard<p/>’;
}
}
}
add_action(‘bp_before_sidebar_me’,’my_alter_bp_sidebar_login’,1);
April 1, 2010 at 8:21 pm #71322newbie999
ParticipantI only need 1 blog – the main one. I disabled the blog tracking component and that worked, thank you. It disabled all the ‘Blog’ tabs.
The only thing I need now is a way for the providers (those who can post to the main blog) a way to create/edit posts. Other than adding a meta widget to the sidebar, is there a better way I can provide authors, contributors, etc. a way to get to the dashboard so they can post/edit blog entries?
-
AuthorSearch Results