block content by User levels
-
Good morning, folks! I need some help . I have three videos on my website. Necessary for the administrator to view all the client visualize only one, and the coach just one too. I’m using this little code below , but in the administrator can not view the video. And the shortcode ‘m inserting into an HTML section in my theme. When I login as administrator , instead of appearing all videos , it appears that I ‘m not allowed , ie is on the function of the shortcode for permission instead of picking up the shortcode to admin . Can anyone give such help there? If you have questions, explain better.
————————————————————
/* shortcode para não cadastrados no site, esse funciona normal */add_shortcode( ‘visitante’, ‘shortcode_para_visitantes’ );
function shortcode_para_visitantes( $atts, $content = null ) {
if ( !is_user_logged_in() ) return ‘<p><span style=”font-size:20px;”>Você precisa estar cadastrado para mais informações.</span></p>’;
}
————————————————————————————————————————
/*shortcode para membros administrador, esse que não está funcionando */add_shortcode( ‘miembro’, ‘shortcode_para_miembros’ );
function shortcode_para_miembros( $atts, $content = null ) {
if ( is_admin() && !is_null( $content ) )
return $content;
}
————————————————————————————————————————
/* shortcode para bloquear conteúdo para não administrador */add_shortcode( ‘permissao’, ‘shortcode_para_permissoes’ );
function shortcode_para_permissoes( $atts, $content = null ) {
if ( is_user_logged_in() && !is_admin() )
return ‘<p><span style=”font-size:20px;”>Você não tem permissao para acesssar esse conteúdo.</span></p>’;
}
The topic ‘block content by User levels’ is closed to new replies.