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  
Webhost4Life - $4.95 Windows Hosting
 


  Sponsors  

Meet Our Sponsors

Webhost4life, specialists in DNN hosting
Mad Development is a full service interactive agency focusing on the merge of design, technology, e-commerce, and affiliate marketing by providing total website solutions.
AspDotNetStoreFront - E-Commerce by Design - The Leading ASP.NET shopping cart platform for developers!
SteadyRain
DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
 


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
2837 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
5694 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.

 


Module Development by Engage Software
Specializing in custom module development, training and skinning.
www.engagesoftware.com
BataviaSoft DotNetNuke Solutions
BataviaSoft offers custom DotNetNuke solutions especially for the European and the South East Asian market.
www.bataviasoft.com
Viva Portals, L.L.C.
Expert module development and graphic design.
www.continure.com

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