"This module adds a block to your site which displays your most recent update to Ping.FM. I didn't like that the existing ping.fm module created a node for each new update. I just wanted to store the one most recent so it could be displayed."
If I added a hook in the Ping.fm module that was triggered when the Custom URL was hit, it might make your life easier. Then Ping.fm Block could depend on the Ping.fm module, and just implement hook_pingfm_custom_url() hook, or something, and display the block. The functionality for the pingfm menu callback wouldn't have to be there.
Thoughts?
Comments
Comment #1
robloachI've also been thinking about abstracting out the Ping.fm node creation stuff into a different module, keeping the API seperate from the functionality. Does that make sense?
Comment #2
chrisfromredfinHi Rob -
Actually, I think that makes perfect sense, IF you abstracted out some of your other functionality like you mention in comment (1). Then the API would afford the ability for multiple things to act on the one custom "ping" url.. so we could create nodes, or store it, or relay it, or all three!
I think I went to "recommended" too fast, but I think I can do a 2x-dev branch which would be the future of it, and would depend on "Ping FM API."
Comment #3
robloachJust made a rather large commit: http://drupal.org/cvs?commit=189508
It creates a new hook_pingfm_custom_url() which looks a little something like this:
The benefit to using this is that it goes through an md5 security check, and you don't have to worry about any of the user settings or anything. See an example in pingfm_node.module.
Comment #4
chrisfromredfinVery cool - I will get on implementing my module this way, since this is much better/more extensible.
Comment #5
robloachNow we just need to backport it to 5 :-P . Heh, yeah right.
Comment #6
robloachWhat the Ping.fm block module is missing is the ability to display Ping.fm updates from different users. This would have to be an additional setting in pingfmblock_block(). Something like this might work, I haven't tested it....
Comment #7
chrisfromredfinSo, you have the ability to store multiple users, and then just change which user gets displayed by the block? Seems kinda "meh," to me -- like it is really just for the sites that are the one-user sites, like personal blogs and stuff. If I wanted multiple users, I would just (personally) use what you already have and create nodes so I can create views and do more powerful things, so I'm more inclined to just leave it.
Something that dawned on me though -- is there any kind of authentication process? I suppose any jamoke on ping.fm could start posting their updates to my site (including nefarious Nigerians or hawkers of enhancement products)... no?
Comment #8
robloachYup, when using the Custom URL with the Ping.fm module, it requires the user ID, as well as an encrypted hash of the user's Ping.fm remote API key. This way, if someone attempts to post to your site, they won't be able to, since they don't have that encrypted Ping.fm remote key. If you have a look at the pingfm_custom_url() function, you'll see that it checks
if ($key == md5($user->pingfm_app_key)).If you install the Ping.fm module and edit your account, you'll see that the custom URL it gives you to provide to Ping.fm is pretty secure ;-) .
Comment #9
chrisfromredfinOK, hmm, well I've got the new code in HEAD and it works (it's running on my site - its530somewhere.com using the newest -dev of pingfm.module). You can check out the HEAD version if you'd like to test.
Unfortunately, creating a 6.x-2.x-dev release off HEAD and getting it to show up on my "administer releases" page is tricky. Either I need to wait, or I did something wrong. In the meantime, like I said, check out HEAD.
Comment #10
robloachVery nicely done! Tested and works! Just need a release ;-) .
Comment #11
chrisfromredfinOK, managed to get my 2.0 release up. Closing.