vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   How to hide this? (https://vborg.vbsupport.ru/showthread.php?t=268459)

Divvy 08-13-2011 11:19 AM

How to hide this?
 
Hello guys,

Maybe someone can help me...

I have this code:
PHP Code:

$template_hook['postbit_userinfo_right_after_posts'] .= '<div style="clear:both;" class="left"><a target="_blank" href="'.$mylink.''.$usernumber.'">'.$mylinktitle.'</a></div>'

That shows a link at postbit with all topics from the user at a two specific forums.

I need that:
- the link only shows when the user have threads at least in one of that two forums.
- If not, the link doesn't appear.

It is possible? Please? :)

Or else, I had another idea...
The links only appear If the user belongs to a specific group.

Lynne 08-13-2011 03:07 PM

You didn't post the full code. We would need to see the whole thing in order to suggest how to modify it to get what you want.

Divvy 08-13-2011 03:19 PM

Thank you for helping me Lynne :)

Here is full plugin code:
PHP Code:

if ($vbulletin->options['ecpl_Online'] == 1)
 {
 
$mylink $vbulletin->options['ecpl_link'];
 
$mylinktitle $vbulletin->options['ecpl_link_title'];
 if (
$vbulletin->options['ecpl_unique_number'])
   {
    
$usernumber ''.$post[userid].'';
   }
 else
   {
    
$usernumber '';
   }

 
$template_hook['postbit_userinfo_right_after_posts'] .= '<div style="clear:both;" class="left"><a target="_blank" href="'.$mylink.''.$usernumber.'">'.$mylinktitle.'</a></div>';
 } 


Lynne 08-13-2011 04:08 PM

Hmm, nowhere in that code do you check for threads at all. If you put a query in there that checks to see if the user has any posts (or is it only starting threads?), then that is going to add one query per post on the page (20 extra queries?). Is that an issue for you?

Divvy 08-13-2011 09:18 PM

hello Lynne, thank you for your reply!

hmmm, 20 extra queries is too many no? :)
but ok, I can try to see how the server handles.

can you help me? :)
and is starting threads only.

Thank you!

Lynne 08-14-2011 01:56 AM

Just write a query that looks at the 'thread' table and counts how many times the $post[userid] = thread.postuserid. Then, use the count in a condition around the template_hook code (if $variable >= 1, then.....)

Divvy 08-14-2011 11:06 AM

Hello Lynne, thank you for your reply, but I dont have any knowledge to write a query.
Can you help me? :)

Lynne 08-14-2011 04:47 PM

Actually, I'm a trial and error query writer which is why I do not like writing queries for people - they never work the first time. (And yes, I have killed my site a few times because of this!)

Divvy 08-15-2011 11:17 PM

Hello Lynne,

I already have this working :D
BirdOPrey5 has helped me:
https://vborg.vbsupport.ru/showthread.php?t=268443

Thank you anyway for your help mate!

Lynne 08-15-2011 11:37 PM

Glad you got it working!


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