PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / trunk
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress vtrunk
4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / src / Admin / SettingsPages / MemberDirectories.php
wp-user-avatar / src / Admin / SettingsPages Last commit date
DragDropBuilder 1 month ago EmailSettings 1 year ago Membership 1 month ago AbstractSettingsPage.php 2 years ago AddNewForm.php 1 year ago AdminFooter.php 4 years ago ExtensionsSettingsPage.php 1 year ago FormList.php 4 months ago Forms.php 1 year ago FuseWP.php 3 years ago GeneralSettings.php 9 months ago IDUserColumn.php 5 years ago LicenseUpgrader.php 3 years ago MailOptin.php 3 years ago MemberDirectories.php 1 year ago MembersDirectoryList.php 4 years ago ToolsSettingsPage.php 4 years ago index.php 3 years ago
MemberDirectories.php
208 lines
1 <?php
2
3 namespace ProfilePress\Core\Admin\SettingsPages;
4
5 use ProfilePress\Core\Admin\SettingsPages\DragDropBuilder\DragDropBuilder;
6 use ProfilePress\Core\Classes\FormRepository as FR;
7 use ProfilePress\Custom_Settings_Page_Api;
8
9 // Exit if accessed directly
10 if ( ! defined('ABSPATH')) {
11 exit;
12 }
13
14 class MemberDirectories extends AbstractSettingsPage
15 {
16 /**
17 * @var FormList
18 */
19 protected $wplist_instance;
20 protected $DragDropClassInstance;
21
22 public function __construct()
23 {
24 add_action('ppress_register_menu_page', array($this, 'register_settings_page'));
25 add_action('ppress_admin_settings_page_member-directories', [$this, 'settings_admin_page_callback']);
26 add_action('ppress_admin_settings_page_add-new', [$this, 'settings_admin_page_callback']);
27 add_action('ppress_admin_settings_page_edit-shortcode-member-directory', [$this, 'settings_admin_page_callback']);
28
29 add_filter('set-screen-option', array($this, 'set_screen'), 10, 3);
30 add_filter('set_screen_option_forms_per_page', array($this, 'set_screen'), 10, 3);
31
32 $this->DragDropClassInstance = DragDropBuilder::get_instance();
33
34 do_action('ppress_admin_member_directory_class_constructor');
35 }
36
37 public function admin_page_title(): string
38 {
39 $page_title = esc_html__('Member Directories', 'wp-user-avatar');
40
41 if ( ! empty($_GET['page']) && $_GET['page'] == PPRESS_MEMBER_DIRECTORIES_SLUG) {
42
43 if ( ! empty($_GET['view'])) {
44 if ($_GET['view'] === 'add') $page_title = esc_html__('Add Member Directory', 'wp-user-avatar');
45
46 if ($_GET['view'] === 'edit-shortcode-member-directory' ||
47 ( ! empty($_GET['form-type']) && $_GET['form-type'] == FR::MEMBERS_DIRECTORY_TYPE)) {
48 $page_title = esc_html__('Edit Member Directory', 'wp-user-avatar');
49 }
50 }
51 }
52
53 return $page_title;
54 }
55
56 public function register_settings_page()
57 {
58 $hook = add_submenu_page(
59 PPRESS_DASHBOARD_SETTINGS_SLUG,
60 'ProfilePress ' . $this->admin_page_title(),
61 esc_html__('Member Directories', 'wp-user-avatar'),
62 'manage_options',
63 PPRESS_MEMBER_DIRECTORIES_SLUG,
64 array($this, 'admin_page_callback')
65 );
66
67 add_action("load-$hook", array($this, 'screen_option'));
68 }
69
70 public function default_header_menu()
71 {
72 return 'member-directories';
73 }
74
75 /**
76 * Save screen option.
77 *
78 * @param string $status
79 * @param string $option
80 * @param string $value
81 *
82 * @return mixed
83 */
84 public function set_screen($status, $option, $value)
85 {
86 return $value;
87 }
88
89 /**
90 * Screen options
91 */
92 public function screen_option()
93 {
94 if (isset($_GET['page'], $_GET['view']) && strpos($_GET['view'], 'edit-shortcode') !== false) return;
95
96 $args = [
97 'label' => esc_html__('Member Directories', 'wp-user-avatar'),
98 'default' => 10,
99 'option' => 'forms_per_page',
100 ];
101
102 add_screen_option('per_page', $args);
103
104 if (isset($_GET['id']) || ppress_var($_GET, 'view') == 'add-new') {
105 add_filter('screen_options_show_screen', '__return_false');
106 }
107
108 $this->wplist_instance = MembersDirectoryList::get_instance();
109 }
110
111 /**
112 * @param $echo
113 *
114 * @return string|void
115 */
116 public function live_form_preview_btn($echo = true)
117 {
118 if ( ! isset($_GET['view'])) return;
119
120 $preview_url = esc_url(add_query_arg(
121 ['pp_preview_form' => absint($_GET['id']), 'type' => FR::MEMBERS_DIRECTORY_TYPE],
122 home_url()
123 ));
124
125 $html = "<a target='_blank' class=\"add-new-h2\" href=\"$preview_url\">" . esc_html__('Live Preview', 'wp-user-avatar') . '</a>';
126
127 if ($echo === false) {
128 return $html;
129 }
130
131 echo $html;
132 }
133
134 /**
135 * Build the settings page structure. I.e tab, sidebar.
136 *
137 * @return mixed|void
138 */
139 public function settings_admin_page_callback()
140 {
141 remove_all_actions('media_buttons');
142 remove_all_filters('media_buttons_context');
143 remove_all_filters('mce_buttons', 10);
144 remove_all_filters('mce_external_plugins', 10);
145
146 add_action('media_buttons', 'media_buttons');
147
148 if ( ! empty($_GET['view']) && $_GET['view'] == 'add-new') {
149 echo '<script type="text/javascript">var pp_is_member_directory = true;</script>';
150
151 return AddNewForm::get_instance()->settings_admin_page();
152 }
153
154 $short_circuit = apply_filters('ppress_member_directory_settings_admin_page_short_circuit', false);
155
156 if (false !== $short_circuit) return $short_circuit;
157
158 add_filter('wp_cspa_main_content_area', array($this, 'wp_list_table'), 10, 2);
159 add_action('wp_cspa_before_closing_header', [$this, 'add_new_form_button']);
160
161 $instance = Custom_Settings_Page_Api::instance();
162 $instance->option_name(PPRESS_FORMS_DB_OPTION_NAME);
163 $instance->page_header($this->admin_page_title());
164 $this->register_core_settings($instance, true);
165 echo '<div class="pp-form-listing pp-forms">';
166 $instance->build(true);
167 echo '</div>';
168 }
169
170 public function add_new_form_button()
171 {
172 $url = esc_url(add_query_arg('view', 'add-new', PPRESS_MEMBER_DIRECTORIES_SETTINGS_PAGE));
173 echo "<a class=\"add-new-h2\" href=\"$url\">" . esc_html__('Add New', 'wp-user-avatar') . '</a>';
174 }
175
176 /**
177 * @param string $content
178 * @param string $option_name settings Custom_Settings_Page_Api option name.
179 *
180 * @return string
181 */
182 public function wp_list_table($content, $option_name)
183 {
184 if ($option_name != PPRESS_FORMS_DB_OPTION_NAME) return $content;
185
186 $this->wplist_instance->prepare_items(FR::MEMBERS_DIRECTORY_TYPE);
187
188 ob_start();
189
190 $this->wplist_instance->display();
191
192 return ob_get_clean();
193 }
194
195 /**
196 * @return self
197 */
198 public static function get_instance()
199 {
200 static $instance = null;
201
202 if (is_null($instance)) {
203 $instance = new self();
204 }
205
206 return $instance;
207 }
208 }