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 ForumsMapMapShow users in one role?Show users in one role?
Previous
 
Next
New Post
3/15/2009 10:02 PM
 

Hi,

Is there a way to have the map module just show the users from one role? Say for example,  members of one usergroup or "paid members".  I have not been able really see how to get this type of thing to work

Thanks,

Greg

 
New Post
3/16/2009 12:10 AM
 

For what it's worth...   I've gotten this to work. 

I ended up generating a stored procedure (maybe I'll optimize it later, but it's late now and I want to catch some ZZZ...)  I you don't know what a stored procedure is or how to make one, then you should contact a database programmer to help you out on this one.

OK  -  The stored procedure reads from the user and role tables in the DNN database.  Only the users in a specific role and portal are selected from the data.  The user data is then used to drive a cursor to collect data from the profile table for each UserID and pop it all into a temporary table.

The data in the temporary table is then put into the Map_Points table, filling in what I think are the required fields.  For each map point, the Description field is filled with the user's name, company, address and contact info.

Once I run this stored procedure, I then run the geolocator function and it creates all the latitude and longitude points.

Easy huh?

Have Fun,

Greg

Here's the code -


SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.Update_MapUser_List
AS
DECLARE @UserID Int
DECLARE @FirstName VarChar(128)
DECLARE @LastName VarChar(128)
DECLARE @FarmName VarChar(255)
DECLARE @FarmPhone VarChar(32)
DECLARE @Address VarChar(255)
DECLARE @Street VarChar(255)
DECLARE @City VarChar(255)
DECLARE @State VarChar(255)
DECLARE @ZipCode VarChar(255)
DECLARE @WebSite VarChar(255)
DECLARE @Email VarChar(255)

DECLARE @myTable TABLE
(
UserID Int,
FirstName VarChar(128),
LastName VarChar(128),
FarmName VarChar(255),
FarmPhone VarChar(32),
Address VarChar(255),
WebSite VarChar(255),
Email VarChar(255)
)

declare myUsers cursor read_only
For
SELECT dbo.Users.UserID, dbo.Users.Email
FROM dbo.Users INNER JOIN
dbo.UserPortals ON dbo.Users.UserID = dbo.UserPortals.UserId INNER JOIN
dbo.UserRoles ON dbo.Users.UserID = dbo.UserRoles.UserID
WHERE (dbo.UserPortals.PortalId = 8) AND (dbo.UserRoles.RoleID = 16) -- member 11 is subscriber

OPEN myUsers

FETCH NEXT from myUsers into @UserID, @Email
WHILE @@FETCH_STATUS = 0
BEGIN

SELECT @FirstName=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'FirstName') AND
(dbo.UserProfile.UserID = @UserID)

SELECT @LastName=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'LastName') AND
(dbo.UserProfile.UserID = @UserID)

SELECT @FarmName=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'Farm_Name') AND
(dbo.UserProfile.UserID = @UserID)


SELECT @FarmPhone=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'Farm_Phone') AND
(dbo.UserProfile.UserID = @UserID)


SELECT @Website=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'Website') AND
(dbo.UserProfile.UserID = @UserID)


SELECT @Street=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'Street') AND
(dbo.UserProfile.UserID = @UserID)


SELECT @City=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'City') AND
(dbo.UserProfile.UserID = @UserID)


SELECT @State=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'Region') AND
(dbo.UserProfile.UserID = @UserID)


SELECT @ZipCode=dbo.UserProfile.PropertyValue
FROM dbo.ProfilePropertyDefinition INNER JOIN dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = 'PostalCode') AND
(dbo.UserProfile.UserID = @UserID)

INSERT INTO @myTable (
UserID,
FirstName,
LastName,
FarmName,
FarmPhone,
Address,
WebSite,
Email)
VALUES (
@UserID,
@FirstName,
@LastName,
@FarmName,
@FarmPhone,
@Street + ', ' + @City + ', ' + @State + ' United States',
@WebSite,
@Email)


FETCH NEXT from myUsers into @UserID, @Email
END

CLOSE myUsers
DEALLOCATE myUsers

DELETE FROM dbo.Map_Points

INSERT INTO dbo.Map_Points(
SourceID,
GUID,
Address,
IconIndex,
Description,
SequenceNumber,
SequenceInfo,
ZoomShow,
ZoomHide,
SummaryCount)
SELECT
1,
UserID,
Address,
0,
FarmName+'<br/>'+FirstName+' '+LastName+'<br/>'+FarmPhone,
UserID,
0,
0,0,0
FROM @myTable


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsMapMapShow users in one role?Show users in one role?


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