admin管理员组文章数量:1389750
I have used custom php form for uploading image via ajax. And has successfully uploaded the image and getting the attachment id & the image url also,
Is there any way to attach the attachment id or the image url to the user profile image, so the admin can also view the user profile image in user list.
Thanks.
I have used custom php form for uploading image via ajax. And has successfully uploaded the image and getting the attachment id & the image url also,
Is there any way to attach the attachment id or the image url to the user profile image, so the admin can also view the user profile image in user list.
Thanks.
Share Improve this question asked Feb 28, 2020 at 6:07 Gaurav ChauhanGaurav Chauhan 113 bronze badges2 Answers
Reset to default 0Generally speaking you can add the attachment ID to the user's profile using the User Meta API, then display the image using the show_user_profile
and edit_user_profile
hooks.
Adding the image to the user listing can be done using the manage_users_columns
and manage_users_custom_column
filters, which Robert hue covered in this answer: https://wordpress.stackexchange/a/160423/2807
I would use ACF-fields for this. And then add and attachment-ID to the user. This way, you don't have to check if the user has a profile-image or not, so you avoid some annoying dependency-constraint-issues.
If you do so, then you can use the plugin: Admin Columns Pro, to show that in a column in the admin.
本文标签: theme developmentHow can i attach the attachmentID to the user profile image
版权声明:本文标题:theme development - How can i attach the attachment-ID to the user profile image? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744707396a2620922.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论