Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForumForumNotification ForumsNotification Forums
Previous
 
Next
New Post
5/18/2011 10:01 AM
 
I use several Notification Forums to make announcements to different groups in our Scouting organization.  The forums are setup to email users that belong to a certain Role.  The problem that I have is if I add a user (solely for the purpose of sending e-mails) or a user registers and does not visit the forum page the forum will not send mail to that user.   What I have been doing for the last few years is running a report that I created, then for any user listed in the report I go to the Forum Administration page and view that user.  Once I do that, the forum will email the user.  

Here is the report that I run:
Select
  U.Username "Account",
  U.DisplayName "User Name",
  U.UserID      "Number",
  AM.Email      "E-Mail"
from
  aspnet_Membership as AM with (nolock)
  join aspnet_Users as AU with (nolock) on AM.UserID  = AU.UserID
  join Users        as U  with (nolock) on U.UserName = AU.Username
  join UserPortals  as UP with (nolock) on U.UserID   = UP.UserID
  join UserRoles    as UR with (nolock) on U.UserID   = UR.UserID
  join Roles        as R  with (nolock) on UR.RoleID  = R.RoleID and UP.PortalID = R.PortalID
where
  AM.ApplicationID  = ( select ApplicationID from dbo.aspnet_Applications where ApplicationName = 'DotNetNuke')
  and U.IsSuperUser = 'False'
  and R.RoleName    = 'Announcements'
  and UP.PortalID   = 3
  and not exists      ( select * from Forum_Users where UserID = U.UserID and PortalID = UP.PortalID )
order by
  U.UserID

My question is; Is there something I can schedule in DNN to add missing users to the forum instead of having to do this process manually?  I often forget to this and people do not get the email.

Thanks,
Greg 
 
New Post
5/19/2011 2:35 AM
 
What actually happens (as Greg pointed out) is that the forum_user record is not created until the user visits the forum once (or an admin finds the user via Forum Admin -> Users search and 'edits' their profile and by edit i mean view it within the forum itself). If you wanted to automate the process, you should just create a scheduled task (DNN Style) that basically runs the SQL that you run (perhaps as a cursor or return to your code and handle their) and then does an insert into the forum_users table (make sure you pass in portalid, userid and any other required fields for this insert). 

Chris Paterra

Get direct answers to your questions in the Community Exchange.
 
New Post
5/19/2011 9:45 PM
 
I am thinking the simple solution may be to add a database insert  trigger on the UserPortals table to run the Forum_User_Add procedure.
Thanks,
Greg Hart
 
New Post
5/20/2011 12:22 PM
 
Here is a solution until this is fixed.

USE [gahart]
GO
/****** Object:  Trigger [dbo].[AutoAddForumUser]    Script Date: 05/20/2011 12:16:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:  G A Hart
-- Create date: 05/20/2011
-- Description: Add user record to Forum to enable Notifcation forums to work correclty.
-- =============================================
CREATE TRIGGER [dbo].[AutoAddForumUser]
   ON  [dbo].[UserPortals]
   AFTER INSERT
AS
BEGIN
 SET NOCOUNT ON;
 DECLARE InsertedCursor CURSOR FOR SELECT UserID, PortalID FROM inserted
 DECLARE @UserID int
 DECLARE @PortalID int
 OPEN InsertedCursor
 FETCH NEXT FROM InsertedCursor INTO @UserID, @PortalID
 WHILE @@fetch_status = 0
  BEGIN
   IF EXISTS ( SELECT [PortalID] FROM dbo.Forum_Groups WHERE PortalID = @PortalID )
    BEGIN
     EXECUTE Forum_User_Add
      @UserID   = @UserID,
      @UserAvatar  = 0,
      @Avatar   = '',
      @AdditionalAvatars = '',
      @Signature  = '',
      @IsTrusted  = 0,
      @EnableOnlineStatus = 0,
      @ThreadsPerPage  = 10,
      @PostsPerPage  = 5,
      @EnablePublicEmail = 0,
      @PortalID  = @PortalID
    END
   FETCH NEXT FROM InsertedCursor into @UserID, @PortalID
  END
 CLOSE InsertedCursor
 DEALLOCATE InsertedCursor
END
GO

Greg Hart
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForumForumNotification ForumsNotification Forums


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out