1
jimkarvo
View Workbook's submition to userpage
  • 2007/5/27 15:05

  • jimkarvo

  • Not too shy to talk

  • Posts: 169

  • Since: 2005/9/19


How I have the workbook's submitions to a userpage as a forum's / news's / gallery's posts?
whttp://www.pc4allgr.com - Greek community for PCs

PC4ALL Admins' Team!

2
jimkarvo
Re: View Wordbook's submition to userpage
  • 2007/5/31 19:58

  • jimkarvo

  • Not too shy to talk

  • Posts: 169

  • Since: 2005/9/19


No one Knows???
whttp://www.pc4allgr.com - Greek community for PCs

PC4ALL Admins' Team!

3
yerres
Re: View Wordbook's submition to userpage
  • 2007/6/1 8:54

  • yerres

  • Just popping in

  • Posts: 14

  • Since: 2006/9/1 7


good point. this would be a possible solution:
edit search.inc.php, delete l.16-19
if ( $userid != 0 )
        {
        return 
$ret;
        }

add before '// because count() ...'
if ( $userid != 0 ) {
        
$sql .= " AND uid = " .$userid. "";
    }

4
jimkarvo
Re: View Wordbook's submition to userpage
  • 2007/6/3 10:33

  • jimkarvo

  • Not too shy to talk

  • Posts: 169

  • Since: 2005/9/19


IF I did it correct, It didn't works...

<?php
/**
 * $Id: search.inc.php v 1.0 8 May 2004 hsalazar Exp $
 * Module: lyrics
 * Version: v 1.00
 * Release Date: 8 May 2004
 * Author: hsalazar
 * Licence: GNU
 */

function wb_search( $queryarray, $andor, $limit, $offset, $userid )
    {
    global 
$xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModule, $xoopsModuleConfig;

    
$ret = array();
    
$sql = "SELECT entryID, term, definition, ref, uid, datesub FROM " . $xoopsDB -> prefix( "wbentries" ) . " WHERE submit = 0 AND offline = 0 "; 
if ( 
$userid != 0 ) {
        
$sql .= " AND uid = " .$userid. "";
    }
    
// because count() returns 1 even if a supplied variable
    // is not an array, we must check if $querryarray is really an array
    
$count = count( $queryarray );
    if ( 
$count > 0 && is_array( $queryarray ) )
        {
        
$sql .= "AND ((term LIKE '%$queryarray[0]%' OR definition OR ref LIKE '%$queryarray[0]%')";
        for ( 
$i = 1; $i < $count; $i++ )
            {
            
$sql .= " $andor ";
            
$sql .= "(term LIKE '%$queryarray[$i]%' OR definition OR ref LIKE '%$queryarray[$i]%')";
            } 
        
$sql .= ") ";
        } 
    
$sql .= "ORDER BY entryID DESC";
    
$result = $xoopsDB -> query( $sql, $limit, $offset );
    
$i = 0;

    while ( 
$myrow = $xoopsDB -> fetchArray( $result ) )
        {
        
$ret[$i]['image'] = "images/wb.png";
        
$ret[$i]['link'] = "entry.php?entryID=" . $myrow['entryID'];
        
$ret[$i]['title'] = $myrow['term'];
        
$ret[$i]['time'] = $myrow['datesub'];
        
$ret[$i]['uid'] = $myrow['uid'];
        
$i++;
        } 
    return 
$ret;
    } 
?>
whttp://www.pc4allgr.com - Greek community for PCs

PC4ALL Admins' Team!

5
yerres
Re: View Wordbook's submition to userpage
  • 2007/6/3 14:41

  • yerres

  • Just popping in

  • Posts: 14

  • Since: 2006/9/1 7


<?php
/**
 * $Id: search.inc.php v 1.0 8 May 2004 hsalazar Exp $
 * Module: Wordbook
 * Version: v 1.00
 * Release Date: 8 May 2004
 * Author: hsalazar
 * Licence: GNU
 */

function wb_search( $queryarray, $andor, $limit, $offset, $userid )
    {
    global 
$xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModule, $xoopsModuleConfig;

    
$sql = "SELECT entryID, term, definition, ref, uid, datesub FROM " . $xoopsDB -> prefix( "wbentries" ) . " WHERE submit = 0 AND offline = 0 "; 
    if ( 
$userid != 0 && strlen($userid) < 9) {
        
$sql .= " AND uid = '".$userid."' ";
    }
    
// because count() returns 1 even if a supplied variable
    // is not an array, we must check if $querryarray is really an array
    
$count = count( $queryarray );
    if ( 
$count > 0 && is_array( $queryarray ) )
        {
        
$sql .= "AND ((term LIKE '%$queryarray[0]%' OR definition LIKE '%$queryarray[0]%' OR ref LIKE '%$queryarray[0]%')";
        for ( 
$i = 1; $i < $count; $i++ )
            {
            
$sql .= " $andor ";
            
$sql .= "(term LIKE '%$queryarray[$i]%' OR definition LIKE '%$queryarray[$i]%' OR ref LIKE '%$queryarray[$i]%')";
            } 
        
$sql .= ") ";
        } 
    
$sql .= "ORDER BY entryID DESC";
    
$result = $xoopsDB -> query( $sql, $limit, $offset );
    
$ret = array();
    
$i = 0;

    while ( 
$myrow = $xoopsDB -> fetchArray( $result ) )
        {
        
$ret[$i]['image'] = "images/wb.png";
        
$ret[$i]['link'] = "entry.php?entryID=" . $myrow['entryID'];
        
$ret[$i]['title'] = $myrow['term'];
        
$ret[$i]['time'] = $myrow['datesub'];
        
$ret[$i]['uid'] = $myrow['uid'];
        
$i++;
        } 
    return 
$ret;
    } 
?>

6
jimkarvo
Re: View Workbooks submition to userpage
  • 2007/6/4 7:10

  • jimkarvo

  • Not too shy to talk

  • Posts: 169

  • Since: 2005/9/19


Respect, yerres!

Now Do you know how I can count the submittions as the post/comments to grow up the users post/comments number and his rank?

Yours,
JimKarvo
whttp://www.pc4allgr.com - Greek community for PCs

PC4ALL Admins' Team!