Welcome to Gallery 2.1. This integration package is part of the ongoing effort to seamlessly integrate Gallery 2 in phpBB2. Please read through this document carefully before integrating Gallery 2 and before asking for help. We have taken care to try to answer as many of your questions here as possible. If you don't read this and have problems, we may refer you back to this document as a first resource.
This package contains all the information you will need in order to include an optional mod to the basic integration package that will add links and thumbnails to all the users gallery items in their profile. Standard Disclaimer: Back up all files/folders/databases related to Gallery 2 and phpBB2 before attempting this integration.
Simply put, this package allows you to include thumbnail images in the users phpBB2 profile as shown in the sample screenshot.
This package does not install or configure Gallery 2 for you. Before you proceed with this add-on mod, you must install and configure Gallery 2 and get the basic integration working.
This integration package does not install or configure Gallery 2 for you. Before you proceed with this integration, you must install and configure Gallery 2 and have the basic integration already working.
This mod may not be a good idea for users who have a large amount of images because it does not stop until it generates a thumbnail and url in the users profile for every single image the user owns at each access.
This package contains these folders:
To install, simply follow the mod instructions. No additional files are required for installation.
The following MOD contains the required SQL and file modifications:
############################################################## ## MOD Title: All Gallery Links In Profile Mod ## MOD Author: Scott Gregory < jettyrat@jettyfishing.com > (N/A) NA ## MOD Description: This mod adds all gallery image links the nuked G2 integration into user profiles ## MOD Version: 0.1.0 ## ## Installation Level: Intermediate ## Installation Time: 30 Minutes ## Files To Edit: g2helper.inc, ## includes/usercp_register.php, ## includes/usercp_viewprofile.php, ## language/lang_english/lang_main.php, ## templates/subSilver/profile_add_body.tpl, ## templates/subSilver/profile_view_body.tpl, ## Included Files: images/icon_gallery.gif ## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 ############################################################## ## Author Notes: ## ############################################################## ## MOD History: ## ## 2006-04-21 - Version 0.1.0 ## - Initial Developmental Release ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ SQL ]------------------------------------------ # ALTER TABLE phpbb_users ADD `user_gallery_links` TINYINT(1) NULL DEFAULT NULL; # #-----[ OPEN ]------------------------------------------ # g2helper.inc # #-----[ FIND ]------------------------------------------ # function _createUser($id, $level, $newUserData) { # #-----[ BEFORE, ADD ]------------------------------------------ # function mapAllGalleryLinks($userId) { global $lang; $this->_initAdmin(); $ret = GalleryEmbed::isExternalIdMapped($userId, 'GalleryUser'); if (empty($ret)) { global $gallery; $urlGenerator =& $gallery->getUrlGenerator(); list ($ret, $entityId) = GalleryCoreApi::loadEntityByExternalId($userId, 'GalleryUser'); if (isset($ret)) { $this->_errorHandler(GENERAL_ERROR, sprintf($lang['G2_LOADENTITYBYEXTID_FAILED'], $userId) . $lang['G2_ERROR'] . $ret->getAsHtml(), __LINE__, __FILE__); } list ($ret, $itemIds) = GalleryCoreApi::fetchAllItemIdsByOwnerId($entityId->getId()); if (isset($ret)) { $this->_errorHandler(GENERAL_ERROR, sprintf($lang['G2_FETCHITEMSBYOWNER_FAILED'], $entityId->getId()) . $lang['G2_ERROR'] . $ret->getAsHtml(), __LINE__, __FILE__); } list ($ret, $descendentCounts) = GalleryCoreApi::fetchDescendentCounts($itemIds, $entityId->getId()); if ((count($descendentCounts) < 1) || (isset($ret) && $ret->getErrorCode() & ERROR_STORAGE_FAILURE)) { $this->done(); return null; } elseif (isset($ret)) { $this->_errorHandler(GENERAL_ERROR, sprintf($lang['G2_FETCHDESCENDCOUNTS_FAILED'], $entityId->getId()) . $lang['G2_ERROR'] . $ret->getAsHtml(), __LINE__, __FILE__); } $itemIds = array_diff($itemIds, array_keys($descendentCounts)); list ($ret, $thumbNails) = GalleryCoreApi::fetchThumbnailsByItemIds($itemIds); if (isset($ret)) { $this->_errorHandler(GENERAL_ERROR, sprintf($lang['G2_FETCHTHUMBSBYIDS_FAILED'], $entityId->getId()) . $lang['G2_ERROR'] . $ret->getAsHtml(), __LINE__, __FILE__); } $itemLinks = " <tr>\n"; $itemLinks .= ' <td colspan="2" class="catLeft" align="center" height="28"><b><span class="gen">Gallery Items For ' . $this->utf8Untranslate($entityId->getUserName()) . ' :: ' . count($itemIds) . ' Images</span></b></td>' . "\n"; $itemLinks .= " </tr>\n"; $itemLinks .= " <tr>\n"; $itemLinks .= ' <td colspan="2" align="center">' . "\n"; $itemLinks .= '<table><tr><td align="center">' . "\n"; foreach ($itemIds as $id) { $url = $urlGenerator->generateUrl(array('view' => 'core.DownloadItem', 'itemId' => $thumbNails[$id]->getId()), array('fullUrl' => true)); $itemLinks .= "<a href=\"gallery2.php?g2_itemId=$id\"><img hspace=\"5\" vspace=\"5\" src=\"$url\"></a>\n"; } $itemLinks .= "</td></tr></table>\n"; $itemLinks .= " </td>\n"; $itemLinks .= " </tr>\n"; $this->done(); return $itemLinks; } elseif (isset($ret) && $ret->getErrorCode() & ERROR_MISSING_OBJECT) { /* * User does not exist in gallery, so do nothing! */ } else { $this->_errorHandler(GENERAL_ERROR, sprintf($lang['G2_ISEXTERNALIDMAPPED_FAILED'], $userId), __LINE__, __FILE__); } $this->done(); return null; } # #-----[ OPEN ]------------------------------------------ # includes/usercp_register.php # #-----[ FIND ]------------------------------------------ # $popup_pm = ( isset($HTTP_POST_VARS['popup_pm']) ) ? ( ($HTTP_POST_VARS['popup_pm']) ? TRUE : 0 ) : TRUE; # #-----[ AFTER, ADD ]------------------------------------------ # $user_gallery_links = ( isset($HTTP_POST_VARS['user_gallery_links']) ) ? ( ($HTTP_POST_VARS['user_gallery_links']) ? TRUE : 0 ) : TRUE; # #-----[ FIND ]------------------------------------------ # SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popup_pm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . " # #-----[ INLINE, FIND ]------------------------------------------ # '$signature_bbcode_uid', # #-----[ INLINE AFTER, ADD ]------------------------------------------ # user_gallery_links = $user_gallery_links, # #-----[ FIND ]------------------------------------------ # $sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey) # #-----[ INLINE, FIND ]------------------------------------------ # user_avatar_type, # #-----[ INLINE AFTER, ADD ]------------------------------------------ # user_gallery_links, # #-----[ FIND ]------------------------------------------ # VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, "; # #-----[ INLINE, FIND ]------------------------------------------ # $avatar_sql, # #-----[ INLINE AFTER, ADD ]------------------------------------------ # $user_gallery_links, # #-----[ FIND ]------------------------------------------ # $viewemail = $userdata['user_viewemail']; # #-----[ BEFORE, ADD ]------------------------------------------ # $user_gallery_links = $userdata['user_gallery_links']; # #-----[ FIND ]------------------------------------------ # 'ALWAYS_ALLOW_SMILIES_NO' => ( !$allowsmilies ) ? 'checked="checked"' : '', # #-----[ AFTER, ADD ]------------------------------------------ # 'GALLERY_LINKS_YES' => ( $user_gallery_links ) ? 'checked="checked"' : '', 'GALLERY_LINKS_NO' => ( !$user_gallery_links ) ? 'checked="checked"' : '', # #-----[ FIND ]------------------------------------------ # 'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'], # #-----[ AFTER, ADD ]------------------------------------------ # 'L_ALLOW_GALLERY_LINKS' => $lang['Allow_gallery_links'], # #-----[ OPEN ]------------------------------------------ # includes/usercp_viewprofile.php # #-----[ FIND ]------------------------------------------ # // // Generate page // # #-----[ AFTER, ADD ]------------------------------------------ # if (!empty($profiledata['user_gallery_links'])) { // Fetch all gallery items for this user require($phpbb_root_path . 'g2helper.inc'); $g2h = new g2helper($db); $item_links = $g2h->mapAllGalleryLinks($profiledata['user_id']); } # #-----[ FIND ]------------------------------------------ # 'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage), # #-----[ AFTER, ADD ]------------------------------------------ # 'GALLERY2_LINKS_DATA' => $item_links, # #-----[ OPEN ]------------------------------------------ # /language/lang_english/lang_main.php # #-----[ FIND ]------------------------------------------ # $lang['Always_add_sig'] = 'Always attach my signature'; # #-----[ AFTER, ADD ]------------------------------------------ # $lang['Allow_gallery_links'] = 'Allow Gallery links in public profile'; # #-----[ OPEN ]------------------------------------------ # /templates/subSilver/profile_add_body.tpl # #-----[ FIND ]------------------------------------------ # <tr> <th class="thSides" colspan="2" height="25" valign="middle">{L_PREFERENCES}</th> </tr> # #-----[ AFTER, ADD ]------------------------------------------ # <tr> <td class="row1"><span class="gen">{L_ALLOW_GALLERY_LINKS}:</span></td> <td class="row2"> <input type="radio" name="user_gallery_links" value="1" {GALLERY_LINKS_YES} /> <span class="gen">{L_YES}</span> <input type="radio" name="user_gallery_links" value="0" {GALLERY_LINKS_NO} /> <span class="gen">{L_NO}</span></td> </tr> # #-----[ OPEN ]------------------------------------------ # /templates/subSilver/profile_view_body.tpl # #-----[ FIND ]------------------------------------------ # </table> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td align="right"><span class="nav"><br />{JUMPBOX}</span></td> # #-----[ BEFORE, ADD ]------------------------------------------ # {GALLERY2_LINKS_DATA} # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM
No configuration is necessary with this mod. Each user can turn this feature on or off within their profile settings.
If you are having problems getting your add-on mod completed successfully, start out by searching the Forums at NukedGallery.net. Gallery2 specific help is offered in this forum on NukedGallery.
If you are having general Gallery 2 problems, you should start by looking in the Gallery 2 Support Forum on the Gallery Website. Search the forum to see if somebody else has posted a similar problem and maybe there's an answer there, otherwise start a new topic to get help. If the problem seems like a bug in the Gallery 2 software you can file a bug in our bug tracker on SourceForge. Please read our tracker guidelines before filing a bug so that we can cut down on the number of spurious reports. If you're unsure whether to file a bug you can always post in the forums first and we'll ask you to file a bug if needed. If you want to chat in real time, you can talk on our user-to-user irc support channel, #gallery-support on irc.freenode.net.
Remember - reporting bugs is good. Even if you think it's silly, go ahead and report it. We can always close the bug or refile it (please don't be offended in this case) but it's harder to find bugs than it is to fix them so we're counting on you to help us with the finding part.
The following are known issues with this add-on mod package:
For a list of known issues with Gallery 2, view the Gallery 2 README.
$Id: Readme.html 14689 2006-10-05 13:34:05Z dmolavi $