New Landing How can we help? Themeforest Theme Support Neighborhood MODIFY Contact 7 for mymail_snippet

Viewing 11 posts - 1 through 11 (of 11 total)
  • #115172
    jascin
    Member
    Post count: 47

    I am in dire need of help. Where do I put his into the theme http://pastebin.com/K26xZEy3
    I created four check-buttons in contact 7. The idea is that when one person use the contact form, there is a check mark list,wedding, engagement, portrait, and others, it will send an email autoresponder according to the option selected. When they use the contact form, they automatically are registered for my mail.

    Here’s the quick snippet that was provided.

    * requires a checkbox with the the name “newsletter” in your CF7
    */
    function wpcf7_my_validate( $result, $tag ) {
    $type = $tag[‘type’];
    $name = $tag[‘name’];

    if ( ‘newsletter’ == $name ) {
    $subscribe = isset($_POST[$name]);

    if(function_exists(‘mymail’) && $subscribe){
    $userdata = array(
    ’email’ => $_POST[’email’],
    ‘firstname’ => $_POST[‘firstname’],
    ‘lastname’ => $_POST[‘lastname’],
    );
    $list_ids = array(123, 456); // your list ids
    $overwrite = true;
    $subscriber_id = mymail(‘subscribers’)->add($userdata, $overwrite);
    if(!is_wp_error($subscriber_id)){
    mymail(‘subscribers’)->assign_lists($subscriber_id, $list_ids);
    }
    }
    }

    return $result;
    }
    add_filter( ‘wpcf7_validate_checkbox’, ‘wpcf7_my_validate’, 10, 2 );

    #115173
    jascin
    Member
    Post count: 47
    This reply has been marked as private.
    #115349
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please insert this code at functions.php of child theme. Its write place to put any custom php code. Make sure that you have activated child theme.
    Thanks
    With Best Regards
    Mohammad

    #115492
    jascin
    Member
    Post count: 47

    would this be the right approach.http://www.youtube.com/watch?v=Za5YAUMqWvo or here the direction i followed http://www.gregreindel.com/wordpress-custom-functions-file/

    this is the procedure i done.
    1. Create a folder within your child theme named “lib”
    2. Within the new “lib” folder, create a file named “my_functions.php”

    <?php

    /**
    * My Custom Functions
    */

    Save.
    3. Paste this code in your themes current functions.php file

    // Add My Custom Functions File
    include_once( get_stylesheet_directory() . ‘/lib/my_functions.php’ );

    Save.
    4. I added the this int my_functions.php

    * requires a checkbox with the the name “newsletter” in your CF7
    */
    function wpcf7_my_validate( $result, $tag ) {
    $type = $tag[‘type’];
    $name = $tag[‘name’];

    if ( ‘newsletter’ == $name ) {
    $subscribe = isset($_POST[$name]);

    if(function_exists(‘mymail’) && $subscribe){
    $userdata = array(
    ‘email’ => $_POST[’email’],
    ‘firstname’ => $_POST[‘firstname’],
    ‘lastname’ => $_POST[‘lastname’],
    );
    $list_ids = array(123, 456); // your list ids
    $overwrite = true;
    $subscriber_id = mymail(‘subscribers’)->add($userdata, $overwrite);
    if(!is_wp_error($subscriber_id)){
    mymail(‘subscribers’)->assign_lists($subscriber_id, $list_ids);
    }
    }
    }

    return $result;
    }
    add_filter( ‘wpcf7_validate_checkbox’, ‘wpcf7_my_validate’, 10, 2 );

    would this be correct? i put this under neighborhood. i don’t know whats a child theme.

    #115620
    jascin
    Member
    Post count: 47

    SCRATCH EVERYTHING! I finally know how to make a child theme. I am now procedding to “Please insert this code at functions.php of child theme” What should the functions.php hold?

    This is what i input

    <?php // Opening PHP tag – nothing should be before this, not even whitespace
    /*
    * requires a checkbox with the the name “newsletter” in your CF7
    */
    function wpcf7_my_validate( $result, $tag ) {
    $type = $tag[‘type’];
    $name = $tag[‘name’];

    if ( ‘newsletter’ == $name ) {

    $subscribe = isset($_POST[$name]);

    if(function_exists(‘mymail’) && $subscribe){
    $userdata = array(
    ’email’ => $_POST[’email’],
    ‘firstname’ => $_POST[‘firstname’],
    ‘lastname’ => $_POST[‘lastname’],
    );
    $list_ids = array(123, 456); // your list ids
    $overwrite = true;
    $subscriber_id = mymail(‘subscribers’)->add($userdata, $overwrite);
    if(!is_wp_error($subscriber_id)){
    mymail(‘subscribers’)->assign_lists($subscriber_id, $list_ids);
    }
    }
    }

    return $result;
    }
    add_filter( ‘wpcf7_validate_checkbox’, ‘wpcf7_my_validate’, 10, 2 );

    function getRefererPage( $form_tag )
    {
    if ( $form_tag[‘name’] == ‘referer-page’ ) {
    $form_tag[‘values’][] = $_SERVER[‘HTTP_REFERER’];
    }
    return $form_tag;
    }
    if ( !is_admin() ) {
    add_filter( ‘wpcf7_form_tag’, ‘getRefererPage’ );
    }

    Im slowly progressing. Thanks. i just need to figure this code out.

    #115622
    jascin
    Member
    Post count: 47

    My child theme is not functioning right….
    http://s28.postimg.org/79n5et6x9/child_theme_is_not_functioning_right.png

    CSS STYLE FILE I PUT

    /* LICENSE & DETAILS

    ==================================================

    Theme Name: Neighborhood

    Theme URI: http://neighborhood.swiftideas.net

    Description: A Retina Responsive Multi-Purpose WordPress Theme – Designed & Developed by Swift Ideas ( http://www.swiftideas.net )

    License: GNU General Public License version 3.0

    License URI: http://www.gnu.org/licenses/gpl-3.0.html

    Version: 1.93

    Author: Swift Ideas

    Author URI: http://www.swiftideas.net

    Template: neighborhood

    All files, unless otherwise stated, are released under the GNU General Public License

    version 3.0 (http://www.gnu.org/licenses/gpl-3.0.html)

    ==================================================

    */

    @import url(“../neignborhood/style.css”);

    #115685
    jascin
    Member
    Post count: 47

    BTW, can the Mymail snippet can be converted as a plugin? instead of making the child theme? my theme breaks when i activate the child theme.

    #115700
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You can use it as a plugin. Please refer this article http://www.hongkiat.com/blog/beginners-guide-to-wordpress-plugin-development/ to make the plugin as you want.
    Thanks 🙂
    With Best Regards
    Mohammad

    #115706
    jascin
    Member
    Post count: 47

    Thank, you so. I already went and did the following.

    here’s the code
    <?php // Opening PHP tag – nothing should be before this, not even whitespace
    /*
    Plugin Name: mymail-contact
    Plugin URI: crestviewphotography.com
    Description: Mymail
    Author: Jasper
    Author URI: http://net.tutsplus.com
    Version: 1.0
    /*
    /*
    * requires a checkbox with the the name “newsletter” in your CF7
    */
    function wpcf7_my_validate( $result, $tag ) {
    $type = $tag[‘type’];
    $name = $tag[‘name’];

    if ( ‘newsletter’ == $name ) {

    $subscribe = isset($_POST[$name]);

    if(function_exists(‘mymail’) && $subscribe){
    $userdata = array(
    ’email’ => $_POST[’email’],
    ‘firstname’ => $_POST[‘firstname’],
    ‘lastname’ => $_POST[‘lastname’],
    );
    $list_ids = array(123, 456); // your list ids
    $overwrite = true;
    $subscriber_id = mymail(‘subscribers’)->add($userdata, $overwrite);
    if(!is_wp_error($subscriber_id)){
    mymail(‘subscribers’)->assign_lists($subscriber_id, $list_ids);
    }
    }
    }

    return $result;
    }
    add_filter( ‘wpcf7_validate_checkbox’, ‘wpcf7_my_validate’, 10, 2 );

    function getRefererPage( $form_tag )
    {
    if ( $form_tag[‘name’] == ‘referer-page’ ) {
    $form_tag[‘values’][] = $_SERVER[‘HTTP_REFERER’];
    }
    return $form_tag;
    }
    if ( !is_admin() ) {
    add_filter( ‘wpcf7_form_tag’, ‘getRefererPage’ );
    }

    the problem i have is identifying what are the elements into the code. for example, what are those values the codes i bold. I’ve attach the codes i have. I need a little direction here.

    Attachments:
    You must be logged in to view attached files.
    #115712
    jascin
    Member
    Post count: 47

    would this be the right approach? I know making a plugin would take so much if i want it robust, but this is very specific and selective.

    #115728
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    It will work as you desire. So use without hesitation.
    Thanks
    Mohammad

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register