I would like to use RedHen CRM in my website: http://szentandras.ujevangelizacio.hu/. But I need a new permission: "create own redhen contact". After registration I want to redirect new users to "redhen/contact/add/volunteer" to fill out own volunteer contact. I have to be confident that they have completed volunteer contact, when they later fill the registration form.

I'm not a developer, I can only help with translation. If someone do this feature I will use RedHen CRM, and I will make the Hungarian translation.

CommentFileSizeAuthor
#10 2008910-create-own-contact.patch3.59 KBjon pugh

Comments

seanberto’s picture

Status: Active » Closed (works as designed)

The "RedHen Contact to Drupal User" connection isn't built to support a user creating their own contact record manually. Rather, you'll want to use Rules or a bit of glue code to create the contact record programmatically when the user account is created. From there, permissions exist for viewing/editing just the contact record associated with your user account.

levelos’s picture

Status: Closed (works as designed) » Active

I think we should keep this open as it's a good addition to make and not too difficult.

bubu’s picture

Thanks for the suggestion! I have studied the Rule module. Here is the rule:

{ "rules_auto_create_contact" : {
    "LABEL" : "Create contact on create new account",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "contact" ],
    "REQUIRES" : [ "rules" ],
    "ON" : [ "user_insert" ],
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "redhen_contact",
            "param_type" : "volunteer",
            "param_first_name" : "[account:name]",
            "param_last_name" : "[account:name]",
            "param_redhen_state" : "1"
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      },
      { "data_set" : {
          "data" : [ "entity-created:redhen-contact-email:0:value" ],
          "value" : "[account:mail]"
        }
      },
      { "data_set" : { "data" : [ "entity-created:user" ], "value" : [ "account" ] } }
    ]
  }
}
bubu’s picture

I think you can close this feature request. RedHen 1.6 supports this via new "create a contact during user registration" feature. Thank you very much!

levelos’s picture

Issue summary: View changes
Status: Active » Fixed

Happy to do so, thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

micnap’s picture

Status: Closed (fixed) » Active

Reopening this:

I think it would still be beneficial to provide a rules action that takes a user account and creates a Redhen Contact from it in addition to the user_registration_form_alter. I say this because when the Commerce module creates a new user account during checkout, it does not use the user_registration_form to create the new user. It uses entity_save. So, no contact record is created. Having a rules action available that takes a user account and contact type would be useful.

jon pugh’s picture

This would be really useful. The use case applies when adding RedHen to an existing site, where users already exist so they never get a contact record unless an admin adds it themselves.

I'll work on a patch.

jon pugh’s picture

Assigned: Unassigned » jon pugh
jon pugh’s picture

Assigned: jon pugh » Unassigned
Status: Active » Needs review
StatusFileSize
new3.59 KB

Patch attached.

It relies on the "Default Contact Type" setting used for user registration, so I moved that setting out of the "User Registration" fieldset in the "admin/config/redhen/crm" form.

It correctly associates the contact record with the user, but does not automatically set the email address on the contact record. Would we want to do this?

jon pugh’s picture

Title: create own redhen contact » Add permission and ability to "create own redhen contact"
edward.peters’s picture

I would appreciate it if we can make the permissions more granular. My use case is that I want a site user (account only) to have the option to create their own contact record as a membership application. The only way I can allow them to do this is to give them create, edit, delete permissions. Can we separate these out by role?