-
Notifications
You must be signed in to change notification settings - Fork 13
/
page-edit-event.php
59 lines (51 loc) · 1.49 KB
/
page-edit-event.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Edit Events
*
* Page to edit all events for theme
*
* @package WordPress
* @subpackage community-portal
* @version 1.0.0
* @author Playground Inc.
*/
?>
<?php
$user = wp_get_current_user()->data;
$meta = get_user_meta( $user->ID );
if ( $user->ID && ( ! isset( $meta['agree'][0] ) || 'I Agree' !== $meta['agree'][0] ) ) {
wp_safe_redirect( "/people/{$user->user_nicename}/profile/edit/group/1/" );
exit();
}
if ( ! empty( $_GET['success'] ) && '1' === $_GET['success'] ) {
$redirect = get_home_url( null, 'events' );
wp_safe_redirect( $redirect );
exit();
}
if ( isset( $_REQUEST['event_id'] ) && isset( $_REQUEST['nonce'] ) && wp_verify_nonce( 'edit-event' ) ) {
$event_id = sanitize_key( $_REQUEST['event_id'] );
}
get_header();
?>
<div class="events__header events__header--edit">
<div class="row middle-md event-creator__container">
<div class="col-md-6 events__header__text">
<h1 class="title"><?php ( isset( $event_id ) && strlen( $event_id ) > 0 ? esc_html_e( 'Edit Event', 'community-portal' ) : esc_html_e( 'Create Event', 'community-portal' ) ); ?></h1>
</div>
</div>
</div>
<div class="content event-creator__container-main">
<?php if ( isset( $user ) ) : ?>
<?php if ( have_posts() ) : ?>
<?php
while ( have_posts() ) :
the_post();
?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php else : ?>
<p><?php esc_html_e( 'You are not authorized to edit this event.', 'community-portal' ); ?></p>
<?php endif; ?>
</div>
<?php get_footer(); ?>