209 lines
5.3 KiB
PHP
209 lines
5.3 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);
|
|
|
|
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,
|
|
'meta_query' => [['key' => 'owner_id', 'value' => $current_user_id]]
|
|
]));
|
|
|
|
$campaign_count = count(get_posts([
|
|
'post_type' => 'campaign',
|
|
'posts_per_page' => -1,
|
|
'meta_query' => [['key' => 'owner_id', 'value' => $current_user_id]]
|
|
]));
|
|
|
|
$email_count = count(get_posts([
|
|
'post_type' => 'email-account',
|
|
'posts_per_page' => -1,
|
|
'meta_query' => [['key' => 'owner_id', 'value' => $current_user_id]]
|
|
]));
|
|
|
|
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">
|
|
<div class="summary_table_wrapper">
|
|
<table class="summary-table">
|
|
<tr>
|
|
<th>Total Domains</th>
|
|
<th>Total Campaigns</th>
|
|
<th>Total Email Accounts</th>
|
|
</tr>
|
|
<tr>
|
|
<td><?php echo $domain_count; ?></td>
|
|
<td><?php echo $campaign_count; ?></td>
|
|
<td><?php echo $email_count; ?></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<?php if (isset($message) ) : ?>
|
|
<div class="message_area_wrapper">
|
|
<div class="message_area">
|
|
<?php echo $message; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</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>',
|
|
)
|
|
);
|
|
?>
|
|
|
|
<h2>Get Started:</h2>
|
|
<ol>
|
|
<li><a href="/membership-account/your-profile/">Save your CloudFlare API Credentials</a></li>
|
|
<li><a href="/dashboard/domains/edit-domain/">Add a Domain and verify DNS records</a></li>
|
|
<li><a href="/dashboard/email-accounts/edit-email-account/">Add one or more Email Accounts</a></li>
|
|
<li><a href="/dashboard/campaigns/edit-campaign/">Create a Campaign</a></li>
|
|
</ol>
|
|
</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();
|