會員註冊 / 登入  |  電腦版  |  Jump to bottom of page

User Forum » Admin Background Color

發表人: XxSky DreamerxX
10 年 前
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
10 年 前
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
10 年 前
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
10 年 前
Hello, Any help on this one?

Thanks!

發表人: andowson
10 年 前
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; }




會員註冊 / 登入  |  電腦版  |  Jump to top of page