• Hi,

    I have a buddyboss community running and I have several admins for certain sections. Each of these admins can edit a custom post type unique to this admin and section. These cpt posts can have comments. Now I need the comments table in the dashboard to show ONLY those comments, that are related to the post type of the actual logged in admin user. As an idea I need something like this:

    function get_admin_related_post_type_comment() {
    if HAS_COMMENTS_AT_ALL start loop:

    if: current_user_has_role: ?admin_cookbook“
    show comments to post_cookbuch AND hide all other comments

    elseif: current_user_has_role: ?admin_nonfiction“
    show comments to post_nonfiction AND hide all other comments

    elseif: current_user_has_role: ?admin_memoire“
    show comments to post_memoire AND hide all other comments

    elseif: current_user_has_role: ?admin_childrensbook“
    show comments to post_childrensbook AND hide all other comments

    elseif: current_user_has_role: ?administrator“
    show all comments EXCEPT comments to post_cookbook, post_nonfiction, post_memoire, post_childrensbook.

    else: stop loop.
    }

    Anybody help me with this?

    Thanks
    Cally

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator James Huff

    (@macmanx)

    Since that is a commercial plugin, we ask that you please go to their official support channel, so you can get support from the people who know it best: https://my.buddyboss.com

    Forum volunteers are not given access to commercial products, so they would not know how it operates. Other community members who may have faced your issue might be able to help you but your best bet is your product’s developer. Keep in mind we encourage you to use the official support venues, as it allows the developers to be aware of issues with their code and gives back to the community in a more robust way.

    Thread Starter calaiopee

    (@calaiopee)

    Hi James, thats true.

    But what I need support for is not part of the plugin.

    It’s a customization of the class-wp-post-comments-list-table.php in wordpress admin/includes folder. That class fetches the list of all comments and puts them in the dashboard table.
    I need it to first check the user role and fetch only the user roles related custom post types comments.

    This does not depend on any plugin. Right?

    Thanks for your patience ??
    Cally

    Hi @calaiopee – you can use pre_get_comments action hook to filter the comments on comments screen of WordPress dashboard.

    In the function attached to the hook you need to check the currently logged in user and accordingly pass the post type in query_vars.

    I hope this helps.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get custom post comment’ is closed to new replies.