191
mjoel
Re: Poster's status
  • 2008/12/24 23:21

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


after adding this code to my root/header.php ..the online/offline code works(no modifications) in yogurt and in profile module..thanks trabis..merry xmas to u

$online_handler =& xoops_gethandler('online');
    
mt_srand((double)microtime()*1000000);
    
// set gc probabillity to 10% for now..
    
if (mt_rand(1100) < 11) {
        
$online_handler->gc(300);
    }
    if (
is_object($xoopsUser)) {
        
$uid $xoopsUser->getVar('uid');
        
$uname $xoopsUser->getVar('uname');
    } else {
        
$uid 0;
        
$uname '';
    }
    if (
is_object($xoopsModule)) {
        
$online_handler->write($uid$unametime(), $xoopsModule->getVar('mid'), $_SERVER['REMOTE_ADDR']);
    } else {
        
$online_handler->write($uid$unametime(), 0$_SERVER['REMOTE_ADDR']);
    }


p/s: displaying <{$user_online}> directly in template ..returns 1



192
mjoel
Re: Poster's status
  • 2008/12/24 14:10

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


Quote:

ghia wrote:
Don't you have to encode the false case?
As with:
if ($thisUser->isOnline())
{
    
$xoopsTpl->assign('user_online'true);
}
else
{
    
$xoopsTpl->assign('user_online'false);
}

or:
$xoopsTpl->assign('user_online'$thisUser->isOnline());



i tried replacing my code with yours but no effect..i am still displayed as offline even though i am logged in (online) !!
Quote:

Check in your template what $user_online is returning, by displaying it directly. If necessary adapt the
<{if $user_online == true}>

how do i do this ? i'm not a coder..i just follow examples..is it something like this
<br /><bOnline Status:</b> <{if $user_online == true}>
                <
span style='color:#ee0000;'>Online</span><br />
<{
$user_online}>
<{else}>
                <
span style='color:#000000;'>Offline</span><br />

<{
$user_online}>
<{/if}>


nothing is displayed just the word Online Status: Offline



193
mjoel
Re: Poster's status
  • 2008/12/24 5:29

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


banditx i replaced my code with yours but no effect ..still i am displayed as offline





194
mjoel
Re: Poster's status
  • 2008/12/24 3:10

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


i think there is something wrong with this code..need to modify it to work with XOOPS 2.3
//user online status

$user_online = new XoopsUser($thisUser->getVar('uid'));

if (
$user_online->isOnline())

{

    
$xoopsTpl->assign('user_online'true);

}

this is perfectly working in XOOPS 2.018 and the old version yogurt but not working anymore in XOOPS 2.3



195
mjoel
Re: Poster's status
  • 2008/12/24 2:54

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


i also tried this using the profile module in XOOPS 2.3...can someone correct this code?..i am always displayed as offline
Resized Image

1. open modules/profile/userinfo.php

find
//User info
$xoopsTpl->assign('uname'$thisUser->getVar('uname'));
$xoopsTpl->assign('email'$email);
$xoopsTpl->assign('avatar'$avatar);
$xoopsTpl->assign('recent_activity'_PROFILE_MA_RECENTACTIVITY);
$xoBreadcrumbs[] = array('title' => _PROFILE_MA_USERINFO);
include 
'footer.php';
?>



add this before the code above


$user_online = new XoopsUser($thisUser->getVar('uid'));
if (
$user_online->isOnline())
{
    
$xoopsTpl->assign('user_online'true);
}



Save and close


2. open modules/profiles/templates/profile_userinfo.html

find
<{foreach item=category from=$categories}>
    <{if isset(
$category.fields)}>
        <
div class="profile-list-category" id="profile-category-<{$category.cat_id}>">
            <
table class="outer" cellpadding="4" cellspacing="1">
                <
tr>
                  <
th colspan="2" align="center"><{$category.cat_title}></th>
                </
tr>
                <{foreach 
item=field from=$category.fields}>
                    <
tr>
                        <
td class="head"><{$field.title}></td>
                        <
td class="even"><{$field.value}></td>
                    </
tr>
                <{/foreach}>
            </
table>
        </
div>
    <{/if}>
<{/foreach}>

add this code before the code above

<br /><bOnline Status:</b> <{if $user_online == true}>
                <
span style='color:#ee0000;'>Online</span><br />
<{else}>
                <
span style='color:#000000;'>Offline</span><br />
<{/if}>



save & close.

clear cache (eg:xoops_data\caches\smarty_compile) (except for index.html)




196
mjoel
Re: Poster's status
  • 2008/12/24 2:46

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


i tried this in yogurt 3.3rc2 with XOOPS 2.3
but it is not working..i am always showed as offline

Resized Image

..can someone check what did i do wrong ?..


open modules/yogurt/index.php

find
/**
 * Closing the page
 */ 
include("../../footer.php");
?>


before the code above add this code below

//user online status

$user_online = new XoopsUser($thisUser->getVar('uid'));

if (
$user_online->isOnline())

{
    
$xoopsTpl->assign('user_online'true);

}



open modules/yogurt/templates/yogurt_index.html

find

<class="even"> <img src="images/clock.gif" /> <span class="yogurt-profileinfo-label"><{$lang_lastlogin}>:</span><span class="yogurt-profileinfo-value"><{$user_lastlogin}></span></p>


before the code above add this code below
<class="even"> <img src="images/clock.gif" /> <span class="yogurt-profileinfo-label">Online Status</span><span class="yogurt-profileinfo-value">
<{if 
$user_online == true}>
                <
span style='color:#ee0000;'>Online</span><br />
<{else}>
                <
span style='color:#000000;'>Offline</span><br />
<{/if}>

</
span></p>


clear cache (eg:\xoops_data\caches\smarty_compile) (except for index.html)



197
mjoel
Re: Poster's status
  • 2008/12/23 12:04

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


not the same but i use this last time in XOOPS 2.018x to show online status in profile (default profile)

https://xoops.org/modules/newbb/viewtopic.php?topic_id=61786&forum=7&post_id=281715#forumpost281715

never tried it it in XOOPS 2.3 + profilemodule/yogurtmodule



198
mjoel
Re: How do put the username into a custom block?
  • 2008/12/5 0:44

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


<{if $xoops_isuser}>
Hi<{$xoops_uname}>.&nbsp;
<
a href="<{$xoops_url}>/user.php">Your 
                  Account 
</a>&nbsp;|&nbsp;<a href="<{$xoops_url}>/user.php?op=logout">Logout</a>
 <{else}>
Welcome Guest. <a href="<{$xoops_url}>/register.php">Register</a> &nbsp;|&nbsp;<a href="<{$xoops_url}>/user.php">Sign In</a
                  <{/if}>


you can do this in your theme

try paste the code above in theme.html (themes/urtheme/)






199
mjoel
Re: [Mylinks] Looking for hacks
  • 2008/10/25 17:18

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


same topic

https://xoops.org/modules/newbb/viewtopic.php?topic_id=46061&forum=27&post_id=202297#forumpost202297



200
mjoel
Re: [Mylinks] Looking for hacks
  • 2008/10/25 17:13

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


example mylinks_link.htm (i modified mylinks heavily..im not sure if any of the variables below are declared in the ori mylinks module)

<a href="<{$xoops_url}>/directory/visit.php?cid=<{$link.cid}>&amp;lid=<{$link.id}>" target="_blank"><img align="left" title="<{$link.title}>" width="120px" height="90px" src="http://open.thumbshots.org/image.pxf?url=<{$link.url}>" id="thumbnail2" onload="if (this.width>50) this.border=1; this.alt='Thumbnails by Thumbshots.org';"></a>


* register with thumbshot first
* sorry no demo..private website




TopTop
« 1 ... 17 18 19 (20) 21 22 23 ... 28 »



Login

Who's Online

136 user(s) are online (95 user(s) are browsing Support Forums)


Members: 0


Guests: 136


more...

Donat-O-Meter

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

Latest GitHub Commits