Automatically revoking user promotions for inactive users

Hi,

I'm currently developing an Add-on for XenForo which provides an user criteria depended from an external service so that users can be promoted to a special group when this criteria is met.

It works perfectly besides on caveat: runPromotions() looks only at the users which were active in the last two hours. Is there a way to handle the other users?
For example as the criteria is independent of the Forum usage what is the best way to unpromote an user when his criteria became invalid. Or vice versa, promote an user which now met the criteria but wasn't online since over two hours?

I thought about adding a function which goes through all users and checks for the criteria once a day, but this way does not really seem clean to me. Is there a better way I can achieve, maybe there some Function in XenForo with such an intended use case.

Best Regards,
Thomas
 
Promotions only need to be checked for users actually using the forum. If the user isn't using the forum, what's the point in applying user group changes to them, if they aren't going to experience them?

In other words, there isn't anything like that in the core code.

Liam
 
First thanks for answering.

For sure there is a point! Other user can see the effects of the promotion. A simple example: lets say if I use it for saying that a member is the best ever and give him a banner all other see that. Now he dos some really bad stuff and so looses the "best member ever" status/criteria but simply because he does not log in all other see him still as best member ever.

Or another example, when I use the Birthday criteria I could want to show it only on the users birthday (and only on that). With the current implementation the following things could happen:
* The user doesn't gets promoted at all as he does not log in on his birthday (but It would be nice for other to see that he has birthday when going through a thread)
* The user has birthday forever as he does not log in anymore.

Those are some simple examples, but I could come up with thousand other which all have an valid point for some use cases.

As such Promotions ( I suppose the are not called this name for no reason) can give or take reputation to Users this is important for sure.
Also not logging in for some time != not using the forum.

Ok, then I'm making something for myself, didn't want to in the case if there was something better suited or already existent.

In other words thanks nonetheless.

Best Regards,
Thomas
 
Hi, yes I saw that it's for sure a design decision and I'm not attacking it directly.
I only wanted to know if anyone had that problem and had a good integrated (and maybe also somewhat fast ;) ) solution.
Or what the developers thought as solution when the made this performance optimization in regards to asynchronous criteria which could change anytime and should trigger a promotion revoke.
While performance optimizations are awesome, they should not restrict the behaviour or at least give an alternative (slower) way where we have unrestricted behaviour, IHMO.

I make a quick workaround with running a cron job once a day which cycles all user.

Later I want to solve it through extend my criteria API so that i can only update those which became valid/invalid since the last update.

Thanks for your time and answer.

best regards,
Thomas
 
Top Bottom