Saltbox / wordpress-lti-consumer

Use Wordpress as an LTI Consumer to launch remote learning content
GNU General Public License v3.0
17 stars 11 forks source link

User id error #12

Closed abertranb closed 10 years ago

abertranb commented 10 years ago

You are using wp_get_current_user and try to get the user_id as 'user_id' => $current_user->user_id

But the wordpress api should be $current_user->ID http://codex.wordpress.org/Function_Reference/wp_get_current_user

return array( 'user_id' => $current_user->ID, 'lis_person_contact_email_primary' => $current_user->user_email, 'lis_person_name_given' => $current_user->user_firstname, 'lis_person_name_family' => $current_user->user_lastname, );

And I think the lti_launch_func only will be executed if there are a user logged in

Bests regards

saebyn commented 10 years ago

Thank you for the bug report! You are correct, it should be $current_user->ID.

The lti_launch_func is designed to show/launch content for logged-in users, however it will execute and render an error message instead (see https://github.com/Saltbox/wordpress-lti-consumer/blob/master/lti-consumer.php#L425 ) if an anonymous user views a page containing the lti-launch shortcode.