This documentation refers to CiviCRM 4.1, the current stable version.

Skip to end of metadata
Go to start of metadata


Documentation Search


CiviCRM 4.1 Documentation

Developer Resources


CiviCRM books!

Make sure to check out our Online User/Administrator and Developer Guides! You can also support this project by ordering a hard copy.

Or support us by buying an eBook or hard copy of Using CiviCRM from Packt Publishing.

How to set up a new CiviCRM site from scratch

Background

CiviCRM is an awesome project, and the Understanding CiviCRM book is an outstanding beginning.  The book, though, is written at a high level of abstraction and doesn't really go into the nuts-and-bolts details of getting CiviCRM up-and-running.  This document is my attempt to document the process, and I'll keep it updated as I learn more.

It's my hope that the CiviCRM documentation experts can use this as a partial content source for volume 2 of their book series.  (smile)    This document needs a lot of work, but it's a start - it would have saved me many hours.

My background when I started this project (a CiviCRM site to electronically collect telephone directory and membership info for a school parent-teacher group): programming since 1978, two computer science degrees, some UNIX experience but not as a sysadmin, no Drupal, PHP or mySQL knowledge.  In other words, pretty low on the Drupal/CiviCRM learning curve.

My environment: Go Daddy (misspelling on purpose for searchers: GoDaddy) shared UNIX hosting.  Slow!  [Drupal/CiviCRM crashed and burned on Go Daddy shared hosting.  I am now using Go Daddy's grid hosting (load balancing is the selling point), and Drupal/CiviCRM is zippy.]     This document is not about Go Daddy, though -- it should be useful to anyone setting up CiviCRM on any server (i.e. once Drupal is installed and a mySQL option is found, it's CiviCRM time).

Drupal installation

Go Daddy provides a setup-for-dummies tool for Drupal and other popular apps.  If you haven't installed the latest and greatest Drupal on your server, go do it now and then come back.

After setup, log into Drupal's owner account and select Administer to fine-tune Drupal's settings to support CiviCRM.

Content Mgmt

>> Post settings: length of trimmed: unlimited (I want my posts displayed on the Home page in their entirety); Preview: required (I want posters forced to look at what they have typed before they post).

>> RSS: # items: 30; feed: full text.

Site config

>>Admin theme: pushbutton (I like to know when I'm in admin mode, so I picked a different theme).

>>Clean URLs: Enabled (gets rid of ugly Drupal node stuff).

>>Date and time: -500 for me

>>Image toolkit: 100%  (JPEG quality)

>>Performance: Caching: normal; enable all caching options.  Caching generally only helps anonymous users -- dynamically-generated pages for authenticated users are not cached (but some of the CSS, etc., files are).

>>Site info: name, slogan, footer.

Site building

>> Themes: configure Garland (the default) and mess w/ colors.

>>Create content: create an intro story for the Home page.

CiviCRM installation

--Open the Understanding CiviCRM book to the installation section.

--Find the CiviCRM on Drupal installation instructions (print!), locate the tarball, then get the tarball to your server in your Drupal root directory: whatyoucalledyourdrupalroot/sites/all/modules. I suggest running ssh and using wget, but you can untar and ftp if you don't have ssh access to your server.

--Login to your Drupal site as the owner, and go to the installation script URL as listed in the installation instructions (e.g. http://theaddressofyourdrupalroot/sites/all/modules/civicrm/install/index.php).

--Grab the Drupal db details from <drupal root>/sites/defaultsettings.php as listed in the installation instructions.  For the CiviCRM db on Go Daddy, I had to go into the Go Daddy db control panel, create a new 5.x mySQL db, and then go into the mySQL myphpadmin util to get the particulars re: location.  Enter the Drupal and CiviCRM db particulars and then click the "Check Requirements and Install" button to complete the installation.

--In Drupal's Administer>>User management >> Permissions >> CiviCRM panel, set things as you like 'em.  I set anonymous and authenticated users up w/ the following permission b/c I collect custom data from users before setting up their accounts - if the permissions aren't set correctly, anonymous users can't access my custom data fields): "access custom data".  As I add more CiviCRM functionality, I know I'll have to come back here and enable other functions, at least for authenticated users.

--Following the installation instructions printout, create CiviCRM contacts for existing Drupal users.

--Review the CiviCRM configuration checklist: Administer CiviCRM >> Configure >> Configuration Checklist.

Domain info: add domain name, from name, from e-mail, snailmail address stuff.

Outbound e-mail: select sendmail and save changes.  Go back in and select "Save and test" (I didn't get the test option until after I saved the sendmail setting and went back in).  [Update: Go Daddy said I'll get better outbound response time if use SMTP instead of sendmail.  Not sure if true, but changed to SMTP: relay-hosting.secureserver.net, no authentication.]

Payment processors: I'm using PayPal Web sites Standard.  I also set up PayPal sandbox stuff, but didn't actually try it.

Setting up CiviCRM custom data fields and profiles (data entry forms)

-- On paper, plan out your forms and their supporting custom data fields.

-- How are custom data fields/groupings and profiles related?

   Custom data fields/groups: fields used to store info not covered by CiviCRM's standard fields.  The weights, required, etc., settings will control display of the fields in the CiviCRM >> Find contacts view/edit screens.  Custom data fields are grouped into custom data groups.

   Profiles: standalone forms that can be used to expose fields to users for direct data entry (add, edit, view).  Profiles can use both standard and custom data fields.  The weights, required, etc., settings will control display of the fields on the form.  These values can be totally different from the ones specified under "Custom data" used to control the view/edit screens under CiviCRM >> Find contacts.  For my purposes, I want the field layout to be identical so that my organization's administrators will see the same screen that our users see.  [Since profile forms can pull data from multiple custom data groups, other profile form implementations may not use the one-to-one matchup that mine do (I have three profile forms that I want to correspond exactly to three custom data groups).]

-- CiviCRM >> Administer CiviCRM >> Customize >> Custom data.  Create fields.

-- CiviCRM >> Administer CiviCRM >> Customize >> Profiles.  Create a profile and reference the custom data fields you created.

Putting links to profiles (forms) on the Drupal menu bar

--Go into Administer CiviCRM >> Customize >> Profiles to get the profile #.  Then, go into Drupal >> Administer >> Site building >> Menus >> Navigation >> Add item and create your link.  The path will be like this: http://yourdrupalrooturl/civicrm/profile/edit?reset=1&gid=3  (my profile form is #3).

--But: the default behavior is for CiviCRM to add a "Back to listings" link on the bottom of the page.  This is completely nonsensical (and broken) when a profile form is accessed from the nav bar.  To fix:

1. Reference CiviCRM document Customize Built-in, Profile, Contribution and Event Registration Screens

2. Create, e.g., a new subdirectory that is a peer of your drupal root.  Ex: mydrupalroot_customtemplates.

3. Administer >> CiviCRM >> Global settings >> Directories >> Custom Templates: name from step 2.

4. In your browser, view the page source of the page that displays the "Back to listings" msg.  Find the .tpl (templatefilename).  In my case, CRM/Profile/Page/view.tpl.

5. Recreate the path in the custom templates directory you created in step 2.  Ex: mydrupalroot_customtemplates/CRM/Profile/Page

6. *Copy* the .tpl file from step 4 to the Page directory created in step 5. I then edited the file and replaced the "Back to listings" link w/ a link to my Home page.

7. Clean up the templates_c directory.  See Directory cleanup section here: Debugging

Enabling CiviMember and CiviContribute

If you want to allow users to join your organization and make payments:

--On the CiviCRM main page under Shortcuts, select New organization and create your organization.

--Administer CiviCRM >> CiviMember: Add membership type(s).

--Administer CiviCRM >> CiviContribute: create a contribution form to allow members to sign up.

--Follow instructions for "Putting links to profiles on the Drupal menu bar" (above) to add your membership signup page link to the nav bar. You can get the path from Administer CiviCRM >> Manage Contribution pages >> Live Contribution page.

Creating an export mapping to dump info collected to a spreadsheet

--CiviCRM >> Find >> Search; select all contact records (skip organizations, etc.); select export; create field mapping for each type of spreadsheet you want to collect.

--Note that many users have problems w/ e-mailed .csv files.  You may have to convert the exported file to a spreadsheet format like .xls.

Capturing a timestamp when users add/edit data using a profile form

 When I put the finishing touches on my forms, the person in charge of merging CiviCRM data into a master spreadsheet to be used for printing a telephone directory found a flaw in my reasoning.  I was thinking that I'd set a cutoff date and then remove the directory info collection form link from the navigation bar.  Then, I'd hand the spreadsheet over to her and relax.

Well, she pointed out that making her wait until the cutoff date to get hundreds of changes wasn't very friendly of me!  So, with Donald Lobo's help (thanks!), I created a module that adds  a last modified timestamp to the form data.  Now she will be able to get data snapshots anytime she wants -- and sort by modification date to find new and changed records.  Details can be found in the CiviCRM hook specification (a section at the top gives an overview of the process, and an example in the postProcess section supplies the code).

Setting up a testing environment or moving to a different server

It's not too hard to clone your Drupal/CiviCRM (or Joomla or standalone) system for testing purposes or to switch to a new server. If you successfully recreate your CiviCRM system on another machine using backup files, then you'll know that the backup procedure and backup files you used are sufficient.Instructions for cloning/moving.

Labels
  • None