Skip to content

Instantly share code, notes, and snippets.

@tripflex
Last active December 22, 2021 19:53
Show Gist options
  • Save tripflex/9f0dcf4e8cc7c7a27aec41dad9629ac4 to your computer and use it in GitHub Desktop.
Save tripflex/9f0dcf4e8cc7c7a27aec41dad9629ac4 to your computer and use it in GitHub Desktop.
Require Company Name for WHMCS User
<?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