Search Results for 'add profile tab to nav bar'
-
AuthorSearch Results
-
April 12, 2010 at 5:30 pm #73124newbie999Participant
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’;
?>
April 5, 2010 at 11:01 pm #71900newbie999ParticipantThank 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 #71322newbie999ParticipantI 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