How to disable profile.php for users?
I am using wordpress 4.2.2 and i am using buddypress latest version. I want all my users customize their profile at buddypress profile page. So i want to disable profile.php for the users. I hide the profile link from dashboard by the WP admin UI customize plugin.But when anyone type url mysite/wp-admin/profile.php it's appear on browser.So i want to escape from the problem and want to disable profile.php for the users. What should i do to do this?
Answers 3
Redirect from
profile.php
to the dashboardHere's one way to do it:
where we redirect to the dashboard instead, if the current user can't manage options.
Redirect from
profile.php
to the current user's member pageIf you want to redirect to the member's profile page, you could try (untested):
The
bp_core_get_user_domain()
function is mentioned in this answer, few years ago, by @BooneGorges.I just checked the BP source and this function is still available in BP 2.3 (see here).
For PHP < 5.3
and
but you should consider updating your PHP if that's the case.
The following code* will redirect non-admin to a custom profile page in the front end, because instead of disabling you need to redirect them to your custom page. :)
*Source^
I like this one. You can add amin pages to the array to redirect them. I have it redirecting to dashboard below, but you can redirect to buddypress url as well... I'm just not sure what that url is since I don't use BP very often.
You can also hide any additional profile.php links with simple css:
The above could also be achieved with jquery or using php and the output buffer.