Changeset 66

Show
Ignore:
Timestamp:
06/12/07 11:28:00 (2 years ago)
Author:
pdingle
Message:

added custom claim capabilities. This version has custom claims turned on for the Burton interop, must be turned off for production versions.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-infocard/pw-config.php

    r63 r66  
    1212define ('PW_VERSION_DATE', '17May07'); 
    1313define ('PW_SELECTORTRIGGER', 'html'); 
     14//define ('PW_CUSTOMDATAPATH', dirname(__FILE__) . '/' . PW_PLUGIN. '/customdata.pw.php'); 
     15define ('PW_CUSTOMDATAPATH', dirname(__FILE__) . '/custom/customdata.pw.php'); 
     16 
     17include_once( PW_CUSTOMDATAPATH ); 
    1418 
    1519include_once( dirname(__FILE__) . '/' . PW_PLUGIN. '/pw-claimtypes.php'); 
  • trunk/wp-infocard/pwlib/login/login.pwlib.php

    r64 r66  
    11<?php 
    2        //defined( '_VALID_IC' ) or die( 'Direct Access to this location is not allowed.'); 
     2//defined( '_VALID_IC' ) or die( 'Direct Access to this location is not allowed.'); 
    33 
    44class pwlib_login  
     
    189189                foreach ($claimslist as $claim) 
    190190                { 
     191                        $newclaim = ""; 
    191192                        if ($output) 
     193                                // append a space if this isn't the first claim 
    192194                                $output .=  " "; 
    193195 
     
    199201                                . ($claim->required?"false":"true") 
    200202                                . '" />'; 
     203 
    201204                        if ( $prettyprint )  
    202205                        { 
  • trunk/wp-infocard/wp/pw-claimtypes.php

    r64 r66  
    3636        FALSE, 
    3737        'Web Page'); 
     38 
     39// Add any custom claims 
     40// (note - custom claims come from PW_CUSTOMDATAPATH in pw-config.php) 
     41pw_customdata::addCustomClaims(); 
    3842 
    3943$datamap['display_name'] = new pw_mapping(  
     
    8892        PW_TABLE_PREFIX . 'users', 
    8993        'return $' . 'claimslist[\'webpage\']->token_value;'); 
     94 
     95// Map any custom claims 
     96// (note - custom claims come from PW_CUSTOMDATAPATH in pw-config.php) 
     97pw_customdata::addCustomDataMap (); 
    9098?> 
  • trunk/wp-infocard/wp/userdata.pw.php

    r60 r66  
    110110                                        if (array_key_exists($datamap[$key]->mappingattribute, $user_info[0])) 
    111111                                        { 
    112                                                 pw_utils::printDebug('Mapping: found '.$datamap[$key]->mappingattribute.' in user_info[0]<br/>'); 
     112                                                pw_utils::printDebug('Existing Value: found '.$datamap[$key]->mappingattribute.' in user_info[0]<br/>'); 
    113113                                                $datamap[$key]->add_db_value($user_info[0][$datamap[$key]->mappingattribute]); 
    114114                                        } 
     
    117117                                // special case for first, last name 
    118118                                $first = get_usermeta($mail_user_id, 'first_name'); 
    119                                 pw_utils::printDebug('FIRST: ' . $first . '<br/>'); 
    120                                 $datamap['first_name']->add_db_value(get_usermeta($mail_user_id, 'first_name')); 
    121                                 $datamap['last_name']->add_db_value(get_usermeta($mail_user_id, 'last_name')); 
     119                                if ($first) 
     120                                { 
     121                                        pw_utils::printDebug('Existing Value: found '.$datamap['first_name']->mappingattribute.' in usermeta ( '.$first.' )<br/>'); 
     122                                        $datamap['first_name']->add_db_value( $first ); 
     123                                } 
     124 
     125                                $last = get_usermeta($mail_user_id, 'last_name'); 
     126                                if ($last) 
     127                                { 
     128                                        pw_utils::printDebug('Existing Value: found '.$datamap['last_name']->mappingattribute.' in usermeta ( '.$last.' )<br/>'); 
     129                                        $datamap['last_name']->add_db_value( $last ); 
     130                                } 
     131                                pw_customdata::evaluateIncomingCustomData( $mail_user_id ); 
    122132                        break; 
    123133 
     
    157167                        $datamap[$key]->new_value = eval($datamap[$key]->mappingfunction); 
    158168                        //pw_utils::printDebug('&nbsp;Mapping Function: '.$datamap[$key]->mappingfunction.'<br/>'); 
    159                         pw_utils::printDebug('&nbsp;Name: '.$datamap[$key]->handle.'&nbsp;Value: '.$datamap[$key]->new_value.'<br/>'); 
    160                 } 
    161  
     169                        pw_utils::printDebug('&nbsp;Newly Mapped Value: '.$datamap[$key]->handle.'&nbsp;Value: '.$datamap[$key]->new_value.'<br/>'); 
     170                } 
     171                pw_utils::printDebug('<br />'); 
    162172        } // end function mapTokenData 
    163173 
     
    228238        function updateUserData( $ID, $datamap ) 
    229239        { 
    230                 global $wpdb; 
     240                pw_utils::printDebug('Comparing Existing Values to Newly Mapped Values:<br />'); 
     241                //global $wpdb; 
    231242 
    232243                // not sure if there is a more graceful way to do this... 
     
    251262                $userdata = compact('ID', 'user_login', 'user_email', 'user_nicename', 'user_url', 'display_name', 'first_name', 'last_name'); 
    252263 
     264                pw_customdata::updateNewCustomData( $ID ); 
     265 
    253266                if (wp_update_user($userdata)) 
    254267                { 
    255                         pw_utils::printDebug('&nbsp;User Updates Successful'); 
     268                        pw_utils::printDebug('&nbsp;WP-User Updates Successful'); 
    256269                        pw_utils::printDebug($query); 
    257270                } 
  • trunk/wp-infocard/wp/utils.pw.php

    r57 r66  
    173173                foreach ($claimslist as $claim) 
    174174                { 
    175                         pw_utils::printDebug( '&nbsp;' . $claim->displayname . (($claim->required)?'  (required)':'  (optional)') . '<br/>'); 
    176                         //pw_utils::printDebug($claim->displayname); 
     175                        if ($claim->schemaURI) 
     176                        { 
     177                                pw_utils::printDebug( '&nbsp;' . $claim->displayname . (($claim->required)?'  (required)':'  (optional)') . '<br/>'); 
     178                                //pw_utils::printDebug($claim->displayname); 
     179                        } 
    177180                } 
    178181                pw_utils::printDebug('<br/>');