Firstly, it’s better to user WP functions than write your own SQL. Even though it might be a bit more expensive:
$post = get_post($post_ID);
$authorid = $post->post_author;
Secondly, it’s not get_usermeta()
, but get_user_meta()
and the complete call should include true
as the third parameter:
$currentPointNumber = get_user_meta($authorid, 'points', true);
And then it’s update_user_meta()
, again, and you don’t need to initialize a new variable, just do:
update_user_meta($authorid, 'points', $currentPointNumber-1);