- wip filter page prof

- upgraded user info shortcode to default behavior on author page
This commit is contained in:
asus
2024-03-07 17:05:55 +01:00
parent b244b59deb
commit d65af4cd43
6 changed files with 73 additions and 43 deletions

View File

@@ -1,24 +1,43 @@
<?php
/*
* it means someone outside wp is accessing the file, in this case kill it.
*/
if (!defined('ABSPATH')) {
die('You can not access this file!');
}
function check_prof_page_CIPF() {
//add_action('template_redirect', 'is_prof_activ_CIPF');
// is an author page
if (!is_author())
return;
error_log("in check_prof_page_CIPF");
// the way to find the id of the author of an author_page
$author_id = get_queried_object_id();
// is_prof_activ_CIPF($author_id);
}
add_action('init', 'check_prof_page_CIPF');
add_action('template_redirect', 'check_prof_page_CIPF');
function is_prof_activ_CIPF() {
function is_prof_activ_CIPF($author_id) {
$acf_prof_is_activ = PLGNTLS_class::ACF_PROF_IS_ACTIV;
$slug_wait_activation = PLGNTLS_class::SLUG_PROF_INACTIV;
//$current_user = wp_get_current_user();
$user_id = get_current_user_id();
$acf_id = 'user_' . $user_id;
//$user_id = get_current_user_id();
//$acf_id = 'user_' . $user_id;
$acf_id = 'user_' . $author_id;
error_log("is activ ?");
$is_activ = get_field($acf_prof_is_activ, $acf_id);
if (!empty($is_activ))
if ($is_activ === 'Actif')
return;
error_log("...is inactiv");
$redirection_prof_inactiv = home_url() . '/' . $slug_wait_activation;
error_log("redirection_prof_inactiv");
@@ -31,4 +50,3 @@ function is_prof_activ_CIPF() {
?>