News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

"Blizzard like" Custom Posts for Admin and Mods

Started by havok4615, March 17, 2013, 05:15:30 PM

Previous topic - Next topic

havok4615

Hard to explain, i need this:
As an admin or mod the POST Background (default windowbg&windowbg") should be replaced my lets say"adminbg" or "modbg" so if an admin or mod posts there are other background and stuff. is dat possible?

You know like Blizzard FOrums.

Looking

Yes. Did you check to see if there is a mod for it? If not it can be done with some custom coding.

havok4615

Yea i already googled it, but i dont know how to "search" for it. You know?
I was like "Custom Posts" or "Custom Admin Posts" but there was always bull****** results.


Matthew K.

If you know a little bit of PHP you could do this fairly easily by modifying your theme Display.template.php.

havok4615

sorry i dont know. could you upload the php template?

Darkorical

#6
in Display.template.php find


echo '
<div class="', $message['approved'] ? ($message['alternate'] == 0 ? 'windowbg' : 'windowbg2') : 'approvebg', '">
<span class="topslice"><span></span></span>
<div class="post_wrapper">';


and replace it with

echo '
<div class="', $message['approved'] ? ($message['alternate'] == 0 ? 'windowbg' : 'windowbg2') : 'approvebg', '">
<span class="topslice"><span></span></span>';

if ($message['member']['group'] == "Administrator")
{
echo'
<div class="post_wrapper_admin">';
}
else
{
echo'
<div class="post_wrapper">';
}

Then go to your css and add a class for "post_wrapper_admin" to apply what ever changes you want to show for admin posts
note if you have changed the name of administrator you will need to change it in this code as well.

havok4615

Quote from: Darkorical on March 22, 2013, 10:20:12 AM
in Display.template.php find


echo '
<div class="', $message['approved'] ? ($message['alternate'] == 0 ? 'windowbg' : 'windowbg2') : 'approvebg', '">
<span class="topslice"><span></span></span>
<div class="post_wrapper">';


and replace it with

echo '
<div class="', $message['approved'] ? ($message['alternate'] == 0 ? 'windowbg' : 'windowbg2') : 'approvebg', '">
<span class="topslice"><span></span></span>';

if ($message['member']['group'] == "Administrator")
{
echo'
<div class="post_wrapper_admin">';
}
else
{
echo'
<div class="post_wrapper">';
}

Then go to your css and add a class for "post_wrapper_admin" to apply what ever changes you want to show for admin posts
note if you have changed the name of administrator you will need to change it in this code as well.


Big thanks. WORKED MEGA SWEET!!!

Darkorical

Glad it worked for you. I may eventually look into making it a mod but for now keep in mind that updates may interfere with it and or you could loose it in the case of an upgrade.

havok4615

is there a way to expand this to other groups?Like:
       <div class="post_wrapper_', $message['member']['group'], '">';
???

Darkorical

<div class="post_wrapper_'.$message['member']['group'].'">';
should work but keep in mind if you do that you will have to set a CSS class for EVERY member group
instead I would recommend

<div class="post_wrapper '.$message['member']['group'].'">';
note the space instead of underscore this allows you to use the normal post_wrapper css and just add the parts you want changed

<style>
.post_wrapper
{
float:left;
width:100%;
}
.admin
{
background-color: #25abc1;
}
.newbie {
background-color: #000000;
}

altho an issue that may arise with this is if your member group is Global Moderator then the space in there will try to mess things up.

havok4615

is it possible to limit that custom post design to the thread starter post?

Darkorical

I have not tested it but I think

<div class="post_wrapper ',$context['first_message'] ? $message['member']['group'] : '','">';

will make it only apply to the first message



havok4615

didnt work. it keeps posting.

It dont puts the "first message" tag.

TheListener


havok4615

Quote from: Old Fossil on March 23, 2013, 10:27:34 PM
QuoteI have not tested it but I think

I just wanted to tell him that it didnt work.

Darkorical

Find

echo '
<div class="', $message['approved'] ? ($message['alternate'] == 0 ? 'windowbg' : 'windowbg2') : 'approvebg', '">
<span class="topslice"><span></span></span>
<div class="post_wrapper">';


and replace it with

echo '
<div class="', $message['approved'] ? ($message['alternate'] == 0 ? 'windowbg' : 'windowbg2') : 'approvebg', '">
<span class="topslice"><span></span></span>';

if ($message['id'] == $context['first_message'])
{
echo'
<div class="post_wrapper '.$message['member']['group'].'">';
}
else
{
echo'
<div class="post_wrapper">';
}



I tested it and it seemed to work for me

MechSpecs

Someone should do a mod for this type of thing; one that allows Admins and Mods to select it as "ON" or "OFF" during a specific post so that not every single one has to be super attention grabbing official LOL

Advertisement: