Changeset 10
- Timestamp:
- 04/05/2008 12:15:13 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp_xprofile.php
r9 r10 311 311 $list_html .= '<p>This group is currently empty. Please contact the site admin if this is incorrect.</p>'; 312 312 } 313 313 314 echo BP_XProfile_Field::get_type(2); 314 315 ?> 315 316 -
trunk/bp_xprofile/bp_xprofile.classes.php
r9 r10 519 519 } 520 520 521 $html .= '<div id="field_' . $this->id . '" ';521 $html .= '<div id="field_' . $this->id . '">'; 522 522 $html .= '<label for="field_' . $this->id . '_day">' . $asterisk . $this->name . ':</label>'; 523 523 … … 780 780 } 781 781 782 function get_type($field_id) 783 { 784 global $wpdb, $bp_xprofile_table_name; 785 786 if(bp_core_validate($field_id)) 787 { 788 $sql = "SELECT type 789 FROM " . $bp_xprofile_table_name . "_fields 790 WHERE id = " . $field_id; 791 792 if(!$field_type = $wpdb->get_var($sql)) 793 { 794 return false; 795 } 796 797 return $field_type; 798 } 799 800 return false; 801 } 782 802 } 783 803 -
trunk/bp_xprofile/bp_xprofile.signup.php
r6 r10 90 90 { 91 91 $_POST['blog_id'] = $_POST['user_name']; 92 $_POST['blog_title'] = $_POST['field_1']; // The core 'Full Name' field.92 $_POST['blog_title'] = $_POST['field_1']; // The core name fields. 93 93 94 94 $counter = 0; 95 95 $hasErrors = false; 96 $prev_field_id = 0; 96 97 foreach($_POST as $key => $value) 97 98 { … … 100 101 $field_id = explode("_", $key); 101 102 $field_id = $field_id[1]; 103 $field_type = BP_XProfile_Field::get_type($field_id); 102 104 103 $field = new BP_XProfile_Field($field_id); 104 105 $bp_xprofile_callback[$counter] = array( 106 "field_id" => $field_id, 107 "value" => $value 108 ); 109 110 if($field->is_required && $_POST[$key] == '') 111 { 112 $bp_xprofile_callback[$counter]["error_msg"] = $field->name . ' cannot be left blank.'; 113 $hasErrors = true; 105 // Need to check if the previous field had 106 // the same ID, as to not validate individual 107 // day/month/year dropdowns individually. 108 if($prev_field_id != $field_id) { 109 $field = new BP_XProfile_Field($field_id); 110 111 if($field_type == "datebox") { 112 $value = strtotime($_POST['field_' . $field_id . '_day'] . " " . 113 $_POST['field_' . $field_id . '_month'] . " " . 114 $_POST['field_' . $field_id . '_year']); 115 } 116 117 $bp_xprofile_callback[$counter] = array( 118 "field_id" => $field->id, 119 "type" => $field->type, 120 "value" => $value 121 ); 122 123 if($field->is_required && $_POST[$key] == '') 124 { 125 $bp_xprofile_callback[$counter]["error_msg"] = $field->name . ' cannot be left blank.'; 126 $hasErrors = true; 127 } 128 129 $counter++; 114 130 } 115 131 116 $ counter++;132 $prev_field_id = $field_id; 117 133 } 118 134 } … … 122 138 123 139 if ( $errors->get_error_code() || $hasErrors ) { 140 124 141 signup_user($user_name, $user_email, $errors); 125 142 … … 145 162 for($i=0; $i<count($bp_xprofile_callback); $i++) 146 163 { 147 $meta['field_' . $bp_xprofile_callback[$i]['field_id']] = $bp_xprofile_callback[$i]['value'];164 $meta['field_' . $bp_xprofile_callback[$i]['field_id']] .= $bp_xprofile_callback[$i]['value']; 148 165 } 149 166 150 167 $meta['xprofile_field_ids'] = $_POST['xprofile_ids']; 151 168 $meta = apply_filters( "add_signup_meta", $meta ); 152 169 153 170 wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta); 154 171 confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta); … … 210 227 global $wpdb, $wpmuBaseTablePrefix, $profile_picture_path; 211 228 229 // Extract signup meta fields to fill out profile 212 230 $field_ids = get_blog_option($blog_id, 'xprofile_field_ids'); 213 231 $field_ids = explode(",", $field_ids); 214 232 233 // Get the new user ID. 215 234 $sql = "SELECT u.ID from " . $wpmuBaseTablePrefix . "users u, 216 235 " . $wpmuBaseTablePrefix . "usermeta um … … 218 237 AND um.meta_key = 'primary_blog' 219 238 AND um.meta_value = " . $blog_id; 220 239 221 240 $user_id = $wpdb->get_var($sql); 222 241 242 // Loop through each bit of profile data and save it to profile. 223 243 for($i=0; $i<count($field_ids); $i++) 224 244 { … … 228 248 229 249 $field = new BP_XProfile_ProfileData(); 230 231 250 $field->user_id = $user_id; 232 251 $field->value = $field_value; 233 252 $field->field_id = $field_ids[$i]; 234 $field->last_updated = time(); 235 253 $field->last_updated = time(); 254 236 255 $field->save(); 237 256 delete_blog_option($blog_id, 'field_' . $field_ids[$i]); … … 240 259 delete_blog_option($blog_id, 'xprofile_field_ids'); 241 260 261 // Set up profile pictures and create a directory to store them for the user. 242 262 $profile_picture_path = trim(get_blog_option($blog_id, 'upload_path')) . '/profilepics'; 243 263 … … 260 280 261 281 } 282 262 283 } 263 284
Note: See TracChangeset
for help on using the changeset viewer.