View Full Version : How to hide this?
Divvy
08-13-2011, 11:19 AM
Hello guys,
Maybe someone can help me...
I have this 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:
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!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.