coppermine-gallery.com/forum

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: korn on May 02, 2004, 11:54:41 AM

Title: Removing field Occupation from My Profile
Post by: korn on May 02, 2004, 11:54:41 AM
How can I remove a field like "Occupation" from "My profile"?
Title: Re: Removing field Occupation from My Profile
Post by: Casper on May 02, 2004, 06:22:39 PM
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'";
Title: Re: Removing field Occupation from My Profile
Post by: korn on May 02, 2004, 07:32:37 PM
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?
Title: Re: Removing field Occupation from My Profile
Post by: Casper on May 02, 2004, 07:47:08 PM
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.
Title: Re: Removing field Occupation from My Profile
Post by: Joachim Müller on May 02, 2004, 10:35:50 PM
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