Code Monkey
Well-known member
I see it does. Never mind then.
Parse error: syntax error, unexpected T_FUNCTION in /home/adminx/public_html/library/XenForo/Mail.php on line 362
To manually specify forum IDs to pull from:
Open library/MonthlyEmails/Model/Email.php
Delete the code in red:
In its place, add:Rich (BB code):protected function _getRecentPublicThreads() { $nodeModel = $this->getModelFromCache('XenForo_Model_Node'); $nodes = $nodeModel->getAllNodes(false, true); $nodePermissions = $nodeModel->getNodePermissionsForPermissionCombination(1); $nodeHandlers = $nodeModel->getNodeHandlersForNodeTypes( $nodeModel->getUniqueNodeTypeIdsFromNodeList($nodes) ); $nodes = $nodeModel->getViewableNodesFromNodeList($nodes, $nodeHandlers, $nodePermissions); $options = XenForo_Application::get('options'); foreach ($nodes as $node) { $nodeIds[] = $node['node_id']; } $conditions = array( 'node_id' => $nodeIds); $fetchOptions = array( 'order' => 'post_date', 'limit' => $options->monthlyEmailsThreadLimit); $threadModel = $this->getModelFromCache('XenForo_Model_Thread'); $threads = $threadModel->getThreads($conditions, $fetchOptions); return $threads; }
Rich (BB code):$nodeIds = array( '2', '3', '4' );
The resulting code will look like:
Rich (BB code):protected function _getRecentPublicThreads() { $nodeIds = array( '2', '3', '4' ); $conditions = array( 'node_id' => $nodeIds); $fetchOptions = array( 'order' => 'post_date', 'limit' => $options->monthlyEmailsThreadLimit); $threadModel = $this->getModelFromCache('XenForo_Model_Thread'); $threads = $threadModel->getThreads($conditions, $fetchOptions); return $threads; }
You'll have to increase the max_execution time for PHP. I've run into this as well on larger sites.
$users = $this->getModelFromCache('XenForo_Model_User')->getUsers(array(
'user_status' => 'valid',
'receive_admin_email' => 1,
'is_banned' => 0,
), array(
'join' => XenForo_Model_User::FETCH_USER_FULL
));
$users = $this->getModelFromCache('XenForo_Model_User')->getUsers(array(
'user_state' => 'valid',
'receive_admin_email' => 1,
'is_banned' => 0,
), array(
'join' => XenForo_Model_User::FETCH_USER_FULL
));
Fixes issue where email was being sent to unconfirmed accounts.
Anyone get into trouble with spam complaints or blacklisting as a result of this? Is there an unsubscribe link?
Also, is there a way to send the mail only to active users, those who have been around in the past month or two? I saw someone else earlier ask about this, but I did not see a response.
Thanks!
At the end of the email a line of text will explain how to stop receiving the monthly emails.
View attachment 63891
Fixed unsubscribe link
Awesome. However I'm pretty sure there are specifics that are required by email host that need to be included in the text.
We use essential cookies to make this site work, and optional cookies to enhance your experience.