Community Support Forums — WordPress® ( Users Helping Users ) — 2011-06-21T14:58:36-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=10126 2011-06-21T14:58:36-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=21338#p21338 <![CDATA[Re: notify by email when file downloaded]]>
Code:
$user_info = $vars['user'];
$user_display_name = $user_info->display_name;

Statistics: Posted by sidera — June 21st, 2011, 2:58 pm


]]>
2011-06-20T22:20:17-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=21269#p21269 <![CDATA[Re: notify by email when file downloaded]]> $user->user_login?

Statistics: Posted by Cristián Lávaque — June 20th, 2011, 10:20 pm


]]>
2011-06-20T14:27:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=21238#p21238 <![CDATA[Re: notify by email when file downloaded]]>
Code:
$first_name = $vars["user->first_name"];
   $last_name = $vars["user->last_name"];


this is part of the var dump
Code:
[user] => WP_User Object ( [data] => stdClass Object ( [ID] => 1 [user_login] => paul [user_pass] => secrett. [user_nicename] => paul [user_email] => secret [user_url] => [user_registered] => 2011-06-02 19:05:22 [user_activation_key] => [user_status] => 0 [display_name] => paul [first_name] => [last_name] => [nickname

Statistics: Posted by sidera — June 20th, 2011, 2:27 pm


]]>
2011-06-20T03:36:03-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=21185#p21185 <![CDATA[Re: notify by email when file downloaded]]> You're very welcome.

There are many variables available with this Hook. As seen in the source code, you get all PHP variables defined within the scope of the Hook, at the precise point in which the Hook is fired by s2Member. Looking at the source code is probably the easiest way: viewtopic.php?f=40&t=9572&src_doc_v=110605#src_doc_line_175

Note how s2Member passes you the value of get_defined_vars(), as explained here in the Hook example: viewforum.php?f=40#src_doc_overview_description

Here is a quick example with some of the most useful variables:
Code:
<?php
add_action
("ws_plugin__s2member_during_file_download_access", "my_function");
function my_function($vars = array()){
    $user_id = $vars["user_id"];
    $file = $_GET["s2member_file_download"];
    $user = new WP_User($user_id);
    //print_r($user);
}
?>

Statistics: Posted by Jason Caldwell — June 20th, 2011, 3:36 am


]]>
2011-06-18T04:39:12-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=21090#p21090 <![CDATA[Re: notify by email when file downloaded]]>
I'll use one of those methods instead of the redirect.
the mail notification works with the hook you mentioned.

I have another question : what data is available during that event, to send in the email, like member name, file name, etc...?

thanks!

Statistics: Posted by sidera — June 18th, 2011, 4:39 am


]]>
2011-06-17T23:28:55-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=21067#p21067 <![CDATA[Re: notify by email when file downloaded]]>

Statistics: Posted by Cristián Lávaque — June 17th, 2011, 11:28 pm


]]>
2011-06-17T17:25:19-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=21046#p21046 <![CDATA[Re: notify by email when file downloaded]]> Thanks for the heads up Cristián.

Yea, this Hook is misleading, it's not the right one to use in this case. Sorry for any confusion in the name of this Hook, but this Hook is really only fired in special cases, which may occur whenever a download attempt is being re-routed in some way; not useful in this case though.

In fact, I wouldn't Hook into the s2Member download routine at all ( at least, not to perform a redirection ), because it could interfere with a successful delivery of the file itself. Instead, you might consider spawning a new window, or doing something else creative with the link itself. For instance, with Google Analytics, I recommend one of these methods:

Reference articles:
http://www.google.com/support/analytics ... swer=55529
http://www.google.com/support/googleana ... swer=55527
http://www.goodwebpractices.com/roi/tra ... cally.html

All of this being said, we are planning to create an API Notification for File Downloads, which will make new things possible, such as automatic email notifications and custom scripts that can receive the event as well. Look for this come to come in a future release. Until then, if you'd like to add this type of funcntionality yourself, you might try this Hook: ws_plugin__s2member_during_file_download_access

Also see documentation:
viewtopic.php?f=40&t=9134&src_doc_v=110605#src_doc_ws_plugin__s2member_during_file_download_access

Statistics: Posted by Jason Caldwell — June 17th, 2011, 5:25 pm


]]>
2011-06-16T18:26:38-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=20978#p20978 <![CDATA[Re: notify by email when file downloaded]]> Statistics: Posted by sidera — June 16th, 2011, 6:26 pm


]]>
2011-06-16T17:12:06-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=20967#p20967 <![CDATA[Re: notify by email when file downloaded]]>
By the way, you may be able to use the ws_plugin__s2member_after_file_download_access hook for the redirection to the thank-you page you mentioned. viewtopic.php?f=40&t=9572&src_doc_v=110605#src_doc_line_238

I hope that helps. :)

Statistics: Posted by Cristián Lávaque — June 16th, 2011, 5:12 pm


]]>
2011-06-16T16:23:56-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=20955#p20955 <![CDATA[Re: notify by email when file downloaded]]> Statistics: Posted by sidera — June 16th, 2011, 4:23 pm


]]>
2011-06-16T11:08:08-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=20927#p20927 <![CDATA[Re: notify by email when file downloaded]]>

Statistics: Posted by Cristián Lávaque — June 16th, 2011, 11:08 am


]]>
2011-06-16T09:32:39-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=20923#p20923 <![CDATA[Re: notify by email when file downloaded]]>
what if I want to redirect the user after the download to a thank you page, so Ican track the goal in google analytics?

Statistics: Posted by sidera — June 16th, 2011, 9:32 am


]]>
2011-06-15T19:25:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=20855#p20855 <![CDATA[Re: notify by email when file downloaded]]>
1. Person clicks on link to your custom script.
2. Custom script sends you an email.
3. Custom script forwards person to the file.
4. s2Member serves the file.

Statistics: Posted by Cristián Lávaque — June 15th, 2011, 7:25 pm


]]>
2011-06-15T19:17:54-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=20853#p20853 <![CDATA[Re: notify by email when file downloaded]]> viewtopic.php?f=40&t=9134&src_doc_v=110605 :)

Statistics: Posted by Cristián Lávaque — June 15th, 2011, 7:17 pm


]]>
2011-06-15T04:22:50-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=20826#p20826 <![CDATA[Re: notify by email when file downloaded]]> Statistics: Posted by sidera — June 15th, 2011, 4:22 am


]]>
2011-06-12T00:02:11-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=20583#p20583 <![CDATA[Re: notify by email when file downloaded]]> Statistics: Posted by Cristián Lávaque — June 12th, 2011, 12:02 am


]]>
2011-06-11T15:44:31-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10126&p=20571#p20571 <![CDATA[notify by email when file downloaded]]>
is there a way to send an email to the admin whenver a file is downloaded?

thanks

Statistics: Posted by sidera — June 11th, 2011, 3:44 pm


]]>