AyeCode / invoicing

GetPaid (Formerly the Invoicing plugin) is a lightweight Payments and Invoicing system for WordPress. It can be used to sell anything online via payment forms or buy now buttons that can be added to any landing page. It can also be used by freelancers to manage their Invoices or by 3rd party Themes and Plugins as their payment system. GeoDirectory currently uses GetPaid as its payment system
https://wpgetpaid.com/
Other
39 stars 22 forks source link

shortcodes are not compatible in dashboard widget #533

Open sridhargoshika opened 3 years ago

sridhargoshika commented 3 years ago

Payment forms shortcode or [wpinv-history] are not working in admin/main dashboard page.

Here is the code in functions.php: `add_action('wp_dashboard_setup', 'my_dashboard_widgets');

function my_dashboard_widgets() { global $wp_meta_boxes; wp_add_dashboard_widget('custom_help_widget', 'Product Request', 'my_product_request_dashboard_widget'); }

function my_product_request_dashboard_widget() {
echo do_shortcode('[getpaid form=83]') ; }

function my_invoice_dashboard_widget() { echo do_shortcode('[wpinv_history]'); }`

picocodes commented 3 years ago

@sridhargoshika your code works for me. Do you see any errors when you add it to your functions.php file? Most importantly, does the dashboard widget appear?

sridhargoshika commented 3 years ago

@sridhargoshika your code works for me. Do you see any errors when you add it to your functions.php file? Most importantly, does the dashboard widget appear?

Here is my output, Card details windows is also disappeared and PayNow not working. image

picocodes commented 3 years ago

Yeah, I see. Our payment scripts are set to only load on the frontend. Try the following code instead (which forces our scripts to load on the backend too).

add_action('wp_dashboard_setup', 'my_dashboard_widgets');

function my_dashboard_widgets() {
     wp_add_dashboard_widget('custom_help_widget', 'Product Request', 'my_product_request_dashboard_widget');
}

function my_product_request_dashboard_widget() {
     echo do_shortcode('[getpaid form=83]') ;
}

function my_invoice_dashboard_widget() {
    echo do_shortcode('[wpinv_history]');
}

add_action( 'admin_enqueue_scripts', 'my_admin_load_scripts' );
function my_admin_load_scripts() {
    $screen = get_current_screen();

    if ( ! empty( $screen->id ) && 'dashboard' == $screen->id ) {
        getpaid()->enqueue_scripts();
    }

}

add_filter( 'aui_screen_ids','my_admin_add_aui_screens' );
function my_admin_add_aui_screens( $screens ) {
    $screens[] = 'dashboard';
    return $screens;
}
sridhargoshika commented 3 years ago

I tried your code. It seems PayNow button working correctly. But invoicing-Pagination not working. It showing first page when I click on 2 page.

image

sridhargoshika commented 3 years ago

Any update on this issue