/** * Plugin Activation * */ public function activate() { if (!class_exists('\\WP_CRM_F')) { include_once ud_get_wp_crm()->path("lib/class_functions.php", 'dir'); } \WP_CRM_F::maybe_install_tables(); \WP_CRM_F::manual_activation('auto_redirect=false&update_caps=true'); }
/** * Installs tables and runs WP_CRM_F::manual_activation() which actually handles the upgrades * * @since 0.01 * */ static function activation() { WP_CRM_F::maybe_install_tables(); WP_CRM_F::manual_activation('auto_redirect=false&update_caps=true'); }
/** * Runs pre-header functions for settings page * * * @since 0.1 * */ function crm_page_wp_crm_settings() { // Download backup of configuration if ($_REQUEST['wp_crm_action'] == 'download-wp_crm-backup' && wp_verify_nonce($_REQUEST['_wpnonce'], 'download-wp_crm-backup')) { global $wp_crm; $sitename = sanitize_key(get_bloginfo('name')); $filename = $sitename . '-wp-crm.' . date('Y-m-d') . '.txt'; header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename={$filename}"); header("Content-Transfer-Encoding: binary"); header('Content-Type: text/plain; charset=' . get_option('blog_charset'), true); echo json_encode($wp_crm); die; } //** Make sure tables are up to date */ WP_CRM_F::maybe_install_tables(); }
/** * Installs tables and runs WP_CRM_F::manual_activation() which actually handles the upgrades * * @since 0.01 * */ function activation() { global $current_user, $wp_crm, $wp_roles; WP_CRM_F::maybe_install_tables(); WP_CRM_F::manual_activation('auto_redirect=false&update_caps=true'); }
/** * Runs pre-header functions for settings page * * * @since 0.1 * */ static function crm_page_wp_crm_settings() { //** Download backup of configuration */ if (!empty($_REQUEST['wp_crm_action']) && $_REQUEST['wp_crm_action'] == 'download-wp_crm-backup' && wp_verify_nonce($_REQUEST['_wpnonce'], 'download-wp_crm-backup')) { global $wp_crm; $sitename = sanitize_key(get_bloginfo('name')); $filename = $sitename . '-wp-crm.' . date('Y-m-d') . '.txt'; header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename={$filename}"); header("Content-Transfer-Encoding: binary"); header('Content-Type: text/plain; charset=' . get_option('blog_charset'), true); echo json_encode($wp_crm); die; } //** Make sure tables are up to date */ WP_CRM_F::maybe_install_tables(); //** Help items for this page */ $contextual_help['General Help'][] = '<h3>' . __('Roles - Hidden Attributes', 'wp_crm') . '</h3>'; $contextual_help['General Help'][] = '<p>' . __('If certain user attributes are not applicable to certain roles, such as "Client Type" to the "Administrator" role, you can elect to hide the unapplicable attributes on profile editing pages.', 'wp_crm') . '</p>'; $contextual_help['General Help'][] = '<h3>' . __('Predefined Values', 'wp_crm') . '</h3>'; $contextual_help['General Help'][] = '<p>' . __('If you want your attributes to have predefined values, such as in a dropdown, or a checkbox list, enter a comma separated list of values you want to use. You can also get more advanced by using taxonomies - to load all values from a taxonomy, simply type line: <b>taxonomy:taxonomy_name</b>.', 'wp_crm') . '</p>'; $contextual_help['Shortcode Forms'][] = '<h3>' . __('Shortcode Forms', 'wp_crm') . '</h3>'; $contextual_help['Shortcode Forms'][] = '<p>' . __('Shortcode Forms, which can be used for contact forms, or profile editing, are setup here, and then inserted using a shortcode into a page, or a widget. The available shortcode form attributes are taken from the WP-CRM attributes, and when filled out by a user, are mapped over directly into their profile. User profiles are created based on the e-mail address, if one does not already exist, for keeping track of users. ', 'wp_crm') . '</p>'; $contextual_help['Shortcode Forms'][] = '<h3>' . __('Shortcode Forms attributes', 'wp_crm') . '</h3>'; $contextual_help['Shortcode Forms'][] = '<p> - ' . __('display_notes = [ true | <b>false</b> ] — If a note exists for an attribute, it will be shown on the right.', 'wp_crm') . '</p>'; $contextual_help['Shortcode Forms'][] = '<p> - ' . __('require_login_for_existing_users = [ <b>true</b> | false ]', 'wp_crm') . '</p>'; $contextual_help['Shortcode Forms'][] = '<p> - ' . __('use_current_user = [ <b>true</b> | false ]', 'wp_crm') . '</p>'; $contextual_help['Shortcode Forms'][] = '<p> - ' . __('success_message = "<i>custom text</i>" — default value is "', 'wp_crm') . __('Your message has been sent. Thank you.', 'wp_crm') . '".</p>'; $contextual_help['Shortcode Forms'][] = '<p> - ' . __('submit_text = "<i>custom text</i>" — default value is "', 'wp_crm') . __('Submit', 'wp_crm') . '".</p>'; $contextual_help['Shortcode Forms'][] = '<p> - ' . __('js_callback_function = "<i>custom_function_name</i>" — default value is "', 'wp_crm') . __('false', 'wp_crm') . '".</p>'; $contextual_help['Shortcode Forms'][] = '<p> - ' . __('js_validation_function = "<i>custom_function_name</i>" — default value is "', 'wp_crm') . __('false', 'wp_crm') . '".</p>'; $contextual_help['Shortcode Forms'][] = '<p>' . __('For example, <b>[wp_crm_form form=example_from display_notes=true success_message="Your message was successfully sent!" submit_text="Send message!"]</b>', 'wp_crm') . '</p>'; $contextual_help['Shortcode Forms'][] = '<p>' . __('If a new user fills out a form, an account will be created for them based on the specified role. ', 'wp_crm') . '</p>'; $contextual_help['Shortcode Forms'][] = '<p>' . __('<b>Important</b>: user\'s email attribute should have slug \'user_email\'.', 'wp_crm') . '</p>'; $contextual_help['Shortcodes'][] = '<h3>' . __('Automation', 'wp_crm') . '</h3>'; $contextual_help['Shortcodes'][] = '<p>' . __('Use other attribute as components. Example: <b>[last_name], [rank]</b> will become <b>Smith, Sgt.</b>', 'wp_crm') . '</p>'; $contextual_help['Shortcodes'][] = '<h3>' . __('Notifications and Trigger Actions', 'wp_crm') . '</h3>'; $contextual_help['Shortcodes'][] = '<p>' . __('Notification messages can be fired off when certain events, such as contact form submission, are executed. Multiple notification events can be attached to a single <b>trigger action</b>. Multiple tags, such as <b>[user_email]</b> and <b>[display_name]</b>, are available to be used as dynamically replaceable tags when setting up notifications.', 'wp_crm') . '</p>'; $contextual_help['Shortcodes'][] = '<p>' . __('Which tags are available depend on the trigger event, but in most cases all user data slugs can be used. On a shortcode form message, <b>[message_content]</b>, <b>[profile_link]</b> and <b>[trigger_action]</b> variables are also available.', 'wp_crm') . '</p>'; //** Hook this filter if you need to add something */ $contextual_help = apply_filters('crm_page_wp_crm_settings_help', $contextual_help); do_action('wp_crm_contextual_help', array('contextual_help' => $contextual_help)); }