Author: RafaelS.
Working forum versions: All versions, except AwesomeBB
Application Result
The application will look as follows after being applied to the forum:Installation
The installation is unique, and can only be done by creating a new javascript. CSS can be modified, and is embedded in Javascript. Please follow the steps below to install the effect on your community.Control Panel >> Modules >> HTML and Javascript >> Management of Javascript codes >> Create a new javascript
Placement: On all pages
- Code:
/****
* Application: Link and avatar in the navbar
* Description: This application can show the link to the user's profile and avatar in the navbar.
* Version: 1.0
* Made and Optimizations by RafaelS. - 2018/07/06
* View more in: https://ajuda.forumeiros.com
* Copyright (c) 2018 RafaelS.<rafael_s at outlook dot pt>
* This work is free. You can redistribute it and/or modify it
* under the terms of the WTFPL, Version 2
**/
$(function() {
if(_userdata.session_logged_in > 0) {
 var username = _userdata.username, userid = _userdata.user_id,navb,linkav = _userdata.avatar,prependcode = '<li><a class="mainmenu rafavatar" href="/u'+userid+'"><span id="img">'+linkav+'</span>'+username+'</a></li>';
Â
if($('body#modernbb').length > 0) navb = '.navbar.navlinks'; // ModernBB version
else if($('td.bodyline').length > 0){navb = '.bodyline table:eq(1) tr td';prependcode = '<a class="mainmenu rafavatar" href="/u'+userid+'"><span id="img">'+linkav+'</span>'+username+'</a> ';} // phpBB2 version
else if($('body#phpbb').length > 0){ navb = '.navbar .linklist.navlinks';prependcode = '<li><a class="mainmenu rafavatar" href="/u'+userid+'"><span id="img">'+linkav+'</span>'+username+'</a> </li>';} // phpBB3 version
else if($('.pun #pun-intro').length > 0)navb = '#pun-navlinks ul.clearfix';// punBB version
else if($('#ipbwrapper').length > 0){ navb = '#submenu ul li'; prependcode= '<a class="mainmenu rafavatar" href="/u'+userid+'"><span id="img">'+linkav+'</span>'+username+'</a>';} // Invision version
else return; // no valid version
Â
$('head').append(
  '<style type="text/css">' +
  '.mainmenu.rafavatar img {' +
  'display: inline-block !important;'+
  'width:30px;' +
  'height: 30px;' +
  'vertical-align: middle;' +
  'border-radius: 16px;'   +
  'margin-right: 7px;'   +
  'box-shadow: 0 2px 2px rgba(0,0,0,0.1);' +
 'filter: none;' +
  '}' +
  '</style>'
 );
Â
$(navb).prepend(prependcode);
}else{return;}});