For the shortcode I am using, the developer of the plugin only added the ability to output content via the shortcode. So the shortcode is all I have to work with.
Here is the default shortcode which does work:
echo do_shortcode("[theplugin_user_data user_id='8']");
With this code, it will output the data for the user with user id of "8". Problem is I can't use this code because if I put that it would give the same data for user id "8" to all comments, while I need it to fetch for each commenter.
So basically I need to fetch the user id of the current comment author, and after fetching their id I need to insert it dynamically into the shortcode.
Here is an idea of what I can come up with but I don't know how to make it work.
echo do_shortcode("[theplugin_user_data user_id='" . phpcodehere . "']");
So how can I get the current commenter's user id and insert it into the shortcode shown above?
Note:
I am putting this in the comments section to pull the data. I am using the default wordpress comments system, no plugins or external comments system (the plugin I am pulling data from doesn't have anything to do with comments).
Note 2:
The user ID that is needed is the commenter who MADE the comment, not who is logged in -- please note that this is inside a wordpress comments loop pulling all comments, this. Here is the comment loop:
<li id="comment-<?phpfunction comment_IDtheme_comment(); ?>" <?php comment_class($comment, empty($args, $args['has_children']$depth ) ?{
'' : 'parent' );$GLOBALS['comment'] ?>>= $comment;
For example, get_comment_author_link()
works inside the loop to get the link for the comment author. What I need is the user ID of the comment author.
Note 3:
Not the post author, nor the logged in user; what I need is the comment author user ID.