Removing field Occupation from My Profile Removing field Occupation from My Profile
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Removing field Occupation from My Profile

Started by korn, May 02, 2004, 11:54:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

korn

How can I remove a field like "Occupation" from "My profile"?

Casper

Easy way.  This will enable you to change 'Occupation' to field of your choice, or leave it blank.;

Open your language file, and find;

'occupation' => 'Occupation',  
and
'user_occupation' => 'User occupation',

In both cases, change the 2nd bit to => ''
Or put your new name for the field here.


Hard way.  This removes the field altogether. Back up these files first.

Open register.php, and find;

array('input', 'occupation', $lang_register_php['occupation'], 255),
and
$occupation = addslashes(get_post_var('occupation'));

Comment them out (or delete them)

Now find;

$sql = "INSERT INTO {$CONFIG['TABLE_USERS']} " . "(user_regdate, user_active, user_actkey, user_name, user_password, user_email, user_location, user_interests, user_website, user_occupation) " . "VALUES (NOW(), '$active', '$act_key', '" . addslashes($user_name) . "', '" . addslashes($password) . "', '" . addslashes($email) . "', '$location', '$interests', '$website', '$occupation' )";

and change it to;

$sql = "INSERT INTO {$CONFIG['TABLE_USERS']} " . "(user_regdate, user_active, user_actkey, user_name, user_password, user_email, user_location, user_interests, user_website) " . "VALUES (NOW(), '$active', '$act_key', '" . addslashes($user_name) . "', '" . addslashes($password) . "', '" . addslashes($email) . "', '$location', '$interests', '$website')";


Now open profile.php, and comment out or delete the following;

array('input', 'occupation', $lang_register_php['occupation'], 255),

and

array('text', 'occupation', $lang_register_php['occupation']),

and

$occupation = get_post_var('occupation');

and

'occupation' => $user_data['user_occupation'],

Note, the last 1 is there 2 times, delete both.

Now find;

$sql = "UPDATE {$CONFIG['TABLE_USERS']} SET " . "user_location = '$location', " . "user_interests = '$interests', " . "user_website = '$website', " . "user_occupation = '$occupation' " . "user_profile1 = '$profile1' " . "user_profile2 = '$profile2' " . "user_profile3 = '$profile3' " . "user_profile4 = '$profile4' "  . "WHERE user_id = '" . USER_ID . "'";

and change it to;

$sql = "UPDATE {$CONFIG['TABLE_USERS']} SET " . "user_location = '$location', " . "user_interests = '$interests', " . "user_website = '$website', " . "user_profile1 = '$profile1' " . "user_profile2 = '$profile2' " . "user_profile3 = '$profile3' " . "user_profile4 = '$profile4' "  . "WHERE user_id = '" . USER_ID . "'";

Now find;

$sql = "SELECT user_name, user_email, user_group, UNIX_TIMESTAMP(user_regdate) as user_regdate, group_name, " . "user_location, user_interests, user_website, user_occupation, user_profile1, user_profile2, user_profile3, user_profile4, user_lang as user_group_list, " . "COUNT(pid) as pic_count, ROUND(SUM(total_filesize)/1024) as disk_usage, group_quota " . "FROM {$CONFIG['TABLE_USERS']} AS u " . "INNER JOIN {$CONFIG['TABLE_USERGROUPS']} AS g ON user_group = group_id " . "LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.owner_id = u.user_id " . "WHERE user_id ='" . USER_ID . "' " . "GROUP BY user_id ";

and change it to;

$sql = "SELECT user_name, user_email, user_group, UNIX_TIMESTAMP(user_regdate) as user_regdate, group_name, " . "user_location, user_interests, user_website, user_profile1, user_profile2, user_profile3, user_profile4, user_lang as user_group_list, " . "COUNT(pid) as pic_count, ROUND(SUM(total_filesize)/1024) as disk_usage, group_quota " . "FROM {$CONFIG['TABLE_USERS']} AS u " . "INNER JOIN {$CONFIG['TABLE_USERGROUPS']} AS g ON user_group = group_id " . "LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.owner_id = u.user_id " . "WHERE user_id ='" . USER_ID . "' " . "GROUP BY user_id ";

Finally, find;

$sql = "SELECT user_name, user_email, UNIX_TIMESTAMP(user_regdate) as user_regdate, group_name, " . "user_location, user_interests, user_website, user_occupation, user_profile1, user_profile2, user_profile3, user_profile4" . "FROM {$CONFIG['TABLE_USERS']} AS u " . "INNER JOIN {$CONFIG['TABLE_USERGROUPS']} AS g ON user_group = group_id " . "WHERE user_id ='$uid'";

and change it to;

$sql = "SELECT user_name, user_email, UNIX_TIMESTAMP(user_regdate) as user_regdate, group_name, " . "user_location, user_interests, user_website, user_profile1, user_profile2, user_profile3, user_profile4" . "FROM {$CONFIG['TABLE_USERS']} AS u " . "INNER JOIN {$CONFIG['TABLE_USERGROUPS']} AS g ON user_group = group_id " . "WHERE user_id ='$uid'";
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

korn

Casper, thank you very much! The field is gone.

One more question about My Profile. How come a user itself cannot change his or her ema-il address?

Casper

I'm not sure this is why, but I think it's to stop malicious users registering, then immediately changing their email so they can't be traced.  If they want to change for genuine reasons, email to the admin who can do it for them.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Joachim Müller

Casper's right by guessing it's to prevent abuse. There'll be an a admin switch in future versions (at least it's on my todo list) that will say "allow user to change email address[Yes]/[No]".

GauGau