Star Citizen-like custom posts for Admins and Mods (with a toggle)

Started by MechSpecs, April 10, 2014, 09:40:59 AM

Previous topic - Next topic

MechSpecs

If you look here https://forums.robertsspaceindustries.com/discussion/119493/how-to-report-a-forum-moderator#latest

You will see that Rutger has this fancy background and different color font as well as a border. This is achieved through the same principle that was listed in the "Blizzard Like Custom Posts for Admins and Mods" thread, with one exception. They have a toggle option to do this. So Mods / Admins can toggle whether they want a regular post or a post with the fancy background making it much more official like.

If Vanilla Forums has something like this then SMF surely must have people capable of coding something like this yes?

Dzonny

Nice idea!
Also should not be so hard to code it actually, just few changes in display.template and all other would be css thing.

I have no much free time to make a mod though, but here's some basic thing for the start..
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">';


replace with:

if ($message['member']['group_id'] == 1)
{
echo'<div class="', $message['approved'] ? ($message['alternate'] == 0 ? 'windowbg5' : 'windowbg5') : 'approvebg', '">
<div class="post_wrapper5">';
}
else {
echo'<div class="', $message['approved'] ? ($message['alternate'] == 0 ? 'windowbg' : 'windowbg2') : 'approvebg', '">
<span class="topslice"><span></span></span>
<div class="post_wrapper">';
}

Note: ['group_id'] == 1 means that style is applied to message from members in group with id 1, which is admins. You'll need to add similar thing (like with elseif) for moderators, global moderators, or whatever you want.


Next, find:
<span class="botslice"><span></span></span>
and replace it with something like:

';
if ($message['member']['group_id'] == 1)
{
echo'<span></span>';
}
else
{
echo'<span class="botslice"><span></span></span>';
}
echo'


Also add a style in index.css:
.windowbg5
{
color: #000;
background-color: #FAF89A;
}
.post_wrapper5
{
float:left;
width:100%;
border: solid 1px black;
background-color: #86AC8C;
}

change colors to whatever suit your needs.


If anyone is willing to make a mod - feel free, there's more code to add ofc, but you can use mine to start...

MechSpecs

All the initial code can be found in this thread...

http://www.simplemachines.org/community/index.php?topic=499932.msg3511675#msg3511675

However that thread's code makes it so that the fancy background/text/border is permanently on for whatever user group you select. It was the toggle portion that I couldn't figure out and I am hoping there is some super genius out there who can knock this one out of the park.

Dzonny

Yeah, indeed, something like a check-box for it would be great.
Sadly I have no free time to commit to this, so let's wait to see if there's anyone interested to complete this and maybe make a mod out of it...

MechSpecs

Exactly!!!

That would be perfect. I've got one site that gets around 150,000 unique visits per month for a game and another one that is just starting up that is expected to be even more than that (probably 250k plus) so something like this would definitely help separate official mod/admin posts from just comments etc.

MechSpecs


Kindred

essentially, you would need to add another variable to the post details in the database
you would have to track "is the background on" during display source and then trigger it in the template
(remember database queries do not belong in the templates)

and
"can the user set a background" in the post source and show the checkbox in the post template
then did the user set the checkbox or not in the post response source


finally - update the CSS to trigger the extra background(s) based on the set class.

it's not complicated... but, because it involves the database, it's not minor either.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

MechSpecs

Yeah I tried messing around with it on my sandbox server and, due to my extremely limited knowledge of groun-up coding I managed to botch it in to oblivion so thought I would come back and see if a professional wanted to take a crack at it.

Advertisement: