It would be nice if this module could take the JSON returned by Google and execute a custom PHP snippet. I suggest a PHP-input field for each possible callback state.

Comments

greggles’s picture

Can you explain how this would help?

The only thing I can think is "that sounds insecure."

MacRonin’s picture

I haven't looked at the returned JSON to verify, but if it gave some type of completion details about the "+1" just executed. It might be nice to be able to log internally that the user had just executed the "+1" option. That info could be added to an analytics tracking system such as Google's or Piwik or OWA or potentially used to issue userpoints

corbacho’s picture

The button has a option for a Javascript callback, that could be used to trigger an ajax notification to Drupal. "Hey, someone voted +1"

I could add that Javascript callback function in the admin settings, but the implementation of the AJAX won't be in this module. Also because it could be faked easily by somone triggering the ajax callback directly.

btw, Greg, you are "tha mAsteR of the aliases" :) ...do you think is the best way to grab the absolute node path like this in Drupal 7:

$node_url = $base_url . '/' . drupal_get_path_alias($node->uri['path']);

In drupal 6, node path is present in the node object (thanks to path_nodeapi), so I grabbed like this:

$node_url = $base_url . '/' . $node->path;

greggles’s picture

I suggest:

<? $node_url = url($node->nid, array('absolute' => TRUE); ?>

btw, that's documented in the pathauto readme.txt ;)

sbefort’s picture

Version: » 6.x-1.0-beta2

I was thinking about using Google +1 instead of Vote Up/Down. I would want the vote total available to Views, so a CCK counter field would need to be updated with the JSON callback. Yes, faking the JSON might be a problem.

corbacho’s picture

Thanks greggles. I changed it in 7.x branch already. But notice that was missing the 'node/' part url("node/$node->nid" ......"

@sbefort It's interesting idea. I don't have time now to explore that option, but tell here if you do.