WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WordPress Download Monitor] Download Page Search Terms Formatting

[Plugin: WordPress Download Monitor] Download Page Search Terms Formatting

  • ARHistoryHub
    Member

    @arhistoryhub

    Hello everyone –
    I’ve been having some issues with the search form for the download page. The form is stripping out spaces and special characters from the search string. For example, searching “funny cats” actually produces a query for “funnycats”. I can manually edit the url to add a “+” symbol between the terms and it works fine. My default wordpress search isn’t similarly afflicted, it’s just download monitor.

    And ideas on how to fix this? I’ve spent hours and hours trying to solve this with no success. Thanks so much!

    http://wordpress.org/extend/plugins/download-monitor/

Viewing 3 replies - 1 through 3 (of 3 total)
  • ARHistoryHub
    Member

    @arhistoryhub

    So I think it might be some sort of urlencode() issue with the search function – dlsearch. Anyone know enough to help me out with this?

    ARHistoryHub
    Member

    @arhistoryhub

    Alright so after banging around in the download-monitor-page-addon.php I was able to sort of fix this in a very crude way. For those of you having the same problem (which apparently only occurs with WP 3.1), here’s what you do…

    Find this….

    `$page = ”;
    $fields = ”;

    // Ensure it works with default permalinks
    global $post;
    if ($post && is_page()) $fields = ‘<input type=”hidden” name=”page_id” value=”‘.$post->ID.'” />’;
    if ($post && is_single()) $fields = ‘<input type=”hidden” name=”p” value=”‘.$post->ID.'” />’;
    if (isset($_GET[‘lang’])) $fields .= ‘<input type=”hidden” name=”lang” value=”‘.$_GET[‘lang’].'” />’;

    $dlsearch = ”;
    if (isset($_GET[‘dlsearch’])) $dlsearch = $_GET[‘dlsearch’];

    $page .= ‘<div id=”download-page”>
    <form id=”download-page-search” action=”” method=”get”>
    <p><label for=”dlsearch”>’.$search_text.'</label> <input type=”text” name=”dlsearch” id=”dlsearch” value=”‘.$dlsearch.'” /><input class=”search_submit” type=”submit” value=”‘.$search_submit_text.'” />’.$fields.'</p></form>’;`

    And replace it with this…

    `$page = ”;
    $fields = ”;

    $dlsearch = implode(‘+’,explode(‘ ‘,$dlsearch));
    if (isset($_GET[‘dlsearch’])) $dlsearch = $_GET[‘dlsearch’];

    $page .= ‘<div id=”download-page”>
    <form id=”download-page-search” action=”URL OF YOUR DOWNLOAD PAGE” method=”get”>
    <p><label for=”dlsearch”>’.$search_text.'</label> <input type=”text” name=”dlsearch” id=”dlsearch” value=”‘.$dlsearch.'” /><input class=”search_submit” type=”submit” value=”‘.$search_submit_text.'” /></p></form>’;`

    And of course replace the action of the form with your download page. I’m sure there’s a way to do this that’s not hardcoded, but I’m too ignorant to know how.

    Not sure why the urlencode/decode functions don’t take care of this anymore after the upgrade to 3.1. Perhaps Mike will update to fix.

    Hello, I am having the same issue. The search field is combining words. I tried your above fix and it did work at first but somewhere along the line it stopped working even though the above code has not been changed since I applied the fix.

    Anybody have any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WordPress Download Monitor] Download Page Search Terms Formatting’ is closed to new replies.