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 05-23-2012, 11:34 AM
Asterix_ita's Avatar
Asterix_ita Asterix_ita is offline
 
Join Date: Aug 2009
Location: Italy
Posts: 312
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default help use the print_membergroup_row on forum options

Hi guys,

I wanted to use print_membergroup_row in the options forum

I created one plugin

Product: My addon
Hook location: forumadmin_edit_form
Title: my plugin forum
Execution order: 5
Plugin php code:
print_membergroup_row($vbphrase[‘mylabelphrase’], 'forum[cts_reportgr]', 2, $forum['cts_reportgr']);

with this plugin I get the list of groups with checkbox, but I can not save selections and when I get back in the option forums are all unchecked

If I used this plugin

Product: My addon
Hook location: forumadmin_edit_form
Title: my plugin forum
Execution order: 5
Plugin php code:
print_input_row ($vbphrase[‘mylabelphrase’], 'forum[cts_reportgr]', $forum['cts_reportgr']);

the entered values are saved.

I know it should be a trivial thing, but until now I never used print_membergroup_row and then of course I miss the code.

Thank you for your help
Reply With Quote
  #2  
Old 05-23-2012, 02:10 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

One problem is that the 4th parameter to print_membergroup_row() is expected to be userdata, so you'd have to do something like this:

Code:
$userarray = array('usergroupid' => 0, 'membergroupids' => $forum['cts_reportgr']);
print_membergroup_row($vbphrase[‘mylabelphrase’], 'forum[cts_reportgr]', 2, $userarray);

Also, you must have had to add a 'cts_reportgr' column to the forum table, and also make that a valid field in the forum data manager? In the data manager it should be something like this:

Code:
            'cts_reportgr' => array(TYPE_ARRAY_INT, REQ_NO, VF_METHOD, 'verify_list'),
That way the array that's given to the data manager will be converted to a comma-separated list when saved in the database.
Reply With Quote
  #3  
Old 05-23-2012, 05:32 PM
Asterix_ita's Avatar
Asterix_ita Asterix_ita is offline
 
Join Date: Aug 2009
Location: Italy
Posts: 312
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank's

I changed this code
PHP Code:
'cts_reportgr' => array(TYPE_ARRAY_INTREQ_NOVF_METHOD'verify_list'
to
PHP Code:
$this->validfields['cts_reportgr'] = array(TYPE_ARRAY_INTREQ_NOVF_METHOD'verify_list'); 
Now it works fine.

Regards

Asterix
Reply With Quote
  #4  
Old 05-23-2012, 06:58 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Asterix_ita View Post
Thank's

I changed this code....

Oh right, thanks. Truth is I tested it by editing the class_dm_forum.php file and inserting that code into the array initialization. I forgot that that code wouldn't work directly in a plugin.
Reply With Quote
  #5  
Old 05-24-2012, 05:13 AM
Asterix_ita's Avatar
Asterix_ita Asterix_ita is offline
 
Join Date: Aug 2009
Location: Italy
Posts: 312
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I noticed one thing, if I select one or more groups and save, then I can reduce or increase the selected groups but I can’t clear all, minimum one remains selected

Why ?

Regards.
Reply With Quote
  #6  
Old 05-24-2012, 10:43 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I guess you need one more plugin, using hook forumadmin_update_save and code like this:

Code:
if (empty($vbulletin->GPC['forum']['cts_reportgr']))
{
    $forumdata->set('cts_reportgr', '');
}
Reply With Quote
  #7  
Old 05-24-2012, 11:42 AM
Asterix_ita's Avatar
Asterix_ita Asterix_ita is offline
 
Join Date: Aug 2009
Location: Italy
Posts: 312
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks

now it works very fine

Regards

Edit

I would not exaggerate, but I can 'eliminate some groups from the list eg. administrator
Reply With Quote
  #8  
Old 05-24-2012, 12:20 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Asterix_ita View Post
Edit

I would not exaggerate, but I can 'eliminate some groups from the list eg. administrator

Are you asking if there's a way to remove some of the options? There is no way using that function. Of course instead of calling that function you could copy the code to your plugin and modify it (it's in includes/adminfunctions.php).
Reply With Quote
  #9  
Old 05-24-2012, 01:16 PM
Asterix_ita's Avatar
Asterix_ita Asterix_ita is offline
 
Join Date: Aug 2009
Location: Italy
Posts: 312
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks very nice
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 06:41 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.04673 seconds
  • Memory Usage 2,243KB
  • 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
  • (3)bbcode_code
  • (2)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