WordPress.org

Ready to get started?Download WordPress

Forums

Multiple comment areas which submit at one time (1 post)

  1. GiantChairDesign
    Member
    Posted 8 years ago #

    I am currently trying to adapt a wordpress blog for an exisiting script (as in documentary script) editing/commenting process. Here’s what needs to happen:

    1. A user will login to the site. They click on a link to a particular script.

    2. The script page opens. The user sees a four-column table layout. The first column has an id number (1, 2, 3… this is a reference number for a particular part of the script). The next cell holds an image related to that part of the script. The third cell holds the couple lines of the script (now, I don’t care whether or not this is held in the database or hard-coded… I’m focusing on the comment system). The fourth and final cell holds a textarea box for comments related to that bit of script. This 4-column row layout repeats for chunks of the script down the page (around 50 rows).

    3. The user reads the script and types comments in the text boxes. When finished, the user clicks a submit button at the bottom of the page to enter their comments.

    4. Comments should not appear on that page. What I would like to have happen is have the logged-in user’s comments (if they have made any) appear in the text boxes when they return so they can pick up where they left off or add/change their comments.

    5. Past a particular deadline (can be automated or not), the comment boxes will be replaced with a compiled list of each user’s comments for each row.

    I have managed to change the layout to what I’d like and have the submit button submit an array (see code below) as the comment, which is then changed in the posting comments function to:

    $comment_content = trim(serialize($_POST['comment']));

    I can see this in my admin panel, and right now also on the single post page, but can’t get it to appear in the text boxes. Does anyone have any pointers for me, or perhaps a better way of going about this? Or should I not use wordpress and build the functionality myself?

    <?php get_header(); ?>

    <!-- content ................................. -->
    <div id="content">

    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    <div id="content" class="widecolumn" style="width: 600px; margin-left: 70px;">

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php // Do not delete these lines
    if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    die ('Please do not load this page directly. Thanks!');

    if (!empty($post->post_password)) { // if there's a password
    if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
    ?>

    <p class="nocomments">This post is password protected. Enter the password to view comments.<p>

    <?php
    return;
    }
    }

    /* This variable is for alternating comment background */
    $oddcomment = 'alt';
    ?>

    <div class="navigation">
    <div class="alignleft"><a href="/">&laquo; back to home</a></div>
    <div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
    </div>
    <h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">Unit 1: Rough Draft</a></h2>
    <table cellpadding="5" cellspacing="5">
    <tr>
    <!--comment id# in this page -->
    <td valign="top" ><p><strong>1</strong></p></td>
    <!--related image in this page -->
    <td valign="top"><img src="/wp-content/themes/default/images/audio.jpg" width="75" height="90"></td>
    <td valign="top">
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer hendrerit nunc. Sed augue turpis, dignissim sed, posuere et, rutrum vel, felis. Suspendisse dapibus, nibh ut vulputate euismod, sapien lectus scelerisque tellus, ac commodo nulla mi a lacus. Ut sem libero,
    </td>
    <!--comments in this page -->
    <td valign="top">

    <!-- You can start editing here. -->

    <p>
    <p><textarea name="comment[1.1.1]" id="comment[1.1.1]" value="1" cols="50" rows="10" tabindex="4"><?php echo get_lastcommentmodified() ?></textarea>
    </p>

    </td>
    </tr>
    <tr>
    <!--comment id# in this page -->
    <td valign="top" ><p><strong>2</strong></p></td>
    <!--related image in this page -->
    <td valign="top"><img src="/wp-content/themes/default/images/audio.jpg" width="75" height="90"></td>
    <td valign="top">

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer hendrerit nunc. Sed augue turpis, dignissim sed, posuere et, rutrum vel, felis. Suspendisse dapibus, nibh ut vulputate euismod, sapien lectus scelerisque tellus, ac commodo nulla mi a lacus. Ut sem libero,
    </td>
    <!--comments in this page -->
    <td valign="top">

    <!-- You can start editing here. -->

    <p>
    <p><textarea name="comment[1.1.2]" id="comment[1.1.2]" value="02" cols="50" rows="10" tabindex="4"><?php echo $post; ?></textarea>
    </p>

    </td>
    </tr>

    <!--comments submit button -->
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td>
    <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    </p>
    <?php do_action('comment_form', $comments->ID); ?></form></td>
    </tr>
    </table>
    <?php endwhile; else: ?>
    <p>Sorry, no posts matched your criteria.</p>
    <?php endif; ?>

    </div>
    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <?php endwhile; ?>

    <?php else : ?>

    <h2>Not Found</h2>
    <p>"Sorry, but you are looking for something that isn't here.</p>

    <?php endif; ?>

    <?php comments_template(); ?>

    </div> <!-- /content -->

    <?php get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic