Skip to content

Commit

Permalink
Merge pull request hissy#46 from ddaishin/develop-feature-user_login
Browse files Browse the repository at this point in the history
Add feature user_login
  • Loading branch information
hissy committed Sep 22, 2015
2 parents 95594f2 + f47f6b3 commit 5539e26
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ You can get example CSV files in `/wp-content/plugins/really-simple-csv-importer
* `ID` or `post_id`: (int) post id.
This value is not required. The post ID is already exists in your blog, importer will update that post data. If the ID is not exists, importer will trying to create a new post with suggested ID.
* `post_author`: (login or ID) The user name or user ID number of the author.
* `post_author_login`: The user name of the author.
* `post_date`: (string) The time of publish date.
* `post_content`: (string) The full text of the post.
* `post_title`: (string) The title of the post.
Expand Down
10 changes: 10 additions & 0 deletions rs-csv-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ function process_posts() {
unset($user);
}
}

// user_login to post_author
$user_login = $h->get_data($this,$data,'post_author_login');
if ($user_login) {
$user = get_user_by('login',$user_login);
if (isset($user) && is_object($user)) {
$post['post_author'] = $user->ID;
unset($user);
}
}

// (string) publish date
$post_date = $h->get_data($this,$data,'post_date');
Expand Down

0 comments on commit 5539e26

Please sign in to comment.