XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
function.xoMemberInfo.php
Go to the documentation of this file.
1 <?php
2 // $Id: function.xoMemberInfo.php
3 // ------------------------------------------------------------------------ //
4 // XOOPS - PHP Content Management System //
5 // Copyright (c) 2000 XOOPS.org //
6 // <http://www.xoops.org/> //
7 // ------------------------------------------------------------------------ //
8 // This program is free software; you can redistribute it and/or modify //
9 // it under the terms of the GNU General Public License as published by //
10 // the Free Software Foundation; either version 2 of the License, or //
11 // (at your option) any later version. //
12 // //
13 // You may not change or alter any portion of this comment or credits //
14 // of supporting developers from this source code or any supporting //
15 // source code which is considered copyrighted (c) material of the //
16 // original comment or credit authors. //
17 // //
18 // This program is distributed in the hope that it will be useful, //
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
21 // GNU General Public License for more details. //
22 // //
23 // You should have received a copy of the GNU General Public License //
24 // along with this program; if not, write to the Free Software //
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
26 // ------------------------------------------------------------------------ //
27 
28 /*
29  * Smarty plugin
30  * -------------------------------------------------------------
31  * Type: function
32  * Name: xoMemberInfo
33  * Version: 1.0
34  * Author: DuGris
35  * Purpose: Get member informations
36  * Input: infos = informations to be recovered in the profile of the member
37  * if empty uname,name,email,user_avatar,url,user_icq,user_aim,user_yim,user_msnm,user_from,
38  * user_occ, user_intrest, bio, user_sig will be recovered
39  *
40  * assign = variable to be initialized for the templates
41  *
42  * I.e: Get all informations
43  * <{xoMemberInfo assign=member_info}>
44  *
45  * I.e: Get uname, avatar and email
46  * <{xoMemberInfo assign=member_info infos="uname|email|avatar"}>
47  * -------------------------------------------------------------
48  */
49 
50 
51 function smarty_function_xoMemberInfo( $params, &$smarty ) {
52  global $xoopsUser, $xoopsConfig;
53 
54  $time = time();
55  $member_info = $_SESSION['xoops_member_info'];
56  if ( !isset($xoopsUser) || !is_object($xoopsUser) ) {
57  $member_info['uname']= $xoopsConfig['anonymous'];
58  } else {
59  if ( @empty( $params['infos'] ) ) {
60  $params['infos'] = 'uname|name|email|user_avatar|url|user_icq|user_aim|user_yim|user_msnm|posts|user_from|user_occ|user_intrest|bio|user_sig';
61  }
62  $infos = explode("|", $params['infos']);
63 
64  if ( !is_array( $member_info ) ) {
65  $member_info = array();
66  }
67  foreach( $infos as $info ) {
68  if ( !array_key_exists($info, $member_info) && @$_SESSION['xoops_member_info'][$info.'_expire'] < $time) {
69  $member_info[$info] = $xoopsUser->getVar($info, 'E');
70  $_SESSION['xoops_member_info'][$info] = $member_info[$info];
71  $_SESSION['xoops_member_info'][$info.'_expire'] = $time + 60;
72  }
73  }
74  }
75  if ( !@empty( $params['assign'] ) ) {
76  $smarty->assign( $params['assign'], $member_info );
77  }
78 
79 }
80 
81 ?>