Actions

From SMFMods

Jump to: navigation, search

This article is a stub, an unfinished article. You can help SMFMods.org by expanding it.


Each page in SMF has its own action, which is present in the URL (ie. index.php?action=whatever). All of the available actions are defined in the action array in SMF's index.php file. This array looks like:

// Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
	$actionArray = array(
		'activate' => array('Register.php', 'Activate'),
		'admin' => array('Admin.php', 'Admin'),
		'announce' => array('Post.php', 'AnnounceTopic'),
		'ban' => array('ManageBans.php', 'Ban'),
		'boardrecount' => array('Admin.php', 'AdminBoardRecount'),
		'buddy' => array('Subs-Members.php', 'BuddyListToggle'),
		'calendar' => array('Calendar.php', 'CalendarMain'),
		// ... snipped ...
		'verificationcode' => array('Register.php', 'VerificationCode'),
		'vote' => array('Poll.php', 'Vote'),
		'viewquery' => array('ViewQuery.php', 'ViewQuery'),
		'who' => array('Who.php', 'Who'),
		'.xml' => array('News.php', 'ShowXmlFeed'),
	);

For each action, the first item is the file name the action is in, and the second item is the function to call. For example, the activate action is in the Register.php file, and uses the Activate function. So, to add your own action, you'd just add a new entry for it:

'test' => array('Test.php', 'Test'),

[edit] See also

Source files

Personal tools