Jump to content

custom fields in my details screen


drhcanada

Recommended Posts

In the "my details area"

is it possible to change the

  <table width="100%" cellspacing="0" cellpadding="0" class="frame">
   <tr>
     <td><table width="100%" border="0" cellpadding="5" cellspacing="0">
         {foreach key=num item=customfield from=$customfields}
         <tr>
           <td width="150" class="fieldarea">{$customfield.name}</td>
           <td>{$customfield.input} {$customfield.required}</td>
         </tr>
         {/foreach}
     </table></td>
   </tr>
 </table>

to something where I can choose the custom fields that are displayed and which ones are non changeable and which ones can be changed.

Link to comment
Share on other sites

that would be great but the problem is with the admin only option turned on they cant fill it out on sign up.

I want them to fill the fields out, but I want to manualy choose which ones display in their profile and which are read only versus modifiable.

 

instead of the whole $customfield.input database calls, I simply want to know how to call specific custom fields in the database

Link to comment
Share on other sites

  • 2 weeks later...

Th following isn't a beautiful solution, but it does the job. Find the customfield foreach in the clientareadetails.tpl, and replace it with something like this:

          {foreach key=num item=customfield from=$customfields}
         {if $customfield.name neq "Fieldname 1" AND $customfield.name neq "Fieldname 2"}
         <tr>
           <td width="150" class="fieldarea">{$customfield.name}</td>
           <td>{$customfield.input}  {$customfield.required}</td>
         </tr>
         {else}<input type="hidden" name="customfield[{$customfield.id}]" value="{$customfield.value}" />{/if}
         {/foreach}

 

Just replace the Fieldname 1, Fieldname 2 etc. with the fieldnames of the fields you don't want to show.

Link to comment
Share on other sites

that perfect . thanks.

no idea how to simply call a specific field would you? and ignore all others?

 

You mean to show only to display the fields you give in instead of hiding them? Just rebuild the if-statement a bit:

          {foreach key=num item=customfield from=$customfields}
         {if $customfield.name eq "Fieldname 1" OR $customfield.name eq "Fieldname 2"}
         <tr>
           <td width="150" class="fieldarea">{$customfield.name}</td>
           <td>{$customfield.input}  {$customfield.required}</td>
         </tr>
         {else}<input type="hidden" name="customfield[{$customfield.id}]" value="{$customfield.value}" />{/if}
         {/foreach}  

Link to comment
Share on other sites

  • 6 months later...

I just got it!

 

You have two options to make custom fields not editable, in your template code where it says:

 

First option:

 

Locate in your code (clientareadetails.tpl):

 

{$customfield.input}

and replace for:

 

{$customfield.value}

it will only display the value of your custom field and not let it be changed

 

Second option:

 

replace for:

 

{$customfield.input|replace:'>':' readonly>'}

it will set your input for not editable

The first one will match the "Locked Client Profile Fields" new option.

 

For showing specifics custom fields I just repeated the custom field code using couple if/else to restrict to certain custom fields:

{if $customfields}

<!-- restrict to specific custom field - start -->
<table width="100%" cellspacing="0" cellpadding="0" class="frame"><tr>
 <h3>YOU CAN ADD A TITLE HERE</h3>
 <td><table width="100%" border="0" cellpadding="5" cellspacing="0">
   {foreach key=num item=customfield from=$customfields}
     <tr>{if $customfield.name eq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-1" || $customfield.name eq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-2" || $customfield.name eq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-3"}
       <td width="215" class="fieldarea">{$customfield.name}</td>
       <td>{$customfield.input} {$customfield.required}</td>
      {/if}</tr>
    {/foreach}
  </table></td>
</tr></table>
<!-- restrict to specific custom field - end -->

<!-- The "EXACT-NAME-OF-YOUR-CUSTOM-FIELD" is case sensitive, if you change in your settings, you must change in the code too.

You can repeat this table for each section of your custom fields, and at the end set up the next one: -->

<!-- show the rest of customfields, if existent - start -->
{if $customfield.name neq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-1" && $customfield.name neq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-2" && $customfield.name neq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-3"}

<table width="100%" cellspacing="0" cellpadding="0" class="frame"><tr>
 <h3>YOU CAN ADD A TITLE HERE - FOR EXTRA CUSTOM FIELDS</h3>
 <td><table width="100%" border="0" cellpadding="10" cellspacing="0">
   {foreach key=num item=customfield from=$customfields}
     <tr>{if $customfield.name neq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-1" && $customfield.name neq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-2" && $customfield.name neq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-3"}
       <td width="215" class="fieldarea">{$customfield.name}</td>
       <td>{$customfield.input} {$customfield.required}</td>
     {/if}</tr>
   {/foreach}
 </table></td>
</tr></table>

{/if} <!-- show the rest of customfields, if existent - end -->
<br />

{/if} <!-- custom fields -->

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated