UPME Actions for Developers

Documentation for using UPME Actions for customizing existing behaviour and adding new behaviour.

Documentation for UPME Actions

Genaral Actions
Action

– upme_validate_login

Description

– Useful for validating the user based on custom conditions before allwoing login.

Parameters

– User credentials

Usage
function upme_validate_login($creds){
	global $upme_login;

	// Execute custom validations based on any type of conditions
	// Assign the validation errors into $upme_login->errors[] variable
	if('admin' != $creds['user_login']){
		$upme_login->errors[] = 'Custom Error Message 1;
		$upme_login->errors[] = 'Custom Error Message 2;
	}
}
add_action('upme_validate_login','upme_validate_login');
Action

– upme_validate_username

Description

– Validate username based on custom conditions before creating a new user.

Parameters

– Username

Usage
function upme_validate_username($username){
	global $upme_register;
	// Execute any kind of custom validation on usernames and assign the errors into $upme_register->errors[] variable
	if($username == 'admin'){
		$upme_register->errors[] = 'Custom Validation for Username Failed';
	}
}
add_action('upme_validate_username','upme_validate_username');
Action

– upme_after_password_change

Description

– Execute custom functionality after changing the password. Useful for sending password change email.

Parameters

– User ID

Usage
function upme_after_password_change($user_id){
	// Execute any task after password change.
	// Usefull for retriving user data using the user ID and sending password change email
}
add_action('upme_after_password_change','upme_after_password_change');
Action

– upme_before_delete_field

Description

– Execute custom functionality before deleting a custom field. Useful for validating field delete process.

Parameters

– Data for deleted field

Usage
function upme_before_delete_field($field){
	global $upme_admin;

	// Use the various attibute values of the field for validation. Use print_r on $field to list all attributes
	// Assign the error messages into  $upme_admin->delete_error variable.
	if($field['meta'] == 'password'){
		$upme_admin->delete_error = 'This field is not allowed to be deleted.';
	}

}
add_action('upme_before_delete_field','upme_before_delete_field');
Action

– upme_after_delete_field

Description

– Execute custom functionality after deleting a custom field. Useful for clearing database data after delete process.

Parameters

– Data for deleted field

Usage
function upme_after_delete_field($field){
	// Delete user meta from the table using custom WordPress query
}
add_action('upme_after_delete_field','upme_after_delete_field');