Thread: Integration with vBulletin - vBulletin Ldap Authentication Plugin
View Single Post
  #36  
Old 10-16-2007, 03:53 PM
Mark Tomlinson's Avatar
Mark Tomlinson Mark Tomlinson is offline
 
Join Date: Oct 2007
Location: Chicago Area
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thought I'd throw this out there for everyone's consideration. We're looking at using vBulletin for our intranet, so LDAP became very important. What also became important is that we remove any hint of anonymity. My LDAP ID, for instance, is A000657 - which says nothing about who I am. It would be far better if my full name appeared in my profile somewhere.

So here's what I did. I added a bit of code to controller.php that would retrieve my full name, location, and title from LDAP and stick them in the additional user profile fields. Then I went into the Admin CP and made sure the user can not modify these fields. Here's what the code looks like. The attributes "l", "title", and "fullName" may be different in your configuration.

PHP Code:
// get the email address from ldap
        
$ldapConnection ldap_connect($ldapServer$ldapPort);
        if(
$ldapConnection)
        {
            
$searchEmail=ldap_search($ldapConnection$ldapBase$ldapFilter$ldapEmailAttr);
            
$userEmail=ldap_get_entries($ldapConnection,$searchEmail);
            if(
sizeof($userEmail) < 2)
            {
                
$newuser->set('email'$noEmailExists);
            }
            else 
            {
                
$newuser->set('email'$userEmail[0]['mail'][0]);
            }
//    ---- Modified by Mark Tomlinson - 10/15/2007 ----
            // get user attributes from ldap
            
$searchField ldap_search($ldapConnection$ldapBase$ldapFilter);
            
$userAttributes ldap_get_entries($ldapConnection$searchField);

            
// set fields
            
$vbulletin->GPC['userfield']['field2'] = $userAttributes[0]['l'][0];
            
$vbulletin->GPC['userfield']['field4'] = $userAttributes[0]['title'][0];
            
$vbulletin->GPC['userfield']['field5'] = $userAttributes[0]['fullname'][0];
            
$newuser->set_userfields($vbulletin->GPC['userfield'], true'admin'); 
//    ---- End Modifications ----
        

        
ldap_close($ldapConnection); 
Next up - plugging the full name and title in the signiture field.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01140 seconds
  • Memory Usage 1,793KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete