Replies
Hey,
They responded with:
Sorry, but we cannot add the hook yet, dev team is evaluating a different way to do it. integrated with WP functions
I appreciate your help, but I am going to mark this as resolved.
-Mic
Hey Brajesh,
Their reply was:
“Ask your developer what kind of hook he needs and we can consider to include it. The registration function is inside this file https://pastebin.com/7QKRMRxg (link added by me) and looks like this…”
function register_user($output) { if (!check_ajax_referer('quadmenu', 'nonce', false)) { QuadMenu::send_json_error(esc_html__('Please reload page.', 'quadmenu')); } $username = sanitize_user($_POST['user']); $email = sanitize_email($_POST['mail']); $password = $_POST['pass']; if (empty($username)) { QuadMenu::send_json_error(sprintf('<div class="quadmenu-alert alert-danger">%s</div>', esc_html__('Please provide an username.', 'quadmenu'))); } if (empty($email) || !is_email($email)) { QuadMenu::send_json_error(sprintf('<div class="quadmenu-alert alert-danger">%s</div>', esc_html__('Please provide a valid email address.', 'quadmenu'))); } if (empty($password)) { QuadMenu::send_json_error(sprintf('<div class="quadmenu-alert alert-danger">%s</div>', esc_html__('Please provide a password.', 'quadmenu'))); } $userdata = array( 'user_login' => $username, 'user_pass' => $password, 'user_email' => $email, ); $user_id = wp_insert_user($userdata); if (!is_wp_error($user_id)) { $user = get_user_by('id', $user_id); if ($user) { wp_set_current_user($user_id, $user->user_login); wp_set_auth_cookie($user_id); do_action('wp_login', $user->user_login); } QuadMenu::send_json_success(sprintf('<div class="quadmenu-alert alert-success">%s</div>', esc_html__('Welcome! Your user have been created.', 'quadmenu'))); } else { QuadMenu::send_json_error(sprintf('<div class="quadmenu-alert alert-danger">%s</div>', $user_id->get_error_message())); } wp_die(); }
This request seems to be getting quite specific. I don’t know how many other people are using QuadMenu, so it might not be worth investing in. If you happen to know what kind of hook you would need I will pass it along to that developer.
Thanks for your willingness to take a look!
-Mic
Thanks for the help. The filter “bp_core_default_avatar_user” led me to additional resources that stated you have to disable Gravatar for that filter to activate.
My final code looks like this:
/* RANDOM MYSTERY MAN ================================================== */ // Random Mystery Man avatar for everyone who doesn't have an avatar assigned. - Mic add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' ); function avatar_photo_random_default() { //pick random number $random_num = rand( 1, 424 ); //currently we have 424 images. $random_num = apply_filters( "avatar_photo_random_num", $random_num ); //pick the random image $dir_avatar = get_stylesheet_directory_uri(); $filename = $dir_avatar."/images/avatars/".$random_num.".png"; $filename = apply_filters( "avatar_photo_default_pick_filename", $filename ); return $filename; } add_filter( "bp_core_default_avatar_user", "avatar_photo_random_default", 10, 2);
Now I am able to have random avatars and moderate them when a user chooses to upload a new one!
-Mic