Commit Graph

253 Commits

Author SHA1 Message Date
Sergey Biryukov fbc2a6ca6d PHPDoc fixes and additions. fixes #24616.
git-svn-id: https://develop.svn.wordpress.org/trunk@24490 602fd350-edb4-49c9-b593-d223f7449a82
2013-06-21 12:45:11 +00:00
Andrew Nacin 8a30181896 Remove docs suggesting that wp_update_user() creates a user if no ID is provided. See #16731, that is incorrect at this time.
git-svn-id: https://develop.svn.wordpress.org/trunk@24345 602fd350-edb4-49c9-b593-d223f7449a82
2013-05-24 16:22:22 +00:00
Mark Jaquith 3bde819dbe Screen option for Post Format UI.
props nacin. see #23930.

git-svn-id: https://develop.svn.wordpress.org/trunk@24092 602fd350-edb4-49c9-b593-d223f7449a82
2013-04-25 07:28:33 +00:00
Andrew Nacin 4d584800bf Add user_search_columns filter to WP_User_Query::prepare_query().
props aaroncampbell.
fixes #16366.



git-svn-id: https://develop.svn.wordpress.org/trunk@24056 602fd350-edb4-49c9-b593-d223f7449a82
2013-04-22 20:37:50 +00:00
Sergey Biryukov 514e6ca11f Fix fatal error in WP_User_Query when searching users by URL. Move wp_is_large_network() to wp-includes. fixes #23683 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@23664 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-12 09:19:55 +00:00
Ryan Boren 6d2a8d2ef0 Use wp_unslash() instead of stripslashes() and stripslashes_deep(). Use wp_slash() instead of add_magic_quotes().
see #21767


git-svn-id: https://develop.svn.wordpress.org/trunk@23594 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-03 21:11:40 +00:00
Andrew Nacin 16d1aa3485 Remove the three default contact methods (AIM, YIM, Jabber) for new installs. fixes #11541.
git-svn-id: https://develop.svn.wordpress.org/trunk@23588 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-03 03:00:34 +00:00
Sergey Biryukov 3e811c5171 Use distinct error code in wp_authenticate_username_password() when user is a spammer. props sirzooro. fixes #19445.
git-svn-id: https://develop.svn.wordpress.org/trunk@23579 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-01 18:01:16 +00:00
Ryan Boren c363aea627 Revert 23416, 23419, 23445 except for wp_reset_vars() changes. We are going a different direction with the slashing cleanup, so resetting to a clean slate. see #21767
git-svn-id: https://develop.svn.wordpress.org/trunk@23554 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-01 16:28:40 +00:00
Ryan Boren a6c8efadb9 Change all core API to expect unslashed rather than slashed arguments.
The exceptions to this are update_post_meta() and add_post_meta() which are often used by plugins in POST handlers and will continue accepting slashed data for now.

Introduce wp_upate_post_meta() and wp_add_post_meta() as unslashed alternatives to update_post_meta() and add_post_meta(). These functions could become methods in WP_Post so don't use them too heavily yet.

Remove all escape() calls from wp_xmlrpc_server. Now that core expects unslashed data this is no longer needed.

Remove addslashes(), addslashes_gpc(), add_magic_quotes() calls on data being prepared for handoff to core functions that until now expected slashed data. Adding slashes in no longer necessary.

Introduce wp_unslash() and use to it remove slashes from GPCS data before using it in core API. Almost every instance of stripslashes() in core should now be wp_unslash(). In the future (a release or three) when GPCS is no longer slashed, wp_unslash() will stop stripping slashes and simply return what is passed. At this point wp_unslash() calls can be removed from core.

Introduce wp_slash() for slashing GPCS data. This will also turn into a noop once GPCS is no longer slashed. wp_slash() should almost never be used. It is mainly of use in unit tests.

Plugins should use wp_unslash() on data being passed to core API.

Plugins should no longer slash data being passed to core. So when you get_post() and then wp_insert_post() the post data from get_post() no longer needs addslashes(). Most plugins were not bothering with this. They will magically start doing the right thing. Unfortunately, those few souls who did it properly will now have to avoid calling addslashes() for 3.6 and newer.

Use wp_kses_post() and wp_kses_data(), which expect unslashed data, instead of wp_filter_post_kses() and wp_filter_kses(), which expect slashed data. Filters are no longer passed slashed data.

Remove many no longer necessary calls to $wpdb->escape() and esc_sql().

In wp_get_referer() and wp_get_original_referer(), return unslashed data.

Remove old stripslashes() calls from WP_Widget::update() handlers. These haven't been necessary since WP_Widget.

Switch several queries over to prepare().

Expect something to break.

Props alexkingorg
see #21767


git-svn-id: https://develop.svn.wordpress.org/trunk@23416 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-14 22:51:06 +00:00
Andrew Nacin 41f3ab73ff Return WP_Error from wp_update_user() on a non-existent user, avoiding a fatal error in the process.
props n7studios, SergeyBiryukov.
fixes #22858 for trunk.
Unit tests: [11776/tests].



git-svn-id: https://develop.svn.wordpress.org/trunk@23210 602fd350-edb4-49c9-b593-d223f7449a82
2012-12-27 15:36:08 +00:00
Andrew Nacin 2a9536d817 Add a $public_only argument to count_many_users_posts() and get_posts_by_author_sql(). Defaults to false, and allows the counts to be returned for only public posts. props ryan, westi. fixes #21431.
git-svn-id: https://develop.svn.wordpress.org/trunk@22386 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-05 23:11:25 +00:00
Ryan Boren 1d02d4bf27 Return WP_User objects when querying 'all' fields with WP_User_Query.
Allow passing stdClass or WP_User to the WP_User constructor.

fixes #22057


git-svn-id: https://develop.svn.wordpress.org/trunk@22248 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-16 20:05:40 +00:00
Ryan Boren 8d5ca186c2 Consolidate some strings. Props pavelevap, SergeyBiryukov. see #21728
git-svn-id: https://develop.svn.wordpress.org/trunk@22124 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-05 19:04:34 +00:00
Andrew Nacin 853793ab16 Add get() and set() methods to WP_User_Query for modifying query variables the way you might with WP_Query. props wonderboymusic. fixes #21426.
git-svn-id: https://develop.svn.wordpress.org/trunk@21995 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-25 05:01:59 +00:00
Andrew Nacin 44cd6b7e85 Deprecate user_pass_ok() in favor of wp_authenticate(). see #21907.
git-svn-id: https://develop.svn.wordpress.org/trunk@21911 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-19 01:35:35 +00:00
Andrew Nacin 411e45256a On user creation, default the display name to the first and last names provided. props mikelittle for the initial patch. fixes #20637.
git-svn-id: https://develop.svn.wordpress.org/trunk@21876 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-16 22:33:24 +00:00
Ryan Boren 7852fd1919 Set the archived, spam, and deleted properties in the objects returned from get_blogs_of_user(). Props wonderboymusic. fixes #16225
git-svn-id: https://develop.svn.wordpress.org/trunk@21794 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-10 17:50:13 +00:00
Ryan Boren f0b2a4f8aa Update phpdoc for count_many_users_posts(). Props willmot. fixes #21640
git-svn-id: https://develop.svn.wordpress.org/trunk@21747 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-04 21:07:27 +00:00
Ryan Boren a77d7f0867 Add @since for _wp_get_user_contactmethods() and _get_additional_user_keys(). Props SergeyBiryukov. fixes #21246
git-svn-id: https://develop.svn.wordpress.org/trunk@21522 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-15 15:33:59 +00:00
Ryan Boren 83e5beed47 Update wp_update_user() phpdoc to reflect a possible return of WP_Error. Props SergeyBiryukov. fixes #21439
git-svn-id: https://develop.svn.wordpress.org/trunk@21509 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-14 19:29:40 +00:00
Ryan Boren 9580f65af6 Allow passing stdClass and WP_User to wp_insert_user() and wp_update_user(). Introduce WP_User::to_array(). Eliminate uses of get_object_vars() when passing to wp_*_user(). fixes #21429
git-svn-id: https://develop.svn.wordpress.org/trunk@21496 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-10 15:36:54 +00:00
Andrew Nacin a5c7405975 Move most instances of new WP_User to get_userdata(). see #21120.
git-svn-id: https://develop.svn.wordpress.org/trunk@21413 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-03 01:06:05 +00:00
Ryan Boren 4bdd2ed253 Better phpdoc for user_nicename. Props SergeyBiryukov. fixes #21427
git-svn-id: https://develop.svn.wordpress.org/trunk@21374 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-31 15:50:29 +00:00
Andrew Nacin 178c404146 Eliminate $user_pass_md5. fixes #21125.
git-svn-id: https://develop.svn.wordpress.org/trunk@21202 602fd350-edb4-49c9-b593-d223f7449a82
2012-06-30 15:04:06 +00:00
Andrew Nacin 07fce717e7 Use maybe_serialize() where appropriate. fixes #19617.
git-svn-id: https://develop.svn.wordpress.org/trunk@20612 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-27 15:57:51 +00:00
Ryan Boren d3571040fb * Return empty arrays instead of false for all conditions in get_blogs_of_user().
* When deleting a user, use a delete_metadata_by_mid() loop over the meta so that the meta cache is cleared.
* Use remove_user_from_blog() for DRYness.

Props nacin, duck_
Fixes #19500


git-svn-id: https://develop.svn.wordpress.org/trunk@20581 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-24 22:13:47 +00:00
Jon Cave 2cc545029f Don't deprecate cleaning the user cache by ID. See #20460.
git-svn-id: https://develop.svn.wordpress.org/trunk@20532 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-19 11:51:27 +00:00
Jon Cave c0dd73f68d Pass full user objects to clean_user_cache(). See #19500, fixes #20460.
Prevents notices when clean_user_cache() is called for a user that has been removed from the database.


git-svn-id: https://develop.svn.wordpress.org/trunk@20522 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-18 21:07:31 +00:00
Ryan Boren 6f9ceb2326 Introduce WP_User::exists(). see #20372
git-svn-id: https://develop.svn.wordpress.org/trunk@20378 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-06 19:18:45 +00:00
Jon Cave 33e990c8dd Remove unused $field_no_prefix variable and associated documentation from sanitize_user_field(). Fixes #20274.
git-svn-id: https://develop.svn.wordpress.org/trunk@20239 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-21 17:33:11 +00:00
Andrew Nacin 762b3bc702 $userdata should be null for anonymous requests. props MattyRob. props duck_ for the unit test. fixes #19769 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@20085 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-02 20:59:30 +00:00
Andrew Nacin 52838cbf4d Docs, see ##19882.
git-svn-id: https://develop.svn.wordpress.org/trunk@19910 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-10 22:49:56 +00:00
Ryan Boren 88b6f54e07 Exclude user_url from default user search columns for large networks. fixes #19999
git-svn-id: https://develop.svn.wordpress.org/trunk@19886 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-09 17:15:24 +00:00
Andrew Nacin 8d80cff84d Add search_columns arg to WP_User_Query to allow for explicit column choices. Without it, the columns will be detected based on the search term. see #19810.
git-svn-id: https://develop.svn.wordpress.org/trunk@19882 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-08 21:48:47 +00:00
Ryan Boren 2aa4b228e3 Match the exact role name when counting users in a role. Props 082net. fixes #12693
git-svn-id: https://develop.svn.wordpress.org/trunk@19735 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-20 16:34:26 +00:00
Ryan Boren 2b186b0c45 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: https://develop.svn.wordpress.org/trunk@19712 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-08 17:01:11 +00:00
Jon Cave 760471a9a8 Fix mistakes in parameter documentation and add some missing param docs. See #19756.
git-svn-id: https://develop.svn.wordpress.org/trunk@19702 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-06 18:31:43 +00:00
Jon Cave 2cc75b6a05 Fix some mismatching parameter documentation. Props akshayagarwal, linuxologos. See #19756.
git-svn-id: https://develop.svn.wordpress.org/trunk@19695 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-06 11:42:00 +00:00
Ryan Boren a8d77cbae9 User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302
git-svn-id: https://develop.svn.wordpress.org/trunk@19687 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-05 20:50:54 +00:00
Ryan Boren 5e76729992 One newline is enough.
git-svn-id: https://develop.svn.wordpress.org/trunk@19684 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-05 20:10:39 +00:00
Andrew Nacin 6062dd1da4 An empty database prefix is not supported for multisite. <small>Add a sanity check anyway.</small> see #19566.
git-svn-id: https://develop.svn.wordpress.org/trunk@19641 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-30 23:22:09 +00:00
Ryan Boren 765078baac Assign the full WP_User object to the userdata global. Props scribu. fixes #19595
git-svn-id: https://develop.svn.wordpress.org/trunk@19624 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-21 20:07:54 +00:00
Ryan Boren 676ba7043e Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: https://develop.svn.wordpress.org/trunk@19593 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-13 23:45:31 +00:00
Jon Cave e263cfc8b5 is_user_member_of_blog() [no args] should return true for logged in users on single site. $wpdb->blogid is 0, but the current blog ID isn't. Fixes #19160.
git-svn-id: https://develop.svn.wordpress.org/trunk@19209 602fd350-edb4-49c9-b593-d223f7449a82
2011-11-07 23:07:07 +00:00
Jon Cave 0890ecf471 get_blogs_of_user() should return false for logged out and non-existent users on single site. See #19160.
git-svn-id: https://develop.svn.wordpress.org/trunk@19208 602fd350-edb4-49c9-b593-d223f7449a82
2011-11-07 23:05:13 +00:00
Andrew Nacin 6355548ea2 Use wp_lostpassword_url() instead of site_url(wp-login...). Update wp_lostpassword_url() to use network_site_url(). props markoheijnen, fixes #18808.
git-svn-id: https://develop.svn.wordpress.org/trunk@19027 602fd350-edb4-49c9-b593-d223f7449a82
2011-10-20 14:40:11 +00:00
Ryan Boren 2c83b5728f Turn is_blog_user() into a wrapper around is_user_member_of_blog() and deprecate. Make user_id optional for is_user_member_of_blog(). Props SergeyBiryukov. fixes #16702
git-svn-id: https://develop.svn.wordpress.org/trunk@19016 602fd350-edb4-49c9-b593-d223f7449a82
2011-10-19 22:35:15 +00:00
Andrew Nacin e50a297ef1 is_blog_user() is from MU. see #16702.
git-svn-id: https://develop.svn.wordpress.org/trunk@19005 602fd350-edb4-49c9-b593-d223f7449a82
2011-10-19 15:56:05 +00:00
Ryan Boren 85c931dc32 Turn is_blog_user() into a convenience wrapper around get_blogs_of_user(). Fixes is_blog_user() for blog prefixes that do not contain a blog ID. Props SergeyBiryukov. fixes #16702
git-svn-id: https://develop.svn.wordpress.org/trunk@19004 602fd350-edb4-49c9-b593-d223f7449a82
2011-10-19 15:53:14 +00:00