Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-11-2006, 11:05 PM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default mysql & conditionals

I have a row named "view_link" varchar(2) not null.

I'm using the conditional
<if condition="is_member_of($bbuserinfo, $dlink['view_link'])">

If I make the value for "$dlink['view_link']" to "6" then I can see the link.
If I make it "1,6,3" I cannot see it.
Reply With Quote
  #2  
Old 01-11-2006, 11:09 PM
TyleR's Avatar
TyleR TyleR is offline
 
Join Date: Nov 2004
Location: North Carolina
Posts: 349
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
<if condition="in_array($bbuserinfo[usergroupid], array(1,6,3))">..</if>
Not exactly sure if the array() function is allowed in templates, but am sure it is.
Reply With Quote
  #3  
Old 01-11-2006, 11:10 PM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll try that.

It's weird because I did.. and it worked out fine but doesn't work with mysql.
<if condition="is_member_of($bbuserinfo, 1,6)">

Edit:
The only time it works with mysql if I only use one number such as "6"
If I were to use multiple numbers then it won't work "1,4,6"
Reply With Quote
  #4  
Old 01-11-2006, 11:17 PM
TyleR's Avatar
TyleR TyleR is offline
 
Join Date: Nov 2004
Location: North Carolina
Posts: 349
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm..try doing it with the is_member_of function, i.e.:

Code:
<if condition="is_member_of($bbuserinfo, array(1,6,3))">..</if>
Reply With Quote
  #5  
Old 01-11-2006, 11:22 PM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It still only works with one number as the value.

Why couldn't this be simple?
Now I have to find something that does it similiar to how I want to do it and do all this work.
I think there's a hack where I can choose which forums I want something to into.
Reply With Quote
  #6  
Old 01-11-2006, 11:31 PM
Guest190829
Guest
 
Posts: n/a
Default

I think it has to do with your column type, try setting it to something like varchar(20) rather then varchar(2)....

/me isn't a genious at columns types though...
Reply With Quote
  #7  
Old 01-11-2006, 11:34 PM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Still no luck..

Edit:
I'm not at home but I may have found something that will work.

PHP Code:
<?php

$member_of 
"1,3,6";

$usergroup = array($member_of);
$array implode(","$usergroup);

echo 
$array;

<if 
condition="is_member_of($bbuserinfo, array($array))">..</if>

?>
Hopefully this will work with mysql.
Reply With Quote
  #8  
Old 01-13-2006, 12:04 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can I bump this?

I don't understand why it doesn't work.

If you want my whole plugin ask for it and I'll upload it.

Edit:
Here's the part to display stand-alone links

PHP Code:
    $getsinglelinks $db->query_read("SELECT * FROM " TABLE_PREFIX "custom_singlelinks WHERE linkid");
    
        while(
$slink $db->fetch_array($getsinglelinks))
    {    
        if(
$slink['new_window'] == 1)
       {
         
$new "_blank";
        }
        else
        {
         
$new "";
        }
        
        if(!empty(
$slink['image']))
        {
          
$img "<img src='".$slink['image']."' width='16' height='16' />";
        }
        else
        {
          
$img "";
        }
        
        
$usergroup = array($slink['member_of']);
        
$array implode(","$usergroup); 
    
    
        
$custom_singlelinks .= "<if condition='is_member_of($bbuserinfo, array($array))'><td class='vbmenu_control'>$img<a href='".$slink['url']."' target='$new' title='".$slink['alt']."'>".$slink['name']."</a></td></if>";
                  
        eval(
'$custom_singlelinks = "' fetch_template('custom_singlelinks') . '";');
    } 
Reply With Quote
  #9  
Old 01-13-2006, 04:10 PM
Deviation Deviation is offline
 
Join Date: Sep 2005
Location: Ohio
Posts: 226
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is $slink['member_of'] stored in the DB as (format & type)? I don't think you can pass is_member_of an array() in the templates. At least not via the PHP array() function. Not 100% sure on that though (not home to verify it).
Reply With Quote
  #10  
Old 01-19-2006, 10:49 AM
Electronic Punk's Avatar
Electronic Punk Electronic Punk is offline
 
Join Date: Dec 2001
Location: StoneHenge
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, I was also wondering if is_member_of could be used to specify mutliple membergroups, can't really add the statement 4 times because some people could end up with 4 times the code if they don't meet any of th e requirements.

What syntax should I use for an or statement?

condition="!is_member_of($bbuserinfo, 11)" || condition="!is_member_of($bbuserinfo, 5)"

does not seem to work.
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 04:46 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.04363 seconds
  • Memory Usage 2,259KB
  • Queries Executed 13 (?)
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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (9)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete