Forums

Join
bbPress Support ForumsThemesAmended Profile page

Info

Tags

Amended Profile page

  1. (profile.php in theme folder)
    My users were asking for the ability to jump to the last post on the 'User Activity' area within their profile page. So I amended the page to use tables like the favorites listings do with two columns >

    TOPIC > DETAILS
    topic name > You replied 2 weeks ago. No replies since.

    <?php bb_get_header(); ?>
    
    <h3 class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> &raquo; <?php _e('Profile') ?></h3>
    
    <div class="vcard">
    
    <?php if ( $avatar = bb_get_avatar( $user->ID ) ) : ?>
    <div id="useravatar"><?php echo $avatar; ?></div>
    <?php unset($avatar); endif; ?>
    <h2 id="userlogin"><span class="fn"><?php echo get_user_display_name( $user->ID ); ?></span> <small>(<span class="nickname"><?php echo get_user_name( $user->ID ); ?></span>)</small></h2>
    
    <?php if ( $updated ) : ?>
    <div class="notice">
    <p><?php _e('Profile updated'); ?>. <a href="<?php profile_tab_link( $user_id, 'edit' ); ?>"><?php _e('Edit again &raquo;'); ?></a></p>
    </div>
    <?php elseif ( $user_id == bb_get_current_user_info( 'id' ) ) : ?>
    <p>
    <?php _e('This is how your profile appears to a logged in member.'); ?>
    
    <?php if (bb_current_user_can( 'edit_user', $user->ID )) : ?>
    <?php printf(__('You may <a href="%1$s">edit this information</a>.'), attribute_escape( get_profile_tab_link( $user_id, 'edit' ) ) ); ?>
    <?php endif; ?>
    </p>
    
    <?php if (bb_current_user_can( 'edit_favorites_of', $user->ID )) : ?>
    <p><?php printf(__('You can also <a href="%1$s">manage your favorites</a> and subscribe to your favorites’ <a href="%2$s"><abbr title="Really Simple Syndication">RSS</abbr> feed</a>.'), attribute_escape( get_favorites_link() ), attribute_escape( get_favorites_rss_link() )); ?></p>
    <?php endif; ?>
    <?php endif; ?>
    
    <?php bb_profile_data(); ?>
    
    </div>
    
    <h3 id="useractivity"><?php _e('User Activity') ?></h3>
    
    <div id="user-replies" class="user-recent">
    <h4><?php _e('Recent Replies'); ?></h4>
    
    <?php if ( $posts ) : ?>
    
    <table id="favorites">
    <tr>
    	<th><?php _e('Topic'); ?></th>
    	<th><?php _e('Details'); ?></th>
    </tr>
    
    <?php foreach ($posts as $bb_post) : $topic = get_topic( $bb_post->topic_id ) ?>
    <tr<?php alt_class('replies'); ?>>
    	<td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td>
    	<td class="num">
    	<a href="<?php topic_last_post_link(); ?>">
    	<?php if ( $user->ID == bb_get_current_user_info( 'id' ) ) printf(__('You replied %s ago.'), bb_get_post_time()); else printf(__('Latest reply %s ago.'), bb_get_post_time()); ?>
    	<span class="freshness"><?php
    		if ( bb_get_post_time( 'timestamp' ) < get_topic_time( 'timestamp' ) )
    			printf(__('Latest reply %s ago'), get_topic_time());
    		else
    			_e('No replies since.');
    	?></span>
    	</a>
    	</td>
    </tr>
    <?php endforeach; ?>
    </table>
    
    <?php else : if ( $page ) : ?>
    <p><?php _e('No more replies.') ?></p>
    <?php else : ?>
    <p><?php _e('No replies yet.') ?></p>
    <?php endif; endif; ?>
    
    </div>
    
    <div id="user-threads" class="user-recent">
    
    <h4><?php _e('Topics Started') ?></h4>
    <?php if ( $topics ) : ?>
    
    <table id="favorites">
    <tr>
    	<th><?php _e('Topic'); ?></th>
    	<th><?php _e('Details'); ?></th>
    </tr>
    
    <?php foreach ($topics as $topic) : ?>
    <tr<?php alt_class('topics'); ?>>
    	<td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td>
    	<td class="num">
    	<a href="<?php topic_last_post_link(); ?>">
    	<?php printf(__('Started: %s ago.'), get_topic_start_time()); ?>
    	<span class="freshness"><?php
    		if ( get_topic_start_time( 'timestamp' ) < get_topic_time( 'timestamp' ) )
    			printf(__('Recent reply: %s ago.'), get_topic_time());
    		else
    			_e('No replies.');
    	?></span>
    	</a>
    	</td>
    </tr>
    <?php endforeach; ?>
    </table>
    
    <?php else : if ( $page ) : ?>
    <p><?php _e('No more topics posted.') ?></p>
    <?php else : ?>
    <p><?php _e('No topics posted yet.') ?></p>
    <?php endif; endif;?>
    </div>
    
    <div class="nav">
    <?php profile_pages(); ?>
    </div>
    
    <?php bb_get_footer(); ?>
  2. You must log in to post.