• Hello, i wish to give my users an option to upload images when they reply. I have looked at adding the code which is in the post-form.php to comment-form.php but “add to post” doesn’t work.

    <?php if ( current_user_can( 'upload_files' ) ): ?>
    	<div id="media-buttons" class="hide-if-no-js">
    		<?php echo P2::media_buttons(); ?>
    	</div>
    <?php endif; ?>

    I understand why it doesn’t work as the textarea has a different name, if I change the name the comment doesn’t get posted. How could I do this?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter andrewjamessenior

    (@andrewjamessenior)

    I have also just noticed, if i add the above code to each reply box, pressing “add to post” inside of the media popup will insert the html into the main post box and not the reply box.

    i have also been looking at the quickpress widget on the dash board and how that does it. the only difference is that the quickpress widget uses the following code and calls media_buttons directly.

    <?php if ( current_user_can( 'upload_files' ) ) : ?>
                    <div id="media-buttons" class="hide-if-no-js">
                            <?php do_action( 'media_buttons' ); ?>
                    </div>
                    <?php endif; ?>

    is there a way to make the above code insert the html into my textarea of choice?

    Thread Starter andrewjamessenior

    (@andrewjamessenior)

    Can anyone help with this please?

    I would personally try this plugin or this one before I try hacking P2 the way you are. But that is just me. Good luck.

    Anyone have an answer to this? I have a similar question dealing with adding the media upload function to a custom field. All of the scripts are in place for the main editor box, i would just like to know how to associate the media buttons with the custom field text area instead of the main editor box. Using <?php do_action( ‘media_buttons’ ); ?> seems to get me most of the way there apart from the fact that my images end up in the main editor box and not my custom field.

    A

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘P2 Theme – Adding media buttons to reply field’ is closed to new replies.