Email invoices linking to HTTP not HPPTS
This topic contains 11 replies, has 5 voices, and was last updated by Kiran 7 years, 1 month ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
November 17, 2017 at 6:46 pm #818
When an email is sent saying an invoice can be viewed, the URL is being sent from a http and not an https URL.
I only have my payment systems and invoice with HTTPS and not the whole side, is there a way to add HTTPS to your invoicing system ?
SORRY POSTED THIS IN GENERAL DISCUSSION BY MISTAKE
November 17, 2017 at 6:49 pm #820Or could we have a “FORCE HTTPS” option for the plug in like some of the other invoice plug-ins around.
November 17, 2017 at 8:15 pm #821Hello!
Invoicing uses your site URL settings. Your’s is a special case, and a customization that would go beyond support. This is a very general WordPress function and you could probably find a solution online.
I have never encountered a setup like that before. Is there a reason you have it setup that way?
November 17, 2017 at 8:25 pm #823Its more common than you think, yes the reason is we get better performance when a client is in their dedicated client zone which they log into, but marking the leap into https and then out again when they return to the client zone works better.
Plus when delivering images online to clients we dont have to worry about mixed content. This solution is much better when delivering unsecured content that doesnt need to be secured. Plus we have an API that connects to clients databases which works freely over HTTP
So we have it set up this way.
Its not a support issue but it needs to be added. Pretty much every invoicing tool I’ve used else where has the “Force HTTPS” option in its general settings, so I dont buy the “its a unique setup”
November 17, 2017 at 11:37 pm #824Hi Dan,
the developers will look into it and let you know how this can be solved, possibly with a code snippet or by adding a new setting if the 1st option isn’t possible.
Thanks
November 18, 2017 at 3:50 pm #827The system uses the wp settings, you can use the below snippet to redirect any page to its https url by the page id, might also be handy for you for other things:
add_action('wp','_my_custom_ssl_redirect'); function _my_custom_ssl_redirect(){ global $post,$wp; $page_ids = array(2,123,321,456); // array of page ids we want to force to ssl. if( is_page() && isset($post->ID) && in_array($post->ID,$page_ids) ){ wp_safe_redirect( add_query_arg( $_SERVER['QUERY_STRING'], '',trailingslashit(home_url( $wp->request, "https" ), 301 )) ); exit; } }
Also FYI if your server is running http2 and is all https it will likely be faster than http.
Thanks,
Stiofan
November 19, 2017 at 2:52 pm #830How does that “snippet” redirect the email URL out to https as the page ids change everytime or am I missing something ? The email invoice comes with a token at the end of the URL string too.
Yes I know it uses the wp settings but I dont want it to, hence having an in app toggle that doesnt require extra code is a benefit.
As for your comment about it being faster, yes it should but in our use case it doesnt.
November 20, 2017 at 4:43 am #833Hi Dan,
Above snippet will work to force HTTPS for particular pages or posts. Use following snippet to force HTTPS for all the invoices.
function _wpi_custom_ssl_redirect(){ global $post, $wp; if ( ! empty( $post->ID ) && ! empty( $post->post_type ) && $post->post_type == 'wpi_invoice' && is_singular() && is_single() ) { if ( strpos( wpinv_get_current_page_url(), 'https://' ) !== 0 ) { wp_safe_redirect( add_query_arg( $_SERVER['QUERY_STRING'], '', trailingslashit( home_url( $wp->request, "https" ), 301 ) ) ); exit; } } } add_action( 'wp', '_wpi_custom_ssl_redirect' );
Thanks,
KiranNovember 20, 2017 at 5:34 am #834Do I need to modify that in anyway to work on my site ?
November 20, 2017 at 5:56 am #842If you want to force all the invoices to use HTTPS, then remove previous snippet provided in reply #827 use snippet as it is provided in reply #834.
Kiran
November 20, 2017 at 5:59 am #843Got it that works by the looks of it.
Thanks you Kiran, appreciated.
November 20, 2017 at 6:13 am #849Thanks for letting us know 🙂
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket