Can user_register output the password?
There’s an action hook in /wp-admin/includes/user.php to check if both password fields match: add_action( ‘check_passwords’, function( $user, $pass1, $pass2 ) { var_dump($pass1); die(); }, 10, 3 );
There’s an action hook in /wp-admin/includes/user.php to check if both password fields match: add_action( ‘check_passwords’, function( $user, $pass1, $pass2 ) { var_dump($pass1); die(); }, 10, 3 );
Use a hook that fires later and add the $bp global to the function. Try this: function bp_password_beefing() { global $bp; if ( !empty( $_POST[‘signup_password’] ) ) if ( strlen( $_POST[‘signup_password’] ) < 6 ) $bp->signup->errors[‘signup_password’] = __( ‘Your password needs to be at least 6 characters’, ‘buddypress’ ); } add_action( ‘bp_signup_validate’, ‘bp_password_beefing’);
got a working solution, but wordpress first validate the username or email address then my validation takes place.. I have used allow_password_reset filter instead of lostpassword_post action: add_filter( ‘allow_password_reset’, ‘my_password_reset_helper’ ); function my_password_reset_helper($true) { if (isset($_POST[‘g-recaptcha-response’])) { $array = array(‘response’ => $_POST[‘g-recaptcha-response’], ‘userip’ => $_SERVER[‘REMOTE_ADDR’], ‘secret’ => ‘asddfer345gfdg4veg45y34635345’); $result = gcaptcha($array); if (!$result) { return … Read more
The hook you’re looking for is insert_user_meta. add_filter( ‘insert_user_meta’, function( $meta, $user, $update ) { if( true !== $update ) return $meta; $old_meta = get_user_meta( $user->ID ); if( $old_meta[ ‘first_name’ ] !== $meta[ ‘first_name’ ] ) { //* Do something } return $meta; }, 10, 3 );
The problem with your code is pretty simple. You don’t terminate the script execution after doing redirect. So the header will be set, but browser will ignore it. If you’ll take a look at WP Code Reference, there is clearly stated: Note: wp_redirect() does not exit automatically, and should almost always be followed by a … Read more
If I understand you correctly, you want all attachment status set to ‘publish’ on upload in stead of ‘inherit’ to prevent that status changing when the parent post status changes. Let’s take a look at wp_insert_post if it offers any possibilities. First on line 3483 (current version) the post status is set to ‘inherit’ in … Read more
So it looks like there is some page redirecting going on in the post updating process, hence why I can’t even access a $GLOBALS variable. The only alternative I found to use was to use a session variable. Something like: add_filter( ‘pre_insert_term’, ‘pre_insert_term_action’, 10, 2 ); add_action( ‘admin_notices’, ‘show_example_error’ ); function pre_insert_term_action( $term, $taxonomy ) … Read more
If you want to return the data, the best solution is to use apply_filters() and instruct the callback to always return: $output = apply_filters( ‘hook_data_handle_’.$args[‘UID’], $args, $options ); if ( $args[‘echo’] ) echo $output; else return $output; A less elegant solution would be to use output buffering.
You should be able to get the ID of the post through the $_POST variable. EDIT: Maybe you should try doing this on the save_post action, like so, but save_post sometimes runs on other instances (ie. Autosave Drafts), so you’ll want to do some more verifying. save_post will also return the ID as one of … Read more
There are few other hooks to manipulated the trashed comment. ‘save_post’: called after post is saved. You can check status of the post and manipulate its comment accordingly. ‘trashed_comment’: called after comment is moved to trash status. ‘transition_comment_status’: called whenever comment status is changed. There are probably few others too. But, it depends what you … Read more