[ABD] Custom Profile Fields For Admin (1.0.3)

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
User avatar
CoC
Registered User
Posts: 280
Joined: Tue Jul 18, 2006 11:16 am
Location: Coventry
Contact:

[ABD] Custom Profile Fields For Admin (1.0.3)

Post by CoC »

MOD Title: Custom Profile Fields For Admin
MOD Description: Remove selected Custom Profile Fields from the UCP.

MOD Version: 1.0.3
phpBB Version: phpBB 3.0.0

MOD Download: Click Me

I have seen this requested a couple of times, so here it is, you can set which custom profile fields users can edit from the UCP, it doesn't effect registration so you can force members to fill in the field on sign up and not worry about them being changed at a later date.

If users are already registered on your forums then they will not be able to set the field or edit it, only admins can edit fields after a user is registered through the ACP -> Users -> Profile.

Screen capture of the ACP, Add / Edit profile field for custom profile fields.
Image

No screen capture of the UCP - would be pointless.

Updated to 1.0.1 - Fixed error when saving profile with required fields hidden.
Updated to 1.0.2 - Fixed error when saving profile with required fields hidden. that I never fixed in 1.0.1
Updated to 1.0.3 - Admin can edit hidden fields from the UCP
Last edited by DavidIQ on Mon Jan 13, 2014 1:51 pm, edited 6 times in total.
Reason: Marked as abandoned.

User avatar
playerfr
Registered User
Posts: 851
Joined: Fri Jul 18, 2003 9:50 am
Location: France - Paris

Re: [RC] Custom Profile Fields For Admin (1.0.0)

Post by playerfr »

Seem nice :)

Thanks
All kind of help for your Forums / Sites. Installing for you the forum, the Mods, creating Custom Mods : for small fee http://www.phpbbhelpers.com

niall_sg1
Registered User
Posts: 38
Joined: Fri Feb 10, 2006 5:20 pm

Re: [RC] Custom Profile Fields For Admin (1.0.0)

Post by niall_sg1 »

Thanks :D This is exactly what I need :D

Farjo
Registered User
Posts: 19
Joined: Fri Apr 13, 2007 12:44 am
Location: Bristol, UK

Re: [RC] Custom Profile Fields For Admin (1.0.0)

Post by Farjo »

Thank you, this solves a problem I could not fix :)

cotp
Registered User
Posts: 445
Joined: Wed Sep 14, 2005 7:34 pm
Contact:

Re: [RC] Custom Profile Fields For Admin (1.0.0)

Post by cotp »

CoC,

I just installed your MOD but I have a problem.
My field is an obligatory one at registration.

1) I changed this field to put "Admin edit field only" to "Yes"
2) I disconnected and connected again as a test user
3) Went to the UCP and the field was indeed not there :mrgreen:
4) But when I try and save changes for this profile it keeps asking me the obligatory field even though it is not there ! :shock:

Can you help me on this ?

Cotp

cotp
Registered User
Posts: 445
Joined: Wed Sep 14, 2005 7:34 pm
Contact:

Re: [RC] Custom Profile Fields For Admin (1.0.0)

Post by cotp »

sorry please delete this post as I don't find a delete button

User avatar
CoC
Registered User
Posts: 280
Joined: Tue Jul 18, 2006 11:16 am
Location: Coventry
Contact:

Re: [RC] Custom Profile Fields For Admin (1.0.1)

Post by CoC »

Sorry I haven't replied - been moving house.

This should do it, sorry about that.

includes/functions_profile_fields.php

Find-

Code: Select all

case FIELD_BOOL:
				if (!$field_value && $field_data['field_required'])
				{
					return 'FIELD_REQUIRED';
				}
			break;

			case FIELD_INT:
				if (empty($field_value) && !$field_data['field_required'])
				{
					return false;
				}

				if ($field_value < $field_data['field_minlen'])
				{
					return 'FIELD_TOO_SMALL';
				}
				else if ($field_value > $field_data['field_maxlen']) 
				{
					return 'FIELD_TOO_LARGE';
				}
			break;
		
			case FIELD_DROPDOWN:
				if ($field_value == $field_data['field_novalue'] && $field_data['field_required'])
				{
					return 'FIELD_REQUIRED';
				}
			break;
			
			case FIELD_STRING:
			case FIELD_TEXT:
				if (empty($field_value) && !$field_data['field_required'])
				{
					return false;
				}
				else if (empty($field_value) && $field_data['field_required'])
				{
					return 'FIELD_REQUIRED';
				}
Replace with -

Code: Select all

case FIELD_BOOL:
				if (!$field_value && $field_data['field_required'] && $field_data['field_no_edit'] == 1)
				{
					return 'FIELD_REQUIRED';
				}
			break;

			case FIELD_INT:
				if (empty($field_value) && !$field_data['field_required'] && $field_data['field_no_edit'] == 1)
				{
					return false;
				}

				if ($field_value < $field_data['field_minlen'])
				{
					return 'FIELD_TOO_SMALL';
				}
				else if ($field_value > $field_data['field_maxlen']) 
				{
					return 'FIELD_TOO_LARGE';
				}
			break;
		
			case FIELD_DROPDOWN:
				if ($field_value == $field_data['field_novalue'] && $field_data['field_required'] && $field_data['field_no_edit'] == 1)
				{
					return 'FIELD_REQUIRED';
				}
			break;
			
			case FIELD_STRING:
			case FIELD_TEXT:
				if (empty($field_value) && !$field_data['field_required'] && $field_data['field_no_edit'] == 1)
				{
					return false;
				}
				else if (empty($field_value) && $field_data['field_required'] && $field_data['field_no_edit'] == 1)
				{
					return 'FIELD_REQUIRED';
				}

cotp
Registered User
Posts: 445
Joined: Wed Sep 14, 2005 7:34 pm
Contact:

Re: [RC] Custom Profile Fields For Admin (1.0.1)

Post by cotp »

CoC wrote:Sorry I haven't replied - been moving house.

This should do it, sorry about that.

includes/functions_profile_fields.php

Find-

Code: Select all

case FIELD_BOOL:
				if (!$field_value && $field_data['field_required'])
				{
					return 'FIELD_REQUIRED';
				}
			break;

			case FIELD_INT:
				if (empty($field_value) && !$field_data['field_required'])
				{
					return false;
				}

				if ($field_value < $field_data['field_minlen'])
				{
					return 'FIELD_TOO_SMALL';
				}
				else if ($field_value > $field_data['field_maxlen']) 
				{
					return 'FIELD_TOO_LARGE';
				}
			break;
		
			case FIELD_DROPDOWN:
				if ($field_value == $field_data['field_novalue'] && $field_data['field_required'])
				{
					return 'FIELD_REQUIRED';
				}
			break;
			
			case FIELD_STRING:
			case FIELD_TEXT:
				if (empty($field_value) && !$field_data['field_required'])
				{
					return false;
				}
				else if (empty($field_value) && $field_data['field_required'])
				{
					return 'FIELD_REQUIRED';
				}
Replace with -

Code: Select all

case FIELD_BOOL:
				if (!$field_value && $field_data['field_required'] && $field_data['field_no_edit'] == 1)
				{
					return 'FIELD_REQUIRED';
				}
			break;

			case FIELD_INT:
				if (empty($field_value) && !$field_data['field_required'] && $field_data['field_no_edit'] == 1)
				{
					return false;
				}

				if ($field_value < $field_data['field_minlen'])
				{
					return 'FIELD_TOO_SMALL';
				}
				else if ($field_value > $field_data['field_maxlen']) 
				{
					return 'FIELD_TOO_LARGE';
				}
			break;
		
			case FIELD_DROPDOWN:
				if ($field_value == $field_data['field_novalue'] && $field_data['field_required'] && $field_data['field_no_edit'] == 1)
				{
					return 'FIELD_REQUIRED';
				}
			break;
			
			case FIELD_STRING:
			case FIELD_TEXT:
				if (empty($field_value) && !$field_data['field_required'] && $field_data['field_no_edit'] == 1)
				{
					return false;
				}
				else if (empty($field_value) && $field_data['field_required'] && $field_data['field_no_edit'] == 1)
				{
					return 'FIELD_REQUIRED';
				}

Thanks CoC, I did that, but now it seems the profile field is not obligatory anymore ? People can enter what they want... I will look if I have make any mistake, can you tell me if that code works with your system ?

Obligatory field at registration only viewable afterwords by admin...

User avatar
CoC
Registered User
Posts: 280
Joined: Tue Jul 18, 2006 11:16 am
Location: Coventry
Contact:

Re: [RC] Custom Profile Fields For Admin (1.0.2)

Post by CoC »

cotp,

I have updated the mod, it should now do as you have asked, what you will need to do is reverse the edit made in http://www.phpbb.com/community/viewtopi ... 2#p3182232

and apply this instead,

Find -

Code: Select all

					$sql_where .= ' AND f.field_hide = 0';
				}
After Add -

Code: Select all

				if (!$auth->acl_gets('a_'))
				{
					$sql_where .= ' AND f.field_no_edit = 1 ';
				}

Find -

Code: Select all

					$sql_where .= ' AND f.field_hide = 0';
				}
After Add -

Code: Select all

				if (!$auth->acl_gets('a_'))
				{
					$sql_where .= ' AND f.field_no_edit = 1 ';
				}
Sorry it's took a while, been a bit busy and wanted to get the Xbox tag mod done and out the way first.

jon123
Registered User
Posts: 148
Joined: Fri Jun 22, 2007 6:00 am

Re: [RC] Custom Profile Fields For Admin (1.0.2)

Post by jon123 »

Help on

Code: Select all

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /var/www/hostedsites/d2tbpk.com/includes/acp/acp_profile.php on line 1033
when entering custom profile in UPC

help plz

cotp
Registered User
Posts: 445
Joined: Wed Sep 14, 2005 7:34 pm
Contact:

Re: [RC] Custom Profile Fields For Admin (1.0.2)

Post by cotp »

CoC wrote:cotp,

I have updated the mod, it should now do as you have asked, what you will need to do is reverse the edit made in http://www.phpbb.com/community/viewtopi ... 2#p3182232

and apply this instead (...)

Sorry it's took a while, been a bit busy and wanted to get the Xbox tag mod done and out the way first.
Thanks Coc, I applied your changes :)

Just so you know, the field nows indeed does not display but there is still a problem

If I mark this field as a "Required field" (Force profile field to be filled out or specified by user. This will display the profile field at registration and within the user control panel.) and as an "Editable by Admin only" what will happen ?

When a user registers, he will be asked for that field.

Now when ANY member including admin, go to edit its profile on the UCP, he will not see this profile field and when you press SAVE CHANGES it will KEEP ASKING FOR THAT FIELD....

I found a work around for now, what I do is I leave the field a non required field, and at registration I added a javascript to make this field a required field, but that's just a small patch, your mod still has this bug.

Hope I explained it clearly :oops:

Cotp

User avatar
Kickerspieler
Registered User
Posts: 5
Joined: Wed Aug 29, 2007 8:49 am
Contact:

Re: [RC] Custom Profile Fields For Admin (1.0.2)

Post by Kickerspieler »

I have a roblem with the Mod ^^
Whats this ?

General error
SQL ERROR [ mysql4 ]

Unknown column 'field_no_edit' in 'field list' [1054]

SQL

INSERT INTO phpbb_3profile_fields (field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_on_reg, field_hide, field_no_view, field_no_edit, field_type, field_ident, field_name, field_order, field_active) VALUES (10, 0, 20, '', '', '.*', 0, 0, 0, 0, 0, 2, 'beruf', 'beruf', 7, 1)

BACKTRACE

User avatar
CoC
Registered User
Posts: 280
Joined: Tue Jul 18, 2006 11:16 am
Location: Coventry
Contact:

Re: [RC] Custom Profile Fields For Admin (1.0.2)

Post by CoC »

jon123 wrote:Help on

Code: Select all

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /var/www/hostedsites/d2tbpk.com/includes/acp/acp_profile.php on line 1033
when entering custom profile in UPC

help plz
In - includes/acp/acp_profile.php

I suspect you missed part of this edit, the comma.

Find

Code: Select all

'field_no_view'			=> $cp->vars['field_no_view']
After Add

Code: Select all

,
			'field_no_edit'			=> $cp->vars['field_no_edit']
So the actual lines look like -

Code: Select all

			'field_hide'			=> $cp->vars['field_hide'],
			'field_no_view'			=> $cp->vars['field_no_view'],
			'field_no_edit'			=> $cp->vars['field_no_edit']
		);
I think this maybe a bettter add before than add after, will change it later.

Kickerspieler wrote:I have a roblem with the Mod ^^
Whats this ?

General error
SQL ERROR [ mysql4 ]

Unknown column 'field_no_edit' in 'field list' [1054]

SQL

INSERT INTO phpbb_3profile_fields (field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_on_reg, field_hide, field_no_view, field_no_edit, field_type, field_ident, field_name, field_order, field_active) VALUES (10, 0, 20, '', '', '.*', 0, 0, 0, 0, 0, 2, 'beruf', 'beruf', 7, 1)

BACKTRACE
You need to the SQL query from the install file.

Code: Select all

ALTER TABLE `phpbb_profile_fields` ADD `field_no_edit` TINYINT( 1 ) UNSIGNED DEFAULT '1' NOT NULL AFTER `field_active` ;

User avatar
CoC
Registered User
Posts: 280
Joined: Tue Jul 18, 2006 11:16 am
Location: Coventry
Contact:

Re: [RC] Custom Profile Fields For Admin (1.0.2)

Post by CoC »

cotp wrote:
CoC wrote:Thanks Coc, I applied your changes :)

Just so you know, the field nows indeed does not display but there is still a problem

If I mark this field as a "Required field" (Force profile field to be filled out or specified by user. This will display the profile field at registration and within the user control panel.) and as an "Editable by Admin only" what will happen ?

When a user registers, he will be asked for that field.

Now when ANY member including admin, go to edit its profile on the UCP, he will not see this profile field and when you press SAVE CHANGES it will KEEP ASKING FOR THAT FIELD....

I found a work around for now, what I do is I leave the field a non required field, and at registration I added a javascript to make this field a required field, but that's just a small patch, your mod still has this bug.

Hope I explained it clearly :oops:

Cotp
When any member except admin goes to the UCP -> Profile and the field is hidden and empty it will continue and save without the field, except in the case of admin only where it will tell you the field is empty and needs to be filled.

It's like that because if you have members already registered they would never be able to edit their profiles if the field is empty, but this way the admin can view and edit the fields through the ACP.

cotp
Registered User
Posts: 445
Joined: Wed Sep 14, 2005 7:34 pm
Contact:

Re: [RC] Custom Profile Fields For Admin (1.0.2)

Post by cotp »

CoC wrote:When any member except admin goes to the UCP -> Profile and the field is hidden and empty it will continue and save without the field, except in the case of admin only where it will tell you the field is empty and needs to be filled.

It's like that because if you have members already registered they would never be able to edit their profiles if the field is empty, but this way the admin can view and edit the fields through the ACP.

Okay, but in this case then an admin can't change his own profile :shock:

Cotp

Locked

Return to “[3.0.x] Abandoned MODs”