如何授予用户用户积分等于某个字段的值/计算值? [英] How to grant user User Points equal to certain field's value / calculated value?

查看:17
本文介绍了如何授予用户用户积分等于某个字段的值/计算值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个内容类型内容",其中包含字段值"(一个整数)和一个名为发布内容并授予用户点数"的标志.每次使用此标志标记内容时,我想授予内容作者一些用户积分,等于价值"字段中的值.p>

我尝试使用规则模块解决我的问题的第一部分,如下所示:

*事件:节点已被标记,在发布内容并授予用户点数"下*条件:内容为内容"类型*操作:授予用户点数:...

但是,无法在 Points 部分选择 flagged-node:field-value.我也试过了:

*事件:节点已被标记,在发布内容并授予用户点数"下*条件:内容为内容"类型*行动:- 计算一个值:`[flagged-node:field-value]` "+" 0. (变量名 = 结果)- 授予用户点数:...

但是,变量结果"不可用.我该如何解决这个问题?

解决方案

我终于找到了解决方案!我成功完成了第二个场景(计算用户点数)!显然,用户积分模块不知道计算是一个整数.因此,我不得不添加一个额外的操作转换数据类型:目标类型:整数,要转换的值:[结果],舍入行为:始终向下.我将其称为总计"并授予用户此数量的用户积分.

I've a content type 'Content' with the field 'Value' (an integer) and a flag called 'Publish Content and grant points to user'. Every time a Content is flagged with this flag, I'd like to grant the Content's author some User Points, equal to the value in the 'Value' field.

I tried solving the first part of my problem with the Rules module like this:

*Event: A node has been flagged, under "Publish Content and grant points to user"

*Conditions: Content is of type 'Content'

*Actions: Grant points to a user: ...

However, it's impossible to pick flagged-node:field-value in the Points section. I also tried:

*Event: A node has been flagged, under "Publish Content and grant points to user"

*Conditions: Content is of type 'Content'

*Actions:

 - Calculate a value: `[flagged-node:field-value]` "+" 0. (Variable name = result)

 - Grant points to a user: ...

But then, the variable 'result' is not available. How can I solve this issue?

解决方案

I finally found a solution! I completed the second scenario (the amount of User Points is calculated) successfuly! Apparently, the User Points module didn't know that the calculation was an integer. Therefore, I had to add an extra action Convert data type: Target type: Integer, Value to convert: [result], Rounding behavior: Always down. I called it 'total' and granted the user this amount of User Points.

这篇关于如何授予用户用户积分等于某个字段的值/计算值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆