0

I have been using MoreEvents for event registrations and now it will no longer save event information (specifically, the Registration cut-off date and ability to open Global Memberships to registration). Because of this, registration functionality no longer works. I noticed in developer log that it was throwing an error:

Deprecated function set_variable() called in system/expressionengine/third_party/moreevents/mcp.moreevents.php on line 114. Deprecated since 2.6. Use view-> = ; instead.

Since the add-on is no longer supported, I wanted to find out if this is something that could be fixed? Or, if anyone else has found a fix?

There is a thread over at devot-ee (http://devot-ee.com/add-ons/support/moreevents/viewthread/10239) that references this but the solution that is provided didn't work for me.

Any help or direction would be appreciated.

0

Certainly found a fix for this, following advise here - https://ellislab.com/expressionengine/user-guide/development/usage/cp.html#set-variables

For instance at mcp.moreevents.php:17

$this->EE->cp->set_variable('cp_page_title', $this->EE->lang->line('moreevents_config_heading'));

replace with

$this->EE->view->cp_page_title = $this->EE->lang->line('moreevents_config_heading');

A simple find/replace of all instances of set_variable() will fix this.

Still yet to find the issue as to why event data is not being saved...

Edit - saving fixes below

The following lines need to altered to ensure saving works - seems to be an issue around strtotime (the two values using this are already in a time format, so this is largely unnecessary. Maybe I'm missing something?.

models/more_event_data.php:165

    $data = array(
        "status"                        => $this->_yep_nope($params['mod_data']['status']),
        "registration_expiry"           => $params['mod_data']['registration_expiry'],
        "notify_on_registration"        => $this->_yep_nope($params['mod_data']['notify_on_registration']),
        "notify_email"                  => $params['mod_data']['notify_email'],
        "member_prices"                 => serialize($params['mod_data']['member_price'][0]),
        "member_permissions"            => serialize($params['mod_data']['member_price'][1]),
        "member_earlybird_prices"       => serialize($params['mod_data']['member_price'][2]),
        "custom_fields"                 => serialize($params['mod_data']['custom_fields']),
        "tickets_available"             => $params['mod_data']['tickets_available'],
        "earlybird_expiry"              => $params['mod_data']['earlybird_expiry']
    );

ext.moreevents.php:103

When changing the 'Notify on Registration' dropdown, this was the only field that didn't trigger the save() function to actually save its value to the DB. Adding the below line at line 103 (after very similar looking lines for other fields) seemed to do the trick. However, once removing this line afterwards, it all seems to work normally. To be safe, its best to add this line anyway.

$query_result[$key]['event:notify_on_registration'] = $is_event ? $event['notify_on_registration'] : NULL;

mod.moreevents.php:54, 57, 79, 108, 111, 228, 415, 525

Replace

$this->EE->functions->redirect($this->EE->functions->create_url($this->EE->functions->remove_double_slashes($next_page ."/".$event_tx_id)));

with

if (version_compare(APP_VER, '2.6', '>=')) {
    $this->EE->load->helper('string');
    $sFixedslashes = reduce_double_slashes($next_page ."/".$event_tx_id);
} else {
    $sFixedslashes = $this->EE->functions->remove_double_slashes($next_page ."/".$event_tx_id);
}

$this->EE->functions->redirect($this->EE->functions->create_url($sFixedslashes));

or for only >= 2.6 support:

$this->EE->load->helper('string');
$this->EE->functions->redirect($this->EE->functions->create_url(reduce_double_slashes($next_page ."/".$event_tx_id)));

FINAL EDIT

I've created a Gist of all the fixes and files so you can simply copy/paste to have them fully working. Any new issues I find will be updated in the Gist.

| improve this answer | |
  • Brad, thank you so much for the above information. I too have started to use MoreEvents and encountered the same above issues. I very much appreciate your help. Regards Richard – Richard Hall Jan 15 '15 at 8:36
  • Hopefully the above fixes helped getting things working! Let me know if not, and would be happy to assist further. – crawf Jan 15 '15 at 10:45
  • Hi crawf, I have altered the code as you suggested and installed ok but when I come to the publish screen and press the "event information" tab it is totally blank. – Kippi Feb 3 '15 at 17:24
  • @Kippi thats interesting - did you use the files in the posted Gist (it's right at the end). The screen shows all the fields as expected for me. Any info on PHP version? And JS errors? – crawf Feb 4 '15 at 12:14
  • Hi and thanks for the reply. I did some testing and I think it has something to do with "Custom Layouts" I set up a new channel and field group and it shows up fine. Ill probably have to reset the "Custom Layout" and see if that help. – Kippi Feb 4 '15 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.