Last active
December 22, 2021 19:53
-
-
Save tripflex/9f0dcf4e8cc7c7a27aec41dad9629ac4 to your computer and use it in GitHub Desktop.
Require Company Name for WHMCS User
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_hook( 'ClientDetailsValidation', 1, function( $vars ){ | |
if( ! isset( $_POST['companyname'] ) || empty( $_POST['companyname'] ) ){ | |
return 'You did not enter a Company Name. If you do not have a company name, please just enter your name.'; | |
} | |
}); | |
add_hook( "ClientAreaFooterOutput", 1, function( $vars ){ | |
if ( $vars['templatefile'] == 'viewcart' || $vars['templatefile'] === 'clientregister' ) { | |
return <<<HTML | |
<script>jQuery( function($){ | |
var company_label = $('label[for="inputCompanyName"]'); | |
if( company_label.length ){ | |
var clean_company_label = company_label.text().replace(/\(Optional\)/g, ''); | |
company_label.text( clean_company_label ); | |
} | |
});</script> | |
HTML; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment