News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Custom Form Mod

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

Previous topic - Next topic

GhostRider2110

Hi all, I upgrade to the latest version for SMF 1.1.11 .. and hit go before reading the warning.. No real big problems, just had to recreate a couple forms.  One thing I can't find, which I thought I had before I updated, was a way to put into the post the username of who posted... But I can't find where I found how to do that... Any help would be greatly appreciated...

--Mitch
Mitchell Baker
--------------------
CoffeeCup Software Ambassador
Get 20% Off CoffeeCup Web Design Software
Use this code when you checkout: 226STS
--------------------
www.getcoffeecup.com

Garou

NeQo, there is no limit set in the mod itself and the way its written should override any max post length  any other mod might theoretically set up.

However after doing a little bit of research the problem may be in the database.  In the messages database SMF uses the type TEXT which has maximum length of 65,535 characters. That would include everything else a user might put in the form based on what setup you have plus everything you put in the Form Output area.

You can try changing it to MEDIUMTEXT (16,777,215 characters) or LONGTEXT (4,294,967,295 characters). Those limits are set by default in MYSQL. Im not 100% this will fix it but its the only thing I can think of at this point.

Mitch, if you had that I dont know where you may have picked it up from. I dont remember another user providing code for that anywhere in the thread either.  Its never been included it in the mod and even though its been asked for a couple of times its low on my priority list. If a user is logged in when they fill out a form the resulting post will be posted by them anyway.

Eammeny

I keep getting an error and i'm not sure how to fix this.
8: Undefined variable: boardFile: /home/ourplace/public_html/forums/Sources/ManageSettings.php
Line: 2313
I'm not sure what this means and i've played around with it trying not to edit the file since i'm not wanting to cause more errors due to lack of knowledge.
Any clues?

Garou

Can you give a little more detail like SMF version, mod version (note the 2.x version wont work on RC2 and viceversa), link to the site and form, other mods you have? Also either paste a chunk of code from ManageSettings.php that includes line #2313 or even attach the whole file.

MeisterBruno

Hello everyone. I am certainly a newbie here and seeing thousands of posts it seems to be a bit hard to find what I am looking for. I am totally new to PHP coding and perhaps have a very simple and maybe stupid question to ask.

I am running SMF 1.1.11, and want to install CFM (Custom Form Mod). I used the package installer and brought the mod to the right theme, etc. When I tried to create a form I get the error: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3 File: /home/content/mywebsite/forum/Sources/ModSettings.php Line: 562.

Like I said I am not a code guy by any means, and at least for now. All I want is to install the thingy and create the forms I need. Any help is greatly appreciated.

Thanks ~ Meister

Eammeny

#1085
currently using custom form mod 1.6 and SMF 2.0 RC2
the line of code reads as follows:
'selected' => !empty($_SESSION['move_to_topic']) && $_SESSION['move_to_topic'] == $row['id_board'] && $row['id_board'] != $board,


(and due to adding another mod, the line is now 2382)

Also, I decided to try and push the CFM further and attempt to make a full form. This error came up.

Quote8: Undefined index: field_type
File: /home/ourplace/public_html/forums/Sources/ManageServer.php
Line: 1801

both files are attached.

Garou

MeisterBruno, Some sites are having issues with icons and version 1.6 of the mod for 1.1.x.

in ./Sources/ModSettings.php find
      if (($temp = cache_get_data('posting_icons-' . $board, 480)) == null)
      {
         $request = db_query("
            SELECT title, filename
            FROM {$db_prefix}message_icons
            WHERE ID_BOARD IN (0, $board)", __FILE__, __LINE__);
         $icon_data = array();
         while ($row = mysql_fetch_assoc($request))
            $icon_data[] = $row;
         mysql_free_result($request);

         cache_put_data('posting_icons-' . $board, $icon_data, 480);
      }


Some people have had luck with changing
WHERE ID_BOARD IN (0, $board)", __FILE__, __LINE__);
to
WHERE ID_BOARD IN (0)", __FILE__, __LINE__);

Eammeny the line you posted is not part of this mod but Ill look at the file when I get home from work tonight. It looks like somewhere another line isnt closed properly.

ManageServer.php issues are part of an SMF bug not the this mod it should be fixed by the time 2.0 goes final.

Horthon Gorthy

Hi there,

I've gotten all the pages except one to work great. I made my form in the admin area index.php?mode=form shows me my list but when i click view and head to the index.php?mode=form&id=1 (in my case id=2) i get a 406 unnaceptable, Ive never got this error before so im not fammiliar with it, (i have tons of other mods)

running 1.1.11 thanks!

Garou

I noticed you are using the ModSecurity fix, usually this fixes that issue. Since you mention id=2 have you been able to make other forms work? If so it could be something you have put into that particular form that is causing the error.

Horthon Gorthy

I've never touched modsecurity, nor do I know of such a fix. However, I did just try and whip up another quick little form with basic/nothing in it and I get the same error. (id=1 i delete cause i was still playing with the new mod at the time)

Garou

Quote from: Garou on January 26, 2010, 04:09:27 PM
For those having issues using this mod on a site with ModSecurity... I almost for got about a fix presented by Elindris. http://www.simplemachines.org/community/index.php?topic=248871.msg2299541#msg2299541

./Sources/CustomForm.php and ./Themes/default/CustomForm.template.php
Search for...
action=form;id=
and replace it with...
action=form&id=
Note: there are multiple instances that need to be changed in the CustomForm.template.php

Ill have to test this on sites that do not run ModSecurity and if it works on both then it will become a permanent change to the mod in the future.



Horthon Gorthy

thank you very much. That fixed it, sorry to waste your time.

Nvb

Quote from: ŦώεαЖзяŁ on December 21, 2009, 12:09:23 PM
A not perfect way to make posts made through custom forms count towards the user post count is to do the following

open CustomForm.php in \sources

find:
Quote$posterOptions = array(
               'id' => $user_info['id'],

add in the next line:
Quote'update_post_count' => !$user_info['is_guest'],

The reason why it's not perfect is that it will not check whether the target board has post count enabled and therefore will add increase the count even if the target board is not supposed to count posts... In my case, that solved my problem because all my forms are supposed to count, so if that's you case, cool...

Is there a reason why this does not work with version 1.6 on Board version 2.0 RC2 ?
Does the modification need an update? or did i do something wrong?
I changed into this:
$posterOptions = array(

'id' => $user_info['id'],
'update_post_count' => !$user_info['is_guest'],


Thank you for looking into this
N.

Garou

Horthon Gorthy, dont worry, I use to be one to say use the search function but if you try to search a single thread it only lists one post and it not always one with the actual answer. In light of that Ive taken to archiving some of the most common questions that way I can just cut and paste. :)

NeQo, that's actually code for 1.1.x I dont know if anyone ever posted the fix for 2.x was ever posted but its probably a slightly different syntax but I'm not sure what off hand.

Horthon Gorthy

thanks Garou

In that case im back!

I know you can change the template function but I was wondering if you could choose for the form page to run on a seperate theme entirely, just like when you force a forum to use a different theme than the rest of the forum? Thanks in Advance.

Garou

Nope it uses whatever forum template the user is using. It wasn't coded with its own template system it just simply attaches to the existing system. The template system in the mod really only effects what is displayed around and within the form and then that is set within the forum template.

Maybe you could set up a link to the form like index.php?action=form;id=1;theme=1 but when the user gets sent back to the forum they will be viewing it within that theme as well. Maybe you could edit the CustomForm.php to reflect the default theme during the redirect.
Look for...
// Redirect this user as well.
if ($exit == 'board' || $exit == '')
  redirectexit('board=' . $board . '.0');
elseif ($exit == 'forum')
  redirectExit();
elseif ($exit == 'form')
  redirectExit("action=form;");
else
  redirectexit("$exit");


and edit as needed.

Horthon Gorthy

yup that worked. if anyone is curious.


// Redirect this user as well.

if ($exit == 'board' || $exit == '')

  redirectexit('board=' . $board . '.0&theme=2');

elseif ($exit == 'forum')

  redirectExit("action=index&theme=2");

elseif ($exit == 'form')

  redirectExit("action=form&theme=3&id=2");

else

  redirectexit("$exit");

}


I know it's a huge hack, but it works for me.

Nvb

Quote from: NeQo on February 08, 2010, 05:10:12 PM
Is there a reason why this does not work with version 1.6 on Board version 2.0 RC2 ?
Does the modification need an update? or did i do something wrong?
I changed into this:
$posterOptions = array(

'id' => $user_info['id'],
'update_post_count' => !$user_info['is_guest'],



Can someone modify this for SMF 2.0 RC 2?
What is the correct code for this command: !$user_info['is_guest'],?

TY

Garou

I just checked the Post.php and that is correct for 2.0 they use...
'update_post_count' => !$user_info['is_guest'] && !isset($_REQUEST['msg']) && $board_info['posts_count'],
Which I believe will also check to see if the board is set up to count posts.

Studio

Hi folks, hi Garou - (I hope you see this one...)

I've made a new table inside the same DB my SMF board is using, with fields and data types according to the custom form I created on the forum.

Is there a way I can tell CustomForm.php to insert the values of the fields to that new table (about 51 columns per record) at the same time it would post to a board in the forum?

Thanks in advance.

Advertisement: