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 02-16-2008, 04:27 AM
Nullifi3d Nullifi3d is offline
 
Join Date: Apr 2004
Location: FL, USA
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default merging into the gpc array

Plugin: profile_updateprofile
I am trying to use $userdata->set to update a custom table field in 'user', however cannot find a way to merge the data with the already existent GPC array. Is this even possible?
Reply With Quote
  #2  
Old 02-16-2008, 07:08 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What do you mean with "merge the data with the already existent GPC array"?
Reply With Quote
  #3  
Old 02-17-2008, 01:18 AM
Nullifi3d Nullifi3d is offline
 
Join Date: Apr 2004
Location: FL, USA
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am trying to update two custom fields in the user table when profile data is updated (profile_updateprofile). I want to clean the posted textbox inputs before inserting into the database.

I have in userdata_start:
PHP Code:
$this->validfields['homepagetitle'] = array(TYPE_STRREQ_NO);
$this->validfields['homepagedesc'] = array(TYPE_STRREQ_NO); 
And in profile_updateprofile:
PHP Code:
$vbulletin->input->clean_array_gpc('p', array(
    
'homepagetitle'    => TYPE_STR,
    
'homepagedesc'  => TYPE_STR,
));
$userdata->set('homepagetitle'$vbulletin->GPC['homepagetitle']);
$userdata->set('homepagedesc'$vbulletin->GPC['homepagedesc']); 
However, this (obviously) erases the GPC variables already set (other profile info).
Reply With Quote
  #4  
Old 02-17-2008, 08:28 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That code would not empty any GPC variables.
Reply With Quote
  #5  
Old 02-17-2008, 08:41 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use var_dump() to debug variables if you are having problems. I don't see anything wrong with your code...make sure the data is being sent from the form and is in the $_POST array after you've submitted the form.

Also I suggest that you change 'homepagedesc' & 'homepagetitle' to TYPE_NOHTML to reduce vulnerabilities.
Reply With Quote
  #6  
Old 02-18-2008, 01:12 AM
Nullifi3d Nullifi3d is offline
 
Join Date: Apr 2004
Location: FL, USA
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I will change to TYPE_NOHTML. Thanks for the advice.

As for the GPC variables, what I meant was when I update my profile, any profile fields other then 'homepagetitle' and 'homepagedesc' are not set because
PHP Code:
$vbulletin->input->clean_array_gpc('p', array(
    
'homepagetitle'    => TYPE_STR,
    
'homepagedesc'  => TYPE_STR,
)); 
is called (within the plugin profile_updateprofile) which is executed in profile.php after:
PHP Code:
    $vbulletin->input->clean_array_gpc('p', array(
        
// coppa stuff
        
'coppauser'    => TYPE_BOOL,
        
'parentemail'  => TYPE_STR,
        
// IM handles / homepage
        
'aim'          => TYPE_STR,
        
'yahoo'        => TYPE_STR,
        
'icq'          => TYPE_STR,
        
'msn'          => TYPE_STR,
        
'skype'        => TYPE_STR,
        
'homepage'     => TYPE_STR,
        
// user title
        
'resettitle'   => TYPE_STR,
        
'customtext'   => TYPE_STR,
        
// birthday fields
        
'day'          => TYPE_INT,
        
'month'        => TYPE_INT,
        
'year'         => TYPE_INT,
        
'oldbirthday'  => TYPE_STR,
        
'showbirthday' => TYPE_UINT,
        
// redirect button
        
'gotopassword' => TYPE_NOCLEAN,
        
// custom profile fields
        
'userfield'    => TYPE_ARRAY,
    )); 
Reply With Quote
  #7  
Old 02-18-2008, 06:39 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry but i still dont understand what you mean. Using clean_array_gpc() does not empty previously set variables.
Reply With Quote
  #8  
Old 02-19-2008, 02:25 AM
Nullifi3d Nullifi3d is offline
 
Join Date: Apr 2004
Location: FL, USA
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

/me is retarded

To test my plugin I was entering 'home page url' as the data for the homepage field and other strings for the custom fields I made. It just came to me that homepage was not updating because I was not inputing a valid url. Don't ya hate thinking deeper then you have to?
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 10:43 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.04067 seconds
  • Memory Usage 2,247KB
  • 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
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_postinfo_query
  • fetch_postinfo
  • 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