Using twitter naturally with weblinks
Summit - June 29, 2009 - 17:45
| Project: | Web Links |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Jump to:
Description
Hi,
I am looking at the possibility to post a weblink to twitter and it seems that the natural way of doing this doesn't work with weblinks after further investigation.
I think it has to do with exactly the same as feedapi architecture: http://drupal.org/node/379748
Is it true that like feedapi, weblinks build nodes through node_object_prepare() and node_save(), rather than drupal_execute(), so the twitter "Post to twitter.com" code never gets fired.
Is this correct analyses?
Greetings, Martijn

#1
Add on may be using twitter, as described on http://drupal.org/node/379748
/*** Implementation of hook_nodeapi().
*/
function Custommodulename_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case 'insert':
if ($node->type == 'weblinks') {
module_load_include('inc', 'twitter');
$twitter_accounts = drupal_map_assoc(array_keys(twitter_get_user_accounts($node->uid, TRUE)));
$node->twitter['post'] = TRUE;
$node->twitter['status'] = 'RT @!title';
$node->twitter['account'] = array_pop(array_keys($twitter_accounts));
}
break;
}
}
#2
To be more precise, we don't build the node at all -- the node module does it. I don't understand why the Twitter module can't intercept standard Drupal actions. I've posted in that issue for more information.
#3
Hi Nancy, made a specific bugreport about this: http://drupal.org/node/509184 Greetings, Martijn
#4
Thanks
#5
#6
Please reopen this when that other issue gets resolved.