Home Forums Plugin Support WP User Frontend Pro Tags autocomplete

This topic is: not resolved

Tagged: ,

This topic contains 18 replies, has 3 voices, and was last updated by  strangerrj 5 years, 5 months ago.

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #8632

    Tareq Hasan
    Keymaster
    Post count: 2831

    Now the login worked.

    Do you have any plugin that is blocking any request or preventing users from entering wp-admin area? The auto complete is working, but the response is coming as 0.
    rick

    #8634

    strangerrj
    Participant
    Post count: 82
    This reply has been marked as private.
    #8636

    Tareq Hasan
    Keymaster
    Post count: 2831

    Ok, got the point here. As the plugin is using WP's default tag search functionality, it doesn't work for guests and I overlooked that. Paste this code in your themes functions.php and should work.

    [php]
    /**
    * Non logged in users tag autocomplete
    *
    * @since 2.1.9
    * @global object $wpdb
    */
    function wpufe_ajax_tag_earch() {
    global $wpdb;

    $taxonomy = sanitize_key( $_GET[‘tax'] );
    $tax = get_taxonomy( $taxonomy );
    if ( !$tax ) {
    wp_die( 0 );
    }

    $s = wp_unslash( $_GET[‘q'] );

    $comma = _x( ‘,', ‘tag delimiter' );
    if ( ‘,' !== $comma )
    $s = str_replace( $comma, ‘,', $s );
    if ( false !== strpos( $s, ‘,' ) ) {
    $s = explode( ‘,', $s );
    $s = $s[count( $s ) – 1];
    }

    $s = trim( $s );
    if ( strlen( $s ) < 2 )
    wp_die(); // require 2 chars for matching

    $results = $wpdb->get_col( $wpdb->prepare( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.name LIKE (%s)", $taxonomy, ‘%' . like_escape( $s ) . ‘%' ) );

    echo join( $results, "\n" );
    wp_die();
    }

    add_action( ‘wp_ajax_nopriv_ajax-tag-search', ‘wpufe_ajax_tag_earch' );
    [/php]

    #8638

    strangerrj
    Participant
    Post count: 82

    Hi Tareq, thank you. Greetings Rick

Viewing 4 posts - 16 through 19 (of 19 total)

The topic ‘Tags autocomplete’ is closed to new replies.