Hey Frosty,
Sure, no problem! Here's how it would all fit together.
1. First, install the Submission Accounts and Submission Pre-Parser modules. Module installation instructions are found here:
http://docs.formtools.org/userdoc/index....ng_modules
2. Configure the Submission Accounts module with your form (I suspect you've already done this, but if not, see the module's help doc for more info on that: http://modules.formtools.org/submission_...tation.php)
3. As mentioned in the previous post, add a new "Delete Account" field to your form. Make it a dropdown or radio button group - just so long as there are two and only two options: "Yes" and "No". Assign that new field to the View that's used by the Submission Account. In other words, that field will now be visible to all users logging in via the Submission Accounts module. (Check to make sure!)
4. The final step it to configure the Submission Pre-Parser. Select the module from your Modules page and create a new rule.
Status: Enabled
When Executed: "When submission is edited"
Rule Name: "User: self-delete accounts"
Form(s): (select the appropriate form)
PHP Code:
In this code, I've assumed your form field name for the "Delete Account" field is called "delete_account_field". So just change that string on the very first line if you've called it something else.
This code will ALWAYS delete the submission if they - or any other Form Tools user (you, the admin or any clients) - set the "Delete Account" field to "Yes". Since we've just deleted the submission, if the user was logged in through the Submission Accounts module, they won't have anywhere to return to. So to prevent this scenario from occurring, we automatically redirect to the http://www.yoursite.com/account_deleted.php page (which you'll need to define). That would contain some blurb for the user to let them know their account was deleted.
So don't forget that if the administrator or clients uses that field to delete the submission, they'll ALSO be redirected to that URL. So perhaps it's best if you only include that field on the View that the user themselves see through the Submission Accounts module.
And that's it! Hope the above was fairly clear!
- Ben
Sure, no problem! Here's how it would all fit together.
1. First, install the Submission Accounts and Submission Pre-Parser modules. Module installation instructions are found here:
http://docs.formtools.org/userdoc/index....ng_modules
2. Configure the Submission Accounts module with your form (I suspect you've already done this, but if not, see the module's help doc for more info on that: http://modules.formtools.org/submission_...tation.php)
3. As mentioned in the previous post, add a new "Delete Account" field to your form. Make it a dropdown or radio button group - just so long as there are two and only two options: "Yes" and "No". Assign that new field to the View that's used by the Submission Account. In other words, that field will now be visible to all users logging in via the Submission Accounts module. (Check to make sure!)
4. The final step it to configure the Submission Pre-Parser. Select the module from your Modules page and create a new rule.
Status: Enabled
When Executed: "When submission is edited"
Rule Name: "User: self-delete accounts"
Form(s): (select the appropriate form)
PHP Code:
PHP Code:
if ($vars["infohash"]["delete_account_field"] == "Yes")
{
$form_id = $vars["form_id"];
$view_id = $vars["infohash"]["view_id"];
$submission_id = $vars["submission_id"];
ft_delete_submission($form_id, $view_id, $submission_id);
header("location: http://www.yoursite.com/account_deleted.php");
exit;
}
In this code, I've assumed your form field name for the "Delete Account" field is called "delete_account_field". So just change that string on the very first line if you've called it something else.
This code will ALWAYS delete the submission if they - or any other Form Tools user (you, the admin or any clients) - set the "Delete Account" field to "Yes". Since we've just deleted the submission, if the user was logged in through the Submission Accounts module, they won't have anywhere to return to. So to prevent this scenario from occurring, we automatically redirect to the http://www.yoursite.com/account_deleted.php page (which you'll need to define). That would contain some blurb for the user to let them know their account was deleted.
So don't forget that if the administrator or clients uses that field to delete the submission, they'll ALSO be redirected to that URL. So perhaps it's best if you only include that field on the View that the user themselves see through the Submission Accounts module.
And that's it! Hope the above was fairly clear!
- Ben