rework transient names specifically for public and private directory
This commit is contained in:
parent
7862f803a7
commit
0bae70ad2c
2 changed files with 8 additions and 4 deletions
|
@ -240,8 +240,8 @@ function wasmo_update_user( $post_id ) {
|
|||
update_user_meta( $user_id, 'last_save', time() );
|
||||
|
||||
// clear directory transients
|
||||
delete_transient( 'directory-1' );
|
||||
delete_transient( 'directory-0' );
|
||||
delete_transient( 'directory-private' );
|
||||
delete_transient( 'directory-public' );
|
||||
|
||||
// update question counts if user includes any
|
||||
if( have_rows( 'questions', 'user_' . $user_id ) ){
|
||||
|
|
|
@ -2,8 +2,12 @@
|
|||
// Directory
|
||||
|
||||
// define transient name - taxid + user state.
|
||||
$transient_name = 'directory-' . is_user_logged_in();
|
||||
$transient_exp = 24 * HOUR_IN_SECONDS;
|
||||
if ( is_user_logged_in() ) {
|
||||
$transient_name = 'directory-private';
|
||||
} else {
|
||||
$transient_name = 'directory-public';
|
||||
}
|
||||
$transient_exp = 7 * 24 * HOUR_IN_SECONDS; // 1 week
|
||||
// debug
|
||||
// if ( current_user_can('administrator') && WP_DEBUG ) {
|
||||
// $transient_name = time();
|
||||
|
|
Loading…
Reference in a new issue