Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

PortalWebHosting
  Ads  
 


  Sponsors  

Meet Our Sponsors

eUKhost.com is commited to offer exceptional UK Windows Web Hosting solutions with quality 24x7 technical support.Our plans support ASP.Net, ASP, ASP.NET Ajax extensions, XML, MSSQL, MySQL, PHP,DNN, multiple domains and Shared SSL as standard.
SmarterTools
Verndale
The Official Microsoft ASP.NET Website
Portal Webhosting - Hosting For Developers
Red-Gate Software
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Programmatically add user to role and menus
Previous Previous
 
Next Next
New Post 8/26/2008 12:27 PM
User is offline Nico
8 posts
10th Ranked


Programmatically add user to role and menus 

Hi there,

I developped a module on DNN 4.8.4 which at some point add the current logged in user to a group called "My Group". That works fine.

Now, I have a page that is visible only to users of "My Group". When I programmatically add the user to the role, even though I can access the page, I am not able to see it in the menu. I have to logout-login for the page to appear in the menu.

Does anybody have any idea how to solve this?

Thanks in advance

Nico

 
New Post 8/26/2008 3:15 PM
User is offline Michael Washington
2842 posts
ADefWebserver.com
5th Ranked










Re: Programmatically add user to role and menus 
Modified By Michael Washington  on 8/26/2008 5:16:03 PM)

I think it's because the user's menu is cached to avoid hitting the database so much.

What you can do is programmatically log the person in. I have an example of this at:

http://www.adefwebserver.com/DotNetNukeHELP/Misc/AutoPortalLogin.htm

Basically it's:

UserController.UserLogin(PortalId, UserInfo, PortalSettings.PortalName, GetIPAddress(), true);



Michael Washington
* ADefWebserver.com
* DNN Module Developer's Guide
* IWEB - DNN Web Services
* Silverlight and DotNetNuke
 
New Post 8/26/2008 7:07 PM
User is offline Mitch Sellers
5712 posts
www.mitchelsellers.com
3rd Ranked




Re: Programmatically add user to role and menus 

After adding the role to the user, you will need to additionally clear the user cache.  You can do this by a call to ClearUserCache.  it is inside the DotNetNuke.Common.Utilities namespace, I believe under the DataCache object.

If you can't find it, just drop me an e-mail to msellers@iowacomputergurus.com and I'll send off a code sample.


-Mitchel Sellers
MCITP, MCPD, MCTS
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Consulting Quotes, and DNN Technical Support Services

I reccomend 3Essentials for shared hosting and BaseCamp for project management
 
New Post 9/10/2008 2:26 PM
User is offline CJones
37 posts
10th Ranked


Re: Programmatically add user to role and menus 

 Mitch Sellers wrote

After adding the role to the user, you will need to additionally clear the user cache.  You can do this by a call to ClearUserCache.  it is inside the DotNetNuke.Common.Utilities namespace, I believe under the DataCache object.

If you can't find it, just drop me an e-mail to msellers@iowacomputergurus.com and I'll send off a code sample.

Mitch,

Do you know if this will work for getting rid of the delay that occurs when a user pays subscription through PayPal and is redirected back to the site?

Ex:  New user registers, and their 'Registered Users' account is created and they are logged into the site.  They are then automatically directed to PayPal to complete payment for subscription.  Once payment is received, they are added to the "Paid Members" role group (via DNN core PayPal handlers) which gives them access to the 'protected' areas of the site.  The only problem is that there is a 1-2 minute delay for the user cache to be erased before they can access the 'protected' area -- when they get back to the site, they are actually IN the "Paid Members" role group, but don't have access until their cache is updated.

I'm thinking that by throwing the "ClearUserCache" in the post-paypal handler, their info would be updated with the more current 'Paid Members' access.  Does the 'ClearUserCache' go deep enough to do this?  Does it log them out of the site?

Thanks,

CJ

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Programmatically add user to role and menus
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


DotNetNuke® in Sweden
All service of DotNetNuke® in Sweden.
Olsmar Konsult
DocuPeak Business Process Management RAD
Comprehensive enterprise and government process management. Forms, documents, indexing, workflow, views, content intelligence, capture, etc. Point and click rapid application development.
www.Webiplex.com
ADefWebserver.com
DotNetNuke® Module Development Help Website
ADefWebserver.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP