Home  ›  Program Hooks  ›  Special Hooks

Special Hooks

These program hooks occur under special circumstances or actions within the forum.

sf_hook_post_feedflare

This hook can be used to execute code or display below the sf_post_post_hook above. The individual post’s permalink is passed into the hook.

function sf_hook_post_feedflare($permalink)
{
	return '';
}

sf_hook_pre_post_save

This hook is executed prior to the post being saved. You can use this to test the content of the post and refuse it by returning a false. To allow the post to be saved – return a true (the default).

function sf_hook_pre_post_save($content)
{
	return true;
}

sf_hook_post_save

This hook is executed upon the saving of a new post. The new post data is passed in as well as the type of post save (action). If the $action argument is ‘topic’, a new topic was created. If the action is ‘post’, a new post was added to an existing topic. The array elements of $newpost argument are forumid, forumslug, topicid, topicslug, postid, submsg, postpin, topicsub, statvalue, posttimestamp, poststatus, postcontent, guestname, guestemail, postername, posteremail, userid, db, and url. NOTE: This hook accepts no return content.

function sf_hook_post_save($newpost, $action)
{
	return;
}

sf_hook_topic_delete

This hook is executed upon the deletion of a Topic. The ID of the Topic that was deleted is passed in as well as the ID of the Forum that the Topic belonged to. This hook is executed before the Posts that belong to the Topic are deleted. It’s also worth noting that this hook is NOT executed for Topics when a Group or Forum is deleted. NOTE: This hook accepts no return content.

function sf_hook_topic_delete($topicid, $forumid)
{
	return;
}

sf_hook_post_delete

This hook is executed upon the deletion of a Post. The ID of the Post that was deleted is passed in. Also passed in are the ID of the Forum and the Topic that the post belonged to. It’s also worth noting that this hook is NOT executed for Posts when a Group, Forum or Topic is deleted. NOTE: This hook accepts no return content.

function sf_hook_post_delete($postid, $topicid, $forumid)
{
	return;
}

sf_hook_pre_edit_post_save

This hook is executed before the filtering and saving of a edited post. The post ID, content and the user’s ID who made the edit are passed in as argments. This hook accepts no return content

function sf_hook_pre_edit_post_save($post_id, $content, $user_id)
{
	return;
}

sf_hook_post_edit_post_save

This hook is executed after the filtering and saving of a edited post. The post ID, content and the user’s ID who made the edit are passed in as argments. This hook accepts no return content

function sf_hook_post_edit_post_save($post_id, $content, $user_id)
{
	return;
}

Article written by steve on January 24, 2010 and last modified by steve on May 30, 2010