• Resolved bewatermyfriend

    (@bewatermyfriend)


    Hey, your plugin is great and exactly what I need for my project.
    There is one extra I urgently need and I would pay you something for that if you can help me. So:

    I have 3 fields: {name-1}{name-2}{name-3}

    And on the Behaviour site I setup to display the entered names:
    {name-1}{name-2}{name-3}

    Now if someone doesn’t enter anything in {name-2} for example, then the name should be read by my url parameter.

    If my URL looks like that: example.com/?name2=john
    Then I want {name-2} says john on the behaviour page.

    I would be happy if you could help me, because your plugin is the only existing that is useful for me.

    PS: One more example for better understanding.
    If someone enters
    name1 = steven
    name2 = (empty)
    name3 = veronica

    and my URL is
    example.com/?name2=john

    Then I want display this message:
    steven john veronica

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter bewatermyfriend

    (@bewatermyfriend)

    On another site I found this code and created a plugin with it:

    $forminator_fields = array(
    // Put the fields here
    // first the URL GET parameter, then the field class in the form
    “f_name” => “forminator-field-name-1”,
    );

    But it is not working, maybe I do something wrong. Please help me.

    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello there @bewatermyfriend,
    hope you’re doing well and thanks for reaching us! ??

    There is one extra I urgently need and I would pay you something for that if you can help me.

    Please keep in mind that these support forums in www.ads-software.com are community-driven and we can’t provide paid support services.
    If you want to get the advantage of WPMUDEV premium support services, then you should get a membership and use the support services (live chat and forums) in our site instead: https://premium.wpmudev.org/get-support/

    Having said that, there’s no out-of-the-box solution to auto-populate data in a Name field. The workarounds here would be:
    1. make the name-2 field required, so members should actually fulfill it
    2. add an additional Hidden field and auto-populate the Embed URL to it: https://monosnap.com/file/mKm1xuZ14tRKkYUm8fV6XdtghIsH4R

    Warm regards,
    Dimitris

    Thread Starter bewatermyfriend

    (@bewatermyfriend)

    Thank you for your answer.

    I created a hidden field as shown on the image now.

    I have 3 fields: Name-1 Name-2 Name-3

    On the Behaviour page I wanted to setup autofill but I only can choose between
    Display Name
    Username
    First Name
    Last Name

    My hidden field is not displayed there and I don’t know where or how I can setup Auto-populate if not there.

    I want all 3 name fields be populated by the URL Parameter.
    If URL is example.com/?name1=tina&name2=john&name3=steven
    Then the fields should be autofilled by those names tina john and steven.

    Sorry for my bad understanding, but I really need this future and this is the best form plugin I could find after very long research.

    So I would appreciate it alot if you help me.
    Thank you very much.

    Hello @bewatermyfriend

    I trust you’re doing well!

    Autopopulating fields so far is possible only with the registered users. It fills in the user information automatically once the form is loaded for logged in user.

    If the registered user, on the User Profile has given the information for the Name-1, Name-2, Name-3, it may possible to achieve but will require a custom coding. The following solution was provided by our developer:

    If for example, you’re Using XProfile from BuddyPress, and have a custom field called “company name”.
    https://monosnap.com/file/WvJpzjI1Zg4wfDKwRz1evxF7RYZ9fq

    On a form add d a text field with a custom CSS identifier as “company-name”.
    https://monosnap.com/file/5w4rqqBhvvmwu2lUBJI6fbOOVVF2Zw

    Now to get the xProfile field value we can utilize the bp_get_profile_field_data() that BuddyPress provides. To do that we will make a mu-plugin like so:

    Always make sure to keep a backup of your site before changing/adding custom code.

    1] Navigate to your /wp-content/ directory and create a new one named mu-plugins if it doesn’t exist.
    2] Inside the mu-plugins folder create a file named frmt-bp-fields.php
    3] Edit the file and copy / paste this code snippet inside.

    <?php
    
    add_action(
    	'wp_footer',
    	function() {
    		// we only run this code if the user is logged in.
    		if ( is_user_logged_in() ) {
    
    			// we retrieve the fields data from BuddyPress.
    			$company_name = bp_get_profile_field_data(
    				array(
    					'field'   => 'company name',
    					'user_id' => get_current_user_id(),
    				)
    			);
    
    			?>
    			<script>
    			( function( $ ) {
    				$( document ).ready( function() {
    					// we add the data into the value of the input field.
    					$( '.company-name input' ).val( '<?php echo $company_name; ?>' );
    				} );
    			} ( jQuery ) );
    			</script>
    			<?php
    		}
    	},
    	999
    );
    4] Save and close the file.
    5] The final path should look like /wp-content/mu-plugins/frmt-bp-fields.php
    
    In the code mentioned above as you see we have to get the fields value first by doing
    $company_name = bp_get_profile_field_data(
    	array(
    		'field'   => 'company name',
    		'user_id' => get_current_user_id(),
    	)
    );

    You can change the “company name” and $company_name depending on the field names that you have to easily update the code and you can add as many as you like.

    Next we simply add the value that we got from BuddyPress to the field of the form like so:
    $( '.company-name input' ).val( '<?php echo $company_name; ?>' );

    Again this code will have to be adjusted so it can work depending on your forms custom field classes etc.

    As a result for this example I’m getting a text field automatically populated with “wpmu dev” as that’s the company name on my xProfile field as well.
    https://monosnap.com/file/soyvSjHoZeO0nLQCHY3lmcohUPASDP

    Hope this helps!

    Cheers,
    Nastia

    Thread Starter bewatermyfriend

    (@bewatermyfriend)

    Hello.

    Will you help me with that if I try the WPMUDEV Premium 30days for free?
    I could pay some money for that, but not too much.

    I only need the features for non-registered users.

    Weather I need option 1:
    autopopulate fields

    Or option 2:
    If fields left empty then read URL Parameters and output them after clicking on submit, as I explained in my first post.

    If you can not help me, then I can not finish my project. ??
    This plugin is the only one that has all what I need expect the thing with the autopopulate or URL Parameter.

    I think for a programmer it is very easy and done in under 20 minutes. I need at least 2 months to add this little feature by myself ?? Already asked in forums, but nobody can help me. So, here I got my last chance for hoping on support, for that I would pay a small amount. Let’s say about 20$…

    Best regards
    Stephan

    Hello @bewatermyfriend

    Hope you’re doing well!

    Please do not offer to pay for help, as this is against WordPress guidelines and the thread can be closed at any time by the forums modarators.

    My colleagues have created a plugin that can pull information from the URL into the hidden fields. Please download the plugin from here.

    Before uploading it, please extract the content and edit forminator-fill.php file. On lines 14 to 16 please replace the "hidden-field-id", "another-hidden-field-id-2", and "another-hidden-field-id-3" with actual hidden fileds CSS IDs.

       
    "name1" => "hidden-field-id",
    "name2" => "another-hidden-field-id-2",
    "name3" => "another-hidden-field-id-3",

    These IDs can be found if you will inspect the page in a browser. Please see the screenshot:
    https://monosnap.com/file/GB7I5qZaJiJ4lnbFvKzZ7brfgXfqmo

    If the URL is example.com/?name1=tina&name2=john&name3=steven, the plugin will auto-populate the hidden fields.

    Hope this helps.

    Kind regards,
    Nastia

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Help me – I pay for this!’ is closed to new replies.