Forum Replies Created

Viewing 15 replies - 76 through 90 (of 208 total)
  • Plugin Author Cole Geissinger

    (@brainfestation)

    Hi jogee, something within your theme is ‘causing the plugin to not fully run.

    When you login, the plugin hooks into WordPress’ native login function, and watching the connections, something is stopping it from returning the Ajax request and then is redirected to the login screen. Try deactivating your plugins and see that stops the issue.

    I see you have secure hidden login enabled, I don’t have any experience with this plugin, but this one sticks out to me.

    Plugin Author Cole Geissinger

    (@brainfestation)

    Hey picnmix, I’ve been tied up with WordCamp San Francisco and haven’t had time yet. Sorry for the delay! Should have time in the next few days.

    Plugin Author Cole Geissinger

    (@brainfestation)

    interesting. I’ll test this out and see what’s going on. It was working before 🙂

    Plugin Author Cole Geissinger

    (@brainfestation)

    I’ll need more details to properly troubleshoot. What themes is it not working on? Have you tried deactivating all plugins but this one? Do you have a public site for me to look at? If you have a custom theme or a third party that its not working with this, your theme may be lacking some common WordPress requirements.

    Plugin Author Cole Geissinger

    (@brainfestation)

    Hi Jogee, I’m unable to reproduce this? Do you have this available publicly so I can see it first hand?

    Plugin Author Cole Geissinger

    (@brainfestation)

    Its only hacky because we use two redirects instead of one. This shouldn’t have any downsides just its not the preferred method.

    I’ll try to remember to list the update here. This new solution will be version 2.1. You can just watch out for that version in the future.

    Plugin Author Cole Geissinger

    (@brainfestation)

    The register link will only show as long as you have enabled registration in Settings > General.

    Also, make sure you update to the latest version as that fixes the issue of users being able to register when its disabled.

    Plugin Author Cole Geissinger

    (@brainfestation)

    So this is more complicated than how this plugin is built. Something I’m now realizing will require some restructuring to effectively make this happen. Here’s what I have been able to uncover and possibly WPMU Dev can uncover some angles I’m missing.

    Over all, the issue is the redirect is set via javascript, and the proper redirect to the user profile won’t be available until AFTER login occurs. So using the filter I created is set too early (on page load). Here’s a snippet I put together that works… but only behind the scenes and not as we want it to.

    function my_awesome_redirect( $redirect ) {
    	$user = get_user_by( 'login', sanitize_text_field( $_REQUEST['username'] ) );
    
       wp_redirect( bp_core_get_user_domain( absint( $user->ID ) ) );
    }
    add_action('wp_login', 'my_awesome_redirect', 10, 2);

    Here’s a break down. We create a function to run when the wp_signon() function is used (this is the function used for user login stuff). This is a hook created by WordPress and is reused in the WP Modal Login plugin. Inside that function we will get the username entered into the form so we can return the logged in users ID. In turn we use that ID with BuddyPress’ bp_core_get_user_domain() function which will return the proper URL for us to redirect to. We then use wp_redirect() to try and redirect the page.

    This works.. but not visibly. If we open Chrome Dev tools in Google Chrome, and open the Network tab, when we hit the login button, the ajax call executes and then a redirect happens, however, in the front end all it says is “Checking credentials…” and no redirect as if it is broken. Here’s a screenshot. The bottom two results is the ajax call and then the last is the redirect to /members/admin/ http://cl.ly/image/1R061a042h39

    I know this doesn’t answer your question though.. and sadly, I don’t have a clear one but that your needs are a little beyond this plugin at the moment without some tweaking to the code.

    Here’s a hack that should work though. Since the issue is we need to dynamically get a URL that isn’t possible without being logged in, we can setup a little hack to get that info after login then perform a second redirect.

    Use this code to point to the members page of buddypress.

    function trg12345_custom_login_redirect( $redirect ) {
    
    	// Set up a static URL for a secondary redirect
       $redirect = esc_url( home_url( '/members?wpml_login=true' ) );
    
       return $redirect;
    }
    add_filter( 'wpml_redirect_to', 'trg12345_custom_login_redirect' );

    What we are doing is redirecting to a non-dynamic page and appending a “query string” to the end of the URL. We can then create a second function that will listen for this exact URL and then run one more redirect to the right user profile page. This should only run right after the user logs in. Place this second function after the function above in your functions.php (FYI, these can be added anywhere in that file).

    function trg12345_finial_redirect() {
    	if ( isset( $_GET['wpml_login'] ) && ! is_admin() ) {
    		// Get the current user ID
    		$user = get_user_by( 'id', get_current_user_id() );
    
    		// Redirect our to our user profile
    	   echo '<script>window.location = "' . bp_core_get_user_domain( absint( $user->ID ) ) . '";</script>';
    	}
    }
    add_action( 'wp_head', 'trg12345_finial_redirect' );

    This last function will listen for the wpml_login query variable and that we are not in the admin area of WordPress. We’ll then get the current logged in users ID and send that to the BuddyPress user domain fnction. We’ll also make sure everything is sanitized to make sure everything is secure too.

    It’s a little hacky, but your users shouldn’t see much of a difference? Maybe a little flicker. Here’s the full script, just copy all of this and paste it into the bottom of your functions.php and it should just work… if your members page lives under a different URL than ‘members’, make sure you update that part of the script. I couldn’t find the BuddyPress function that would spit that out for us dynamically.

    /**
     * Setup a redirect to the main members page with a query string for us to hook onto when logged in
     * @param  string $redirect The URL to redirect to after logging in
     * @return array
     */
    function trg12345_custom_login_redirect( $redirect ) {
    
    	// Set up a static URL for a secondary redirect
       $redirect = esc_url( home_url( '/members?wpml_login=true' ) );
    
       return $redirect;
    }
    add_filter( 'wpml_redirect_to', 'trg12345_custom_login_redirect' );
    
    /**
     * The final redirect which will take us directly to the user profile.
     * This is done via JavaScript.
     * @return string
     */
    function trg12345_finial_redirect() {
    	if ( isset( $_GET['wpml_login'] ) && ! is_admin() ) {
    		// Get the current user ID
    		$user = get_user_by( 'id', get_current_user_id() );
    
    		// Redirect our to our user profile
    	   echo '<script>window.location = "' . bp_core_get_user_domain( absint( $user->ID ) ) . '";</script>';
    	}
    }
    add_action( 'wp_head', 'trg12345_finial_redirect' );
    Plugin Author Cole Geissinger

    (@brainfestation)

    The next major version is packed with more options like this and better support for custom login/user profile plugins like buddypress and some others.

    There will also be more options via the admin area for users to customize the text, redirects and other stuff. Just need to find the time to build all of this out 🙂

    Plugin Author Cole Geissinger

    (@brainfestation)

    Ok, fix is in the latest version 2.0.5.2 🙂

    Plugin Author Cole Geissinger

    (@brainfestation)

    Good point. I was curious how an account was just created on my demo site 🙂

    I will correct that this weekend and roll that out. Thanks for pointing this out!

    Plugin Author Cole Geissinger

    (@brainfestation)

    Thanks for the heads up. I’ll check this out and make sure everything is working.

    Plugin Author Cole Geissinger

    (@brainfestation)

    Hi trpxlog,

    I’m not sure I follow what you are asking? Can you provide more details?

    Plugin Author Cole Geissinger

    (@brainfestation)

    In it’s current version, this is not possible. But this is an option coming in the next major release.

    Plugin Author Cole Geissinger

    (@brainfestation)

    Hi Deborah,

    Thanks for the translation! I just rolled out version 2.0.5.1 which contains your translations. Let me know if there’s anything else going on 🙂

Viewing 15 replies - 76 through 90 (of 208 total)