Skip to content

Commit

Permalink
Handle contribution forms too (i.e. the forms where people join)
Browse files Browse the repository at this point in the history
  • Loading branch information
grischard committed Feb 24, 2019
1 parent b7a8ff8 commit 96fc857
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions username.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ function username_civicrm_entityTypes(&$entityTypes) {
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_validateForm/
*/
function username_civicrm_validateForm($formName, &$fields, &$files, &$form, &$errors) {
if ( $formName == 'CRM_Contact_Form_Contact' or $formName ==
'CRM_Contact_Form_Inline_CustomData') {
if ( $formName == 'CRM_Contact_Form_Contact' or
$formName == 'CRM_Contact_Form_Inline_CustomData' or
$formName == 'CRM_Contact_Form_Inline_CustomData'
) {
$osmfield = civicrm_api3('CustomField', 'getsingle', array('label' => 'OSM username'));
if(! $osmfield){
throw new InvalidArgumentException(sprintf("Could not find custom field with 'OSM username' as its label"));
Expand Down

0 comments on commit 96fc857

Please sign in to comment.