├── .gitmodules ├── loader.php ├── changelog.txt ├── languages └── nbi-default.pot └── includes └── ning-buddypress-importer.php /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "includes/dash-notice"] 2 | path = includes/dash-notice 3 | url = git@bitbucket.org:incsub/wpmudev-dashboard-notification.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /loader.php: -------------------------------------------------------------------------------- 1 | 129, 'name'=> 'Ning To BuddyPress User Importer', 'screens' => array( 'buddypress_page_ning-importer' ) ); 37 | include_once( dirname( __FILE__ ) . '/includes/dash-notice/wpmudev-dash-notification.php' ); -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | Plugin Name: Ning To BuddyPress User Importer 2 | Plugin URI: http://premium.wpmudev.org/project/ning-to-buddypress-user-importer/ 3 | Description: Allows you to do a full import of a Ning network's users, their custom profile fields, and avatars to BuddyPress. Full support for very large member lists via optional FTP upload and batch processing. 4 | Author: Aaron Edwards (Incsub) 5 | 6 | Copyright 2010-2014 Incsub (http://incsub.com) 7 | 8 | Change Log: 9 | ---------------------------------------------------------------------- 10 | ---------------------------------------------------------------------- 11 | 12 | 1.2.2 -02/22/2017 13 | ---------------------------------------------------------------------- 14 | - Fix fatal error due to incompatible function bp_core_is_multisite 15 | 16 | 1.2.1 - 12/17/2014 17 | ---------------------------------------------------------------------- 18 | - Fix avatars import on some custom profile themes 19 | 20 | 1.2 - 12/16/2013 21 | ---------------------------------------------------------------------- 22 | - Update help link to ning site 23 | - Add checkbox option to import without sending emails 24 | 25 | 1.1 - 5/31/2013 26 | ---------------------------------------------------------------------- 27 | - Fix avatar retrieval from profile pages 28 | 29 | 1.0.7 - 1/15/2013 30 | ---------------------------------------------------------------------- 31 | - Make imported users immediately active in members listings 32 | 33 | 1.0.6 - 12/12/2011 34 | ---------------------------------------------------------------------- 35 | - Compatibility fixes for downloading avatars and latest Ning formats 36 | 37 | 1.0.5 - 9/30/2011 38 | ---------------------------------------------------------------------- 39 | - BuddyPress 1.5 Compatibility fix 40 | 41 | 1.0.4 - 2/25/2011 42 | ---------------------------------------------------------------------- 43 | - WP 3.1 w/BP 1.2.8 Compatibility fix 44 | 45 | 1.0.3 - 1/25/2011 46 | ---------------------------------------------------------------------- 47 | - Fixed minor error handling bug. 48 | 49 | 1.0.2 - 1/05/2011 50 | ---------------------------------------------------------------------- 51 | - WP 3.1 Compatibility 52 | 53 | 1.0.1 - 4/25/2010 54 | ---------------------------------------------------------------------- 55 | - is_multisite() not in WP 2.9.2. Sorry guys! 56 | 57 | 1.0.0 - 4/19/2010 58 | ---------------------------------------------------------------------- 59 | - Initial Release. -------------------------------------------------------------------------------- /languages/nbi-default.pot: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 2 | # This file is distributed under the same license as the package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: \n" 6 | "Report-Msgid-Bugs-To: http://premium.wpmudev.org/\n" 7 | "POT-Creation-Date: 2013-12-16 17:57:29+00:00\n" 8 | "MIME-Version: 1.0\n" 9 | "Content-Type: text/plain; charset=UTF-8\n" 10 | "Content-Transfer-Encoding: 8bit\n" 11 | "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n" 12 | "Last-Translator: FULL NAME \n" 13 | "Language-Team: LANGUAGE \n" 14 | 15 | #: includes/ning-buddypress-importer.php:62 16 | #: includes/ning-buddypress-importer.php:523 17 | msgid "Ning Importer" 18 | msgstr "" 19 | 20 | #: includes/ning-buddypress-importer.php:155 21 | msgid "Skipped - Email address already in use: " 22 | msgstr "" 23 | 24 | #: includes/ning-buddypress-importer.php:207 25 | msgid "Could not create user: " 26 | msgstr "" 27 | 28 | #: includes/ning-buddypress-importer.php:228 29 | msgid "Successfully Imported: %s - %s (%s)" 30 | msgstr "" 31 | 32 | #: includes/ning-buddypress-importer.php:243 33 | msgid "Processed %d of %d members so far. Please be patient as this process may take a while." 34 | msgstr "" 35 | 36 | #: includes/ning-buddypress-importer.php:247 37 | msgid "If your browser doesn’t start loading the next page automatically, click this link:" 38 | msgstr "" 39 | 40 | #: includes/ning-buddypress-importer.php:247 41 | msgid "Next Members" 42 | msgstr "" 43 | 44 | #: includes/ning-buddypress-importer.php:260 45 | msgid "Congratulations! %d of %d members were imported successfully." 46 | msgstr "" 47 | 48 | #: includes/ning-buddypress-importer.php:262 49 | msgid "They should be recieving your notification email with their username and temporary random password." 50 | msgstr "" 51 | 52 | #: includes/ning-buddypress-importer.php:263 53 | msgid "Adjust Profile Fields" 54 | msgstr "" 55 | 56 | #: includes/ning-buddypress-importer.php:268 57 | msgid "%d errors were encountered during the import:" 58 | msgstr "" 59 | 60 | #: includes/ning-buddypress-importer.php:362 61 | msgid "Unable to create directory %s. Is its parent directory writable by the server?" 62 | msgstr "" 63 | 64 | #: includes/ning-buddypress-importer.php:368 65 | msgid "Could not write file %s" 66 | msgstr "" 67 | 68 | #: includes/ning-buddypress-importer.php:384 69 | msgid "Remote server did not respond" 70 | msgstr "" 71 | 72 | #: includes/ning-buddypress-importer.php:390 73 | msgid "Remote file returned error response %1$d %2$s" 74 | msgstr "" 75 | 76 | #: includes/ning-buddypress-importer.php:393 77 | msgid "Remote file is incorrect size" 78 | msgstr "" 79 | 80 | #: includes/ning-buddypress-importer.php:416 81 | #: includes/ning-buddypress-importer.php:422 82 | msgid "Invalid file type" 83 | msgstr "" 84 | 85 | #: includes/ning-buddypress-importer.php:529 86 | msgid "Import file successfully deleted." 87 | msgstr "" 88 | 89 | #: includes/ning-buddypress-importer.php:544 90 | msgid "There was a problem uploading your file. Please check permissions or use FTP." 91 | msgstr "" 92 | 93 | #: includes/ning-buddypress-importer.php:553 94 | msgid "Invalid file format. Please upload your export file ending in \".csv\"." 95 | msgstr "" 96 | 97 | #: includes/ning-buddypress-importer.php:564 98 | msgid "A Ning import file was detected with %d members to process." 99 | msgstr "" 100 | 101 | #: includes/ning-buddypress-importer.php:565 102 | msgid "Delete Import File" 103 | msgstr "" 104 | 105 | #: includes/ning-buddypress-importer.php:571 106 | msgid "Detected Custom Profile Fields:" 107 | msgstr "" 108 | 109 | #: includes/ning-buddypress-importer.php:572 110 | msgid "The following custom profile fields will be created if not existing and imported to BuddyPress. You should modify the field types and settings after import." 111 | msgstr "" 112 | 113 | #: includes/ning-buddypress-importer.php:581 114 | msgid "Customize Your Email Notification:" 115 | msgstr "" 116 | 117 | #: includes/ning-buddypress-importer.php:583 118 | msgid "Subject:" 119 | msgstr "" 120 | 121 | #: includes/ning-buddypress-importer.php:585 122 | msgid "No HTML allowed. The following codes will be replaced with their appropriate values: FULLNAME, USERNAME, EMAIL, SITENAME" 123 | msgstr "" 124 | 125 | #: includes/ning-buddypress-importer.php:588 126 | msgid "Message:" 127 | msgstr "" 128 | 129 | #: includes/ning-buddypress-importer.php:590 130 | msgid "No HTML allowed. The following codes will be replaced with their appropriate values: FULLNAME, USERNAME, PASSWORD, EMAIL, LOGINURL, SITENAME" 131 | msgstr "" 132 | 133 | #: includes/ning-buddypress-importer.php:594 134 | msgid "Don't send emails" 135 | msgstr "" 136 | 137 | #: includes/ning-buddypress-importer.php:595 138 | msgid "If you are wanting to test the import or just not send email notifications you may check this box." 139 | msgstr "" 140 | 141 | #: includes/ning-buddypress-importer.php:598 142 | msgid "New Username Source:" 143 | msgstr "" 144 | 145 | #: includes/ning-buddypress-importer.php:601 146 | msgid "Display Name" 147 | msgstr "" 148 | 149 | #: includes/ning-buddypress-importer.php:602 150 | msgid "Email Prefix" 151 | msgstr "" 152 | 153 | #: includes/ning-buddypress-importer.php:605 154 | msgid "Though your Ning members are used to logging in with their email address, usernames will be used in BuddyPress in profile url slugs and @username replies. Because of this in most cases we recommend choosing the display name as that is what was public before." 155 | msgstr "" 156 | 157 | #: includes/ning-buddypress-importer.php:609 158 | msgid "Please be patient while members are being imported. The page will attempt to import 5 members at a time then refresh to import the next batch. Don't worry if you have duplicate members in your csv as it will skip existing BuddyPress users if their email address exists. Ready?" 159 | msgstr "" 160 | 161 | #: includes/ning-buddypress-importer.php:611 162 | msgid "Import Members »" 163 | msgstr "" 164 | 165 | #: includes/ning-buddypress-importer.php:615 166 | msgid "Please Note:

Spam filters, especially strict ones for institutional email addresses, can sometimes block this username and login information from reaching your members. You should consider also sending out a bulk email via another method to your network notifying them of the migration and who to contact if they don't recieve this notification." 167 | msgstr "" 168 | 169 | #: includes/ning-buddypress-importer.php:623 170 | msgid "Please export your Ning network members to a CSV file and upload that file here. If your CSV is too large, you can ftp it to the \"%s\" directory and rename it to \"ning-export.csv\"." 171 | msgstr "" 172 | 173 | #: includes/ning-buddypress-importer.php:626 174 | msgid "Maximum file size: " 175 | msgstr "" 176 | 177 | #: includes/ning-buddypress-importer.php:629 178 | msgid "Upload »" 179 | msgstr "" 180 | 181 | #: includes/ning-buddypress-importer.php:650 182 | msgid "Importing Members..." 183 | msgstr "" -------------------------------------------------------------------------------- /includes/ning-buddypress-importer.php: -------------------------------------------------------------------------------- 1 | $value ) { 110 | $new_fields[ $titles[ $key ] ] = $value; 111 | } 112 | } 113 | 114 | $fields[] = $new_fields; 115 | } 116 | 117 | 118 | fclose( $fh ); 119 | 120 | //remove header row 121 | array_shift( $fields ); 122 | 123 | return $fields; 124 | } else { 125 | return false; 126 | } 127 | } 128 | 129 | function nbi_file_path( $dir = false ) { 130 | $target_path = wp_upload_dir(); 131 | if ( $dir ) { 132 | return trailingslashit( $target_path['basedir'] ); 133 | } else { 134 | return trailingslashit( $target_path['basedir'] ) . 'ning-export.csv'; 135 | } 136 | } 137 | 138 | function nbi_process_import_queue() { 139 | @set_time_limit( 60 ); 140 | $users = nbi_get_csv_array(); 141 | 142 | $total = count( $users ); 143 | $count = get_option( 'nbi_count' ); 144 | $count = ( ! $count ) ? 0 : $count; 145 | 146 | $imported_count = get_option( 'nbi_imported_count' ); 147 | $imported_count = ( ! $imported_count ) ? 0 : $imported_count; 148 | 149 | $errors = get_option( 'nbi_errors' ); 150 | 151 | //only do 5 users at a time 152 | $users = array_slice( $users, $count, 5 ); 153 | 154 | if ( count( $users ) ) { 155 | echo '"; 249 | echo '

' . sprintf( __( 'Processed %d of %d members so far. Please be patient as this process may take a while.', 'nbi' ), $count, $total ) . '

'; 250 | 251 | ?> 252 |
253 |

254 |

256 | ' . sprintf( __( 'Congratulations! %d of %d members were imported successfully.', 'nbi' ), $imported_count, $total ) . ''; 269 | ?> 270 |

271 |

272 |

273 | 274 | ' . sprintf( __( '%d errors were encountered during the import:', 'nbi' ), count( $errors ) ) . '

'; 278 | echo ""; 283 | } 284 | 285 | //delete import file and options 286 | if ( @unlink( nbi_file_path() ) ) { 287 | //delete options 288 | delete_option( 'nbi_count' ); 289 | delete_option( 'nbi_imported_count' ); 290 | delete_option( 'nbi_errors' ); 291 | } 292 | 293 | } 294 | } 295 | 296 | function nbi_create_buddypress_fields() { 297 | $fields = nbi_get_profile_fields(); 298 | 299 | foreach ( $fields as $field ) { 300 | //skip if existing 301 | if ( xprofile_get_field_id_from_name( $field ) ) { 302 | continue; 303 | } 304 | 305 | $args = array( 306 | 'field_group_id' => 1, 307 | 'name' => $field, 308 | 'type' => 'textarea', 309 | 'is_required' => false 310 | ); 311 | xprofile_insert_field( $args ); 312 | } 313 | 314 | 315 | } 316 | 317 | function nbi_import_buddypress_fields( $user_id, $user ) { 318 | $fields = nbi_get_profile_fields(); 319 | 320 | //loop through custom fields and insert 321 | foreach ( $fields as $field ) { 322 | if ( $user[ $field ] ) { 323 | xprofile_set_field_data( $field, $user_id, $user[ $field ] ); 324 | } 325 | } 326 | } 327 | 328 | //filters http timeout 329 | function nbi_filter_http_timeout( $val ) { 330 | return 30; 331 | } 332 | 333 | //filters useragent 334 | function nbi_filter_http_useragent( $user_agent ) { 335 | return 'Ning To BuddyPress Importer: http://premium.wpmudev.org'; 336 | } 337 | 338 | //scans the user's profile page and scrapes their avatar, adding it to BP 339 | function nbi_fetch_ning_avatar( $user_id, $profile_url ) { 340 | 341 | add_filter( 'http_request_timeout', 'nbi_filter_http_timeout' ); 342 | add_filter( 'http_headers_useragent', 'nbi_filter_http_useragent' ); 343 | 344 | //get the avatar url from the profile 345 | $profile_page = wp_remote_retrieve_body( wp_remote_get( $profile_url ) ); 346 | if ( ! $profile_page ) { 347 | return false; 348 | } 349 | 350 | $regex = '/_origImgUrl=([\'"])?((?(1).+?|[^\s>]+))(?(1)\1)/'; 351 | if ( preg_match( $regex, $profile_page, $match ) ) { 352 | $img_url = urldecode( $match[2] ); 353 | } 354 | 355 | //profile page is different, so try just fetching first image 356 | if ( ! $img_url ) { 357 | $regex = '/]*src="([^"]*)"[^>]*>/'; 358 | if ( preg_match( $regex, $profile_page, $match ) ) { 359 | $img_url = urldecode( $match[1] ); 360 | } 361 | } 362 | 363 | if ( ! $img_url ) { 364 | return false; 365 | } //still no image skip 366 | 367 | if ( false !== ( $pos = strpos( $img_url, '?' ) ) ) { 368 | $img_url = substr( $img_url, 0, $pos ); 369 | } 370 | 371 | $url = add_query_arg( array( 'width' => BP_AVATAR_FULL_WIDTH, 372 | 'height' => BP_AVATAR_FULL_HEIGHT, 373 | 'crop' => '1%3A1' 374 | ), $img_url ); 375 | 376 | // extract the file name and extension from the url 377 | $file_name = basename( $img_url ); 378 | 379 | // get placeholder file in the upload dir with a unique sanitized filename 380 | $upload = wp_upload_dir(); 381 | 382 | $upload['path'] = $upload['basedir']; 383 | 384 | $filename = wp_unique_filename( $upload['path'], $file_name ); 385 | 386 | $new_file = $upload['path'] . "/$filename"; 387 | if ( ! wp_mkdir_p( dirname( $new_file ) ) ) { 388 | $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), dirname( $new_file ) ); 389 | 390 | return array( 'error' => $message ); 391 | } 392 | 393 | $ifp = @ fopen( $new_file, 'wb' ); 394 | if ( ! $ifp ) { 395 | return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) ); 396 | } 397 | 398 | @fwrite( $ifp, $bits ); 399 | fclose( $ifp ); 400 | // Set correct file permissions 401 | $stat = @ stat( dirname( $new_file ) ); 402 | $perms = $stat['mode'] & 0007777; 403 | $perms = $perms & 0000666; 404 | @ chmod( $new_file, $perms ); 405 | 406 | // fetch the remote url and write it to the placeholder file 407 | $headers = wp_get_http( $url, $new_file ); 408 | 409 | //Request failed 410 | if ( ! $headers ) { 411 | @unlink( $new_file ); 412 | 413 | return new WP_Error( 'import_file_error', __( 'Remote server did not respond' ) ); 414 | } 415 | 416 | // make sure the fetch was successful 417 | if ( $headers['response'] != '200' ) { 418 | @unlink( $new_file ); 419 | 420 | return new WP_Error( 'import_file_error', sprintf( __( 'Remote file returned error response %1$d %2$s' ), $headers['response'], get_status_header_desc( $headers['response'] ) ) ); 421 | } else if ( isset( $headers['content-length'] ) && filesize( $new_file ) != $headers['content-length'] ) { 422 | @unlink( $new_file ); 423 | 424 | return new WP_Error( 'import_file_error', __( 'Remote file is incorrect size' ) ); 425 | } 426 | 427 | //if file extension is bin rename it based on image headers 428 | if ( preg_match( '!\.(bin)$!i', $filename ) ) { 429 | if ( 430 | strpos( $headers['content-type'], 'image/jpeg' ) !== false 431 | || 432 | strpos( $headers['content-type'], 'image/pjpeg' ) !== false 433 | ) { 434 | $renamed = str_replace( '.bin', '.jpg', $new_file ); 435 | @rename( $new_file, $renamed ); 436 | $new_file = $renamed; 437 | } else if ( strpos( $headers['content-type'], 'image/png' ) !== false ) { 438 | $renamed = str_replace( '.bin', '.png', $new_file ); 439 | @rename( $new_file, $renamed ); 440 | $new_file = $renamed; 441 | } else if ( strpos( $headers['content-type'], 'image/gif' ) !== false ) { 442 | $renamed = str_replace( '.bin', '.gif', $new_file ); 443 | @rename( $new_file, $renamed ); 444 | $new_file = $renamed; 445 | } else { 446 | @unlink( $new_file ); 447 | 448 | return new WP_Error( 'import_file_error', __( 'Invalid file type' ) ); 449 | } 450 | } else { //not bin, check if valid 451 | $wp_filetype = wp_check_filetype( $filename ); 452 | if ( ! $wp_filetype['ext'] ) { 453 | @unlink( $new_file ); 454 | 455 | return new WP_Error( 'import_file_error', __( 'Invalid file type' ) ); 456 | } 457 | } 458 | 459 | //save to buddypress 460 | //$avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/avatars/' . $user_id, $user_id, 'user', 'avatars' ); 461 | $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', bp_core_avatar_upload_path() . '/avatars/' . $user_id, $user_id, 'user', 'avatars' ); 462 | 463 | require_once( ABSPATH . '/wp-admin/includes/image.php' ); 464 | require_once( ABSPATH . '/wp-admin/includes/file.php' ); 465 | 466 | /* Delete the existing avatar files for the object */ 467 | bp_core_delete_existing_avatar( array( 'object' => 'user', 'avatar_path' => $avatar_folder_dir ) ); 468 | 469 | /* Set the full and thumb filenames */ 470 | $full_filename = wp_hash( $original_file . time() ) . '-bpfull.jpg'; 471 | $thumb_filename = wp_hash( $original_file . time() ) . '-bpthumb.jpg'; 472 | 473 | //make sure directory exists 474 | wp_mkdir_p( $avatar_folder_dir ); 475 | 476 | /* Crop the image */ 477 | $full_cropped = wp_crop_image( $new_file, 0, 0, BP_AVATAR_FULL_WIDTH, BP_AVATAR_FULL_HEIGHT, BP_AVATAR_FULL_WIDTH, BP_AVATAR_FULL_HEIGHT, false, $avatar_folder_dir . '/' . $full_filename ); 478 | $thumb_cropped = wp_crop_image( $new_file, 0, 0, BP_AVATAR_FULL_WIDTH, BP_AVATAR_FULL_HEIGHT, BP_AVATAR_THUMB_WIDTH, BP_AVATAR_THUMB_HEIGHT, false, $avatar_folder_dir . '/' . $thumb_filename ); 479 | 480 | /* Remove the original */ 481 | @unlink( $new_file ); 482 | 483 | return true; 484 | 485 | } 486 | 487 | 488 | //------------------------------------------------------------------------// 489 | 490 | //---Output Functions-----------------------------------------------------// 491 | 492 | //------------------------------------------------------------------------// 493 | 494 | function nbi_new_user_notification( $user_id, $plaintext_pass ) { 495 | //skip email if turned off 496 | if ( get_option( 'nbi_email_nosend' ) ) { 497 | return false; 498 | } 499 | 500 | $user = new WP_User( $user_id ); 501 | 502 | $user_login = stripslashes( $user->user_login ); 503 | $user_email = stripslashes( $user->user_email ); 504 | 505 | // The blogname option is escaped with esc_html on the way into the database in sanitize_option 506 | // we want to reverse this for the plain text arena of emails. 507 | $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 508 | 509 | //filter subject 510 | $subject = stripslashes( get_option( 'nbi_email_subject' ) ); 511 | $subject = str_replace( 'FULLNAME', $user->display_name, $subject ); 512 | $subject = str_replace( 'USERNAME', $user_login, $subject ); 513 | $subject = str_replace( 'EMAIL', $user_email, $subject ); 514 | $subject = str_replace( 'SITENAME', $blogname, $subject ); 515 | 516 | //filter message 517 | $message = stripslashes( get_option( 'nbi_email_text' ) ); 518 | $message = str_replace( 'FULLNAME', $user->display_name, $message ); 519 | $message = str_replace( 'USERNAME', $user_login, $message ); 520 | $message = str_replace( 'PASSWORD', $plaintext_pass, $message ); 521 | $message = str_replace( 'EMAIL', $user_email, $message ); 522 | $message = str_replace( 'LOGINURL', wp_login_url(), $message ); 523 | $message = str_replace( 'SITENAME', $blogname, $message ); 524 | 525 | wp_mail( $user_email, $subject, $message ); 526 | 527 | } 528 | 529 | //------------------------------------------------------------------------// 530 | 531 | //---Page Output Functions------------------------------------------------// 532 | 533 | //------------------------------------------------------------------------// 534 | 535 | function nbi_page_output() { 536 | global $wpdb; 537 | 538 | //only show to site admins if on wpmu 539 | if ( is_multisite() && ! is_site_admin() ) { 540 | echo "

Nice Try...

"; //If accessed properly, this message doesn't appear. 541 | return; 542 | } 543 | 544 | if ( ! current_user_can( 'edit_users' ) ) { 545 | echo "

Nice Try...

"; //If accessed properly, this message doesn't appear. 546 | return; 547 | } 548 | 549 | echo '
'; 550 | 551 | switch ( $_GET['action'] ) { 552 | //---------------------------------------------------// 553 | default: 554 | 555 | $file_path = nbi_file_path(); 556 | 557 | ?> 558 |

559 |

' . __( 'Import file successfully deleted.', 'nbi' ) . '

'; 565 | } 566 | 567 | //if uploaded file 568 | if ( isset( $_FILES['csv_file']['name'] ) ) { 569 | 570 | //make sure directory exists 571 | wp_mkdir_p( nbi_file_path( true ) ); 572 | 573 | //check extension 574 | if ( preg_match( '!\.(csv)$!i', strtolower( $_FILES['csv_file']['name'] ) ) ) { 575 | 576 | //attempt to move uploaded file 577 | if ( ! move_uploaded_file( $_FILES['csv_file']['tmp_name'], $file_path ) ) { 578 | @unlink( $_FILES['csv_file']['tmp_name'] ); 579 | echo '

' . __( 'There was a problem uploading your file. Please check permissions or use FTP.', 'nbi' ) . '

'; 580 | } else { 581 | //success, clear options 582 | delete_option( 'nbi_count' ); 583 | delete_option( 'nbi_imported_count' ); 584 | delete_option( 'nbi_errors' ); 585 | } 586 | 587 | } else { 588 | echo '

' . __( 'Invalid file format. Please upload your export file ending in ".csv".', 'nbi' ) . '

'; 589 | } 590 | 591 | } 592 | 593 | //if file has been uploaded 594 | if ( file_exists( $file_path ) ) { 595 | $fields = nbi_get_profile_fields(); 596 | $total = count( nbi_get_csv_array() ); 597 | ?> 598 |
599 |

600 | 601 |

603 | 604 | 608 |

609 |

610 | '; 612 | foreach ( $fields as $field ) { 613 | echo '
  • ' . $field . '
  • '; 614 | } 615 | echo ""; 616 | } 617 | ?> 618 | 619 |

    620 | 621 |

    622 |
    623 |
    626 | 627 |

    628 |

    629 |
    630 |
    632 | 633 |

    634 |

    635 |
    638 | 639 |

    640 | 641 |

    642 | 643 |

    644 | 650 |
    651 | 652 |

    653 | 654 |
    655 | 656 |

    657 | 658 |

    659 | 661 |

    662 |
    663 |

    664 | Please Note:

    Spam filters, especially strict ones for institutional email addresses, can sometimes block this username and login information from reaching your members. You should consider also sending out a bulk email via another method to your network notifying them of the migration and who to contact if they don\'t recieve this notification.', 'nbi' ) ?> 665 |

    666 | 671 |
    672 |

    export your Ning network members to a CSV file and upload that file here. If your CSV is too large, you can ftp it to the "%s" directory and rename it to "ning-export.csv".', 'nbi' ), nbi_file_path( true ) ); ?>

    673 | 674 |

    675 |
    676 | 677 |

    678 |

    679 | 681 |

    682 |
    683 | 701 |

    702 |
    703 | '; 713 | } 714 | 715 | ?> --------------------------------------------------------------------------------