1
souidas
Error with Wordpress Author Block!
  • 2006/1/10 17:30

  • souidas

  • Just popping in

  • Posts: 50

  • Since: 2005/11/21


I use Wordpress on my test Site and when I tryed to put a block (at the homepage) with all the Blog Authors I took a blank page and this error:

Quote:
Fatal error: Call to a member function on a non-object in /home/pandou/gba/lab/kernel/object.php on line 728
Warning [PHP]: Missing argument 1 for xoopsuserhandler() in file kernel/user.php line 537


Only myself Is the only Author until now. I making "not visible" the block and all its OK.

WordPress Configuration
PHP Version::4.3.10
MySQL Version::4.0.22
XOOPS Version::XOOPS 2.2.3 Final
Wordpress Version::1.52
safemode:OFF
register_globals:ON
magic_quotes_gpc:OFF
XML extension:ON
MB extension:ON

WordPress Stats
Category count:1
Blog article count:1
Author count:1

2
phppp
Re: Error with Wordpress Author Block!
  • 2006/1/10 17:53

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


Wordpress Version:: 1.52 Moon or 1.52 PHP ?

3
souidas
Re: Error with Wordpress Author Block!
  • 2006/1/10 18:11

  • souidas

  • Just popping in

  • Posts: 50

  • Since: 2005/11/21


From changelog...

XPress 1.5.2 (Moon)
Sep 05th, 2005

4
phppp
Re: Error with Wordpress Author Block!
  • 2006/1/10 18:35

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


I am not able to reproduce the error

plz modify wordpress/blocks/wp_authors.php to the following content, check if it works

<?php
// $Id: xoops_version.php,v 1.8 2005/06/03 01:35:02 phppp Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <https://xoops.org/>                             //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
// Author: phppp (D.J.)                                                      //
// URL: http://xoopsforge.com, https://xoops.org.cn                           //
// ------------------------------------------------------------------------- //
class myXoopsUserHandler extends XoopsUserHandler
{    
    
/**
     * Constructor
     *
     * @param object $db reference to the {@link XoopsDatabase} object     
     **/
    
function myXoopsUserHandler(&$db) {
        
$this->XoopsUserHandler($db);
    }
    
    
/**
     * get a list of user realnames and their IDs
     * 
     * @param object $criteria {@link CriteriaElement} object
     * @param string extraIdentiferName
     * @return array associative array of user-IDs and names
     */
    
function &getList($criteria null$limit 0$start 0$extraIdentiferName "") {
        
$ret = array();
        
$profile_handler =& xoops_gethandler('profile');
        
$sql 'SELECT '.$this->keyName.', '.$this->identifierName.(($extraIdentiferName)?", ".$extraIdentiferName:"").' FROM '.$this->table.' u, '.$profile_handler->table.' p WHERE u.'.$this->keyName.' = p.'.$this->_pHandler->keyName;
        if (isset(
$criteria) && is_subclass_of($criteria'criteriaelement')) {
            
$clause $criteria->render();
            if (
$clause != "") {
                
$sql .= ' AND '.$clause;
            }
            if (
$criteria->getSort() != '') {
                
$sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
            }
            else {
                
$sql .= ' ORDER BY '.$this->identifierName;
            }
            
$limit $criteria->getLimit();
            
$start $criteria->getStart();
        }
        
$result $this->db->query($sql$limit$start);
        if (!
$result) {
            return 
$ret;
        }

        
$myts =& MyTextSanitizer::getInstance();
        while (
$myrow $this->db->fetchArray($result)) {
            
//identifiers should be textboxes, so sanitize them like that
            
$ret[$myrow[$this->keyName]] = 
                empty(
$myrow[$extraIdentiferName])?
                
$myts->htmlSpecialChars($myrow[$this->identifierName]):
                
$myts->htmlSpecialChars($myrow[$extraIdentiferName]);
                
        }
        return 
$ret;
    }
}

function 
b_wordpress_authors_show($options)
{
    
$block['content'] = "<ul>".list_authors_xoops($options[0], $options[1], $options[2])."</ul>";
    
$block['content'] = encoding_wp2xoops($block['content']);
    return 
$block;
}

function 
b_wordpress_authors_edit($options)
{
    
$form _MB_WORDPRESS_COUNT."<input type='text' name='options[0]' value='" $options[0] . "' />";
    
    
$form .= "<br />"._MB_WORDPRESS_EXCLUEDEADMIN "<input type="radio" name="options[1]" value="1"";
    if (
$options[1] == 1$form .= " checked="checked"";
    
$form .= " />"._YES."; <input type="radio" name="options[1]" value="0"";
    if (
$options[1] == 0$form .= " checked="checked"";
    
$form .= " />"._NO;
    
    
$form .= "<br />"._MB_WORDPRESS_REALNAME "<input type="radio" name="options[2]" value="1"";
    if (
$options[2] == 1$form .= " checked="checked"";
    
$form .= " />"._YES."; <input type="radio" name="options[2]" value="0"";
    if (
$options[2] == 0$form .= " checked="checked"";
    
$form .= " />"._NO;
    
    return 
$form;
}
    

function 
list_authors_xoops($count 10$exclude_admin true$show_realname false
{
    
/* For wp blocks */
    
global $wpdb$wp_query$wp_rewrite;
    global 
$m$monthnum$year$timedifference$month$month_abbrev$weekday$weekday_initial$weekday_abbrev$posts$category_posts$use_cache;
    
/* */
    
$myts =& MyTextSanitizer::getInstance();
    
$member_handler =& xoops_getHandler("member");
    if(
$exclude_admin){
        
$admins implode(",",$member_handler->getUsersByGroup(XOOPS_GROUP_ADMIN));
    }
    require(
dirname(__FILE__).'/../wp-config.php');
    
$query "SELECT COUNT(ID) AS pcount, post_author AS uid from $wpdb->posts WHERE post_status = 'publish' " . ($exclude_admin "AND post_author NOT IN (".$admins.") " '') . " GROUP BY post_author ORDER BY pcount DESC";
    
$_authors $wpdb->get_results($query);
    if(!
is_array($_authors) || count($_authors) == 0) return null;

    
$authors = array();
    foreach(
$_authors as $author) {
        
$authors[$author->uid] = $author->pcount;
    }
    
$uids "(".implode(","array_keys($authors)).")";
    if(empty(
$show_realname)){
        
$users $member_handler->getUserList(new Criteria("uid"$uids"IN"));
    }else{
        
$user_handler = new myXoopsUserHandler($GLOBALS["xoopsDB"]);
        
$users $user_handler->getList(new Criteria("uid"$uids"IN"), 00"name");
    }
    
    
$author_link ="";
    foreach(
array_keys($authors) as $uid) {
        
$author_link .= "<li><a href="".get_author_link(0, $uid$users[$uid])."" title="Posts by ".$myts->htmlspecialchars($users[$uid])."">".$myts->htmlspecialchars($users[$uid])." (".intval($authors[$uid]).")</a></li>";
    }
    return 
$author_link;
}
    
?>

5
souidas
Re: Error with Wordpress Author Block!
  • 2006/1/10 19:33

  • souidas

  • Just popping in

  • Posts: 50

  • Since: 2005/11/21


Now It works OK. Your new code had 10lines more than this one that already had.

Thanks for your healp.

PS. I am a big fan of your modules. I already use Article 1.0 in a production site. And of course I made a utf-8 translation to n Greeks.

Login

Who's Online

141 user(s) are online (97 user(s) are browsing Support Forums)


Members: 0


Guests: 141


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