viktorthang / wordpress-custom-content-type-manager

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

After upgrade from 0.9.3 to 0.9.4.1 Role Scoper plug-in no longer registers the Custom Content types developed with Wordpress Custom-Content-Type-Manager. #203

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
After upgrade from 0.9.3 to 0.9.4.1 Role Scoper plug-in no longer registers the 
Custom Content types developed with Wordpress Custom-Content-Type-Manager. 

*Note - Integration with Role Scoper worked well in version 0.9.3 

What is the expected output? What do you see instead? Role Scoper registers 
custom content types developed with custom-content-type-manager

Does the problem continue if you disable all other plug-ins? YES (all but Role 
Scoper and custom-content-type-manager enabled) same bug

Please provide any additional information below (e.g. Browser, version,
OS):

*SYSTEM INFO* 
------------------------ 
Plug in Version: 0.9.4.1-pl
WordPress Version: 3.2.1
PHP Version: 5.2.6
MySQL Version: 5.1.45-community
Server OS: WINNT
------------------------ 
Other Active plugins: 
 * Disable Autosave v. []
 * Avatars v.10.0 [http://www.sterling-adventures.co.uk/blog/2008/03/01/avatars-plugin/]
 * Akismet v.2.5.3 [http://akismet.com/]
 * All in One SEO Pack v.1.6.13.4 [http://semperfiwebdesign.com]
 * Capability Manager v.1.3.2 [http://alkivia.org/wordpress/capsman]
 * cforms v.11.7.1 [http://www.deliciousdays.com/cforms-plugin]
 * Dashboard Heaven v.1.0 [http://dave.kinkead.com.au/dashboard-heaven/]
 * Duplicate Post v.1.1.2 [http://www.lopo.it/duplicate-post-plugin/]
 * Emu2 - Email Users 2 v.0.82b [http://1manfactory.com/emu2]
 * Enhanced Meta Widget v.3.0.0 [http://neurodawg.wordpress.com/enhanced-meta-widget/]
 * Hide Update Reminder v.1.2 [http://www.stuffbysarah.net/wordpress-plugins/remove-update-reminder/]
 * MapPress Easy Google Maps v.2.28 [http://www.wphostreviews.com/mappress]
 * My Calendar v.1.9.2 [http://www.joedolson.com/articles/my-calendar/]
 * NextGEN Gallery v.1.8.3 [http://alexrabe.de/?page_id=80]
 * Post Sorting Reloaded v.1.2 [http://www.gab.ro/post-sorting-reloaded/]
 * Print Friendly and PDF v.3.0.6 [http://www.printfriendly.com]
 * Redirect My Login v.1.0.5 [http://www.jfarthing.com/wordpress-plugins/redirect-my-login-plugin]
 * Register Plus v.3.5.1 [http://skullbit.com/wordpress-plugin/register-plus/]
 * Role Scoper v.1.3.46 [http://agapetry.net/]
 * Shopp v.1.1.4.1 [http://shopplugin.net]
 * Simple Post Template v.1.1.0.1 [http://clifgriffin.com/2008/10/28/simple-post-template-wordpress-plugin/]
 * Simply Exclude v.1.7.9.2 [http://www.codehooligans.com/projects/wordpress/simply-exclude/]
 * TinyMCE Advanced v.3.4.2.1 [http://www.laptoptips.ca/projects/tinymce-advanced/]
 * uCan Post v.1.0.09 [http://cartpauj.com/projects/ucan-post-plugin]
 * Artiss YouTube Embed v.2.1 [http://www.artiss.co.uk/artiss-youtube-embed]
 * Youtube Feeder v.1.0.7 [http://andrewensley.com/projects/youtube-feeder-wordpress-plugin/]

Original issue reported on code.google.com by pswsa...@gmail.com on 7 Oct 2011 at 11:20

GoogleCodeExporter commented 8 years ago
Thanks for the bug report.

 there are a couple glitches that have been brought to my attention: one fix is to re-save your content type definitions (just edit them and then save them again). 

The other has to do with the way WP handles the post-type registration, so you 
may want to try the dev version on http://wpcctm.com/cctm-dev.zip -- I'm 
working on a fix there for what I believe is a related issue.

Original comment by fireproofsocks on 8 Oct 2011 at 3:01

GoogleCodeExporter commented 8 years ago
UPDATE 2

I installed the dev version referred to in the email, No change in the issue - 
Role scoper still does not recognize the Content Type. 

Also there is one more bug that was present in 0.9.3, Role Scoper prevents 
WordPress Custom-Content-Type-Manager menu from appearing in the left nav of 
WordPress. To access the menu you have to browse to plugins section and then 
choose the settings URL.

UPDATE 2

I did try to resave the definitions, in fact after the update the custom 
content type would no show in the admin menu until the each screen was resaved. 
I'll try the dev version and see what happens.

Original comment by pswsa...@gmail.com on 8 Oct 2011 at 3:58

GoogleCodeExporter commented 8 years ago
Well, part of the problem has to do with the Role Scoper plugin... it's got 
unhandled notices e.g.

Notice: Trying to get property of non-object in 
/path/to/html/wp-content/plugins/role-scoper/admin/admin_rs.php on line 185

The other thing is me trying to deal with WP's insane arguments to the 
register_post_type() function... using the get_post_types() function doesn't 
recognize public post types when they are registered verbosely using the 
attributes represented by the public argument: 

In other words, if public = true, then

publicly_queriable = true;
show_ui = true;
show_in_nav_menus = true;
exclude_from_search = false;

See issue 202.

So I have to work around the fact the WP doesn't register post-types in a 
sensible way.

I think the code in 0.9.4.2 handles this by checking the options and forcing 
"public" to true:

        // Verbosely check to see if "public" is inferred
        if (isset($def['publicly_queriable']) && $def['publicly_queriable']
            && isset($def['show_ui']) && $def['show_ui']
            && isset($def['show_in_nav_menus']) && $def['show_in_nav_menus']
            && (!isset($def['exclude_from_search']) || (isset($def['exclude_from_search']) && !$def['publicly_queriable']))
        ) 
        {
            $def['public'] = true;
        }

Can you see if 0.9.4.2 fixes this problem?

Original comment by fireproofsocks on 8 Oct 2011 at 5:36

GoogleCodeExporter commented 8 years ago
OK upgraded to 0.9.1.4 no change in bug, I'm glad to give you login to my dev 
site if you wish I just need secure method to send the info.  Just as a fyi i 
did test on my live production site with the same result.

Original comment by pswsa...@gmail.com on 11 Oct 2011 at 3:15

GoogleCodeExporter commented 8 years ago
Ok, in the 0.9.4.3-dev version (available @ http://wpcctm.com/ in about an 
hour), I reworked the "public" argument to the register_post_type() function -- 
I basically had to cater to a WP bug.  You should be able to download and 
install this latest patch, then try editing and re-saving your custom post-type 
definitions, and see if Role Scoper is happier.

If you need to send login details, you can contact me @ 
http://fireproofsocks.com/contact/

Original comment by fireproofsocks on 12 Oct 2011 at 8:44

GoogleCodeExporter commented 8 years ago
Ok, the newest version of the 0.9.4.3-dev patch does work with Role Scoper: 
http://wpcctm.com/ 

Original comment by fireproofsocks on 12 Oct 2011 at 8:45

GoogleCodeExporter commented 8 years ago
I installed [0.9.4.3-dev] and Role Scoper does now register the content type as 
long as the public attribute verbosely setting is checked.

There is still one issue, Role Scoper is keeping the Custom Content Types 
options from showing in the admin menus. If Role Scoper is deactivated the 
option displays.

Original comment by pswsa...@gmail.com on 12 Oct 2011 at 10:50

Attachments:

GoogleCodeExporter commented 8 years ago
Hmm... it seems that Role Scoper isn't enforcing permissions correctly -- the 
main menu item isn't there, but if you click on Plugins --> CCTM --> Settings, 
the page is still accessible.  So Role Scoper is only affecting the visibility 
of the page.  Weirdness.

When activating the Role Scoper plugin I get this error:

"The following Custom Post Types are enabled for RS filtering: Chapter. 
Non-administrators will be unable to edit them until you either disable 
filtering (Roles > Options > Realm > Post Type Usage) or assign type-specific 
Roles (Roles > General). Disregard this message if you have already done so."

And I've found several posts re Role Scoper where it made menu items disappear:

* 
http://wordpress.org/support/topic/plugin-role-scoper-menus-under-appearance-gon
e?replies=1
* 
http://wordpress.org/support/topic/role-scoper-plugin-crashes-navigation-menu?re
plies=4
* 
http://wordpress.org/support/topic/plugin-role-scoper-users-menu-tab-disappears?
replies=2

Ok, interesting: I found what's causing this.  It's another place where WP's 
architecture is weak: when using the add_menu_page() function 
(http://codex.wordpress.org/Function_Reference/add_menu_page) if 2 menu items  
use the same $position attribute, only one of the items shows up in the menu; 
one menu item gets overwritten.  I've updated the docs.

So, I've found 2 ways of working around this:
1. Add the following to your wp-config.php file:
define( 'SCOPER_DISABLE_MENU_TWEAK', true );
2. OR... change the $position attribute used by CCTM when it creates its menu.  
Inside includes/CCTM.php, search for the add_menu_page() function (around line 
793).  In the first item (the one for the main menu item), change the position 
from 71 to 73 (Role Scoper seems to be using 71 and 72).

Since WP seems vulnerable to collisions here, I think I'll put the menu 
position as a variable at the top of the CCTM class for easier editing.

Hope that takes care of it!

Original comment by fireproofsocks on 13 Oct 2011 at 3:38

GoogleCodeExporter commented 8 years ago
I edited the class worked like a charm - thanks. Maybe an option to change in 
the setting menu might be nice for those with issues in the future, just a 
thought.

Original comment by pswsa...@gmail.com on 15 Oct 2011 at 3:14

GoogleCodeExporter commented 8 years ago
Glad it worked.  Yeah, I thought about doing a setting for the menu position, 
but you'd never be able to change it via the GUI if it was encountering a 
problem, so instead I put it as a class variable (i.e. a "setting for 
developers") inside the CCTM class.  Oh well.

Original comment by fireproofsocks on 15 Oct 2011 at 4:30