Пример #1
0
 /**
  * Notify site admins that a group is created
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function notifyAdmins(SocialGroup $group)
 {
     // Push arguments to template variables so users can use these arguments
     $params = array('title' => $group->getName(), 'creatorName' => $group->getCreator()->getName(), 'creatorLink' => $group->getCreator()->getPermalink(false, true), 'categoryTitle' => $group->getCategory()->get('title'), 'avatar' => $group->getAvatar(SOCIAL_AVATAR_LARGE), 'permalink' => $group->getPermalink(true, true), 'alerts' => false);
     // Set the e-mail title
     $title = JText::sprintf('COM_EASYSOCIAL_EMAILS_GROUP_CREATED_MODERATOR_EMAIL_TITLE', $group->getName());
     // Get a list of super admins on the site.
     $usersModel = FD::model('Users');
     $admins = $usersModel->getSiteAdmins();
     foreach ($admins as $admin) {
         // Ensure that the user is a site admin or the Receive System email is turned off
         if (!$admin->isSiteAdmin() || !$admin->sendEmail) {
             continue;
         }
         // Immediately send out emails
         $mailer = FD::mailer();
         // Set the admin's name.
         $params['adminName'] = $admin->getName();
         // Get the email template.
         $mailTemplate = $mailer->getTemplate();
         // Set recipient
         $mailTemplate->setRecipient($admin->getName(), $admin->email);
         // Set title
         $mailTemplate->setTitle($title);
         // Set the template
         $mailTemplate->setTemplate('site/group/created', $params);
         // Set the priority. We need it to be sent out immediately since this is user registrations.
         $mailTemplate->setPriority(SOCIAL_MAILER_PRIORITY_IMMEDIATE);
         // Try to send out email to the admin now.
         $state = $mailer->create($mailTemplate);
     }
     return true;
 }
Пример #2
0
 /**
  * Adds opengraph data for the group
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function addGroup(SocialGroup $group)
 {
     $config = FD::config();
     // Only proceed when opengraph is enabled
     if (!$config->get('oauth.facebook.opengraph.enabled')) {
         return;
     }
     $this->properties['type'] = 'profile';
     $this->properties['title'] = $group->getName();
     $description = strip_tags($group->getDescription());
     $this->addDescription($description);
     $this->addImage($group->getAvatar(SOCIAL_AVATAR_MEDIUM), SOCIAL_AVATAR_MEDIUM_WIDTH, SOCIAL_AVATAR_MEDIUM_HEIGHT);
     $this->addUrl($group->getPermalink(true, true));
     return $this;
 }
Пример #3
0
 /**
  * Post process after the group avatar is removed
  *
  * @since	1.2
  * @access	public
  * @param	SocialGroup
  */
 public function removeAvatar(SocialGroup $group)
 {
     FD::info()->set($this->getMessage());
     $permalink = $group->getPermalink(false);
     $this->redirect($permalink);
 }