Ich würde gerne die Geburtstagsmail in eine "Gratuliere du bist schon x Jahre Mitglied in unserem Forum" abändern.
Ok dachte ich mir da müsste man ja nur die birthday.php ändern den sowol Geburtsdatum als auch Registrierungsdatum stehen ja in der DB
So nun zu meinen Problem
PHP-Code:
$today = date('m-d', TIMENOW)
legt ja fest das $today im Format m-d vorliegt also zum beispiel 12-6
Dann kommen einige Zusatzangaben die aber kein Problem sind.
Wichtig wird es dann hier:
PHP-Code:
WHERE birthday LIKE '$today-%
Hier wird in der DB die Tabelle birthday ausgelesen und mit $today also dem heutigen Datum verglichen.
Ist heute z.B der 15-6 wird in der Tabelle birthday genau nach 15-6 gesucht.
So weit so gut ist ja auch kein Problem den das Datum in der Tabelle birthday liegt ja in der Form "10-10-1981" vor.
Jetzt soll aber nicht die Tabelle birthday sondern die Tabelle joindate ausgelesen werden.
Das ist auch kein Problem nur das Ergebnis lässt sich nicht verwerten da in der Tabelle joindate das Datum als Unix Timestamp gespeichert ist also in der Form 1022273160.
Das bedeutet mann muss den PHP Code wohl so ändern das er in der Lage ist aus dem Unix Timestamp Monat und Jahr auszulesen und in die Form 12-6 zu bringen damit dies mit
PHP-Code:
$today = date('m-d', TIMENOW)
verglichen werden kann.
Wie macht man das?
hier noch mal die ganze birthday.php
PHP-Code:
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
$today = date('m-d', TIMENOW);
$ids = '0';
foreach($vbulletin->usergroupcache AS $usergroupid => $usergroup)
{
if ($usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['showbirthday'] AND $usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'] AND !in_array($usergroup['usergroupid'], array(1, 3, 4)))
{
$ids .= ",$usergroupid";
}
}
$birthdays = $vbulletin->db->query_read("
SELECT username, email, languageid
FROM " . TABLE_PREFIX . "user
WHERE birthday LIKE '$today-%' AND
(options & " . $vbulletin->bf_misc_useroptions['adminemail'] . ") AND
usergroupid IN ($ids)
");
vbmail_start();
while ($userinfo = $vbulletin->db->fetch_array($birthdays))
{
$username = unhtmlspecialchars($userinfo['username']);
eval(fetch_email_phrases('birthday', $userinfo['languageid']));
vbmail($userinfo['email'], $subject, $message);
$emails .= iif($emails, ', ');
$emails .= $userinfo['username'];
}
vbmail_end();
if ($emails)
{
log_cron_action($emails, $nextitem, 1);
}
Hab auch schon was gefunden wie es funktionieren könnte.
Mein Problem ist ich hab von PHP nicht wirklich ne ahnung.
Könnte mir bitte jemand dabei helfen wie ich den oben geposteten Code mit dieser Funktion so umändern kann das es funktioniert?
PHP-Code:
FROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format)
Returns a representation of the unix_timestamp argument as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is used in a string or numeric context. The value is expressed in the current time zone. unix_timestamp is an internal timestamp value such as is produced by the UNIX_TIMESTAMP() function.
If format is given, the result is formatted according to the format string, which is used the same way as listed in the entry for the DATE_FORMAT() function.
mysql> SELECT FROM_UNIXTIME(1196440219);
-> '2007-11-30 10:30:19'
mysql> SELECT FROM_UNIXTIME(1196440219) + 0;
-> 20071130103019.000000
mysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),
-> '%Y %D %M %h:%i:%s %x');
-> '2007 30th November 10:30:59 2007'
Note: If you use UNIX_TIMESTAMP() and FROM_UNIXTIME() to convert between TIMESTAMP values and Unix timestamp values, the conversion is lossy because the mapping is not one-to-one in both directions. For details, see the description of the UNIX_TIMESTAMP() function.
VIELEN DANK!!