CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • $customPost output empty for authenticated users on any profile
Pages: [1]

Author Topic: $customPost output empty for authenticated users on any profile  (Read 608 times)

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
$customPost output empty for authenticated users on any profile
June 25, 2012, 09:25:10 am
On a Civi 3.4 installation with Drupal 6 I am experiencing an odd behavior that I am stuck on how else to debug.

On an Event registration, any profile I put in the 'top of page' section shows up fine. Any profile I put in the bottom of page shows up fine for anonymous users but it does not show up for any authenticated user. This is not an ACL issue because I can put the same profile in the profile 'top' section and it will show up fine for any user role.

I have confirmed that Register.tpl is still calling {include file="CRM/UF/Form/Block.tpl" fields=$customPost}  no matter what. If I put a {$fields | @print_r} at the top of Block.tpl I get the following for anon users:
Code: [Select]
Array ( [custom_43] => Array ( [name] => custom_43 [groupTitle] => test profile [groupHelpPre] => [groupHelpPost] => [title] => This is a test question [where] => [attributes] => [is_required] => 0 [is_view] => 0 [help_pre] => [help_post] => [visibility] => Public Pages [in_selector] => 0 [rule] => [location_type_id] => [phone_type_id] => [group_id] => 38 [add_to_group_id] => [add_captcha] => 0 [field_type] => Participant [field_id] => 376 [is_search_range] => 0 [options_per_line] => [data_type] => String [html_type] => Text ) ) 1;
but I only get this for authenticated users:
Code: [Select]
Array ( ) 1;
Similarly, smartyDebug prints the following to my console for authenticated users:

{$customPost}    Array (0)

Can anyone shed light into what the issue is here? Again, I can put this same profile in the 'top of page' section and it will show up fine, so it's not a permissions issue.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: $customPost output empty for authenticated users on any profile
June 25, 2012, 10:06:18 am

hey emily:

Might be a lot easier if you can upgrade to 4.1 which also works with D6 :)

there were a few issues in the 3.4.x/4.0.x series with profiles that ring a bell, but dont remember any details

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: $customPost output empty for authenticated users on any profile
June 25, 2012, 11:18:12 am
hi lobo, thanks for the reply. unfortunately we can't upgrade because of civievent_discount and heavy customizations that both won't work with 4.1.

however i have debugged this down further.

CRM/Core/BAO/UFGroup.php filterUFGroups was getting passed an array instead of an ID for parameter 1 but only when the second profile was being added. I tracked this down to CRM/Event/Form/Register.php function buildQuickForm where

Code: [Select]
$this->buildCustom( $this->_values['custom_post_id'] , 'customPost'  );

is holding an array instead of a value. I don't know why this is, but I replaced that line with the following two lines:

Code: [Select]

$custom_post_id = CRM_Utils_Array::value( 0, $this->_values['custom_post_id'], '');
$this->buildCustom( $custom_post_id , 'customPost'  );

If you know where I can fix this easier let me know, otherwise I will just implement this fix. posted up as a bug as well: http://issues.civicrm.org/jira/browse/CRM-10443

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: $customPost output empty for authenticated users on any profile
June 25, 2012, 01:13:27 pm

yes, in the 3.4.x series we allowed folks to add more than 2 profiles and hence the error. We've fixed this bug in more recent releases

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • $customPost output empty for authenticated users on any profile

This forum was archived on 2017-11-26.