• Resolved ilakya

    (@ilakya)


    How to pass dynamic query values like
    select * from tablename where userid = {dynamic value}

    using Import from database option to create visualizer charts

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor contactashish13

    (@rozroz)

    Can you help us understand the scenario better? Where will the dynamic value come from?

    Thread Starter ilakya

    (@ilakya)

    I want to use wordpress function get_current_user_id() call like

    select * from tablename where userid = get_current_user_id() as the requirement is to show chart for particular user id.

    If calling get_current_user_id() is not possible, is there any other way to pass user ID of currently logged in user to the query?

    Plugin Contributor contactashish13

    (@rozroz)

    You can use the below snippet in the latest version of the plugin:

    
    add_filter( 'visualizer_db_query', function( $query, $chart_id ) { 
    	$query = str_replace( "LIMIT 1000", " WHERE " . userid = get_current_user_id() . " LIMIT 1000", $query );
           return $query;
    }, 10, 2 );
    
    
    Plugin Contributor contactashish13

    (@rozroz)

    We haven’t heard from you in sometime so marking this as Resolved. If you continue to face an issue, please create a new ticket. We’d be happy to help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Pass dynamic query values – (Charts using my sql queries)’ is closed to new replies.