Hi,
I recently started a weblog about movies at the german TV and some people requested a form for non-registered users. That’s how I came to TDO Miniforms.
I need a lot of select boxes (year, month, day, hour, minute, channel) – inserting the values via the widgets is very boring and exhausting, so I made it by hand with the form hacker. Now I can’t change the alignment of the inserted values in the widget without having to change everything, because they appear as “textfield” again (hacking forms didn’t change the widget).
Another question is about the output. I would like to create a url to a recording-website from the data stored in the custom fields (e.g. http://www.createrecording.de/create.php?startdate=value1&starttime=value2&station=value3 etc.). Any ideas about how to do this?
admin said:
Won’t work. The Form Hacker should be used to hack the appearance of the form, nothing else. It does not modify the backend, so adding extra text-fields in the form hacker without adding the widgets to the form will do nothing. You could add a “Append to Content” widget and manually write the code to add values from the text fields to the post. But thats just plain mad!i guess, if you’re adding lots of custom fields it is time consuming, but then it’s really only a once-off job isnt it?
Well, that is what I was afraid off – would’ve been to easy for me, only to copy & paste.
admin said:
You’ll have to be a little more specific about what you mean. Do you mean add it to the post or just have it on the page?If you’re storing the data in Custom Fields, just use the Custom Fields API to add in your theme.
You could also add the “Append to Content” widget to your form, below the relevant fields and then write the same piece of PHP code to add it to the post. FYI heres an example that uses Custom Fields to change the title of the post – some slight changes and you can do the URL.
![]()
I’m not sure about whether you mean the same thing as I do for my english is not that good.
To go further into detail: There is a website onlinetvrecorder.com. It records almost everything in the german TV for members, but due to german rights you need to assign the recordings.
In my blog people can write if they get to know about good films (maybe insiders’ tip) and should leave a recording link. In the form are the custom-fields (currently numbered 1-7) with the information you need for a correct recording link (take a look here: http://kuschelknaeuel.de/filmtipp/?page_id=108 – It’s overwritten with “Sendungsdaten*” and “Sender”).
If these fields are what you get with get_post_meta(), I have no more problems (except for my laziness
). If not, please tell me.
Thanks a lot in advance,
Kuschelknaeuel (in english: cuddle-clew ^^)
For some reason Aksimet is flagging your comments as spam. I’ve de-spammed them. Don’t know why. Anyway…
kuschelknaeuel said:
I’m not sure about whether you mean the same thing as I do for my english is not that good.
To go further into detail: There is a website onlinetvrecorder.com. It records almost everything in the german TV for members, but due to german rights you need to assign the recordings.
In my blog people can write if they get to know about good films (maybe insiders’ tip) and should leave a recording link. In the form are the custom-fields (currently numbered 1-7) with the information you need for a correct recording link
Okay. I’m still not sure what you’re trying to do. What specifically do you want to do with the recording link/URL after someone has submitted it? Do you want publish it on the post or is it used internally for some other application?
(take a look here: http://kuschelknaeuel.de/filmtipp/?page_id=108 – It’s overwritten with “Sendungsdaten*” and “Sender”).
If these fields are what you get with get_post_meta(), I have no more problems (except for my laziness). If not, please tell me.
Are you saying that, when you use get_post_meta() after submission, you only get the values of “Sendungsdaten*” and “Sender”? Make sure that each Custom Field has a unique key. If it doesn’t, it’ll stick them all in the first custom field.
hmm, again my last answer doesn’t appear in here – maybe it’s in the spam?
Now I have a new problem – I wanted to add two custom fields of which I thought they might be helpful (ending time: hour and minute). They should be select-fields but after hitting save changes and looking again at their properties, nothing changed. They still have no title and this cryptic “TDOMF Form #2 Custom Field #8″ unique key, textfields and so on.
So far: thanks a lot for your help.
As I can’t edit my post, I think I’m going to spam
So, I saved and deleted the “old” form and created a new one.
For the first 7 custom-widgets everything went fine. When I came to custom-widget no. 8 it saved nothing. Being prepared for something like that I only had few changes (Title, unique key, textfield to select) and, as expected, the changes weren’t saved.
So I took a look at my database and I saw in table wp_ft_tdomf_table_widgets the tdomf_customfields_widget_7 record is the last one. I think that’s the problem. I could solve this manually in the database by adding tdomf_customfields_widget_8 & tdomf_customfields_widget_9 to the table. Imho that would be to much work, but as long as there’s no other solution I’m willing to do this.
kuschelknaeuel said:
So, I saved and deleted the “old” form and created a new one.
For the first 7 custom-widgets everything went fine. When I came to custom-widget no. 8 it saved nothing. Being prepared for something like that I only had few changes (Title, unique key, textfield to select) and, as expected, the changes weren’t saved.
So I took a look at my database and I saw in table wp_ft_tdomf_table_widgets the tdomf_customfields_widget_7 record is the last one. I think that’s the problem. I could solve this manually in the database by adding tdomf_customfields_widget_8 & tdomf_customfields_widget_9 to the table. Imho that would be to much work, but as long as there’s no other solution I’m willing to do this.
I suspect I know what might be the cause of this. Any chance you can export your form and post it somewhere for me to download?
kuschelknaeuel said:
Update (really sorry for posting endless): Can’t even solve the problem by creating a record named tdomf_customfields_widget_8
Next thing I’m going to try is a re-install of tdomf…
I wouldn’t! You’ll only drive yourself up the wall. Instead could you tell me what browser you using to do the changes and also would it be possible to get a dump of some the info in your phpinfo?
admin said:
I suspect I know what might be the cause of this. Any chance you can export your form and post it somewhere for me to download?
Of course I can: here it is
admin said:
I wouldn’t! You’ll only drive yourself up the wall. Instead could you tell me what browser you using to do the changes and also would it be possible to get a dump of some the info in your phpinfo?I’m using Firefox 3.0.3, Scripts allowed on my domain, AddBlock Plus activated. Which part of my phpinfo do you need? Won’t post the whole thing
![]()
I successfully imported the form into my test bed and was easily able to configure Custom Field 8 and add a Custom Field 9. I’m afraid my suspicion was not valid here and I suspect there is some host configuration that is preventing this.
Could you check, in your phpinfo, what your ‘memory_limit’ is set to? On my host configuration it is set very high, around 128M.
admin said:
I successfully imported the form into my test bed and was easily able to configure Custom Field 8 and add a Custom Field 9. I’m afraid my suspicion was not valid here and I suspect there is some host configuration that is preventing this.Could you check, in your phpinfo, what your ‘memory_limit’ is set to? On my host configuration it is set very high, around 128M.
It has the limit at 128M too.
kuschelknaeuel said:
It has the limit at 128M too.
Okay. Scratch that line of inquiry.
Are you using a translation for TDOMF? It might also be worth disabling all other plugins, if you have any active, just to make sure. If you’re using wp-super-cache that can require some additional work to properly disable.
german version of wordpress, english version of tdomf (didn’t find a german one), no other plugins except Askimet active. Disabled Askimet, retried configuring custom field 8, no success.
I did very few changes on the original WP – only “Welcome”, “HowTo” and “Credits” as pages. Activated the Askimet-Plugin, added a few links and link categories.. the usual stuff.
fyi: PHP is version 5.2.6 (latest)
Output from last try:
[xx.xx.xx.xx][16-10-08(14:35:12)] tdomf-form-post: No Form ID set!
[xx.xx.xx.xx][16-10-08(14:35:13)] AJAX: Using old argument method
[xx.xx.xx.xx][16-10-08(14:35:13)] tdomf-form-ajax: No Form ID set!
[admin][16-10-08(14:36:26)] tdomf-edit-form.php:620: current memory footprint: 15128212
[admin][16-10-08(14:36:26)] tdomf-edit-form.php:638: current memory footprint: 15199028
[admin][16-10-08(14:36:26)] tdomf-edit-form.php:441: current memory footprint: 15142960
[admin][16-10-08(14:36:26)] tdomf-edit-form.php:445: current memory footprint: 15145040
[admin][16-10-08(14:36:26)] tdomf-edit-form.php:453: current memory footprint: 15146956
[admin][16-10-08(14:36:26)] tdomf-edit-form.php:455: current memory footprint: 15205224
[admin][16-10-08(14:36:26)] tdomf-edit-form.php:458: current memory footprint: 15157844
[xx.xx.xx.xx][16-10-08(14:36:27)] tdomf-form-post: No Form ID set!
[xx.xx.xx.xx][16-10-08(14:36:28)] AJAX: Using old argument method
[xx.xx.xx.xx][16-10-08(14:36:28)] tdomf-form-ajax: No Form ID set!
[admin][16-10-08(14:36:42)] tdomf-edit-form.php:620: current memory footprint: 15261076
[admin][16-10-08(14:36:42)] tdomf-edit-form.php:638: current memory footprint: 15332692
[admin][16-10-08(14:36:42)] tdomf-edit-form.php:649: current memory footprint: 15278444
[admin][16-10-08(14:36:43)] tdomf-edit-form.php:441: current memory footprint: 15276804
[admin][16-10-08(14:36:43)] tdomf-edit-form.php:445: current memory footprint: 15278048
[admin][16-10-08(14:36:43)] tdomf-edit-form.php:453: current memory footprint: 15280100
[admin][16-10-08(14:36:43)] tdomf-edit-form.php:455: current memory footprint: 15339512
[admin][16-10-08(14:36:43)] tdomf-edit-form.php:458: current memory footprint: 15294640
[xx.xx.xx.xx][16-10-08(14:36:44)] tdomf-form-post: No Form ID set!
[xx.xx.xx.xx][16-10-08(14:36:44)] AJAX: Using old argument method
[xx.xx.xx.xx][16-10-08(14:36:44)] tdomf-form-ajax: No Form ID set!
Just replaced the IP adresses ![]()
But if it was a restriction of my database, why and how could I have done the first seven custom fields?
I can’t figure why, on your setup, that an 8th or 9th Custom Field would not save but on my setup it does. The problem is that it’s a bit of a pain to trace through the code.
If you’re willing, you could insert this line of code in widgets/tdomf-customfield-widget.php around line 305:
if(is_array($params) && count($params) >= 1){
$number = $params[0];
}
tdomf_log_message( "Processing control options for 'tdomf_customfields_widget_$number' on form $form_id..." );
$options = tdomf_widget_customfields_get_options($number,$form_id);
And around line 331:
if ( $options != $newoptions ) {
$options = $newoptions;
tdomf_log_message( "Saving options for 'tdomf_customfields_widget_$number' on form $form_id: <pre>" . htmlentities(var_export($options,true)) . '</pre>' );
tdomf_set_option_widget('tdomf_customfields_widget_'.$number, $options,$form_id);
}
What this will do is put lines into the log to say if it’s attempting to process the custom field widget for saving and what its attempting to save.
Hoping, this helps
[xx.xx.xx.xx][16-10-08(15:29:23)] tdomf-form-post: No Form ID set!
[xx.xx.xx.xx][16-10-08(15:29:24)] AJAX: Using old argument method
[xx.xx.xx.xx][16-10-08(15:29:24)] tdomf-form-ajax: No Form ID set!
[xx.xx.xx.xx][16-10-08(15:29:27)] tdomf-form-post: No Form ID set!
[xx.xx.xx.xx][16-10-08(15:29:28)] AJAX: Using old argument method
[xx.xx.xx.xx][16-10-08(15:29:28)] tdomf-form-ajax: No Form ID set!
[..]
[admin][16-10-08(15:29:32)] tdomf-edit-form.php:458: current memory footprint: 15163384
[admin][16-10-08(15:29:33)] Processing control options for ‘tdomf_customfields_widget_1′ on form 1…
[admin][16-10-08(15:29:33)] Processing control options for ‘tdomf_customfields_widget_2′ on form 1…
[admin][16-10-08(15:29:33)] Processing control options for ‘tdomf_customfields_widget_3′ on form 1…
[admin][16-10-08(15:29:33)] Processing control options for ‘tdomf_customfields_widget_4′ on form 1…
[admin][16-10-08(15:29:33)] Processing control options for ‘tdomf_customfields_widget_5′ on form 1…
[admin][16-10-08(15:29:33)] Processing control options for ‘tdomf_customfields_widget_6′ on form 1…
[admin][16-10-08(15:29:33)] Processing control options for ‘tdomf_customfields_widget_7′ on form 1…
[admin][16-10-08(15:29:33)] Processing control options for ‘tdomf_customfields_widget_8′ on form 1…
[admin][16-10-08(15:29:33)] Processing control options for ‘tdomf_customfields_widget_9′ on form 1…
[admin][16-10-08(15:29:33)] Processing control options for ‘tdomf_customfields_widget_10′ on form 1…
[admin][16-10-08(15:29:33)] Processing control options for ‘tdomf_customfields_widget_11′ on form 1…
[..]
[admin][16-10-08(15:29:47)] tdomf-edit-form.php:458: current memory footprint: 15301856
[admin][16-10-08(15:29:48)] Processing control options for ‘tdomf_customfields_widget_1′ on form 1…
[admin][16-10-08(15:29:48)] Saving options for ‘tdomf_customfields_widget_1′ on form 1:array (
‘title’ => ‘Datum’,
‘key’ => ’startdate_day’,
‘required’ => false,
‘preview’ => true,
‘defval’ => ”,
’size’ => 30,
‘cols’ => 40,
‘rows’ => 1,
‘type’ => ’select’,
‘append’ => false,
‘format’ => ‘%%VALUE%%. Â ‘,
’s-multiple’ => false,
’s-values’ => ‘01:01;02:02;03:03;04:04;05:05;06:06;07:07;08:08;09:09;10:10;11:11;12:12;’,
’s-defaults’ => ‘test’,
)[admin][16-10-08(15:29:48)] Processing control options for ‘tdomf_customfields_widget_2′ on form 1…
[admin][16-10-08(15:29:48)] Saving options for ‘tdomf_customfields_widget_2′ on form 1:array (
‘title’ => ‘Monat: ‘,
‘key’ => ’startdate_month’,
‘required’ => false,
‘preview’ => true,
‘defval’ => ”,
’size’ => 30,
‘cols’ => 40,
‘rows’ => 1,
‘type’ => ’select’,
‘append’ => false,
‘format’ => ”,
’s-multiple’ => false,
’s-values’ => ‘Januar:01;Februar:02;März:03;April:04;Mai:05;Juni:06;Juli:07;August:08;September:09;Oktober:10;November:11;Dezember:12;’,
’s-defaults’ => ‘test’,
)[..]
[admin][16-10-08(15:30:25)] tdomf-edit-form.php:458: current memory footprint: 15170612
[admin][16-10-08(15:30:26)] Processing control options for ‘tdomf_customfields_widget_1′ on form 1…
[admin][16-10-08(15:30:26)] Processing control options for ‘tdomf_customfields_widget_2′ on form 1…
[admin][16-10-08(15:30:26)] Processing control options for ‘tdomf_customfields_widget_3′ on form 1…
[admin][16-10-08(15:30:26)] Processing control options for ‘tdomf_customfields_widget_4′ on form 1…
[admin][16-10-08(15:30:26)] Processing control options for ‘tdomf_customfields_widget_5′ on form 1…
[admin][16-10-08(15:30:26)] Processing control options for ‘tdomf_customfields_widget_6′ on form 1…
[admin][16-10-08(15:30:26)] Processing control options for ‘tdomf_customfields_widget_7′ on form 1…
[admin][16-10-08(15:30:26)] Processing control options for ‘tdomf_customfields_widget_8′ on form 1…
[admin][16-10-08(15:30:26)] Processing control options for ‘tdomf_customfields_widget_9′ on form 1…
[admin][16-10-08(15:30:26)] Processing control options for ‘tdomf_customfields_widget_10′ on form 1…
[admin][16-10-08(15:30:26)] Processing control options for ‘tdomf_customfields_widget_11′ on form 1…
Maybe I should deactivate my browser plugins while working on tdomf – I don’t know if the problem lies there.
I only cutted off the recurring things like
[admin][16-10-08(15:29:47)] tdomf-edit-form.php:458: current memory footprint: 15301856
and
[xx.xx.xx.xx][16-10-08(15:29:28)] tdomf-form-ajax: No Form ID set!
nothing else. If there was something about custom field 8 I wouldn’t remove it.
If you can, can you put these two pieces of trace into admin/tdomf-edit-form.php?
do_action('tdomf_control_form_start',$form_id,$mode);
$widgets = tdomf_filter_widgets($mode,$tdomf_form_widgets);
tdomf_log_message( 'looking at all widgets: <pre>'.htmlentities(var_export($widgets,true)).'</pre>');
$widgets_control = tdomf_filter_widgets($mode,$tdomf_form_widgets_control);
tdomf_log_message( 'looking at filtered widgets (control): <pre>'.htmlentities(var_export($widgets_control,true)).'</pre>');
I suspect that the other widgets are accidentially getting filtered out… not sure why as it doesn’t happen in my setup.
I can’t explain why it’s not working on your configuration. I have one suggested change left. In widgets/tdomf-customfiled-widgets.php line 308:
// Store settings for this widget
if (isset($_POST["customfields-$number-submit"]) ) {
$newoptions['title'] = $_POST["customfields-title-$number"];
What host software are you using? Is it a LAMP setup?
Just changed what you told me, but that had no effect.
I think it is a LAMP setup. I’m not sure, because I only rent the webspace.
It would make sense to me, if none of my changes were saved, but the (magical) eight? Shouldn’t make a difference.
Wow, I have to revoke this statement. Just tried to change some of the other custom fields (which are, at the moment, placeholders with names) and they don’t save the changes any more. That is really amazing!
The most promising option seems to be the complete removal of the plugin and a retry with a clear installation. Maybe with the current form saved and re-imported.
Well, I will send the phpinfo to you, but via email. But I can tell you that I can’t change anything except using php 4.
I have no access to detailed error logs on the server, but if there were further problems, I would know.
Maybe I’ll do it the other way round: Install and configure locally and export the local form to my server.
I’ve gone through your phpinfo. Thank you. The first thing I noticed was that your post_max_size was set to only 8M but on mine it was set to 20M. However on testing the lower size, saving the form still worked.
The next thing I saw was that your host uses “Suhosin Extension” and also that it sets the post.max_vars to 200. I can’t replicate this on my host as they don’t have the suhosin extension installed. However I added some debug and the post max variables is actually 326, so it looks like suhosin may be capping the post variables and so preventing you from saving options of several elements of the form. I assume it’s probably a bit random on what it caps too.
I assume you can increase this value by creating a php.ini file and placing it in wp-admin with the contents set to something like this:
suhosin.post.max_array_depth = 500;
This will affect any admin page. If that doesn’t work, you may need to talk to your host provider about it.
Fingers crossed this is it!
You’re right, but it isn’t the right variable. The suhosin extension has a variable to set it to simulation-mode.
From the Configuration Page of hardened-php:
If you fear that Suhosin breaks your application, you can activate Suhosin’s simulation mode with this flag. When Suhosin runs in simulation mode, violations are logged as usual, but nothing is blocked or removed from the request. (Transparent Encryptions are NOT deactivated in simulation mode.)
I set this flag and my changes appear. I know it may be insecure, but as you said it only affects my admin-pages. I will go on trying which variable has to be set to which value until it fits, so I can activate this extension again.
Thanks a lot, great job done here!
Kuschelknaeuel
Here I go again, coming back to my problem with creating the url.
I tried to change the title as explained in Setting up custom fields… with one of my values. i.e. I added a “Append to Post Content”-Widget and inserted the following code:
$post_id,
"post_title" => $post_title);
sanitize_post($postdata,"db");
wp_update_post($postdata);
?>
So even if there was no startdate_day key (but there is) it should alter the title – or am I wrong?
I only try to access the fields, and, like described in the thread you linked, add to the title. It’t the first step towards using the data in the custom fields to create a link. But it doesn’t change anything: whether I try to replace the title or to add a custom field value to it. Whether I’m using the key or the %%WIDGET:customfields-1%% macro.
<?php
$start_day = get_post_meta($post_id, 'startingdate_day', true);
if ($start_day != false)
{
$post_title .= ', '.$start_day;
}
else
{
$post_title .= ', something went wrong';
}
$postdata = array(
"ID" => $post_id,
"post_title" => $post_title);
sanitize_post($postdata,"db");
wp_update_post($postdata);
?>
By now it works.
There’s an error in the description you posted earlier. To access the post title the variable is content_title. To alter the title the code looks like this:
<php
$start_day = get_post_meta($post_id, 'startdate_day', true);
$start_month = get_post_meta($post_id, 'startdate_month', true);
$start_year = get_post_meta($post_id, 'startdate_year', true);
$sender = get_post_meta($post_id, 'station', true);
$content_title .= " - ".$sender.", ".$start_day.". ".$start_month.". ".$start_year;
$postdata = array(
"ID" => $post_id,
"post_title" => $content_title);
sanitize_post($postdata,"db");
wp_update_post($postdata);
?>
with this changes now everything works fine.
admin
Guest
October 14th, 2008 at 1:02 pm
Won’t work. The Form Hacker should be used to hack the appearance of the form, nothing else. It does not modify the backend, so adding extra text-fields in the form hacker without adding the widgets to the form will do nothing. You could add a “Append to Content” widget and manually write the code to add values from the text fields to the post. But thats just plain mad!
i guess, if you’re adding lots of custom fields it is time consuming, but then it’s really only a once-off job isnt it?
You’ll have to be a little more specific about what you mean. Do you mean add it to the post or just have it on the page?
If you’re storing the data in Custom Fields, just use the Custom Fields API to add in your theme.
You could also add the “Append to Content” widget to your form, below the relevant fields and then write the same piece of PHP code to add it to the post. FYI heres an example that uses Custom Fields to change the title of the post – some slight changes and you can do the URL.
Permalink | Quote