Add a different post text colour for admins

From PunBB Resource Wiki

Jump to: navigation, search

What it does

This small modification changes the admin's text colour in posts.

What to change

  • Open viewtopic.php
  • Find (~line 186)
 
// Retrieve the posts (and their respective poster/online status)
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
  • Change it to
 
// Retrieve the posts (and their respective poster/online status)
$result = $db->query('SELECT u.group_id, u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
  • Find (~line 328)
 
<div class="postmsg">
  • Replace it with
 
<?php echo '<div class="'.($cur_post['group_id'] == PUN_ADMIN ? 'adminmsg' : 'postmsg').'">'; ?>
  • Open yourstyle_cs.css
  • Find (~line 33)
 
.pun DIV.blockmenu LI.isactive A, #posterror LI STRONG {COLOR: #<something> }
  • Add after:
 
.pun .adminmsg { color: #FF0000; }
    • You can change the colour

From now on, it will show the the admin's posts in red, if you didn't change the example colour.


Chanage the Signature color for admins

  • Open viewtopic.php
  • Find (~line 332)
 
<?php if ($signature != '') echo "\t\t\t\t".'<div class="postsignature"><hr />'.$signature.'</div>'."\n"; ?>
  • Replace it with
 
<?php if ($signature != '') echo "\t\t\t\t".($cur_post['group_id'] == PUN_ADMIN ? '<div class="postsignatureadmin">' : '<div class="postsignature">').'<hr />'.$signature.'</div>'."\n"; ?>
  • Open base.css
  • Find (~line 200)
 
DIV.postsignature HR {
	MARGIN-LEFT: 0px;
	WIDTH: 200px;
	TEXT-ALIGN: left;
	HEIGHT: 1px;
	BORDER:none
}
  • Add After
 
DIV.postsignatureadmin HR {
	MARGIN-LEFT: 0px;
	WIDTH: 200px;
	TEXT-ALIGN: left;
	HEIGHT: 1px;
	BORDER:none
}
  • Open yourstyle_cs.css
  • Find (~line 52)
 
.pun HR {BACKGROUND-COLOR: #333; COLOR: #333}
  • Add after
 
.pun .postsignatureadmin { color: #FF0000; }

--Mark 20:59, 13 July 2006 (GMT)

--Elbekko 16:26, 13 July 2006 (GMT)

Personal tools