inherit
140147
0
Nov 19, 2024 5:07:22 GMT -8
Nscalerr
Throw me to the wolves and I'll return leading the pack!
3,043
May 2009
nscalerr
|
Post by Nscalerr on Apr 30, 2017 1:48:22 GMT -8
railvillage.proboards.com/I have the following that goes to a users profile, but I would like it to not show for when a guest has posted, but still link to a normal users profile when they do a post. <a href="$[post.created_by.link.href]" class="button" role="button">$[post.created_by.name]'s Profile</a>
|
|
Kami
Forum Cat
Posts: 40,198
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,198
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Apr 30, 2017 9:19:56 GMT -8
to clarify, you want the button to appear based on whether or not the post is created by a member, rather than based on if the current user is a member?
|
|
inherit
140147
0
Nov 19, 2024 5:07:22 GMT -8
Nscalerr
Throw me to the wolves and I'll return leading the pack!
3,043
May 2009
nscalerr
|
Post by Nscalerr on Apr 30, 2017 19:06:32 GMT -8
When I am logged in to to the forum and look at a thread in the Guest Room created by a guest it has, ('s Profile) which looks odd, it would be better if the button was not showing for a post created by a guest.
|
|
Kami
Forum Cat
Posts: 40,198
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,198
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Apr 30, 2017 20:02:40 GMT -8
When I am logged in to to the forum and look at a thread in the Guest Room created by a guest it has, ('s Profile) which looks odd, it would be better if the button was not showing for a post created by a guest. Wrap the button in an if statement:
{if $[user.is_member]} stuff {/if}
|
|
inherit
140147
0
Nov 19, 2024 5:07:22 GMT -8
Nscalerr
Throw me to the wolves and I'll return leading the pack!
3,043
May 2009
nscalerr
|
Post by Nscalerr on Apr 30, 2017 20:54:04 GMT -8
Thanks Kami the if statement was where I was stuck, until you posted. The following one had the desired effect. {if $[current_user.is_member] && !$[post.created_by.is_guest]} stuff {/if}
|
|
Kami
Forum Cat
Posts: 40,198
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,198
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Apr 30, 2017 20:58:35 GMT -8
Glad you got it (: I'm not entirely sure why you'd have to declare that the post must be made by a member AND not a guest but /shrug whatever works!
|
|
inherit
140147
0
Nov 19, 2024 5:07:22 GMT -8
Nscalerr
Throw me to the wolves and I'll return leading the pack!
3,043
May 2009
nscalerr
|
Post by Nscalerr on Apr 30, 2017 22:11:26 GMT -8
After your comment I did a test and found that $[current_user.is_member] && is not actually needed, so have removed it.
|
|
Kami
Forum Cat
Posts: 40,198
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,198
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Apr 30, 2017 23:21:06 GMT -8
After your comment I did a test and found that $[current_user.is_member] && is not actually needed, so have removed it. :) "current user" should not be used in this instance at all. as stated, it only takes effect when the current user -- as in, the person who is viewing the page -- fulfills the conditions required.
This is why I asked if you wanted to have the button display if the person viewing was a member, or if the person who was posting was. the $[user] variable affects the latter, while $[current_user] affects the former.
If, as you stated, you wanted the button to appear only if the person who posted was a member, then the code I gave you originally should have worked. If it doesn't, could you post the template here and I'll have a look.
|
|
inherit
140147
0
Nov 19, 2024 5:07:22 GMT -8
Nscalerr
Throw me to the wolves and I'll return leading the pack!
3,043
May 2009
nscalerr
|
Post by Nscalerr on Apr 30, 2017 23:27:43 GMT -8
Think when I did the OP, I might confused myself with what I actually wanted.
{foreach $[post]} <tr id="$[post.content_id]" class="$[post.content_class]{if $[post.even]} even{/if}{if $[viewing_recent_posts]} recent{/if}"> <td class="$[post.unblocked_class]"> <table role="grid"> <tr> <td class="left-panel" rowspan="2"> $[post.created_by.miniprofile] </td> <td class="content"> <article> <div class="content-head ui-helper-clearfix"> <div class="info"> $[post.thread] <span class="date postby postid">by $[post.created_by.link], $[post.created_on], Id #$[post.id]</span><br /> {if $[post.how_posted]}<span class="post-method">via $[post.how_posted]</span>{/if} {if $[post.how_posted] && $[post.likes.user.dash_before]}<span class="$[post.likes.class]"> —</span>{/if} $[post.likes] </div> <div class="controls"> <!-- <a class="button" href="/">Home</a> --> {if $[current_user.is_member]} <a href="/post/new/$[post.thread.id]" class="button" role="button">Reply</a> $[post.quote_button] $[post.edit_button] $[post.likes.button] {/if} $[post.select_options] </div> </div> <h3 class="title aria-hidden">Post by $[post.created_by.name] on $[post.created_on]</h3> <div class="message">$[post.message]</div> </article> </td> </tr> <tr> <td class="foot">{if $[current_user.id] == "1" && $[post.ip]}<span style="font-size: 7pt; color: #A39480;">Ip: $[post.ip]</span>{/if} <!-- {if $[post.edited]} <div class="edited_by"><span class="italic">Last Edit:</span> $[post.edited.date] by $[post.edited.by_user]{if $[post.edited.reason]}: $[post.edited.reason]{/if}</div> {/if} --> <div class="up_down"> <a href="/" class="button" role="button">Home</a> {if $[current_user.is_member]} <a href="/post/new/$[post.thread.id]" class="button" role="button">Reply</a> {if !$[post.created_by.is_guest]} <a href="$[post.created_by.link.href]" class="button" role="button">$[post.created_by.name]'s Profile</a> <a href="$[post.created_by.pm_href]" role="button" class="button pm-button">Msg $[post.created_by.name]</a> {/if} {/if} <a onclick="scroll(0,0);" class="down_up button">Up</a> <a onclick="scroll(0,document.body.scrollHeight);" class="down_up button">Down</a> </div><br /> {if $[post.created_by.signature]} <div class="signature" style="font-family: 'Yellowtail', cursive; font-size: 10pt;">$[post.created_by.signature]</div> {/if} </td> </tr> </table> </td> {if $[post.is_blocked]} <td class="$[post.blocked_class] content center"> <div class="message note pad-bottom">This post is hidden</div> $[post.display_blocked_post_button] </td> {/if} </tr> {/foreach} {if !$[post]} <tr class="last"><td class="last center" colspan="1">No posts were found.</td></tr> {/if}
|
|
Kami
Forum Cat
Posts: 40,198
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,198
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on May 1, 2017 0:11:03 GMT -8
So what are you looking for, exactly? You have two options:
1. Show the button based on the poster's membership or guest status 2. Show the button based on the VIEWER's membership or guest status
?
|
|
inherit
140147
0
Nov 19, 2024 5:07:22 GMT -8
Nscalerr
Throw me to the wolves and I'll return leading the pack!
3,043
May 2009
nscalerr
|
Post by Nscalerr on May 1, 2017 1:27:06 GMT -8
What I have now is working, so I think we can close this one off. {if !$[post.created_by.is_guest]} <a href="$[post.created_by.link.href]" class="button" role="button">$[post.created_by.name]'s Profile</a> <a href="$[post.created_by.pm_href]" role="button" class="button pm-button">Msg $[post.created_by.name]</a> {/if}
|
|
Kami
Forum Cat
Posts: 40,198
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,198
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on May 1, 2017 1:42:32 GMT -8
sounds good! glad you sorted it (:
|
|