1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Use database data

Discussion in 'XenForo Development Discussions' started by AT8500, Feb 7, 2013.

  1. AT8500

    AT8500 Member


    In my old forum (phpBB3) I used user data for loging on portal. Users register thru forum interface and then when they want to use portal futures for which user must be logged in, then they use same username and password.

    Portal is custom made (it is not phpbb portal) and I connected directly to phpbb database and used phpbb3 code for authenticating users.

    Now I would need same thing with xenForo, but can someone suggest me what would be best way to access and use data from xenForo database, or more precisely users username and password authentication. Write custom code which will directly access database or use some API or something for this.

    Please this is very important to me, because all new users which are registered after transition to xenForo can't login to portal.
  2. Slavik

    Slavik XenForo Moderator Staff Member

    Just call the database directly and use the XenForo login authentication.
    AT8500 likes this.
  3. AT8500

    AT8500 Member

    Hey, I have new question about using xenForo database.
    On portal I used to show last active topics (just time of last post and title of thread). In which table I should search for last posts (in whole forum) so I could display only 10 newest. Practicly I need only time and title of last 10 active threads.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The xf_thread table.
  5. AT8500

    AT8500 Member

    I didn't finish my project that I was working on when I asked my first question. Now i decided to finaly do it but still don't know how to implement authentication on portal.
    I looked in xenForo files but it seems that I should include lot of files in my script that I use on portal just to authenticate user. I just need to check if user is registered and that person is really one that he or she claims to be (to know own username and password). I would like to do it just with calling database directly and then just check if username and password matches and I would like to do it with my custom code (which would be simple and just few lines). If authentication pass, script will let user in (set some SESSION variables...). I don't need users to be recognized on forum as loged in. They can login on forum again. I just need it on portal to check once.

    I only have one problem and that is I don't know which encryption xenForo uses for password?

    Sorry for complicating things but please help me because I am stuck now.
  6. Slavik

    Slavik XenForo Moderator Staff Member

    2 ways, either you can load the XenForo Model and then use XenForo's authentication to handle it.

    Or, probably more easily, use this api addon: http://xenforo.com/community/resources/xenapi-xenforo-rest-api.902/
  7. AT8500

    AT8500 Member

    Is it possible to get code example of implementing any of those solutions. I tried but then my db got corrupted and I am not sure if I was reason for it or it just happened so I am now afraid to experiment.
    I would appreciate if someone could show me exact code what I should use for authenticatiing user, and when I know that code is OK I can later adopt it to fully fit my needs.
    I hope that I am not asking to much but after four days of horor with my forum and db I am not comfortable to experiment anymore.
  8. AT8500

    AT8500 Member

    I try and can't figure out how to do it. So please help :cry: (Sorry for crying heir but I just can't do it right :))
    I am trying to allow users to login on portal with username and pass from forum. Protal is custom built and forum is not integrated in it.

    I see that I probably need to include xenForo models in my script but I just cant do it right (I set full path, and that part is OK , but then I get some undifined errors etc...). Also I don't like thing that every action or error is loged in FORUM log. Only thing I need is simple check username/password for user and after that I don't need anyhing because I will then in my custom code set all data I need for portal.

Share This Page