Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete option not available #5

Closed
kantha05 opened this issue Sep 15, 2014 · 6 comments
Closed

Delete option not available #5

kantha05 opened this issue Sep 15, 2014 · 6 comments

Comments

@kantha05
Copy link

Hi there,

I'm new to this plugin. First of all, I would like to thank you for this wonderful plugin. I'm using it for the past few weeks. On the plugin description I see that we can delete the row of the table using the delete button next to the row but in my case, I'm not seeing the delete button there. Please help me on how to get it.

FYI, I have added these codes in my functions.php file

function dbTableEditorScripts(){
wp_register_script('employee-table-extensions-js',
get_stylesheet_directory_uri().'/employee-table.js',
array('db-table-editor-js'));
}
add_action('db-table-editor_enqueue_scripts', 'dbTableEditorScripts');

function pa_admin_area_favicon() {
$favicon_url = get_option('ws_favicon');
echo '';
}
add_action('admin_head', 'pa_admin_area_favicon'); if(function_exists('add_db_table_editor')){ add_db_table_editor(array( 'title'=>'[page title]', 'table'=>'[table-name]', 'sql'=>'SELECT * FROM [table-name] ORDER BY sub_id DESC' ));}

Please let me know if I have missed anything.

Thanks in advance.

-Kantha

@bobbysmith007
Copy link
Member

If you are missing the delete button, you dont have editcap for whatever reason or the grid has been set to noedit. editcap defaults to edit_others_posts. noedit will default to true if there is no column named with the id_column value from the config (defaults to id).

So: ensure you have edit_others_posts capability, and either a column named id or set the config variable id_column to the correct value in your call to add_db_table_editor.

Cheers, hope this helps

Ps: I added this information to a new Troubleshooting section of the README.md

@kantha05
Copy link
Author

Hi,

Thanks for your reply. I understand that I have to update the values for noedit and id_column variables. It would be great if you let me know where to update these variables. Is there any interface for this to update, if not please let me know which file have to be updated.

Thanks,
-Kantha

@bobbysmith007
Copy link
Member

Those are arguments to the add_db_table_editor as listed in the comment above.

add_db_table_editor(Array('id_column'=>'foo' ...

This plugin has no configuration admin screens and is controlled by php code in your theme.

@ik-j
Copy link

ik-j commented Nov 24, 2014

I am new to WP and am learning plugins development though I am a developer in PHP, Java etc. But I find it hard to use this plugin. First of I have a database with my own tables. I want this plugin to work with those tables.

I have placed the dummy code (with replacing employee table with my own table) and placed a shortcode on a newly created WP page, but seems like nothing works :(

Will anyone provide a dummy step by step help regarding this plugin, as I very much need CRUD feature in WP.

@ik-j
Copy link

ik-j commented Nov 24, 2014

I receive this error, No Database Table Configured to Edit. As i checked the code, id is going NULL to that function. Does this plugin maintain IDs for tables or just passing table name will do ?

@bobbysmith007
Copy link
Member

Sorry I apparently missed you updates to this (months and months ago). This plugin is mostly intended to be used from admin screens. Recently a patch that makes it work on public facing pages was added to allow this to work.

All configuration code needs to happen BEFORE the admin_menu action. The best place to put the configuration code is in the theme's "functions.php" file or in a plugins php file.

As noted however, this plugin was written by an experienced developer for experienced developers. I hope you were able to make it work, but if not there are more streamlined options available for crud that provides admin screens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants