开发者

How to identify current logged in user in Dotnetnuke?

I have a very simple SQL query that I made which retrieves some user information from a table that is in my DNN database. It displays the information in a "Grid View" via the "Reports" Module that comes standard with DNN 6.0

My problem is not with the query, but rather the view. I need to set a filter/parameter(?) that will only display the records of the current user who is viewing the records.

Now I'm not sure if this can even be done in SQL or if I would have to write a custom module myself or whether it's just some custom code that I have to add to the skin/page开发者_C百科. After doing research I heard some people also talking about the DNN Core API but I can't find any decent documentation on it. (Nor have I ever used any kind of API before)

I'm pretty sure the solution to this is pretty simple it's just that I can't get a straight answer from my research which is just leading me to be more and more confused.

As always any help, input, article/tutorial or nudge in the right direction is greatly appreciated.

Thank You

*EDIT*

For the sake of anyone in the future who is looking for this, here is how my SQL Query looks after adding the parameter values. I've stripped it down to show you just the basic:

SELECT dbo.Users.UserID
FROM dbo.Users
WHERE dbo.Users.UserID = @UserID

Putting this into to my Reports Query generated the only the records of the User who is currently logged in. Pretty simple!


The DNN reports module supports tokens. I wrote this blog post awhile back ago: DNN Reports Module Shows an example of using a URL parameter to replace some data in the SQL. I can't recall if it has SQL injection protection or not.

In your SQL you can use @UserID and it gets replaced with the logged in users - Userid.

You can also use: @PortalID, @TabID

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜