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
39 Responses to “Wordpress, FOAF, OpenID - updated”
Leave a Reply
You must be logged in to post a comment.

Just a little test with OpenID/FoaF…
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
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?
Hi Alex,
I used http://alexandre.alapetite.net/ as OpenID login.
/me joins the test squad from http://www.wasab.dk/morten/…
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.
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
One more question: if you logout, can you login with your OpenID login or do you have to enter the Yadis file URL ?
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.”
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…
Now the link under my name is correct, but still no FoaF discovery…
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
Hi again,
Great!
But… I can now see a FoaF logo next to my name, strangely pointing to a wrong address :-O
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 .*
Hum, the regular expression is definitely not good enough. It would be nice to use an XPath instead?
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
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.
Just a test with OpenID + FOAF from http://david.larlet.fr
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
[…] wordpress. Теперь он может изымать из вашего URL FOAF, об этом написал Александре […]
and another test with openid http://www.leobard.net
foaf link should be there.
Test test test. FOAF?
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 ??
Nickel
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.
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.
na dann probieren wir das Ganze doch auch mal aus.
phpMyID funktioniert!
FakeID auch: http://fakeid.media.mit.edu/site/about
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é ?
[…] 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 […]
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…
test test foaf
[…] post is supposed to be a place for testing the OpenID + FOAF plugin for WordPress by Alexandre […]
[…] 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. […]
FOAF ?
[…] 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 […]
[…] Wordpress, FOAF, OpenID - updated […]
[…] meant for app-to-app consumption unlike XFN / hCard which are embedded in HTML. Check out this post WordPress, FOAF, OpenID - updated for a WordPress plugin retrieving FOAF profiles when users authenticate a wordpress blog with […]
Awesome, a lot better than having your url as your name.
[…] identifiant OpenID pourrait être lié à un profil FOAF, administrable lui aussi en […]