Tag Info

New answers tagged

0

This page gives you a typical wordpress load http://codex.wordpress.org/Plugin_API/Action_Reference You can see, the current user is available after the theme is setup but before init. If you are calling these functions within the theme then you will be fine. Otherwise make sure any functions that reference the current user are called using hooks that run ...


1

In general your problem is that you check the condition on the front end but not on the backend. You have to check if a user is a allowed to upload a file before moving it to the uploads directory and adding it as an attachment. If the limitation you put are kind of nice to have it might be enough to limit upload in the UI, but if it has business or law ...


0

The QA that you have linked to is related but not needed here. meta_value_num is still not part of the user_query core and so, your meta_value_num parameter has no effect on the query. Just use meta_value as described on codex and you'll get what you want.


0

Try this: $yoursearchquery = 'This is my search'; $users = new WP_User_Query(array( 'search' => $yoursearchquery, 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'shoe_size', 'value' => $yoursearchquery, 'compare' => 'LIKE' ), array( 'key' ...


0

The answer is, this can't be done with any efficiency. The best thing to do is pull the data out of the serialized array and save each as their own key/value pair in the wp_usermeta table. My key was extraInfo and the values I needed were serialized in the value. This is the script I've used to create new keys and values from the data automatically. The ...


0

<?php /** * are you sure that your meta value is ok */ $meta_key = 'extraInfo[zip]'; $meta_value = $zip; $query = get_users( array( 'meta_key' => $meta_key, 'meta_value' => $meta_value ));


0

So i made this code from this help and work but i want to be this in ajax can somone help me my code now is: <div class="form"> <form name="newsletterform" method="post" action=""> <table> <tr> <td><label name="plus">VOTE +:</label></td> <td><input type="text" name="plus" maxlength="45" maxsize="30" ...


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

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( ...


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 ...


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 ...


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. ...


0

All of this can be done using WP_User_Query: $users = new WP_User_Query(array( meta_query( array( 'key' => 'login_status', 'value' => '0' ), array( 'key' => 'active_code', 'value' => '3f7431e226893f16cbe44424850d00ad' ) ) )); This will return a list of users that meet your requirements. Then you can get the ids like ...



Top 50 recent answers are included