I thought it would be fun to have a "poster cloud" like the word cloud thing that people sometimes have on their blogs. I want to do a word cloud, too, but the posters were easier to start with. ;)
Put the code below in a phpbox block. It will look at the 100 most recent posts on your forum and tally the number of posts within that 100 for each poster. It then prints out the posters' names in random order with the size of the font dependent on the number of posts for that poster. The fun thing is that the "cloud" will change from day to day or even hour to hour and it will encourage people to post so that they can see their names in the cloud.
I replaced spaces in names with a Ã,· character so that it wouldn't word-wrap in the middle of a username. The +7 is rather arbitrary, but it seemed to me that 8pt font (7 + 1 post) would be just about the smallest size that anyone could be expected to read.
The code:
global $db_prefix;
$count= array();
$query = db_query(
"SELECT posterName
FROM {$db_prefix}messages
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['posterName']]))
$count[$row['posterName']] = 0;
++$count[$row['posterName']];
}
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = $count[$value] + 7;
$name = str_replace(" ",'Ã,·',$value);
echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div>';
The only drawback is that if you have a prolific poster with a really long name, it might distort your blocks.
Dude! that's cool...
Very cool indeed! Thanks for sharing this!
this is really cool
:D thanks
im using it on my page (http://path-to-peace.net) if anyone wants a demo
@ Akulion
I didn't see teh demo. Also you have a parse error on your TOP POSTERS.
It's there. :-D I'm glad to see that someone is getting use of it. I can't really show a demo because this is a shadow of a long-established existing board and I don't want people to get confused if it comes up in a Google search. I used a side block to have a narrower output. It's a little more "cloud-like". But it did occur to me that I could take a screenshot of it. So here it is.
I may have to put that on my site.
oh sorry about that
i was JUST messing with it and i accidentally put an extra ' in the code
just fate that u happend to see it RIGHT then lol
ive fixed it now :D
I would like to exclude the admin and moderators from this block. How do I go about doing that?
Well.... :) That would be a little more involved. It would require a JOIN between the messages and the members tables and a WHERE statement to exclude certain groups. I'll cogitate on it a bit and see what I can come up with.
Quote from: Xarcell on August 04, 2006, 02:21:57 PM
I may have to put that on my site.
I put it in a right block and my name was huge and extended past the block :o How you change the size of the top poster so it's not that big?
Play around with the
$fsize = $count[$value] + 7;
line.
You could set a minimum and maximum. Something like
$fsize = $count[$value];
if ($fsize > 20)
$fsize = 20;
elseif ($fsize < 7)
$fsize = 7;
That is the area you want to experiment with. The code I used worked for my situation, but those with heavier or lighter posting loads would have to make alterations.
JPDeni,
it iz easy enuff to link the names to their profiles? ;)
Linking names to profiles isn't too hard, I don't think. :)
To tell you the truth, I hadn't looked at the code since I posted this, and as I mentioned elsewhere, memory is not my long suit these days, so I'm not exactly sure. But it seems that it shouldn't be too hard to link to profiles without a JOIN, because the ID number for the poster is in the message table.
I'll work on it a while as my hair is drying. :) My husband just called from work and when he gets home he's taking me out to dinner, so I'll only work on this until I need to quit to get ready. I do have my priorities! :2funny: ;)
no hassle, will give it a go myself :)
Got it.
This includes adding a link to the profile, not including admins and moderators and being able to adjust the minimum and maximum font sizes.
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
"SELECT posterName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['posterName']]))
$count[$row['posterName']] = 0;
++$count[$row['posterName']];
$poster_number[$row['posterName']] = $row['ID_MEMBER'];
}
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = $count[$value] + 7;
if ($fsize > 20)
$fsize = 20;
elseif ($fsize < 8)
$fsize = 8;
$name = str_replace(" ",'ÂÃ,·',$value);
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">
<span style="font-size:' . $fsize . 'pt;">' . $name . '</span></a> ';
}
echo '</div>';
Anything else? :)
YOU ROCK!
That was fast JPDeni...
new code fills the error log with Undefined index:
Let me check it and see if I can figure it out. Sorry. :)
Got it. A little problem in the "echo" line.
great thanks. :)
Great block code!
Gonna add this one to my site aswell!
This one still created multiple errors....about 63 pages in 3 hours. I've had to delete the block. Thank you for trying to get the code to work without addint the admin or moderators.
What type of errors?
Array errors; anytime the admin or moderators move about the site. Usually I got through the error log each night and clear them once I've made sure they are just the normal type of errors, but these were created when going to any board, into personal messages, the arcade, even playing a game created 8 errors per play.
I deleted the error log wtihout making note of what exactly the error was but it was very similar to what was posted on your word cloud thread.
Very odd. I don't get any errors at all with the poster cloud. I guess you're right to remove it and if anybody else gets errors, it's best to remove it, too.
I think because the version I was using omitted admin and moderators. Thats where all the odd errors were coming from.
That's the one I'm using right now, and I'm not getting any errors. However, if you want to test it, take out the line
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
Or even go back to the first code in the thread. I'd be interested to know what works.
hey JPDeni, do you think it would be possible to edit this block to display the members website (if the filled it in their profile) instead of their name?
I tried it, but for some reason it's not working properly.
The size of url's (and the url's) are just random it seems.
If you want I can send you the code I already have.
This should print out the name with URL and, if there's no URL, just a plain name. The crux of determining whether there's a URL is that the length is greater than 8, since all URLs start with "http://" and have to have at least two letters.
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
"SELECT posterName, {$db_prefix}messages.ID_MEMBER, ID_GROUP, websiteURL
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['posterName']]))
$count[$row['posterName']] = 0;
++$count[$row['posterName']];
$poster_number[$row['posterName']] = $row['ID_MEMBER'];
$poster_site[$row['posterName']] = $row['websiteURL'];
}
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = $count[$value] + 7;
if ($fsize > 20)
$fsize = 20;
$name = str_replace(" ",'ÂÃ,·',$value);
if (strlen($poster_site[$value])> 8)
{
echo '<a class="normaltext" href="' . $poster_site[$value] . '">
<span style="font-size:' . $fsize . 'pt;">' . $name . '</span></a> ';
}
else
}
echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
}
echo '</div>';
Was not exactly what I was looking for, But now I was able to edit it.
Thanks a lot for the help!
There's all sorts of possible permutations, but after a while you can see what's going on. Good that you were able to edit it yourself.
Well..I posted about 60% of my forum and my name was HUGE. Only half of it showed. :\
Any solutions?
Yeah. I put a solution up a while back.
$fsize = $count[$value] + 7;
if ($fsize > 20)
$fsize = 20;
If it's still too big at 20, then make it 15. Or you could remove yourself from the list altogether.
How could I remove myself? Because I'm using a different user name than my display name for hacking purposes cause I don't want people hacking my account...
Aren't you an admin? If you are either an admin or a moderator and you use one of the codes I posted here, your name -- and the names of any other admins or moderators -- would not be included in the Poster cloud.
Look on page 2 of this topic, a post by me on August 19, that starts with:
QuoteGot it.
This includes adding a link to the profile, not including admins and moderators and being able to adjust the minimum and maximum font sizes.
This?
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
"SELECT posterName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['posterName']]))
$count[$row['posterName']] = 0;
++$count[$row['posterName']];
$poster_number[$row['posterName']] = $row['ID_MEMBER'];
}
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = $count[$value] + 7;
if ($fsize > 20)
$fsize = 20;
elseif ($fsize < 8)
$fsize = 8;
$name = str_replace(" ",'ÂÃ,·',$value);
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">
<span style="font-size:' . $fsize . 'pt;">' . $name . '</span></a> ';
}
echo '</div>';
It worked fine on my site but I disabled it due to the fact that it showed the user name and not the display name. I encourage my members to have a user name that is different from the display name for security reasons.
Could that be fixed?
PS, but not by me, I don't code. ;)
Jpg, yes. Try it. Nothing that goes into a block can break your machine. The worst thing that can happen is that you have to go into the database and delete it and that would be very rare. Give it a try. See what happens. Be bold!! ;D
Marian, anything that is in the database can be displayed in any way you want it. :)
Actually, the code that Jpg just posted shows the display name. It shows whatever is displayed next to the posts because the name is taken from the record of the post, not from the member.
Whoa seriously Jpdeni? Cool I'm adding it after I get another block for the other side. So my forum is evenly matched. ;)
PS:And Marian did you know the user name can be simply cracked by going to the profile and looking at the top header.
Summary - [Username]
Luckily that's only for 1.07 and lower... :)
The only thing that could possibly hurt your database would be something that included "INSERT", "DELETE" or "UPDATE" in the database query. Even then, you'd be able to get it back if your system did regular backups.
I have the advantage of working on a site that isn't "live" at all. I'm still using Invision Board for my community until I get everything all spiffy and can reveal it all to the group at once.
what code uses their actual "display name" Mine shows their login name. I am using the code from a couple posts up.
top right block here:
http://www.the-rota.com
I'm making an assumption, which may not be warranted. I'm testing it now. Since my database was imported, there is no difference between real names and poster names. So I've changed my poster name and added a post. Now I'll go look at my database.
Things are a little slow on my server at present. Just talk among yourselves for a moment. ;) [humming the tune from Jeopardy]
Ah-ha! I made an unwarranted assumption. My apologies. Back to the drawing board. :)
Sorry, but the code posted by JPG still shows the user/log in name and I really don't want anyone to know the administration user log-in.
So I will disabled it again. I don't mess with my databases, I don't know what I am doing so I leave it alone. I ask for help and will pay for it when it becomes really necessary to adjust things there.
Okay. I got it. It is confusing when the names are labeled the way they are. I would think that "realName" would be the name people log in with. Live 'n' learn.
This code counts the number of times each poster has added a post within the last 100 posts, excluding those made by admins and global moderators. It prints out the display name of the poster in relative size, depending on how many of those 100 posts the member contributed, with a minimum size of 8pt and a maximum of 20. Those numbers can be changed if you have a very narrow side block. Each name prints out a link to the poster's profile.
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
"SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['realName']]))
$count[$row['realName']] = 0;
++$count[$row['realName']];
$poster_number[$row['realName']] = $row['ID_MEMBER'];
}
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = $count[$value] + 7;
if ($fsize > 20)
$fsize = 20;
elseif ($fsize < 8)
$fsize = 8;
$name = str_replace(" ",'ÂÃ,·',$value);
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">
<span style="font-size:' . $fsize . 'pt;">' . $name . '</span></a> ';
}
echo '</div>';
Marian, you just needed to be a little more patient. This prints out the display name.
;) Sorry, did I sound impatient? Didn't intend too. So, I'll try this. Thanks, you're a sweetie.
:up: :) Yay, That worked.
Cool! I just made an assumption that the name with the post would be the name displayed on the post. That's what I get for making assumptions.
I'm glad it worked for you. :)
Ok. Thanx for the update!
JPDeni have a small idea..
The person with the biggest name gets a different colour from the rest,
would make um stand out more :)
Sure. That would be fine. You'd have to do a sort just before the line
$random = array_rand($count, count($count));
in order to determine who the most prolific poster was.
Or if you had different colors for different groups, you could do that, too.
Its Great :up:
how can i make it so that it only shows the active posters of just that day?
Limiting to the posts within the past 24 hours would probably be more effective than to the current calendar day, especially if you have posters from different time zones.
Change the beginning of the code from
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
"SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
to
Quoteglobal $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$today = time() - (24 * 60 * 60);
$query = db_query(
"SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
AND posterTime > '$today'
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
This is what i have so far, and i made another topic to test it, but nothing showed up on Block.
This is what i have so far,
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$today = time() - (24 * 60 * 60);
$query = db_query(
"SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
AND posterTime > '$today'
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['posterName']]))
$count[$row['posterName']] = 0;
++$count[$row['posterName']];
$poster_number[$row['posterName']] = $row['ID_MEMBER'];
}
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = $count[$value] + 7;
if ($fsize > 15)
$fsize = 15;
elseif ($fsize < 5)
$fsize = 5;
$name = str_replace(" ",'ÂÃ,·',$value);
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">
<span style="font-size:' . $fsize . 'pt;">' . $name . '</span></a> ';
}
echo '</div>';
Are there any posts made by anyone other than an admin or moderator? The code excludes admins and global moderators (because someone else asked for that).
Instead of
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
AND posterTime > '$today'
try
WHERE posterTime > '$today'
oh...im a admin, haha, how do i make it show for everybody? and maybe the peoples names like not all over the place but side by side each other or something.
Quotehow do i make it show for everybody?
Put in the most recent change I posted.
Quoteand maybe the peoples names like not all over the place but side by side each other or something.
You're sort of getting away from the point of the cloud. :)
What do you want, exactly? Give me an example and I'll see if I can get you what you want.
ok i posted again and its not showing anything in it, this is waht i have.
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$today = time() - (24 * 60 * 60);
$query = db_query(
"SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE posterTime > '$today'
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['posterName']]))
$count[$row['posterName']] = 0;
++$count[$row['posterName']];
$poster_number[$row['posterName']] = $row['ID_MEMBER'];
}
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = $count[$value] + 7;
if ($fsize > 15)
$fsize = 15;
elseif ($fsize < 5)
$fsize = 5;
$name = str_replace(" ",'ÂÃ,·',$value);
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">
<span style="font-size:' . $fsize . 'pt;">' . $name . '</span></a> ';
}
echo '</div>';
and for the other thing...
[name] | [name]
[name] | [name]
[name] | [name]
etc...
I've had so many alterations of this script, based on individual requests, that I don't know what it's doing any more. :)
I'll see if I can work it out tomorrow. My brain isn't working tonight.
ok, i noticed this is going off the topic of poster cloud, so i made a new topic. called Active Posters.
hi jp
in this post:
http://www.tinyportal.net/smf/index.php?topic=6996.msg61853#msg61853
the code u gave made everyone elses names REALLY small lol
so i changed it to this
$fsize = $count[$value];
if ($fsize > 28)
$fsize = 28;
elseif ($fsize < 28)
$fsize = $count[$value] + 7;
it seems to work fine for now but I just wanted your input on 'long term ramifications' of this? would it effect anything ?
Go with what works. You can always change it.
I had intended it to be on a side block, so names that are too large will really mess up the balance of your site. You have yours in a center block, so it's not that much of a problem.
This is a nice script.. is there anyway to make it show the colors of the membergroups ?
Probably, but I don't have different colors for my membergroups, so there's no way for me to test it. And I guess I had too much turkey yesterday because I can't seem to write anything this morning that works. :)
Okay. I think this works. At least I don't get any errors.
global $db_prefix, $scripturl;
$nbsp = "&n"."bsp;";
$count= array();
$poster_number = array();
$query = db_query(
"SELECT mes.posterName, mes.ID_MEMBER, mem.ID_GROUP, grp.onlineColor
FROM smf_messages as mes
LEFT JOIN smf_members as mem
ON mem.ID_MEMBER = mes.ID_MEMBER
LEFT JOIN smf_membergroups as grp
ON grp.ID_GROUP = mem.ID_GROUP
WHERE mem.ID_GROUP <> 1 AND mem.ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['posterName']]))
$count[$row['posterName']] = 0;
++$count[$row['posterName']];
$poster_number[$row['posterName']] = $row['ID_MEMBER'];
$poster_color[$row['posterName']] = $row['onlineColor'];
}
asort($count);
$low_count = reset($count);
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = intval($count[$value]/$low_count) + 7;
if ($fsize > 20)
$fsize = 20;
elseif ($fsize < 8)
$fsize = 8;
$name = str_replace(" ",$nbsp,$value);
if (!empty($poster_color[$value]))
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] .
'" style="font-size:' . $fsize . 'pt; color:' . $poster_color[$value] . '">ÂÃ,·' . $name . 'ÂÃ,·</a> ';
else
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] .
'" style="font-size:' . $fsize . 'pt;">ÂÃ,·' . $name . 'ÂÃ,·</a> ';
}
echo '</div>';
It worked .. thanks.. but it dont show the colors of post-count-based-groups for some reason.. any way to fix that ? :)
BTW i envy you on all that turkey you ate.. we dont have that tradition here in Denmark ::)
Quoteit dont show the colors of post-count-based-groups for some reason
That's because you didn't ask for it. :)
change
ON grp.ID_GROUP = mem.ID_GROUP
to
ON grp.ID_GROUP = mem.ID_POST_GROUP
QuoteBTW i envy you on all that turkey you ate.. we dont have that tradition here in Denmark
But you have turkey, right? You can still eat it, even if you don't have the tradition. :)
That little change made all the names disappear :o
Yes we have Turkey but its not something that we normaly eat.. But sometimes my parrents makes it for christmas.. so i know that it taste real good.. ::)
Then I guess you should put it back the way it was. :-)
I'll work with it a bit and see if I can figure out how to do what you want.
Edited to add--
It works within the database just fine. But I can't test it any further because I don't use colors for member groups.
No problemo.. it looks great still.. thanks for helping me out ;)
thanks JP - i just wanted to check with the expert before I end up sending the script into some recursive loop which could cause the page to go down
u never know lol i've done it once before with fopen urls :2funny:
Quote from: JPDeni on August 04, 2006, 05:51:23 AM
I replaced spaces in names with a ÂÃ,· character so that it wouldn't word-wrap in the middle of a username. The +7 is rather arbitrary, but it seemed to me that 8pt font (7 + 1 post) would be just about the smallest size that anyone could be expected to read.
The only drawback is that if you have a prolific poster with a really long name, it might distort your blocks.
I am just trying this out now and there seems to be a lot of members with spaces in their names so it looks horrible with big  all over the cloud.
(I looked at your site and it looks really nice on there)
Anyway to get rid of it?
Also I don't show in the cloud, is that because I'm Admin?
And we only have 8 members showing up in the cloud, and two font sizes - small and huge - is that because we only have 8 members that have posted in the last x number of posts?
My blocks are only 160px wide, is there a way to make the largest font smaller so they dont run over the edge of the blocks?
Sorry, didnt realise I had so many questions
the code I'm using from this thread is:
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
"SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['realName']]))
$count[$row['realName']] = 0;
++$count[$row['realName']];
$poster_number[$row['realName']] = $row['ID_MEMBER'];
}
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = $count[$value] + 7;
if ($fsize > 20)
$fsize = 20;
elseif ($fsize < 8)
$fsize = 8;
$name = str_replace(" ",'ÂÃ,·',$value);
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">
<span style="font-size:' . $fsize . 'pt;">' . $name . '</span></a> ';
}
echo '</div>';
QuoteI am just trying this out now and there seems to be a lot of members with spaces in their names so it looks horrible with big  all over the cloud.
I'm not sure what the  is from. What I use is a Ã,· but you can use anything. You can use a non-breaking space if you want. I'll go see if I can find that  in the original code and get rid of it. It shouldn't exist at all.
QuoteAlso I don't show in the cloud, is that because I'm Admin?
That's how I set it up, yes. It's easy to change.
QuoteAnd we only have 8 members showing up in the cloud, and two font sizes - small and huge - is that because we only have 8 members that have posted in the last x number of posts?
Yes, probably. This is designed for a more active site. But you should be able to adjust the font sizes to make things look better.
QuoteMy blocks are only 160px wide, is there a way to make the largest font smaller so they dont run over the edge of the blocks?
Certainly. There are lots of ways to alter it.
Okay... to change things.
If you want admins and global moderators to show up in the cloud, delete the line
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
If you want to get rid of that  thing (still don't know why that exists), change
$name = str_replace(" ",'ÂÃ,·',$value);
to
$name = str_replace(" ",'Ã,·',$value);
If you want to make the largest font smaller, play around with
if ($fsize > 20)
$fsize = 20;
Change the
20 -- in both places -- to whatever you want. That is the determiner of the largest font.
Similarly, if you should want to change the smallest font, play around with the
8 in
elseif ($fsize < 8)
$fsize = 8;
thanks, that works brilliantly :)
I really wanted to control that overflow thing...
This seems to have worked for me.
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
"SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['realName']]))
$count[$row['realName']] = 0;
++$count[$row['realName']];
$poster_number[$row['realName']] = $row['ID_MEMBER'];
}
$random = array_rand($count, count($count));
echo '<div style="width: 160px; text-align: center; overflow: hidden;">';
foreach ($random as $value)
{
$fsize = $count[$value] + 7;
if ($fsize > 20)
$fsize = 20;
elseif ($fsize < 6)
$fsize = 6;
$name = str_replace(" ",' ',$value);
echo '<a style="font-size:' . $fsize . 'pt;" class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">' . $name . '</a> ';
}
echo '</div>';
You can delete the line
$name = str_replace(" ",' ',$value);
The purpose of that line is to replace spaces with something so that the usernames won't break in the middle. The downside of it is that sometimes a long name will have a large font and it'll stretch the block, especially if your blocks are narrow.
Ah, That makes more sense now. I see why it is working for me then. However with the overflow set those long names will just clip instead of going outside the block. So it's a compromise. Which is fine by me. I kind of like the chaos of the cloud with the names split up though.
Quote from: m771401 on March 01, 2007, 03:24:23 PM
I really wanted to control that overflow thing...
This seems to have worked for me.
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
"SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['realName']]))
$count[$row['realName']] = 0;
++$count[$row['realName']];
$poster_number[$row['realName']] = $row['ID_MEMBER'];
}
$random = array_rand($count, count($count));
echo '<div style="width: 160px; text-align: center; overflow: hidden;">';
foreach ($random as $value)
{
$fsize = $count[$value] + 7;
if ($fsize > 20)
$fsize = 20;
elseif ($fsize < 6)
$fsize = 6;
$name = str_replace(" ",' ',$value);
echo '<a style="font-size:' . $fsize . 'pt;" class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">' . $name . '</a> ';
}
echo '</div>';
how would I exclude Admins/Mods from the above code... tried adding WHERE ID_GROUP <> 1 AND ID_GROUP <> 2, but that crashed it. Any ideas?
Awesome mod, btw... really a good motivator for users to get involved.
That's the code that you need to add. The only question is where you added it.
$query = db_query(
"SELECT posterName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
I know this works, because I copied the above from the block I have on my site.
Thanks for the nice words. I didn't expect that it would be that much of a motivator, but I've had several people say that they felt they had to post after they saw that they were off the cloud. People like to see their names.
Vdubbia, I just tested this and it works fine.
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
"SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['realName']]))
$count[$row['realName']] = 0;
++$count[$row['realName']];
$poster_number[$row['realName']] = $row['ID_MEMBER'];
}
$random = array_rand($count, count($count));
echo '<div style="width: 160px; text-align: center; overflow: hidden;">';
foreach ($random as $value)
{
$fsize = $count[$value] + 7;
if ($fsize > 20)
$fsize = 20;
elseif ($fsize < 6)
$fsize = 6;
$name = str_replace(" ",' ',$value);
echo '<a style="font-size:' . $fsize . 'pt;" class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">' . $name . '</a> ';
}
echo '</div>';
also, I changed the width to 100% and it works great as a top center block.
how easy would it be to change the color of the font displayed in this block only?
Quotehow easy would it be to change the color of the font displayed in this block only?
Pretty easy.
echo '<div style="text-align: center; color: purple">';
Or whatever color you want to use. You can put any css attribute in there that you want and it will apply only to the text in the block.
Okay, now what if I wanted it to show each user's started posts instead of their profile when clicked?
This might work.
echo '<a style="font-size:' . $fsize . 'pt;" class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . ';sa=showPosts">' . $name . '</a> ';
If not, I don't know.
Quote from: JPDeni on March 13, 2007, 11:49:36 PM
This might work.
echo '<a style="font-size:' . $fsize . 'pt;" class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . ';sa=showPosts">' . $name . '</a> ';
If not, I don't know.
that worked!
thanks!
Quote from: JPDeni on August 19, 2006, 09:58:45 PM
Got it.
This includes adding a link to the profile, not including admins and moderators and being able to adjust the minimum and maximum font sizes.
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
"SELECT posterName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['posterName']]))
$count[$row['posterName']] = 0;
++$count[$row['posterName']];
$poster_number[$row['posterName']] = $row['ID_MEMBER'];
}
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = $count[$value] + 7;
if ($fsize > 20)
$fsize = 20;
elseif ($fsize < 8)
$fsize = 8;
$name = str_replace(" ",'ÂÃ,·',$value);
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">
<span style="font-size:' . $fsize . 'pt;">' . $name . '</span></a> ';
}
echo '</div>';
Anything else? :)
How do I keep staff (including admins) from showing up in this one ?
It's already there.
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
This eliminates admins and global moderators.
Quote from: JPDeni on April 15, 2008, 02:35:19 AM
It's already there.
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
This eliminates admins and global moderators.
All 3 of my global mods are still showing up with this one as well as the 2 admins whos id's are 1 (mine)and 2. (see image below)
What about other staff members? (I have 14 other individual staff membergroups - including 2 administrative ones). Is there a line I need to add for each ones member number?
Are your admins, mods, staff, whatever in more than one group?
Everyone is in their own group (with the exception of 3 of my gmods - who are all in that same group). I have several different staff types/positions on my site all of which require different permissons - I just set up the new group and set that groups permissions accordingly. I have to do it that way because not all of them are granted the same permissions, and they all need the seperate group for their various staff titles. Some have more than one title so I chose to set it up that way so both titles would appear for each one instead of only having their primary group appear.
Well, the thing is that in order to eliminate them from the script, you have to know what group they're in. The basic admin and global moderator groups are groups 1 and 2, which is why I used those numbers when I didn't want admins and global moderators to be included. And most people only have one group per person.
In order to give me something to work with, what are the numbers for the groups that you want to eliminate? Are these all the primary groups, or are some of them "additional" groups?
I pretty much decided for now to just let it show the staff groups its showing (its no big deal for now), however I have two quick questions regarding the code you posted that shows the names in their group color
1. How do I get rid of all that AA stuff (as seen in the image I attached,
2. When I change the code to make it so where it shows the colors for all membergroups not just staff, my portal wont even load. (when it finally finishes trying to load.. its a big white page and my status bar says done)
Any ideas?
This was my code when I tried to adjust it so that all group colors would show:
global $db_prefix, $scripturl;
$nbsp = "&n"."bsp;";
$count= array();
$poster_number = array();
$query = db_query(
"SELECT mes.posterName, mes.ID_MEMBER, mem.ID_GROUP, grp.onlineColor
FROM smf_messages as mes
LEFT JOIN smf_members as mem
ON mem.ID_MEMBER = mes.ID_MEMBER
LEFT JOIN smf_membergroups as grp
ON grp.ID_GROUP = mem.ID_POST_GROUP
WHERE mem.ID_GROUP <> 1 AND mem.ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['posterName']]))
$count[$row['posterName']] = 0;
++$count[$row['posterName']];
$poster_number[$row['posterName']] = $row['ID_MEMBER'];
$poster_color[$row['posterName']] = $row['onlineColor'];
}
asort($count);
$low_count = reset($count);
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = intval($count[$value]/$low_count) + 7;
if ($fsize > 20)
$fsize = 20;
elseif ($fsize < 8)
$fsize = 8;
$name = str_replace(" ",$nbsp,$value);
if (!empty($poster_color[$value]))
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] .
'" style="font-size:' . $fsize . 'pt; color:' . $poster_color[$value] . '">ÂÃ,·' . $name . 'ÂÃ,·</a> ';
else
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] .
'" style="font-size:' . $fsize . 'pt;">ÂÃ,·' . $name . 'ÂÃ,·</a> ';
}
echo '</div>';
QuoteI pretty much decided for now to just let it show the staff groups its showing (its no big deal for now),
I can fix it if you'll answer my questions.
1) I don't know what all the "AA" stuff is from, so I don't know how to get rid of it.
2) I use a little different syntax in my queries and it might make things work better.
$query = db_query(
"SELECT mes.posterName, mes.ID_MEMBER, mem.ID_GROUP, grp.onlineColor
FROM smf_messages as mes, smf_members as mem, smf_membergroups as grp
WHERE mem.ID_MEMBER = mes.ID_MEMBER
AND grp.ID_GROUP = mem.ID_POST_GROUP
AND mem.ID_GROUP <> 1 AND mem.ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
That sort of thing has worked for me.
I will say that I had to shut down this on my site because it used too many resources.
My site is in the middle of a revamp so I am holding off on the staff groups thing untiul I figure out who will actually still be there. I will let you know when I need help on that again :)
As for the AA stuff,, that is stemming originally from the code you posted here:
http://www.tinyportal.net/index.php?topic=6996.10 (I think..lol - its got the same code for the AA in it anyways.. heck ive used so many of the codes in this topic i have no idea anymore..lol)
Basically what I woild like is the code to have the "link to the profile" feature and I would like the names to also show up in the group colors (for both staff and reg members). :)
This is the code that I have on my site now. I just checked it and it's working fine with no odd letters:
global $db_prefix, $scripturl;
$nbsp = "&n"."bsp;";
$count= array();
$poster_number = array();
$query = db_query(
"SELECT posterName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['posterName']]))
$count[$row['posterName']] = 0;
++$count[$row['posterName']];
$poster_number[$row['posterName']] = $row['ID_MEMBER'];
}
asort($count);
$low_count = reset($count);
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = intval($count[$value]/$low_count) + 7;
if ($fsize > 15)
$fsize = 15;
elseif ($fsize < 8)
$fsize = 8;
$name = str_replace(" ",$nbsp,$value);
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '" style="font-size:' . $fsize . 'pt;">·' . $name . '·</a> ';
}
echo '</div>';
ok the odd letters was stemming from this part of the code but its not in the one you just posted so I will try it.
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] .
'" style="font-size:' . $fsize . 'pt; color:' . $poster_color[$value] . '">ÂÃ,·' . $name . 'ÂÃ,·</a> ';
else
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] .
'" style="font-size:' . $fsize . 'pt;">ÂÃ,·' . $name . 'ÂÃ,·</a> ';
}
The one you posted works good, but it does not show the names in the group colors. What code would i need to add for that?
Thanks for the help :)
The problem with the code came from when the TP forum got moved. That happened in a lot of them. I forgot about that until just now.
Oh, yeah. Colors. I won't be able to test this, because I don't have different colors on my site. It does run without errors, though.
global $db_prefix, $scripturl;
$defaultcolor = "#000000";
$nbsp = "&n"."bsp;";
$count= array();
$poster_number = array();
$query = db_query(
"SELECT posterName, {$db_prefix}messages.ID_MEMBER, {$db_prefix}members.ID_GROUP
FROM {$db_prefix}members
JOIN {$db_prefix}messages
ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
LEFT JOIN {$db_prefix}membergroups
ON {$db_prefix}members.ID_GROUP = {$db_prefix}membergroups.ID_GROUP
WHERE {$db_prefix}members.ID_GROUP <> 1 AND {$db_prefix}members.ID_GROUP <> 2
ORDER BY posterTime DESC
LIMIT 100", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if (!isset($count[$row['posterName']]))
$count[$row['posterName']] = 0;
++$count[$row['posterName']];
$poster_number[$row['posterName']] = $row['ID_MEMBER'];
if (isset($row['onlineColor']))
$color[$row['posterName']] = $row['onlineColor'];
else
$color[$row['posterName']] = $defaultcolor;
}
asort($count);
$low_count = reset($count);
$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
$fsize = intval($count[$value]/$low_count) + 7;
if ($fsize > 15)
$fsize = 15;
elseif ($fsize < 8)
$fsize = 8;
$name = str_replace(" ",$nbsp,$value);
echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '" style="font-size:' . $fsize . 'pt; color: ' . $color[$value] . ';">·' . $name . '·</a> ';
}
echo '</div>';