Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove permalink ‘view’ link from Profile Container request

  • Greetings,

    I am really enjoying spending time modifying the CSS of BuddyPress and customizing it to meet my needs. However, I need a little help with modifying some of the php files. I apologize if these questions have been asked before elsewhere. Here are the main things I need to do:

    1. Remove the ‘view’ link displayed next to meta data in the Profile Container. This link appears next to the text that is displayed when a comment is written and then displayed in the Profile Container. (The container displaying the user name, avatar, etc at the top of the user homepage) This link goes to a permalink page that displays just the comment. I have removed the ‘view’ link in the activity stream. I would like the comment still to show, just not the view link.

    2. I would like to remove the ‘#’ link from forum posts.

    I don’t need to heavily modify the code and remove this functionality altogether. I just need to prevent these links from being displayed to the user. I was able to remove the ‘view’ link from the activity stream simply be removing the word ‘view’ from the ‘bp-activity-templatetags.php’ file, but I am unsure of how to remove the others.

    I sincerely appreciate any advice anyone can provide and I look forward to sharing my soon-to-be finished BuddyPress template with the BuddyPress community.

    Many thanks,

    Shane.

Viewing 7 replies - 1 through 7 (of 7 total)
  • always try and override the values if a filter is available instead of modifying the bp-core files (next bp update you’ll need to make the changes all over again)

    bp_activity_latest_update() triggers the member-header activity – there is a filter bp_get_activity_latest_update

    as for the forum # permalink – that is in the /groups/single/forum/topic.php theme file (can override with a child theme)

    Great. Thanks for your help. I am not quite sure how to apply a filter. I am using a child theme I have created using a heavily modified default theme CSS and my own custom graphics. Do you mean create new files, such as the above, and place them in my child theme folder, instead of simply modifying the core bp files?

    Kind regards,

    Shane.


    Roger Coathup
    Participant

    @rogercoathup

    It’s a pain to have to use a filter and override the core function simply to remove a presentational element (the view link).

    The API needs to be much more granular here (e.g. get_the_activity_name, get_the_acitivity_description, get_the_activity_permalink), rather than echoing large monolithic strings from a single function.

    This would make it much easier to design and develop child themes.


    Roger Coathup
    Participant

    @rogercoathup

    We ended up implementing our own versions of bp_activity_latest_update(). Try adding something like the following to your bp-custom.php. Then remember to change the call in your member-header.php file to call your version of the function.

    function ka_activity_latest_update( $user_id = false ) {
    echo ka_get_activity_latest_update( $user_id );
    }
    function ka_get_activity_latest_update( $user_id = false ) {
    global $bp;

    if ( !$user_id )
    $user_id = $bp->displayed_user->id;

    if ( !$update = get_usermeta( $user_id, ‘bp_latest_update’ ) )
    return false;

    $latest_update = trim( strip_tags( bp_create_excerpt( $update, 40 ) ) );

    return apply_filters( ‘bp_get_activity_latest_update’, $latest_update );
    }


    Roger Coathup
    Participant

    @rogercoathup

    oh, we removed the bp_create_excerpt() call as well, as we want to show the whole update:

    Change:
    $latest_update = trim( strip_tags( bp_create_excerpt( $update, 40 ) ) );
    to
    $latest_update = trim( strip_tags( $update ) );


    trinzia
    Participant

    @trinzia

    I tried to do this. I created bp-custom.php, and placed it in plugins directory (not in plugins/buddypress). the function gets as far as //return $user_id, and will display it, but doesn’t seem to know what $update is.

    	<?php
    
    	//Remove view button on status update
    
    	function tty_activity_latest_update( $user_id = false ) {
    		echo tty_get_activity_latest_update( $user_id );
    	}
    
    	function tty_get_activity_latest_update( $user_id = false ) {
    		global $bp;
    
    		if ( !$user_id ) {
    		$user_id = $bp->displayed_user->id;
    		}
    
    		//return $user_id;
    
    		if ( !$update = get_usermeta( $user_id, 'bp_latest_update' ) ) {
    			return false;
    		}
    
    	$latest_update = trim( strip_tags( $update ) );
    
    	return apply_filters( 'bp_get_activity_latest_update', $latest_update );
    	}
    
    	?>
    
    

    trinzia
    Participant

    @trinzia

    Update:
    I searched through BP files for ‘bp_activity_latest_update’. When you find it you see it’s echo of the function ‘bp_get_activity_latest_update’. I copied this function into my theme, renamed it, and removed one line.

    In theme file, where you want to place status, put the following:

    	<?php if ( bp_is_active( 'activity' ) ) : ?>
    
    		<div class="statusnote" style="border:1px solid;">
    
    			<?php //override 'View' button
    			function tty_get_activity_latest_update( $user_id = false ) {
    
    			if ( empty( $user_id ) )
    			$user_id = bp_displayed_user_id();
    
    			if ( bp_is_user_inactive( $user_id ) )
    			return false;
    
    			if ( !$update = bp_get_user_meta( $user_id, 'bp_latest_update', true ) )
    			return false;
    
    			$latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 358 ) ) ) );
    			return apply_filters( 'tty_get_activity_latest_update', $latest_update  );
    			}
    			?>
    
    			<?php echo tty_get_activity_latest_update(); ?>
    
    		</div>
    
    	<?php endif; ?>
    

    Then remove the old one from members/single/member-header.php:

    		<?php if ( bp_is_active( 'activity' ) ) : ?>
    
    			<div id="latest-update">
    
    				<?php bp_activity_latest_update( bp_displayed_user_id() ); ?>
    
    			</div>
    
    		<?php endif; ?>
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Remove permalink ‘view’ link from Profile Container request’ is closed to new replies.
Skip to toolbar