delete node = delete kaltura media
jjbarrows - August 24, 2009 - 06:48
| Project: | Kaltura |
| Version: | 6.x-1.4 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
has anyone implimented
http://www.kaltura.org/delete-files-kaltura-db-when-deleting-nodes
and willing to share the code?
thanks,
joseph

#1
FYI: looks like that link is broken now.
#2
Something like this should work:
<?phpfunction YOURMODULE_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
if($op == 'delete' && $node->type == 'YOUR KALTURA CONTENT TYPE NAME'){
$session_user = KalturaHelpers::getSessionUser();
$kaltura_client = KalturaHelpers::getKalturaClient(TRUE);
$result = $kaltura_client->deleteEntry($session_user, $node->kaltura_entryId);
}
}
?>
#3
Hi JaceRider,
I tried to implement it in the kaltura.module. But I seems to work not in that way I did it.. is the "if" wrong implemented?
Cheers
.../**
* Implementation of hook_nodeapi().
*
* All we do here is to alter the body and teaser fields when a node goes to view mode
* we call our functions to replcae the special "tags", which we create in theme_node_kaltura_*_entryId(), with the embed tag
*
*/
function kaltura_nodeapi(&$node, $op, $teaser, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case "delete":
if($node->type == 'blog_crossposting'){
$session_user = KalturaHelpers::getSessionUser();
$kaltura_client = KalturaHelpers::getKalturaClient(TRUE);
$result = $kaltura_client->deleteEntry($session_user, $node->kaltura_entryId);
}
break;
#4
I don't know bud, that looks like it should work to me.
Try doing a dsm($result); after the line "$result = $kaltura_client->deleteEntry($session_user, $node->kaltura_entryId);" and see what it returns. (Make sure you have the devel module installed, otherwise do print_r($result))
If I remember correctly, the message that is displayed should tell you what the issue is.
#5
Hi JaceRider,
I got this:
Array ( [result] => Array ( [serverTime] => 1257865714 ) [error] => Array ( [0] => Array ( [code] => MANDATORY_PARAMETER_MISSING [desc] => Mandatory paramter missing [entry_id] ) ) [debug] => Array ( [sigtype] => 1 [signature] => d094f66cd60462b6ee2854ea055248b3 [execute_impl_time] => -1257865714.0101 [execute_time] => 0.067968130111694 [total_time] => 0.0689699649811 ) )
#6
Well, it would seem something is wrong with "$node->kaltura_entryId". I would do a dsm of $node and make sure that kaltura_entryId is listed in that object. If it isn't, that's why it isn't working and you will need to track down why it isn't there.