Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send To Credly failing due to incorrect parameter order. #208

Closed
tw2113 opened this issue Feb 7, 2014 · 2 comments
Closed

Send To Credly failing due to incorrect parameter order. #208

tw2113 opened this issue Feb 7, 2014 · 2 comments
Labels

Comments

@tw2113
Copy link
Collaborator

tw2113 commented Feb 7, 2014

Due to a lot of complaints on the forums about this one, I felt need to investigate further.

In the badgeos_send_to_credly_handler callback handler, we call the following, with $_REQUEST['ID'] being the post/achievement ID.

$send_to_credly = $GLOBALS['badgeos_credly']->post_credly_user_badge( $_REQUEST['ID'] );

This is where the issue begins. In the method declaration for post_credly_user_badge, the order of parameters is as follows:

public function post_credly_user_badge( $user_id = 0, $badge_id = 0 )

The very first thing we do is check the badge_id for validity

// Bail if the badge isn't in Credly
if ( ! credly_is_achievement_giveable( $badge_id ) )
    return false;

However due to the order of parameters, and only passing in 1 parameter. $badge_id is instantly 0, thus we exit right away with a return of false.

If we got that far, we'd eventually set the $user_id variable to the correct value, but we never do. It remains the achievement ID value until we've exited.

Just tested with reversed parameters, and got a green success message. I don't see it in my credly profile, but I'm not sure my settings are all correct for that anyway. I assume our users have a better grasp of that part.

@brichards
Copy link
Collaborator

Assigning this one to @sc0ttkclark to review as he's got the better working knowledge of Credly integration.

@brichards
Copy link
Collaborator

This is now fixed via 79b8e6c, props @tw2113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants