[Logo] JForum - Powering Communities
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 


The final version of JForum 2.8.0 has been released with lots of improvements. Read all about it here

Admin Background Color RSS feed
Forum Index » User Forum
Author Message
XxSky DreamerxX


Joined: 2011/9/19
Messages: 5
Offline
Hello Everyone! I am new and I just registered here on this forum because I am also running Jforum for my website since I download it from Google code smilie

I was wondering if the admin or anyone else can help me? How do I change the background post color for admin/mod? Can anyone help me? Thanks a lot in advance!
andowson


Joined: 2011/6/30
Messages: 230
Offline
Welcome to the community.

Q: How do I change the background post color for admin/mod?
A: I'm not sure what you are asking for. Can you use the print screen function to make a screenshot and draw an arrow to point out where you want to change?
Thank you~
XxSky DreamerxX


Joined: 2011/9/19
Messages: 5
Offline
Hello. I took a picture from another forum that is also using JForum and here is a print screen:

image

I want to change the background color like that smilie

You can go here to check it yourself: http://forums.downworld.com/forums/posts/list/30/66551.page#1853898

Thanks in advance ^_^
XxSky DreamerxX


Joined: 2011/9/19
Messages: 5
Offline
Hello, Any help on this one?

Thanks!
andowson


Joined: 2011/6/30
Messages: 230
Offline
1. You need a method to check if the post user is an Admin or a Moderator, because JForum-2.3.1 does not support this, so you have to add the following method to the src/main/java/net/jforum/entities/User.java and recompile it (Eclipse should help you fix the import):

/**
* Checks if the user is an administrator
*
* @return <code>true</code> if the user is an administrator
*/
public boolean isAdmin()
{
return SecurityRepository.canAccess(this.id, SecurityConstants.PERM_ADMINISTRATION);
}

/**
* Checks if the user is a moderator
*
* @return <code>true</code> if the user has moderations rights
*/
public boolean isModerator()
{
return SecurityRepository.canAccess(this.id, SecurityConstants.PERM_MODERATION);
}

/**
* Checks if the user can moderate a forum
*
* @param forumId the forum's id to check for moderation rights
* @return <code>true</code> if the user has moderations rights
*/
public boolean isModerator(int forumId)
{
final PermissionControl permissionControl = SecurityRepository.get(this.id);

return (permissionControl.canAccess(SecurityConstants.PERM_MODERATION))
&& (permissionControl.canAccess(SecurityConstants.PERM_MODERATION_FORUMS,
Integer.toString(forumId)));
}


Refer to How to Setup JForum Development Environment and download the source code.

2.Modify templates/default/post_show.htm, add the <#if>...</#if> part below <#assign> to change the CSS class
<#assign user = users.get(post.userId)/>

<#assign canEditCurrentMessage = (logged && post.canEdit && topic.status != STATUS_LOCKED) || moderatorCanEdit/>
<#if user.isAdmin() || user.isModerator(post.forumId)>
<#assign rowColor = "row3">
</#if>


3.Edit templates/default/styles/style.css if you want different color of td.row3:

/* td */
td.row1 { background-color: #fafafa; }
td.row2 { background-color: #f7f7f8; }
td.row3 { background-color: #dfdfdf; }
 
Forum Index » User Forum
Go to:   
Mobile view
Powered by JForum 2.8.0-b1 © 2021 JForum Team • Maintained by Andowson Chang and Ulf Dittmer