1
draxan
Hack site info block
  • 2005/3/16 11:22

  • draxan

  • Just popping in

  • Posts: 20

  • Since: 2005/3/9 1


Hi
I want change site block info to add ICQ status icon but for that I need take from data base ICQ number for each user but I don't know what

!-- start group member loop --
{foreach item=user from=$group.users}
tr
td class="even" valign="middle" align="center"
img src="<{$user.avatar}>" alt="" width="32" /
br /
a href="<{$xoops_url}>/userinfo.php?uid=<{$user.id}>"
{$user.name}
/a
/td
!here I want put changes
td align="center"
img border=0 src="http://web.icq.com/whitepages/online?icq=ICQ_USER_NUMBER&img=5"
/td
!end changes
td class="odd" width="20%" align="right" valign="middle"
{$user.msglink}
/td
/tr
{/foreach}
!-- end group member loop --
but there is a question how get ICQ_USER_NUMBER from data base????
Please help

2
ackbarr
Re: Hack site info block

What you changed was the presentation side of the coin, however, the code that creates the block will also need to be modified to retrieve the user's ICQ #:

in /modules/system/blocks/system_blocks.php find the function b_system_info_show() and replace it with this one:

function b_system_info_show($options)
{
    global 
$xoopsConfig$xoopsUser;
    
$xoopsDB =& Database::getInstance();
    
$myts =& MyTextSanitizer::getInstance();
    
$block = array();
    if (!empty(
$options[3])) {
        
$block['showgroups'] = true;
        
$result $xoopsDB->query("SELECT u.uid, u.uname, u.email, u.user_viewemail, u.user_avatar, [b][color=008000]u.user_icq[/color][/b], g.name AS groupname FROM ".$xoopsDB->prefix("groups_users_link")." l LEFT JOIN ".$xoopsDB->prefix("users")." u ON l.uid=u.uid LEFT JOIN ".$xoopsDB->prefix("groups")." g ON l.groupid=g.groupid WHERE g.group_type='Admin' ORDER BY l.groupid, u.uid");
        if (
$xoopsDB->getRowsNum($result) > 0) {
            
$prev_caption "";
            
$i 0;
            while  (
$userinfo $xoopsDB->fetchArray($result)) {
                if (
$prev_caption != $userinfo['groupname']) {
                    
$prev_caption $userinfo['groupname'];
                    
$block['groups'][$i]['name'] = $myts->htmlSpecialChars($userinfo['groupname']);
                }
                if (
$xoopsUser != '') {
                    
$block['groups'][$i]['users'][] = array('id' => $userinfo['uid'], 'name' => $myts->htmlspecialchars($userinfo['uname']), 'msglink' => "javascript:openWithSelfMain('".XOOPS_URL."/pmlite.php?send2=1&to_userid=".$userinfo['uid']."','pmlite',450,370);">/images/icons/pm_small.gif" border="0" width="27" height="17" alt="" />"'avatar' => XOOPS_UPLOAD_URL.'/'.$userinfo['user_avatar'], [b][color=008000]'icq' => $userinfo['user_icq'][/color][/b] );
                } else {
                    if (
$userinfo['user_viewemail']) {
                        
$block['groups'][$i]['users'][] = array('id' => $userinfo['uid'], 'name' => $myts->htmlspecialchars($userinfo['uname']), 'msglink' => '.$userinfo['email'].'">.XOOPS_URL.'/images/icons/em_small.gif" border="0" width="16" height="14" alt="" />''avatar' => XOOPS_UPLOAD_URL.'/'.$userinfo['user_avatar'], [b][color=008000]'icq' => $userinfo['user_icq'][/color][/b]);
                    } else {
                        
$block['groups'][$i]['users'][] = array('id' => $userinfo['uid'], 'name' => $myts->htmlspecialchars($userinfo['uname']), 'msglink' => ' ''avatar' => XOOPS_UPLOAD_URL.'/'.$userinfo['user_avatar'], [b][color=008000]'icq' => $userinfo['user_icq'][/color][/b]);
                    }
                }
                
$i++;
            }
        }
    } else {
        
$block['showgroups'] = false;
    }
    
$block['logourl'] = XOOPS_URL.'/images/'.$options[2];
    
$block['recommendlink'] = "javascript:openWithSelfMain('".XOOPS_URL."/misc.php?action=showpopups&type=friend&op=sendform&t=".time()."','friend',".$options[0].",".$options[1].")">"._MB_SYSTEM_RECO."";
    return 
$block;
}


Then in your site info template:

  <{foreach 
item=user from=$group.users}>
  <
tr>
    <
td class="even" valign="middle" align="center"><img src="<{$user.avatar}>" alt="" width="32" /><br /><a href="<{$xoops_url}>/userinfo.php?uid=<{$user.id}>"><{$user.name}>a>td>[b][color=008000]<td class="odd" align="center"><img border="0" src="http://web.icq.com/whitepages/online?icq=<{$user.icq}>&img=5" />td>[/color][/b]<td class="odd" width="20%" align="right" valign="middle"><{$user.msglink}>td>
  tr>
  <{/foreach}>
  

3
draxan
Re: Hack site info block
  • 2005/3/17 16:06

  • draxan

  • Just popping in

  • Posts: 20

  • Since: 2005/3/9 1


Thanx a lot ackbarr. That's working.
But there is one little problem. I change template file and replace it on server but when I enter to site template file is not changed. It seems like a xoop make backup file with old preferences.

4
ackbarr
Re: Hack site info block

when you install or update a module, all the templates for that module are added to the XOOPS database - into the default template set.

To see your changes you'll need to do one of the following:
1. Update the module (system in this case) to add the modified templates to the database
2. Clone the default template set in System -> Templates and make your changes in the cloned template set. Once your changes are made, switch the site template set in System -> Preferences.

Of the two, I prefer to use #2, because that leaves the default templates around in case I mess something up.

Login

Who's Online

316 user(s) are online (104 user(s) are browsing Support Forums)


Members: 0


Guests: 316


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits