3 replies [Last post]
jprieto's picture
Offline
Joined: 11/09/2007
Juice: 79
Was this information Helpful?

I want to give a free ebook to anyone who register in my site

how can i indicate that in the cart? What are the steps?

since it seems that download files got to be connected to a product.

how can i accmplish this?

thanks

ps: registration in my site is FREE

------------------------------------------------------------------------------
Using the cart in WebARtSale.com -- a new site not yet in production
---------------------------------------------------------------------------

Shawn Conn's picture
Offline
Administrator
Joined: 08/07/2007
Juice: 916
Re: how can my members get a free download file AUTOMATICALLY up

I'm not sure how to execute abitrary PHP code (either through a module or otherwise) after a user registers but running the function:

<?php
_user_table_action
('allow', $fid, $uid);
?>

where $fid is the file id of the file in the uc_files table and $uid is the user id in the user table, will give the user the file specified by fid without having to mess with the cart or checkout.

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

jprieto's picture
Offline
Joined: 11/09/2007
Juice: 79
cool .... but where?

cool

where can i enter this code? i would like this function to run automatically each time a new user register.

which file can i place this is?

------------------------------------------------------------------------------
Using the cart in WebARtSale.com -- a new site not yet in production
---------------------------------------------------------------------------

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: cool .... but where?

It's not as simple as just placing the code, you'll need to extract the values of fid and uid within your block. Calling global $user and finding through SQL the value of fid (from the uc_files table) for your particular download.

Your best bet is to write a new module that hooks into hook_user, I think. Basically upon new user registration the module will get called and the file download gets generated (the fid, uid and pfid get added to uc_file_users table).

--
Help directly fund development: Donate via PayPal!