Merge Membership and Profile into one-step UI

WordPress Business Themes Forums Responsive Themes Dating Theme Merge Membership and Profile into one-step UI Reply To: Merge Membership and Profile into one-step UI

WordPress Business Themes Forums Responsive Themes Dating Theme Merge Membership and Profile into one-step UI Reply To: Merge Membership and Profile into one-step UI

  • JamesD
    JamesD
    Super Guru 1,296 points

    @Thomas

    If you’re up to it… here’s a method based off of the default DA9 theme file.

    1. Unzip and upload the attached ajax-modal-register.php file to your child theme directory.
    2. Add the following to your _functions.php file:
      // Handle Upload profile photo
      add_action( 'user_register', 'custom_user_register' );
      /**
       *
       * Save additional registratio form fields data and upload profile photo (i.e. 'zip', 'wlt_userphoto')
       *
       * Fired by user_register action hook.
       *
       * @access public
       *
       * @param integer $user_id
       * @return void
       */
      function custom_user_register( $user_id ) {
          global $CORE;
      
          // Add Zip/Postal Code
          if(isset($_POST['zip']) && !empty($_POST['zip'])) {
              update_user_meta($user_id, 'zip', strip_tags($_POST['zip']));
          }
      
          // UPLOAD USER PHOTO
          if(isset($_FILES['wlt_userphoto']) && strlen($_FILES['wlt_userphoto']['name']) > 2 && in_array($_FILES['wlt_userphoto']['type'],$CORE->allowed_image_types) ){
              // INCLUDE UPLOAD SCRIPTS
              $dir_path = str_replace("wp-content","",WP_CONTENT_DIR);
              if(!function_exists('wp_handle_upload')){
                  require $dir_path . "/wp-admin/includes/file.php";
              }
      
              // GET WORDPRESS UPLOAD DATA
              $uploads = wp_upload_dir();
      
              // UPLOAD FILE
              $file_array = array(
              'name' 		=> $_FILES['wlt_userphoto']['name'], //$userdata->ID."_userphoto",//
              'type'		=> $_FILES['wlt_userphoto']['type'],
              'tmp_name'	=> $_FILES['wlt_userphoto']['tmp_name'],
              'error'		=> $_FILES['wlt_userphoto']['error'],
              'size'		=> $_FILES['wlt_userphoto']['size'],
              );
              //die(print_r($file_array));
              $uploaded_file = wp_handle_upload( $file_array, array( 'test_form' => FALSE ));
      
              // CHECK FOR ERRORS
              if(isset($uploaded_file['error']) ){
                  $GLOBALS['error_message'] = $uploaded_file['error'];
              }else{
                  // NOW LETS SAVE THE NEW ONE
                  update_user_meta($user_id, "userphoto", array('img' => $uploaded_file['url'], 'path' => $uploaded_file['file'] ) );
              }
          }
      }
    3. Make sure the “USER SETS PASSWORD” setting is turned ON. (@ PremiumPress > Configuration > USER SETTINGS > USER SETS PASSWORD)
    Attachments:
    You must be logged in to view attached files.
    March 8, 2019 at 7:37 am
  • Didn't find what you were after?

    Chat with us now

    or contact our support team