[wp-hackers] get_editable_user_ids
Andrew Nacin
wp at andrewnacin.com
Mon Feb 28 08:40:40 UTC 2011
On Mon, Feb 28, 2011 at 3:27 AM, Scott Bressler <sbressler at gmail.com> wrote:
> Clearly spoke too soon -- the method was merely deprecated. However, in a
> manner of speaking, the form of deprecating methods in WordPress could
> indeed be considered breaking backward-compatibility, as methods are moved
> from one file to another. It so happened that the part of my plugin that
> used that method was only called via AJAX and only pulled in
> wp-admin/includes/user.php. Since the method in question is no longer in
that file, my plugin broke. It might be worth rethinking the approach to
deprecating methods: as can be seen in this instance, I would argue that
moving methods around is an API-breaking change. While it keeps the
currently un-deprecated methods all together neatly, it can break plugins
that I think are executing perfectly valid code (only including what's
necessary).
If you were using admin-ajax.php, you wouldn't have run into this problem.
:)
Otherwise, you'll want to include wp-admin/includes/admin.php instead of
individual files, as that allows us the flexibility of moving things around.
That's not going to be great for memory footprint, but for a one-off AJAX
request, it's far better than trying to peg where a function is (which is
never a good idea). We don't plan to change how functions get deprecated,
because this is pretty much the only hiccup, and it's easily avoided.
Now more important is that I get my plugin working again. I could obviously
> take the easy approach and just include the deprecated file, but I'd rather
> migrate to get_users like a good programmer. So now my question is: what
> parameters ought I pass to that function to make it behave like
> get_editable_user_ids used to?
>
I'm pretty sure the main argument to match the functionality of
get_editable_user_ids() is 'who' => 'authors'. Beyond that, the other
interesting argument is 'include_selected', which is to include an author
who isn't included in the initial query, such as a post author who lost
permissions.
Hope that helps,
Nacin
More information about the wp-hackers
mailing list