YAFLogo

Rivelyn
  • Rivelyn
  • 59% (Neutral)
  • YAF Forumling
15 years ago
I have pages in my site that are not part of the actual forum page(s) and I need to check users and make sure they are in certain roles that are set for registered members to be able to access the content on those pages.

So I use if then statements to check against the logged in users roles, and these roles are dynamic, as in I create them and I know what they are but they are not part of an Admin or Moderator role pre-defined by YAF.

guest
  • guest
  • Guest Topic Starter
15 years ago
You mean different groups? Check these places:

- Enums.cs GroupFlags.

- dbo.yaf_group & dbo.yaf_UserGroup

Hopefully this helps.

Rivelyn
  • Rivelyn
  • 59% (Neutral)
  • YAF Forumling
15 years ago
neubee wrote:

You mean different groups? Check these places:

- Enums.cs GroupFlags.

- dbo.yaf_group & dbo.yaf_UserGroup

Hopefully this helps.

No I just want to get the role that the current logged in user belongs to into a string so I can programmatically make use of it.

guest
  • guest
  • Guest Topic Starter
15 years ago
Role = group, you can verify this when you are in the Admin section - Groups(Roles) on the left panel. But in the code and database, it is called group. If you join dbo.yaf_UserGroup with dbo.yaf_group, you will see userid associated with a "role" you assigned.
guest
  • guest
  • Guest Topic Starter
15 years ago
Hi,

I've been looking for single login solutions here as well, but not able to use any of the methods discussed. Maybe I miss certain step. What I did so far:

1. Created my own login page. When user login, will use the YAF DLL to check and create user to the YAF database.

2. Once login, then i will store the ID, EMAIL and Password to session.

3. Created a link to the Forum from my website. After login, the user will be directed to my website main page (session has been created). If the user click on the Forum link, will bring the user to the forum main page and at this point it should be able to recognize the user because user already login.

But the problem now is, the user is still not logged in. Any step I miss? Thanks in advance.

I've continue this question at the following topic as I think that it is more suitable there:

http://forum.yetanotherforum.net/yaf_postsm18593_Installation-Help-Needed.aspx#18593 

Regards,

ewyong

guest
  • guest
  • Guest Topic Starter
14 years ago
If it helps, I had the same issue with maintaining session. After reviewing the cookie in IE7, we noticed differences in the cookie names. For example, when testing the auto login locally, the cookie displayed the name ".ASPXAUTH". When we logged into the forum, the cookie had a different name ."YAFNET_Authentication". We went into the forum web.config and noticed . We changed the forms name value to match the cookie name on the main/initial website and everything worked.

Sweettrips
14 years ago
Thank yo for sharing useful information.We want you to come up with advanced information so that will be helpful to everyone.

YTBTravels-Travel, Flight, Cars, Hotels, Cruises, Vacations 

tejas7001
13 years ago
According to zee's code i did the following

Dim sPassword As String = FormsAuthentication.HashPasswordForStoringInConfigFile(pgen.fvar(Request, "ppass"), "md5")

Dim userID As Object = yaf.DB.user_login(1, pgen.fvar(Request, "puser"), sPassword)

Response.Write(userID.ToString)

If Not userID Is DBNull.Value Then

Dim idName As String = String.Format("{0};{1};{2}", userID, 1, pgen.fvar(Request, "puser"))

If (Request.QueryString("ReturnUrl") <> Nothing) Then

FormsAuthentication.RedirectFromLoginPage(idName, True)

Else

FormsAuthentication.SetAuthCookie(idName, True)

'yaf.Forum.

Response.Write("authen")

End If

Else

'AddLoadMessage(GetText("password_error"))

End If

i am gettin the error : System.ApplicationException: Failed to get configuration from Web.config. at yaf.Config.get_configSection() at yaf.YafDBConnManager.InitConnection() at yaf.DB.ExecuteScalar(SqlCommand cmd) at yaf.DB.user_login(Object boardID, Object name, Object password) at bestprax._default1.Page_Load(Object sender, EventArgs e) in C:\whb\Sites\9231\Web\default.aspx.vb:line 100

I also added the machine key in my web.config as well as yaf's web.config :

please help me out

tejas7001
13 years ago
In the above code by zeeee yaf.DB.user_login

is DB in above line database name? or something else

please help me ou.........getting crazzzzzzzy :evil:

tejas7001
13 years ago
Any ways........at last i figured it out my self and got every thing working, succesfully integrating the yaf with my website as well as my database

This post helped me a lot, thanks

re3rotor
  • re3rotor
  • 51.8% (Neutral)
  • YAF Forumling
13 years ago
Hi,

I am looking to do the same and am wondering if the instructions is still the same? Or is there an updated list? I would like all the information in once place where I can just follow the steps to finish the integration off and move onto other tasks. :-d

Thanks,

-John

Schmakt
  • Schmakt
  • 55.4% (Neutral)
  • YAF Forumling
13 years ago
John - I followed these instructions yesterday, and everything worked great.

I had a few issues making sure that users were logged into the forum and my webpage at the same time as well as making sure that new users were created in the forum when they were created in my application, but the post above by tejas7001 was huge in helping me find all the problems.

I'm still very very new at this, but if you run into any specific problems, I'm happy to try to help.

okiebug
  • okiebug
  • 50.6% (Neutral)
  • YAF Forumling
13 years ago
System.ApplicationException: Failed to get configuration from Web.config. at yaf.Config.get_configSection() at yaf.YafDBConnManager.InitConnection() at yaf.DB.ExecuteScalar(SqlCommand cmd) at yaf.DB.user_login(Object boardID, Object name, Object password)

I also have this problem. We have the forum running independent of the membership system on the site as a virtual app. under IIS.

Thanks in advance for all the sharing and tips.

hemisphere_1
13 years ago
Dim userID As Object = yaf.DB.user_login(1, UserName.Text, sPassword)

What is the meaning of yaf.DB??

please help me