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 have made a wordpress plugin following standard wordpress tutorials. This plugin add a file upload to the comment form by using simply this function:

add_action( 'comment_form_logged_in_after', array(&$this, 'add_to_comment_form') );

. But when I activate some themes it won't show on the comment form.

Any Help how to make it show on comment form?

share|improve this question
    
Are those themes using comments_template rather than comment_form to display the form? –  mrwweb May 25 '12 at 19:40
    
Sorry I am new to wordpress I don't know exactly how to find it, but it has inside a comments.php file. –  albanx May 25 '12 at 19:50
    
I see a comments_template() inside single.php –  albanx May 25 '12 at 19:59
    
I think it is using comment_form because I see it in the comments.php: <?php do_action('comment_form', $post->ID); ?> –  albanx May 25 '12 at 20:10
    
What software do you use to edit your code? It should be able to perform a global search in all your theme files... –  brasofilo May 25 '12 at 20:17

2 Answers 2

comment_form_logged_in_after action hook was added to WordPress When comment_form() was introduced at version 3.0.

So the themes where your plugin doesn't work are probably outdated themes that don't use comment_form.

share|improve this answer
    
this is wordpress 3.2 –  albanx May 25 '12 at 19:51
    
It's not about the version of WordPress, it's about the function the theme uses to display the comment form. The old way didn't use the action that you're hooking to. –  mrwweb May 25 '12 at 20:52
    
Mrwweb is correct and as i posted the themes are out dated not the WordPress version. –  Bainternet May 25 '12 at 22:34

I solved by adding these actions to comments.php of the theme:

<?php if ( is_user_logged_in() ) : ?>
//...................theme code
<?php do_action( 'comment_form_logged_in_after', $comment_author, $user_identity );  ?>

and

do_action( 'comment_form_after_fields' ); 

Hope this help someone and also for theme makers

share|improve this answer

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.