buddypress - 如何获取当前用户的 buddypress 字段?
问题描述
如何在 buddyPress 中获取当前连接用户的字段值?
例如:如何打印:
My gender is : {gender}
解决方案
获取当前用户id:get_current_user_id()
然后使用xprofile_get_field_data
我的性别是:<?php echo xprofile_get_field_data('gender', get_current_user_id(), 'comma'); ?>
推荐阅读
- python - 在排序一个列表期间将不同列表中的相关元素保持在一起
- c# - 如何对通用列表对象进行排序
- javascript - 向和从 js 服务器发送数据的基本方法?
- json - 使用 Pyspark 处理 JSON 结构
- amazon-web-services - 为什么角色假设应该在 lambda 内部完成?
- html - 如何将数值绑定到 CSS 以创建时间线?
- docker - 如何为 docker compose 环境变量设置运行时变量
- javascript - 仅在 Javascript 中具有不同段落的动态 Div
- tsql - 表格模型中的测量列未在浏览器中显示正确的值
- javascript - 调用此函数时如何获取返回值?