I had the time to refactor and to optimice the profile.module
mainly profile_browse()

list of changes

  • at profile_browse() was a lot of code duplication. reordered this part and put it an own function profile_list_profiles()
    side benefit: use this function in a node to integrate a user-list inside your article
  • removed hardcoded html - this is in theme_profile_list_profiles()
    there was also some inconsistency in it - it is now everywhere the same
  • now there is a unique css-class for every profile-field at theme_profile_listing() - so you can theme it easily (for example:

there is still some room for improvements
like:

  • remove the id at <li id="profiles">...</li>
    I want to rename a lot of classes there
  • checkboxes do not have a title --> rethink theme_profile_block()

...

I hope you like the changes
please test it!

Tobi

Comments

Tobias Maier’s picture

StatusFileSize
new7.19 KB

checkboxes do not have a title --> rethink theme_profile_block()

there were two ways to fix this - but nothing had to do with the function mentioned

  • at profile_view_profile() there is the following line:
    $title = ($field->type != 'checkbox') ? check_plain($field->title) : '';
    

    one solution would be to change the '' to NULL.
    the ":" which is listed on the user-page does disappear (a common example is http://scratch.drupal.org/user/1 - do you see all the single ":" on every item?)
    but then text will be attached to the last item visually (because of the definition-list used)

  • change "the root of the evil":
    --> change theme_user_profile() - that is what I did
Tobias Maier’s picture

StatusFileSize
new7.79 KB

remove the id at <li id="profiles">...</li>
I want to rename a lot of classes there

this patch contains everything of the last patch plus
that the id was replaced by the class ".module-profile" - because I think the main class of every module should start with "module-"
it costs us flexibility and sometimes to have a valid site that we use ids in such an inconsistent way (and so often)

Tobias Maier’s picture

StatusFileSize
new9.17 KB

sorry this was the false file...

Tobias Maier’s picture

Title: refactor profile.module » refactor and cleanup at profile.module and user.module
StatusFileSize
new9.5 KB

i think the class .profile is a perfect example why it is difficult to theme drupal...
.profile is used by the user module again (at theme_user_profile())
I did the hard way: I renamed the class to .module-user-profile and now we have a clear class name which nobody could accidently use

Tobias Maier’s picture

if you want I would go through all core module and change every id to a class tomorrow at work

Tobias Maier’s picture

Title: refactor and cleanup at profile.module and user.module » refactor profile_browse() and cleanup+new small features of profile.module and user.module
moshe weitzman’s picture

Category: bug » feature
Tobias Maier’s picture

Category: feature » bug

ok here comes a summary for this thread:
there are 3 patches which all have additional "features"

  • the first patch is a bugfix for the profile.module - because it brings in more consistency, removes hardcoded html
  • #1 is also a bugfix - it fixes the bug at profile.module and additionally a bug in user.module
  • #4 fixes these two bugs and has a new "feature": it removes the id
drumm’s picture

Can you post either one patch or move the separate pateches into new issues?

Tobias Maier’s picture

I released the main topics in seperate issues:
refactor profile_browse()
senseless colon on user-page

Tobias Maier’s picture

Status: Needs review » Closed (duplicate)