WordPress.org

Ready to get started?Download WordPress

Forums

Team Rosters
[resolved] CSV Import Failure (10 posts)

  1. nano_mike
    Member
    Posted 10 months ago #

    Hi Mark,

    Good looking plugin - thanks for the work!

    I'm trying to get things set up for a Minor football club and am having issues with the CSV importer.

    WP: Version 3.5.1
    Plugin version 2.1

    Each time I try to upload I get:

    $opt_cat(ID): 41 Team slug: 2013-atom-grizzlies

    Team slug: 2013-atom-grizzlies
    Loading DataSource ...

    Done.

    Import CSV
    Imported 0 posts to 2013-atom-grizzlies in 0.00 seconds.

    I get the same result with the sample CSV files as with my own.

    Thanks,

    http://wordpress.org/extend/plugins/team-rosters/

  2. nano_mike
    Member
    Posted 10 months ago #

    Ok, I take it back - the sample files work if you don't let excel touch them. :o)

    Seems to have to do with the quotes around certain fields.

  3. nano_mike
    Member
    Posted 10 months ago #

    FYI: It's the line endings.

    Classic MAC (CR only) isn't sufficient. Must use CRLF for this to work.

  4. Mark O'Donnell
    Member
    Plugin Author

    Posted 10 months ago #

    Correct. Good work, thanks for finding this. I guess I need to add that to the documentation. Didn't think anyone was still using a Mac. Are they still in business? (JK. I think this issue's been around forever and is really a UNIX - PC/DOS/Windows thing.)

    [ Signature moderated. ]

  5. nano_mike
    Member
    Posted 10 months ago #

    haha.. yes, yes I believe there may be a blogger or two out there *still* using a MAC. I'm actually surprised this hasn't come up before..

    In any event, while poking around a bit I made a small change that may be useful (I may make some more and pass them along)

    I modified the CSV import so that it checks if a given player already exists (based on the slug) and if so, don't bother adding them again, just add them to the team we're importing.

    in mstw-team-rosters-admin.php around line 1363

    // mph - Test for the existance of this player first!
    		echo '<p>Checking Player: ' . $temp_title . ' <br/> Slug: ' . $temp_slug ;
    
    		$search = array(
    				'post_type' => $type,
    				'name' => $temp_slug,
    				'post_status' => 'publish',
    				'numberposts' => 1
    			);
    
    		if ( $player_exists = get_posts( $search ) ){
    			echo '<br/>Looks like they already exist in our system, adding them to this team... </p>';
    			$term = get_term_by( 'id', $opt_cat, 'teams' );
    			wp_set_object_terms( $player_exists[0]->ID, $term->slug, 'teams');
    			echo '<br/>Updating their info... </p>';
    			$this->create_custom_fields( $player_exists[0]->ID, $data );
    			return false;
    		}
    
    		echo '<br/>Nobody Found, Creating new player... </p>';
    		// - end mph

    I commented out the rest of the echos since I'm not sure they mean much to anyone unless their debugging

  6. nano_mike
    Member
    Posted 8 months ago #

    So it appears that this *bug* is back in v. 3.0.1 and that the import functionality is handled differently (or at least has moved since it is no longer found in the same file at the same location).

    Would you be so kind as to point me in the direction of the csv import stuff. I really prefer that the plugin doesn't add a new player that already exists, simply update the existing information.

    Thanks!

  7. Mark O'Donnell
    Member
    Plugin Author

    Posted 8 months ago #

    Hi nano_mike,
    I did not (knowingly) change anything related to the import code in 3.0.1.
    All the CSV Import code is in the CSV Importer Class (class MSTW_TR_ImporterPlugin) around line 1630 in /includes/mstw-team-rosters-admin. The class was modified from the CSV Importer (now WP CSV Ultimate Importer) plugin.

    OBTW, I thought about whether or not to overwrite existing players or not. I guess sometimes you want to, sometimes you don't. Probably should have a control in the UI to decide whether or not to overwrite.

    Thanks and Good luck!
    -Mark

  8. FuryFC
    Member
    Posted 7 months ago #

    Mark,

    I want to do the same, but that line # doesn't seem to make sense. I am using the newest version of the plug-in.

    Since I'll be updating stats each week, I don't want to have to go back in and manually add the player's photo each week after I update the stats.

    would the solution above work, and what line should it go on?

    Thanks!!

  9. Mark O'Donnell
    Member
    Plugin Author

    Posted 7 months ago #

    Hi FuryFC-
    I am working on an upgrade right now. I will see about putting a control in. As for the line number, it could very well be different in your editor, so just search for Importer and you will find the class definition.

    Regards,
    -Mark

  10. FuryFC
    Member
    Posted 7 months ago #

    Thanks, Mark! Will look for that.

Reply

You must log in to post.

About this Plugin

About this Topic