[split] Custom Profile Field Idea - Type Specific Options Page Needs To Display Field Name

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
User avatar
durangod
Registered User
Posts: 817
Joined: Tue Nov 03, 2009 1:26 pm
Location: USA East Texas
Name: Dave

[split] Custom Profile Field Idea - Type Specific Options Page Needs To Display Field Name

Post by durangod »

EDIT by Kailey: Idea topic


Here is the mod i did to accomplish this task.

IMPORTANT: be sure you save or download the original copy of the files you are about to edit, so if you mess up you can just replace the files back to original.

acp_profile.php (two edits in this file)

First Edit:

on approx line 328
after this code

Code: Select all

$profile_field = $this->type_collection[$field_type];

add this code

Code: Select all

					
					
/* begin custom mod  */
/* this sets the php variable for the field name and cleans it */

$the_field_name = utf8_clean_string($field_row['field_name']);

/* end custom mod */



Second edit:
approx line 627

change this code

Code: Select all

					'U_BACK'			=> $this->u_action)
					);

to this (just remove the ) and );

Code: Select all

				       'U_BACK'			=> $this->u_action
now add this after new code above

Code: Select all


/* begin custom mod */
/* add template var */
/* i added the , and moved the ) and ); */
                                ,
                                'THE_FIELD_NAME' => $the_field_name)					
				);
				
/* end custom mod */

IMPORTANT see the additional code for this file i added in a later post below before saving and closing this file.

save and close acp_profile.php


now for the html file

acp_profile.html (one edit)

approx line 149

after this code

Code: Select all

		<!-- ELSEIF S_STEP_TWO -->

		<fieldset>
		    
		 <legend>{L_TITLE} 	

add this code (be sure you add this code before the closing </legend>

Code: Select all

    
	
<!-- begin custom mod -->
            <!-- added code to show name of custom field on this page -->
            <!-- added if edit code, text, and field identity name var -->
			<!-- IF S_EDIT_MODE -->
			for field name [{THE_FIELD_NAME}]  
			<!-- ENDIF -->			
<!-- end custom mod -->	

the closing </legend> should be after that code

save and close acp_profile.html

go to general tab in acp and clear the cache.

Your changes should result in showing the field name
custom_profile_edit_results.jpg
You do not have the required permissions to view the files attached to this post.
Last edited by durangod on Mon Dec 02, 2024 12:04 pm, edited 1 time in total.
Username is short for durango dave
User avatar
durangod
Registered User
Posts: 817
Joined: Tue Nov 03, 2009 1:26 pm
Location: USA East Texas
Name: Dave

Re: Custom Profile Field Idea - Type Specific Options Page Needs To Display Field Name

Post by durangod »

I wanted to update this because i found an issue with my mod.

My mod works if the field is already created or if you fill out the info on the first page of creation (basic), but i did not account for the situation if someone goes directly to the "profile type specific options" page without entering the data on the first page. (note... this should not happen if done in the right order but since someone might try it i needed to null the value of the variable name).

The issue is that if that happens my mod variable is not defined and it shows a php system warning on the page. So i just set the custom mod variable $the_field_name to '' if we are creating a new field.

in acp_profile.php

look for this code (approx line 355

Code: Select all

				else
				{			    
				  // We are adding a new field, define basic params


after the open else bracket add this code

Code: Select all

				    
/* begin dave mod */
/* we are adding a new field so there is no field name to display yet */
$the_field_name = '';
/* end dave mod */					    
					
That should prevent the variable undefined warning from occuring.
Username is short for durango dave

Return to “phpBB Custom Coding”