- This topic has 3 replies, 2 voices, and was last updated 11 years ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
WordPress Membership Plugin
Simple Membership Plugin › Forums › Simple Membership Plugin › Login with PHP
I’m trying to create a user check page. I use it on my own product(VB.NET) but expiry days always the same.
result:
Login successful.
Days: noexpire
Why it is writing “no expire”?
How can I do that?
PHP Code:
<?php
include("wp-config.php");
include_once('wp-content/plugins/simple-membership/classes/class.swpm-utils.php');
$username = $_GET['username'];
$password = $_GET['password'];
$user = get_user_by( 'login', $username );
if ( $user && wp_check_password( $password, $user->data->user_pass, $user->ID) ){
echo "Login successful.<br>Days:";
$permission = SwpmPermission::get_instance($username->membership_level);
echo SwpmUtils::calculate_subscription_period_days($permission->get('subscription_period'), $permission->get('subscription_duration_type'));
}else{
echo "ERR";
}
?>
Hi you might like to check the following documentation. It will provide some ideas for your code.
Regards
Thank you. I did check this code, but what I want is not here. I want to read user expire date using username.
In fact, if you write me would be enough login function. How do I log in?
this code wordpress login:
$username = $_GET['username'];
$password = $_GET['password'];
$user = get_user_by( 'login', $username );
if ( $user && wp_check_password( $password, $user->data->user_pass, $user->ID) ){
echo "Login successful.";
}
but this function can not be logged to Simple Membership.