Created
June 15, 2021 10:56
-
-
Save nextab/80832cab73f9b41647560dcac4ede9c1 to your computer and use it in GitHub Desktop.
Diese kleine Funktion prüft lediglich per MySQL-Abfrage, ob ein registrierter Benutzer (der aktuell eingeloggt ist) Zugriff auf einen Online-Kurs hat (= product in DigiMember).
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
// Übergabe der Produkt-ID bei Funktionsaufruf; es wird als Rückgabe mitgeteilt, ob der aktuell eingeloggte Benutzer ein bestimmtes DigiMember Produkt erworben hat (true bei ja). | |
function nxt_check_dm_access($product_id = 2) { | |
global $wpdb; | |
$user_id = get_current_user_id(); | |
$result = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}digimember_user_product WHERE product_id = $product_id and is_active = 'Y' and user_id = $user_id"); | |
// echo '<pre>'; print_r($result); echo '</pre>'; | |
// echo '<pre>'; print_r("SELECT * FROM {$wpdb->prefix}digimember_user_product WHERE product_id = $product_id and is_active = 'Y' and user_id = $user_id"); echo '</pre>'; | |
if($result) { | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment