Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-22-2011, 06:37 PM
K a M a L K a M a L is offline
 
Join Date: Jun 2011
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default print_membergroup_row() and array() Help !

sorry , it is my second thread today
I'm programming admin page and used the function
PHP Code:
print_membergroup_row (string $title, [string $name 'membergroup'], [integer $columns 0], [mixed $userarray NULL]) 
My strange problem is with last arrtibute , it is used to prefill usergrups with current values
when I write
PHP Code:
    print_membergroup_row("Title""recusergroup",2,array('usergroupid' => 0'membergroupids' => '1,2,3,4,5,6')); 
it works correctly and groups 1,2,3,4,5,6 are marked
I have variabe
PHP Code:
$groups=1,2,3,4,5,
when I write
PHP Code:
print_membergroup_row("Title""recusergroup",2,array('usergroupid' => 0'membergroupids' => $groups)); 
I get only group 1 marked
then I set
PHP Code:
$groups='1,2,3,4,5,6' 
it doesn't work correctly
the first and last number are ignored !! and groups 2,3,4,5 only marked !
Reply With Quote
  #2  
Old 08-22-2011, 06:46 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't see any reason that this:

PHP Code:
print_membergroup_row("Title""recusergroup",2,array('usergroupid' => 0'membergroupids' => '1,2,3,4,5,6')); 

would not be the same as this:
PHP Code:
    $groups '1,2,3,4,5,6';
    
print_membergroup_row("Title""recusergroup",2,array('usergroupid' => 0'membergroupids' => $groups)); 
(but you definitely need the quotes around the list).

Also, it looks like there can not be any spaces, so make sure you're not doing this:
PHP Code:
$group ' 1,2,3,4,5,6 '
Reply With Quote
  #3  
Old 08-22-2011, 07:02 PM
K a M a L K a M a L is offline
 
Join Date: Jun 2011
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes , I tried it with space and without and the problem is the same
but I made a solution
PHP Code:
$groups1,2,3,4,5,6// without quotes
print_membergroup_row("Title""recusergroup",2,array('usergroupid' => 0'membergroupids' => "'0,".$groups.",0'")); 
I added 0 at start and zero at end so it ignores the starting zero and end zero
but I'm still intersted to know why this happens
Reply With Quote
  #4  
Old 08-22-2011, 07:09 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$groups1,2,3,4,5,// without quotes 

Strange, I get an error when I try that in a test file. Maybe there's some option I don't know about.
Reply With Quote
  #5  
Old 08-22-2011, 07:14 PM
K a M a L K a M a L is offline
 
Join Date: Jun 2011
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You may forgot the semicolon
Reply With Quote
  #6  
Old 08-22-2011, 07:17 PM
Badshah93 Badshah93 is offline
 
Join Date: Jun 2010
Location: India
Posts: 505
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just tried

PHP Code:
$groups '1,2,3,4,5,6';

print_membergroup_row("Title""recusergroup",2,array('usergroupid' => 0'membergroupids' => $groups)); 
and its working well..
Reply With Quote
  #7  
Old 08-22-2011, 07:17 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by K a M a L View Post
You may forgot the semicolon
I tried it with a semicolon, I get this error:

Code:
Parse error: syntax error, unexpected ',' in test.php on line 9

Oh well, as long as you got it working.
Reply With Quote
  #8  
Old 08-22-2011, 07:34 PM
K a M a L K a M a L is offline
 
Join Date: Jun 2011
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank you your help and time
by the way , I copied your code and it is working without problems
can you find the diffrence between your code and mine ?
I think the diffrence is that i didn't sleep for 20 hours
Reply With Quote
  #9  
Old 08-22-2011, 07:56 PM
Badshah93 Badshah93 is offline
 
Join Date: Jun 2010
Location: India
Posts: 505
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by K a M a L View Post
thank you your help and time
by the way , I copied your code and it is working without problems
can you find the diffrence between your code and mine ?
I think the diffrence is that i didn't sleep for 20 hours
write ur codes always in good notepad software like notepad++.
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 07:39 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.03919 seconds
  • Memory Usage 2,258KB
  • 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
  • (1)bbcode_code
  • (11)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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