AndreasN.OTGS
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Email notification for custom order statusSorry, took bit longer..
Please add this also to your “functions.php” of your active theme:function my_awesome_shipping_notification( $order_id, $checkout=null ) { global $woocommerce; $order = new WC_Order( $order_id ); //error_log( $order->status ); if($order->status === 'shipping-progress' ) { // Create a mailer $mailer = $woocommerce->mailer(); $message_body = __( 'Your order is being shipped..', 'text_domain' ); $message = $mailer->wrap_message( // Message head and message body. sprintf( __( 'Order %s ready for shipping', 'text_domain' ), $order->get_order_number() ), $message_body ); // Client email, email subject and message. $result = $mailer->send( $order->billing_email, sprintf( __( 'Order %s received', 'text_domain' ), $order->get_order_number() ), $message ); //error_log( $result ); } } add_action( 'woocommerce_order_status_changed', 'my_awesome_shipping_notification');If that is the most recommended code for the most recent Woocommerce version I’m not sure. But when I tried it out I received an email when order status was set on “Shipping”, so it worked for me.*
Btw since checking if mailer is really working is a bit tricky:
Add this to wp-config.phpdefine('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);The output of error_log( $variable ) will then appear in your-install.com/wp-content/debug.log If you test on localhost like Xampp or WAMP use plugin WP-Mail-SMTP and connect to e.g. to a Google mail account.
—
*http://stackoverflow.com/questions/27112461/woocommerce-send-custom-email-on-custom-order-status-change -> user “quelicm”Forum: Fixing WordPress
In reply to: External link on images WoocommerceGood to hear 🙂
Somewhere in your database there must be fields containing the affiliate link for your “Buy Now” buttons. Once we know where exactly we can retrieve them from DB and add them into this “affiliate_custom_links” function.1) Are you using an extra plugin for affiliate links?
2) Where in the WP backend do you add those links? (screenshot would help)Forum: Fixing WordPress
In reply to: Accessing Remote MySQL databasesSince I’m not familiar with your setup and installations – allow my to ask/mention this:
1) Remote-ness of your external MySQL databases
Are the remote MySQL DBs on the same *DB server* as your WordPress installation?2) If not – make sure to grant these remote MySQL DBs “remote access” privileges.
This can be done often via the hosting panel. Example: http://www.liquidweb.com/kb/enable-remote-mysql-connections-in-cpanel/3) WP operates with the $wpdb object using the data provided in the
wp-config.phpof the WP installation
In order to get data from another WP database but using all WP functionality you need to register another $wpdb object. Like this -> http://wordpress.stackexchange.com/questions/1604/using-wpdb-to-connect-to-a-separate-databaseHope this helps a little bit 🙂
Forum: Hacks
In reply to: WooCommerce Product Image to External Link in New WindowForum: Fixing WordPress
In reply to: External link on images WoocommerceHad a closer look at https://wordpress.org/support/topic/woocommerce-product-image-to-external-link-in-new-window – true, actually there a Woocommerce core file is edited, this is not what we wanna do. But it mentions the right filter which has to be manipulated:
woocommerce_single_product_image_htmlCould you try this:
1) Add below code into the “functions.php” file of your active themedefine( 'AFFILIATE_LINK_1', 'http://v2.wp-api.org/' ); function affiliate_custom_links($link, $post_id) { $pattern = '/(?<=href=")([^"]*)/'; $replacement = AFFILIATE_LINK_1; return preg_replace($pattern, $replacement, $link); } add_filter( 'woocommerce_single_product_image_html', 'affiliate_custom_links', 10, 2 );2) Go to the *single* view of a product
3) Click on product picture
4) Are you redirected to http://v2.wp-api.org/ page?Works fine for me, hope for you too 🙂
—
see also: http://stackoverflow.com/questions/21127301/overriding-template-with-hooksForum: Hacks
In reply to: A new creating-content-formTried out your code with some wp_insert_post() in posting_page. Works, post is posted. Perhaps some other things to consider:
1) Users will post via front-end, right?
Better use wp_verify_nonce() instead of check_admin_referer(). As outlined in 3rd code example of -> https://codex.wordpress.org/Function_Reference/wp_nonce_field#Examples2) Make sure to prevent users submitting empty posts 🙂
3) Use sanitize_text_field() for sanitizing your form text input https://codex.wordpress.org/Validating_Sanitizing_and_Escaping_User_Data
4) To prevent accidental double-submitting you could add at end of posting_page a wp_redirect. Like..
$post_id = wp_insert_post( $args ); if( $post_id ){ wp_redirect( url target ); exit(); }5) Is posting supposed to be totally anonymous, or do you need at least some info about poster?
-> http://www.wpbeginner.com/wp-tutorials/how-to-display-a-users-ip-address-in-wordpress/6) Consider a captcha like https://www.google.com/recaptcha/intro/index.html
Forum: Fixing WordPress
In reply to: External link on images WoocommerceHi Curly86
Think the plugin/code mentioned here might help: https://wordpress.org/support/topic/woocommerce-product-image-to-external-link-in-new-windowForum: Fixing WordPress
In reply to: Where to add php code and how to pass data from JavaScriptHi Josep, my personal view+ideas :-)..
1) yes, cant be wrong
2) yes, AJAX is the way to go
3) yes, PHP is needed to get ACF data3A) yes
3B) good starting point is “functions.php”, once all is running I personally would move it to an extra plugin. To be “theme-update save”.3C) I recommend to study this post here: http://wordpress.stackexchange.com/questions/158364/ajax-call-in-wordpress-front-end
When WP is called in browser it also loads things like add_action(‘wp_ajax_nopriv_my_action’, ..) and hooked functions.3D) If you use AJAX for that, yes. No reload needed.
Forum: Fixing WordPress
In reply to: Email notification for custom order statusYes, I will try to 🙂
The code you mention in the opening post, where exactly in which file is it located?Forum: Fixing WordPress
In reply to: Email notification for custom order statusOk, this is not a complete solution but might help a bit – you can trigger Woocommerce emails like this:
WC()->mailer()->emails['WC_Email_Customer_Processing_Order']->trigger($orderId);—
http://wordpress.stackexchange.com/questions/191860/woo-commerce-send-mail-by-codeForum: Fixing WordPress
In reply to: Moving Server – Errors after moveBased on my own moving experiences 🙂 could you check via phpMyAdmin if there are still “old” http://www.national-stage.co.uk urls in your database tables?
Forum: Fixing WordPress
In reply to: U.S. map, states linked, jumping to content belowThough haven’t used it myself yet but this plugin might help -> https://wordpress.org/plugins/mapmaker-enhanced-google-maps/. It mentions under “Key features”: “Can be used with any photo as a hotspot generator”.
Forum: Hacks
In reply to: A new creating-content-formThink in this case one of the plugins mentioned here could help -> https://premium.wpmudev.org/blog/wordpress-post-frontend-plugins/
Forum: Fixing WordPress
In reply to: 3 problem in wordpress databaseThis is not a direct WP problem but something with the counter MyISAM database engine – http://dev.mysql.com/doc/refman/5.0/en/myisam-table-close.html
After an backup please try these steps -> http://www.thegeekstuff.com/2008/09/how-to-repair-corrupted-mysql-tables-using-myisamchk/
I’m quite sure that this “more-link” must come from one of your theme options.
To get rid of the link immediately adda.more-link {visibility: hidden;}to the very end of your themes style.css
Does it make a difference?