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 / src / Controllers / Web / DashboardController.php
DashboardController.php
55 lines 1003 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 // do not cache.
16 $request->noCache();
17 return \SureCart::view( $view );
18 }
19
20 /**
21 * Get the link from the request.
22 *
23 * @param string $link_id The link id.
24 * @return string|\WP_Error
25 */
26 public function getLink( $link_id ) {
27 $link = CustomerLink::find( $link_id );
28 if ( is_wp_error( $link ) ) {
29 return $link;
30 }
31 return $link;
32 }
33
34 /**
35 * Login the user
36 *
37 * @param int|\WP_User $wp_user WordPress user.
38 * @return void
39 */
40 public function loginUser( $wp_user ) {
41 if ( ! $wp_user ) {
42 return wp_die( esc_html__( 'This user could not be found.', 'surecart' ) );
43 }
44
45 $id = ! empty( $wp_user->ID ) ? $wp_user->ID : $wp_user;
46 if ( ! is_int( $id ) ) {
47 return;
48 }
49
50 wp_clear_auth_cookie();
51 wp_set_current_user( $id );
52 wp_set_auth_cookie( $id );
53 }
54 }
55