Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: [Tutorial] Complete integration of Coppermine into MyBB  (Read 9295 times)

0 Members and 1 Guest are viewing this topic.

pavemen

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
[Tutorial] Complete integration of Coppermine into MyBB
« on: February 23, 2011, 07:07:28 am »

Hopefully its okay to post this way. Just wanted to share my tutorial and plugin.

This is not about bridging with MyBB, its about integrating the two systems and assumes that you already have a working bridge

I put together a tutorial on the MyBB forums a while back explaining how to get complete (or near complete) integration of Coppermine in a bridged MyBB setup.  It includes a simple Coppermine plugin (not a MyBB plugin) to integrate the two systems. It works with CPG1.5 and MyBB 1.4/1.6. It does require one core file edit, but its basic and easy to replicate after upgrade.

The integration can be seen at my site at http://www.pavementsucks.com and click "Photos and Video" for my gallery. You will see that the MyBB headers are complete with valid session and user data, login support, full MyBB functionality of plugins, etc , complete MyBB footer, even with the Coppermine script outside the forum root folder. Coppermine plugins work fine as well.

http://community.mybb.com/thread-87200.html

If wanted, I can attach the zip package here as well, but it would be easier to maintain a single copy at the MyBB site.

Mods, please let me know if this is not okay.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: [Tutorial] Complete integration of Coppermine into MyBB
« Reply #1 on: February 24, 2011, 09:54:58 am »

I think it would be a good idea to have the full tutorial including all needed files at this board, too.
Logged

pavemen

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: [Tutorial] Complete integration of Coppermine into MyBB
« Reply #2 on: February 24, 2011, 05:01:44 pm »

This integration requires:

One CPG core file edit
Tweaks to CPG template of choice
Install and configure included Coppermine plugin
Upload included wrapper file
Two new MyBB templates for the top and bottom of the wrapper

==========================
Step 1. Getting started
==========================
Set your current Coppermine installation to use a default unmodified theme (one that you will not be modifying for integration). This will make it easier to install and configure the plugin without the theme messing up the layout.

Make sure MyBB and Coppermine are properly bridged and the features working as expected.

Backup <CPGROOT>\includes\init.inc.php

==========================
Step 2. Coppermine Core File Edits for 1.5.x
==========================

Edit <cpgroot>\includes\init.inc.php

Here you can either disable strict mode, but that opens up all superglobals that CPG is trying to lock out for security, or make a copy of the $_COOKIE variable before that happens and let CPG work as it originally does. I chose the latter method

after:

// Set $strict to false to make the superglobals available
$strict TRUE


add:

$globalcookie 
$_COOKIE


This will store the $_COOKIE variables for later use in the MyBB code. Without this edit or setting $strict = FALSE, MyBB will not have access to the server cookies needed to support MyBB user data when wrapping in CPG 1.5

If you use the $strict=FALSE; option instead, you should still add the $globalcookie line, or if not, comment out the $_COOKIE=$globalcookie line in the wrapper file below

==========================
Step 3. Template Edits for Coppermine 1.5.x
==========================

In my case, I edited the template.html file of the Classic theme. In template.html, remove all the content between <DOCTYPE> and {CUSTOM_HEADER} and all the content below {CUSTOM_FOOTER}

While you are there, correct any layout issues like missing closing tags, etc.

If there is any javascript or stylesheet info in the template.html header, retain that info for later use.

Depending on how complex the theme is, you may just want to backup the Classic theme and modify that one as it is a simple theme and template which will make initial edits easier. You can always apply these edits to another theme once you have the integration working.

==========================
Step 4. CSS Edits for Coppermine 1.5.x
==========================

To match the overall look, you need to edit the Classic theme's style.css file as well. For my site, I had to modify .tableh1, .tableh1compact and .navmenu to include the background and color settings from MyBB's .thead. You may need to adjust the path to background images depending on your folder setup.

There may be other minor edits you need to make the style.css file to get a better looking match.

==========================
Step 5. Installing Coppermine Plugin for 1.5.x
==========================

Upload the contents of the included \Coppermine\plugins folder to  you <cpgroot>\plugins\ folder. This should be a folder called mybb_wrapper with 3 files in it.

From your Coppermine plugin manager (usually linked in the Config > General Settings > Plugins > Manage Plugins) click the Install icon next to the MyBB Wrapper plugin. This will install the plugin into Coppermine and take you to the plugin configuration page.

Enter the appropriate data using the default paths as an example. Click the OK button.

==========================
Step 6. Wrapper for MyBB 1.4.x/1.6.x
==========================

I have include my copy of the wrapper in the zip file as I need it. There are several edits you would need to make...

You may need to modify the globals line. Most entries are required, but as you can see, there are some variables you wont need, like the $adserver_* ones as those are for my banner ads that are generated via a separate plugin. If you have a plugin that applies other variables to the templates, you will need to add those to this globals list.

Update the path in the MYBB_ROOT definition. This is the only edit required for basic functionality.

Remember the template.html <head> items you saved when modifying that file? Now is the time to add those into the $headerinclude variable at the bottom of the wrapper. Otherwise you will loose the features of the CPG theme you are trying to implement. Do NOT overwrite the $headerinclude, but append to it.

If you set the init.inc.php file to use $strict=FALSE, comment out the $_COOKIE=$globalcookie line unless you added the globalcookie line to init.inc.php above.

There is some navigation language when adding the breadcrumb, you can edit that if you like.

Upload this file to your <CPGROOT> folder

==========================
Step 7. Templates for MyBB 1.4.x or 1.6.x
==========================

Create two new templates in the MyBB ACP called cpg_main_top and cpg_main_bottom. I am using the default templates, so adjust to fit your template needs. I just grabbed the parts I needed from the index template.

Top:

<html>
<
head>
<
title>{$mybb->settings['bbname']}</title>
{
$headerinclude}
<
script type="text/javascript">
<!--
    
lang.no_new_posts "{$lang->no_new_posts}";
    
lang.click_mark_read "{$lang->click_mark_read}";
// -->
</script>
</head>
<body>
{$header} 


Bottom:

<br style="clear: both" />
{
$footer}
</
body>
</
html


==========================
Step 8. Clean Up existing custom header/footer for Coppermine 1.5.x
==========================

If you have already specified a custom header and/or footer in the CPG config, empty those values as the wrapper will now handle it all.

All Done!
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 20 queries.