vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Link post number in postbit (Admin only) (https://vborg.vbsupport.ru/showthread.php?t=35442)

Jawelin 02-25-2002 02:59 PM

Link post number in postbit (Admin only)
 
Hi. Weeks ago I modified my postbit template (actually it wasn't a hack) to make the post counter link to search.php?action=finduser, just as done here....
But found an unacceptable increment of MySQL (and CPU) load.. I.e. most users started submitting searches.... :surprised
So I had to remove that link.

Now I would try again showing that link only to Admins.
As said elsewhere, I'm not too good at template bits encapsulation, so would simply a tip how to start.
Could someone give the trick ?

Thanks

Admin 02-25-2002 03:35 PM

In the getpostbit() function (functions.php), add a check like this:
Code:

if ($bbuserinfo['usergroupid']==6) {
  // set $postcount to a link with HTML
} else {
  // set $postcount to a static number
}


Jawelin 02-26-2002 04:14 PM

Yeah!
Thanks to your tip I quickly made this stupid hack:

In functions.php, just before
PHP Code:

$post[joindate]=vbdate($registereddateformat,$post[joindate]); 

I added:
PHP Code:

//HACK: linkable user posts for admins & supermods
        
if (($bbuserinfo['usergroupid']==6) || ($bbuserinfo['usergroupid']==5)) {
            
$postslink="<a href=\"search.php?s=$session[sessionhash]&action=finduser&userid=$post[userid]\">$post[posts]</a>";
        } else {
            
$postslink="$post[posts]";
        }
//HACK: linkable user posts for admins & supermods 

Of course, in In postbit template
I replaced Posts: $post[posts] with Posts: $postslink...
If that could be useful to somebody...

Thanks again.
Bye


All times are GMT. The time now is 05:57 PM.

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.00966 seconds
  • Memory Usage 1,719KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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