Page 1 of 1

Manager purchasing logins for employees

PostPosted: March 26th, 2011, 9:32 pm
by natecroy
We are currently using s2Member Pro in the build of an online training service with Manager and Employee user levels. We are looking for a way that a Manager can purchase multiple logins for his/her employees with s2Member.

Here is our user level setup:

User Level 0 = Free (access to sample training content)
User Level 1 = Manager (access to employee reports and sample training content). Low recurring monthly fee.
User Level 2 = Employee (access to all training content). One time larger fee for 30-day access.

We would like a Manager to be able to purchase multiple Employee logins at any given time. An ideal workflow would be:

1. After logging in, a Manager clicks on an "add employees" button on his/her Login Welcome page leading to a Paypal Pro form
2. Paypal Pro form has a Quantity field where Manager enters 50 Employee logins
3. Manager enters credit card information for the entire transaction
4. 50 logins are sent to the Manager for distribution to employees (these could be access links, vouchers, or Paid Subscriber IDs that an Employee could update their free accounts with).

As our site sits now, a Manager would have to logout of their account and complete all Billing/Credit Card information (along w/ the Employee information) 50 times in order to get 50 logins. We're looking for an automated solution that doesn't involve admin intervention.

Any ideas for enabling a single user to purchase logins for additional user logins?

Thanks,

Nate

Re: Manager purchasing logins for employees

PostPosted: March 27th, 2011, 7:45 am
by Jason Caldwell
Hi Nate. Thanks for the excellent question.
Video
I've done a video tutorial for you covering this topic in detail.
Please let me know if you have any questions that I may have missed.

Please click this link to download/view the MP4 video file:
http://www.s2member.com/wp-content/uplo ... counts.mp4

Re: Manager purchasing logins for employees

PostPosted: March 27th, 2011, 2:14 pm
by natecroy
This has been one of the best customer service experiences I've ever had with a product, Jason. Thank you very much for the thorough video response, it is incredibly helpful. Your support on this forum is one of the biggest reasons why s2member is such a great product.

I'm going to start working through your solution on our site and get some programming help when necessary. One thing I may have missed in the video was how the block of 50 logins can be physically purchased. I'm guessing this would involve integrating a shopping cart alongside s2member. I've been a bit timid to invite another eCommerce solution to the party as it may cause conflicts with s2member. Any suggestions for a solution that plays well with s2member or can s2member help us purchase multiple logins in a single transaction?

Thanks for all of your help Jason,

Nate

Re: Manager purchasing logins for employees

PostPosted: March 31st, 2011, 12:37 am
by Jason Caldwell
Hi Nate. You're very welcome. This part of the video may help answer that.
I've set the video to start at the correct point for you.

Re: Manager purchasing logins for employees

PostPosted: May 19th, 2011, 1:23 pm
by natecroy
Hi Jason,

Believe it or not, we're actually very close to having this solution implemented. Thanks so much for the help a while back. Here's the latest from our programmer...

We're having some issues we don't understand with specific page purchases. The process is working great when I go through the purchase as an admin, but level 1 members (who we want using this) are redirected differently.

Here's what should happen:
User goes to /addabarista/ (this page isn't protected by member level or custom capabilities) and gets a purchase form
User completes purchase
User is forwarded to /thankyou-baristapurchase (the protected page; ID is 996; there are no protections other than the Specific Page Purchase protection)
When you go through the purchase as an admin, the process is flawless. When you try it as a Level 1 user, you're forwarded to /pricing?s2member_seeking=page-996&s2member_sp_req=996 after the successful purchase. I'm assuming those query vars mean the user isn't authorized to view the page.

Here's the code for that purchase form: https://gist.github.com/d5f820ce1ed80c12d86a

Any ideas?

If I can provide any additional info to help troubleshoot, please let me know.

Thanks!

Re: Manager purchasing logins for employees

PostPosted: May 19th, 2011, 1:36 pm
by Cristián Lávaque
Does the person have the level required to see the thankyou page when sent to it? If it has specific-page protection, then he'll only be able to access it with the link s2Member sends to him for it.

Re: Manager purchasing logins for employees

PostPosted: May 19th, 2011, 1:49 pm
by natecroy
The Thank you page is not restricted to a membership level, just the page protection. From Jason's video I thought he said not to restrict the Thank you page to a membership level.

Also, how do you use the success parameter with specific page purchases? Are we using it correctly?

Thanks Cristián!

Nate

Re: Manager purchasing logins for employees

PostPosted: May 19th, 2011, 4:14 pm
by Cristián Lávaque
I guess you're using the success attribute correctly or you would not be redirected to the page you specified. The problem is you're redirecting him to the protected page with a link that's not going to let him in, that one he'll get in an email.

You should have your custom thankyou page not be protected at all or he won't be able to see it after purchase, unless you protect with a level/ccap he has and is logged in with at the time of redirection. I hope that makes sense.

Re: Manager purchasing logins for employees

PostPosted: May 19th, 2011, 4:33 pm
by natecroy
Thanks for the response, Cristián! I don't know if I told you this already or not, but we're displaying the vouchers on the thank you page after purchase as well as emailing them. If we removed the Buy Now Post/Page protection and protected just by membership level, would that make the vouchers that display in page accessible to any user of that membership level?

Re: Manager purchasing logins for employees

PostPosted: May 19th, 2011, 4:50 pm
by Cristián Lávaque
I'm confused now... I think I'll watch that video again. :P

Re: Manager purchasing logins for employees

PostPosted: May 20th, 2011, 12:08 pm
by Cristián Lávaque
No, you shouldn't remove the specific-page protection and make it level restricted only.

What I'm saying is that you shouldn't send people to the sold page as the purchase thank-you. That page can only be accessed with the link that is sent to them by email, you can't just redirect them there with a simple link.

What I'm saying is that, if you want a thank-you page for the purchase, it should be another one than the one sold, where you can explain that they will get an email with a special link to the page where his vouchers are.

I hope that makes sense.

Re: Manager purchasing logins for employees

PostPosted: May 20th, 2011, 12:25 pm
by natecroy
Thanks Cristián, that makes sense.

Can we add custom query variables to the email sent to the customer containing the vouchers? If so, do you know how we would do that? We would need to add the quantity to the end of the link.

We really appreciate the help, Cristián. Thanks again.

Re: Manager purchasing logins for employees

PostPosted: May 20th, 2011, 1:53 pm
by Cristián Lávaque
Well, you can edit the confirmation email and use some replacement codes there. You'll find them in the PayPal Options page.

WP Admin -> s2Member -> PayPal Options -> Signup Confirmation Email (Standard)
WP Admin -> s2Member -> PayPal Options -> Signup Confirmation Email (Pro-Forms)
WP Admin -> s2Member -> PayPal Options -> Specific Post/Page Confirmation Email (Standard)
WP Admin -> s2Member -> PayPal Options -> Specific Post/Page Confirmation Email (Pro-Forms)


Does that help?

Re: Manager purchasing logins for employees

PostPosted: May 20th, 2011, 7:40 pm
by natecroy
Passing our quantity is where we're running into problems. Is there any way to pass query vars into the access URL?

Re: Manager purchasing logins for employees

PostPosted: May 23rd, 2011, 4:07 am
by Jason Caldwell
natecroy wrote:Passing our quantity is where we're running into problems. Is there any way to pass query vars into the access URL?

You might try something like this.
Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_filter
("ws_plugin__s2member_sp_access_link_gen_alternative", "my_sp_access_link_shrinker");
function my_sp_access_link_shrinker($raw_sp_access_link)
    {
        $raw_sp_access_link .= "&quantity=xx";
        return ($tinyurl = c_ws_plugin__s2member_utils_urls::remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($raw_sp_access_link)));
    }
?>
* Note, you MUST compress the link, making it smaller. If you don't make the link smaller using the tinyURL server ( or something equivalent ), s2Member will not use your generated link.

Re: Manager purchasing logins for employees

PostPosted: May 23rd, 2011, 10:03 am
by natecroy
Wonderful, Jason. Thank you and Cristián for all of your help!

Re: Manager purchasing logins for employees

PostPosted: August 5th, 2011, 4:44 pm
by dhempy
Nice to see this. I need the exact same feature. We'll be selling bulk licenses to schools for X number of students. The school will make a single purchase, then take responsibility for distributing the codes/accounts to students.

Let me see if I understand the video correctly:

The basic strategy is to have the employees (students) register as free users, but have a hook on the account creation to immediately upgrade their account, assuming they redeem a valid voucher. The separate manager account is not terribly critical to the vouchers, other than matching the original poster's marketing plan. You could go so far as to sell vouchers in a shopping cart, independent of s2member. Right?

Generating and validating the vouchers is beyond the scope of s2member, albeit there are hooks to support doing that. I missed where the vouchers get generated...I suppose that would be the result of the shopping cart purchase, pretty well unrelated to the manager's account. Yes?

I assume the developer (me) would write a script to create the 50 vouchers in the database and display/email the codes/links to the manager. Is there a hook on purchase completion using s2member's Buy Now forms where I could trigger that script?

On the voucher side of things, to be implemented by us, presumably the employee voucher would be linked to the manager's account, and perhaps other reports (developed locally) would show redemption status and such. Again, all this would occur outside s2member.

Did I get that pretty much right?


Now, the big question...is this something s2member is considering developing? While all this is within our development abilities, I'm looking to use as much off-the-shelf functionality as I can on this project.

Thanks,
-dave

Re: Manager purchasing logins for employees

PostPosted: August 6th, 2011, 1:00 pm
by Jason Caldwell
The basic strategy is to have the employees (students) register as free users, but have a hook on the account creation to immediately upgrade their account, assuming they redeem a valid voucher. The separate manager account is not terribly critical to the vouchers, other than matching the original poster's marketing plan. You could go so far as to sell vouchers in a shopping cart, independent of s2member. Right?
Yes, that's correct.

Generating and validating the vouchers is beyond the scope of s2member, albeit there are hooks to support doing that. I missed where the vouchers get generated...I suppose that would be the result of the shopping cart purchase, pretty well unrelated to the manager's account. Yes?


I assume the developer (me) would write a script to create the 50 vouchers in the database and display/email the codes/links to the manager. Is there a hook on purchase completion using s2member's Buy Now forms where I could trigger that script?
Yes, the generation of Voucher Codes and the validation of them, are both something that would need to be custom coded.

On the voucher side of things, to be implemented by us, presumably the employee voucher would be linked to the manager's account, and perhaps other reports (developed locally) would show redemption status and such. Again, all this would occur outside s2member.

Did I get that pretty much right?
Yes, you've got it.

Now, the big question...is this something s2member is considering developing? While all this is within our development abilities, I'm looking to use as much off-the-shelf functionality as I can on this project.
Perhaps in the future, but honestly, I wouldn't look for this to come anytime soon, as we are working to develop/further s2Member in other ways that are/will take precedence over this. Sorry.

Re: Manager purchasing logins for employees

PostPosted: August 8th, 2011, 9:00 am
by dhempy
Thanks for the quick reply, Jason! :-)

-dave

Re: Manager purchasing logins for employees

PostPosted: August 8th, 2011, 8:37 pm
by natecroy
Hi Dave,

I'm just getting caught up with this thread. We did end up creating the automated voucher system for one of our latest projects: http://www.newbarista.com. We did so while continuing to use s2member for payment, without the need to invite a shopping cart to the party. We sell Barista Training, so we also built a custom LMS (Learning Management System) for Wordpress that keeps the Manager/Owner accounts tied to Barista accounts along with tracking testing records. This may be of interest to you as well for your school accounts.

Jason and Cristián were a great help in supporting the s2member side of things and getting us started in a good direction. It was quite time consuming to get the entire voucher system programmed and tested. I've included some screen shots of how the voucher system appears on the front-end to a Manager/Owner. Our team is available if you need help building a similar voucher system for your site. You can get a hold of us through the Contact Us link on http://www.newbarista.com.

Thanks Dave,

Nate

voucher1.png
Manager Owner Dashboard on newbarista.com

voucher2.png
After clicking Add a Barista

voucher3.png
Payment page after adding 3 Baristas

voucher5.png
Voucher list from Manager/Owner Dashboard

voucher4.png
Wordpress Admin management of Vouchers
voucher4.png (19.77 KiB) Viewed 1182 times

Re: Manager purchasing logins for employees

PostPosted: August 9th, 2011, 11:42 am
by Cristián Lávaque
Well done, Nate! That looks pretty good. :)

Re: Manager purchasing logins for employees

PostPosted: August 9th, 2011, 11:50 am
by natecroy
Thanks Cristián! We've got a great team. Thanks again to you and Jason for your help in getting us started.

Re: Manager purchasing logins for employees

PostPosted: August 9th, 2011, 1:29 pm
by Cristián Lávaque
:)

Re: Manager purchasing logins for employees

PostPosted: August 9th, 2011, 4:24 pm
by ZebEl
@natecroy
I have also same problem described as Group membership http://www.primothemes.com/forums/viewtopic.php?f=4&t=14169&p=28874#p28874 and I think you solved it very well. Is there any chance if you would like to share any of your experince, code, etc.?

Re: Manager purchasing logins for employees

PostPosted: August 12th, 2011, 11:17 pm
by natecroy
Hi ZebEl,

I apologize for the late response. Yes we can share our experience, our team is available for contracting if you'd like some help.

Thanks,

Nate