<< Return to Profiles Admin Main Page
PROFILES may be linked to specific modules, used to create standalone forms as well as search and listing pages.
Examples of module links include:
- User - One or several profiles can be linked to either the new user registration and/or view and edit screens for existing user accounts.
- CiviContribute - When you want to collect information from Contributors via online contribution pages, you can create a profile and link it to your contribution page.
- CiviEvent - When you want to collect information from people who are registering for events via online registration pages, you can create a profile with standard or custom fields and link it to your event registration page.
- Profile Listings - When you want to provide a search form and search result listings for some or all of your contacts you can create a profile with the desired search fields and link users to the path for that search form. You can also limit the search results to a specific group of contacts. For example, maybe you only want Organization Staff to be searchable. You would limit this profile to only contacts in your "Staff" group.
|Search and Listings Pages|
When creating a link to search and listings profiles, add the corresponding profile ID to the end of your query string using the 'gid' parameter. For example, the link to display a search and listings page for a Profile with ID = 3 would be: /civicrm/profile?reset=1&gid=3
|Using Profiles in Joomla! Sites|
Currently, Profiles can not be linked to new user registration and user account editing in Joomla! sites. We hope to correct this limitation after the release of Joomla 1.5. Keep this limitation in mind when reviewing the following section. However, you can include Profile forms, search and listings pages in your front-end Joomla! site by following these instructions
- Search Results - If you want to customize the columns which are displayed in Advanced Search results. For example, you might have a critical custom field that you want included in the results listings.
Permissions for Profiles (Drupal Only)
For Drupal installations, you can use Drupal Access Control to determine which "roles" can access Profile forms and listings (as well as Contribution and Event Registration pages with contain Profiles):
- If you want anonymous visitors (i.e. folks who are not logged in to your site) to have access to profile pages, you need to grant the profile listings and forms permission to the Anonymous role.
- If you are using custom fields in your profiles and want anonymous visitors to access the form or page, you also need to grant access all custom data permission to the Anonymous role.
Since many sites use profiles for constituents who may not have user accounts - this configuration is the most common. However, you can restrict general access to profile pages and forms by assigning these permissions to specific roles.
If you need to limit access to specific profiles for subsets of your user population - you can do so using by using Access Control Lists (ACLs) (learn more...).
If you need to restrict access to a specific profile for anonymous users (for example, a members' only directory) but you still want anonymous users to see other profiles on your site, you can add a function to your Drupal theme to do this. You might be thinking that simple Drupal modules like Path Access could do this but with clean URLs enabled, you can't use a CiviCRM path because of characters like ? and &.
- You must first create a custom "access denied" page with the user login block visible on that path (or if you use the LoginToboggan module, you can set it so the login fields appear on your access denied page).
- Then create a URL redirect using the Path Redirect module from something "clean" like <yoursite>/memberdirectory to <yoursite>/civicrm/profile?reset=1&gid=11 (with the ID of the profile you want people to go to).
- Then insert the below function into your template.php file. In Drupal 6, it should go in phptemplate_preprocess() and in Drupal 5 in _phptemplate_variables() You will need to change the profile ID, the access denied path (created in step 1 above) and the destination path (created in step 2).
Once you do this, when people try to access the profile, they will get your access denied page but once they login, will be redirected to the profile you wanted them to go to. Not elegant but it worked for us. To visit forum post, click here.
If you need to restrict anonymous access to certain forms a safer way to accomplish this would be to implement hook_civicrm_buildForm from within a custom module. This pulls the access control logic out of Drupal's theme layer. To do this, follow step 1 as listed above and then add this code to your custom module:
Refer to your Drupal or Joomla documentation for information on creating links and menu items.
* Make sure your profile has and includes at least first name and last name OR email address, as these are the minimum required fields for creating a new contact.
- You must also check the option "Used for: Profile" in the Profile settings.
|Contact Sign-Up Forms|
If you simply want to present a contact sign-up (create) form independent of the Drupal 'create account' process, link to <site root>/civicrm/profile/create?reset=1&gid=N where N is the ID of the Profile. (Each Profile has a unique numeric ID - you can find the value by checking the second column of the table at CiviCRM » Administer » CiviCRM Profile)
Linking to Built-in Contact View and Edit Page(s)
Refer to your Drupal or Joomla documentation for information on creating links and menu items.
You can also use a Profile to give logged-in users a way to view and/or edit specific fields from their own contact data.
As with any profile, you control the fields you want exposed to these view and "self-service edit forms" by the fields you select to include in the profile.
|Custom Edit Form|
Give your logged in users a custom edit form by linking to <site root>/civicrm/profile/edit?reset=1&gid=N where N is the ID of the Profile. (Each Profile has a unique numeric ID - you can find the value by checking the second column of the table at CiviCRM » Administer » CiviCRM Profile).
Any information that exists in the contact record for the included profile fields will be retrieved and displayed in the form.
|Custom Contact View|
Give your logged in users a customized view of their contact info by linking to <site root>/civicrm/profile/view?reset=1&gid=N where N is the ID of the Profile. Any information that exists in the contact record for the included profile fields will be retrieved and displayed.
|Allow Anonymous (not-logged-in) Users to Edit Their Profile|
A great feature is to "invite" your non-logged in users the ability to view and edit their contact info via a profile using CiviMail. To do this, insert the following link with appropriate tokens as shown into a CiviMail message:
... where N is the ID of the Profile you want them to use for editing. The contact checksum token generates a special link that gives a user access to edit their information in that profile for 7 days from the day you send them the mailing.
Profile Search and Listing
To allow searching and listing of profiles:
Link to <site root>/civicrm/profile?reset=1&gid=N (where N is the Profile ID) to display a Search and Listings page which provides basic search on any "Public and User Listings" Profile fields - and returns a sortable listing of contacts.
For example: the link to display a search and listings page for a Profile with ID = 3 would be <site root>/civicrm/profile?reset=1&gid=3
|Listings With and Without Search Forms|
If you are using profiles to list members of a group - you can have the group members appear automatically when the profile page is loaded by using the force parameter. You can also hide the Search form by adding &search=0.
To immediately a listing for Profile ID 3 without a search form:
You can also create external links to specific Listings filters by creating the url q=civicrm/profile?reset=1&force=1&gid=N&field_name=value.
- Example: civicrm/profile&reset=1&force=1&gid=N&city=London
- The above url actually does a search, so you can link together sequentially multiple fields. Thus to see all "Democrats" in "California" in my local site, I can use this URL:
Be sure to verify the correct field names and values to use in these these URLs by checking the field link from a My Account page, OR by browsing to your profile's listing page without additional filters and doing View Source from your browser.
Showing a map is also possible:
- Create the profile. Limit listings to a group if needed. Let's assume profile id is PID.
- Make sure you have mapping enabled for this profile (this is a checkbox in the profile's Advanced Settings)
- The url to map all contacts from that profile is: civicrm/profile/map?reset=1&gid=PID&force=1&map=1
Each Profile has, under Settings (Advanced Settings section) the option to Limit Listings to Group. If you are reading this looking to figure out how to format a complex query string, like I was trying to do, Senators & Delegates or something, or not null in some field, do yourself a favor and create a Group, then use Limit Listings to Group to control which contacts are available in the profile search.
If you want to place standalone contact create / sign-up form(s) anywhere on a web-site (outside of CiviCRM pages) navigate to Customize » CiviCRM Profile, and then click more and then HTML Form Snippet.
- You can edit the provided HTML to eliminate fields for this use (as long as they aren't marked required in the Profile field setup).
- You control the post-form-processing landing page by modifying the postURL hidden field value (replace the default URL with any other valid URL).
|Using Profile HTML Snippet forms for Group sign-up|
Where the settings for the profile include adding a new contact to a group, the group in question must have its visibility set to "Public Pages". If the Group visibility is set to "User and User Admin Only" the contact will not be added to the group.
|Using Profile HTML Snippet forms in Joomla!|
To use a Standalone Profile form in Joomla!:
- First create your Profile.
- Then create a menu link to the profile as a "create profile" type, and make sure the link is published and public. Test the Profile link as a built-in form.
- In the Standalone HTML generated by CiviCRM, replace the generated form action URL with a copy of the URL from the menu link.
|Limitations for using Profile HTML Snippet forms in Joomla!|
There are a few problems w/ using some field types in HTML Snippet forms in Joomla!. Assuming you use the Article Manager and paste the CiviCRM Profile HTML Form Snippet into the Article content:
- *# You need to "Toggle editor" (into view source mode) in order to paste the HTML Form Snippet code.
- If you are including the State / Province field - you need to edit the source to set the - select - option value to 0 rather than empty (Joomla's HTML editor removes the empty option value which causes an error if user submits form w/o selecting a state):
- Date picker fields (built in fields like Birth Date, or custom date fields) don't display properly because the CiviCRM <style> tags are commented out automatically by the Joomla HTML editor - and hence the needed css is not included in the page.
Customized Advanced Search Results
To display a different set of columns from the defaults in Advanced Search results:
- Create a Profile, and check Search Results in the Used For field.
- Add ALL the fields you want included in the results to this profile. For each profile field, check the In Selector.
- Go to Advanced Seach and select your profile in the Search Views dropdown (upper right)
- Do a search - the results should display the columns (fields) from your profile.