vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   merging into the gpc array (https://vborg.vbsupport.ru/showthread.php?t=170641)

Nullifi3d 02-16-2008 04:27 AM

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?

Marco van Herwaarden 02-16-2008 07:08 AM

What do you mean with "merge the data with the already existent GPC array"?

Nullifi3d 02-17-2008 01:18 AM

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

Marco van Herwaarden 02-17-2008 08:28 AM

That code would not empty any GPC variables.

Opserty 02-17-2008 08:41 AM

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.

Nullifi3d 02-18-2008 01:12 AM

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,
    )); 


Marco van Herwaarden 02-18-2008 06:39 AM

Sorry but i still dont understand what you mean. Using clean_array_gpc() does not empty previously set variables.

Nullifi3d 02-19-2008 02:25 AM

/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?


All times are GMT. The time now is 03:32 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.02225 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
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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