function shoutbox_user_shoutbox in Shoutbox 6.2
Same name and namespace in other branches
- 7.2 shoutbox_user/shoutbox_user.module \shoutbox_user_shoutbox()
- 7 shoutbox_user/shoutbox_user.module \shoutbox_user_shoutbox()
Implementation of hook_shoutbox()
File
- shoutbox_user/
shoutbox_user.module, line 52
Code
function shoutbox_user_shoutbox($op, &$shout, &$a1 = NULL, $form_state = NULL) {
switch ($op) {
case 'context':
if ($uid = shoutbox_user_get_current_uid()) {
$a1['shoutbox_user'] = $uid;
}
break;
case 'insert':
// Determine if the shout was added for a user
if ($uid = $form_state['values']['uid']) {
shoutbox_user_save($shout, $uid);
}
break;
case 'presave':
// Determine if the shout was added for a user
if ($uid = $form_state['values']['uid']) {
// Tag this shout as belonging to this module
$shout->module = 'shoutbox_user';
}
case 'delete':
// Remove any tag references to this shout
db_query("DELETE FROM {shoutbox_user} WHERE shout_id = %d", $shout->shout_id);
break;
case 'js path':
// Alter the js update path so only shouts with the given
// tag are shown
if ($uid = shoutbox_user_get_current_uid()) {
$a1 = "shoutbox/user/{$uid}/js/view/";
}
break;
case 'form':
// Remove the shout form if we're viewing a tag
if ($uid = shoutbox_user_get_current_uid()) {
$a1['uid'] = array(
'#type' => 'value',
'#value' => $uid,
);
}
break;
case 'link':
if ($uid = shoutbox_user_get_current_uid()) {
$a1 = "shoutbox/user/{$uid}";
}
break;
}
}