Added user Dashboard and Add/Edit Domain pages
This commit is contained in:
parent
a2ab138939
commit
d5f41acd10
2 changed files with 40 additions and 14 deletions
|
|
@ -12,6 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
$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 ];
|
||||
|
||||
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>';
|
||||
|
|
@ -35,6 +36,22 @@ $email_count = count(get_posts([
|
|||
'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_count > 0) {
|
||||
$onboard_steps[2] = true;
|
||||
}
|
||||
|
||||
if ($campaign_count > 0) {
|
||||
$onboard_steps[3] = true;
|
||||
}
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div <?php generate_do_attr( 'content' ); ?>>
|
||||
|
|
@ -89,14 +106,14 @@ get_header(); ?>
|
|||
<div class="summary_table_wrapper">
|
||||
<table class="summary-table">
|
||||
<tr>
|
||||
<th>Total Domains</th>
|
||||
<th>Total Campaigns</th>
|
||||
<th>Total Email Accounts</th>
|
||||
<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><?php echo $domain_count; ?></td>
|
||||
<td><?php echo $campaign_count; ?></td>
|
||||
<td><?php echo $email_count; ?></td>
|
||||
<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>
|
||||
|
|
@ -150,15 +167,18 @@ get_header(); ?>
|
|||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
if ( ($onboard_steps[0] || $onboard_steps[1] || $onboard_steps[2] || $onboard_steps[3]) ) :
|
||||
?>
|
||||
|
||||
<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 id="onboarding_frame">
|
||||
<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>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
|
|
|||
|
|
@ -59,6 +59,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['domain_submit'])) {
|
|||
log_to_file("Domain Edit template - Results: ", $results);
|
||||
}
|
||||
|
||||
if ($domain_in_use) {
|
||||
log_to_file("Domain Edit template - Domain in use: $post_title");
|
||||
} else {
|
||||
log_to_file("Domain Edit template - Domain not in use: $post_title");
|
||||
}
|
||||
|
||||
if ( !(isset($_POST['stay_on_page']) && ($_POST['stay_on_page'] === 'on')) ) {
|
||||
// log_to_file("Domain Edit template - stay_on_page not set; redirecting!");
|
||||
wp_redirect( get_permalink( $post_id ) );
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue