[HOW TO] Utilizing each Custom Profile Field

All style (template, theme and imageset) related questions for the new release; advice, feedback here please.
Post Reply
User avatar
Sniper_E
Registered User
Posts: 6
Joined: Sat Sep 29, 2007 4:57 pm

[HOW TO] Utilizing each Custom Profile Field

Post by Sniper_E »

I have been working with the <!-- IF postrow.S_PROFILE_FIELD1 --> and trying to figure it out. (with no luck)
I've read a lot of topics on this at .com and in area51. I have not seen an answer to what I was looking for.

Here, I will show you how I was able to utilize and control the different custom profile fields we've added to our sites.

This is the section of the viewtopic_body.html which we are all having problems to get to work like we want it to.

Code: Select all

					<!-- IF postrow.S_PROFILE_FIELD1 -->
						<!-- Use a construct like this to include admin defined profile fields. Replace FIELD1 with the name of your field. -->
						<br /><b>{postrow.PROFILE_FIELD1_NAME}:</b> {postrow.PROFILE_FIELD1_VALUE}
					<!-- ENDIF -->
I have side stepped that section above and utilized/customized the <!-- BEGIN custom_fields --> to get what we wanted.
Highway of Life and Handyman have 3 custom profile fields they use on our STG site.
  • Favorite Team
  • Gender
  • Real Name
Watch how each custom profile field was sectioned off and called for individually in this code I have setup on our styles.

OPEN styles/subsilver2/template/viewtopic_body.html

FIND

Code: Select all

					<!-- BEGIN custom_fields -->
						<br /><b>{postrow.custom_fields.PROFILE_FIELD_NAME}:</b> {postrow.custom_fields.PROFILE_FIELD_VALUE}
					<!-- END custom_fields -->
REPLACE WITH

Code: Select all

					<!-- BEGIN custom_fields -->
					<!-- IF postrow.custom_fields.PROFILE_FIELD_NAME eq "Favorite Team" -->
<b>{postrow.custom_fields.PROFILE_FIELD_NAME}:</b> {postrow.custom_fields.PROFILE_FIELD_VALUE}<br />
					<!-- ENDIF -->

					<!-- IF postrow.custom_fields.PROFILE_FIELD_NAME eq "Gender" -->
<b>{postrow.custom_fields.PROFILE_FIELD_NAME}:</b> {postrow.custom_fields.PROFILE_FIELD_VALUE}<br />
					<!-- ENDIF -->
					<!-- END custom_fields -->
OPEN styles/prosilver/template/viewtopic_body.html

FIND

Code: Select all

		<!-- BEGIN custom_fields -->
			<dd><strong>{postrow.custom_fields.PROFILE_FIELD_NAME}:</strong> {postrow.custom_fields.PROFILE_FIELD_VALUE}</dd>
		<!-- END custom_fields -->
REPLACE WITH

Code: Select all

		<!-- BEGIN custom_fields -->
               <!-- IF postrow.custom_fields.PROFILE_FIELD_NAME eq "Favorite Team" -->
			<dd><strong>{postrow.custom_fields.PROFILE_FIELD_NAME}:</strong> {postrow.custom_fields.PROFILE_FIELD_VALUE}</dd>
               <!-- ENDIF -->

               <!-- IF postrow.custom_fields.PROFILE_FIELD_NAME eq "Gender" -->
			<dd><strong>{postrow.custom_fields.PROFILE_FIELD_NAME}:</strong> {postrow.custom_fields.PROFILE_FIELD_VALUE}</dd>
               <!-- ENDIF -->
		<!-- END custom_fields -->
See how I'm calling for each specific custom profile field and placing each one where I want it in my page?
You can place each field you've added anywhere in your page that you want it.

Now for the 3rd custom profile field, "Real Name" I want this field further up the page under the username.

For subsilver2
FIND

Code: Select all

			<!-- IF postrow.ONLINE_IMG -->
REPLACE WITH

Code: Select all

                        <!-- BEGIN custom_fields -->
				<!-- IF postrow.custom_fields.PROFILE_FIELD_NAME eq "Real Name" -->
				<tr>
					<td align="center" nowrap="nowrap"><b class="postauthor"<!-- IF postrow.POST_AUTHOR_COLOUR --> style="color: {postrow.POST_AUTHOR_COLOUR}"<!-- ENDIF -->><i>{postrow.custom_fields.PROFILE_FIELD_VALUE}</i></b></td>
				</tr>
				<!-- ENDIF -->
                        <!-- END custom_fields -->
			<!-- IF postrow.ONLINE_IMG -->
For prosilver
FIND

Code: Select all

			<dt>
				<!-- IF postrow.POSTER_AVATAR -->
					<!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}">{postrow.POSTER_AVATAR}</a><!-- ELSE -->{postrow.POSTER_AVATAR}<!-- ENDIF --><br />
				<!-- ENDIF -->
				<!-- IF not postrow.U_POST_AUTHOR --><strong>{postrow.POST_AUTHOR_FULL}</strong><!-- ELSE -->{postrow.POST_AUTHOR_FULL}<!-- ENDIF -->
 			</dt>
REPLACE WITH

Code: Select all

			<dt>
				<!-- IF postrow.POSTER_AVATAR -->
					<!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}">{postrow.POSTER_AVATAR}</a><!-- ELSE -->{postrow.POSTER_AVATAR}<!-- ENDIF --><br />
				<!-- ENDIF -->
				<!-- IF not postrow.U_POST_AUTHOR --><strong>{postrow.POST_AUTHOR_FULL}</strong><!-- ELSE -->{postrow.POST_AUTHOR_FULL}<!-- ENDIF -->
				<!-- BEGIN custom_fields -->
					<!-- IF postrow.custom_fields.PROFILE_FIELD_NAME eq "Real Name" -->
					&nbsp; &nbsp; <b class="postauthor"<!-- IF postrow.POST_AUTHOR_COLOUR --> style="color: {postrow.POST_AUTHOR_COLOUR}"<!-- ENDIF -->><i>{postrow.custom_fields.PROFILE_FIELD_VALUE}</i></b>
					<!-- ENDIF -->
				<!-- END custom_fields -->
 			</dt>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I also worked with a couple of guys here who used a "Clan Site" custom profile field for their users.
But, they didn't want the url which a user entered in to show up in that profile field.
They wanted an image (a button) to be there that would link them to the url address.

Watch how this works with an image.... which we couldn't do before.

FIND

Code: Select all

					<!-- BEGIN custom_fields -->
						<br /><b>{postrow.custom_fields.PROFILE_FIELD_NAME}:</b> {postrow.custom_fields.PROFILE_FIELD_VALUE}
					<!-- END custom_fields -->
REPLACE WITH

Code: Select all

                   <!-- BEGIN custom_fields -->
                        <!-- IF postrow.custom_fields.PROFILE_FIELD_NAME eq "Clan Site" -->
                            <b>{postrow.custom_fields.PROFILE_FIELD_NAME}:</b>  <a href="{postrow.custom_fields.PROFILE_FIELD_VALUE}"><img src="{T_IMAGESET_PATH}/en/icon_contact_www.gif" alt="{postrow.custom_fields.PROFILE_FIELD_VALUE}" title="{postrow.custom_fields.PROFILE_FIELD_VALUE}"></a>
                         <!-- ENDIF -->
                   <!-- END custom_fields -->
Hope this helps out all those who have been battling this along with me.
Attachments
cpf_subsilver2.jpg
cpf_subsilver2.jpg (84.88 KiB) Viewed 15823 times
cpf_prosilver.jpg
cpf_prosilver.jpg (63.4 KiB) Viewed 15823 times
Last edited by Sniper_E on Sun Dec 13, 2009 5:34 am, edited 1 time in total.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!

Dakin Quelia
Registered User
Posts: 11
Joined: Mon Feb 02, 2009 4:44 pm

Re: [HOW TO] Utilizing each Custom Profile Field

Post by Dakin Quelia »

Hello,

I tested and it works fine. However it's missing a party for dropdown box in template file (e.g. to define choice 1 == image1 etc). :)

See you soon,

Edit: I found. ;)

Example:

Code: Select all

<!-- BEGIN custom_fields -->
	<!-- IF postrow.custom_fields.PROFILE_FIELD_NAME eq "Weapon" -->
		<dd><strong>{postrow.custom_fields.PROFILE_FIELD_NAME}:</strong> 
			<!-- IF postrow.custom_fields.PROFILE_FIELD_VALUE eq "Blue Lightsaber" -->
			<img src="{ROOT_PATH}images/armes/vaderazul.gif" alt="Arme" /></dd>
			<!-- ENDIF -->
			<!-- IF postrow.custom_fields.PROFILE_FIELD_VALUE eq "Red Lightsaber" -->
			<img src="{ROOT_PATH}images/armes/vaderrojo2.gif" alt="Arme" /></dd>
			<!-- ENDIF -->
	<!-- ENDIF -->
<!-- END custom_fields -->

Post Reply