Home Forums Plugin Support WP User Frontend (Free Version) How to set the WPUF Form as the default form

This topic is: resolved

This topic contains 7 replies, has 4 voices, and was last updated by  Tareq Hasan 5 years, 7 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #3503

    akh701
    Participant
    Post count: 2

    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

    #3513

    Tareq Hasan
    Keymaster
    Post count: 2831

    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).

    #3522

    akh701
    Participant
    Post count: 2

    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

    #3525

    Tareq Hasan
    Keymaster
    Post count: 2831

    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.

    #3693

    skone
    Participant
    Post count: 6

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

    #4677

    akh701
    Participant
    Post count: 2

    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

    #6979

    seospec
    Participant
    Post count: 13

    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?

    #7022

    Tareq Hasan
    Keymaster
    Post count: 2831

    How did you tried? It should've worked!

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘How to set the WPUF Form as the default form’ is closed to new replies.