Show "follow" to guests

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
 
Admin CP -> Appearance -> Templates -> member_card

Add the red code:

Rich (BB 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:

Rich (BB 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>
 
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?

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

Rich (BB 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>
 
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>
 
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:

Rich (BB 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>
 
Top Bottom