PluginProbe
Assistant – Every Day Productivity Apps / trunk
Assistant – Every Day Productivity Apps vtrunk
1.5.5 trunk 0.1.0 0.2.0 0.2.1 0.2.2 0.3.0 0.3.1 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.6.0 0.7.0 0.7.0.2 0.7.0.3 0.7.0.4 0.7.0.5 0.7.0.6 0.7.0.7 0.7.0.8 0.7.0.9 0.7.1 1.0 All 71 releases
assistant / backend / src / Hooks / Actions / OnEditUserProfile.php

OnEditUserProfile.php in Assistant – Every Day Productivity Apps trunk, at backend/src/Hooks/Actions/OnEditUserProfile.php

60 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FL\Assistant\Hooks\Actions;
4
5 use FL\Assistant\Data\UserState;
6 use FL\Assistant\System\View;
7 use FL\Assistant\Helpers\BeaverBuilderHelper;
8 /**
9 * Class OnEditUserProfile
10 * @package FL\Assistant\Hooks\Actions
11 *
12 */
13 class OnEditUserProfile {
14
15 /**
16 * @var View
17 */
18 protected $view;
19
20 /**
21 * OnEditUserProfile constructor.
22 *
23 * @param View $view
24 */
25 public function __construct( View $view ) {
26 $this->view = $view;
27 }
28
29
30 /**
31 * @param $user
32 */
33 public function __invoke( $user ) {
34
35 if ( ! current_user_can( 'edit_others_posts' ) || BeaverBuilderHelper::is_assistant_extension() ) {
36 return false;
37 }
38
39 $state = get_user_meta( $user->ID, UserState::FL_ASSISTANT_STATE, true );
40 $state = $state ? $state : UserState::$default_state;
41 $window = $state['window'];
42
43 if ( ! apply_filters( 'fl_assistant_should_enqueue', true ) ) {
44 return false;
45 }
46
47 $this->view->render(
48 'user-profile', [
49 'show_in_admin' => $state['shouldShowInAdmin'],
50 'window' => $window,
51 'hidden_appearance' => isset( $window['hiddenAppearance'] ) ? $window['hiddenAppearance'] : '',
52 'hidden_appearances' => [
53 '' => __( 'Button (Default)', 'assistant' ),
54 'admin_bar' => __( 'Admin Bar Item', 'assistant' ),
55 ],
56 ]
57 );
58 }
59 }
60