Create a Meta Box in the Admin User Screen?

Well, as you already know, meta boxes are for post types only… What you can do is to customize the heck out of that screen. What follows is the code I used on a client’s custom theme. Originally, it was used with the action hook admin_print_scripts-profile.php (which could also be added bellow). /functions.php: add_action( ‘admin_print_scripts-user-new.php’, … Read more

Check if username exist with AJAX

The problem is with your jQuery selector: var usr = $(“#site-addres-input”).attr(‘value’); Will get the default value of the input element. Typically this will be blank, because you’re not setting it ahead of time. You need to use: var usr = $(“#site-addres-input”).val(); I’m also noticing that you’re using #site-addres-input, but “address” has two s at the … Read more

User registration on sub site

What you’ve described is default behavior for WordPress where when a user registers on a subsite, they’re really registering with the root site. Check out this plugin, which looks to help with new user sign ups and adding them to the right subsite. http://wordpress.org/extend/plugins/wpmu-default-user-role/ If that plugin isn’t what you’re looking for then perhaps this … Read more

WPMU – new users are automatically subscribed to the main blog – how to prevent that?

This is a known bug. A fix will be available in 3.6.1, see: http://core.trac.wordpress.org/ticket/25166 For now, either bulk remove the users in WP Admin or do something (ugly and temporary, remove when 3.6.1 is available) like: add_action( ‘wpmu_new_user’, function ( $user_id ) { global $current_site; remove_user_from_blog( $user_id, $current_site->blog_id ); // remove user from main blog. … Read more

How do I show errors after validation with a custom form frontend?

This is a pretty basic solution. First I am assuming that you are not saving the data/form, and just returning to the same page.. In your $formContent you would do something like this. <?php $formContent=” …. <tr> <th><label for=”email”>Förnamn*</label></th> <td><input name=”first_name” id=”first_name” value=”” class=”regular-text” . $class_errors[‘first_name’] . ‘” type=”text”>’ . ( array_key_exists( ‘first_name’, $class_errors ) … Read more

Send Notifications to All Admins

Is there a nice little filter that someone knows about where I can hook into notifications and send the notification to each / every administrator? There is : comment_post Runs just after a comment is saved in the database. Action function arguments: comment ID, approval status (“spam”, or 0/1 for disapproved/approved). http://codex.wordpress.org/Plugin_API/Action_Reference#Comment.2C_Ping.2C_and_Trackback_Actions And user_register which… … Read more

How To Get User Data in Callback Function for pre_user_nicename?

If anyone should be faced with this problem, check if you have defined a callback function to set the user_login on pre_user_login. This filter is applied inside the wp_insert_user()-function and produced a same username again. Therefore the nicename was changed by adding a “-2”. So, my problem was that I reset the user_logins again and … Read more

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