WP web services – weekly update
Continued testing the plugin again. Nothing much this week.
I attended the IRC chat and discussed my progress with my mentor.
Next week i will focus on adding documentation.
Continued testing the plugin again. Nothing much this week.
I attended the IRC chat and discussed my progress with my mentor.
Next week i will focus on adding documentation.
Steve Steiner 5:26 pm on July 27, 2011 Permalink |
I have installed the plugin and am beginning to use some of the functions.
I have a question: Why did you rename all of the parameters?
For example, in the wp_newUser function, which serves as a wrapper for wp_insert_user(), the parameter ‘user_login’ is renamed to ‘username’, `user_pass` is renamed `password` and so on.
Wouldn’t it be easier to just use the name of the parameter as passed to wp_insert_user() to avoid having to remember two completely different sets of parameter names?
This seems to have been done with almost every parameter to every function — “user_description” becomes “bio”, user_nicename becomes “nicename” and so on.
Since these are brand new functions, there is no legacy ‘compatibility’ consideration so it would seem good practice to keep the parameter names the same as the parameter names passed to the WordPress functions and avoid all of this translation overhead.
Thanks,
S
Prasath Nadarajah 5:06 pm on July 28, 2011 Permalink |
I got these names from the wp-admin backend. When you add/edit users you get these ‘user_description’ as ‘bio’. Its realy good to have same names to avoid translation overhead. I will discuss this with my mentor and change it.
let me know any bugs on these functions
Cheers
Steve Steiner 5:48 pm on July 28, 2011 Permalink |
Prasath,
I’m so glad you agree!
Some of these name translations are also carry-overs from the legacy Blogger etc. support.
Since these are shiny new “WordPress only” functions, with no need for legacy support, the closer the functions (in both capabilities and parameter names) stay to the back-end WordPress functions they wrap, the easier they’ll be to learn, use, and, especially, remember.
Thanks!
S
Steve Steiner 2:12 pm on July 29, 2011 Permalink |
Would it be possible to get wp_getUser() to also accept a user_login as well as a user_ID?
I think it’s a much more prevalent use case to have the user’s login name rather than the database ID; at least it is for me.
Unfortunately, at the moment, it’s necessary to call wp_getUsers() to get a list of users, then find the user’s ID in the return value, then call wp_getUser() with that ID.
Thanks,
S