Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using the publish_post action to run some checks on a user after their post is published:

$author_ID = ????

add_action('publish_post', 'rhb_check_current_user', 10, $author_ID);

How can I get the original author's ID?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

use

add_action('publish_post', 'rhb_check_current_user');

and in your rhb_check_current_user function check using the global $post:

function rhb_check_current_user(){
    global $post;
    $author_id = $post->post_author;
    ...
    ...
}
share|improve this answer
add comment

I think get_currentuserinfo() is what you're looking for.

share|improve this answer
    
This would work if everybody published their own articles, however I want to get the original author's ID (not the person who reviewed the article). –  idea Mar 17 '11 at 4:52
    
Isn't it easier if the reviewer doesn't change the original Author of that article? If not mistaken, once you change the original Author even post revision doesn't store that info. –  zeo Mar 18 '11 at 21:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.