Number of days since first registration

E-mail
(2 votes, average 5.00 out of 5)

This recipe can easily be customised to show people new modules based on how many days they have been registered. You may want to progress your registered users through a rolling programme of advertising / instruction etc. e.g. for the first week after they register show one module, then another for the next week, and another after that.

if ($user->id > 0) { // ensure that there's a logged in user
  $days = (int)((time() - strtotime( $user->registerDate )) / (24*60*60));
  if ($days >= 21) return 101; // for all users reg for 3 weeks or more
  if ($days >= 14) return 102; // for all users reg for 2 weeks or more
  if ($days >=  7) return 103; // for all users reg for 1 week or more
  return 104; // user has been registered from 0-7 days
}