BuddyDev

Search

[Resolved] Redirect admin URL profile and setting profile to 404 & dropdown profile tabs

  • Participant
    Level: Master
    Posts: 213
    smart life on #14513

    Hi,

    1)
    My admin URL is
    domain.com/members/admin-username

    2)
    My hidden URL is
    domain.com/members/username-current-login/slug

    ==> If something hits 1+2 URL, redirect to 404

    3) Profile tabs plugin
    Option: turn all subnav to dropdown or snipped code if available.

    Ex: Hover parents menu “setting” will see all subnav , just like defaul wordpress main menu.
    The same happen in GROUP if available.

    WHY?
    + Current subnav is horizontal, look so terrible on phone, what is mess.
    + Reload too many time, which user need so to sub, user must do 2 step –>ex: choose setting –> reload again for choose sub-setting, bad google score, web oevrload when many reload useless.

    May usefull code, it no longer work, but idea:
    https://buddypress.org/support/topic/profile-tab-dropdown-menus/

    Thanks

  • Participant
    Level: Master
    Posts: 213
    smart life on #14521

    4) Similar facebook
    NONE login : fb.com is Homepage
    Logged in : fb.com….User activity

    How do i have similar?
    –> logged in user, who open “domain.com” they will always stay in “Profile buddypress” page

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #14528

    Hi Julia,
    I am not sure what your questions are. Can you please help me understand them better.

    A few things that I understood, I will answer here:-

    Profile Tabs:- The navigation is managed by your theme or BuddyPress template pack. It can be vertical or horizontal based on which theme you are using. There is not much that we can do on our part.

    Reload too many time:- I am not sure what do you mean by this? Why will that be an seo issue? Is it about BuddyPress or one of our plugins?

    Thank you
    Brajesh

  • Participant
    Level: Master
    Posts: 213
    smart life on #14554

    Thank for respond question 4.

    Here is explain:

    1)
    My admin URL is
    domain.com/members/admin-username ==> Redirect to 404

    2)
    My hidden URL is
    domain.com/members/username-current-login/slug ==> Redirect to 404

    3) For only who already logged in. Not apply for logout people
    Home url
    domain.com ==> Redirect back to there buddypress profile domain.com/members/username-logged-in

    Hope it clear.

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #14609

    Hi Julia,
    I am rephrasing your question

    1. Do you want to disable access to site admin’s profile?
    2. I am still confused, please clarify.

    3. Do you want the logged in users to be unable to check site’s home page and when they try to check home page they should be redirected to their profile?

    Thank you
    Brajesh

  • Participant
    Level: Master
    Posts: 213
    smart life on #14633

    1) Correct.
    As subcriber who know that my admin is user-admin, they still available access via type
    “domain.com/user-admin”
    ==> Complete disabled, 404 error for “none admin”

    3) Correct.
    via 301 redirect action type.

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #14674

    For 1,3, Please use the following code

    
    function buddydev_redirect_admin_url() {
    	// part 1. redirect to user profile if accessing the home page.
    	if ( is_user_logged_in() && is_front_page() ) {
    		bp_core_redirect( bp_loggedin_user_domain(), 301 );
    	}
    
    	if ( bp_is_user() && ! bp_is_my_profile() && user_can( bp_displayed_user_id(), 'manage_options' ) ) {
    		bp_core_redirect( site_url( '/404/' ) );
    	}
    
    }
    
    add_action( 'bp_template_redirect', 'buddydev_redirect_admin_url' );
    

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 213
    smart life on #14679

    Code worked. Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #14685

    You are welcome.

The topic ‘ [Resolved] Redirect admin URL profile and setting profile to 404 & dropdown profile tabs’ is closed to new replies.

This topic is: resolved