-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.php
69 lines (58 loc) · 1.58 KB
/
index.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
60
61
62
63
64
65
66
67
68
69
<?php
/**
* Index
*
* Main footer file for the theme.
*
* @package WordPress
* @subpackage community-portal
* @version 1.0.0
* @author Playground Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.txt GNU/GPLv3
* @since 1.0.0
*/
global $bp;
$group = $bp->groups->current_group;
$live_user = wp_get_current_user()->data;
// Improved site routing.
if ( $group && property_exists( $live_user, 'ID' ) ) {
$meta = get_user_meta( $live_user->ID );
$is_admin = groups_is_user_admin( $live_user->ID, $group->id );
$edit_group = bp_is_group_admin_page() && $is_admin;
if ( $edit_group && ( ! isset( $meta['agree'][0] ) || 'I Agree' !== $meta['agree'][0] ) ) {
$current_translation = mozilla_get_current_translation();
if ( 'en' !== $current_translation ) {
wp_safe_redirect( "{$current_translation}/people/{$user->user_nicename}/profile/edit/group/1/" );
} else {
wp_safe_redirect( "/people/{$user->user_nicename}/profile/edit/group/1/" );
}
exit();
}
if ( ! empty( $_SERVER['REQUEST_METHOD'] ) && 'POST' === $_SERVER['REQUEST_METHOD'] ) {
if ( $edit_group ) {
mozilla_edit_group();
}
}
} else {
// We are on the user page.
if ( bp_is_user() ) {
if ( ! empty( $_SERVER['REQUEST_METHOD'] ) && 'POST' === $_SERVER['REQUEST_METHOD'] ) {
if ( bp_is_my_profile() && 'edit' === bp_current_action() ) {
mozilla_update_member();
}
}
}
}
get_header();
?>
<div class="content">
<?php if ( have_posts() ) : ?>
<?php
while ( have_posts() ) :
the_post();
?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php get_footer(); ?>