MicroID Module

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
tanepiper's picture

Hey fellow Microformatters,

I've been working on a small side-element to Microformats in Drupal and it will be ready to commit to the CVS at some point tommorow.

I have created microid.module, which creates a MicroID hash in the user profile.

At the moment, it's a little hard coded. First off all, there is the function that creates the hash:

<?php
function microid_genhash($email, $url)
{
  return
sha1(sha1("mailto:" . trim($email)) . sha1(trim($url)));
}
?>

Now, what I do with this is I get $user->email to generate the email part of the hash, thats fine. But for the profile side, I have specified that there must be a field called profile_homepage. The reason for this is that the URL you want to create the hash with should be your homepage, thats how you will be identified.

The second hard coded bit is there is also a field called profile_microid. This is an invisible (to the user) field in the profile where your MicroID is stored. At the moment, I have only completed the generation code, tommorow I need to finish off my work on the hook_nodeapi part so it can then be embedded around node content like this:

<div class="hentry node microid-a9993e364706816aba3e25717850c26c9cd0d89d">$content</div>

This means that this post can now be validated against a MicroID checking service, and validated to have come from yourself.

If anyone can maybe help solve the problem of removing the hard coding, and letting the user select which field to apply (must be a URL field however, so may make things easier).

Comments

Now commited

tanepiper's picture

This module has now been committed to the CVS.

The module creates a meta tag in a node view (so only 1 meta tag appears).

In both teaser and node view, the module uses jQuery to add a class to any node that includes the microid hash. However, when checking the source code, the class is not there, but using the Web Developer extention in Firefox it is there. I need to verify if this is still accepted by MicroID checking.

Both these are created on-the-fly rather than be stored in the database.

Tane Piper

Digital Spaghetti

head

moshe weitzman's picture

can your code just call drupal_set_html_head() to inject the meta tag on the server side?

Finally working

tanepiper's picture

After much frustration, this module is FINALLY working!

http://drupal.org/files/projects/microformats-5.x-1.3.tar.gz

To check it out, enable the module on your site, then add a node url to your ClaimID page (www.claimid.com if you don't have one!) and verify the link. You'll now see that ClaimID verifies that the post actually belongs to you.

Tane Piper

Digital Spaghetti

Profiles as nodes

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: