@Anom, that lets the user set the slug. What I’m trying to do is retrieve the slug. This is my first time writing code for BP but I know with WP they have functions like get_site_url(); I was hoping something like get_member_slug(); was out there so I can use it as part of a default plugin where I won’t know each users member slug url as they set that up themselves. There is probably a way to retrieve the defined member slug, is that the best way to do this?
BP_MEMBERS_SLUG
is a constant defined – so if bp is initialized you can use that.
bp_core_get_user_domain( $user_id )
will return the member’s url – e.g. http://domain.com/ BP_MEMBERS_SLUG / username / – (also if BP_ENABLE_ROOT_PROFILES
is used or not)
thanks, rich, what happens if BP_ENABLE_ROOT_PROFILES is enabled? Also the problem is that I am setting an option in then db and want to set it to just the http://domain.com/ BP_MEMBERS_SLUG / without the username part as the username will change with each login. I saw `bp_core_get_user_domain( $user_id )` but that requires you to set the $user_id for the user you want the profile url for.
I think I can do
if(!defined(BP_ENABLE_ROOT_PROFILES){
$base_member_url=get_site_url().MEMBER_SLUG;
} else {
$base_member_url= get_site_url();
}
I was just hoping there would be a function for the base member url without a username attached.
if BP_ENABLE_ROOT_PROFILES is set then urls do not include the BP_MEMBERS_SLUG (ie, http://whatever.com/username )
function my_get_members_base()
global $bp;
if ( !defined( ‘BP_ENABLE_ROOT_PROFILES’ ) )
$domain = $bp->root_domain . ‘/’ . BP_MEMBERS_SLUG . ‘/’;
else
$domain = $bp->root_domain . ‘/’;
return $domain;
}