WordPress.org

Ready to get started?Download WordPress

Forums

Author Avatars List
Any chance to add custom post types support? (3 posts)

  1. miguelcortereal
    Member
    Posted 6 months ago #

    My users are posting in a custom post type.

    Any chance to include the option of display lists of users authors of a certain custom post type?
    That would be an awesome improvement.

    Or the code to apply so that the plugin go lookup also users posts from a given post type.

    https://wordpress.org/plugins/author-avatars/

  2. Paul Bearne
    Member
    Plugin Author

    Posted 6 months ago #

    I need to think about this

    The way the plugin works is that get all users and then filter to remove hidden users etc.

    I could add to the filter to check if the use is part of custom post type

    Here is some that I might be able to start from
    http://wordpress.stackexchange.com/questions/120469/get-all-authors-with-at-least-one-post-of-custom-post-type

    But I would what to extend to to support multiple custom page types

    And if this is set is this an only or add option

    so we might need to have 2 options

    just_post_types="dddd,page" and add_post_types="dddd"

    This will need to be added to the options as well as the shortcode handler

    I will see if I can poke at the code and let you know how I get on

    Ping me if I haven't got to in a couple weeks

    Paul

  3. miguelcortereal
    Member
    Posted 6 months ago #

    I've just found a working solution that fits my needs by hardcoding the plugin.

    At /author-avatar/lib/UserList.class.php:944, $total variable gets new values as following:

    global $wpdb;
    $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = $user_id AND post_type IN ('my_cpt') and post_status = 'publish'" );
    $regposts += count_user_posts($user_id);
    $total = $regposts + $count;

    Here 'my_cpt' is the custom post type I'm interested in.

    I guess the plugin should have at options a list of public and queryable post types to select from, that would be included in the sum.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.