Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Support: Creating & Extending

Existing and new plugins/components and themes.

Change the default activity tab (12 posts)

Started 1 year, 10 months ago by: Anton

  • Profile picture of Anton Anton said 1 year, 10 months ago:

    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?

  • Profile picture of Anton Anton said 1 year, 9 months ago:

    Anyone?

  • Profile picture of Anton Anton said 1 year, 9 months ago:

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

  • Profile picture of paulhastings0 paulhastings0 said 1 year, 6 months ago:

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

  • Profile picture of Nahum Nahum said 1 year, 6 months ago:

    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 picture of paulhastings0 paulhastings0 said 1 year, 6 months ago:

    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 picture of paulhastings0 paulhastings0 said 1 year, 6 months ago:

    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 picture of paulhastings0 paulhastings0 said 1 year, 6 months ago:

    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 picture of paulhastings0 paulhastings0 said 1 year, 6 months ago:

    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 picture of Anton Anton said 1 year, 6 months ago:

    @paulhastings0

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

  • Profile picture of paulhastings0 paulhastings0 said 1 year, 6 months ago:

    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 picture of calvinhsu calvinhsu said 1 year, 4 months ago:

    @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.