Results 1 to 9 of 9

Thread: integrating phpbb users to the rest of my site

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default integrating phpbb users to the rest of my site

    I was just thinking of adding the ability to add comments to my articles by people using a login feature and cookies. I thought about building my own when a friend suggested integrating the user system from my phpbb forum. Is this fairly easy to do or should I just create my own username/password database?
    To choose the lesser of two evils is still to choose evil. My personal site

  2. #2
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    256
    Thanks
    1
    Thanked 21 Times in 21 Posts

    Default

    I haven't actually watched this yet but I think this is pretty close to what you want

    http://www.youtube.com/user/phpacade...18/Jq4csat4jNU

  3. The Following User Says Thank You to fastsol1 For This Useful Post:

    james438 (08-01-2010)

  4. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Yes, this does, thanks. I have only watched the first few minutes so far, but this certainly does help.
    To choose the lesser of two evils is still to choose evil. My personal site

  5. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I've done this a few times with other software (such as SMF) and it works well. It takes a significant amount of time to understand the complex programming of the board (from what I recall, phpbb is not simple, to say the least, though not much more complex than other forums), but once you understand it everything is simpler.

    If your goal is to integrate with the forum (use the forum and use your site), then this is a good idea.

    If your goal is to only borrow from the forum and not actually use it, this will probably be more work for you because you will need to shortcut all of the user operations like login, registration, change password, etc. And somehow disable the forum while keeping the system running for integration.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #5
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Hi James,

    I've done this with both a phpbb2 and phpbb3 forum software so logged in members get special menus, stylesheets and content across the whole site. Admins get their own special admin tools and facilities too.

    I've also crossed phpbb3 integration across sub-domains of a site.

    Let me know your own particular plans/setup and be only too pleased to help.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  7. #6
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Well, mostly what I want to do is to let visitors be able to write comments or questions on individual articles/pages. I was thinking that the best way to do this would be to integrate the login system that my phpbb3 forum currently uses so as to save myself a bit of coding and maybe make it so that users only need to log in to one place and be able to post in both the forum and the rest of my site. Mind you my site gets no visitors as it is really only a hobby site for myself and at $5 a month certainly well worth it .

    I am wondering if it might be easier to write my own script though instead and use my own user table for this purpose as I am not too keen on decrypting phpbb's password system.
    To choose the lesser of two evils is still to choose evil. My personal site

  8. #7
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    There's not much to decrypt really - in fact you can achieve rather a lot by pasting in a short block of code on every page (.php) of your site.

    For phpbb3;

    Paste this at the very top of each page - change the path to phpbb3 to suit:
    PHP Code:
    <?php
    define
    ('IN_PHPBB'true);
    // Specify the path to your phpBB3 installation directory.
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH 'phpBB3/';
    $phpEx substr(strrchr(__FILE__'.'), 1);
    include(
    $phpbb_root_path 'common.' $phpEx);
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();
    ?>
    Here are some code examples;

    PHP Code:
    <!-- if user is logged in show members stylesheet else show default stylesheet -->
    <?php 
    if($user->data['is_registered'])
    {echo 
    "<link href=\"http://www.mywebsite/styles/members.css\" rel=\"stylesheet\" type=\"text/css\">";}
    else
    {echo 
    "<link href=\"http://www.mywebsite/styles/default.css\" rel=\"stylesheet\" type=\"text/css\">";}
    ?>
    PHP Code:
    <?php if($user->data['is_registered'])
    {
         print 
    $user->data['username'];
         echo
    ' is logged in<br />
         <a title="Log out" href="' 
    append_sid("{$phpbb_root_path}ucp.$phpEx"'mode=logout'true$user->session_id). '">Log out</a>';
    }
    else 
    {
         echo 
    'You are not logged in<br /><a title="Log in" href="login_page.php">Log In</a> or <a title="Register" href="forum/ucp.php?mode=register"> Register Now</a>!';
    }
    ?>
    You can specify usergroups or even individual users like this;
    PHP Code:
    <!-- If Admin or bobtest is logged in show content else show alternative -->
    <?php if (($user->data['group_id'] == 11902) || ($user->data['username'] == 'bobtest')) { ?>
    You are logged in as Admin or bobtest
    <?php } else { ?>
    Who are you? Some random Joe off the street?
    <?php ?>
    You can find your group ID (in my example, the Admin group is 11902) by logging into the ACP, going to the "General" tab and selecting "Manage groups" on the left (under QUICK ACCESS)
    Then select "Members" and look in the URL - it's the number on the very end.

    So, using combinations of the code above you can protect your content/scripts/online tools and serve them to logged-in members or specific groups, or just yourself.

    This thread got me started: http://www.phpbb.com/community/viewt...60577#p4016875

    Hope that helps

    BTW -You also need to check to make sure the cookie is set to cover the whole domain and not just the phpbb3 forum. To do that, go to the "General" tab again, right at the bottom select "Cookie settings" (under SERVER CONFIGURATION) and set the cookie path to "/". And the cookie domain should just be something like ".mywebsite.com".

    I also read somewhere that the number of dots in the cookie domain can affect things so if you have a .co.uk wesbite, you might have to set the cookie domain to "mywebsite.co.uk" - the 2 dots are still there but at the end - this was definitely a factor on phpbb2 but it may have been corrected in phpbb3.
    Last edited by Beverleyh; 08-02-2010 at 12:42 PM.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  9. The Following User Says Thank You to Beverleyh For This Useful Post:

    james438 (08-03-2010)

  10. #8
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Much appreciated, thanks. I think that I will use phpbb to integrate the users with the rest of my site. I still need to set up a block of time to update my site, but it looks like you did most of the work for me

    Later,
    James438
    To choose the lesser of two evils is still to choose evil. My personal site

  11. #9
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    If the members database/login system is already there, you might aswell use it

    Glad I could help anyway.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •