WPFront
  • Home
  • Plugins
    • Notification Bar Plugin
      • Plugin Ideas
      • Plugin Settings
      • Plugin FAQ
    • Scroll Top Plugin
      • Plugin Settings
      • Plugin FAQ
    • User Role Editor Plugin
      • Plugin Documentation
      • Plugin Settings
      • Plugin FAQ
    • Paddle Gateway Plugin
  • Go Pro
  • Support
    • Documentation
    • FAQ
  • Affiliates
  • Contact
  • Login
  • Cart

Tagged: login, redirect

  • This topic has 27 replies, 2 voices, and was last updated 9 years, 8 months ago by Syam Mohan.
Viewing 15 posts - 1 through 15 (of 28 total)
1 2 →
  • Author
    Posts
  • August 6, 2015 at 9:33 am #13954
    Bratt
    Participant

    Hi!

    Thanks for a wonderful plug-in that makes my page so much easier to handle!

    I wonder if it’s possible to auto redirect to the role’s login redirect url, when landing on the startpage, otherwise redirect to wordpress login page.

    I have a startpage that use a custom template called page-login.php.

    August 6, 2015 at 6:24 pm #13981
    Syam Mohan
    Keymaster

    Hi Bratt,

    Not possible using the plugin right now. But I could give you some code to add to your page template if you are comfortable with it.

    Thanks

    Syam

    August 7, 2015 at 3:28 am #14008
    Bratt
    Participant

    Wow great, absolutly! 🙂

    August 7, 2015 at 9:02 am #14028
    Syam Mohan
    Keymaster

    if(is_user_logged_in())
    wp_redirect(apply_filters(‘login_redirect’, ‘/’));
    else
    wp_redirect(‘/wp-login.php’);

    I did not test the code, just wrote it here. Let me know if it doesn’t work.

    Thanks

    Syam

    August 7, 2015 at 5:07 pm #14048
    Bratt
    Participant

    It didn’t work 100%, it works as long as your not logged in, but if logged in it will not redirect to “login redirect” url. =(

    Any spontaneous ides ?, really appreciate the help =)

    August 7, 2015 at 5:40 pm #14054
    Syam Mohan
    Keymaster

    When is this code executing?

    August 9, 2015 at 1:34 am #14087
    Bratt
    Participant
    <?php if(is_user_logged_in())
    wp_redirect(apply_filters(‘login_redirect’, ‘/’));
    else
    wp_redirect(‘/wp-login.php’); ?>
    
    <?php
                                
    get_header();  ?>
    	<div id="primary" class="row-fluid">
    		<div id="content" role="main" class="span8 offset2">
    
    			<?php if ( have_posts() ) : ?>
    				<?php while ( have_posts() ) : the_post(); ?>
                    
    					<article class="post">
    						  
                             <h1 class="title"><img class="img-responsive aligncenter title" alt="DSV" src="http://xxxxxxxx.xxx/xxx_b.png"><?php the_title();  ?></h1>
    						                          
    						<div class="the-content">
                                	
    							<?php the_content(); 
    							
    							?>
    							<?php wp_link_pages(); ?>
                            </div><!-- the-content -->
    					</article>
    
    				<?php endwhile; ?>
    
    			<?php else : ?>
    				
    				<article class="post error">
    					<h1 class="404">Här var det tomt.</h1>
    				</article>
    
    			<?php endif;  ?>
    
    		</div><!-- #content .site-content -->
    	</div><!-- #primary .content-area -->
    <?php get_footer();  ?>
    August 9, 2015 at 1:00 pm #14096
    Syam Mohan
    Keymaster

    The code I sent you can only be executed after the plugins have been loaded. Otherwise it won’t work, since the login redirect settings comes from a plugin. Can you try to execute it in the ‘plugins_loaded’ action?

    Thanks

    August 9, 2015 at 2:20 pm #14103
    Bratt
    Participant

    Sorry, i didn’t think i got this. 🙁

    I tried to add this instead but didn’t work at all.

    
    <?php
    add_action( 'plugins_loaded', 'my_plugin_override' );
    
    function my_plugin_override() {
    if(is_user_logged_in())
    wp_redirect(apply_filters(‘login_redirect’, ‘/’));
    else
    wp_redirect(‘/wp-login.php’);
    }
    ?>
    
    August 9, 2015 at 8:44 pm #14122
    Syam Mohan
    Keymaster

    Is it possible for you to give me access to your site?

    Thanks

    August 9, 2015 at 11:46 pm #14131
    Bratt
    Participant
    This reply has been marked as private.
    August 10, 2015 at 8:40 am #14150
    Syam Mohan
    Keymaster

    Can you also send me the location of your template file and the url/page I need to access to test it?

    Thanks

    August 10, 2015 at 10:37 am #14153
    Bratt
    Participant
    This reply has been marked as private.
    August 10, 2015 at 6:30 pm #14175
    Syam Mohan
    Keymaster

    Hi Bratt,

    I was able to connect successfully. But the changes I make within the PHP code takes lot of time to reflect on the web page. Either you have a caching plugin or your PHP opcache re-validation frequency is low. I didn’t try with deactivating the plugins, if in case this is a live site.

    Thanks

    syam

    August 11, 2015 at 12:25 am #14188
    Bratt
    Participant

    I deactivated Wordfence, should be the only plugin that should have some with the cache to do. I will try it as soon as i can 🙂

    So glad you are helping me with this!

  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 28 total)
1 2 →
  • The topic ‘If logged in redirect to Login Redirect url?’ is closed to new replies.
Log In
Lost Password

Search Topics

Documentation

FAQ
Roles List Add Role Edit Role Delete Role Restore Role Add or Remove Capability Assign/Migrate Users Posts/Pages Extended Permissions Custom Post Type Permissions Navigation Menu Permissions Widget Permissions Admin Menu Editor Media/Attachment File Permissions User Level Permissions Content Restriction Shortcodes Login Redirect Export Roles Import Roles Bulk Edit Settings Multisite Roles List Multisite Add New Role Multisite Edit Role Multisite Delete Role Multisite Restore Role Multisite Sync Roles Multisite Settings WordPress Capabilities Actions and Filters Installation Instructions