PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 1.1.6
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v1.1.6
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
← All changes | core/class-login.php +56 -0 1-final1.1.6 View file →
@@ -1,0 +1,56 @@
1 +<?php
2 +
3 +namespace Templately;
4 +
5 +class Login {
6 +
7 + /**
8 + * Save global sign in flag based on user choice.
9 + *
10 + * @param $choice
11 + *
12 + * @return bool true|false
13 + */
14 + public static function set_user_login_choice( $user, $choice ) {
15 + return update_option( '_templately_user_login_choice', array (
16 + 'id' => $user,
17 + 'choice' => $choice
18 + ) );
19 + }
20 +
21 + public static function get_user_login_choice() {
22 + return get_option( '_templately_user_login_choice', array () );
23 + }
24 +
25 + public static function user_can_logout( $user = null ) {
26 + $userdata = self::get_user_login_choice();
27 + if( ! empty( $userdata ) ) {
28 + if( isset( $userdata['choice'] ) ) {
29 + return isset( $userdata['id'] ) ? $userdata['id'] === get_current_user_id() : false;
30 + }
31 + }
32 + return false;
33 + }
34 +
35 + public static function already_signedin_globally() {
36 + $userdata = self::get_user_login_choice();
37 + if( isset( $userdata['choice'] ) ) {
38 + return $userdata['choice'];
39 + }else {
40 + return false;
41 + }
42 + }
43 +
44 + public static function set_link_my_account() {
45 + return update_user_meta( get_current_user_id(), '_templately_link_my_account', true );
46 + }
47 +
48 + public static function get_link_my_account() {
49 + return get_user_meta( get_current_user_id(), '_templately_link_my_account', true );
50 + }
51 +
52 + public static function delete_link_my_account() {
53 + return delete_user_meta( get_current_user_id(), '_templately_link_my_account' );
54 + }
55 +
56 +}