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.
FYI: It’s the line endings.
Classic MAC (CR only) isn’t sufficient. Must use CRLF for this to work.
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. ]
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
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!
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
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!!
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
Thanks, Mark! Will look for that.