-
Notifications
You must be signed in to change notification settings - Fork 3
/
not-a-member-template.php
63 lines (49 loc) · 2.11 KB
/
not-a-member-template.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
<?php
/**
* Template Name: Not A Member Template
*
* Description: Handle logins without necessary privs.
*
* @since HCommons
*/
$memberships = Humanities_Commons::hcommons_get_user_memberships();
if ( ! empty( $memberships ) ) {
global $comanage_api;
$comanage_roles = $comanage_api->get_person_roles( Humanities_Commons::hcommons_get_session_username(), Humanities_Commons::$society_id );
$inactive_role = false;
foreach( $comanage_roles as $comanage_key => $comanage_role ) {
if ( $comanage_key == strtoupper( Humanities_Commons::$society_id ) && 'Active' != $comanage_role['status'] ) {
$inactive_role = true;
}
}
if ( $inactive_role ) {
wp_redirect( '/inactive-member/' );
}
}
//must redirect first
get_header(); ?>
<div class="page-full-width">
<div id="primary" class="site-content">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<?php if ( ! empty( $memberships ) ) {
the_content();
} else if ( ! empty( Humanities_Commons::hcommons_get_session_username() ) ) {
echo '<h1 class="entry-title">Something is wrong!</h1>';
echo "You have logged in with a username (" . Humanities_Commons::hcommons_get_session_username() . ") that does not have any memberships.";
echo '<a href="mailto:[email protected]">Please let us know.</a>';
} else {
$identity_provider = Humanities_Commons::hcommons_get_identity_provider();
echo '<h1 class="entry-title">Unknown Login</h1>';
echo 'You have chosen a login method (' . $identity_provider . ') that is not linked to any account in Humanities Commons.';
echo '<p /><a href="' . get_site_url() . '/remind-me/" title="Not sure what your username is? Search for yourself on the Commons!">Forgotten how you logged in?</a>';
} ?>
</div><!-- .entry-content -->
</article><!-- #post -->
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
</div><!-- .page-full-width -->
<?php get_footer(); ?>