How to get its meta_value of a specific meta_key within wp_usermeta
Using the S2member plugin, a meta_key for the last-payment-time is automatically stored in WordPress DB under table wp_usermeta (custom field is called wp_meds2member_last_payment_time).
From wp_usermeta, the column called meta_key has a value 'wp_meds2member_last_payment_time'. But the content I'm trying to collect is its meta_value equivalent.
I didn't find how to call this meta_value to the function below where I use the date of the last payment time to start a new count of the posts created by the user.
function check_post_limit(){
if(current_user_can('edit_posts')) {
global $userdata;
global $post_type;
global $wpdb;
$postintervall = date('Y-m-d H:i:s', $s2member_last_payment_time );
$item_count = $wpdb-get_var( "SELECT count(*) FROM $wpdb-posts WHERE post_status = 'publish' AND post_author = $userdata-ID AND post_date '$postintervall'" );
if(( $item_count = 2 ) (current_user_is("s2member_level1")) )
{ wp_die( 'Do not create too much posts.','check-limit' ); }
return; }
}
Any suggestions? Thanks