• I’m about to start working on a site and wanted to know if there was an easy way to capture some URL information and insert it into a hidden field on the form?

    I’d like to capture where a new user originated and then push that information into the database/profile for use later.

Viewing 1 replies (of 1 total)
  • Mike

    (@bigmikey00)

    if your doing something like http://myurl.com/?url_key=1234
    then you would do something like

    	add_action('um_after_register_fields', 'add_a_hidden_field_to_register');
    function add_a_hidden_field_to_register( $args ) {
    	
    	if(isset($_GET['url_key'])){
    	    $myKey = $_GET['url_key'];
    		
    	}
    	?> 
    	<input type="hidden" name="url_key" id="url_key" value="<?php echo $myKey;?>" />
    	
    	<?php
    }
    

    This can be either placed in functions.php or write your own plugin to do this.
    you can play with the code to do this . This will add this as a user_meta data with url_key as the tag to the registration form

    so to retrieve this info do the following. You will need to pass the user_id though however you go about achieving that
    $url_key = get_user_meta( $user_id, 'url_key', true );

    • This reply was modified 1 year, 11 months ago by Mike.
Viewing 1 replies (of 1 total)
  • The topic ‘Hidden field’ is closed to new replies.