Chris
Forum Replies Created
-
Hi Anders,
Thanks for the rapid response and suggestion! I had Jetpack’s “site accelerator” turned on for images (“Speed up image load times” in English). Turning this option off immediately resolved my issue.
Forum: Plugins
In reply to: [Contact Form 7] Emails not received when submitted from mobile SafariJason,
The Coding Monkey link had a tip that worked; thanks. In hindsight it’s pretty obvious. The form was using the user’s email as the From address. After changing the From address to the website owner’s address, the email sent successfully.
-Chris
Forum: Plugins
In reply to: [BackUpWordPress] Blank page on manual backupHi Owain,
Thanks. Yes, I was on the latest version. However, given the circumstances, I needed to use another plugin.
Forum: Plugins
In reply to: [Custom Permalinks] Notice: Undefined index: pathThanks. This was a development environment, not production. I already had a solution implemented by the time I posted this, I just wanted to alert the developer in the event that they wanted to address it in a future update.
Forum: Plugins
In reply to: [WooCommerce] How to Show Shipping Cost on Product PageHi Mike,
I understand that shipping normally isn’t calculated until checkout. However, for my current project I need to show flat rate shipping on the product page.
I’m not sure what you mean by, “add the the short/long description.”
In lieu of using built-in functionality, I wrote this function to obtain an individual product’s shipping cost for the Flat Rate shipping method (does not work with fees, defaults to 1 quantity):
function wc_get_flat_rate_shipping_cost( $product_object ) { $flat_rate_settings = maybe_unserialize( get_option( 'woocommerce_flat_rate_settings' ) ); $base_rate = isset( $flat_rate_settings['cost'] ) ? $flat_rate_settings['cost'] : 0; $key = 'class_cost_' . $product_object->get_shipping_class(); $class_rate = isset( $flat_rate_settings[$key] ) ? $flat_rate_settings[$key] : 0; $class_rate = str_replace( '[qty]', 1, $class_rate ); $class_rate = str_replace( '[cost]', $product_object->price, $class_rate ); $class_rate = (int)$class_rate; $total = ( isset( $base_rate ) && isset( $class_rate ) ) ? $base_rate + $class_rate : 0; return $total; }
Unless there is a function that I should be using from the WC_Shipping or WC_Shipping_Flat_Rate classes, I will mark this as resolved.
Does this fix it (edit to newsletter/statistics/link.php):
$site_url = parse_url( get_site_url() ); $site_domain = $site_url['host']; $input_url = parse_url( $url ); $input_domain = $input_url['host']; if ($site_domain == $input_domain) $header('Location: ' . $url);
Forum: Plugins
In reply to: [Image Gallery Reloaded] Captions cut off at quotation marksI solved my problem. In image-gallery-reloaded.php, I replaced this:
$title = $attachment -> post_excerpt;
with this:
$title = str_replace('"', '"', $attachment -> post_excerpt);
Voila.
Forum: Fixing WordPress
In reply to: Updating posts with $wpdb->update() and wp_update_post()Hi ajith2011, please don’t hijack this thread. Start your own, please, as your question is entirely different than my own. It is bad practice to post your own question in an unrelated or tangentially related thread, and you will likely not receive a proper answer doing so.
Forum: Hacks
In reply to: Left join slows down mysql queryOf course! That does it, thank you very much. ??
I was able to implement a solution for forcing the subject line to be what I want it to be (in this case, the title of the post on whose template file I am placing the contact form).
First, hook the custom subject function into the Grunion Contact Form filter:
add_filter('contact_form_subject', 'product_contact_subject');
Now, the function:
function post_contact_subject($subject) { $url = $_SERVER['HTTP_REFERER']; //Create an array divided by the base url. This example assumes that the post slug immediately follows the root domain. Change this to match your permalink structure. $arr = explode(get_site_url() . '/', $url); //Make sure that the array has at least two elements. if (count($arr) < 2) return $subject; //Get the slug and remove the query string and any trailing slash if it exists. $slug = str_replace('/', '', $arr[1]); $slug = preg_replace('/\?.*/', '', $slug); //Get the post id based on the slug. $id = slug_to_id($slug); //title $title = get_the_title($id); //Return the custom title return $title; }
Now, the function for getting a post’s ID from its slug:
function slug_to_id($slug, $type = 'post') { $args=array( 'name' => $slug, 'post_type' => $type, 'post_status' => 'publish', 'showposts' => 1, 'caller_get_posts'=> 1 ); $my_posts = get_posts($args); if( $my_posts ) { return $my_posts[0]->ID; } else { return 0; } }
I hope that this helps anybody else with this problem.
Jeremy,
Thanks, I have successfully implemented this solution. While testing it I found that the default subject line of the email is now the name of the page where I placed the contact form. Unfortunately I need the subject to remain equal to the post title where this contact form will be displayed; is there a way to do this?
Previous to updating Jetpack and WordPress to their newest versions, I was using do_shortcode() without any problems. Are there plans to make this usability available again?
Thanks.
Forum: Plugins
In reply to: Jetpack Contact From not Sending when in do_shortcodeI am having the same problem. If I use the shortcode in a page’s content via the UI, it works. But if I use do_shortcode(), nothing happens. Extremely frustrating!
Forum: Plugins
In reply to: [ALO EasyMail Newsletter] Adding an anti-spam question to subscription formThanks! I had looked at the custom field stuff prior to posting my original question and didn’t think it would work, but now that I’m looking at your code I really don’t know what I was thinking. :-/ Anyway your solution works perfectly just like your documentation says. Here is the code that I used:
/** * Add an anti-spam question to Easymail newsletter subscription form */ function easymail_add_antispam ( $fields ) { // Custom field: Captcha $fields['cf_captcha'] = array( 'humans_name' => __("What color is an orange?", "alo-easymail"), 'sql_attr' => "VARCHAR(1) NOT NULL", 'input_type' => "text", 'input_mandatory' => true, 'input_validation' => 'easymail_validate_antispam', 'input_attr' => ' maxlength="20" ' ); return $fields; } add_filter ( 'alo_easymail_newsletter_set_custom_fields', 'easymail_add_antispam' ); /** * Validate input of antispam question */ function easymail_validate_antispam ($data) { $text = strtolower($data); if ($text == 'orange') return true; else return false; }
Forum: Plugins
In reply to: [ALO EasyMail Newsletter] Author attributionExcellent, I figured there was a function out there for this but didn’t know the name. Thanks. ?? #resolved
PS love the plugin. I think it lacks some good features, for example I don’t think the gallery support is that great and it would be easier if the template allowed for some kind of dynamic design, because right now I am having to custom design the HTML for our emails to get them looking like I want. I eventually plan on writing a little HTML generation page with an option to choose single-column or multi-column so that I can switch up newsletter formats for our readers. I can’t promise my code will be up to par with cleanliness and best practices but it will get the job done; I can PM you the code when it’s finished if you want, but this is a project that I am putting on the backburner for the time being. Thanks again and sorry for the tldr.
Forum: Plugins
In reply to: [ALO EasyMail Newsletter] Author attributionThanks for the rapid response! However, I should have been more clear with my question; sorry about that.
When publishing newsletters as blog posts, I would like to be able to attribute the newsletters to a different user account (author) just like I can when publishing a blog post.