Support

  1. stratacorps
  2. Support
  3. Friday, December 16 2016, 04:44 PM
Before Easy Profile I was using a User Import component that was updating users from a 2,000 user csv file. This file gets updated periodically and we use it to merge/update users on a regional club roster.

Is there anyway to automate an import similar to this with Easy Profile Pro say via a cron script? We wanted to use CSVI but they don't support extended profile fields.
admin Accepted Answer
Admin
Hi,
sorry this is not possible natively, but you can download and customize import plugin (frontend)
- Download, Install and enabled it (http://docs.easy-profile.com/index.php/article/import-plugin)
- Open files /plugins/jsn/userimport/userimport.php
- Customize file:
replace from line 66 to line 90 this code:

if(JRequest::getVar('goimport',false))
{
if(isset($_FILES['filecsv']) && !empty($_FILES['filecsv']['name']))
{
require_once('parsecsv.lib.php');
$this->csv=new parseCSV();
/* TODO ENCODING */
$content = file_get_contents($_FILES['filecsv']['tmp_name']);
$firstline = strtok($content, "\n");
$firstline = preg_replace('/[^A-Za-z0-9\-,;_\r"]/', '', $firstline);
$content=$firstline."\n".preg_replace('/^.+\n/', '', $content);
$this->csv->auto($content);
$this->check();
}
else
{
$app=JFactory::getApplication();
$app->enqueueMessage('No file selected','error');
$this->getForm();
}
}
else
{
$this->getForm();
}

with this:

if( JRequest::getVar('code','') != 'SOME_SECURITY_CODE' ) return;
require_once('parsecsv.lib.php');
$this->csv=new parseCSV();
$content = file_get_contents('URL_OF_YOUR_CSV_FILE');
$firstline = strtok($content, "\n");
$firstline = preg_replace('/[^A-Za-z0-9\-,;_\r"]/', '', $firstline);
$content=$firstline."\n".preg_replace('/^.+\n/', '', $content);
$this->csv->auto($content);
$this->check();

- replace:
SOME_SECURITY_CODE with some code
URL_OF_YOUR_CSV_FILE with url of your remote CSV or path of local csv files
- create cron process that trigger this url: http://your-domain/index.php?option=com_jsn&view=import&code=SOME_SECURITY_CODE

NOTE: This code is not tested and not supported, this code is provided only for example purpose, you need to have some PHP knowledge to implement this.
NOTE 2: in the latest release you can continue to import CSV files manually from backend
  1. more than a month ago
  2. Support
  3. # 1
stratacorps Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. Support
  3. # 2
admin Accepted Answer
Admin
hi,
you can import all Joomla core fields and Easy Profile custom fields with import feature, but if in Easy Profile options you have set "Login Type" to "Email" then the username will be always generated from the system.
  1. more than a month ago
  2. Support
  3. # 3
stratacorps Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. Support
  3. # 4
admin Accepted Answer
Admin
I have the Login Type set to Both, so will Username in Joomla! be updatable via Easy Profile's import?
Yes.

I'm having a problem with the import process matching the field names though in Easy Profile. I am getting a report that columns in the CSV source file which match the alias won't be imported because there is no match. Maybe this is a text case issue? Example, will DistrNbr match "distrnbr" or will the file's column fields have to be exact upper/lower case?
column titles need to match exactly with alias of fields.
for example: "Username" is different from "username"

I have tried to override the alias for one of the fields, but Easy Profile keeps changing it and then won't let me change it later...its an all numeric field column "3030" and I put 3030 in the alias, but Easy Profile changes it to something like field_xxxxxxxxxxxx and then its locked out from further changes. I can't modify the source file so I need to import fields (that is it comes to me by way of a URL and without routing it through a filter of some sort, I can't modify what the vendor provides us with directly).
Each field create a column in DB table and column names like "3030" are not allowed by DB.
I think that the most easy way is to change "3030" to Easy Profile field in csv content, for example from my above code you can add this:

.....
$firstline = preg_replace('/[^A-Za-z0-9\-,;_\r"]/', '', $firstline);
/* START - HERE CODE TO CHANGE FIRSTLINE OF CSV */
$firstline = str_replace('3030', 'FIELDALIAS', $firstline);
$firstline = str_replace('DistrNbr', 'distrnbr', $firstline);
.......
/* END - HERE CODE TO CHANGE FIRSTLINE OF CSV */
$content=$firstline."\n".preg_replace('/^.+\n/', '', $content);
.....

Of course you can use this way also to convert column title from "DistrNbr" to "distrnbr" (or something_else).
  1. more than a month ago
  2. Support
  3. # 5
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Request Support

Support is currently Online

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.