The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Editing Offline Code - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5)
+--- Thread: Editing Offline Code (/showthread.php?tid=18)



Editing Offline Code - frostyintrepid - Feb 27th, 2009

Hi All,

To edit the layout when the form goes offline, it is as simple as editing the process.php file.

However, things are a little more complicated with this version.

Would someone out there be able to help me out on this?

TIA!


RE: Editing Offline Code - Ben - Feb 28th, 2009

Hi Frosty,

Thanks for the post!

I actually didn't quite follow the problem, though. What layout are you trying to edit? The form itself? What did you used to do with Form Tools 1?

[ Nothing's actually changed in this regard since FT1; taking the form offline still redirects you to a "offline" message, like in the screenshot you posted. If I understand your requirement, I don't really want to get into adding a "disabled redirect URL" option to redirect users to a custom page if the form is disabled. It should *really* be tackled on the original form page itself. We can't have people spending time filling in forms just to get redirected to a "form offline!" page. That would annoy a lot of people! Better to just put a note on the form page & remove the form itself (or something along those lines). ]


RE: Editing Offline Code - frostyintrepid - Feb 28th, 2009

Hmm thanks but we do take cycle through registrations period on quite a regular basis and find it quite a hassle to do some changes to the form instead (more room for mistakes).

Is it even possible say just to edit the message from "The form is offline" to "Please log a support ticket at..." instead?


RE: Editing Offline Code - frostyintrepid - Mar 1st, 2009

Anyone that can assist?


RE: Editing Offline Code - Ben - Mar 1st, 2009

Sorry for the wait! I spent the day drywalling my bathroom. Glad that's over with...

Here's a solution using the Submission Pre-Parser module. In case you're not familiar with the module, here's what it's all about. It lets you run your own (PHP) code on incoming form submissions, letting you do really whatever you want with the form submission. In your case, you'd want to look at the form itself and see if it's online or not. If it's offline, redirect the user to a custom "Sorry, this form is offline!" page; otherwise, just add the submission normally.

Here's how to do it.

1. Download and install the module. The module is found here:
http://modules.formtools.org/submission_pre_parser/download.php
Module installation instructions are found here:
http://docs.formtools.org/userdoc/?page=installing_modules

2. After activating the module through your Modules page, add a new "Rule". Give it the following values:

Status: enabled
When Executed: check "On form submission" and "On form submission, via API"
Rule Name: Offline Form Redirect
Forms: (select all forms)
PHP Code:

PHP Code:
if ($vars["form_info"]["is_active"] == "no")
{
  
header("location: http://www.yoursite.com/form_offline.php");
  exit;


You'll need to tweak the URL here to point to a page where you want to redirect the user. I'm assuming it can be the same for every form, but let me know if my assumption is incorrect.

And that's it! Now try disabling a form and putting through a form submission. You should now be redirected to the form_offline.php page (or whatever you called it!).

Couple of final remarks:
- This is rather a nice approach because it's compatible with upgrading. Upgrading won't overwrite any of your settings, unlike if you were to edit the process.php file or change the string values in the language file.
- The one drawback I can think of is that any time you add a new form, you'll need to update the rule to ensure the rule applies to the new form as well. If you find yourself adding forms a lot, I'd suggest adding a link to the Submission Pre-Parser module in your nav menu, so it's always just one-click away. (You can edit your menu in Settings -> Menus -> Edit Admin Menu).

Hope this helps, Frosty. Let me know if I wasn't clear on anything!

- Ben


RE: Editing Offline Code - frostyintrepid - Mar 2nd, 2009

Thanks Ben, will try it soon! Smile


(Mar 1st, 2009, 11:59 PM)admin Wrote: Sorry for the wait! I spent the day drywalling my bathroom. Glad that's over with...

Here's a solution using the Submission Pre-Parser module. In case you're not familiar with the module, here's what it's all about. It lets you run your own (PHP) code on incoming form submissions, letting you do really whatever you want with the form submission. In your case, you'd want to look at the form itself and see if it's online or not. If it's offline, redirect the user to a custom "Sorry, this form is offline!" page; otherwise, just add the submission normally.

Here's how to do it.

1. Download and install the module. The module is found here:
http://modules.formtools.org/submission_pre_parser/download.php
Module installation instructions are found here:
http://docs.formtools.org/userdoc/?page=installing_modules

2. After activating the module through your Modules page, add a new "Rule". Give it the following values:

Status: enabled
When Executed: check "On form submission" and "On form submission, via API"
Rule Name: Offline Form Redirect
Forms: (select all forms)
PHP Code:

PHP Code:
if ($vars["form_info"]["is_active"] == "no")
{
  
header("location: http://www.yoursite.com/form_offline.php");
  exit;


You'll need to tweak the URL here to point to a page where you want to redirect the user. I'm assuming it can be the same for every form, but let me know if my assumption is incorrect.

And that's it! Now try disabling a form and putting through a form submission. You should now be redirected to the form_offline.php page (or whatever you called it!).

Couple of final remarks:
- This is rather a nice approach because it's compatible with upgrading. Upgrading won't overwrite any of your settings, unlike if you were to edit the process.php file or change the string values in the language file.
- The one drawback I can think of is that any time you add a new form, you'll need to update the rule to ensure the rule applies to the new form as well. If you find yourself adding forms a lot, I'd suggest adding a link to the Submission Pre-Parser module in your nav menu, so it's always just one-click away. (You can edit your menu in Settings -> Menus -> Edit Admin Menu).

Hope this helps, Frosty. Let me know if I wasn't clear on anything!

- Ben