mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-17 13:43:38 +09:00
Update 1.0.89
This commit is contained in:
+9
-25
@@ -183,6 +183,11 @@ class UM_Query {
|
||||
***/
|
||||
function role_data( $role_slug ) {
|
||||
global $wpdb, $ultimatemember;
|
||||
|
||||
// get cache
|
||||
if ( $ultimatemember->cache->role_data( $role_slug ) ) {
|
||||
return $ultimatemember->cache->role_data( $role_slug );
|
||||
}
|
||||
|
||||
if ($role_slug == 'admin' || $role_slug == 'member'){
|
||||
$try = $this->find_post_id('um_role','_um_core',$role_slug);
|
||||
@@ -212,6 +217,10 @@ class UM_Query {
|
||||
$array = $ultimatemember->setup->get_initial_permissions( $role_slug );
|
||||
|
||||
}
|
||||
|
||||
// set cache
|
||||
$ultimatemember->cache->set_role_data( $role_slug, $array );
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
@@ -246,31 +255,6 @@ class UM_Query {
|
||||
return $array;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Counts all user posts
|
||||
***/
|
||||
function count_posts($user_id){
|
||||
$args = array(
|
||||
'author' => $user_id,
|
||||
'post_status' => array('publish'),
|
||||
'post_type' => 'any'
|
||||
);
|
||||
$posts = new WP_Query( $args );
|
||||
$post_count = $posts->found_posts;
|
||||
return $post_count;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Count comments by user
|
||||
***/
|
||||
function count_comments( $user_id ) {
|
||||
$args = array(
|
||||
'user_id' => $user_id
|
||||
);
|
||||
$comments = get_comments( $args );
|
||||
return count($comments);
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Capture selected value
|
||||
***/
|
||||
|
||||
Reference in New Issue
Block a user