Fix email templates.

This commit is contained in:
Hoang Huu
2019-10-21 13:24:14 +07:00
parent 18c41ca780
commit b724789907
16 changed files with 374 additions and 240 deletions

View File

@@ -27,6 +27,30 @@ function opalestate_rest_check_post_permissions( $post_type, $context = 'read',
return apply_filters( 'opalestate_rest_check_permissions', $permission, $context, $object_id, $post_type );
}
/**
* Return the user data for the given consumer_key.
*
* @param string $consumer_key Consumer key.
* @return array
*/
function opalestate_get_user_data_by_consumer_key( $consumer_key ) {
global $wpdb;
$consumer_key = opalestate_api_hash( sanitize_text_field( $consumer_key ) );
$user = $wpdb->get_row(
$wpdb->prepare(
"
SELECT key_id, user_id, permissions, consumer_key, consumer_secret, nonces
FROM {$wpdb->prefix}opalestate_api_keys
WHERE consumer_key = %s
",
$consumer_key
)
);
return $user;
}
/**
* The opalestate_property post object, generate the data for the API output
*