Can I import my users before sending the email

I have the plugin and .csv ning file - but while I want to import my users - I don't want to send out any emails just yet. The free ning importer plugin does this - but I was having issues with importing the profile pics - so I purchased a membership here just to get these profile pics in - however it seems like if I start the import it will also send out hundreds of emails...

Maybe there is a php command I can add to the plugin files that will stop the plugin from sending an email just yet. I want to finish setting up the site and ensure that everything is working before inviting hundreds of people to signup... I think this would be an obvious feature in such a plugin.

When I am ready I can clear the database table, restore the plugin php files to their original version and reimport with the emails going out.

  • DavidM
    • DEV MAN’s Mascot

    Hi batsirai and first off, welcome to WPMU DEV!

    That should be simple enough, if you don't mind a slight edit to the plugin core for a moment. I believe you can do that by commenting out line 471 of ning-buddypress-importer\includes as follows:
    //wp_mail($user_email, $subject, $message);

    That's where the message is being sent so commenting it ought will stop it from sending. How would that work for you?

    -David

  • batsirai
    • Flash Drive

    yes. looks like its a default avatar

    I even reverted to the default buddy press theme - and the same effect - only users with gravatar images are shown - same as the current theme.

    The question is: will the WPMU plugin import Ning users profile pictures? The members export csv doesn't have links to the profile image.

  • Aaron
    • CTO

    Hi there, it is supposed to import the pictures, but it's entirely possible that something was changed on ning's side that breaks that step. Let me take a look at it... I'll get back to you in a bit.

    UPDATE

    Ok, I think I "may" have found the issue. Can you try this for me? Change line 332 of ning-buddypress-importer.php from:
    $img_url = substr($sub_html, strpos($sub_html, 'src="http://api.ning.com/files/') + 5);
    to
    $img_url = substr($sub_html, strpos($sub_html, 'src="http://api.ning.com') + 5);

    It looks like the profile image urls are starting with http://api.ning.com:80/files/ now, so it's not catching in a search for http://api.ning.com/files/.

    Let me know if that fixes it and I'll put out a new release.

  • batsirai
    • Flash Drive

    No - it didn't solve the issue - but you are correct the profile images are now at :80/files

    here is an excerpt of a ning-members.json

    ([{"createdDate":"2011-11-29T02:21:26.844Z","fullName":"John Smith","birthdate":"1945-02-05","email":"exmaple@gmail.com","profileQuestions":{"City/Town, Province":"Medicine Hat, AB","How many hats do you wear (your roles)":"Choir, Fan"},"profilePhoto":"http://api.ning.com:80/files/DNWudNGcVfd4hSGkxsYiPADQEjvfM8JONJVOQxEt3-NS5ToGw4rntNz8LcLezRMGujfScHQq-f3bBadYHAKC-9kM0BpyK2PC/780866695.bin?xgip=99%3A0%3A479%3A479%3B%3B&crop=1%3A1","level":"member","state":"active","contributorName":"020zyxla1vrr5"}

    Glad we are making progress!

  • Aaron
    • CTO

    Ok, lets try to get a better error message. Change line 212 from
    //scrape avatar
    nbi_fetch_ning_avatar( $user_id, $user['Profile Address'] );
    to

    //scrape avatar
    $result = nbi_fetch_ning_avatar( $user_id, $user['Profile Address'] );
    if ( is_wp_error($result) ) {
    	$errors[] = __('Could not get avatar for ', 'nbi') . $user['Name'] . ': ' . $user_id->get_error_message();
    }

    Note for testing it'd be easier to just keep say the first 10 lines of your csv, no need to loop through them all!

  • Aaron
    • CTO

    Sounds like a problem with your modded csv, not the code change in question. Same with the original csv?

    If json exports were available when I coded this, totally would have gone that route as the avatar url is right there. But that would be a total rewrite of the plugin unfortunately at this point.

    Sorry i'm making you do all the debugging. I don't have access to a ning account or fresh data for testing anymore.

  • batsirai
    • Flash Drive

    Np - dont mind - and I'm probably a bit more techy than other users...

    I made the change, imported 10 users - still not bringing in the avatar.

    Do you want direct access to all this - I can supply the csv, and login info (cpanel & wordpress) - its not a production site yet. It might be much faster for you...

  • Vladislav
    • Dead Eye Dev

    Hi,

    I think the problem is two-part - one being the new Ning image URL, which prevented the plugin from finding the proper URL. The second part was header recognition - where we expected an usual image/jpeg as header, Ning was responding with image/pjpeg instead.

    Both of these were fixed in the attached version. I have tested it and it seemed to work properly - can you please give it a go and see if it helps with this issue on your setup?

  • batsirai
    • Flash Drive

    No dice.

    I installed the new version. Uploaded a membersdata file (see attached) - but I still get the default avatar - not the imported profile picture. I also switched the default buddypress theme - to exclude the possibility that it was the theme I was using.

    Do you have my access info - so you can go in, and try it your self? I had mailed the info to Aaron before.

    You can delete all users except admin and wpmu
    Then make sure the plugin doesn't send out any emails upon import.

    line 471 of ning-buddypress-importer\includes as follows:
    //wp_mail($user_email, $subject, $message);

    Let me know... thanks for the progress updates!

    NB: Looks like I cant upload the attachment. I can email it to you - if you let me know where.

  • Vladislav
    • Dead Eye Dev

    Hi,

    In addition to the previously mentioned issues I managed to find another one, which was a bit sneakier and wasn't applying to the local setup I was testing it on. It was, however, in effect on your site and thanks to your help I believe it should be solved now. I updated the plugin version on your site and managed to import several users from your CSV, together with their avatars.

    I have made sure the mailing line is commented out, and I also changed the emails in the test csv for each user before attempting to import, just in case. You can see the result on your site - you can safely delete the imported users and test the import yourself. I'm attaching the changed version for reference.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.