11
teibaz
Re: single singin
  • 2006/11/29 10:56

  • teibaz

  • Not too shy to talk

  • Posts: 103

  • Since: 2004/6/13


could you please specify more detailed your problem?



12
teibaz
Re: Smarty Tag / PHP Question
  • 2006/11/26 16:54

  • teibaz

  • Not too shy to talk

  • Posts: 103

  • Since: 2004/6/13


Just remember that if you hack smth from 'system' directory like this time - be careful with XOOPS upgrade later.



13
teibaz
Re: Change Homepage?
  • 2006/11/25 15:45

  • teibaz

  • Not too shy to talk

  • Posts: 103

  • Since: 2004/6/13


Simply put this code:
<form action="http://www.yourxoopssite.com/user.php" method="post">
    
Username: <br>
    <
input name="uname" size="12" value="" maxlength="25" type="text"><br>

    
Password: <br>
    <
input name="pass" size="12" maxlength="32" type="password"><br>
    <
input name="op" value="login" type="hidden">
    <
input value="User Login" type="submit"><br>
</
form>


But remember that you'll be redirect in your XOOPS site even if member login fail.

In XOOPS you can create plain block, so add there your link to non-xoops site and that's all.



14
teibaz
Re: Change Homepage?
  • 2006/11/25 13:27

  • teibaz

  • Not too shy to talk

  • Posts: 103

  • Since: 2004/6/13


Quote:

melissawb wrote:
Hi,

I have a homepage that has a members section. The members section is powered by xoops. How can I put a link on the login page which will take the user back to the original home page (not part of xoops)?


Sorry, I can't understand what do you want to do

You want that:
* users that logged in would be redirected to your site?
* users that login incorrectly would be redirected to your site?
* you would have login block in your non-xoops site, and after user login it would be redirected to xoops?

:) If you ask more clearly maybe someone could help you :)

Good luck,
teibaz



15
teibaz
Re: Smarty Tag / PHP Question
  • 2006/11/25 13:13

  • teibaz

  • Not too shy to talk

  • Posts: 103

  • Since: 2004/6/13


I don't know what XOOPS version do you use, but probably it's XOOPS 2.0.x so i downloaded that version :)

File: modules\system\blocks\system_blocks.php
Lines: from 267 to 289

Now there is such code:
function b_system_newmembers_show($options)
{
    
$block = array();
    
$criteria = new CriteriaCompo(new Criteria('level'0'>'));
    
$limit = (!empty($options[0])) ? $options[0] : 10;
    
$criteria->setOrder('DESC');
    
$criteria->setSort('user_regdate');
    
$criteria->setLimit($limit);
    
$member_handler =& xoops_gethandler('member');
    
$newmembers $member_handler->getUsers($criteria);
    
$count count($newmembers);
    for (
$i 0$i $count$i++) {
        if ( 
$options[1] == ) {
            
$block['users'][$i]['avatar'] = $newmembers[$i]->getVar('user_avatar') != 'blank.gif' XOOPS_UPLOAD_URL.'/'.$newmembers[$i]->getVar('user_avatar') : '';
        } else {
            
$block['users'][$i]['avatar'] = '';
        }
        
$block['users'][$i]['id'] = $newmembers[$i]->getVar('uid');
        
$block['users'][$i]['name'] = $newmembers[$i]->getVar('uname');
        
$block['users'][$i]['joindate'] = formatTimestamp($newmembers[$i]->getVar('user_regdate'), 's');
    }
    return 
$block;
}


You should change this function into:
function b_system_newmembers_show$options ) {

    
/**
     * XOOPS database object
     */
    
$xoopsDB =& Database::getInstance();
    
    
/**
     * Old block
     */
    
$block = array();
    
$criteria = new CriteriaCompo(new Criteria('level'0'>'));
    
$limit = (!empty($options[0])) ? $options[0] : 10;
    
$criteria->setOrder('DESC');
    
$criteria->setSort('user_regdate');
    
$criteria->setLimit($limit);
    
$member_handler =& xoops_gethandler('member');
    
$newmembers $member_handler->getUsers($criteria);
    
$count count($newmembers);
    for (
$i 0$i $count$i++) {
        if ( 
$options[1] == ) {
            
$block['users'][$i]['avatar'] = $newmembers[$i]->getVar('user_avatar') != 'blank.gif' XOOPS_UPLOAD_URL.'/'.$newmembers[$i]->getVar('user_avatar') : '';
        } else {
            
$block['users'][$i]['avatar'] = '';
        }
        
$block['users'][$i]['id'] = $newmembers[$i]->getVar('uid');
        
$block['users'][$i]['name'] = $newmembers[$i]->getVar('uname');
        
$block['users'][$i]['joindate'] = formatTimestamp($newmembers[$i]->getVar('user_regdate'), 's');
    }
    
    
/**
     * Get time for query (we use here 24hours)
     */
    
$time time() - 24*3600;
    
    
/**
     * SQL query
     */
    
$sql "SELECT COUNT( last_login ) AS count FROM " $xoopsDB->prefix'user_profile' ) . " WHERE last_login >= '" $time "'";
    
    
/**
     * Get results
     */
    
list( $count ) = $xoopsDB->fetchRow$xoopsDB->query$sql ) );
    
    
/**
     * Assign results to return variable
     */
    
$block['users_in_last_24_hours'] = intval$count );
    
    return 
$block;
}


And now in your template (modules\system\templates\blocks\system_block_newusers.html) you have a new variable <{$block.users_in_last_24_hours}> and you can put it anywhere you like.


P.S.
Sorry, but i was too lazy to test this function :) i believe that it works, but i cant assure you

Good luck,
teibaz



16
teibaz
Re: Smarty Tag / PHP Question
  • 2006/11/24 22:58

  • teibaz

  • Not too shy to talk

  • Posts: 103

  • Since: 2004/6/13


Quote:

DevlshOne wrote:
I'd like to modify the system_block_newusers.html template to report how many new users have registered in the past 24 hours but am not seeing how to incorporate some type of query to provide the count. Does anyone have an example of this I could pick apart?


Users in last 24 hours? I would do that in this way (i wrote this for function for XOOPS 2.2.4, but i believe that it's for XOOPS 2.x)

/**
 * Get user count by last login time
 *
 * @param int $hours
 * @return int
 */
function getLastLoggedUserList$hours 24 ) {

    
/**
     * XOOPS database class
     */
    
global $xoopsDB;
    
    
/**
     * Define default return value
     */
    
$count 0;
    
    
/**
     * Get time for query
     */
    
$time = ( intval$hours ) > ) ? time() - ( intval$hours ) * 3600 ) : ( time() - 24*3600 );
    
    
/**
     * SQL query
     */
    
$sql "SELECT COUNT( last_login ) AS count FROM " $xoopsDB->prefix'user_profile' ) . " WHERE last_login >= '" $time "'";
    
    
/**
     * Get results
     */
    
list( $count ) = $xoopsDB->fetchRow$xoopsDB->query$sql ) );
    
    return 
$count;
}


If you would like such function for XOOPS 2.0.x, i believe that it's enought to change your sql to this:

$sql "SELECT COUNT( last_login ) AS count FROM " $xoopsDB->prefix'users' ) . " WHERE last_login >= '" $time "'";



So, just put this function near your other functions and call it with hours as parameter.

Hope this was helpful.



17
teibaz
Re: use $xoposDB in own php file
  • 2006/11/24 22:21

  • teibaz

  • Not too shy to talk

  • Posts: 103

  • Since: 2004/6/13


Quote:

mdeshane wrote:

Try:

<?php

include( '../../mainfile.php' ) ;

function writehistory($uid, $toid, $action, $comment)
global $xoopsDB;
{
//schreibt einen historyeintrag

//$historytable = $db->prefix("history");
//die ($historytable);
$historytable = "xoops_history";
$xoopsDB->query("INSERT INTO $historytable (uid, date, action, comment, toid) VALUES ($uid, NOW(), $action, '$comment', $toid)");
}
?>


nope :) you cannot write like this, you'll get parse error :)

global $xoopsDB; must be in function

i mean:

function blaBla( $bla, $bla ) {
global $xoopsDB;
//code
}



18
teibaz
Re: Minor bug in $reservedTables
  • 2006/11/23 21:15

  • teibaz

  • Not too shy to talk

  • Posts: 103

  • Since: 2004/6/13


I use 2.2.4 (actually i modified it a lot and now it's half XOOPS 2.2.4, half ???)

In 2.2.4 there is only one place in that file with this variable, but i downloaded newest XOOPS release 2.0.16 and write this post by the source of XOOPS 2.0.16.



19
teibaz
Re: synchronize XOOPS code and Database
  • 2006/11/20 9:33

  • teibaz

  • Not too shy to talk

  • Posts: 103

  • Since: 2004/6/13


I suggest you to use SubVersion, so you can see all your changes in your source.

For database differences I do this:
Get structure of production site,
get structure of development site and I use TotalCommander to compare these files.



20
teibaz
Re: my album latest listings off? MyAlbum 2.84
  • 2006/11/19 23:45

  • teibaz

  • Not too shy to talk

  • Posts: 103

  • Since: 2004/6/13


and what would you like to see instead of latest photos?




TopTop
« 1 (2) 3 4 5 ... 8 »



Login

Who's Online

30 user(s) are online (9 user(s) are browsing Support Forums)


Members: 0


Guests: 30


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