[wp-hackers] GSoC 2010, WordPress.org Profiles

Stas Sușcov stas at nerd.ro
Mon Mar 29 03:33:08 UTC 2010


În data de Vi, 26-03-2010 la 18:56 -0500, Stephen Rider a scris:
> On Mar 25, 2010, at 4:28 AM, mrmist wrote:
> 
> > it would pain me greatly to see someone getting karma points for spamming the forum / codex with useless bilge that is fit for the trash can, whilst quality responses that take a lot of time to craft "only" make 1 karma point.
> > 
> > Perhaps there could be some rating system applied to forum responses, or note could be taken over when an answer "resolves" a problem.
> 
> Yes -- I think a simple thumbsup/thumbsdown switch that readers can hit would be useful here.  Karma shouldn't be automated -- real people should have to indicate that something is good.
> 

Hey everybody,
I followed Jane's advice and wrote some code just to get familiar with
BP and see what's all about.

Here's a small plugin I wrote that actually implements a simple API into
BuddyPress with the following features:
* Admin screen to add applications to API and delete them
* User screen with the latest logs from API's actions related to him
* Ability to add a new activity into user's profile using a POST

How to use it, you will need curl, bellow is the result of such a query:
---
stas at rivalry:~ ~» curl -i -X POST -d
"api_key=ca6ba9de07a1709605588d0510a33cd0fde0e228&username=c00l2sv&data_uri="http://plugins.svn.wordpress.org/buddypress-am-i-gcoder"&ts=2010-03-29 03:22:33&data=First update using POST" http://reteaua.utcluj.ro/members/c00l2sv/api/update/
HTTP/1.1 404 Not Found
Date: Mon, 29 Mar 2010 03:02:18 GMT
Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.10 with Suhosin-Patch
X-Powered-By: PHP/5.2.4-2ubuntu5.10
X-Pingback: http://reteaua.utcluj.ro/xmlrpc.php
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Last-Modified: Mon, 29 Mar 2010 03:02:18 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Pragma: no-cache
Content-Length: 15
Content-Type: text/html; charset=UTF-8

{"status":true}%
--- 
the above resulted into this
http://reteaua.utcluj.ro/members/c00l2sv/activity/21


So the idea is to `POST` to `/members/%username%/api/update` using the
`api_key` and the rest of the details, and that will register a new
activity of `application_name` type with the posted data. The response
is a json with the resulted status: `true` on success and `false` on
failure.

The code is available at
http://plugins.trac.wordpress.org/browser/buddypress-am-i-gcoder/trunk

Sorry, I misspelled the name of the plugin repo, the idea was to call it
`Am I a gsocr?`

I believe implementing this kind of API into profiles.wp.org and
connecting it with hooks from trac/wiki/forum is the best and easiest
solution to finish the task. As I mentioned before, this API will also
offer to any kind of developers an option to connect (web)services to
BuddyPress.

I would be very thankful to get some input on my ideas and possible
implementation/features. It's the first time I'm designing/writing an
API.


-- 
()  Campania Panglicii în ASCII
/\  http://stas.nerd.ro/ascii/



More information about the wp-hackers mailing list