a user recently was asking here: https://community.mybb.com/thread-231606...pid1364263 about how to hide certain added toplinks links display from guest usergroup and during providing suggestions to such I provided expand upon suggestions based on existing toplinks for examples to then apply to the users added toplinks and thus came to creation of the following suggestions and the share as a tutorial here also just in case it is of any need to any others:
[TUT] - Simple edits to hide by gid toplink item and or also stylize visble items by gid
...a simple way and without the requirement of a plugin is a simple minor edit of css and template:
ie: of guest usergroup not being displayed a link (for this example: help link):
![[Image: Forums.png]]()
for this example i will use the help section toplink just to show a basic example though for your usages require say for link in toplinks you added then you would just apply this to your specific added links instead if such is only required:
in header template:
I add one minor edit to add class by GID to link:
and in global.css i add the relative styling:
so in a nutshell what this simply does so far is find if user viewing is usergroup_1 ie: guest then the link display is hidden to that usergroup but then the minute I login I am usergroup other than 1/ guest so since my usergroup is not defined to display none then it is not applied thus visible unless you further modify it to do so for any other usergroup id #
OK, if all you wanted is simply as guest non visibility for all links you apply this class to the link then you can stop here as this accomplishes that. NOTE: any suggestions found below are simply in reference to further expand upon base suggestion if so desired:
Just in case you need to know default GIDs to expand this edit to if desired, the default GIDs are as follows:
if you have say additional added usergroups that you desired to apply this to then you would take note of those addition gid #s
and understand that you simply would add respective css in stylesheet for such after the initial link class edit has been applied per link desired in initial template edit
ie:
etc...
etc...
only if desired... but understand the existing edit will mean you use this on all links desired, except if you desired to do this link specific....
meaning..., link 1 is hidden to say these usergroups...
and say link 2 is hidden to say these other usergroups...
then in that case the original snippet would need to be modified
so for that example let us do it to the existing help link already modified but let us call that link 1 now
Edit Template: header
I add one minor edit to add class link1 ( l1 ) by GID to link:
and in global.css i add the relative styling:
ok, for this example we are going to apply a link 2 and use link 2 to apply to calendar link also:
Edit Template: header_menu_calendar
I add one minor edit to add class link2 ( l2 ) by GID to link:
and in global.css i add the relative styling:
here i still apply to usergroup 1 guest as that is your request but say you want other groups on a link you could define those and remove the existing link 1 or link 2 usergroup 1 styling for either desired link...
but again for example and is why i suggested the l1 l2 variant is say you decide to apply a l3 to memberlist link for example:
Edit Template: header_menu_memberlist
and in global.css i add the relative styling:
say you decide to apply a l4 to search link for example:
ok, for this example we are going to apply a link 4 and use link 4 to apply to search link also:
Edit Template: header_menu_search
and in global.css i add the relative styling:
and then say you decide hey, the guest should still see help docs but not calendar, memberlist or search but then we want say for example usergroup 7 and 5 to still not see help docs we would change css as follows:
and if you want gid 5 & 7 for example applied to all simply for an example of additional gids added beyond gid 1
ie:
![[Image: Forums.png]]()
oh, in this example so far we have set style/display control on 4 links but for what come next as suggested let us finish up the last link in default as we are using default links for example thought you would simply do similar for your specific added links
anyhoo, let us quickly round up the guide by doing link 5:
say you decide to apply a l5 to portal link for example:
ok, for this example we are going to apply a link 5 and use link 5 to apply to portal link also:
Edit Template: header_menu_portal
from:
to:
also note that you can say set other styling for example, say on a link you want the guest to see you decide to set a link color to orange for that usergroup:
so:
and so:
for example another reason I say you can expand on what is displayed or not by say this example of for usergroup 4 i could say opt to want to style the displayed links to the gid 4 text color for gid 4 user on l1, l2, l3, l4, l5 just for example sake:
etc, etc... hopefully that makes sense on how to expand upon this and you see why I suggest after to expand by specific link and such if so desired as doing such gives a bit of control per...
just a final example of the aforementioned 5 link edits with various suggested stylings ie visibles by styled gids, 4, 6, 3, 2 applied to make overall css now replace by:
NOTE: what this final does is after you have modified in templates the aforementioned template edits of link class to l1, l2, l3,l4, l5 by gid it styles toplink links for gids that it displays for and hides menu items from usergroups that are defined to not display, etc, etc...
also if you decide that say oh, hey guest shouldnt see portal link either then find:
and uncomment like so:
thus now only allowing guest to see the help link
ie:
![[Image: Forums-Help-Documents.png]]()
oh, you could also if you desire as you see from final css example above, it is getting lengthly say opt to cut and copy your addition of this in global.css and opt instead to create a new stylesheet attached to your theme titled say, hmm,
toplink_visibility.css
attached globally and add the final css example to it instead, while removing any such previous from global.css... hmm... options... options.. if you decide to keep it all organized in one lil spot and expand
ie:
guest has some defined items hidden from them:
![[Image: Forums-3.png]]()
registered user with no hidden items:
![[Image: Forums-5.png]]()
mod & super mod without hidden items:
![[Image: Forums-2.png]]()
admin without hidden items:
![[Image: Forums-4.png]]()
You would then keep modifying further for whatever your specific usages may require....
oh if in the screenshots you see the welcomeblock username colored by gid, well that is not part of this tutorial, nor is it a plugin, it is a core edit:
for welcomeblock which can be applied with a quick core edit if desired:
in global.php
Find:
change to:
* but note: that this particular edit (not the previous tutorial content) would be overwritten on core updates and the global.php edit would have to be re-applied on updates....
though you could sort that particular issue out by simply creating a quick lil plugin for it instead of applying the global.php edit for example:
forum/inc/plugins/welcomegroup.php
ie: https://github.com/vintagedaddyo/MyBB_Pl...lcomeGroup
* again not part of this tutorial just explaining why it looked like that in for welcomeblock in screenshots, haha!
Best of luck!
Happy editing! ~ V
[TUT] - Simple edits to hide by gid toplink item and or also stylize visble items by gid
...a simple way and without the requirement of a plugin is a simple minor edit of css and template:
ie: of guest usergroup not being displayed a link (for this example: help link):
for this example i will use the help section toplink just to show a basic example though for your usages require say for link in toplinks you added then you would just apply this to your specific added links instead if such is only required:
in header template:
<li><a href="{$mybb->settings['bburl']}/misc.php?action=help" class="help">{$lang->toplinks_help}</a></li>I add one minor edit to add class by GID to link:
<li class="visibility_{$mybb->user['usergroup']}"><a href="{$mybb->settings['bburl']}/misc.php?action=help" class="help">{$lang->toplinks_help}</a></li>and in global.css i add the relative styling:
ul.menu li.visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}so in a nutshell what this simply does so far is find if user viewing is usergroup_1 ie: guest then the link display is hidden to that usergroup but then the minute I login I am usergroup other than 1/ guest so since my usergroup is not defined to display none then it is not applied thus visible unless you further modify it to do so for any other usergroup id #
OK, if all you wanted is simply as guest non visibility for all links you apply this class to the link then you can stop here as this accomplishes that. NOTE: any suggestions found below are simply in reference to further expand upon base suggestion if so desired:
Just in case you need to know default GIDs to expand this edit to if desired, the default GIDs are as follows:
[ 1 ] _ Guests
[ 2 ] _ Registered
[ 3 ] _ Super Moderators
[ 4 ] _ Administrators
[ 5 ] _ Awaiting Activation
[ 6 ] _ Moderators
[ 7 ] _ Bannedif you have say additional added usergroups that you desired to apply this to then you would take note of those addition gid #s
and understand that you simply would add respective css in stylesheet for such after the initial link class edit has been applied per link desired in initial template edit
ie:
etc...
ul.menu li.visibility_7 {
/* hide menu link for usergroup_7 */
display: none !important;
}etc...
ul.menu li.visibility_5 {
/* hide menu link for usergroup_5 */
display: none !important;
}only if desired... but understand the existing edit will mean you use this on all links desired, except if you desired to do this link specific....
meaning..., link 1 is hidden to say these usergroups...
and say link 2 is hidden to say these other usergroups...
then in that case the original snippet would need to be modified
so for that example let us do it to the existing help link already modified but let us call that link 1 now
Edit Template: header
<li><a href="{$mybb->settings['bburl']}/misc.php?action=help" class="help">{$lang->toplinks_help}</a></li>I add one minor edit to add class link1 ( l1 ) by GID to link:
<li class="l1-visibility_{$mybb->user['usergroup']}"><a href="{$mybb->settings['bburl']}/misc.php?action=help" class="help">{$lang->toplinks_help}</a></li>and in global.css i add the relative styling:
/* link 1 usergroup 1 */
ul.menu li.l1-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}ok, for this example we are going to apply a link 2 and use link 2 to apply to calendar link also:
Edit Template: header_menu_calendar
<li><a href="{$mybb->settings['bburl']}/calendar.php" class="calendar">{$lang->toplinks_calendar}</a></li>I add one minor edit to add class link2 ( l2 ) by GID to link:
<li class="l2-visibility_{$mybb->user['usergroup']}"><a href="{$mybb->settings['bburl']}/calendar.php" class="calendar">{$lang->toplinks_calendar}</a></li>and in global.css i add the relative styling:
/* link 2 - usergroup 1 */
ul.menu li.l2-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}here i still apply to usergroup 1 guest as that is your request but say you want other groups on a link you could define those and remove the existing link 1 or link 2 usergroup 1 styling for either desired link...
but again for example and is why i suggested the l1 l2 variant is say you decide to apply a l3 to memberlist link for example:
Edit Template: header_menu_memberlist
<li><a href="{$mybb->settings['bburl']}/memberlist.php" class="memberlist">{$lang->toplinks_memberlist}</a></li>
<li class="l3-visibility_{$mybb->user['usergroup']}"><a href="{$mybb->settings['bburl']}/memberlist.php" class="memberlist">{$lang->toplinks_memberlist}</a></li>
and in global.css i add the relative styling:
/* link 3 - usergroup 1 */
ul.menu li.l3-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}say you decide to apply a l4 to search link for example:
ok, for this example we are going to apply a link 4 and use link 4 to apply to search link also:
Edit Template: header_menu_search
<li><a href="{$mybb->settings['bburl']}/search.php" class="search">{$lang->toplinks_search}</a></li><li class="l4-visibility_{$mybb->user['usergroup']}"><a href="{$mybb->settings['bburl']}/search.php" class="search">{$lang->toplinks_search}</a></li>and in global.css i add the relative styling:
/* link 4 - usergroup 1 */
ul.menu li.l4-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}and then say you decide hey, the guest should still see help docs but not calendar, memberlist or search but then we want say for example usergroup 7 and 5 to still not see help docs we would change css as follows:
/* link 1 - usergroup 1 */
ul.menu li.l1-visibility_1 {
/* hide menu link for usergroup_1 */
/* display: none !important; */
}
/* link 1 - usergroup 5 */
ul.menu li.l1-visibility_5 {
/* hide menu link for usergroup_5 */
display: none !important;
}
/* link 1 - usergroup 7 */
ul.menu li.l1-visibility_7 {
/* hide menu link for usergroup_7 */
display: none !important;
}
/* link 2 - usergroup 1 */
ul.menu li.l2-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}
/* link 3 - usergroup 1 */
ul.menu li.l3-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}
/* link 4 - usergroup 1 */
ul.menu li.l4-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}
and if you want gid 5 & 7 for example applied to all simply for an example of additional gids added beyond gid 1
/** Link 1 **/
/* link 1 - usergroup 1 */
ul.menu li.l1-visibility_1 {
/* hide menu link for usergroup_1 */
/* display: none !important; */
}
/* link 1 - usergroup 5 */
ul.menu li.l1-visibility_5 {
/* hide menu link for usergroup_5 */
display: none !important;
}
/* link 1 - usergroup 7 */
ul.menu li.l1-visibility_7 {
/* hide menu link for usergroup_7 */
display: none !important;
}
/** Link 2 **/
/* link 2 - usergroup 1 */
ul.menu li.l2-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}
/* link 2 - usergroup 5 */
ul.menu li.l2-visibility_5 {
/* hide menu link for usergroup_5 */
display: none !important;
}
/* link 2 - usergroup 7 */
ul.menu li.l2-visibility_7 {
/* hide menu link for usergroup_7 */
display: none !important;
}
/** Link 3 **/
/* link 3 - usergroup 1 */
ul.menu li.l3-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}
/* link 3 - usergroup 5 */
ul.menu li.l3-visibility_5 {
/* hide menu link for usergroup_5 */
display: none !important;
}
/* link 3 - usergroup 7 */
ul.menu li.l3-visibility_7 {
/* hide menu link for usergroup_7 */
display: none !important;
}
/** Link 4 **/
/* link 4 - usergroup 1 */
ul.menu li.l4-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}
/* link 4 - usergroup 5 */
ul.menu li.l4-visibility_5 {
/* hide menu link for usergroup_5 */
display: none !important;
}
/* link 4 - usergroup 7 */
ul.menu li.l4-visibility_7 {
/* hide menu link for usergroup_7 */
display: none !important;
}
ie:
oh, in this example so far we have set style/display control on 4 links but for what come next as suggested let us finish up the last link in default as we are using default links for example thought you would simply do similar for your specific added links
anyhoo, let us quickly round up the guide by doing link 5:
say you decide to apply a l5 to portal link for example:
ok, for this example we are going to apply a link 5 and use link 5 to apply to portal link also:
Edit Template: header_menu_portal
from:
<li><a href="{$mybb->settings['bburl']}/portal.php" class="portal">{$lang->toplinks_portal}</a></li>to:
<li class="l5-visibility_{$mybb->user['usergroup']}"><a href="{$mybb->settings['bburl']}/portal.php" class="portal">{$lang->toplinks_portal}</a></li>
/* link 5 - usergroup 1 */
ul.menu li.l5-visibility_1 {
/* hide menu link for usergroup_1 */
/* display: none !important; */
}we have this commented out for now because it is only there if we ever decide to enable display none for this link and youalso note that you can say set other styling for example, say on a link you want the guest to see you decide to set a link color to orange for that usergroup:
/* link 1 - usergroup 1 a */
ul.menu li.l1-visibility_1 a {
color: orange !important;
}so:
/** Link 1 **/
/* link 1 - usergroup 1 */
ul.menu li.l1-visibility_1 {
/* hide menu link for usergroup_1 */
/* display: none !important; */
}
/* link 1 - usergroup 1 a */
ul.menu li.l1-visibility_1 a {
/* link color */
color: #FF7705 !important;
}
/* link 1 - usergroup 1 visited state */
ul.menu li.l1-visibility_1 a:visited {
/* link color */
color: #FF7705 !important;
}
/* link 1 - usergroup 1 active & hover states */
ul.menu li.l1-visibility_1 a:active,
ul.menu li.l1-visibility_1 a:hover {
/* link color */
color: #0069B1 !important;
}
and so:
/** Link 5 **/
/* link 5 - usergroup 1 */
ul.menu li.l5-visibility_1 {
/* hide menu link for usergroup_1 */
/* display: none !important; */
}
/* link 5 - usergroup 1 a */
ul.menu li.l5-visibility_1 a {
/* link color */
color: #FF7705 !important;
}
/* link 5 - usergroup 1 visited state */
ul.menu li.l5-visibility_1 a:visited {
/* link color */
color: #FF7705 !important;
}
/* link 5 - usergroup 1 active & hover states */
ul.menu li.l5-visibility_1 a:active,
ul.menu li.l5-visibility_1 a:hover {
/* link color */
color: #0069B1 !important;
}
for example another reason I say you can expand on what is displayed or not by say this example of for usergroup 4 i could say opt to want to style the displayed links to the gid 4 text color for gid 4 user on l1, l2, l3, l4, l5 just for example sake:
/* link 1 - usergroup 4 a */
ul.menu li.l1-visibility_4 a {
/* link color */
color: #008000 !important;
}
/* link 1 - usergroup 4 visited state */
ul.menu li.l1-visibility_4 a:visited {
/* link color */
color: #008000 !important;
}
/* link 1 - usergroup 4 active & hover states */
ul.menu li.l1-visibility_4 a:active,
ul.menu li.l1-visibility_4 a:hover {
/* link color */
color: #003400 !important;
}
/* link 2 - usergroup 4 a */
ul.menu li.l2-visibility_4 a {
/* link color */
color: #008000 !important;
}
/* link 2 - usergroup 4 visited state */
ul.menu li.l2-visibility_4 a:visited {
/* link color */
color: #008000 !important;
}
/* link 2 - usergroup 4 active & hover states */
ul.menu li.l2-visibility_4 a:active,
ul.menu li.l2-visibility_4 a:hover {
/* link color */
color: #003400 !important;
}
/* link 3 - usergroup 4 a */
ul.menu li.l3-visibility_4 a {
/* link color */
color: #008000 !important;
}
/* link 3 - usergroup 4 visited state */
ul.menu li.l3-visibility_4 a:visited {
/* link color */
color: #008000 !important;
}
/* link 3 - usergroup 4 active & hover states */
ul.menu li.l3-visibility_4 a:active,
ul.menu li.l3-visibility_4 a:hover {
/* link color */
color: #003400 !important;
}
/* link 4 - usergroup 4 a */
ul.menu li.l4-visibility_4 a {
/* link color */
color: #008000 !important;
}
/* link 4 - usergroup 4 visited state */
ul.menu li.l4-visibility_4 a:visited {
/* link color */
color: #008000 !important;
}
/* link 4 - usergroup 4 active & hover states */
ul.menu li.l4-visibility_4 a:active,
ul.menu li.l4-visibility_4 a:hover {
/* link color */
color: #003400 !important;
}
/* link 5 - usergroup 4 a */
ul.menu li.l5-visibility_4 a {
/* link color */
color: #008000 !important;
}
/* link 5 - usergroup 4 visited state */
ul.menu li.l5-visibility_4 a:visited {
/* link color */
color: #008000 !important;
}
/* link 5 - usergroup 4 active & hover states */
ul.menu li.l5-visibility_4 a:active,
ul.menu li.l5-visibility_4 a:hover {
/* link color */
color: #003400 !important;
}
etc, etc... hopefully that makes sense on how to expand upon this and you see why I suggest after to expand by specific link and such if so desired as doing such gives a bit of control per...
just a final example of the aforementioned 5 link edits with various suggested stylings ie visibles by styled gids, 4, 6, 3, 2 applied to make overall css now replace by:
/* Hide by GID Toplinks link and display displayed styling by GID TUT by: V */
/** Link 1 **/
/* link 1 - usergroup 1 */
ul.menu li.l1-visibility_1 {
/* hide menu link for usergroup_1 */
/* display: none !important; */
}
/* link 1 - usergroup 1 a */
ul.menu li.l1-visibility_1 a {
/* link color */
color: #FF7705 !important;
}
/* link 1 - usergroup 1 visited state */
ul.menu li.l1-visibility_1 a:visited {
/* link color */
color: #FF7705 !important;
}
/* link 1 - usergroup 1 active & hover states */
ul.menu li.l1-visibility_1 a:active,
ul.menu li.l1-visibility_1 a:hover {
/* link color */
color: #0069B1 !important;
}
/* link 1 - usergroup 5 */
ul.menu li.l1-visibility_5 {
/* hide menu link for usergroup_5 */
display: none !important;
}
/* link 1 - usergroup 7 */
ul.menu li.l1-visibility_7 {
/* hide menu link for usergroup_7 */
display: none !important;
}
/* admin */
/* link 1 - usergroup 4 a */
ul.menu li.l1-visibility_4 a {
/* link color */
color: #008000 !important;
}
/* link 1 - usergroup 4 visited state */
ul.menu li.l1-visibility_4 a:visited {
/* link color */
color: #008000 !important;
}
/* link 1 - usergroup 4 active & hover states */
ul.menu li.l1-visibility_4 a:active,
ul.menu li.l1-visibility_4 a:hover {
/* link color */
color: #003400 !important;
}
/* super mod */
/* link 1 - usergroup 6 a */
ul.menu li.l1-visibility_6 a {
/* link color */
color: #CC00CC !important;
}
/* link 1 - usergroup 6 visited state */
ul.menu li.l1-visibility_6 a:visited {
/* link color */
color: #CC00CC !important;
}
/* link 1 - usergroup 6 active & hover states */
ul.menu li.l1-visibility_6 a:active,
ul.menu li.l1-visibility_6 a:hover {
/* link color */
color: #990099 !important;
}
/* mod */
/* link 1 - usergroup 3 a */
ul.menu li.l1-visibility_3 a {
/* link color */
color: #CC00CC !important;
}
/* link 1 - usergroup 3 visited state */
ul.menu li.l1-visibility_3 a:visited {
/* link color */
color: #CC00CC !important;
}
/* link 1 - usergroup 3 active & hover states */
ul.menu li.l1-visibility_3 a:active,
ul.menu li.l1-visibility_3 a:hover {
/* link color */
color: #990099 !important;
}
/* registered */
/* link 1 - usergroup 2 a */
ul.menu li.l1-visibility_2 a {
/* link color */
color: #0072BC !important;
}
/* link 1 - usergroup 2 visited state */
ul.menu li.l1-visibility_2 a:visited {
/* link color */
color: #0072BC !important;
}
/* link 1 - usergroup 2 active & hover states */
ul.menu li.l1-visibility_2 a:active,
ul.menu li.l1-visibility_2 a:hover {
/* link color */
color: #005389 !important;
}
/** Link 2 **/
/* link 2 - usergroup 1 */
ul.menu li.l2-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}
/* link 2 - usergroup 5 */
ul.menu li.l2-visibility_5 {
/* hide menu link for usergroup_5 */
display: none !important;
}
/* link 2 - usergroup 7 */
ul.menu li.l2-visibility_7 {
/* hide menu link for usergroup_7 */
display: none !important;
}
/* admin */
/* link 2 - usergroup 4 a */
ul.menu li.l2-visibility_4 a {
/* link color */
color: #008000 !important;
}
/* link 2 - usergroup 4 visited state */
ul.menu li.l2-visibility_4 a:visited {
/* link color */
color: #008000 !important;
}
/* link 2 - usergroup 4 active & hover states */
ul.menu li.l2-visibility_4 a:active,
ul.menu li.l2-visibility_4 a:hover {
/* link color */
color: #003400 !important;
}
/* super mod */
/* link 2 - usergroup 6 a */
ul.menu li.l2-visibility_6 a {
/* link color */
color: #CC00CC !important;
}
/* link 2 - usergroup 6 visited state */
ul.menu li.l2-visibility_6 a:visited {
/* link color */
color: #CC00CC !important;
}
/* link 2 - usergroup 6 active & hover states */
ul.menu li.l2-visibility_6 a:active,
ul.menu li.l2-visibility_6 a:hover {
/* link color */
color: #990099 !important;
}
/* mod */
/* link 2 - usergroup 3 a */
ul.menu li.l2-visibility_3 a {
/* link color */
color: #CC00CC !important;
}
/* link 2 - usergroup 3 visited state */
ul.menu li.l2-visibility_3 a:visited {
/* link color */
color: #CC00CC !important;
}
/* link 2 - usergroup 3 active & hover states */
ul.menu li.l2-visibility_3 a:active,
ul.menu li.l2-visibility_3 a:hover {
/* link color */
color: #990099 !important;
}
/* registered */
/* link 2 - usergroup 2 a */
ul.menu li.l2-visibility_2 a {
/* link color */
color: #0072BC !important;
}
/* link 2 - usergroup 2 visited state */
ul.menu li.l2-visibility_2 a:visited {
/* link color */
color: #0072BC !important;
}
/* link 2 - usergroup 2 active & hover states */
ul.menu li.l2-visibility_2 a:active,
ul.menu li.l2-visibility_2 a:hover {
/* link color */
color: #005389 !important;
}
/** Link 3 **/
/* link 3 - usergroup 1 */
ul.menu li.l3-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}
/* link 3 - usergroup 5 */
ul.menu li.l3-visibility_5 {
/* hide menu link for usergroup_5 */
display: none !important;
}
/* link 3 - usergroup 7 */
ul.menu li.l3-visibility_7 {
/* hide menu link for usergroup_7 */
display: none !important;
}
/* admin */
/* link 3 - usergroup 4 a */
ul.menu li.l3-visibility_4 a {
/* link color */
color: #008000 !important;
}
/* link 3 - usergroup 4 visited state */
ul.menu li.l3-visibility_4 a:visited {
/* link color */
color: #008000 !important;
}
/* link 3 - usergroup 4 active & hover states */
ul.menu li.l3-visibility_4 a:active,
ul.menu li.l3-visibility_4 a:hover {
/* link color */
color: #003400 !important;
}
/* super mod */
/* link 3 - usergroup 6 a */
ul.menu li.l3-visibility_6 a {
/* link color */
color: #CC00CC !important;
}
/* link 3 - usergroup 6 visited state */
ul.menu li.l3-visibility_6 a:visited {
/* link color */
color: #CC00CC !important;
}
/* link 3 - usergroup 6 active & hover states */
ul.menu li.l3-visibility_6 a:active,
ul.menu li.l3-visibility_6 a:hover {
/* link color */
color: #990099 !important;
}
/* mod */
/* link 3 - usergroup 3 a */
ul.menu li.l3-visibility_3 a {
/* link color */
color: #CC00CC !important;
}
/* link 3 - usergroup 3 visited state */
ul.menu li.l3-visibility_3 a:visited {
/* link color */
color: #CC00CC !important;
}
/* link 3 - usergroup 3 active & hover states */
ul.menu li.l3-visibility_3 a:active,
ul.menu li.l3-visibility_3 a:hover {
/* link color */
color: #990099 !important;
}
/* registered */
/* link 3 - usergroup 2 a */
ul.menu li.l3-visibility_2 a {
/* link color */
color: #0072BC !important;
}
/* link 3 - usergroup 2 visited state */
ul.menu li.l3-visibility_2 a:visited {
/* link color */
color: #0072BC !important;
}
/* link 3 - usergroup 2 active & hover states */
ul.menu li.l3-visibility_2 a:active,
ul.menu li.l3-visibility_2 a:hover {
/* link color */
color: #005389 !important;
}
/** Link 4 **/
/* link 4 - usergroup 1 */
ul.menu li.l4-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}
/* link 4 - usergroup 5 */
ul.menu li.l4-visibility_5 {
/* hide menu link for usergroup_5 */
display: none !important;
}
/* link 4 - usergroup 7 */
ul.menu li.l4-visibility_7 {
/* hide menu link for usergroup_7 */
display: none !important;
}
/* admin */
/* link 4 - usergroup 4 a */
ul.menu li.l4-visibility_4 a {
/* link color */
color: #008000 !important;
}
/* link 4 - usergroup 4 visited state */
ul.menu li.l4-visibility_4 a:visited {
/* link color */
color: #008000 !important;
}
/* link 4 - usergroup 4 active & hover states */
ul.menu li.l4-visibility_4 a:active,
ul.menu li.l4-visibility_4 a:hover {
/* link color */
color: #003400 !important;
}
/* super mod */
/* link 4 - usergroup 6 a */
ul.menu li.l4-visibility_6 a {
/* link color */
color: #CC00CC !important;
}
/* link 4 - usergroup 6 visited state */
ul.menu li.l4-visibility_6 a:visited {
/* link color */
color: #CC00CC !important;
}
/* link 4 - usergroup 6 active & hover states */
ul.menu li.l4-visibility_6 a:active,
ul.menu li.l4-visibility_6 a:hover {
/* link color */
color: #990099 !important;
}
/* mod */
/* link 4 - usergroup 3 a */
ul.menu li.l4-visibility_3 a {
/* link color */
color: #CC00CC !important;
}
/* link 4 - usergroup 3 visited state */
ul.menu li.l4-visibility_3 a:visited {
/* link color */
color: #CC00CC !important;
}
/* link 4 - usergroup 3 active & hover states */
ul.menu li.l4-visibility_3 a:active,
ul.menu li.l4-visibility_3 a:hover {
/* link color */
color: #990099 !important;
}
/* registered */
/* link 4 - usergroup 2 a */
ul.menu li.l4-visibility_2 a {
/* link color */
color: #0072BC !important;
}
/* link 4 - usergroup 2 visited state */
ul.menu li.l4-visibility_2 a:visited {
/* link color */
color: #0072BC !important;
}
/* link 4 - usergroup 2 active & hover states */
ul.menu li.l4-visibility_2 a:active,
ul.menu li.l4-visibility_2 a:hover {
/* link color */
color: #005389 !important;
}
/** Link 5 **/
/* link 5 - usergroup 1 */
ul.menu li.l5-visibility_1 {
/* hide menu link for usergroup_1 */
/* display: none !important; */
}
/* link 5 - usergroup 1 a */
ul.menu li.l5-visibility_1 a {
/* link color */
color: #FF7705 !important;
}
/* link 5 - usergroup 1 visited state */
ul.menu li.l5-visibility_1 a:visited {
/* link color */
color: #FF7705 !important;
}
/* link 5 - usergroup 1 active & hover states */
ul.menu li.l5-visibility_1 a:active,
ul.menu li.l5-visibility_1 a:hover {
/* link color */
color: #0069B1 !important;
}
/* link 5 - usergroup 5 */
ul.menu li.l5-visibility_5 {
/* hide menu link for usergroup_5 */
display: none !important;
}
/* link 5 - usergroup 7 */
ul.menu li.l5-visibility_7 {
/* hide menu link for usergroup_7 */
display: none !important;
}
/* admin */
/* link 5 - usergroup 4 a */
ul.menu li.l5-visibility_4 a {
/* link color */
color: #008000 !important;
}
/* link 5 - usergroup 4 visited state */
ul.menu li.l5-visibility_4 a:visited {
/* link color */
color: #008000 !important;
}
/* link 5 - usergroup 4 active & hover states */
ul.menu li.l5-visibility_4 a:active,
ul.menu li.l5-visibility_4 a:hover {
/* link color */
color: #003400 !important;
}
/* super mod */
/* link 5 - usergroup 6 a */
ul.menu li.l5-visibility_6 a {
/* link color */
color: #CC00CC !important;
}
/* link 5 - usergroup 6 visited state */
ul.menu li.l5-visibility_6 a:visited {
/* link color */
color: #CC00CC !important;
}
/* link 5 - usergroup 6 active & hover states */
ul.menu li.l5-visibility_6 a:active,
ul.menu li.l5-visibility_6 a:hover {
/* link color */
color: #990099 !important;
}
/* mod */
/* link 5 - usergroup 3 a */
ul.menu li.l5-visibility_3 a {
/* link color */
color: #CC00CC !important;
}
/* link 5 - usergroup 3 visited state */
ul.menu li.l5-visibility_3 a:visited {
/* link color */
color: #CC00CC !important;
}
/* link 5 - usergroup 3 active & hover states */
ul.menu li.l5-visibility_3 a:active,
ul.menu li.l5-visibility_3 a:hover {
/* link color */
color: #990099 !important;
}
/* registered */
/* link 5 - usergroup 2 a */
ul.menu li.l5-visibility_2 a {
/* link color */
color: #0072BC !important;
}
/* link 5 - usergroup 2 visited state */
ul.menu li.l5-visibility_2 a:visited {
/* link color */
color: #0072BC !important;
}
/* link 5 - usergroup 2 active & hover states */
ul.menu li.l5-visibility_2 a:active,
ul.menu li.l5-visibility_2 a:hover {
/* link color */
color: #005389 !important;
}
NOTE: what this final does is after you have modified in templates the aforementioned template edits of link class to l1, l2, l3,l4, l5 by gid it styles toplink links for gids that it displays for and hides menu items from usergroups that are defined to not display, etc, etc...
also if you decide that say oh, hey guest shouldnt see portal link either then find:
/** Link 5 **/
/* link 5 - usergroup 1 */
ul.menu li.l5-visibility_1 {
/* hide menu link for usergroup_1 */
/* display: none !important; */
}
and uncomment like so:
/** Link 5 **/
/* link 5 - usergroup 1 */
ul.menu li.l5-visibility_1 {
/* hide menu link for usergroup_1 */
display: none !important;
}
thus now only allowing guest to see the help link
ie:
oh, you could also if you desire as you see from final css example above, it is getting lengthly say opt to cut and copy your addition of this in global.css and opt instead to create a new stylesheet attached to your theme titled say, hmm,
toplink_visibility.css
attached globally and add the final css example to it instead, while removing any such previous from global.css... hmm... options... options.. if you decide to keep it all organized in one lil spot and expand
ie:
guest has some defined items hidden from them:
registered user with no hidden items:
mod & super mod without hidden items:
admin without hidden items:
You would then keep modifying further for whatever your specific usages may require....
oh if in the screenshots you see the welcomeblock username colored by gid, well that is not part of this tutorial, nor is it a plugin, it is a core edit:
for welcomeblock which can be applied with a quick core edit if desired:
in global.php
Find:
// Format the welcome back message
$lang->welcome_back = $lang->sprintf($lang->welcome_back, build_profile_link(htmlspecialchars_uni($mybb->user['username']), $mybb->user['uid']), $lastvisit);change to:
// Format the welcome back message
//$lang->welcome_back = $lang->sprintf($lang->welcome_back, build_profile_link(htmlspecialchars_uni($mybb->user['username']), $mybb->user['uid']), $lastvisit);
// Format the welcome back message
$welcome_back_user = format_name($mybb->user['username'], $mybb->user['usergroup'], $mybb->user['displaygroup']);
$lang->welcome_back = $lang->sprintf($lang->welcome_back, build_profile_link($welcome_back_user, $mybb->user['uid']), $lastvisit);* but note: that this particular edit (not the previous tutorial content) would be overwritten on core updates and the global.php edit would have to be re-applied on updates....
though you could sort that particular issue out by simply creating a quick lil plugin for it instead of applying the global.php edit for example:
forum/inc/plugins/welcomegroup.php
<?php
/**
* This file is part of Welcome Group plugin for MyBB.
* Copyright (C) Vintagedaddyo
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// disallow direct access to this file
if(!defined("IN_MYBB"))
die("This file cannot be accessed directly.");
// add hooks
$plugins->add_hook("global_intermediate", "welcomegroup_global_run");
function welcomegroup_info()
{
return array(
"name" => "Welcome Group",
"description" => "Displays usergroup color for username in welcomeblock",
"website" => "https://community.mybb.com",
"author" => "Vintagedaddyo",
"authorsite" => "https://github.com/vintagedaddyo",
"version" => "1.0",
"guid" => "",
"compatibility" => "18*"
);
}
function welcomegroup_global_run()
{
global $db, $mybb, $lang, $lastvisit;
if($mybb->user['uid'] != 0)
{
// Format the welcome back message
//$lang->welcome_back = $lang->sprintf($lang->welcome_back, build_profile_link(htmlspecialchars_uni($mybb->user['username']), $mybb->user['uid']), $lastvisit);
// Format the welcome back message
$welcome_back_user = format_name($mybb->user['username'], $mybb->user['usergroup'], $mybb->user['displaygroup']);
$lang->welcome_back = $lang->sprintf($lang->welcome_back, build_profile_link($welcome_back_user, $mybb->user['uid']), $lastvisit);
}
}
?>ie: https://github.com/vintagedaddyo/MyBB_Pl...lcomeGroup
* again not part of this tutorial just explaining why it looked like that in for welcomeblock in screenshots, haha!
Best of luck!
Happy editing! ~ V