Combo Multisearch Issue
-
I am trying to add a download button to my search form. The system work beautiful when I use a default template ([pdb_list template=multisearch]). I have taken the multisearch template and added the download button at the bottom. When I use the template with the search button then the search field disappears and the download button is no where to be found.
My custom templates are in the childtheme and I installed the Custom Templates Folder 2 plugin. That part is working because I have use the customized template with the MultiSearch mode (display multiple fields to search in) and the download button is there. But when I use it with the Combo Multisearch (single search field, that looks in all existing fields) then neither the search field nor the download button shows up.
-
I don’t know what the exact problem is, there is probably some fault in the custom template you are using.
I suggest you very carefully compare your custom template to the multisearch template provided by the plugin. Since that is a working template you should be able to find the problem that way.
If you find there is a problem with the template provided with the plugin, let me know, however, I cannot debug custom templates.
Thank you for getting back to me. It appears to be working now. However, I am not able to download my records. I can download if I use the Multi Search Function but not with the Combo Search.
I am able to make it work by using the search with the multisearch template and the list with the custom template.
As far as the custom template itself, it is a copy of the multisearch template. I just added the search button at the bottom.
Any help will be appreciated.
So, can you be more specific about what happens when it doesn’t work?
The first place to look is in the Browser Developer Tools console, that will tell you if there are any javascript errors.
Thank you for following up. I can do the search with no issues. It returns the values, so that part works great. The issue is when I click on the download CSV for this list button, it just flashes and resets the form.
This only happens when a do single field search. If I do a multi field search then it downloads beautifully. I’d like to be able to download with the single field since that is what my clients will be using. The custom template is the sample code provided in your support page, with no changes.
You can try my site by navigating to this URL: https://sbnai.net/influencers/database_test/Here’s the custom code just in case you want to see it.
<?php /* * * template for participants list shortcode output including a CSV download form * */ ?> <div class="wrap <?php echo $this->wrap_class ?>" id="<?php echo $this->list_anchor ?>"> <?php /* * SEARCH/SORT FORM * * the search/sort form is only presented when enabled in the shortcode. * */ $this->show_search_sort_form(); /* LIST DISPLAY */ /* * NOTE: the container for the list itself (excluding search and pagination * controls) must have a class of "list-container" for AJAX search/sort to * function */ ?> <table class="wp-list-table widefat fixed pages list-container" > <?php // print the count if enabled in the shortcode $this->print_list_count($wrap_tag = false); ?> <?php if ( $record_count > 0 ) : // print only if there are records to show ?> <thead> <tr> <?php /* * this function prints headers for all the fields * replacement codes: * %2$s is the form element type identifier * %1$s is the title of the field */ $this->print_header_row( '<th class="%2$s" scope="col">%1$s</th>' ); ?> </tr> </thead> <tbody> <?php while ( $this->have_records() ) : $this->the_record(); // each record is one row ?> <tr> <?php while( $this->have_fields() ) : $this->the_field(); // each field is one cell ?> <td class="<?php echo $this->field->name ?>-field"> <?php $this->field->print_value() ?> </td> <?php endwhile; // each field ?> </tr> <?php endwhile; // each record ?> </tbody> <?php else : // if there are no records ?> <tbody> <tr> <td><?php if ($this->is_search_result) echo Participants_Db::$plugin_options['no_records_message'] ?></td> </tr> </tbody> <?php endif; // $record_count > 0 ?> </table> <?php $this->show_pagination_control(); ?> <?php /** * prints the CSV download form * * @see full instructions on https://xnau.com/adding-a-csv-download-button/ * * @param array $config * 'title' => string the title for the export control * 'helptext' => string helptext to show with the control * 'button_text' => text shown on the download button * 'filename' => string initial name of the file * 'allow_user_filename' => bool if false, user cannot set filename * 'export_fields' => array of field names to include in the export * 'field_titles_checkbox' => bool whether to show the "field titles" checkbox * 'field_titles_checkbox_label' => string label to use for the field titles checkbox */ $config = array(); // this shows the form with all default values $this->csv_export_form( $config ); ?> </div>
OK, so your code looks fine, that’s not the problem. I took a look at you page, I see what is happening, but I don’t know why. It works fine unless there is a search result displaying, then it doesn’t begin the download, just reloads the page.
I’ve tested this on my site and it is working as it should, so there’s nothing obviously wrong with the plugin code.
Next step would be for you to use plugin debugging to see what is coming in to the log. My guess is the nonce (security check) is failing, which forces a page reload.
Clear the debugging log, then test the CSV download after performing a search. Check the log right after that.
It is returning the following error message:
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ORDER BY p.date_updated DESC’ at line 1]
SELECT p.address, p.bio_email, p.bio_phone, p.hashtag, p.frequency, p.num_posts_hash, p.date_scan, p.date_first_post, p.date_last_post, p.most_recent, p.bio, p.is_verified, p.nickname, p.num_followers, p.num_following, p.num_posts, p.num_likes, p.num_profile_likes, p.secuid, p.id, p.date_recorded, p.date_updated, p.is_private, p.platform, p.profile, p.profile_pic_url, p.hashtags, p.likes, p.location, p.num_comments, p.play_count, p.post_date, p.post_id, p.post_link, p.post_text, p.shares, p.language FROM wp_participants_database p WHERE (p.address REGEXP “[[:<:]]yahoo[[:>:]]” OR p.bio_email REGEXP “[[:<:]]yahoo[[:>:]]” OR p.bio_phone REGEXP “[[:<:]]yahoo[[:>:]]” OR p.hashtag REGEXP “[[:<:]]yahoo[[:>:]]” OR p.frequency REGEXP “[[:<:]]yahoo[[:>:]]” OR p.num_posts_hash REGEXP “[[:<:]]yahoo[[:>:]]” OR p.date_last_post REGEXP “[[:<:]]yahoo[[:>:]]” OR p.most_recent REGEXP “[[:<:]]yahoo[[:>:]]” OR p.last_update_user REGEXP “[[:<:]]yahoo[[:>:]]” OR p.bio REGEXP “[[:<:]]yahoo[[:>:]]” OR p.is_verified REGEXP “[[:<:]]yahoo[[:>:]]” OR p.nickname REGEXP “[[:<:]]yahoo[[:>:]]” OR p.num_followers REGEXP “[[:<:]]yahoo[[:>:]]” OR p.num_following REGEXP “[[:<:]]yahoo[[:>:]]” OR p.num_posts REGEXP “[[:<:]]yahoo[[:>:]]” OR p.num_likes REGEXP “[[:<:]]yahoo[[:>:]]” OR p.num_profile_likes REGEXP “[[:<:]]yahoo[[:>:]]” OR p.secuid REGEXP “[[:<:]]yahoo[[:>:]]” OR p.id REGEXP “[[:<:]]yahoo[[:>:]]” OR p.private_id REGEXP “[[:<:]]yahoo[[:>:]]” OR p.is_private REGEXP “[[:<:]]yahoo[[:>:]]” OR p.platform REGEXP “[[:<:]]yahoo[[:>:]]” OR p.profile REGEXP “[[:<:]]yahoo[[:>:]]” OR p.profile_pic_url LIKE “%yahoo%” OR p.hashtags REGEXP “[[:<:]]yahoo[[:>:]]” OR p.likes REGEXP “[[:<:]]yahoo[[:>:]]” OR p.location REGEXP “[[:<:]]yahoo[[:>:]]” OR p.num_comments REGEXP “[[:<:]]yahoo[[:>:]]” OR p.play_count REGEXP “[[:<:]]yahoo[[:>:]]” OR p.post_id REGEXP “[[:<:]]yahoo[[:>:]]” OR p.post_link LIKE “%yahoo%” OR p.post_text REGEXP “[[:<:]]yahoo[[:>:]]” OR p.shares REGEXP “[[:<:]]yahoo[[:>:]]” OR p.language LIKE “%yahoo%” OR p.plateform REGEXP “[[:<:]]yahoo[[:>:]]”) AND ORDER BY p.date_updated DESCI’m running the latest version of MySQL, not sure why is returning that error message. It works if I use multiple search fields.
What is the exact shortcode you are using?
Also, do you have both multisearch and combo search fields configured? Looks like something might be wrong with the multisearch configuration. Try clearing everything out of the multisearch configuration.
-
This reply was modified 2 years, 11 months ago by
xnau webdesign.
This is the shortcodes that I’m using:
[pdb_search template=multisearch]
[pdb_list template=custom]I do have multisearch and combo search fields configured. I’ve cleared everything and reconfigured and got the same issue. I’ll be happy to provide you with admin access to you can see the configuration.
OK, it’s best to avoid using two shortcodes for that, use only the list shortcode with the multisearch code. If you need to use a custom template, add the multisearch code to that template so you’re only using a single shortcode.
There is probably something wrong with the multisearch configuration that clearing and reconfiguring is not fixing. There is a setting in the options database table (wp_options), I suggest you try deleting it, then rebuild your multi-select fields. The option is named “pdbcms_multifields” just delete that option from the table.
Thank you for your patience and direction.
Apparently searching on multiple date fields is an issue. I removed the date fields from the search and now it works as it is intended.
However I’ve been getting this warning message a few times and it appears like it is related to an update that keeps popping up but that it is already installed. Any ideas?
Warning: The URL https://xnau.com/xnau-updates/?action=get_metadata&slug=pdb-combo-multisearch&installed_version=2.4.9&php=7.3.33&locale=en_US&checking_for_updates=1 does not point to a valid metadata file. WP HTTP Error: cURL error 28: Operation timed out after 10000 milliseconds with 482 bytes received in /home/www/sbnai.net/influencers/wp-content/plugins/participants-database/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p11/UpdateChecker.php on line 430 Warning: The URL https://xnau.com/xnau-updates/?action=get_metadata&slug=pdb-custom-templates2&installed_version=2.4.1&php=7.3.33&locale=en_US&checking_for_updates=1 does not point to a valid metadata file. WP HTTP Error: cURL error 28: Operation timed out after 10000 milliseconds with 470 bytes received in /home/www/sbnai.net/influencers/wp-content/plugins/participants-database/vendor/yahnis-elsts/plugin-update-checker/Puc/v4p11/UpdateChecker.php on line 430
Don’t worry about those warnings, it’s just checking for updated versions, and the server was temporarily down.
So, you said it was multiple date fields: were they both in the configuration as combo search fields or were they multi search fields? I’d like to follow up on that.
-
This reply was modified 2 years, 11 months ago by
- The topic ‘Combo Multisearch Issue’ is closed to new replies.