How to create login function
- 
		Hi! I am using the Avada theme with BuddyPress and it doesn’t have a login button or anything I can put in the header or menu. 
 Instead I have found a solution to redirect logged-in users to their profile, and if a user is not logged in he gets redirected to the registration page.
 But how about a login function – how do I create that? Users can’t really go to their profile if they are not logged in, and if they already have a user then it’s just stupid to get them to register. Can you please help me add the right functions? Thanks a lot 🙂At the moment I have this in my functions.php file: function redirect2profile(){ 
 include_once( ABSPATH . ‘wp-admin/includes/plugin.php’ );
 if($_SERVER[‘REQUEST_URI’] == ‘/profil/’ && is_plugin_active(‘buddypress/bp-loader.php’) && is_user_logged_in()){
 global $current_user;
 wp_redirect( get_bloginfo(‘url’) . ‘/medlemmer/’. $current_user->user_login . ‘/profile/’);
 exit();
 } else {
 if ($_SERVER[‘REQUEST_URI’] == ‘/profil/’ && is_plugin_active(‘buddypress/bp-loader.php’) && !is_user_logged_in()) {
 wp_redirect( get_bloginfo(‘url’) . ‘/register/’);
 exit();
 }}
 }
 add_action(‘init’, ‘redirect2profile’);
- The topic ‘How to create login function’ is closed to new replies.