Hello Wise Ones,
I am just now discovering the cool features of WebloginPE. Mostly it’s working great. I am wondering if any of you have had success with getting a sign-up form to work across multiple pages?
The general idea is to have a quick initial sign-up, so that they’re in the site. Then they’ll be shown the next page, where they can either ignore it for now, or add more profile fields.
I was reading through the documentation, and figured that with some combination of &liHomeId (which puts you at a particular page after log-in) and &profileTpl (which gives you a template to use for profile editing), that I might be able to make a succession of the following:
1st sign-up page
page 2 editing some profile fields
page 3 editing more fields
... and so on.
Is this feasible? If not, I was thinking that I could use JQuery to make one big mega sign-up look like several pages, but I’d rather do it in the manner above.
Thanks for any ideas you can offer!
Cheers, Samba
-
☆ A M B ☆
- 24,524 Posts
Yes, that’s no problem. Have the initial sign-up form send the new user to a profile management page. Each form submission can send to the next page, with a different WLPE snippet using a different form.
See ®SuccessId, ®SuccessPause
Susan,
What a great idea, thanks! I just did a test, and I can see how the register forwards after some seconds when you do that. Very nice! I stuck the second register page form code there.
I think I’m almost there! Could I impose on your hospitality one more time? I have the next group of fields on the second registration form. I submit "register page 1", get forwarded to "register page 2", but when I submit the second one, it says it’s lacking required info. The reason for this seems clear maybe; when I submit the first register page, before you’re forwarded you get the usual screen saying to log in, and check your email for details and so on. So it skips over this log-in by forwarding.
So I’m not actually logged in at this point, right? So the question becomes, can you do the register and the log-in all at once somehow? Or maybe I also need a log-in page, and then go to register page 2?
Any help much appreciated!
Thanks, Dave
Hi Amigos,
I’ve tried two approaches, both unsuccessful, and I hope someone will have an idea for me.
Susan’s cool idea of using a daisy-chain of different register pages didn’t work for me. If you use more than one register page, it tells you that the user is already registered.
I also tried using a register page followed by a customized profile update page with some new fields. First, this didn’t work because "some fields were missing". So I figured out how to carry the fields forward from the previous page, and coded the form to save the profile. This appeared to work, but then the 2 new fields saved to the database but were not attached to the new user, they seemed to go into "la-la land".
Do any of you have other ideas? Any help appreciated.
Thanks, Dave
-
☆ A M B ☆
- 24,524 Posts
You probably need to emulate a login after submission of the first form by loading the new user’s values into the SESSION, which is what the profile editing form uses. Use a plugin with the OnWebSaveUser event to load the SESSION; now the new user is "logged in" and can freely edit his profile page.
The OnWebSaveUser event will pass your plugin the new user’s data that you need for this in its "user" array. You can trigger the plugin by checking the value of the "mode" variable (new or update) to only do the SESSION loading if it’s "new".
$_SESSION['webShortname'] = $this->Username;
$_SESSION['webFullname'] = $this->User['fullname'];
$_SESSION['webEmail'] = $this->User['email'];
$_SESSION['webValidated'] = 1;
$_SESSION['webInternalKey'] = $this->User['internalKey'];
$_SESSION['webValid'] = base64_encode($this->Password);
$_SESSION['webUser'] = base64_encode($this->Username);
$_SESSION['webFailedlogins'] = $this->User['failedlogincount'];
$_SESSION['webLastlogin'] = $this->User['lastlogin'];
$_SESSION['webnrlogins'] = $this->User['logincount'];
$_SESSION['webUserGroupNames'] = ''; // reset user group names
Susan,
Thanks. I sorta kinda follow you, as I don’t do much programming, and know zero about sessions, and near zero about plugins. If I have time (which I really don’t in this case), I’ll see if I can work it out.
Forms are just the worst.
Thanks again, I appreciate it, Dave
Hi,
I put the SESSION code above into a plugin to trigger upon OnWebSaveUser triggering, as per above. I could not follow the part about "mode" and how that would tie in, so I simply used those lines above in whole cloth in the plugin.
This did seem to help. My second form, a profile update with new fields, did take my "saveprofile" click, and the new fields were saved to the table - "Your profile has been updated" - no missing field errors this time! I almost started smiling.
But unfortunately, in the table these two new custom fields ended up saved, sure enough, but not attached to my user at all, just sort of randomly inserted. And this was verified when I tried displaying my user, those fields were empty.
It’s been a long day, and I guess I’ll try just using one giant form again. Or something.
Thanks. Dave
-
☆ A M B ☆
- 24,524 Posts
That code was just what it uses when logging someone in; it gets those values from a database query. You need to use values from the $user array that the event provides; these are taken from the registration form and the ID is taken from the database insertion. That’s why you use the event for
after the form is submitted, so that the insertion has taken place and the automatic user ID has been created in the database.
if($mode == "new") {
$_SESSION['webShortname'] = $user['username'];
$_SESSION['webFullname'] = $user['fullname'];
$_SESSION['webEmail'] = $user['email'];
$_SESSION['webValidated'] = 1;
$_SESSION['webInternalKey'] = $user['id'];
$_SESSION['webValid'] = base64_encode($user['password']);
$_SESSION['webUser'] = base64_encode($user['username];
$_SESSION['webFailedlogins'] = 0;
$_SESSION['webLastlogin'] = 0;
$_SESSION['webnrlogins'] = 0;
$_SESSION['webUserGroupNames'] = '';
} // end if "new"
A good way to see what values you have to work with is to start making your plugin with just this code:
if($mode == "new") {
echo "<pre>";
print_r($user); // print out the "user" array
echo "</pre>";
exit(); //stop everything else
} // end if "new"
Then you can see exactly what to use to load the SESSION.
Susan,
That’s an excellent lesson, thank you very much! You’re an ace.
When I actually have time, I think I will do some testing to follow what the code is doing. In the meantime, I have learned some valuable (albeit hard-won) lessons about this app, and in the future will most likely just use it for simpler purposes, like a nice short sign-up sheet and ability to display users and update their nice short profiles. It seems so good for that.
To really push the boundaries of this, one clearly needs to love to code PHP, understand sessions, and be willing to do logged in and logged out testing (barf!). I am willing to code PHP, but the "L" word never enters into it for me.
Dave
I have been trying this for a while now with no success. I have a 5 page registration process, but I can never get past the second page.
On the first page I have the registration form withe the basic required profile fields. That page works fine and it redirects to the second page no problem. However forcing the login with the session var is not working. I have the [+user.username+]
Is there an equivalent to ®SuccessId for profile mode?
When in profile mode to edit the profile do we need to have all the fields available (as hidden fields) or only the ones being edited.