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

XF 1.1 User promotion not working?

Discussion in 'Troubleshooting and Problems' started by Rudy, Dec 21, 2012.

  1. Rudy

    Rudy Well-Known Member

    I have a user promotion setup on the forum where the first three posts are set to the moderation queue. Following an example here, I set it by 1) choosing the secondary usergroup to be assigned to and 2) selecting only "User has posted at least X messages:" (with the appropriate value) in the "Apply this promotion while..." tab. It works fine, as all users with more than three posts now belong to my "Verified Member" secondary group.

    I have an existing forum offline for awhile why I rearrange everything, and what I want to do is assign all existing members to three separate secondary user groups. I created pretty much the same promotion, yet it is not taking effect. The only things I have selected are similar to above: 1) I select the secondary groups to be assigned to, and 2) nothing else is selected in the other two tabs except for "User has been registered for at least X days:" which is set for 7 days (I've had the forum offline for more than a week).

    Checking an existing long-time member, the promotion is not being applied. When I first set it up, I manually ran the cron entry...no change. Then I waited until after the next scheduled run of the cron, loaded the forum a few times...still nothing. I also notice when I ran it manually once, it took several seconds to complete. On subsequent tries, the cron job ends almost immediately.

    I even created another new promotion, again selecting only the one critera...still nothing.

    What am I missing? Both the good and the bad promotions are essentially setup the same way, and each only has the one criteria selected. It worked fine for my Verified Member promotion, but it's not doing anything with the new ones.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Promotions are run hourly. You may wish to manually run the cron after creating the promotion:

    Admin CP -> Tools -> Cron Entries -> User Group Promotions -> Controls: Run

    And even if you manually run the cron it only processes users who have been active in the last 3 days. If you want to process all users regardless of activity then you need to use this updated version of the cron:


    That will allow you to remove 'last_activity' => array('>', XenForo_Application::$time - 86400 * 3) from the file to process all users without memory problems.
    mjp likes this.
  3. Rudy

    Rudy Well-Known Member

    Oh jeez...once again I forgot about that 3-day limit. That's what it is. Thanks! I actually changed that file on our big board since some promotions I was running were failing due to exhausting the memory.

    Once I get everyone moved over, I may switch it back to the original file. This one is not a busy forum, but I'm trying to configure it properly before launch.

    I may do things slightly different though: I am setting it up so certain forum areas do not appear unless a member checks a box in Preferences within his user profile. I'm using custom fields for that, and permissions are working fine. Ideally I want to select some of those boxes on their behalf ahead of time--I'm basically going to be merging three other forums into this one, but want to be sure the current forum members are still viewing the forums they originally viewed before I shut the site down.

    I can't find a query that will work to update the xf_user_field_value table (unless I start getting into MySQL "procedures"), so I'm going to be rolling my own PHP script to handle it.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    This will set a value in a custom user field for all users:

    INSERT INTO xf_user_field_value (user_id, field_id, field_value)
    	SELECT user_id, 'field_id', 'new value'
    	FROM xf_user
    	field_value = VALUES(field_value);
    Then rebuild the user cache:

    Admin CP -> Tools -> Rebuild Caches -> Rebuild User Caches
  5. Rudy

    Rudy Well-Known Member

    One last question I forgot--I can just remove this from the array, then, like this:

            $users $userModel->getUsers(array(
    'user_state' => 'valid',
    'is_banned' => 0)
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  7. Rudy

    Rudy Well-Known Member

    Fantastic--thanks for both tips!
  8. Rudy

    Rudy Well-Known Member

    Wuh woah...

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24607 bytes) in/usr/www/users/xxxxxxxxxxxxxxx/library/XenForo/Model/Permission.php on line 1626

  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    What triggers it?
  10. Rudy

    Rudy Well-Known Member

    I ran the cron for user promotions (using your modified file). I ended up bumping the memory to some insane amount (256MB) and it completed OK.
    Jake Bunce likes this.

Share This Page