Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-13-2011, 12:06 AM
Divvy Divvy is offline
 
Join Date: Nov 2008
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 08-13-2011, 07:13 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Divvy View Post
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.
It would be much easier to show it based on usergroup. That code would be:

PHP Code:
if (is_member_of($vbulletin->userinfo2))
{
   
$template_hook['postbit_userinfo_right_after_posts'] .= '<div style="clear:both;" class="left"><a target="_blank" href="'.$mylink.''.$usernumber.'">'.$mylinktitle.'</a></div>';

Where "2" is the usergroupid... you can change that to whatever usergroupid you want. Primary or secondary. You can also do additional groups by adding more such as:
PHP Code:
if (is_member_of($vbulletin->userinfo2,5,6,7)) 
Would work for users in groups 2, 5, 6, and 7.

Depending on the hook you may need to make $vbulletin global if you aren't using it already. Doesn't hurt to put this line at the top of the plugin or php code if you haven't already:
PHP Code:
global $vbulletin
As for your other way, depending on posts in specific forums, that would require custom coding and an additional database query to get that info so this is easier and more efficient code.
Reply With Quote
  #3  
Old 08-13-2011, 09:26 PM
Divvy Divvy is offline
 
Join Date: Nov 2008
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hi mate, thank you for your reply

I tried your code but didnt work, It shows this errors:
Code:
Parse error: syntax error, unexpected $end in /home/vns/public_html/forum/includes/class_postbit.php(340) : eval()'d code on line 67
here is my 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>';
 } 
Any idea?
Reply With Quote
  #4  
Old 08-14-2011, 12:28 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Divvy View Post
hi mate, thank you for your reply

I tried your code but didnt work, It shows this errors:
Code:
Parse error: syntax error, unexpected $end in /home/vns/public_html/forum/includes/class_postbit.php(340) : eval()'d code on line 67
here is my 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>';
 } 
Any idea?
Given that code I would put it as part of the main/top condition...


PHP Code:
if ($vbulletin->options['ecpl_Online'] == AND is_member_of($vbulletin->userinfo,2))
 {
 
$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>';
 } 
Reply With Quote
  #5  
Old 08-14-2011, 01:35 AM
Divvy Divvy is offline
 
Join Date: Nov 2008
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you again for your reply BirdOPrey5

I think that the code is correct now, but is not what Im looking for... my english is a little poor, and maybe you didnt understood well my request hehe

Explaining again:
That plugin code that I posted is from this mod:
https://vborg.vbsupport.ru/showthread.php?t=235619

The mod adds a custom link to the postbit, the default is user album link, but I changed to appear the topics that user started in two specific forums.

By default, the link appears to ALL members, even the ones that dont have any topics created in those two forums.
For example, below of the avatar will appear "My topics" link.
My idea is to show that link only to the users that have topics created in those two forums.
If the user dont have any topics created in those two forums, the link dont appear.

Got the idea?

I give the usergroup idea, because I add my users to a specific group If they created a topic in those two forums. So If they belong to that group, is because they started a topic in one of those two forums.

Sorry for the trouble...
Any idea how to make this like I want?
Reply With Quote
  #6  
Old 08-14-2011, 10:22 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you add people to the usergroup the code I have should work. You need to change the number 2 in the is_member_of function to the usergroupid of the usergroup you add members to. 2 was just an example, it shows to all registered users- I would have no idea what the real usergroupid is on your forum.
Reply With Quote
  #7  
Old 08-14-2011, 10:50 AM
Divvy Divvy is offline
 
Join Date: Nov 2008
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ohhh damn... I have read my explanation and I think that I explained wrong again :/
very sorry mate...

I know that your code works fine! I tried with usergroupid 6 that is administrators and only admins see the link...

But is not what I want lol.

Let me try explain again:
I want to show the link to everyone! but If the user belongs to specific usergroups, the link will appear (to everyone), If the user dont belongs to that specific usergroups, the link will not appear to anyone.

For example, please check:
http://screensnapr.com/e/g8ii2H.jpg

In link above, only the user Ruimaisluisa belongs to the usergroup that I want.
And Green_Boy dont belongs.
But as you can see, the link that says "As minhas fotos" appears to both.
I want to appear only to user Ruimaisluisa, for example
Reply With Quote
  #8  
Old 08-14-2011, 12:23 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think this does it:

Product: vBulletin

Hook location: showthread_postbit_create

Title: Find Qualified Members

Exectuion order: 5

Plugin PHP code:

PHP Code:
if($vbulletin->userinfo['userid'] == 5)
{
    
ini_set('display_errors''1');
        
$db->show_errors(); 
// REMOVE THE STUFF ABOVE WHEN EVERYTHING IS WORKING

    
$thread_count $db->query_read("
        SELECT COUNT(*)
        FROM " 
TABLE_PREFIX "thread
        WHERE postuserid = " 
$post[userid] . "
        AND (forumid = 6 
        OR forumid = 7)
    "
);
    
$templater->register('thread_count'$thread_count); 

// REMOVE THE STUFF BELOW WHEN EVERYTHING IS WORKING
        
$db->hide_errors();


Put in YOUR user id in the first line and YOUR forumids. When everything is working get rid of the stuff at the top and bottom so everyone can see it.

Now you can use a template conditional:

<vb:if condition="$thread_count > 0"> ................. </vb:if>

I think this will work.
Reply With Quote
  #9  
Old 08-14-2011, 12:50 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ahhh...

Try sing $post instead of $vbulletin->userinfo in the is_member_of() function.

edited.
Reply With Quote
  #10  
Old 08-14-2011, 01:39 PM
Divvy Divvy is offline
 
Join Date: Nov 2008
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for your reply nerbert, and for trying to help me

I created an plugin like you said:
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'] .= '<vb:if condition="$thread_count > 0"><div style="clear:both;" class="left"><a target="_blank" href="'.$mylink.''.$usernumber.'">'.$mylinktitle.'</a></div></vb:if>';
 } 
And changed this:
PHP Code:
$template_hook['postbit_userinfo_right_after_posts'] .= '<div style="clear:both;" class="left"><a target="_blank" href="'.$mylink.''.$usernumber.'">'.$mylinktitle.'</a></div>'
to this:
PHP Code:
$template_hook['postbit_userinfo_right_after_posts'] .= '<vb:if condition="$thread_count > 0"><div style="clear:both;" class="left"><a target="_blank" href="'.$mylink.''.$usernumber.'">'.$mylinktitle.'</a></div></vb:if>'
But when I try to see a topic, I get this error:
Quote:
Fatal error: Call to a member function register() on a non-object in /home/viciados/public_html/forum/showthread.php(1053) : eval()'d code on line 14
What I did wrong?

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

BirdOPrey5, thank you for keep helping me

I did what you said, but didnt work... the link disappeared in all users.

What I added:
PHP Code:
if ($vbulletin->options['ecpl_Online'] == AND is_member_of($post->userinfo,27,17,13,18,14))
 {
 
$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>';
 } 
27,17,13,18,14 are the usergroupids that I want link appear.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:58 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04329 seconds
  • Memory Usage 2,325KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (13)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete