Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to have no email in feeds. Fix a number of issues in feed vie... #222

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,9 @@
value="author">COM_CONFIG_FIELD_VALUE_AUTHOR_EMAIL</option>
<option
value="site">COM_CONFIG_FIELD_VALUE_SITE_EMAIL</option>
<option
value="none">COM_CONFIG_FIELD_VALUE_NO_EMAIL</option>

</field>
</fieldset>

Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/en-GB.com_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ COM_CONFIG_FIELD_VALUE_DISPLAY_OFFLINE_MESSAGE_CUSTOM="Use Custom Message"
COM_CONFIG_FIELD_VALUE_DISPLAY_OFFLINE_MESSAGE_LANGUAGE="Use Site Language Default Message"
COM_CONFIG_FIELD_VALUE_ENTIRE_SITE="Entire Site"
COM_CONFIG_FIELD_VALUE_MAXIMUM="Maximum"
COM_CONFIG_FIELD_VALUE_NO_EMAIL="No Email"
COM_CONFIG_FIELD_VALUE_NONE="None"
COM_CONFIG_FIELD_VALUE_PHP_MAIL="PHP Mail"
COM_CONFIG_FIELD_VALUE_SENDMAIL="Sendmail"
Expand Down
30 changes: 22 additions & 8 deletions components/com_contact/views/category/view.feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@
*/
class ContactViewCategory extends JView
{
function display()
function display($tpl = null)
{
// Get some data from the models
$category = $this->get('Category');
$rows = $this->get('Items');

// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
Expand All @@ -36,6 +32,13 @@ function display()

$doc = JFactory::getDocument();
$params = $app->getParams();
$feedEmail = $app->getCfg('feed_email','author');
$siteEmail = $app->getCfg('mailfrom');

JRequest::setVar('limit', $app->getCfg('feed_limit'));
// Get some data from the models
$category = $this->get('Category');
$rows = $this->get('Items');

$doc->link = JRoute::_(ContactHelperRoute::getCategoryRoute($category->id));

Expand All @@ -51,8 +54,8 @@ function display()
// url link to article
$link = JRoute::_(ContactHelperRoute::getContactRoute($row->slug, $row->catid));

$description = $row->introtext;
$author = $row->created_by_alias ? $row->created_by_alias : $row->author;
$description = $row->address;
$author = $row->created_by_alias ? $row->created_by_alias : $row->created_by;
@$date = ($row->created ? date('r', strtotime($row->created)) : '');

// load individual item creator class
Expand All @@ -61,7 +64,18 @@ function display()
$item->link = $link;
$item->description = $description;
$item->date = $date;
$item->category = $row->category;
$item->category = $category->title;
$item->author = $author;

// We don't have the author email so we have to use site in both cases.
if ($feedEmail == 'site')
{
$item->authorEmail = $siteEmail;
}
elseif($feedEmail == 'author')
{
$item->authorEmail = $siteEmail;
}

// loads item info into rss array
$doc->addItem($item);
Expand Down
14 changes: 8 additions & 6 deletions components/com_content/views/category/view.feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
*/
class ContentViewCategory extends JView
{
function display()
function display($tpl = null)
{
$app = JFactory::getApplication();

$doc = JFactory::getDocument();
$params = $app->getParams();
$feedEmail = (@$app->getCfg('feed_email')) ? $app->getCfg('feed_email') : 'author';
$feedEmail = $app->getCfg('feed_email', 'author');
$siteEmail = $app->getCfg('mailfrom');

// Get some data from the model
JRequest::setVar('limit', $app->getCfg('feed_limit'));
$category = $this->get('Category');
Expand Down Expand Up @@ -58,12 +59,13 @@ function display()
$item->description = $description;
$item->date = $date;
$item->category = $row->category_title;

$item->author = $author;
if ($feedEmail == 'site') {
if ($feedEmail == 'site')
{
$item->authorEmail = $siteEmail;
}
else {
}
elseif($feedEmail === 'author')
{
$item->authorEmail = $row->author_email;
}

Expand Down
11 changes: 6 additions & 5 deletions components/com_content/views/featured/view.feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function display($tpl = null)
$db = JFactory::getDbo();
$document = JFactory::getDocument();
$params = $app->getParams();
$feedEmail = (@$app->getCfg('feed_email')) ? $app->getCfg('feed_email') : 'author';
$feedEmail = $app->getCfg('feed_email', 'author');
$siteEmail = $app->getCfg('mailfrom');
$document->link = JRoute::_('index.php?option=com_content&view=featured');

Expand Down Expand Up @@ -67,16 +67,17 @@ function display($tpl = null)
}
}

$item->author = $author;
if ($feedEmail == 'site') {
$item->author = $author;
if ($feedEmail == 'site')
{
$item->authorEmail = $siteEmail;
}
else {
elseif ($feedEmail === 'author')
{
$item->authorEmail = $row->author_email;
}
// loads item info into rss array
$document->addItem($item);
}
}
}
?>
18 changes: 16 additions & 2 deletions components/com_weblinks/views/category/view.feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ function display($tpl = null)
$document->link = JRoute::_(WeblinksHelperRoute::getCategoryRoute(JRequest::getVar('id', null, '', 'int')));

JRequest::setVar('limit', $app->getCfg('feed_limit'));
$params = $app->getParams();
$siteEmail = $app->getCfg('mailfrom');
$fromName = $app->getCfg('fromname');
$feedEmail = $app->getCfg('feed_email', 'author');
$document->editor = $fromName;
$document->editorEmail = $siteEmail;

Expand All @@ -45,10 +47,11 @@ function display($tpl = null)
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');

// url link to article
$link = JRoute::_(WeblinksHelperRoute::getWeblinkRoute($item->slug, $item->catid));
$link = JRoute::_(WeblinksHelperRoute::getWeblinkRoute($item->id, $item->catid));

// strip html from feed item description text
$description = $item->description;
$author = $item->created_by_alias ? $item->created_by_alias : $item->created_by;
$date = ($item->date ? date('r', strtotime($item->date)) : '');

// load individual item creator class
Expand All @@ -57,7 +60,18 @@ function display($tpl = null)
$feeditem->link = $link;
$feeditem->description = $description;
$feeditem->date = $date;
$feeditem->category = 'Weblinks';
$feeditem->category = $category->title;
$feeditem->author = $author;

// We don't have the author email so we have to use site in both cases.
if ($feedEmail == 'site')
{
$feeditem->authorEmail = $siteEmail;
}
elseif($feedEmail === 'author')
{
$feeditem->authorEmail = $siteEmail;
}

// loads item info into rss array
$document->addItem($feeditem);
Expand Down