Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Remove access & links to back end profile / admin bar

  • Avatar of fpats
    fpats
    Participant

    @fpats

    Hi,

    I’ve got pretty much everything running how it should now but the admin bar for logged in users (left side) still shows a link to the back end profile page.

    Is there a way to remove this? They can edit profiles via the drop down on the right side of the admin bar using the front end which looks cleaner and has better options so this just causes confusion and makes the site look a bit messy.

    many thanks!

Viewing 14 replies - 1 through 14 (of 14 total)
  • Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @fpats
    This will remove it for subscribers but leaves it for admin. Add it to bp-custom.php

    
    function bphelp_custom_toolbar($wp_toolbar) {
    	global $wp_admin_bar;
    	
    	if ( !current_user_can( 'manage_options' ) ) { 
    	$wp_toolbar->remove_node('site-name');
    	}
    }
    
    add_action('admin_bar_menu', 'bphelp_custom_toolbar', 999);
    
    Avatar of fpats
    fpats
    Participant

    @fpats

    thanks alot @bp-help that worked perfectly in removing the left side menu.

    unfortunately it’s also somehow disabled front end editing of user profiles.

    is there another way?

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @fpats
    Did you put the code between opening and closing php tags? I have it working on fresh install of WP 3.6 beta2 and BP 1.8 beta1 so if its not working for you it may be some other code you introduced interfering with the function. That code doesn’t do anything to the profile menu in the top right, it just removes the node in the top left for sitename/dashboard.

    Avatar of fpats
    fpats
    Participant

    @fpats

    I really don’t get it, i’ve done nothing but add that code.

    So i removed it… the left side menu is back on the admin bar as it should be but i still can’t access front end profiles, i just get a white screen.

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @fpats
    Did you add it to bp-custom.php? Can you put a copy of it on pastebin and supply the link?

    Avatar of fpats
    fpats
    Participant

    @fpats

    here it is at the moment

    http://pastebin.com/fpbxJFv6

    Avatar of fpats
    fpats
    Participant

    @fpats

    and with the code..

    http://pastebin.com/gSwwkxnR

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @fpats
    Have you tried temporarily commenting out your function to see if it is causing your issue?

    Avatar of fpats
    fpats
    Participant

    @fpats

    And now i can’t delete posts or upload media, it’s like the site is completely broken now. I’ve been working since 6am to get this ready for tomorrow and every thing was perfect until i added this bit of code.

    Is anyone else from Buddypress online who can offer advice please?

    Avatar of fpats
    fpats
    Participant

    @fpats

    sorry @bp-help i’m not sure what you mean. i’m learning as i go along here, how would i do that?

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @fpats
    To comment out that block of code in your function just add /* after the opening php tag and before your function. After the last } then add */ before the closing php tag.
    Note comments basically prevents php from reading the function.
    Here is your function commented:

    
    <?php
    /* //Begin comment
    function redirect_group_home() {
      global $bp;
      $path = clean_url( $_SERVER['REQUEST_URI'] );
      $path = apply_filters( 'bp_uri', $path );
      if (bp_is_group_home() && strpos( $path, $bp->bp_options_nav['groups']['home']['slug'] ) === false ) {
        
        echo "HERE WE GO...";
        echo "<PRE>"; print_r($bp->groups->current_group); echo "</PRE>";
        echo $bp->groups->current_group->status;
        echo $bp->groups->current_group->is_user_member;
        
        if ($bp->groups->current_group->is_user_member || $bp->groups->current_group->status == 'public') {
          echo "<PRE>"; print_r($bp->bp_options_nav); echo "</pre>";
          exit();
          if ($bp->bp_options_nav['groups']['announcements']['slug']) {
            bp_core_redirect( $path . $bp->bp_options_nav['groups']['announcements']['slug'] . '/' );
          } else {
            bp_core_redirect( $path . $bp->bp_options_nav['groups']['forum']['slug'] . '/' );
          }
          bp_core_redirect( $path . 'welcome/' ); //quick hack for some other tab
        }
      }
    }
    */ //END COMMENT
    
    ?>
    
    Avatar of fpats
    fpats
    Participant

    @fpats

    Thank you very much, that’s restored the front end profiles again.
    I’ve added your original code and removed the link to the dashboard too.

    Will i be ok leaving that commmented out or will have an effect on something else?
    Sorry for all the questions and thanks again for your help.

    If you’re available for hire i’ll be looking for someone to check over the site for us very soon to make sure it’s all as it should be.

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @fpats
    Leaving it commented out will not cause you any issues. Lots of developers use this technique while testing functions with other functions so they don’t loose the code by deleting it.
    I can be contacted here:
    bphelp.1@gmail.com

    Avatar of fpats
    fpats
    Participant

    @fpats

    thanks again, i’ll drop you a line tomorrow :)

Viewing 14 replies - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.