[TH] User Criteria Extended

[TH] User Criteria Extended 1.0.6

No permission to download
The add-on doesn't directly influence the frequency with which user promotions are run. Outside of performance degradation from using too many advanced criteria, performance impact should be pretty much non-existent. If it continuously takes too long, there may be other outstanding jobs in the queue that need to be completed first and take too long or your job queue is not run frequently enough, depending on how busy your site is.
 
We have a promotion setup to add new members to a new member group with fewer permissions (permissions are set to never) than the Registered group. We're using the following criteria:
  • User has posted no more than X messages
  • User has been registered for no more than X days
We want both of these to be met before a member is removed from this limited group, but they're being removed after meeting only one of them.

Is there a way to make this work?

If not, would this be the correct way to set it up? Limit the Registered group, create a group with the normal member permissions, add all existing members to it, then setup the promotion to promote new members using:
  • User has posted at least X messages
  • User has been registered for at least X day
I was hoping to avoid adding all normal members to an additional group, but if that's the only way to do this, that's what we'll have to do.
 
If not, would this be the correct way to set it up? Limit the Registered group, create a group with the normal member permissions, add all existing members to it, then setup the promotion to promote new members using:
  • User has posted at least X messages
  • User has been registered for at least X day
I was hoping to avoid adding all normal members to an additional group, but if that's the only way to do this, that's what we'll have to do.
Yes, that's the way to go. User group promotions only trigger if all conditions are met, so you'll need to put them into a restricted group by default and then promote them to a group with more permissions once they hit your desired threshold.
 
Yes, that's the way to go. User group promotions only trigger if all conditions are met, so you'll need to put them into a restricted group by default and then promote them to a group with more permissions once they hit your desired threshold.

Thanks @Lukas W., I appreciate the quick response :)
 
Saw this reported back in 2019, but also seem to be having the same issue with:
Counting of resources is not working ("at least X resources" for example)
Any idea why it's not counting the resources and promoting members based on this?
 
Just updated to PHP 8.1 and we're getting this error, primarily when trying to switch styles. Once disabled, it works fine.

Hoping this is something simple, as this is one of the most useful XF addons :)

Code:
Server error log

    ErrorException: Fatal Error: During inheritance of JsonSerializable: Uncaught ErrorException: [E_DEPRECATED] Return type of Carbon\CarbonInterface::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/nginx/domains/domain.com/public/src/addons/ThemeHouse/UserCriteria/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php:2872 Stack trace: #0 /home/nginx/domains/domain.com/public/xenforo22/src/addons/ThemeHouse/UserCriteria/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php(513): XF::handlePhpError(8192, '...', '...', 2872) #1 /home/nginx/domains/domain.com/public/xenforo22/src/vendor/composer/ClassLoader.php(571): include('...') #2 /home/nginx/domains/domain.com/public/xenforo22/src/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('...') #3 /home/nginx/domains/domain.com/public/xenforo22/src/addons/ThemeHouse/UserCriteria/vendor/nesbot/carbon/src/Carbon/Carbon.php(509): Composer\Autoload\ClassLoader->loadClass('...') #4 /home/nginx/domains/domain.com/public/xenforo22/src/vendor/composer/ClassLoader.php(571): include('...') #5 /home/nginx/domains/domain.com/public/xenforo22/src/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('...') #6 /home/nginx/domains/domain.com/public/xenforo22/src/addons/ThemeHouse/UserCriteria/Listener/CriteriaUser.php(1480): Composer\Autoload\ClassLoader->loadClass('...') #7 /home/nginx/domains/domain.com/public/xenforo22/src/XF/Extension.php(69): ThemeHouse\UserCriteria\Listener\CriteriaUser::criteriaUser('...', Array, Object(SV\DailyStatistics\XF\Entity\User), false) #8 /home/nginx/domains/domain.com/public/xenforo22/src/XF/App.php(2990): XF\Extension->fire('...', Array, NULL) #9 /home/nginx/domains/domain.com/public/xenforo22/src/XF/Criteria/User.php(66): XF\App->fire('...', Array) #10 /home/nginx/domains/domain.com/public/xenforo22/src/XF/Criteria/AbstractCriteria.php(65): XF\Criteria\User->isUnknownMatched('...', Array, Object(SV\DailyStatistics\XF\Entity\User)) #11 /home/nginx/domains/domain.com/public/xenforo22/src/XF/Repository/UserGroupPromotion.php(111): XF\Criteria\AbstractCriteria->isMatched(Object(SV\DailyStatistics\XF\Entity\User)) #12 /home/nginx/domains/domain.com/public/xenforo22/src/XF/Pub/App.php(246): XF\Repository\UserGroupPromotion->updatePromotionsForUser(Object(SV\DailyStatistics\XF\Entity\User)) #13 /home/nginx/domains/domain.com/public/xenforo22/src/XF/Pub/App.php(199): XF\Pub\App->updateUserCaches() #14 /home/nginx/domains/domain.com/public/xenforo22/src/XF/App.php(2479): XF\Pub\App->start(true) #15 /home/nginx/domains/domain.com/public/xenforo22/src/XF.php(524): XF\App->run() #16 /home/nginx/domains/domain.com/public/xenforo22/index.php(20): XF::runApp('...') #17 {main} src/addons/ThemeHouse/UserCriteria/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php:513 

    Generated by: Test User Jan 9, 2023 at 12:01 PM 

Stack trace

#0 [internal function]: XF::handleFatalError()
#1 {main}

Request state

array(4) {
  ["url"] => string(6) "/xenforo22/"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
I require the utilization of this add-on. However, its download is presently unattainable due to a web source error.

If anyone possesses this add-on, kindly share it with me.

Thank you.
 
Can you expand on what issue you're having?

I'm not sure I follow what you mean by stopped working on mobile, this addon has no UI elements to it, it adds user criteria options.

Also a PHP upgrade wouldn't affect anything specifically on mobile as PHP is server-side and mobile viewports are done in CSS client-side.
 
Last edited:
When I upgraded php I checked the forum with my iPhone and the forum broke and threw an error-message.
It was late, had to get up early, I didn't screenshot and just deactivated the add-on.

I have re-enabled the add-on today.

In 10 minutes seven error-messages which may have appeared then, too:

For example:

Code:
TypeError: Carbon\Carbon::setLastErrors(): Argument #1 ($lastErrors) must be of type array, bool given, called in /var/www/web1/htdocs/forumname/forum/src/addons/ThemeHouse/UserCriteria/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php on line 670 src/addons/ThemeHouse/UserCriteria/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:928
Generiert von: Unbekanntes Konto 4. Februar 2024 um 11:20
Stack-Trace
#0 src/addons/ThemeHouse/UserCriteria/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(670): Carbon\Carbon::setLastErrors(false)
#1 src/addons/ThemeHouse/UserCriteria/vendor/nesbot/carbon/src/Carbon/Traits/Timestamp.php(51): Carbon\Carbon::rawCreateFromFormat('U u', '142598760 00000...')
#2 src/addons/ThemeHouse/UserCriteria/vendor/nesbot/carbon/src/Carbon/Traits/Timestamp.php(31): Carbon\Carbon::createFromTimestampUTC(142598760)
#3 src/addons/ThemeHouse/UserCriteria/Listener/CriteriaUser.php(169): Carbon\Carbon::createFromTimestamp(142598760)
#4 src/XF/Extension.php(81): ThemeHouse\UserCriteria\Listener\CriteriaUser::criteriaUser('th_registered_m...', Array, Object(SV\DailyStatistics\XF\Entity\User), false)
#5 src/XF/App.php(2994): XF\Extension->fire('criteria_user', Array, NULL)
#6 src/XF/Criteria/User.php(66): XF\App->fire('criteria_user', Array)
#7 src/XF/Criteria/AbstractCriteria.php(65): XF\Criteria\User->isUnknownMatched('th_registered_m...', Array, Object(SV\DailyStatistics\XF\Entity\User))
#8 src/XF/Repository/UserGroupPromotion.php(111): XF\Criteria\AbstractCriteria->isMatched(Object(SV\DailyStatistics\XF\Entity\User))
#9 src/XF/Cron/UserGroupPromotion.php(36): XF\Repository\UserGroupPromotion->updatePromotionsForUser(Object(SV\DailyStatistics\XF\Entity\User), Array, Array)
#10 src/XF/Job/Cron.php(37): XF\Cron\UserGroupPromotion::runPromotions(Object(XF\Entity\CronEntry))
#11 src/XF/Job/Manager.php(260): XF\Job\Cron->run(8)
#12 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#13 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 8)
#14 job.php(43): XF\Job\Manager->runQueue(false, 8)
#15 {main}
Status der Anfrage
array(4) {
  ["url"] => string(14) "/forum/job.php"
  ["referrer"] => string(91) "https://www.forumname/forum/threads/123.90327/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
Ah okay, that’s from an outdated Carbon package. Check you’re on the latest version of the addon (1.0.7 patch level 2), I pushed a fix the other day to fix an error using the birthday criteria, but the error you have there seems to be one that was fixed with 8.2 compatibility updates a few months ago.
 
Ah okay, that’s from an outdated Carbon package. Check you’re on the latest version of the addon (1.0.7 patch level 2), I pushed a fix the other day to fix an error using the birthday criteria, but the error you have there seems to be one that was fixed with 8.2 compatibility updates a few months ago.

Is the plugin with the latest version currently available or will there be an update?
 
@mattrogowski I want to make it ziyaretçi (means visitor) and yönetici (means admin) but it's not working. I want to see my website ads but I get an error:

Incompatible user criteria. A user cannot be a guest and have other statuses at the same time.

How can we solve this issue?
 
This is just core XenForo I believe and not specific to this addon. I'm not entirely sure what you're trying to achieve or what criteria you have configured. You don't need to specify anything for being a logged in user if you're selecting admins as they will inherently be logged in.
 
This is just core XenForo I believe and not specific to this addon. I'm not entirely sure what you're trying to achieve or what criteria you have configured. You don't need to specify anything for being a logged in user if you're selecting admins as they will inherently be logged in.

I got this error on ads manager. I want to see my ads but I don't get it. Do you have any suggestions?
 
Well, you're setting incompatible criteria. A user isn't going to be a guest and an admin at the same time. If you can explain what it is you're trying to do and attach a screenshot of what criteria you're setting it may be clearer. You may just need to select usergroups instead of the criteria for being a guest and an admin.
 
Top Bottom