How to set the WPUF Form as the default form

This topic contains 7 reply and 4 voices, and was last updated by Tareq Hasan 10 years, 8 months ago
Viewing 7 Posts - 1 through 7 (of 7 total)
Author Posts
May 11, 2013 at 12:41 pm 3503
Tareq Hasan Hi I have two issues please 1. How can I set all the posts to have the same form by default as am only using one form. instead of me having to go to the back end changing each post on its own. 2. when a members edits their post and updates it, the commenting section gets closed on that post. How can I fix this thanks
May 11, 2013 at 3:15 pm 3513
Tareq Hasan Tareq Hasan

1. There isn’t any bulk update system right now. But you can update all your posts form association using this code below. Put that code on your theme functions.php, reload the page once and remove the code.

$form_id = 143;

$all_posts = new WP_Query( array('posts_per_page' => -1) );
if ( $all_posts->have_posts() ) {
    $posts = $all_posts->get_posts();

    foreach ($posts as $p) {
        update_post_meta( $p->ID, '_wpuf_form_id', $form_id );
    }
}

2. Make sure you are using the latest version (2.1.4).

May 12, 2013 at 8:15 am 3522
akh701 akh701

Hi Tareq
thanks for the reply. regarding 1. even thought it solvs part of the problem but I cant keep doing it every time. as I am importing youtube videos as posts automatically, And I won’t be able to keep an eye on the number of videos being imported nor would I have the time to keep making sure every new video imported has the form enabled so my members can edit them from the front end.

so if there is a way to make it the default form then that would be great thanks

May 12, 2013 at 11:39 am 3525
Tareq Hasan Tareq Hasan

So you can listen to posts when they inserts and set the form id like this:
[php]
function wpufe_auto_set_formid( $post_id, $post ) {
$form_id = 143;

if ( $post->post_type == ‘post’ ) {
update_post_meta( $post_id, ‘_wpuf_form_id’, $form_id );
}
}

add_action( ‘wp_insert_post’, ‘wpufe_auto_set_formid’, 10, 2 );
[/php]

Every new posts will have this form id automatically.

May 16, 2013 at 4:58 am 3693
skone skone

Just chiming in on this to say it works great to batch update. Thanks!

June 8, 2013 at 8:13 pm 4677
akh701 akh701

Hi
I have updated to the latest version yet still when a user updates a post the commenting still gets closed and no commenting is allowed until I go from the back end and enable commenting again

August 15, 2013 at 10:40 am 6979
seospec seospec

I have the same query. I posted a different thread. But I can’t find it now. The code you gave it’s not working for me. So can you take a look to my site?

August 16, 2013 at 7:35 pm 7022
Tareq Hasan Tareq Hasan

How did you tried? It should’ve worked!

Viewing 7 Posts - 1 through 7 (of 7 total)