The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Announcement

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

View previous topic View next topic Go down

Solved Announcement

Post by PurpleTears on July 15th 2017, 5:54 am

I had someone here go into my forum and make a birthday go into a thread after this now my announcements do not work can someone help please?
http://2girlsgraphics.forumotion.com/

PurpleTears
Forumember

Posts : 133
Reputation : 2
Language : english

Back to top Go down

Solved Re: Announcement

Post by Justice™ on July 15th 2017, 7:13 am

Hi,

By announcements you mean the Happy Birthday threads, right? If so, the problem should be solved now.
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Announcement

Post by PurpleTears on July 15th 2017, 5:30 pm

no i meant announcement at the top of the page but its working again thanks this can be closed

PurpleTears
Forumember

Posts : 133
Reputation : 2
Language : english

Back to top Go down

Solved Re: Announcement

Post by Draxion on July 15th 2017, 5:31 pm

@Wolfuryo, did you solved this by changing the original code you presented on the 'Birthday Thread'?


NEVER provide your founder's account or email
Please provide forum's URL when dealing with design and appearance issues
Don't forget to mark the topic as when the issue is resolved. This helps the staff greatly.
PM Support is prohibited!
TOS | General Rules | FAQ | Tricks & Tips | Latest Updates | Introduce Yourself

avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 1813
Reputation : 227
Language : English
Location : USA

http://www.draxionsgameden.com/

Back to top Go down

Solved Re: Announcement

Post by Justice™ on July 15th 2017, 5:52 pm

@Draxion, I changed the code on @PurpleTears' forum.
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Announcement

Post by Draxion on July 15th 2017, 5:53 pm

is there a way you can post the code here so others could know if they used the same one you used on the "Birthday Thread"? That way they can use if they faced the same issue.


NEVER provide your founder's account or email
Please provide forum's URL when dealing with design and appearance issues
Don't forget to mark the topic as when the issue is resolved. This helps the staff greatly.
PM Support is prohibited!
TOS | General Rules | FAQ | Tricks & Tips | Latest Updates | Introduce Yourself

avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 1813
Reputation : 227
Language : English
Location : USA

http://www.draxionsgameden.com/

Back to top Go down

Solved Re: Announcement

Post by Justice™ on July 15th 2017, 6:09 pm

The only forum that can use that code is @PurpleTears' forum.
Reason:The code is created to only work for one forum. Otherwise, there would be a ton of bugs and the code would stop working.

Anyway, if anyone wants to edit the code(and knows how to do it Very Happy) and use it on his/her forum:
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(/<a href=".+">.+<\/a>|<strong>.+<\/strong>/),
                len = ar.length;
            if (len != 0) {
                for (var i = 0; i < len; i++) {
                    ar[i] = ar[i].replace(/<strong>|<\/strong>|<a href=".+">|<\/a>/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;
    };
});
To make it work, you have to change the selectors(if you use phpBB2 without any template edited, there's no need for edits) and the link http://virus-design.esy.es/2girlsgraphics.php/ with the link to a server where you are hosting the php file. You might also have to change the regular expressions a bit.

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);
};
?>
You have to change http://2girlsgraphics.forumotion.com to the link of your forum and db.txt with the name of an empty .txt file. Both the PHP and the txt file have to be hosted on a server. If you don't have one, send me a PM and I can host it for you.

If anyone wants to use this and doesn't manage to make it work, you can open up a topic on this forum and I'll help you with it.
avatar
Justice™
Forumember

Posts : 517
Reputation : 119
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Announcement

Post by Draxion on July 15th 2017, 6:10 pm

Thank you very much for posting the solution.
Problem solved & topic archived.
Please read our forum rules: ESF General Rules


NEVER provide your founder's account or email
Please provide forum's URL when dealing with design and appearance issues
Don't forget to mark the topic as when the issue is resolved. This helps the staff greatly.
PM Support is prohibited!
TOS | General Rules | FAQ | Tricks & Tips | Latest Updates | Introduce Yourself

avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 1813
Reputation : 227
Language : English
Location : USA

http://www.draxionsgameden.com/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum