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

The name "column" is already in use Error when adding custom columns #495

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
WP version : 3.5.1
PHP version : 5.3.16
CCTM Version : 0.9.7.5-pl
Active plugins : Adminer 1.2.3, Cron GUI 1.0.3

Description :
A label "The name 'mycolumn' is already in use" is displayed for each instance 
of custom type, in the list of them in admin UI (generated by CCTM). 

To reproduce the problem :
1. Create a custom type 'website', with several fields
2. Enable option "Customize columns" for this custom type, and choose columns 
you want to be displayed in admin UI when selecting the list of these custom 
types instances
3. Then, declare custom code in wordpress (for example in main plugin file) to 
add your own custom columns, using standard WP functions :

// declare filter
add_filter('manage_website_posts_columns', 'rpoc_manage_website_posts_columns', 
10, 1);

// add a column 'myaction' in admin UI list
function rpoc_manage_website_posts_columns($columns) {
    return array_merge($columns,array('myaction'=>__('myaction')));
}

>> the label "The name myaction is already in use." is displayed on each row of 
the list of custom types instances "website".

Going further, to write your own content into the cell, you can declare this 
code too in WP :

// declare filter
add_action('manage_website_posts_custom_column', 
'rpoc_manage_website_posts_custom_column', 10, 2);
function rpoc_manage_website_posts_custom_column($column, $post_id) {
    switch ($column) {
        case 'myaction':
            echo '<a href="http://www.google.com">Google</a>';
            break;
        default:
            break;
    }
}

>> the label "The name myaction is already in use.<a 
href="http://www.google.com">Google</a>" is displayed on each row of the list 
of custom types instances "website". It changes nothing. 

Original issue reported on code.google.com by jerome.d...@gmail.com on 15 May 2013 at 3:22

GoogleCodeExporter commented 9 years ago
File to import initial definition of custom objects

Original comment by jerome.d...@gmail.com on 15 May 2013 at 3:31

Attachments:

GoogleCodeExporter commented 9 years ago
I can't support custom code and custom actions.  This is sorta like tearing off 
that 'Warranty Void if Opened' sticker and then complaining that things broke 
when you tweaked them.  If you're going to use your own code, I would recommend 
NOT checking the "Customize Columns" box because that triggers CCTM actions.  

However, I cannot reproduce the initial problem.  Custom columns are working:

http://www.screencast.com/t/NlT3pbrx

Since this works locally on my installation, my only guess is that the plugin 
did not install correctly on your server -- maybe it's got an older version of 
some of the PHP files (?).  I've seen WordPress make some mistakes when 
unpackaging plugins on certain servers -- you really need to copy and paste 
EVERYTHING from that box of text.  That's why put it there that that's why I 
ask for it: it tells me which server OS you're running.  See 
https://code.google.com/p/wordpress-custom-content-type-manager/wiki/Invalid

I would recommend that you make a full backup of your site, then completely 
uninstall the CCTM and delete its folder from wp-content/plugins/ then 
reinstall to see if a 100% fresh installation fixes the problem.

Original comment by ever...@fireproofsocks.com on 15 May 2013 at 3:48

GoogleCodeExporter commented 9 years ago
I tried reinstall but no changes.

FYI, I found that this is in includes/functions.php:62 that the error is 
thrown. You don't support other custom columns that have not be defined in the 
columns tab of "customize columns". I don't know in which context this is used, 
but a simple search gave me a lot of matches.

You could easily reproduce if you add the code provided. But I understand that 
mixing CCTM and custom code can be difficult to support. 

So I will not use customize columns but will write my own. It could be great if 
it would do the trick, but as I said I can understand that you don't want to 
drive CCTM too much complex.

Great plugin anyway, thanks for your support .  

Original comment by jerome.d...@gmail.com on 15 May 2013 at 6:58

GoogleCodeExporter commented 9 years ago
Well, the CCTM's customize column feature appears to be working, and that's my 
priority.  The conflicts with events and hooks and global variables that comes 
with custom code is really a WordPress problem that I'm not going to get into.  
The way that WP handles the custom columns is really baffling architecture in 
my opinion: the entire event-driven model breaks down pretty quickly with too 
many customizations.

Original comment by ever...@fireproofsocks.com on 15 May 2013 at 7:04