AJO Membership Settings


Available Shortcodes

Use these shortcodes on your pages to display forms to your users:

Enter the links you want to protect from non-registered users, and where they should be sent instead.

'; } public function protected_urls_callback() { $urls = get_option( 'ajome_protected_urls', '' ); echo ''; echo '

Enter one URL or path per line. Both relative paths (e.g. /my-page/) and full URLs are supported. Child pages of these paths will also be protected.

'; } public function redirect_url_callback() { $url = get_option( 'ajome_redirect_url', '' ); echo ''; echo '

Where should non-registered users be sent? (Leave blank to use the default WordPress login page).

'; } /** * Shortcode: Login Form */ public function login_shortcode() { if ( is_user_logged_in() ) { return '

You are already logged in.

'; } return wp_login_form( array( 'echo' => false ) ); } /** * Shortcode: Registration Form (Uses core WP processing) */ public function register_shortcode() { if ( is_user_logged_in() ) { return '

You are already registered and logged in.

'; } // Ensures the form sends data to WordPress's native registration handler $register_url = esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ob_start(); ?>



Registration confirmation and password setup will be emailed to you.

You are already logged in.

'; } // Ensures the form sends data to WordPress's native lost password handler $reset_url = esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ob_start(); ?>


You must be logged in to edit your profile.

'; } $current_user = wp_get_current_user(); $message = ''; // Check if the form was submitted if ( isset( $_POST['ajome_profile_submit'] ) ) { // VERIFY SECURITY NONCE EXACTLY AS REQUESTED BY WORDPRESS if ( ! isset( $_POST['ajome_profile_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['ajome_profile_nonce'] ) ), 'ajome_update_profile_action' ) ) { $message = '

Security check failed. Please refresh and try again.

'; } else { // Sanitize user inputs $email = sanitize_email( wp_unslash( $_POST['ajome_email'] ) ); $first_name = sanitize_text_field( wp_unslash( $_POST['ajome_first_name'] ) ); $last_name = sanitize_text_field( wp_unslash( $_POST['ajome_last_name'] ) ); // Validate email if ( ! is_email( $email ) ) { $message = '

Please enter a valid email address.

'; } elseif ( email_exists( $email ) && email_exists( $email ) !== $current_user->ID ) { $message = '

That email is already registered to another account.

'; } else { // Prepare data for WordPress update function $userdata = array( 'ID' => $current_user->ID, 'user_email' => $email, 'first_name' => $first_name, 'last_name' => $last_name, ); // Handle password update if fields are not empty if ( ! empty( $_POST['ajome_pass1'] ) || ! empty( $_POST['ajome_pass2'] ) ) { if ( $_POST['ajome_pass1'] === $_POST['ajome_pass2'] ) { $userdata['user_pass'] = $_POST['ajome_pass1']; } else { $message = '

The passwords you entered do not match.

'; } } // If there are no errors, update the user if ( empty( $message ) ) { $user_id = wp_update_user( $userdata ); if ( is_wp_error( $user_id ) ) { $message = '

' . esc_html( $user_id->get_error_message() ) . '

'; } else { $message = '

Profile updated successfully.

'; // Refresh user data so the form shows the new data $current_user = wp_get_current_user(); } } } } } // Output the frontend form ob_start(); ?>





Change Password

Leave blank if you do not want to change your password.