Integrating Gigya and Signup Modules
I am currently working on hacking signup and gigya to support triggers for signups. I have actually gotten it to do pretty much what I want to do, except I cannot seem to pass along the absolute path to a newsfeed. I have everything configured correctly, posts show up on my wall, but there is no link back to the content. In the gigya.module file, I see $xml_params['path'] and assumed that it would get plugged into the template and passed along. However this does not seem to be the case for even the unhacked elements like node posts, or comments.
In a brute force way, I thought I would force gigya to write the title with the link already in it and pass that on. However it just passes it on as text and not HTML to facebook. Below is the function gigya_newsfeed_action() which I've modified to accept a "signup" hook in addition to the others.
I've commented the change below.
<?php
function gigya_newsfeed_action($object, $context) {
global $base_path;
//notification actions here, we need to figure out a way to dynamically update a status
//probably by showing a field, or making system configurable actions with canned action text
module_load_include('inc', 'gigya');
if ($capabilities = _gigya_getUserCapabilities($_SESSION['gigya_uid'])) {
if (!array_search('Actions', $capabilities)) {
return FALSE;
}
}
$xml_params = array();
$xml_params['action'] = $context['default_message'];
$xml_params['template'] = $context['template'];
$hook = $context['hook'];
switch ($hook) {
case 'comment':
$context['node'] = node_load($context[$hook]->nid);
if (array_search($context['node']->type, $context['newsfeed_content_types']) || empty($context['newsfeed_content_types'])) {
$xml_params['path'] = $content['node']->path ? $content['node']->path : 'node/'. $context['node']->nid;
$xml_params['title'] = $context['node']->title;
}
else {
return;
}
break;
case 'user':
$xml_params['title'] = $context['account']->name;
$xml_params['path'] = 'user/'. $context['account']->uid;
break;
case 'nodeapi':
if (array_search($context['node']->type, $context['newsfeed_content_types']) || empty($context['newsfeed_content_types'])) {
$xml_params['title'] = $context['node']->title;
$xml_params['path'] = $context['node']->path ? $context['node']->path : 'node/'. $context['node']->nid;
}
else {
return;
}
break;
// I have added the signup case which I've already successfully created a signup hook for triggers. It gets to this point fine, but links don't get processed
case 'signup':
$context['node'] = node_load($context['nid']);
if (array_search($context['node']->type, $context['newsfeed_content_types']) || empty($context['newsfeed_content_types'])) {
$date = $context['node']->field_date_time[0][value];
$xml_params['title'] = $context['node']->title;
$xml_params['path'] = $context['node']->path ? $context['node']->path : 'node/'. $context['node']->nid;
$xml_params['title'] = "<a href=\"http://www.albany2030.org/" . $xml_params['path'] . "\">" .$xml_params['title']."</a> on " . $date;
}
else {
return;
}
break;
}
if (!empty($xml_params['title']) &&
!empty($xml_params['template']) &&
!empty($xml_params['action']) &&
!empty($xml_params['path']))
gigya_publish_user_action($_SESSION['gigya_uid'], $xml_params);
}
?>Basically, the question is, how do I send html characters through the gigya API so they don't end up as text on Facebook? I've tried htmlspecialchars() and they just end up as the special characters. I'm at a loss. If anyone knows of another approach, I'd be glad to try, but this seems like it's within close reach.
Also, below is the code I added to signup.module to enable two triggers for signing up and canceling. This seems to have worked like a charm (although I may have missed something or duplicated code). If this seems to look ok, how do I roll this into a patch? I work a lot with PHP, but haven't really worked in a group coding environment and am recent to the drupal framework.
<?php
/**
* Implementation of hook_hook_info().
*/
function signup_hook_info() {
return array(
'signup'=>array(
'signup'=>array(
'signup'=>array(
'runs when'=>t('User signs up for an event'),
),
'cancel_signup'=>array(
'runs when'=>t('User cancels a signup'),
),
),
),
);
}
/**
* Implementation of hook_trigger_name().
*/
function signup_signup($op, $nid) {
// We support a subset of operations.
echo "success" . $op;
if (!in_array($op, array(
'signup', 'cancel_signup'
))) {
return;
}
$aids = _trigger_get_hook_aids('signup', $op);
$context = array(
'hook'=>'signup', 'op'=>$op, 'nid'=>$nid,
);
$return = actions_do(array_keys($aids), $nid, $context);
return $return;
}
/**
* Implementation of hook_action_info_alter().
*/
function signup_action_info_alter(&$info) {
foreach ($info as $type=>$data) {
if (stripos($type, "user_") === 0 || stripos($type, "system_") === 0) {
if (isset($info[$type]['hooks']['application'])) {
array_merge($info[$type]['hooks']['signup'], array(
'signup', 'signup_cancel'
));
} else {
$info[$type]['hooks']['signup'] = array(
'signup', 'signup_cancel',
);
}
}
}
}
?>Thanks for any help.
Best,
Jason

Maybe this will help
Try the following :
* Open gigya.inc file for editing.
* Go to _gigya_get_useraction_xml function (in line 490 if u have beta5)
* Replace
$title = htmlspecialchars($content['title']);with
$httpPos = stripos($content['title'],'http');
if ( !$httpPos ) {
$title = htmlspecialchars($content['title']);
}
else {
$title = $content['title'];
}
Please let me know if it helped.
No luck yet
Thanks for the response. This doesn't seem to work. I tried two things, using your code and then I just removed htmlspecialchars() altogether. When changing it, no content makes it on to Facebook at all. I changed it back and it posted.
I'm starting to think I may have implemented something wrong to begin with. When I look at _gigya_get_useraction_xml() I see the reference to template, but I don't believe I pass in a template specifically. I assumed that there was a default template and action that is inherited from the user defined trigger/action, but maybe I'm wrong?
I may get my terms wrong, but when I look at other posts on facebook, it looks like links are only allowed in a "title" area that shows up as a facebook blue link. Then below that is the general message (normally a teaser for posted content from another site) that shows up in light gray. When I post I only get the light gray text.
Here is an example of what I'm talking about:
http://www.albany2030.org/example.jpg
There are two posts in the image. The one on the bottom is from Gigya. The one on the top is from the facebook.me script because I want users to be able to share content without logging in. However, I want events to be posted automatically on those users that are signed in to create some buzz around the event.
Anyway, you can see the general difference in posts. What I want is something that looks similar to the top one (image not necessary) where the blue link links back to the event.
I hope this makes sense?
Best,
Jason
signup triggers
http://drupal.org/node/595414#comment-2215844
cheers
Ed
geeksupport.com.au
Still need to address the Gigya problem
I actually did get the signup working with triggers without any problems and I registered some actions to it. The actions fire and everything works except that the Gigya module does not post to Facebook in the way I desire. See my prior post.
-J
can't help, but interested
Hi,
I am a very novice developer and I don't think I can heop with this but I am very interested. If you get it working I would like to know. I am looking for a module now that works the same way, but writes to a google calendar, I could pay for that if you could do it. I am not rich, but if you're interested or think you have an idea how to do that please let me know and lets try to figure something out. I believe this would be a popular module. Thanks for reading. Hope to hear from you.
Good Luck,
Chris