Module

Archived
Forum
(read-only)


For official support, visit the official support site »

Threaded Comments

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Yuri Salimovskiy

     

Unable to display conditionally-tagged commenter data inside threaded_comments tag pair

Support Request

Lesli
Lesli

Hello,

I don’t know if this issue is related to this or not:
http://devot-ee.com/add-ons/support/threaded-comments/viewthread/5349

But what I’m trying to do is essentially create an enhanced commenter byline:
if a particular commenter is not banned (group_id is anything but 2), display the commenter’s URL, Twitter, FB, and other information pulled from the commenter’s member profile

if a particular commenter is Banned (group_id = 2_, instead display the byline-message “This member has been banned for violating community guidelines”

The code I’m trying to use is

{exp:member:custom_profile_data}
{if group_id 
!= '2'}{url_or_email_as_author}
{if url 
!= ''}<a href="{url}" target="_blank">site</a>{/if}
{if twitter 
!= ''}<a href="https://twitter.com/{twitter}" target="_blank">Twitter</a>{/if}
{if fb_username 
!= ''}<a href="{fb_username}" target="_blank">FB</a>{/if}
{
/if}
{if group_id 
== '2'}{username} 
(Member has been banned for violating community guidelines){/if} :: 
{comment_date format="%Y-%m-%d"}{/exp:member:custom_profile_data} 

The correct member data is pulled and displayed, for each commenter. However, the member data is pulled and displayed even if the commenter is Banned (group_id == 2). I’ve checked with the folks in the EE support forum, and either I’m miscommunicating what I want to do…or the tag isn’t working as expected, inside the exp:threaded_comments:display tag pair.

Am I just using the wrong syntax?

Lesli
# 1
Lesli

Hello,

Any feedback on this? I’m trying to post this member data only if the commenter-in-question has not been banned.

Yuri Salimovskiy
# 2
Developer
Yuri Salimovskiy

Hello Lesli,

sorry I thought I have replied to this.
Please try using

{if '{group_id}' == '2'

instead

Lesli
# 3
Lesli

Thanks, Yuri. I’ll give that a shot!

Lesli
# 4
Lesli

...and indeed, that did it. For anyone else who may be running into this issue, or who may just want to replicate this layout, the syntax I am using now is:

{exp:member:custom_profile_data}
{if 
'{group_id}' != '2'}
{url_or_email_as_author}
{if url 
!= ''}<a href="{url}" target="_blank">site</a>{/if}
{if twitter 
!= ''}<a href="https://twitter.com/{twitter}" target="_blank">Twitter</a>{/if}
{if fb_username 
!= ''}<a href="{fb_username}" target="_blank">FB</a>{/if}
{
/if}
{if 
'{group_id}' == '2'}
{username} 
(Member has been banned)
{/if}
 
:: {comment_date format="%Y-%m-%d"}{/exp:member:custom_profile_data} 
PP
# 5
PP

Hi,

I think I have a similar problem. group_id always returns the logged_in_group_id.
This is my code. I tried {if “{group_id}”!=“5”} but this didn’t work, too.
With EEs native comment module it was working fine.

{exp:threaded_comments:display entry_id="{segment_2}" form_class="cf" channel="projects" sort="asc"}
 
<ul id="comments-list">
 
{comments}
  
<li class="cf{if entry_author_id=="{author_id}"} author{/if}">
   <
div class="comment">
    <
div class="tip"><span>by</span></div>
    <
h3>{if group_id!="5"}PRO{/if}<a href="{site_url}{username}">{if screen_name}{name}{if:else}{username}{/if}</a></h3>
    
{comment}
   
</div>
  
  </
li>
 
{/comments}
 
</ul>
{/exp:threaded_comments:display} 
Yuri Salimovskiy
# 6
Developer
Yuri Salimovskiy

Hi Philip,

try updating to latest version (just released) and using {member_group_id} variable as alternative

PP
# 7
PP

Thanks it’s working now!