Results 1 to 9 of 9

Thread: Contact Form on user page

  1. #1
    Thread Starter
    Rookie bostonlogic's Avatar
    Join Date
    Aug 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Contact Form on user page

    I'm trying to add a contact form on the user page(the author.php template), to allow people to contact users. I tried copying the form from the sidebar in the ad template (see below), but I'm not sure how to tweak it to get it working, if it is even possible. Has anyone tried this, or have any ideas? Thanks

    Code:
    <?php
    
    /**
     * This is the sidebar contact form used on the single ad page
     *
     */
    
    $msg = '';
    
    // if contact form has been submitted, send the email
    if (isset($_POST['submit']) && $_POST['send_email'] == 'yes') {
    
        // get the submitted math answer
        $rand_post_total = (int)$_POST['rand_total'];
    
        // compare the submitted answer to the real answer
        $rand_total = (int)$_POST['rand_num'] + (int)$_POST['rand_num2'];
    
        // if it's a match then send the email
        if ($rand_total == $rand_post_total) {
            cp_contact_ad_owner_email($post->ID);
            $msg = '<p class="green center"><strong>' . __('Your message has been sent!', 'cp') . '</strong></p>';
        } else {
            $msg = '<p class="red center"><strong>' . __('ERROR: Incorrect captcha answer', 'cp') . '</strong></p>';
        }
    
    }
    
    ?>
    
    
       <form name="mainform" id="mainform" class="form_contact" action="#priceblock2" method="post" enctype="multipart/form-data">
    
           <?php echo $msg; ?>
    
           <p class="contact_msg"><?php _e('To inquire about this ad listing, complete the form below to send a message to the ad poster.', 'cp') ?></p>
    
            <ol>
                <li>
                    <label><?php _e('Name:', 'cp') ?></label>
                    <input name="from_name" id="from_name" type="text" minlength="2" value="<?php if(isset($_POST['from_name'])) echo stripslashes($_POST['from_name']); ?>" class="text required" />
                    <div class="clr"></div>
                </li>
    
                <li>
                    <label><?php _e('Email:', 'cp') ?></label>
                    <input name="from_email" id="from_email" type="text" minlength="5" value="<?php if(isset($_POST['from_email'])) echo stripslashes($_POST['from_email']); ?>" class="text required email" />
                    <div class="clr"></div>
                </li>
    
                <li>
                    <label><?php _e('Subject:', 'cp') ?></label>
                    <input name="subject" id="subject" type="text" minlength="2" value="<?php _e('Re:', 'cp') ?> <?php the_title();?>" class="text required" />
                    <div class="clr"></div>
                </li>
    
                <li>
                    <label><?php _e('Message:', 'cp') ?></label>
                    <textarea name="message" id="message" rows="" cols="" class="text required"><?php if(isset($_POST['message'])) echo stripslashes($_POST['message']); ?></textarea>
                    <div class="clr"></div>
                </li>
    
                <li>
                    <?php
                    // create a random set of numbers for spam prevention
                    $randomNum = '';
                    $randomNum2 = '';
                    $randomNumTotal = '';
                    
                    $rand_num = rand(0,9);
                    $rand_num2 = rand(0,9);
                    $randomNumTotal = $randomNum + $randomNum2;
                    ?>
                    <label><?php _e('Sum of', 'cp') ?> <?php echo $rand_num; ?> + <?php echo $rand_num2; ?> =</label>
                    <input name="rand_total" id="rand_total" type="text" minlength="1" value="" class="text required number" />
                    <div class="clr"></div>
                </li>
    
                <li>
                    <input name="submit" type="submit" id="submit_inquiry" class="btn_orange" value="<?php _e('Send Inquiry','cp'); ?>" />
                </li>
    
            </ol>
    
            <input type="hidden" name="rand_num" value="<?php echo $rand_num; ?>" />
            <input type="hidden" name="rand_num2" value="<?php echo $rand_num2; ?>" />
            <input type="hidden" name="send_email" value="yes" />
    
       </form>

  2. #2
    Marketplace Seller ahikmahin's Avatar
    Join Date
    Aug 2010
    Location
    Australia
    Posts
    504
    Thanks
    32
    Thanked 52 Times in 42 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. #3
    Thread Starter
    Rookie bostonlogic's Avatar
    Join Date
    Aug 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  4. #4
    Junior Member jvtraydz's Avatar
    Join Date
    Aug 2010
    Location
    San Diego, CA
    Posts
    29
    Thanks
    2
    Thanked 6 Times in 6 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #5
    Thread Starter
    Rookie bostonlogic's Avatar
    Join Date
    Aug 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  6. #6
    Thread Starter
    Rookie bostonlogic's Avatar
    Join Date
    Aug 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  7. #7
    Rookie rugbuzz's Avatar
    Join Date
    Sep 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  8. #8
    Member samanders's Avatar
    Join Date
    Jan 2011
    Location
    London UK
    Posts
    99
    Thanks
    17
    Thanked 11 Times in 9 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  9. #9
    Rookie rugbuzz's Avatar
    Join Date
    Sep 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. BCC Ad Contact Form
    By Cyrus in forum Help Using ClassiPress
    Replies: 1
    Last Post: May 13th, 2010, 06:21 PM
  2. Remove the contact form on item page
    By howiej in forum ClassiPress General Discussion
    Replies: 2
    Last Post: May 5th, 2010, 03:37 PM
  3. Remove the contact form on item page
    By howiej in forum Help Using ClassiPress
    Replies: 0
    Last Post: December 31st, 1969, 07:00 PM