Version Description
- Done the bug fixings for the google login.
- Done the bug fixings for the username repeate issue.
- Done the modification of the wp_new_user_notification function to match with wordpress version less than 4.3.1
Download this release
Release Info
Developer | Access Keys |
Plugin | Social Login WordPress Plugin – AccessPress Social Login Lite |
Version | 3.1.0 |
Comparing to | |
See all releases |
Code changes from version 3.0.9 to 3.1.0
- accesspress-social-login-lite.php +80 -41
- inc/frontend/login_check.php +12 -5
- readme.txt +6 -1
accesspress-social-login-lite.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin name: Social Login WordPress Plugin - AccessPress Social Login Lite
|
4 |
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-login-lite/
|
5 |
Description: A plugin to add various social logins to a site.
|
6 |
-
version: 3.0
|
7 |
Author: AccessPress Themes
|
8 |
Author URI: https://accesspressthemes.com/
|
9 |
Text Domain: accesspress-social-login-lite
|
@@ -12,7 +12,7 @@
|
|
12 |
*/
|
13 |
//Declearation of the necessary constants for plugin
|
14 |
if( !defined( 'APSL_VERSION' ) ) {
|
15 |
-
define( 'APSL_VERSION', '3.0
|
16 |
}
|
17 |
|
18 |
if( !defined( 'APSL_IMAGE_DIR' ) ) {
|
@@ -48,58 +48,97 @@ if( !defined( 'APSL_PLUGIN_DIR' ) ) {
|
|
48 |
*/
|
49 |
include_once( 'inc/backend/widget.php' );
|
50 |
|
51 |
-
|
52 |
-
|
|
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
|
72 |
-
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
|
78 |
-
|
79 |
-
|
80 |
|
81 |
-
|
82 |
-
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
}
|
|
|
|
|
103 |
// Declaration of the class
|
104 |
if( !class_exists( 'APSL_Lite_Class' ) ) {
|
105 |
|
3 |
Plugin name: Social Login WordPress Plugin - AccessPress Social Login Lite
|
4 |
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-login-lite/
|
5 |
Description: A plugin to add various social logins to a site.
|
6 |
+
version: 3.1.0
|
7 |
Author: AccessPress Themes
|
8 |
Author URI: https://accesspressthemes.com/
|
9 |
Text Domain: accesspress-social-login-lite
|
12 |
*/
|
13 |
//Declearation of the necessary constants for plugin
|
14 |
if( !defined( 'APSL_VERSION' ) ) {
|
15 |
+
define( 'APSL_VERSION', '3.1.0' );
|
16 |
}
|
17 |
|
18 |
if( !defined( 'APSL_IMAGE_DIR' ) ) {
|
48 |
*/
|
49 |
include_once( 'inc/backend/widget.php' );
|
50 |
|
51 |
+
if (version_compare(get_bloginfo('version'), '4.3.1', '>=')){
|
52 |
+
// Redefine user notification function
|
53 |
+
if ( !function_exists('wp_new_user_notification') ) {
|
54 |
|
55 |
+
function wp_new_user_notification( $user_id, $deprecated = null, $notify = 'both' ) {
|
56 |
+
if ( $deprecated !== null ) {
|
57 |
+
_deprecated_argument( __FUNCTION__, '4.3.1' );
|
58 |
+
}
|
59 |
|
60 |
+
global $wpdb, $wp_hasher;
|
61 |
+
$user = get_userdata( $user_id );
|
62 |
+
if ( empty ( $user ) )
|
63 |
+
return;
|
64 |
|
65 |
+
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
66 |
+
// we want to reverse this for the plain text arena of emails.
|
67 |
+
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
68 |
|
69 |
+
$message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
|
70 |
+
$message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
|
71 |
+
$message .= sprintf(__('E-mail: %s'), $user->user_email) . "\r\n";
|
72 |
|
73 |
+
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
|
74 |
|
75 |
+
if ( 'admin' === $notify || empty( $notify ) ) {
|
76 |
+
return;
|
77 |
+
}
|
78 |
|
79 |
+
// Generate something random for a password reset key.
|
80 |
+
$key = wp_generate_password( 20, false );
|
81 |
|
82 |
+
/** This action is documented in wp-login.php */
|
83 |
+
do_action( 'retrieve_password_key', $user->user_login, $key );
|
84 |
|
85 |
+
// Now insert the key, hashed, into the DB.
|
86 |
+
if ( empty( $wp_hasher ) ) {
|
87 |
+
require_once ABSPATH . WPINC . '/class-phpass.php';
|
88 |
+
$wp_hasher = new PasswordHash( 8, true );
|
89 |
+
}
|
90 |
+
$hashed = time() . ':' . $wp_hasher->HashPassword( $key );
|
91 |
+
$wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
|
92 |
|
93 |
+
$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
|
94 |
+
$message .= __('To set your password, visit the following address:') . "\r\n\r\n";
|
95 |
+
$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";
|
96 |
|
97 |
+
$message .= wp_login_url() . "\r\n\r\n";
|
98 |
+
$message .= sprintf( __('If you have any problems, please contact us at %s.'), get_option('admin_email') ) . "\r\n\r\n";
|
99 |
+
$message .= __('Adios!') . "\r\n\r\n";
|
100 |
|
101 |
+
wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}else{
|
105 |
+
// for wordpress version less than 4.3.1
|
106 |
+
// Redefine user notification function
|
107 |
+
if(!function_exists( 'wp_new_user_notification' )){
|
108 |
+
function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {
|
109 |
+
$user = new WP_User($user_id);
|
110 |
+
|
111 |
+
$user_login = stripslashes($user->user_login);
|
112 |
+
$user_email = stripslashes($user->user_email);
|
113 |
+
|
114 |
+
$message = sprintf(__('New user registration on your site %s:'), get_option('blogname')) . "\r\n\r\n";
|
115 |
+
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
|
116 |
+
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
|
117 |
+
$message .= __('Thanks!');
|
118 |
+
|
119 |
+
$headers = 'From:'.get_option('blogname').' <'.get_option('admin_email').'>' . "\r\n";
|
120 |
+
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message, $headers);
|
121 |
+
|
122 |
+
if ( empty($plaintext_pass) )
|
123 |
+
return;
|
124 |
+
|
125 |
+
$message = __('Hi there,') . "\r\n\r\n";
|
126 |
+
$message .= sprintf(__("Welcome to %s! Here's how to log in:"), get_option('blogname')) . "\r\n\r\n";
|
127 |
+
$message .= wp_login_url() . "\r\n";
|
128 |
+
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
|
129 |
+
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n\r\n";
|
130 |
+
$message .= sprintf(__('If you have any problems, please contact me at %s.'), get_option('admin_email')) . "\r\n\r\n";
|
131 |
+
$message .= __('Thanks!');
|
132 |
+
|
133 |
+
$headers = 'From:'.get_option('blogname').' <'.get_option('admin_email').'>' . "\r\n";
|
134 |
+
|
135 |
+
wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message, $headers);
|
136 |
+
|
137 |
+
}
|
138 |
+
}
|
139 |
}
|
140 |
+
|
141 |
+
|
142 |
// Declaration of the class
|
143 |
if( !class_exists( 'APSL_Lite_Class' ) ) {
|
144 |
|
inc/frontend/login_check.php
CHANGED
@@ -58,7 +58,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
58 |
update_user_meta( $row->ID, 'deuimage', $result->deuimage );
|
59 |
update_user_meta( $row->ID, 'description', $result->about );
|
60 |
update_user_meta( $row->ID, 'sex', $result->gender );
|
61 |
-
wp_update_user( array('ID' => $row->ID, 'display_name' => $result->first_name . ' ' . $result->last_name, 'role' =>
|
62 |
}
|
63 |
$this->loginUser( $row->ID );
|
64 |
}
|
@@ -207,7 +207,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
207 |
update_user_meta( $row->ID, 'deutype', $result->deutype );
|
208 |
update_user_meta( $row->ID, 'deuimage', $result->deuimage );
|
209 |
update_user_meta( $row->ID, 'description', $result->about );
|
210 |
-
wp_update_user( array('ID' => $row->ID, 'display_name' => $result->first_name . ' ' . $result->last_name, 'role' =>
|
211 |
}
|
212 |
$this->loginUser( $row->ID );
|
213 |
}
|
@@ -313,6 +313,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
313 |
//for google login
|
314 |
function onGoogleLogin() {
|
315 |
$result = $this->GoogleLogin();
|
|
|
316 |
if( isset( $result->status ) == 'SUCCESS' ) {
|
317 |
$row = $this->getUserByMail( $result->email );
|
318 |
$options = get_option( APSL_SETTINGS );
|
@@ -326,7 +327,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
326 |
update_user_meta( $row->ID, 'deutype', $result->deutype );
|
327 |
update_user_meta( $row->ID, 'deuimage', $result->deuimage );
|
328 |
update_user_meta( $row->ID, 'description', $result->about );
|
329 |
-
wp_update_user( array('ID' => $row->ID, 'display_name' => $result->first_name, 'role' =>
|
330 |
}
|
331 |
$this->loginUser( $row->ID );
|
332 |
}
|
@@ -363,6 +364,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
363 |
$service = new Google_Service_Plus( $client );
|
364 |
|
365 |
if( $action == 'login' ) { // Get identity from user and redirect browser to OpenID Server
|
|
|
366 |
if( !( isset( $_SESSION['access_token'] ) && $_SESSION['access_token'] ) ) {
|
367 |
$authUrl = $client->createAuthUrl();
|
368 |
$this->redirect( $authUrl );
|
@@ -505,12 +507,17 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
505 |
}
|
506 |
|
507 |
function creatUser( $user_name, $user_email ) {
|
|
|
508 |
$random_password = wp_generate_password( 12, false );
|
509 |
-
$user_id = wp_create_user( $
|
510 |
do_action( 'APSL_createUser', $user_id ); //hookable function to perform additional work after creation of user.
|
511 |
$options = get_option( APSL_SETTINGS );
|
512 |
if( $options['apsl_send_email_notification_options'] == 'yes' ) {
|
513 |
-
|
|
|
|
|
|
|
|
|
514 |
}
|
515 |
return $user_id;
|
516 |
}
|
58 |
update_user_meta( $row->ID, 'deuimage', $result->deuimage );
|
59 |
update_user_meta( $row->ID, 'description', $result->about );
|
60 |
update_user_meta( $row->ID, 'sex', $result->gender );
|
61 |
+
wp_update_user( array('ID' => $row->ID, 'display_name' => $result->first_name . ' ' . $result->last_name, 'role' => 'subscriber', 'user_url' => $result->url) );
|
62 |
}
|
63 |
$this->loginUser( $row->ID );
|
64 |
}
|
207 |
update_user_meta( $row->ID, 'deutype', $result->deutype );
|
208 |
update_user_meta( $row->ID, 'deuimage', $result->deuimage );
|
209 |
update_user_meta( $row->ID, 'description', $result->about );
|
210 |
+
wp_update_user( array('ID' => $row->ID, 'display_name' => $result->first_name . ' ' . $result->last_name, 'role' => 'subscriber', 'user_url' => $result->url) );
|
211 |
}
|
212 |
$this->loginUser( $row->ID );
|
213 |
}
|
313 |
//for google login
|
314 |
function onGoogleLogin() {
|
315 |
$result = $this->GoogleLogin();
|
316 |
+
// echo "<pre>";
|
317 |
if( isset( $result->status ) == 'SUCCESS' ) {
|
318 |
$row = $this->getUserByMail( $result->email );
|
319 |
$options = get_option( APSL_SETTINGS );
|
327 |
update_user_meta( $row->ID, 'deutype', $result->deutype );
|
328 |
update_user_meta( $row->ID, 'deuimage', $result->deuimage );
|
329 |
update_user_meta( $row->ID, 'description', $result->about );
|
330 |
+
wp_update_user( array('ID' => $row->ID, 'display_name' => $result->first_name, 'role' => 'subscriber', 'user_url' => $result->url) );
|
331 |
}
|
332 |
$this->loginUser( $row->ID );
|
333 |
}
|
364 |
$service = new Google_Service_Plus( $client );
|
365 |
|
366 |
if( $action == 'login' ) { // Get identity from user and redirect browser to OpenID Server
|
367 |
+
unset($_SESSION['access_token']);
|
368 |
if( !( isset( $_SESSION['access_token'] ) && $_SESSION['access_token'] ) ) {
|
369 |
$authUrl = $client->createAuthUrl();
|
370 |
$this->redirect( $authUrl );
|
507 |
}
|
508 |
|
509 |
function creatUser( $user_name, $user_email ) {
|
510 |
+
$username = self:: get_username($user_name);
|
511 |
$random_password = wp_generate_password( 12, false );
|
512 |
+
$user_id = wp_create_user( $username, $random_password, $user_email );
|
513 |
do_action( 'APSL_createUser', $user_id ); //hookable function to perform additional work after creation of user.
|
514 |
$options = get_option( APSL_SETTINGS );
|
515 |
if( $options['apsl_send_email_notification_options'] == 'yes' ) {
|
516 |
+
if (version_compare(get_bloginfo('version'), '4.3.1', '>=')){
|
517 |
+
wp_new_user_notification( $user_id, $deprecated = null, $notify = 'both' );
|
518 |
+
}else{
|
519 |
+
wp_new_user_notification( $user_id, $random_password );
|
520 |
+
}
|
521 |
}
|
522 |
return $user_id;
|
523 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: social, login, social login, facebook, twitter, google, social connect, s
|
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.5
|
7 |
-
Stable tag: 3.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -133,6 +133,11 @@ Yes. You can use the AccessPress social login lite anywhere by using shortcode i
|
|
133 |
4. Backend Other settings Section.
|
134 |
|
135 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
136 |
= 3.0.9 =
|
137 |
* Done the bug fixing for the facebook login.
|
138 |
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.5
|
7 |
+
Stable tag: 3.1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
133 |
4. Backend Other settings Section.
|
134 |
|
135 |
== Changelog ==
|
136 |
+
= 3.1.0 =
|
137 |
+
* Done the bug fixings for the google login.
|
138 |
+
* Done the bug fixings for the username repeate issue.
|
139 |
+
* Done the modification of the wp_new_user_notification function to match with wordpress version less than 4.3.1
|
140 |
+
|
141 |
= 3.0.9 =
|
142 |
* Done the bug fixing for the facebook login.
|
143 |
|