Skip to content

Instantly share code, notes, and snippets.

@paradigmaweb
Forked from tripflex/hooks.php
Created December 22, 2021 19:53
Show Gist options
  • Save paradigmaweb/80e0efdcb31dd071017b333ac8b5dcc3 to your computer and use it in GitHub Desktop.
Save paradigmaweb/80e0efdcb31dd071017b333ac8b5dcc3 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