I had the same issue, main users have the contributor role and a simple sidebar comment sidebar widget was not working when logged-in! Strange. I solved it by some sql:
function getLatestComments ( $postid ) {
global $wpdb;
$sql = "SELECT * from $wpdb->comments WHERE
comment_post_ID = $postid AND
comment_approved = 1
ORDER BY comment_ID DESC";
return $wpdb->get_results($sql);
}
I used this instead of get_comments. You may modify the sql and customize as required.
Related Posts:
- Capability for allowing user to post own comments without moderation
- Why do comment moderators need to have all create/edit/delete toboth posts and pages?
- Why the capability ‘activate_plugins’ is needed to allow a role to see all posts/pages/comments?
- How to change the email notification recipient (user) for new comments?
- how to make author to write comment on only his own posts?
- Add a drop down list to comment form?
- Prevent Contributor to show comment list
- Expanding the allowed HTML tags in comments?
- How to allow a particular role like Contributor be able to only view pending comments and approve them?
- edit_comment capability for subscriber
- Allow contributors to moderate comments comments on posts they write
- Why are authors allowed to approve comments on their posts? How to revoke privilege?
- Show comments of a user post only when they are login
- Grant a person permission to moderate all comments on a blog without giving them the ability to edit other peoples post
- Only Allow post author and “Premium” Role user to comment
- Show image next to the comment author if have certain role
- Is there a way to only allow certain user ranks to comment on a post
- Allow comments only for custom post type
- Showing different images depending on user role
- Listing comment author role code problem
- Hide comments from admin comments.php that user can’t edit or manage
- How do I comment out a block of tags in XML?
- R: Comment out block of code
- Getting a List of Currently Available Roles on a WordPress Site?
- Editor can create any new user except administrator
- Why do I get comment spam even with Akismet and Captcha?
- What tools are available for managing/writing to WordPress? [closed]
- Is there way to rename user role name without plugin?
- How to create a clone role in wordpress
- Possible to hide Custom Post Type UI/Menu from specific User Roles?
- How to rearrange fields in comment_form()
- setting comments off as default for pages and custom post types?
- How to add a Capability to a User Role?
- Select subscriber as author of post in admin panel?
- How can I get a list of users by their role?
- Remove Ability for Other Users to View Administrator in User List?
- How do I make a draft post accessible to everyone?
- Is it possible to pull comments from facebook into your blog?
- Reset default roles and capabilities
- What action should I hook into when adding roles and capabilities?
- add_role() run only once?
- Custom post type role permissions won’t let me read
- what’s the meaning of the field wp_capabilities in table wp_usermeta
- Filtering the Admin Comments List to Show Only Comments from the Current User?
- Allowing custom role access to custom post type in back end
- Non-threaded comment replies with link to original comment
- WordPress SEO by Yoast: Hide Meta Boxes in Posts for Non-admins
- Approve comment hook?
- Commenting in user profile page?
- How to change “You must be logged in to post a comment.”
- Groups of capabilities: users with multiple roles?
- comment_post_ID 0 (cannot remove from dashboard)
- User-edit role setting distinct from wp_capabilities? [closed]
- Disable comments on all posts/pages
- How do I delete all comments from a specific old blog post?
- Removing the “Website” Field from Comments and Replies?
- What do unfiltered_html and unfiltered_upload actually filter?
- Stop WordPress redirecting comment-page-1 to the post page?
- Allow Editors to edit pending posts but not draft ones
- What’s the difference between Role and Meta capabilities; When to use map_meta_cap() filter
- Importing old Disqus comments into WordPress
- How to add a class to the comment submit button?
- How to wrap submit button of comment form with div
- Temporary capability for current_user_can()
- Allow user to “edit_others_posts” to save only, not publish
- How to enable comments for pending and draft posts?
- Using WordPress’ WYSIWYG for comments
- Enable Submit Comment Without Page Reload (Using Ajax)?
- What for is the table “wp_commentmeta” exactly?
- Getting Post Comments for post ID using WP_Query() and a Custom Loop?
- Add option to disable comments on a per posts basis?
- Allow roles below admin to add subscribers only
- How to let contributors to create a new revision(draft) editing their published posts
- Resetting comment count
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- When importing – failed to import: Invalid post type feedback
- Redirect user to a custom url after submitting the comment
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- Paginate result set from $wpdb->get_results()
- How to assign specific users the capability to edit specific pages / posts / custom post types
- Change Comment Author Display Name
- Would switching to InnoDB from MyISAM improve performance of comments table?
- Custom comment type based on thread level
- How to add internal, revision comments to page updates
- How to load and show comments with AJAX instead of pagination?
- Linking to Page Showing Only Comments Without Parent Post
- How can I modify the Capability needed to access a plugin’s options?
- Comment Reply javascript
- How do we remove the H3 tag for the reply-title I.D
- Comments not appearing at all
- Disable posts, only allow to edit existing pages, not create new ones (create_posts)
- How to enable a site administrator to edit users in a WordPress network/ multisite setup?
- comments reply script not working
- How to display comment form error messages in the same page
- 3 moderators to approve comment
- Allow user to Edit Posts but not Add New?
- How to get all capabilities of an existing user role
- Defining capabilities for custom post type
- How to deal with small scale comment spam on small commercial sites? [closed]
- What should I do to make generated avatars different for anonymous comments?