mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-16 21:23:39 +09:00
Update 1.0.89
This commit is contained in:
@@ -6,8 +6,15 @@ class UM_Cache {
|
||||
|
||||
add_action( 'init', array(&$this, 'do_not_cache' ) );
|
||||
|
||||
add_action('um_admin_after_editing_role', array(&$this, 'delete_role_cache'), 10, 2 );
|
||||
|
||||
$this->role_data = get_option('um_cache_role_data');
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @needed for some cache plugins
|
||||
***/
|
||||
function do_not_cache() {
|
||||
|
||||
if ( um_is_core_uri() ) {
|
||||
@@ -15,5 +22,33 @@ class UM_Cache {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @clear cached role data
|
||||
***/
|
||||
function delete_role_cache( $post_id, $post ) {
|
||||
$role_slug = $post->post_name;
|
||||
if ( isset( $this->role_data[ $role_slug ] ) ) {
|
||||
unset( $this->role_data[ $role_slug ] );
|
||||
update_option('um_cache_role_data', $this->role_data);
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
*** @get cached role data
|
||||
***/
|
||||
function role_data( $role_slug ) {
|
||||
if ( isset( $this->role_data[ $role_slug ] ) )
|
||||
return $this->role_data[ $role_slug ];
|
||||
return null;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @set role data cache
|
||||
***/
|
||||
function set_role_data( $role_slug, $array ) {
|
||||
$this->role_data[ $role_slug ] = $array;
|
||||
update_option('um_cache_role_data', $this->role_data);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user