TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 728
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 589
  • Total: 589

Looking for Birthday Code

Started by qwe3, March 17, 2006, 05:59:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DawnsWebDesigns


Torill

I know my question might be very stupid, but I have to ask (the code is great and works very nice, Thank you for sharing) Is it possible to center the date and names on page?

I am all new to php coding and it is really something I struggle to understand and I guess I never will be able to  :-\

However if possible what do I do :-)

I did mange to put in the code for image and I was able to center that but I can't find out if it's possible to center the names and date as well :-)

Thank you for reading

JPDeni

Do you want to center the table on the page or do you want to center each individual name and date? And, just to be sure, are you referring to the code that lists all the birthdays in the month or the one that says "Happy birthday" on the member's birthday. There's two different types of code in this topic. :)

Torill

Oh my.

I think I want to center the names?

Look here http://www.ccsnakk.com/treffstedet/

I have put the code in an article , yes?
And also an image and text saying happy Birthday (in Norwegian, ;D)

And then I wanted to center the names under there. I think.........not sure what's the best,since the image and "my text" are centered

Not sure sorry, but I guess you might understand when you see?
Hopefully.

Thank you for reply


JPDeni

Well, actually, it was more designed for a side block. You can see it on my site. You're going to end up with a list that's a lot narrower than your image. You might be better off having them all in one line, rather than the table or each person's name on a separate line.

Instead of
  asort($birthdays);
  echo '<table>';
  $yesterday = 0;
  foreach ($birthdays as $key => $value)
  {
    if ($value <> $yesterday)
    {
      if ($yesterday > 0)
        echo '</td></tr>';
      echo '<tr valign="top"><td>' , $value , '</td><td>';
    }
    echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $member[$key] . '">' . $key . '</a><br />';
    $yesterday = $value;
  }
  echo '</td></tr></table>';

You could use

  asort($birthdays);
  echo '<div style="text-align:center;">';
  foreach ($birthdays as $key => $value)
  {
    echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $member[$key] . '">' . $key . '</a>&nbsp;(',$value,')';
  }
  echo '</div>';


I think that would probably look a little better, with your wide graphic.

Torill

Thank you :-)

I'll try that.

I was not aware that it was meant to be in a sideblock. But if this change don't work for me then I know now and will tru that out.........

Again - Thank you

Rocket

wow, lost track of this post..  :o

JP, yes, all members do have birthdays.. :)  but we run a clan site and I was thinking of just showing birthdays for squad members.

Some people who join the site, are not necessarily friendly to the group and we don't necessarily want to celebrate their birthday!   :P

JPDeni

#37
I see. :)

You can alter the query, but I'm not sure how you need it altered.

Here's the original query:
 
  "SELECT ID_MEMBER, memberName, birthdate
     FROM {$db_prefix}members
     WHERE birthdate LIKE '%$month_number%'
     AND birthdate NOT LIKE '0001-01-01'
     ORDER BY memberName", __FILE__, __LINE__);


If you wanted only one primary group to be included, after the "WHERE" line you would add something like


AND ID_GROUP = 3


which would mean that only those who have primary group 3 would have their birthdays listed.

If you have two groups that you want to include, you would add


AND (ID_GROUP = 3 OR ID_GROUP= 2)


If you wanted to exclude a particular primary group, you could add something like


AND ID_GROUP <> 3


because we don't like the people in group 3 and we don't care when their birthday is. :)

It gets a little more complicated when you are looking at secondary groups, because there can be multiples. Let's just start with one possibility and if that doesn't work for you, we can go on. Let's say that the bad people are in the 32 secondary group. You would add the following after the WHERE line:


AND NOT FIND_IN_SET('32',additionalGroups)


If you only wanted to show for one secondary group (and that group was number 23), you would use


AND FIND_IN_SET('23',additionalGroups)


I think. :) I haven't tested any of this, but this is what seems would work.

Rocket

#38
Sounds good JP, I will test it out and let you know what happens! 

That darn group 32.. you just can't trust'em!  ^-^

Thanks for the help!

IchBin

For your future reference Rocket, JPDeni = Sis not Bro....  :2funny:

This website is proudly hosted on Crocweb Cloud Website Hosting.