Separate member login welcome page vs. separate user-defined login welcome page

I do have a technical and coding question which perhaps someone can clarify. I’m presently trying to set up the proper redirect for login welcome to a page based on level 0 and a separate page for level 1 members (and then, presumably enabled ability by code to provide separate homepage for each individual member). As I presently understand, there are two basic approaches which I think appropriate and competent for using:

  1. where I set up a single login welcome page and then with short-codes define what content can be seen by level 0 and what content can be seen by level 1.
  2. where i set up 2 separate login welcome pages by name, and then redirect the login with a .php file placed in the wp-content directory, which defines by member level the correct page name to forward the login to.
  3. *** I’m too vague about, in as much as the Login Welcome Page redirection URL provided by S2member is still abstract to my understanding, e.g. how it could be used for this redirection purpose. Moreover, how it is I’m to use the short-codes with a page URL incoordination with the page(s) I’m forwarding login to. To my understanding, the only data to reference a page for purposes of redirection is by its name or page ID# and not by an applied short-code.

My diatribe is to convey where my novice understanding lay with regard to subject matter. What I’m presently going with, in terms of approach to problem resolution, is #2. Hence, my technical question please, if someone could lend insight:

The .php code I’m using is:

<?php add_action('init','my_login_redirect'); function my_login_redirect(){ if(isset($_GET['dw_redirect']) && $_GET['dw_redirect'] == 'special'){ if(current_user_can('access_s2member_level1')){ //Redirect Subscribed wp_redirect('subscribed_'.S2MEMBER_CURRENT_USER_ID); //replace 'subscribed_' with page slug } else if(current_user_can('access_s2member_level0')){ //Redirect Registered wp_redirect('registered_'.S2MEMBER_CURRENT_USER_ID); //replace 'registered_' with page slug } } } ?>

To my understanding, by putting this file in my wp-content directory, I can override the purpose of the S2member redirection URL, and all that is required for it to work is to have two pages created: 1 page named registered and 1 page named subscribed. The path then will direct login to a welcome page defined by member level to a specific page URL defined by site URL followed by page name, registered and subscribed and then further defined S2MEMBER_CURRENT_USER_ID or NICENAME; e.g. my-site.com/registered/johnsmith. So, iow, although there are only two pages to which a login is redirected, the system will create its own page defined as ‘johnsmith’. This is the desired result, at least. However, I’m unclear as to whether or not that is possible with the above code. If so, then given said specific user assignment, such as ‘registered/johnsmith’ a user could make a change to their own welcome login page, e.g. that only they would see. It’s this last part with regard to what actually constitutes an assigned separate page as compared to an assigned user-defined page I’m unclear of.

Q. Is the above code correct for purposes of providing an individualized member login welcome page?

The best approach in my opinion, is the single page with dynamic content using shortcodes/php.

The redirection code you mention may work for levels. It seems close, although I didn’t test it to confirm.

If you want separate pages for the levels, I’d suggest the Login Welcome Page redirection with the level replacement code.

Screenshot-2022-12-08-at-01-46-45-s2Member-General-Options---s2Member-Membership-Plugin-for-WordPress---WordPress

You can do the redirection for usernames too, but creating the redirection doesn’t automatically create the page, so unless you already have some plugin that creates those user pages, it’d require more work/customization.

:slight_smile:

Thank you for the reply. The other issue I was with question: I set up a Buy Now paypal button, but i can’t check the functionality of it. How do I know if after making payment, the Customer will be redirected back to the Buy Now Restricted page URL?