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?
- Return HTML Template Page with PHP Function
- Is there a way to parse shortcodes in PHP?
- Display sorting options dropdown when using WooCommerce product category shortcode
- Retrieve multiple values passed to a single attribute in a shortcode
- Getting the comment number relative to all the post’s comments
- ob_get_clean returns empty string, ob_get_flush outputs string
- Export User Info to CSV from Front End
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- Shortcode created to check language not works
- Add/echo div with Analytics-Code to function in functions.php
- How do I hardcode a WordPress shortcode into my theme?
- How to check if comments are paginated?
- How to return multiples lines in a shortcode?
- How can I default to all WordPress roles when parameter is not included in shortcode?
- PHP contact form returns warning in text widget [closed]
- Add “last” and “first” to WordPress Comment Pagination Links
- Uncaught TypeError: Cannot read property ‘firstChild’ of null after upgrading to WordPress 5.5
- Recent post display using shortcode
- How do I turn a shortcode into PHP code?
- How to return a foreach inside a shortcode
- How do I fetch all comments per post via WP REST API?
- custom shortcode will not display the wrapped content
- Shortcode content output but not in correct place
- PHP code inside shortcodes
- Trigger popup in a php if/else statement
- Append HTML Using Shortcode
- How to output a PHP file values by shortcode?
- Sending data from custom inputs in WordPress comment form in the admin notification email
- Show wp_die if url form comment not emply
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- Pass php dynamic variable to shortcode
- Limit 1 global comment per minute
- do_shortcode with custom field
- Remove echo from shortcode
- Genesis framework comments broken?
- Shortcode to show the code
- Get URL from shortcode tag
- Multiple do_shortcode in page template
- Shortcode from a function not working
- Is it possible to return content, and then also continue to do other things?
- $wpdb returns duplicate posts
- Creating WordPress Shortcode with Variable
- Catchable fatal error: Object of class stdClass could not be converted to string
- How to add text to the start of all comments?
- Does anyone know all parameters of get_comments()
- Shortcode to find and replace URL
- Could use some help with Shortcodes
- How to put a form with php code into a variable or shortcode?
- wp_delete_comment takes two tries to delete – then deletes all comments
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- Shortcode to embed Edit Account form not working
- Handling PHP/HTML inside the output of a shortcode function
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- Shortcodes showing in excerpt despite using strip_shortcodes
- Calling PHP Titles inside Javascript Markup
- How to get my [shortcode] rendered on the home page, other pages are fine
- Including Custom fields within the_content
- What is the difference between Null vs Empty (Zero Length) string?
- MySQL Query Returns Array () In Shortcode
- Show Featured Image Dimensions and size frontend with shortcode
- How to work Woocommerce pagination inside shortcode?
- How to get woocommerce orders with get_posts method in a shortcode
- Counting number of posts in multiple (sub)categories using shortcode
- Add custom field on admin dashboard comments / reviews
- Display Visual Composer shortcode if a post belongs in specific categories
- is it possible for a URL to filter by tag
- Trying to create a shortcode to display categories with a specific product tag
- Display the list of user’s comments + the post title + date
- How can I prevent a shortcode div from extending beyond its boundaries?
- Adding variable in WordPress shortcode
- Execute Shortcode in Textfile
- Echo short code syntax
- custom taxonomies not working
- How to return html as a string from php for WordPress
- Changing Date Format on Custom Meta Data w/shortcode call
- Add the shortcodes from the enfold theme to the other theme
- How to output values from a loop into a javascript array
- Offset with ajax load more posts duplicates
- How to add delete, approve, spam Links to Comments
- What’s the correct offset value for order ASC?
- Short code into PHP
- How can i iterate through this shortcode array?
- Shortcode in a $output statement
- Need help with PHP functions
- When using shortcode, content stops generating after the_content
- PHP Shortcode – 500 error
- Run PHP Results inside WP Shortcode
- Shortcode At top of Page – PHP 5.5 vs 5.4 – ob_start();
- On selecting shortcode generate selected shortcode table inside page editor worrdpress
- Using the same shortcode to show any table from the database
- Shortcoding with Divs
- How to get the rating value of each comment
- My title is showing after the shortcode
- Trouble figuring out how to get my button to submit comment
- Shortcode to include PHP file, pass various parameters to include?
- Is there a better way to output HTML as a shortcode?
- why css file not link?how to create permalink?
- Show Login Errors In WordPress/Elementor (Code “works”, but breaks site)
- Shortcode Displays 2 times