• Resolved smpayne2

    (@smpayne2)


    I have been blessed with a javascript/PHP plugin that will add the user_id to the end of external links. One small problem: I have to update the “define” line with calling the logged in user’s ID #. Does anybody know how I tell it to define that paramater as the user ID?

    (noncoder here)

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter smpayne2

    (@smpayne2)

    Does this look right?

    <?php
        wp_get_current_user();
        echo 'User ID: ' . $current_user->ID . '<br />';
    ?>
    
    define( 'EXT_LINK_PARAMS', 'ul=$current_user' );
    <?php
        wp_get_current_user();
        $user_id = $current_user->ID;
        echo 'User ID: '.$user_id.'<br />';
                $ext_link_param = 'ul='.$user_id;
    
    define( 'EXT_LINK_PARAMS', $ext_link_param );
    ?>
    Thread Starter smpayne2

    (@smpayne2)

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Calling the User ID for javascript’ is closed to new replies.