Title: FlashUK's Replies | WordPress.org

---

# FlashUK

  [  ](https://wordpress.org/support/users/flashuk/)

 *   [Profile](https://wordpress.org/support/users/flashuk/)
 *   [Topics Started](https://wordpress.org/support/users/flashuk/topics/)
 *   [Replies Created](https://wordpress.org/support/users/flashuk/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/flashuk/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/flashuk/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/flashuk/engagements/)
 *   [Favorites](https://wordpress.org/support/users/flashuk/favorites/)

 Search replies:

## Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[PDF Invoices & Packing Slips for WooCommerce] New filter for generate_pdf_ajax](https://wordpress.org/support/topic/new-filter-for-generate_pdf_ajax/)
 *  Thread Starter [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/new-filter-for-generate_pdf_ajax/#post-8572310)
 * Thank you for linking the code snippet, didn’t find that while I was googling!
 * Very useful 🙂
 * It makes more sense than what I put – I realise you just drop the ref to “my-
   account” which allows you to adjust the permissions.
 * FYI, anyone else using WC Vendors Pro who wants to add the buttons to the “Order”
   dashboard section, use the code below:
 *     ```
       add_filter('wcv_orders_add_new_row', function($new_row){
       	if ( !class_exists( 'WooCommerce_PDF_Invoices' ) ) {
       		return false;
       	}
       	$order_id = $new_row->order_number;
       	$order = new WC_Order ( $order_id );
   
       	$vendor_pdf_actions = array(
       		'invoice'       => array (
       			'class'     => 'button tips wpo_wcpdf invoice',
       			'url'       => wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $order->id ), 'generate_wpo_wcpdf' ),
       			'label'		=> sprintf( '<img src="%s" width="16">', WooCommerce_PDF_Invoices::$plugin_url . 'images/invoice.png'),
       			'target'    => '_blank'
       		),
       		'packing-slip'       => array (
       			'class'     => 'button tips wpo_wcpdf packing-slip',
       			'url'       => wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=packing-slip&order_ids=' . $order->id ), 'generate_wpo_wcpdf' ),
       			'label'		=> sprintf( '<img src="%s" width="16">', WooCommerce_PDF_Invoices::$plugin_url . 'images/packing-slip.png'),
       			'target'    => '_blank'
       		),
       	);
   
       	$new_row->row_actions = array_merge($new_row->row_actions, $vendor_pdf_actions);
   
       	return $new_row;
       }, 10, 1);
       ```
   
 * Cheers!
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [how to disable autosave in WP3.3 ?](https://wordpress.org/support/topic/how-to-disable-autosave-in-wp33/)
 *  [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/how-to-disable-autosave-in-wp33/#post-2458830)
 * **Word of warning:** You should never disable the ‘autosave’ function like this.
 * Because it will ‘break’ the preview function for posts.
 * Instead edit your **wp-config.php** to contain the following:
 * `define('AUTOSAVE_INTERVAL', 86400 ); // seconds (Default: 1 day)`
 * Put the interval time as long as you want.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Yoast SEO - Advanced SEO with real-time guidance and built-in AI] [Plugin: WordPress SEO by Yoast] Export – Import bug](https://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-export-import-bug/)
 *  [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-export-import-bug/#post-2030924)
 * UPDATE
 * You will want this code instead. The error handling is a mess and would advise
   redoing it. This was a quick hack to get it working.
 * _[32 lines of code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code).
   The maximum number of lines of code that you can post in these forums is **ten
   lines**. Please use the [pastebin](http://wordpress.pastebin.com/)]_
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Yoast SEO - Advanced SEO with real-time guidance and built-in AI] [Plugin: WordPress SEO by Yoast] Export – Import bug](https://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-export-import-bug/)
 *  [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-export-import-bug/#post-2030923)
 * On further investigation, I noticed that the file wasn’t importing properly (
   folder permissions).
 * So I wrote a patch for the code in class-config.php.
    Line: 412
 *     ```
       $file = wp_handle_upload($_FILES['settings_import_file']);
   
       				if ( isset( $file['file'] ) && !is_wp_error($file) ) {
       					require_once (ABSPATH . 'wp-admin/includes/class-pclzip.php');
       					$zip = new PclZip( $file['file'] );
                           $upload_dir = wp_upload_dir();
       					$unzipped = $zip->extract( $upload_dir['path'] );
       					if ( $unzipped[0]['stored_filename'] == 'settings.ini' ) {
       						$options = parse_ini_file( $unzipped[0]['stored_filename'] , true );
       						foreach ($options as $name => $optgroup) {
       							if ($name != 'wpseo_taxonomy_meta') {
       								update_option($name, $optgroup);
       							} else {
       								update_option($name, json_decode( urldecode( $optgroup['wpseo_taxonomy_meta'] ), true ) );
       							}
       						}
       						@unlink( $file['file'] ); // Remove archive file
   
       						$content .= '<p><strong>'.__('Settings successfully imported.', 'wordpress-seo' ).'</strong></p>';
       					} else {
       						$content .= '<p><strong>'.__('Settings could not be imported:', 'wordpress-seo' ).' '.__('Unzipping failed.', 'wordpress-seo' ).'</strong></p>';
       					}
       				} else {
       					if ( is_wp_error($file) )
       						$content .= '<p><strong>'.__('Settings could not be imported:', 'wordpress-seo' ).' '.$file['error'].'</strong></p>';
       					else
       						$content .= '<p><strong>'.__('Settings could not be imported:', 'wordpress-seo' ).' '.__('Upload failed.', 'wordpress-seo' ).'</strong></p>';
       				}
       ```
   
 * That works for MU but will need testing on standalone installations. It’s probably
   correct because it uses wp_upload_dir().
 * Thanks for the great plugin as always 🙂
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Yoast SEO - Advanced SEO with real-time guidance and built-in AI] [Plugin: WordPress SEO by Yoast] Export – Import bug](https://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-export-import-bug/)
 *  [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-export-import-bug/#post-2030922)
 * Found the answer to this – WordPress MU denies .zip files by default.
 * You need to go to:
    Network Admin > Settings > Upload file types
 * Then add **zip** to the exception list.
 * Then try again. You can now upload your settings file.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Cimy User Extra Fields] [Plugin: Cimy User Extra Fields] Found 2 PHP Notices](https://wordpress.org/support/topic/plugin-cimy-user-extra-fields-found-2-php-notices/)
 *  [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-cimy-user-extra-fields-found-2-php-notices/#post-2493258)
 * Bumping this topic. We’ve also found these errors.
 * We enable WP_DEBUG for local testing and would be grateful if you could fix these
   on this plugin, as we do use it on our commercial sites.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[User Role Editor] [Plugin: User Role Editor] WordPress 3.x.x Multisite bug (with details)](https://wordpress.org/support/topic/plugin-user-role-editor-wordpress-3xx-multisite-bug-with-details/)
 *  Thread Starter [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-user-role-editor-wordpress-3xx-multisite-bug-with-details/#post-2586942)
 * I would love to help but I can see there is a lot of changes from our version
   control.
 * I am already on deadline for a project and can’t spare any time.
 * To reproduce the problem you should:
    * Create an Editor account and another 
   test editor account * Use Multisite and create a blog * Assign those users to
   the blog so there is multiple authors * Add/Edit post and show “Authors” dropdown(
   enable it through Screen Options)
 * You will notice that if you logged in as an Admin, you can see the dropdown. 
   If you are an Editor, you cannot.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[User Role Editor] [Plugin: User Role Editor] User List hidden from Admins](https://wordpress.org/support/topic/plugin-user-role-editor-user-list-hidden-from-admins/)
 *  [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-user-role-editor-user-list-hidden-from-admins/#post-2537475)
 * We discovered this bug too – I’ve posted details about it here:
 * [http://wordpress.org/support/topic/plugin-user-role-editor-wordpress-3xx-multisite-bug-with-details?replies=1](http://wordpress.org/support/topic/plugin-user-role-editor-wordpress-3xx-multisite-bug-with-details?replies=1)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Yoast SEO - Advanced SEO with real-time guidance and built-in AI] [Plugin: WordPress SEO by Yoast] 'wp_0_options' error on multisite](https://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-wp_0_options-error-on-multisite/)
 *  [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-wp_0_options-error-on-multisite/#post-2505063)
 * Actually, taking a closer look, the solution isn’t correct.
 * According to the documentation, Yoast has not used the function correctly.
    [http://codex.wordpress.org/Function_Reference/get_admin_url](http://codex.wordpress.org/Function_Reference/get_admin_url)
 * File: wordpress-seo/inc/wpseo-non-ajax-functions.php
    Line: 122
 * His code is:
    `get_admin_url('admin.php?page=wpseo_dashboard')`
 * A value must be set for the first parameter. The correct code is:
    `get_admin_url(
   null, 'admin.php?page=wpseo_dashboard')`
 * This will stop the unnecessary error occurring.
 * Yoast, I hope you see this – Thanks.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Activate Users] [Plugin: WP Activate Users] Broken but have a fix](https://wordpress.org/support/topic/plugin-wp-activate-users-broken-but-have-a-fix/)
 *  Thread Starter [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-wp-activate-users-broken-but-have-a-fix/#post-2442748)
 * As promised.
 * I haven’t added new features but I fixed the existing code.
 * Enjoy [Download fixed version](http://www.jasonashdown.co.uk/2011/12/fixed-version-of-activate-users-buddypress/)
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Can't preview posts in Wp 3.2.1](https://wordpress.org/support/topic/cant-preview-posts-in-wp-321/)
 *  [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/cant-preview-posts-in-wp-321/#post-2192057)
 * Fixed it. Originally I took my example from [http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page](http://justintadlock.com/archives/2010/02/02/showing-custom-post-types-on-your-home-blog-page)
   but didn’t add any filtering for the category or the home page.
 * Here is the updated code:
 *     ```
       add_filter( 'pre_get_posts', 'my_get_posts' );
       function my_get_posts($query) {
   
           // Alters the main query to include different post-types by default everywhere
           // Useful when you want to mash up everything into the same feed
       	if ( !is_admin() && false == $query->query_vars['suppress_filters'] ) {
               if (is_category() OR is_home()) {
                   // Add your different post-types below ie. reviews, previews etc.
                   $query->set('post_type', array( 'post', 'review' ) );
               }
           }
   
       	return $query;
       }
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Can't preview posts in Wp 3.2.1](https://wordpress.org/support/topic/cant-preview-posts-in-wp-321/)
 *  [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/cant-preview-posts-in-wp-321/#post-2192055)
 * Tracked it down to the following code in my theme:
 *     ```
       add_filter( 'pre_get_posts', 'my_get_posts' );
       function my_get_posts($query) {
   
           // Alters the main query to include different post-types by default everywhere
           // Useful when you want to mash up everything into the same feed
       	if ( !is_admin() && false == $query->query_vars['suppress_filters'] ) {
               // Add your different post-types below ie. reviews, previews etc.
               $query->set('post_type', array(
                   'post',
                   'review'
               ));
           }
   
       	return $query;
       }
       ```
   
 * Looking at how to fix it.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Can't preview posts in Wp 3.2.1](https://wordpress.org/support/topic/cant-preview-posts-in-wp-321/)
 *  [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/cant-preview-posts-in-wp-321/#post-2192053)
 * I have the same problem but have not found a solution yet.
 * The same problem still occurs on my localhost. The Super Admin can preview posts
   but other users, even one’s with Editor permission, still cannot preview posts.
 *   Forum: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
   
   In reply to: [Use of Hyperdb](https://wordpress.org/support/topic/use-of-hyperdb/)
 *  [FlashUK](https://wordpress.org/support/users/flashuk/)
 * (@flashuk)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/use-of-hyperdb/#post-1645631)
 * The current setup of HyperDB is even simpler than that.
 * Copy the db-config.php file to you’re main directory (where wp-config.php is,
   it overrides these settings) and copy db.php into the wp-content folder – and
   away you go.
 * The post you linked to is quite old.
 * Refer to the comments in the code and README file for up-to-date instructions.
   I may post some examples later.

Viewing 14 replies - 1 through 14 (of 14 total)