creating a user profile module

Events happening in the community are now at Drupal community events on www.drupal.org.
sharique's picture

I'm creating a user profile module, I want to restrict users, so that oner person can submit only one profile.I implemented check in hook_insert, it displays message properly but does not stop user from posting another profile.

function mybio_insert($node) {
   $res = db_result(db_query('select count(*) from {mybio} where uid=%d',$node->uid));
  
   if($res != 0)
  {  
       form_set_error('name','You have already created a profile.');
      return ;//t('You have already created a profile. ');
}else
  {  
   db_query("insert into {mybio} (nid,vid,uid,address,city,state,dateofbirth)
             values(%d, %d, %d, '%s', '%s', '%s', '%s')",
     $node->nid, $node->vid, $node->uid, $node->address, $node->city,$node->state,date($node->dateofbirth));
   }
}

Few more question :
Is there any way by which I can completely remove 'create profile' from create content menu and provide a link in user's account tab.

Also extra fields of new content type created by me are not visible to CCK.

Comments

Why?

michelle's picture

Why reinvent the wheel? There's already two profile modules.

Michelle

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

learning

sharique's picture

I'm learning drupal module development and want to understand how drupal works.
Thank you michelle for suggestions. You have developed 2 very good modules. I have used them in few places.

This time I want write from scratch.

Sharique uddin Ahmed Farooqui

Sharique Ahmed Farooqui

Ok

michelle's picture

I wasn't actually referring to my modules but... Good luck.

Michelle

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

sorry and thanks. In all

sharique's picture

sorry and thanks.

In all profile related module, your module is the best.

Sharique uddin Ahmed Farooqui

Sharique Ahmed Farooqui

LOL

michelle's picture

As I said, I wasn't referring to my modules. I was talking about core profile and content profile.

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

I'm looking for solution as

sharique's picture

I'm looking for solution as code snippet not as module.

I think I found problem. I have implemented hook_insert which called after node_insert, which insert values in node table.

Sharique uddin Ahmed Farooqui

Sharique Ahmed Farooqui

visualnotion's picture

Completely off topic, but on the home page, there is an open code tag, probably due to the teaser break that messes up the styling on this groups' home page.

Profiles as nodes

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week