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 »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • civievent + custom fields + drupal views (2 problems)
Pages: [1]

Author Topic: civievent + custom fields + drupal views (2 problems)  (Read 4745 times)

nunodonato

  • Guest
civievent + custom fields + drupal views (2 problems)
November 26, 2009, 09:37:16 am
Hi there,

I'm having 2 problems setting up civicrm to do what I want with my drupal and views.

Problem 1 is, I need to register some hidden data for each event (basically to help the view to filter it). But it shows up to the public in the event page. I cant find any "hide" option or "admin-only". how to solve?

Problem 2 is, these custom fields are not recognized by the views filters. What are my options here to get the data in views?

thanks!

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: civievent + custom fields + drupal views (2 problems)
December 26, 2009, 05:02:55 pm
You can hide particular fields using CiviCRM ACL, <base-url>/civicrm/admin/access&reset=1 to hide particular groups of fields from a set of users.  Note you can only hide groups of fields, not individual field within a custom group also you cannot hide core fields at this point.

The second is definitely a bug, i'll look into it.

jim
http://www.rootyhollow.com

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: civievent + custom fields + drupal views (2 problems)
December 26, 2009, 05:34:53 pm
It's still a bug but if you have data in one of the custom fields that is not appearing they will show up in your filters
http://www.rootyhollow.com

nunodonato

  • Guest
Re: civievent + custom fields + drupal views (2 problems)
January 11, 2010, 08:43:55 am
Quote from: jalama on December 26, 2009, 05:02:55 pm
You can hide particular fields using CiviCRM ACL, <base-url>/civicrm/admin/access&reset=1 to hide particular groups of fields from a set of users.  Note you can only hide groups of fields, not individual field within a custom group also you cannot hide core fields at this point.

hi
thanks for the info.
The ACLs can only be used with existing groups of users, so I can not hide it from anonymous visitors...
any ideas?

thanks

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: civievent + custom fields + drupal views (2 problems)
January 11, 2010, 08:48:45 am
Never tried it with this role but you could try matching the authenticated user role in Drupal to  a group in CiviCRM using the CiviGroup Roles sync module, that ships with CiviCRM core, and only allow access to those fields to the group.

I've used the module elsewhere and it's pretty easy to use
http://www.rootyhollow.com

nunodonato

  • Guest
Re: civievent + custom fields + drupal views (2 problems)
January 14, 2010, 07:25:47 am
Hi,

yes its a good idea, but the problem is: i can allow access to a particular role to access the fields, but there is no way to deny access to all the other (e.g. anonymous users)... so I'm still stuck in the same problem...

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: civievent + custom fields + drupal views (2 problems)
January 14, 2010, 11:39:10 am
Not if you change the Drupal's "access all custom data" to false for anonymous users.  At that point you are deciding who can see what in reference to custom fields, as opposed to restricting who can see what.
http://www.rootyhollow.com

mnestor

  • I’m new here
  • *
  • Posts: 9
  • Karma: 2
Re: civievent + custom fields + drupal views (2 problems)
February 17, 2010, 06:57:29 pm
Have you gotten anywhere with problem 2 yet? I'm having the same issue.

Added some custom data fields to Events and want to create a Drupal view to show all the events along with this custom data but I see now way to get that data into the view.

mnestor

  • I’m new here
  • *
  • Posts: 9
  • Karma: 2
Re: civievent + custom fields + drupal views (2 problems)
February 18, 2010, 10:46:45 pm
Ok, I figured out my problem but have no idea how to fix it.

The select statement that gets the custom fields for the view to use has this in it's where clause
Code: [Select]
( civicrm_custom_group.extends_entity_column_value LIKE '%1%'  OR   civicrm_custom_group.extends_entity_column_value IS NULL )
For some reason those special characters are evaluating to the same thing as what I actually have in my database. Since it appears that that value is being retrieved specifically a few SELECTs before it must be some issue with internationalization with my php/database?

Selects I see happening to get this data
Code: [Select]
select id, extends, extends_entity_column_value, style from civicrm_custom_group where is_active = 1


SELECT civicrm_custom_field.id as civicrm_custom_field_id, civicrm_custom_field.label as civicrm_custom_field_label, civicrm_custom_field.column_name as civicrm_custom_field_column_name, civicrm_custom_field.data_type as civicrm_custom_field_data_type, civicrm_custom_field.html_type as civicrm_custom_field_html_type, civicrm_custom_field.default_value as civicrm_custom_field_default_value, civicrm_custom_field.attributes as civicrm_custom_field_attributes, civicrm_custom_field.is_required as civicrm_custom_field_is_required, civicrm_custom_field.is_view as civicrm_custom_field_is_view, civicrm_custom_field.help_pre as civicrm_custom_field_help_pre, civicrm_custom_field.help_post as civicrm_custom_field_help_post, civicrm_custom_field.options_per_line as civicrm_custom_field_options_per_line, civicrm_custom_field.start_date_years as civicrm_custom_field_start_date_years, civicrm_custom_field.end_date_years as civicrm_custom_field_end_date_years, civicrm_custom_field.date_format as civicrm_custom_field_date_format, civicrm_custom_field.time_format as civicrm_custom_field_time_format, civicrm_custom_field.option_group_id as civicrm_custom_field_option_group_id, civicrm_custom_group.id as civicrm_custom_group_id, civicrm_custom_group.name as civicrm_custom_group_name, civicrm_custom_group.table_name as civicrm_custom_group_table_name, civicrm_custom_group.title as civicrm_custom_group_title, civicrm_custom_group.help_pre as civicrm_custom_group_help_pre, civicrm_custom_group.help_post as civicrm_custom_group_help_post, civicrm_custom_group.collapse_display as civicrm_custom_group_collapse_display, civicrm_custom_group.is_multiple as civicrm_custom_group_is_multiple, civicrm_custom_group.extends as civicrm_custom_group_extends, civicrm_custom_group.extends_entity_column_id as civicrm_custom_group_extends_entity_column_id, civicrm_custom_group.extends_entity_column_value as civicrm_custom_group_extends_entity_column_value, civicrm_custom_group.max_multiple as civicrm_custom_group_max_multiple  FROM     civicrm_custom_group LEFT JOIN civicrm_custom_field ON (civicrm_custom_field.custom_group_id = civicrm_custom_group.id) WHERE civicrm_custom_group.is_active = 1  AND civicrm_custom_field.is_active = 1  AND civicrm_custom_group.extends IN ('Event') AND ( civicrm_custom_group.extends_entity_column_value LIKE '%1%'  OR   civicrm_custom_group.extends_entity_column_value IS NULL )AND civicrm_custom_group.style = 'Inline' AND civicrm_custom_group.id IN ( 1 )   ORDER BY civicrm_custom_group.weight,        civicrm_custom_group.title,        civicrm_custom_field.weight,        civicrm_custom_field.label

nunodonato

  • Guest
Re: civievent + custom fields + drupal views (2 problems)
February 22, 2010, 02:49:28 am
ok this is strange but, I just turned off and back on my views module, and I could access the custom fields of CiviEvent.
try it :)

mnestor

  • I’m new here
  • *
  • Posts: 9
  • Karma: 2
Re: civievent + custom fields + drupal views (2 problems)
February 22, 2010, 03:00:31 am
No joy for me on that one. :(

mnestor

  • I’m new here
  • *
  • Posts: 9
  • Karma: 2
Re: civievent + custom fields + drupal views (2 problems)
February 22, 2010, 05:04:25 pm
Ok, I got it working. Maybe someone can chime in here and tell me how wrong I am and where this fix should be.

The problem was that the CRM_Core_DAO::VALUE_SEPARATOR was getting put in twice. So instead of
Code: [Select]
LIKE '%^A1^A%' I was getting
Code: [Select]
LIKE '%^A^A1^A^A%'
So for my "fix" I edited CRM/Core/BAO/CustomGroup.php:328
Code: [Select]
if ( $subType ) {
            $subType  = CRM_Core_DAO::VALUE_SEPARATOR . $subType . CRM_Core_DAO::VALUE_SEPARATOR;
            $strWhere = "

and changed it to

Code: [Select]
if ( $subType ) {
            if ($subType{0} != CRM_Core_DAO::VALUE_SEPARATOR) { //only wrap if we don't start with the separator value
                $subType  = CRM_Core_DAO::VALUE_SEPARATOR . $subType . CRM_Core_DAO::VALUE_SEPARATOR;
            }
            $strWhere = "

This fixes my issue but I feel that there might be a bigger problem to this, such as why does the $subType already have the VALUE_SEPARATOR wrapped on it before it gets to this point? Maybe it's just that this point doesn't need that wrapping anymore.

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: civievent + custom fields + drupal views (2 problems)
February 22, 2010, 07:05:37 pm

good sleuthing mnestor :)

can you please file an issue and we'll track it down. Also if you can give the steps you did to generate the bad double ^A query that would be great and we could ensure its fixed

thanx

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 »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • civievent + custom fields + drupal views (2 problems)

This forum was archived on 2017-11-26.