*

msaki

  • *
  • 1 posts
Regarding the "Show Email" checkbox in the admin panel
« on: July 13, 2024, 12:12:44 AM »
Hello, First of all, I've just started using this software and I'm making some additions and modifications according to my needs. The issue I'm going to mention might be caused by me, so I wanted to point that out.

When editing an item/ad in the admin panel, if I select the Show Email checkbox and save, the checkbox is not selected when I re-enter the editing page. If I save it again by mistake, it gets saved as email not to be shown.

To fix this, I edited the Item.form.class.php in the /oc-includes/osclass/frm/ path as follows, and it solved the problem (I hope I did it correctly).

Original code:
  public static function show_email_checkbox($item = null) {
    if($item==null) { $item = osc_item(); }
    if(Session::newInstance()->_getForm('showEmail') != 0) {
     $item['b_show_email'] = Session::newInstance()->_getForm('showEmail');
    }
    parent::generic_input_checkbox('showEmail', '1', isset($item['b_show_email']) ? $item['b_show_email'] : false);
    return true;
  }

My edited version:
  public static function show_email_checkbox($item = null) {
    if($item==null) { $item = osc_item(); }

    /** original
    * if(Session::newInstance()->_getForm('showEmail') != 0) {
    *  $item['b_show_email'] = Session::newInstance()->_getForm('showEmail');
    * }
    * original**/

    /** my edit **/
    if(Session::newInstance()->_getForm('showEmail') == 1) {
      $item['b_show_email'] = true;
    }
    /** my edit **/
   
    parent::generic_input_checkbox('showEmail', '1', isset($item['b_show_email']) ? $item['b_show_email'] : false);
    return true;
  }

I wanted to report this.

*

MB Themes

Re: Regarding the "Show Email" checkbox in the admin panel
« Reply #1 on: July 13, 2024, 02:19:22 PM »
Its not using session value so not ideal code
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots