MyBB Community Forums

Full Version: how can i display today's birthday in portal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
please am using portal, and how can i display today's birthday in portal
Go to your theme templates first.

Admin CP > Templates > Expand > Portal Template > Portal

Add $birthdays where you want it to display. I would place it under $whosonline
(2018-06-26, 10:15 PM)/r/ Wrote: [ -> ]Go to your theme templates first.

Admin CP > Templates > Expand > Portal Template > Portal

Add $birthdays where you want it to display. I would place it under $whosonline

This won't work. The {$birthdays} variable can only be used in the index.

You'll need a core edit to do this...
please teach me
It is indeed possible without any core edit.
Let me have some time to reach home and I will post the solution.
please effone
teach me please
Alright, so ... here is a tutorial:

First open your "index_birthdays" template and find this line at line no. 3:

<td class="trow1"><span class="smalltext">{$bdays}</span></td>

Change it to:

<td class="trow1"><span class="smalltext" id="bdays">{$bdays}</span></td>

Save the template.

Next, open your "portal_whosonline" template and add the following code at the end (don't delete existing code, you need to add at the end):

<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead"><strong>Today's Birthdays</strong></td>
</tr>
<tr>
<td class="trow1">
<span class="smalltext" id="pbdays"></span>
</td>
</tr>
</table>
<br />
<script>jQuery(function(){jQuery("#pbdays").load("{$mybb->settings['bburl']}/index.php #bdays")});</script>

Save the template and you are done.

Result:

[Image: Untitled_2.png]
Thanks boss
Would there be a way to make the table header use the language variable
{$lang->todays_birthdays}
there?
If you set the ID to <tr> in 'index_birthdays' template (<tr id="bdays">) instead of the span you will get the entire chunk of the birthday block.
Problem is the "Today's Birthdays" will appear in 'tcat' class (black line) instead of 'thead' (blue line) which you then need to further restyle to match with other blocks.

Alternate method is to pull the language var value with same technique using different id but I will not recommend this as this is not worth for the code it is gonna run in background slowing down your page load (negligible, but still).