Gravity Forms Submit form as another user

A solution I have found is to manipulate the entry after submission using the following: function submit_as_user_proxy( $form ) { $id = null; $proxy_user_meta = null; $user_role=””; $field_existing_users = null; $field_signed_up_as = null; foreach ( $form[‘fields’] as &$field ) { if ( false !== strpos( $field->cssClass, ‘existing_users’ ) ) { $field_existing_users = &$field; } if … Read more

delete_user_meta Delete one value out of array

Thanks yo Howdy_McGee, Here is working code. // Remove favorite authors from current users DB function fav_author_remove_user(){ check_ajax_referer( ‘fav_authors_obj_ajax’, ‘security’ ); $remove_this_author = $_POST[‘clicked_author_id’]; if ( current_user_can( ‘edit_posts’ ) ){ $user_id = fav_authors_get_user_id(); $author_list = get_user_meta( $user_id, FAV_AUTHORS_META_KEY, true ); //print_r($author_list); $author_saved = array_search($remove_this_author, $author_list); if( FALSE !== $author_saved ){ // Remove $author_saved unset($author_list[$author_saved]); $author_arr … Read more

How can I sort get_users() by any value (last_name, user defined fields and more)

get_users() does not allow you to directly sort by whatever you like, but there are ways around it. The Codex for get_users() says: orderby – Sort by ‘ID’, ‘login’, ‘nicename’, ’email’, ‘url’, ‘registered’, ‘display_name’, ‘post_count’, ‘include’, or ‘meta_value’ (query must also contain a ‘meta_key’ – see WP_User_Query). meta_value is a very powerful way to go … Read more

Create a page Meta Box listing all blog users

If someone wants to clean this up, all the better, but it gets the job done 🙂 If I understood you correctly, you need the ID for the user, yes? For more info on $wp_user_query check out this post which was a partial resource for me writing this code: http://www.mattvarone.com/wordpress/list-users-with-wp_user_query/ // List Users add_action(“admin_init”, “users_meta_init”); … Read more

Admins can’t edit each other’s posts

Ok, I got it figured out. For some reason, current_user_can was returning false when an admin went to edit other user’s posts… I have no idea how admins lost the ability to do this, but putting this into functions.php is a workable bandaid that restores admin edit capabilities; $administrator = get_role(‘administrator’); $administrator->add_cap(‘edit_others_posts’);

User fields that can be edited by administrator?

I used this so a teacher would mark what courses the students were subscribed to. This is a generic version of that code, using only one extra field. Admin view Other users view <?php /* Plugin Name: Admin User Fields */ add_action( ‘admin_init’, ‘wpse_70265_init’); function wpse_70265_init() { if( current_user_can( ‘administrator’ ) ) { add_action( ‘show_user_profile’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)