30 lines
527 B
PHP
30 lines
527 B
PHP
<?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!');
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
* shortcode to write email of the logged in user
|
|
*/
|
|
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;
|
|
}
|
|
}
|
|
add_shortcode('cipf_user_email', 'current_user_email_shortcode');
|
|
|
|
|
|
?>
|