Sandbox Link: https://drupal.org/sandbox/majorrobot/2236277
Repo: git clone http://git.drupal.org/sandbox/majorrobot/2236277.git

The Credly module allows integration between your Drupal site and the Credly Open Credit API — a platform for creating, giving and earning digital badges.

This module currently:

  • Provides a tab on user accounts for awarding your organization's badges.
  • Displays earned badges on user profiles.

Users will need to:

  • Sign up your site/organization/self for Credly at credly.com.
  • Create badges with Credly's Badge Builder (available once you have a Credly account).
  • Obtain API credentials for your site/organization from Credly. Learn more about their API and how to get started here.

Here is an example workflow:

  1. Create a badge on Credly.com.
  2. Award a user with a badge at user/[uid]/credly.
  3. If you are a trusted issuer, the badge will immediately appear on their profile. If not, they will have to accept the badge first at credly.com.

Reviews:

I've reviewed the following applications for the Review Bonus program:
https://drupal.org/node/2224079#comment-8740503
https://drupal.org/node/2175685#comment-8734351
https://drupal.org/node/2244479#comment-8748027

CommentFileSizeAuthor
#15 coder-results.txt2.21 KBklausi

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxmajorrobot2236277git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

majorrobot’s picture

Issue summary: View changes
majorrobot’s picture

Status: Needs work » Needs review

We've resolved the bot's errors and are ready for review again!

majorrobot’s picture

Issue summary: View changes
majorrobot’s picture

autopoietic’s picture

Initial installation works fine.

Settings page asks for credly username, not aware that I was asked for name so used registered email address (this lets me into credly.com) also tried id from credly user url, unable to authenticate:

Unable to authenticate with Credly. Please check settings against Credly issued information and try again.

I have api key from https://developers.credly.com/my-apps, and secret key, checked no trailing space in form etc

Happy to trial module if I can get over this hurdle.

izus’s picture

Status: Needs review » Needs work

Hello,
Thanks for the contribution. Here is my review :

in credly_settings_validate and credly_badge_add_form_submit you have a drupal_set_message with error status and a form_set error, the last one is suffisant i think, no need for the extra drupal_set_message.

This module uses curl library, but this in not a Drupal requirement, so the module should implement its hook_requirements for this and document it in README.txt
You can check simpletest_requirements in simpletest module that does the same as needed here.

in theme_credly_badges there is a weird str_replace. is this some custom stuff ? maybe adding a comment would make it clear.

also the body of theme_credly_badges may be replaced by a simple theme('item_list', $vars); i think instead of hardcoding the li ul tags

Thanks again

majorrobot’s picture

Hi autopoietic,

Thanks for taking a look!

Yes, the "username" should be the email address you used with Credly. I can see how that can be confusing! We've added a hint to the #description on that form element. If you fetch and merge 7.x-1.x again, you should see this change.

The authentication issue is a bit of a mystery. To test further, we created a new user and were successful with authentication. The order of our fields may be a bit odd from a UI standpoint — it's easy to accidentally put your password into the API Key field. Can you confirm that this is what you're entering:

Credly Username: The email address you log into Credly with.
API Key: Your key from https://developers.credly.com/my-apps.
Credly account password: The password that you log into Credly with.
API Secret: Your secret from https://developers.credly.com/my-apps.

I apologize if that seems a bit basic! I just want to make sure we cover everything. We've also augmented the error in watchdog() for this. If your authentication fails again, can you paste the watchdog error here? That might help us debug.

Thanks so much!

majorrobot’s picture

Hi izus,

Thanks for the review! Those are great comments. If you fetch and merge 7.x-1.x again, you should see that we've addressed your concerns.

in credly_settings_validate and credly_badge_add_form_submit you have a drupal_set_message with error status and a form_set error, the last one is suffisant i think, no need for the extra drupal_set_message.

There is now only form_set_error() in the _validate() function.

This module uses curl library, but this in not a Drupal requirement, so the module should implement its hook_requirements for this and document it in README.txt. You can check simpletest_requirements in simpletest module that does the same as needed here.

hook_requirements() is now added, and README.txt refers to cURL as a necessity.

in theme_credly_badges there is a weird str_replace. is this some custom stuff ? maybe adding a comment would make it clear.

Indeed, that code is there to switch the full-size image which Credly's API returns with a thumbnail. We've added a comment to this line to explain this.

also the body of theme_credly_badges may be replaced by a simple theme('item_list', $vars); i think instead of hardcoding the li ul tags

Good call. The module uses a theme('item_list', $vars) now.

Let us know if the new version resolves these items to your satisfaction!

Thanks,
majorrobot

majorrobot’s picture

Status: Needs work » Needs review
Issue tags: -PAreview: review bonus

Removing the "PAReview: review bonus" tag, since issue was set back to 'Needs Work' earlier today.

Also setting back to Needs review!

izus’s picture

Status: Needs review » Needs work

hi,

thanks again for your contribution, i noticed all your changes.
we can make theme_credly_badges better with no hard coded html tag.
replacing '<a href="https://credly.com/credit/' . $badge->id . '"> <img src="' . $badge_image . '"/></a>';
as in https://api.drupal.org/comment/49213#comment-49213.

i don't have extra notices. it seems good for me.
Thanks

majorrobot’s picture

Status: Needs work » Needs review

Hi izus,

Good call — that makes a lot of sense. Our code is updated to reflect your suggestion. Before I set the issue to RTBC, I wanted to confirm that you were able to connect to Credly. Did that work for you (autopoietic had an issue with this, above)?

Thanks so much!

izus’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +PAreview: review bonus

hi,
i looked again at the codebase and it seems ok.
i tested the module by installing it, i creadted an app and tested with a drupal user that is registered in credly.com
i can access the tab with badges and operations.
it seems good

also putting back the PAReview: review bonus tag as i checked those are good too.

Thanks

majorrobot’s picture

Thanks so much, izus!

klausi’s picture

Status: Reviewed & tested by the community » Fixed
StatusFileSize
new2.21 KB

Review of the 7.x-1.x branch:

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. credly_settings_form(): doc block is wrong, this is not a hook. See https://drupal.org/node/1354#forms . Same for credly_settings_validate() and possibly others
  2. '#prefix' => "<p>If you are viewing this page, your settings have been validated ...: all user facing text must run through t() for translation.
  3. credly_rest(): all check_plain() calls in this function are wrong, your are not printing those settings to HTML? Make sure to read https://drupal.org/node/28984 again.
  4. credly_authenticate(): the filter_xss_admin() is wrong here because the "%" placeholder will already run check_plain() for you.
  5. credly_badges_page(): same here: the filter_xss() is wrong here since t() with the appropriate placeholders will already sanitize the variables for you.
  6. theme_credly_badges(): $badge->image seems to be a URL, so you should use check_url() instead of check_plain().

So although your sanitization function usage is a bit worrisome I don't see exploitable security issues, so I think we can proceed. But please do fix those.

Thanks for your contribution, majorrobot!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

majorrobot’s picture

Hi klausi,

Thanks for the review! We've updated our code to correct what you found. Thanks for updating my account; we look forward to contributing more to the community.

And thanks to all the reviewers!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.