Membership pro 2 - Add Hello FNAME on a custom page?

Hi

Is it possible after a i.e a silver member logs in, then he gets re-directed to a silver memembership page and on that page, there could be a message with the users name on, exsample could be "Hi John, welcome back".

  • Hamid

    Sorry for bumping, but I can see that i also need help with the redirect it self.

    Please see attached screendump.

    In the redirect option i am missing the options for redirecting users to a specific welcome page rather than to the account page, depending on their membership account. Lets say a silver member logs in, he should be redirected to a specific SILVER members page, and other members to their respective pages.
    Then on that page, i want a custom message for that user.
    Possible??

  • Adam Czajczyk

    Hello Hamid,

    I hope you're well today and thank you for you question!

    The "Redirect Control" doesn't currently support "per membership" redirect. The simplest option to overcome it would be to create single "welcome" page and use redirect option to redirect all the logged in users there.

    To achieve this simply replace existing "account" link in "After login" redirect field with a full URL of that new "welcome" page.

    The second step would be to put all the "membership-specific" welcome messages on that "welcome" page and then wrap them with shortcodes fro specific memberships. An example for two memberships would be:

    [ms-protect-content id="1" silent="yes"]
    Hello member of Basic Membership
    [/ms-protect-content]
    
    [ms-protect-content id="2" silent="yes"]
    Hello member of VIP Membership
    [/ms-protect-content]

    where numbers are IDs of your memberships. Note please the silent="yes" argument. Thanks to it the shortcode will just hide irrelevant content and won't display any protection message in its place. As a result a member will only see message that applies to the membership he/she is a member of.

    Additionally, you'd like to use members name inside these messages. That can be achieved with a simple shortcode. To add it to your site add this code as an "MU plugin" to your site:

    - create an empty file with .php extension (e.g. "username-shortcode.php")
    - copy and paste this code into the file (using "clean text" editor such as e.g. Notepad++, Sublime or similar):

    <?php
    
    function wpmu_user_firstname_shortcode() {
    	$current_user = wp_get_current_user();
    	return $current_user->user_firstname;
    
    }
    add_shortcode('wpmu_firstname','wpmu_user_firstname_shortcode');

    - upload the file to the "/wp-content/mu-plugins" folder of your site; if there's no "mu-plugins" folder in "wp-content" folder, just create empty one

    Then you can use [wpmu_firstname] shortcode anywhere on your site (in posts and pages).

    Would that work for you?

    Best regards,
    Adam

  • Adam Czajczyk

    Hello Hamid!

    I have accessed your site and checked it first using "Test Membership" mode and that worked fine. It showed me right message for each membership and the user name ("Hamid" in this case).

    Then I have created a subscriber-role user account on your site (with a name of "Adam WPMU") and assigned myself free membership. I then logged in to the site using login widget on front page (no issues here), I was redirected to the weclome page as expected and finally given a welcome message for free membership: "Hello Adam WPMU. Hope you are good today member of Free Membership". That looks like it's working then.

    I see that you posted your most recent replay a couple of hours ago already so did you manage to solve that meanwhile or am I missing anything? Let me know please.

    Best regards,
    Adam

  • Adam Czajczyk

    Hello Hamid!

    Defender doesn't include admin URL change feature, though it checks if default "admin" username is used or not. I think Wordfence (if I remember correctly you had that installed) can help you with that. iThemes Security should also have that feature built-in. I must say I'm not sure how the login widget will work with such change. Still though, you can also try to use any other front-end login widget (there's some free plugins available in wp.org repository) as Membership 2 Pro doesn't necessarily require its own widget to be used.

    Kind regards,
    Adam