News:

Wondering if this will always be free?  See why free is better.

Main Menu

Custom Form Mod

Started by live627, July 09, 2008, 10:24:44 PM

Previous topic - Next topic

Shades.

Quote from: live627 on February 26, 2022, 07:45:34 AMlooks like you were running v1.7

so either phone or rule2 are too long for the new code. The new size is 150 whereas you have 192. They need trimmed.

Or you can modify the code to accept more data.

install.php
array(
'name' => 'type',
'type' => 'varchar',
'size' => 150,
'null' => true,
),
change size to 255 array(
'name' => 'type',
'type' => 'varchar',
'size' => 255,
'null' => true,
),

Ok it insalled but still getting error 500 page at index.php?action=admin;area=modsettings;sa=customform
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

live627

oh a parse error I didn't catch

in .\Themes\default\CustomForm.template.php on line 252', isset($modSettings['customform_view_title']) && ($modSettings['customform_view_title'] != '')) ? $modSettings['customform_view_title'] : $txt['customform_tabheader'], '

replace with', isset($modSettings['customform_view_title']) && $modSettings['customform_view_title'] != '' ? $modSettings['customform_view_title'] : $txt['customform_tabheader'], '

Shades.

#1982
That worked! ;)

Another issue when I go to my form at /index.php?action=form;n=1 I get an error log:

QuoteError
Type of error
Undefined_vars
Error message
8: Undefined variable: true
File
/home2/*****/public_html/*****/Sources/Class-CustomForm.php
Line
188
URL of page causing the error
https://*****.com/index.php?action=form;n=1

Backtrace information
#0: smf_error_handler()
Called from /home2/*****/public_html/*****/Sources/Class-CustomForm.php on line 188
#1: setHtml()
Called from /home2/*****/public_html/*****/Sources/CustomForm.php on line 197
#2: CustomForm()
Called from /home2/*****/public_html/*****/index.php on line 187

And then also when I try to edit my form it won't save the board to post in. I can select a board but it always come back empty after saving. (see attachment)

Edit: Although it does show on the main custom form list page. (2nd attachment)
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Shades.

Also just tried to create another form and same thing, no board in the edit but shows on the main list.
But after creating the 2nd form another one or a "dummy" form popped up in between. It just says:

Quote0 ("Invalid Board")   Admin   (Edit)   (Delete)
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

live627

I'll create a new release with these fixes. :)

Does it find all of your old fields and assign the right type to them?
Quote from: Shades. on February 26, 2022, 09:00:29 AMBut after creating the 2nd form another one or a "dummy" form popped up in between. It just says:
Curious. I'll see ifs I can reproduce.

Shades.

Quote from: live627 on February 26, 2022, 09:17:39 AMDoes it find all of your old fields and assign the right type to them?
As far as I can tell.

I used the form I created and it actually posted to the correct board but sent me to an empty "thank you" page after sending the form.
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

live627

Quote from: Shades. on February 26, 2022, 10:49:35 AM
QuoteDoes it find all of your old fields and assign the right type to them?
As far as I can tell.
That's good! Means the compatibility code is working.

Shades.

Yes it's working! ;)

But still having these errors and no thank you page after submitting a form.
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Shades.

This is on a fresh install of SMF 2.1.1 and no mods and first time installing custom form v2.1.1 on this database:

QuoteError
Type of error
Undefined_vars
Error message
8: Undefined index: parent_boards
File
/home2/*****/public_html/*****/Sources/Subs-Post.php
Line
2758
URL of page causing the error
https://*****.com/index.php?action=form

Backtrace information
#0: smf_error_handler()
Called from /home2/*****/public_html/*****/Sources/Subs-Post.php on line 2758
#1: updateLastMessages()
Called from /home2/*****/public_html/*****/Sources/Subs-Post.php on line 2158
#2: createPost()
Called from /home2/*****/public_html/*****/Sources/CustomForm.php on line 167
#3: CustomForm()
Called from /home2/*****/public_html/*****/index.php on line 187

QuoteError
Type of error
General
Error message
2: Invalid argument supplied for foreach()
File
/home2/*****/public_html/*****/Sources/Subs-Post.php
Line
2764
URL of page causing the error
https://*****.com/index.php?action=form

Backtrace information
#0: smf_error_handler()
Called from /home2/*****/public_html/*****/Sources/Subs-Post.php on line 2764
#1: updateLastMessages()
Called from /home2/*****/public_html/*****/Sources/Subs-Post.php on line 2158
#2: createPost()
Called from /home2/*****/public_html/*****/Sources/CustomForm.php on line 167
#3: CustomForm()
Called from /home2/*****/public_html/*****/index.php on line 187

QuoteError
Type of error
Undefined_vars
Error message
8: Undefined index: customform_thankyou
File
/home2/*****/public_html/*****/Themes/default/CustomForm.template.php
Line
260
URL of page causing the error
https://*****.com/index.php?action=form;thankyou

Backtrace information
#0: smf_error_handler()
Called from /home2/*****/public_html/*****/Themes/default/CustomForm.template.php on line 260
#1: template_ThankYou()
Called from /home2/*****/public_html/*****/Sources/Load.php on line 2744
#2: loadSubTemplate()
Called from /home2/*****/public_html/*****/Sources/Subs.php on line 4147
#3: obExit()
Called from /home2/*****/public_html/*****/index.php on line 190

QuoteError
Type of error
Undefined_vars
Error message
8: Undefined index: customform_forum
File
/home2/*****/public_html/*****/Themes/default/CustomForm.template.php
Line
266
URL of page causing the error
https://*****.com/index.php?action=form;thankyou

Backtrace information
#0: smf_error_handler()
Called from /home2/*****/public_html/*****/Themes/default/CustomForm.template.php on line 266
#1: template_ThankYou()
Called from /home2/*****/public_html/*****/Sources/Load.php on line 2744
#2: loadSubTemplate()
Called from /home2/*****/public_html/*****/Sources/Subs.php on line 4147
#3: obExit()
Called from /home2/*****/public_html/*****/index.php on line 190

QuoteError
Type of error
Undefined_vars
Error message
8: Undefined index: customform_list
File
/home2/*****/public_html/*****/Themes/default/CustomForm.template.php
Line
269
URL of page causing the error
https://*****.com/index.php?action=form;thankyou

Backtrace information
#0: smf_error_handler()
Called from /home2/*****/public_html/*****/Themes/default/CustomForm.template.php on line 269
#1: template_ThankYou()
Called from /home2/*****/public_html/*****/Sources/Load.php on line 2744
#2: loadSubTemplate()
Called from /home2/*****/public_html/*****/Sources/Subs.php on line 4147
#3: obExit()
Called from /home2/*****/public_html/*****/index.php on line 190

It does post to the correct board though (see attachment-form is not complete but it posted what I wanted so you could see it).
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

live627

v2.2.0

Features
  • Make the input box for the field text a textarea
  • Show form activity in the who's online page
Bug Fixes
  • Actually show help text when clicking on icon
  • Don't write the global $board because it confuses SMF into looking up undefined variables (parent_boards)
  • Parse error
  • Select correct board value for dropdown
  • Thankyou page was blank and generated errors
  • Undefined variable $true

Shades.

Quote from: live627 on February 27, 2022, 01:28:42 AMv2.2.0

Features
  • Make the input box for the field text a textarea
  • Show form activity in the who's online page
Bug Fixes
  • Actually show help text when clicking on icon
  • Don't write the global $board because it confuses SMF into looking up undefined variables (parent_boards)
  • Parse error
  • Select correct board value for dropdown
  • Thankyou page was blank and generated errors
  • Undefined variable $true

It still shows Last Updated Yesterday at 02:28:32 AM & version 2.1.1 ;D
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Mooby The Golden Sock

I'm using the latest v2.2.0 from Github on 2.1.1 (upgraded from 2.0.19).

"Add New Form" gives me an error 500 on [boardurl]/index.php?action=admin;area=modsettings;sa=customform;form_id=5;

After this, I hit back button and refresh the page, and get:
Quote0 ("Invalid Board")   Admin   (Edit)   (Delete)

Clicking "Edit" gives another error 500 on [boardurl]/index.php?action=admin;area=modsettings;sa=customform;form_id=5;

Shades.

Just downloaded v2.2.1 and installed it. Went into admin and everything is in order and in place where it should be. Got no errors so I went to my old form that I created from way back and entered the information, hit submit and my heart skipped a beat from excitement that it works perfectly! :laugh:

Thanks you sooo much @live627! This mod makes my life easier and quite frankly is one of the best mods out there and should be a premium mod IMHO! ;)  8)
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

live627

Quote from: Shades. on February 27, 2022, 10:51:08 PMquite frankly is one of the best mods out there and should be a premium mod IMHO! ;)  8)
I though so too but this was already here and its author was kind enough to give it to me; therefore I will keep it free.

I've seen several very useful mods get disappeared because their authors pulled them, some of which I use. I get frustrated to see them gone. I will not be contributing to such loss.

I DO, however, accept PayPal donations via the link/button on the mod page (or this ==> )

Shades.

Quote from: live627 on February 28, 2022, 01:08:36 AMI DO, however, accept PayPal donations via the link/button on the mod page (or this ==> )
And done! ;)

I just found this issue this morning when trying to visit the users online: (Sends me to a blank 500 error page)

QuoteError
Type of error
Undefined_vars
Error message
8: Undefined variable: result
File
/home2/*****/public_html/*****/Sources/Subs-CustomForm.php
Line
38
URL of page causing the error
https://*****.com/index.php?action=who

Backtrace information
#0: smf_error_handler()
Called from /home2/*****/public_html/*****/Sources/Subs-CustomForm.php on line 38
#1: customform_load_theme()
Called from /home2/*****/public_html/*****/Sources/Subs.php on line 5810
#2: call_integration_hook()
Called from /home2/*****/public_html/*****/Sources/Load.php on line 2668
#3: loadTheme()
Called from /home2/*****/public_html/*****/index.php on line 230
#4: smf_main()
Called from /home2/*****/public_html/*****/index.php on line 187
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Shades.

My temporary fix (working with no errors but just a temporary fix): ;)

in Subs-CustomForm removed:
function customform_load_theme()
{
global $context, $scripturl, $smcFunc, $txt;

if ($context['current_action'] == 'who')
{
$request = $smcFunc['db_query']('', 'SELECT id_form, title FROM {db_prefix}cf_forms');
while ([$id_form, $title] = $smcFunc['db_fetch_row']($result))
if (allowedTo('custom_forms_' . $form_id))
$txt['customform_whoallow_' . $id_form] = sprintf(
$txt['customform_who'],
$scripturl,
$id_form,
$title,
);
$smcFunc['db_free_result']($result);
}

if ($context['current_action'] == 'helpadmin')
loadLanguage('CustomForm');
}

and disabled these Integration hooks:

1. customform_load_theme
2. customform_whos_online
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Shades.

Is there any way when a guest tries to access ?action=form;n=1 that it sends them to the registration page instead of the front page?
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Kindred

That's not default smf behavior.   
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Diego Andrés

#1998
Quote from: Shades. on March 11, 2022, 04:00:31 PMIs there any way when a guest tries to access ?action=form;n=1 that it sends them to the registration page instead of the front page?

Yes

Change this in CustomForm.php
if (!allowedTo('customform_view_perms'))
        redirectExit();
to
if (!allowedTo('customform_view_perms'))
        redirectExit('action=signup');

Or you could do what live didn't  :laugh:
Replace
if (!allowedTo('customform_view_perms'))
redirectExit();

loadLanguage('CustomForm');
with
loadLanguage('CustomForm');
isAllowedTo('customform_view_perms');
Then add the error txt string to the file (CustomForm.english.php)
$txt['cannot_customform_view_perms'] = 'You do not have permission to view the Custom Forms page.';

SMF Tricks - Free & Premium Responsive Themes for SMF.

Shades.

Quote from: Kindred on March 11, 2022, 08:08:11 PMThat's not default smf behavior. 
:P  ;D

Quote from: Diego Andrés on March 11, 2022, 08:24:27 PM
Quote from: Shades. on March 11, 2022, 04:00:31 PMIs there any way when a guest tries to access ?action=form;n=1 that it sends them to the registration page instead of the front page?


Yes

Change this in CustomForm.php
if (!allowedTo('customform_view_perms'))
        redirectExit();
to
if (!allowedTo('customform_view_perms'))
        redirectExit('action=signup');

Or you could do what live didn't  :laugh:
Replace
if (!allowedTo('customform_view_perms'))
redirectExit();

loadLanguage('CustomForm');
with
loadLanguage('CustomForm');
isAllowedTo('customform_view_perms');
Then add the error txt string to the file (CustomForm.english.php)
$txt['cannot_customform_view_perms'] = 'You do not have permission to view the Custom Forms page.';

I like the second option better, thanks a million! 8)
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Advertisement: