Actions performed upon signup

Discussion in 'Customization & add-ons' started by scott_wa1, Jun 15, 2009.

  1. scott_wa1

    scott_wa1 aMember Pro Customer

    Joined:
    Aug 22, 2006
    Messages:
    54
    hey guys!

    I have some tasks that I need to accomplish when a user signs up for the first time. I know this is nothing new, it's been asked here before! But I can't find any answers that help me. :(

    I have already reviewed this:
    http://manual.amember.com/Using_site.inc.php_and_hooks

    And I have already looked at the plugin_template in the protect folder.

    However I'm not sure if these will do what I want.

    I'm looking to perform an action (adding someone to a separate database) upon the initial signup - and ONLY on the initial signup. If they expire and come back later, it will not re-do the action. And if they delete/add new products and subscription, it will not re-do the action.

    In other words, it ONLY happens during the initial signup.

    From what I can tell, all the hooks and plugintemplate options will repeat the hook every time the status flips from '1' to '0' to '1', or whenever payments are added, etc...


    Can anyone help?


    -Scott Wang
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    Scott,
    You can use subscription_added or finish_waiting_payment hooks this does not matter.
    Just create any field in user profile for example
    Code:
    add_member_field('added_to_database', 'Added to database', 'text');
    
    Then in your hook check that field:
    Code:
    if(!$user['data']['added_to_database']){
        /// Add to database then update user's field    
        $user['data']['added_to_database']++;
        $db->update_user($user['member_id'], $user);
    }else{
    // do nothing
    }
    
  3. scott_wa1

    scott_wa1 aMember Pro Customer

    Joined:
    Aug 22, 2006
    Messages:
    54
    THank you very much Alexander!!

Share This Page