google-code-export / wordpress-custom-content-type-manager

Automatically exported from code.google.com/p/wordpress-custom-content-type-manager
2 stars 1 forks source link

Disables ability to 'bulk edit' posts when filter is applied. #458

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
WP: 3.5.1, CCTM: 0.9.6.7; Theme: Montezuma (Bytesforall) 1.1.3 [but have 
confirmed conflict remains when I switch to 'Twenty Twelve' theme]

What steps will reproduce the problem? (Be specific enough so that someone
else can make the plugin fail for themselves. Remember: if the issue can't
be fixed if it can't be reproduced!)

1. Through WP dashboard | All posts, apply filter - e.g. show only a specific 
category
2. Select some / all of the displayed posts to 'bulk edit', choose edit options 
then 'enter'

What is the expected output? What do you see instead?

Expected output is that the desired changes are made to selected posts. 
Instead, gives a WP 'error' screen stating: "Invalid post type"

Does the problem continue if you disable all other plugins? (Conflicts
between plugins are easily the #1 cause of errors, so it's important to
isolate the issue):

Problem continues with all plugins except CCTM deactivated; disappears with all 
other plugins activated but CCTM deactivated.

Please copy and paste the system information that appears in a yellow
textarea when you click on "Report a Bug" on any CCTM admin screen (this
includes the version of theplugin, the version of PHP, the version of MySQL, a 
list of other active plugins etc.):

*SYSTEM INFO* 
------------------------ 
Plugin Version: 0.9.6.7-pl
WordPress Version: 3.5.1
PHP Version: 5.3.1
MySQL Version: 5.1.41
Server OS: WINNT
------------------------ 
ACTIVE PLUGINS: 
 * Add Functions v.0.2 [http://tigor.me/add-functions/]
 * Akismet v.2.5.7 [http://akismet.com/?return=true]
 * BuddyPress Template Pack v.1.2.1 [http://wordpress.org/extend/plugins/bp-template-pack/]
 * BuddyPress v.1.6.4 [http://buddypress.org]
 * Codepress Admin Columns v.1.4.9 [http://www.codepress.nl/plugins/codepress-admin-columns/]
 * Configure SMTP v.3.1 [http://coffee2code.com/wp-plugins/configure-smtp/]
 * Cookie warning v.1.2 [http://majweb.co.uk/services/cookie-warning]
 * Custom Post Templates v.1.5 [http://wordpress.org/extend/plugins/custom-post-template/]
 * WCK Taxonomy Creator v.1.0.1 []
 * Force Download Shortcode v.1.1 [http://www.werdswords.com]
 * Page Columnist v.1.7.3 [http://www.code-styling.de/english/development/wordpress-plugin-page-columnist-en]
 * Plugin Organizer v.2.5.9 [http://wpmason.com]
 * Query Multiple Taxonomies v.1.6.2 [http://scribu.net/wordpress/query-multiple-taxonomies]
 * Random image gallery with pretty photo zoom v.6.1 [http://www.gopiplus.com/work/2011/12/12/wordpress-plugin-random-image-gallery-with-pretty-photo-zoom/]
 * Random Text v.0.2.9 [http://www.pantsonhead.com/wordpress/randomtext/]
 * Remove Widget Titles v.1.0 [http://scratch99.com/wordpress/plugins/remove-widget-titles/]
 * SI CAPTCHA Anti-Spam v.2.7.6.4 [http://www.642weather.com/weather/scripts-wordpress-captcha.php]
 * Theme My Login v.6.2.3 [http://www.jfarthing.com/development/theme-my-login/]
 * Widget Logic v.0.56 [http://wordpress.org/extend/plugins/widget-logic/]
 * WP Better Emails v.0.2.4.1 [http://wordpress.org/extend/plugins/wp-better-emails/]
 * WP Database Optimizer Tools v.0.2 [http://xtremenews.info/wordpress-plugins/wp-database-optimizer-tools/]
 * WP Month Calendar v.1.0 [http://niklas-rother.de/]
------------------------ 
CURRENT THEME: Montezuma v.1.1.3 
http://wordpress.bytesforall.com/wordpress-themes/montezuma/

Original issue reported on code.google.com by michael...@gmail.com on 17 Feb 2013 at 11:05

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, I've reproduced this -- it's helpful if you paste in your URL.  To 
reproduce:

1. Show all posts (pages, etc).
2. Filter by category (e.g. show all uncategorized)
3. Attempt to apply a new category (e.g. you can re-select "uncategorized") and 
attempt to save.

It seems that when you attempt to submit your changes, the post_type parameter 
in the URL gets malformed -- it shows up as "Array", e.g.:

http://mysite.com/wp-admin/edit.php?s=&post_status=all&post_type=Array&_wpnonce=
b4410495bf&_wp_http_referer=%2Fwp-admin%2Fedit.php%3Fs%26post_status%3Dall%26pos
t_type%3Dmovie%26action%3D-1%26m%3D0%26cat%3D24%26paged%3D1%26mode%3Dlist%26acti
on2%3D-1&action=edit&m=0&cat=24&paged=1&mode=list&post_category%5B%5D=0&post_cat
egory%5B%5D=17&tax_input%5Bpost_tag%5D=&_status=-1&bulk_edit=Update&post_view=li
st&screen=edit-movie&post%5B%5D=75&post%5B%5D=78&post%5B%5D=77&action2=-1

When the CCTM is deactivated, performing the same steps preserves the post_type 
parameter, e.g. 

http://mysite.com/wp-admin/edit.php?s&post_status=all&post_type=post&m=0&cat=1&p
aged=1&mode=list&updated=5&skipped=0&locked=0

I don't know where all those other URL parameters are coming from, but the 
post_type is definitely wrong.

My best guess of where this is being caused is in the problematic and 
frequently broken request filter that has been the cause of many glitches like 
this.  My guess is that it's returning an array of post-types instead of a 
single value...

Original comment by ever...@fireproofsocks.com on 17 Feb 2013 at 4:55

GoogleCodeExporter commented 9 years ago
Thanks for the response and for looking into it. It's one of those 'bugs' that 
once you know it's there, a work-around is easy ... simply deactivate CCTM, do 
what you gonna do ... and reactivate the plugin. 

As you've already said, no 'damage' is done to any fields created by CCTM when 
you make any necessary changes, so it's a bit of a pain rather than a 'show 
stopper'.

For reference - a bit late now, sorry, - typical URL is 
http://captioned.s-t-u-f-f.net, though obviously in this case no effects of the 
issue are visible.

Original comment by michael...@gmail.com on 17 Feb 2013 at 5:07

GoogleCodeExporter commented 9 years ago
Deactivating is a poor workaround... and not one that works when you need to 
bulk edit custom post-types.

Original comment by ever...@fireproofsocks.com on 17 Feb 2013 at 5:10

GoogleCodeExporter commented 9 years ago
Lol, oh yeah! Hadn't thought of that ... probably because I don't use them 
myself at the moment.

Original comment by michael...@gmail.com on 17 Feb 2013 at 5:17

GoogleCodeExporter commented 9 years ago
Yep, it's that same cursed filter.  The fix is this:  inside of 
includes/CCTM.php inside the request_filter() function, add this at the top 
(say at line 2149):

        if ( substr($_SERVER['SCRIPT_NAME'], strrpos($_SERVER['SCRIPT_NAME'], '/')+1) == 'edit.php' 
            && self::get_value($_GET, 'post_type')) {
            return $query;
        }
That will prevent the filter from being applied on the edit page.  I'm 
seriously concerned though that this (like all the other fixes regarding this 
filter) will have unintended consequences.  The WP architecture is just not 
good for this type of thing.

Original comment by ever...@fireproofsocks.com on 17 Feb 2013 at 5:24

GoogleCodeExporter commented 9 years ago
Thanks for the fix. I tried to install as instructed but guess I did it wrongly 
as it didn't seem to work. Was going to say that I'll wait for if / when you 
include the fix in a plugin upgrade, but as I've just downloaded your latest, 
and the bug seems to have gone away, I guess you've already done it! Many many 
thanks.

Original comment by michael...@gmail.com on 19 Feb 2013 at 4:11

GoogleCodeExporter commented 9 years ago
The plugin upgrade was released yesterday -- 0.9.7 is available and your sites 
should receive notices that an update is available (WordPress repo has been 
very unreliable with updates recently for some reason).   I was able to verify 
the behavior, and the fix outlined above fixed it.  So confirm your version 
number -- if you are using the latest version and still experiencing the 
problem, then post back here with details.

Original comment by ever...@fireproofsocks.com on 19 Feb 2013 at 4:55