News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Custom Form Mod

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

Previous topic - Next topic

SychO

Quote from: SychO on August 30, 2016, 02:44:36 PM
this is much better

in ManageSettings.php

find

                $smcFunc['db_query']('', '
DELETE FROM {db_prefix}permissions
WHERE id_group = {int:current_group}
' . (empty($context['illegal_permissions']) ? '' : ' AND permission NOT IN ({array_string:illegal_permissions})'),
array(
'current_group' => $_GET['group'],
'illegal_permissions' => !empty($context['illegal_permissions']) ? $context['illegal_permissions'] : array(),
)
);


replace WHERE with:

WHERE permission NOT LIKE "custom_forms%" AND permission NOT LIKE "CustomForm_view_perms" AND

Omg i am so sorry i meant ManagePermissions.php but wrote ManageSettings.php
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

aegersz

#1761
when i try this mod in my dev system, the topic that it generates doesn't include the fields that i filled in.

am i doing it right ?

where does my entered data go ?

EDIT: Sorted now, i forgot to add the "{field}" value into the body
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here


iViscosity

I need some help, if anyone still can. I used the guide to make the 'new topic' redirect to the form, but when I click 'save' at the end of the form, it just goes back to the empty form and no post is made. How can I fix this?

thunderchld

I have attempted to go through the posts, but I cannot find it.  Is it possible to have the forum post anonymously? (Paired with another mod is fine).

e.g. we have a form to collect feedback after certain events; but we do not want everyone to know who sent in that feedback.

VenoM9078

I'm sorry for bumping this thread. But I don't know where else can I go for help. It's really important for me to solve this..

When I install the Custom Form Mod and redirect to the 'settings' page as it recalls, this error comes up:

QuoteFatal error: Redefinition of parameter $nul in /storage/ssd1/304/2487304/public_html/Sources/ManageSettings.php on line 2693

Where 2693 line is:


// Fucntion to produce a list of custom form fields.
function list_CustomForm_fields($nul, $nul, $nul, $id)
{
global $txt, $scripturl, $smcFunc;

// Get the data from the cf_fields table.
$request = $smcFunc['db_query']('','
SELECT id_field, title, type, text
FROM {db_prefix}cf_fields
WHERE id_form = {int:id_form}
ORDER BY id_field',
array(
'id_form' => $id,
)
);

$data = array();

while($row = $smcFunc['db_fetch_assoc']($request))
$data[] = $row;

$list = array();
$i = 1;
$end = count($data);


I don't know how to resolve this error. Was hoping someone can help? I only have 2 other packages installed including "mentioning @members" and a smiley pack.

Atomixx

Anyone know a way that I can make one of the Text Boxes be automatically filled with the users username and cannot be changed?

Eiyuu

Hi everyone,

I am trying to make the custom form to also work on replies.

I have managed to get do Display.template.php and modify it to go to a custom form, but it always does a new topic instead of replying to the current topic.

My objective was to even use the same form, on the same board. If the same form doesn't work i will just duplicate the form and use that for a reply (which is what i have been trying to do without success...)

Can someone give me a few pointers in how i can make it work for replies as well?

Thanks

wwwserfer

Quote from: SychO on September 04, 2016, 03:53:39 PM
Quote from: SychO on August 30, 2016, 02:44:36 PM
this is much better

in ManageSettings.php

find

                $smcFunc['db_query']('', '
DELETE FROM {db_prefix}permissions
WHERE id_group = {int:current_group}
' . (empty($context['illegal_permissions']) ? '' : ' AND permission NOT IN ({array_string:illegal_permissions})'),
array(
'current_group' => $_GET['group'],
'illegal_permissions' => !empty($context['illegal_permissions']) ? $context['illegal_permissions'] : array(),
)
);


replace WHERE with:

WHERE permission NOT LIKE "custom_forms%" AND permission NOT LIKE "CustomForm_view_perms" AND

Omg i am so sorry i meant ManagePermissions.php but wrote ManageSettings.php

4 SMF 1.1.x

In ManagePermissions.php

Find:

// Insert the general permissions.
if ($_GET['group'] != 3 && empty($_GET['boardid']))
{
db_query("
DELETE FROM {$db_prefix}permissions
WHERE permission NOT LIKE 'custom_forms%' AND permission NOT LIKE 'CustomForm_view_perms' AND ID_GROUP = $_GET[group]" . (empty($context['illegal_permissions']) ? '' : "
AND permission NOT IN ('" . implode("', '", $context['illegal_permissions']) . "')"), __FILE__, __LINE__);


replace WHERE with:

WHERE permission NOT LIKE 'custom_forms%' AND permission NOT LIKE 'CustomForm_view_perms' AND

It will be right?

(At least it helped me) ;)

ryry46d9

Any chance for live627 to come out of retirement ...

Forum version: SMF 2.0.14
I did a local install to track that broke my forums and so far it looks like Custom Form Mod 1.7 is the culprit (only mod installed)

For some reason when CFM is installed I have no access to:
Core Features
Features and Options
Security and Moderation
Modification Settings
Error Log
Administration Log
Moderation Log
Ban Log
Spider Log
Task Log
Log Pruning
When I try to access the pages I get a error 500 with chrome and a blank page with firefox

Also found this gem sitting in the Error Log :
http://192.168.1.100/public/index.php?action=admin;area=packages;sa=install;package=CustomFormMod_v1.7_SMF2x.zip [nofollow]
8: Undefined index: package_readme
File: /var/www/html/public/Sources/Packages.php
Line: 356

Proderf

#1770
From what I notice, this mod doesn't bode well with 2.0.14

I have an error where I can access and use the template, but if i go to edit them, it error screens in the forums saying "The database value you're trying to insert does not exist: id_form"

EDIT: Ive done some of my own tweaking, and the problem comes from ~line 2700 and its previous similar lines with "function list************($nul, $nul, $nul, $id)"

This give an overall fatal error "redefined parameter $nul"

Fix 1: change "function list************($nul, $nul, $nul, $id)" to "function list************()"
-This give the id error stated above

Fix 2:  change "function list************($nul, $nul, $nul, $id)" to "function list************($id)"
-This lets you see the edit page of the forums, but does not show the fields used; its as though there are no feeds on the form, HOWEVER, hone you use the form the fields are still there.

My hypothesis is that 2.0.14 has a bug with mods and databases, where the coding of the mod is not properly pulling from the database the mod data is stored in


Here is my current code (I'm mostly concerned with the second half of it)

// Fucntion to produce a list of custom forms.
function list_CustomForms($id)
{
global $txt, $scripturl, $smcFunc;

// Get the data from the cf_forms table.
$request = $smcFunc['db_query']('','
SELECT id_form, title, id_board
FROM {db_prefix}cf_forms'
);

// Get some general permissions info.
$permissions = get_CustomForm_permissions();
$membergroups = get_CustomForm_membergroups();
$list = array();

// Go through every form.
While($row = $smcFunc['db_fetch_assoc']($request))
{
// Create a list of the groups which can use this form.
$permissions_string = $txt['admin'];
if(isset($permissions['custom_forms_'.$row['id_form']]))
foreach($permissions['custom_forms_'.$row['id_form']] as $membergroup_id)
$permissions_string .= ', '.$membergroups[$membergroup_id];

// Try to find the name of the board.
$board_name = 'Invalid Board';

$board_request = $smcFunc['db_query']('','
SELECT name
FROM {db_prefix}boards
WHERE id_board = {int:id_board}
AND redirect = \'\'',
array(
'id_board' => $row['id_board'],
)
);

// Try to get the name from the returned row.
if($board = $smcFunc['db_fetch_assoc']($board_request))
$board_name = $board['name'];
$smcFunc['db_free_result']($board_request);

// Add the current entry into the list.
$list[] = array(
'title' => $row['title'],
'board' => $row['id_board'].' ("'.$board_name.'")',
'permissions' => $permissions_string,
'modify' => '
<table width="100%">
<tr>
<td width="50%" style="text-align:center;">
<a href="'.$scripturl.'?action=admin;area=modsettings;sa=customform;form_id='.$row['id_form'].';">
('.$txt['CustomForm_edit'].')
</a>
</td>
<td width="50%" style="text-align:center;">
<a href="'.$scripturl.'?action=admin;area=modsettings;sa=customform;form_id='.$row['id_form'].';delete;" onclick="return confirm(\''.$txt['CustomForm_delete_warning'].'\')" >
('.$txt['delete'].')
</a>
</td>
</tr>
</table>',
);
}
$smcFunc['db_free_result']($request);
return $list;
}

// Fucntion to produce a list of custom form fields.
function list_CustomForm_fields($id)
{
global $txt, $scripturl, $smcFunc;

// Get the data from the cf_fields table.
$request = $smcFunc['db_query']('','
SELECT id_field, title, type, text
FROM {db_prefix}cf_fields
WHERE id_form = {int:id_form}
ORDER BY id_field',
array(
'id_form' => $id,
)
);

$data = array();

while($row = $smcFunc['db_fetch_assoc']($request))
$data[] = $row;

$list = array();
$i = 1;
$end = count($data);

// Go through every field.
foreach($data as $field)
{
// Convert the field type into the proper text strings.
$type = str_replace(
// Search array.
array('largetextbox', 'textbox', 'checkbox', 'selectbox', 'float', 'int', 'radiobox', 'infobox'),
// Replace array.
array( $txt['CustomForm_large_textbox'], $txt['CustomForm_textbox'], $txt['CustomForm_checkbox'], $txt['CustomForm_selectionbox'], $txt['CustomForm_float'], $txt['CustomForm_int'], $txt['CustomForm_radiobox'], $txt['CustomForm_infoboxa']),
$field['type']
);

// Add the current entry into the list.
$list[] = array(
'title' => $field['title'],
'text' => $field['text'],
'type' => $type,
'modify' => '
<table width="100%">
<tr>
<td width="25%" style="text-align:center;">
<a href="'.$scripturl.'?action=admin;area=modsettings;sa=customform;field_id='.$field['id_field'].';moveup;">
'.(($i != 1) ? '('.$txt['CustomForm_moveup'].')' : '').'
</a>
</td>
<td width="25%" style="text-align:center;">
<a href="'.$scripturl.'?action=admin;area=modsettings;sa=customform;field_id='.$field['id_field'].';movedown;" >
'.(($i != $end) ? '('.$txt['CustomForm_movedown'].')' : '').'
</a>
</td>
<td width="50%" style="text-align:center;">
<a href="'.$scripturl.'?action=admin;area=modsettings;sa=customform;field_id='.$field['id_field'].';">
('.$txt['CustomForm_edit'].')
</a>
</td>
<td width="50%" style="text-align:center;">
<a href="'.$scripturl.'?action=admin;area=modsettings;sa=customform;field_id='.$field['id_field'].';delete;" onclick="return confirm(\''.$txt['CustomForm_delete_warning'].'\')" >
('.$txt['delete'].')
</a>
</td>
</tr>
</table>',
);
$i++;
}
$smcFunc['db_free_result']($request);
return $list;
}


Kindred

Since there are many other mods that store and pull information from the database, with no issues, your hypothesis is pretty certainly Incorrect
Сл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."

Proderf

Quote from: Kindred on October 10, 2017, 11:22:05 PM
Since there are many other mods that store and pull information from the database, with no issues, your hypothesis is pretty certainly Incorrect


thanks for the help :)

what i meant is that the mod itself is not pulling properly; this only started happening with 2.0.14

Kindred

2.0.14 did change some things for php7 and supporting https. So, there is a chance that this mod will have to be updated
Сл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."

Proderf

That's probably accurate. The mod worked before 2.0.14 so it probs just needs a bit of tweaking.

Aleksi "Lex" Kilpinen

I haven't tried to actually use it ( so try this at your own risk ).

In theory, you should be able to bypass that problem and get all the info to show by simply editing the code like this

Find

function list_CustomForm_fields($nul, $nul, $nul, $id)


Replace with

function list_CustomForm_fields($nul3, $nul2, $nul, $id)


Those are empty parameters anyways. However, I have no idea if the forms will work after this edit....
Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

thunderchld

I do apologize if this has already been asked in this thread. I looked, but I cannot find it.

Is it possible to have a Custom Form post to a moderated board?  Goal: Person fills out form, it goes to moderated state.  Person can see the post, I can see the post, nobody else can see the post.  This would get me a work around until I can find an event registration mod

Raths Rants

Quote from: thunderchld on January 01, 2018, 05:12:10 PM
I do apologize if this has already been asked in this thread. I looked, but I cannot find it.

Is it possible to have a Custom Form post to a moderated board?  Goal: Person fills out form, it goes to moderated state.  Person can see the post, I can see the post, nobody else can see the post.  This would get me a work around until I can find an event registration mod

At a base level no. The user must have permission to view where the submission is sent. You can add a completed submission page under "Submit Redirect" that let's the user know it has been successfully completed.

With that said. It doesn't mean it can't be done. It's just not a feature out of the box.
The DDC Network
a lot of hard work goes into easy

Proderf

Quote from: Aleksi "Lex" Kilpinen on December 23, 2017, 08:54:54 AM
I haven't tried to actually use it ( so try this at your own risk ).

In theory, you should be able to bypass that problem and get all the info to show by simply editing the code like this

Find

function list_CustomForm_fields($nul, $nul, $nul, $id)


Replace with

function list_CustomForm_fields($nul3, $nul2, $nul, $id)


Those are empty parameters anyways. However, I have no idea if the forms will work after this edit....



TY SO MUCH this worked

cloudstrife465

when i try to access the custom mod on 2.0.10 in the modifcation settings its giving me this error code

what do i need to do to fix it

This page isn't working
rrgscommunity.epizy.com is currently unable to handle this request.
HTTP ERROR 500

Advertisement: