Yetkinwebmaster | Web Design, Kodlar, Makaleler
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Smf Aktif Olmayan üyelere Otomatik Mail (paket), ( sizi özledik modu )

Aşağa gitmek

Smf Aktif Olmayan üyelere Otomatik Mail (paket), ( sizi özledik modu ) Empty Smf Aktif Olmayan üyelere Otomatik Mail (paket), ( sizi özledik modu )

Mesaj tarafından admin Perş. Nis. 02, 2009 3:23 pm

Modülün adı: AUTO EMAIL INACTIVE ORDINARY USERS v1.2
Yapımcı: karlbenson
İşlevi: Uzun süre forumunuza gelmeyen üyeye otomatik mail atar,çağrıda bulunur..

Download:
http://custom.simplemachines.org/mod...x.php?mod=1025

Bazı modlarla çakıştığından yakınanlar ve paket modül kuramıyorum diyenler için bu modun manuel anlatımı:

forum index.php'de bul:
Kod:
// Load the current user's permissions.
loadPermissions();


sonrasına ekle:
Kod:
// Auto Email In active ordinary users
require_once($sourcedir . '/Subs-Post.php');
aeiou();
sources/subs.php dosyasının en sonuna ekle:
Kod:
// Auto Email Inactive Ordinary Users Function
function aeiou()
{
global $context, $modSettings, $db_prefix, $txt, $scripturl;

// Max chunk. (max amount of emails to send at a time.)
// Keeps page loading fast, mail server running smoothly
$maxchunk = ($modSettings['aeiou_chunksize'] != 0) ? $modSettings['aeiou_chunksize'] : 5;

// Mod disabled?
if(!$modSettings['aeiou_enable'])
return;

// Time
$time = time();
list($hour, $day) = explode(',', (date('H,d',$time)));
list($lockedhour, $lockedday) = ($modSettings['aeiou_locktimestamp'] == 0) ? array(-1,-1) : explode(',', (date('H,d', $modSettings['aeiou_locktimestamp'])));

// 5 min gap between sending each chunk
if(($time-$modSettings['aeiou_locktimestamp'])/60 < 5)
return;

// Locked? - Shouldn't be after 5 minutes, override it to prevent accidental permanent lock
if($modSettings['aeiou_lockkey'] != 0)
$unlock = 1;

// Different hour/day? Reset?
if($day != $lockedday)
$modSettings['aeiou_day_sent'] = 0;
if($hour != $lockedhour)
$modSettings['aeiou_hour_sent'] = 0;

// Reached limits for this hour/day?
if(($modSettings['aeiou_hour_sent'] >= $modSettings['aeiou_hour_max']) || ($modSettings['aeiou_day_sent'] >= $modSettings['aeiou_day_max']))
return;

// Generate unique random key
$lockkey = md5($time.rand());

// Update the timestamp
$request = db_query("
UPDATE {$db_prefix}settings
SET value = $time
WHERE variable = 'aeiou_locktimestamp'
AND value = ". $modSettings['aeiou_locktimestamp'] ."
LIMIT 1
", __FILE__, __LINE__);

// If it didn't change the timestamp (eg same query called simultaneously by another?)
if(mysql_affected_rows() == 0)
return;

// Change the lockkey
$request = db_query("
UPDATE {$db_prefix}settings
SET value = '".$lockkey."'
WHERE variable = 'aeiou_lockkey'
AND value = ". ( isset($unlock) ? $modSettings['aeiou_lockkey'] : 0 ) ."
", __FILE__, __LINE__);

// If it didn't change the key (eg same query called simultaneously by another?)
if(mysql_affected_rows() == 0)
return;

// Reset the emails sent for any users who have logged in since we sent the emails
db_query("
UPDATE {$db_prefix}members
SET aeiou_email = 0, aeiou_count = 0
WHERE lastLogin > aeiou_email
AND aeiou_email > 0
", __FILE__, __LINE__);

// Delete users query
if($modSettings['aeiou_delete'])
aeiou_delete();

// How many victims to get?
// Based on the remainder allowed for this hour and max chunk size
$limit = (($modSettings['aeiou_hour_max'] - $modSettings['aeiou_hour_sent']) < $maxchunk) ? $modSettings['aeiou_hour_max'] - $modSettings['aeiou_hour_sent'] : $maxchunk;
// Based on the remainder allowed for this day
if($limit > ($modSettings['aeiou_day_max'] - $modSettings['aeiou_day_sent']))
$limit = $modSettings['aeiou_day_max'] - $modSettings['aeiou_day_sent'];

// Query to get next victims
// - Must have been registered for 21 days
// - Must not have logged in for 21 days
// - Must have been sent less than 3 emails
// - Must not been emailed in the last 30 days
// - Must not be banned (is_activated >= 10)
// - Must be an activated username/account (not 0)
$request = db_query("
SELECT ID_MEMBER, emailAddress, memberName, realName
FROM {$db_prefix}members
WHERE dateRegistered < ". ($time - 1814400) ."
AND lastLogin < ". ($time - 1814400) ."
AND aeiou_count < 3
AND aeiou_email < ". ($time - 2592000) ."
AND emailAddress is NOT NULL
AND is_activated < 10
AND is_activated != 0
AND is_activated != 4
ORDER BY aeiou_count ASC, aeiou_email ASC, lastLogin ASC
LIMIT ".$limit."
", __FILE__, __LINE__);

$returned = (int) mysql_num_rows($request);

// No victims, returned
if($returned == 0)
{
// No point in calling this script again until tomorrow, So make it look like reached limits
aeiou_update(array('day_sent' => $modSettings['aeiou_day_max'],'hour_sent' => $modSettings['aeiou_hour_max'], 'lockkey' => 0));
return;
}
elseif($returned < $limit)
{
// Some returned (must be the last few)
// No point in calling this script again until tomorrow, So make it look like reached limits
aeiou_update(array('day_sent' => $modSettings['aeiou_day_max'],'hour_sent' => $modSettings['aeiou_hour_max']));
}
else
{
// Increase the amount sent hour/day
aeiou_update(array('day_sent' => $modSettings['aeiou_day_sent'] + $returned, 'hour_sent' => $modSettings['aeiou_hour_sent'] + $returned));
}

$search = array('$username', '$displayname', '$forum', '$link', '$lostpassword');
// Now the actual sending
while($row = mysql_fetch_assoc($request))
{
// Custom or default message/subject?
$message = empty($modSettings['aeiou_message']) ? $txt['aeiou_default_message'] : $modSettings['aeiou_message'];
$subject = empty($modSettings['aeiou_subject']) ? $txt['aeiou_default_subject'] : $modSettings['aeiou_subject'];

// Replace our placeholders in the message eg $username eg
$replace = array($row['memberName'], $row['realName'], $context['forum_name'], $scripturl, $scripturl.'?action=reminder');
$message = str_replace($search, $replace, $message);
$subject = str_replace($search, $replace, $subject);

// Now send the mail
sendmail($row['emailAddress'], $subject, $message);

// Update each users information
db_query("
UPDATE {$db_prefix}members
SET aeiou_email = '". $time ."', aeiou_count = aeiou_count+1
WHERE ID_MEMBER = ". $row['ID_MEMBER'] ."
", __FILE__, __LINE__);
}
// Tidy up
mysql_free_result($request);
unset($row, $search, $replace, $subject, $message);

// Unlock the function
aeiou_update(array('lockkey' => 0));

}
// Function to delete users. sends through deleteMembers function in Subs-members.php
function aeiou_delete()
{
global $db_prefix, $modSettings;

$modSettings['aeiou_underposts'] = empty($modSettings['aeiou_underposts']) ? 0 : (int) $modSettings['aeiou_underposts'];

// Get a timestamp
$time = time();

// Grab all ordinary (non-admin) users to kill (5 at a time, otherwise it would kill the server)
$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE lastLogin < ". ($time - 2592000) ."
AND ID_GROUP != 1
AND FIND_IN_SET(1, additionalGroups) = 0
AND aeiou_count >= 3
AND aeiou_email < ". ($time - 2592000) ."
". ( ($modSettings['aeiou_underposts'] > 0) ? "AND posts <= ".$modSettings['aeiou_underposts'] : "" ) ."
LIMIT 5
", __FILE__, __LINE__);

// No people to delete
if(mysql_num_rows($request) == 0)
return;

// Store all the users to be deleted in an array
$users = array();
while($row = mysql_fetch_assoc($request))
$users[] = (int) $row['ID_MEMBER'];

// Tidy up
mysql_free_result($request);
unset($row, $condition);

// Delete members (using a bypass of some checks)
require_once('Subs-Members.php');
deleteMembers($users, true);

}
// Function to update a setting of this mod, adds aeiou_ to any variable name
function aeiou_update($array = null)
{
global $db_prefix;

// If not an array, or empty, return
if(!is_array($array) || empty($array))
return;

foreach($array as $a => $b)
{
db_query("
UPDATE {$db_prefix}settings
SET value = ". (int) $b ."
WHERE variable = 'aeiou_".$a."'
", __FILE__, __LINE__);
}
}
sources/Subs-Members.php dosyasında bul:

Kod:
function deleteMembers($users)
bununla değiştir:
Kod:
function deleteMembers($users, $bypass = false)
bul:
Kod:
elseif (count($users) == 1)
{
list ($user) = $users;
$condition = '= ' . $user;

if ($user == $ID_MEMBER)
isAllowedTo('profile_remove_own');
else
isAllowedTo('profile_remove_any');
}
else
{
foreach ($users as $k => $v)
$users[$k] = (int) $v;
$condition = 'IN (' . implode(', ', $users) . ')';

// Deleting more than one? You can't have more than one account...
isAllowedTo('profile_remove_any');
}

// Make sure they aren't trying to delete administrators if they aren't one. But don't bother checking if it's just themself.
if (!allowedTo('admin_forum') && (count($users) != 1 || $users[0] != $ID_MEMBER))
{
$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE ID_MEMBER IN (" . implode(', ', $users) . ")
AND (ID_GROUP = 1 OR FIND_IN_SET(1, additionalGroups) != 0)
LIMIT " . count($users), __FILE__, __LINE__);
$admins = array();
while ($row = mysql_fetch_assoc($request))
$admins[] = $row['ID_MEMBER'];
mysql_free_result($request);

if (!empty($admins))
$users = array_diff($users, $admins);
}
değiştir:
Kod:
// *Section Modified by Automatically Email Inactive Users mod
if (count($users) == 1)
{
list ($user) = $users;
$condition = '= ' . $user;

// Bypass when called by AEIOU mod
if(!$bypass)
{
if ($user == $ID_MEMBER)
isAllowedTo('profile_remove_own');
else
isAllowedTo('profile_remove_any');
}
else
{
global $boardurl;
// Bypass only valid via SMF, the Board Url and deletion is enabled
if(!defined('SMF') || $boardurl != substr($_SERVER['REQUEST_URL'], 0, strlen($boardurl)) || empty($modSettings['aeiou_delete']))
return;
}
}
else
{
foreach ($users as $k => $v)
$users[$k] = (int) $v;
$condition = 'IN (' . implode(', ', $users) . ')';

// Bypass when called by AEIOU mod
if(!$bypass)
{
// Deleting more than one? You can't have more than one account...
isAllowedTo('profile_remove_any');
}
else
{
global $boardurl;
// Bypass only valid via SMF && via Board Url
if(!defined('SMF') || $boardurl != substr($_SERVER['REQUEST_URL'], 0, strlen($boardurl)) || empty($modSettings['aeiou_delete']))
return;
}
}

// Make sure they aren't trying to delete administrators if they aren't one. But don't bother checking if it's just themself.
if (!allowedTo('admin_forum') && (count($users) != 1 || $users[0] != $ID_MEMBER))
{
$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE ID_MEMBER IN (" . implode(', ', $users) . ")
AND (ID_GROUP = 1 OR FIND_IN_SET(1, additionalGroups) != 0)
LIMIT " . count($users), __FILE__, __LINE__);
$admins = array();
while ($row = mysql_fetch_assoc($request))
$admins[] = $row['ID_MEMBER'];
mysql_free_result($request);

if (!empty($admins))
$users = array_diff($users, $admins);
}
sources/ModSettings.php dosyasında bul:
Kod:
$context['sub_template'] = 'show_settings';

$subActions = array(
'basic' => 'ModifyBasicSettings',
'layout' => 'ModifyLayoutSettings',
'karma' => 'ModifyKarmaSettings',
altına ekle:
Kod:
'aeiou' => 'ModifyAeiouSettings',
bul:
Kod:
require_once($sourcedir . '/ManageServer.php');

$subActions = array(
'basic' => 'ModifyBasicSettings',
'layout' => 'ModifyLayoutSettings',
'karma' => 'ModifyKarmaSettings',
altına ekle:
Kod:
'aeiou' => 'ModifyAeiouSettings',
bul:
Kod:
'karma' => array(
'title' => $txt['smf293'],
'href' => $scripturl . '?action=featuresettings;sa=karma;sesc=' . $context['session_id'],
altına ekle:
Kod:
),
'aeiou' => array(
'title' => $txt['aeiou'],
'href' => $scripturl . '?action=featuresettings;sa=aeiou;sesc=' . $context['session_id'],
bul:
Kod:
$context['post_url'] = $scripturl . '?action=featuresettings2;save;sa=karma';
$context['settings_title'] = $txt['smf293'];

prepareDBSettingContext($config_vars);
}
altına ekle:
Kod:
function ModifyAeiouSettings()
{
global $txt, $scripturl, $context, $settings, $sc, $modSettings;

$config_vars = array(
array('check', 'aeiou_enable'),
array('text', 'aeiou_subject'),
array('large_text', 'aeiou_message'),
'',
array('check', 'aeiou_delete'),
array('int', 'aeiou_underposts'),
$txt['aeiou_warning'],
array('int', 'aeiou_hour_max'),
array('int', 'aeiou_day_max'),
array('int', 'aeiou_chunksize'),
);

if(empty($modSettings['aeiou_subject']))
$modSettings['aeiou_subject'] = !empty($txt['aeiou_default_subject']) ? $txt['aeiou_default_subject'] : '';
if(empty($modSettings['aeiou_message']))
$modSettings['aeiou_message'] = !empty($txt['aeiou_default_message']) ? $txt['aeiou_default_message'] : '';
admin
admin
Forummoderatör

Forummoderatör

Uyarı Yok
Cinsiyet : Erkek
Mesaj Sayısı : 467
Puan : 1475
Başarı Puanı : 1

https://yetkinwebmaster1.yetkin-forum.com

Sayfa başına dön Aşağa gitmek

Sayfa başına dön

- Similar topics

 
Bu forumun müsaadesi var:
Bu forumdaki mesajlara cevap veremezsiniz