MyBB Community Forums

Full Version: Forum/Site integration questions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So, I'm new to myBB and fairly new to PHP so I'm having a hard time just figuring out where to start with integrating my forums into my site. I really just need some hints and tips to get me started. I apologize in advance for my lack of knowledge on the topic.
Basically my forums are just attached to my website. I want to be able to tell a few things about the user. I need to be able to figure out if the person viewing my page is logged in to the forums and if so I need to be able to refer to their username and avatar. I assume that I do this with the session ID but I have no idea where to start.
I'm guessing it'd be something like; identify session ID, use this to determine which user it is, then use the user ID to find things like their avatar or permission tier.
Any help on understanding how this might work or tips on where to start to figure this out would be really helpful. I'm more interested in learning how to fish rather than to be given fish in this case, if that makes any sense. Thanks in advance for any help.
How is your current site set up? If it is mainly static pages then you could integrate it into MyBB pretty easily using the portal page and other custom pages. If it is a blog with posts (wordpress) that can be a bit harder. Can you provide a forum url? You can pm it if you prefer.
The site itself is currently simple HTML pages.
http://xenocrystserver.com/index.php - This goes to the forums but the site itself is simply xenocrystserver.com. It's currently devoid of content. I'm still working on getting the functionality set up first (it's also my first website, in my defense).
i'm not terribly familiar with the portal page. I suppose this is something I should look into now.

Edit: Ah, I see. You mean use the portal page as my landing page, correct? I could do this but I'd still like to learn how to at least identify if the user is logged in and, if so, identify that user.
Edit 2: While I understand that I could make this site with more ease if I did just create custom pages through MyBB I would prefer to do at least some things on my own. This is my first coding project and I'd like to use it to develop my skill and hopefully produce something reasonably decent. It's not the most logical choice but I need to learn somehow.
I know. I was you 5 years ago. Smile

MyBB only ships with one page like the portal, but you can use it as a "base template"for many more.

See this tutorial: http://www.communityplugins.com/forum/sh...ght=portal

That should help a bit. It assumes that you have a website, and a forum in a subdirectory.

Generally, mybb has a file called global.php. It has a lot of the functions you need to be able to have a set of pages above the forums which runs on MyBB. if you can include that file and define the page as IN_MYBB then a lot of the functions become available.
(2015-10-12, 02:55 PM)Leefish Wrote: [ -> ]I know. I was you 5 years ago. Smile

MyBB only ships with one page like the portal, but you can use it as a "base template"for many more.

See this tutorial: http://www.communityplugins.com/forum/sh...ght=portal

That should help a bit. It assumes that you have a website, and a forum in a subdirectory.

Generally, mybb has a file called global.php. It has a lot of the functions you need to be able to have a set of pages above the forums which runs on MyBB. if you can include that file and define the page as IN_MYBB then a lot of the functions become available.

I will complete Leefish's answer with more info if you don't mind. This will be semi-relevant to your question. I actually started coding with MyBB and now I own an IT business.

First of all, get a good IDE. Notepad++ won't do it. You want to quickly jump between the files, click on methods/functions and check the source/view parameters and such. phpStorm is a paid program (they have a 30 day trial) but you will find free alternatives. This is worth investing time into.

Once you have are working with an IDE set up XAMPP on your machine. Making live changes to your site isn't just slow, its also a security threat - not to mention that some visitors will see test code. Always work on this local installation and upload changes once you have tested them.

Decide on the structure of your website early one (day 1 preferably), it will hurt your SEO if you move the forum to a subdirectory (or vice versa) later on.

Learn about common security problems before you do something silly and have to spend days recovering from an attack. Attacks like XSS can be easily prevented if you know how they are executed. The rule is not to trust content from users and don't assume that if a functionality isn't linked on your site an attacker can't abuse it (talking about non-protected pages which are only linked to mods for example - common issue).

Learn about all the mybb hooks, seriously - read the list a few times, sometimes a solution will just pop in because you are aware that there is a hook for that. Hooks will make it possible to avoid core changes. Yes, you will probably have to use a plugin to help with integration because at some stage you will want to change the way MyBB serves content to certain visitors.

Download plugins from good MyBB coders. Some of the guys on github will have very solid code. Learn from them, its free. Remember that if you disagree with an approach to the problem you might be right even if you are a beginner.

Just some advice I wish I was given 6 years ago.
I have some of the info here as well: https://github.com/dragonexpert/tutorial...t.html#L97