1
Burning
News 1.66 - How to hide Approve checkbox ?
  • 2010/10/6 23:49

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi'

I'm trying to simplify submit and edit forms.

I would like to keep only these fields :
• title (text field)
• subject (list of choix)
• scoop (text area)
• body text (text area)
• upload fields (for attached files and image)

I have already hidden all fields I want :
• news/include/storyform.original.inc.php --> to simplify public edit form and back office forms
• news/include/storyform.inc.php --> to simplify submit form front office)

... except one :(

How could I hide the approve checkbox ?

Here is the code (News 1.66):
//Set date of publish/expiration
if ($approveprivilege) {
    if(
is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
        
$approve=1;
    }
$approve_checkbox = new XoopsFormCheckBox('''approve'$approve);
$approve_checkbox->addOption(1_AM_APPROVE);
$option_tray->addElement($approve_checkbox);

   
$check $published>:0;
$published_checkbox = new XoopsFormCheckBox('''autodate',$check);
$published_checkbox->addOption(1_AM_SETDATETIME);
    
$option_tray->addElement($published_checkbox);
$option_tray->addElement(new XoopsFormDateTime(_AM_SETDATETIME'publish_date'15$published));


$check=$expired>:0;
$expired_checkbox = new XoopsFormCheckBox('''autoexpdate'$check);
$expired_checkbox->addOption(1_AM_SETEXPDATETIME);
    

$option_tray->addElement($expired_checkbox);
$option_tray->addElement(new XoopsFormDateTime(_AM_SETEXPDATETIME'expiry_date'15$expired));

}


If I comment this line, checkbox is hidden as I would like but article is not approved (moderation is needed).
Quote:

$option_tray->addElement($approve_checkbox);


Thanks in advance for response
Still learning CSS and... english

2
ghia
Re: News 1.66 - How to hide Approve checkbox ?
  • 2010/10/7 8:44

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You need to replace it by an hidden input with the same name and the required value (1 or true).
$sform->addElement(new XoopsFormHidden('approve'1));


3
Burning
Re: News 1.66 - How to hide Approve checkbox ?
  • 2010/10/7 9:05

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi'

Thanks a lot, it works fine !
... and I feel less stupid now with XoopsFormHidden instruction
Still learning CSS and... english

4
Burning
Re: News 1.66 - How to hide Approve checkbox ?
  • 2010/10/14 18:36

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi'

... sorry to bump it, but I have another question about News submit form.

I would like to hide list wich permits to choice subjects (because I have only one) :

include_once XOOPS_ROOT_PATH."/class/tree.php";
$allTopics $xt->getAllTopics($xoopsModuleConfig['restrictindex'],'news_submit');
$topic_tree = new XoopsObjectTree($allTopics'topic_id''topic_pid');
$topic_select $topic_tree->makeSelBox('topic_id''topic_title''-- '$topicidfalse);

$sform->addElement(new XoopsFormLabel(_NW_TOPIC$topic_select));


This kind of instruction does not work
Quote:
$sform->addElement(new XoopsFormHidden(_NW_TOPIC, $topic_select));
Still learning CSS and... english

5
ghia
Re: News 1.66 - How to hide Approve checkbox ?
  • 2010/10/14 18:46

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


$sform->addElement(new XoopsFormHidden('topic_id'1));
First parameter is the name of the field. This can't be a language constant _NW_TOPIC (if you look it up you know why).
Second parameter is the value that otherwise would be filled in or selected (here number of the topic).

6
Burning
Re: News 1.66 - How to hide Approve checkbox ?
  • 2010/10/14 19:03

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


Thanks, I begin to understand... it is very simple to make hacks with you !
Still learning CSS and... english

Login

Who's Online

147 user(s) are online (86 user(s) are browsing Support Forums)


Members: 0


Guests: 147


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