2014-03-24 45 views
1

我有一個內容類型和登錄用戶投票的可能性。有5個不同的五星級投票(類別)在節點上。現在我想添加用戶點,並想詢問用戶是否有可能在節點上投票時得到1分,如果他在每個類別中投票都得5分。他有可能在稍後改變投票,但是他不應該再得到任何分數。這可能嗎?Drupal 7 - Fivestar和用戶點

迎接

回答

0

雖然它看起來不像有完成此現有7.x或8.x的模塊,有兩種方法,你應該能夠實現自己的目標:

  • 編寫一個模塊。Userpoints API is fairly well-documented並且應該可以創建一個模塊,以在修改fivestar字段時遞增用戶的用戶點數。爲了避免重複,注意,這個領域看起來應該做到去欺騙你正在尋找(假設你設定txn_id當前節點ID的組合,現場ID和用戶ID:

'txn_id' => (int) Transaction ID of a current points record. If present an UPDATE occurs

  • 使用規則。的userpoints模塊與規則結合使用,你應該能夠完成你的userpoints使用情況,而無需編寫任何代碼。據壽Userpoints Rules integration notes,可以將當前userpoints比較點之前的數交易:

Compare Userpoints before the transaction - This condition is used to compare the amount of userpoints the user had before the userpoints was added to/deducted from the user against a specified value. - The 'Amount to compare' value is checked as >= (greater than or equal to) and the Negate checkbox will change the condition to < (less than) as it will be any value other than >=. If you would like to get an exact value, say 1, you can add two of the condition to use >= and < to specify one number. Simple math stuff here =)

我希望這有助於。讓我知道事情的後續!

+0

嗨,謝謝你的回答,我的PHP知識非常小,所以我會盡力用規則來做。 – JOKER