xxaimsxx
Forum Replies Created
-
@andrewshu The registration form does not allow a user to make a username. I also found a code where I can set it to be the email address when I did more googling.
/** * Use email address as username for new user registration * 02.02.2024 */ add_action("um_submit_form_register","um_092321_email_address_validation"); function um_092321_email_address_validation( $post_form ){ if( isset( $post_form['user_email'] ) && ! empty( $post_form['user_email'] ) ){ if( username_exists( $post_form['user_email'] ) ) { UM()->form()->add_error('user_email', __( 'Email address already registered as username', 'ultimate-member' ) ); } } } add_action("um_user_register","um_092321_after_register_complete", -1, 2 ); function um_092321_after_register_complete( $user_id, $args ){ global $wpdb; $wpdb->update( $wpdb->users, array('user_login' => $args['user_email'] ), array('ID' => $user_id)); }
But what can I do for existing users? Do you know if there is a code to set existing user’s username as email?
Forum: Plugins
In reply to: [WPS Hide Login] Login page not displaying header and footer@seinomedia, that didn’t work unfortunately =(.
To clarify, the include of the header and footer.php worked but the code within those file that is pulling the Elementor header/footer is not working once the WPS Hide Login is activated.
if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'footer' ) ) { if ( did_action( 'elementor/loaded' ) && hello_header_footer_experiment_active() ) { get_template_part( 'template-parts/dynamic-footer' ); } else { get_template_part( 'template-parts/footer' ); } }
Forum: Plugins
In reply to: [WPS Hide Login] Login page not displaying header and footer@seinomedia inside the functions.php, I used this action hook for the header and footer. It worked fine on wp-login.php but not after the plugin is activated. Do I need to use a diff action hook?
add_action( 'login_header', 'login_custom_header' ); function login_custom_header() { include 'header.php'; }
add_action( 'login_footer', 'login_custom_footer' ); function login_custom_footer() { include 'footer.php';?> }
Hi @andrewshu
I deleted it but when I go to the website, it keeps redirecting to a page not found.
When looking at the setting, the Login page is now set to Home. Would I still need to use the redirect code to have it go back to wp-login.php?
I have this commented out at the moment but it’s not pushing to the default wp-login.php
// /* redirect all pages to custom login if user is logged out */ add_action('template_redirect', function() { if ( !is_user_logged_in() ) { if ( !is_page('login') && !is_page('register') && !is_page('password-reset') && !is_page('email-activated') && !is_page('ext-contacts-faqs') ) { wp_redirect( home_url('login') ); exit; } } }); /* redirect default login page to custom login */ function redirect_login() { if ( basename($_SERVER['REQUEST_URI']) == 'wp-login.php' && $_SERVER['REQUEST_METHOD'] == 'GET' ) { wp_redirect( home_url('login') ); exit; } } add_action('init', 'redirect_login');
Thank you for this. I did whitelist our VPN IP address “just in case”.
When I looked further into the issue of why she was having issues, it showed the reason as “wrong username” but she’s always used that username to login. So I’m at a lost there.
Typically you can login with the set username or the email address and she’s always used her email address. Would you have any idea?
Amy
@jkleinithemes great, thank you!
I ended up finding this post which helped https://isotropic.co/how-to-set-wordpress-user-role-based-on-email-domain/
- This reply was modified 1 year, 11 months ago by xxaimsxx.
@ozyeger Yes, we have Elementor pro. I’m new to using Elementor so not sure how the Popup works. If it’s cookie based, etc.
@ozyeger the pop up is not available to view unless you are a client and logged in. Right now it only loads after the user has logged in and came in from a specific URL.
So does that mean I would have to manually do that every single time a user registers and doesn’t fill in either of those 2 fields?
@missveronicatv that worked nicely but 1 thing I did notice was that if I had 20 users and only 5 of them had the UM data in the columns, when I sort, the rest would disappear. Is that normal function or is there a way to make it so I can still see the rest of the users but with just the – since there is no data?
@missveronicatv thank you for this! This helped a lot. How do I go about sorting those 2 columns? I thought I got it to work but it’s not sorting correctly.
user_organization and user_role are the um columns added.
add_filter( 'manage_users_sortable_columns', 'sortable_columns' ); function sortable_columns( $columns ) { return wp_parse_args ( array ( 'user_organization' => 'user_organization', 'user_role' => 'user_role', 'role' => 'role', 'user_company' => 'user_company', 'registration_date' => 'registered', 'account_status' => 'account_status', ), $columns ); }
@missveronicatv thank you so much for this.
I am not very good with the hooks just yet, am learning. Am I safe to assume that all I need is lines 10-60? First function creates the column with names and the 2nd function is getting the data?
@missveronicatv Thank you for getting back to me.
In the UM registration form, I have 2 fields in there named “Organization” and “Role” aside from the typical info like Name, Email, etc.
I’d like to pull those 2 data over and add them to a column in the Users admin page.
I am using manage_users_columns WP hook to add these 2 columns but I do not know how to add the data from the registration form fields.
- This reply was modified 2 years ago by xxaimsxx.
@aswingiri Thank you.
So if I wanted the ACF relationship field to be populated once they register but before they complete registration (like confirm email, etc), would I use the default priority of 10,2?
Sorry if I’m asking a stupid question, I’m quite new to using hooks/functions.