Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change the default activity tab

  • Profile photo of Anton
    Anton
    Participant

    @antonrsa

    When a member is logged in and browsing to the activity page, the default activity tab shows “All Members” activity. I am using the “Followers” plugin. How can I change that so that the default tab for logged in users displays the people that they are following activity instead of every member on the network? For logged out users, the default site wide activity can still be the default. Is there a way to hack this?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Profile photo of Anton
    Anton
    Participant

    @antonrsa

    Anyone?

    Profile photo of Anton
    Anton
    Participant

    @antonrsa

    Is it at all possible to have a different default tab for the activity stream except the “All Members” tab displaying everything?

    Profile photo of paulhastings0
    paulhastings0
    Participant

    @paulhastings0

    Hmm… I’d be interested in this as well. Was there a fix that someone had written up a while back?

    Profile photo of Nm
    nm
    Participant

    @nahummadrid

    i’ve tried doing this for the activity page and the profile activity, but I wasn’t able to get it going…i think there was someone who posted a possible solution but I can’t find it.

    It almost makes sense to include the logic you described into the default BP. Its the most common activity logic found everywhere else….so you got my vote.

    Profile photo of paulhastings0
    paulhastings0
    Participant

    @paulhastings0

    I did some snooping around and found some tips for changing the ordering and defaults tabs of groups, but nothing on the default activity tabs.

    http://shabushabu.eu/reordering-buddypress-group-tabs/

    I found a thread that @modemlooper made a couple months back discussing the issue. I completely forgot that I had posted on the thread. :P

    Profile photo of paulhastings0
    paulhastings0
    Participant

    @paulhastings0

    Hmm… did some more snooping. The relevant file is /bp-child-default-theme/activity/index.php

    Ideally there would be a single function that should generate the current activity tabs, that way we could use the hook to remove the existing function and then drop in our own existing function via add_action();

    Unfortunately I see nothing of the sort. Here are lines 18 – 56.

    http://pastebin.com/PH8BTyN8

    Profile photo of paulhastings0
    paulhastings0
    Participant

    @paulhastings0

    Whoa, whoa, come to think of it then theoretically there should be a single value floating out there somewhere that’s making the “All Members” tab behave as the default.

    Profile photo of paulhastings0
    paulhastings0
    Participant

    @paulhastings0

    Wow, I think I just figured out how to do it. It’s kind of hacky but I’ll share it with yall anyway.

    1. Make sure that you’re working on a child theme of the BP Default theme.
    2. Copy/paste the contents of bp-default/activity/index.php into your child theme’s activity/index.php folder
    3. Find the line <li class="selected" id="activity-all"> and delete class="selected"
    4. Scroll down a few lines further to <li id="activity-friends"> and insert class="selected" just after id="activity-friends"

    And that should be it. One thing I’ve noticed though is that the browser still seems to remember what the last tab was that you were using. But if you login into your account with a completely new browser then your default activity tab will be “Friends”.

    If anyone else has a less “hacky” solution then by all means share with us.

    Profile photo of Anton
    Anton
    Participant

    @antonrsa

    @paulhastings0

    So it won’t display anything when you are not logged in?

    Profile photo of paulhastings0
    paulhastings0
    Participant

    @paulhastings0

    To be honest I don’t remember. It might just display something like “There are no current topics” or something similar to that or perhaps it’ll just default to the only available tab which would be the “All Members” tab since logged-out users obviously don’t have the “My Friends”, “My Groups”, etc. tabs.

    Of course to guarantee what logged-out guests see, someone could write an if/else clause that decides what activity to set as “selected” depending whether they’re logged in or not. For the purposes of our website though we don’t allow logged-out visitor to see our pages at all, so it really wasn’t an issue for us.

    Profile photo of calvinhsu
    calvinhsu
    Participant

    @calvinhsu

    @paulhastings0

    Hi, I used this method before, and I even moved <li id="activity-all"> to the end of all tabs.

    But after this, although it appears the preferred tab(“My friends” or “my groups”) is selected, the actual activities automatically loaded below the tabs are still all members’ activities.

    So it seems the class="selected" is just for defining css style, it does not change the default activity sream loaded.

    Profile photo of freddy mcbob
    freddy mcbob
    Participant

    @yeshourun

    thank you very much! worked great!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Change the default activity tab’ is closed to new replies.