PDA

View Full Version : different profile fields for usergroups


phil_11
08-18-2011, 08:55 AM
First, I want to apologize for my far from perfect english.. ;)

I have different Usergroups, A, B and C. All have the same profile-fields.

Now I want additional fields for A-Users (x,y,z), some for B-Users (u,v,w) and so on.

A should not see the fields for B when filling out the profile, of course - but should see B's fields when looking at B's profile.


As far as i know, this should work with an if-condition for usergroups.
But unfortunately, I have no idea how exactly this condition should look like and where to put it.


Could someone help me, please? :)

greets, phil

phil_11
08-22-2011, 02:31 PM
Nearly 100 views, but no replies yet..

Is my question too banal and nobody wants to tell me to rtfm? ;)

Or is it so specific no one has ever thought about doing that before?


greets,
phil

kh99
08-22-2011, 05:45 PM
I think it's not an easy question to answer. And there is no manual, so you'd have to rtfsc (source code) :)

The custom profile field info is stored in the database (of course), so you need to find where that info is read and then figure out how to tell if it's one of the fields you want to set by user group. And unless they are private fields, you will want to do this where they are displayed *and* where they are edited.

Maybe a different approach would be to add a usergroup id column to the profilefield table (with 0 for all usergroups) and then find everywhere that table is queried and add usergroupid checks to the WHERE clause. I doubt it could be done using hooks only, but I'm not sure.

ETA: I had another thought: maybe if you find the template used to render the profile fields, you could check the field id and user group in a <vb:if... there.

Marco64Th
08-24-2011, 03:36 AM
He only want to users of a group to be able to fill out certain profile fields. He want everyone to see them.

As long as they are not required fields, a template conditional should be able to do the trick. Although i don't like to code functionality into a presentation layer.

Badshah93
08-24-2011, 04:12 AM
its not hard, but need few file edit .. this thing can't be done by template as all the field are in one array..

1. you need to add a field in profilefield table which will store usergroups id's to whom that profile field will be show.

2. Then next thing will be edit functions_user.php file

in that you need to edit fetch_profilefields function..

3. YOu need to edit profile.php file admincp to add a column for entering usergroupid.

kh99
08-24-2011, 08:07 AM
He only want to users of a group to be able to fill out certain profile fields. He want everyone to see them.

Well, I assumed that he wanted everyone only to see the fields that apply to that user's (the user whose profile it is) group, but I could be wrong.

deespys
08-27-2011, 01:12 AM
I am looking for the same thing.

Profile fields based on user groups.

Admins would have profile fields a,b,c,d,e,f

Registered User would only have fields a,b,c and not be able to see d,e,f when they edit their profile.