How to auto generate WPCargo API Key after user registration
These guides cover:
- Features
- How to install and activate license WPCargo API Add on
- How to use plugin API’s
- How to add shipment using API through AJAX
- How to update shipment using API through AJAX
To auto generate WPCargo API Key after user registration, you have to add this simple hook “user_register” to you theme functions.php file
</pre> add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); function myplugin_registration_save( $user_id ) { $wpcargo_api = get_user_meta( $user_id, 'wpcargo_api', true ); if( !$wpcargo_api && function_exists( 'wpcapi_generate_api_key' ) ){ $api_key = wpcapi_generate_api_key( ); update_user_meta( $user_id, 'wpcargo_api', $api_key ); } } <pre>