Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 28 total)

  • jerryskate
    Participant

    @jerryskate

    Hi! Sorry for the late reply. Its the default from start yeah, but i change up a lot of the design on my own.


    jerryskate
    Participant

    @jerryskate

    Mee too 😀


    jerryskate
    Participant

    @jerryskate

    Henry, your a genius! It works! It gave me .member-profile-of-jerry as a class to use. Finally! Thanks so much. I have one bug left to solve, a permalink issue, but won’t bother the forum until i tried deactivating plugins and some other things. Again, thanks!


    jerryskate
    Participant

    @jerryskate

    Ok, a bit better 🙂 Still having my profilename outside the classes, but got all the old ones back.

    <body jerryclass="activity bp-user my-activity my-account just-me buddypress bbp-user-page single singular bbpress page page-id-5 page-template-default logged-in admin-bar no-customize-support bp-wall adminbar-enable not-responsive this-is-a-member-profile member-profile-of-" class=" customize-support" data-twttr-rendered="true">


    jerryskate
    Participant

    @jerryskate

    And this in header:

    <body <?php page_bodyclass(); ?>>


    jerryskate
    Participant

    @jerryskate

    This in bp-custom:

    function add_body_classes( $classes ) {
        if ( bp_is_member() )
            $classes[] = 'this-is-a-member-profile';
    
        if ( bp_is_member() )
        $classes[] = 'member-profile-of-' . bp_displayed_user_username();
    }
    add_filter( 'body_class', 'add_body_classes', 12 );

    jerryskate
    Participant

    @jerryskate

    Well, i use the snippet in my bp-custom.php, which is empty except the snippet. i use the one you guys gave me. What code do you want me to paste, the header.php one?

    Thanks for the effort btw, much appreciated.


    jerryskate
    Participant

    @jerryskate

    Yeah thats what i was thinking too. Seemed kinda weird to me. body.classname would be the obvious choose for me, but well.. weird output. need to fiddle around with it a little to see if i can get it to work. Too bad it filters out all the other classes though. This is how it looks without the filter:

    activity bp-user my-activity my-account just-me buddypress bbp-user-page single singular bbpress page page-id-5 page-template-default logged-in admin-bar bp-wall adminbar-enable not-responsive customize-support

    Wish i could keep those classes and have the bodyclass of the user added.


    jerryskate
    Participant

    @jerryskate

    Hmm there we go. I now get <body jerryclass="" class=" customize-support" and its consistent throughout the priflepage. it does however give me less other classes, which is a problem in my bbpress where i have used the classes for customization there. Maybe i can work around that.

    Im unsure how to use the this bodycalss with css though, i tried .jerryclass, #jerryclass, body.jerryclass.. Nothing seems to work. Any guidance there would be appreciated.

    Thanks for the replies, feels close know!


    jerryskate
    Participant

    @jerryskate

    Nope, thats exactly what i did. It does work though, it outputs the profilename as the only unique class when you land on a profile page due to the slug being your profilename. But as stated above, if you navigate around on someones profile page, forum, sites, notifications etc, the slug changes to something not unique, and it doesn’t work anymore.

    It would work if i used “dirty” permalinks, but being on a multisite its not an option.

    The output in my previous post is what i get when i use the body tag your talking about.


    jerryskate
    Participant

    @jerryskate

    Well, i changed the header.php´s bodytag to that, yes. Should i have done it somewhere else? Took a look around the php right know, didn’t find any obvious places with a body tag. Maybe thats my problem?


    jerryskate
    Participant

    @jerryskate

    Yes of course… I added echo '<pre>' . print_r( $wp_query->query_vars, true ) . '</pre>';

    To dump the output of the body classes in the page source, which you can se in my post above.Pagename gives me the users name, but only when you land on the profile page. Any other tab you click on the profile page, it changes to profile, therefor useless.


    jerryskate
    Participant

    @jerryskate

    Yeah it might be correct, but it doesn’t work. I have tried pretty much anything regarding the body class, but the page doesn’t output anything i can use. It works at the main profile page, where my last slug is unique to the username, but as soon as you click on any tabs at the profile page, its lost, since the slug change to a more universal one. Here´s some of the things i tried, to no luck. https://wordpress.org/support/topic/give-pages-truly-unique-id´s-classes-possible?replies=23

    This is the page output:

      [page] => 0
        [pagename] => profile
        [error] =>
        [m] =>
        [p] => 0
        [post_parent] =>
        [subpost] =>
        [subpost_id] =>
        [attachment] =>
        [attachment_id] => 0
        [name] => profile
        [static] =>
        [page_id] => 0
        [second] =>
        [minute] =>
        [hour] =>
        [day] => 0
        [monthnum] => 0
        [year] => 0
        [w] => 0
        [category_name] =>
        [tag] =>
        [cat] =>
        [tag_id] =>
        [author] =>
        [author_name] =>
        [feed] =>
        [tb] =>
        [paged] => 0
        [comments_popup] =>
        [meta_key] =>
        [meta_value] =>
        [preview] =>
        [s] =>
        [sentence] =>
        [fields] =>
        [menu_order] =>
        [category__in] => Array
            

    As you can see the page doesn’t output a class unique to the profile, so doesn’t seems to work to filter the bodyclass.

    Must be another way of doing this?


    jerryskate
    Participant

    @jerryskate

    Appreciate the answer, but i have already tried it, and it doesn’t work. It actually gives me less body classes, which break other stuff where i use .single and .single-forum rom the body tags.


    jerryskate
    Participant

    @jerryskate

    Still struggling with this- Anyone?


    jerryskate
    Participant

    @jerryskate

    Hmm. Seems to have fixed it finally. Had to clear w3 cache and do some css. Feels a bit “dirty” solution, but seems to work.


    jerryskate
    Participant

    @jerryskate

    Ok i somehow managed to fix this. Hours of trying to solve this, and i do tight after i post here :p I placed this code in both sites functions.php:

    /* This fixes the MULTIBLOG avatar problem */
    function nfm_bp_avtar_upload_path_correct($path){
        if ( bp_core_is_multisite() ){
         //   $path = ABSPATH . get_blog_option( BP_ROOT_BLOG, 'upload_path' );
    		$path = ABSPATH . 'wp-content/uploads/sites/2/';
        }
        return $path;
    }
    add_filter('bp_core_avatar_upload_path', 'nfm_bp_avtar_upload_path_correct', 1);
    
    function nfm_bp_avatar_upload_url_correct($url){
        if ( bp_core_is_multisite() ){
            $url = get_blog_option( BP_ROOT_BLOG, 'siteurl' ) . "/wp-content/uploads/sites/2";
        }
        return $url;
    }
    add_filter('bp_core_avatar_url', 'nfm_bp_avatar_upload_url_correct', 1);

    Changed the path to where my sub site stores the avatars.


    jerryskate
    Participant

    @jerryskate

    Well.. I get that. However, I’m using a theme that have buddypess integrated, so that won’t work for me. I do have my functions in a child theme, and if i need to move to a new theme i can easily bring those functions.

    Anyways, back to my question. Still haven´t find a solution to this.


    jerryskate
    Participant

    @jerryskate

    Still struggling with this one. anyone?


    jerryskate
    Participant

    @jerryskate

    Well, this didn’t work.. It only works for my main profile page where my slug/url is unique to the profilname. If i click other fields in the profile page, notifications, activity etcetera the url changes, and so does my css changes.

    Any other ideas?


    jerryskate
    Participant

    @jerryskate

    Solved it. Added this to functions.php

    function page_bodyclass() {  // add class to <body> tag
    	global $wp_query;
    	$page = '';
    	if (is_front_page() ) {
        	   $page = 'home';
    	} elseif (is_page()) {
       	   $page = $wp_query->query_vars["pagename"];
    	}
    	if ($page)
    		echo 'class= "'. $page. '"';
    }

    and then replaced the body tag in the header with

    <body <?php page_bodyclass(); ?>>


    jerryskate
    Participant

    @jerryskate

    Ok, i just suddenly solved this. I added these lines to my hatches:

    RedirectMatch 301 ^/members/(.*)$ http://abovebasics.com/community/members/$1
    RedirectMatch 301 ^/groups/(.*)$ http://abovebasics.com/community/groups/$1
    RedirectMatch 301 ^/blogs/(.*)$ http://abovebasics.com/community/blogs/$1
    RedirectMatch 301 ^/forums/(.*)$ http://abovebasics.com/community/forums/$1

    placed them just above # add a trailing slash to /wp-admin


    jerryskate
    Participant

    @jerryskate

    Here´s an example. I wrote a post on my main site that have buddypress installed as a plugin, and it shows up on my other site in the network that is integrated buddy press theme.

    If i click at the my name, jerry, it points to the site where i made the post, http://abovebasics.com/members/jroc/, instead of http://abovebasics.com/community/members/jroc/. Stuff i do at the sub site, works as it should, but not the activity from the main site.

    Is it possible to fox this?

    Thanks for the help!


    jerryskate
    Participant

    @jerryskate

    Hmm seems like my solution didn’t work as good as i wanted, so the multiblog option would be best. Cant get it to work though. My main theme has buddy press as a plugin, the second one have it integrated. How should i configure it to work?

    Thanks for the help!


    jerryskate
    Participant

    @jerryskate

    If i could get a custom class for just the #profile, then it would be enough!

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