Data-posting

An “action” (or “actionblock”) is a special type of block, which is loaded when submitting a POST request, and invokes an object called an “ActionExecuter” to execute some operation and return the results.

define ('GD_TEMPLATE_ACTION_LOGIN', 'action-login');

class GD_Template_Processor_LoginActions extends GD_Template_Processor_ActionsBase {

	protected function get_actionexecuter($template_id) {

		switch ($template_id) {

			case GD_TEMPLATE_ACTION_LOGIN:

				return GD_DATALOAD_ACTIONEXECUTER_LOGIN;
		}

		return parent::get_actionexecuter($template_id);
	}
}
new GD_Template_Processor_LoginActions();

(Source) Defining the ActionExecuter

define ('GD_DATALOAD_ACTIONEXECUTER_LOGIN', 'login');

class GD_DataLoad_ActionExecuter_Login extends GD_DataLoad_ActionExecuter {

	function get_name() {
	
		return GD_DATALOAD_ACTIONEXECUTER_LOGIN;
	}

	function execute(&$block_data_settings, $block_atts, &$block_execution_bag) {

		if ('POST' == $_SERVER['REQUEST_METHOD']) { 

			if (is_user_logged_in()) {

				return array(
					GD_DATALOAD_IOHANDLER_FORM_ERRORSTRINGS => array(__('You are already logged in'))
				);
			}
			else {

				wp_signon();
				return array(
					GD_DATALOAD_IOHANDLER_FORM_SUCCESS => true
				);
			}
		}

		return parent::execute($block_data_settings, $block_atts, $block_execution_bag);
	}
}
new GD_DataLoad_ActionExecuter_Login();

(Source) ActionExecuter to log the user in


Welcome to the PoP framework!
Break the information monopoly

the PoP framework is open source software which aims to decentralize the content flow and break the information monopoly from large internet corporations. Read more.


Sign up to our newsletter: