I got it to work for non-AJAX forms by doing this hack.
Assuming you’re using v0.13, open tdomf-form-post.php and go to the end of the file. Change it like this:
if(!isset($post_id) || !$publish || !tdomf_get_option_form(TDOMF_OPTION_REDIRECT,$form_id)) {
// Go back to form with args
//
$redirect_url = $_POST['redirect'];
if($publish || isset($post_id)) { $redirect_url = 'http://thedeadone.net'; }
if($save_post_info) {
$args = $_POST;
} else {
$args = array();
}
if($hide_form) {
$args['tdomf_no_form_'.$form_id] = true;
}
$args['tdomf_post_message_'.$form_id] = $message;
$form_data['tdomf_form_post_'.$form_id] = $args;
} else {
unset($form_data['tdomf_form_post_'.$form_id]);
#$redirect_url = get_permalink($post_id);
$redirect_url = 'http://thedeadone.net';
}
Change 'http://thedeadone.net' to the URL of your choice.
Now if you have AJAX, that is different. Hold on a mo while I figure that one out...
Now to do this for AJAX enabled forms, you have to modify a different file: tdomf-form-ajax.php (again assuming v0.13), open the file and go to line 154 (or so).
// Now either generate a preview or create a post
//
if($_POST['tdomf_action'] == "post") {
tdomf_log_message("Someone is attempting to submit something");
$message = tdomf_validate_form($tdomf_args,false);
if($message == NULL) {
$args = $tdomf_args;
$args['ip'] = $_SERVER['REMOTE_ADDR'];
$retVal = tdomf_create_post($args);
// If retVal is an int it's a post id
if(is_int($retVal)) {
if($is_edit) {
$edit_id = $retVal;
$edit = tdomf_get_edit($edit_id);
// @todo could probably test if $edit is real or not before proceeding
$post_id = $edit->post_id;
if($edit->state == 'approved') {
if(tdomf_get_option_form(TDOMF_OPTION_REDIRECT,$form_id)) {
#die( "tdomfRedirect$form_id('".get_permalink($post_id)."');" );
die( "tdomfRedirect$form_id('http://thedeadone.net/download/tdo-mini-forms-wordpress-plugin/');" );
} else {
tdomf_ajax_exit($form_id,tdomf_get_message_instance(TDOMF_OPTION_MSG_SUB_PUBLISH,$form_id,false,$post_id),true,false,$post_id);
}
} else if($edit->state == 'spam') {
tdomf_ajax_exit($form_id,tdomf_get_message_instance(TDOMF_OPTION_MSG_SUB_SPAM,$form_id),true,false,$post_id);
} else { // unapproved
tdomf_ajax_exit($form_id,tdomf_get_message_instance(TDOMF_OPTION_MSG_SUB_MOD,$form_id,false,$post_id),true,false,$post_id);
}
} else {
$post_id = $retVal;
if(get_post_status($post_id) == 'publish') {
if(tdomf_get_option_form(TDOMF_OPTION_REDIRECT,$form_id)) {
#die( "tdomfRedirect$form_id('".get_permalink($post_id)."');" );
die( "tdomfRedirect$form_id('http://thedeadone.net/download/tdo-mini-forms-wordpress-plugin/');" );
} else {
tdomf_ajax_exit($form_id,tdomf_get_message_instance(TDOMF_OPTION_MSG_SUB_PUBLISH,$form_id,false,$post_id),true,false,$post_id);
}
} else if(get_post_status($post_id) == 'future') {
tdomf_ajax_exit($form_id,tdomf_get_message_instance(TDOMF_OPTION_MSG_SUB_FUTURE,$form_id,false,$post_id),true,false,$post_id);
} else if(get_post_meta($post_id, TDOMF_KEY_SPAM)) {
tdomf_ajax_exit($form_id,tdomf_get_message_instance(TDOMF_OPTION_MSG_SUB_SPAM,$form_id),true,false,$post_id);
} else {
#tdomf_ajax_exit($form_id,tdomf_get_message_instance(TDOMF_OPTION_MSG_SUB_MOD,$form_id,false,$post_id),true,false,$post_id);
die( "tdomfRedirect$form_id('http://thedeadone.net/download/tdo-mini-forms-wordpress-plugin/');" );
}
}
// If retVal is a string, something went wrong!
} else {
tdomf_ajax_exit($form_id,tdomf_get_message_instance(TDOMF_OPTION_MSG_SUB_ERROR,$form_id,false,false,$retVal),false,false,$post_id);
}
} else {
tdomf_ajax_exit($form_id,tdomf_get_message_instance(TDOMF_OPTION_MSG_SUB_ERROR,$form_id,false,false,$message),false,false,$post_id);
}
And, obviousily change 'http://thedeadone.net/download/tdo-mini-forms-wordpress-plugin/' to the URL of your choice.
I've tested this and it works.
Also, I've left these changes in the code but commented out. So v0.13.1 will have them. A near-future version, I should be able to provide them as options on a per form basis.
toul
Guest
May 10th, 2009 at 5:11 pm
yep. i am working hard to find a solution but i did not make it…that kills me!
Permalink | Quote