Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to move adminbar links to sidebar?

  • Hey,

    I would like to add certain links that are found in the admin bar into the sidebar, such as Profile
    Messages
    Groups
    Settings
    Activity
    @Me Mentions
    Logout

    I do not want to remove the admin bar or any of its links I would just like to add the list above to the sidebar.
    How can I do this??

    Thanks for any help

    eor

Viewing 21 replies - 1 through 21 (of 21 total)
  • Can anyone help me with this? I’d greatly appreciate it.

    Avatar of Hans
    Hans
    Participant

    @hanss

    A sollution for this problem would be helpful for me too.

    Could I just create a text widget in the side bar with something like this for example. open tag http://www.mywebsite.com/members/user_id profile “profile” closing tags or something similar?

    would really love to get some help on this. I just feel it creates a simpler user navigation for there menus.

    Thanks,
    eor

    Avatar of Bowe
    Bowe
    Participant

    @bowromir

    You can use the following code to create navigation links:

    http://pastebin.com/u3cHdGWk

    etc

    You can build the links by using the $userlink tag + adding the correct urls :) good luck

    ps: How can I display code properly in the new forums?

    I can’t seem to get that to work. I tried using the $userlink tag and the correct urls but it just brings me back to the home page everytime I try to use it. Any other way of generating the proper links?

    Thanks,
    eor

    anybody have a way to do this?

    thanks,
    eor

    Avatar of zeitgeist76
    zeitgeist76
    Member

    @zeitgeist76

    hi eor …. dont use $userlink tag ….. its better to use “php echo bp_loggedin_user_domain()

    hope that helps

    Avatar of ScottWatson
    ScottWatson
    Member

    @scottwatson

    @zeitgeist76

    `php echo bp_loggedin_user_domain()` obviously points towards a users Main Profile page, do you know how I would then be able to change this so that it points to the others items such as Inbox, Upload a Photo etc…?

    Avatar of ScottWatson
    ScottWatson
    Member

    @scottwatson

    *** Shamelessly bumps the thread and waves his hands in the hope that someone can help ***

    Avatar of acaps2007
    acaps2007
    Member

    @acaps2007

    I am bumping this too as I would really like to do this. Can anyone write the exact link to put in, i.e. “php echo bp_loggedin_user_domain()…”, for the following items?

    Messages
    Groups
    Settings
    Activity
    Logout

    THANK YOU!

    Avatar of ScottWatson
    ScottWatson
    Member

    @scottwatson

    Surely somebody knows the answer to this? This question has been asked countless times on this board and yet nobody responds. Having spent a bit of time on these boards I know that some of you guys are proper gurus with this stuff; please help us that are less versed in solving this problem.

    Scotty

    Avatar of josemv
    josemv
    Participant

    @el_terko

    Maybe this helps: http://whaaat.de/blog/w/439

    Avatar of ScottWatson
    ScottWatson
    Member

    @scottwatson

    @josemv you are an absolute star mate, thank you very much that is exactly what I was after.

    @acaps2007 here you go mate, as requested I have copied a few of the ones that I have put onto my site, should let you get the idea if used in conjunction with the link that josemv provided.

    `<li class="page_item current_page_item”><a href="”>Profile`
    `<li class="page_item current_page_item”><a href="messages/inbox”>Inbox`
    `<li class="page_item current_page_item”><a href="album”>Portfolio`

    Avatar of acaps2007
    acaps2007
    Member

    @acaps2007

    This is very helpful, but I would really appreciate one more thing. The nav bar has a link that says “Notifications”. When you get a message or something, it adds a number to the side, for how many notifications you have. For example, if you get one message, it puts the number “1″ on the right. When you mouse over it, it shows you the notifications and you can click to go to them. How would I put the same link with mouse over effect on my site? I am very confused. Thank you for the help!!!

    Avatar of ScottWatson
    ScottWatson
    Member

    @scottwatson

    That would be a very nice addition to what I have done now. I now have the links I wanted from the Admin bar within the Navbar of my template – one of which is Inbox – and it would be nice if I could display the number of unread messages next to the “Inbox” menu text in the nav bar.

    Any thoughts?

    Avatar of acaps2007
    acaps2007
    Member

    @acaps2007

    While we wait for a reply, I just wanted to thank everyone for the help. You all are amazing!

    Avatar of calvinhsu
    calvinhsu
    Participant

    @calvinhsu

    @acaps2007
    @ScottWatson
    the post linked below says how to display the number of unread messages.

    http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-to-moverelocate-the-links-in-the-admin-bars-my-account-individuallyseparately-to-the-sidebar/

    But I would prefer the idea @acaps2007 has proposed, that’s the “notification” item and the mouse over effect, since in a buddypress community, we would have
    1. private messages
    2. friend requests
    3. group requests
    4. group invites
    5. mentions

    Although the last one is not included in the default bp notification count, combining the previous four in one place would still help a lot.

    Avatar of calvinhsu
    calvinhsu
    Participant

    @calvinhsu

    @acaps2007

    I think I’ve find an easy way to provide the effect you mentioned. It’s rather a css trick than a php-code way. Below is what I’ve find during this process:

    First, I find the function `bp_adminbar_notifications_menu()` in `bp-core-adminbar.php`, but it only works when adminbar is enable, and it simply lists out all notifications rather than the “mouse-over” effect we want. It seems `admin-bar.js` is also required, which is totally beyond me.

    So I realized that since it already requires adminbar to be enable in the first place, why are we bothering to duplicate this item, especially in so complex a way?

    We just need to hide all other items in adminbar, and re-position the notification menu.

    So finally I come up with this:

    `/** Play with admin-bar to grab notification menu */

    #wp-admin-bar {
    position: absolute;
    }

    #wp-admin-bar .padder {
    background: none;
    }

    #wp-admin-bar .padder #admin-bar-logo, #wp-admin-bar .padder ul #bp-adminbar-account-menu, #wp-admin-bar .padder ul #bp-adminbar-blogs-menu, #wp-admin-bar .padder ul #bp-adminbar-thisblog-menu, #wp-admin-bar .padder ul #bp-adminbar-authors-menu, #wp-admin-bar .padder ul #bp-adminbar-visitrandom-menu {
    display: none;
    }`

    Now we have notification menu there, and it’s no longer a “always-in-the-front” item. What remains to be done is further defining the style of this little baby, its position, background color, font color, etc.

    Hope this would do some help.

    Avatar of acaps2007
    acaps2007
    Member

    @acaps2007

    That’s a good fix, but unfortunately my theme doesn’t display an admin bar at all. That’s why I need to re-create certain things, like notifications…

    Avatar of josemv
    josemv
    Participant

    @el_terko

    Avatar of calvinhsu
    calvinhsu
    Participant

    @calvinhsu

    @acaps2007
    What I’ve found finally:

    (It’s based on this article:
    http://easyoutsource.com/blog/how-to-code-a-custom-adminbar-in-buddypress/)

    So if you just set your adminbar to be hidden in css rather than completely disable it in the `wp-config.php`, you could use “to call the notification menu.

    If you’ve completely disabled adminbar, then use the following code instead(it’s copied from bp-core-adminbar.php):
    `<?php
    global $bp;

    if ( !is_user_logged_in() )
    return false;

    echo ‘

  • loggedin_user->domain . ‘”>’;
    _e( ‘Notifications’, ‘buddypress’ );

    if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>

    <?php
    }

    echo ‘‘;
    echo ‘

      ‘;

      if ( $notifications ) {
      $counter = 0;
      for ( $i = 0; $i < count($notifications); $i++ ) {
      $alt = ( 0 == $counter % 2 ) ? ‘ class=”alt”‘ : ”; ?>

      <li>

  • <?php $counter++;
    }
    } else { ?>

  • <a href="loggedin_user->domain ?>”>
  • <?php
    }

    echo ‘‘;
    echo ‘‘;
    ?>
    `
    And as I have found out, the js effect (what you called the “mouse over” effect) is dealt automatically by `bp-themes/bp-default/_inc/global.js`.

    In my case, I’m building a child theme of bp-default, so I don’t have to worry about js, just copy and paste css codes from `bp-themes/bp-default/_inc/css/adminbar.css` and adjust selectors accordingly.

    If you are not building a child theme of bp-default, then maybe you can try search in the global.js and make some copy and past.

    Good luck !

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

You must be logged in to reply to this topic.