PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 1.0.3
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v1.0.3
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 / src / Controllers / Web / DashboardController.php
DashboardController.php
53 lines 961 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SureCart\Controllers\Web;
4
5 use SureCart\Models\CustomerLink;
6
7 /**
8 * Thank you routes
9 */
10 class DashboardController {
11 /**
12 * Show the dashboard.
13 */
14 public function show( $request, $view ) {
15 return \SureCart::view( $view );
16 }
17
18 /**
19 * Get the link from the request.
20 *
21 * @param string $link_id The link id.
22 * @return string|\WP_Error
23 */
24 public function getLink( $link_id ) {
25 $link = CustomerLink::find( $link_id );
26 if ( is_wp_error( $link ) ) {
27 return $link;
28 }
29 return $link;
30 }
31
32 /**
33 * Login the user
34 *
35 * @param int|\WP_User $wp_user WordPress user.
36 * @return void
37 */
38 public function loginUser( $wp_user ) {
39 if ( ! $wp_user ) {
40 return wp_die( esc_html__( 'This user could not be found.', 'surecart' ) );
41 }
42
43 $id = ! empty( $wp_user->ID ) ? $wp_user->ID : $wp_user;
44 if ( ! is_int( $id ) ) {
45 return;
46 }
47
48 wp_clear_auth_cookie();
49 wp_set_current_user( $id );
50 wp_set_auth_cookie( $id );
51 }
52 }
53