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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesPortalSettings instance when using SchedulePortalSettings instance when using Schedule
Previous
 
Next
New Post
3/21/2011 12:53 AM
 
Hi DNN users,

I am trying to develop a scheduled job that requires Portal Settings using DNN v5.6.1 using DNN Host>Schedule.
Problem is that "Portal Settings" fails when you are running this schedule.

A solution in DNN v4.x was written up here however this doesn't work in v5.x.
I have tried the suggestion to remove reference to a few things, however it doesn't work :(

Has anyone developed something to make this work in v5.x before I go off and try to reinvent the wheel?

Thanks

C
 
New Post
3/21/2011 4:05 PM
 
The scheduler creates a new thread and requires the settings to be retrieved by your scheduled code.

Here is an example

This will work if you know the Module Id.

Dim ModuleId as Integer = [Your Module ID]
Dim oModuleController As New DotNetNuke.Entities.Modules.ModuleController
Dim settings As Hashtable

settings = oModuleController.GetModuleSettings(ModuleId)


Otherwise you will need to get all instances of the module an loop through them.

Dim oModuleController As New DotNetNuke.Entities.Modules.ModuleController
Dim oController As New Controller
Dim oModules As New InfoUtility
Dim aModules As New ArrayList
Dim eModules As System.Collections.IEnumerator
Dim settings As Hashtable

aModules = oController.GetModules("Your Module Name")
eModules = aModules.GetEnumerator()

If Not (aModules.Count = 0) Then
While eModules.MoveNext()
oModules = CType(eModules.Current, InfoUtility)
settings = oModuleController.GetModuleSettings(oModules.ModuleID)

'Do Work

End While
End If


Robert Harriman
WEBMAZING.NET
AutoWebSuite / BrokerWebSuite

DNN Modules for Auto Dealers and Real Estate Professionals.

 
New Post
3/21/2011 9:55 PM
 
Hi Robert,

I am doing exactly that... a little excert of code:
Namespace....
Partial class....

Private QuestionSettings As Hashtable
...

Public Function UnsolvedQuestionsNotification(ByVal objq As myQuestionInfo, ByVal SelectedModule As Integer) As String
....
QuestionSettings = (New DotNetNuke.Entities.Modules.ModuleController).GetModuleSettings(SelectedModule)
Dim tk As New TokenProcessor(QuestionSettings, 0, TabIDint)
....
End Function
.....
End Namespace

The issue is that when I run this Function from the Schedule it doesn't actually retrieve the ModuleSettings, it simple returns an empty hashtable.
I thought as per the post that I found, you have to initiate PortalSettings in order to get ModuleSettings to work.
The parameter "SelectedModule" is the ModuleID.

The line of code that I need in order to move on that is not working is in the TokenProcessor Class
sURL = DotNetNuke.Common.Globals.FriendlyUrl(TabInfo, Path, PageName)

--
TokenProcessor Class
--
Imports System.Reflection
Imports DotNetNuke.Common.Utilities

Namespace ....
Public Class TokenProcessor

Private Settings As Hashtable
Private tabid As Integer = vbNull
Private Portalid As Integer = 0

'Public Sub New(ByVal settings As Hashtable)
' Me.Settings = settings
'End Sub

'Public Sub New(ByVal settings As Hashtable, ByVal Tabid As Integer)
' Me.Settings = settings
' Me.tabid = Tabid
'End Sub

Public Sub New(ByVal settings As Hashtable, ByVal portalid As Integer, ByVal Tabid As Integer)
Me.Settings = settings
Me.tabid = Tabid
Me.Portalid = portalid
End Sub

.....

Thoughts? Comments?
Appreciate your help.
 
New Post
3/21/2011 11:56 PM
 
Craig you can just read the modulesettings directly from the database, as long as you have the moduleId.

DotNetNuke.Entities.Modules.ModuleController.GetModuleSettings

Wouldn't that solve your issue?
 
New Post
3/22/2011 12:20 AM
 
Well something must have changed between 5.1.4 and 5.6.0.

Just tested this in 5.1.4 and it works as expected, 5.6.0 returns nothing.


Robert Harriman
WEBMAZING.NET
AutoWebSuite / BrokerWebSuite

DNN Modules for Auto Dealers and Real Estate Professionals.

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesPortalSettings instance when using SchedulePortalSettings instance when using Schedule


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