public function my_account_page_shortcode($attr) { global $wp; $args = array(); if (!is_user_logged_in()) { if (isset($wp->query_vars['lost-password'])) { $args['form'] = 'lost_password'; // process reset key / login from email confirmation link if (isset($_GET['key']) && isset($_GET['login'])) { $user = self::_check_password_reset_key($_GET['key'], $_GET['login']); // reset key / login is correct, display reset password form with hidden key / login values if (is_object($user)) { $args['form'] = 'reset_password'; $args['key'] = esc_attr($_GET['key']); $args['login'] = esc_attr($_GET['login']); } } elseif (isset($_GET['reset'])) { bon_error_notice()->add('password_reset_success', __('Your password has been reset.', 'bon') . ' <a href="' . $this->my_account_url() . '">' . __('Log in', 'bon') . '</a>', 'success'); } } else { $args['form'] = 'login'; $args['lost_password_url'] = $this->lost_password_url(); } } else { if (isset($wp->query_vars['edit-account'])) { $args['form'] = 'edit_account'; $args['user'] = get_user_by('id', get_current_user_id()); if ($args['user']) { $args['user']->filter = 'edit'; } } else { if (isset($_GET['updated'])) { bon_error_notice()->add('edit_success', __('Account details changed successfully.', 'bon'), 'success'); } $args['current_user'] = get_user_by('id', get_current_user_id()); $args['edit_account_url'] = $this->edit_account_url(); } } bon_get_template('accounts/account.php', $args); }
<div class="<?php echo apply_filters('bon_login_form_wrap', 'bon-login-form-wrap'); ?> "> <?php bon_get_template('accounts/form-login.php', $args); ?> </div> <?php if (get_option('users_can_register')) { ?> <div class="<?php echo apply_filters('bon_register_form_wrap', 'bon-register-form-wrap'); ?> "> <?php bon_get_template('accounts/form-register.php'); ?> </div> <?php } ?> </div> <?php do_action('bon_after_login_form');
<?php if (!defined('ABSPATH')) { exit('No direct script access allowed'); } // Exit if accessed directly /** * * @author Hermanto Lim * @copyright Copyright (c) Hermanto Lim * @link http://bonfirelab.com * @since Version 1.3 * @package BonFramework * @subpackage Template * @category Account * * */ if (isset($args['form'])) { if ($args['form'] == 'lost_password' || $args['form'] == 'reset_password') { bon_get_template('accounts/form-lost-password.php', $args); } if ($args['form'] == 'edit_account') { bon_get_template('accounts/form-edit-account.php', $args); } if ($args['form'] == 'login') { bon_get_template('accounts/form-views.php', $args); } } else { bon_get_template('accounts/my-account.php', $args); }
public function front_end_editor_shortcodes($attr) { global $wp, $current_screen, $wp_meta_boxes, $post; $is_bac = $this->is_bac(); $output = ''; /** * Start Checking the Conditional needed to render editor * Define Variable needed for use in whole function * * */ if (!is_user_logged_in()) { if ($is_bac === true) { wp_safe_redirect(bon_accounts()->my_account_url()); } else { if (is_woocommerce_activated()) { wp_safe_redirect(get_permalink(wc_get_page_id('myaccount'))); } } } else { if (!$this->is_edit()) { return; } $object_id = $this->get_post_to_edit(); if (!$object_id) { bon_error_notice()->add('invalid_post', __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?'), 'error'); return; } $post_object = get_post($this->get_post_to_edit()); setup_postdata($GLOBALS['post'] =& $post_object); $current_post_type = get_post_type($object_id); if (!$post_object) { bon_error_notice()->add('invalid_post', __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?'), 'error'); return; } if (!current_user_can('edit_post', $object_id)) { bon_error_notice()->add('permission_denied', __('You are not allowed to edit this item.'), 'error'); return; } if (!post_type_supports($post_object->post_type, 'front-end-editor')) { bon_error_notice()->add('unsupported_posttype', __('The post type assigned is not supporting front end post', 'bon'), 'error'); } $form_extra = ''; $notice = false; if ($post_object->post_status === 'auto-draft') { $post_object->post_title = ''; $post_object->comment_status = get_option('default_comment_status'); $post_object->ping_status = get_option('default_ping_status'); $autosave = false; $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />"; } else { $autosave = wp_get_post_autosave($object_id); } $form_action = 'editpost'; $nonce_action = 'update-post_' . $object_id; $form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($object_id) . "' />"; $content_css = array(trailingslashit(get_stylesheet_directory_uri()) . 'assets/css/editor-styles.css', trailingslashit(includes_url()) . 'css/dashicons.min.css', trailingslashit(includes_url()) . 'js/mediaelement/mediaelementplayer.min.css', trailingslashit(includes_url()) . 'js/mediaelement/wp-mediaelement.css', trailingslashit(includes_url()) . 'js/tinymce/skins/wordpress/wp-content.css', trailingslashit(includes_url()) . 'css/editor.min.css'); $content_css = join(',', array_map('esc_url', array_unique($content_css))); $args = array('post_ID' => $object_id, 'post_type' => $current_post_type, 'user_ID' => get_current_user_id(), 'post' => $post_object, 'post_type_object' => get_post_type_object($current_post_type), 'autosave' => $autosave, 'form_extra' => $form_extra, 'form_action' => $form_action, 'nonce_action' => $nonce_action, 'editor_settings' => array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button, save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'add_unload_trigger' => false, 'content_css' => $content_css))); ob_start(); bon_get_template('posts/editor.php', $args); $args['editor'] = ob_get_clean(); unset($args['editor_settings']); set_current_screen($current_post_type); $current_screen->set_parentage('edit.php?post_type=' . $current_post_type); if (!wp_check_post_lock($object_id)) { $args['active_post_lock'] = wp_set_post_lock($object_id); } $messages = $this->get_wp_messages($post_object); $message = false; if (isset($_GET['message'])) { $_GET['message'] = absint($_GET['message']); if (isset($messages[$current_post_type][$_GET['message']])) { $message = $messages[$current_post_type][$_GET['message']]; } elseif (!isset($messages[$current_post_type]) && isset($messages['post'][$_GET['message']])) { $message = $messages['post'][$_GET['message']]; } } // Detect if there exists an autosave newer than the post and if that autosave is different than the post if ($autosave && mysql2date('U', $autosave->post_modified_gmt, false) > mysql2date('U', $post_object->post_modified_gmt, false)) { foreach (_wp_post_revision_fields() as $autosave_field => $_autosave_field) { if (normalize_whitespace($autosave->{$autosave_field}) != normalize_whitespace($post_object->{$autosave_field})) { bon_error_notice()->add('autosave_exists', sprintf(__('There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>'), get_edit_post_link($autosave->ID)), 'notice'); break; } } // If this autosave isn't different from the current post, begone. if (!$notice) { wp_delete_post_revision($autosave->ID); } unset($autosave_field, $_autosave_field); } bon_get_template('posts/post.php', $args); unset($GLOBALS['current_screen']); wp_reset_postdata(); } }
* Fires after the content editor. * * @since 3.5.0 * * @param WP_Post $post Post object. */ do_action('edit_form_after_editor', $post); ?> </div><!-- end bon-fee-post-body-content --> <?php do_action('bon_fee_meta_section'); //global $wp_meta_sections; bon_get_template('posts/meta-section.php', $args); ?> <br class="clear"> </div><!-- end bon-fee-post-body --> </div><!-- end bon-fee-poststuff --> </form> <?php if (post_type_supports($post_type, 'title') && '' === $post->post_title) { ?> <script type="text/javascript"> try{document.getElementById('bon-fee-title').focus();}catch(e){} </script>