Forked from JarrydLong/mypmro-qr-code-return-member-number.php
Created
September 7, 2023 19:34
-
-
Save kimwhite/021072e40cb3348662cc1737c8649b61 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/** | |
* This recipe will return a custom field when scanning a QR code. (diverlogno) | |
* | |
* Set your shortcode to [pmpro_membership_card qr_code='true' qr_data='other'] | |
* for this filter to take effect. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
/** | |
* This recipe will return a member number when scanning a QR code. | |
* | |
* Set your shortcode to [pmpro_membership_card qr_code='true' qr_data='other'] | |
* for this filter to take effect. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function mypmro_membership_card_return_diverlogno( $pmpro_membership_card_user, $option ){ | |
//Checking if PMPro is active | |
if( !function_exists( 'pmpro_hasMembershipLevel' ) ){ | |
return; | |
} | |
if( $option == 'other' ){ | |
$diverlogno = get_user_meta( $pmpro_membership_card_user->ID, 'diverlogno', true ); | |
if( $diverlogno !== "" ){ | |
return $diverlogno; | |
} | |
} | |
} | |
add_filter( 'pmpro_membership_card_qr_data_other', 'mypmro_membership_card_return_diverlogno', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment