• Resolved Dan Atrill

    (@djadan)


    Hello

    I ran into a problem whereby my database table prefix wasn’t wp_ as in the lcp-parameters.php file.

    Below is what I had to do to make this work ie so the prefix isn’t hardcoded. I obviously had to amend the file to make it work so I’m hoping you can incorporate this amend into future versions please?

    Line 298:

    public function starting_with($where){
    $letters = explode(‘,’, $this->starting_with);

    // Support for both utf8 and utf8mb4
    global $wpdb;
    $wp_posts_prefix = $wpdb->prefix . “posts”;
    // $charset = $wpdb->get_col_charset(‘wp_posts’, ‘post_title’);
    $charset = $wpdb->get_col_charset($wp_posts_prefix, ‘post_title’);

    // $where .= ‘AND (wp_posts.post_title ‘ .
    $where .= ‘AND (‘ . $wp_posts_prefix . ‘.post_title ‘ .
    ‘COLLATE ‘ . strtoupper($charset) . ‘_GENERAL_CI LIKE \” . $letters[0] . “%'”;
    for ($i=1; $i <sizeof($letters); $i++) {
    // $where .= ‘OR wp_posts.post_title ‘ .
    $where .= ‘OR ‘ . $wp_posts_prefix . ‘.post_title ‘ .

    ‘COLLATE ‘ . strtoupper($charset) . ‘_GENERAL_CI LIKE \” . $letters[$i] . “%'”;
    }
    $where.=’)’;
    return $where;
    }

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Table prefix if not wp_’ is closed to new replies.