init commit
This commit is contained in:
29
client_webapp/code-snippets/loggedInAs.php
Normal file
29
client_webapp/code-snippets/loggedInAs.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
add_action( 'wp_enqueue_scripts', 'my_getUserInfo' );
|
||||
function my_getUserInfo() {
|
||||
if (!is_user_logged_in()) {
|
||||
return;
|
||||
}
|
||||
if(page_id() === 2) {
|
||||
global $current_user;
|
||||
wp_get_current_user();
|
||||
js_manipulate($current_user);
|
||||
}
|
||||
}
|
||||
|
||||
function js_manipulate($current_user) {
|
||||
?>
|
||||
<script>
|
||||
// START JAVASCRIPT
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
const email = "<?php echo $current_user->user_email ?>";
|
||||
|
||||
jQuery('#textLoggedInAs .fl-rich-text p').ready(function() {
|
||||
jQuery("#textEmail .fl-rich-text")[0].textContent = email;
|
||||
});
|
||||
});
|
||||
// END JAVASCRIPT
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user