Skip to:
Content
Pages
Categories
Search
Top
Bottom

w3c compliant coding and buddypress

  • Avatar of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Hi all

    I just want to know your views about w3c compliant coding with buddypress.I have done several themes/sites with buddypress.

    Some of the time my clients want that the site should be w3c compliant and we mostly validate the css/xhtml.

    In buddypress,we are able to validate most of the things except the repetition of same id for user avatar.

    for example,say in case of wire posts,If a user posts 3 times on your wire,all the user avatars(for same user) will have same id.

    This causes the page to be invalid.

    Is there a solution that instead of Id ,the avatr uses class only,so the things get validated.

    Your thoughts please.

Viewing 5 replies - 1 through 5 (of 5 total)
  • If you are able to make a patch to improve this behaviour, upload it to the Trac. Otherwise upload an enhancement ticket as a suggestion.

    I was just looking at the code and I’m not sure the id on the img tag actually serves any purpose. Or does it? Perhaps it could just be removed… in the name of W3C validation? I often come across this actually where an id will be used in a loop and end up creating multiple identical “unique” identifiers upon rendering the HTML page.

    Avatar of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    Thanks for the suggestion DJPaul

    I will take another look at the bp_core_fetch_avatar and see if I can implement the code to remove id and upload to trac if done.

    and yeh David,I agree with you,the ids should not be used for things which are supposed to exist multiple time on the page.

    Should be a simple fix.

    Avatar of Brajesh Singh
    Brajesh Singh
    Participant

    @sbrajesh

    hi Andy

    You were right.I just changed one line in bp_core_fetch_avatar and it worked .No more ids ,no more problem :)

    I changed

    return apply_filters( 'bp_core_fetch_avatar', "<img src='{$avatar_url}' alt='{$alt}' id='{$css_id}' class='{$class}'{$html_width}{$html_height} />", $params );

    to

    return apply_filters( 'bp_core_fetch_avatar', "<img src='{$avatar_url}' alt='{$alt}' class='{$class}'{$html_width}{$html_height} />", $params );

    Thanks

    Brajesh

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

You must be logged in to reply to this topic.