animafac/wp-civicrm-frontoffice

Add shortcodes that allow users to edit their own organization in CiviCRM

Installs: 91

Dependents: 0

Suggesters: 0

Security: 0

Type:wordpress-plugin

1.0.2 2019-02-26 14:11 UTC

This package is not auto-updated.

Last update: 2022-09-16 15:33:18 UTC


README

This WordPress plugin adds several shortcodes that allow users to edit their own profile or organization in CiviCRM.

Note: the HTML generated by the shortcodes is not styled. It is up to you to adapt the CSS of your theme.

Requirements

You need CiviCRM 5.6.

Available shortcodes

Warnings:

  • You should not add several shortcodes on the same page.
  • Shortcodes can be replaced on the fly with the civicrm_action query variable. So even if you don't use a shortcode, users might be able to access this functionnality.

edit_member

Display a form allowing a logged-in user to edit its contact info.

Attributes:

  • id: CiviCRM ID of the person to edit. Defaults to the current user. (Can also be set with the civicrm_id query variable.)

edit_organization

Display a form allowing a logged-in user to edit an organization info. The user must have a relationship with the organization and must be allowed to edit it.

Attributes:

  • id: CiviCRM ID of the organization to edit. (Can also be set with the civicrm_id query variable.)
  • tagset (optional): Name of a tagset from which the user can select tags to apply to the organization.
  • note (optional): Name of a note that can be created on the organization and will be displayed publicly with show_organization. (Can be used for a public description, for example.)

show_organization

Display info about an organization.

Attributes:

  • id: CiviCRM ID of the organization to display. (Can also be set with the civicrm_id query variable.)
  • tagset (optional): Name of a tagset from which to display tags applied to the organization.
  • note (optional): Name of a note attached to the organization that will be displayed (if it exists).

search_organization

Display a form allowing to search organizations.

Attributes:

  • redirect (optional): URL of a page the form should redirect to. (Can be useful if you want to display the form on your homepage but display results on a separate page that also contains this shortcode.)
  • country (optional): ISO code of the country from which to list provinces.
  • tagset (optional): Name of a tagset from which to display tags to search organizations in.

show_members

Display members of an organization. The user must also be a member of the organization. Be carefull with the GDPR, if everyone can join any organisation without oversight you might not be in conformance.

Attributes:

  • id: CiviCRM ID of the organization to edit. (Can also be set with the civicrm_id query variable.)

show_member

Display info about a person.

Attributes:

  • id: CiviCRM ID of the person to show. Defaults to the current user. (Can also be set with the civicrm_id query variable.)

add_organization

Allow a logged-in user to add a relationship between himself and an organization.

create_organization

Allow a logged-in user to create a new organization.

Attributes:

  • tagset (optional): Name of a tagset from which the user can select tags to apply to the organization.
  • note (optional): Name of a note that can be created on the organization and will be displayed publicly with show_organization. (Can be used for a public description, for example.)

add_member

Display a form allowing a logged-in user to add a relationship between a person and an organization. The user must have a relationship with the organization and must be allowed to edit it.

Attributes:

  • id: CiviCRM ID of the organization. (Can also be set with the civicrm_id query variable.)

edit_relationship

Display a form allowing a logged-in user to edit a relationship.

Attributes:

  • id: CiviCRM ID of the relationship to edit. (Can also be set with the civicrm_id query variable.)

edit_avatar

Display a form allowing a logged-in user to change its own avatar.

The WP User Avatar plugin must be enabled.

delete_member

Display a page allowing a logged-in user to delete an acount. If the user confirms, the WordPress will be deleted, but not the CiviCRM person.

(For now, users can only delete their own account.)

Attributes:

  • id: CiviCRM ID of the person whose account to delete. Defaults to the current user. (Can also be set with the civicrm_id query variable.)

Grunt tasks

Grunt can be used to run some automated tasks defined in Gruntfile.js.

Your first need to install dependencies with Yarn and Composer:

yarn install
composer install

Be careful to not commit these dependencies in the repository!

You can remove them like this:

composer install --no-dev

(We can't add vendor/ to .gitignore because we need to include the non-dev dependencies and the autoloader into the repository in case the plugin is installed with the regular WordPress installer and not Composer.)

Lint

You can check that the JavaScript, JSON and PHP files are formatted correctly:

grunt lint

Tests

You can run PHPUnit tests:

grunt test

Documentation

phpDocumentor can be used to generate the code documentation:

grunt doc

CI

Gitlab CI is used to run the tests automatically after each commit.