1
|
|
|
<?php |
2
|
|
|
/*! |
3
|
|
|
* WordPress Social Login |
4
|
|
|
* |
5
|
|
|
* https://miled.github.io/wordpress-social-login/ | https://github.com/miled/wordpress-social-login |
6
|
|
|
* (c) 2011-2020 Mohamed Mrassi and contributors | https://wordpress.org/plugins/wordpress-social-login/ |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Email notifications to send. so far only the admin one is implemented |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
// Exit if accessed directly |
14
|
|
|
if ( !defined( 'ABSPATH' ) ) exit; |
15
|
|
|
|
16
|
|
|
// -------------------------------------------------------------------- |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Send a notification to blog administrator when a new user register using WSL |
20
|
|
|
* |
21
|
|
|
* also borrowed from http://wordpress.org/extend/plugins/oa-social-login/ |
22
|
|
|
* |
23
|
|
|
* Note: |
24
|
|
|
* You may redefine this function |
25
|
|
|
*/ |
26
|
|
|
if( ! function_exists( 'wsl_admin_notification' ) ) |
27
|
|
|
{ |
28
|
|
|
function wsl_admin_notification( $user_id, $provider ) |
29
|
|
|
{ |
30
|
|
|
//Get the user details |
31
|
|
|
$user = new WP_User($user_id); |
32
|
|
|
$user_login = stripslashes( $user->user_login ); |
33
|
|
|
|
34
|
|
|
// The blogname option is escaped with esc_html on the way into the database |
35
|
|
|
// in sanitize_option we want to reverse this for the plain text arena of emails. |
36
|
|
|
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
37
|
|
|
|
38
|
|
|
$message = sprintf(__('New user registration on your site: %s', 'wordpress-social-login'), $blogname ) . "\r\n\r\n"; |
39
|
|
|
$message .= sprintf(__('Username: %s' , 'wordpress-social-login'), $user_login ) . "\r\n"; |
40
|
|
|
$message .= sprintf(__('Provider: %s' , 'wordpress-social-login'), $provider ) . "\r\n"; |
41
|
|
|
$message .= sprintf(__('Profile: %s' , 'wordpress-social-login'), $user->user_url ) . "\r\n"; |
42
|
|
|
$message .= sprintf(__('Email: %s' , 'wordpress-social-login'), $user->user_email) . "\r\n"; |
43
|
|
|
$message .= "\r\n--\r\n"; |
44
|
|
|
$message .= "WordPress Social Login\r\n"; |
45
|
|
|
$message .= "http://wordpress.org/extend/plugins/wordpress-social-login/\r\n"; |
46
|
|
|
|
47
|
|
|
@ wp_mail(get_option('admin_email'), '[WordPress Social Login] '.sprintf(__('[%s] New User Registration', 'wordpress-social-login'), $blogname), $message); |
|
|
|
|
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
// -------------------------------------------------------------------- |
52
|
|
|
|
If you suppress an error, we recommend checking for the error condition explicitly: