vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Getting the group ID of edited post (https://vborg.vbsupport.ru/showthread.php?t=107440)

pran 02-08-2006 04:17 AM

Getting the group ID of edited post
 
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:

Code:

<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;

Code:

<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:

Code:

      <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.


All times are GMT. The time now is 04:50 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04549 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete