public function dispatch() { $this->listing = WPBDP_Listing::get(intval($_GET['listing_id'] ? $_GET['listing_id'] : 0)); if (!$this->listing || !wpbdp_user_can('upgrade-to-sticky', $this->listing->get_id())) { return wpbdp_render_msg(_x('Invalid link followed.', 'listing upgrade', 'WPBDM'), 'error'); } $sticky_info = $this->upgrades_api->get_info($this->listing->get_id()); if ($sticky_info->pending) { $html = ''; $html .= wpbdp_render_msg(_x('Your listing is already pending approval for "featured" status.', 'templates', 'WPBDM')); $html .= sprintf('<a href="%s">%s</a>', $this->listing->get_permalink(), _x('Return to listing.', 'templates', 'WPBDM')); return $html; } if (isset($_POST['do_upgrade'])) { return $this->checkout(); } return $this->upgrade_selection(); }
function dispatch() { $listing_id = intval($_REQUEST['listing_id']); if (!wpbdp_user_can('delete', $listing_id)) { $html .= wpbdp_render_msg(_x('Please log in to delete the listing.', 'delete listing', 'WPBDM')); $html .= wpbdp_render('parts/login-required', array('show_message' => false)); return $html; } $listing = WPBDP_Listing::get($listing_id); $nonce = isset($_REQUEST['_wpnonce']) ? $_REQUEST['_wpnonce'] : ''; if (!$listing) { die; } if ($nonce && wp_verify_nonce($nonce, 'delete listing ' . $listing->get_id())) { $listing->delete(); return wpbdp_render_msg(_x('Your listing has been deleted.', 'delete listing', 'WPBDM')); } return wpbdp_render('delete-listing-confirm', array('listing' => $listing, 'has_recurring' => $this->has_recurring_fee($listing))); }
public function dispatch() { if (!wpbdp_get_option('listing-renewal')) { return wpbdp_render_msg(_x('Listing renewal is disabled at this moment. Please try again later.', 'renewal', 'WPBDM'), 'error'); } if (!$this->obtain_renewal_info()) { return wpbdp_render_msg(_x('Your renewal ID is invalid. Please use the URL you were given on the renewal e-mail message.', 'renewal', 'WPBDM'), 'error'); } if (!wpbdp_user_can('edit', $this->listing->get_id())) { $html = ''; // $html .= wpbdp_render_msg( _x( 'You don\'t have permission to access this page. Please login.', 'renewal', 'WPBDM' ), 'error' ); $html .= wpbdp_render('parts/login-required', array(), false); return $html; } if ($this->category->recurring) { return $this->recurring_management(); } if ($this->category->payment_id) { return $this->checkout(); } return $this->fee_selection(); }
public function row_actions($actions, $post) { if ($post->post_type == WPBDP_POST_TYPE && current_user_can('contributor')) { if (wpbdp_user_can('edit', $post->ID)) { $actions['edit'] = sprintf('<a href="%s">%s</a>', wpbdp_get_page_link('editlisting', $post->ID), _x('Edit Listing', 'admin actions', 'WPBDM')); } if (wpbdp_user_can('delete', $listing_id)) { $actions['delete'] = sprintf('<a href="%s">%s</a>', wpbdp_get_page_link('deletelisting', $listing_id), _x('Delete Listing', 'admin actions', 'WPBDM')); } } return $actions; }
--> <!--<?php if (wpbdp_user_can('edit', $listing_id)) { ?> <form action="<?php echo wpbdp_get_page_link('editlisting', $listing_id); ?> " method="POST"><input type="submit" name="" value="<?php _ex('Edit', 'templates', 'WPBDM'); ?> " class="edit-listing" /></form><?php } ?> --> <!--<?php if (wpbdp_user_can('delete', $listing_id)) { ?> <form action="<?php echo wpbdp_get_page_link('deletelisting', $listing_id); ?> " method="POST"><input type="submit" name="" value="<?php _ex('Delete', 'templates', 'WPBDM'); ?> " class="delete-listing" data-confirmation-message="<?php _ex('Are you sure you wish to delete this listing?', 'templates', 'WPBDM'); ?> " /></form><?php } ?> --> <?php