listcsv plugin generates fatal error

EricWebsite

Member
Hi,
When importing users into a list with import from csv I neeeded to generate Joomla users as well, so I installed the listcsv plugin in the list.
In the first test, this generated an error:
"Fatal error: Array and string offset access syntax with curly braces is no longer supported in ....../plugins/fabrik_list/listcsv/scripts/csv_import_user_class.php on line 99".
Line 99 reads:
Code:
$string = $chars{rand(0, $chars_length)};
Replacing the curly brackets with '(' and ')' will probably do the trick, but the generated password could be a lot better.

I came up with:
Code:
    private function rand_str()
    {
        // leave out letter o and zero, 1 (one) an l (letter), etc to avoid confusion
        $charslower = "abcdefghijkmnpqrstuvwxyz";
        $charsupper = "ABCDEFGHIJKMNPQRSTUVWXYZ";
        $charsnumber = "23456789";
        $charsspec = "!@#$%&*(){}_+";
        // at least 1 lowercase, 1 uppercase, 1 number, 1 special character
        $chars = substr(str_shuffle($charslower),0,1);
        $chars .= substr(str_shuffle($charsupper),0,1);
        $chars .= substr(str_shuffle($charsnumber),0,1);
        $chars .= substr(str_shuffle($charsspec),0,1);
        // add 8 more from a mix of all
        $chars .= substr(str_shuffle($charslower . $charsupper . $charsnumber . $charsspec),0,8);
        $password = str_shuffle($chars);
        return $password;
    }

A second point: I think it would be a lot easier if the user can set the parameters directly in the plugin (like in juser), rather than have to do that in a copy of create_client_user.php.
Please let me have your thoughts!
 
$csv_user->userid_element = 'changethis_userid';
Maybe you took this literally? It should be 'changethis___userid'; (3_)
 
This is confusing. In csv_import_user_class.php Hugh wrote: 'There is nothing in this file that needs changing.'
And 'DO NOT set these class variables here. Instead, set them in your copy of create_client_user.php'

Nevertheless on line 39 and further, it reads:
Code:
    /*
     * REQUIRED
     *
     * The full Fabrik element names for the username, email, name and J! userid.
     * The plugin will write the newly created J! userid to the userid element.
     * These four are REQUIRED and the code will fail if they are missing or wrong.
     *
     * NOTE - if $name_element is blank, use optional first and last name elements to create full name
     */
    public $username_element = 'changethis___username';
    public $email_element = 'changethis___email';
    public $name_element = 'changethis___name';
    public $userid_element = 'changethis_userid';
Indeed with one underscore in 'changethis_userid'.

If you don't set these 4 in csv_import_user_class.php (as I did first), or do set them seems to make no difference.
I did set them in my copy of create_client_user.php (with the correct 3 underscores in userid).
 
A bit confusing, yes (but it says "nothing needs changing", so you can do what you want if you are using a copy (and include this copy in your copy of create_client...)

I think in csv_import... these "required" public vars are only for initialisation, I don't know why they are not set to a simple "" (maybe it was only a copy/paste from one file to the other, I assume the example file(s) were split at some point ... history mysteries...)

The "optional" ones are setting default values.

So obviously the examples can be improved...
 
No email is being sent to the nimported user either
I can't see where this should be done.

What do you get as system messages?
What do you get in the log?
 
I think in csv_import... these "required" public vars are only for initialisation
Seems like a leftover, I don't see if any of these declared public $..... variables are used anywhere???

(maybe it was only a copy/paste from one file to the other, I assume the example file(s) were split at some point ... history mysteries...)
Yes, it looks like it.

After the import I get a success message.

In the Fabrik log I find nothing relevant. Will: jimport('joomla.log.log'); as in the script still work?

No email is being sent to the nimported user either
I can't see where this should be done.
If a create a user from the list then joomla sends the mail. The form has the juser plugin installed, set to:

Bypass activation; yes
Bypass registration: yes
Account details email no (but according to the help popup: if yes will NOT send the standard Joomla welcome mail
Bypass all email: no

So I hoped a mail would be sent.
 
I'm testing. I didn't find the reason for the missing userid yet but it was sending a J! mail for the new created user.
Fixes: Only changed the old {} to [] in csv_import
1715182717881.png


So mailing is doing. The script is setting nothing extra, so it may be your J! settings.
 
I'm surprised! Did you (as I am trying to do) use the 2 step approach: use a copy of create_client_user.php set in the plugin to call the updated csv_import_user_class.php?
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top