Move Topbar icon to Sidebar

I have a theme which doesn't display the topbar

i'd like to know how to get the message icon to show on my sidebar

so that users can check their notifications.

Also i have the

friend request plugin and it attaches itself to the top bar

how would i go about, making that icon show on my sidebar with

the same function as if it where on the topbar.

Thank You.

i've been having trouble with this.

I know i must check the messages and friend-request mod folder

but specifically what code would i have to move to the sidebar.php so that it would display the icon??

  • still trying to work this out :(

  • 1. For display in extras menu

    elgg_register_menu_item('extras', array(
                'name' => 'messages',
                'href' => 'messages/inbox/' . elgg_get_logged_in_user_entity()->username,
                'text' => $text,
                'priority' => 600,
                'title' => $tooltip,
            ));

     

    2. For display in sidebar as link:

    elgg_register_menu_item('page', array(
                'name' => 'messages',
                'href' => 'messages/inbox/' . elgg_get_logged_in_user_entity()->username,
                'text' => $text,
                'priority' => 600,
                'title' => $tooltip,
            ));

  • Ahh, for overriding...

    In your theme's start.php

    elgg_unregister_menu_item('topbar', 'messages');

    Then add the aboving code

     

    OR

     

    You need overide messages_notifier function in your plugin/theme:

    elgg_register_event_handler('pagesetup', 'system', 'messages_notifier');

  • @RvR

    Thanks, but

    to be more specific of what i'm trying to do
    basically i want to get this

    image

    and put it on top of the profile picutre

    image

    i tried your code

    but it's not showing up on the sidebar :(
    image

    like i said before i also have to friend request plugin
    image

    and so far the closest i have gotten is

    image

    using this code
    image

  • that's because that code didn't include an icon in the array. use this as a reference

    elgg_register_menu_item('topbar', array(

    'name' => 'friends',

    'href' => "friends/{$viewer->username}",

    'text' => elgg_view_icon('users'), // <--- that shows the friends icon in the topbar

    'title' => elgg_echo('friends'),

    'priority' => 300,

    ));

  • @$('Cim')

    lets 4get about the friends

    im planning on just echo-ing the friend icon (html) and since it's in an "if you have a friend request then it'll only show when the user has a friend request"

    so lets 4get about that..

    the trouble is the message icon

    i tried your code but the sidebar stayed the same - no friend icon no nothing :(

    Thanks for late-night response - it's 2:19am where im at lol

  • same here, i live in california. but i did look at the messages plugin start.php file. the image is populated by the $class variable which is using css. look at the code

    function messages_notifier() {

    if (elgg_is_logged_in()) {

    $class = "elgg-icon elgg-icon-mail"; // <--- elgg premade classes to show mail icon

    $text = "<span class='$class'></span>"; <--- using the span tag as a container for the image

    $tooltip = elgg_echo("messages");

     

    // get unread messages

    $num_messages = (int)messages_count_unread();

    if ($num_messages != 0) { <--- if $num_messages isn't 0/null then shows the counter

    $text .= "<span class=\"messages-new\">$num_messages</span>";

    $tooltip .= " (" . elgg_echo("messages:unreadcount", array($num_messages)) . ")";

    }

     

    elgg_register_menu_item('topbar', array(

    'name' => 'messages',

    'href' => 'messages/inbox/' . elgg_get_logged_in_user_entity()->username,

    'text' => $text, <--- variable being called to display the icon along with the counted new messages

    'priority' => 600,

    'title' => $tooltip,

    ));

    }

    }

  • @$('Cim')

    been there (start.php) of messages

    whenever i have troubles like this i use windows grep to search all the files for relative functions which lead me to start.php 

    i always get the message :(

    Fatal error: Cannot redeclare messages_notifier() (previously declared in /home/content/.*/.*/html/mod/messages/start.php:125) in/home/content/.*/.*/html/views/default/page/layouts/content/sidebar.php on line 44

  • yeah you're not supposed to put the actual function in your theme's start.php. use the snippet

  • oops lol

    No error but icon not showing :(