vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   template threadbit (https://vborg.vbsupport.ru/showthread.php?t=171559)

Poet PHP 02-27-2008 11:44 AM

template threadbit
 
hi all i have Q . PLZ.. replay

i want to use Variable usergroupid in template threadbit

example

PHP Code:

<if condition="$show[usergroupid]==6">

<
font color=red>$thread[threadtitle]</font>
</else>

<
font color=000000>$thread[threadtitle]</font>
</if> 


shovel 02-27-2008 12:00 PM

Try..

PHP Code:

<if condition="$bbuserinfo[usergroupid] == 6"

<
font color=red>$thread[threadtitle]</font
<else /> 

<
font color=000000>$thread[threadtitle]</font
</if> 


Opserty 02-27-2008 01:01 PM

usergroupid of whom? The thread starter or the browsing user or?

shovel 02-27-2008 01:28 PM

Hmm you're correct. I assumed the browser since it was a style change.

Poet PHP 02-28-2008 04:59 AM

thank U for your responding
i wnat fo chose the color of the tite according to the group 'otherwise when the mangager write any subject the tite must be red color
this method is not useful :

PHP Code:

<if condition="$bbuserinfo[usergroupid] == 6"

<
font color=red>$thread[threadtitle]</font
<else /> 

<
font color=000000>$thread[threadtitle]</font
</if> 


because it will make all titles color with same color when the manager neter to any department
just i want to change the color title of the manager i mean to be unique than the member's subjects
in order to the reader be able to differentiat betweet the subjects of the manager and members
so i want vairiable usergrouid according to the writer
with best best wishes

--------------- Added [DATE]1204201286[/DATE] at [TIME]1204201286[/TIME] ---------------

thanks for your unhelp :mad:
i found the solution :rolleyes: and it's as following:

in file forumdisplay.php

find out

PHP Code:

        while ($thread $db->fetch_array($threads))
        { 
// AND $counter++ < $perpage) 

then put this code after

PHP Code:

        $getparent_id '';  
        
$getparentid $db->query_read("SELECT * FROM " TABLE_PREFIX "user WHERE userid ='" $thread[postuserid] . "'");  
          
        while (
$getparentids $db->fetch_array($getparentid)) {  
              
            
$getparent_id .=  $getparentids[displaygroupid];  
              
        } 

then put this code in template threadbit

PHP Code:


            
<if condition="$getparent_id==6"><font color="#FF0000"></if>
            
$thread[threadtitle]
            </
font

see the result http://www.akafi.net/forumdisplay2.php?f=13

Opserty 02-28-2008 01:50 PM

Two things:
  1. You shouldn't be editing files, it means you have to edit files every time you upgrade
  2. You are running an extra query on every threadbit (thats 25 queries extra on top of the ~14 or so there)

Here is the plugin we use:
Hook Location: forumdisplay_query
PHP Code:
PHP Code:

$hook_query_fields ", user.usergroupid";

$hook_query_joins "LEFT JOIN "TABLE_PREFIX ."user AS user ON(user.userid=postuserid)"

The you can use:
PHP Code:

$thread['usergroupid'


shovel 02-28-2008 02:04 PM

Quote:

Originally Posted by Opserty (Post 1452908)
Two things:
  1. You shouldn't be editing files, it means you have to edit files every time you upgrade
  2. You are running an extra query on every threadbit (thats 25 queries extra on top of the ~14 or so there)
Here is the plugin we use:
Hook Location: forumdisplay_query
PHP Code:
PHP Code:

$hook_query_fields ", user.usergroupid";

$hook_query_joins "LEFT JOIN "TABLE_PREFIX ."user AS user ON(user.userid=postuserid)"

The you can use:
PHP Code:

$thread['usergroupid'


Shoot, I think even I learned from that one. Didn't know they had query modifier variables.


All times are GMT. The time now is 03:07 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.01066 seconds
  • Memory Usage 1,753KB
  • 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
  • (10)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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