Limited time
Make Better Decisions With Better Data
Up to 30%Off
Grab Now
Limited time

If you add a prefix or a suffix to values in the table, they won’t be carried over to the chart. This is the default behavior of the chart engine, but you can use wpdatachart callbacks to get them to display. Every chart exposes several options that customize its look and feel. Charts usually support custom options appropriate to that visualization. You can use it for adding options that are available in Highcharts API.

In this example we will show you how to use Highcharts.setOptions to add these labels on a chart which has two Y axes.

<script type="text/javascript">
jQuery(window).on('load',function(){
    if( typeof wpDataChartsCallbacks == 'undefined' ){ wpDataChartsCallbacks = {}; }
    wpDataChartsCallbacks[94] = function(obj){
        obj.options.yAxis[0] = {
           labels: {
             format: '$ {value}'
           }
        }
        obj.options.yAxis[1] = {
           opposite: true,
           labels: {
             format: '{value} %'
           }
        }
    }
});
</script>

Highcharts do not inherit the number format you set up in wpDataTables, and there are no built-in options to change the number format in the chart, but you can use wpdatachart callbacks. Every chart exposes several options that customize its look and feel. Charts usually support custom options appropriate to that visualization. You can use it for adding options that are available in Highcharts API.

In this example we will show you how to use Highcharts.setOptions to change the decimal separator from point ( . ) to a comma ( , ). In the callback, you can see how to change the number of decimal places after the separator ( , ) from default 2 to 3. We use the method wpDataChartsCallbacks where 93 is the id of the chart for which we want to apply these settings.

<script type="text/javascript">
jQuery(window).on('load',function(){
    Highcharts.setOptions({
        lang: {
            decimalPoint: ','
        }
    });
    if( typeof wpDataChartsCallbacks == 'undefined' ){ wpDataChartsCallbacks = {}; }
    wpDataChartsCallbacks[93] = function(obj){
        obj.options.tooltip = {
            pointFormat: "Distance: {point.y:.3f} km"
        };
    };
});
</script>

Starting from the version 2.3 you can connect to multiple separate database connections, and you can make tables from each database but at the moment is not unfortunately possible to join them directly.

You could solve this in some of the cases by using the foreign key functionality and configuring table relations, this way you would be able to pull data from one table and show it in another, even if the tables use different databases as the data sources.

If you would like to create a query with JOINs, and the tables are in different databases, but on the same server, you could use a MySQL view that would be generated based on a stored query using the database.table.field syntax, e.g. something like this is described here.

If the servers are physically separated, our suggestion is to create a PHP script that would pull the data from all of the remote databases into a single one, and run scheduled e.g. once per hour.  You could then use the generated table to create a wpDataTable based on that.

Read more about our plugin features in the documentation.

  • Please check is there are no JS errors in the javascript console. Please check e.g. in Chrome JS console. Usually when we investigate such things we find out that some other plugin or theme are broken, and wpDataTables JS cannot execute.
  • Try to turn off option Include bootstrap on front-end in main settings of plugin.
  • Please try switching the theme to a different one and see if it helps.
  • Feel free to Gleap Chat, providing us with the URL of the page so we could tell why does it happen.

By default, WordPress Media Library (used for attachments) allows file uploads only for users who have the upload_files capability. So, everyone who doesn’t have this capability (e.g. a subscriber) will receive an error on trying to upload a file.

To add this capability to subscribers you can e.g. use the User Role Editor plugin. Just enable the upload_files capability for the users which need it and it will work.

Other option is to add this capability dynamically via a hook. To do this you can add e.g. this code to your theme’s functions.php:

            function give_permissions( $allcaps, $cap, $args ) {
                $allcaps['upload_files'] = true;
                return $allcaps;
            }
            add_filter( 'user_has_cap', 'give_permissions', 0, 3 );     

Basically, it enables the upload_files capability to everyone – but you can extend this logic to allow it only for certain users at certain moments.

By default WordPress does not allow this. Reason is: logged out user has no ID (id is 0), and no permissions/capabilities enabled for him.

A solution would be to create an actual user that will be used as a single user for all logged-out users, and copy his ID (e.g. id = 100).

Then you can add a simple hook to identify logged out users as User with ID 100. To do this you can use a hook like this:

    function set_loggedout_id( $user_id ){
       if( empty( $user_id ) ){
          $user_id = 100;
       }
       return $user_id;
    }
            
    add_filter( 'determine_current_user', 'set_loggedout_id', 999, 1 );

Basically, it “tells” WordPress to replace the empty ID of a logged out user with a value of 100.
Then you can allow uploading for this user.

Wait, Before You Download!

To get your hands on wpDataTables Lite, please enter your email address below. We’ll send you a direct download link and keep you updated on existing features along with helpful tips and tricks!

By continuing, I accept Privacy Policy and T&C
Mail Box