This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

sfDoctrineGuard and sfForkedDoctrineApply

Questions relating to sfGuardPlugin or other user management plugins

sfDoctrineGuard and sfForkedDoctrineApply

by symfony44 » Sat Mar 27, 2010 5:49 am

Hi everyone,

I am running these two plugins mentioned in the title. I have everything working when displaying them by themselves, however, when I try to show both the login and apply forms on one page I am having issues with both forms submitting when I only submit one. Can anyone share some guidance or tips on how to get around this?

Thanks in advance!
symfony44
Junior Member
 
Posts: 5
Joined: Sat Mar 27, 2010 5:44 am

Re: sfDoctrineGuard and sfForkedDoctrineApply

by fizyk » Mon Mar 29, 2010 9:08 pm

You're using component for the login form?

It's designed that way, by p'unk avenue, that when you show apply form, you don't get the login one on the same page.
I find it quite good, although uncommon conception, since when you apply for account, you don't have the possibility to log in ;)~ ;-)~ :wink:

In order to show both forms, you need to overwrite templates (_login.php would be enough), and remove these lines:

Code: Select all
<?php if (has_slot('sf_apply_login')): ?>
  <?php include_slot('sf_apply_login') ?>
<?php else: ?>
<!-- ... -->
<?php endif ?>
User avatar
fizyk
Member
 
Posts: 73
Joined: Mon Dec 14, 2009 11:25 pm
Location: Western Slavic Republic

Re: sfDoctrineGuard and sfForkedDoctrineApply

by symfony44 » Tue Mar 30, 2010 3:15 am

I was not using the component. I actually created the forms myself extending the plugins. How would you recommend setting up my page? All of my users will be directed to the login page which will show the login box and then also the account creation box on the side. I have both forms showing but I am running into an issue because they are coming from two different modules so the submit for each one executes a different action. This is not really a problem but now I have to maintain two templates that show pretty much the same thing. I am assuming there has to be a better way to accomplish this. Can you help?
symfony44
Junior Member
 
Posts: 5
Joined: Sat Mar 27, 2010 5:44 am

Re: sfDoctrineGuard and sfForkedDoctrineApply

by symfony44 » Tue Mar 30, 2010 4:01 am

Ok so I have both forms displaying and I have the apply form working. However, I can no longer login because the login action doesnt know about the apply form.

The apply form submits to user/new and and the login form submits to /login. If I goto the page user/new I can successfully create a new account. If i then go to user/new and try to login as soon as i click the login I get an error saying it cant locate "firstname" widget. I understand this is because the login action doesnt know anything about this form. How can I fix this?
symfony44
Junior Member
 
Posts: 5
Joined: Sat Mar 27, 2010 5:44 am

Re: sfDoctrineGuard and sfForkedDoctrineApply

by fizyk » Tue Mar 30, 2010 9:12 pm

I'm afraid you'd have to create custom action for that. Then first check if there was post used to access method. After that depends process the form based in the form that was passed. That is you create both forms as usuall:

Code: Select all
$this->form = $this->newForm('sfApplyApplyForm');
$this->form2 = $this->newForm('sfGuardLoginSomthingForm'); //Don't know the name


And then, when you check, if any form was sent, you run check like that:

Code: Select all
if( null !== $valuesSent = $request->getParameter('sfApplyApply', null) )
{
  //Process sfApplyApply form
}
elseif(  null !== $valuesSent = $request->getParameter('sfGuardLoginSomethigForm', null)
{
  //Process login form
}



You can use $this->form->getName() to get the actual form name in those checks.
User avatar
fizyk
Member
 
Posts: 73
Joined: Mon Dec 14, 2009 11:25 pm
Location: Western Slavic Republic

Re: sfDoctrineGuard and sfForkedDoctrineApply

by symfony44 » Wed Mar 31, 2010 2:14 am

Ok that makes sense.

Just to clarify, you are saying I will need to take the actions from each plugins action file and put them into a custom actions file where I can use your example to say which portion to process... correct?
symfony44
Junior Member
 
Posts: 5
Joined: Sat Mar 27, 2010 5:44 am

Re: sfDoctrineGuard and sfForkedDoctrineApply

by symfony44 » Wed Mar 31, 2010 4:28 am

Got it to work properly. Thanks for the help!
symfony44
Junior Member
 
Posts: 5
Joined: Sat Mar 27, 2010 5:44 am

Re: sfDoctrineGuard and sfForkedDoctrineApply

by glissattitude » Thu Jul 21, 2011 1:41 am

Hi symfony44

May you explain how you manage to do it running ? I'm trying to do exactly the same thing.
It would be very helpful for me if you could guide me
many thanks
glissattitude
Junior Member
 
Posts: 1
Joined: Thu Jul 21, 2011 1:37 am