I am excited to be working with civicrm, but I am quite frustrated at this point and so I hope someone can help me.
I can see how valuable hooks are, and it seems like they are actually very basic to implement, but I need a small amount of pre-knowledge to use them. I have read every link I could find about hooks to change forms and yet I find myself lost.
I did find one example that fit my needs exactly, and would be a great learning experience ... but the description leaves out a lot of necessary information for someone as new as me.
Can someone walk me though implementing this? It comes from How can I set “Assigned To” for an Activity to default
The extension mentioned in the comment above is:
function myextension_civicrm_buildForm($formName, &$form) {
if ($formName == 'CRM_Activity_Form_Activity' && $form->action == CRM_Core_Action::ADD) {
$form->setDefaults(array('assignee_contact_id' => $form->_currentUserId));
}
}
- How do I find the 'create activity' form this relates to?
I got that answer myself -- CRM _ Activity _ Form _ Activity means the php file is in
/var/www/drupal/sites/all/modules/civicrm/CRM/Activity/Form and then activity.php
- Do I copy the form to my /var/www/drupal/sites/all/modules/civicrm_extensions directory?
- Do I put that function inside the form I copied?
- Do I create that as a file?
- If a file, what do I name it?
- Where do I put the extension once I create it?
You are all very helpful and I appreciate it. Thank you in advance for any help you can give me on this problem I face.
Just a note about searching for answers: About a month or two ago I found a web page that explained some of this to me but for the life of me I fail to find that page today. I did find a lot of links that looked like they could help but a whole mess of them led to (Page Not Found) on http://wiki.civicrm.org/confluence/display/CRMDOC/. Seems a lot of pages were deleted or renamed.
Thanks again.