Firefox PHP

Module: Birthdays

Posted by Steve Healy 
Re: Module: Birthdays
February 09, 2008 01:25AM
There is no template hook for that. All you can do is use the before_footer hook to add the birthday at the bottom of the page. But that wouldn't put it inside the profile block. Some javascript to move it inside the block would work if you want a totally drop-in module. Check what I did for the jumpmenu templates to move the jumpmenu into place. That one is pretty versatile. Either the code moves the jumpmenu into a default spot or you can add a <div> to the templates yourself to indicate where the jumpmenu should appear.

Maybe the template page would be a good one for adding some template hook, but we are very careful about this. We don't want to stuff the templates with a lot of hooks. Partly because they are easily forgotten when people start customizing templates.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Birthdays
February 09, 2008 11:36AM
Still doesn't work for me.

Here's some further investigation: It's not the javascript in the header. I removed that & it still doesn't work.

I have the 'Online Users' module and the 'stats' module working, and they hook into the footer perfectly. Is there something that this module does differently to those other two in the way it hooks before the footer?
Re: Module: Birthdays
February 09, 2008 11:42AM
Quote
stevehealy
(In my inexpert opinion, it looks like your server is overtaxed by other things - you were only trying to allocate 8208, and it says 26214400 exhausted)

You're reading this wrong I think. This means that the running PHP script is trying to allocate 8208 at the spot where the memory got exhausted. It does not mean that it needs 8208 in total. The script is most defenitely taking up more memory than allowed. M@AATW's server is configured to allow max 25MB of memory usage and according to this error, the script would have exceeded the 25MB when another 8208 bytes would have been allocated.

Isn't something going on here like pulling in the full user list into memory or so? I didn't look at the code and don't have time for it right now, but this kind of error simply means that a lot of memory is being filled for some reason.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Birthdays
February 10, 2008 09:08AM
Yes it does read the entire user list. (active users anyway) Can I use the API user search on a custom profile field? If so, that could help. I'll give it a shot next week.

That brings up another question for M@AATW - how many users does your phorum have? I've got less than 50.

...
Steve Healy, Phorum hacker, currently on: (version 5.2.19)
contributions:
Birthdays mod, Top Users mod, Icon legend.tpl, (plus a handful of bugfixes and old 5.0 creations)
Re: Module: Birthdays
February 10, 2008 10:37AM
You can use phorum_api_user_search_custom_profile_field() for that.
Here a excerpt from the Google Maps module which does a lookup on a custom profile field:
// Collect all users which have a "mod_google_maps" custom user profile field.
require_once('./include/api/custom_profile_fields.php');
$field = phorum_api_custom_profile_field_byname('mod_google_maps');
if (empty($field)) trigger_error(
    'No custom profile field named "mod_google_maps" available',
    E_USER_ERROR
);
$user_ids = phorum_api_user_search_custom_profile_field(
    $field[0], '', '%', TRUE
);


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Birthdays
February 10, 2008 07:05PM
My site has 3,083 users.
Re: Module: Birthdays
February 11, 2008 09:37AM
i am not able to translate this module into Turkish. "No birthdays in the next 30 days" I need to write "30 days" between other words according to turkish grammer. It suits in no way..
Re: Module: Birthdays
February 11, 2008 06:46PM
Quote
scabboy
i am not able to translate this module into Turkish. "No birthdays in the next 30 days" I need to write "30 days" between other words according to turkish grammer. It suits in no way..

"No birthdays in the next 30 days", uses these 2 language strings:

    "BlockContentNone"    => "No birthdays in the next",
    "Days"                => "days",

It inserts the number (in this case 30) between those 2 strings like so: "[BlockContentNone] 30 [Days]"

I should have named the strings better, however I *think* you should be able to modify them such that you get the proper word order.

That is, if your word for "days" goes before the "30", just put it in the "BlockContentNone" string, and put whatever goes after the "30" in the "Days" string.

Does that help?

...
Steve Healy, Phorum hacker, currently on: (version 5.2.19)
contributions:
Birthdays mod, Top Users mod, Icon legend.tpl, (plus a handful of bugfixes and old 5.0 creations)
Re: Module: Birthdays
February 11, 2008 07:02PM
I should point out also that currently:

    "BlockContentOne"     => "Birthday in the next",
    "BlockContentMany"    => "Birthdays in the next",
    "BlockContentNone"    => "No birthdays in the next",
    "Days"                => "days",

All 3 BlockContent strings use "Days" as the second string after the number. It occurred to me that this may be a problem in other languages. If so I'll have to add some more strings.

...
Steve Healy, Phorum hacker, currently on: (version 5.2.19)
contributions:
Birthdays mod, Top Users mod, Icon legend.tpl, (plus a handful of bugfixes and old 5.0 creations)
Re: Module: Birthdays
February 11, 2008 07:11PM
This reminds me of a question for the experts which I had while working on the language file:

Is it possible to put a variable within a language string?

It would simplify this process significantly if I could write language strings like

    "BlockContentNone"    => "No birthdays in the next [#] days",

(or something like that)

...
Steve Healy, Phorum hacker, currently on: (version 5.2.19)
contributions:
Birthdays mod, Top Users mod, Icon legend.tpl, (plus a handful of bugfixes and old 5.0 creations)
Sorry, only registered users may post in this forum.

Click here to login