- Added image optimization with WebP conversion
- Updated Dashboard UI with card layout
- Fixed duplicate domain/email detection
- Increased default items per page to 25
- Added campaign weekend reduction factor field
- Added ember animation effect in footer
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
259 lines
7.8 KiB
PHP
259 lines
7.8 KiB
PHP
<?php
|
|
/**
|
|
* The Template for displaying the dashboard.
|
|
*
|
|
* @package GeneratePress
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit; // Exit if accessed directly.
|
|
}
|
|
|
|
$current_user_id = get_current_user_id();
|
|
$cloudflare_email = get_user_meta($current_user_id, 'cloudflare_api_email', true);
|
|
$cloudflare_key = get_user_meta($current_user_id, 'cloudflare_api_key', true);
|
|
$onboard_steps = [ false, false, false, false ];
|
|
// $message = "This is the notification area";
|
|
|
|
if (! ($cloudflare_email || $cloudflare_key) ) {
|
|
$message = '<a href="/membership-account/your-profile/">It looks like you haven\'t set up your CloudFlare API info yet. Click here to save that in your profile and get started!</a>';
|
|
}
|
|
|
|
$domain_count = count(get_posts([
|
|
'post_type' => 'domain',
|
|
'posts_per_page' => -1,
|
|
'status' => 'publish',
|
|
'meta_query' => [['key' => 'owner_id', 'value' => $current_user_id]]
|
|
]));
|
|
|
|
$campaign_count = count(get_posts([
|
|
'post_type' => 'campaign',
|
|
'posts_per_page' => -1,
|
|
'status' => 'publish',
|
|
'meta_query' => [['key' => 'owner_id', 'value' => $current_user_id]]
|
|
]));
|
|
|
|
$email_account_count = count(get_posts([
|
|
'post_type' => 'email-account',
|
|
'posts_per_page' => -1,
|
|
'status' => 'publish',
|
|
'meta_query' => [['key' => 'owner_id', 'value' => $current_user_id]]
|
|
]));
|
|
|
|
if ( ($cloudflare_email || $cloudflare_key) ) {
|
|
$onboard_steps[0] = true;
|
|
}
|
|
|
|
if ($domain_count > 0) {
|
|
$onboard_steps[1] = true;
|
|
}
|
|
|
|
if ($email_account_count > 0) {
|
|
$onboard_steps[2] = true;
|
|
}
|
|
|
|
if ($campaign_count > 0) {
|
|
$onboard_steps[3] = true;
|
|
}
|
|
|
|
get_header(); ?>
|
|
|
|
<div <?php generate_do_attr( 'content' ); ?>>
|
|
<main <?php generate_do_attr( 'main' ); ?>>
|
|
<?php
|
|
/**
|
|
* generate_before_main_content hook.
|
|
*
|
|
* @since 0.1
|
|
*/
|
|
do_action( 'generate_before_main_content' );
|
|
|
|
if ( generate_has_default_loop() ) {
|
|
while ( have_posts() ) :
|
|
|
|
the_post();
|
|
|
|
?>
|
|
|
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
|
|
<div class="inside-article">
|
|
<?php
|
|
/**
|
|
* generate_before_content hook.
|
|
*
|
|
* @since 0.1
|
|
*
|
|
* @hooked generate_featured_page_header_inside_single - 10
|
|
*/
|
|
do_action( 'generate_before_content' );
|
|
|
|
if ( generate_show_entry_header() ) :
|
|
?>
|
|
<header <?php generate_do_attr( 'entry-header' ); ?>>
|
|
<?php
|
|
/**
|
|
* generate_before_entry_title hook.
|
|
*
|
|
* @since 0.1
|
|
*/
|
|
do_action( 'generate_before_entry_title' );
|
|
|
|
// if ( generate_show_title() ) {
|
|
// $params = generate_get_the_title_parameters();
|
|
|
|
// the_title( $params['before'], $params['after'] );
|
|
// }
|
|
|
|
?>
|
|
|
|
<div class="dash_summary">
|
|
<?php if (isset($message) ) : ?>
|
|
<div class="message_area_wrapper">
|
|
<div class="message_area notice notice-success">
|
|
<?php echo $message; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
<!-- <div class="summary_table_wrapper dash-card">
|
|
<table class="summary-table">
|
|
<tr>
|
|
<th><a href="/dashboard/domains">Total Domains</a></th>
|
|
<th><a href="/dashboard/campaigns">Total Campaigns</a></th>
|
|
<th><a href="/dashboard/email-accounts">Total Email Accounts</a></th>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="/dashboard/domains"><?php //echo $domain_count; ?></a></td>
|
|
<td><a href="/dashboard/campaigns"><?php //echo $campaign_count; ?></a></td>
|
|
<td><a href="/dashboard/email-accounts"><?php //echo $email_count; ?></a></td>
|
|
</tr>
|
|
</table>
|
|
</div> -->
|
|
</div>
|
|
|
|
<?php
|
|
|
|
/**
|
|
* generate_after_entry_title hook.
|
|
*
|
|
* @since 0.1
|
|
*
|
|
* @hooked generate_post_meta - 10
|
|
*/
|
|
do_action( 'generate_after_entry_title' );
|
|
?>
|
|
</header>
|
|
<?php
|
|
endif;
|
|
|
|
/**
|
|
* generate_after_entry_header hook.
|
|
*
|
|
* @since 0.1
|
|
*
|
|
* @hooked generate_post_image - 10
|
|
*/
|
|
do_action( 'generate_after_entry_header' );
|
|
|
|
$itemprop = '';
|
|
|
|
if ( 'microdata' === generate_get_schema_type() ) {
|
|
$itemprop = ' itemprop="text"';
|
|
}
|
|
?>
|
|
|
|
<div class="entry-content mf-dashboard-page"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
|
|
<?php
|
|
the_content();
|
|
|
|
wp_link_pages(
|
|
array(
|
|
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
|
|
'after' => '</div>',
|
|
)
|
|
);
|
|
?>
|
|
<div class="dash-row-wrapper">
|
|
<div class="dash-card header-card"><h3>Campaigns</h3><span class="card_data"><?php echo $campaign_count; ?></span></div>
|
|
<div class="dash-card header-card"><h3>Email Accounts</h3><span class="card_data"><?php echo $email_account_count; ?></span></div>
|
|
<div class="dash-card header-card"><h3>Domains</h3><span class="card_data"><?php echo $domain_count; ?></span></div>
|
|
<div class="dash-card header-card"><h3>Messages Scheduled</h3><span class="card_data"><?php ///echo ; ?></span></div>
|
|
<div class="dash-card header-card"><h3>Delivery Rate</h3><span class="card_data"><?php ///echo ; ?></span></div>
|
|
<div class="dash-card header-card"><h3>Delivery Errors</h3><span class="card_data"><?php ///echo ; ?></span></div>
|
|
<!-- <div class="dash-card header-card"></div>
|
|
<div class="dash-card header-card"></div> -->
|
|
</div>
|
|
<div class="dash-row-wrapper">
|
|
<div class="dash-card">
|
|
<?php
|
|
|
|
if ( ($onboard_steps[0] = false || $onboard_steps[1] = false || $onboard_steps[2] = false || $onboard_steps[3] = false) ) :
|
|
|
|
?>
|
|
<h2>Get Started:</h2>
|
|
<ol class="onboarding_list">
|
|
<li class="<?php echo $onboard_steps[0] ?'finished': ''; ?>" ><a href="/membership-account/your-profile/">Save your CloudFlare API Credentials</a></li>
|
|
<li class="<?php echo $onboard_steps[1] ?'finished': ''; ?>" ><a href="/dashboard/domains/edit-domain/">Add a Domain and verify DNS records</a></li>
|
|
<li class="<?php echo $onboard_steps[2] ?'finished': ''; ?>" ><a href="/dashboard/email-accounts/edit-email-account/">Add one or more Email Accounts</a></li>
|
|
<li class="<?php echo $onboard_steps[3] ?'finished': ''; ?>" ><a href="/dashboard/campaigns/edit-campaign/">Create a Campaign</a></li>
|
|
</ol>
|
|
<?php endif; ?>
|
|
</div>
|
|
<!-- <div class="dash-card"></div> -->
|
|
</div>
|
|
<!-- <div class="dash-row-wrapper">
|
|
<div class="dash-card"></div>
|
|
<div class="dash-card"></div>
|
|
<div class="dash-card"></div>
|
|
</div> -->
|
|
<!-- <div id="onboarding_frame" class="dash-card">
|
|
|
|
</div> -->
|
|
|
|
</div>
|
|
|
|
<?php
|
|
/**
|
|
* generate_after_entry_content hook.
|
|
*
|
|
* @since 0.1
|
|
*
|
|
* @hooked generate_footer_meta - 10
|
|
*/
|
|
do_action( 'generate_after_entry_content' );
|
|
|
|
/**
|
|
* generate_after_content hook.
|
|
*
|
|
* @since 0.1
|
|
*/
|
|
do_action( 'generate_after_content' );
|
|
?>
|
|
</div>
|
|
</article>
|
|
|
|
<?php
|
|
|
|
endwhile;
|
|
}
|
|
|
|
/**
|
|
* generate_after_main_content hook.
|
|
*
|
|
* @since 0.1
|
|
*/
|
|
do_action( 'generate_after_main_content' );
|
|
?>
|
|
</main>
|
|
</div>
|
|
|
|
<?php
|
|
/**
|
|
* generate_after_primary_content_area hook.
|
|
*
|
|
* @since 2.0
|
|
*/
|
|
do_action( 'generate_after_primary_content_area' );
|
|
|
|
generate_construct_sidebars();
|
|
|
|
get_footer();
|