function wpaam_add_invoices_tabs($current_tab, $all_tabs, $form, $fields, $user_id, $atts) { get_wpaam_template("invoices-tabs.php", array('tabs' => wpaam_get_invoices_page_tabs(), 'current_tab' => $current_tab, 'all_tabs' => $all_tabs)); }
function wpaam_invoices_tab_exists($tab) { $exists = false; if (array_key_exists($tab, wpaam_get_invoices_page_tabs())) { $exists = true; } return $exists; }
/** * Output the form. * * @access public * @since 1.0.0 * @return void */ public static function output($atts = array()) { // Get the tabs $current_tab = wpaam_get_current_invoices_tab(); $all_tabs = array_keys(wpaam_get_invoices_page_tabs()); // Display template if (is_user_logged_in()) { if (isset($_POST['submit_wpaam_invoices'])) { // Show errors from fields self::show_errors(); // Show confirmation messages self::show_confirmations(); } get_wpaam_template('forms/edit-invoice-form.php', array('atts' => $atts, 'form' => self::$form_name, 'author_id' => self::$user->ID, 'current_tab' => $current_tab, 'all_tabs' => $all_tabs)); // Show login form if not logged in } else { echo wpaam_login_form(); } }
public function wpaam_invoices($atts, $content = null) { $user = wp_get_current_user(); //echo $user->roles[0]; die; //Get the tabs $current_invoices_tab = wpaam_get_current_invoices_tab(); $all_tabs_inv = array_keys(wpaam_get_invoices_page_tabs()); // Display template for aam user's if (is_user_logged_in() && current_user_can('edit_invoice') && current_user_can('publish_invoice')) { get_wpaam_template('invoices.php', array('atts' => $atts, 'form' => 'edit-invoice', 'user_id' => $user->ID, 'current_tab' => $current_invoices_tab, 'all_tabs' => $all_tabs_inv)); // Display Invoices list for client's } elseif (is_user_logged_in() && current_user_can('aam_client')) { get_wpaam_template('client_invoices.php', array('user_id' => $user->ID)); // Show login form if not logged in } else { echo wpaam_login_form(); } }