CSV User Upload v1.8.2 RC

  • Hi,

    any chance hat this great plugin gets updated for elgg 2.0

    I have the problem that it stops after the first imported user (and shows just a empty white screen) in 2.0.1

    Cheers,

    Reklov

  • You are right, thanks  -that works. Actually it worked after I renamed the CSV file (I used the same file for years now) - kept structure and data, just renamed the file.

    Not sure what made the difference. Also maybe the version here would have worked as well with renaming the CSV file.

  • Trigger some events when importing users

    Hi everyone.
    Great plugin.

    I am using the lastest release of your plugin but I have some troubles.
    I have written a plugin which trigger some events when user account is created. My plugin works perfectly. I trigger an event as you can see in the following line.

    elgg_register_event_handler('create', 'user', 'my_function');

    But when I import users through your plugin my_function is not triggered. So I dont know what's wrong.

    What should I do ?

    Best regard

  • @Hermand Pessek I think the 'register', 'user' plugin hook is used instead of 'create', 'user'.

  • Thanks @iionly for your answer. In such case what I am suppose to do. I read the online documentation and I found that 'register' is not and event. so I cannot do the following.

    elgg_register_event_handler('register', 'user', 'my_function');

    What am I suppose to do ?

    Best regard

  • It's not an event but a plugin hook that gets triggered by the upload_users plugin after the user account is created (for example you could also add a callback function for this plugin hook that would return false if the account should not get created - in this case upload_users deletes the account again right away).

    It works quite similar to the event handler registration, i.e. register the handler in the init function of your plugin with:

    elgg_register_plugin_hook_handler('register', 'user', 'my_function');

    And then add your function. The $params array contains some data you could make use of if necessary:

    /**
     * @param string $hook Equals 'register'
     * @param string $type Equals 'user'
     * @param boolean $return Return flag received by the hook
     * @param array $params An array of additional hook parameters
     * @return boolean
     */
    function my_function($hook, $type, $return, $params) {
        // Extracting user entity from $params array
        $user = elgg_extract('user', $params);
    
        // Other data that is likely available
        // (they come from the csv file and are used when creating the user account in the uploadUser() function
        // in mod/upload_users/classes/UploadUsers.php and are added to the $hook_params array the 'register', 'user' hook is triggered with)
        // User entity guid: $params['guid']
        // User entity username: $params['username']
        // Password: $params['password']
        // Display name: $params['name']
        // Email address: $params['email']
    
        <YOUR CODE HERE>
    
        // You can just return the value of the return flag received by the hook
        // You would return false if the account should not get created for whatever reason
        return $return;
    }

Arck Interactive

You imagine. We create. We develop custom social networks, content management systems and other rich internet applications. We help entrepreneurs and creative agencies breathe life into their visions. Let's start a conversation!

Stats

  • Category: User admin
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 3394
  • Recommendations: 8

Other Projects

View Arck Interactive's plugins