Пример #1
0
/**
 * Add a new employee
 *
 * @since	1.3
 * @param	arr		$data	$_POST super global
 * @return	void
 */
function mdjm_add_employee_action($data)
{
    if (!wp_verify_nonce($data['mdjm_nonce'], 'add_employee')) {
        $message = 'security_failed';
    } else {
        if (empty($data['first_name']) || empty($data['last_name']) || empty($data['user_email']) || !is_email($data['user_email']) || empty($data['employee_role'])) {
            $message = 'employee_info_missing';
        } elseif (mdjm_add_employee($data)) {
            $message = 'employee_added';
        } else {
            $message = 'employee_add_failed';
        }
    }
    $url = remove_query_arg(array('mdjm-action', 'mdjm_nonce'));
    wp_redirect(add_query_arg(array('mdjm-message' => $message), $url));
    die;
}
Пример #2
0
 /**
  * Adds a new employee and assigns the role
  *
  * @param	arr		$post_data
  *						'first_name'	Required: The first name of the employee.
  *						'last_name'		Required: The last name of the employee.
  *						'user_email'	Required: The email address of the employee.
  *						'employee_role' Required: The role that the employee should be assigned.
  *
  * @return	void
  */
 public function add($post_data)
 {
     return mdjm_add_employee($post_data);
 }