Ryan Stutzman
Forum Replies Created
-
Hi, Yes! I was thinking the same thing! I will do some research to figure out what it would take.
Also, if you like the CSMI plugin, please leave a review! https://www.ads-software.com/support/view/plugin-reviews/location-specific-menu-items-by-country#postform
Hi doyenwilliams,
Word is the fix will be released with WP version 4.5.2. No ETA yet but it should be pretty soon.
In the meantime, you can simply delete the code I mentioned above and the plugin will work right away. (Unless you plan to create more than 70 menu items, removing the code won’t break anything, and it will be updated with the new WP version)
Ok, I just found out this is due to a bug in WP core. You can fix it for now by deleted the code above in
wp-admin/nav-menus.php
, or wait for WP to provide a fix.Hi gerdhansen2, I’ll work on it tonight and see what I can come up with.
In 4.5, WordPress added the following code to
wp-admin/nav-menus.php
, and for some reason yet to be discovered, it breaks the plugin./* * If a JSON blob of navigation menu data is found, expand it and inject it * into <code>$_POST</code> to avoid PHP <code>max_input_vars</code> limitations. See #14134. */ if ( isset( $_POST['nav-menu-data'] ) ) { $data = json_decode( stripslashes( $_POST['nav-menu-data'] ) ); if ( ! is_null( $data ) && $data ) { foreach ( $data as $post_input_data ) { // For input names that are arrays (e.g. <code>menu-item-db-id[3]</code>), derive the array path keys via regex. if ( preg_match( '#(.*)(?:\[(\d+)\])#', $post_input_data->name, $matches ) ) { if ( empty( $_POST[$matches[1]] ) ) { $_POST[$matches[1]] = array(); } $_POST[$matches[1]][(int)$matches[2]] = $post_input_data->value; } else { $_POST[$post_input_data->name] = $post_input_data->value; } } } }
Ok, Plugin is broken in 4.5. I’m working on a fix.
Hi, Sorry for the late reply. For some reason I didn’t get a notification.
So if I understand you correctly, you’re saying the country and visibility settings are not staying set. Is that right? Please email me at [email protected] so we can figure out what’s going on.
Forum: Plugins
In reply to: [Country Specific Menu Items] Please report bugs and give suggestionsHi Joshbunnik,
Thanks for your input. The best way to do this–and one that ensures the plugin is definitely working based on a real IP address–is to use a free VPN (https://hide.me for example) that sets your IP address to a specific country.
Ryan
Forum: Plugins
In reply to: [Menu Item Visibility Control] WordPress 4.3No problem. I wrote the developer asking if he was interested in some help managing it.
Here’s the fixed function:
function update_option( $menu_id, $menu_item_db_id, $args ) { $meta_value = get_post_meta( $menu_item_db_id, '_menu_item_visibility', true ); if ( isset( $_POST[ 'menu-item-visibility' ][ $menu_item_db_id ] ) ) { $new_meta_value = stripcslashes( $_POST['menu-item-visibility'][$menu_item_db_id] ); if( '' == $new_meta_value ) { delete_post_meta( $menu_item_db_id, '_menu_item_visibility', $meta_value ); } elseif( $meta_value !== $new_meta_value ) { update_post_meta( $menu_item_db_id, '_menu_item_visibility', $new_meta_value ); } } }
Forum: Plugins
In reply to: [Menu Item Visibility Control] WordPress 4.3Fixed it. https://docs.google.com/uc?authuser=0&id=0B4vaqDOBE4ZnYU5MZXpyanlING8&export=download
I had to change
$new_meta_value = stripcslashes( $_POST['menu-item-visibility'][$menu_item_db_id] );
to
if ( isset( $_POST[ 'menu-item-visibility' ][ $menu_item_db_id ] ) ) { $new_meta_value = stripcslashes( $_POST['menu-item-visibility'][$menu_item_db_id] );
Forum: Plugins
In reply to: [Menu Item Visibility Control] WordPress 4.3Yes sir. Please test it out and let me know if it works. (It works on my sites, but so does the old version).
Forum: Plugins
In reply to: [Menu Item Visibility Control] WordPress 4.3Forum: Plugins
In reply to: [Menu Item Visibility Control] WordPress 4.3Mine doesn’t do what this one does. This plugin is very simple though and should be easy to fix.
Forum: Plugins
In reply to: [Menu Item Visibility Control] WordPress 4.3Haha. Ok, I’ll try to fix it tomorrow post a link here.
Forum: Plugins
In reply to: [Menu Item Visibility Control] WordPress 4.3It’s a shame this plugin seems to have been abandoned. I wrote a similar plugin (CSMI) and would be willing to take it over.