WordPress.org

Forums

Email Before Download
[resolved] Don't need when user is logged in (7 posts)

  1. Manu-PB
    Member
    Posted 3 years ago #

    Hi,
    Thanks for this useful plugin.
    I wonder how I can bypass the Cf7 form when the user is already logged in (in this case, I do not need to catch his/her email address).
    Thanks for help

    http://wordpress.org/extend/plugins/email-before-download/

  2. Manu-PB
    Member
    Posted 3 years ago #

    Hi there,
    In CF7 there is the possibility to add "default values" in the form fields, this for EACH form. I modified the form as follows :

    <p>Votre nom (obligatoire) : [text* your-name default:user_display_name] </p>
    <p>Votre email (obligatoire) : [email* your-email default:user_email] </p>

    The form is still visible, but at least I will not bother the registered users....
    I am still interested in skipping the CF7 form if you find a solution.

  3. mandsconsulting
    Member
    Plugin Author

    Posted 3 years ago #

    Hi Manu-PB,

    Thanks your your note and updating your solution.

  4. williambennettiv
    Member
    Posted 2 years ago #

    Depending on what you are using that has users log in, there may be shortcode that hides/displays content ONLY for logged in users? For logged in users you can show a direct link and hide CF7...and for non-logged in users you can hide the direct link and show only the CF7. Just running into this scenario now, and will be testing it out to see how it works.

  5. Manu-PB
    Member
    Posted 2 years ago #

    @williambennettiv

    I have created a new shortcode which skips the CF7 form when user is logged in :

    Function show_download_link($article) {
    if ( is_user_logged_in() ) {
    $dlm_short = '[download id="' . $article[0] . '" format="format-coach"]';
    $affiche = '<br/><p>Cliquez sur ce lien pour visualiser le fichier : <span class="button-file-dl">' . do_shortcode ( $dlm_short ) . '</span></p></br>';
    }
    else {
    $ebd_short = '[email-download download_id="' . $article[0] . '" contact_form_id="460"]';
    $affiche = '<p>' . do_shortcode ( $ebd_short ) . '</p>';
    }
    return ( $affiche );
    }
    add_shortcode('my-dl-link', 'show_download_link');

    This must be added in the functions.php of your theme.
    Then use shortcode [my-dl-link Id] in your post.

    Hope it helps

  6. williambennettiv
    Member
    Posted 2 years ago #

    that looks good! I played around and am now using "Logged in User Shortcode" by Jack Lamb. Then I set up my code as follows:

    [loggedin]Since you are already logged in, here is the file: [download id="2" format="1"][/loggedin]
    [loggedout]We would really like to share this file with you -- would you please just share your email with us?
    [email-download download_id="2" contact_form_id="XXXX"][/loggedout]

    An extra step perhaps --- but I can customize what is shown to whom. And shouldnt have to re-update the functions file on a theme update.

  7. mandsconsulting
    Member
    Plugin Author

    Posted 2 years ago #

    Hi williambennettiv,

    Leveraging the "Logged in User Shortcode" plugin seems like a great idea for this use case. Nice find and thanks for sharing. And, Manu-PB, thank you again for all your inputs. Very nice to see the community helping each other!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Email Before Download
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic