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 CiviMember (Moderator: Deepak Srivastava) »
  • Create Membership for Employer or On Behalf of Organization?
Pages: [1] 2

Author Topic: Create Membership for Employer or On Behalf of Organization?  (Read 4998 times)

jackrabbithanna

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 3
  • Quick like bunny
    • http://www.skvare.com
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.23
  • MySQL version: 5.1
  • PHP version: 5.3.3
Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 09:16:33 am
I'm tryin to figure out the best way to do something.

Here's my scenario.

I want a user to be able to create a group membership for their employer.  I have created two membership types that include the "Employer Of" relationship.  This way I can have employees of that organization inherit memberships based on that relationship.  What I want is an employer "captain" to be able to create the group membership for their organization.

When I use the "create membership on behalf of an organization" feature under the Title tab in the settings for a contribution page I can use a custom profile that has at minimum the organization name and email.  I have even found some code and made a custom template that makes the organization name a autocomplete field.  Unfortunately, no matter if the user filling out the form already has their employer set to the correct organization, and the value entered or selected for the organization name is spelled exactly the same, a new organization contact duplicate is created.

I'm trying to figure out the best approach to get what I want.

If I use the "On behalf" feature, what hooks can I tie into to make the membership be added to an existing organization contact instead of creating a new one?

Or should I not use the "On behalf" feature, and just include a profile on the form that includes the Current Employer field and use that field to fetch the organization contact and add the membership?

Has anyone needed to create memberships for a user's employer, or something similar?

Tony Horrocks

  • I post occasionally
  • **
  • Posts: 110
  • Karma: 7
    • Fabriko Limited
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 10:16:47 am
Have you checked that the user is able to edit the employer contact in the relationship?
Tony Horrocks
Author of the CiviCRM CookBook https://www.packtpub.com/web-development/civicrm-cookbook

Tony Horrocks

  • I post occasionally
  • **
  • Posts: 110
  • Karma: 7
    • Fabriko Limited
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 10:19:33 am
The other way to do this is to use Webform CiviCRM. This enables you to set up both them employer and emplyee AND the relationship. And you can prepopulate the employer field is the user is logged. Hope that makes sense.
Tony Horrocks
Author of the CiviCRM CookBook https://www.packtpub.com/web-development/civicrm-cookbook

jackrabbithanna

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 3
  • Quick like bunny
    • http://www.skvare.com
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.23
  • MySQL version: 5.1
  • PHP version: 5.3.3
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 10:24:41 am
I've been testing with my admin user, which has permissions for everything civicrm...

Webform CiviCRM would be great, if it tied into the CiviCRM payment system

Tony Horrocks

  • I post occasionally
  • **
  • Posts: 110
  • Karma: 7
    • Fabriko Limited
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 10:31:17 am
With Webform CiviCRM, use the Contact checksum with a custom URL redirect to direct the person filling out the form to the Civi contribition page - all the values get filled in for you and they can go ahead and join.
Tony Horrocks
Author of the CiviCRM CookBook https://www.packtpub.com/web-development/civicrm-cookbook

jackrabbithanna

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 3
  • Quick like bunny
    • http://www.skvare.com
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.23
  • MySQL version: 5.1
  • PHP version: 5.3.3
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 10:33:48 am
Well, this is generally going to be used by users that already have a contact created...they are just going to add a membership for their organization.

If I put the Current Employer field on the profile, the data is populated for the user. That's not the problem.  I need the value typed into the Organization name, which is on the Organization profile, used by the "on behalf" functionality to be used to add a membership to that organization and not create a new organization contact

Tony Horrocks

  • I post occasionally
  • **
  • Posts: 110
  • Karma: 7
    • Fabriko Limited
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 10:36:47 am
Ah right. My brain hurts already. :)
Tony Horrocks
Author of the CiviCRM CookBook https://www.packtpub.com/web-development/civicrm-cookbook

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 12:59:43 pm
without reading this too carefully - here is what i would expect
If Person A is a 'current employer' and has a 'permissioned relationship' to Company A then
on a Contribution page that is set up with 'on behalf of' and using the 'on behalf of organisation' profile
if Company A already has a membership
and Person A is logged in/checksum
then Person A should see Company A already in the 'organisation field' in the 'on behalf' profile

not sure if that is too concise, but it does work without code/custom templates

notes
- a current employer with no permission wont see org field prefilled
- an employee of with permission but without 'current employer' wont see org field prefilled
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

jackrabbithanna

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 3
  • Quick like bunny
    • http://www.skvare.com
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.23
  • MySQL version: 5.1
  • PHP version: 5.3.3
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 01:33:54 pm
Person A is not a current employer, they work for the organization that we want them to be able to create the membership for.

Developing/testing with user with all the rights...

The user has the employer set....but nothing appears in the Organization Name field...wish it was working.....

If that's how its supposed to work, then something is wrong

Basically, its not automatically pulling up the Organization contact information that is the employer for the user
« Last Edit: June 20, 2013, 01:36:45 pm by jackrabbithanna »

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 01:36:36 pm
ok so you mean the Org is in the database but the individual isn't yet?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 01:38:32 pm
and i am getting a bit confused as you said
"Unfortunately, no matter if the user filling out the form already has their employer set to the correct organization, and the value entered or selected for the organization name is spelled exactly the same, a new organization contact duplicate is created"
I was trying to clarify the conditions that should make that work without creating a duplicate Org.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

jackrabbithanna

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 3
  • Quick like bunny
    • http://www.skvare.com
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.23
  • MySQL version: 5.1
  • PHP version: 5.3.3
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 01:44:21 pm
nah I figured it out now....Tony Horrocks was right

I had to edit the relationship in my contact and check the checkbox '[contact_name] can view and update information for [org]'

I didn't realize their were permission settings in other places...was looking at the Drupal permissions page.

Thanks you guys for helping out!!
« Last Edit: June 20, 2013, 01:54:42 pm by jackrabbithanna »

jackrabbithanna

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 3
  • Quick like bunny
    • http://www.skvare.com
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.23
  • MySQL version: 5.1
  • PHP version: 5.3.3
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 01:53:53 pm
Now I got to figure out how to let users's with Employee of relationships automatically have that permission set...probably sue the hook_civicrm_post( $op, $objectName, $objectId, &$objectRef ) then if its a relationship creation , set the setting automatically

Wow, I'm gonna crack this, learning civi though, this is great

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 02:35:17 pm
Quote from: jackrabbithanna on June 20, 2013, 01:44:21 pm
I had to edit the relationship in my contact and check the checkbox '[contact_name] can view and update information for [org]'
Just to clear up for others - this is the Permissioned Relationship.

Quote
Webform CiviCRM would be great, if it tied into the CiviCRM payment system

There is an MIH for this which i see has now gone over 50% since some others kicked in too - would be great if you and others could chip in

http://civicrm.org/make-it-happen#Drupal Webform Payment Integration
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

jackrabbithanna

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 3
  • Quick like bunny
    • http://www.skvare.com
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.23
  • MySQL version: 5.1
  • PHP version: 5.3.3
Re: Create Membership for Employer or On Behalf of Organization?
June 20, 2013, 02:46:56 pm
My hook to auto set the permissions so that the Organization field will populate with the users employer
Code: [Select]
function yourmodule_civicrm_post( $op, $objectName, $objectId, &$objectRef  ){


if($op=='create'){
if ($objectName=='Relationship'){

$params = array(
  'version' => 3,
  'sequential' => 1,
  'id' => $objectId,
  'is_permission_a_b' => 1,
);
$result = civicrm_api('Relationship', 'create', $params);

}
}

}

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Create Membership for Employer or On Behalf of Organization?

This forum was archived on 2017-11-26.