Tag Info

Hot answers tagged

4

There is no one answer, because both have pros and cons depending on what you want to store and why. A (probably non-exhaustive) list of differences to consider for a choice: Capabilities are designed to check if a user can do something or not. user_can and current_user_can are there to help you to check user permissions. You can implement that with user ...


2

The difference is that capabilities are part of the access permission system of the site, which utilize and can be changed by the built-in tools and APIs that are designed to handle permissions. You can create your own permission scheme but then it will not be easy to override with tools or code that expect access permissions to be handled in capabilities. ...


1

User Capabilities will allow you set site-wide access settings for a specific User/User Account Type whereas the meta-data allows you to make settings individually for each Post/Page or anything that supports Meta in Wordpress. In other words, Capabilities are part of ACL (Access Control Layer) whereas Meta is best when used for Data Presentation. User ...


1

You can store the ratings as user meta. When a rating is added, add it to the user's ratings using add_user_meta(): add_user_meta( $user_id, '_ratings', $rating, false ); The last parameter tells it to add the current rating to the meta as a new item, not to replace the existing. All ratings can then be retrieved using get_user_meta(): get_user_meta( ...


1

Two options. The first will keep you away from custom SQL, and should be a lot more efficient than what you currently have. It runs two queries, one to get the user ID with the highest hourly rate, and then again to get the lowest. You need one more query to update the user meta cache & then you're home free: $query = new WP_User_Query; $users = array( ...


1

Your query is wrong because your third argument to TIMESTAMPDIFF is incorrect. You should be using meta_value instead of SELECT meta_value. SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_wp_kc_last_active_time' AND TIMESTAMPDIFF( second, now(), TIMESTAMP(meta_value) ) > 5184000; Try that and see if the results start looking correct. I just ...



Only top voted, non community-wiki answers of a minimum length are eligible