CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Jump to extension setup screen on enable
Pages: [1]

Author Topic: Jump to extension setup screen on enable  (Read 1140 times)

nicolas

  • I post occasionally
  • **
  • Posts: 92
  • Karma: 6
    • cividesk
  • CiviCRM version: 4.4 LTS
  • CMS version: Standalone (yep)
  • MySQL version: 5.1
  • PHP version: 5.3
Jump to extension setup screen on enable
March 22, 2013, 09:39:51 am
I have an extension that provides a form necessary in order to set it up. Right now there is a comment in the info.xml instructing users to use menu 'Administer / bla bla / bla bla' to setup the extension after install. So they install the extension, do not read the extension summary screen containing the above comment, click on Install and are back on the extension list screen - without a clue what to do next.

I would therefore like to jump to the extension setup screen on the 'enable' hook. I have tried:
function reformat_civicrm_enable() {
  // jump to the setup screen after enabling extension
  $session = CRM_Core_Session::singleton();
  $session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/setting/reformat'));
  return _reformat_civix_civicrm_enable();
}

but this does not work. Any other suggestions?

Thanks.
cividesk -- CiviCRM delivered ... your way!

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Jump to extension setup screen on enable
March 25, 2013, 11:13:49 am
You might try displaying a message instructing the user to go the config screen, e.g.

Code: [Select]
function reformat_civicrm_enable() {
  CRM_Core_Session::setStatus(ts('Please go to <a href="%1">the admin form</a>', array(
    1 => CRM_Utils_System::url('civicrm/admin/setting/reformat')
   )));
  return _reformat_civix_civicrm_enable();
}

An aside: it's also possible for extensions to be installed via API/cli (e.g. "drush cvapi extension.download keys=com.example.foo,com.example.bar"). I probably wouldn't expend much energy on making that CLI workflow nice or pretty, and either design (pushing-user-context or displaying a message) seems safe, but it's a reminder that we should be careful about accessing UI stuff in install/upgrade process

nicolas

  • I post occasionally
  • **
  • Posts: 92
  • Karma: 6
    • cividesk
  • CiviCRM version: 4.4 LTS
  • CMS version: Standalone (yep)
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Jump to extension setup screen on enable
April 01, 2013, 09:21:45 pm
Nice solution ... and reminder: I did not know you could install extensions with API/drush!
cividesk -- CiviCRM delivered ... your way!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Jump to extension setup screen on enable

This forum was archived on 2017-11-26.