Restrict the user access in multi site for non-assigned blogs

is_user_logged_in() is a pluggable function, which means you can override its functionality. That’s probably where I’d start. Something like this may do what you’re looking for. This is untested code and comes with no warranties of any kind. function is_user_logged_in() { $user = wp_get_current_user(); $current_blog_id = get_current_blog_id(); $allowed = false; $blogs_of_user = get_blogs_of_user( $user->ID ); … Read more

How to automatically apply a password to all posts within a custom post type

If you want to make all the posts for a post type password protected with the same password then you can do run an update query like below to make this happen. Use the following code in the active theme’s functions.php file. global $wpdb; $wpdb->update( $wpdb->prefix . ‘posts’, array( ‘post_password’ => ‘wpse’ ), // Replace … Read more

Front end user meta options for users

“edit_user_profile_update” is not an action… check: http://codex.wordpress.org/Plugin_API/Action_Reference update_usermeta() is deprecated in wp 3 and above, use update_user_meta() your form is lacking some standard hidden fields like: <input type=”hidden” name=”user_id” id=”user_id” value=”<?php echo esc_attr( $current_user->ID ); ?>” /> use wp_nonce_field(); ex: <?php wp_nonce_field( ‘update-user_’ . $current_user->ID ) ?>

Add new media uploader at frontend for wp 3.5+

Add this code to your theme’s functions.php file: function add_media_upload_scripts() { if ( is_admin() ) { return; } wp_enqueue_media(); } add_action(‘wp_enqueue_scripts’, ‘add_media_upload_scripts’); This will cause the the media upload files to load on your front end pages. If you would like to load them only on one specific page where they will be needed, you … Read more

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