Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Extending Userforms - tracking users, only allow one attempt

Go to End

2 Posts   565 Views


Community Member, 244 Posts

27 September 2011 at 11:49am


I'm using the userforms module ( which is excellent! ) for a membership site. The concept is people create an account, log in, and get given a few questionaires/tests.

What I need is

> only allow a user to complete the form one time
> the site owners need to be able to find a client in the CMS and view the results of forms they've submitted

ideally it would be nice if I could extend the 'options' tab in the form to have 3 options:
> allow unlimited submissions | allow one submission | user can return and edit form

Any suggestins welcome



Community Member, 244 Posts

27 September 2011 at 12:33pm

Ok, i've got one part working by created this function in page.php

public function FormSubmittedAlready() {
$MemberID = Member::currentUser()->ID;
return DataObject::get('SubmittedForm', "`SubmittedByID` = '$MemberID' and `ParentID` = '$this->ID' ");

and then putting this in

<% if FormSubmittedAlready %>
<p>You have already submitted this form</p>
<% else %>
<% end_if %>

however, i had to remove $UserDefinedForm from the CMS field, to force the form to default to using the $Form area in the template. this means i've lost the abilty to control where the form is...

still looking for solutions to the other parts...