It looks like you could add the
MAX( comment_date ) last_commented_date
to the field list to get the latest date, each user commented.
Then use e.g. the human_time_diff() function to get a human readable text for how long ago each user commented.
human_time_diff( strtotime( $result->last_commented_date) )
For safety reasons, you should then prepare the SQL statement with $wpdb->prepare(), since it contains the user input $amount.
Related Posts:
- Pre_get_comments and orderby comment_karma
- Query multiple custom post types in single loop
- The correct method to pass query vars in AJAX using ajaxurl
- How to search display_name column when using WP_User_Query
- Using WP_Query – how to display something IF there are no results
- Display user’s total comment count outside The Loop
- Facebook Comment Count
- How to order posts by modified date without using ‘query_posts’?
- Delete post revisions on post publish
- How to get user by display_name with WP_User_Query
- How to sort results from a custom database table
- Specific Loop For 2 Within Each
- How do I create comment-reply-button using element not
- How to check if comments are paginated?
- WP database error for comments_popup_link()
- How to add a post or page tag to the list of classes appearing in the body tag’s class attribute?
- Use two WP Query in template
- Uncaught TypeError: Cannot read property ‘firstChild’ of null after upgrading to WordPress 5.5
- Automatically generate Post/Page from searched Database item?
- Get ID of child from child slug, while knowing parent ID
- List User order by ID in Descending order (Backend)
- WordPress – query 5 posts with a specific post in top
- Why is variable not working on custom sql query using wpdb?
- How to get a list of all possible values of a specific user meta key?
- How does this WordPress Plugin (Thrive Comments) apply their custom comment sort? [closed]
- Show comments menu in dashboard only if the site has comment
- Custom filter in admin edit custom post type responding with invalid post type?
- Accessing the database from a plugin outside of action hooks
- Create WP_Query to search for posts by their categories or their parent/child categories
- ACF: how do I get the fields and its values of a specific group?
- Set WP_query ‘order’ option by another tables value
- WordPress default Search function inconsistent in WooCommerce Product Titles
- Increase offset while looping
- Two queries for a WP_User_Query search work perfectly apart, but not together
- edit_comment_link is not showing for comment author
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- Genesis framework comments broken?
- WordPress SQL injection
- Which is the correct way to conditionally enqueue a CSS file?
- unable to use ‘new WP_Query’ in AJAX call
- Parse error: syntax error, unexpected ‘}’ on get_the_author_meta [closed]
- How to add text to the start of all comments?
- How to overwrite orderby with add_query_var
- Can’t update multiple rows with $wpdb query
- Appended comments but they show up above the content instead of below
- get comment data using comment id
- 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]
- How to display SQL query that ran in WC_Order_Query?
- Custom Post type slider with thumbnail navigation
- get_comments_number() returns 0
- WordPress PHP syntax doesn’t seem to be working correctly
- Querying for specific tags
- Limit tags shown in post
- Why my query does not run with prepare
- How to get comment_ID by post_ID in wordpress
- List of Events with Multiple Dates: Only NEXT Date
- Undefined variable: row?
- WordPress Custom Query: Combining Two Functions
- WordPress is removing query variables like page, p from the URL of a custom static page
- Reject all malicious URL requests functions.php
- Build A Custom SQL Query for WordPress Search
- comment_post (if comment is approved OR $comment_approved === 1) not working?
- WordPress Custom Form – Getting Query Vars, Weird Glitch?
- Add custom field on admin dashboard comments / reviews
- Display articles with a different template in the home page | Solved |
- array wordpress when get is null
- Reading URL Parameters
- How to pass parameters in wordpress shortcode?
- Display the list of user’s comments + the post title + date
- Category Page Displaying all Pages
- Comments on my custom post type
- Why does a header location on admin_head remove the query var I’m setting in the location?
- Offset with ajax load more posts duplicates
- wordpress query returning unexpected results
- How to add delete, approve, spam Links to Comments
- Real time notification on user profile after new comment
- How to do a MySql query in WordPress?
- What’s the correct offset value for order ASC?
- Pagination in WP Queries
- How can I display a query in a page?
- Getting most popular posts based on Facebook comments count
- A Space being added to url generated by custom plugin
- “Where… like” query not working as expected
- Unserializeing multiple column values that are stored in one database results variable
- Problems With Query and/or Template Part and/or PHP
- If Elseif Query
- How to callback custom field text
- How can I add more code to this?
- Does wp_query and query_posts affect website performance? [duplicate]
- How to get the rating value of each comment
- Trouble figuring out how to get my button to submit comment
- How to insert a variable into a query parameter?
- How to convert my comment.html to comment.php
- WP_Query not returning results
- Guests comment form – prevent duplicate email addresses
- Permissions error when I use my plugin to delete comments in the front-end
- Custom Filtering date with newsletter
- Display featured posts first, then display all others within a specific category in WordPress
- How to allow searching a custom meta key in admin list table?