Dani Harp
Forum Replies Created
-
includes/class-wcpdf-export.php
Into this file are my solution for this issue…
wp_die( __( ‘You do not have sufficient permissions to access this page.’, ‘wpo_wcpdf’ ) );
… to comment.
That’s it. Thanks again Ewout, you definatly put me in the track!!!!!
I’ve rewrite this but still the display: “You don’t have sufficient permissions to view this page”.
$fac = wpo_wcpdf_thank_you_link( "", $num_factura ); $html= '<tr>'; $html .= '<td width="4%" align="left" valign="top" bordercolor="#017dc5"><small>'. $num_compra.'</small></span></td>'; $html .= '<td width="14%" align="center" valign="top" bordercolor="#017dc5"><small>'. $fech.'</small></td>'; $html .= '<td width="60%" valign="top" bordercolor="#017dc5"><strong>Asunto</strong></br><small>'.$asunto.'</small><strong></br></br>Descripción</strong></br><small>'.$refma[0].'</small></br></br><strong>Contacto</strong></br><small> ■ <b>Nombre</b> - '.$nombre.'</br> ■ <b>Localización</b> - '.$localizacion.'</br> ■ <b>Email</b> - '.$email.'</br> ■ <b>Tel</b> - '.$tel.'</br> ■ <b>Urgencia para empezar</b> - '.$urgencia.'</br> ■ <b>Preferencia</b> - '.$preferencia.'</br> ■ <b>Horario contacto</b> - '.$horario.'</small></br></br></td>'; $html .= '<td width="12%" align="center" valign="top" bordercolor="#017dc5"><small>'.$fac.'</br><b>No.factura</b><small></br>'.$num_factura.'</small></br></br><b>No.reforma</b><small></br>'.$refr.'</small></br></small></td>'; $html .= '<td width="10%" align="center" valign="top" bordercolor="#017dc5"><small>'. $prc .' € </small></td>'; $html .= '</tr>'; $data_html .=$html; } $page_links = paginate_links( array( 'base' => add_query_arg( 'paged1', '%#%' ), 'format' => '?paged1=%#%', 'prev_text' => '«', 'next_text' => '»', 'total' => $num_of_pages, 'current' => $paged1 ) ); if ( $page_links ) { $data_html.= '</table>' . '<p><div align="center">' . $page_links . '</div></p>'; }else{ $data_html.= '</table>'; } } // Punto de Interrupción // $data_html .= 'Pag: ' . $_POST['paged1'] . ', s: ' . $paged1; return $data_html; } add_filter('woocommerce_thankyou_order_received_text', 'wpo_wcpdf_thank_you_link', 10, 2); function wpo_wcpdf_thank_you_link( $text, $order ) { if ( is_user_logged_in() ) { $pdf_url = wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $order . '&my-account'), 'generate_wpo_wcpdf' ); $text .= '<a href="'.esc_attr($pdf_url).'"><span><img border="0" alt="Factura" src="https://www.reformasyservicios.es/wp-includes/images/euro3.png" width="100" height="100"></span></a>'; } return $text; } add_shortcode('registro_reformas_compradas','regrefcomp');
So, the respond’s page says: “No tiene suficientes permitos para acceder a esta página”
Hello Ewout.
It’s a logged user in fact who must able to download his invoices. I tryed with the code from “How can I add a download link to the invoice on the Thank you page?”, but not as a filter, so I’ve write the next code at functions.php, where I need to add the .pdf’s links from each invoce on each row:
Here is a preview:
https://www.reformasyservicios.es/wp-content/themes/Avada/images/a.gif
And here the code (Hope thebackticks
doesn’t execute it…)
” // Factura
$num_factura = $results->idfactura;if ( is_user_logged_in() ) {
$pdf_url = wp_nonce_url( admin_url( ‘admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=’ . $num_factura . ‘&my-account’), ‘generate_wpo_wcpdf’ );
$text = ‘<span><img border=”0″ alt=”Factura” src=”https://www.reformasyservicios.es/wp-includes/images/euro3.png” width=”100″ height=”100″></span>‘;
}$html= ‘<tr>’;
$html .= ‘<td width=”4%” align=”left” valign=”top” bordercolor=”#017dc5″><small>’. $num_compra.'</small></span></td>’;
$html .= ‘<td width=”14%” align=”center” valign=”top” bordercolor=”#017dc5″><small>’. $fech.'</small></td>’;
$html .= ‘<td width=”60%” valign=”top” bordercolor=”#017dc5″>Asunto</br><small>’.$asunto.'</small></br></br>Descripción</br><small>’.$refma[0].'</small></br></br>Contacto</br><small> ■ <b>Nombre</b> – ‘.$nombre.'</br> ■ <b>Localización</b> – ‘.$localizacion.'</br> ■ <b>Email</b> – ‘.$email.'</br> ■ <b>Tel</b> – ‘.$tel.'</br> ■ <b>Urgencia para empezar</b> – ‘.$urgencia.'</br> ■ <b>Preferencia</b> – ‘.$preferencia.'</br> ■ <b>Horario contacto</b> – ‘.$horario.'</small></br></br></td>’;
$html .= ‘<td width=”12%” align=”center” valign=”top” bordercolor=”#017dc5″><small>’.$text.'</br><b>No.factura</b><small></br>’.$num_factura.'</small></br></br><b>No.reforma</b><small></br>’.$refr.'</small></br></small></td>’;
$html .= ‘<td width=”10%” align=”center” valign=”top” bordercolor=”#017dc5″><small>’. $prc .’ € </small></td>’;
$html .= ‘</tr>’;$data_html .=$html;
}
“Thousand thanks by the way Ewout
Hi, you actually answered my question by email. I have installed WooCommerce PDF Invoices & Packing Slips and WooCommerce Print Invoice/Packing list.
Is there any way to print or to download the logged user’s invoices through any filter or hook used at my own shortcode at functions.php? Sorry if I didn’t explain myself correctly before, and thanks for the prompt answer!