How to replicate get_users_of_blog depreciated function for latest WP (5 posts)

  1. masok88
    Posted 4 years ago #

    Hey I'm trying to create a list of authors (w/ desc) for a site I'm making and stumbled on this function, is there a way to achieve similar results with the latest version of wordpress?

    The codex entry is here.. -http://codex.wordpress.org/Function_Reference/get_users_of_blog

    Any advice would be great.

  2. publicradio
    Posted 4 years ago #

    The codex is telling me get_users() is the new function but I'm having trouble passing any variables to this.

    The other functions show an example and unfortunately there are no examples for this new function in the codex. I would like to get_users from another blog in a multisite installation, with the role of 'contributor', and spit out a list of their emails. The function says blog_id and role are variables I can pass but they don't work for me.

    Can someone post some examples of get_users, or at least one example? Thanks.

  3. publicradio
    Posted 4 years ago #

    OK I got a basic function working with get_users and I added it to the codex.

  4. thefatguy
    Posted 4 years ago #

    Can you provide an example, either here or in the codex, for using include and exclude? I'm doing this, and getting a list of everybody, which is like 1000 subscribers that I don't want.

    $blogusers = get_users('blog_id=1&orderby=post_count&order=DESC&include=(86,99)');

    I tried 'include(86,99)' as well...same results. I tried delimiting it with role=administrator, and got nothing at all.

  5. thefatguy
    Posted 4 years ago #

    Durrr...found my own answer:

    $blogusers = get_users('blog_id=1&include=99,86');

    I really thought I'd tried that.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.