We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17691
    • 22 Posts
    Hi Frisco!

    Hmmm... Thats true! When i directly open the Gallery i can see a Link to login. But when i open the G2 module in MODx i only see the link for register and the albums what i make before.
    Now i also clear the hole cache of G2. I also build in the snippet with [!Gallery!] but its the same problem.

    At my old installation (MODx 0.9.2.2 and the module for the Gallery 2.0.4) it looks like that when i open the G2 admin site in MODx:


    Here i direct logged in as the user admin i can make all i want, as in the direct link interface. And in my old installation i don’t have set up any Webusers in MODx!

    - try going there to the admin area and configure the same admin with the same password as for modx.
    Which admin do you mean? The admin at the webuser or the admin of the MODx manager? I try both variants, but nothing works.

    And thats my problem what i don’t understand huh

    Lupo
      • 20644
      • 37 Posts
      To Lupo

      Please add
      GalleryEmbed::checkActiveUser($this->g2AdminId);


      upper line GalleryCapabilities::set(’showSidebarBlocks’, true); in g2cms.admin.class.inc.php.

      I hope that solve the problem....
        • 17691
        • 22 Posts
        @ muramoto
        Thanks for help, but this also don’t solve the problem :’( :’( :’(
        Can you show me a picture how it looks like when you open the Gallery Admin in MODx?

        Many thankx, Lupo
          • 20644
          • 37 Posts
          Hi Lupo
          Can you show me a picture how it looks like when you open the Gallery Admin in MODx?
          I see.

          It’s small picture.. sorry.

          In trial, Can you clear browser cookies?

          And,
          Lupo write before
          Then i try the Gallery 2.0.4 with the version 0.9.5 and this don’t works. The installation is OK and i also can open the module and i see the 3 topics (Gallery Admin, Export, Import). But when i will open the Admin i only get a blank page
          Can the problem be with the modxfix.zip and g2cms.zip files? I think the modxfix i don’t be needed in the new 0.9.5 version. But i also copy the files into the directories. And the g2cms.zip is the module (your beta zip file).

          Maybe...cause to modfix.zip?
          I don’t add modfix.zip to my modx0.9.5.


            • 21475
            • 80 Posts
            Hi everybody,

            Lupo, I think that you must check your database.
            Check g2_User table, you have to find the g_id of the username of the admin.
            Then check g2_ExternalIdMap table.
            Fing the g_externalId of your webuser in modx, and check the g_entityId : it have to be the same number as for g_id.

            Then login to modx manager : your are at least sure that your modx adminuser have the right id.

            I had to do this once cause i messed with my user synch... maybe it can help you.

            nicpan
              • 20644
              • 37 Posts
              Hello , Everyone wink

              I have changed gallery2 plugin & snipet
              /**
               *	Gallery Plugin for MODx
               *	Written by Raymond Irving, Sept 2005
               *  Modyfied by Hisanori Muramoto, Feb, 2007
               *	Integrates Gallery2 with MODx
               *
               *	Events:
               *		OnWebChangePassword,OnWebDeleteUser,OnWebSaveUser,OnWebLogout,OnWebLogin
               *
               *	Version: 1.1
               *
               */
              
              
              
              $e = &$modx->event;
              
              # build mod path
              $modpath = $modx->config["base_path"].($mpth ? $mpth:"assets/modules/gallery/");
              
              # include main class
              include_once $modpath."g2cms.base.class.inc.php";
              $g2base = new G2CMS_Base();
              
              // include Gallery API
              require_once($g2base->g2Path.'embed.php'); 
              
              $ret = GalleryEmbed::init(array(
              	'embedUri' => $g2base->embedUri,
              	'g2Uri' => $g2base->g2Uri
              ));
              
              if ($ret) { 
              	 $modx->logEvent(0,2,$ret->getAsHtml(),'Gallery');
              	 exit; 
              } 
              		
              // Event switch
              switch($e->name) {
              
              	case "OnWebLogin": 
              		$ret = GalleryEmbed::login($modx->getLoginUserName());
              		if ($ret) { 
              			 $modx->logEvent(0,2,"Error has occured when  login by ($username)<br /><br />".$ret->getAsHtml(),'Gallery');
              		} 		
              		break;
              
              	case "OnWebLogout": 
              		$ret = GalleryEmbed::logout(array(
              			'embedUri' => $g2base->embedUri
              		));
              		if ($ret) { 
              			 $modx->logEvent(0,2,"Error has occured when  logout by ($username)".$ret->getAsHtml(),'Gallery');
              		} 		
              		break;
              	case "OnWebSaveUser":
              
              		$uid = $username;
              		$args = array(
              			'username'	=> $username,
              			'fullname' => $userfullname,
              			'email' => $useremail,
              			'hashmethod' => 'md5',
              			'hashedpassword' => md5($userpassword)
              		);
              			
              		if($mode=="new") {		
              			$ret = GalleryEmbed::createUser($uid,$args);
              			if ($ret) {
              				$modx->logEvent(0,2,"Unable to create Gallery user account ($username)<br /><br />".$ret->getAsHtml(),"Gallery");
              			}			
              		}
              		else if($mode=="upd"){
              			$uid=($oldusername ? $oldusername:$username);
              			if(GalleryEmbed::isExternalIdMapped($uid,'GalleryUser')==null) {
              				$ret = GalleryEmbed::updateUser($uid,$args);
              				if ($ret) {
              					$modx->logEvent(0,2,"Unable to update Gallery user account ($username)<br /><br />".$ret->getAsHtml(),"Gallery");
              				}
              			}
              		}
              		break;
              
              	case "OnWebChangePassword":
              		if(GalleryEmbed::isExternalIdMapped($username,'GalleryUser')==null) {
              			$ret = GalleryEmbed::updateUser($username,array(
              				'username'=>$username,
              				'password'=>$userpassword,
              			));
              			if ($ret) {
              				$modx->logEvent(0,2,"Unable to update Gallery user ($username) password<br /><br />".$ret->getAsHtml(),"Gallery");
              			}
              		}
              		break;
              
              	case "OnWebDeleteUser":
              		if(strpos(strtolower($ondel),'delete')!==false) {
              			if(GalleryEmbed::isExternalIdMapped($username,'GalleryUser')==null) {
              				$ret = GalleryEmbed::deleteUser($username);
              				if ($ret) {
              					$modx->logEvent(0,2,"Unable to update Gallery user ($username) password<br /><br />".$ret->getAsHtml(),"Gallery");
              				}
              			}
              		}
              		break;
              
              	default:
              		return;
              		break;
              }
              

              <?php
              /**
               *	Gallery Module Snippet for MODx
               *	Created by Raymond Irving, Sept 2005
               *  Modyfied by Hisanori Muramoto, Feb, 2007
               *	Integrates Gallery2 with MODx
               *
               *	Depends on Gallery Module
               *
               *	Version: 1.1
               */
              
              
              # build mod path
              $modpath = $modx->config["base_path"].($mpth ? $mpth:"assets/modules/gallery/");
              
              # include main class
              include_once $modpath."g2cms.base.class.inc.php";
              
              $gb = new G2CMS_Base();
              
              require_once($gb->g2Path.'embed.php'); 
              
              $ret = GalleryEmbed::init(array(
              	'embedUri' => $gb->embedUri,
              	'g2Uri' => $gb->g2Uri
              ));
              
              if ($ret) { 
              	 echo $ret->getAsHtml();
              	 exit; 
              }
              $uname = $modx->getLoginUserName();
              if ($uname) {
              // check is id map already exists
              	if(GalleryEmbed::isExternalIdMapped($uname,'GalleryUser')) {
              	    $user = GalleryCoreApi::fetchUserByUserName($uname);
              		if ($user[1]->_id>0) {
              			// add id map
              			$ret = GalleryEmbed::addExternalIdMapEntry($uname, $user[1]->_id, 'GalleryUser');
              
              		}
              	}
              }
              
              GalleryEmbed::checkActiveUser($uname);
              
              GalleryCapabilities::set('showSidebarBlocks', true);
              $g2data = GalleryEmbed::handleRequest(); 
              
              list($title, $css, $javascript) = GalleryEmbed::parseHead($g2data['headHtml']); 
              
              // setup header tags
              $header = '';
              foreach($css as $c) $modx->regClientCSS($c);
              foreach($javascript as $j) $modx->regClientStartupScript($j);
              
              return $g2data['bodyHtml'];
              ?>


              I have been to no use "ActiveUserId" in GalleryEmbed::init().Because I think there is a case which not mapped between ExternalId and G2Id.
              And I modified the problems of OnWebSaveUser , OnWebDeleteUser.(There were some dusts in code ex. ";" . grin )

              But ! I had an error on gallery2 snipet called page when I login by Weblogin.
              I saw the event log in MODx manager,
              Error has occured when login by (muramoto)

              Error (ERROR_STORAGE_FAILURE)

              * in modules/core/classes/GalleryStorage.class at line 476 (GalleryCoreApi::error)
              * in modules/core/classes/Gallery.class at line 223 (GalleryStorage::search)
              * in modules/core/classes/helpers/GalleryEntityHelper_simple.class at line 136 (Gallery::search)
              * in modules/core/classes/GalleryCoreApi.class at line 2424 (GalleryEntityHelper_simple::loadEntityByExternalId)
              * in modules/core/classes/GalleryEmbed.class at line 254 (GalleryCoreApi::loadEntityByExternalId)
              * in /var/www/html/modx/manager/includes/document.parser.class.inc.php(724) : eval()’d code at line 42 (GalleryEmbed::login)
              * in /var/www/html/modx/manager/includes/document.parser.class.inc.php at line 724
              * in /var/www/html/modx/manager/includes/document.parser.class.inc.php at line 2289 (DocumentParser::evalPlugin)
              * in /var/www/html/modx/assets/snippets/weblogin/weblogin.processor.inc.php at line 398 (DocumentParser::invokeEvent)
              * in /var/www/html/modx/manager/includes/document.parser.class.inc.php(748) : eval()’d code at line 86
              * in /var/www/html/modx/manager/includes/document.parser.class.inc.php at line 748
              * in /var/www/html/modx/manager/includes/document.parser.class.inc.php at line 837 (DocumentParser::evalSnippet)
              * in /var/www/html/modx/manager/includes/document.parser.class.inc.php at line 979 (DocumentParser::evalSnippets)
              * in /var/www/html/modx/manager/includes/document.parser.class.inc.php at line 1173 (DocumentParser::parseDocumentSource)
              * in /var/www/html/modx/manager/includes/document.parser.class.inc.php at line 1087 (DocumentParser::prepareResponse)
              * in /var/www/html/modx/index.php at line 144 (DocumentParser::executeParser)
              But The Gallery2 snipet page is crrectly read in login.
              help me!! :’( :’( I want to fix the error.


              To nicpan

              I cannot login directly to the gallery2 page ( /gallery2/main.php) by using weblogin event....
              Insert a "’activeUserId’ => $modx->getLoginUserName() " , but not solved.
              (But can login gallery2 snipet page by weblogin)
              huh huh

                • 20644
                • 37 Posts
                To nicpan

                I solved it!!

                My site path of gallery2 /gallery2/ and MODx is /modx/
                But I changed to /modx/gallery2/ , and I can directly login the gallery2.
                Maybe It’s problem of cookies path.

                And solved the error "ERROR_STORAGE_FAILURE" , I don’t know why it solved..
                  • 17691
                  • 22 Posts
                  Hi nicpan!

                  I make a new installation. I delete all files on the server and also the database. And now i setup the Gallery 2.1.2 (typical) and i make all configurations. Then i look into the database i see that i have 2 user in the g2_User table. (Guest: g_id 5, admin: g_id 6). But the g2_ExternalIdMap table is BLANK!!! I also make a Import in the Gallery page before.

                  Why is this table blanke at my installation??? I have a correct installation without errors. I try to fill in the data manually but this don’t work because i don’t know what are the correct values for the g2_ExternalIdMap undecided

                  I clear the cache of the Gallery and my browser before but the same shit: I can’t make anything in my Gallery Admin huh :’(

                  Now i try the changes of muramoto but it don’t have any effect.
                  I don’t understand why only i have this problem? Anyone idea what i can try next? Thankx people!

                  Lupo
                    • 17691
                    • 22 Posts
                    Hi everybody!!!

                    What a miracle! It works!!!! shocked

                    What i have done: I make a Export of the User at the Gallery main page. The User admin can’t get export. And so this also has no effect. Then i check the database table g2_ExternalIdMap and i have one user in the table (not the admin).
                    Then i add the user admin manually with this values:
                    g2_externalId: admin
                    g_entityType: GalleryUser
                    g_entityId: 6


                    Then i log in into MODx and i open the Gallery Admin i don’t believe my eyes shocked I see the fully administration of the gallery!!!

                    I hope this helps other guys who have the same problem as i.
                    Now i can test the new module and i give you a feedback when i found errors!

                    Thanks for all the help until now!!! wink

                    Lupo
                      • 21475
                      • 80 Posts
                      laugh Great news today wink
                      Quote from: muramoto at Feb 11, 2007, 08:28 PM

                      My site path of gallery2 /gallery2/ and MODx is /modx/
                      But I changed to /modx/gallery2/ , and I can directly login the gallery2.
                      Maybe It’s problem of cookies path.

                      And solved the error "ERROR_STORAGE_FAILURE" , I don’t know why it solved..
                      I had this error once, indeed its probably due to your path (had this in my attempt to have a fully working image block, that i’ll post here soon) (again wink), because when i had solved mine, got no more the error, like your your case smiley

                      Quote from: lupo1 at Feb 12, 2007, 04:59 AM

                      Hi everybody!!!

                      What a miracle! It works!!!! shocked
                      Great news! grin At least wink

                      Quote from: lupo1 at Feb 12, 2007, 02:58 AM

                      But the g2_ExternalIdMap table is BLANK!!! I also make a Import in the Gallery page before.

                      Why is this table blanke at my installation???

                      In fact, this is normal after a fresh install, because you hadn’t sync any users ; You did an Import, witch copy gallery users to modx! Normally, with an Export, this should have worked.
                      Well, everything is solved, thanks for sharing tongue

                      Muramoto, what is in final the good package?
                      I’ll post here a snippet that does work, if you want to include it in the package.
                      Thanks for your work smiley