BuddyDev

Search

Ajax registration – form has gone whacky

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #14330

    Thank you Diana.

    I am sorry for the delayed reply.

    Please put this in your child theme

    
    /**
     * Load on login page.
     */
    function buddydev_login_load_ajaxr_styles() {
    	wp_enqueue_style( 'bp-custom-ajaxr', get_stylesheet_directory_uri() . '/bp-ajax-register.css' );
    }
    
    add_action( 'login_enqueue_scripts', 'buddydev_login_load_ajaxr_styles' );
    
    

    That will load the styles from your child theme on the wp-login.php page too and should fix the form.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 32
    Diana on #14343

    Hi Brajesh,

    It’s getting close. Some of the form labels have disappeared, but happily the “x” to close the modal window has reappeared. I’m also getting a form box within a form box.

    Thank you very much for your support.

    I’d be happy to grant you temporary admin access. Just pm me and I’ll send a link.

    Also, could you explain a little about loading on the wp-login.php page. As you can see I already was loading css for the registration form — but maybe in the wrong order? I try to learn as much as I can when things don’t go right.

    The start of the functions.php file now reads:

    
    <?php
    
    /* functions.php for IHC Theme - a child of customizr */
    
    /*  Enqueue parent & child theme stylesheets for proper cascading */
    add_action( 'wp_enqueue_scripts', 'my_assets' );
    function my_assets() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css' );
        wp_enqueue_style( 'calendar-style', get_stylesheet_directory_uri() . '/simcal.css' );
        wp_enqueue_style( 'Spreadsheet-style', get_stylesheet_directory_uri() . '/mbr-roster.css' );
        wp_enqueue_style( 'caldera-forms-style', get_stylesheet_directory_uri() . '/caldera.css' );
        wp_enqueue_style( 'weather-widget-style', get_stylesheet_directory_uri() . '/wunderground.css' );
        wp_enqueue_style( 'bp-register-style', get_stylesheet_directory_uri() . '/bp-ajax-register.css' );
    
    //    wp_enqueue_script( 'myscripts', get_stylesheet_directory_uri() . '/scripts.js', array('jquery'), '1.0.0', true );
        /*  Modify ServiceBox plugin so that links open in same window.       */
        /*  https://wordpress.org/support/topic/link-opening-in-a-new-tab-2/  */
        wp_enqueue_script( 'custom-functions', get_stylesheet_directory_uri() . '/js/custom.js', array('jquery') );
     add_action( 'login_enqueue_scripts', 'custom_login_placeholders', 10 );
    function custom_login_placeholders() {
        wp_enqueue_script( 'customlogin.js', get_template_directory_uri() . '/js/customlogin.js', array( 'jquery' ), 1.0 );
    }
    }    /*  Done most of the enqueuing  */
    
    /**
     * Load on login page.
     */
    function buddydev_login_load_ajaxr_styles() {
    	wp_enqueue_style( 'bp-custom-ajaxr', get_stylesheet_directory_uri() . '/bp-ajax-register.css' );
    }
    add_action( 'login_enqueue_scripts', 'buddydev_login_load_ajaxr_styles' );
    
    /*  Remove the login labels, we'll use placeholders  */
    function empty_login_labels() {
            add_filter( 'gettext', 'username_change', 20, 3 );
            function username_change( $translated_text, $text, $domain )
            {
                if (preg_match("/Username|Password/", $text)) {
                    $translated_text = '';
                }
                return $translated_text;
            }
        }
    add_action( 'login_head', 'empty_login_labels' );
    
    /**
     * Filter the WP Users List Table views to override 'bp-signups' with 'new-user-approve-admin'.
     *
     *
     * @param array $views WP List Table views.
     * @return array The views with the signup view replaced with 'new-user-approve-admin' link.
     * @author lenasterg
     */
    function ls_change_signup_filter_view_to_new_user_approve_admin($views = array()) {
        global $role;
        /**
         * Detect plugin. For use in Admin area only.
         */
        if (is_plugin_active('new-user-approve/new-user-approve.php')) {
            remove_filter("views_users", array('BP_Members_Admin', 'signup_filter_view'));
            // Remove the 'current' class from All if we're on the signups view.
            if ('registered' === $role) {
                $views['all'] = str_replace('class="current"', '', $views['all']);
                $class = 'current';
            } else {
                $class = '';
            }
    
            $user_status = pw_new_user_approve()->get_user_statuses();
            $users = $user_status['pending'];
            $signups = count($users);
    
            if (is_network_admin()) {
                $base_url = network_admin_url('users.php');
            } else {
                $base_url = bp_get_admin_url('users.php');
            }
    
            $url = add_query_arg('page', 'new-user-approve-admin', $base_url);
            $text = sprintf(_x('Pending %s', 'signup users', 'buddypress'), '<span class="count">(' . number_format_i18n($signups) . ')</span>');
    
            $views['registered'] = sprintf('<a href="%1$s" class="%2$s">%3$s</a>', esc_url($url), $class, $text);
        }
        return $views;
    }
    
    add_filter('views_users', 'ls_change_signup_filter_view_to_new_user_approve_admin', 12);
    
  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #14398

    Hi Diana,
    Please do grant me temporary admin access and I will update the css.

    About loading css/js on the login page. The scripts loaded on the hook ‘wp_enqueue_Scripts’ will not be loaded.

    In order to load css/js on the login page, we need to hook to ‘login_enqueue_scripts’ action.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 32
    Diana on #14400

    Hi Brajesh,

    Please send me a private message with an email address to which I can send a link that will activate temporary admin access for you.

    Also, thank you for the explanation about ‘login_enqueue_scripts’. My lack of knowledge about various WordPress hooks is a big stumbling block.

    Take care,
    Diana

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #14401
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #14581

    Marking it resolved as the discussion is there on email. Please flee free to reopen in future.

    Ragrds
    Brajesh

The topic ‘Ajax registration – form has gone whacky’ is closed to new replies.

This topic is: not resolved