So I’m assuming the “current commenter” is actually the current user logged into WP. So to get the current user ID, you can simply use get_current_user_id:
echo do_shortcode("[theplugin_user_data user_id='" . get_current_user_id() . "']");
UPDATE
Ok, so we want, then, the comment’s author ID:
//$comment = get_comment(); // in your case, it seems you already have a $comment object...
if($comment) {
if($comment->user_id) echo do_shortcode("[theplugin_user_data user_id='" . $comment->user_id . "']");
else echo '(no data available)'; // <---- fallback, in case the comment has no known author
}
Hope this helps!
Related Posts:
- How to pass parameters in wordpress shortcode?
- How to implement a rating and review system for WordPress custom posts?
- Custom shortcode outputs plain text instead of HTML at top of post
- How to use wp_add_inline_style for custom CSS added via shortcode?
- Ajax load more button for comments wordpress
- Pass php dynamic variable to shortcode
- How can I dynamically update the class in my shortcode?
- Creating own shortcode – echoeing php variable based on JS variable
- edit_comment_link is not showing for comment author
- Limit 1 global comment per minute
- Create Page To Count Comments For Each Post In WordPress Site
- How create a Shortcode with hover and complex options
- Remove from shortcode
- comments sorting incorrectly across multiple pages
- Displaying recent posts on static page with template-part via shortcode
- Commenting out unwated CSS/scripts in HTML with PHP
- wordpress 4.4 self hosted video (html5) doesn’t show
- do_shortcode with custom field
- How to Reference/Echo Variable from Another PHP Function
- Remove echo from shortcode
- wp-comments-post.php file returns a blank page
- Replace shortcode in substring
- php function to display commenter username or login
- Genesis framework comments broken?
- check if comment submitted was successful
- Shortcode to show the code
- Shortcode returns values in the wrong order
- Get URL from shortcode tag
- Embedding PHP in shortcode $content
- Alter required message using comment form api
- Shortcode with PHP issue “Undefined index”
- Excecuting php function in shortcode
- Only first shortcode gets executed
- Get post id within comments loop
- Multiple do_shortcode in page template
- Returning data instead of echoing/printing
- echo something inside a shortcode
- displaying content that includes shortcodes within an echo
- List taxonomy term slugs within shortcode (do_shortcode)
- Shortcode from a function not working
- Display Data in Table from External Database in WP using Shortcodes
- get_posts works in the page template but not in a shortcode
- Is it possible to return content, and then also continue to do other things?
- ::before on open/close function [closed]
- anyway to put inside a $outprint=sprintf()
- WordPress comment submit button substitutes/options
- Is There A Way To Make Theme Files Accept Shortcodes?
- How to list commenters and days since last commented
- How can I include shortcodes within PHP?
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- Create a WordPress shortcode using PHP [duplicate]
- do_action(), iFrame Gets Displayed Despite Password Protection [closed]
- $wpdb returns duplicate posts
- Creating WordPress Shortcode with Variable
- Catchable fatal error: Object of class stdClass could not be converted to string
- Syntax error in a shortcode function
- How to add text to the start of all comments?
- Does anyone know all parameters of get_comments()
- Using Shortcode to Grab Archive Listing, Separate by Year
- Capitalize Shortcode Value on Output
- Appended comments but they show up above the content instead of below
- Shortcode to find and replace URL
- Why is my str_replace not working on short code submitted by front-end?
- Could use some help with Shortcodes
- get comment data using comment id
- Removing the comment function within wordpress
- How to put a form with php code into a variable or shortcode?
- Unable to process php via shortcode
- Help with WordPress function inside a shortcode
- wp_delete_comment takes two tries to delete – then deletes all comments
- calling a custom field value inside functions.php
- Using ob_start and ob_get_clean with wordpress shortcode
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- Short code template + ajax
- WordPress shortcode returns the data before
- Send a mail to specific address in a custom field when a new comment is made on a specific post
- List all blogs, but exclude the main site
- Shortcode to embed Edit Account form not working
- Shortcode not staying inside div tag
- Line breaks inside shortcode variable
- Handling PHP/HTML inside the output of a shortcode function
- Shortcode for Listing Users from Meta Value?
- Cant display an image via PHP in wordpress
- Shortcode to pull posts
- PHP code inside Shortcode
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- Fetching Initials of the Commentator in the WordPress Website
- Help Fallback (thumbnail)
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- get_comments_number() returns 0
- Shortcode to log user into current URL
- Shortcode function doesnt work without caption
- Action Hook Inside WordPress Plugin Shortcode
- Split shortcodes to array of shortcodes
- Shortcodes showing in excerpt despite using strip_shortcodes
- PHP error with a shortcode: “no suitable wrapper” for file_get_contents
- PHP Helper Class to create shortcodes
- Calling PHP Titles inside Javascript Markup
- Restrict characters in comment section
- How to make a conditional statement within $output in shortcodes.php?