Free registration with ccaps

Forums General Free registration with ccaps

Viewing 43 posts - 1 through 43 (of 43 total)
  • Author
    Posts
  • #584
    Carole Asselin
    Participant

    OK, as a tangent from another thread, i am looking at a way to get a free registration form, to associate a ccap, but i am getting really confused with the instructions available so far.

    I am looking at the FREE REGISTRATION FORM and i get this code:
    [s2Member-Pro-PayPal-Form register="1" level="0" ccaps="" desc="Signup now, it's Free!" custom="scrapbookcampus.com" tp="0" tt="D" captcha="clean" /]

    Now, if i want to associate a default ccap (to be transfered as a tag on Active Campaign or to use as a conditional later), but in the attribute explained at the bottom, it says this:

    ccaps=”music,videos” A comma-delimited list of Custom Capabilities. Only valid w/ Membership Level Access and/or Independent Custom Capabilities.

    and also

    level=”1″ Membership Level [1-4] (or, up to the number of configured Levels). Only valid for Forms providing Membership Level Access, which includes Free Registration Forms too. Free Registration Forms allow a value of level=”0″ whenever register=”1″ for Free Registration. In addition, Free Registration Forms will also allow visitors to register for free, even at higher Levels if you wish. Free Registration Forms will accept any value [0-4] (or, up to the number of configured Levels). With Independent Custom Capabilities this MUST be set to level=”*”, and ccaps=”” must NOT be empty (i.e., level=”*” ccaps=”music,videos”).

    But now, if With Independent Custom Capabilities this MUST be set to level=”*”, and ccaps=”” must NOT be empty, how do i give a level 0 AND a ccap to someone? Will using the “*” on the FIRST time they register give them a level 0? Is that the way to go?

    #589

    You can add a ccap to the free registration pro-form. Let’s say your ccap is default then:

    [s2Member-Pro-PayPal-Form register="1" level="0" ccaps="default" desc="Signup now, it's Free!" custom="scrapbookcampus.com" tp="0" tt="D" captcha="clean" /]

    The instructions for independent custom capabilities is when selling them to a logged in member, it doesn’t work with visitors. You can give a ccap in the free registration pro-form, the level is set.

    #591
    Carole Asselin
    Participant

    Oh ok… that would work.
    Now, is there a way for this shortcode to get a dynamic variable to know where the person clicked to get to this form, so i could then use it instead of the WP registration form?

    So, if the person was on the page http://example.com/thispage, clicks on a button/link sending them to a generic page with that particular form you showed, is there a way for the code to redirect them to the http://example.com/thispage upon success?

    #593

    You could custom code that, bur remember that registering won’t automatically log the user in, so he’ll still be logged out when redirected to the URL after registration…

    You could try using $_SERVER[‘HTTP_REFERER’] in the success attribute. http://php.net/reserved.variables.server

    [s2Member-Pro-PayPal-Form register="1" level="0" ccaps="default" desc="Signup now, it's Free!" custom="scrapbookcampus.com" tp="0" tt="D" captcha="clean" success="<?php echo $_SERVER['HTTP_REFERER']; ?>" /]

    See also the documentation here, in case there’s something that could be useful to you: WP Admin -> s2Member -> PayPal Forms -> Custom Return -> Free Registration.

    #595
    Carole Asselin
    Participant

    Well, i got a hack called s2-auto-login, which is this:

    <?php
    add_action('ws_plugin__s2member_during_configure_user_registration', 's2_auto_login_after_registration');
    function s2_auto_login_after_registration($vars = array())
    	{
    		if(is_admin()) return; // Not when an Admin is creating accounts.
    		
    		wp_set_auth_cookie($vars['user_id'], FALSE, FALSE); // Log the user in.
    		
    		if(did_action('login_form_register')) // For <code>/wp-login.php?action=register</code> compatibility.
    			c_ws_plugin__s2member_login_redirects::login_redirect($vars['login'], $vars['user']);
    		
    		$GLOBALS['_s2_auto_login_after_registration_vars'] = $vars; // For Pro Form compatibility.
    		add_action('template_redirect', '_s2_auto_login_after_registration', 1);
    	}
    function _s2_auto_login_after_registration() // Pro Form redirection handler.
    	{
    		$vars = $GLOBALS['_s2_auto_login_after_registration_vars'];
    		c_ws_plugin__s2member_login_redirects::login_redirect($vars['login'], $vars['user']);
    	}

    Maybe that would work?

    #596

    Okay…

    I’m not sure if the hack will pick up the success URL for the redirection. Could you try and see how it goes? I don’t remember if Jason kept that in mind when he wrote it. I see a line that makes me think it’s possible, but testing will confirm it.

    #597
    Carole Asselin
    Participant

    As i am running out of email addresses to test, Cristian, would you mind trying?
    I put the REGISTER link on this page: http://scrapbookcampus.com/test-page/
    and the form on this page: http://scrapbookcampus.com/krum/

    Would you be redirected?

    It would be a great workaround if it does what i think it should do.

    #598

    Sure.

    In the pro-form I see this error:

    Security Verification
    Input error: k: Format of site key was invalid

    I tried submitting it but didn’t succeed because of the error.

    Check that your configuration here is correct: WP Admin -> s2Member -> General -> Captcha

    #599
    Carole Asselin
    Participant

    I am not using any CAPTCHA. What should i check?
    I saw that error message but i have no clue where it is from.

    #600
    Carole Asselin
    Participant

    Ok i fixed that error. In the code you provided, it stated captcha = “clean” and it should have been “0”.

    #601

    I don’t know… Make sure the fields for that setting are empty and save, I guess. And set the captcha attribute in the shortcode to 0: captcha="0". WP Admin -> s2Member -> PayPal Forms -> Shortcode Attributes -> captcha

    #602

    Ok i fixed that error.

    Cool. I’ll try the registration redirection now.

    #603

    After registration I got taken to http://scrapbookcampus.com/welcome-back/ which I guess is the Login Welcome page. So the success redirection is ignored by the autologin hack.

    #604
    Carole Asselin
    Participant

    Darn. Either it is ignoring it, or the hack is not working. Now, which one is it?? Or how to test it? Any idea?

    I think this would be a wonderful “hack” to use and could be very useful if we can get it to work, not just for me, but for adding functionalities to s2Member

    #605

    First thing I’d try is removing the autologin hack and creating a new account, to see if the success redirection to the previous page works. If it doesn’t, that needs more work, if it does, then the autologin hack needs to be improved to support that.

    #606
    Carole Asselin
    Participant

    OK, the hack is removed. Do you have another email you can use?

    #607

    I registered again and didn’t get the autologin, or the redirection to another page, just the confirmation message at the top of the current page: “Thank you. You’ll receive an email momentarily.”

    In the page with the registration form, could you add this outside of the shortcode so it shows up on the page when viewed, please? I want to see if it’s actually giving the previous page’s address.

    <?php echo $_SERVER['HTTP_REFERER']; ?>

    You could also add this:

    <?php print_r($_SERVER); ?>

    You do have a PHP execution plugin active on your installation, right?

    #608
    Carole Asselin
    Participant

    Added those two lines.

    You do have a PHP execution plugin active on your installation, right?

    Yes i do. It is called Allow PHP execute.

    (you will run out of emails too!)

    #609

    I found these lines in the source code of the test page:

    <p><?php echo $_SERVER['HTTP_REFERER']; ?></p>
    <p><?php print_r($_SERVER); ?></p>
    

    It doesn’t look like the PHP execution is working there. See if the plugin is up-to-date and working, or try a new one (e.g. Jason’s EZ PHP https://wordpress.org/plugins/ezphp/ ).

    you will run out of emails too!

    Don’t worry, I have plenty. 😉

    #610

    Or maybe you’re using the visual editor… Make sure you use the code editor for the page.

    #611
    Carole Asselin
    Participant

    I was specifically in the Text tab, but as i checked the visual editor to see what showed, nothing of those lines showed, but back to the Text tab, the code had disappeared.

    I installed Jason’s plugin now, and i put back the code in the code editor.

    #612
    Carole Asselin
    Participant

    It is ready for the next test.
    I really wish i could get this setup to work!

    #613
    Carole Asselin
    Participant

    OK looking deeper into the Free registration form to add a default ccap.
    Is there a way to format it in a way to have the Username field on top and the First and last name at the bottom, just like the default WP registration form?

    Right now, here is my page: http://scrapbookcampus.com/register-to-the-campus/

    I tested it and it does what i had it set for: register a user and add a ccap in AC.
    Now,i had disabled the auto-login plugin to test but i ran out of email addresses.
    Can you test again?

    #614
    Carole Asselin
    Participant

    Ok, i tested it, and it seems to work.
    You can login and come back to the page where you clicked LOGIN
    You can click on REGISTER and be sent to the free registration page, and upon submitting, you are logged in automatically and a message redirects you to the previous page, where you just need to refresh.

    So that is one way it works.

    If there would be a way to remember the URL of the page where the user clicked the REGISTER, so he would be redirected there automatically, it would be even better!

    And while i am here, although i might not use the default WP registration form, i am still using the default LOGIN page. Can i have that on my “registration” page? Is there a shortcode or something? It would make it better looking and branded to the site (instead of having two different pages).

    #615

    I did a couple test registrations, and using the link to “register” at the top of the page, I had the registration pro-form in a new tab, after submitting it got automatically loggged into the new account, and was shown a message telling me that the previous page was still open in my browser and that I could now reload it.

    I also see that the PHP code is working in the test page now.

    i am still using the default LOGIN page. Can i have that on my “registration” page? Is there a shortcode or something?

    There’s the s2Member Pro login widget: WP Admin -> s2Member -> Scripting -> Pro Login Widget via PHP.

    #616
    Carole Asselin
    Participant

    Oh right… i`ll try the widget thing. I had not used that since i started, 5 years ago!
    I`ll update you on it.

    #617
    Carole Asselin
    Participant

    OK, i am trying to use the widget, but it does include the option to REGISTER, which i don’t want to (i want the free registration form), so i figured i could use the php version of the widget.

    I am choosing to send the member to the other page (the REGISTER one) once logged in so the member would get the same message as the one who would have just registered (and automatically logged in through the hack).

    My problem is simply the code as i don’t really understand the syntax. I came up with this:
    <?php echo s2member_pro_login_widget("title" => "" "login_redirect" => "http://scrapbookcampus.com/register-to-the-campus"); ?>

    But it is not working. Obviously, i have an error somewhere, so i would need your help to fix it.
    The page i put this login “widget” is this one:
    http://scrapbookcampus.com/login/

    Once i have the code figured out, i will take care of the page layout itself.
    So, can you help?

    #618

    Try this 🙂

    <?php echo s2member_pro_login_widget(array("title" => "", "login_redirect" => "http://scrapbookcampus.com/register-to-the-campus")); ?>

    #621
    Carole Asselin
    Participant

    OK that takes care of the error message, but i am getting a blank section (the one on the left).

    #622

    Right after I posted my previous reply, I edited it because there was something missing. Perhaps you got the code right before I fixed it. Please make sure you copied the latest version. 🙂

    #623
    Carole Asselin
    Participant

    Yes, that works. Now, to edit it, is there a way to remove the “Signup now”? Because having that would defeat the purpose of having the free registration form.

    #624

    You can also set the signup URL.

    <?php echo s2member_pro_login_widget(array("title" => "", "signup_url" => "http://scrapbookcampus.com/register-to-the-campus", "login_redirect" => "http://scrapbookcampus.com/register-to-the-campus")); ?>

    From the docs: http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_s2member_pro_login_widget()

    “signup_url” => “%%automatic%%” Full Signup URL, or use %%automatic%% for the Membership Options Page. If you leave this blank, it will not be shown.

    #625
    Carole Asselin
    Participant

    Cool, that seems to work exactly as i need it.
    This should be documented somewhere for others to benefit from this nice looking code! 🙂

    Thanks Cristian!

    #626
    Carole Asselin
    Participant

    Just to be picky, is there a way to redirect dynamically to the page they were on, when they clicked to reach that page?
    If not, it is ok, but it would be neat!

    #627

    Do you mean for the login redirection? I mentioned $_SERVER['HTTP_REFERER'] earlier in the conversation, is it what you want?

    <?php echo s2member_pro_login_widget(array("title" => "", "signup_url" => "http://scrapbookcampus.com/register-to-the-campus", "login_redirect" => $_SERVER['HTTP_REFERER'])); ?>

    #628
    Carole Asselin
    Participant

    YES!!!! that seems to work!!!
    So it does not even have to redirect to the “registration” page!
    Woohoo!

    #629

    🙂

    #637
    Carole Asselin
    Participant

    OK everything worked, but yesterday i got a registration that didn’t have the “default” ccap. I asked the person to tell me where she registered (thinking i had forgotten one link). Sure enough, she had clicked on the “You need to be logged in to post a comment”, and that links to the default WP login/registration.

    Unfortunately, i have no idea how to redirect that link to the page i created with the free registration form.

    Any suggestion?

    #639

    You can disable open registration, so the default registration form won’t be available, and in the default login form’s footer add a link to your page with the registration pro-form (the pro-form doesn’t obey the open registration setting).

    WP Admin -> s2Member -> General -> Open Registration
    WP Admin -> s2Member -> General -> Login/Registration Design -> Footer

    #640
    Carole Asselin
    Participant

    I find that adding a footer is not very visually obvious for the user. Is there a way to place the footer higher on the page??

    Or can we modify the message that says that “registration is not allowed” to add a link there??

    #641
    Krum Cheshmedjiev
    Participant
    #642
    Carole Asselin
    Participant

    Hi Krum, would you mind showing me the actual code i need to put? I don’t know the syntax of what goes in that file.
    Or even better… could you do it for me?? 😉

    #643
    Krum Cheshmedjiev
    Participant

    Put this on a single row:

    Redirect 301 /wp-login.php?action=register http://scrapbookcampus.com/register-to-the-campus/

Viewing 43 posts - 1 through 43 (of 43 total)
  • You must be logged in to reply to this topic.