admin管理员组文章数量:1332890
Example: I have a website with 3 different user roles (amongst others): *developers *designers *contributors
I would like to have profile pages for users and would like to be able to display users on pages based (filtered) by their role. Hope this is clear. I have researched quite a few membership plugins and found that they are just bloated with features and ended up with TMI and no answers/solutions, so if you can help I would appreciate it. Do you know of any plugins suitable of doing that?
Thanx in advance
Example: I have a website with 3 different user roles (amongst others): *developers *designers *contributors
I would like to have profile pages for users and would like to be able to display users on pages based (filtered) by their role. Hope this is clear. I have researched quite a few membership plugins and found that they are just bloated with features and ended up with TMI and no answers/solutions, so if you can help I would appreciate it. Do you know of any plugins suitable of doing that?
Thanx in advance
Share Improve this question asked Jun 27, 2020 at 9:10 heartcoreheartcore 1 2- What do you want on the profile pages? Would a normal author page do? You could put conditional sections in the author page template based on the user's role. – Rup Commented Jun 27, 2020 at 10:03
- @Rup Hmmm... What i want to appear is a featured image, a description and some links along with the created content. I also want to have archive(?) pages of authors based on their role. – heartcore Commented Jun 27, 2020 at 13:12
1 Answer
Reset to default 0Try this to get you started. This creates a shortcode [alldevelopers] that displays a list of all developers. Pretty basic but can be heavily extended and duplicted. (Not tested)
add_shortcode( 'alldevelopers', 'show_all_developers' );
function show_all_developers(){
$users = get_users( [ 'role__in' => [ 'developers' ] ] );
foreach ( $users as $user ) {
echo $user->first_name . ' ' . $user->last_name . '<br>';
}
}
本文标签: pluginshow to create user profile pages and display them based on users roles
版权声明:本文标题:plugins - how to create user profile pages and display them based on users roles 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742310224a2450717.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论