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) »
  • Help with Writing Hooks and Editing Preloaded Material on Event Forms
Pages: [1]

Author Topic: Help with Writing Hooks and Editing Preloaded Material on Event Forms  (Read 1533 times)

EBArtsCreativeIndustries

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
Help with Writing Hooks and Editing Preloaded Material on Event Forms
February 02, 2010, 10:56:23 am
Hi...

I am working on an install of Joomla 1.5 and CiviCRM 3.1 (current stable version) currently and have searched endless hours for answers to my problems and seem to get stuck at certain points.  

Here is a link to one of the online event registration forms:
http://maranathacamp.org/registration/index.php?option=com_civicrm&task=civicrm/event/register&id=4&reset=1

The first problem I am having is writing a hook so that the address and home phone info is automatically entered for additional registrants based on what is entered for the first registrant.  ie: I enter my address and myself as a registrant first, then enter my daughter.  I don't want users to have to re-enter that information for each registrant.  I understand creating the document for the hooks in Joomla and how to implement them, I just don't quite understand how to write the one for my specific needs.

The second problem I am having is editing the preloaded text on the registration forms.  If a user is not logged in the form adds an area for creating an account.  It also adds text above that that says if you already have an account "please login".  I need to edit that specific text (namely remove the link on "please login") but can't quite locate it in the document.  I am at CRM/Form/Registration/Register.php and here is the section I am looking at:

// check if the user is registered and we have a contact ID
        $session =& CRM_Core_Session::singleton( );
        $contactID = $session->get( 'userID' );
        if ( $contactID ) {
            $options = array( );
            $fields = array( );

            require_once "CRM/Core/BAO/CustomGroup.php";
            if ( ! empty($this->_fields)) {
                $removeCustomFieldTypes = array ('Participant');
                foreach ( $this->_fields as $name => $dontCare ) {
                    if ( substr( $name, 0, 7 ) == 'custom_' ) {  
                        $id = substr( $name, 7 );
                        if ( !$this->_allowConfirmation &&
                             !CRM_Core_BAO_CustomGroup::checkCustomField( $id, $removeCustomFieldTypes )) {
                            continue;
                        }
                    } else if ( ( substr( $name, 0, 12 ) == 'participant_' ) ) { //ignore component fields
                        continue;
                    }
                    $fields[$name] = 1;
                }
            }

            $names = array( "first_name", "middle_name", "last_name","street_address-{$this->_bltID}","city-{$this->_bltID}",
                            "postal_code-{$this->_bltID}","country_id-{$this->_bltID}","state_province_id-{$this->_bltID}"
                            );

            foreach ($names as $name) {
                $fields[$name] = 1;
            }
            $fields["state_province-{$this->_bltID}"] = 1;
            $fields["country-{$this->_bltID}"       ] = 1;
            $fields["email-{$this->_bltID}"         ] = 1;
            $fields["email-Primary"                 ] = 1;
            
            require_once 'CRM/Core/BAO/UFGroup.php';
            CRM_Core_BAO_UFGroup::setProfileDefaults( $contactID, $fields, $this->_defaults );

I found on the Core/BAO/CMSUser.php page the following,

// $cms is true when there is email(primary location) is set in the profile field.
            $session =& CRM_Core_Session::singleton( );                        
            $userID  = $session->get( 'userID' );      
            $showUserRegistration = false;
            if ( $action ) {
                $showUserRegistration = true;
            }elseif (!$action && !$userID ) {
                $showUserRegistration = true;
            }

            if ( $isCMSUser && $emailPresent ) {                
                if ( $showUserRegistration ) {
                    if ( $isCMSUser != 2  ) {
                        $extra = array(
                                       'onclick' => "return showHideByValue('cms_create_account','','details','block','radio',false );"
                                       );
                        $form->addElement('checkbox', 'cms_create_account', ts('Create an account?'), null, $extra);
                        $required = false;      
                    }else {
                        $form->add('hidden', 'cms_create_account', 1 );
                        $required = true;
                    }

                    $form->assign( 'isCMS', $required );      
                    require_once 'CRM/Core/Action.php';
                    if( ! $userID || $action & CRM_Core_Action::PREVIEW || $action & CRM_Core_Action::PROFILE ) {    
                        $form->add('text', 'cms_name', ts('Username'), null, $required );
                        if ( ( $isDrupal && !variable_get('user_email_verification', TRUE ) ) OR ( $isJoomla ) ) {      
                            $form->add('password', 'cms_pass', ts('Password') );
                            $form->add('password', 'cms_confirm_pass', ts('Confirm Password') );
                            }

which should be where that text ultimately is called for, but can't seem to find out how to edit it.  Any help with the above is greatly appreciated.  Thanks in advance

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: Help with Writing Hooks and Editing Preloaded Material on Event Forms
February 02, 2010, 12:42:42 pm

1. check

http://wiki.civicrm.org/confluence/display/CRMDOC/Customizing+CiviCRM+Screens

on how to customize the templates for various screens

2. check

http://civicrm.org/node/631

on how to write a joomla hook. If you have specific questions about some details, we can answer them on the forums/irc. If u'd like someone to walk you thru the steps involved, consider hiring someone from http://civicrm.org/professional/

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

EBArtsCreativeIndustries

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
Re: Help with Writing Hooks and Editing Preloaded Material on Event Forms
February 08, 2010, 07:45:02 am
Thanks for the help Donald!  I finally found the right doc.  According to the HTML output it gives this as the call out:

CRM/Event/Form/Registration/Register.tpl

I was looking at the wrong form, it was under CRM under in the civicrm folder, not in templates/CRM/...

I finally found it and got it edited.  I appreciate the help...:)

Working on the hooks with mild success so far, should have them working by Wed.

One last question...is it possible to modify the limit of 10 items in selection drop-down fields.  They are custom data fields that I have created and need at least 11 options but it only allows 10 right now.  Thank you for the help again :)

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: Help with Writing Hooks and Editing Preloaded Material on Event Forms
February 08, 2010, 07:58:56 am
Quote from: EBArtsCreativeIndustries on February 08, 2010, 07:45:02 am
One last question...is it possible to modify the limit of 10 items in selection drop-down fields.  They are custom data fields that I have created and need at least 11 options but it only allows 10 right now.  Thank you for the help again :)

yes, edit the custom field code to display more than 10 options. U'll need to change the PHP file and the tpl file. Alternatively once u create a custom field u can add more options

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

EBArtsCreativeIndustries

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
Re: Help with Writing Hooks and Editing Preloaded Material on Event Forms
February 08, 2010, 08:30:50 am
Is that located in CustomFields.php and .tpl or Register.php and .tpl?  Or potentially somewhere totally diff?  Thank you :)

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: Help with Writing Hooks and Editing Preloaded Material on Event Forms
February 08, 2010, 09:24:47 am

CRM/Custom/Form/Field.php
templates/CRM/Custom/Form/Field.tpl

(search for the string '11')

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) »
  • Help with Writing Hooks and Editing Preloaded Material on Event Forms

This forum was archived on 2017-11-26.