Wordpress, FOAF, OpenID - updated

Here’s an update of my previous experiments on retrieving FOAF profiles when users authenticate a wordpress blog with OpenID.

The openid plug-in for Wordpress is now stable (I made the experiments on svn versions), so here’s the piece of code that retrieves profiles when creating user account - tested with v2.1.2 of wp-openid.

Unpack the tgz in your the wp-openid folder, and check readme-foaf.txt for instructions. This version also features a function you can add in your templates to show the FOAF icon and a link to the profile in comments, and a way to cron the autodiscovery feature for profiles updates (Edit: The cron now tries to find FOAF files from user homepages, see comments).

I’ll maintain this hack for next updates of wp-openid (unless it’s in the plug-in itself). Nexts steps will be to retrieve people URI (more than just the profile, which should be easy if people use the foaf:openid property in their profile) and use these data in the SIOC and FOAF exports for Wordpress. It will be one more way to provide a RDF-ized social graph, with reference to existing profiles and URIs.

Comments

36 Responses to “Wordpress, FOAF, OpenID - updated”

  1. Alexandre Alapetite on January 6th, 2008 3:25 pm

    Just a little test with OpenID/FoaF…

  2. Alex on January 6th, 2008 3:32 pm

    Hi?
    Did you use http://alexandre.alapetite.net/id/yadis.xrds.xml or simply http://alexandre.alapetite.net as a login ? While the second one features a link to your FOAF profile, the first one doesn’t.
    If you used it, it means the plug-in stores the yadis URL rather than the OpenID one :/ But that seems strange, I never has this before

  3. Alexandre Alapetite on January 6th, 2008 3:37 pm

    Hum, did not discover FoaF, apparently due to the use of YADIS/XRDS :-(

    In my case, I do a content negotiation at the root of my Web site to serve my YADIS file to clients seeking application/xrds+xml.
    Therefore, in order to get the HTML content (and thus discover the FoaF in the HEAD), the plug-in should perform a HTTP GET with an Accept header that will match application/xhtml+xml or text/html, but not application/xrds+xml.

    As a side note, is it possible to specify one’s FoaF profile in a YADIS file?

  4. Alexandre Alapetite on January 6th, 2008 3:38 pm

    Hi Alex,
    I used http://alexandre.alapetite.net/ as OpenID login.

  5. Morten Høybye Frederiksen homepageblog on January 6th, 2008 3:39 pm

    /me joins the test squad from http://www.wasab.dk/morten/…

  6. Alex on January 6th, 2008 3:50 pm

    Alexandre, thanks for the explanations.

    So it seems the problem is not that the plug-in retrieves the yadis file (it follows the content-negociation requirements) but that it considers the user login / OpenID is this file URL rather that the original OpenID URL (in that case, I’d have been able to retrieve FOAF).

    I’ll check the code and see with the wp-openid plug-in maintainer.

  7. Alexandre Alapetite on January 6th, 2008 4:00 pm

    Hi Alex,
    Great, I would be pleased to hear more about it.

    Here is Sam Ruby’s page explaining a similar setup as mine:
    http://intertwingly.net/blog/2007/12/05/phpMyId-0-7
    http://intertwingly.net/blog/2007/01/03/OpenID-for-non-SuperUsers

  8. Alex on January 6th, 2008 4:06 pm

    One more question: if you logout, can you login with your OpenID login or do you have to enter the Yadis file URL ?

  9. Alexandre Alapetite on January 6th, 2008 4:12 pm

    I did logout and login again with http://alexandre.alapetite.net/
    It was slow, slow, and finally directed me to your Wordpress admin interface!
    A small quote to show you that is correct:
    “Akismet has protected your site from 4,015 spam comments.”

  10. Alexandre Alapetite on January 6th, 2008 4:17 pm

    Ok, strange behaviour, but seems fine : it was my account on your Web site :-)
    I tried to manually update my “Website” information in “Contact info”. Let us see if this changes something…

  11. Alexandre Alapetite on January 6th, 2008 4:24 pm

    Now the link under my name is correct, but still no FoaF discovery…

  12. Alex on January 6th, 2008 4:42 pm

    Indeed, it didn’t work because the FOAF file is retrieve from the OpenID URL, and this URL is currently your Yadis file … moreover you can’t change it since wordpress considers that’s your username.

    But I updated my cron script which now tries to fetch a FOAF file from the user homepage, in case it can’t find one from the OpenID URL. (.tgz updated).

    So, that’s not solving the issue of storing the Yadis file rather than the OpenID one as a username, but at least, now I have your FOAF :)

  13. Alexandre Alapetite on January 6th, 2008 4:52 pm

    Hi again,
    Great!
    But… I can now see a FoaF logo next to my name, strangely pointing to a wrong address :-O

  14. Alexandre Alapetite on January 6th, 2008 4:59 pm

    Hum, the error seems to be in wp-openid-foaf.php, in your regular expression to discover the FoaF.
    May I suggest ungreedy quantifiers .*? instead of your greedy ones .*

  15. Alexandre Alapetite on January 6th, 2008 5:10 pm

    Hum, the regular expression is definitely not good enough. It would be nice to use an XPath instead?

  16. Alex on January 6th, 2008 5:18 pm

    Indeed, the regexp works only with a specific args order, a bit dirty …
    XPath would be nice, but implies to tidy the HTML file before, so it requires some PHP extensions that may not be available from some web hosting provider.
    I’ll try to mix regexp / explode to get it

  17. Alexandre Alapetite on January 6th, 2008 6:30 pm

    May I point you to Morten’s getFoaF() function?
    http://xml.mfd-consult.dk/foaf/getFoaF.phps

    Otherwise, in PHP5, the DOM extension is enabled by default and has a DOMDocument->loadHTMLFile() function.

  18. David Larlet homepageblog on January 6th, 2008 8:04 pm

    Just a test with OpenID + FOAF from http://david.larlet.fr

  19. Alex on January 6th, 2008 8:21 pm

    Alexandre > Thanks for the links, I updated my regexp based on Morten’s one, it works now.

    Morten > BTW, your regexp did not work for some URLs. Some of them because it’s not well designed (eg there’s no application/rdf+xml), but for some of them, I didn’t find what was wrong, eg - your homepage.

    David > Bienvenue :)

  20. Недельный обзор | Футуриус on January 7th, 2008 2:48 pm

    […] wordpress. Теперь он может изымать из вашего URL FOAF, об этом написал Александре […]

  21. Leo Sauermann on January 8th, 2008 11:08 am

    and another test with openid http://www.leobard.net
    foaf link should be there.

  22. Gunnar Aastrand Grimnes on January 8th, 2008 11:12 am

    Test test test. FOAF? :)

  23. Gautier Poupeau on January 8th, 2008 10:58 pm

    Un test pour voir si ça fonctionne à présent. La première étape s’est bien passé, j’avais mal configuré ma délégation… A présent le FOAF ??

  24. Alex on January 8th, 2008 10:59 pm

    Nickel ;)

  25. Gautier Poupeau on January 8th, 2008 11:01 pm

    Super, ça marche !! Il faudrait maintenant essayer de lier cette fonctionnalité avec mon dernier test (http://www.lespetitescases.net/foaf-le-reseau-social-garanti-sans-pub) en comparant le nom renvoyé par Open ID et le profil FOAF.

  26. Alex on January 8th, 2008 11:07 pm

    J’ai commencé quelque chose de ce coté, j’espère avancer d’ici la fin de semaine.

    => http://apassant.net/?author_name=Alex/foaf.rdf

    (cf a34 pour ton compte crée à l’instant)

    Il y a une nouvelle URI “locale” pour chaque utilisateur où j’associe l’openid avec foaf:openid (et le mail également) pour permettre d’identifier qu’il s’agit de la même ressource (les 2 étant des IFP). Par la suite il faudrait que je crawle le profile d’origine pour ajouter un owl:sameAs, j’y travaille.

  27. Sonja Swisch on January 9th, 2008 11:54 am

    na dann probieren wir das Ganze doch auch mal aus.

    phpMyID funktioniert!

    FakeID auch: http://fakeid.media.mit.edu/site/about

  28. Alexandre Alapetite homepagehttp://fr.wikipedia.org/ ()http://copainsdavant.linternaute.com/ ()http://www.facebook.com/ () on January 11th, 2008 6:05 pm

    Bonjour,
    J’ai changé la manière dont je sers mon fichier YADIS :
    - avant, c’était une redirection HTTP 302 vers le fichier YADIS si un client demandait la racine de mon site avec un entête HTTP Accept contenant application/xrds+xml
    - maintenant, je sers le YADIS directement sans redirection pour ces clients, par négociation de contenu avec le .var de ma racine:

    URI: id/yadis.xrds.xml
    Content-type: application/xrds+xml;qs=0.9

    Cela semble marcher beaucoup mieux avec le plug-in Wordpress. Voyons si le FoaF sera découvert :-)

    Est-ce que mon ancien compte avec comme nom d’utilisateur http://alexandre.alapetite.net/id/yadis.xrds.xml peut être supprimé ?

  29. One FOAF fits all : Alexandre Passant on January 12th, 2008 8:08 pm

    […] since I can create a link to this FOAF profile from my OpenID, I can reuse this graph in many applications. And when login to a new service, ask him “is […]

  30. Morten Høybye Frederiksen homepageblog on January 16th, 2008 10:57 pm

    Alex,

    Regarding getFoaF: The problem is that the regexp’s only finds one link with application/rdf+xml, the first, and if that’s not the FOAF one it fails…

  31. http://geocities.com/rmarkwhite/ homepage on January 17th, 2008 2:07 am

    test test foaf

  32. Spoogle » OpenID + FOAF on January 22nd, 2008 3:51 pm

    […] post is supposed to be a place for testing the OpenID + FOAF plugin for WordPress by Alexandre […]

  33. Web Semantico: semanticizzare un WordPress blog (Parte 1) | Stalkk.ed on January 22nd, 2008 10:46 pm

    […] per il supporto di FOAF e di SKOS fare riferimento ai plugins FOAF Output e SKOS Output, entrambi sviluppati da Morten Høybye Frederiksen, nonché al plugin di Alexandre Passant WordPress - FOAF - OpenID. […]

  34. Nicolas on February 11th, 2008 4:00 pm

    FOAF ?

  35. SparlPress and foaf:openid : Alexandre Passant on February 14th, 2008 8:59 pm

    […] cool thing with this plugin is that the openid patch I wrote some times ago, which implied to hack the original plug-in, is now powered by SparqlPress […]

  36. Nodalities » Blog Archive » This Week’s Semantic Web on April 17th, 2008 7:14 pm

    […] Wordpress, FOAF, OpenID - updated […]

Leave a Reply

You must be logged in to post a comment.