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

Adding "Your News Feed" tab to profile page

Discussion in 'XenForo Questions and Support' started by toodlez, Nov 8, 2011.

  1. toodlez

    toodlez 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
     
    erich37 likes this.
  2. erich37

    erich37 Well-Known Member

    great idea actually !
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Tested in 1.1:

    Admin CP -> Appearance -> Templates -> member_view

    Add the red code:

    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:

    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.png
     
    Azofan, RobinHood, erich37 and 2 others like this.
  4. toodlez

    toodlez Active Member

    That's awesome dude..
    How about if I want it as the first tab selected? I know it'll require some moving parts
     
  5. toodlez

    toodlez Active Member

    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 ?

    Thanks buddy! Do work!
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.

    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:

    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.png
     
    Glockie, RobinHood and erich37 like this.
  7. toodlez

    toodlez Active Member

    Very nicely done, sir.

    Another idea, is it possible to get this to display STATUS UPDATES / WALL POSTS ONLY?
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  9. toodlez

    toodlez Active Member

    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
     
  10. toodlez

    toodlez Active Member

    Hey Jake, can you add the "Show Older Items" at the bottom, as it shows in the standard "Your News Feed?"
     
  11. toodlez

    toodlez Active Member

  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I have been unable to get this to work.
     
  13. toodlez

    toodlez Active Member

    Damn :(
     
  14. erich37

    erich37 Well-Known Member

    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!
     
    otto likes this.
  15. isaiahv

    isaiahv Member

    Will this work with 1.4?
     
  16. Glockie

    Glockie Well-Known Member

    Hmm I'd be interested in if this works currently?
    I've done it, but it seems to be pulling data from other sources :confused:
     

Share This Page