Adding "Your News Feed" tab to profile page

thunderup

Active member
Okay, is there any way I can add a tab to show ONLY on your OWN profile page, that will show "Your News Feed"

This wold be a great feature to have for me to add to my site, or even just to be coded into the main XF end of things
 
Tested in 1.1:

Admin CP -> Appearance -> Templates -> member_view

Add the red code:

Rich (BB code):
			<ul class="tabs mainTabs Tabs" data-panes="#ProfilePanes > li" data-history="on">
				<li><a href="{$requestPaths.requestUri}#profilePosts">{xen:phrase profile_posts}</a></li>
				<xen:if is="{$showRecentActivity}"><li><a href="{$requestPaths.requestUri}#recentActivity">{xen:phrase recent_activity}</a></li></xen:if>
				<li><a href="{$requestPaths.requestUri}#postings">{xen:phrase postings}</a></li>
				<li><a href="{$requestPaths.requestUri}#info">{xen:phrase information}</a></li>
				<xen:if is="{$user.user_id} == {$visitor.user_id}"><li><a href="{$requestPaths.requestUri}#yourfeed">{xen:phrase your_news_feed}</a></li></xen:if>
				<xen:if is="{$warningCount}"><li><a href="{$requestPaths.requestUri}#warnings">{xen:phrase warnings} ({xen:number $warningCount})</a></li></xen:if>
				<xen:hook name="member_view_tabs_heading" params="{xen:array 'user={$user}'}" />
			</ul>

And also near the bottom of the template:

Rich (BB code):
							<xen:if is="{$customFieldsGrouped.contact}">
								<xen:foreach loop="$customFieldsGrouped.contact" value="$field">
									<xen:include template="custom_field_view" />
								</xen:foreach>
							</xen:if>
						</div>
					</div>
				</div>
			</li>

			<xen:if is="{$user.user_id} == {$visitor.user_id}">
			<li id="yourfeed" class="profileContent" data-loadUrl="{xen:link account/news-feed}">
				<span class="jsOnly">{xen:phrase loading}...</span>
				<noscript><a href="{xen:link account/news-feed}">{xen:phrase view}</a></noscript>
			</li>
			</xen:if>
			
			<xen:if is="{$warningCount}">
				<li id="warnings" class="profileContent" data-loadUrl="{xen:link members/warnings, $user}">
					{xen:phrase loading}...
					<noscript><a href="{xen:link members/warnings, $user}">{xen:phrase view}</a></noscript>
				</li>
			</xen:if>
			
			<xen:hook name="member_view_tabs_content" params="{xen:array 'user={$user}'}" />
		</ul>
	</div>

</div>

The result:

Screen shot 2011-11-09 at 12.21.26 AM.webp
 
That's awesome dude..
How about if I want it as the first tab selected? I know it'll require some moving parts

That requires moving the red pieces to the beginning of the tab order in both locations. I just tried this and it worked, but it also broke the javascript on the page. I was unable to fix this, so it looks like first tab is a no-go.

Also, can we get the user's avatars aligned to the left just like in the original news feed page? rather than having them above ?

Good call. I didn't even notice the lack of styling. To fix this you need to add more code:

Admin CP -> Appearance -> Templates -> member_view

Add the red code near the top:

Rich (BB code):
<xen:title>{$user.username}</xen:title>
<xen:h1></xen:h1> <xen:comment>H1 empty, do not render.</xen:comment>

<xen:container var="$head.canonical">
	<link rel="canonical" href="{xen:link 'canonical:members', $user, 'page={$page}'}" /></xen:container>

<xen:container var="$head.description">
	<meta name="description" content="{xen:phrase x_is_a_y_at_z, 'name={$user.username}', 'title={xen:helper stripHtml, {xen:helper usertitle, $user}}', 'location={$xenOptions.boardTitle}'}" /></xen:container>
	
<xen:container var="$head.openGraph"><xen:include template="open_graph_meta">
	<xen:set var="$url">{xen:link 'canonical:members', $user}</xen:set>
	<xen:set var="$title">{$user.username}</xen:set>
	<xen:set var="$avatar">{xen:helper avatar, $user, 'm', '', 'true'}</xen:set>
</xen:include></xen:container>

<xen:navigation>
	<xen:breadcrumb href="{xen:link full:members, $user}">{$user.username}</xen:breadcrumb>
</xen:navigation>

<xen:require css="member_view.css" />
<xen:require js="js/xenforo/quick_reply_profile.js" />

<xen:if is="{$user.user_id} == {$visitor.user_id}">
	<xen:require css="events.css" />
	<xen:require css="news_feed.css" />
	<xen:require js="js/xenforo/news_feed.js" />
</xen:if>

<div class="profilePage" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person">

	<div class="mast">
		<div class="avatarScaler">
			<xen:if is="{$visitor.user_id} == {$user.user_id}">
				<a class="Av{$user.user_id}l OverlayTrigger" href="{xen:link account/avatar}">
					<img src="{xen:helper avatar, $user, l, 'true'}" alt="{$user.username}" style="{xen:helper avatarCropCss, $user}" itemprop="photo" />
				</a>
			<xen:else />

Now it looks better:

Screen shot 2011-11-09 at 2.27.53 PM.webp
 
Cool, I'm thinking I will develop an add-on, which will let the users preferences decide what shows in their news feed...
Status / Comments
or All Activity


You the man, Jake
 
would it be possible to have this fature as an Add-on instead of doing template-edits?

it would be even better to have this in XF as a core feature.

Many thanks!
 
Top Bottom