XF 2.1 How do I add Rebuild user caches as a cron job?


Hi everyone,

I'm trying to mirror a personally-managed database called roster with the user groups in XenForo. Here's an example of my query:

UPDATE xenforo.xf_user xu
LEFT OUTER JOIN roster.member rs
ON (xu.user_id = rs.forums_id)
SET user_group_id = 13, secondary_group_ids = "2,14,15"
WHERE rs.rank_id = 4;

I ran this query, and I'm seeing the values correctly populated in the database. However, none of my users have their Title set to the title of their new user group.

How do I refresh XenForo so that it properly displays ranks changed in the database and not on the backend? I need to have this done by Friday so any and all help is appreciated.


Alright, I found the job that allows me to update user ranks:


However, if you'll indulge me to change the purpose of this thread, is it possible to run this as a cronjob on my server?


Almost a year late, but thank you so much @duderuud ! I installed this on my server and it was exactly what I was looking for. I can do this now:

0 6 * * * /usr/bin/php $HOME/public_html/cmd.php -- xf-rebuild:users | tee /tmp/xf_rebuild_users.log

I am running into an issue with this cron job though, the output file says:

Content-type: text/html; charset=UTF-8

This script can only be run via the command line interface.

I'm looking into how to fix it.

Fixed: https://xenforo.com/community/threads/cli-job-runner-for-xf-2-1.148636/post-1524576
Last edited: