RDO wrote
CJ,
From your post, it looks like you have figured out how to do what I am trying to figure out. I am needing a way to allow users to pay for a subscription, and on confirmation, have them automatically added to a role. I was looking at the integrated DNN method, but I do not like that it can not be displayed on any page. Also, I want to be able to input the role name dynamically instead of a list of them. (The site is going to have MANY different roles)
I have been trying to look at the files in the admin/sales folder but I have not been able to pick apart how to recreat the funcionality of having a button send the info to paypal and get the response back.
Can you please provide any info/tips/code examples/links to documentation/anything
Thanks
The way I have things running now (I'm using VWD Express 08 for writing code):
I have a module that contains the following an ImageButton labeled "Join" (Subscribe) whose properties for "onclick" calls the following:
--------------------
Protected Sub RegisterandJoin(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnJoin.Click
If Not IsInRole("Members") Then
'Determine RoleID for appropriate Role name to subscribe user to
Dim objRoles As New RoleController
Dim objroleinfo As RoleInfo = objRoles.GetRoleByName(PortalSettings.PortalId, "Members")
If IsInRole("Registered Users") Then
'If user is already a 'Registered User' but not in a subscription based role, then send the user directly to PayPal to purchase membership.
Response.Redirect("http://www.yourdomain.com/admin/sales/paypalsubscription.aspx?roleID=" & HTTPPOSTEncode(objroleinfo.RoleID))
Else
'Send the user to registration page then to PayPal to purchase membership.
Response.Redirect("http://www.yourdomain.com/Home/tabid/36/ctl/Register/Default.aspx?returnurl=%2fadmin%2fsales%2fpaypalsubscription.aspx?roleID=" & HTTPPOSTEncode(objroleinfo.RoleID))
End If
End If
End Sub
-------------------------
It is possible to write all of the 'create user' code by using the core DNN objects, which is what I did until I realized I could just redirect the user to the regular DNN Registration page, which will accept a "returnURL" string. That 'returnURL' string can be used to call the PayPalSubscription.aspx which accepts the RoleID of the role that you want to add the user to once they are registered. The registration URL will be different according to your domain. You can find the URL for your domain by clicking on the "Register" link and simply copy the address from the address bar.
I'm not sure what you mean about entering dynamic roles to have the user subscribed to -- do you want to have a dropdown list, button list, certain roles according to certain pages, etc? If you can find a way to nail down which role the user will be subscribed to, you can adjust the "Dim objroleinfo As RoleInfo = objRoles.GetRoleByName(PortalSettings.PortalId, "Members")" line to be changed to the correct role name (Members in my case) according to the appropriate situation.
OTOH, you can simply put the RoleID directly into "paypalsubscription.aspx?roleID=" & HTTPPOSTEncode(objroleinfo.RoleID))" without having to use the objRoleInfo stuff. I like to determine the roleID each time to prevent any future mishap if the database gets shuffled around.
If you're using VWD 08, one handy tool I found was the "Object Browser" (View -> Object Browser). That lists all of the DNN and .NET objects availabe in your website. It has come in very handy over the past few weeks.
If you have any more questions, feel free to ask. There doesn't seem to be much info available out there regarding this area of DNN.
CJ