Users can't comment on discussions or view course units in CoursePress

There's only one unit already created in the course and students can’t view it not either post comments on it.

  • Predrag Dubajic

    Hey Dorie,

    Hope you're doing well :slight_smile:

    I had a look at your course and I can see that the course availability is set to 23. January and that's why it's not accessible yet.

    If you edit your course and go to Step 4 - Course Dates you can set the date to either today or some past date and after that your course will be available to students.

    Let us know if everything is in order after changing this.

    Best regards,
    Predrag

  • Predrag Dubajic

    Hi Dorie,

    Chats can sometimes be hectic and CoursePress has a lot of options so something can be easily missed.

    As for the comment section, I'm afraid that the issue here is the Divi theme and how it handles comments with its own custom comments form.
    At the moment only way is to edit CoursePress files in order to include Divi form.
    You can do this by editing /wp-content/plugins/coursepress/2.0/include/coursepress/template/class-communication.php on line 182 and replace this line of code:
    comments_template();

    With this:

    $comments = get_comments(array(
                                    'post_id' => $discussion->ID,
                                    'number' => '2' ));
    
                            foreach( $comments as $comment )
                            {
                                    ?>
                                    <article id="comment-<?php $comment->ID ?>" class="comment-body clearfix">
                                            <div class="comment_avatar">
                                                    <?php echo get_avatar( $comment->comment_author_email ); ?>
                                            </div>
    
                                            <div class="comment_postinfo">
                                                    <span class="fn"><a href="https://wordpress.org/" rel="external nofollow" class="url"><?php echo $comment->comment_author; ?></a></span> <span class="comment_date">on <?php echo date_i18n( get_option( 'date_format' ), strtotime( $comment->comment_date ) ); ?> <?php echo date_i18n( get_option( 'time_format' ), strtotime( $comment->comment_date ) ); ?></span>
                                            </div> <!-- .comment_postinfo -->
    
                                            <div class="comment_area">
                                                    <div class="comment-content clearfix">
                                                            <?php echo $comment->comment_content ?>
                                                    </div> <!-- end comment_area-->
                                            </div>
                                    </article>
                                    <?php
                            }
    
                            comment_form( array('label_submit' => esc_attr__( 'Post Comment', 'Divi' ), 'title_reply' => '<span>' . esc_attr__( 'Submit a Comment', 'Divi' ) . '</span>', 'title_reply_to' => esc_attr__( 'Leave a Reply to %s', 'Divi' ), 'class_submit' => 'submit et_pb_button' ) );

    Note that this change will be gone when CoursePress is updated so you will need to apply the change again.

    Best regards,
    Predrag

  • Adam Czajczyk

    Hello dorie

    Fortunately, this is only a matter of styling so it can be fixed with CSS.

    To keep user avatar but make it look better, use this code:

    .course_discussion .comment_avatar {
    max-width:80px;
    }

    Alternatively, if you want to remove avatar completely, use this code instead:

    .course_discussion .comment_avatar {
    display:none;
    }

    To apply selected one to the site, add it to "Appearance -> Customize -> Additional CSS" option or via "Custom CSS" option in Theme Options (if there is such option).

    Best regards,
    Adam