Author image
Senior Developer

Certified to Rock field

Certified to Rock is a site that allows you to look-up user names, and see their 'certified to rock' score. is a way that community members and employers can get a sense of someone's involvement with the Drupal project. The site uses a custom algorithm that gathers publicly available information which is then distilled down into a score on a scale from one to eleven.

I've been wanting to build an easy way to bring this rating into a Drupal site to add an additional metric to user profiles. Until recently this wouldn't have been a simple undertaking, but a few days ago, Certified to Rock added a JSON web service, making it really easy to get Certified to Rock ratings. I took the opportunity to learn the Drupal 7 field API and decided to take the plunge and build a module that adds a new field that gets the Certified to Rock score of the user ID that you put into the field.

Thus, Certified to Rock field was born! You can add it to any entity and enter the user ID, and get the Certified to Rock score back!

Field Info API

This was my first real venture into any of the Field API of Drupal 7, and I came out relatively happy. Total coding took under four hours, so it was pretty quick, and the amazing examples module was incredibly handy for making a fast start.

There are three major APIs that you can implement to add something to the fields info system:

  1. Field types - This is how you tell Drupal about your field, and the database columns that it needs. You can additionally implement validation and other hooks, to ensure validity of your data and more. The important distinction from CCK in Drupal 6 is that this can all happen without a form, and in fact you must code like this. Forms become just another user of Drupal's APIs, not an integral part of them. Yey!
  2. Field Widgets - So this is the formy bit, widgets are essentially the editing side of your field. My field was a simple(-ish) text box, but you can put whatever you like here. Widgets are really easy to build, but if you're adding a new field, you might find that there is already a widget out there that will do what you want, and you can just tell Drupal that people can use that widget instead of re-inventing the wheel.
  3. Field Formatters - The output, turning the field's data into something presentable. These were always easy to create, but were a bit of a black art of knowing exactly what to name things for it all to work, now in Drupal 7 the hooks are much more descriptive, making it even simpler than ever to build a new formatter. If your formatter supports options it's now painfully straightforward to add an options form. Drupal takes care of storing the data for you, allowing you to focus on what matters: your functionality.

That's my brief first impressions of the Field Info API in Drupal 7. I'm sure we'll be writing about it again soon.

Certified to Rock field

The field works, and I've released a stable version to play with, but there are a number of outstanding issues I'd like to get resolved:

  1. Updating scores on cron. Currently when re-saving the entity the Certified to Rock score will get updated, but it won't if you're not saving the entity. I'd like to process all entities on cron, and update the scores.
  2. Allow entering of Usernames. I'd really like to allow people to just enter their user name, and then look-up their user ID, but I don't know of an easy way to do this at the moment. Suggestions welcome!

I also need to make sure that the field works with Views, because we're all going to want to sort by Certified to Rock rating, aren't we?

[EDIT] Computerminds are not affiliated with Growing venture solutions, the crazy cats behind Certified to Rock


Updating scores on cron is a good idea generally for a field that takes it's value from an external service - but since Certified to Rock is updated so rarely, surely it would make more sense for a site admin to have a master button that would just update all scores manually instead? Updating at frequent intervals through cron would be a waste of time if Certified to Rock isn't updated.

Another thought, since data can be taken from external sources now in Drupal 7, could Certified to Rock field take its data directly from the CtR JSON web service? Perhaps it could be cached so that it normally uses the cached version rather than querying the service on every node load?

Certified to rock is a completely worthless contribution to the Drupal community since it can never include things like personal communication and direct involvement with getting Drupal used by more people.

It's not completely worthless. It doesn't know the "whole story" of someone's contributions to and involvement in the community, but it effectively calculates the "part of the story" it's been calibrated to calculate. If that's the part of the story you want a quick snapshot of for someone you don't otherwise know, that's valuable.

Worst than completely worthless; its dangerous in a bad way because it only knows part of the story then claims and does the quick judging of people based of shallow heuristics.

I disagree with the "worthless" comments. Having a CTR score at all is a good thing, even better if it's a high score. NOT having a CTR score doesn't mean you aren't a good drupal developer or contributor to the community.

Certified to Rock also encourages developers to contribute worthless and overlapping modules to instead of collaborating and submitting patches, since commits and module numbers raises their score.

Dear Anonymous, the CTR score calculations are based on a lot of factors, not just "commits and module numbers".

CTR is worthless because the algorithm is terrible.

Take any two d.o users, one that you know to be a big contributor and one that you know not to be. Their CTR scores will be all over the map and not at all representative of reality.

The only thing CTR tells you is that someone has a user account on d.o.

Comments on this article are now closed, if you want to give us feeback you can use our contact form instead.