Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove the ‘view’ button in the activity stream


  • Roger Coathup
    Participant

    @rogercoathup

    I’m trying to find a simple way to remove the ‘view’ button from the activity header displayed in the activity stream.

    The ‘view’ button (and other meta information) is displayed by the call to bp_activity_action() in the activity loop.

    In my child theme, I don’t want to display the view button (and other ‘forced’ on me presentational elements like dots as separators). The only ways I can see to do this are:

    • Write an ‘ugly’ filter thats parses the string being returned and strips out the view button (e.g. a filter on bp_insert_activity_meta)
    • Write my own ‘API’ calls on the $activities_template that give me fine grained accessed to the data structure – so I can retrieve just the information I need for my theme

    Am I missing something obvious? Are there some existing API calls that I’m not seeing?

    As a more general point: Why is the core bp_activity_action() template tag ‘forcing’ presentational decisions on the theme developer. Whether you display your activity summary with a dot separator, and with or without metadata, should be a decision that is easy take in your theme, not one that is embedded in the core code.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @rogercoathup; I removed the View link from the activity stream by putting the following in the theme’s functions.php file;

    add_filter(‘bp_activity_permalink’, create_function(‘$a’, “return null;”));

    To remove it from the Profile page required a core hack, which I keep separate so I can restore/overwrite if need be. (I could be wrong about that, as I’m just getting into BP’s actions, filters, etc).

    Since getting into BP a few weeks ago I’ve found a lot of things somewhat convoluted, but from reading around the forums here it seems the next version will have some restructuring, and easier theming. There’s a thread somewhere inviting people to test it.


    Roger Coathup
    Participant

    @rogercoathup

    Hi @lincme.co.uk; yes, that kind of puts a nice full stop on its display.

    It doesn’t get rid of the problem of ‘dots’ being added on other elements you might want (like the delete option) though.

    I’m solving it, by putting my own simple API calls in bp_custom.php (I guess they’d work in functions.php as well) to return the items I want from the activities_template uncorrupted:

    my_activity_action(); returns just the action field without the meta stuff being forced in
    my_activity_time(); so the time of the activity (rather than time since) can be displayed
    has_delete_permissions(); used in conjunction with bp_get_activity_delete_link to just display the delete link if appropriate

    Then, modifying entry.php to call these functions instead.

    An improved set of API functions would make theming a lot easier – would be good to know where the invite thread is.


    Roger Coathup
    Participant

    @rogercoathup

    @lincme – this thread mentions a filter for the view button in the profile area: https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/remove-permalink-view-link-from-profile-container-request/#post-57691

    I haven’t investigated it yet.

    @rogercoathup; Yep, I hacked the core previously due to lack of time to recode things, but upgraded to the latest BP today and found a number of issues (for me) were fixed. So only one small core hack now. Our site is fine with the &middots in the strings, which you can see at http://lincme.co.uk/community if you’re curious.

    On a (kind of) similar note, I think the functions.php idea works well, with filters, etc. We wanted the last logged-in time shown only to logged-in members, and this seems to have done the trick fine (one for activity streams, one for the profile page);

    function hide_activity($content) {
    if ( !is_user_logged_in() ) {
    $content=’Please log-in to view last visit time.’;
    }
    return $content;
    }
    add_filter(‘bp_member_last_active’, ‘hide_activity’, $last_activity);
    add_filter(‘bp_last_activity’, ‘hide_activity’, $last_activity);

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove the ‘view’ button in the activity stream’ is closed to new replies.
Skip to toolbar