Does work with the nodeprofile module and CCK fields?

I have user's data kept in nodeprofile by means of fields CCK . There I have a field DATES to keep the date of birth of the users.

CommentFileSizeAuthor
#74 get_birthdays.txt4.38 KBmuschpusch
#74 content_type.txt14.61 KBmuschpusch

Comments

lias’s picture

This would be a nice option now that Michelle has come out with advanced profile and the use of nodeprofile and bio.

Fayna’s picture

Or now Content Profile, the successor of the Nodeprofile and bio modules:

http://drupal.org/project/content_profile

This would be great to integrate the Birthdays module with!

dtabach’s picture

Category: support » feature

+1 for this feature request: read birthday dates from date_fields in cck content types used as profile nodes.

liliplanet’s picture

Yes, would love this to work with profile nodes .. as do not use the profile.module

EgonO’s picture

+1 subscribe for nodeprofile & cck_datefield option

daniorama’s picture

Title: Using with nodeprofile & cck » Integration with cck (nodeprofile, contentprofile, etc...) in D5 & D6
kenorb’s picture

subscribing

kamtcho’s picture

subscribing

igorik’s picture

Yes, it would be great.
I really love this module.
My idea is that you coudl select profile field OR cck field for birthday.

If you choose cck field, then you can use cck_field_privacy for visibility of birthday age/year field for nobody/friends only/everyone
what is better as current nobody/everyone

I will try to do some patch for it, it will be my first so I am not sure how many time it takes me but I thing that I did it throug christmas time.

bye
Igorik
http://www.somvprahe.sk

bennos’s picture

subscribing

ckidow’s picture

subscribing

aleagi’s picture

Subscribing! +1

design.er’s picture

subscribing

Lorbas’s picture

Version: 5.x-1.x-dev » 6.x-1.0

it would be great! but it's on list more than year :(

Witch’s picture

subscribing

maartenvg’s picture

This is definitely still on the future features list. I've researched how to do this and came to the conclusion that it will require a lot rewriting and adding of code to make it independent of the type of field used. I don't have that amount of time at the moment (and not for the next few month), but will be able to review & commit any patches that come along.

Witch’s picture

Hi maartenvg,

Are you able to add just the field with the age? Is there a quicker solution? Its very important for one of my projects!

maartenvg’s picture

You could use the profile field and use hook_form_alter to show the element on you user node. Perhaps....

Witch’s picture

i am not good in coding :\ may you or someone else give me a short instruction?

kenorb’s picture

Witch’s picture

But this article doesn't deal with the age :\

bobgeier’s picture

Yet another vote and subscription. I think the majority of folks who are collecting any kind of user information / user profile are doing it in nodes with content_profile or one of the D5 variants.

venusrising’s picture

Sad not to be able to use this module as using content profile

jthomasbailey’s picture

subscribing

nirvanajyothi’s picture

I created a Date field on 'Content profile' and was hoping that B'day module may detect the new date field!

+1 for this feature.Will be useful to all those who are using and switching to 'Content profile' module. It will be great to have 'Birthdays' module working .

richard.e.morton’s picture

+1

we can't have date of birth on unprotected userprofiles, but content profiles allow us to protect certain fields so integrating brithdays with a cck date field and content profile would be fantastic as we installed this module briefly when we were setting up the site and loved it but can't use it as previously mentioned.

Thanks

Richard

merilainen’s picture

+1 for integration

I'm using Content profile at the moment and will just add a birthday-cck field. Then I can create a block with views to show 5 upcoming birthdays, so that's quite enough at the moment, but it would be nice to see this integrated with Content profile.

chaosprinz’s picture

oh yeah.. integration for content-profile would be real great.. what an cool possible combination cck+contentprofile+advanced-profile+panels2+birthday could be.. a nice dream, i subscribe

Passionate_Lass’s picture

Would like to see this made compatible with Content Profile as well.

bgogoi’s picture

Option should be there to link with any (thsoe are meant for b'days) date field.

++

pixelpreview@gmail.com’s picture

yes subscribing too
I use content profile too

design.er’s picture

Maarten, sorry for bothering you but I just wanted to ask about the status of this feature. If you can say after 4 months if/when we can plan with this feature.

Have a nice weekend! :)

Regards,
Stefan

liliplanet’s picture

Yes ... +1 for content profile, thx!

mzi’s picture

just want to stay up to date.

+1 for for feature und subscribing

jho1086’s picture

yes it's great if it is compatible with content profile and have age generate and zodiac sign...

Thanks very much...The module is so nice...

foodbo’s picture

I want that feature toooooo....subscribing

Yacko’s picture

subscribing : +1 for content profile

jrabeemer’s picture

This feature is the way go. The disconnect by a profile field versus a CCK field in content_profile is face-palm worthy.

jrabeemer’s picture

For those who want to have the birthday field on the user profile, thus killing the separate tabs, try: http://drupal.org/project/onepageprofile

Kristina-2’s picture

I'd like to see this feature as well. There's several issues on the issue queue requesting this feature which is making it confusing to know where to comment.

GeekyLass’s picture

subscribing.

robby.smith’s picture

+1 with content profile

iaminawe’s picture

+1 Content Profile

zuzu83’s picture

+1 subscribing

trevorleenc’s picture

throwing in my +1 as well...but going to investigate using the one page profile approach, and adding just a cck date field...we'll see how it all works out.

muschpusch’s picture

subscribe... content profile integration :)

YK85’s picture

+1 subscribing

danielm’s picture

+1 subscribing

Hello everybody,

Everyone has been asking this patch for years but nobody did anything.

Is there someone (a kind soul) to make a patch to use content profile (CCK)

See an example birthday with CCK (Computed Field module) : http://drupal.org/node/420932

Thank you in advance for your help, everyone will thank you.

Sincerely Daniel

Balbo’s picture

+1
Unfortunately at the moment, I'm not able to code it myself.

Breakerandi’s picture

Would be great if this will work.. I would pay for it!

deggertsen’s picture

subscribe

Stephen Scholtz’s picture

subscribe

Michsk’s picture

to bad this is going so slow but +1 from to also.

Michsk’s picture

to bad this is going so slow but +1 from to also.

916Designs’s picture

Here is something I hacked together to get basic Happy Birthday emails sent out to users based on a CCK field, after giving up on the Rules module and not wanting to use standard profile fields. I know this is horribly written, incomplete, etc. but it is working. Everything is hardcoded for MySQL only. Timezone handling isn't implemented.

Could be extended to have a UI or hacked back into the Birthdays module. 99% of this code taken from Birthdays module. Below is an independent module, Birthdays not required. "content_type_profile" is your cck content type containing a date field, in this case called field_birthday_value

.module code:

<?php
function cck_birthday_email_cron() {
    $time = time(); //Get UNIX timestamp for now

    if (variable_get('cck_birthday_email_last_cron', 0) <= ($time - 24*3600)) { 
      variable_set('cck_birthday_email_last_cron', floor($time/100)*100);
      _cck_birthday_email_send_user_emails();
    }
}

function _cck_birthday_email_send_user_emails() {

    // Get all users having their birthday today
    $accounts = _cck_birthday_email_get_todays_birthdays(1);
	
	//drupal_set_message('These users have a birthday today: <pre>' . print_r($accounts,true) . '</pre>'); 

    foreach ($accounts as $uid) {
		
		// Load user
		$account = user_load(array('uid' => $uid));
		$to = $account->name .' <'. $account->mail .'>';
		$params['account'] = $account;
		$params['theusername'] = $account->name;

        // Send mail
        drupal_mail('cck_birthday_email', 'user_message', $to, user_preferred_language($account), $params);
        // Log actions
        watchdog('Birthday Emails', 'Sent @name a birthday e-mail.', array('@name' => $account->name), WATCHDOG_NOTICE, '&#160;');
    }
}

function cck_birthday_email_mail($key, &$message, $params) {


  $language = $message['language'];

  switch ($key) {
    // Send message to user.
    case 'user_message':
      // Get the content for the placeholders.
      $variables = user_mail_tokens($params['account'], $language);
      $message['subject'] = 'Happy Birthday ' . $params['theusername'] . '!';
      $message["body"] = "Happy Birthday from YOUR WEBSITE. We hope you have a great day."; //ouch, needs help
  }
}

function _cck_birthday_email_get_todays_birthdays($amount) {
  $birthdays = array();
  
  //Current user, needed for timezone information
  global $user;

  // $amount should be larger or equal to 1
  if ($amount < 1) {
    $amount = 1;
  }

  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
	
		//Will likely mess us all non-pacific time zone dates
		$result = db_query(
			"SELECT {node}.uid FROM {node} INNER JOIN {content_type_profile} ON node.nid = content_type_profile.nid WHERE MONTH(content_type_profile.field_birthday_value) = MONTH(CURDATE()) AND DAY(content_type_profile.field_birthday_value) = DAY(CURDATE())");
      break;
  }

  while ($account = db_fetch_object($result)) {
    $birthdays[] = $account->uid;
  }

  // Return array of uids that have their birthday
  return $birthdays;
}
?>
andypost’s picture

Version: 6.x-1.0 » 6.x-1.x-dev

Is there any patches?

pitxels’s picture

I could also pay for this integration... +1

imDhaval’s picture

+1

MasterChief’s picture

maartenvg seems to no longer maintain this module, maybe someone could take the place of maintainer for this module ?

mirrow1’s picture

+1 ;)

MasterChief’s picture

"Maintenance status: Seeking co-maintainer(s)"

We can see that on the module page, maybe someone ?

stefan81’s picture

subscribe

venusrising’s picture

Status: Active » Closed (won't fix)
YK85’s picture

Status: Closed (won't fix) » Active

why was this set to "won't fix" all of a sudden?
this integration would be super helpful =)

andypost’s picture

seems like this feature should go into d7

muschpusch’s picture

i think you can achieve the same functionality of this module using the rules module... I will test it the next couple of days and will post an export of my rule....

imDhaval’s picture

i am waiting 4 your explanation,muschpusch.

eL’s picture

subscribe

Balbo’s picture

waiting for muschpusch too

muschpusch’s picture

hm... rules can't do any node_load's on cron. Second change is a views & some custom code... :( Keep you posted...

design.er’s picture

I didn't test it yet but this seems to be the answer: http://drupal.org/project/date_repeat_presets

Cheers,
Stefan

muschpusch’s picture

StatusFileSize
new14.61 KB
new4.38 KB

Ok i got it working the code depends on:

CCK, views, content_profile and mimemail

In the attachments is an export of my content_profile content_type and the view i'm using. The labels are in dutch the machine names in english so you can change that easily. I don't use any of the functionality of the birthday module so you want need it. What you need some basic understanding of php to use this.

What is it doing. I created a content_type profile which has a date field for birthdays. After that I created a view filtering for this field. Actually views doesn't have a filter like this so a custom module has to be added.

The first part of the code for the custom module: (create a module named custom_love or something else)

// this adds a where condition to the view
function custom_love_views_query_alter(&$view, &$query){
    if ($view->name == 'get_birthdays') {
        $where_clause="MONTH(field_birthday_value) = MONTH(curdate()) AND DAYOFMONTH(field_birthday_value) = DAYOFMONTH(curdate())";
        $view->query->add_where('birthday_filter', $where_clause);
    }
}

Ok now we want to check for birthdays on cron:

function custom_love_cron(){
define('TODAY', mktime(0, 0, 0, date('n'), date('j'), date('Y'), 0));
if (variable_get('daily_cron', TODAY) != TODAY) {
        variable_set('daily_cron', TODAY);
    $view = views_get_view('get_birthdays'); // get our view
    $view->execute_display($display_id, $view_args);
    if (!empty($view)) {
        //mail( "volkan@rhizom.nl","huhu",$content['content']);
        /*
        print_r($view->result);
        [nid] => 45
        [users_uid] => 3161
        [node_data_field_birthday_field_birthday_value] => 1996-11-26T00:00:00
        [node_type] => user_profiles
        [node_vid] => 45
        [node_data_field_birthday_field_name_value] => Florchinger
        [node_data_field_birthday_field_surname_value] => Volkan
        */
        $mail_info=array();
        foreach ($view->result as $key => $value){
            $userinfo=user_load($value->users_uid);
            //print_r($userinfo);
            $mail_info[$key]['surname']=$value->node_data_field_birthday_field_surname_value;
            $mail_info[$key]['name']=$value->node_data_field_birthday_field_name_value;
            $mail_info[$key]['email']=$userinfo->mail;
            custom_love_mail_birthday($mail_info);
        }
    }
}
// uncomment this line for testing purposes. It resets the daily cron
//variable_set('daily_cron', "keep_sending_on_every_cron");
}

And now the mail function:

function custom_love_mail_birthday($info){
    foreach($info as $value){
        $body='Heey '.$value['surname'].',<br /><br />
            it's your birthday!';
    mimemail("slaes@something.com", $value['email'],"subject!", $body, FALSE, $headers = array(), $text = NULL);
    }
}                 

Have fun... !

igorik’s picture

Hi muschpusch
it looks very good, I would love to move from birthday module to content profile + cck + views
(I already use these modules )

But, what about existing data? I have about 11,000 members with bithday field.

can you help us please with some sql query for export and import?

dob table has a simple structure, it has only 2 columns, uid and birthday
so uid record is e.g. 19 and birthday record is 1977-01-09

how can I move all these existing recors from dob table into cck field table?

thanks a lot for your (or anybody) help
Igor

muschpusch’s picture

I just had a quick look but maybe this could help: http://drupal.org/project/profile_migrate

igorik’s picture

Profile migrate is sooo buggy module, I really warn everybody from using it. It create a lot of duplicate nodes, a lot of things doesn't work.

muschpusch’s picture

Sorry to hear Igorik... Migrating from profile to CCK could be done with some custom code. Try the forums, profile_migrate issue queue or contact me for paid support if you want to...

skolchin’s picture

Issue tags: +birthday

Hi!
I've managed to create birthday view without any modules or customizations. What I did:

- I created a field called field_birthdays of type Datetime and set it to have multiple values.
- I created a rule which calculates birthdays for 3 years - past, current, and next one and set it to to fire upon 'content is going to be saved' for User Profile and save these results to field_birthdays. Code is pretty simple, I may attach it if needed
- Then, I copied a calendar view and set field_birthdays as argument and view field.
- The last one - I created a rule which hides field_birthdays when node is going to be displayed

That's all. I know its quick&dirty way, and it doesn't scale and it should be some way to update field_birthdays when year is changed, but it works and I hope it helps someone.

muschpusch’s picture

Ok some info about migrating existing profile fields to content profile. (igorik you're lucky) I needed to do it for a client. Sooo...

1.) download & activate views_bonus, node_import-6.x-1.x-dev, user_import
2.) Create a user view and select all fields you want to migrate
3.) create a feed display & and set the style to csv
4.) import & select the merge option...

igorik’s picture

thanks a lot muschpusch, I downloaded and enabled all neccessary modules but I am a bit lost if this.

2.) I have user view. Need I to create a view with all of my cck fields in content profile (about 70 fields...) + wanted profile fields?

and then how I can pair these values with concrete users on node import, e.g. my view and cvs file can contains about 11,900 users and there is about 11,950 users on my page (about 50 users don't have content profile)
So far I can understand it it is using node title so the first field need to be node (content profile) title?

Are there neccessary column names for each field?

thanks a lot

Michsk’s picture

(4years later) Mabe any progress been made?

liliplanet’s picture

subscribe thx :)

delykj’s picture

subscribing

Niklas Fiekas’s picture

Title: Integration with cck (nodeprofile, contentprofile, etc...) in D5 & D6 » Integration with cck (nodeprofile, contentprofile, etc...) in D6
Status: Active » Closed (won't fix)

D7 already has a field type. D5 is no longer supported (only straight forward patches accepted).

I am maintaining D6 for bugfixes only, so unless someone volunteers this isn't likely to happen. Patches and/or co-maintainers welcome.

Kutakizukari’s picture

subscribing

chinita7’s picture

subscribe

Niklas Fiekas’s picture

Seen the follow button above? Subscribe comments are no longer required :)

chinita7’s picture

Thanks for letting me know. I'll use it from now on.