1
wcrwcr
WebLog - duplicated options check boxes
  • 2004/3/22 6:41

  • wcrwcr

  • Home away from home

  • Posts: 1114

  • Since: 2003/12/12


Hi all!!

After a peacefull install the weblog module is showing on the post form duplicated "private" option check boxes.
The first one I presume must be "Disable html" and the second "Private".

I?m wondering if could be anything wrong with this piece of code on "weblog/post.php":
======================================================
// options check box
$checkbox_tray = new XoopsFormElementTray(_BL_OPTIONS ,'<br />');
$checkbox = new XoopsFormCheckBox('', 'nohtml', !$entry->doHtml());
$checkbox->addOption('nohtml', _BL_DISABLEHTML);
$checkbox_tray->addElement($checkbox);
$checkbox = new XoopsFormCheckBox('', 'private', $entry->isPrivate());
$checkbox->addOption('private', _BL_PRIVATE);
$checkbox_tray->addElement($checkbox);
$blog_form->addElement($checkbox_tray);
==========================================================
Trying to find a solution I commented out this line
====================================================
//$checkbox = new XoopsFormCheckBox('', 'private', $entry->isPrivate());
========================================================
and guess what?
now I have 4 check boxes
a pair of disable html and a pair of private!!!

Any tip???
Best regards,
Wilson
http://xoops.net.br

2
wcrwcr
Re: WebLog - duplicated options check boxes
  • 2004/3/22 15:47

  • wcrwcr

  • Home away from home

  • Posts: 1114

  • Since: 2003/12/12


Well, well.......
Still wondering..............

3
Venezia
Re: WebLog - duplicated options check boxes
  • 2004/5/4 22:21

  • Venezia

  • Just popping in

  • Posts: 36

  • Since: 2003/6/24


Yes, there is a bug in the code.

The $checkbox variable must be unset() before being used a second time. To work properly the code should read:

// options check box
$checkbox_tray = new XoopsFormElementTray(_BL_OPTIONS ,'<br />');
$checkbox = new XoopsFormCheckBox('', 'nohtml', !$entry->doHtml());
$checkbox->addOption('nohtml', _BL_DISABLEHTML);
$checkbox_tray->addElement($checkbox);
unset($checkbox); //destroy first instance
$checkbox = new XoopsFormCheckBox('', 'private', $entry->isPrivate());
$checkbox->addOption('private', _BL_PRIVATE);
$checkbox_tray->addElement($checkbox);
$blog_form->addElement($checkbox_tray);

4
WarDick
Re: WebLog - duplicated options check boxes
  • 2004/5/4 22:36

  • WarDick

  • Just can't stay away

  • Posts: 890

  • Since: 2003/9/13


This is a good fix.

Thank you very much.

5
wcrwcr
Re: WebLog - duplicated options check boxes
  • 2004/5/26 3:01

  • wcrwcr

  • Home away from home

  • Posts: 1114

  • Since: 2003/12/12


Hey thanks Venezia!

I have the same results with a maybe not so elegant solution:


// options check box
$checkbox_tray = new XoopsFormElementTray(_BL_OPTIONS ,'<br />');
$checkbox = new XoopsFormCheckBox('', 'nohtml', !$entry->doHtml());
$checkbox->addOption('nohtml', _BL_DISABLEHTML);
$checkbox_tray->addElement($checkbox);
$checkbox2 = new XoopsFormCheckBox('', 'private', $entry->isPrivate());
$checkbox2->addOption('private', _BL_PRIVATE);
$checkbox_tray->addElement($checkbox2);
$blog_form->addElement($checkbox_tray);

=======================================================

Thanks for the reply.
Regards,
Wilson

6
razzrezz
Re: WebLog - duplicated options check boxes
  • 2004/7/14 18:06

  • razzrezz

  • Just popping in

  • Posts: 3

  • Since: 2004/7/8 3


Thanks for the FIX

I hope my php skills will be up there with yours someday

Login

Who's Online

193 user(s) are online (128 user(s) are browsing Support Forums)


Members: 0


Guests: 193


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