Hey all,
I'm recoding an associative array that used to post 16 static data fields. I just need to get 10 WP current user fields and pass the field data to a post string.
This php code allows user registration data to be passed to a third-party content provider website, so the WP user doesn't have to go through the whole user signup process twice.
I first need the correct coding for the get current user array and then define the correct values for the post string. The post string is expecting certain label names for each value and will not except WP label names.
Example - post string expects 'firstname' => 'value', not 'user_firstname' => 'value'. After days of fatal parse errors for syntax, now I just get a fail status. Either my array code or post code, (or both), is somehow flawed. This is what I have:
global $current_user;
Function get_currentuserinfo(){
$current_user-> $label;
$n="user_variable_{$type}_name";
${$n} = true;
//Get values for these 10 user fields
$query_vals = array(
'user_firstname' . $current_user->firstname =>'n',
'user_lastname' . $current_user->lastname =>'n',
'mepr-address-one' . $current_user->address =>'n',
'mepr-address-city' . $current_user->city =>'n',
'mepr-address-state' . $current_user->state =>'n',
'mepr-address-zip' . $current_user->zip =>'n',
'mepr-address-country' . $current_user->country =>'n',
'user_email' . $current_user->email =>'n',
'user_login' . $current_user->username =>'n',
'user_pass' . $current_user->password =>'n'
);
}
// Generate the POST string
// These 1st 3 lines did work when posting static data
$postdata = '';
foreach($query_vals as $key => $value) {
$postdata .= $key.'='.urlencode($value).'&';
//These last two lines aren't posting my get user data
foreach($query_vals as $key => $value)
$postdata .= $key.'='.urlencode($n=$value).'&';
}
Php Wizards please help!