This topic has 10 replies, 3 voices, and was last updated 10 years by Abe.

  • Author

    Tagged: ,

  • #32962
     chazzzzy
    Participant

    All the users I have testing the site out tell me the site is broken when they click a menu item in the Buddypress Menu area as they don’t see anything change on the screen. BUT they don’t realize that they NEED TO SCROLL down to see the changes.

    Is there anything you can do to make the screen scroll DOWN when you click a menu item like:

    Change Profile Picture or any other item that is within the Profile Area?

    For Change Profile Picture, adding a /#upload to the end of the link would scroll the screen down, but I have no idea how to add that to the URL.

    I am beta testing my site and EVERYONE on a laptop is experiencing this problem. (Where they don’t know that they need to scroll down) and that’s in no way obvious for them.

    My site is underground.net you can log in and test it if you want.

    Thanks!

    Charles

    #32981
     sharmstr
    Moderator

    Did you ask the Buddypress forum how to add and an anchor tag to the buddypress nav links like I suggested? What did they say? I’m not trying to get rid of you, I promise. All of those nav links are handled by Buddypress functions. Kleo only stylizes them. Normally you’d customize the url by putting something like this in your functions.php file

    COPY CODE
    
    define ( 'BP_FRIENDS_SLUG', 'peeps' );
    

    Another user here asked about adding anchors so I tried it like this

    COPY CODE
    
    define ( 'BP_FRIENDS_SLUG', 'peeps/#main' );
    

    I ended up getting a 404 error because its gets parsed like /peeps/main.

    Hmmm. I wonder if you can add something in your .htaccess or use the rewrite_rules_array filter to write your own permalink that would append the anchor to the url.

    Still another option would be to make the profile header smaller or hide it all together.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #32986
     sharmstr
    Moderator

    There’s a wrapper div under the buddypress nav called item-body, so you can use that as your anchor. The bp_get_displayed_user_nav function in /buddypress/bp-members/bp-members-template.php draws the menu. Within that function is a apply_filters_ref_array filter. You can tap into that (search how to do it because I’m not exactly sure). right after $link you can add ‘#item-body’.

    COPY CODE
    
    echo apply_filters_ref_array( 'bp_get_displayed_user_nav_' . $user_nav_item['css_id'], array( '<li id="' . $user_nav_item['css_id'] . '-personal-li" ' . $selected . '><a href="' . $link . '#item-body">' . $user_nav_item['name'] . '</a></li>', &$user_nav_item ) );
    
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #32989
     sharmstr
    Moderator

    Okay, again I think you can tap into the filter, but since I dont know how to do that. You can do this.

    Add this to your functions.php file

    COPY CODE
    
    
    /**
     * Render the navigation markup for the displayed user.
     */
    function my_bp_get_displayed_user_nav() {
    	global $bp;
    
    	foreach ( (array) $bp->bp_nav as $user_nav_item ) {
    		if ( empty( $user_nav_item['show_for_displayed_user'] ) && !bp_is_my_profile() )
    			continue;
    
    		$selected = '';
    		if ( bp_is_current_component( $user_nav_item['slug'] ) ) {
    			$selected = ' class="current selected"';
    		}
    
    		if ( bp_loggedin_user_domain() ) {
    			$link = str_replace( bp_loggedin_user_domain(), bp_displayed_user_domain(), $user_nav_item['link'] );
    		} else {
    			$link = trailingslashit( bp_displayed_user_domain() . $user_nav_item['link'] );
    		}
    
    		echo apply_filters_ref_array( 'bp_get_displayed_user_nav_' . $user_nav_item['css_id'], array( '<li id="' . $user_nav_item['css_id'] . '-personal-li" ' . $selected . '><a href="' . $link . '#item-body">' . $user_nav_item['name'] . '</a></li>', &$user_nav_item ) );
    	}
    }
    
    

    Then copy the following files to your child theme
    /kleo/buddypress/members/single/home.php
    /kleo/rtmedia/main.php

    In both of those files, change

    COPY CODE
    
    bp_get_displayed_user_nav () ;
    

    to

    COPY CODE
    
    my_bp_get_displayed_user_nav () ;
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #33049
     chazzzzy
    Participant

    Awesome that works for the main navigation items, not the sub-nav items. Let me play around with it for a second and figure out how to add it to the sub-nav items.

    Will post update!

    Thanks!

    Charles

    #33073
     chazzzzy
    Participant

    OK.. I found the following to address the Sub Nav items… I took your code and added the subnav items.. resulting in the following longer code. You replaced bp_get_displayed_user_nav() with my_bp_get_displayed_user_nav()

    I also replaced bp_get_options_nav() with my_bp_get_options_nav()

    And I then had to copy over all the php files in buddypress/members/single over to my child theme.

    And I replaced all instances of bp_get_options_nav() with my_bp_get_options_nav()

    It required me to change around 12 pages.. which is a pain!

    Here is the code I also added to my functions.php after your code:

    COPY CODE
    
    function my_bp_get_options_nav() {
      global $bp;
    
      // If we are looking at a member profile, then the we can use the current component as an
      // index. Otherwise we need to use the component's root_slug
      $component_index = !empty( $bp->displayed_user ) ? bp_current_component() : bp_get_root_slug( bp_current_component() );
    
      if ( !bp_is_single_item() ) {
        if ( !isset( $bp->bp_options_nav[$component_index] ) || count( $bp->bp_options_nav[$component_index] ) < 1 ) {
          return false;
        } else {
          $the_index = $component_index;
        }
      } else {
        if ( !isset( $bp->bp_options_nav[bp_current_item()] ) || count( $bp->bp_options_nav[bp_current_item()] ) < 1 ) {
          return false;
        } else {
          $the_index = bp_current_item();
        }
      }
    
      // Loop through each navigation item
      foreach ( (array) $bp->bp_options_nav[$the_index] as $subnav_item ) {
        if ( !$subnav_item['user_has_access'] )
          continue;
    
        // If the current action or an action variable matches the nav item id, then add a highlight CSS class.
        if ( $subnav_item['slug'] == bp_current_action() ) {
          $selected = ' class="current selected"';
        } else {
          $selected = '';
        }
    
        // List type depends on our current component
        $list_type = bp_is_group() ? 'groups' : 'personal';
    
        // echo out the final list item
        echo apply_filters( 'bp_get_options_nav_' . $subnav_item['css_id'], '<li id="' . $subnav_item['css_id'] . '-' . $list_type . '-li" ' . $selected . '><a id="' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '#item-body" rel="nofollow">' . $subnav_item['name'] . '</a></li>', $subnav_item );
      }
    }
    

    I’m sure there is an easier way to change this stuff.. as it doesn’t work on the Group navigation items within the Group pages.. buy hey.. at lease I won’t have people yelling at me that the site doesn’t work when they are on a laptop!

    Thanks again sharmstr!

    Attachments:
    You must be logged in to view attached files.
    #33107
     sharmstr
    Moderator

    I’m pretty sure that bp_get_options_nav also controls the group nav menu. Did you try changing bp_get_options_nav to my_bp_get_options_nav in /groups/single/*.php? The pages have similar names to the ones in members/single/

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #33378
     Abe
    Keymaster

    Please don’t create duplicated topics https://archived.seventhqueen.com/forums/topic/change-buddypress-change-profile-photo-url

    Also i see you also added a comment on the item page which makes our job to take 3 times longer and not so cool 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #33379
     Abe
    Keymaster

    thanks @sharmstr

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #33384
     chazzzzy
    Participant

    I don’t remember how that happened! I think I was so buried in trying to set the site up that I forgot that I had posted that!

    Sorry about that!

    For those coming her, the topic was resolved over here: https://archived.seventhqueen.com/forums/topic/change-buddypress-change-profile-photo-url

    Charles

    #33391
     Abe
    Keymaster

    thanks @chazzzzy

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

Viewing 11 posts - 1 through 11 (of 11 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?