Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am running v3.2.1 with the Boldy theme.
I have installed the Wordpress Download Monitor plugin to create a downloads gallery.

I asked for some assistance before on a good workflow for allowing our clients to download files from our wordpress site.
- I may need to better re=phrase that Q.

Workflow:
- Create a guest account (subscriber)
- Upload the product (zip) and add it to the gallery. - Make use of the 'Member Only file' tickbox, so that anyone not logged in wont be able to get file. - send an email out to our paying customers with credentials for guest account

That aside, the workflow has been rejected by our marketing team as its not a smooth process for end-users:

Problem:
- Email has link to login (wp-admin) - After logging in, they get re-directed to the wordpress dashboard. - They then have to navigate to the dl gallery and find the links to the download.

If you try and download the product when your not logged in, it will tell you:

You must be logged in to download this file. ← Back to Dekho Resource Center

Ideally there would be a looping re-direct to let you login and then download zip?

Looking for an answer that gives my users a slick way to download without getting lost along the way and minimising clicks.

share|improve this question
    
I honestly don't believe this is an appropriate use of WP - WP simply doesn't match this kind of functionality. –  AndrettiMilas Nov 28 '11 at 5:14
    
WP can certainly handle redirects. The process described is absolutely possible. That being said, you can edit questions though. Please do not post duplicates if the first one's answers are not satisfactory. Consider a bounty instead. Be so kind as to delete one of the questions. –  Johannes Pille Nov 28 '11 at 9:15
    
deleted other Q –  Simon Dec 2 '11 at 9:06
add comment

1 Answer

Try adding this to your theme's functions.php file

function Get_curPageURL() {
    $pageURL = 'http';
    if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
        $pageURL .= "://";
    if ($_SERVER["SERVER_PORT"] != "80") {
        $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
    } else {
        $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    }
    return $pageURL;
}


add_filter('gettext','custom_login_to_download_msg');

function custom_login_to_download_msg( $input ) {

    if( !is_admin() && 'You must be logged in to download this file. <br/><br/><a href="%1$s"><strong>?† Back to %2$s</strong></a>' == $input  )
        return 'You must be logged in to download this file. <br/><br/>
            <a href="<?php echo wp_login_url(Get_curPageURL()); ?>" title="Login"><Strong>Login To Download</Strong></a><br/><br/>
            <a href="%1$s"><strong>?† Back to %2$s</strong></a>';

    return $input;
}

Which should give you :

enter image description here

And the Login to Download Link will start the download automatically once they are logged in.

share|improve this answer
    
Looks promising, but still the client will login, and still have to navigate back to the download page (i.e. click out of the dashboard once logged in) right? –  Simon Dec 2 '11 at 9:07
1  
Nope, the user will be redirected automatically after the login to the download page. –  Bainternet Dec 2 '11 at 11:12
    
u da man! Let me implement over weekend, and ill report back... –  Simon Dec 2 '11 at 11:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.