On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I always had trouble to activate things like badges and classes in the post view, and social buttons were not really even around when Discuss was first coded, that's a bit shocking but true.

    So, I discovered that all this stuff can be put into this file, which builds up ever single post: core/components/discuss/themes/default/chunks/post/disthreadpost.chunk.tpl

    Here is what the final result looks like, I was quite happy with it, as the post view went from being a very bland space to having color and icons and other stuff. https://www.rayxilawforums.com/forums/thread/164/necessary-v.-sufficient/

    I am sorry to say I cannot be sure exactly what was edited and what was not. I definitely did take out the buttons when making a new topic to choose whether to make a question or a discussion, and the default is discussion, so I didn't need to pull out all the code related to questions, if there is no button to choose question then there are no questions and that code never is used.

    The first part of this code is related to questions, then beginning with <div class="dis-post-left"> we have the left side of the post, which has the user name and avatar.

    For user classes, class "badges" and avatars, I found the documentation to be limited, so I just asked some developer friends to do them independent of the system. Badges are part of the Discuss system but I had no idea how to make them work at that time, so we just made our own.

    In this page, as default we had number of posts provided, and what we did was use that data to make classes and class badges. At that time I had little understanding of what data about the author we could access from this template, so we just used the one we knew we could get, which was user posts. Now I understand the system much better, and so I guess we could use other author data as well, such as number of threads started and so on. So user class and class badges begin with <li class="dis-usr-post-count">. We tried to calculate how quickly to let users move up, we wanted the advancement to start early but then slow down as number of posts went on.

    Avatars were a little tricker, there was a lot of changes that needed to be made in different places. The avatars have to be uploaded using the right code and the post view and profile view must be edited, I think those were the only places the avatar appears.

    Finally, social buttons, I wanted the social buttons to sit to the lower left, but had to be careful of the reply button which uses java to stay hidden until mouse-over. Not all of these buttons work to be honest. The "bookmark this" add on worked perfectly for me, as i could edit all the data easily.

    <li class="[[+class]] group-fix" id="dis-post-[[+id]]" data-author="[[+author.username:htmlent]]" data-date="[[+createdon_raw]]" data-message="[[+content_raw]]">
        [[+answer:neq=``:then=`
        <div class="dis-post-answer-marker">
            [[+answer_count:gt=`1`:then=`
                <nav>
                [[+answer_prev.link]]
                [[+answer_next.link]]
                </nav>
            `:else=``]]
    
            [[+url_mark_as_answer:eq=``:then=`
                <span title="[[%discuss.answer]]">[[%discuss.answer]]</span>
            `:else=`
            <a href="[[+url_mark_as_answer]]">
                <span title="[[%discuss.unflag_answer]]">[[%discuss.unflag_answer]]</span>
            </a>
            `]]
        </div>
        `:else=`
            <div class="dis-post-answer-marker dis-post-notanswer">
                [[+url_mark_as_answer:eq=``:then=``:else=`
                <div class="dis-post-answer-marker dis-post-notanswer">
                    <p>[[%discuss.flag_answer]]</p>
                    <a href="[[+url_mark_as_answer]]">
                        <span>[[%discuss.flag_answer]]</span>
                    </a>
                </div>
                `]]
            </div>
        `]]
        <!-- mark answer-->
        <div class="dis-post-left">
            <ul>
                <li class="dis-usr-icon">
                    <a href="[[DiscussUrlMaker? &action=`user` ¶ms=`{"type":"username", "user":"[[+author.username]]"}`]]" class="auth-avatar" title="[[%discuss.view_author_profile]]">
    <img src="assets/userfiles/[[+author.username]]/avatar.gif" alt="[[+author.username]]">
                        [[+author.title:notempty=`<span class="dis-usr-title">[[+author.title]]</span>`]]
                    </a>
                </li>
                <li class="dis-usr-post-count">
    [[+author.user:ismember=`Administrator`:then=`<div>Admin</div>
    `:else=`
    [[+author.user:ismember=`Forum Moderators`:then=`<div>Moderator</div>
    `:else=`
    [[+author.posts:gt=`0`:and:lte=`8`:then=`<div>Class 1</div>`]]
    [[+author.posts:gt=`8`:and:lte=`18`:then=`<div>Class 2</div>`]]
    [[+author.posts:gt=`18`:and:lte=`33`:then=`<div>Class 3</div>`]]
    [[+author.posts:gt=`33`:and:lte=`50`:then=`<div>Class 4</div>`]]
    [[+author.posts:gt=`50`:and:lte=`65`:then=`<div>Class 5</div>`]]
    [[+author.posts:gt=`65`:and:lte=`85`:then=`<div>Class 6</div>`]]
    [[+author.posts:gt=`85`:and:lte=`105`:then=`<div>Class 7</div>`]]
    [[+author.posts:gt=`105`:and:lte=`125`:then=`<div>Class 8</div>`]]
    [[+author.posts:gt=`125`:and:lte=`150`:then=`<div>Class 9</div>`]]
    [[+author.posts:gt=`150`:and:lte=`180`:then=`<div>Class 10</div>`]]
    [[+author.posts:gt=`180`:and:lte=`205`:then=`<div>Class 11</div>`]]
    [[+author.posts:gt=`205`:and:lte=`235`:then=`<div>Class 12</div>`]]
    [[+author.posts:gt=`235`:and:lte=`270`:then=`<div>Class 13</div>`]]
    [[+author.posts:gt=`270`:and:lte=`310`:then=`<div>Class 14</div>`]]
    [[+author.posts:gt=`310`:and:lte=`9990`:then=`<div>Class 15</div>`]]
    `]]
    `]] 
                </li>
                
                
                
                
                
    <li class="rrank">
    [[+author.posts:gt=`0`:and:lte=`5`:then=`<div class="s1"></div>`]]
    [[+author.posts:gt=`5`:and:lte=`10`:then=`<div class="s2"></div>`]]
    [[+author.posts:gt=`10`:and:lte=`15`:then=`<div class="sp1"></div><div class="s1"></div>`]]
    [[+author.posts:gt=`15`:and:lte=`20`:then=`<div class="sp2"></div>`]]
    [[+author.posts:gt=`20`:and:lte=`30`:then=`<div class="st1"></div><div class="sp1"></div>`]]
    [[+author.posts:gt=`30`:and:lte=`40`:then=`<div class="st2"></div>`]]
    [[+author.posts:gt=`40`:and:lte=`50`:then=`<div class="gt1"></div><div class="st1"></div>`]]
    [[+author.posts:gt=`50`:and:lte=`75`:then=`<div class="gt2"></div>`]]
    [[+author.posts:gt=`75`:and:lte=`100`:then=`<div class="ft1"></div><div class="gt1"></div>`]]
    [[+author.posts:gt=`100`:and:lte=`120`:then=`<div class="ft2"></div>`]]
    [[+author.posts:gt=`120`:and:lte=`140`:then=`<div class="ga1"></div><div class="ft1"></div>`]]
    [[+author.posts:gt=`140`:and:lte=`160`:then=`<div class="ga2"></div>`]]
    [[+author.posts:gt=`160`:and:lte=`180`:then=`<div class="rat1"></div><div class="ga1"></div>`]]
    [[+author.posts:gt=`180`:and:lte=`200`:then=`<div class="rat2"></div>`]]
    [[+author.posts:gt=`200`:and:lte=`220`:then=`<div class="glt1"></div>`]]
    [[+author.posts:gt=`220`:and:lte=`240`:then=`<div class="glt1"></div><div class="s1"></div>`]]
    [[+author.posts:gt=`240`:and:lte=`270`:then=`<div class="glt1"></div><div class="sp1"></div>`]]
    [[+author.posts:gt=`270`:and:lte=`300`:then=`<div class="glt1"></div><div class="st1"></div>`]]
    [[+author.posts:gt=`300`:and:lte=`350`:then=`<div class="glt1"></div><div class="gt1"></div>`]]
    [[+author.posts:gt=`350`:and:lte=`400`:then=`<div class="glt1"></div><div class="ft1"></div>`]]
    [[+author.posts:gt=`400`:and:lte=`500`:then=`<div class="glt1"></div><div class="rat1"></div>`]]
    [[+author.posts:gt=`500`:and:lte=`600`:then=`<div class="glt2"></div>`]]
    
    </li>
    
    
                <a href="[[DiscussUrlMaker? &action=`messages/new` ¶ms=`{"user":"[[+author.username]]"}`]]" class="dis-pm-btn">Send PM</a>
            </ul>
        </div>
        <div class="dis-post-right">
            <div class="title">
                <strong>[[+author.username_link]]</strong> <a class="normal-type" href="[[+url]]" title="[[%discuss.post_link]]">
                Reply #[[+idx]], <span title="[[+createdon]]">[[+createdon:ago]]</span></a>
                [[+action_modify:notempty=`<ul class="dis-content-actions">[[+action_modify]][[+action_remove]][[+action_spam]]</ul>`]]
            </div>
            <div class="dis-content">
                [[+content]]
    <div style="float:right; margin-top:20px; margin-right:10px; margin-bottom:5px;"><p><span style="font-size:14px; font-weight:600; color:#808080;">Share This Thread:</span>  <a target="_blank" href="https://plusone.google.com/_/+1/confirm?url=[[+url]]"><img src="assets/components/bookmarkthis/images/v1.4/google plus.png" style="max-width:18px; max-height:18px; border:1px groove silver;" /></a> <a target="_blank" href="http://share.renren.com/share/buttonshare.do?link=[[+url]]&title=[[+content_raw:ellipsis]]"><img src="assets/components/bookmarkthis/images/v1.4/renren.png" style="max-width:18px; max-height:18px; border:1px groove silver;" /></a> <a target="_blank" href="http://www.facebook.com/sharer/sharer.php?u=[[+url]]"><img src="assets/components/bookmarkthis/images/v1.4/facebook.png" style="max-width:18px; max-height:18px; border:1px groove silver;" /></a> <a target="_blank" href="http://service.weibo.com/share/share.php?url=[[+url]]&appkey=&title=[[+content_raw:ellipsis=`80`]]"><img src="assets/components/bookmarkthis/images/v1.4/weibo.png" style="max-width:18px; max-height:18px; border:1px groove silver;" /></a> <a target="_blank" href="https://twitter.com/intent/tweet?text=[[+content_raw:ellipsis=`80`]]&url=[[+url]]&via="rayxilawforums"><img src="assets/components/bookmarkthis/images/v1.4/twitter.png" style="max-width:18px; max-height:18px; border:1px groove silver;" /></a> <a target="_blank" href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=[[+url]]&title=[[+content_raw:ellipsis=`80`]]"><img src="assets/components/bookmarkthis/images/v1.4/qqzone.png" style="max-width:18px; max-height:18px; border:1px groove silver;" /></a> </div>
                [[+discuss.user.shouldMarkAnAnswer:eq=`1`:then=`
                    [[+idx:eq=`1`:then=`
                        <div class="dis-info"><p>[[%discuss.mark_answer_instructions]] <a id="Show-answer-link" href="#">[[%discuss.mark_answer_link]]</a></p></div>
                    `:else=``]]
                `:else=``]]
                [[+idx:eq=`1`:then=`
                    [[+answer_count:neq=`0`:then=`
                        <div class="dis-info"><p>[[+jump_to_first_answer.explanation]] [[+jump_to_first_answer.link]]</p></div>
                    `:else=``]]
                `:else=``]]
                [[+attachments:notempty=`<div class="dis-post-attachments"><ul class="dis-attachments">[[+attachments]]</ul></div>`]]
                [[+editedby:is=`0`:then=``:else=`<span class="dis-post-editedon">[[%discuss.editedon_post? &on=`[[+editedon:ago]]` &user=`[[+editedby.username]]`]]</span>`]]
            </div>
            <ul class="dis-action-btn">[[+report_link]][[+action_reply]]</ul>
        </div>
        [[+author.signature:notempty=`<div class="dis-signature">[[+author.signature]]</div>`]]
    </li>
    • Hmm social button code isn't in that snippet, will have to seek it out somewhere. Thought it should be in that same template...and still think so
      • I don't know why the code was missing the social buttons, here is the whole of the file:

        <li class="[[+class]] group-fix" id="dis-post-[[+id]]" data-author="[[+author.username:htmlent]]" data-date="[[+createdon_raw]]" data-message="[[+content_raw]]">
            [[+answer:neq=``:then=`
            <div class="dis-post-answer-marker">
                [[+answer_count:gt=`1`:then=`
                    <nav>
                    [[+answer_prev.link]]
                    [[+answer_next.link]]
                    </nav>
                `:else=``]]
        
                [[+url_mark_as_answer:eq=``:then=`
                    <span title="[[%discuss.answer]]">[[%discuss.answer]]</span>
                `:else=`
                <a href="[[+url_mark_as_answer]]">
                    <span title="[[%discuss.unflag_answer]]">[[%discuss.unflag_answer]]</span>
                </a>
                `]]
            </div>
            `:else=`
                <div class="dis-post-answer-marker dis-post-notanswer">
                    [[+url_mark_as_answer:eq=``:then=``:else=`
                    <div class="dis-post-answer-marker dis-post-notanswer">
                        <p>[[%discuss.flag_answer]]</p>
                        <a href="[[+url_mark_as_answer]]">
                            <span>[[%discuss.flag_answer]]</span>
                        </a>
                    </div>
                    `]]
                </div>
            `]]
            <!-- mark answer-->
            <div class="dis-post-left">
                <ul>
                    <li class="dis-usr-icon">
                        <a href="[[DiscussUrlMaker? &action=`user` &params=`{"type":"username", "user":"[[+author.username]]"}`]]" class="auth-avatar" title="[[%discuss.view_author_profile]]">
        <img src="assets/userfiles/[[+author.username]]/avatar.gif" alt="[[+author.username]]">
                            [[+author.title:notempty=`<span class="dis-usr-title">[[+author.title]]</span>`]]
                        </a>
                    </li>
                    <li class="dis-usr-post-count">
        [[+author.user:ismember=`Administrator`:then=`<div>Admin</div>
        `:else=`
        [[+author.user:ismember=`Forum Moderators`:then=`<div>Moderator</div>
        `:else=`
        [[+author.posts:gt=`0`:and:lte=`8`:then=`<div>Legal Intern</div>`]]
        [[+author.posts:gt=`8`:and:lte=`18`:then=`<div>Law Clerk </div>`]]
        [[+author.posts:gt=`18`:and:lte=`33`:then=`<div>Summer Associate</div>`]]
        [[+author.posts:gt=`33`:and:lte=`50`:then=`<div>Baby Lawyer</div>`]]
        [[+author.posts:gt=`50`:and:lte=`65`:then=`<div>Global Associate</div>`]]
        [[+author.posts:gt=`65`:and:lte=`85`:then=`<div>Lateral Hire</div>`]]
        [[+author.posts:gt=`85`:and:lte=`105`:then=`<div>Junior Associate</div>`]]
        [[+author.posts:gt=`105`:and:lte=`125`:then=`<div>In-House Counsel</div>`]]
        [[+author.posts:gt=`125`:and:lte=`150`:then=`<div>Senior Associate</div>`]]
        [[+author.posts:gt=`150`:and:lte=`180`:then=`<div>Non-Equity Partner</div>`]]
        [[+author.posts:gt=`180`:and:lte=`205`:then=`<div>Rainmaker</div>`]]
        [[+author.posts:gt=`205`:and:lte=`235`:then=`<div>Equity Partner</div>`]]
        [[+author.posts:gt=`235`:and:lte=`270`:then=`<div>Senior Partner</div>`]]
        [[+author.posts:gt=`270`:and:lte=`310`:then=`<div>Attorney Emeritus</div>`]]
        [[+author.posts:gt=`310`:and:lte=`9990`:then=`<div>Of Counsel</div>`]]
        `]]
        `]] 
                    </li>
                    
                    
                    
                    
                    
        <li class="rrank">
        [[+author.posts:gt=`0`:and:lte=`5`:then=`<div class="s1"></div>`]]
        [[+author.posts:gt=`5`:and:lte=`10`:then=`<div class="s2"></div>`]]
        [[+author.posts:gt=`10`:and:lte=`15`:then=`<div class="sp1"></div><div class="s1"></div>`]]
        [[+author.posts:gt=`15`:and:lte=`20`:then=`<div class="sp2"></div>`]]
        [[+author.posts:gt=`20`:and:lte=`30`:then=`<div class="st1"></div><div class="sp1"></div>`]]
        [[+author.posts:gt=`30`:and:lte=`40`:then=`<div class="st2"></div>`]]
        [[+author.posts:gt=`40`:and:lte=`50`:then=`<div class="gt1"></div><div class="st1"></div>`]]
        [[+author.posts:gt=`50`:and:lte=`75`:then=`<div class="gt2"></div>`]]
        [[+author.posts:gt=`75`:and:lte=`100`:then=`<div class="ft1"></div><div class="gt1"></div>`]]
        [[+author.posts:gt=`100`:and:lte=`120`:then=`<div class="ft2"></div>`]]
        [[+author.posts:gt=`120`:and:lte=`140`:then=`<div class="ga1"></div><div class="ft1"></div>`]]
        [[+author.posts:gt=`140`:and:lte=`160`:then=`<div class="ga2"></div>`]]
        [[+author.posts:gt=`160`:and:lte=`180`:then=`<div class="rat1"></div><div class="ga1"></div>`]]
        [[+author.posts:gt=`180`:and:lte=`200`:then=`<div class="rat2"></div>`]]
        [[+author.posts:gt=`200`:and:lte=`220`:then=`<div class="glt1"></div>`]]
        [[+author.posts:gt=`220`:and:lte=`240`:then=`<div class="glt1"></div><div class="s1"></div>`]]
        [[+author.posts:gt=`240`:and:lte=`270`:then=`<div class="glt1"></div><div class="sp1"></div>`]]
        [[+author.posts:gt=`270`:and:lte=`300`:then=`<div class="glt1"></div><div class="st1"></div>`]]
        [[+author.posts:gt=`300`:and:lte=`350`:then=`<div class="glt1"></div><div class="gt1"></div>`]]
        [[+author.posts:gt=`350`:and:lte=`400`:then=`<div class="glt1"></div><div class="ft1"></div>`]]
        [[+author.posts:gt=`400`:and:lte=`500`:then=`<div class="glt1"></div><div class="rat1"></div>`]]
        [[+author.posts:gt=`500`:and:lte=`600`:then=`<div class="glt2"></div>`]]
        
        </li>
        
        
                    <a href="[[DiscussUrlMaker? &action=`messages/new` &params=`{"user":"[[+author.username]]"}`]]" class="dis-pm-btn">Send PM</a>
                </ul>
            </div>
            <div class="dis-post-right">
                <div class="title">
                    <strong>[[+author.username_link]]</strong> <a class="normal-type" href="[[+url]]" title="[[%discuss.post_link]]">
                    Reply #[[+idx]], <span title="[[+createdon]]">[[+createdon:ago]]</span></a>
                    [[+action_modify:notempty=`<ul class="dis-content-actions">[[+action_modify]][[+action_remove]][[+action_spam]]</ul>`]]
                </div>
                <div class="dis-content">
                    [[+content]]
        <div style="float:right; margin-top:20px; margin-right:10px; margin-bottom:5px;"><p><span style="font-size:14px; font-weight:600; color:#808080;">Share This Thread:</span>  <a target="_blank" href="https://plusone.google.com/_/+1/confirm?url=[[+url]]"><img src="assets/components/bookmarkthis/images/v1.4/google plus.png" style="max-width:18px; max-height:18px; border:1px groove silver;" /></a> <a target="_blank" href="http://share.renren.com/share/buttonshare.do?link=[[+url]]&title=[[+content_raw:ellipsis]]"><img src="assets/components/bookmarkthis/images/v1.4/renren.png" style="max-width:18px; max-height:18px; border:1px groove silver;" /></a> <a target="_blank" href="http://www.facebook.com/sharer/sharer.php?u=[[+url]]"><img src="assets/components/bookmarkthis/images/v1.4/facebook.png" style="max-width:18px; max-height:18px; border:1px groove silver;" /></a> <a target="_blank" href="http://service.weibo.com/share/share.php?url=[[+url]]&appkey=&title=[[+content_raw:ellipsis=`80`]]"><img src="assets/components/bookmarkthis/images/v1.4/weibo.png" style="max-width:18px; max-height:18px; border:1px groove silver;" /></a> <a target="_blank" href="https://twitter.com/intent/tweet?text=[[+content_raw:ellipsis=`80`]]&url=[[+url]]&via="rayxilawforums"><img src="assets/components/bookmarkthis/images/v1.4/twitter.png" style="max-width:18px; max-height:18px; border:1px groove silver;" /></a> <a target="_blank" href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=[[+url]]&title=[[+content_raw:ellipsis=`80`]]"><img src="assets/components/bookmarkthis/images/v1.4/qqzone.png" style="max-width:18px; max-height:18px; border:1px groove silver;" /></a> </div>
                    [[+discuss.user.shouldMarkAnAnswer:eq=`1`:then=`
                        [[+idx:eq=`1`:then=`
                            <div class="dis-info"><p>[[%discuss.mark_answer_instructions]] <a id="Show-answer-link" href="#">[[%discuss.mark_answer_link]]</a></p></div>
                        `:else=``]]
                    `:else=``]]
                    [[+idx:eq=`1`:then=`
                        [[+answer_count:neq=`0`:then=`
                            <div class="dis-info"><p>[[+jump_to_first_answer.explanation]] [[+jump_to_first_answer.link]]</p></div>
                        `:else=``]]
                    `:else=``]]
                    [[+attachments:notempty=`<div class="dis-post-attachments"><ul class="dis-attachments">[[+attachments]]</ul></div>`]]
                    [[+editedby:is=`0`:then=``:else=`<span class="dis-post-editedon">[[%discuss.editedon_post? &on=`[[+editedon:ago]]` &user=`[[+editedby.username]]`]]</span>`]]
                </div>
                <ul class="dis-action-btn">[[+report_link]][[+action_reply]]</ul>
            </div>
            [[+author.signature:notempty=`<div class="dis-signature">[[+author.signature]]</div>`]]
        </li>