0

I am unsure how to take data from the user array and place some of these values into the following hyperlink. I want to replace the email address, first name and last name with the values from the currently logged in user array.

<a href="https://thinkmcat.webex.com/thinkmcat/m.php?AT=EN&AE=testreg@testdomain.com&FN=Firstname&LN=Lastname&&MK=665080128&PW=miami&BU=http://thinkmcat.com/">

<?php
$current_user = wp_get_current_user();
/**
 * @example Safe usage: $current_user = wp_get_current_user();
 * if ( !($current_user instanceof WP_User) )
 *     return;
 */
echo 'Username: ' . $current_user->user_login . '<br />';
echo 'User email: ' . $current_user->user_email . '<br />';
echo 'User first name: ' . $current_user->user_firstname . '<br />';
echo 'User last name: ' . $current_user->user_lastname . '<br />';
echo 'User display name: ' . $current_user->display_name . '<br />';
echo 'User ID: ' . $current_user->ID . '<br />';

?>
1

I would set up an array with the variables you want in the url query string and then use http_build_query().

Like so:

$args = array( 'AT' => 'EN',
               'AE' => $current_user->user_email,
               'FN' => $current_user->user_firstname,
               'LN' => $current_user->user_lastname,
               'MK' => 665080128,
               'PW' => 'miami',
               'BU' => 'http://thinkmcat.com/');

?>

<a href="https://thinkmcat.webex.com/thinkmcat/m.php?<?php echo http_build_query($args); ?>">LINK</a>
1
  • Thank you so much! I wish there was some way I could repay you. If you ever need something SEO related, I consult large SEO agencies as an experts' expert. – coneH34D May 21 '14 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.