Also, I think I know what I want to do but i am just not sure how to write it. Any help is always appreciated.
// Insert to table_agency_profile
$wpdb->query($wpdb->prepare(“INSERT INTO “.table_agency_profile.”
(
ProfileContactDisplay,
ProfileContactNameFirst,
ProfileContactNameLast,
ProfileGender,
ProfileContactEmail,
ProfileIsActive,
ProfileUserLinked,
ProfileType,
ProfileGallery
)
VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s)”,
$profile_contact_display,
$first_name,
$last_name,
$ProfileGender,
$user_email,
$profileactive,
$new_user,
$new_user_type,
$profile_gallery
));
$id = $wpdb->insert_id;
$NewProfileID = $id;
//Update and set ProfileUserLinked,ProfileGallery and ProfileContactDisplay with the ProfileID
if($rb_agency_option_profilenaming == 3){
$update = $wpdb->query("UPDATE " . table_agency_profile . " SET ProfileGallery='ID-" . $id . "', ProfileContactDisplay='ID-" . $id . "' WHERE ProfileID='" . $id . "'");
$profile_gallery = "ID-".$id;
rb_agency_createdir($profile_gallery);
}
add_user_meta( $new_user, 'user_profile_id', $new_user);
//Custom Fields
$arr = array();
foreach($_POST as $key => $value) {
if ((substr($key, 0, 15) == "ProfileCustomID") && (isset($value) && !empty($value))) {
$ProfileCustomID = substr($key, 15);
if(is_array($value)){
$value = implode(",",$value);
}
//format: _ID|value|_ID|value|_ID|value|
if(!empty($value)){
$arr[$ProfileCustomID] = $value;
}
}
}
$arr["new"] = true;
$arr["step1"] = true;
$arr["step2"] = true;
$arr["step3"] = true;
add_user_meta($new_user, 'rb_agency_new_registeredUser',$arr);
// Log them in if no confirmation required.
if ($rb_agencyinteract_option_registerapproval == 1) { // automatically approval
// Notify admin and user
rb_new_user_notification($new_user,$user_pass);
} else { // manually approval
// Notify admin and user
rb_new_user_notification($new_user,$user_pass);
}
}