1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.


Discussion in 'General XenForo Discussion and Feedback' started by ragtek, Oct 16, 2011.

  1. ragtek

    ragtek Guest

    The usergroup promotion is IMO very strange.

    It selects (and promotes if necessary) only the users, which were online in the last 24h.

    If i want to create a group for not active users i need another way to move them

    If i send mails (with excl. offers for special users) to usergroup x it could be possible that they get the mail, but they shouldn't because they'll lose the promosion(will be transfered out of the usergroup) once the click the link...

    Also if i have a condition "if registerdate is 1 year ago" promote...
    But this won't also happen before the user gets online...
    So we won't get the mails for these usergroup:(

    Any way to optimise this?

    On the other side, i can understand this way, because if there would be no limit, you'll have probably a big user foreach loop
    Alluidh and Markos like this.
  2. Dean

    Dean Well-Known Member

    It worked the same in vb3.8.. My solution was to edit the code directly so they were promoted even if they were not online in the last 24 hours. Certainly not ideal.
  3. ragtek

    ragtek Guest

    to be honnest=> don't know how it works in vB
    Haven't touched the code for a long while:D

    thx for the info
    have to check if this will throw the famous xf- memory exceptions with xf:D
  4. Dean

    Dean Well-Known Member

    My personal theory is that if there should be no problem because those are being done every 24hours (for most sites) i.e. as people accumulate the various promotions for what ever criteria they will be promoted as time goes on - once the initial mass promotions occur.

    All I know for sure is that it is not problem for our small site.
  5. ragtek

    ragtek Guest

    No, all 20 minutes
    But i'm still scared of the first run.
  6. Dean

    Dean Well-Known Member

    I am assuming you have a test site to test on?
  7. giorgino

    giorgino Well-Known Member

    Please, how you've changed the code?
    Can you please give us the necessary code modifications?
    Thanks :)
  8. digitalpoint

    digitalpoint Well-Known Member

    Not sure you would want to change it to be honest. While it would be nice if promotions were instant, the reality is that checking all users for promotions every hour (or however often they are checked) is a huge waste of server resources. What if you have 1,000,000 users... do you really want your server spinning through them all every hour just to hopefully find one that needs a promotion? Checking users that have visited in the last 24 hours prevents server resources required for the check from going crazy.

    For a special situation like Ragtak was trying to address, it would probably be better to just have a custom addon that did that specific check (based on the user date) and did the promotion itself (I assume it wouldn't be too hard to just use the existing promotion model to do it).
  9. giorgino

    giorgino Well-Known Member

    I agree with you :) But I need to run the cron once after the vb4 to xenforo migration ;)
    After that, I'll put the code in place like before modification.

    Anyway, I've found the code to modify, but my server goes in error 500 (probably nginx/php timeout).
    Alterinatives to run the cron successfully ?

    Thanks :)
  10. digitalpoint

    digitalpoint Well-Known Member

    I haven't tried it myself, but you may be able to run the cron.php script from a shell. It shouldn't require any user authentication since it's really just a triggering mechanism).
  11. giorgino

    giorgino Well-Known Member

    I've tried with
    php -f UserGroupPromotion.php
    without success

Share This Page