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

Rebuild User Cache with cron entry

Discussion in 'XenForo Development Discussions' started by averythomas, Jul 29, 2014.

  1. averythomas

    averythomas Member

    I need to rebuild my user cache every hour and I was wondering how to do it with a cron entry. I saw this thread but did not show actually how to do it, thanks!
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    What particularly in that cache needs to be rebuilt? And why?
     
  3. loplo

    loplo Active Member

    I don't want to open an another thread, but I'm in a similar situation.
    I've created a new usergroup called Birthday, so each user celebrating his birthday is promoted for one day.
    The issue is: the promotion only works if the user logs into the forum on hist birthday, otherwise I have to run "Rebuild User Group Promotions" via cron.
     
  4. Jeremy P

    Jeremy P Well-Known Member

    @loplo Just curious, if the user doesn't log in on his birthday then why does it matter if the promotion isn't applied?
     
  5. loplo

    loplo Active Member

    The promotion adds a banner to the username, that's the only thing that this promotion does.
    Most people don't have time for the forum on their birthday (family/birthday trip/etc), but the rest of the forum can write some "Birthday wishes" on his profile page, dedicated thread, etc, after noticing the "birthday banner".
     
  6. Jeremy P

    Jeremy P Well-Known Member

    You could accomplish something similar with template edits and avoid the overhead and limitations of the promotion system, but I realize it's a bit cumbersome in its own right:

    Code:
    <xen:if is="{$user.dob_day} == {xen:date $serverTime, 'd'} AND {$user.dob_month} == {xen:date $serverTime, 'm'}">
        <em class="userBanner wrapped" itemprop="title">
            <strong>Birthday</strong>
        </em>
    </xen:if>
    
    Putting that in the right place in the message_user_info and member_view templates would show the banner in posts and on the profile. You could customize it further with CSS classes on the <em> tag.

    The downside being it relies on the server's timezone, not the forum's/user's. I'm not sure if there's a way around that.
     
    Last edited: Jan 24, 2016
    loplo likes this.

Share This Page