Version Description
Download this release
Release Info
Developer | smackcoders |
Plugin | Ultimate CSV Importer |
Version | 3.3.0 |
Comparing to | |
See all releases |
Code changes from version 3.2.3 to 3.3.0
- Readme.txt +18 -7
- class.comments.php +26 -0
- class.modulehandler.php +34 -0
- class.rendercsv.php +38 -2
- class.userroles.php +153 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- screenshot-5.png +0 -0
- wp_ultimate_csv_importer.js +5 -2
- wp_ultimate_csv_importer.php +49 -15
Readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: smackcoders
|
|
3 |
Donate link: http://www.smackcoders.com/donate.html
|
4 |
Tags: batch, excel, import, spreadsheet, plugin, admin, csv, importer,
|
5 |
Requires at least: 3.4.0
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 3.
|
8 |
-
Version: 3.
|
9 |
Author: smackcoders
|
10 |
Author URI: http://profiles.wordpress.org/smackcoders/
|
11 |
License: GPLv2 or later
|
@@ -15,7 +15,8 @@ A plugin that turns your offline data as wordpress post, page or custom post dat
|
|
15 |
|
16 |
== Description ==
|
17 |
|
18 |
-
Version 3.
|
|
|
19 |
|
20 |
WP Ultimate CSV Importer Plugin helps you to import any CSV file as post, page or even as custom post type. Convert your offline database maintained for years into your valuable website content. Also do periodical content changes, maintenance, content update, prices, offers, coupons and inventory etc.
|
21 |
|
@@ -77,9 +78,11 @@ Or view our how to guide video guide in our [Youtube Channel](www.youtube.com/us
|
|
77 |
|
78 |
== Screenshots ==
|
79 |
|
80 |
-
1.
|
81 |
-
2.
|
82 |
-
3.
|
|
|
|
|
83 |
|
84 |
== Frequently Asked Questions ==
|
85 |
|
@@ -144,6 +147,11 @@ Please click here for [ More Details](http://www.smackcoders.com/blog/category/f
|
|
144 |
|
145 |
== Changelog ==
|
146 |
|
|
|
|
|
|
|
|
|
|
|
147 |
= 3.2.3 =
|
148 |
* Added: WordPress 3.7.1 compatibility added.
|
149 |
* Added: Different media path support added.
|
@@ -249,6 +257,9 @@ Please click here for [ More Details](http://www.smackcoders.com/blog/category/f
|
|
249 |
|
250 |
== Upgrade Notice ==
|
251 |
|
|
|
|
|
|
|
252 |
= 3.2.3 =
|
253 |
* Upgrade for WordPress 3.7.1 compatibility and minor bug fixes
|
254 |
|
3 |
Donate link: http://www.smackcoders.com/donate.html
|
4 |
Tags: batch, excel, import, spreadsheet, plugin, admin, csv, importer,
|
5 |
Requires at least: 3.4.0
|
6 |
+
Tested up to: 3.8
|
7 |
+
Stable tag: 3.3.0
|
8 |
+
Version: 3.3.0
|
9 |
Author: smackcoders
|
10 |
Author URI: http://profiles.wordpress.org/smackcoders/
|
11 |
License: GPLv2 or later
|
15 |
|
16 |
== Description ==
|
17 |
|
18 |
+
Version 3.3.0 is now available with WP 3.8 compatibility and added bulk user,comments import feature.
|
19 |
+
[Please visit for guides and tutorials.] (http://www.smackcoders.com/category/free-wordpress-plugins.html)
|
20 |
|
21 |
WP Ultimate CSV Importer Plugin helps you to import any CSV file as post, page or even as custom post type. Convert your offline database maintained for years into your valuable website content. Also do periodical content changes, maintenance, content update, prices, offers, coupons and inventory etc.
|
22 |
|
78 |
|
79 |
== Screenshots ==
|
80 |
|
81 |
+
1. Browse and Import CSV with delimiter
|
82 |
+
2. Explained -How to CSV Mapping Headers works and how CSV can be related to wordpress fields?
|
83 |
+
3. Simple click mapping option to relate csv field headers with wordpress post type fields
|
84 |
+
4. Wp Ultimate CSV Importer Settings
|
85 |
+
5. Wp Ultimate CSV Importer Dashboard, Reports.
|
86 |
|
87 |
== Frequently Asked Questions ==
|
88 |
|
147 |
|
148 |
== Changelog ==
|
149 |
|
150 |
+
= 3.3.0 =
|
151 |
+
* Added: WordPress 3.8 compatibility.
|
152 |
+
* Added: Bulk users with role import feature.
|
153 |
+
* Added: Comments import feature with relevant post ids.
|
154 |
+
|
155 |
= 3.2.3 =
|
156 |
* Added: WordPress 3.7.1 compatibility added.
|
157 |
* Added: Different media path support added.
|
257 |
|
258 |
== Upgrade Notice ==
|
259 |
|
260 |
+
= 3.3.0 =
|
261 |
+
* Upgrade now for WP 3.8 compatibility and added bulk user,comments feature.
|
262 |
+
|
263 |
= 3.2.3 =
|
264 |
* Upgrade for WordPress 3.7.1 compatibility and minor bug fixes
|
265 |
|
class.comments.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once('class.modulehandler.php');
|
3 |
+
class Comments extends Modulehandler{
|
4 |
+
|
5 |
+
public $insComments = 0;
|
6 |
+
public $skippedComments = 0;
|
7 |
+
|
8 |
+
public function addComment($data_row){
|
9 |
+
global $wpdb;
|
10 |
+
$data_array = $this->formDataArray($data_row);
|
11 |
+
$postid = $_POST['selectPosts'];
|
12 |
+
foreach($data_array as $data){
|
13 |
+
$post_id = $data['comment_post_ID'];
|
14 |
+
$post_exists = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE id = '" . $post_id . "' and post_status in ('publish','draft','future','private','pending')", 'ARRAY_A');
|
15 |
+
if($post_exists){
|
16 |
+
$commentid = wp_insert_comment($data);
|
17 |
+
if($commentid)
|
18 |
+
$this->insComments++;
|
19 |
+
else
|
20 |
+
$this->skippedComments++;
|
21 |
+
}else{
|
22 |
+
$this->skippedComments++;
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
class.modulehandler.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Modulehandler {
|
3 |
+
|
4 |
+
/*
|
5 |
+
*frames array with post values
|
6 |
+
*/
|
7 |
+
public function getReturnArray(){
|
8 |
+
|
9 |
+
foreach($_POST as $postkey=>$postvalue){
|
10 |
+
if($postvalue != '-- Select --')
|
11 |
+
$ret_array[$postkey]=$postvalue;
|
12 |
+
}
|
13 |
+
|
14 |
+
return $ret_array;
|
15 |
+
}
|
16 |
+
|
17 |
+
/*
|
18 |
+
*Forms Data array to insert
|
19 |
+
*/
|
20 |
+
public function formDataArray($csvArray){
|
21 |
+
$ret_array = $this->getReturnArray();
|
22 |
+
$inc = 0;
|
23 |
+
foreach($csvArray as $key => $value){
|
24 |
+
for($i=0;$i<count($value) ; $i++){
|
25 |
+
if(array_key_exists('mapping'.$i,$ret_array))
|
26 |
+
$new_post[$ret_array['mapping'.$i]] = $value[$i];
|
27 |
+
}
|
28 |
+
foreach($new_post as $ckey => $cval)
|
29 |
+
$data_array[$inc][$ckey] = $new_post[$ckey];
|
30 |
+
$inc++;
|
31 |
+
}
|
32 |
+
return $data_array;
|
33 |
+
}
|
34 |
+
}
|
class.rendercsv.php
CHANGED
@@ -111,10 +111,10 @@ class RenderCSVCE
|
|
111 |
$setString .= "<li><label class='checked'><input type='checkbox' name='post' value='post' onclick='savePluginSettings()' disabled checked>" . $impCESett->t('POST') . "</label>";
|
112 |
$setString .= "<label class='checked'><input type='checkbox' name='custompost' value='custompost' onclick='savePluginSettings()' disabled checked>" . $impCESett->t('CUSTOMPOST') . "</label>";
|
113 |
$setString .= "<label class='checked'><input type='checkbox' name='page' value='page' onclick='savePluginSettings()' disabled checked>" . $impCESett->t('PAGE') . '</label>';
|
114 |
-
$setString .= "<label class
|
115 |
$setString .= "<li><label class=$categories><input type='checkbox' name='categories' value='categories' onclick='savePluginSettings()' " . $categories . " >Categories/Tags</label>";
|
116 |
$setString .= "<label class=$customtaxonomy><input type='checkbox' name='customtaxonomy' value='customtaxonomy' onclick='savePluginSettings()' " . $customtaxonomy . " >Custom Taxonomy</label>";
|
117 |
-
$setString .= "<label class
|
118 |
$setString .= "</ul></td></tr></table></div></td></tr>";
|
119 |
|
120 |
|
@@ -197,6 +197,8 @@ class RenderCSVCE
|
|
197 |
$menuHTML .= "<li class=\"navigationMenu $post\" style='margin-left:0px;'><a href = 'admin.php?page=upload_csv_file&action=post' class = 'navigationMenu-link' id='module1'>" . $impCEM->t('POST') . "</a></li>";
|
198 |
$menuHTML .= "<li class=\"navigationMenu $page\"><a href = 'admin.php?page=upload_csv_file&action=page' class = 'navigationMenu-link' id='module1'>" . $impCEM->t("PAGE") . "</a></li>";
|
199 |
$menuHTML .= "<li class=\"navigationMenu $custompost\"><a href = 'admin.php?page=upload_csv_file&action=custompost' class = 'navigationMenu-link' id = 'module2'>" . $impCEM->t('CUSTOMPOST') . "</a></li>";
|
|
|
|
|
200 |
$menuHTML .= "<li class=\"navigationMenu $settings\"><a href = 'admin.php?page=upload_csv_file&action=settings' class='navigationMenu-link' id='module9'>" . $impCEM->t('SETTINGS') . "</a></li>";
|
201 |
$menuHTML .= "<li class=\"navigationMenu $dashboard\"><a href = 'admin.php?page=upload_csv_file&action=dashboard' class='navigationMenu-link' id='module0'>" . $impCEM->t('DASHBOARD') . "</a></li>";
|
202 |
$menuHTML .= "</ul></div> <div style='margin-top:-55px;float:right;margin-right:300px'><a href='http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html' target='_blank'><input type='button' class='button-primary' name='Upgradetopro' id='Upgradetopro' value='Upgrade To PRO' /></a></div> <div class='msg' id = 'showMsg' style = 'display:none;'></div>";
|
@@ -270,5 +272,39 @@ class RenderCSVCE
|
|
270 |
$state = 'pluginActive';
|
271 |
return $state;
|
272 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
}
|
274 |
?>
|
111 |
$setString .= "<li><label class='checked'><input type='checkbox' name='post' value='post' onclick='savePluginSettings()' disabled checked>" . $impCESett->t('POST') . "</label>";
|
112 |
$setString .= "<label class='checked'><input type='checkbox' name='custompost' value='custompost' onclick='savePluginSettings()' disabled checked>" . $impCESett->t('CUSTOMPOST') . "</label>";
|
113 |
$setString .= "<label class='checked'><input type='checkbox' name='page' value='page' onclick='savePluginSettings()' disabled checked>" . $impCESett->t('PAGE') . '</label>';
|
114 |
+
$setString .= "<label class='checked'><input type='checkbox' name='comments' value='comments' onclick='savePluginSettings()' disabled checked>" . $impCESett->t('COMMENTS') . "</label></li>";
|
115 |
$setString .= "<li><label class=$categories><input type='checkbox' name='categories' value='categories' onclick='savePluginSettings()' " . $categories . " >Categories/Tags</label>";
|
116 |
$setString .= "<label class=$customtaxonomy><input type='checkbox' name='customtaxonomy' value='customtaxonomy' onclick='savePluginSettings()' " . $customtaxonomy . " >Custom Taxonomy</label>";
|
117 |
+
$setString .= "<label class='checked'><input type='checkbox' name='users' value='users' onclick='savePluginSettings()' disabled checked>" . $impCESett->t('USERSROLES') . "</label></li>";
|
118 |
$setString .= "</ul></td></tr></table></div></td></tr>";
|
119 |
|
120 |
|
197 |
$menuHTML .= "<li class=\"navigationMenu $post\" style='margin-left:0px;'><a href = 'admin.php?page=upload_csv_file&action=post' class = 'navigationMenu-link' id='module1'>" . $impCEM->t('POST') . "</a></li>";
|
198 |
$menuHTML .= "<li class=\"navigationMenu $page\"><a href = 'admin.php?page=upload_csv_file&action=page' class = 'navigationMenu-link' id='module1'>" . $impCEM->t("PAGE") . "</a></li>";
|
199 |
$menuHTML .= "<li class=\"navigationMenu $custompost\"><a href = 'admin.php?page=upload_csv_file&action=custompost' class = 'navigationMenu-link' id = 'module2'>" . $impCEM->t('CUSTOMPOST') . "</a></li>";
|
200 |
+
$menuHTML .= "<li class=\"navigationMenu $users \"><a href = 'admin.php?page=upload_csv_file&action=users' class = 'navigationMenu-link' id = 'module4'>".$impCEM->t('USERSROLES')."</a></li>";
|
201 |
+
$menuHTML .= "<li class=\"navigationMenu $comments\"><a href = 'admin.php?page=upload_csv_file&action=comments' class = 'navigationMenu-link' id = 'module8'>".$impCEM->t('COMMENTS')."</a></li>";
|
202 |
$menuHTML .= "<li class=\"navigationMenu $settings\"><a href = 'admin.php?page=upload_csv_file&action=settings' class='navigationMenu-link' id='module9'>" . $impCEM->t('SETTINGS') . "</a></li>";
|
203 |
$menuHTML .= "<li class=\"navigationMenu $dashboard\"><a href = 'admin.php?page=upload_csv_file&action=dashboard' class='navigationMenu-link' id='module0'>" . $impCEM->t('DASHBOARD') . "</a></li>";
|
204 |
$menuHTML .= "</ul></div> <div style='margin-top:-55px;float:right;margin-right:300px'><a href='http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html' target='_blank'><input type='button' class='button-primary' name='Upgradetopro' id='Upgradetopro' value='Upgrade To PRO' /></a></div> <div class='msg' id = 'showMsg' style = 'display:none;'></div>";
|
272 |
$state = 'pluginActive';
|
273 |
return $state;
|
274 |
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* return mapping fields for comments and user module
|
278 |
+
*/
|
279 |
+
function renderMapping($action){
|
280 |
+
if($action == 'users'){
|
281 |
+
$maparray = array(
|
282 |
+
'user_login' => null,
|
283 |
+
'first_name' => null,
|
284 |
+
'last_name' => null,
|
285 |
+
'nickname' => null,
|
286 |
+
'user_email' => null,
|
287 |
+
'user_url' => null,
|
288 |
+
'aim' => null,
|
289 |
+
'yim' => null,
|
290 |
+
'jabber/gtalk' => null,
|
291 |
+
'role' => null,
|
292 |
+
'description' => null,
|
293 |
+
);
|
294 |
+
}else if($action == 'comments'){
|
295 |
+
$maparray = array(
|
296 |
+
'comment_post_ID' => null,
|
297 |
+
'comment_author' => null,
|
298 |
+
'comment_author_email' => null,
|
299 |
+
'comment_author_url' => null,
|
300 |
+
'comment_content' => null,
|
301 |
+
'comment_author_IP' => null,
|
302 |
+
'comment_date' =>null,
|
303 |
+
'comment_approved' =>null,
|
304 |
+
);
|
305 |
+
}
|
306 |
+
return $maparray;
|
307 |
+
}
|
308 |
+
|
309 |
}
|
310 |
?>
|
class.userroles.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once('class.modulehandler.php');
|
3 |
+
class Users extends Modulehandler{
|
4 |
+
// @var int inserted post count
|
5 |
+
public $insUserCount = 0;
|
6 |
+
|
7 |
+
public $skipUserCount = 0;
|
8 |
+
/* get roles for users */
|
9 |
+
public function getRoles(){
|
10 |
+
global $wp_roles;
|
11 |
+
foreach($wp_roles->roles as $rkey => $rval){
|
12 |
+
for($cnt=0;$cnt<count($rval['capabilities']);$cnt++){
|
13 |
+
$findval = "level_".$cnt;
|
14 |
+
if(array_key_exists($findval,$rval['capabilities']))
|
15 |
+
$roles[$rkey] = $roles[$rkey].$cnt.',';
|
16 |
+
}
|
17 |
+
}
|
18 |
+
return $roles;
|
19 |
+
}
|
20 |
+
|
21 |
+
public function addUsers($csvValues){
|
22 |
+
global $wpdb;
|
23 |
+
$user_table = $wpdb->users;
|
24 |
+
$UC = $wpdb->get_results("select count(ID) as users from $user_table");
|
25 |
+
$initial_count = $UC[0]->users;
|
26 |
+
$ret_array = $this->getReturnArray();
|
27 |
+
$roles = $this->getRoles();
|
28 |
+
$user_table = $wpdb->users;
|
29 |
+
$limit = (int) apply_filters( 'postmeta_form_limit', 30 );
|
30 |
+
$keys = $wpdb->get_col( "
|
31 |
+
SELECT meta_key
|
32 |
+
FROM $wpdb->postmeta
|
33 |
+
GROUP BY meta_key
|
34 |
+
HAVING meta_key NOT LIKE '\_%'
|
35 |
+
ORDER BY meta_key
|
36 |
+
LIMIT $limit" );
|
37 |
+
|
38 |
+
foreach($csvValues as $key => $value){
|
39 |
+
for($i=0;$i<count($value) ; $i++){
|
40 |
+
if(array_key_exists('mapping'.$i,$ret_array)){
|
41 |
+
if($ret_array['mapping'.$i]!='add_role'.$i){
|
42 |
+
$new_post[$ret_array['mapping'.$i]] = $value[$i];
|
43 |
+
}
|
44 |
+
else{
|
45 |
+
$new_post[$ret_array['textbox'.$i]] = $value[$i];
|
46 |
+
$custom_array[$ret_array['textbox'.$i]] = $value[$i];
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
for($inc=0;$inc<count($value);$inc++){
|
51 |
+
foreach($keys as $k => $v){
|
52 |
+
if(array_key_exists($v,$new_post)){
|
53 |
+
$custom_array[$v] =$new_post[$v];
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
foreach($new_post as $ckey => $cval){
|
58 |
+
if($ckey == 'jabber/gtalk'){
|
59 |
+
$data_array['jabber'] = $new_post[$ckey];
|
60 |
+
}
|
61 |
+
elseif($ckey == 'role'){
|
62 |
+
$data_array_ckey = '';
|
63 |
+
for($i=0 ; $i<=$new_post[$ckey] ; $i++){
|
64 |
+
$data_array_ckey .= $i.",";
|
65 |
+
}
|
66 |
+
$data_array[$ckey]= $data_array_ckey;
|
67 |
+
}
|
68 |
+
else{
|
69 |
+
$data_array[$ckey]=$new_post[$ckey];
|
70 |
+
}
|
71 |
+
}
|
72 |
+
$data_array['user_pass'] = wp_generate_password( 12, false );
|
73 |
+
$getUsers = $wpdb->get_results("select count(ID) as users from $user_table");
|
74 |
+
foreach($roles as $rkey => $rval){
|
75 |
+
if($rval == $data_array['role']){
|
76 |
+
$data_array['role'] = $rkey;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
if(! array_key_exists($data_array['role'],$roles)){
|
80 |
+
$data_array['role'] = $ret_array['userrole'];
|
81 |
+
}
|
82 |
+
if(isset($_POST['existRecords']) && ($_POST['existRecords'] == 'updatedcsv')){
|
83 |
+
$getUserId = $wpdb->get_results("select ID from $user_table where user_email = '".$data_array["user_email"]."'");
|
84 |
+
$user_id = $getUserId[0]->ID;
|
85 |
+
if($user_id){
|
86 |
+
$data_array['ID'] = $user_id;
|
87 |
+
wp_update_user( $data_array );
|
88 |
+
}
|
89 |
+
else{
|
90 |
+
$user_id = wp_insert_user( $data_array );
|
91 |
+
$getUsers1 = $wpdb->get_results("select count(ID) as users from $user_table");
|
92 |
+
$no_of_users = ($getUsers1[0]->users) - ($getUsers[0]->users);
|
93 |
+
$termcount = $userscount+$no_of_users; if($no_of_users > 0){
|
94 |
+
$newUsers['user'][] = $user_id;
|
95 |
+
}
|
96 |
+
$getDashboard = $wpdb->get_results("select * from smack_csv_dashboard where type ='Users'");
|
97 |
+
$getusercount = $getDashboard[0]->value;
|
98 |
+
$usercount = $getusercount+$no_of_users;
|
99 |
+
$table = 'smack_csv_dashboard';
|
100 |
+
$data_user = array('value'=>$usercount);
|
101 |
+
$where = array('id'=>$getDashboard[0]->id);
|
102 |
+
$wpdb->update($table, $data_user, $where);
|
103 |
+
$current_user = wp_get_current_user();
|
104 |
+
$admin_email = $current_user->user_email;
|
105 |
+
$headers = "From: Administrator <$admin_email>" . "\r\n";
|
106 |
+
$message = "Hi,You've been invited with the role of ".$ret_array['userrole'].". Here, your login details."."\n"."username: ".$data_array['user_login']."\n"."userpass: ".$data_array['user_pass']."\n"."Please click here to login ".wp_login_url();
|
107 |
+
$emailaddress = $data_array['user_email'];
|
108 |
+
$subject = 'Login Details';
|
109 |
+
if(isset($_POST['send_password'])){
|
110 |
+
wp_mail($emailaddress, $subject, $message, $headers);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
else{
|
115 |
+
$getUserId = $wpdb->get_results("select ID from $user_table where user_email = '".$data_array["user_email"]."'");
|
116 |
+
$user_id = $getUserId[0]->ID;
|
117 |
+
if($user_id){
|
118 |
+
$this->skipUserCount = $this->skipUserCount+1;
|
119 |
+
}
|
120 |
+
else{
|
121 |
+
$user_id = wp_insert_user( $data_array );
|
122 |
+
$getUsers1 = $wpdb->get_results("select count(ID) as users from $user_table");
|
123 |
+
$no_of_users = ($getUsers1[0]->users) - ($getUsers[0]->users);
|
124 |
+
$termcount = $userscount+$no_of_users; //print($termcount);
|
125 |
+
if($no_of_users > 0){
|
126 |
+
$newUsers['user'][] = $user_id;//print_r($newUsers);
|
127 |
+
}
|
128 |
+
$getDashboard = $wpdb->get_results("select *from smack_csv_dashboard where type = 'Users'");
|
129 |
+
$getusercount = $getDashboard[0]->value;
|
130 |
+
$usercount = $getusercount+$no_of_users;
|
131 |
+
$table = 'smack_csv_dashboard';
|
132 |
+
$data_user = array('value'=>$usercount);
|
133 |
+
$where = array('id'=>$getDashboard[0]->id);
|
134 |
+
$wpdb->update($table, $data_user, $where);
|
135 |
+
$current_user = wp_get_current_user();
|
136 |
+
$admin_email = $current_user->user_email;
|
137 |
+
$headers = "From: Administrator <$admin_email>" . "\r\n";
|
138 |
+
$message = "Hi,You've been invited with the role of ".$ret_array['userrole'].". Here, your login details."."\n"."username: ".$data_array['user_login']."\n"."userpass: ".$data_array['user_pass']."\n"."Please click here to login ".wp_login_url();
|
139 |
+
$emailaddress = $data_array['user_email'];
|
140 |
+
$subject = 'Login Details';
|
141 |
+
if(isset($_POST['send_password'])){
|
142 |
+
wp_mail($emailaddress, $subject, $message, $headers);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
}
|
146 |
+
}
|
147 |
+
$UC1 = $wpdb->get_results("select count(ID) as users from $user_table");
|
148 |
+
$last_count = $UC1[0]->users;
|
149 |
+
$this->insUserCount = $last_count - $initial_count;
|
150 |
+
return $this->insUserCount;
|
151 |
+
}
|
152 |
+
|
153 |
+
}
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|
screenshot-3.png
CHANGED
Binary file
|
screenshot-4.png
ADDED
Binary file
|
screenshot-5.png
ADDED
Binary file
|
wp_ultimate_csv_importer.js
CHANGED
@@ -82,7 +82,7 @@ function addcustomfield(myval, selected_id) {
|
|
82 |
var a = document.getElementById('h1').value;
|
83 |
var importer = document.getElementById('selectedImporter').value;
|
84 |
var aa = document.getElementById('h2').value;
|
85 |
-
if (importer == 'custompost' || importer == 'post' || importer == 'page') {
|
86 |
var selected_dropdown = document.getElementById('mapping' + selected_id);
|
87 |
var selected_value = selected_dropdown.value;
|
88 |
var prevoptionindex = document.getElementById('prevoptionindex').value;
|
@@ -248,6 +248,7 @@ function hideSuccessMessage() {
|
|
248 |
}
|
249 |
|
250 |
function clearmapping(){
|
|
|
251 |
var total_mfields = document.getElementById('h2').value;
|
252 |
var mfields_arr = document.getElementById('mapping_fields_array').value;
|
253 |
var n=mfields_arr.split(",");
|
@@ -257,7 +258,9 @@ function clearmapping(){
|
|
257 |
}
|
258 |
for(var j=0;j<total_mfields;j++){
|
259 |
document.getElementById('mapping'+j).innerHTML = options;
|
260 |
-
|
|
|
|
|
261 |
document.getElementById('textbox'+j).style.display = 'none';
|
262 |
document.getElementById('customspan'+j).style.display = 'none';
|
263 |
}
|
82 |
var a = document.getElementById('h1').value;
|
83 |
var importer = document.getElementById('selectedImporter').value;
|
84 |
var aa = document.getElementById('h2').value;
|
85 |
+
if (importer == 'custompost' || importer == 'post' || importer == 'page' || importer == 'comments' || importer == 'users') {
|
86 |
var selected_dropdown = document.getElementById('mapping' + selected_id);
|
87 |
var selected_value = selected_dropdown.value;
|
88 |
var prevoptionindex = document.getElementById('prevoptionindex').value;
|
248 |
}
|
249 |
|
250 |
function clearmapping(){
|
251 |
+
var importer = document.getElementById('selectedImporter').value;
|
252 |
var total_mfields = document.getElementById('h2').value;
|
253 |
var mfields_arr = document.getElementById('mapping_fields_array').value;
|
254 |
var n=mfields_arr.split(",");
|
258 |
}
|
259 |
for(var j=0;j<total_mfields;j++){
|
260 |
document.getElementById('mapping'+j).innerHTML = options;
|
261 |
+
if(importer != 'comments' && importer != 'users'){
|
262 |
+
document.getElementById('mapping'+j).innerHTML += "<option value='add_custom"+j+"'>Add Custom Field</option>";
|
263 |
+
}
|
264 |
document.getElementById('textbox'+j).style.display = 'none';
|
265 |
document.getElementById('customspan'+j).style.display = 'none';
|
266 |
}
|
wp_ultimate_csv_importer.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
*Plugin Name: WP Ultimate CSV Importer
|
4 |
*Plugin URI: http://www.smackcoders.com/blog/how-to-guide-for-free-wordpress-ultimate-csv-importer-plugin.html
|
5 |
*Description: A plugin that helps to import the data's from a CSV file.
|
6 |
-
*Version: 3.
|
7 |
*Author: smackcoders.com
|
8 |
*Author URI: http://www.smackcoders.com
|
9 |
*
|
@@ -138,6 +138,9 @@ function upload_csv_file()
|
|
138 |
<div class="smack-wrap" id="smack-content">
|
139 |
<?php
|
140 |
echo $impRen->renderMenu();
|
|
|
|
|
|
|
141 |
if (count($impCE->headers) >= 1 && count($data_rows) >= 1) {
|
142 |
?>
|
143 |
<form class="add:the-list: validate" name="secondform" id="secondform" method="post" onsubmit="return import_csv();"
|
@@ -158,7 +161,7 @@ function upload_csv_file()
|
|
158 |
<input type="hidden" id="prevoptionvalue" name="prevoptionvalue" value=""/>
|
159 |
<?php
|
160 |
// second form starts here
|
161 |
-
if (($_REQUEST['action'] == 'post') || ($_REQUEST['action'] == 'custompost') || ($_REQUEST['action'] == 'page')) {
|
162 |
|
163 |
//set custom fields value
|
164 |
$taxo = get_taxonomies();
|
@@ -170,7 +173,7 @@ function upload_csv_file()
|
|
170 |
$custo_taxo = substr($custo_taxo, 0, -1);
|
171 |
|
172 |
?>
|
173 |
-
<input type='hidden' name='cust_taxo' id='cust_taxo' value='<?php echo $custo_taxo; ?>'
|
174 |
<div id="posttypecss" style="margin-top: 30px;">
|
175 |
<table>
|
176 |
<tr>
|
@@ -206,9 +209,11 @@ function upload_csv_file()
|
|
206 |
<?php } ?>
|
207 |
</td>
|
208 |
</tr>
|
|
|
|
|
|
|
209 |
<tr>
|
210 |
<td>
|
211 |
-
<?php $cnt1 = count($impCE->headers);?>
|
212 |
|
213 |
<label>Import with post status<span class="mandatory"> *</span></label></td>
|
214 |
<td><select
|
@@ -246,6 +251,7 @@ function upload_csv_file()
|
|
246 |
</td>
|
247 |
</tr>
|
248 |
</table>
|
|
|
249 |
</div>
|
250 |
<div style="width:50%;float:left;"><h3>Map Fields</h3></div><div style="width:50%;float:right;"><input type="button" name="remap" id="remap" value="Clear Mapping" onclick="clearmapping();" />
|
251 |
<a href="#" class="tooltip">
|
@@ -308,6 +314,7 @@ function upload_csv_file()
|
|
308 |
<?php
|
309 |
|
310 |
}
|
|
|
311 |
foreach (get_taxonomies() as $taxokey => $taxovalue) {
|
312 |
if ($taxokey != 'category' && $taxokey != 'link_category' && $taxokey != 'post_tag' && $taxokey != 'nav_menu' && $taxokey != 'post_format') {
|
313 |
?>
|
@@ -321,7 +328,7 @@ function upload_csv_file()
|
|
321 |
?>
|
322 |
<option value="add_custom<?php print($count); ?>">Add Custom Field
|
323 |
</option>
|
324 |
-
|
325 |
</select> <!-- added to solve issue id 1072-->
|
326 |
<input class="customfieldtext" type="text"
|
327 |
id="textbox<?php print($count); ?>"
|
@@ -416,10 +423,9 @@ function upload_csv_file()
|
|
416 |
echo $impRen->renderMenu();
|
417 |
if (($impCE->insPostCount != 0) || ($impCE->dupPostCount != 0)) {
|
418 |
?>
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
echo $impRen->setDashboardAction();
|
423 |
$messageString = $impCE->insPostCount . " records are successfully Imported.";
|
424 |
if ((isset($_POST['titleduplicatecheck']) && $_POST['titleduplicatecheck'] == 1) || (isset($_POST['contentduplicatecheck']) && $_POST['contentduplicatecheck'] == 1))
|
425 |
$messageString .= $impCE->dupPostCount . " duplicate records found.";
|
@@ -430,12 +436,40 @@ function upload_csv_file()
|
|
430 |
<?php
|
431 |
} else if (($impCE->insPostCount == 0) && ($impCE->dupPostCount == 0)) {
|
432 |
?>
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
echo $impRen->renderDashboard();
|
440 |
} else {
|
441 |
?>
|
3 |
*Plugin Name: WP Ultimate CSV Importer
|
4 |
*Plugin URI: http://www.smackcoders.com/blog/how-to-guide-for-free-wordpress-ultimate-csv-importer-plugin.html
|
5 |
*Description: A plugin that helps to import the data's from a CSV file.
|
6 |
+
*Version: 3.3.0
|
7 |
*Author: smackcoders.com
|
8 |
*Author URI: http://www.smackcoders.com
|
9 |
*
|
138 |
<div class="smack-wrap" id="smack-content">
|
139 |
<?php
|
140 |
echo $impRen->renderMenu();
|
141 |
+
if($_REQUEST['action']=='users' || $_REQUEST['action']=='comments'){
|
142 |
+
$impCE->defCols = $impRen->renderMapping($_REQUEST['action']);
|
143 |
+
}
|
144 |
if (count($impCE->headers) >= 1 && count($data_rows) >= 1) {
|
145 |
?>
|
146 |
<form class="add:the-list: validate" name="secondform" id="secondform" method="post" onsubmit="return import_csv();"
|
161 |
<input type="hidden" id="prevoptionvalue" name="prevoptionvalue" value=""/>
|
162 |
<?php
|
163 |
// second form starts here
|
164 |
+
if (($_REQUEST['action'] == 'post') || ($_REQUEST['action'] == 'custompost') || ($_REQUEST['action'] == 'page') || ($_REQUEST['action'] == 'users') || ($_REQUEST['action'] == 'comments')) {
|
165 |
|
166 |
//set custom fields value
|
167 |
$taxo = get_taxonomies();
|
173 |
$custo_taxo = substr($custo_taxo, 0, -1);
|
174 |
|
175 |
?>
|
176 |
+
<input type='hidden' name='cust_taxo' id='cust_taxo' value='<?php echo $custo_taxo; ?>'/><br>
|
177 |
<div id="posttypecss" style="margin-top: 30px;">
|
178 |
<table>
|
179 |
<tr>
|
209 |
<?php } ?>
|
210 |
</td>
|
211 |
</tr>
|
212 |
+
<?php $cnt1 = count($impCE->headers);
|
213 |
+
if($_REQUEST['action']!='users' && $_REQUEST['action']!='comments'){
|
214 |
+
?>
|
215 |
<tr>
|
216 |
<td>
|
|
|
217 |
|
218 |
<label>Import with post status<span class="mandatory"> *</span></label></td>
|
219 |
<td><select
|
251 |
</td>
|
252 |
</tr>
|
253 |
</table>
|
254 |
+
<?php } ?>
|
255 |
</div>
|
256 |
<div style="width:50%;float:left;"><h3>Map Fields</h3></div><div style="width:50%;float:right;"><input type="button" name="remap" id="remap" value="Clear Mapping" onclick="clearmapping();" />
|
257 |
<a href="#" class="tooltip">
|
314 |
<?php
|
315 |
|
316 |
}
|
317 |
+
if($_REQUEST['action']!='users' && $_REQUEST['action']!='comments'){
|
318 |
foreach (get_taxonomies() as $taxokey => $taxovalue) {
|
319 |
if ($taxokey != 'category' && $taxokey != 'link_category' && $taxokey != 'post_tag' && $taxokey != 'nav_menu' && $taxokey != 'post_format') {
|
320 |
?>
|
328 |
?>
|
329 |
<option value="add_custom<?php print($count); ?>">Add Custom Field
|
330 |
</option>
|
331 |
+
<?php } ?>
|
332 |
</select> <!-- added to solve issue id 1072-->
|
333 |
<input class="customfieldtext" type="text"
|
334 |
id="textbox<?php print($count); ?>"
|
423 |
echo $impRen->renderMenu();
|
424 |
if (($impCE->insPostCount != 0) || ($impCE->dupPostCount != 0)) {
|
425 |
?>
|
426 |
+
<div>
|
427 |
+
<?php
|
428 |
+
echo $impRen->setDashboardAction();
|
|
|
429 |
$messageString = $impCE->insPostCount . " records are successfully Imported.";
|
430 |
if ((isset($_POST['titleduplicatecheck']) && $_POST['titleduplicatecheck'] == 1) || (isset($_POST['contentduplicatecheck']) && $_POST['contentduplicatecheck'] == 1))
|
431 |
$messageString .= $impCE->dupPostCount . " duplicate records found.";
|
436 |
<?php
|
437 |
} else if (($impCE->insPostCount == 0) && ($impCE->dupPostCount == 0)) {
|
438 |
?>
|
439 |
+
<div>
|
440 |
+
<?php echo $impRen->showMessage('error', "Check your CSV file and format."); ?>
|
441 |
+
</div>
|
442 |
+
<?php }
|
443 |
+
$_REQUEST['action'] = 'dashboard';
|
444 |
+
echo $impRen->renderDashboard();
|
445 |
+
} else if(isset ($_POST ['post_csv']) && $_REQUEST['action'] == 'users') { // Code for import users and their Datas.
|
446 |
+
echo $impRen->setDashboardAction();
|
447 |
+
require_once('class.userroles.php');
|
448 |
+
$impCE1 = new SmackImpCE ();
|
449 |
+
$userObj = new Users();
|
450 |
+
$data_rows = $impCE1->csv_file_data($impCE1->getUploadDirectory() . "/" . $_POST['filename'],$_POST['delim']);
|
451 |
+
$result = $userObj->addUsers($data_rows);
|
452 |
+
echo $impRen->renderMenu();
|
453 |
+
if ($userObj->insUserCount != 0)
|
454 |
+
echo $impRen->showMessage('success',$userObj->insUserCount." users has been imported");
|
455 |
+
if($userObj->skipUserCount != 0)
|
456 |
+
echo $impRen->showMessage('error',$userObj->skipUserCount." users has been skipped");
|
457 |
+
$_SESSION['thirdformaction'] = 'dashboard';
|
458 |
+
|
459 |
+
echo $impRen->renderDashboard();
|
460 |
+
} else if(isset ($_POST ['post_csv']) && $_REQUEST['action'] == 'comments') {
|
461 |
+
echo $impRen->setDashboardAction();
|
462 |
+
require_once('class.comments.php');
|
463 |
+
$impCE1 = new SmackImpCE();
|
464 |
+
$commentObj = new Comments();
|
465 |
+
$data_rows = $impCE1->csv_file_data($impCE1->getUploadDirectory() . "/" . $_POST['filename'],$_POST['delim']);
|
466 |
+
$result = $commentObj->addComment($data_rows);
|
467 |
+
echo $impRen->renderMenu();
|
468 |
+
if ($commentObj->insComments != 0)
|
469 |
+
echo $impRen->showMessage('success',$commentObj->insComments." comments has been imported");
|
470 |
+
if ($commentObj->skippedComments != 0)
|
471 |
+
echo $impRen->showMessage('error',$commentObj->skippedComments." comments has been skipped");
|
472 |
+
|
473 |
echo $impRen->renderDashboard();
|
474 |
} else {
|
475 |
?>
|