By raph on Saturday, 03 October 2015
Likes 0
Views 1.1K
Votes 0
Hi Stackideas team,

Is it possible to assign a proper CSS class to each profile type?

Best

Raph
You probably want to edit the file /components/com_easysocial/themes/wireframe/profile/default.php and you can use a code like this to generate the class names,


class="profile-<?php echo $user->getProfile()->id;?>"
·
Monday, 05 October 2015 10:49
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Raph,

I am really sorry for the delay of this reply as it is a weekend for us here. Hm, not really sure what you mean here. Can you please elaborate more on this please?
·
Sunday, 04 October 2015 02:36
·
0 Likes
·
0 Votes
·
0 Comments
·
I think I have a pretty good idea of what they mean. In the div element that loads the profile, they want an additional class with the name of the profile type. Here's a screen shot showing this ("default-users" is highlighted):



By having it in the first loaded div element, this gives the user full control of styling based on the profile type. So if a user type was named "Premium Users", the class that would load in would be "premium-users". This would allow us to hide elements based on profile type, hence adding another layer of flexibility. Classes can go a long ways.
·
Sunday, 04 October 2015 14:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm, unfortunately right now this isn't possible but you can always customize this by modifying the theme file for the profile view.
·
Sunday, 04 October 2015 15:06
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Josh,

Yes I want to have a class "profile-one" automatically added to the body of profile one type user views
and a class "profile-two" automatically added to the body of profile two type user views
to be able to render/style the elements differently for the two profiles.

Mark,

Could you kindly elaborate on the requested modifications to be applied to the theme file for the profile view. I need your help.. ;-)

Thanking you,

Raph
·
Monday, 05 October 2015 08:56
·
0 Likes
·
0 Votes
·
0 Comments
·
The best method would be to ouput the Profile Type's alias so that there is no space in the class title (classes with spaces will be considered separate classes). Raph wants to know what theme file to modify and the php code to output the Profile Type alias.

@raph: Unless the Profile Type's have alias's of "profile-two", it's actually easier to output the real alias of that Profile Type. I suppose you could output the Profile Type id as an alternative (you would set a prefix to be more specific of what the class number means).
·
Monday, 05 October 2015 09:52
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey
@Josh and @Mark,

Yes structuring the class either with the profile alias or with the profile id number with prefix [profile id number is a more stable solution no? cause it can't be modified hence your css won't change if you change the name or alia of your profile, what do you think?] would make it and be useful. ;-)
·
Monday, 05 October 2015 10:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Works like a charm. Awesome! Thanks Mark!

and thanks Josh.
·
Monday, 05 October 2015 12:41
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome Raph.
·
Monday, 05 October 2015 12:44
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post