Hide Birthdays if no birthday

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Scam Warning
User avatar
moviehive
Registered User
Posts: 190
Joined: Mon Oct 20, 2014 2:08 am
Name: Aaron T

Hide Birthdays if no birthday

Post by moviehive » Sun Nov 02, 2014 11:35 pm

So I am currently developing a forum to go alongside a clients website and they've made a request that the birthday section is hidden on the index when there is no birthday.

Currently when you set up a phpBB 3.1 you get the birthday section on the index by default.

How do I go about NOT removing it - but having it hidden unless there is a birthday.
Last edited by Oyabun1 on Mon Nov 03, 2014 8:57 am, edited 1 time in total.
Reason: Moved from 3.1.x Support forum

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21010
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Hide Birthdays if no birthday

Post by RMcGirr83 » Mon Nov 03, 2014 11:28 am

You could change this line in index.php

Code: Select all

	'S_DISPLAY_BIRTHDAY_LIST'	=> ($config['load_birthdays']) ? true : false,
to this

Code: Select all

	'S_DISPLAY_BIRTHDAY_LIST'	=> (!empty($birthday_list) && $config['load_birthdays']) ? true : false,
I am pretty sure there is no event to be able to do what you are trying without modifying the core code.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
Lightfeather
Registered User
Posts: 246
Joined: Sat Jan 25, 2003 4:52 am

Re: Hide Birthdays if no birthday

Post by Lightfeather » Mon Sep 12, 2016 11:58 pm

Thank you so much for this!
"Experience is what you get when you don't get what you want."

User avatar
Lightfeather
Registered User
Posts: 246
Joined: Sat Jan 25, 2003 4:52 am

Re: Hide Birthdays if no birthday

Post by Lightfeather » Thu Feb 15, 2018 8:25 pm

I just updated from 3.1 to 3.2.2 and when I went to make this change in index.php the line to change isn't the same. It's now:

Code: Select all

	'S_DISPLAY_BIRTHDAY_LIST'	=> $show_birthdays,
There's also this bit up above it:

Code: Select all

	'BIRTHDAY_LIST'	=> (empty($birthday_list)) ? '' : implode($user->lang['COMMA_SEPARATOR'], $birthday_list),
I'm unsure how to make the changes in 3.2.2 to force the birthday list to hide if there are no birthdays. I'm actually not sure if it doesn't already do this by default now because there are currently users with birthdays on my forum.
"Experience is what you get when you don't get what you want."

User avatar
3Di
Registered User
Posts: 13151
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Hide Birthdays if no birthday

Post by 3Di » Thu Feb 15, 2018 8:33 pm

'S_DISPLAY_BIRTHDAY_LIST' => (!empty($birthday_list)) ? $show_birthdays : false, should do.
:game_die: The new Dice Roller extension for phpBB 3.2 is out! :game_die:

Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
fliper4o
Registered User
Posts: 267
Joined: Wed Mar 23, 2011 8:15 pm
Contact:

Re: Hide Birthdays if no birthday

Post by fliper4o » Fri Feb 16, 2018 7:32 pm

Hide Birthdays
https://www.phpbb.com/customise/db/exte ... _birthdays
dmzx wrote:Display birthdays only when there is a birthday.

User avatar
Lightfeather
Registered User
Posts: 246
Joined: Sat Jan 25, 2003 4:52 am

Re: Hide Birthdays if no birthday

Post by Lightfeather » Fri Feb 16, 2018 9:19 pm

Spectacular! Thank you very much. =)

Edit: Darnit. I installed the Hide Birthdays mod and it will hide anything that is anchored to the birthday section if there is no birthdays. I have the Happy Anniversary extension installed and made it so it would appear above the birthday list by using index_body_birthday_block_before instead of index_body_birthday_block_before. But with the Hide Birthday extension installed, when there is no birthdays, both the birthday and anniversary sections hide themselves. =(

Anything using index_body_birthday_block_before, index_body_block_birthday_append, or index_body_block_birthday_prepend are affected. I wrote a support ticket on the Hide Birthdays extension and hopefully there is a way to resolve it.
"Experience is what you get when you don't get what you want."

User avatar
Lumpy Burgertushie
Registered User
Posts: 65349
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Hide Birthdays if no birthday

Post by Lumpy Burgertushie » Fri Feb 16, 2018 10:30 pm

disable and uninstall both extensions and then reinstall them the other way around. install the hide birthdays one first then install the anniversery one
see if that solves the problem.

rob e3rt
I am available for custom work on a donation basis. Please send me a PM with your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

OK, so what's the speed of dark?

User avatar
Lightfeather
Registered User
Posts: 246
Joined: Sat Jan 25, 2003 4:52 am

Re: Hide Birthdays if no birthday

Post by Lightfeather » Fri Feb 16, 2018 11:12 pm

The order of installation didn't make a difference.

The simplest solution was using the index.php hard edit 3Di posted above. It hid the empty birthday list without affecting the Anniversary list extension. I've been trying to get away from core file edits and stick with extensions only, (to ease future updates), but I think I have to stick with this one because it just works.
"Experience is what you get when you don't get what you want."

User avatar
3Di
Registered User
Posts: 13151
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Hide Birthdays if no birthday

Post by 3Di » Fri Feb 16, 2018 11:18 pm

There are no events for that, still. I have no time atm to make one.

That's why I posted hard-code, that's not me usually, since I am against that.

BTW, this line:
Lightfeather wrote:
Thu Feb 15, 2018 8:25 pm
There's also this bit up above it:

Code: Select all

	'BIRTHDAY_LIST'	=> (empty($birthday_list)) ? '' : implode($user->lang['COMMA_SEPARATOR'], $birthday_list),
is totally unused by the core as far as I can see, perhaps a remaining of the old times.
:game_die: The new Dice Roller extension for phpBB 3.2 is out! :game_die:

Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
david63
Jr. Extension Validator
Posts: 15087
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Hide Birthdays if no birthday

Post by david63 » Sat Feb 17, 2018 12:41 am

Lumpy Burgertushie wrote:
Fri Feb 16, 2018 10:30 pm
disable and uninstall both extensions and then reinstall them the other way around. install the hide birthdays one first then install the anniversery one
see if that solves the problem.
The order in which extensions are installed has no relevance on the order in which they are run - in fact the official answer is that there is no logic in the order extensions are run, but in practice it appears that they are run in alphabetical order.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21010
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Hide Birthdays if no birthday

Post by RMcGirr83 » Sat Feb 17, 2018 11:41 am

3Di wrote:
Fri Feb 16, 2018 11:18 pm
There are no events for that, still. I have no time atm to make one.
One can use the core.index_modify_page_title to overwrite the template data.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
3Di
Registered User
Posts: 13151
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Hide Birthdays if no birthday

Post by 3Di » Sat Feb 17, 2018 1:54 pm

RMcGirr83 wrote:
Sat Feb 17, 2018 11:41 am
3Di wrote:
Fri Feb 16, 2018 11:18 pm
There are no events for that, still. I have no time atm to make one.
One can use the core.index_modify_page_title to overwrite the template data.
I see, still the point would be:
is it worth to make an extension for this or better modify the core via a PR which will take care of removing redundant code as well?
:game_die: The new Dice Roller extension for phpBB 3.2 is out! :game_die:

Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
Christian 2.0
Former Team Member
Posts: 4450
Joined: Wed Nov 04, 2009 11:16 pm
Location: UK
Name: Christian
Contact:

Re: Hide Birthdays if no birthday

Post by Christian 2.0 » Sun Feb 18, 2018 12:00 am

Hello :)

You can change the IF-statement in the front-end template file to achieve this without affecting other extensions.

Open: /styles/*/template/index_body.html

Find:

Code: Select all

<!-- IF S_DISPLAY_BIRTHDAY_LIST -->
Replace with:

Code: Select all

<!-- IF S_DISPLAY_BIRTHDAY_LIST and BIRTHDAY_LIST -->

User avatar
3Di
Registered User
Posts: 13151
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Hide Birthdays if no birthday

Post by 3Di » Sun Feb 18, 2018 12:08 am

That BIRTHDAY_LIST template bit is there just for 3.0 compatibility, not used in 3.2 and should be removed (redundant code). :geek:

Code: Select all

'BIRTHDAY_LIST'	=> (empty($birthday_list)) ? '' : implode($user->lang['COMMA_SEPARATOR'], $birthday_list),

Code: Select all

		// For 3.0 compatibility
		$birthday_list[] = $birthday_username . (($birthday_age) ? " ({$birthday_age})" : '');
:game_die: The new Dice Roller extension for phpBB 3.2 is out! :game_die:

Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

Post Reply

Return to “Extension Requests”

Who is online

Users browsing this forum: </Solidjeuh> and 15 guests