I'm working on my website and I'm having some trouble with PHP syntax. I just want to say "Welcome, [name]" when users are logged in. I'm working on Wordpress and I'm using a plugin to work with users. So, as I want to align the text on the right side of the website, I have this:
print"<p align=\"RIGHT\">Welcome, </p>";
But now I need to insert the name. For doing that I have a shortcode:
[user-data field_name="Name"]
I'm trying to put those things together, but is not working. I'm using do_shortcode, but I don't know how to put that together.
do_shortcode('[user-data field_name="Nombre"]')
Hope someone can help me. thank you very much!
if the plugin is querying the databse table _users you should be able to store the name of the current user in a variable and then add that to your output. I'm not sure what plugin you're using, but try something like this. This is how I've always done it.
<?php if(is_user_logged_in()) : ?>
<?php
global $current_user;
get_currentuserinfo();
$username = $current_user->user_login;
?>
<p class="your-class">Welcome, <?php echo $username; ?></p>
<?php endif; ?>
if that doesn't work I would hop into your database and find the table/field where the usernames are being stored and then call/store them in a similar manner