Generate User ID QR Code for New Users


Filename: gpqr-new-user-qr-meta.php

 * Gravity Perks // QR Codes // Generate User ID QR Code for New Users
// Update "user_register" to "gform_user_registered" to limit QR generation only to users created via a Gravity Form.
add_action( 'user_register', function( $user_id ) {
	if ( is_callable( 'gp_qr_code' ) ) {
		add_user_meta( $user_id, 'qr_code', gp_qr_code()->generator->generate( (string) $user_id ) );
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.