Contact Us form WeBid 1.2.* ONLY

adds a 'Contact Us' form which is emailed to the Administrators email address

  1. webcreations

    webcreations New Member

    Joined:
    Aug 24, 2013
    Messages:
    55
    Likes Received:
    0
    Thanks mod for adding a nice lines, without these lines this is incompelete.
     
  2. wesinternet

    wesinternet Donor Donor

    Joined:
    Nov 6, 2013
    Messages:
    6
    Likes Received:
    0
    Hello,

    I am trying to make this mod work in WeBid version 1.1.0 but when the form is filled out correctly and you press the Send button,
    an error message shows up and states the emailaddress entered is invalid.

    Would anyone know how to fix this?
    Thanks
     
  3. super_st

    super_st Well-Known Member

    Joined:
    Dec 2, 2012
    Messages:
    634
    Likes Received:
    141
    Been trying to get this to work. but i hit an error,

    I have already fixed a few things but could do with a little help to fix this
    Code:
    Fatal error: Class 'email_class' not found in /home/caredgec/public_html/caredge.co.uk/email_request_support.php on line 96
    Which is this section (i have *** the line in question)
    Code:
    if (empty($TPL_error_text))
    {
    $mes = $MSG['337'] . ': <i>' . $admin_nick . '</i><br><br>';
    $emailer = new email_class();    **********
    $emailer->assign_vars(array(
    'SENDER_NAME' => $user->user_data['name'],
    'SENDER_QUESTION' => $cleaned_question,
    'SUBJECT' => $cleaned_subject,
    'SENDER_EMAIL' => $user->user_data['email'],
    'SITENAME' => $system->SETTINGS['sitename'],
    'SITEURL' => $system->SETTINGS['siteurl'],
    'SELLER_NICK' => $admin_nick
    ));
    $page_title = $system->uncleanvars($page_title);
    $subject = $system->SETTINGS['sitename'] . ' ' . $page_title;
    $from_id = (!$user->logged_in) ? $_POST['sender_email'] : $user->user_data['id'];
    $id_type = (!$user->logged_in) ? 'fromemail' : 'sentfrom';
    $emailer->email_uid = $site_id;
    $emailer->email_sender($admin_email, 'email_request.inc.php', $subject);
    $emailer->email_sender($sender_email, 'email_request_copy_to_sender.inc.php', $subject);
    
    
    }
    }
    
     
  4. super_st

    super_st Well-Known Member

    Joined:
    Dec 2, 2012
    Messages:
    634
    Likes Received:
    141
    Sussed it, should be
    Code:
    $emailer = new email_handler();
    I will repackage mod and upload at somepoint, for others to use
     
  5. super_st

    super_st Well-Known Member

    Joined:
    Dec 2, 2012
    Messages:
    634
    Likes Received:
    141
    Added an updated version that should work with 1.1.1 and above.
    Have corrected a few issues and added some language code.
    Download, unzip and read instructions.
     

    Attached Files:

  6. icaro56

    icaro56 Member

    Joined:
    Jan 27, 2015
    Messages:
    35
    Likes Received:
    2
    super_st,

    how to allow user not logged to enter in Contact page?

    Thanks.
     
  7. nay27uk

    nay27uk Super Moderator Staff Member

    Joined:
    Nov 24, 2009
    Messages:
    5,573
    Likes Received:
    549
    r
    In email_request_support.php remove code
    PHP:
    if (!$user->is_logged_in())
    $_SESSION['REDIRECT_AFTER_LOGIN'] = 'email_request_support.php'header('location: login.php');
    exit;
    }
     
    icaro56 and super_st like this.
  8. super_st

    super_st Well-Known Member

    Joined:
    Dec 2, 2012
    Messages:
    634
    Likes Received:
    141
    Thanks nay :) although keeping it as user logged in May reduce unwanted spam emails

    Need something like this added to the github version as a contact us form is a must
     
    nay27uk likes this.
  9. icaro56

    icaro56 Member

    Joined:
    Jan 27, 2015
    Messages:
    35
    Likes Received:
    2
    Thanks nay.
     
  10. Alistair

    Alistair Donor Donor

    Joined:
    Jun 9, 2016
    Messages:
    38
    Likes Received:
    1
    Hi there. I havent installed Xampp yet so cant advise where the code is failing on my install of Webid 1.2 but when menu item contact is clicked no email form is instantiated.
    If I figure out where its faulting will advise.
    You may want to sort the information in the NEW SETTINGS and whats in the zip you got footer in zip and header in distro:

    Add link to footer menu:
    <li><a href="{SITEURL}email_request_support.php" alt="contact">{L_210}</a></li>
    Download the 'email_request_support.zip' from below
    Upload all of the files and folders you unpacked in step 2 if prompted by your FTP software select 'overwrite all' or 'Replace All'
    Open 'global_header.tpl' and on line 85 find code
    <li><a href="{SITEURL}faqs.php" alt="faqs" class="new-window">{L_148}</a></li>
    Directly bellow this add code
    <li><a href="{SITEURL}email_request_support.php" alt="contact">Contact Us</a></li>
     
  11. Shaman

    Shaman Active Member

    Joined:
    Feb 8, 2016
    Messages:
    166
    Likes Received:
    33
    If WeBiв version 1.2.1:
    1. in line 26 "email_request_support.php" chenge "if (!$user->is_logged_in())" to "if (!$user->logged_in)"
    2. in line 19 "include $main_path . 'inc/captcha/recaptchalib.php';" to "include PACKAGE_PATH . 'recaptcha/recaptcha.php';"
    3. in line 23 "include $main_path . 'inc/captcha/securimage.php';" to include PACKAGE_PATH . 'captcha/securimage.php';
    to Russian user:
    при использовании версии скрипта 1.2.1, замените данные на указанные выше.
    + не забывайте в RU внести переведенные записи, аналогично внесению в EN
     
    Last edited: Oct 27, 2016
    nay27uk likes this.
  12. Shaman

    Shaman Active Member

    Joined:
    Feb 8, 2016
    Messages:
    166
    Likes Received:
    33
    I want to add. The previous post works if you want you can write only registered users.
    If you have that wrote all, the rows from 26 to 31 it is necessary either to remove or to put a ban on the execution in file "email_request_support.php"
    To Russain users.
    Перевожу по быстрому.
    Изначально весь файл настроен на то, что обратной связью могут воспользоваться только зарегистрированные пользователи.
    Что бы воспользоваться системой обратной связи мог любой пользователь, заремарьте или удалите, на мой взгляд проще заремарить, строки с 26 по 31-ю в файле "email_request_support.php".
    Ну и не забудьте внести изменения в .tpl в соответствии с требуемым вам видом :).
     
    Last edited: Oct 27, 2016
  13. Shaman

    Shaman Active Member

    Joined:
    Feb 8, 2016
    Messages:
    166
    Likes Received:
    33
    En:
    File "email_request_support.php" modified to WeBid version 1.2.1.
    Tested with 2 types of captchas.
    Ru:
    Готовый файл для версии 1.2.1.
    Проверено с 2 видами капчи.
     

    Attached Files:

  14. Shaman

    Shaman Active Member

    Joined:
    Feb 8, 2016
    Messages:
    166
    Likes Received:
    33
    En: If anyone is interested, .tpl to themes modern version of webid 1.2.1. The screenshots also make...
    Ru: Если вдруг кому надо. Кладу .tpl сделанный под Тему Модерн, для webid 1.2.1. Cкриншоты так же прикладываю....
     

    Attached Files:

  15. Dominik

    Dominik New Member

    Joined:
    Dec 28, 2015
    Messages:
    17
    Likes Received:
    1
    Nice work Shaman, but i have some problem with this. When i try to send email without registration (unregistered user), the system say "Please, insert a valid e-mail address". With registred user everything works... i try to resolve this problem by myself but im not to strong with PHP. Please help.
    Best Regards
    Dominik
     
  16. Shaman

    Shaman Active Member

    Joined:
    Feb 8, 2016
    Messages:
    166
    Likes Received:
    33
    @Dominik
    In the near future will check
     
  17. Shaman

    Shaman Active Member

    Joined:
    Feb 8, 2016
    Messages:
    166
    Likes Received:
    33
    @Dominik
    It is possible that some sort of configuration on my server does not allow to obtain a version of your error.
     
  18. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
    i have update this to suit 1.2.1 and Modern theme

    Just replace all in the email_request_support_form.tpl with this
    Code:
    <script type="text/javascript">
    function SubmitFriendForm(){
        document.friend.submit();
    }
    function ResetFriendForm(){
        document.friend.reset();
    }
    </script>
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="well">
                <legend>
                    {PAGE_TITLE}
                </legend>
    <!-- IF MESSAGE ne '' -->
            <div class="padding">
                {MESSAGE}
            </div>
    <!-- ELSE -->
            <!-- IF ERROR ne '' -->
            <div class="alert alert-danger" role="alert">
                {ERROR}
            </div>
            <!-- ENDIF -->
                <form class="form-horizontal" name="sendemail" action="email_request_support.php" method="post">
                    <input type="hidden" name="csrftoken" value="{_CSRFTOKEN}"/>
                   
                     <div class="form-group catsearch">
                        <label class="col-sm-4 control-label">{L_econ001}</label>
                        <div class="col-sm-8">
                        <select class="contactSelector">
                        <option class="input" onclick="this.form.subject.value=this.value;" value="" selected="true">Choose a Subject:</option>
                        <option class="input" onclick="this.form.subject.value=this.value;" value="Request a new Category">Request a new Category</option>
                        <option class="input" onclick="this.form.subject.value=this.value;" value="Site Suggestions">Site Suggestions</option>
                        <option class="input" onclick="this.form.subject.value=this.value;" value="General Enquiry">General Enquiry</option>
                        <option class="input" onclick="this.form.subject.value=this.value;" value="Error">Error</option>
                        </select>
                        </div>
                    </div>
        <!-- IF B_LOGGED_IN eq false -->
                    <div class="form-group">
                        <label class="col-sm-4 control-label">{L_006}</label>
                        <div class="col-sm-8">
                           <input class="form-control" type="text" name="sender_email" size="40" value="{SENDER_EMAIL}"/>
                        </div>
                    </div>
        <!-- ENDIF -->
            <!-- your email -->
                    <div class="form-group">
                        <label class="col-sm-4 control-label">{L_002}</label>
                        <div class="col-sm-8">
                            <input class="form-control" type="text" name="sender_name" size="40" value="{YOURUSERNAME}"/>
                        </div>
                    </div>
            <!-- comment -->
                    <div class="form-group">
                        <label class="col-sm-4 control-label">Subject:</label>
                        <div class="col-sm-8">
                            <input  class="form-control" type="text" name="subject" size="40" value="{SUBJECT}" placeholder="Choose a subject from the dropdown list."/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">{L_650}</label>
                        <div class="col-sm-8">
                            <textarea class="form-control" rows="7" name="sender_question">{SELLER_QUESTION}</textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label"></label>
                        <div class="col-sm-8">
                           <div class="capchaForm">{CAPCHA}</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="text-center">
                            <input type="hidden" name="admin_email" value="{ADMIN_EMAIL}"/>
                            <input type="hidden" name="action" value="{L_106}"/>
                            <input type="submit" name="" value="{L_5201}"  class="btn btn-primary"/>
                       
                            <!-- IF B_LOGGED_IN -->
                            <input type="hidden" name="sender_email" size="25" value="{EMAIL}"/>
                            <!-- ENDIF -->
                            <input type="reset" name="" value="{L_035}" class="btn btn-primary"/>
                        </div>
                    </div>
                </form>
    <!-- ENDIF -->
            </div>
        </div>
    </div>
    and replace all in email_request_support.php with this,
    PHP:
    <?php
    /***************************************************************************
    *   copyright                : (C) 2008, 2009 WeBid
    *   site                    : http://www.webidsupport.com/
    ***************************************************************************/

    /***************************************************************************
    *   This program is free software; you can redistribute it and/or modify
    *   it under the terms of the GNU General Public License as published by
    *   the Free Software Foundation; either version 2 of the License, or
    *   (at your option) any later version. Although none of the code may be
    *   sold. If you have been sold this script, get a refund.
    ***************************************************************************/

    include 'common.php';

    // check recaptcha is enabled
    if ($system->SETTINGS['spam_register'] == 2)
    {
        include 
    PACKAGE_PATH 'recaptcha/recaptcha.php';
    }
    elseif (
    $system->SETTINGS['spam_register'] == 1)
    {
        include 
    PACKAGE_PATH 'captcha/securimage.php';
    }

    if (!
    $user->checkAuth())
    {
        
    $_SESSION['REDIRECT_AFTER_LOGIN'] = 'email_request_support.php';
        
    header('location: user_login.php');
        exit;
    }
    $spam_html '';

        if (
    $system->SETTINGS['spam_register'] == 1)
            {
                
    $resp = new Securimage();
                
    $spam_html $resp->show_html();
            }

        
    $site_id $system->SETTINGS['sitename'];
        
    $page_title $MSG['econ006'];
        
    $admin_nick $MSG['econ007'];
        
    $admin_email $system->SETTINGS['adminmail'];
        
    $sender_email $user->user_data['email'];


    if (isset(
    $_POST['action']) || !empty($_POST['action']))
    {
        
    $cleaned_question $system->cleanvars($_POST['sender_question']);
        
    $cleaned_subject $system->cleanvars($_POST['subject']);
        if (
    $system->SETTINGS['wordsfilter'] == 'y')
        {
            
    $cleaned_question $system->filter($cleaned_question);
            
    $cleaned_subject $system->filter($cleaned_subject);     
        }
       
        
    // Check errors
        
    if (isset($_POST['action']) && (!isset($_POST['sender_name']) || !isset($_POST['sender_email']) || empty($admin_nick) || empty($admin_email) || empty($sender_email)))
        {
            
    $TPL_error_text $ERR_032;
        }

        if (empty(
    $cleaned_question))
        {
            
    $TPL_error_text $ERR_031;
        }
       
        if (empty(
    $cleaned_subject))
        {
            
    $TPL_error_text $ERR_031;
        }

        if (isset(
    $_POST['action']) && (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i'$_POST['sender_email']) || !preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i'$admin_email) || !preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i'$sender_email)))
        {
            
    $TPL_error_text $ERR_008;
        }

        if (
    $system->SETTINGS['spam_register'] == 2)
            {
                
    $recaptcha_response = (isset($_POST['g-recaptcha-response'])) ? $_POST['g-recaptcha-response'] : '';
                
    $resp recaptcha_check_answer($system->SETTINGS['recaptcha_private'], $recaptcha_response);
            }

            if (
    $system->SETTINGS['spam_register'] == && !$resp)
            {
                
    $ERR $MSG['752'];
            }
            elseif (
    $system->SETTINGS['spam_register'] == && !$resp->check($_POST['captcha_code']))
            {
                
    $ERR $MSG['752'];
            }
           

        if (empty(
    $TPL_error_text))
        {
            
    $mes $MSG['337'] . ': <i>' $admin_nick '</i><br><br>';
            
    $emailer = new email_handler();
            
    $emailer->assign_vars(array(
                    
    'SENDER_NAME' => $user->user_data['name'],
                    
    'SENDER_QUESTION' => $cleaned_question,
                    
    'SUBJECT' => $cleaned_subject
                    
    'SENDER_EMAIL' => $user->user_data['email'],
                    
    'SITENAME' => $system->SETTINGS['sitename'],
                    
    'SITEURL' => $system->SETTINGS['siteurl'],
                    
    'SELLER_NICK' => $admin_nick
                    
    ));
            
    $page_title $system->cleanvars($page_title);
            
    $subject $system->SETTINGS['sitename'] . ' ' $page_title;
            
    $from_id = (!$user->logged_in) ? $_POST['sender_email'] : $user->user_data['id'];
            
    $id_type = (!$user->logged_in) ? 'fromemail' 'sentfrom';
            
    $emailer->email_uid $site_id;
            
    $emailer->email_sender($admin_email'email_request.inc.php'$subject);
            
    $emailer->email_sender($sender_email'email_request_copy_to_sender.inc.php'$subject);


        }
    }

    $template->assign_vars(array(
            
    'MESSAGE' => (isset($mes)) ? $mes '',
            
    'ERROR' => (isset($TPL_error_text)) ? $TPL_error_text '',
            
    'ADMIN_NICK' => $admin_nick,
            
    'ADMIN_EMAIL' => $system->SETTINGS['adminmail'],
            
    'SENDER_EMAIL' => $user->user_data['email'],
            
    'SELLER_QUESTION' => (isset($_POST['sender_question'])) ? $_POST['sender_question'] : '',
            
    'PAGE_TITLE' => $page_title,
            
    'CAPCHA' => ($system->SETTINGS['spam_register'] == 2) ? recaptcha_get_html($system->SETTINGS['recaptcha_public']) : $spam_html,
            
    'EMAIL' => $user->user_data['email']
            ));


    include 
    'header.php';
    $template->set_filenames(array(
            
    'body' => 'email_request_support_form.tpl'
            
    ));
    $template->display('body');
    include 
    'footer.php';
    ?>
     
  19. super_st

    super_st Well-Known Member

    Joined:
    Dec 2, 2012
    Messages:
    634
    Likes Received:
    141
    Thanks i will test this out and then update the download package with new version over next few days :)

    I have not been around for a while, :S
     
    BabyDunk likes this.
  20. super_st

    super_st Well-Known Member

    Joined:
    Dec 2, 2012
    Messages:
    634
    Likes Received:
    141

Share This Page