Executing some code after a member has been created
Hi all,
I need to add some rows to a custom database after a member has been created, editted and deleted through the Umbraco API or through the backend interface.
I have a faint memory of being able to drop a .cs file into the app_data file with some methods overridden to hook into specific events...?
How would I go about doing this? Is there any documentation of which method scan be overridden?
Dont worry I solved it - I created a new class project, created a class that extended System.Web.Security.SqlMembershipProvider, overrode the create, update and delete members, called their superclasses, made the changes to my other database that I needed and returned the object that the super constructor gave me:
using System; using System.Collections.Generic; using System.Linq; using System.Text;
using System.Web; using System.Web.Security;
namespace MembershipProvider { public class Members : System.Web.Security.SqlMembershipProvider { public override System.Web.Security.MembershipUser CreateUser(string username, string password, string email, string passworrQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out System.Web.Security.MembershipCreateStatus status) { // create the user in the aspnet membership provider MembershipUser m = base.CreateUser(username, password, email, passwordQuestion, passwordAnswer, isApproved, providerUserKey, out status);
Thats great Michael, thanks. And to hook into these I just need to create a class which extends a namespace, then override the method I want to hook into? Then drop the .cs file into the app_data folder?
Basically you need to create a class that inherits from ApplicationBase, and then in the constructor you hook up whatever event you want. So your class should look something like this:
I'm not 100% sure but I think you will need to put this in a separate assembly that you then copy into your bin folder. I don't think it would work if it resides in app_data.
Executing some code after a member has been created
Hi all,
I need to add some rows to a custom database after a member has been created, editted and deleted through the Umbraco API or through the backend interface.
I have a faint memory of being able to drop a .cs file into the app_data file with some methods overridden to hook into specific events...?
How would I go about doing this? Is there any documentation of which method scan be overridden?
Thanks,
Max.
p.s. I am using the asp.net membership provider, not the out-of-the-box umbraco one and not a custom one.
Dont worry I solved it - I created a new class project, created a class that extended System.Web.Security.SqlMembershipProvider, overrode the create, update and delete members, called their superclasses, made the changes to my other database that I needed and returned the object that the super constructor gave me:
Hi Max,
Here you have a list of all the events you can hook up to: http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/overview-of-all-events
Cheers,
Michael.
Thats great Michael, thanks. And to hook into these I just need to create a class which extends a namespace, then override the method I want to hook into? Then drop the .cs file into the app_data folder?
Hi Max,
Basically you need to create a class that inherits from ApplicationBase, and then in the constructor you hook up whatever event you want. So your class should look something like this:
You can see a full example on this thread I just saw today : http://our.umbraco.org/forum/developers/extending-umbraco/33027-Page-Event-Button-In-Members-Sectio-%28editmemberaspx%29?p=0#comment121448
I'm not 100% sure but I think you will need to put this in a separate assembly that you then copy into your bin folder. I don't think it would work if it resides in app_data.
Hope this helps.
Cheers,
Michael.
Great, thanks very much for your help.
You're welcome :-)
Good luck!
Cheers,
Michael.
is working on a reply...