• Resolved darko1970

    (@darko1970)


    Kako da napravim kopiju 500 formi, tako da se imenu formi automatski dodeli redni broj. Npr. Moja forma se zove “TEST”. Ho?u da automatski napravim 500 istih formi koje ?e se zvati “TEST1”, “TEST2″…. “TEST500”.

    Hvala

    • This topic was modified 11 months ago by darko1970.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @darko1970

    I hope you are doing well today.

    By default, this will be not possible. I pinged our SLS. Team to review your query to check what can be done in that matter. We will post an update here as soon as more information is available.

    Kind Regards,
    Kris

    Hi @darko1970,

    Hope this message finds you well.

    Our Devs shared this mu-plugin:

    add_action('admin_init', 'wpmudev_attach_pdf_to_form');
    function wpmudev_attach_pdf_to_form() {
        if ( ! isset( $_GET['page'] ) ) {
    		return;
    	}
    
    	if ( $_GET['page'] != 'forminator-cform' ) {
    		return;
    	}
    
        if ( empty( $_GET['form-duplicate'] ) ) {
    		return;
    	}
    
        $form_id = $_GET['form-duplicate'];
    
        if ( empty( $form_id ) ) {
            return;
        }
    
        $form_post = (array) get_post( $form_id ); // Post to duplicate.
        if ( ! $form_post ) {
            return;
        }
    
        unset( $form_post['ID'] ); // Remove id, wp will create new post if not set.
        for( $i=0; $i < 500; $i++ ) {
            $incr_id = $i + 1;
            $form_post['post_title'] = $form_post['post_title'] . $incr_id;
            $new_form_id = wp_insert_post( $form_post );
            $form_meta = get_post_meta( $form_id, 'forminator_form_meta', true );
            $form_meta['settings']['formName'] = $form_meta['settings']['formName'] . $incr_id;
            $form_meta['settings']['form_id'] = $new_form_id;
            if ( ! update_post_meta( $new_form_id, 'forminator_form_meta', $form_meta ) ) {
                return;
            }
        }
    }

    You might need to install it as a mu-plugin following the instructions on this link https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins.

    After adding it, you need to visit the form listing page. Then in the URL of that page should append the parameter form-duplicate=your_form_id like this: https://localsite.local/wp-admin/admin.php?page=forminator-cform&form-duplicate=2690 and reload the page. After some time it will create 500 copies of that form ID.

    If you need fewer copies then in this lin:

    for( $i=0; $i < 500; $i++ ) {

    Change 500 to the number of copies required.

    Let us know the results.

    Best regards,
    Laura

    Hi @darko1970,

    We haven’t heard from you in a while, I’ll go and mark this thread as resolved. Note that you can still reply on this topic.

    If you have any additional questions or require further help, please let us know!

    Best regards,
    Laura

    Thread Starter darko1970

    (@darko1970)

    Hello @wpmudevsupport3 ,

    Honestly, I believe this is all good, but I’m a total beginner and I’m afraid to dive into this, even though I really need it. Also, it would greatly help me to have the ability to copy multiple pages of the website I’ve created in Elementor at once. Perhaps there is a plugin that makes this easier to do.

    Thanks again,
    Regards

    • This reply was modified 10 months, 2 weeks ago by darko1970.
    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @darko1970,

    I understand your concern. However, there aren’t any plugins that I found that could help create copies of a Forminator form in bulk. I would appreciate it if you could try the workaround on your staging website or development environment. Please feel free to get back to us if you need any further clarification, we are happy to help.

    Elementor provides an option to create a duplicate of a page, however, I was unable to find an option to generate multiple copies of the same page. Here is the documentation on how to create a duplicate page with Elementor: https://elementor.com/help/how-can-i-duplicate-an-elementor-page-using-the-wordpress-dashboard/

    For further assistance regarding Elementor, please get in touch with Elemetor support as they will be more resourceful regarding this.

    Kind Regards,
    Nebu John

    Thread Starter darko1970

    (@darko1970)

    I tried to follow the instructions, however, the result is this. I received a ‘must use’ plugin, but it’s not working and an error code appears on the WordPress dashboard. Where did I go wrong?

    mudev_attach_pdf_to_form’); function wpmudev_attach_pdf_to_form() { if ( ! isset( $_GET[‘page’] ) ) { return; } if ( $_GET[‘page’] != ‘forminator-cform’ ) { return; } if ( empty( $_GET[‘form-duplicate’] ) ) { return; } $form_id = $_GET[‘form-duplicate’]; if ( empty( $form_id ) ) { return; } $form_post = (array) get_post( $form_id ); // Post to duplicate. if ( ! $form_post ) { return; } unset( $form_post[‘ID’] ); // Remove id, wp will create new post if not set. for( $i=0; $i < 3; $i++ ) { $incr_id = $i + 1; $form_post[‘post_title’] = $form_post[‘post_title’] . $incr_id; $new_form_id = wp_insert_post( $form_post ); $form_meta = get_post_meta( $form_id, ‘forminator_form_meta’, true ); $form_meta[‘settings’][‘formName’] = $form_meta[‘settings’][‘formName’] . $incr_id; $form_meta[‘settings’][‘form_id’] = $new_form_id; if ( ! update_post_meta( $new_form_id, ‘forminator_form_meta’, $form_meta ) ) { return; } } }

    • This reply was modified 10 months, 2 weeks ago by darko1970.
    Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    Hello @darko1970,

    It might be happening due to a missing opening tag.

    Please try adding <?php on the first line, before the rest of the previously shared code, like this:

    <?php
    
    add_action('admin_init', 'wpmudev_attach_pdf_to_form');
    function wpmudev_attach_pdf_to_form() {
        if ( ! isset( $_GET['page'] ) ) {
    		return;
    	}
    
    	if ( $_GET['page'] != 'forminator-cform' ) {
    		return;
    	}
    
        if ( empty( $_GET['form-duplicate'] ) ) {
    		return;
    	}
    
        $form_id = $_GET['form-duplicate'];
    
        if ( empty( $form_id ) ) {
            return;
        }
    
        $form_post = (array) get_post( $form_id ); // Post to duplicate.
        if ( ! $form_post ) {
            return;
        }
    
        unset( $form_post['ID'] ); // Remove id, wp will create new post if not set.
        for( $i=0; $i < 500; $i++ ) {
            $incr_id = $i + 1;
            $form_post['post_title'] = $form_post['post_title'] . $incr_id;
            $new_form_id = wp_insert_post( $form_post );
            $form_meta = get_post_meta( $form_id, 'forminator_form_meta', true );
            $form_meta['settings']['formName'] = $form_meta['settings']['formName'] . $incr_id;
            $form_meta['settings']['form_id'] = $new_form_id;
            if ( ! update_post_meta( $new_form_id, 'forminator_form_meta', $form_meta ) ) {
                return;
            }
        }
    }

    Please take our apologies for the confusion. Let us know if you need any further assistance.

    Best Regards,
    Dmytro

    Thread Starter darko1970

    (@darko1970)

    Thanks a lot. The problem is solved ?? However, now new challenges arise ?? Now that I’ve created the desired number of forms, I’m wondering if there’s a possibility to change or add email addresses of recipients of notifications that someone has filled out the form, in one go for all forms? Thanks again.

    Hi @darko1970,

    Thanks for the update.

    About your new query, it looks very challenging, still, I notified our devs about it, and once we get a reply from them we will back to you on this thread.

    Best regards,
    Laura

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘redni brojevi 500 formi’ is closed to new replies.