celtic-project / wordpress-lti

LTI Connector for WordPress
GNU General Public License v3.0
23 stars 11 forks source link

Handing over email addresses #6

Closed MelanieWalter closed 4 years ago

MelanieWalter commented 4 years ago

Hi everybody

we are using the LTI Plugin in a higher education context (Connecting Moodle to Wordpress) and would need the email addresses of the users to be handed over. As far as I can see this is not included in the code right now. Would it be possible to include this?

Cheers,

Melanie

spinozarabel commented 4 years ago

Hi Melanie, This is already built-in and very easy to open out. Look for a file called doConnect.php in includes subfolder. There are 2 places you need to uncomment the email part as shown below:

if ($user) { // user exists, simply save the current details $result = wp_insert_user( array( 'ID' => $user->ID, 'user_login' => $user_login, 'user_nicename' => $user_login, 'first_name' => $tool_provider->user->firstname, 'last_name' => $tool_provider->user->lastname, 'user_email' => $tool_provider->user->email, //'user_url' => 'http://', 'display_name' => $tool_provider->user->fullname, ) ); } else { // User doesn't exist, create username if user provisioning is on $result = wp_insert_user( array( 'user_login' => $user_login, 'user_pass' => wp_generate_password(), 'user_nicename' => $user_login, 'first_name' => $tool_provider->user->firstname, 'last_name' => $tool_provider->user->lastname, 'user_email' => $tool_provider->user->email, //'user_url' => 'http://', 'display_name' => $fullname ) );

MelanieWalter commented 4 years ago

Thank you for your swift reply. Seems like I was to hasty, sorry for that. I had thought I diligently went through all the files, but seems I missed that line :/