vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   mysql & conditionals (https://vborg.vbsupport.ru/showthread.php?t=105110)

harmor19 01-11-2006 11:05 PM

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.

TyleR 01-11-2006 11:09 PM

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.

harmor19 01-11-2006 11:10 PM

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"

TyleR 01-11-2006 11:17 PM

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

Code:

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

harmor19 01-11-2006 11:22 PM

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.

Guest190829 01-11-2006 11:31 PM

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...

harmor19 01-11-2006 11:34 PM

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.

harmor19 01-13-2006 12:04 AM

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') . '";');
    } 


Deviation 01-13-2006 04:10 PM

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).

Electronic Punk 01-19-2006 10:49 AM

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.


All times are GMT. The time now is 06:39 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.01213 seconds
  • Memory Usage 1,743KB
  • 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_code_printable
  • (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