简体   繁体   English

Wordpress:向用户配置文件添加列

[英]Wordpress: adding columns to user profile

So I'm saving extra user info into the db (into my own table) and want to have it be displayed on the user's profile page, using Wordpress's column format (the same columns used for the post edit screen, etc).所以我将额外的用户信息保存到数据库中(到我自己的表中),并希望使用 Wordpress 的列格式(用于帖子编辑屏幕等的相同列)将其显示在用户的个人资料页面上。

Is this possible?这可能吗? If so, how do I call it?如果是这样,我该如何称呼它? It's easy enough to hack on post pages, but I'm not finding a way to add columns to other kinds of pages.在帖子页面上破解很容易,但我没有找到将列添加到其他类型页面的方法。

I could build a table manually, but would rather use a method if there is one, especially to take advantage of sorting.我可以手动构建一个表,但如果有一个方法,我宁愿使用一种方法,特别是利用排序。

You can look into wp-admin/edit-user.php file and find some hook actions.您可以查看wp-admin/edit-user.php文件并找到一些挂钩操作。

personal_options - runs at the end of "Personal Options" form table. personal_options - 在“个人选项”表格的末尾运行。 Parameter: $profileuser参数:$profileuser

profile_personal_options - runs after "Personal Options" form table and before "Name" header. profile_personal_options - 在“个人选项”表单表之后和“名称”header 之前运行。 Runs only on current user profile page.仅在当前用户个人资料页面上运行。 Parameter: $profileuser参数:$profileuser

show_user_profile - runs after "About the user" block and before "Update user" button. show_user_profile - 在“关于用户”块之后和“更新用户”按钮之前运行。 Runs only on current user profile.仅在当前用户配置文件上运行。 Parameter: $profileuser参数:$profileuser

edit_user_profile - runs after "About the user" block and before "Update user" button. edit_user_profile - 在“关于用户”块之后和“更新用户”按钮之前运行。 Runs only on not current user profile.仅在非当前用户配置文件上运行。 Parameter: $profileuser参数:$profileuser

Use next hook actions for saving your additional data:使用下一个挂钩操作来保存您的附加数据:

personal_options_update - runs only on current user profile page. personal_options_update - 仅在当前用户个人资料页面上运行。 Parameter: $user_id.参数:$user_id。

edit_user_profile_update - runs only on not current user profile pages. edit_user_profile_update - 仅在非当前用户个人资料页面上运行。 Parameter: $user_id.参数:$user_id。

PS There is no hook action in wp-admin/user-new.php , which you can use for your additional field. PS wp-admin/user-new.php中没有钩子操作,您可以将其用于您的附加字段。 So, you can only when your edit exsisting user.因此,您只能在您编辑现有用户时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM