Log in

View Full Version : Getting the group ID of edited post


pran
02-08-2006, 04:17 AM
How do you get the group ID of the user that edited a post? I wanted to display a different style if the post was edited by moderators or admins.

Rich
02-08-2006, 11:19 AM
Hello,

Wrap the output with if conditionals like this:


<if condition="is_member_of($bbuserinfo, 6)">
Admins Display This for editted post
</if>
</else>
<if condition="is_member_of($bbuserinfo, 2)">
Member Display this for editted post
</if>


The number "6" reflects that the user is an admin. That can include other usergroups like your s.mods and mods by adding their usergroup id like this;


<if condition="is_member_of($bbuserinfo, 6,5,7)">
Staff Display This for editted post
</if>

pran
02-08-2006, 12:08 PM
That's what I did but not exactly what I wanted. The logic is: if the post was edited by a moderator or admin, show it using a different style (div) else use normal style.

Rich
02-08-2006, 12:12 PM
Hello,

To make it look differently, you will need to add YOUR code between the conditions. For example:

<if condition="is_member_of($bbuserinfo, 6)">
<div class="YOURS">Admins Display This for editted post</div>
</if>
</else>
<if condition="is_member_of($bbuserinfo, 2)">
Whatever is normally here!
</if>

I don't know exactly where the editted post info is located, so i don't know how it is handled. (Don't have time to search through the templates right now.)

Paul M
02-08-2006, 01:13 PM
What he wants is not quite as simple as that - $bbuserinfo is the information for the poster, not the editor.

Rich
02-08-2006, 03:21 PM
Hello,

I just ran a test on my site to see if I could figure this out. This is what I did and it worked for me:


<if condition="is_member_of($bbuserinfo, 6)">
<if condition="$show['postedited']">
<!-- edit note -->
<div class="smallfont"> <hr size="1" style="color:$stylevar[tborder_bgcolor]" />
<em>
<phrase 1="$post[edit_username]" 2="$post[edit_date]" 3="$post[edit_time]">$vbphrase[last_edited_by_x_on_y_at_z]</phrase>- No No.
<if condition="$post['edit_reason']">$vbphrase[reason]: $post[edit_reason]</if>
</em>
</div>
<!-- / edit note -->
</if></if>
</else>
<if condition="is_member_of($bbuserinfo, 2)">
<if condition="$show['postedited']">
<!-- edit note -->
<div class="smallfont"> <hr size="1" style="color:$stylevar[tborder_bgcolor]" />
<em>
<phrase 1="$post[edit_username]" 2="$post[edit_date]" 3="$post[edit_time]">$vbphrase[last_edited_by_x_on_y_at_z]</phrase> - HA HA.
<if condition="$post['edit_reason']">$vbphrase[reason]: $post[edit_reason]</if>
</em>
</div>
<!-- / edit note -->
</if></if>



I didn't play with the colors or anything. I just added the little text that is bolded to see if it saw the difference. I editted a post of my test account and it displayed the "No No" like I wanted it to. I then logged in with my test account, which is a normal user, and it displayed the "HA HA" when he editted like I wanted it to.

On both of these I entered a reason for the edit.

The only other thing I was going to try was the $post[edit_userid] and perhaps create an array with the user id's of those in the staff.

I am not sure if this will remain working but I was thinking that since the edit function passes through the permissions system this would be adequate.