Changeset 3345932
- Timestamp:
- 08/17/2025 03:10:50 PM (8 months ago)
- Location:
- hngamers-atavism-user-verification
- Files:
-
- 6 edited
- 1 copied
-
tags/0.0.14 (copied) (copied from hngamers-atavism-user-verification/trunk)
-
tags/0.0.14/atavism-verify.php (modified) (1 diff)
-
tags/0.0.14/readme.txt (modified) (2 diffs)
-
tags/0.0.14/templates/hngamers-atavism-verify-user.php (modified) (1 diff)
-
trunk/atavism-verify.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/templates/hngamers-atavism-verify-user.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
hngamers-atavism-user-verification/tags/0.0.14/atavism-verify.php
r3112739 r3345932 12 12 * Plugin URI: https://hngamers.com/courses/atavism/atavism-wordpress-cms/ 13 13 * Description: This is the user verification plugin for the HNG Core Atavism series and allows users to verify and log into the game server from the wordpress logins. 14 * Version: 0.0.1 214 * Version: 0.0.14 15 15 * Author: thevisad 16 16 * Author URI: https://hngamers.com/ -
hngamers-atavism-user-verification/tags/0.0.14/readme.txt
r3112739 r3345932 4 4 Donate link: https://hngamers.com/support-and-thank-you/ 5 5 Requires at least: 6.0 6 Tested up to: 6. 4.16 Tested up to: 6.8.2 7 7 Requires PHP: 7.4 8 Stable tag: 0.0.1 28 Stable tag: 0.0.14 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 31 31 32 32 == Changelog == 33 = 0.0.14 = 34 Corrected issues with PMPro 35 36 = 0.0.13 = 37 Patched issue with PMPro not working right. 38 33 39 = 0.0.12 = 34 40 Updated to the new core handler. -
hngamers-atavism-user-verification/tags/0.0.14/templates/hngamers-atavism-verify-user.php
r3112739 r3345932 134 134 135 135 function hngamers_pmpro_integration($usernamePost, $userPassword) { 136 $options = get_option('hngamers_atavism_user_verify_plugin_options'); 137 $required_pmpro_level = $options['pmp_subscription_id']; 138 $pieces = explode(",", $required_pmpro_level); 136 $opts = get_option('hngamers_atavism_user_verify_plugin_options'); 137 $required_levels = array_map('trim', explode(',', $opts['pmp_subscription_id'])); 139 138 140 if ( function_exists( 'pmpro_getMembershipLevelForUser' )) 141 { 142 $user = get_user_by( 'login', $usernamePost ); 143 $id = strval($user->ID); 144 if ( empty( $id ) ) { 145 echo(esc_html( '-1, user not found' )); 146 } 147 if (wp_check_password($userPassword, $user->data->user_pass, $id)) 148 { 149 $membership_level = pmpro_getMembershipLevelForUser( $user->ID ); 150 if ( empty( $membership_level ) ) { 151 echo(esc_html( '-1, no subscription' )); 152 } else { 153 $subscription = 0; 154 foreach ($pieces as &$value) { 155 if ( $membership_level->ID == $value) 156 { 157 hngamers_atavism_user_verify_check_wordpress_user($usernamePost, $userPassword); 158 $subscription = 1; 159 break; 160 } 161 } 162 if ($subscription == 0) 163 { 164 echo(esc_html( '-1, no subscription.' )); 165 } 166 } 167 } 168 else 169 { 170 echo(esc_html( '-1, wrong pass' )); 171 } 172 } 173 else 174 { 175 echo(esc_html( '-1, required plugin not found' )); 176 } 139 if (! function_exists('pmpro_getMembershipLevelForUser')) { 140 echo esc_html('-1, required plugin not found'); 141 return; 142 } 143 144 // lookup WP user (handles email vs login) 145 $user = ReturnWordPressUser($usernamePost); 146 if (! $user) { 147 echo esc_html('-1, user not found'); 148 return; 149 } 150 151 // check password 152 if (! wp_check_password($userPassword, $user->data->user_pass, $user->ID)) { 153 echo esc_html('-1, wrong pass'); 154 return; 155 } 156 157 // get the PMPro level (returns null or an object with ->id) 158 $membership = pmpro_getMembershipLevelForUser($user->ID); 159 if (empty($membership) || empty($membership->id)) { 160 echo esc_html('-1, no subscription'); 161 return; 162 } 163 164 foreach ($required_levels as $lvl) { 165 if (intval($lvl) === intval($membership->id)) { 166 // will echo the final user ID or banned code 167 hngamers_atavism_user_verify_check_wordpress_user($usernamePost, $userPassword); 168 return; 169 } 170 } 171 172 echo esc_html('-1, no subscription'); 177 173 } -
hngamers-atavism-user-verification/trunk/atavism-verify.php
r3112739 r3345932 12 12 * Plugin URI: https://hngamers.com/courses/atavism/atavism-wordpress-cms/ 13 13 * Description: This is the user verification plugin for the HNG Core Atavism series and allows users to verify and log into the game server from the wordpress logins. 14 * Version: 0.0.1 214 * Version: 0.0.14 15 15 * Author: thevisad 16 16 * Author URI: https://hngamers.com/ -
hngamers-atavism-user-verification/trunk/readme.txt
r3112739 r3345932 4 4 Donate link: https://hngamers.com/support-and-thank-you/ 5 5 Requires at least: 6.0 6 Tested up to: 6. 4.16 Tested up to: 6.8.2 7 7 Requires PHP: 7.4 8 Stable tag: 0.0.1 28 Stable tag: 0.0.14 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 31 31 32 32 == Changelog == 33 = 0.0.14 = 34 Corrected issues with PMPro 35 36 = 0.0.13 = 37 Patched issue with PMPro not working right. 38 33 39 = 0.0.12 = 34 40 Updated to the new core handler. -
hngamers-atavism-user-verification/trunk/templates/hngamers-atavism-verify-user.php
r3112739 r3345932 134 134 135 135 function hngamers_pmpro_integration($usernamePost, $userPassword) { 136 $options = get_option('hngamers_atavism_user_verify_plugin_options'); 137 $required_pmpro_level = $options['pmp_subscription_id']; 138 $pieces = explode(",", $required_pmpro_level); 136 $opts = get_option('hngamers_atavism_user_verify_plugin_options'); 137 $required_levels = array_map('trim', explode(',', $opts['pmp_subscription_id'])); 139 138 140 if ( function_exists( 'pmpro_getMembershipLevelForUser' )) 141 { 142 $user = get_user_by( 'login', $usernamePost ); 143 $id = strval($user->ID); 144 if ( empty( $id ) ) { 145 echo(esc_html( '-1, user not found' )); 146 } 147 if (wp_check_password($userPassword, $user->data->user_pass, $id)) 148 { 149 $membership_level = pmpro_getMembershipLevelForUser( $user->ID ); 150 if ( empty( $membership_level ) ) { 151 echo(esc_html( '-1, no subscription' )); 152 } else { 153 $subscription = 0; 154 foreach ($pieces as &$value) { 155 if ( $membership_level->ID == $value) 156 { 157 hngamers_atavism_user_verify_check_wordpress_user($usernamePost, $userPassword); 158 $subscription = 1; 159 break; 160 } 161 } 162 if ($subscription == 0) 163 { 164 echo(esc_html( '-1, no subscription.' )); 165 } 166 } 167 } 168 else 169 { 170 echo(esc_html( '-1, wrong pass' )); 171 } 172 } 173 else 174 { 175 echo(esc_html( '-1, required plugin not found' )); 176 } 139 if (! function_exists('pmpro_getMembershipLevelForUser')) { 140 echo esc_html('-1, required plugin not found'); 141 return; 142 } 143 144 // lookup WP user (handles email vs login) 145 $user = ReturnWordPressUser($usernamePost); 146 if (! $user) { 147 echo esc_html('-1, user not found'); 148 return; 149 } 150 151 // check password 152 if (! wp_check_password($userPassword, $user->data->user_pass, $user->ID)) { 153 echo esc_html('-1, wrong pass'); 154 return; 155 } 156 157 // get the PMPro level (returns null or an object with ->id) 158 $membership = pmpro_getMembershipLevelForUser($user->ID); 159 if (empty($membership) || empty($membership->id)) { 160 echo esc_html('-1, no subscription'); 161 return; 162 } 163 164 foreach ($required_levels as $lvl) { 165 if (intval($lvl) === intval($membership->id)) { 166 // will echo the final user ID or banned code 167 hngamers_atavism_user_verify_check_wordpress_user($usernamePost, $userPassword); 168 return; 169 } 170 } 171 172 echo esc_html('-1, no subscription'); 177 173 }
Note: See TracChangeset
for help on using the changeset viewer.