@@ -35,4 +35,126 @@ protected function getUser()
3535 {
3636 return \get_user_by ('id ' , $ this ->id ());
3737 }
38+
39+ /**
40+ * Get meta
41+ *
42+ * @param string $key
43+ * @return mixed
44+ */
45+ public function meta (string $ key )
46+ {
47+ return \get_user_meta ($ this ->id , $ key , true );
48+ }
49+
50+ /**
51+ * Get first name
52+ *
53+ * @return string
54+ */
55+ public function firstName ()
56+ {
57+ return $ this ->meta ('first_name ' );
58+ }
59+
60+ /**
61+ * Get last name
62+ *
63+ * @return string
64+ */
65+ public function lastName ()
66+ {
67+ return $ this ->meta ('last_name ' );
68+ }
69+
70+ /**
71+ * Get full name
72+ *
73+ * @return string
74+ */
75+ public function fullName ()
76+ {
77+ return \trim ("{$ this ->firstName ()} {$ this ->lastName ()}" );
78+ }
79+
80+ /**
81+ * Get nickname
82+ *
83+ * @return string
84+ */
85+ public function nickname ()
86+ {
87+ return $ this ->meta ('nickname ' );
88+ }
89+
90+ /**
91+ * Get biographical info
92+ *
93+ * @return string
94+ */
95+ public function description ()
96+ {
97+ return \apply_filters ('the_content ' , $ this ->meta ('description ' ));
98+ }
99+
100+ /**
101+ * Get username
102+ *
103+ * @return string
104+ */
105+ public function username ()
106+ {
107+ return $ this ->getUser ()->data ->user_login ;
108+ }
109+
110+ /**
111+ * Get nicename
112+ * * A URL friendly version of username()
113+ *
114+ * @return string
115+ */
116+ public function nicename ()
117+ {
118+ return $ this ->getUser ()->data ->user_nicename ;
119+ }
120+
121+ /**
122+ * Get display name
123+ *
124+ * @return string
125+ */
126+ public function displayName ()
127+ {
128+ return $ this ->getUser ()->data ->display_name ;
129+ }
130+
131+ /**
132+ * Get email address
133+ *
134+ * @return string
135+ */
136+ public function email ()
137+ {
138+ return $ this ->getUser ()->data ->user_email ;
139+ }
140+
141+ /**
142+ * Get website URL
143+ *
144+ * @return string
145+ */
146+ public function url ()
147+ {
148+ return $ this ->getUser ()->data ->user_url ;
149+ }
150+
151+ /**
152+ * Get registration date
153+ *
154+ * @return string
155+ */
156+ public function registredDate ()
157+ {
158+ return $ this ->getUser ()->data ->user_registered ;
159+ }
38160}
0 commit comments