Private Groups

  • strict warning: Non-static method GalleryDataCache::put() should not be called statically in /home1/draperfa/public_html/gallery2_core/embed.php on line 32.
  • strict warning: Non-static method GalleryDataCache::_getCache() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 85.
  • strict warning: Non-static method GalleryEmbed::getEmbedPathByHttpRequest() should not be called statically in /home1/draperfa/public_html/gallery2_core/embed.php on line 36.
  • strict warning: Non-static method GalleryUtilities::getRequestVariablesNoPrefix() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryEmbed.class on line 1092.
  • strict warning: Non-static method GalleryUtilities::_getRequestVariable() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 289.
  • strict warning: Non-static method GalleryUtilities::_internalGetRequestVariable() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 875.
  • strict warning: Non-static method GalleryUtilities::_internalGetRequestVariable() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 879.
  • strict warning: Non-static method GalleryUtilities::sanitizeInputValues() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 293.
  • strict warning: Non-static method GalleryUtilities::sanitizeInputValues() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 708.
  • strict warning: Non-static method GalleryUtilities::sanitizeInputValues() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 714.
  • strict warning: Non-static method GalleryEmbed::init() should not be called statically in /home1/draperfa/public_html/sites/all/modules/gallery/gallery_base.inc on line 134.
  • strict warning: Non-static method GalleryDataCache::containsKey() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryEmbed.class on line 94.
  • strict warning: Non-static method GalleryDataCache::_getCache() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 203.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 46.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 47.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 48.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 49.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryModule.class on line 21.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 55.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryPlatform/UnixPlatform.class on line 21.
  • strict warning: Non-static method GalleryUtilities::getRequestVariables() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 150.
  • strict warning: Non-static method GalleryUtilities::_getRequestVariable() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 242.
  • strict warning: Non-static method GalleryUtilities::_internalGetRequestVariable() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 875.
  • strict warning: Non-static method GalleryUtilities::_internalGetRequestVariable() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 879.
  • strict warning: Non-static method GalleryUtilities::sanitizeInputValues() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 246.
  • strict warning: Non-static method GalleryUtilities::sanitizeInputValues() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 708.
  • strict warning: Non-static method GalleryUtilities::sanitizeInputValues() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 714.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 152.
  • strict warning: Non-static method GalleryTranslator::getSupportedLanguageCode() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 154.
  • strict warning: Non-static method GalleryTranslator::getLanguageData() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryTranslator.class on line 414.
  • strict warning: Non-static method GalleryUtilities::strToUpper() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryTranslator.class on line 418.
  • strict warning: Non-static method GalleryDataCache::put() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryEmbed.class on line 103.
  • strict warning: Non-static method GalleryDataCache::_getCache() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 85.
  • strict warning: Non-static method GalleryEmbed::isCompatibleWithEmbedApi() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryEmbed.class on line 107.
  • strict warning: Non-static method GalleryEmbed::getApiVersion() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryEmbed.class on line 61.
  • strict warning: Non-static method GalleryUtilities::isCompatibleWithApi() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryEmbed.class on line 61.
  • strict warning: Non-static method GalleryDataCache::containsKey() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryEmbed.class on line 128.
  • strict warning: Non-static method GalleryDataCache::_getCache() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 203.
  • strict warning: call_user_func() expects parameter 1 to be a valid callback, non-static method RewriteSimpleHelper::loadItemIdFromPath() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/rewrite/classes/RewriteUrlGenerator.class on line 103.
  • strict warning: Non-static method GalleryUtilities::getRequestVariables() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/rewrite/classes/RewriteSimpleHelper.class on line 38.
  • strict warning: Non-static method GalleryUtilities::_getRequestVariable() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 242.
  • strict warning: Non-static method GalleryUtilities::_internalGetRequestVariable() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 875.
  • strict warning: Non-static method GalleryUtilities::_internalGetRequestVariable() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 879.
  • strict warning: Non-static method GalleryUtilities::_getRequestVariable() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 242.
  • strict warning: Non-static method GalleryUtilities::_internalGetRequestVariable() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 875.
  • strict warning: Non-static method GalleryUtilities::_internalGetRequestVariable() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 879.
  • strict warning: Non-static method GalleryUtilities::sanitizeInputValues() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 246.
  • strict warning: Non-static method GalleryUtilities::sanitizeInputValues() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 708.
  • strict warning: Non-static method GalleryUtilities::sanitizeInputValues() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 714.
  • strict warning: Non-static method GalleryUtilities::sanitizeInputValues() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 708.
  • strict warning: Non-static method GalleryUtilities::sanitizeInputValues() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUtilities.class on line 714.
  • strict warning: Non-static method GalleryCoreApi::getAllFactoryImplementationIds() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 179.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryCoreApi.class on line 187.
  • strict warning: Non-static method GalleryFactoryHelper_simple::getAllImplementationIds() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryCoreApi.class on line 188.
  • strict warning: Non-static method GalleryFactoryHelper_simple::_getFactoryData() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 213.
  • strict warning: Non-static method GalleryFactoryHelper_simple::_getSingleton() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 63.
  • strict warning: Non-static method GalleryCoreApi::newFactoryInstanceById() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 186.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryCoreApi.class on line 174.
  • strict warning: Non-static method GalleryFactoryHelper_simple::newInstanceById() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryCoreApi.class on line 175.
  • strict warning: Non-static method GalleryFactoryHelper_simple::_getFactoryData() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 191.
  • strict warning: Non-static method GalleryFactoryHelper_simple::_getSingleton() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 63.
  • strict warning: Non-static method GalleryFactoryHelper_simple::newInstance() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 201.
  • strict warning: Non-static method GalleryFactoryHelper_simple::_getFactoryData() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 141.
  • strict warning: Non-static method GalleryFactoryHelper_simple::_getSingleton() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 63.
  • strict warning: Non-static method GalleryCoreApi::newFactoryInstanceById() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 186.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryCoreApi.class on line 174.
  • strict warning: Non-static method GalleryFactoryHelper_simple::newInstanceById() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryCoreApi.class on line 175.
  • strict warning: Non-static method GalleryFactoryHelper_simple::_getFactoryData() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 191.
  • strict warning: Non-static method GalleryFactoryHelper_simple::_getSingleton() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 63.
  • strict warning: Non-static method GalleryFactoryHelper_simple::newInstance() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 201.
  • strict warning: Non-static method GalleryFactoryHelper_simple::_getFactoryData() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 141.
  • strict warning: Non-static method GalleryFactoryHelper_simple::_getSingleton() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 63.
  • strict warning: Non-static method GalleryCoreApi::getCodeBasePath() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 169.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryFactoryHelper_simple.class on line 175.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/httpauth/classes/HttpAuthPlugin.class on line 21.
  • strict warning: Non-static method GalleryCoreApi::getAnonymousUserId() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 203.
  • strict warning: Non-static method GalleryCoreApi::getPluginParameter() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryCoreApi.class on line 3078.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryCoreApi.class on line 300.
  • strict warning: Non-static method GalleryPluginHelper_simple::getParameter() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryCoreApi.class on line 302.
  • strict warning: Non-static method GalleryPluginHelper_simple::_fetchAllParameters() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryPluginHelper_simple.class on line 222.
  • strict warning: Non-static method GalleryDataCache::containsKey() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryPluginHelper_simple.class on line 281.
  • strict warning: Non-static method GalleryDataCache::_getCache() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 203.
  • strict warning: Non-static method GalleryDataCache::get() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryPluginHelper_simple.class on line 282.
  • strict warning: Non-static method GalleryDataCache::_getCache() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 186.
  • strict warning: Non-static method GalleryCoreApi::loadEntitiesById() should not be called statically in /home1/draperfa/public_html/gallery2_core/init.inc on line 208.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryCoreApi.class on line 2360.
  • strict warning: Non-static method GalleryEntityHelper_simple::loadEntitiesById() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryCoreApi.class on line 2361.
  • strict warning: Non-static method GalleryDataCache::containsKey() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryEntityHelper_simple.class on line 53.
  • strict warning: Non-static method GalleryDataCache::_getCache() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 203.
  • strict warning: Non-static method GalleryDataCache::getFromDisk() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryEntityHelper_simple.class on line 56.
  • strict warning: Non-static method GalleryDataCache::_getCache() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 273.
  • strict warning: Non-static method GalleryDataCache::getCachePath() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 280.
  • strict warning: Non-static method GalleryDataCache::getCacheTuple() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 405.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 287.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUser.class on line 21.
  • strict warning: Non-static method GalleryCoreApi::requireOnce() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryEntity.class on line 21.
  • strict warning: Declaration of GalleryUser::create() should be compatible with GalleryEntity::create() in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUser.class on line 42.
  • strict warning: Declaration of GalleryUser::save() should be compatible with GalleryEntity::save($postEvent = true, $setAclId = NULL) in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryUser.class on line 42.
  • strict warning: Non-static method GalleryDataCache::put() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryEntityHelper_simple.class on line 95.
  • strict warning: Non-static method GalleryDataCache::_getCache() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 85.
  • strict warning: Non-static method GalleryUtilities::isA() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/helpers/GalleryEntityHelper_simple.class on line 118.
  • strict warning: Non-static method GalleryDataCache::put() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryEmbed.class on line 133.
  • strict warning: Non-static method GalleryDataCache::_getCache() should not be called statically in /home1/draperfa/public_html/gallery2_core/modules/core/classes/GalleryDataCache.class on line 85.
  • strict warning: Non-static method GalleryCoreApi::getMapEntry() should not be called statically in /home1/draperfa/public_html/sites/all/modules/gallery/gallery_user.inc on line 616.
  • warning: Creating default object from empty value in /home1/draperfa/public_html/sites/all/modules/mailhandler/mailhandler.module on line 123.

The following post is about my attempts at setting up a private group on a website.  It is put here more for my reference, but if anyone finds it helpful, then that is all the better.

 

Introduction

So I'm trying to create a group with Drupal that will only allow members of that group to view the content.  Actually, this is a fairly trivial issue, as Organic Groups already does this out of the box.  However, I want to be able to invite people to join the group, and these individuals may not already be members of my site.  For example, say I want to put up an album for a family member and we only want aunts, uncles, and grandparents to have access.  Some of these individuals may already have accounts, but let's say most of them do not.  When I invite them, I want an easy and seamless way for them to be added to the group.  It should be done in a single step, because if a person has to register, then wait for approval, they probably won't be back.  In order to do this, they should be given a code that they can enter, either at registration, or if they are already registered, they can enter it on the group's page to be given access to the group.

Registration Codes helps with much of this.  (Note that I am using this module over Organic Groups Registration Keys or the far less actively developed Organic Groups Registration Codes because it has a broader scope and appears to be more actively maintained.)  At the time of this writing, the release packages for Registration Codes is broken for Organic Groups, but it can easily be fixed by looking at the issue list.  Notably, these posts: http://drupal.org/node/1235574 and http://drupal.org/node/1294912 to fix the Organic Groups integration, and the Views Bulk Operations integration, respectively.

With the patched code in place, we can proceed.  The model I am going by is the way Snapfish allows users to set up private groups, and then invite others to view the albums.  Invitees will receive a shared group code in their email, which they must enter in order view the album.  (I'm hoping to use Registration Codes to generate unique codes to prevent a code from being shared or stolen.)  The invitee must be logged into Snapfish in order to apply the code, which means they must register if they do not already have an account.  This is very similar to what I'm wanting to do.

Ideally, we could use the Invite module to send the invitations.  Unfortunately, this integration is not yet available, and is outside of my current plans.  Fortunately, using the VBO integration of Registration Codes, you can email a code to users.  This requires entering your message every time (you can't store a default message at this time.)  While this isn't perfect, it will suffice for now.  You can embed the code in the link, which can cause it to be automatically placed in the appropriate field on the registration page by using the following format:

[site-url]user/registration?regcode=[regcode]

I have made some modifications to the code add the registration code to the login page, and have the code automatically injected into the field on the user profile page, the voucher page, and the login page.  However, it would require supplying a link to each of these, then relying on the user knowing which link they should click on (ie. if a user is already logged in, clicking on the registration link will result in an access denied error.)

Going back to the snapfish model, they do not inject the code automatically.  Invitees are expected to copy/paste the code into the appropriate text box.  Going with this method, we can provide a link to the group to which the person is being invited to join.  If they are currently logged out, they will see the login/register form on that page.  Once they are logged in, they will have a text box where they may paste the code.

Sending invitations

Sending the invitation is fairly simple (for those with the proper administrative permissions.)  On the Registration Codes admin page ([site-url]/admin/user/regcode) you can select the codes you wish to use for the invitations.  Once selected, choose the 'Mail Codes' bulk operation and execute.  Give your invitation a subject, body, and list the email addresses of the users you wish to invite.  In the body, be sure to use the [regcode] replacement pattern to make sure the code is sent (I don't think it will actually let you send the message without this code.)

The login/register page

I am wanting to have the login/register form on the group page (only if the user is not currently logged in.)  I opted to go with the Panels module for the basic reason that if I wanted to change themes, I would still have the desired layout.  You can do this with your theme, and in hindsight, that might have been the easier way to go.

First I created a page that had the login and register forms in panels on the same page.  I also added the 'lost password' form.  To do this, create a block for each panel (ie. 'user login panel', 'user register panel', and 'user lost password panel'.)  The names can be anything you like.  Make sure the input format is set to Php Code, and enter the following snippets:

Login:
<?php
  global $user;
  if (!$user->uid) {
    // Only show the login form to anonymous users
    $form = drupal_get_form('user_login');
    print $form;
  }
?>

Register:
<?php  print drupal_get_form('user_register');  ?>

Lost Password:
<?php
  module_load_include('inc', 'user', 'user.pages');
  print drupal_get_form('user_pass');
?>

Note how the login block makes sure the user is logged in before displaying the form.  We should never need to worry about this in practice (the form shouldn't be displayed to logged in users) but this is a safety check, as it will cause trouble otherwise.  Also, note how the lost password form requires the inclusion of the 'user.pages.inc' file (this gave me some trouble before I found that.)

Now that we have the blocks created to show these forms, let's create the page to show them.  With Panels installed, go to admin/build/pages.  Create a new page (link at the bottom of the list) and give the page a title, name, and description as desired.  The important thing is to set the path for this page (I set mine to be login-register', so that if I go to http://www.mysitedomain.com/login-register, I will get the login or register page.)  Variant type should be Panel, then create the page.  I set my layout to 2 column (login and password reset in the left column, registration in the right.)  You don't need any selection rules, though if you wanted, you could probably make it to only show for anonymous users.  In the content section, you will add the panes to the page.  Click on the gear icon in the top left corner of the panel where you want to add the pane, then click 'Add content.'  Because we added the panes as blocks, they will be under the Miscellaneous section.  Simply select the appropriate content from this list, and it will be added to the panel.  Be sure to save the page!

Now, if we go to http://www.mysitedomain.com/login-register, we will see the new layout (it might be a good idea to do this as an anonymous user.)  However, anytime drupal generates the login or register links (such as when an anonymous user wants to add a comment where they need to be logged in), they will go to the regular drupal forms.  To go to our new page, create the following files in your theme directory:

  • page-user-login.tpl.php
  • page-user-register.tpl.php
  • page-user-password.tpl.php

(I didn't use the password template myself, but the process is the same.)  In each of these files, enter the following code:

<?php
  unset($_REQUEST['destination']);
  drupal_goto('login-register')
?>

Now when you click on a drupal-generated login link, you will go to the new page!

Redirecting anonymous users to the login/register page and providing the registration field for non-members

Initially, I was trying to do this step simply using panels.  I had developed a recipe that seemed like it was going to work rather well: Anonymous users would be redirected to the login/register page and non-members were given the registration code field.  Then I realized that it wouldn't work for public groups.  If an anonymous user went to a public group, they would be redirected to the login/register page, even though they should be able to view the group.  Trying various logic in the selection rules for the panel didn't seem to work.  Eventually, I resorted to writing a custom module that does just what I need (and maybe with some more flexibility.)

The OG Views module creates the messages that appear when a user needs to login or register to view a group.  I adapted the necessary functions from OG Views and implemented them in my module (OG Login Regcode) so that if no content is being displayed, it will check if the user is logged in.  If not, then it will redirect to the login/register page.  If they are logged in, but not a member, it will show the registration code field.  If an anonymous user (or even a non-member) tries to view a public group, it will show normally.  This actually turned out to be easier than using panels in this case.  I want to make it somewhat configurable (allow the user to specify the path for the login page, for instance.)  I will provide a download for this module soon.

Sending invitations

 

Conclusion

This isn't the most ideal solution.  As it stands, an administrator is about the only person that can send invitations (due to using the Registration Codes admin panel and the VBO integration.)  If a module were made to integrate the codes with the Invite module, that would just be a whole lot nicer.  However, for a small family site, where I'm about the only one who would be sending invites anyway, this way should work for now.

 

One last note, I am switching my gallery to Node Gallery.  I had noticed an issue that when I was viewing the group, which contained a gallery, each image was being listed individually (note that this is not when I was viewing the gallery, but the group page itself.)  This is because each image is a node, assigned to the group.  To fix this, I edited the view og_ghp_ron and added the filter Node: Type <> Gallery image.  This prevents the images from being listed in the group page, but they are still accessible from within the gallery.