Forum Replies Created

Viewing 15 replies - 1 through 15 (of 43 total)
  • Thread Starter marcorm69

    (@marcorm69)

    Hi Alex.

    Thanks you!
    I am sorry.
    The little button over the dimension fonts of the button was escaped me!!

    Regards,
    Marco

    Thread Starter marcorm69

    (@marcorm69)

    Hi Rashed.

    I am using Astra theme.

    For now my workaround is:
    – Create a page with a default page from theme
    – Develop the page with WP Page builder
    – Change the default page to WP Page Builder template.

    In this way working.

    Regards,
    Marco

    Thread Starter marcorm69

    (@marcorm69)

    Hi kardi,

    Thanks for reply.
    I’ve resolved with clear cache (browser and wordpress) and restart my pc.
    Probably is not a plugin problem but a my temporary problem.

    Thanks for help.

    Regards,
    Marco

    Thread Starter marcorm69

    (@marcorm69)

    I found the solution to the problem, I share it because it could be useful to someone.

    I add this in the Custom CSS of carousel object and now work.

    .wppb-builder-container {
      width:90%;
      margin: 0 auto;
    }

    Regards,
    Marco

    Thread Starter marcorm69

    (@marcorm69)

    I see that there is no support for this plugin.
    Pity because, despite several problems, it is the most complete free “page builder”.

    • This reply was modified 3 years, 2 months ago by marcorm69.
    Thread Starter marcorm69

    (@marcorm69)

    Yes, this is the first step I done

    Thread Starter marcorm69

    (@marcorm69)

    Hi.

    Unfortunately not work.
    I try to disable all plugin but the result is the same.

    I have try to use, as “Post page” another page, for example “Albums” or “About me”, in this case I don’t see the “slider”, see the title of page “Albums” or “About me”, but only the title, not the contains, and, after the title, I see the grid blog, for any page I set.

    1. This is the preview with “Post Page” as blog, the FIRST TIME i go to the settings (if I change blog to albums and return to blog I see the preview of point 2)
    https://ibb.co/ZmtKFrh

    2. If I change the post page I see this for all type of pages
    https://ibb.co/6nYbJCY

    Regards,
    Marco

    • This reply was modified 4 years, 2 months ago by marcorm69.
    Thread Starter marcorm69

    (@marcorm69)

    Hi.

    Yes, I am sure.
    I have try different pages in “Post page” option (Blog, Albums, my pages) but I see always only the “simple” Home page.

    Is possible the problem is the design downloaded from your site?
    I using “Frame” as design.

    Regards,
    Marco

    Thread Starter marcorm69

    (@marcorm69)

    I am sorry.

    I am an idiot!!!
    I have resolve with a regular expression

    $final_output = preg_replace('/(<form id="give-form-[0-9]*-[0-9]*")/', '$1 enctype="multipart/form-data"', $final_output);
    
    Thread Starter marcorm69

    (@marcorm69)

    Thanks you

    Marco

    Thread Starter marcorm69

    (@marcorm69)

    I all.

    I have solved the second issue.
    I write the solution if it can be useful to someone.

    In add hook give_donation_form_required_fields in order to add a file upload field.
    Before add field code, I add check the radio button payment method.
    If the radio button is “paypal” I add “display:none” at the file upload div.
    If the radio button is “offline” I add “display:block” at the file upload div.
    At the first time, the payment-mode is empty, but the my default payment method is Paypal and the file upload field should not be displayed, so I added $answer==”” to check.

    The code working at each change of payment method.

    This is the code:

    <php?
      $answer = $_GET['payment-mode'];  
      if ($answer == "paypal" || $answer == "") {
    	$div_file_uploader = "style=\"display:none;\"";
    	$div_upload_filename = "style=\"display:none;\"";
      }
      else {
    	$div_file_uploader = "style=\"display:block;\"";
    	$div_upload_filename = "style=\"display:block;\"";
      } 
    ?>
    
    <div class="file-uploader" <?php echo $div_file_uploader; ?>>
        <input id="fileToUpload" name="fileToUpload" type="file" accept=".pdf,.jpg"/>
        <label for="file-upload" class="custom-file-upload">
           <i class="fas fa-cloud-upload-alt"></i>
           <p>Clicca per caricare la ricevuta di pagamento</p>
           <input type="hidden" id="filenamecheck" name="filenamecheck" value="">
         </label>
    </div>'

    Regards.
    Marco

    Thread Starter marcorm69

    (@marcorm69)

    Hi all.

    I have found a solution.
    I am using a “fake” hidden input field where I enter the name of the file to upload and validate it.

    <input type="hidden" id="filenamecheck" name="filenamecheck" value="">

    In the js script, where I check the file type and size, I move the filename in this field

    var inputElement = document.getElementById("fileToUpload")
    document.getElementById("filenamecheck").value = inputElement.value; 

    and in filter give_donation_form_required_fields I check the “fake” field.

    $required_fields['filenamecheck'] = array(
       'error_id'      => 'invalid_fileToUpload',
       'error_message' => __( 'Per favore, carica copia del bonifico bancario o del bollettino postale.', 'give' ),
    );
    Thread Starter marcorm69

    (@marcorm69)

    Hi all,

    I have solved the upload files issue (at the end of develop I post the code)
    There is still the problem of viewing the file upload only for offline payment.
    Someone can you help me?

    Regards,
    Marco

    Thread Starter marcorm69

    (@marcorm69)

    I went a little further.
    This is my complete code, for now.
    But the problem persist.
    Without add “multipart/form-data” in form, the filename is stored in DB and show in donation detail but the file is not upload.
    With add “multipart/form-data” in form, the filemane is not stored in DB and NOT show in donation detail page and the file is NOT upload.
    ??

    <?php
    
    /**
     * Add enctype="multipart/form-data" to GiveWP form
     *
     * @param $final_output, $args
     */
    function give_add_multipart_tag_donation_form( $final_output, $args ) {    
    		$form_tag = "<form id=\"give-form-{$args['form_id']}-1\"";		
    		$final_output = str_replace( $form_tag, "{$form_tag} enctype=\"multipart/form-data\"", $final_output );
    		return $final_output;	
    }
    
    add_filter( 'give_donate_form', 'give_add_multipart_tag_donation_form', 10, 2 );
    
    /**
     * Add Custom Donation Form Fields
     *
     * @param $form_id
     */
    function give_mamafrica_custom_form_fields( $form_id ) {
    	// Only display for forms with the IDs "754" and "578";
    	// Remove "If" statement to display on all forms
    	// For a single form, use this instead:
    	if ( $form_id == 27021) {
    	//$forms = array( 754, 578 ); 
    	?>
    
    		
      <div id="holder">
    	<i class="fas fa-cloud-upload-alt"></i>
        <input type="file" name="fileToUpload" id="fileToUpload">
      </div> 
    
    	<?php
    	} //endif;
    }
    
    add_action( 'give_purchase_form_after_cc_form', 'give_mamafrica_custom_form_fields', 10, 1 );
    
    function give_mamafrica_donations_save_custom_fields( $payment_id ) {
    	if ( isset( $_POST['fileToUpload'] ) ) {
    		$message = wp_strip_all_tags( $_POST['fileToUpload'], true );
    		give_update_payment_meta( $payment_id, 'fileToUpload', $message );		
    	if(trim($_FILES["fileToUpload"]["name"]) == '')  
    		{  		
    			echo 'Non hai selezionato nessun file!';  
    		}  
    		if (!isset($_FILES['fileToUpload']) || !is_uploaded_file($_FILES['fileToUpload']['tmp_name'])) {
    			echo 'Non hai inviato nessun file...';
    			exit;    
    		}
    		//percorso della cartella dove mettere i file caricati dagli utenti
    		$uploaddir = get_template_directory() || '/offline_donation/';
    
    		//Recupero il percorso temporaneo del file
    		$userfile_tmp = $_FILES['fileToUpload']['tmp_name'];
    
    		//recupero il nome originale del file caricato
    		$userfile_name = $_FILES['fileToUpload']['name'];
    
    		//copio il file dalla sua posizione temporanea alla mia cartella upload
    		if (move_uploaded_file($userfile_tmp, $uploaddir . $userfile_name)) {
    		//Se l'operazione è andata a buon fine...
    			echo 'File inviato con successo.';
    		}else{
    			//Se l'operazione è fallta...
    			echo 'Upload NON valido!'; 
    		}
    		
    	}
    	
    	
    }
    
    add_action( 'give_insert_payment', 'give_mamafrica_donations_save_custom_fields' );
    
    /**
     * Show Data in Payment Details
     *
     * Show the custom field(s) on the payment details page in wp-admin within its own metabox.
     *
     * @param int $payment_id
     */
    function give_mamafrica_donation_details( $payment_id ) {
    
    	// Bounce out if no data for this transaction.
    	$fileToUpload = give_get_meta( $payment_id, 'fileToUpload', true );
    	if ( $fileToUpload ) : ?>
            <div class="referral-data postbox">
                <h3 class="hndle"><?php esc_html_e( 'Copia pagamento', 'give' ); ?></h3>
                <div class="inside" style="padding-bottom:10px;">			
    				<?php echo wpautop( $fileToUpload ); ?>
                </div>
            </div>
    	<?php endif;
    
    	
    	}
    
    add_action( 'give_view_donation_details_billing_after', 'give_mamafrica_donation_details' );
    
    ?>
    
    
    Thread Starter marcorm69

    (@marcorm69)

    I add a bit.

    I am able to store the “namefile” in db and show it in donation detail, but not to upload the file.

Viewing 15 replies - 1 through 15 (of 43 total)