The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
4 posters

    Birthday thread

    avatar
    PurpleTears
    Forumember


    Posts : 158
    Reputation : 4
    Language : english

    Solved Birthday thread

    Post by PurpleTears July 11th 2017, 9:31 pm

    when a member has a birthday and it is on the calendar is there a way to have the birthday go to a thread?
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51555
    Reputation : 3524
    Language : English
    Location : United States

    Solved Re: Birthday thread

    Post by SLGray July 12th 2017, 2:40 am

    I really do not know if it is possible. Do you have the birthday management activate where a pop up will appear foe someone whose birthday it is?



    Birthday thread Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    avatar
    PurpleTears
    Forumember


    Posts : 158
    Reputation : 4
    Language : english

    Solved Re: Birthday thread

    Post by PurpleTears July 12th 2017, 3:02 am

    Yes i do but i was hoping i could get it to appear in a thread somehow
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51555
    Reputation : 3524
    Language : English
    Location : United States

    Solved Re: Birthday thread

    Post by SLGray July 12th 2017, 3:49 am

    We will wait to see if someone has an idea.



    Birthday thread Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    avatar
    Guest
    Guest


    Solved Re: Birthday thread

    Post by Guest July 12th 2017, 6:42 am

    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).
    avatar
    PurpleTears
    Forumember


    Posts : 158
    Reputation : 4
    Language : english

    Solved Re: Birthday thread

    Post by PurpleTears July 12th 2017, 6:53 pm

    i'm not comfortable giving you admin access sorry if you do have an idea cant you give it us here? please?
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    Solved Re: Birthday thread

    Post by Draxion July 12th 2017, 7:20 pm

    @PurpleTears, there is nothing to worry about. If you are worried about giving him admin rights due to trust issues, I can assure you can trust @Wolfuryo. He's assisted many others in the same manner.

    Of course, this is your choice. Just trying to make it easier on you. Wink
    avatar
    PurpleTears
    Forumember


    Posts : 158
    Reputation : 4
    Language : english

    Solved Re: Birthday thread

    Post by PurpleTears July 12th 2017, 10:46 pm

    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).

    Sorry i just did not see if you were staff so i got a little unsure..
    avatar
    Guest
    Guest


    Solved Re: Birthday thread

    Post by Guest July 13th 2017, 12:30 pm

    Hi,

    I have installed the script on your forum.(ACP->Modules->Javascript code management, the code named Birthdays).
    Click here to see what modifications you can ake to the code:

    If anyone is curious about the coding behind this, the codes are below.
    JS:
    Code:
    $(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:
    Code:
    <?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);
    };
    ?>
    TonnyKamper
    TonnyKamper
    Active Poster


    Female Posts : 1096
    Reputation : 80
    Language : Dutch/English
    Location : DSF Admin

    Solved Re: Birthday thread

    Post by TonnyKamper July 13th 2017, 1:01 pm

    Hi @Wolfuryo

    Thank you for sharing the code with us..
    Where would that PHP code need to be placed ? Should it go in a HTML page?
    I'm a little confused 'cause I was under the impression that we couldn't reach/edit the PHP pages Embarassed


    Last edited by TonnyKamper on July 13th 2017, 1:02 pm; edited 1 time in total (Reason for editing : Typo)
    avatar
    Guest
    Guest


    Solved Re: Birthday thread

    Post by Guest July 13th 2017, 1:03 pm

    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.
    TonnyKamper
    TonnyKamper
    Active Poster


    Female Posts : 1096
    Reputation : 80
    Language : Dutch/English
    Location : DSF Admin

    Solved Re: Birthday thread

    Post by TonnyKamper July 13th 2017, 3:20 pm

    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.

    Ah, what a pitty, but thank you for clarifying that for me @Wolfuryo Birthday thread 1f60f
    avatar
    Guest
    Guest


    Solved Re: Birthday thread

    Post by Guest July 13th 2017, 3:22 pm

    You're welcomed.
    avatar
    PurpleTears
    Forumember


    Posts : 158
    Reputation : 4
    Language : english

    Solved Re: Birthday thread

    Post by PurpleTears July 13th 2017, 10:09 pm

    ok so are you saying you were or were not able to make this work?
    avatar
    Guest
    Guest


    Solved Re: Birthday thread

    Post by Guest July 14th 2017, 9:04 am

    Hi,

    It works as it should. To test:go to your profile, change the birth date to the date today, than go to the first page of the forum, select the birthday forum and you'll see the post.
    avatar
    PurpleTears
    Forumember


    Posts : 158
    Reputation : 4
    Language : english

    Solved Re: Birthday thread

    Post by PurpleTears July 15th 2017, 12:18 am

    thank you so much it does work
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    Solved Re: Birthday thread

    Post by Draxion July 15th 2017, 12:19 am

    May I mark this as solved?
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51555
    Reputation : 3524
    Language : English
    Location : United States

    Solved Re: Birthday thread

    Post by SLGray July 15th 2017, 2:58 am

    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules



    Birthday thread Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.

      Current date/time is November 14th 2024, 9:41 pm