I needed to tie in my Dynamic Registration with the AS Groups, so that when someone picks the type of group they want to be in, it fires an SQL event to add them.. so I just dug up the stored procedure called
Active_Social_Groups_members_add and used the logic in there:
USE [mydatabase]
GO
/****** Object: StoredProcedure [dbo].[activesocial_Groups_Members_Add] Script Date: 10/27/2009 12:53:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[activesocial_Groups_Members_Add]
@GroupId int,
@UserId int,
@MemberStatus int,
@Note nvarchar(1000),
@DateCreated datetime,
@DateApproved datetime = NULL
AS
IF NOT EXISTS(SELECT UserId FROM dbo.activesocial_Groups_Members WHERE GroupId = @GroupId AND UserId = @UserId)
BEGIN
INSERT INTO dbo.activesocial_Groups_Members
(GroupId, UserId, MemberStatus,Note,DateCreated,DateApproved)
VALUES
(@GroupId, @UserId, @MemberStatus,@Note,@DateCreated,@DateApproved)
END
Seems to work well enough. So you could write some code that reads their UserID via a querystring, and fire off that SQL. For security you might want to add a second querystring value with a unique code, so that people couldn't tamper with the URL and add other people to groups - an easy way to do this would be to give each user a GUID, which (if you're not using it otherwise) could be plunked into the "AffiliateCode" column of the DNN Users table.