Skip to:
Content
Pages
Categories
Search
Top
Bottom

Making the “Profile” Tab Open When Viewing a Profile vs “Activity”

  • Avatar of thealchemist
    thealchemist
    Member

    @thealchemist

    This is a small tweak I think, but my users are asking for it, so I figure I’d look into it. In BP, when you visit a member’s profile the “Activity” tabe is what’s open and viewable first. Is there a way – and would you please advise me – to make the “Profile” tab the one that is open?

Viewing 16 replies - 1 through 16 (of 16 total)
  • Avatar of zkwc
    zkwc
    Participant

    @zkwc

    Avatar of thealchemist
    thealchemist
    Member

    @thealchemist

    @zkwc Thanks. Checked it out. The suggestion of editing the bp-custom.php file is interesting fix for the forum tab in groups but I can’t FIND the bp-custom.php file anywhere.

    Avatar of danbpfr
    danbpfr
    Participant

    @chouf1

    bp-custom must be created first by yourself to exist !

    http://codex.buddypress.org/extending-buddypress/bp-custom-php/

    Avatar of thealchemist
    thealchemist
    Member

    @thealchemist

    @Chouf1 Well who would have known! I learn something every day … THANKS!

    Avatar of pcwriter
    pcwriter
    Participant

    @pcwriter

    @thealchemist @zkwc

    This is a great find! I asked that very same question not too long ago:
    http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-to-make-profile-the-default-tab-without-editing-wp-config/

    Even posted an enhancement suggestion in trac where I was led to believe it can’t be done.
    http://trac.buddypress.org/ticket/3007

    Now I find the reference in the link supplied by @zkwc and, lo and behold, it looks like it CAN be done.

    I can’t wait to test this out in my new BuddyBuilder theme framework.
    If it works well, I’ll incorporate the idea in so users can select ANY one of the default subnavs as group home.

    Avatar of thealchemist
    thealchemist
    Member

    @thealchemist

    Well, I have created the bp-custom.php file, added the code they suggested, uploaded … and nada. So, I am likely missing something obvious. How does the page know to even ‘look’ at the bp-custom.php file? Also, the trick suggested works for groups … how would / could this be altered to work on the profile?

    Avatar of zkwc
    zkwc
    Participant

    @zkwc

    Glad I could help you all find the information. @pcwriter if you find that it works PLEASE let me know. I am somewhat savvy when coding but not savvy enough and I’m scared to try it for fear of breaking my site. Wuss, I know. Buddy used to give admins the option of showing the ‘wall’ or ‘activity’ or not and now that feature is gone and it’s confusing ALL, not just some, of my users. And they never know where to post, the forum or activity.

    Avatar of zkwc
    zkwc
    Participant

    @zkwc

    @thealchemist I know that if you copy and paste code from here it sometimes doesn’t post exactly as it should. So if you did that try typing it exactly as shown instead of copy and paste. Not sure if that’s the issue though, but just trying to help. :)

    Avatar of thealchemist
    thealchemist
    Member

    @thealchemist

    Nope. Nada. hmmmm.

    pcwriter
    Loading that constant has to be done early; I’m not sure without looking if bp-custom.php is early enough or not. If it is, great. I would recommend against overwriting that file from a theme, however. A end-user may have used it to configure settings which would be lost when you overwrite the file.

    Avatar of pcwriter
    pcwriter
    Participant

    @pcwriter

    @thealchemist @zkwc @djpaul

    Hurray!

    The code snippet works just fine in functions.php. That’s good news for a theme designer: no worries about a theme overriding a user’s custom configurations in bp-custom.php.
    Now I’m off to add “Group Landing Page” as an option in my new theme. It’ll be incorporated with the theme’s “Alternate Header” option too.

    Then I’ve got to adapt the code to work with member profiles. My initial attempts have failed, but I’ve been known to be persistent at times ;-)

    For future reference, here’s the code snippet to add to functions.php or, if you have created it, bp-custom.php.
    You can see it in action here: http://rspacesandbox.org/ Click any group.

    `function redirect_groups_to_forum() {
    global $bp;
    $path = clean_url( $_SERVER );
    $path = apply_filters( ‘bp_uri’, $path );
    if ( bp_is_group_home() && strpos( $path, $bp->bp_options_nav ) === false )
    bp_core_redirect( $path . $bp->bp_options_nav . ‘/’ );
    }
    add_action( ‘wp’, ‘redirect_groups_to_forum’ );`

    Avatar of pcwriter
    pcwriter
    Participant

    @pcwriter

    @thealchemist

    I just replied to your query at bp-tricks
    Here’s the same answer: bp-custom needs to go in your /plugins/ directory, not /buddypress/
    Hope it helps! :-)

    Avatar of zkwc
    zkwc
    Participant

    @zkwc

    @pcwriter @thealchemist

    woohoo! that worked for my forums too! :) i am one happy camper. now hopefully my forums will stay clean! yay!

    anyone know the code for profiles? would one just replace “profile” for “group” in the code for forums? thinking that there would be MORE to that, but I’m all ears. :)

    thank you for testing @pcwriter !

    Avatar of thealchemist
    thealchemist
    Member

    @thealchemist

    Well … heck. This conflicts with BP Chat. I got tons of error messages. So, deactivated BP Chat and I see the above code at the top of the browser window and the function won’t work. hmmmm.

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    @TheAlchemist if you’re seeing php scripting outputed by the browser then you have possibly left out php tags wrapping the function? depends on how your functions.php is arranged but generally as it tends to contain various disparate functions and snippets of code including markup php tags tend to be opened and closed on a per item basis.
    @pcwriter There appears to be a bit of confusion over two separate requirements here; this sniipet of code is quite old and I think was actually written by r-a-y and perhaps ought to have been duly attributed! the function always did work in functions.php quite happily and I’ve been running it since early last year so it’s been around a while, your original request was for the profile tab a component and the ticket you raised for the constant to be defined in functions.php which in theory and practice is impossible as constants are pre-defined set values and have to be set before BP loads thus they can only work in wp-config or bp-custom.

    Avatar of pcwriter
    pcwriter
    Participant

    @pcwriter

    @hnla

    Props to @r-a-y. Thanks for pointing that out!
    And thanks for clearing out the mud in my head re the constant ;-)

Viewing 16 replies - 1 through 16 (of 16 total)

You must be logged in to reply to this topic.