Completed
Push — 1 ( 13c7dd...13037b )
by Morven
01:38
created

code/Users.php (5 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * Root class for users, this will mostly be used to store generic
5
 * config, but will probably be extended in future to provide additional
6
 * functionality.
7
 *
8
 * @author i-lateral (http://www.i-lateral.com)
9
 * @package users
10
 */
11
class Users extends Object
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
12
{
13
14
    /**
15
     * Stipulate if a user requires verification. NOTE this does not
16
     * actually deny the user the ability to login, it only alerts them
17
     * that they need validiation
18
     *
19
     * @var Boolean
20
     * @config
21
     */
22
    private static $require_verification = true;
0 ignored issues
show
The property $require_verification is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
23
24
    /**
25
     * Stipulate whether to send a verification email to users after
26
     * registration
27
     *
28
     * @var Boolean
29
     * @config
30
     */
31
    private static $send_verification_email = true;
0 ignored issues
show
The property $send_verification_email is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
32
33
    /**
34
     * Stipulate the sender address for emails sent from this module. If
35
     * not set, use the default @Email.admin_email instead.
36
     *
37
     * @var strong
38
     * @config
39
     */
40
    private static $send_email_from;
0 ignored issues
show
The property $send_email_from is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
41
42
    /**
43
     * Auto login users after registration
44
     *
45
     * @var Boolean
46
     * @config
47
     */
48
    private static $login_after_register = true;
0 ignored issues
show
The property $login_after_register is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
49
50
    /**
51
     * Add new users to the following groups. This is a list of group codes.
52
     * Adding a new code will add the user to this group
53
     *
54
     * @var array
55
     * @config
56
     */
57
    private static $new_user_groups = array(
58
        "users-frontend"
59
    );
60
61
    /**
62
     * Add a group to the list of groups a new user is added to on
63
     * registering.
64
     *
65
     * @param string Group code that will be used
66
     */
67
    public static function addNewUserGroup($code)
68
    {
69
        self::$new_user_groups[] = $code;
70
    }
71
72
    /**
73
     * Remove a group from the list of groups a new user is added to on
74
     * registering.
75
     *
76
     * @param string Group code that will be used
77
     */
78
    public static function removeNewUserGroup($code)
79
    {
80
        if (isset(self::$new_user_groups[$code])) {
81
            unset(self::$new_user_groups[$code]);
82
        }
83
    }
84
85
    /**
86
     * Groups a user will be added to when verified. This should be an
87
     * array of group "codes", NOT names or ID's
88
     *
89
     * @var array
90
     * @config
91
     */
92
    private static $verification_groups = array(
93
        "users-verified"
94
    );
95
96
    /**
97
     * Add a group to the list of groups a new user is added to on
98
     * registering.
99
     *
100
     * @param string Group code that will be used
101
     */
102
    public static function addVerificationGroup($code)
103
    {
104
        self::$verification_groups[] = $code;
105
    }
106
107
    /**
108
     * Remove a group from the list of groups a new user is added to on
109
     * registering.
110
     *
111
     * @param string Group code that will be used
112
     */
113
    public static function removeVerificationGroup($code)
114
    {
115
        if (isset(self::$verification_groups[$code])) {
116
            unset(self::$verification_groups[$code]);
117
        }
118
    }
119
}
120