public static function output($atts = array()) { // Get the tabs $current_tab = wpaam_get_current_products_tab(); $all_tabs = array_keys(wpaam_get_products_page_tabs()); // Display template if (is_user_logged_in() && current_user_can('edit_product')) { get_wpaam_template('products.php', array('atts' => $atts, 'form' => self::$form_name, 'user_id' => self::$user->ID, 'current_tab' => $current_tab, 'all_tabs' => $all_tabs)); // Show login form if not logged in } else { echo wpaam_login_form(); } }
/** * 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_products_tab(); $all_tabs = array_keys(wpaam_get_products_page_tabs()); // Display template if (is_user_logged_in() && current_user_can('edit_product')) { if (isset($_POST['submit_wpaam_add_products'])) { // Show errors from fields self::show_errors(); // Show confirmation messages self::show_confirmations(); } elseif (isset($_POST['submit_wpaam_edit_products'])) { // Show errors from fields self::show_errors(); // Show confirmation messages self::show_confirmations(); } get_wpaam_template('forms/edit-product-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_products($atts = array()) { $user = wp_get_current_user(); // Get the tabs $current_tab = wpaam_get_current_products_tab(); $all_tabs = array_keys(wpaam_get_products_page_tabs()); // Display template if (is_user_logged_in() && current_user_can('edit_product')) { get_wpaam_template('products.php', array('atts' => $atts, 'user_id' => $user->ID, 'current_tab' => $current_tab, 'all_tabs' => $all_tabs)); } elseif (is_user_logged_in() && !current_user_can('edit_product')) { echo "You are not allowed to see this page"; // Show login form if not logged in } else { echo wpaam_login_form(); } }