How to reload the role specific registration form on validation errors?

You can either user session or cookies to setup the user for the desired role e.g: /** * register_roles_with_cookies */ class register_roles_with_cookies { function __construct($args = array()){ //create a hidden field for role and extra fields needed add_action(‘register_form’,array($this,’add_hidden_role_field’)); //validate add_action(‘register_post’,array($this,’my_user_fields_validation’),10,3); //save the role add_action(‘user_register’, array($this,’update_role’)); } public function setCookie($name,$val,$time = false){ if(false === $time) $time … Read more

How to make custom comment fields required and message field not required

Here is a related question that should answer yours. Basicly you want to use the pre_comment_on_post hook function custom_validate_comment() { //validate for brief and rating if( empty( $_POST[‘brief’]) || empty( $_POST[‘rating’]) ) wp_die( __(‘Error: you must fill in both the rating and the brief’) ); //make comment not required if(empy($_POST[‘comment’]){$_POST[‘comment’] == “empty_comment”;} } add_action(‘pre_comment_on_post’, ‘custom_validate_comment’); … Read more

Validation Function for URL in plugin

I would look into PHP’s parse_url() and/or filter_var() with FILTER_VALIDATE_URL filter. parse_url() gives you a bit more control. Combine that with a sanitization as mentioned at the end. Here are couple use cases that will hopefully give you a better idea on how to proceed: If you want to verify that the url’s domain is … Read more

stray elements

Remove the filter from the the_content and run it after the shortcode are processed. Try: remove_filter( ‘the_content’, ‘wpautop’ ); add_filter( ‘the_content’, ‘wpautop’ , 12); Usually shortcodes are processed after wpautop is applied to the content. See http://core.trac.wordpress.org/browser/tags/3.1/wp-includes/shortcodes.php#L296

Get the user type of an author

One way would be to use the get_the_author_meta function and pass it user_level More info on the function: http://codex.wordpress.org/Function_Reference/get_the_author_meta Then, see this chart to convert user levels to roles (unless you have created custom roles): http://codex.wordpress.org/Roles_and_Capabilities#User_Level_to_Role_Conversion Example code $level = get_the_author_meta(‘user_level’); if($level >= 8) { // Is admin // do something } else if ($level … Read more

Validating a new user registration field

After examining the code and much trial and error, I have a solution: There is a filter – user_profile_update_errors – that is called in the file wp-admin/includes/user.php just after WordPress does it’s own input validation. This filter allows plugins to return their own errors by adding them to a referenced WP_Error class. If any errors … Read more

WordPress oEmbed W3C Validation

The class-oembed.php file reveals some of the available filters regarding the oEmbeds. We can use the oembed_result or oembed_dataparse filters to modify the HTML fetched from Vimeo before it’s cached in the post meta. Here’s an example for the latter: add_filter( ‘oembed_dataparse’, function( $return, $data, $url ) { // Target only Vimeo: if( is_object( $data … Read more

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