简体   繁体   English

Buddypress活动问题和立方体积分

[英]Buddypress Activity issue & cubepoints

i currently encounter a problem in the activity i was adding to each user to be displayed its cubepoint rank i have added the following 我当前在活动中遇到一个问题,我正在向每个用户添加要显示其立方体积分的排名,我添加了以下内容

<?php echo cp_module_ranks_getRank( bp_displayed_user_id() ); ?>

but it dosent seem to work it seems to repeat the same rank on each user again and again it stays in level 1 also i have applied that same code. 但它似乎起作用,似乎在每个用户上重复相同的排名,一次又一次地保持在第1级,我也应用了相同的代码。

i posted above and it works for each users profile so it displays there actual rank so its weird i will be posting an image of what i mean, thank you have a nice day. 我在上面发布了它,它适用于每个用户个人资料,因此它在那里显示实际排名,所以很奇怪,我会在上面发布我的意思的图片,谢谢您度过愉快的一天。

bp_displayed_user_id() is used on a member profile page to determine the ID of the user's profile currently being shown, but it won't update when part of the loop. 成员个人资料页面上使用bp_displayed_user_id()确定当前显示的用户个人资料的ID,但在循环的一部分时不会更新。 Depending on which type of loop you are using, you need to use one of the following methods: 根据您使用的是哪种循环类型,您需要使用以下方法之一:

For the activity loop, the function would be bp_get_activity_user_id() to return the ID and bp_activity_user_id() to echo it. 对于活动循环,则该函数将被bp_get_activity_user_id()返回ID和bp_activity_user_id()呼应它。 For you case you would want to use: 对于您的情况,您需要使用:

<?php echo cp_module_ranks_getRank( bp_get_activity_user_id() ); ?>

In the case of the member loop, the function would be bp_get_member_user_id() to return the ID and bp_member_user_id() to echo it: 在部件循环的情况下,该函数将被bp_get_member_user_id()返回ID和bp_member_user_id()呼应它:

<?php echo cp_module_ranks_getRank( bp_get_member_user_id() ); ?>

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

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