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.

Change Text In "Who's Online"

View previous topic View next topic Go down

Solved Change Text In "Who's Online"

Post by Empire_1 on Sun 17 Jul - 11:43

Hello, I want to change the text in "Who's Online." I mean it like I want to change "Members connected during the last 48 hours:" to something else, say, for example, "Cats padded in recently:" or something similar to that. I know this can be done somehow as Simple Machines allows their users to do this.

Here's an example of a site that has this feature: http://warriorcatsrpg.com/

If you scroll all the way down to "Warrior Cats RPG - Info Centre" table, you can see they've defined different words/phrases for "Members", "Topics", etc. I wish to do this with my forum (which is phpBB3 by the way).

Thanks!!


Last edited by The Divine Clutch on Sun 17 Jul - 15:24; edited 1 time in total

Empire_1
Active Poster

Male Posts : 1391
Reputation : 124
Language : English, Spanish, Mandarin, C++
Location : Summoner's Rift

Back to top Go down

Solved Re: Change Text In "Who's Online"

Post by Uknown-Data on Sun 17 Jul - 12:48

Like this?
Code:
function replacetext() {
document.body.innerHTML = document.body.innerHTML.replace(/Members connected during last 48 hours :/g,"Cats padded in recently:");
}

window.onload=replacetext;
... Will replace every sentence named "Members connected during last 48 hours :" with "Cats padded in recently:" in the body area.

Uknown-Data
Forumember

Male Posts : 66
Reputation : 0
Language : HTML/CSS/JS

Back to top Go down

Solved Re: Change Text In "Who's Online"

Post by Guest on Sun 17 Jul - 14:24

Since that sentence is only in one location, it's best to limit the search to that location, as follows:

Code:
<script type="text/javascript">
jQuery(function() {
var x=document.getElementById('i_whosonline').nextSibling;
x.innerHTML = x.innerHTML.replace(/Members connected during last 48 hours :/g,"Cats padded in recently:");
});
</script>
Since the stats are only on the homepage, I would add this code to the homepage message.

Guest
Guest


Back to top Go down

Solved Re: Change Text In "Who's Online"

Post by Empire_1 on Sun 17 Jul - 14:31

@Uknown-Data wrote:Like this?
Code:
function replacetext() {
document.body.innerHTML = document.body.innerHTML.replace(/Members connected during last 48 hours :/g,"Cats padded in recently:");
}

window.onload=replacetext;
... Will replace every sentence named "Members connected during last 48 hours :" with "Cats padded in recently:" in the body area.

It didn't seem to work...

What do you mean by body area?

Anyway I want to make mine (screenshot below)


have the text like this one below:



Empire_1
Active Poster

Male Posts : 1391
Reputation : 124
Language : English, Spanish, Mandarin, C++
Location : Summoner's Rift

Back to top Go down

Solved Re: Change Text In "Who's Online"

Post by boffer10 on Sun 17 Jul - 15:21

I couldn't get either one to work either, and would like to learn how.Nevermind bwi


Last edited by boffer10 on Sun 17 Jul - 15:36; edited 1 time in total

boffer10
Forumember

Male Posts : 311
Reputation : 10
Language : english
Location : Go Seahawks!

http://squarefoot.creatingforum.com/

Back to top Go down

Solved Re: Change Text In "Who's Online"

Post by Empire_1 on Sun 17 Jul - 15:22

@dion wrote:Since that sentence is only in one location, it's best to limit the search to that location, as follows:

Code:
<script type="text/javascript">
jQuery(function() {
var x=document.getElementById('i_whosonline').nextSibling;
x.innerHTML = x.innerHTML.replace(/Members connected during last 48 hours :/g,"Cats padded in recently:");
});
</script>
Since the stats are only on the homepage, I would add this code to the homepage message.

It works!! Thank you so much! I really appreciate it! :wouhou:

*solved!*

Empire_1
Active Poster

Male Posts : 1391
Reputation : 124
Language : English, Spanish, Mandarin, C++
Location : Summoner's Rift

Back to top Go down

Solved Re: Change Text In "Who's Online"

Post by Uknown-Data on Sun 17 Jul - 15:31

Dion: nice Smile I first tried to dot it getElementById, but couldn't find one propper, and haven't even thought about nextSibling.. Must admit that you are the genius at this (though it wasen't that complicated again xD).

The Divine Cluth: wierd, worked on my forum? Nevermind though Smile

Uknown-Data
Forumember

Male Posts : 66
Reputation : 0
Language : HTML/CSS/JS

Back to top Go down

Solved Re: Change Text In "Who's Online"

Post by Empire_1 on Sun 17 Jul - 15:41

@Uknown-Data wrote:Dion: nice Smile I first tried to dot it getElementById, but couldn't find one propper, and haven't even thought about nextSibling.. Must admit that you are the genius at this (though it wasen't that complicated again xD).

The Divine Cluth: wierd, worked on my forum? Nevermind though Smile

Hey, but thanks so much for helping me! It's great to see so many helpful people! And yours does work, I just had to put it in the homepage message and not the CSS Stylesheet. Dion's code doesn't work in the Stylesheet either. Thanks again!! ^.^

*topic solved! :wouhou: *

Empire_1
Active Poster

Male Posts : 1391
Reputation : 124
Language : English, Spanish, Mandarin, C++
Location : Summoner's Rift

Back to top Go down

Solved Re: Change Text In "Who's Online"

Post by Guest on Sun 17 Jul - 16:15

Before the "lock-em-up" crew swoops in, here's one last tip.

You don't need to create different scripts for each replacement operation. Just add another replace line to the bottom of the first script, like this:

Code:
var x=document.getElementById('i_whosonline').nextSibling;
x.innerHTML = x.innerHTML.replace(/Members connected during last 48 hours :/g,"Cats padded in recently:");
x.innerHTML = x.innerHTML.replace(/users/g,"Cats");
And finally...for future reference, scripts don't go into the CSS. Very Happy

Guest
Guest


Back to top Go down

Solved Re: Change Text In "Who's Online"

Post by Jophy on Sun 17 Jul - 17:40

Since this thread has been marked as 'Solved', I will now lock this thread.

~ Joph25

Jophy
ForumGuru

Male Posts : 17924
Reputation : 835
Language : English
Location : Somewhere

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