multiple wordpress installation with shared usertable on an different database

After writing those two lines in wp-config.php, your users data will be shared between both installations, but both installations will also need to have the same cookie parameters, so in wp-config.php file of your second installation, modify the COOKIE_DOMAIN like this: define(‘COOKIE_DOMAIN’, ‘.{yoursite.com}’); //replace with URL of first site define(‘COOKIEPATH’, “https://wordpress.stackexchange.com/”);

Assign published posts to another user automatically

You can try using wp_insert_post_data for the task. Something like: function assign_new_post_to_specific_author( $data , $postarr ) { // Where author_ID is the ID of the author you want to assign the new post $data[‘post_author’] = author_ID; return $data; } add_filter( ‘wp_insert_post_data’, ‘assign_new_post_to_specific_author’, ’99’, 2 ); Tried it on c9.io and it works, but you need … Read more

Create a “user log”

You can use edit_user_profile_update hook. This action hook is generally used to save custom fields that have been added to the WordPress profile page. add_action( ‘edit_user_profile_update’, ‘update_extra_profile_fields’ ); function update_extra_profile_fields( $user_id ) { if ( current_user_can( ‘edit_user’, $user_id ) ) { update_user_meta( $user_id, ‘my_custom_field’, $_POST[‘your_field’] ); } } With update_user_meta you can check the response … Read more

How to make Users sort in reverse order by default?

You can override the default query arguments using users_list_table_query_args: function wpse_214577_users_list_table_query_args( $args ) { if ( empty( $args[‘orderby’] ) ) $args[‘orderby’] = ‘ID’; if ( empty( $args[‘order’] ) ) $args[‘order’] = ‘ASC’; return $args; } add_filter( ‘users_list_table_query_args’, ‘wpse_214577_users_list_table_query_args’ );

Custom User role not working with custom post type

I thought I would try to clarify my comments: You only get a few things out of setting your capability_types the way you have above, which it is explained in Note 2 of capabilities. Here is what I see looking at $GLOBALS[‘wp_post_types’][‘adoptions’]->cap: stdClass Object( [edit_post] => edit_adoption [read_post] => read_adoption [delete_post] => delete_adoption [edit_posts] => … Read more

How to get all posts belongs to a user between a certain date

Check out the WP_Query reference. For parameters. Date Parameters. $args = array( ‘author’ => 123 , ‘date_query’ => array( array( ‘after’ => ‘January 1st, 2013’, ‘before’ => array( ‘year’ => 2013, ‘month’ => 2, ‘day’ => 28, ), ‘inclusive’ => true, ), ), ‘posts_per_page’ => -1, ); $query = new WP_Query( $args ); For the … Read more

Shared account / dual blogging in WordPress

Yes, this is really very basic. If you are the admin, you can create new users and asign them a role. You could make your friend ‘author’, which would allow him to write and edit his own posts only, or make him an ‘editor’ if you also want him to edit other people’s post.