Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
buddypress profile link
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 23, 2016 - 10:50 am

If you change just the url on the sp side, how will buddypress sort out the url??

As I said, we have a facility already in place for you to adjust the url...  its a standard wp filter called sph_buddypress_profile....  just set up a standard wp filter on it and you can adjust however you like...  just remember, buddypress has to understand the url... 

if you dont know how to use standard wp filters, just let us know and we can walk you through it...

Avatar
Shibu
Member
Free Members
sp_UserOfflineSmall Offline
Jan 23, 2016 - 2:33 pm

I'm sorry. I'm a beginner when it comes to php.

I have this filter in place

function bp_profile_url() {return 'http://test';}
add_filter('sph_buddypress_profile', 'bp_profile_url');

How do I get the username in accordance to the sp id?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jan 23, 2016 - 3:20 pm

Well I am sure @mr-papa wll correct me if I am wrong or if I am missing something here but there can be many ways of determining the user name dependent upon where it is being called from. The current user is one,. The user who made a specific post is another. Then there might be the members list where it is simply the user that is selected.

Are these the sort of user name 'sources' that you mean?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Shibu
Member
Free Members
sp_UserOfflineSmall Offline
Jan 23, 2016 - 9:22 pm

Yes those are the sources I mean.

This is what I have so far

add_filter('sph_buddypress_profile', 'bp_profile_url');
function bp_profile_url() {
$userid = 1;
$user = new WP_User($userid);
$username = bp_is_username_compatibility_mode() ? $user->user_login : $user->user_nicename;
if (strstr($username, ' ')) {$username = $user->user_nicename;} else {$username = urlencode($username);}
return SFSITEURL.user_trailingslashit(BP_MEMBERS_SLUG.'/'.str_replace(' ', '', $username));}
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 23, 2016 - 10:21 pm

sorry, you have lost me...

back in post #1, you said it was all working and you just wanted to remove the /profile from the end...  so know you have lost me as to what you are doing...  to simply remove the /profile from the end as requested in first post, something like this:

add_filter('sph_buddypress_profile', 'my_sp_bp_profile_url');
function my_sp_bp_profile_url($url) {
    $url = str_replace('/profile/', '/', $url);
    return $url;
}

but it appears you are trying to do way more than introduced in the first post...  if so, could you elaborate further?  are you trying to redo bp profile url?  or just ours?

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625