completed Birthday Notifications

Ceri
Ceri
@adolygwr
8 years ago
370 posts
Would it be possible to develop a birthday notification system similar to the one on Ning 2? It's a great way of reminding inactive members that we are still around :)


--
Ceri Shaw - AmeriCymru

updated by @adolygwr: 04/15/16 02:46:49PM
paul
@paul
8 years ago
4,326 posts
Ning member birthdays are imported and are in the the user datastore but by default none of our skins show them. A bit of profile template editing could rectify that.
But you talk about notifications. How would you want it to work?


--
Paul Asher - JR Developer and System Import Specialist
Ceri
Ceri
@adolygwr
8 years ago
370 posts
Basically I would like to see a site builder widget titled 'Birthdays Today' or something like that which could be placed on a page or pages displaying three or four member profile pics together with their names and perhaps a 'Wish them happy Birthday' message. I have an admin who used to send out a message to all members on their b'days and it was a surprisingly effective way to engage members and remind the less active ones about the site. If there were more than 4 in a day, perhaps a more button?

I tried to find a screenshot of the old Ning 2 birthday widget in action but came up blank :(


--
Ceri Shaw - AmeriCymru

updated by @adolygwr: 01/11/16 06:18:40PM
Strumelia
Strumelia
@strumelia
8 years ago
3,603 posts
I'd love to see a widget/module for birthday wishes as well!

However, I wouldn't want it to be dependent on old Ning data. This week I'm actually deleting 2000 old inactive Ning members. And as I leave Ning further behind in the past, on my new JR site i don't require date of birth anymore (some joining members bristled at that). I had required it on Ning only because spammers were a much bigger problem on my ning than in my JR site. (all the spammers were apparently young urban women in their 20s...lol)

I'd love to see a Birthday Club where members could choose to enter in their OWN birthdays (no years) if they WANT to be part of it- and their avatar would pop up on the main page in the widget on their birthday. Then other members could click to the birthday members' pages and wish them happy birthday on their comment wall. There should however be one auto-generated birthday wish (a comment, or a notification message) for them somehow though- 'cause it'd be reeeeally sad if some members got no happy birthday message at all on their big day... :(



--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015

updated by @strumelia: 01/11/16 07:51:23PM
michael
@michael
8 years ago
7,715 posts
Its certainly possible to build with the Form Designer adding the birthday date to their profile form.

Then the {jrCore_list} call calling out people who's birthdays match today.
paul
@paul
8 years ago
4,326 posts
A quick 'How To' . . .

1) As admin, goto your profile settings and click on the Form Designer
2) Create field 'profile_birthday' and select 'date_birthday' as the type, and 'string' for validation. Select group(s) that this is active for. Save.
3) In SiteBuilder, create an Template Code widget and title it "Today's Birthdays".
4) Copy and paste this code as the template -
{$this_day = $smarty.now|date_format:"d"}
{$this_month = $smarty.now|date_format:"m"}
{jrCore_list module="jrProfile" search="profile_birthday LIKE %`$this_month``$this_day`" limit="4" template="widget_list_grid_2.tpl" tpl_dir="jrProfile"}



--
Paul Asher - JR Developer and System Import Specialist
Ceri
Ceri
@adolygwr
8 years ago
370 posts
Many thanks :) I just implemented this but its not showing any b'days for today. That may be because there aren't any but with 4000 members you would expect an average of 10 a day (approx).

Possible gotchas:-

1. Should I enable this for all quotas? Which I did.

2. Also when you say 'groups' does that mean quotas?

Cheers

Ceri


--
Ceri Shaw - AmeriCymru
Ceri
Ceri
@adolygwr
8 years ago
370 posts
Actually I stiil dont see birthday as a question field when you try to create a new account. So did I bork the form designer stage?


--
Ceri Shaw - AmeriCymru
michael
@michael
8 years ago
7,715 posts
paul:.....
1) As admin, goto your profile settings and click on the Form Designer
2) Create field 'profile_birthday' and select 'date_birthday' as the type, and 'string' for validation. Select group(s) that this is active for. Save......

That part is important.

Docs: "Using the Form Designer"
http://www.jamroom.net/the-jamroom-network/documentation/getting-started/1275/using-the-form-designer

That will allow users to add birthdays to their profile. Right now you dont have birthdays saved in the datastore, (as far as I know) so you need to have the data stored before being able to act on it.
paul
@paul
8 years ago
4,326 posts
Actually, birthdays imported from Ning are in the User datastore (saved as user_birthdate) and are in the format yyyy-mm-dd so the above code to pick those up would be -

{$this_day = $smarty.now|date_format:"d"}
{$this_month = $smarty.now|date_format:"m"}
{jrCore_list module="jrUser" search="user_birthdate LIKE %`$this_month`-`$this_day`" limit="4"}
This will use the default user list template which is not in a grid format so you might want to add some custom user template code based on the profile grid template.

Also, add the birthday field to the User Account form, not the Profile Settings form. Add 'user_birthdate' as a text field and make the default 'yyyy-mm-dd' so as to persuade users to enter it in the right format (Also make that clear in the help text).


--
Paul Asher - JR Developer and System Import Specialist
Ceri
Ceri
@adolygwr
8 years ago
370 posts
I am still somewhat confused. When I go to the Form Designer in User Accounts I find that there is already a birthday field there user_profile_birthday

Can I not use this?


--
Ceri Shaw - AmeriCymru
Ceri
Ceri
@adolygwr
8 years ago
370 posts
Also I added the code above to a Template Code box on sitebuilder and got a template error message ( see screenshot below )


--
Ceri Shaw - AmeriCymru
paul
@paul
8 years ago
4,326 posts
Sorry - This is what happens when I suggest code without actually trying it first lol
Yes, the user module does not have an item_list.tpl so we'll need include it in the template so try this -

{capture name="birthday_tpl" assign="birthday_tpl"}
    {literal}
	<div class="container">
    	    {if isset($_items)}
                {foreach from=$_items item="item"}
                    {if $item@first || ($item@iteration % 2) == 1}
                        <div class="row">
                    {/if}
                    <div class="col6{if $item@last || ($item@iteration % 2) == 0} last{/if}">
                        {jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$item._user_id size="large" crop="portrait" class="img_scale" style="margin:0" alt="@`$item.user_name`" title="@`$item.user_name`"}</a>
                    </div>
                    {if $item@last || ($item@iteration % 2) == 0}
                        </div>
                    {/if}
                {/foreach}
            {/if}
        </div>
    {/literal}
{/capture}

{$this_day = $smarty.now|date_format:"d"}
{$this_month = $smarty.now|date_format:"m"}
{jrCore_list module="jrUser" search="user_birthdate LIKE %`$this_month`-`$this_day`" limit="4" template=$birthday_tpl}

Not sure where 'user_profile_birthday' has come from but it is 'user_birthdate' that contains all your imported birthdays so maybe disable that field and add in the proper one.
Thanks


--
Paul Asher - JR Developer and System Import Specialist
Ceri
Ceri
@adolygwr
8 years ago
370 posts
Many thanks.....I have it now on the home page of AC (bottom right for now till I've styled it a bit) but it doesn't appear that the icons are linked to the members profile pages. What I was hoping for is a list of clickable icons that admins can use to access profiles and leave birthday messages.


--
Ceri Shaw - AmeriCymru
paul
@paul
8 years ago
4,326 posts
Yeh - the problem is that this is a User listing and as such, associated profile info isn't included in the returned smarty data. We'll need to get the profile_url in the template code like this -

{capture name="birthday_tpl" assign="birthday_tpl"}
    {literal}
	<div class="container">
    	    {if isset($_items)}
                {foreach from=$_items item="item"}
                    {if $item@first || ($item@iteration % 2) == 1}
                        <div class="row">
                    {/if}
                    <div class="col6{if $item@last || ($item@iteration % 2) == 0} last{/if}">
                        {$profile_url = jrCore_db_get_item_key('jrProfile', $item['_profile_id'], 'profile_url')}
                        <a href="{$jamroom_url}/{$profile_url}">{jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$item._user_id size="large" crop="portrait" class="img_scale" style="margin:0" alt="@`$item.user_name`" title="@`$item.user_name`"}</a>
                    </div>
                    {if $item@last || ($item@iteration % 2) == 0}
                        </div>
                    {/if}
                {/foreach}
            {/if}
        </div>
    {/literal}
{/capture}

{$this_day = $smarty.now|date_format:"d"}
{$this_month = $smarty.now|date_format:"m"}
{jrCore_list module="jrUser" search="user_birthdate LIKE %`$this_month`-`$this_day`" limit="4" template=$birthday_tpl}
Note that this adds an extra database query for every user in the birthday list so will load the server a bit more, but if the limit is still four its not much of an issue. If greater, let me know and I'll give you some template code that's a bit more complicated but will get all the profile_urls in one hit.
Cheers
Pa


--
Paul Asher - JR Developer and System Import Specialist
Ceri
Ceri
@adolygwr
8 years ago
370 posts
A further question occurs to me. Should 'enter your b'day' q be in user/account or create account? At the moment I have it in both but it does not appear on the create an account page?


--
Ceri Shaw - AmeriCymru
Ceri
Ceri
@adolygwr
8 years ago
370 posts
Quote:
Note that this adds an extra database query for every user in the birthday list so will load the server a bit more, but if the limit is still four its not much of an issue. If greater, let me know and I'll give you some template code that's a bit more complicated but will get all the profile_urls in one hit.
Cheers
Pa


Hoping to get all the birthdays for a single day in a single hit. Ideally though I would like to display 4 followed by a more button to reveal the rest so that the widget doesnt take up too much page real estate. Is that possible?


--
Ceri Shaw - AmeriCymru
paul
@paul
8 years ago
4,326 posts
You'd probably need to raise the limit value in the jrCore_list call then put a counter in the foreach loop so as to break out of the loop after four items.
Then test the total items variable -

{if $info.total_items > 4}
    // 'More' link code here
{/if}



--
Paul Asher - JR Developer and System Import Specialist
paul
@paul
8 years ago
4,326 posts
Try this -

{capture name="birthday_tpl" assign="birthday_tpl"}
    {literal}
	<div class="container">
    	    {if isset($_items)}
                {$ctr = 0}
                {foreach from=$_items item="item"}
                    {if $item@first || ($item@iteration % 2) == 1}
                        <div class="row">
                    {/if}
                    <div class="col6{if $item@last || ($item@iteration % 2) == 0} last{/if}">
                        {$profile_url = jrCore_db_get_item_key('jrProfile', $item['_profile_id'], 'profile_url')}
                        <a href="{$jamroom_url}/{$profile_url}">{jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$item._user_id size="large" crop="portrait" class="img_scale" style="margin:0" alt="@`$item.user_name`" title="@`$item.user_name`"}</a>
                    </div>
                    {if $item@last || ($item@iteration % 2) == 0}
                        </div>
                    {/if}
                    {$ctr = $ctr + 1}
                    {if $ctr == 4}
                    	{break}
                    {/if}
                {/foreach}
				{if $info.total_items > 4}
				    // 'More' link code here
				{/if}
            {/if}
        </div>
    {/literal}
{/capture}

{$this_day = $smarty.now|date_format:"d"}
{$this_month = $smarty.now|date_format:"m"}
{jrCore_list module="jrUser" search="user_birthdate LIKE %`$this_month`-`$this_day`" limit="5" template=$birthday_tpl}



--
Paul Asher - JR Developer and System Import Specialist
Ceri
Ceri
@adolygwr
8 years ago
370 posts
Got the links working but the more link code displays as text. I'm thinking we may get 10 a day max on a busy day but I don't want the b'day list to take up half the column if poss.

Cheers

ceri


--
Ceri Shaw - AmeriCymru
Ceri
Ceri
@adolygwr
8 years ago
370 posts
Ahhh ...of course I realise now that the more link IS plain text :) But where should that link go. Not sure how to construct it?


--
Ceri Shaw - AmeriCymru
paul
@paul
8 years ago
4,326 posts
Ceri:
Ahhh ...of course I realise now that the more link IS plain text :) But where should that link go. Not sure how to construct it?

Maybe construct a page with Site Builder called "Today's Birthdays". Add a (full width?) widget to it with the same template code but with a bigger limit (100 say) and the break, counter and more link removed. Then link the More to that -

<a href="{$jamroom_url}/todays_birthdays">More</a>



--
Paul Asher - JR Developer and System Import Specialist
Ceri
Ceri
@adolygwr
8 years ago
370 posts
Superb....that works just fine. Once again many thanks for a prompt solution to a pressing problem. I have at least one site admin who will be delighted by this. Diolch yn fawr :)


--
Ceri Shaw - AmeriCymru