| 1 |
<?php |
| 2 |
|
| 3 |
/******************************************* |
| 4 |
* Restrict Content Display Functions |
| 5 |
*******************************************/ |
| 6 |
|
| 7 |
function rcMetaDisplayEditor($content) |
| 8 |
{ |
| 9 |
global $rc_options; |
| 10 |
global $post; |
| 11 |
|
| 12 |
$rcUserLevel = get_post_meta($post->ID, 'rcUserLevel', true); |
| 13 |
|
| 14 |
if ($rcUserLevel == 'Administrator') |
| 15 |
{ |
| 16 |
return do_shortcode( $rc_options['editor_message'] ); |
| 17 |
} |
| 18 |
else |
| 19 |
{ |
| 20 |
return $content; |
| 21 |
} |
| 22 |
} |
| 23 |
function rcMetaDisplayAuthor($content) |
| 24 |
{ |
| 25 |
global $rc_options; |
| 26 |
global $post; |
| 27 |
|
| 28 |
$rcUserLevel = get_post_meta($post->ID, 'rcUserLevel', true); |
| 29 |
|
| 30 |
if ($rcUserLevel == 'Administrator' || $rcUserLevel == 'Editor') |
| 31 |
{ |
| 32 |
return do_shortcode( $rc_options['author_message'] ); |
| 33 |
} |
| 34 |
else |
| 35 |
{ |
| 36 |
// return the content unfilitered |
| 37 |
return $content; |
| 38 |
} |
| 39 |
} |
| 40 |
function rcMetaDisplayContributor($content) |
| 41 |
{ |
| 42 |
global $rc_options; |
| 43 |
global $post; |
| 44 |
|
| 45 |
$rcUserLevel = get_post_meta($post->ID, 'rcUserLevel', true); |
| 46 |
|
| 47 |
if ($rcUserLevel == 'Administrator' || $rcUserLevel == 'Editor' || $rcUserLevel == 'Author') |
| 48 |
{ |
| 49 |
return do_shortcode( $rc_options['contributor_message'] ); |
| 50 |
} |
| 51 |
else |
| 52 |
{ |
| 53 |
// return the content unfilitered |
| 54 |
return $content; |
| 55 |
} |
| 56 |
} |
| 57 |
function rcMetaDisplaySubscriber($content) |
| 58 |
{ |
| 59 |
global $rc_options; |
| 60 |
global $post; |
| 61 |
|
| 62 |
$rcUserLevel = get_post_meta($post->ID, 'rcUserLevel', true); |
| 63 |
|
| 64 |
if ($rcUserLevel == 'Administrator' || $rcUserLevel == 'Editor' || $rcUserLevel == 'Author' || $rcUserLevel == 'Contributor') |
| 65 |
{ |
| 66 |
return do_shortcode( $rc_options['subscriber_message'] ); |
| 67 |
} |
| 68 |
else |
| 69 |
{ |
| 70 |
// return the content unfilitered |
| 71 |
return $content; |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
// this is the function used to display the error message to non-logged in users |
| 76 |
function rcMetaDisplayNone($content) |
| 77 |
{ |
| 78 |
global $rc_options; |
| 79 |
global $post; |
| 80 |
|
| 81 |
$rcUserLevel = get_post_meta($post->ID, 'rcUserLevel', true); |
| 82 |
|
| 83 |
if (!current_user_can('read') && ($rcUserLevel == 'Administrator' || $rcUserLevel == 'Editor' || $rcUserLevel == 'Author' || $rcUserLevel == 'Contributor' || $rcUserLevel == 'Subscriber')) |
| 84 |
{ |
| 85 |
$userLevelMessage = strtolower($rcUserLevel); |
| 86 |
return do_shortcode( $rc_options[$userLevelMessage . '_message'] ); |
| 87 |
} |
| 88 |
else |
| 89 |
{ |
| 90 |
// return the content unfilitered |
| 91 |
return $content; |
| 92 |
} |
| 93 |
} |