update_user_meta on registration but only for default role type

Here is what you need to do: function set_user_rcp_default_subscriber($user_id) { $user = new WP_User( $user_id ); foreach( $user->roles as $role ) { if ( $role === ‘subscriber’ ) { update_user_meta( $user_id, ‘wp_user_level’, ‘0’ ); update_user_meta( $user_id, ‘rcp_subscription_level’, ‘1’ ); update_user_meta( $user_id, ‘rcp_status’, ‘active’ ); update_user_meta( $user_id, ‘rcp_expiration’, ‘2014-06-30’ ); } } } add_action(“user_register”, “set_user_rcp_default_subscriber”, 10, … Read more

Is there a way of retrieving the core WP capabilities?

As said in comment above is more easy remove the added capabilities. Below, as example, a simple implementation: class MyAwesomePlugin { static $capabilities = array(‘a_cap’=> true, ‘another_one’=> true, ‘third_cap’=> true); static $custom_roles = array(‘one_role’ => ‘One Role’, ‘second_role’ => ‘Second Role’); static $core_roles = array(‘administrator’, ‘editor’, ‘author’); static function install() { // add custom capabilities … Read more

Creating Custom user type just like custom post

Well, Roles are in many ways custom user types and you can add meta fields specific to roles. For example… function is_my_user_role($id = null) { global $profileuser; if (empty($profile) && !empty($id)) $profileuser = get_user_to_edit($id); return (in_array(‘myrole’,$profileuser->roles)) ? true : false; } function my_user_fields($profileuser) { if (!is_my_user_role()) return false; // HTML for the fields } add_action(‘show_user_profile’, … Read more

Is there any way to give all users access to one blog in a multisite network without using a plugin?

You could filter get_blogs_of_user and add this particular blog to the returned list. Pseudo-code, not tested: add_filter( ‘get_blogs_of_user’, ‘add_special_blog’, 10, 3 ); function add_special_blog( $blogs, $user_id, $all ) { $new_blog = get_blog_details( $special_blog_id ); $blogs[ $special_blog_id ] = (object) array( ‘userblog_id’ => $special_blog_id, ‘blogname’ => $new_blog->blogname, ‘domain’ => $new_blog->domain, ‘path’ => $new_blog->path, ‘site_id’ => $new_blog->site_id, … Read more

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