PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 1.2.5
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v1.2.5
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / hooks.php
hooks.php
34 lines 848 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Declare any actions and filters here. USE THIS SPARINGLY.
4 *
5 * In most cases you should use a service provider, but in cases where you
6 * just need to add an action/filter and forget about it you can add it here.
7 *
8 * @package SureCart
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 // register uninstall.
16 register_uninstall_hook( SURECART_PLUGIN_FILE, 'surecart_uninstall' );
17 function surecart_uninstall() {
18 if ( (bool) get_option( 'sc_uninstall', false ) ) {
19 \SureCart::activation()->uninstall();
20 }
21 }
22
23 // redirect to an admin page that they can't access instead of homepage.
24 // Otherwise the homepage if they cannot access admin.
25 add_filter(
26 'surecart.middleware.user.can.redirect_url',
27 function( $url ) {
28 if ( current_user_can( 'read' ) ) {
29 return get_admin_url() . 'admin.php?page=sc-denied';
30 }
31 return $url;
32 }
33 );
34