v0.2.8 wip can force the id of a user for a portion of page with shortcode

This commit is contained in:
asus
2024-03-15 13:50:27 +01:00
parent 6c7b269052
commit 494943e4f7
3 changed files with 270 additions and 142 deletions

View File

@@ -101,7 +101,6 @@ class PLGNTLS_class
const ROLE_ADMIN = 'administrator';
// SHORTCODES
const SHORTCODE_CHOOSE_ACF_ID = ['logged_in'=>'logged_in', 'post_creator'=>'post_creator', 'off'=>'off'];
// OTHER
const CARD_RENEW_PERIOD = 31; // int : number of days before expiration when renew card start to be possible
@@ -118,6 +117,7 @@ class PLGNTLS_class
private static $_file_name;
private static $_root_path;
private static $_root_url;
private static $_backup_current_user = null;
private $_first_script;
private $_first_style;
@@ -189,8 +189,33 @@ class PLGNTLS_class
return(self::$_root_url);
}
/*
* setter and getter for current user backup
*
*/
public static function set_current_user_backup() {
if (self::$_backup_current_user !== null)
return;
self::$_backup_current_user = get_current_user_id();
}
public static function get_current_user_backup() {
return self::$_backup_current_user;
}
public static function reset_current_user_backup() {
$backup_user = self::$_backup_current_user;
self::$_backup_current_user = null;
return $backup_user;
}
/*
* for debug purposes
*
*/
public static function debug_infos() {
if (self::$_DEBUG_INFOS === false)