Welcome to Geeklog, Anonymous Saturday, November 23 2024 @ 11:00 pm EST

Geeklog Forums

PHP Block: Refer a Friend


Status: offline

Tony

Site Admin
Admin
Registered: 12/17/01
Posts: 405
Location:Urbandale, Iowa
On my site, Iowa Outdoors, I have PHP Block that allows users to refer a friend to the site. Adding this to your Geeklog 1.3 site is simple (note, you probably won't see the block because I set the permissions so that anonymous users can't use it so create an account if you absolutely must see it in action).
  • First, add this code to your lib-custom.php (be sure to edit the email message that gets sent as it is worded for my needs now.
  • Then go to your admin/block.php and create a new PHP Block and be sure to point it to your function.

    That's it! This function does keep track of the number of referrals made. If you would like that statistic to show up on stats.php you can add it yourself. The number of referals is stored in the vars table where the name is 'num_site_referrals'

    e.g.
    SELECT value FROM vars WHERE name = 'num_site_referrals';

    For those interested, this code emails the following text:

    This message was sent to you by Tony at tony@iowaoutdoors.org because they thought you would be interested in learning more about a great Hunting & Fishing website called Iowa Outdoors! Iowa Outdoors is a not-for-profit website with the only focus being to make you and others better at their outdoor pursuits. Get a wide variety of information, tips, tactics on fishing, hunting, trapping and much more by visiting Iowa Outdoors at http://www.iowaoutdoors.org today!
    ------------------------------------------------------------
    NOTE: This is not unsolicited mail. You received this message because someone specifically requested that you do. Your email address was not saved and will not be given out under any circumstance.

    Hope that helps!


    The reason people blame things on previous generations is that there's only one other choice.
  •  Quote

    austad

    Anonymous
    I added the following code to make it so I can leave this block visible to anonymous users. This way, if they want to use it, it will force them to create an account.

    After the first if statement in the patch, add:
    if (!$_USER['uid']) {
    $msg = 'You must be a member to use this feature. Please log in, or create a free account.';
    } else {

    And then at the end, make sure to close out the "else" right after the section that updates the count for the number of referrals. You can see how it works at Brewtus.com.

     Quote

    Status: offline

    squatty

    Forum User
    Full Member
    Registered: 01/21/02
    Posts: 269
    How does the code know what mail server to use? I have it running on my site but, none of the referral emails are getting sent? I don't receive any error messages. Just never get the "success" message.
    In a world without walls and fences, who needs Windows and Gates?
     Quote

    Anonymous

    Anonymous
    I think it uses the system sendmail program (or wrapper). If you don't have a sendmail binary on your machine, this may be why it doesn't work. Make sure your mailserver is running also.
     Quote

    Status: offline

    racooper

    Forum User
    Junior
    Registered: 03/13/04
    Posts: 24
    Reviving an ancient thread here....

    I have made some modifications to the original referral block, and am releasing them for whoever finds it useful.


    [QUOTE=readme.txt]
    UPDATES/CHANGES:
    -- 10 Nov 2005
    * Moved customization variables to plugins/referral/conf.php
    * modified location of files
    * corrected spelling errors in all files (including function names)
    * updated email validation to use Geeklog's COM_isEmail function
    * moved block function to it's own file plugins/referral/functions.php
    * removed COM_refresh from error messages so they can be read
    * Changed outgoing mailer to use Geeklog's COM_mail
    [/QUOTE]

    Download Link
     Quote

    All times are EST. The time is now 11:00 pm.

    • Normal Topic
    • Sticky Topic
    • Locked Topic
    • New Post
    • Sticky Topic W/ New Post
    • Locked Topic W/ New Post
    •  View Anonymous Posts
    •  Able to post
    •  Filtered HTML Allowed
    •  Censored Content