Created
November 15, 2019 18:38
-
-
Save dancameron/c6854f8c875c53d3b7601b6dfd0a6a1a to your computer and use it in GitHub Desktop.
Get all Dashboard Links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // don't include this line in your functions.php, since it already starts with it. | |
remove_action( 'pre_si_invoice_view', array( 'SI_Payment_Terms_Fees', 'show_message_about_term_due' ), 20, 1 ); | |
function _si_get_user_dashboard_links() { | |
if ( class_exists( 'SI_Client_Dashboard' ) ) { | |
$args = apply_filters( 'si_get_users_for_association_args', array( 'fields' => array( 'ID', 'user_email', 'display_name' ) ) ); | |
$users = get_users( $args ); | |
foreach ( $users as $user ) { | |
$user_id = $user->ID; | |
$client_ids = SI_Client::get_clients_by_user( $user_id ); | |
foreach ( $client_ids as $client_id ) { | |
$dashboard_url = SI_Client_Dashboard::private_dashboard_url( $client_id, $user_id ); | |
echo $dashboard_url; | |
echo ', '; | |
echo $user->user_email; | |
echo ', '; | |
echo $user->display_name; | |
echo '<br/>'; | |
} | |
} | |
exit(); | |
} | |
} | |
add_filter( 'admin_init', '_si_get_user_dashboard_links' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This snippet is a customization for Sprout Invoices. A customizable solution that provides a way for you to get paid via your WordPress site. For more information please don't hesitate to reach out.