first commit
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
class WPML_User extends WP_User {
|
||||
|
||||
/**
|
||||
* @see \get_user_meta
|
||||
*
|
||||
* @param string $key
|
||||
* @param bool $single
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_meta( $key = '', $single = false ) {
|
||||
return get_user_meta( $this->ID, $key, $single );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \update_meta
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param mixed $prev_value
|
||||
*/
|
||||
public function update_meta( $key, $value, $prev_value = '' ) {
|
||||
update_user_meta( $this->ID, $key, $value, $prev_value );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \get_user_option
|
||||
*
|
||||
* @param string $option
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_option( $option ) {
|
||||
return get_user_option( $option, $this->ID );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \update_user_option
|
||||
*
|
||||
* @param string $option_name
|
||||
* @param mixed $new_value
|
||||
* @param bool $global
|
||||
* @return int|bool
|
||||
*/
|
||||
function update_option( $option_name, $new_value, $global = false ) {
|
||||
return update_user_option( $this->ID, $option_name, $new_value, $global );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
class WPML_WP_User_Factory {
|
||||
|
||||
public function create( $user_id ) {
|
||||
return new WPML_User( $user_id );
|
||||
}
|
||||
|
||||
public function create_by_email( $user_email ) {
|
||||
$user = get_user_by( 'email', $user_email );
|
||||
return new WPML_User( $user->ID );
|
||||
}
|
||||
|
||||
public function create_current() {
|
||||
return new WPML_User( get_current_user_id() );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
class WPML_WP_User_Query_Factory {
|
||||
|
||||
public function create( $args ) {
|
||||
return new WP_User_Query( $args );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user