1
Reintjan
help needed: add posts count to xfguestbook
  • 2009/5/6 12:12

  • Reintjan

  • Not too shy to talk

  • Posts: 144

  • Since: 2005/3/17


I'm using xfguestbook 2.5 and want posts to increase number of posts in the users account. I tried to figure how this works but i'm lost here...

Someone knows how to integrate this in xfguestbook?

Thanks for helping...
Be smart, stay smart. Stay one step ahead...

2
Reintjan
Re: help needed: add posts count to xfguestbook
  • 2009/5/8 7:25

  • Reintjan

  • Not too shy to talk

  • Posts: 144

  • Since: 2005/3/17


Anyone?
Be smart, stay smart. Stay one step ahead...

3
trabis
Re: help needed: add posts count to xfguestbook
  • 2009/5/8 12:35

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Hi, I have version 2.40 so you must check your code against mine.
Look in class/msg.php and replace this method:

function insert(&$msg)
    {
        if (
strtolower(get_class($msg)) != 'xfguestbookmsg') {
            return 
false;
        }
        if (!
$msg->cleanVars()) {
            return 
false;
        }
        foreach (
$msg->cleanVars as $k => $v) {
            ${
$k} = $v;
        }
        if (empty(
$msg_id)) {
            
$msg_id $this->db->genId('xfguestbook_msg_msg_id_seq');
            
$sql 'INSERT INTO '.$this->db->prefix('xfguestbook_msg').' (msg_id, user_id, uname, title, message, note, post_time, email, url, poster_ip, moderate, gender, country, photo, flagdir, other) VALUES ('.$msg_id.','.$user_id.', '.$this->db->quoteString($uname).', '.$this->db->quoteString($title).', '.$this->db->quoteString($message).', '.$this->db->quoteString($note).', '.$post_time.',  '.$this->db->quoteString($email).', '.$this->db->quoteString($url).', '.$this->db->quoteString($poster_ip).', '.$moderate.', '.$this->db->quoteString($gender).', '.$this->db->quoteString($country).', '.$this->db->quoteString($photo).', '.$this->db->quoteString($flagdir).', '.$this->db->quoteString($other).')';
        } else {
            
$sql 'UPDATE '.$this->db->prefix('xfguestbook_msg').' SET user_id='.$user_id.', uname='.$this->db->quoteString($uname).', title='.$this->db->quoteString($title).', message='.$this->db->quoteString($message).', note='.$this->db->quoteString($note).', email='.$this->db->quoteString($email).', url='.$this->db->quoteString($url).', moderate='.$moderate.', gender='.$this->db->quoteString($gender).', country='.$this->db->quoteString($country).', photo='.$this->db->quoteString($photo).', flagdir='.$this->db->quoteString($flagdir).', other='.$this->db->quoteString($other).' WHERE msg_id='.$msg_id;
        }
        if (!
$result $this->db->queryF($sql)) {
            return 
false;
        }
        if (empty(
$msg_id)) {
            
$msg_id $this->db->getInsertId();

            
// Hack for increment user posts by trabis            
            
$member_handler xoops_gethandler('member');
            
$poster $member_handler->getUser(intval($user_id));
            if (
is_object($poster)) {
                
$poster->setVar('posts'$poster->getVar('posts') + 1);
                
$member_handler->insertUser($postertrue));
            }
            
// End of hack
        
}
        
$msg->assignVar('msg_id'$msg_id);
        return 
$msg_id;
    }

4
Reintjan
Re: help needed: add posts count to xfguestbook
  • 2009/5/12 9:01

  • Reintjan

  • Not too shy to talk

  • Posts: 144

  • Since: 2005/3/17


Hello Trabis,

I inserted your hack but i get this error:

Parse error: syntax error, unexpected ')' in /home/vhosting/s/vhost0000694/domains/jzdhelios.nl/htdocs/www/modules/xfguestbook/class/msg.php on line 115

In line 115 is the last line of your hack....

I did compare the rest of the function with my file and these seem to be the same except for the hack code.

Can you please help me out here?

Thanks!
Be smart, stay smart. Stay one step ahead...

5
Reintjan
Re: help needed: add posts count to xfguestbook
  • 2009/5/12 9:07

  • Reintjan

  • Not too shy to talk

  • Posts: 144

  • Since: 2005/3/17


Ok, i found out i had to remove the last ) in the hack code. Now it workes perfect!

Thank you very much Trabis for your help!!!!
Be smart, stay smart. Stay one step ahead...

Login

Who's Online

184 user(s) are online (127 user(s) are browsing Support Forums)


Members: 0


Guests: 184


more...

Donat-O-Meter

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

Latest GitHub Commits