Last active
June 14, 2020 14:05
-
-
Save gaupoit/02e47b5f241793a1f7928217b50d657a to your computer and use it in GitHub Desktop.
Integrate PDA Gold with Simple WordPress Membership
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 | |
add_filter( 'pda_before_handle_normal_fap', 'pda_handle_simple_membership', 10, 3 ); | |
/** | |
* Callback to handle before checking FAP. This function will help to fix the problem | |
* when WordPress cookie expired before Simple WordPress Membership one. | |
* | |
* @param bool $is_valid_fap Flag to know whether FAP is valid. | |
* @param int $attachment_id The attachment ID. | |
* @param string $fap_type FAP type. | |
* | |
* @return bool | |
*/ | |
function pda_handle_simple_membership( $is_valid_fap, $attachment_id, $fap_type ) { | |
if ( ! method_exists( 'SwpmMemberUtils', 'is_member_logged_in' ) ) { | |
return $is_valid_fap; | |
} | |
if ( SwpmMemberUtils::is_member_logged_in() ) { | |
return true; | |
} | |
return $is_valid_fap; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment