PluginProbe
wpForo Forum / 3.1.4
wpForo Forum v3.1.4
3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.2 All 137 releases
wpforo / integrations / UltimateMember.php

UltimateMember.php in wpForo Forum 3.1.4, at integrations/UltimateMember.php

523 lines 22.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace wpforo\integrations;
4
5 // Exit if accessed directly
6 if( ! defined( 'ABSPATH' ) ) exit;
7
8 class UltimateMember {
9 function __construct() {
10 add_action( 'after_setup_theme', [ $this, 'init' ] );
11 add_action( 'wp_enqueue_scripts', [ $this, 'um_frontend_enqueue' ], 100 );
12 }
13
14 function init() {
15 $this->um_init();
16 if( wpforo_setting( 'um', 'forum_tab' ) ) {
17 add_filter( 'um_profile_tabs', [ $this, 'um_tabs' ], 999 );
18 add_filter( 'um_user_profile_tabs', [ $this, 'um_user_tabs' ], 999 );
19 add_action( 'um_profile_content_foro_default', [ $this, 'um_default_tab_content' ] );
20 add_action( 'um_profile_content_foro_topics', [ $this, 'um_user_topics' ] );
21 add_action( 'um_profile_content_foro_replies', [ $this, 'um_user_replies' ] );
22 add_action( 'um_profile_content_foro_favorites', [ $this, 'um_user_favorites' ] );
23 add_action( 'um_profile_content_foro_subscriptions', [ $this, 'um_user_subscriptions' ] );
24 }
25 if( wpforo_setting( 'profiles', 'profile' ) === 'um' ) {
26 add_filter( 'wpforo_member_profile_url', [ $this, 'um_profile_url' ], 10, 3 );
27 }
28 if( wpforo_setting( 'um', 'notification' ) && class_exists( 'UM_Notifications_API' ) ) {
29 add_filter( 'um_notifications_core_log_types', [ $this, 'um_notification_types' ], 500, 1 );
30 add_filter( 'um_notifications_get_icon', [ $this, 'um_notification_icon' ], 10, 2 );
31 add_action( 'wpforo_after_add_post', [ $this, 'um_add_notification' ], 10, 2 );
32 add_action( 'wpforo_post_status_update', [ $this, 'um_notification_on_post_status_change' ], 10, 2 );
33 }
34 }
35
36 function um_init() {
37 $options = get_option( 'um_options' );
38
39 if( wpfkey( $options, 'profile_tab_foro' ) || wpfkey( $options, 'log_wpforo_user_reply' ) ) {
40 if( ! empty( $options ) ) {
41 //Set default options for Tab Settings
42 $tab_options = [ 'profile_tab_foro' => 1, 'profile_tab_foro_privacy' => 0 ];
43 foreach( $tab_options as $key => $value ) {
44 if( ! isset( $options[ $key ] ) ) $options[ $key ] = $value;
45 }
46 //Set default options for Notification Settings
47 $notification_options = [];
48 $notification_options['wpforo_user_reply'] = [
49 'title' => __( 'User leaves a reply to wpForo topic', 'wpforo' ),
50 'template' => '<strong>{member}</strong> has <strong>replied</strong> to a topic you started on the forum.',
51 'account_desc' => __( 'When a member replies to one of my forum topics', 'wpforo' ),
52 ];
53 $notification_options['wpforo_user_reply_to_reply'] = [
54 'title' => __( 'User replied to wpForo post', 'wpforo' ),
55 'template' => '<strong>{member}</strong> has <strong>replied</strong> to your post on the forum.',
56 'account_desc' => __( 'When a member replies to one of my post in forum topics', 'wpforo' ),
57 ];
58 foreach( $notification_options as $type => $note ) {
59 if( ! isset( $options[ 'log_' . $type ] ) ) $options[ 'log_' . $type ] = 1;
60 if( ! isset( $options[ 'log_' . $type . '_template' ] ) ) $options[ 'log_' . $type . '_template' ] = $note['template'];
61 }
62 update_option( 'um_options', $options );
63 }
64 }
65 }
66
67 function um_tabs( $tabs ) {
68 $user_id = um_user( 'ID' );
69 if( $user_id ) {
70 $member = wpforo_member( $user_id );
71 $topics = $member['topics'];
72 $posts = $member['posts'];
73 $likes = (int) wpfval( $member, 'reactions_in', 'up' );
74 $subscriptions = 0;
75 $args = [ 'userid' => $user_id ];
76 if( WPF()->sbscrb ){
77 $subs = WPF()->sbscrb->get_subscribes( $args );
78 if( ! empty( $subs ) ) $subscriptions = count( $subs );
79 }
80 $tabs['foro'] = [
81 'name' => wpforo_phrase( 'Forums', false ),
82 'icon' => 'um-faicon-comments',
83 'subnav' => [
84 'topics' => wpforo_phrase( 'Topics Started', false ) . '<span>' . intval( $topics ) . '</span>',
85 'replies' => wpforo_phrase( 'Replies Created', false ) . '<span>' . intval( $posts ) . '</span>',
86 'favorites' => wpforo_phrase( 'Liked Posts', false ) . '<span>' . intval( $likes ) . '</span>',
87 'subscriptions' => wpforo_phrase( 'Subscriptions', false ) . '<span>' . intval( $subscriptions ) . '</span>',
88 ],
89 'subnav_default' => 'topics',
90 ];
91 if( ! WPF()->sbscrb ) unset( $tabs['foro']['subnav']['subscriptions'] );
92 }
93
94 return $tabs;
95 }
96
97 function um_user_tabs( $tabs ) {
98 if( wpfval( $tabs, 'foro', 'subnav_default' ) && wpfval( $tabs, 'foro', 'subnav', $tabs['foro']['subnav_default'] ) ) {
99 $i = 0;
100 if( isset( $tabs['foro']['subnav'] ) ) {
101 foreach( $tabs['foro']['subnav'] as $id => $data ) {
102 $i ++;
103 if( $i == 1 ) {
104 $tabs['foro']['subnav_default'] = $id;
105 }
106 }
107 }
108 }
109
110 return $tabs;
111 }
112
113 function um_default_tab_content( $args ) {
114 $this->um_user_topics( $args );
115 }
116
117 function um_user_topics( $args ) {
118 $user_id = um_user( 'ID' );
119 if( isset( $_GET['wpfpaged'] ) && intval( $_GET['wpfpaged'] ) ) $paged = intval( $_GET['wpfpaged'] );
120 $paged = ( isset( $paged ) && $paged ) ? $paged : 1;
121 $args = [
122 'offset' => ( $paged - 1 ) * WPF()->current_object['items_per_page'],
123 'row_count' => WPF()->current_object['items_per_page'],
124 'userid' => $user_id,
125 'orderby' => 'modified',
126 'check_private' => true,
127 ];
128 $activities = WPF()->topic->get_topics( $args, $items_count );
129 ?>
130 <div id="wpforo-topics" class="wpforo-activity">
131 <h3 class="wpf-activity-head"><?php wpforo_phrase( 'Forum Topics Started' ); ?></h3>
132 <?php if( empty( $activities ) ) : ?>
133 <p class="wpf-p-error"> <?php wpforo_phrase( 'No activity found for this member.' ) ?> </p>
134 <?php else: ?>
135 <table width="100%" border="0" cellspacing="0" cellpadding="0">
136 <?php $bg = false;
137 foreach( $activities as $activity ) : ?>
138 <tr>
139 <td class="wpf-activity-title">
140 <span class="dashicons dashicons-admin-comments"></span>
141 <?php
142 $topic = wpforo_topic( $activity['topicid'] );
143 if( ! empty( $topic ) ) {
144 $topic_url = $topic['url'];
145 $topic_title = $topic['title'];
146 if( ! $topic_url ) $topic_url = '#';
147 if( ! $topic_title ) $topic_title = wpforo_phrase( 'Topic link' );
148 ?><a href="<?php echo esc_url( (string) $topic_url ) ?>" class="wpf-item-title"><?php echo $topic_title ?></a><?php
149 }
150 if( wpfval( $topic, 'forumid' ) ) {
151 $forum = wpforo_forum( $topic['forumid'] );
152 $forum_url = $forum['url'];
153 $forum_title = $forum['title'];
154 if( ! $forum_url ) $forum_url = '#';
155 if( ! $forum_title ) $forum_url = wpforo_phrase( 'Forum link' );
156 ?><p style="font-style: italic"><span><?php echo wpforo_phrase( 'in forum', false ) ?></span> <a href="<?php echo esc_url( (string) $forum_url ) ?>"><?php echo $forum_title ?></a></p><?php
157 }
158 ?>
159 </td>
160 <td class="wpf-activity-users">
161 <?php $members = WPF()->topic->members( $topic['topicid'], 3 ); ?>
162 <?php if( ! empty( $members ) ): foreach( $members as $member ): ?>
163 <?php if( ! empty( $member ) ): ?>
164 <a href="<?php echo um_user_profile_url( $member['userid'] ) ?>" title="<?php echo esc_attr( um_get_display_name( $member['userid'] ) ); ?>"><?php echo wpforo_user_avatar( $member, 30 ) ?></a>
165 <?php endif; ?>
166 <?php endforeach; endif; ?>
167 </td>
168 <td class="wpf-activity-posts">
169 <?php echo $activity['posts']; ?><?php wpforo_phrase( 'posts' ); ?>
170 </td>
171 <td class="wpf-activity-date"><?php wpforo_date( $topic['created'] ); ?></td>
172 </tr>
173 <?php endforeach ?>
174 </table>
175 <div class="wpf-activity-foot"><?php WPF()->tpl->pagenavi( $paged, $items_count, null, false ); ?></div>
176 <div style="clear: both"></div>
177 <?php endif; ?>
178 </div>
179 <?php
180
181 }
182
183 function um_user_replies( $args ) {
184 $user_id = um_user( 'ID' );
185 if( isset( $_GET['wpfpaged'] ) && intval( $_GET['wpfpaged'] ) ) $paged = intval( $_GET['wpfpaged'] );
186 $paged = ( isset( $paged ) && $paged ) ? $paged : 1;
187 $args = [
188 'offset' => ( $paged - 1 ) * WPF()->current_object['items_per_page'],
189 'row_count' => WPF()->current_object['items_per_page'],
190 'userid' => $user_id,
191 'orderby' => '`created` DESC',
192 'check_private' => true,
193 ];
194 $activities = WPF()->post->get_posts( $args, $items_count );
195 ?>
196 <div id="wpforo-posts" class="wpforo-activity">
197 <h3 class="wpf-activity-head"><?php wpforo_phrase( 'Forum Replies Created' ); ?></h3>
198 <?php if( empty( $activities ) ) : ?>
199 <p class="wpf-p-error"> <?php wpforo_phrase( 'No activity found for this member.' ) ?> </p>
200 <?php else: ?>
201 <table width="100%" border="0" cellspacing="0" cellpadding="0">
202 <?php $bg = false;
203 foreach( $activities as $activity ) : ?>
204 <tr>
205 <td class="wpf-activity-title">
206 <span class="dashicons dashicons-format-chat"></span>
207 <?php
208 $post = wpforo_post( $activity['postid'] );
209 if( ! empty( $post ) ) {
210 $post_url = $post['url'];
211 $post_title = $post['title'];
212 if( ! $post_url ) $post_url = '#';
213 if( ! $post_title ) $post_title = wpforo_phrase( 'Post link' );
214 ?><a href="<?php echo esc_url( (string) $post_url ) ?>" class="wpf-item-title"><?php echo $post_title ?></a><?php
215 }
216 ?>
217 <?php if( wpfval( $post, 'body' ) ): ?>
218 <p class="wpf-post-excerpt" style="font-style: italic">
219 <?php
220 $body = wpforo_content_filter( $post['body'], $post );
221 $body = preg_replace( '#\[attach][^\[\]]*\[/attach]#i', '', strip_shortcodes( strip_tags( $body ) ) );
222 wpforo_text( $body, 200 );
223 ?>
224 </p>
225 <?php endif; ?>
226 </td>
227 <td class="wpf-activity-forum">
228 <?php
229 if( wpfval( $post, 'forumid' ) ) {
230 $forum = wpforo_forum( $post['forumid'] );
231 $forum_url = $forum['url'];
232 $forum_title = $forum['title'];
233 if( ! $forum_url ) $forum_url = '#';
234 if( ! $forum_title ) $forum_url = wpforo_phrase( 'Forum link' );
235 ?><p style="font-style: italic"><span><?php echo wpforo_phrase( 'in forum', false ) ?></span> <a href="<?php echo esc_url( (string) $forum_url ) ?>"><?php echo $forum_title ?></a></p><?php
236 }
237 ?>
238 </td>
239 <td class="wpf-activity-date"><?php wpforo_date( $post['created'] ); ?></td>
240 </tr>
241 <?php endforeach ?>
242 </table>
243 <div class="wpf-activity-foot"><?php WPF()->tpl->pagenavi( $paged, $items_count, null, false ); ?></div>
244 <div style="clear: both"></div>
245 <?php endif; ?>
246 </div>
247 <?php
248 }
249
250 function um_user_favorites( $args ) {
251 $user_id = um_user( 'ID' );
252 if( isset( $_GET['wpfpaged'] ) && intval( $_GET['wpfpaged'] ) ) $paged = intval( $_GET['wpfpaged'] );
253 $paged = ( isset( $paged ) && $paged ) ? $paged : 1;
254 $args = [
255 'userid' => $user_id,
256 'offset' => ( $paged - 1 ) * WPF()->current_object['items_per_page'],
257 'row_count' => WPF()->current_object['items_per_page'],
258 'var' => 'postid',
259 ];
260 $activities = WPF()->post->get_liked_posts( $args, $items_count );
261 ?>
262 <div id="wpforo-liked-posts" class="wpforo-activity">
263 <h3 class="wpf-activity-head"><?php wpforo_phrase( 'Liked Forum Posts' ); ?></h3>
264 <?php if( empty( $activities ) ) : ?>
265 <p class="wpf-p-error"> <?php wpforo_phrase( 'No activity found for this member.' ) ?> </p>
266 <?php else: ?>
267 <table width="100%" border="0" cellspacing="0" cellpadding="0">
268 <?php $bg = false;
269 foreach( $activities as $postid ) : ?>
270 <tr>
271 <td class="wpf-activity-title">
272 <span class="dashicons dashicons-thumbs-up"></span>
273 <?php
274 $post = wpforo_post( $postid );
275 if( ! empty( $post ) ) {
276 $post_url = $post['url'];
277 $post_title = $post['title'];
278 if( ! $post_url ) $post_url = '#';
279 if( ! $post_title ) $post_title = wpforo_phrase( 'Post link' );
280 ?><a href="<?php echo esc_url( (string) $post_url ) ?>" class="wpf-item-title"><?php echo $post_title ?></a><?php
281 }
282 ?>
283 <?php if( wpfval( $post, 'body' ) ): ?>
284 <p class="wpf-post-excerpt" style="font-style: italic">
285 <?php
286 $body = wpforo_content_filter( $post['body'], $post );
287 $body = preg_replace( '#\[attach\][^\[\]]*\[\/attach\]#is', '', strip_shortcodes( strip_tags( $body ) ) );
288 wpforo_text( $body, 200 );
289 ?>
290 </p>
291 <?php endif; ?>
292 </td>
293 <td class="wpf-activity-forum">
294 <?php
295 if( wpfval( $post, 'forumid' ) ) {
296 $forum = wpforo_forum( $post['forumid'] );
297 $forum_url = $forum['url'];
298 $forum_title = $forum['title'];
299 if( ! $forum_url ) $forum_url = '#';
300 if( ! $forum_title ) $forum_url = wpforo_phrase( 'Forum link' );
301 ?><p style="font-style: italic"><span><?php echo wpforo_phrase( 'in forum', false ) ?></span> <a href="<?php echo esc_url( (string) $forum_url ) ?>"><?php echo $forum_title ?></a></p><?php
302 }
303 ?>
304 </td>
305 <td class="wpf-activity-date"><?php wpforo_date( $post['created'] ); ?></td>
306 </tr>
307 <?php endforeach ?>
308 </table>
309 <div class="wpf-activity-foot"><?php WPF()->tpl->pagenavi( $paged, $items_count, null, false ); ?></div>
310 <div style="clear: both"></div>
311 <?php endif; ?>
312 </div>
313 <?php
314 }
315
316 function um_user_subscriptions( $args ) {
317 if( ! WPF()->sbscrb ) return;
318 $user_id = um_user( 'ID' );
319 if( isset( $_GET['wpfpaged'] ) && intval( $_GET['wpfpaged'] ) ) $paged = intval( $_GET['wpfpaged'] );
320 $paged = ( isset( $paged ) && $paged ) ? $paged : 1;
321 $args = [
322 'offset' => ( $paged - 1 ) * WPF()->current_object['items_per_page'],
323 'row_count' => WPF()->current_object['items_per_page'],
324 'userid' => $user_id,
325 'order' => 'DESC',
326 ];
327 $activities = WPF()->sbscrb->get_subscribes( $args, $items_count );
328 ?>
329 <div id="wpforo-subscriptions" class="wpforo-activity">
330 <h3 class="wpf-activity-head"><?php wpforo_phrase( 'Forum Subscriptions' ); ?></h3>
331 <?php if( empty( $activities ) ) : ?>
332 <p class="wpf-p-error"> <?php wpforo_phrase( 'No activity found for this member.' ) ?> </p>
333 <?php else: ?>
334 <table width="100%" border="0" cellspacing="0" cellpadding="0">
335 <?php $bg = false;
336 foreach( $activities as $activity ) : ?>
337 <tr>
338 <td class="wpf-activity-title">
339 <span class="dashicons <?php echo ( $activity['type'] == 'forum' ) ? 'dashicons-category' : 'dashicons-admin-comments'; ?>"></span>
340 <?php
341 if( in_array( $activity['type'], [ 'forum', 'forum-topic' ] ) ) {
342 $item = wpforo_forum( $activity['itemid'] );
343 $item_url = $item['url'];
344 } elseif( $activity['type'] == 'topic' ) {
345 $item = wpforo_topic( $activity['itemid'] );
346 $item_url = $item['url'];
347 } elseif( in_array( $activity['type'], [ 'forums', 'forums-topics' ] ) ) {
348 $item = [ 'title' => wpforo_phrase( 'All ' . $activity['type'], false ) ];
349 $item_url = '#';
350 }
351 if( empty( $item ) ) continue;
352 ?>
353 <a href="<?php echo esc_url( (string) $item_url ) ?>" class="wpf-item-title"><?php echo esc_html( $item['title'] ) ?></a>
354 </td>
355 <?php if( wpforo_is_owner( $user_id ) ) : ?>
356 <td class="wpf-activity-unsb"><a href="<?php echo esc_url( (string) WPF()->sbscrb->get_unsubscribe_link( $activity['confirmkey'] ) ) ?>"><?php wpforo_phrase( 'Unsubscribe' ); ?></a></td>
357 <?php else : ?>
358 <td></td>
359 <?php endif; ?>
360 </tr>
361 <?php endforeach ?>
362 </table>
363 <div class="wpf-activity-foot"><?php WPF()->tpl->pagenavi( $paged, $items_count, null, false ); ?></div>
364 <div style="clear: both"></div>
365 <?php endif; ?>
366 </div>
367 <?php
368 }
369
370 function um_profile_url( $url = '', $member = [], $template = 'profile' ) {
371 if( ! wpforo_is_admin() && wpfval( $member, 'userid' ) ) {
372 $user_domain = $this->um_profile_permalink( $member['userid'] );
373 if( isset( $user_domain ) ) {
374 $user_domain = $user_domain ?: get_author_posts_url( $member['userid'] );
375 $user_domain = strtok( $user_domain, '?' );
376 $tabs = wpforo_setting( 'um', 'forum_tab' );
377 if( $user_domain && $tabs ) {
378 switch( $template ) {
379 case 'account':
380 $url = $user_domain . '?profiletab=main&um_action=edit';
381 break;
382 case 'activity':
383 $url = $user_domain . '?profiletab=foro';
384 break;
385 case 'favored':
386 $url = $user_domain . '?profiletab=foro&subnav=favorites';
387 break;
388 case 'subscriptions':
389 $url = $user_domain . '?profiletab=foro&subnav=subscriptions';
390 break;
391 case 'profile':
392 $url = $user_domain;
393 break;
394 }
395 } else {
396 $url = $user_domain;
397 }
398 }
399 }
400 if( isset( $user_domain ) ) {
401 return apply_filters( 'wpforo_um_member_profile_url', $url, $member, $template );
402 } else {
403 return $url;
404 }
405 }
406
407 function um_profile_permalink( $user_id ) {
408 if( ! $user_id ) return false;
409 $permalink_base = UM()->options()->get( 'permalink_base' );
410 $slug = get_user_meta( $user_id, "um_user_profile_url_slug_{$permalink_base}", true );
411 if( empty( $slug ) ) {
412 if( $permalink_base != 'user_login' ) {
413 $slug = get_user_meta( $user_id, "um_user_profile_url_slug_user_login", true );
414 }
415 if( empty( $slug ) ) {
416 return false;
417 }
418 }
419 $um = get_option( 'um_options' );
420 $page_id = ( wpfval( $um, 'core_user' ) ) ? $um['core_user'] : '';
421 $profile_url = get_permalink( $page_id );
422 $profile_url = apply_filters( 'um_localize_permalink_filter', $profile_url, $page_id );
423 if( get_option( 'permalink_structure' ) ) {
424 $profile_url = trailingslashit( untrailingslashit( $profile_url ) );
425 $profile_url = $profile_url . strtolower( (string) $slug ) . '/';
426 } else {
427 $profile_url = add_query_arg( 'um_user', strtolower( (string) $slug ), $profile_url );
428 }
429
430 return ! empty( $profile_url ) ? $profile_url : '';
431 }
432
433 function um_notification_types( $array ) {
434 $array['wpforo_user_reply'] = [
435 'title' => __( 'User leaves a reply to wpForo topic', 'wpforo' ),
436 'template' => __( '<strong>{member}</strong> has <strong>replied</strong> to a topic you started on the forum.', 'wpforo' ),
437 'account_desc' => __( 'When a member replies to one of my forum topics', 'wpforo' ),
438 ];
439 $array['wpforo_user_reply_to_reply'] = [
440 'title' => __( 'User replied to wpForo post', 'wpforo' ),
441 'template' => __( '<strong>{member}</strong> has <strong>replied</strong> to your post on the forum.', 'wpforo' ),
442 'account_desc' => __( 'When a member replies to one of my post in forum topics', 'wpforo' ),
443 ];
444
445 return $array;
446 }
447
448 function um_notification_icon( $output, $type ) {
449 if( $type == 'wpforo_user_reply' ) {
450 $output = '<i class="um-faicon-comments" style="color: #43A6DF"></i>';
451 }
452 if( $type == 'wpforo_user_reply_to_reply' ) {
453 $output = '<i class="um-faicon-comment" style="color: #43A6DF"></i>';
454 }
455
456 return $output;
457 }
458
459 function um_add_notification( $post = [], $topic = [] ) {
460
461 //Get reply data
462 if( ! wpfval( $post, 'postid' ) ) return;
463 if( ! wpfval( $topic, 'topicid' ) ) return;
464
465 //Don't notify if a new reply is unapproved
466 if( wpfval( $post, 'status' ) ) return false;
467 if( wpfval( $post, 'is_first_post' ) ) return false;
468
469 //Get author information
470 $author_id = $post['userid'];
471 $topic_author_id = $topic['userid'];
472 $reply_to_item_author_id = 0;
473 um_fetch_user( $author_id );
474
475 // Hierarchical replies
476 if( wpfval( $post, 'parentid' ) ) {
477 $reply_to_item_author_id = wpforo_post( $post['parentid'], 'userid' );
478 }
479
480 // Notify the topic author if not the current reply author
481 if( $author_id != $topic_author_id ) {
482 $vars['photo'] = um_get_avatar_url( get_avatar( $author_id, 40 ) );
483 $vars['member'] = um_user( 'display_name' );
484 $vars['notification_uri'] = esc_url_raw( $post['posturl'] );
485 UM()->Notifications_API()->api()->store_notification( $topic_author_id, 'wpforo_user_reply', $vars );
486 }
487 // Notify the immediate reply author if not the current reply author
488
489 if( $reply_to_item_author_id && wpfval( $post, 'parentid' ) && $author_id != $reply_to_item_author_id && $topic_author_id != $reply_to_item_author_id ) {
490 $vars['photo'] = um_get_avatar_url( get_avatar( $author_id, 40 ) );
491 $vars['member'] = um_user( 'display_name' );
492 $vars['notification_uri'] = esc_url_raw( $post['posturl'] );
493 UM()->Notifications_API()->api()->store_notification( $reply_to_item_author_id, 'wpforo_user_reply_to_reply', $vars );
494 }
495
496 }
497
498 function um_notification_on_post_status_change( $post, $status = 0 ) {
499 if( ! $post || ! wpforo_setting( 'um', 'notification' ) ) return;
500 $post['status'] = $status = intval($status);
501 $post['posturl'] = WPF()->post->get_url( $post['postid'] );
502 if( ($topic = WPF()->topic->get_topic( wpfval( $post, 'topicid' ) )) && ! $status ){
503 $this->um_add_notification( $post, $topic );
504 }
505 }
506
507 function um_frontend_enqueue() {
508 if( is_rtl() ) {
509 wp_register_style( 'wpforo-um-rtl', WPF()->tpl->template_url . '/integration/ultimate-member/style-rtl.css', false, WPFORO_VERSION );
510 wp_enqueue_style( 'wpforo-um-rtl' );
511 } else {
512 wp_register_style( 'wpforo-um', WPF()->tpl->template_url . '/integration/ultimate-member/style.css', false, WPFORO_VERSION );
513 wp_enqueue_style( 'wpforo-um' );
514 }
515 if( ! is_wpforo_page() ) {
516 wp_enqueue_style( 'dashicons' );
517 }
518 }
519
520 }
521
522 new UltimateMember();
523