HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Custom Profile Fields

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#59251 (In Topic #12898)
Avatar

Community saint

Is there a way to get rid of the Custom Profile Field for the Country code? The reason I ask is that I don't need it and it appears there is no way to remove it. I also tried to uncheck the Required Field and got the following error:

Expand: Click Here Click Here



Rick Henson

OCP 4.3.2 & 5.0.1
PHP 5.2.5
MySQL 5.0.51a
FireFox 3.6.8
Back to the top
 
Posted
Rating:
#59264
Avatar

Funnily enough I found exactly the same problem yesterday myself. The fix is to change:

Code

                  $result=form_input_list($custom_field['trans_name'],$_description,'custom_'.strval($custom_field['id']).'_value',$list);
to:

Code

                  $result=form_input_list($custom_field['trans_name'],$_description,'custom_'.strval($custom_field['id']).'_value',$list,NULL,false,$list_required);
in sources/ocf_members_action2.php

I'll look at the stack trace as a separate issue now, you can expect that to be fixed in the next release.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#59313
Avatar

Community saint

Hey Chris,

I tried your change and it did not do anything for my problem but I left the change in place. I then went in a day or 2 later to edit my profile and got the following error:

Expand: Click Here Click Here

I put back the original file and I can enter and edit my profile fine.


Last edit: by rick

Rick Henson

OCP 4.3.2 & 5.0.1
PHP 5.2.5
MySQL 5.0.51a
FireFox 3.6.8
Back to the top
 
Posted
Rating:
#59339
Avatar

Hi,

My fault, I accidentally only gave you part of the fix. The whole bit of surrounding code is:

Code

            case 'form_input_multi_list':
            case 'form_input_list':
            case 'form_input_radio':
               $list=new ocp_tempcode();
               $_value=explode('|',$custom_field['cf_default']);
               // asort($_value);
               $list_required=true;
               if ($function=='form_input_list')
               {
                  if ($value=='') $value=$_value[0];
                  foreach ($_value as $__value)
                  {
                     if ($__value=='') $list_required=false;
                     $list->attach(form_input_list_entry($__value,$value==$__value));
                  }
                  if (($custom_field['cf_encrypted']==1) && (is_encryption_enabled()))
                     $list->attach(form_input_list_entry(do_lang('PRESERVE_ENCRYPTION'),true));
                  $result=form_input_list($custom_field['trans_name'],$_description,'custom_'.strval($custom_field['id']).'_value',$list,NULL,false,$list_required);
               }
               elseif ($function=='form_input_multi_list')

(only a few lines are changed, I put much more here just to make it easier to see where it goes)


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#59344
Avatar

Community saint

Thanks Chris,

As always you guys are the best, works great now…

Rick Henson

OCP 4.3.2 & 5.0.1
PHP 5.2.5
MySQL 5.0.51a
FireFox 3.6.8
Back to the top
 
Posted
Rating:
#59607
Avatar

Well-settled

Hi,

I tried the above fix to see if I could get rid of the Duplicate key name error that occurs each time I try to edit a custom profile field. Unfortunately, I couldn't. I create a custom field, save it, go back, choose the field to edit, change a single character in the description and save again. After the error occurs, the changes seem to have saved fine.

Changes to any predefinded custom fields seem to save fine, too. I initially thought it had sth to do with duplicate numbers in the field order, but apparently it hasn't.

Any hints appreciated,
Peter

Expand: Stack Trace Stack Trace


Back to the top
 
Posted
Rating:
#59630
Avatar

Hi,

The attached should fix it.

Attachment
sources/database_helper.php
» Download: database_helper.php (16 Kb, 109 downloads so far)


Regards,

Chris


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#59674
Avatar

Well-settled

Hi Chris,

Chris Graham said

The attached should fix it.

indeed it does. Changed custom profile fields can be saved without errors now.   :thumbs:

Thanks a lot,
Peter
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: