PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Gravity Forms + User Registration + Displaying custom form field on a page

  1. DamienOh
    Member

    This is what I need to do, in sequence:

    1. Create a form to allow visitor to register as a member and capture various user info.
    2. Integrate with the user registration addon to register a user account
    3. Once registered pass the user id back to the form
    4. Once the form data is saved to the database, it should be retrievable by a plugin to allow the admin to view and modify the user info.

    I have completed 1 and 2. I am having some difficulties passing the user id back to the form and also retrieving form data from the database.

    Can anyone help?

    Posted 12 years ago on Thursday November 17, 2011 | Permalink
  2. I lost you around step 3. Once the form is submitted and the user is created, there is no more form to pass the user ID to. Where do you want to send the ID of the recently created user?

    For #4, what plugin are you talking about?

    Thanks for any clarification you can provide.

    Posted 12 years ago on Thursday November 17, 2011 | Permalink
  3. DamienOh
    Member

    First of all, the gravity forms is used as the registration form for the member, with plenty of fields for the member to fill up. Once the member submit the form, the form (along with the user registration add on) will create a user account for the member.

    The difficult part is this: I am creating a custom plugin to allow the member to log in and view/edit their own info. The plugin needs to pull in data from the gravity forms database and display it in the WP dashboard. The plugin needs to associate the data with the logged in user so that the members can only see their own information.

    AT the moment, there doesn't seem to be a way for the submitted data to be tied to a particular user. In addition, I can't find many example of pulling data from the gravity forms table and display them on the frontend.

    Posted 12 years ago on Friday November 18, 2011 | Permalink
  4. To link all the extra data to the user profile I have used the user meta. This works great as you can retreive it really easy.

    Here is the code I used to call the data:

    [php]
    function fn_list_all_user_meta() {
    	if( is_user_logged_in() ) {
    		$current_user = wp_get_current_user();
    
    		echo 'Username: ' . $current_user->user_login . '';
    		echo 'User email: ' . $current_user->user_email . '';
    		echo 'User first name: ' . $current_user->user_firstname . '';
    		echo 'User last name: ' . $current_user->user_lastname . '';
    		echo 'User display name: ' . $current_user->display_name . '';
    		echo 'User ID: ' . $current_user->ID . '
    
    ';
    
    		$the_meta_array = array('pic_profile', 'company', 'company_logo', 'business_address_street', 'business_address_city', 'business_address_state', 'business_address_zip', 'phone_direct', 'phone_mobile', 'phone_business', 'Website' );
    		foreach ( $the_meta_array as $tma ) {
    			$ttt = get_user_meta( $current_user->ID, $tma, true );
    			if ( !empty( $ttt ) ) {
    				echo $ttt . '' ;
    			}
    		}
    	}
    }

    Hope this helps.

    Posted 12 years ago on Saturday November 19, 2011 | Permalink