Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • JanDieckmann
    Participant

    @jandieckmann

    Hello and sorry for bringing up again this old topic, but now it can be closed and considered resolved. After some month of ignoring that issue I came back to take care for the concerned website and still had the same problem.

    I saw that the related ticket is closed and marked as fixed. And I can acknowledge that the group pages are showing up on other installations, but on this particular site it consisted.

    So I tried again with changing the theme, deactivating all plugins, reinstalling buddypress and so on without success to finally figure out that it has had something to do with my bp-custom.php. After deleting it, it works, the group pages are shown again. I created a new bp-custom.php copied the content from the old one and it still works. Don’t know what happened or where might be an unnoticed character.

    Thanks for taking care, developing and maintaining Buddypress!


    JanDieckmann
    Participant

    @jandieckmann

    Wow, a lot is going on already. Thanks for taking care of it so quickly and doing the necessary approaches to track and fix this.

    I had a look at the ticket and saw that there are patches available? What is the next step for me? How can I use them or is it better to wait for the next update?


    JanDieckmann
    Participant

    @jandieckmann

    No, I haven’t tried yet. Is there a guide to roll back to the previous version?


    JanDieckmann
    Participant

    @jandieckmann

    I am also thankful because I looked for the same issue and the code posted by mcpeanut worked for me too.


    JanDieckmann
    Participant

    @jandieckmann

    Still works good what I have put together there.

    Even if your suggestion looks much easier and more compact, I wonder how to determinate the position in the menu?


    JanDieckmann
    Participant

    @jandieckmann

    I finally succeed in creating the dynamic menu link. I’ve taken a part of code that was made to create an entry in the menu for the latest post and modified it in a way that it obviously works:

    // Front end only, don't hack on the settings page
    if ( ! is_admin() ) {
        // Hook in early to modify the menu
        // This is before the CSS "selected" classes are calculated
        add_filter( 'wp_get_nav_menu_items', 'replace_placeholder_nav_menu_item_with_mygroups', 10, 3 );
    }
    
    // Replaces a custom URL placeholder with the URL to mygroups
    function replace_placeholder_nav_menu_item_with_mygroups( $items, $menu, $args ) {
    
            $key = 'http://#mygroups:';
    	global $current_user;
    	get_currentuserinfo();
    
        // Loop through the menu items looking for placeholder(s)
        foreach ( $items as $item ) {
     
            // Is this the placeholder we're looking for?
            if ( 0 === strpos( $item->url, $key ) )
            {
    	// Get the username
            $username = $current_user->user_login;
         
            if ( empty( $username ) )
                continue;
    
            // Replace the placeholder with the real URL
            $item->url = 'http://www.....org/en/members/' . $username . '/groups/my-groups/';
            }
        }
    
        // Return the modified (or maybe unmodified) menu items array
        return $items;
    }
    

    If some one with more experience and knowledge sees problems with security or performance I am glad to learn how to change this code.

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