Organizations often want to use Ping.FM to update their social networks in one fell swoop. To this end, I've created a pingfm_actions module which can post to pingfm under any trigger or rule (i.e. when new "news" content is created, send that over to ping.fm).

What seemed to be difficult was that the existing pingfm module is somewhat user-centric. Even pingfm_post takes an account. I got around this by "faking" an $account with a site-wide API key. (So, no matter who posts the "news item," it goes to the site-wide Ping.FM account for the organization).

What seemed to be missing was a place to store the "site-wide" API key. I could put it in my pingfm_actions module, but it seemed to me like this setting might be useful to other future modules, too. So, I put it in Ping.FM's pingfm.admin.inc settings form. I put it under the advanced section.

  // pingfm.admin.inc near line 45
  $form['advanced']['pingfm_sitewide_apikey'] = array(
    '#title' => 'Ping.FM Site-Wide Account API Key',
    '#description' => 'Some modules will want to post to an account that is tied
      at the "site-wide" level.  Enter that account\'s API key if you need it. '.
      l('Ping.FM application key', 'http://ping.fm/key', array('attributes' => array('target' => '_blank'))).'.',
    '#type' => 'textfield',
    '#default_value' => variable_get('pingfm_sitewide_apikey', ''),
  );

I'm open to some discussion about what's really the best way to implement this. I suppose another workaround is to use the user 1's credentials for site-wide stuff, but that also seemed to me less flexible. That is, user 1 might be "Bob" but we still don't want to post to "Bob's" personal Ping.FM account that's stored with his $user.

CommentFileSizeAuthor
#4 pingfm-global.patch4.22 KBSMerriman

Comments

robloach’s picture

Was actually thinking about this before, and I do think it needs to go in. Any ideas of some functionality that could take advantage of it? Thanks!

chrisfromredfin’s picture

The crux of it is any time a site/organization wants to update its own ping.fm account with content from its site (no matter who the author is). Ping.FM Actions will (does) use this to do just that. Another module might be one that runs on cron, aggregating content, and pinging that. (Of course, Ping.FM can already use an RSS feed as a source I think, so maybe this use case doesn't make sense).

I'd also love to see the ping.fm module's core "Ping this post" be able to use a system-wide key instead of per-user, so content authors (no matter who they are) can cherry-pick posts to be ping'd without having to set each of their individual accounts to the site's key (since there could ostensibly be some cases where "Bob" the content author wants to ping "this one" to HIS account, but ping "this other one" to the site's).

momper’s picture

+1 it's the same situation "a site/organization wants to update its own ping.fm account with content from its site (no matter who the author is)."

SMerriman’s picture

Component: User interface » Code
Status: Active » Needs review
StatusFileSize
new4.22 KB

I also needed this, so wrote a patch that:

  • Adds a global app key setting to the settings page
  • Adds a new permission ('use global ping.fm app key')
  • If a user has both the 'post to ping.fm' permission and the 'use global ping.fm app key' permission, but has left their app key blank, the global app key (if entered) will be used instead.

First time submitting a patch, so apologies if there are any major issues.

momper’s picture

thanks #4 - the site will go online next monday - so now it's to hot for me to test the patch -> i wikll try later ...

emilcohen’s picture

chrisfromredfin’s picture

Emil - this is not a support request ticket or the correct avenue to ask your question, so you will likely not get an answer. You'll have more success if you post in the forums, ask in IRC, or open a new ticket of Category "support request" on the ping.fm project. Thanks!

Steven Brown’s picture

Assigned: Unassigned » Steven Brown
Status: Needs review » Closed (fixed)

This feature is now in the latest 6.x-1.x-dev and in the latest 6.x-1.0-beta1 release.