I'd like to add an admin field so that I can switch on or off certain signup pages. Need this: 1) how to add an admin only field 2) how to read if that field is 'on'/'off' on a signup page 3) same as #2 but in site.php thanks, david
In case of you do not add user field to either signup or profile form then only admin can see/edit it. So just add new field at aMember CP -> Configuration -> Add User Fields You can add two type of fields - SQL and DATA: DATA: $user->data()->get('field_name'); SQL: $user->field_name; Do you mind to elaborate on point 2? What do you want to achieve here?
these are not user fields- this is so the admin can control if part of a signup form is viewable or not. David
Ummm ... a plugin with the settings (ie Signup Settings) which has the required settings so you can fiddle them in the ACP problem is that you would need to build a signup template which loads the settings and handles the insertions. This would mean the default brick system would be unusable for the optional sections.
should be addable using a site.php edit i would imagine. I just want to add an admin field, and check its status! David
In site.php Code: global $myStuffSwitch; $myStuffSwitch = true; in form; Code: global $myStuffSwitch; if( $myStuffSwitch ) { /// Added block } Should work .. maybe .. perhaps
In site... Code: class Am_Form_Setup_Option extends Am_Form_Setup { function __construct() { parent::__construct('Option'); $this->setTitle(___('Options')); $this->data['help-id'] = 'Setup/Options'; } function initElements() { $this->addElement('advcheckbox', 'myoption.switch', null) ->setLabel(___('Enable Switch')); } } Get value Code: $di = Am_Di::getInstance(); $val = $di->config->get('myoption.switch', false )
David, Do you want to control it on form basic (checkbox in signup form edit) or globally (checkbox in configuration)? What is part of signup form you want to hide/show? Do you want to skip some bricks? Thanks.
globally (checkbox in configuration) - in the admin setup or other admin screen. I'd like to essentially hide the entire signup form if this is enabled and show another one text. EG unchecked - > show order form checked -> show signup form/waiting list (no order)
Here is small mock up for misc plugin that do it, you can extend it according your requirements PHP: <?phpclass Am_Plugin_HideSignupForm extends Am_Plugin{ protected $_configPrefix = 'misc.'; function _initSetupForm(Am_Form_Setup $form) { $form->addAdvCheckbox('hide') ->setLabel('Hide Signup Form'); } function onLoadSignupForm(Am_Event $e) { if (!$this->getConfig('hide')) return; $form = $e->getReturn(); if ($form->code == 'OU0DHw7XE') { $view = $this->getDi()->view; $view->title = "Your Title"; $view->content = <<<CUT<strong>Your message here</strong>CUT; $view->display('member/layout.phtml'); throw new Am_Exception_Redirect; } }} You need to put this code to file amember/application/default/plugins/misc/hide-signup-form.php and then enable plugin at aMember CP -> Configuration -> Setup/Configuration -> Plugins (Other Plugins)
I took this and made CSaLT -- Coming Soon & Limited Time, it does the following Start/End Date for a sale/campaign Limit total sales and/or sales to a client Optionally totally hide product from all but the CSaLT designated signup form Redirect user to a page (default error message if blank) for Too Early -- Tried before start date Too Late -- Tried after finish date Too Many -- Sold out Too Many User -- limit per client I think I have the coding part done, just needs some documentation though. The options make it twiddly but it is set out to be easily understood if you understand the concept.