• Hi, I’m using the simplemodal-login plugin, which is great, but I want to hide the “wp-admin” page from users. So after they have logged in, I want them to stay on the page they are on. How should I do it?

    Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Eric

    (@emartin24)

    Read the first question on the FAQ

    If that doesn’t help, let me know.

    Eric,

    I read the FAQ, located the function in general-template.php but I am unclear as to what text to change.

    What I see is:

    function wp_loginout($redirect = '', $echo = true) {
    	if ( ! is_user_logged_in() )
    		$link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
    	else
    		$link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
    
    	if ( $echo )
    		echo apply_filters('loginout', $link);
    	else
    		return apply_filters('loginout', $link);
    }

    Which looks very different from what you suggest I replace it with:
    <?php wp_loginout($_SERVER[‘REQUEST_URI’]); ?>

    Could you clarify please? Perhaps I am looking at the wrong file?
    Thank you.

    Plugin Author Eric

    (@emartin24)

    David,

    You shouldn’t be modifying the core WP files, but adding the wp_loginout function to your template files.

    For example, place <?php wp_loginout($_SERVER['REQUEST_URI']); ?> in your sidebar.php file. When you load your site, you should see a Login link wherever you place the code above.

    Let me know if that does not make sense.

    My sidebar.php has no functional code in it. Just a comment

    // Included sidebar.php since some plugins need this to work
    	// Column 2 uses get_sidebar() which will read in this file
    	// Move get_sidebar to the appropriate area in the templates as needed
    	// More information: https://codex.www.ads-software.com/Function_Reference/get_sidebar

    Anyway, I placed this code manually in a text widget:
    <a href="/wp-login.php?redirect_to=<?php echo $_SERVER['REQUEST_URI']; ?>" class="simplemodal-login">Log In</a>
    That works but was not what I was intending. That is, I didnt want the Login lonk to be in the sidebar as a widget. I wanted it in the upper right of the page in a small menu. I can create that link via the Menus > Custom Links of wordpress but as far as I can tell there is no way to include the redirect to portion of the code above.

    The url of the link is entered exactly as one would type an address and not as an

    Site I am working on is https://www.lightroomtampabay.com

    Logging in via the forum or any post achieves what I want -redirect back to the same spot but I had nothing to do with that behavior. I am trying to use your plugin to have a separate login area for members to see a private section of the site so if they click the Members link they will get to a page…

    As I write this Im thinking I should simply place the link on that page itself, freeing up the space on the widget, since the manual code works.

    EDIT:
    Just tried that and all hell broke loose. All the widget ads moved onto page content area in a non orderly fashion.

    Anyway. I have it “functioning” the way I want it now but if you know of a way to allow the same functionality of the current sidebar Log In text to be attached to the Small menu (upper right) instead, I would be interested.
    I would much prefer to keep LOG IN / LOG OUT out of the sidebars.
    Again, that small menu is part of the Menus section of Appearance. This themes allows three menus.

    Thanks

    managed to do this successfully.
    Now… can I do the same thing for the registration link?

    It would be really nice if the plugin offered configuration for login redirect. Requesting people to add code to their themes is really going to restrict the audience for this plugin. It’s really a nice plugin but could be more user friendly!

    Plugin Author Eric

    (@emartin24)

    @mahalie – thanks for your comments.

    The plugin follows all of the current WP conventions and a lot of people use other plugins to control where the user should be redirected to (Peter’s Login Redirect).

    In earlier version, I had the option to manually redirect or use whatever WP responded with, but that caused issues for some users. So, it’s a bit of a catch-22 from my perspective.

    I will keep your input in mind when I have the chance to work on future updates.

    My disclaimer … I am new to the forum posting and apologize if I do not use the correct protocol … please correct me where necessary.

    My intention is to share a solution I implemented to return to the same page upon Login error (it works) and get any feedback if anyone sees any issues, security or otherwise. I value all constructive feedback.

    I’ve struggled with this issue of having a special login page and then returning to that page if login fails, i.e., not going to the Admin Login page, which is distracting for the client’s purposes.

    So, I wanted to return to an custom error page with the same look, but with a Login Error message and a chance to Login again, or link to a form to email the issue to the client’s staff.

    I’ve implemented a solution that works, but does anyone see security issues? I would appreciate any feedback.

    Here is what I did:
    1. To redirect for Login Error: in the top level directory: Copied wp-login.php and renamed to my_wp-login.php. Left it in the same directory – I call this file later, below.
    (1) I modified the my_wp-login.php so that upon login error, the code does not enter into the HTML form, but instead redirects to my special login fail page. I put this redirect just before the form code and commented out the existing add_action code:

    if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
    <strong>wp_redirect( site_url('/index.php/members-login-fail/')); exit;</strong>/*add_action( 'login_head', 'wp_shake_js', 12 )*/
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    2. To link to my_wp-login.php, I copied the wp_login_form( $args = array ()),function file with rename to my_wp_login_form( $args = array ()):
    a. I included this function into my functions.php file located in my template folder. I then set all of the form parameters to suit my needs and also set the redirects appropiately as follows:

    a. Form action to call my_wp-login.php to process the login:

    <form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . <strong>site_url( 'my_wp-login.php', 'login' )</strong> . '" method="post">

    b. Submit redirect to my landing page for successful login:

    'redirect' => 'https://localhost/raywebdemo/index.php/members/support-services/vendors-list/','
    
    3.  I made a custom page template file and located it in my theme directory: page-login.php (assigned this template in my Member LogIn page).
          (1) In page-login.php, I set a function call to the modified login form file:

    <div class= “my-wp-login”>
    <?php my_wp_login_form(array()); ?>
    </div>`

    In summary, I call the modified wordpress login function that links to the modified wordpress login processing file that redirects to my error page (upon failed login) or to my landing page (upon successful login).

    In conclusion, it works great … but is it secure, etc.

    Any comments or feedback will be appreciated.

    Made some entry errors when I submitted last post. There is no “strong” tag in the code … this appeared when I tried to add “BOLD” to the post entry, and then wrapped it in CODE format. Didn’t understand how it would appear to the reader. Also, in 2.b. CODE box, there is some text that was intended to be the next paragraph,(para 3.). And finally, the code that follows was intended to be in a CODE box. Might get it right next time. Couldn’t find a way to edit the post, or I would have just fixed it.

    Hey guys, I have small problem – I tried to put <?php wp_loginout($_SERVER['REQUEST_URI']); ?>, then I tried <?php wp_loginout( $redirect, $echo ); ?>, then <?php wp_loginout(); ?> – and nothing helped me, my theme just redirects me to a blank page after I press the button Log out – I just can’t log out (in other themes anything is ok)… May be someone can tell me what is wrong (may be I have to put something in functions.php or may be I have to create loop.php (I didn’t create it) or something else…)?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Plugin: SimpleModal Login] How to get rid of the "wp-admin" page after user login?’ is closed to new replies.