You are browsing a read-only backup copy of Wikitech. The primary site can be found at wikitech.wikimedia.org

Fundraising/External-facing/E-mail preference center

From Wikitech-static
Jump to navigation Jump to search

Overview

The email preference center is a standalone wiki that uses civiproxy to talk to civicrm.

Live link: https://fundraising.frdev.wikimedia.org/index.php/Special:EmailPreferences/emailPreferences?contact_id=&contact_hash=

Test links:

Preference Center: https://localhost:9002/index.php/Special:EmailPreferences/emailPreferences?checksum=705239735920094e8b2cf6c1f9b04215_1645597635_168&contact_id=208

Translated Preference Center (adding &uselang=): https://localhost:9002/index.php/Special:EmailPreferences/emailPreferences?checksum=705239735920094e8b2cf6c1f9b04215_1645597635_168&contact_id=208&uselang=ja

Civiproxy JSON response: https://localhost:9005/rest.php?entity=civiproxy&action=getpreferences&key=SITE_KEY&version=3&json=1&checksum=705239735920094e8b2cf6c1f9b04215_1645597635_168&api_key=API_KEY&contact_id=208

Phabricator Epic: https://phabricator.wikimedia.org/T125272

  • Get Email Preference Info from civiproxy
    • dev/src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/api/v3/Civiproxy/Getpreferences.php
  • Update Email Preference with Queue
  1. /src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/CRM/Queue/PreferencesQueueConsumer.php
  2. /src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/api/v3/Preferencesqueue/Consume.php
  3. /src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/api/v3/Preferences/Create.php

File paths

  • HTML: src/email-pref-ctr/extensions/DonationInterface/email_forms/templates/emailPreferences.html.mustache
  • CSS: src/email-pref-ctr/extensions/DonationInterface/modules/css/emailPreferences.css
  • JS: src/email-pref-ctr/extensions/DonationInterface/modules/js/ext.donationInterface.emailPreferences.js

Queue

drush cvapi Preferencesqueue.consume time_limit=1000 max_batch_size=1

Unit Test

./vendor/bin/phpunit --filter testEmailPreferenceCenterUpdateApi

CiviCRM

Civiproxy

Official documentation: https://docs.civicrm.org/civiproxy/en/latest/

Our repo: https://gerrit.wikimedia.org/r/q/project:wikimedia/fundraising/crm/civiproxy

Deploying

The email preference center is under the project donorwiki. Deploying is the same steps as deploying Donation Interface and then running fundraising_code_update with the project donorwiki

There is a settings file in localsettings in a folder called civiproxy. This can be deployed to the civiproxy project