Hi guys, fine?
I'm using the k18 theme, and i want to move the profile photo and settings link to the right side, to seems like facebook.
Look the print: http://prntscr.com/8e7fbi
Here is the code
<?php
/**
* Aalborg theme plugin
*
* @package AalborgTheme
*/
elgg_register_event_handler('init','system','k18_init');
function k18_init() {
elgg_register_event_handler('pagesetup', 'system', 'k18_pagesetup', 1000);
// theme specific CSS
elgg_extend_view('css/elgg', 'k18/css');
elgg_extend_view('page/elements/head', 'k18/head');
elgg_register_page_handler('dashboard', 'k18_dashboard_handler');
elgg_register_js('respond', 'mod/k18/vendors/js/respond.min.js');
elgg_load_js('respond');
// non-members do not get visible links to RSS feeds
if (!elgg_is_logged_in()) {
elgg_unregister_plugin_hook_handler('output:before', 'layout', 'elgg_views_add_rss_link');
}
elgg_unregister_plugin_hook_handler('register', 'menu:river', 'elgg_river_menu_setup');
elgg_register_plugin_hook_handler('register', 'menu:river', 'k18_river_menu_handler');
}
/**
* Rearrange menu items
*/
function k18_pagesetup() {
$user = elgg_get_logged_in_user_entity();
$site = elgg_get_site_entity();
elgg_unextend_view('page/elements/header', 'search/header');
if (elgg_is_logged_in()) {
elgg_extend_view('page/elements/sidebar', 'search/header', 0);
}
elgg_unregister_menu_item('topbar','elgg_logo');
elgg_unregister_menu_item('topbar','profile');
if ($user) {
elgg_register_menu_item('avataruser', array(
'name' => 'profile',
'href' => $user->getURL(),
'text' => elgg_view('output/img', array(
'src' => $user->getIconURL('small'),
'alt' => $user->name,
'title' => elgg_echo('edit:profile'),
'class' => 'elgg-border-plain elgg-transition',
)),
'priority' => 100,
'link_class' => 'elgg-topbar-avatar',
));
elgg_register_menu_item('topbaruser', array(
'name' => 'user',
'href' => $user->getURL(),
'text' => $user->name ,
'priority' => 120,
));
elgg_register_menu_item('topbaruser', array(
'name' => 'edit',
'href' => "/settings/user/$user->username",
'text' => elgg_echo('edit:settings'),
'priority' => 140,
));
}
elgg_register_menu_item('topbar', array(
'name' => 'sitename',
'href' => "/",
'text' => "$site->name",
'priority' => 1,
'class' => 'elgg-topbar-name-site',
));
$item = k18_elgg_get_menu_item('topbar', 'friends');
if ($item) {
$item->setText(elgg_view_icon('users24','elgg-icon24'));
$item->setTooltip(elgg_echo('friends'));
}
if (elgg_is_active_plugin('chat_pfc')) {
$item = k18_elgg_get_menu_item('topbar', 'chat_pfc');
if ($item) {
$item->setText(elgg_view_icon('chat_pfc','elgg-icon24'));
$item->setTooltip(elgg_echo('chat_pfc'));
}
}
$item = k18_elgg_get_menu_item('topbar', 'messages');
if ($item) {
$class = "elgg-icon elgg-icon-mail24 elgg-icon24";
$text = "<span class='$class'></span>";
$tooltip = elgg_echo("messages");
$num_messages = (int)messages_count_unread();
if ($num_messages != 0) {
$text .= "<span class=\"messages-new\">$num_messages</span>";
$tooltip .= " (" . elgg_echo("messages:unreadcount", array($num_messages)) . ")";
}
$item->setText($text);
$item->setTooltip($tooltip);
}
if (elgg_is_active_plugin('dashboard')) {
elgg_unregister_menu_item('topbar', 'dashboard');
elgg_register_menu_item('topbar', array(
'name' => 'dashboard',
'href' => "/dashboard",
'title' => elgg_echo('home'),
'text' => elgg_view_icon('home24','elgg-icon24'),
'priority' => 980,
));
} else {
elgg_register_menu_item('topbar', array(
'name' => 'activity',
'href' => "/activity",
'title' => elgg_echo('home'),
'text' => elgg_view_icon('home24','elgg-icon24'),
'priority' => 980,
));
}
elgg_unregister_menu_item('topbar', 'usersettings');
$item = k18_elgg_get_menu_item('topbar', 'administration');
if ($item) {
$item->setText(elgg_view_icon('setting24','elgg-icon24'));
$item->setTooltip(elgg_echo('settings'));
}
$item = k18_elgg_get_menu_item('topbar', 'logout');
if ($item) {
$item->setText(elgg_view_icon('logout24','elgg-icon24'));
$item->setTooltip(elgg_echo('logout'));
}
if (elgg_is_active_plugin('site_notifications')) {
$item = k18_elgg_get_menu_item('topbar', 'site_notifications');
elgg_unregister_menu_item('topbar', 'site_notifications');
if ($item) {
$text = elgg_view_icon('info') . elgg_echo('site_notifications:topbar');
$item->setText( $text );
$item->setContext('dashboard','activity');
elgg_register_menu_item('menu-sidebar', $item);
}
}
if (elgg_is_active_plugin('chat_pfc')) {
elgg_register_menu_item('menu-sidebar', array(
'section' => 'sidebar',
'name' => "chat",
'text' => elgg_view_icon('speech-bubble-alt','elgg-icon16x16').elgg_echo('chat_pfc'),
'href' => "chat_pfc",
'contexts' => array('dashboard','activity'),
));
}
if (elgg_is_active_plugin('poll')) {
elgg_register_menu_item('menu-sidebar', array(
'section' => 'sidebar',
'name' => "poll",
'text' => elgg_view_icon('polls','elgg-icon').elgg_echo('poll'),
'href' => "poll/owner/$user->username",
'contexts' => array('dashboard','activity'),
));
}
if (elgg_is_active_plugin('groups')) {
elgg_register_menu_item('groups', array(
'section' => 'sidebar',
'name' => "title",
'text' => elgg_echo('groups'),
'href' => "groups/member/$user->username",
'contexts' => array('dashboard','activity'),
));
if (elgg_is_active_plugin('reportedcontent')) {
$item = k18_elgg_get_menu_item('footer', 'report_this');
$success = elgg_unregister_menu_item('footer', 'report_this');
if ($success) {
$item->setText(elgg_view_icon('report-this'));
$item->setPriority(500);
$item->setSection('default');
elgg_register_menu_item('extras', $item);
}
}
if (elgg_is_logged_in()) {
$groups = $user->getGroups('', 10);
foreach ($groups as $group) {
$icon = elgg_view('output/img', array(
'src' => $group->getIconURL('tiny'),
'alt' => $group->name,
'title' => elgg_echo('edit:profile'),
'width' => '16',
'height' => '16',
'class' => 'elgg-menu-item-groups-icon',
));
elgg_register_menu_item('groups', array(
'section' => 'sidebar',
'name' => "groups-$group->guid elgg-menu-item-groups",
'text' => $icon . $group->name,
'href' => "/groups/activity/$group->guid",
'contexts' => array('dashboard','activity'),
'class' => 'elgg-menu-item-groups',
));
}
}
}
}
function k18_dashboard_handler() {
require_once dirname(__FILE__) . '/pages/dashboard.php';
return true;
}
/**
* Get a menu item registered for a menu
*
* @param string $menu_name The name of the menu
* @param string $item_name The unique identifier for this menu item
*
* @return ElggMenuItem
*/
function k18_elgg_get_menu_item($menu_name, $item_name) {
global $CONFIG;
if (!isset($CONFIG->menus[$menu_name])) {
return null;
}
foreach ($CONFIG->menus[$menu_name] as $index => $menu_object) {
/* @var ElggMenuItem $menu_object */
if ($menu_object->getName() == $item_name) {
return $CONFIG->menus[$menu_name][$index];
}
}
return null;
}
function k18_river_menu_handler($hook, $type, $items, $params) {
$item = $params['item'];
$object = $item->getObjectEntity();
if (!elgg_in_context('widgets') && !$item->annotation_id && $object instanceof ElggEntity) {
if (elgg_is_active_plugin('likes') && $object->canAnnotate(0, 'likes')) {
if (!elgg_annotation_exists($object->getGUID(), 'likes')) {
// user has not liked this yet
$options = array(
'name' => 'like',
'href' => "action/likes/add?guid={$object->guid}",
'text' => elgg_view_icon('thumbs-up'),
'is_action' => true,
'priority' => 900,
);
} else {
// user has liked this
$options = array(
'name' => 'like',
'href' => "action/likes/delete?guid={$object->guid}",
'text' => elgg_view_icon('thumbs-down'),
'is_action' => true,
'priority' => 900,
);
}
$items[] = ElggMenuItem::factory($options);
}
if ($object->canAnnotate(0, 'generic_comment')) {
$items[] = ElggMenuItem::factory(array(
'name' => 'comment',
'href' => "#comments-add-$object->guid",
'text' => elgg_echo('comment'),
'title' => elgg_echo('comment:this'),
'rel' => "toggle",
'priority' => 50,
));
}
if ($object instanceof ElggUser && !$object->isFriend()) {
$items[] = ElggMenuItem::factory(array(
'name' => 'addfriend',
'href' => "/action/friends/add?friend=$object->guid",
'text' => elgg_echo('friend:user:add', array($object->name)),
'is_action' => TRUE,
));
}
if (elgg_instanceof($object, 'object', 'groupforumtopic')) {
$items[] = ElggMenuItem::factory(array(
'name' => 'reply',
'href' => "#groups-reply-$object->guid",
'title' => elgg_echo('reply:this'),
'text' => elgg_echo('reply'),
));
}
}
return $items;
}
I've tried to change the "priority" and the sequence but nothing works, someone can send me a light?
Thx <3
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.