Adding Joomla 2.5 users programmatically without sending the welcome e-mail

The code I’m sharing is a stand-alone script that can be ran directly from your browser, it doesn’t need to be added to a module or component, though the core functionality can be used in either of course =)

This code was written to read an excel spreadsheet containing a username, e-mail and password. I wanted to create these users and NOT send the “Welcome” e-mail containing the login information because the site was still under development and the users already had that information anyway.

The script loads in the Joomla framework and then utilizes PHPExcel to read in the spreadsheet.. read on for the code.

4 Responses to Adding Joomla 2.5 users programmatically without sending the welcome e-mail

  1. Joan Carles says:

    Hi there!!

    Nice work! Altough I have a doubt, when you say ‘Create an associative array using the first row as the keys’ you mean:

    A1: ID
    A2: Name
    A3: Username
    A4…

    Is this what you mean? Thanks in advance

    • lonnie says:

      An associative array would be using the variable name as the key instead of the normal numeric key.. a normal array would be like this

      array[0] = “something”

      an associative array would be this:

      array[‘ID’] = “something”

      Does this help? :)

  2. alnatih says:

    can you please put some example of how the excel should be formated to create the array?

    • lonnie says:

      I could – forgive me, this reply is SO very late… but Joomla has changed the way things work so this isn’t really applicable ( I suspect ) … and I think by now you’ve probably solved your issue.. if not you can let me know and I can help you come up with something

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">