1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Show "follow" to guests

Discussion in 'Styling and Customization Questions' started by Luke B, Oct 25, 2011.

  1. Luke B

    Luke B Active Member

    Hello all,

    I would like to show "follow" in the user profile pages as well as the user card to guests. When they click it, it will obviously take them to the "you must be a member..."page.

    How would I achieve this?

    Thank you
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Appearance -> Templates -> member_card

    Add the red code:

    Code:
    		<div class="userLinks">
    		<xen:hook name="member_card_links">
    			<a href="{xen:link members, $user}">{xen:phrase profile_page}</a>
    			<xen:if is="{$visitor.user_id} AND {$user.user_id} != {$visitor.user_id}">
    				<xen:if is="{$canStartConversation}"><a href="{xen:link conversations/add, '', 'to={$user.username}'}">{xen:phrase start_conversation}</a></xen:if>
    				<xen:follow user="$user" class="Tooltip" />
    				<xen:if is="{xen:helper isIgnored, $user.user_id}"><a href="{xen:link members/unignore, $user}" class="FollowLink">{xen:phrase unignore}</a><xen:elseif is="{$canIgnore}" /><a href="{xen:link members/ignore, $user}" class="FollowLink">{xen:phrase ignore}</a></xen:if>
    			<xen:elseif is="!{$visitor.user_id}" />
    				<a href="{xen:link members/follow, $user}">{xen:phrase follow}</a>
    			</xen:if>
    		</xen:hook>
    		</div>
    
    Admin CP -> Appearance -> Templates -> member_view

    Add the red code:

    Code:
    	<div class="main">
    
    		<div class="section primaryUserBlock">
    			<div class="mainText secondaryContent">
    				<div class="followBlock">
    					<ul>
    					<xen:if is="{$visitor.user_id}">
    						<xen:follow user="$user" title="" tag="li" />
    					<xen:else />
    						<li><a href="{xen:link members/follow, $user}">{xen:phrase follow}</a></li>
    					</xen:if>
    						<xen:if is="{xen:helper isIgnored, $user.user_id}">
    							<li><a href="{xen:link members/unignore, $user}" class="FollowLink">{xen:phrase unignore}</a></li>
    						<xen:elseif is="{$canIgnore}" />
    							<li><a href="{xen:link members/ignore, $user}" class="FollowLink">{xen:phrase ignore}</a></li>
    						</xen:if>
    						<xen:if is="{$canWarn}">
    							<li><a href="{xen:link members/warn, $user}">{xen:phrase warn}</a></li>
    						</xen:if>
    					</ul>
    
     
    Luke B likes this.
  3. Luke B

    Luke B Active Member

    Much appreciated
    Thank you
     
  4. Luke B

    Luke B Active Member

    The profile one worked great but the member card one did not. I'm wondering if its because I'm using Xen 1.01 and the template is different?
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Sure enough. The code is different in 1.0. Use this in member_card to make it like 1.1:

    Code:
    		<div class="userLinks">
    		<xen:hook name="member_card_links">
    			<a href="{xen:link members, $user}">{xen:phrase profile_page}</a>
    			<xen:if is="{$visitor.user_id} AND {$user.user_id} != {$visitor.user_id}">
    				<xen:if is="{$canStartConversation}"><a href="{xen:link conversations/add, '', 'to={$user.username}'}">{xen:phrase start_conversation}</a></xen:if>
    				<xen:follow user="$user" class="Tooltip" />
    				<xen:if is="{$canCleanSpam}"><a href="{xen:link spam-cleaner, $user}" class="deleteSpam OverlayTrigger">{xen:phrase spam}</a></xen:if>
    			<xen:elseif is="!{$visitor.user_id}" />
    				<a href="{xen:link members/follow, $user}">{xen:phrase follow}</a>
    			</xen:if>
    		</xen:hook>
    		</div>
    
     
  6. Luke B

    Luke B Active Member

    Hm, it didn't work
    I also included some code to show the "message" link as well. That is working but is it messing the "follow" up somehow? Here is what I have:
    Code:
                    <div class="userLinks">
            <xen:hook name="member_card_links">
                <a href="{xen:link members, $user}">{xen:phrase profile_page}</a>
                <xen:if is="{$user.user_id} != {$visitor.user_id}">
                    <a href="{xen:link conversations/add, '', 'to={$user.username}'}">{xen:phrase start_conversation}</a>
                    <xen:follow user="$user" class="Tooltip" />
                    <xen:if is="{$canCleanSpam}"><a href="{xen:link spam-cleaner, $user}" class="deleteSpam OverlayTrigger">{xen:phrase spam}</a></xen:if>            
                            </xen:if>
            </xen:hook>
            </div>
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    With the way the condition is structured, you can add more "guest" links in the red area. This is how you would add a PM link as well as a follow link:

    Code:
    		<div class="userLinks">
    		<xen:hook name="member_card_links">
    			<a href="{xen:link members, $user}">{xen:phrase profile_page}</a>
    			<xen:if is="{$visitor.user_id} AND {$user.user_id} != {$visitor.user_id}">
    				<xen:if is="{$canStartConversation}"><a href="{xen:link conversations/add, '', 'to={$user.username}'}">{xen:phrase start_conversation}</a></xen:if>
    				<xen:follow user="$user" class="Tooltip" />
    				<xen:if is="{$canCleanSpam}"><a href="{xen:link spam-cleaner, $user}" class="deleteSpam OverlayTrigger">{xen:phrase spam}</a></xen:if>
    			<xen:elseif is="!{$visitor.user_id}" />
    				<a href="{xen:link conversations/add, '', 'to={$user.username}'}">{xen:phrase start_conversation}</a>
    				<a href="{xen:link members/follow, $user}">{xen:phrase follow}</a>
    			</xen:if>
    		</xen:hook>
    		</div>
    
     
  8. Luke B

    Luke B Active Member

    I gotcha! It worked great, thank you for the help. When I upgrade to 1.1, I will do your first suggestion.
     

Share This Page