MyBB Community Forums

Full Version: My modification for snowstorm plugin.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In view of the upcoming holidays I thought to upload the snow on my forum. I realize that
some may not like this idea so I wrote a script that checks whether a given View Member Profile
group, "Snow." If it appears the snow. I do not know where I insert my script. And imparted to like
retrieve the name of the currently logged on user. I put the following script:
<?php
$sql = mysql_connect ("localhost","----","---")
or die ("Nie można się połączyć");
$db= mysql_select_db("-----", $sql)
or die ("Nie można wybrać bazy danych");

$nr=12;
// $mybb->user['username']; <---- z tego co wyczytałem ale to chyba w js jest
$z = mysql_query("SELECT `mybb_users`.`additionalgroups` FROM mybb_users WHERE (`mybb_users`.`username` ='kreteda') LIMIT 1");
while($row=mysql_fetch_array($z))
{
$pieces = explode(",", $row['additionalgroups']);
/// wiem, że mozna pętlą ale nie miałem czasu na sprawdzenie poprawności. 
if($pieces[0]==$nr || $pieces[1]==$nr || $pieces[2]==$nr || $pieces[3]==$nr || $pieces[4]==$nr || $pieces[5]==$nr || $pieces[6]==$nr || $pieces[7]==$nr || $pieces[8]==$nr || $pieces[9]==$nr || $pieces[10]==$nr || $pieces[11]==$nr)
{
echo "<script src='/jscripts/snowstorm.js'></script>";
}}
mysql_close($sql);
?>
You could just include global.php, then use:

Global $mybb;
If ($mybb->user['usergroup'] == GIDofSnowGroup
{
//display snow
}

Then you need to load that Smile
(2010-12-13, 07:27 AM)Tom K. Wrote: [ -> ]Global $mybb;
If ($mybb->user['usergroup'] == GIDofSnowGroup
{
//display snow
}

that's incorrect code. Proper code would be like this;

if ($mybb->user['usergroup'] == GIDSnowGroup)
{
// display snow
}

You forget to add ")" after GIDSnowGroup Toungue
Oops, it's gar to write PHP on an iPhone XD