Jump to content

Condition for reputation - Pages


aXenDev

Recommended Posts

Hey,
I need to find a condition for the element to appear when it receives a reaction.

I tried the following code, but the item appears despite not receiving a reaction to the record.

{{if \IPS\IPS::classUsesTrait( $record, 'IPS\Content\Reactable' ) and settings.reputation_enabled}}
	test
{{endif}}

 

Link to comment
Share on other sites

9 hours ago, newbie LAC said:

Hello,

You can also use $record->reactionCount()


{{if \IPS\IPS::classUsesTrait( $record, 'IPS\Content\Reactable' ) and settings.reputation_enabled AND $record->reactionCount()}}
	
{{endif}}

 

Actually, reactionCount is the overall value of all reactions. So, if a record has a reaction, or number of reactions, that are neutral (does not increase a users reputation) then it will return zero.

Link to comment
Share on other sites

the office oops GIF

4 minutes ago, Ryan Ashbrook said:

Actually, reactionCount is the overall value of all reactions. So, if a record has a reaction, or number of reactions, that are neutral (does not increase a users reputation) then it will return zero.

In this case the method should be called reactionSum and docblock should contain more detailed information

	/**
	 * Reaction Count
	 *
	 * @return int
	 */
	public function reactionCount()
	{

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...