/**
  * Create a new ad
  *
  * @param $name             string name of ad
  * @param $body             string content of ad
  * @param $caption            string caption/heading of ad
  * @param $mainlink            string main link for the ad (link caption to page)
  * @param $user             User causing the change
  * @param bool|int $displayAnon integer flag for display to anonymous users
  * @param bool|int $displayUser integer flag for display to logged in users
  *
  * @return bool true or false depending on whether ad was successfully added
  */
 static function addAd($name, $body, $caption, $mainlink, $user, $displayAnon = true, $displayUser = true)
 {
     //if ( $name == '' || !Ad::isValidAdName( $name ) || $body == '' ) {
     if ($name == '' || !Ad::isValidAdName($name)) {
         return 'promoter-null-string';
     }
     $ad = Ad::newFromName($name);
     if ($ad->exists()) {
         return 'promoter-ad-exists';
     }
     $ad->setAllocation($displayAnon, $displayUser);
     $ad->setCaption($caption);
     $ad->setMainLink($mainlink);
     $ad->setBodyContent($body);
     $ad->save($user);
     return true;
 }