ka2
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom DataBase Tables] Not able to see table after importing tableThank you for your inquiry.
I think there’s a high possibility that occurred error by conflicting of the jQuery.
Would you try to change the plugin options as follow?1. Go to the “General Settings” tab on the “CDBT Plugin Options” screen.
2. Uncheck the checkbox of “jQuery” in the “Administration Screen” column at the “Loading Resources” item of the “Advanced Plugin Settings”.
3. Click the “Save Changes” button.How did that go?
Forum: Plugins
In reply to: [Custom DataBase Tables] Displaying data using a Genesis Framework ThemeThank you for your inquiry.
In the troubled page, aren’t you inserting the shortcode in directly template or widget like without the post content?
In Custom DataBase Tables plugin, it will be loading the required resources when that found shortcodes in the post content. Therefor, it cannot loading the resources if the shortcodes is placing outer of the post content.In that case, you should initialize manually to render shortcode. As in the “functions.php” of your theme, you should insert code below.
if ( ! is_admin() ) { global $cdbt; add_action( 'init', array( $cdbt, 'cdbt_pre_shortcode_render' ), 10, 2 ); }Maybe I think that will be resolved the view’s matter if you do above.
On the other hand, I probably think the matter of entry and edit is another cause. That maybe is by conflicting the jQuery.
Please try to change plugin options as below if that’s conflicting the jQuery file.
1. Go to the “General Settings” tab on the “CDBT Plugin Options” screen.
2. Uncheck the checkbox of “jQuery” in the “Front-end Screen” column at the “Loading Resources” item of the “Advanced Plugin Settings”.
3. Click the “Save Changes” button.Please try it.
Thank you,Forum: Plugins
In reply to: [Custom DataBase Tables] Import CSVThank you for your inquiry.
I think maybe such error has occurred by different the number of columns because there is contained the comma in the string data that you want to import.
That matter will resolve likely if you make the appropriate escape.For example,
Inappropriate CSV file:
ID,name,gender,age,user_id,profile,created ,Firstname Lastname,male,20,1,If in the string data that contains the comma, you should make the appropriate escape.,2016/6/25 0:00Note: The first line of the CSV is the index of the column name
Specifies to the setting of “Prepend Indices Line” in the same column name order as the first line of the CSV when you import.
Then it will occur error after you import.
The reason is as follows:
The candidate of importing column: 7 columns
| ID | name | gender | age | user_id | profile | created |The actual column of data: 8 columns
| | Firstname Lastname | male | 20 | 1 | If in the string data that contains the comma | you should make the appropriate escape. | 2016/6/25 0:00 |Exactly it the number of the column does not match.
In order to import correctly at this example, we should change the data of CSV in the following.
Properly escaped CSV file:
ID,name,gender,age,user_id,profile,created ,Firstname Lastname,male,20,1,"If in the string data that contains the comma, you should make the appropriate escape.",2016/6/25 0:00Please wrap at quote of strings that contains the comma.
Thank you,
I closed this ticket because that has resolved.
Forum: Plugins
In reply to: [Custom DataBase Tables] Columns in Modal EditI closed this ticket because that has resolved.
I closed this ticket because that has resolved.
Forum: Plugins
In reply to: [Custom DataBase Tables] Failed to create table.Thank you for your inquiry.
You have mistaken the “Date” column definition. In the column of date type cannot have a binary attribute and strings like “TODAY” as default value. You should modify the “Date” column definition as follows.
If “Date” is date type:
Date date NOT NULL COMMENT 'Date You''re Grateful',If “Date” is binary type:
Date binary(n) NOT NULL DEFAULT 'TODAY' COMMENT 'Date You''re Grateful',Note: the “n” of the
binary(n)is any integerThank you,
Forum: Plugins
In reply to: [Custom DataBase Tables] A way to show data only after search?Thank you for your inquiry.
If you can prepare the function of getting the user’s search value, you can dynamically generate a shortcode by using the filter hook and its value.
I introduce the sample code to dynamically generate a shortcode from PHP using the GET values.
https://gist.github.com/ka215/e3b97bae49056e5e827efb6358b35e68
Also, you will be able to perform that by same filter hook if you want to limit to any searching columns.
Thank you,
Forum: Plugins
In reply to: [Custom DataBase Tables] Import data feature buggedThank you for your inquiry.
Could you go to step 3 on import wizard when you import csv?
So I will introduce an actual example of import procedures by the CSV in the following, please try to reference.The structure of the import table:
CREATE TABLE wp_test ( ID bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', name varchar(100) NOT NULL COMMENT 'Name', gender enum('male','female') NOT NULL COMMENT 'Gender', age tinyint(4) unsigned NOT NULL COMMENT 'Age', user_id bigint(20) unsigned DEFAULT NULL COMMENT 'User ID', profile text COMMENT 'Profile', created datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Created Datetime', updated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Updated Datetime', PRIMARY KEY (ID), KEY user_id (user_id) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COMMENT='For TEST';The contents of the CSV file:
Firstname Lastname,male,20,1,"This ""text"" must be escaped.",2016/6/25 0:00Firstly in the step 1 on the section of import data, we remove columns of the “ID (as auto increment column)” and the “updated (as auto insertion timestamp column)” from the “Prepend Indices Line”. Then, we specify the CSV to import, and click the button of “Upload”.
If we can upload the importable CSV, we can proceed to step 2. In the step 2, we can confirm SQL for importing. Let’s press the “Import” button.
The import process completed correctly, if it is displayed of “data is imported successfully” at the step 3. If an error occurs here, it is likely that there is a deficiency in character escape of data in the CSV file.
Thank you,
Thank you for your inquiry.
Firstly, please allow me to check that my understanding is correct or not.
In summary, you want to display the only data that stored “CAP” and “AP” to the “Qual” coulmn. And the “Qual” column is stored “CAP” or “AP” or “None” or NULL.
My understanding Okay?If ok, you should use the filter hook to resolve your request as following:
function custom_filter_sql( $sql, $table_name, $sql_clauses ) { $target_tables = [ 'your_table_name' ]; if ( in_array( $table_name, $target_tables ) ) { if ( is_array( $sql_clauses[1] ) ) { // Narrowing is find_data() $_add_query = "AND Qual IN ('CAP','AP')"; foreach ( $sql_clauses[1] as $_i => $_union_query ) { $_before_query = function_exists( 'mb_substr' ) ? mb_substr( $_union_query, 0, -1 ) : substr( $_union_query, 0, -1 ); $sql_clauses[1][$_i] = $_before_query . $_add_query . ')'; } $sql = implode( ' ', $sql_clauses[1] ) .' '. $sql_clauses[2] .' '. $sql_clauses[3]; } else { // Narrowing is get_data() $_new_sql = <<<SQL SELECT %s FROM %s %s %s %s SQL; $_add_query = "Qual IN ('CAP','AP')"; $_where_clause = empty( $sql_clauses[1] ) ? 'WHERE '. $_add_query : $sql_clauses[1] .'AND '. $_add_query; $sql = sprintf( $_new_sql, $sql_clauses[0], $table_name, $_where_clause, $sql_clauses[2], $sql_clauses[3] ); } } return $sql; } add_filter( 'cdbt_crud_find_data_sql', 'custom_filter_sql', 10, 3 ); add_filter( 'cdbt_crud_get_data_sql', 'custom_filter_sql', 10, 3 );Also because I uploaded the generic sample code to the Gist, please try to refer those code at the same time.
https://gist.github.com/ka215/4d82f74a74f0c3b169ecd68f7b7ed5f8
Thank you,
Thank you very much for your prompt reply.
Sorry, I cannot get your specified theme/plugin because that has to pay for using.
So, please tell me your site url and how to access your site as an admin. Thereby I may survey your trouble. Please send that informations to my email below, for taking care of it.
email: ka2@ka2.org
Best regards,
Thank you for your inquiry.
Sorry, I don’t know such plugin or theme that you said. I tried to search on the public repositories in the wordpress.org, but nothing was such plugin and theme.
Because that package has been probably distributing informally, I cannot survey the conflict detail that will be occurring.Maybe, you might be able to improve the conflict by disabling a particular loading resources at the plugin options of the CDBT plugin.
I am truly sorry for not being able to help you.
Forum: Plugins
In reply to: [Custom DataBase Tables] Columns in Modal EditThank you for your inquiry.
You can resolve that by using the filter hook of “cdbt_shortcode_custom_forms”.
Please try to use sample code below as reference.function cdbt_edit_custom_forms( $elements_options, $shortcode_name, $table ){ $target_table = 'your_table_name'; $hidden_cols = [ 'hide_column1', 'hide_column2' ]; if ( $target_table === $table ) { foreach ( $elements_options as $_i => $_option ) { if ( in_array( $_option['elementName'], $hidden_cols ) ) { $elements_options[$_i]['elementType'] = 'hidden'; } } } return $elements_options; } add_filter( 'cdbt_shortcode_custom_forms', 'cdbt_edit_custom_forms', 10, 3 );Also this filter hook will be enabled the shortcode of “cdbt-entry”, too. So it’s cons of current plugin, I’m going to improve that at future.
Thank you,
Forum: Plugins
In reply to: [Custom DataBase Tables] Adjusting Table and Column WidthI’m so sorry for not replying sooner.
About the adjustment of the cell width on the displayed data table, In the plugin specification is allowed by using a filter. Because I never tried actually yet, I please give time to investigate.
Also at the released new version 2.1.31, we added new component “Dynamic Table Layout” for displaying data. This component has feature that automatically adjusts of the cell width, and that is able to drag the table body when inner content is overflow, too. Please try it.
Thank you,
Forum: Plugins
In reply to: [Custom DataBase Tables] Multiple row for Entry DataThank you for your inquiry.
If you want to register a plurality of data at once, you should be whether to use “insert_data()” the built-in method of the plugin or to use the data import function with CSV file and the like.
Please refer the example of the multiple data registration by using the “insert_data()” method from below url.
https://ka2.org/cdbt/v2/methods/insert_data/
Thank you,