2014-06-11 11:41
浏览 68

从CSV文件添加Joomla 2.5中的用户并通知他们注册电子邮件

My requirement is to add users in Joomla 2.5 from a CSV file. After the user is added, it should send registration email to the user.

For eg. if I add a user from Joomla Admin panel and save it, it sends an registration email automatically.

I tried adding users directly in the _users table and _user_usergroup_map table. It does adds the users in Joomla but the registration email is not being sent.

Please let me know how can I do so.


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doufang1889
    doufang1889 2014-06-16 13:30

    I solved this myself as-

    1. You need to have an CSV file with the data in it. It should have the column names according to the Joomla __users schema. Click here to download the sample CSV file.

    Make sure that at-least below columns are filled in (Rest can be left empty or if you wish, fill them too)-

    • Name
    • Username
    • Email-ID
    • Password (Use MD5 encrypted)
    • User Type (Generally 2 for Registered Users)

    Passwords need to be MD5 encrypted. For eg.- If password is- password123, its MD5 value would be- 482c811da5d5b4bc6d497ffa98491e38

    You can encrypt passwords from here-

    1. Copy this CSV file in the MySQL database folder. Generally '/var/lib/mysql' in Linux.

    2. Log in MySQL prompt / PhpMyAdmin with the user who has privileges to write in the DB.

    3. Select the DB and execute the below query:

    mysql> LOAD DATA INFILE '/var/lib/mysql/Final_Template_For_Adding_New_Joomla_2_5_Users.csv' INTO TABLE __users FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY ' ' IGNORE 1 LINES;

    This would add the users in __users table.

    4- Now you need to update the User ID & Group ID in the __user_usergroup_map table.

    To do this, download this sample MAP CSV file. You would need to note the user IDs and User Type of the users which you added in the __users table. Now update the rows accordingly.

    5- Follow step 2 and 3 again for this MAP CSV file and now execute this below query:

    mysql> LOAD DATA INFILE '/var/lib/mysql/Final_Template_For_Adding_New_Joomla_2_5_Users_MAP.csv' INTO TABLE __user_usergroup_map FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY ' ' IGNORE 1 LINES;

    Now all the users are added into the database. You can check them through Admin Panel > User Manager.

    If you want to send registration mails to the new registered users, you can use AcyMailing. Starter (Free) edition will do the work.

    You would now need to import the newly added users. Here is the documentation- Or you may search for videos on Youtube.

    Create a new list, select and subscribe the new users to this list.

    Create a newsletter with the message you want to send. It also has some tags through which you can fetch the values of username, Name variables, Email Id etc.

    Apply this newsletter for the list which you created and send the mail.

    If everything is okay, it will now send the emails to all the users subscribed to this list :)

    It will send emails in the batch of 40 mails i.e. 40 mails/batch, then it would sleep for 2 mins. and will continue sending emails.

    Hope it helps!


    点赞 评论