solved Moving Profile comment form ABOVE the comment list

Elise
Elise
@elise
8 years ago
249 posts
My site is 9 years old and some of my members have an encyclopedia of comments.
For example: http://empathcommunity.eliselebeau.com/bing

To write a comment, you need to scroll down (a lot) to get to the form to post a new comment.

I would like to move the comment form above the comment item list.
I found the skin profile_index.tpl where I "think" this is happening. But I don't see how to change the order in here...

   {* Profile Comments section *}
        {if jrCore_module_is_active('jrComment')}
        <div class="row">
            <div class="col12 last">
                <div class="block">
                    <div class="title">
                        <h3>{jrCore_lang skin=$_conf.jrCore_active_skin id="37" default="Comments"}</h3>
                    </div>
                    <div class="block_content">
                        <div class="item">
                            {* bring in module features *}
                            {jrCore_db_get_item module="jrProfile" item_id=$_profile_id assign="item"}
                            {jrCore_item_detail_features module="jrProfile" item=$item}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {/if}  

updated by @elise: 12/29/16 11:48:15AM
paul
@paul
8 years ago
4,326 posts
Hi Elise
The template you want is the jrComment comment_form.tpl -
{jrCore_module_url module="jrComment" assign="curl"}
<a id="{$jrComment.unique_id}_cm_section"></a>
<a id="comment_section"></a>

<div id="{$jrComment.unique_id}_comments" class="comment_page_section">

    {* see if profile owners can delete *}
    {assign var="profile_owner_id" value=0}
    {if $_user.user_active_profile_id == $_item._profile_id && $_item.quota_jrComment_profile_delete == 'on'}
        {assign var="profile_owner_id" value=$_item._profile_id}
    {/if}

    {if $jrComment.pagebreak > 0}
        {jrCore_list module="jrComment" search1="comment_item_id = `$jrComment.item_id`" search2="comment_module = `$jrComment.module`" order_by="_item_id `$_conf.jrComment_direction`" profile_owner_id=$profile_owner_id pagebreak=$_conf.jrComment_pagebreak page=1 pager=true pager_template="comment_pager.tpl"}
    {else}
        {jrCore_list module="jrComment" search1="comment_item_id = `$jrComment.item_id`" search2="comment_module = `$jrComment.module`" order_by="_item_id `$_conf.jrComment_direction`" limit="500" profile_owner_id=$profile_owner_id}
    {/if}

</div>

{if jrUser_is_logged_in() && $_user.quota_jrComment_allowed == 'on'}

    <div id="comment_form_holder">
    <div id="comment_form_section">

        <div id="{$jrComment.unique_id}_cm_notice" class="item error" style="display:none;">
            {* any comment error loads here *}
        </div>

        {if $_conf.jrComment_threading == 'on' && $_conf.jrComment_editor == 'on'}
        <div id="comment_reply_to" class="item success" style="display:none;">
            {* small note about how you are replying to when editor is enabled *}
            {jrCore_lang module="jrComment" id=18 default="Your Reply To:"} <strong><span id="comment_reply_to_user"></span></strong>
        </div>
        {/if}

        <div class="item" style="display:table">
            <div style="display:table-row">
                <div class="p5" style="display:table-cell;width:5%;vertical-align:top;">
                    {jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$_user._user_id size="small" alt=$item.user_name class="action_item_user_img iloutline" _v=$_user.user_image_time}
                </div>
                <div class="p5" style="display:table-cell;width:95%;padding:5px 12px;">

                    <a id="cform"></a>
                    <form id="{$jrComment.unique_id}_form" action="{$jamroom_url}/{$curl}/comment_save" method="POST" onsubmit="jrPostComment('#{$jrComment.unique_id}', 'undefined', 500, '{$_conf.jrComment_editor}');return false">

                        <input type="hidden" id="{$jrComment.unique_id}_cm_module" name="comment_module" value="{$jrComment.module}">
                        <input type="hidden" id="{$jrComment.unique_id}_cm_profile_id" name="comment_profile_id" value="{$jrComment.profile_id}">
                        <input type="hidden" id="{$jrComment.unique_id}_cm_item_id" name="comment_item_id" value="{$jrComment.item_id}">
                        <input type="hidden" id="{$jrComment.unique_id}_cm_order_by" name="comment_order_by" value="{$_conf.jrComment_direction}">
                        <input type="hidden" id="comment_parent_id" name="comment_parent_id" value="0">

                        {if isset($_conf.jrComment_editor) && $_conf.jrComment_editor == 'on' && !jrCore_is_mobile_device()}
                            {jrCore_editor_field name="comment_text"}
                        {else}
                            <textarea id="comment_text" name="comment_text" cols="40" rows="5" class="form_textarea {$jrComment.class}" style="height:64px;width:98%;{$jrComment.style}"></textarea><br>
                        {/if}
                        <div style="vertical-align:middle">
                            {jrCore_lang module="jrCore" id="73" default="working..." assign="working"}
                            {jrCore_image image="form_spinner.gif" id="`$jrComment.unique_id`_fsi" width="24" height="24" alt=$working style="margin:8px 8px 0px 8px;display:none"}<input id="{$jrComment.unique_id}_cm_submit" type="submit" value="{jrCore_lang module="jrComment" id="2" default="Save Comment"}" class="form_button {$jrComment.class}" style="margin-top:8px;{$jrComment.style}">
                        </div>

                        {if $_user.quota_jrComment_attachments == 'on'}
                        <div class="jrcomment_upload_attachment">
                            {jrCore_upload_button module="jrComment" field="comment_file" allowed="`$_user.quota_jrComment_allowed_file_types`" multiple="true"}
                        </div>
                        {/if}
                        <div style="clear:both"></div>

                    </form>

                </div>
            </div>
        </div>
    </div>
    </div>

{elseif jrUser_is_logged_in() === false}

    {jrCore_module_url module="jrUser" assign="url"}
    <div class="item"><div class="p5"><a href="{$jamroom_url}/{$url}/login">{jrCore_lang module="jrComment" id="16" default="You must be logged in to post a comment"}</a></div></div>

{/if}

If you look at this code you see that its in two sections. Lines 5-19 display all the comments whilst lines 21-83 display the form so I think you should be able to jusr cut lines 5-19 and paste them at the end after the form section.


--
Paul Asher - JR Developer and System Import Specialist
Elise
Elise
@elise
8 years ago
249 posts
OH! Thanks! It works!
joanna
@joanna
8 years ago
88 posts
Thank you @Paul for this tip.

It works on our site, and I like it.
Strumelia
Strumelia
@strumelia
8 years ago
3,603 posts
I'm assuming this would then shift the comment editor box to the top of ALL comment sections on our site- comments on profiles, on videos, on photos, and on Group Comment walls as well? Or is it do-able only on profile pages?


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
joanna
@joanna
8 years ago
88 posts
It moved all of the comment boxes to the top.
updated by @joanna: 09/29/16 10:58:03AM
brian
@brian
8 years ago
10,148 posts
I'm assuming you are listing comments NEWEST to oldest.. otherwise a comment box at the top doesn't make sense. If I scroll to the bottom of a comment list, then I would have to scroll "up" to post my comment. The "quote" option is also going to feel a bit weird.

My opinion of course :)


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
joanna
@joanna
8 years ago
88 posts
Yes, you are assuming correctly. For a while our comments are from the newest to the oldest.
:)
Strumelia
Strumelia
@strumelia
8 years ago
3,603 posts
I just now did this on both my sites as well. Thanks everyone! A nice little touch. :)


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015

Tags