Aller directement à la fin des métadonnées
Aller au début des métadonnées

 
These instructions are for CivicSpace's Groundswell Professional. Should work well for any Drupal/CiviCRM installation.

Goal: Create searchable member directory for a community website.

Outline: Use a custom field that allows members to decide if they want to be listed in the directory. Key a smart group off that field and have that smart group define a profile listing. Pick the fields you want in your member directory and make them part of the profile. Set all the permission right and away you go.

#1 What information will you display in your member directory?

We need to make three sets of fields: (a) the fields people can search the directory by (b) the fields that show up in the table view (c) the fields that show up in the detail view when you click on a specific member. Life is easiest if (a), (b) and (c) are the same. Still easy is (a) and (b) are the same. 

#1a Searchable fields:

First Name

Last Name

City (Primary)

Postal Code (Primary)

#1b Table view fields


Name

City (Primary)

Postal Code (Primary)


 

One, Member

member1city

94107

Details | Map

 

Two, Member

member2city

94106

Details | Map

NOTE: CiviCRM Profile listings shows the name by default. This is really just two fields.

City (Primary)
Postal Code (Primary)

 #1c Detail view

Contact's Profile

First Name
Last Name
City (Primary)
Postal Code (Primary)

#2 Create any custom fields you need.

Since we want to have users opt into the directory, we will create a yes/no custom field "List me in the public website member directory." Make sure to remember to make this custom field searchable.

If any of the fields you need in #1 are custom fields, create them now. 

#3 Create the groups you need 

We want to create a smart group which identifies all CiviCRM contacts that have entered "Yes" in the "List me in the public website member directory" custom field. (do an advanced search for all the yeses. From the drop down, select create new smart group).  We'll name this smart group "Public Member Directory". This group visibility should be "Public User Pages and Listings".

#4 Create the data entry CiviCRM profiles

Users can enter their information either before or after they register with the website (by marking the profile for use during user registration and/or view/edit user account). We are going to assume that they fill out directory information when they first get their drupal account.

Create a new profile called "Member Info (entry)"
"Used for" should be:
User Registration View/Edit User Account

Set up the fields:

CiviCRM Field Name

Visibility

Searchable?

In Selector?

Weight

Active

Required

View Only

 

First Name
(Individual)

User and User Admin Only

No

No

1

Yes

No

No

Edit | Preview | Disable | Delete

Last Name
(Individual)

User and User Admin Only

No

No

2

Yes

No

No

Edit | Preview | Disable | Delete

City
(Individual)

User and User Admin Only

No

No

4

Yes

No

No

Edit | Preview | Disable | Delete

Postal Code
(Individual)

User and User Admin Only

No

No

7

Yes

No

No

Edit | Preview | Disable | Delete

#5 Create the CiviCRM profiles for the directory listing

 Create  new profile called "Member Directory (Display)"

Used for should be "Profile" only
Limit Listings to Group = Public Member Directory (our smart group we created above)

And pick the fields:

CiviCRM Field Name

Visibility

Searchable?

In Selector?

Weight

Active

Required

View Only

 

First Name
(Individual)

Public User Pages and Listings

Yes

No

1

Yes

No

No

Edit | Preview | Disable | Delete

Last Name
(Individual)

Public User Pages and Listings

Yes

No

2

Yes

No

No

Edit | Preview | Disable | Delete

City (Primary)
(Individual)

Public User Pages and Listings

Yes

Yes

3

Yes

No

No

Edit | Preview | Disable | Delete

Postal Code (Primary)
(Individual)

Public User Pages and Listings

Yes

Yes

4

Yes

No

No

Edit | Preview | Disable | Delete

Note the searchable and in selector values. This basically defines what fields you can search on (searchable) and which fields are displayed in the actual membership directory list view (in selector). 

#6 Create a link to your directory

 We generally create drupal menu item to a civicrm URL: civicrm/profile?reset=1&force=1&gid=5
Where gid=5 is the profile id for the profile we created in step 5. You can see the ID values in the page that lists your civicrm profiles. Looks something like this:

Profile Title

ID

Used For

Status?

Weight


Member Info (entry)

3

User Registration, View/Edit User Account, Profile, Search Results

Active

4

View and Edit Fields | Settings | Preview | Disable | Delete | Standalone Form

Member Directory (Display)

5

Profile

Active

7

View and Edit Fields | Settings | Preview | Disable | Delete | Standalone Form

Organization Directory (Display)

6

Profile

Active

10

View and Edit Fields | Settings | Preview | Disable | Delete | Standalone Form

The force value controls whether the actual search results are displayed or not. force=1 displays your list of members. You can also hide the search box by using search=0

More information on parameters. 

#7 TEST 

 Go through like a regular user and verify everything works as you expect. Edit this wiki page with tips and more information.

Étiquette
  • Aucun