Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function cats_edit_form_shortcode($atts, $content = null) {
- if ( is_user_logged_in() ) {
- // current user id
- $user_id = get_current_user_id();
- $group_id = isset($_REQUEST['form_id']) ? $_REQUEST['form_id'] : '';
- $post_id = isset($_REQUEST['post_id']) ? $_REQUEST['post_id'] : '';
- $post = get_post($post_id);
- $author_id = $post->post_author;
- if ( $user_id == $author_id ) {
- $atts = shortcode_atts( array( 'group_id' => $group_id, ), $atts);
- if ( isset($atts['group_id']) ) {
- $post_meta = get_post_meta($atts['group_id']);
- if (isset($post_meta['form_settings'])) {
- $form_settings = unserialize($post_meta['form_settings'][0]);
- }
- if ( 'form' == $form_settings['display'] ) {
- $redirect_after_submit_url = $form_settings['redirect_after_submit'];
- $form_settings_user = $form_settings['who-can-post'];
- $form_actions = $form_settings['custom_actions'];
- $this->process_shortcode_atts( $atts, $form_settings, $redirect_after_submit_url, $form_actions, $post_id );
- } else {
- return;
- }
- } else {
- return;
- }
- } else {
- echo '<div style="background: #fff;border-left: 4px solid #fff;border-left-color: #dc3232;-webkit-box-shadow: 2px 2px 5px 0px rgba(204,204,204,0.55); -moz-box-shadow: 2px 2px 5px 0px rgba(204,204,204,0.55); box-shadow: 2px 2px 5px 0px rgba(204,204,204,0.55);"><p style="margin: 2.5em; padding: 2px;">Warning: You do not have permission to edit this page</p></div>';
- return;
- }
- } else {
- echo '<div style="background: #fff;border-left: 4px solid #fff;border-left-color: #dc3232;-webkit-box-shadow: 2px 2px 5px 0px rgba(204,204,204,0.55); -moz-box-shadow: 2px 2px 5px 0px rgba(204,204,204,0.55); box-shadow: 2px 2px 5px 0px rgba(204,204,204,0.55);"><p style="margin: 2.5em; padding: 2px;">Warning: Either you did not login or your account has no right to post from frontend. Please use the other account which can edit post to do that.</p></div>';
- wp_login_form();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement