Development

Changeset 10285

You must first sign up to be able to contribute.

Changeset 10285

Show
Ignore:
Timestamp:
07/14/08 21:53:07 (5 years ago)
Author:
pookey
Message:

refactoring to allow user to define custom usersync function

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfPhorumPlugin/branches/1.1/README

    r10255 r10285  
    11= sfPhorum plugin (for symfony 1.1) = 
     2 
     3This plugin enables you to embed a phorum install into a symfony application 
     4and to syncronise the user base. 
    25 
    36== Installation == 
  • plugins/sfPhorumPlugin/branches/1.1/config/app.yml.sample

    r10245 r10285  
    77                                     # doing this yourself. See 
    88                                     # sfPhorumPluginConnector::get_user_id() for example. 
     9    usersync_class:         sfPhorumPluginUserToolkit  # these two lines are used for defining 
     10    usersync_method:        defaultUserSync            # a custom usersync function 
    911    slave_fields:                    # slave fields are fields that phorum's 'control center' 
    1012      - real_name                    # will allow the user to edit 
  • plugins/sfPhorumPlugin/branches/1.1/lib/sfPhorumPluginConnector.class.php

    r10255 r10285  
    2626        if (sfConfig::get('app_sfPhorum_auto_usersync', true)) 
    2727        { 
    28           $syncuser = array( 
    29             'user_id' => $user->getGuardUser()->getId(), 
    30             'username' => $user->getGuardUser()->getUsername(), 
    31             'real_name' => 'FIXME', 
    32             'email'     => 'FIXME@FIXME.com', 
    33             'admin'     => true, 
    34           ); 
    35           sfPhorumPluginUserToolkit::SyncUser($syncuser); 
     28          // all a user definable user sync function. 
     29          call_user_func(array( 
     30            sfConfig::get('app_sfPhorum_usersync_class', 'sfPhorumPluginUserToolkit'), 
     31            sfConfig::get('app_sfPhorum_usersync_method', 'defaultUserSync') 
     32          )); 
    3633        } 
    3734        return $user->getGuardUser()->getId(); 
  • plugins/sfPhorumPlugin/branches/1.1/lib/sfPhorumPluginUserToolkit.class.php

    r10255 r10285  
    66    { 
    77      global $PHORUM; 
    8       // FIXME: fix paths 
    98      require_once ( sfConfig::get('app_sfPhorum_vendor_dir') . 'mods/embed_phorum/syncuser.php' ); 
    109      require_once ( sfConfig::get('app_sfPhorum_vendor_dir'). 'include/users.php' ); 
     
    1211      return $syncuser['user_id']; 
    1312    } 
     13 
     14    public static function defaultUserSync() 
     15    { 
     16      $user = sfContext::getInstance()->getUser(); 
     17      $syncuser = array( 
     18        'user_id' => $user->getGuardUser()->getId(), 
     19        'username' => $user->getGuardUser()->getUsername(), 
     20        'real_name' => $user->getGuardUser()->getUsername(), 
     21        'admin'     => false, 
     22      ); 
     23      sfPhorumPluginUserToolkit::SyncUser($syncuser); 
     24    } 
    1425  }