我希望基于多个不同的用户角色来显示内容。
因此,如果用户具有角色订户+其他角色之一,则将显示内容,如果没有,则将显示其他消息。我需要根据用户角色的次要角色在“我的帐户”页面(mytheme> woocommerce> myaccount> dashboard.php)中显示多个徽章。
此刻,我有以下代码,但不起作用:
#Get the index of the movie starting with "The"
inds <- grepl("^The", df$Movie)
#Remove "The" from the beginning of the sentence and paste it at the end.
df$Movie[inds] <- paste(sub("^The", "", df$Movie[inds]), "The")
df
# Year Movie
#1 2012 Avengers The
#2 2015 Furious 7
#3 2017 Fate of the Furious The
编辑:我有一个新代码,但仍然无法使用:
<?php
//* Role de SU
//* Roles needed
//* 'su_biblioteca_das_sombras',
//* 'su_escudo_mc_para_tocado',
//* 'su_informante',
//* 'su_mc',
//* 'su_mc_tocado',
//* 'mc_tocado_de_sombras_urbanas',
//* 'su_mc_da_faccao',
//* 'su_mc_de_sombras_urbanas',
//* 'su_marcas_da_corrupcao'
//* 'su_marque_corrupcao',
//* 'su_membro_das_sombras',
//* 'su_precursor_das_sombras',
//* 'su_renomado_nas_sombras',
//* 'rs_ruas_sombrias',
//* 'rs_ruas_sombrias_virtual',
//* 'sombras_urbanas',
//* 'su_tocado_informante',
//* 'su_tocado_renomado_das_sombras',
//* 'su_tocado_pelas_sombras',
//*
//* echo '<img src="';
//* echo get_template_directory_uri();
//* echo '/images/sombrasurbanas1.jpg" Title="Você participou do FC de Sombras Urbanas!" />';
global $user_login, $current_user;
$user_info = array(
'customer'
);
$roles = array (
'su_biblioteca_das_sombras',
);
if (array_intersect( $roles, $user_info)) {
echo 'success';
} else {
echo 'failure';
}
?>