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 07-13-2007, 06:34 AM
ChurchMedia's Avatar
ChurchMedia ChurchMedia is offline
 
Join Date: Dec 2002
Location: Las Cruces, NM
Posts: 473
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to insert a pre-defined number into user db

Using the useradmin_edit_column2 and the userdata_start plugins, I need to insert 3 values into the user table. The trick is that 2 of them are input values and one of them is the same value as one of the input values. So like this:

$value_1 goes into field_1
$value_2 goes into field_2
$value_3 = $value_2
$value_3 goes into field_3

I know how to use input rows for the useradmin_edit_column2 hook, but I don't know what to use or how to format value 3 (which needs to be the same as value 2 and silently go into field 3). I've tried using standard PHP code, but it's not working. I think there's a vb class that I just don't know.

Any help would be appreciated. Thanks!
Reply With Quote
  #2  
Old 07-13-2007, 01:43 PM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

One idea, assuming strings...
Code:
$db->query_write("INSERT INTO " . TABLE_PREFIX . "user
	(field_1, field_2, field_3)
	VALUES
	(
		'" . $db->escape_string($value_1) . "'
		'" . $db->escape_string($value_2) . "'
		'" . $db->escape_string($value_2) . "'
	)
");
Reply With Quote
  #3  
Old 07-13-2007, 01:58 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1. a plugin at hook: userdata_start
PHP Code:
$this->validfields['myfield']         = array(TYPE_UINTREQ_NO); 
2. plugin useradmin_edit_column2
PHP Code:
 print_input_row($vbphrase['myuservalue1'], 'user[myfield]'$user['myfield'], 0); 
Reply With Quote
  #4  
Old 07-13-2007, 06:13 PM
ChurchMedia's Avatar
ChurchMedia ChurchMedia is offline
 
Join Date: Dec 2002
Location: Las Cruces, NM
Posts: 473
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by calorie View Post
One idea, assuming strings...
Code:
$db->query_write("INSERT INTO " . TABLE_PREFIX . "user
	(field_1, field_2, field_3)
	VALUES
	(
		'" . $db->escape_string($value_1) . "'
		'" . $db->escape_string($value_2) . "'
		'" . $db->escape_string($value_2) . "'
	)
");
I've tried sql queries and I tried this one too -- I get this error:
Quote:
Fatal error: Call to a member function on a non-object in /path/to/me/CMN/includes/class_dm_user.php(183) : eval()'d code on line 1
Quote:
Originally Posted by ragtek View Post
1. a plugin at hook: userdata_start
PHP Code:
$this->validfields['myfield']         = array(TYPE_UINTREQ_NO); 
2. plugin useradmin_edit_column2
PHP Code:
 print_input_row($vbphrase['myuservalue1'], 'user[myfield]'$user['myfield'], 0); 
I was using this exactly for input fields and it works fine. I just need an "invisible" input row -- like the the HTML equivalent of a preset value in a form, but that value needs to be the same as my value 2.
Reply With Quote
  #5  
Old 07-13-2007, 06:15 PM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perhaps try the construct_hidden_code function.
Reply With Quote
  #6  
Old 07-13-2007, 06:31 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ups
I havent seen that you need a hidden row
look into adminfunktions.php
there you see all the functios available
Reply With Quote
  #7  
Old 07-13-2007, 06:39 PM
ChurchMedia's Avatar
ChurchMedia ChurchMedia is offline
 
Join Date: Dec 2002
Location: Las Cruces, NM
Posts: 473
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks -- I'll keep working on this and let you know what I find out. It's for a hack that I think a lot of people will like.
Reply With Quote
  #8  
Old 07-13-2007, 06:40 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

a "give me every month 1000$ on my konto" hack?

yea i'll love it

but i don't understand for what should be hidden fields used in this example
they can't do something usefull
Reply With Quote
  #9  
Old 07-13-2007, 06:54 PM
ChurchMedia's Avatar
ChurchMedia ChurchMedia is offline
 
Join Date: Dec 2002
Location: Las Cruces, NM
Posts: 473
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ragtek View Post
a "give me every month 1000$ on my konto" hack?

yea i'll love it

but i don't understand for what should be hidden fields used in this example
they can't do something usefull
Sarcasm aside....

I need to insert the same value from one input box into two database fields. I have my reasons -- I don't feel like explaining the whole hack. I can do this easily with regular sql queries, but with the hook system I'm having trouble (still learning). That's why I'm asking for help.

No biggie -- I'll figure it out eventually.
Reply With Quote
  #10  
Old 07-13-2007, 06:57 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok ok*g*
i'll see it after you publish it
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:31 PM.


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.05038 seconds
  • Memory Usage 2,259KB
  • 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
  • (4)bbcode_php
  • (4)bbcode_quote
  • (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
  • (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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete