diff --git a/plugins/fipfcard_plugin/fipfcard_plugin.php b/plugins/fipfcard_plugin/fipfcard_plugin.php index 7f95831..823cae0 100644 --- a/plugins/fipfcard_plugin/fipfcard_plugin.php +++ b/plugins/fipfcard_plugin/fipfcard_plugin.php @@ -37,7 +37,7 @@ include_once(PLGNTLS_class::get_path() . 'php/admin_menu/example_menu.php'); include_once(PLGNTLS_class::get_path() . 'php/paypal/paypal.php'); -//include_once(PLGNTLS_class::get_path() . '/php/user_infos.php'); +include_once(PLGNTLS_class::get_path() . '/php/user_infos.php'); //include_once(PLGNTLS_class::get_path() . '/php/hide_admin.php'); //include_once(PLGNTLS_class::get_path() . '/php/menus.php'); include_once(PLGNTLS_class::get_path() . 'php/register_partenaires.php'); diff --git a/plugins/fipfcard_plugin/php/user_infos.php b/plugins/fipfcard_plugin/php/user_infos.php index ab5dbf3..6aa8669 100644 --- a/plugins/fipfcard_plugin/php/user_infos.php +++ b/plugins/fipfcard_plugin/php/user_infos.php @@ -11,19 +11,50 @@ if (!defined('ABSPATH')) { /* -* shortcode to write email of the logged in user +* shortcode to write user info of the logged in user +* 0 or 1 argument, usage : +* - [cipf_user_info] -> list of all availables infos +* - [cipf_user_info user_email] -> display the email +* - [cipf_user_info user_email user_login] -> display the email */ -function current_user_email_shortcode() { - $text_not_logged_in = "you are not logged in"; - if (is_user_logged_in()) { - $current_user = wp_get_current_user(); - return $current_user->user_email; - } - else { - return $text_not_logged_in; +function current_user_infos_CIPF($atts) { + if (!is_user_logged_in()) + return ; + error_log("----"); + + $current_user = wp_get_current_user(); + $current_user_infos = $current_user->data; + + if (empty($atts)) { + $user_properties = (array) get_userdata($current_user->ID)->data; + $user_metas = get_user_meta($current_user->ID); + $user_infos = array_merge($user_metas, $user_properties); + $output = '