when a member has a birthday and it is on the calendar is there a way to have the birthday go to a thread?
This is a Hitskin.com skin preview
Install the skin • Return to the skin page
This is a Hitskin.com skin preview
Install the skin • Return to the skin page
Wolfuryo wrote:Hi,
So you have a thread, and when it is someones birthday, a message should be posted in the thread, right? It's possible to do something like this. Send me a PM with your forum's link and an account that has admin access(not necessary the founder account, I only need access to the JS part).
|
|
|
|
$(function() {
var poster_name = "BOT";
var message = "Happy Birthday %user!";
var subject = "Happy Birthday %user!";
var avatar = 0;
if (_userdata.session_logged_in && (location.pathname == "/" || location.pathname == "/forum")) {
var tbd = [],
tb = [],
arr, leng, len;
function check() {
var ar = $("span:contains('birthday')").first().html().split("<br")[0].match(/<strong>.+<\/strong>/),
len = ar.length;
if (len != 0) {
for (var i = 0; i < len; i++) {
ar[i] = ar[i].replace(/<strong>|<\/strong>/g, "");
tbd.push(ar[i]);
};
get_d();
};
};
function get_d() {
$.get("http://virus-design.esy.es/2girlsgraphics.php/?get", function(data) {
arr = data.split("<sp>"), leng = arr.length;
filtere();
});
};
var index = 0;
function filtere() {
for (var i = 0; i < tbd.length; i++) {
if (arr.indexOf(tbd[i]) == -1) {
tb.push(tbd[i]);
};
};
post(index);
};
function post(l) {
if (!(l < tb.length && tb[l] != undefined && tb[l] != "undefined")) return;
$.post("/post", {
mode: "newtopic",
f: 19,
subject: subject.replace(/%user/g, tb[l]),
message: message.replace(/%user/g, tb[l]),
post: "Ok"
}).always(function() {
$.post("http://virus-design.esy.es/2girlsgraphics.php/?post?name=" + tb[l], function() {
l++;
if (l < tb.length - 1) {
post(l);
};
});
});
};
check();
};
if (/f19-/.test(window.location.pathname)) {
for (var i = 4; i < $("tbody>tr").length; i++) {
$("span.name>strong>a>span>strong").eq(i).text(poster_name)
};
};
if (/t\d+/.test(window.location.pathname) && $("a.nav[href*='/f19-happy-birthday']").length != 0) {
$("span.name>strong>a>span>strong").eq(0).text(poster_name);
var avat = $("[alt='avatar']").eq(0);
avatar == 0 ? avat.remove() : avatar != 1 ? avat.attr("src", avatar) : avat = avat;
};
});
<?php
header("Access-Control-Allow-Origin: http://2girlsgraphics.forumotion.com");
$url="http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$mode=parse_url($url, PHP_URL_QUERY);
if(strpos($mode, "get") !== false){
$file=fopen("db.txt", "r");
$text=fread($file,filesize("db.txt"));
echo $text;
fclose($file);
};
if(strpos($mode, "post") !== false){
$file=fopen("db.txt", "a");
$text=fread($file,filesize("db.txt"));
echo $url;
$name=explode("name=", $url)[1];
echo $name;
$t=$text."<sp>".$name;
fwrite($file, $t);
fclose($file);
};
?>
Wolfuryo wrote:You need your own server to host the code. The one that is used for @"Purple Tears" is placed on my server. The codes have to be modified to work with other forums.
Problem solved & topic archived.
|