2

Is it possible to use civicrm stand alone profile page to edit existing contacts? Is it also possible to alter or override civicrm stand alone profile page via Drupal hook apis?

9
  1. no - since standalone html cannot do smart things like populate stuff from db etc

  2. not via drupal hook but civicrm also has a hook system similar to drupal. so u can modify stuff via civi hooks.

If you think SE is a good place for a Q&A forum, please follow and upvote a few questions at:

http://area51.stackexchange.com/proposals/77367/civicrm

lobo

10

Generally agree with the previous commenters -- you can do an edit screen using "civicrm/profile/edit", and "webform_civicrm" is generally the next level to go if you want the effect of a standalone profile managed in a Drupal-way. There are hooks for manipulating Civi's profile screens, but they're different from the hooks of typical Drupal forms.

For completeness, we should add some links about Civi's profile hooks. The most concise reference I can think of is:

It's a bit dense, so let's drill down on an example section:

civicrm/profile/edit:
    CSS: form#Edit .crm-profile-name-{NAME}
    Region: profile-form-{NAME}
    Hooks: buildProfile($name), validateProfile($name), processProfile($name)

What this says: If you're dealing with the page "/civicrm/profile/edit?gid=X", then there are three ways to precisely customize that profile (and no other profiles). All three require that you know the {NAME} of the profile. (This is internal name that corresponds to the DB field "civicrm_uf_group.name".)

  • To customize with CSS or jQuery, use a selector like "form#Edit .crm-profile-name-{NAME}". (As always, it's helpful to "View Source" and see the precise tags on your form.)
  • To append/prepend content programmatically, use a region named "profile-name-{NAME}".
  • To execute code while processing the profile, you can use hook_civicrm_buildProfile($name), hook_civicrm_validateProfile($name), or hook_civicrm_processProfile($name).

For information about other Civi hooks, see wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference .

(NOTE: I left some links as plain-text because stackexchange limits the #links from new users.)

7

1) It's important to clarify what you mean by "standalone profile page".

a) If you mean the form presented by CiviCRM at e.g. example.com/civicrm/profile then yes. Construct the url like so: ...civicrm/profile/edit&gid=1&reset=1 where ... represents whatever normally comes before civicrm in your site's url, and in gid=1 replace the number 1 with the id of your profile. This will auto-fill the form with the logged-in user's contact record. If you are an administrator and wish to use the form to update a different user, append &cid=123 to the end of the url (where 123 is the id of the contact you wish to update). You can also use CiviMail tokens to allow anonymous users to update their records without logging in.

b) If you mean the html snippet that you can copy-paste, then no. As Lobo mentioned that will not work because the html snippet once pasted will not dynamically based on the logged-in user (it's only html after all)

2) Another recommended tool is the Drupal Webform-Integration module (http://drupal.org/project/webform_civicrm), which can do all of the above, with the added flexibility of being able to display in a drupal block, or as a panel pane, or anywhere you can display a node. It includes additional features not available for profile forms such as working with multiple contacts, creating activities, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.