BuddyDev

Search

Replies

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #25534

    Thanks for taking care of this 🙂

    -Mic

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22893

    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

    • This reply was modified 3 years, 4 months ago by Mic.
    • This reply was modified 3 years, 4 months ago by Mic.
  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22794

    I totally understand and it does work well calling attention to the fact that it was reported.

    Adding this feature will be awesome! I’m looking forward to the next release.

    -Mic

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22674

    Thanks Brajesh,

    I have forwarded your message on to them. I have asked for a response, but I don’t know if they will respond or not. I will update this thread if they do.

    -Mic

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22672

    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

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22662

    Hey Brajesh,

    Thanks for the awesome support again! I have a support ticket in with the other developer asking them for a way to hook into their registration process. I will update this thread when I hear back from them.

    -Mic

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22644

    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

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22636

    Thank you for the quick response guys!

    I will go try that code and update this thread with my results.

    -Mic

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22131

    Awesome, it works like a charm!

    Thanks for knocking out all of these requests.

    -Mic

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22119

    Looking forward to the admin bar update!

    -Mic