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) »
  • Adding custom fields into badge printing
Pages: [1]

Author Topic: Adding custom fields into badge printing  (Read 748 times)

rez

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1.63
  • PHP version: 5.2
Adding custom fields into badge printing
June 22, 2012, 07:49:13 pm
I am trying to create a custom badge template so that we can print lables to go on a 4x3 event badge. Each lable will be only an inch high and I have a qr code for security/staff to log in to gather info. We have a few custom fields including badge name, (a custom name they want printed on their badge) as well as a few other variables Like emergency contact info. The problem I am having is that I cant get them to display on the badge. I noticed in one of the related pages it is supposed to be pulling the information and making it so i just type $participant['customfieldname']. they are all in the same custom data set called o_emergency_contact_name_1 in the database table and the fields in the table are named o_Emergency_Contact_Name, Emergency_Contact_Phone, Allergies, Badge_Name with the ids being 1,2,3,4 and the custom group id is 1 for all of them

attached  to this post is what i have so far

am I missing something or did I overlook a post some where that explains this? Any help on getting it to work would be appreciated and yes I do plan on submitting this to the site once all the formatting is finished.

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: Adding custom fields into badge printing
June 23, 2012, 07:27:41 am

Took a brief look at your code. You will need to retrieve the custom fields from the DB via the API to display them on the badge.

Might want to check the api docs to see how to retrieve participant custom fields

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

rez

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1.63
  • PHP version: 5.2
Re: Adding custom fields into badge printing
June 23, 2012, 09:45:23 am
Thanks, i will look into that. I noticed there were some examples for me to look at that the test suite just have to change it from contact to get it to do perticipant stuff.

i was a bit confused because there is this line in one of the filed that it refrences

  if ( $includeCustomFields )
         {
                // also get all the custom participant properties
                require_once "CRM/Core/BAO/CustomField.php";
                $fields = CRM_Core_BAO_CustomField::getFieldsForImport('Participant');
                if ( ! empty( $fields ) )
            {
                    foreach ( $fields as $name => $dontCare ) {
                        $properties[$name] = 1;
                    }
                }
            }

If I'm understanding it correctly its adding that custom fields to the $participant array. If that's the case it seems like a lot of leg work to have to go and re gather everything

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Adding custom fields into badge printing

This forum was archived on 2017-11-26.