-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsingle-lti_consumer.php
56 lines (48 loc) · 1.85 KB
/
single-lti_consumer.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
<?php
/**
* The Template for displaying single lti_consumer
*/
get_header(); ?>
<?php
// restrict access to the page
if ( current_user_can_for_blog( $blog_id, 'edit_posts' ) || is_super_admin() ) {
// Start the Loop.
while ( have_posts() ) {
the_post();
$author_id = get_the_author_meta('ID');
$user = wp_get_current_user();
// Skip displaying anything if the current user is not super admin or post author.
if (!is_super_admin() && ($author_id != $user->ID)) {
// break the loop; should we redirect?
continue;
}
global $wpdb;
$endpoint = get_site_url(1) . '/api/lti/BLOGID';
echo '<div><label for="lti_consumer_endpoint">';
_e( 'Endpoint' );
echo ': </label>';
echo '<strong id="lti_consumer_endpoint" name="lti_consumer_endpoint">' . $endpoint . '</strong>';
echo '</div>';
echo '<div class="description">Replace BLOGID with the site id the user should be redirected to.</div>';
if ( $key = get_post_meta( get_the_ID(), LTI_META_KEY_NAME, true ) ) {
echo '<div><label for="lti_consumer_key">';
_e( 'Key' );
echo ': </label>';
echo '<strong id="lti_consumer_key" name="lti_consumer_key">' . esc_attr( $key ) . '</strong>';
echo '</div>';
}
if ( $secret = get_post_meta( get_the_ID(), LTI_META_SECRET_NAME, true ) ) {
echo '<div><label for="lti_consumer_secret">';
_e( 'Secret' );
echo ': </label>';
echo '<strong id="lti_consumer_secret" name="lti_consumer_secret">' . esc_attr( $secret ) . '</strong>';
echo '</div>';
}
}
}
?>
</div><!-- #content -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();