Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 18 replies - 1 through 18 (of 18 total)
  • @defunctlife

    Participant

    add this to functions.php: it will filter the bbpress function that shows the avatar to switch it to using full.

    `function fix_forum_avatar($author_avatar = false, $reply_id = false, $size = false) {
    echo str_replace(‘-bpthumb’, ‘-bpfull’, $author_avatar );
    }
    add_filter(‘bbp_get_reply_author_avatar’, ‘fix_forum_avatar’);`

    @defunctlife

    Participant

    This function creates an infinite loop if the MOD didn’t enable discussion forums for their group.

    Updated code to check for that:

    `function redirect_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 ) {
    if( $bp->bp_options_nav )
    bp_core_redirect( $path . $bp->bp_options_nav . ‘/’ );
    }
    }
    add_action( ‘wp’, ‘redirect_to_forum’ );`

    @defunctlife

    Participant

    Never mind, it’s something I changed as it works in the default template.

    @defunctlife

    Participant

    Hey guys,

    Regarding @nuprn1 post, bp_get_displayed_user_nav() is not displaying any tabs on this custom page.

    Any ideas?

    @defunctlife

    Participant

    @nahummadrid thanks again for the post, I got everything working quite well!

    @defunctlife

    Participant

    @nahumamadrid I mean /members/single/activity.php ?

    @defunctlife

    Participant

    @nahummadrid I think you have a typo on your blog: where you say “From your theme/activity/post-form.php replace the following lines:” I think you mean theme/activity/index.php right?

    @defunctlife

    Participant

    @nahummadrid thanks a lot, I wil try to implement it today.

    @defunctlife

    Participant

    Thank you both for your help, so I’m hoping I can return the favor. Modemlooper, here is how I adjusted the My Friends tab, but it has sub nav code for you, maybe it will help. Credit for this from @jeffsayre

    `function my_friends_setup_nav() {
    global $bp;

    /* Add ‘Friends’ to the main navigation */
    if( bp_friend_get_total_requests_count($disp_user) > 0 && bp_is_my_profile()) {
    bp_core_new_nav_item( array( ‘name’ => sprintf( __( ‘Friends (%d) (%d)‘, ‘buddypress’ ), friends_get_total_friend_count(), bp_friend_get_total_requests_count() ), ‘slug’ => $bp->friends->slug, ‘position’ => 60, ‘screen_function’ => ‘friends_screen_my_friends’, ‘default_subnav_slug’ => ‘my-friends’, ‘item_css_id’ => $bp->friends->id ) );
    } else {
    bp_core_new_nav_item( array( ‘name’ => sprintf( __( ‘Friends (%d)‘, ‘buddypress’ ), friends_get_total_friend_count() ), ‘slug’ => $bp->friends->slug, ‘position’ => 60, ‘screen_function’ => ‘friends_screen_my_friends’, ‘default_subnav_slug’ => ‘my-friends’, ‘item_css_id’ => $bp->friends->id ) );
    }

    $friends_link = $bp->loggedin_user->domain . $bp->friends->slug . ‘/’;

    /* Add the subnav items to the friends nav item */
    bp_core_new_subnav_item( array( ‘name’ => __( ‘My Friends’, ‘buddypress’ ), ‘slug’ => ‘my-friends’, ‘parent_url’ => $friends_link, ‘parent_slug’ => $bp->friends->slug, ‘screen_function’ => ‘friends_screen_my_friends’, ‘position’ => 10, ‘item_css_id’ => ‘friends-my-friends’ ) );
    bp_core_new_subnav_item( array( ‘name’ => sprintf( __( ‘Requests (%d)‘, ‘buddypress’ ), bp_friend_get_total_requests_count() ), ‘slug’ => ‘requests’, ‘parent_url’ => $friends_link, ‘parent_slug’ => $bp->friends->slug, ‘screen_function’ => ‘friends_screen_requests’, ‘position’ => 20, ‘user_has_access’ => bp_is_my_profile() ) );

    if ( $bp->current_component == $bp->friends->slug ) {
    if ( bp_is_my_profile() ) {
    $bp->bp_options_title = __( ‘My Friends’, ‘buddypress’ );
    } else {
    $bp->bp_options_avatar = bp_core_fetch_avatar( array( ‘item_id’ => $bp->displayed_user->id, ‘type’ => ‘thumb’ ) );
    $bp->bp_options_title = $bp->displayed_user->fullname;
    }
    }

    do_action( ‘friends_setup_nav’ );
    }

    add_action( ‘bp_setup_nav’, ‘my_friends_setup_nav’, 11 );`

    @defunctlife

    Participant

    Never mind, I see you named them as my_profile_page function. Will be giving this a try today. Thank you!

    @defunctlife

    Participant

    Thanks Rich, can this be done without editing the core?

    @defunctlife

    Participant

    No one out there knows the best way to do this?

    @defunctlife

    Participant

    Nevermind, figured it out. I had to use domain.com/blog/author/username.

    @defunctlife

    Participant

    @Jeff indeed it’s working now: Here is my bp-custom.php for others: http://pastie.org/1030176

    I think it wasn’t working because I had adjusted the do_action() function from within my function to do_action( ‘my_friends_setup_nav’); and I guess it needs to be left as do_action( ‘friends_setup_nav’);

    Thanks for all your help Jeff!

    @defunctlife

    Participant

    @Jeff you copied it in as my_friends_setup_nav()? Can you post your function please?

    @defunctlife

    Participant

    Hey Jeff,

    Yeah I had tried that already (tried 99 etc…) and nothing seems to work. Thanks for trying though, really do appreciate the time.

    I decided to take another route and override the $bp global in my functions.php

    $disp_user = $bp->displayed_user->id;
    if( bp_friend_get_total_requests_count($disp_user) > 0) {
    $bp->bp_nav .= ‘(‘.bp_friend_get_total_requests_count($disp_user).’)‘;
    }

    This doesn’t really allow for the customization I want, but I guess it will have to do for now.

    @defunctlife

    Participant

    Thanks for having a look Jeff, however it didn’t help. I simply want to edit some HTML that is generated in a tab and it’s a total nightmare. Besides the fact that I wish this was generated in a template since it generates HTML, I just cannot seem to override this function: friends_setup_nav() located in bp-friends.php (line 87).

    Since that function adds it’s own action do_action( ‘friends_setup_nav’); I’m assuming I can remove it and add my own in it’s place but it doesn’t work.

    Even if I do install that plugin and find when it is fired, how does that help me? Does it just change how or where I call remove_action?

    Should I be trying to hook into something else?

    @defunctlife

    Participant

    Well,

    I tried remove_action on the function I found that I want to customize, but it doesn’t work apparently because bp-custom.php is being loaded before bp-friends. I tried this in my theme’s functions.php as well, but it still does not work. What am I doing wrong?

    /***
    * Create custom functions for buddypress so updates do not override customizations
    */

    function my_friends_setup_nav() {
    global $bp;

    /* Add ‘Friends’ to the main navigation */
    bp_core_new_nav_item( array( ‘name’ => sprintf( __( ‘Friends (%d)2222′, ‘buddypress’ ), friends_get_total_friend_count() ), ‘slug’ => $bp->friends->slug, ‘position’ => 60, ‘screen_function’ => ‘friends_screen_my_friends’, ‘default_subnav_slug’ => ‘my-friends’, ‘item_css_id’ => $bp->friends->id ) );

    $friends_link = $bp->loggedin_user->domain . $bp->friends->slug . ‘/’;

    /* Add the subnav items to the friends nav item */
    bp_core_new_subnav_item( array( ‘name’ => __( ‘My Friends’, ‘buddypress’ ), ‘slug’ => ‘my-friends’, ‘parent_url’ => $friends_link, ‘parent_slug’ => $bp->friends->slug, ‘screen_function’ => ‘friends_screen_my_friends’, ‘position’ => 10, ‘item_css_id’ => ‘friends-my-friends’ ) );
    bp_core_new_subnav_item( array( ‘name’ => __( ‘Requests’, ‘buddypress’ ), ‘slug’ => ‘requests’, ‘parent_url’ => $friends_link, ‘parent_slug’ => $bp->friends->slug, ‘screen_function’ => ‘friends_screen_requests’, ‘position’ => 20, ‘user_has_access’ => bp_is_my_profile() ) );

    if ( $bp->current_component == $bp->friends->slug ) {
    if ( bp_is_my_profile() ) {
    $bp->bp_options_title = __( ‘My Friends’, ‘buddypress’ );
    } else {
    $bp->bp_options_avatar = bp_core_fetch_avatar( array( ‘item_id’ => $bp->displayed_user->id, ‘type’ => ‘thumb’ ) );
    $bp->bp_options_title = $bp->displayed_user->fullname;
    }
    }

    do_action( ‘my_friends_setup_nav’);
    }
    remove_action( ‘bp_setup_nav’, ‘friends_setup_nav’);
    add_action( ‘bp_setup_nav’, ‘my_friends_setup_nav’);

Viewing 18 replies - 1 through 18 (of 18 total)
Skip to toolbar