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

Trophy/User Upgrades Questions

Discussion in 'XenForo Questions and Support' started by Jake Hakoda Shirley, Apr 29, 2011.

  1. Jake Hakoda Shirley

    Jake Hakoda Shirley Active Member

    Hey guys, I am looking for a way to have my registered members to have a "free" trial. I want them to be put into a group for x days but then removed after that. Is there any way I can accomplish this?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. Jake Hakoda Shirley

    Jake Hakoda Shirley Active Member

    That's what I was afraid off...
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    You can always try asking in the add-on requests forum.
     
  5. Onimua

    Onimua Well-Known Member

  6. Jake Hakoda Shirley

    Jake Hakoda Shirley Active Member

    That's pretty much what I wanted. I suggested a feature in the Trophy User Group thread. Hopefully I can get this working :)
     
  7. James

    James Well-Known Member

    In the meantime, maybe you could set up a cron job and a custom usergroup (for the trial) and have the cron job remove people from the trial usergroup It only needs to be ran once a day.
     
  8. Jake Hakoda Shirley

    Jake Hakoda Shirley Active Member

    I can try. Anyone want to pass along a Cron Entry guide for Xenforo?
     
  9. James

    James Well-Known Member

    I'm no expert but if you take a look at the existing XenForo cron jobs you might be able to figure it out:
    admin.php?cron/
     
  10. Jake Hakoda Shirley

    Jake Hakoda Shirley Active Member

    I came up with something based off of trophies. Probably not even in the ball park.

    PHP:
    <?php

    /**
    * Cron entry for trial checking
    *
    * @package XenForo_Trial
    */
    class XenForo_CronEntry_Trial
    {
        
    /**
        * Runs the cron-based check for trial termination
        */
        
    public static function runTrialCheck()
        {
            
    /* @var $userModel XenForo_Model_User */
            
    $userModel XenForo_Model::create('XenForo_Model_User');

    // Assuming that 13 is the group number for your trial members
    // Assuming that 'timeinseconds' is a real number

            
    $users $userModel->getUsers(array(
                
    'secondary_goup_ids' => 13,
                
    'register_date' => array('>'XenForo_Application::$time timeinseconds)
            ));

            foreach (
    $users AS $user)
            {
    // Not too sure on how to set fields...
                
    $user['secondary_group_ids'] = null;
            }
        }
    }
     

Share This Page