WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: WP-Members] The Redirects (2 posts)

  1. pmagony
    Member
    Posted 2 years ago #

    Hi,

    Great plugin and excellent support. A true rarity in the plugin community. On that note, I tip my hat to Chad Butler for his work.

    I'm trying to pin down and wrap my head around the log-in functionality of the WP-Members plugin.

    I've defined unique pages, utilizing the available short codes provided in the manual, for a log-in page, a registration page, as well as a member page.

    What I find odd, is that if I click on a hard coded log-in link, log-in successfully, I'm not redirected to the "member page", I'm left on the log-in page.

    If I click on a blocked page, I'm presented with the choice to log-in or register depending on my status as a user. If I log-in as an existing user successfully, I'm not redirected to a "member area", I'm simply left on the registration page. Albeit, the text changes on that page sensitive to my status, but what I am trying to achieve is that after a successful log-in, I would like to be redirected to the "member" page.

    Is there anyway to achieve this functionality via the administration area or by modifying any of the plug-in pages?

  2. Chad Butler
    Member
    Posted 2 years ago #

    sorry about the very delayed response - I did not see this until now. (it was not tagged wp-members when submitted)

    The short answer here is that there is a filter for login redirect. The basic explanation of how to use it would be (like any other WP filter) adding the following to your functions.php:

    add_filter( 'wpmem_login_redirect', 'my_login_redirect' );
    
    function my_login_redirect()
    {
    	// return the url that the login should redirect to
    	return 'http://yourdomain.com/your-page';
    }

    Now, you can get as fancy as you want with this. In your case, it might mean that you only want to redirect a user if they are using the login page (as opposed to logging in directly on a content page). You would need to add some conditional (if/else) code to determine what page id you were on, then redirect accordingly. It's very flexible (and thus, quite powerful).

    Now, the long answer -

    The reason the plugin's functionality is the way that it is is because many of these features were added to meet specific user requests. When the plugin first was released, WP was little more than a blogging engine and login was done directly on the content page, thus the intention was to not move the user away from what they were trying to view in the first place. Additionally, the Members Area (which is for users to update their settings, etc) has a login form already.

    The Registration and Login pages were added much later due to user requests for specific features. But since there are many ways to configure the plugin for use in a variety of applications, I chose to leave this generic (and thus more flexible/extensible) rather than force users into a particular framework. I've found that what seems to be an intuitive approach for one user may not be for another.

    That also means that when new features are added (such as when we added the login form shortcode), we don't implement it in such a way as to change the previous way the plugin functioned. There are a lot of users of the plugin and I'm sensitive to the fact that they all have it configured a certain way for a certain use so I don't want to force anyone to change. That gets more into a philosophical approach to the plugin's development, but I think it's relative.

    And speaking of the philosophical approach to the plugin's development coupled with the login process (and registration process for that matter), the primary way the plugin functions with its default installation is to require the least amount of steps for a user to get from non-user to viewing content. That is why the default places both login and registration in the place of blocked content, and that is why login drops you by default on the page your were viewing at the time. Most users do not want to be taken away from what they were looking at only to have to navigate back there once they register of login. But that model of course doesn't fit for every application so that is why the plugin is designed to be flexible.

    Sorry for the ramble... But I was on a roll and I may refer to this content later for the next time I get this question.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags