PluginProbe
Private groups / 1.7
Private groups v1.7
trunk 1.5 1.6 1.7 1.8 1.8.1 1.9.1 1.9.2 2.0 2.0.1 2.2 2.3 2.4 2.5 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 All 116 releases
bbp-private-groups / includes / pg_forum_widgets.php

pg_forum_widgets.php in Private groups 1.7, at includes/pg_forum_widgets.php

678 lines 24.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 /**
5 * Register the filtered PG Widgets
6 */
7 function register_pg_widgets() {
8 register_widget("pg_Forums_Widget");
9 register_widget("pg_Topics_Widget");
10 register_widget("pg_Replies_Widget");
11 }
12
13
14 add_action('widgets_init', 'register_pg_widgets');
15
16
17
18 // Exit if accessed directly
19 if (!defined('ABSPATH'))
20 exit;
21
22 /**
23 * pg Forum Widget*
24 * Adds a widget which displays the forum list
25 *
26 */
27 class pg_Forums_Widget extends WP_Widget {
28
29 /**
30 * primarily the code from the bbpress forum widget !
31 */
32 public function __construct() {
33 $widget_ops = apply_filters('pg_forums_widget_options', array(
34 'classname' => 'widget_display_forums',
35 'description' => __('A list of forums with an option to set the parent.', 'private groups')
36 ));
37
38 parent::__construct(false, __('(Private Groups) Forums List', 'private-groups'), $widget_ops);
39 }
40
41 /**
42 * Register the widget
43 *
44 * @since bbPress (r3389)
45 *
46 * @uses register_widget()
47 */
48 public static function register_widget() {
49 register_widget('pg_Forums_Widget');
50 }
51
52 /**
53 * Displays the output, the forum list
54 *
55 * @since bbPress (r2653)
56 *
57 * @param mixed $args Arguments
58 * @param array $instance Instance
59 * @uses apply_filters() Calls 'bbp_forum_widget_title' with the title
60 * @uses get_option() To get the forums per page option
61 * @uses current_user_can() To check if the current user can read
62 * private() To resety name
63 * @uses bbp_has_forums() The main forum loop
64 * @uses bbp_forums() To check whether there are more forums available
65 * in the loop
66 * @uses bbp_the_forum() Loads up the current forum in the loop
67 * @uses bbp_forum_permalink() To display the forum permalink
68 * @uses bbp_forum_title() To display the forum title
69 */
70 public function widget($args, $instance) {
71
72 // Get widget settings
73 $settings = $this->parse_settings($instance);
74
75 // Typical WordPress filter
76 $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base);
77
78 // bbPress filter
79 $settings['title'] = apply_filters('pg_widget_title', $settings['title'], $instance, $this->id_base);
80
81 // Note: private and hidden forums will be excluded via the
82 // bbp_pre_get_posts_exclude_forums filter and function.
83 $query_data = array(
84 'post_type' => bbp_get_forum_post_type(),
85 'post_parent' => $settings['parent_forum'],
86 'post_status' => bbp_get_public_status_id(),
87 'posts_per_page' => get_option('_bbp_forums_per_page', 50),
88 'orderby' => 'menu_order',
89 'order' => 'ASC'
90 );
91
92 //PRIVATE GROUPS Get an array of IDs which the current user has permissions to view
93 $allowed_posts = private_groups_get_permitted_post_ids(new WP_Query($query_data));
94 // The default forum query with allowed forum ids array added
95 $query_data['post__in'] = $allowed_posts;
96
97 $widget_query = new WP_Query($query_data);
98
99 // Bail if no posts
100 if (!$widget_query->have_posts()) {
101 return;
102 }
103
104 echo $args['before_widget'];
105 if (!empty($settings['title'])) {
106 echo $args['before_title'] . $settings['title'] . $args['after_title'];
107 }
108 ?>
109
110 <ul>
111
112 <?php while ($widget_query->have_posts()) : $widget_query->the_post(); ?>
113
114 <li><a class="bbp-forum-title" href="<?php bbp_forum_permalink($widget_query->post->ID); ?>" title="<?php bbp_forum_title($widget_query->post->ID); ?>"><?php bbp_forum_title($widget_query->post->ID); ?></a></li>
115
116 <?php endwhile; ?>
117
118 </ul>
119
120 <?php
121 echo $args['after_widget'];
122
123 // Reset the $post global
124 wp_reset_postdata();
125 }
126
127 /**
128 * Update the forum widget options
129 *
130 * @since bbPress (r2653)
131 *
132 * @param array $new_instance The new instance options
133 * @param array $old_instance The old instance options
134 */
135 public function update($new_instance, $old_instance) {
136 $instance = $old_instance;
137 $instance['title'] = strip_tags($new_instance['title']);
138 $instance['parent_forum'] = $new_instance['parent_forum'];
139
140 // Force to any
141 if (!empty($instance['parent_forum']) && !is_numeric($instance['parent_forum'])) {
142 $instance['parent_forum'] = 'any';
143 }
144
145 return $instance;
146 }
147
148 /**
149 * Output the forum widget options form
150 *
151 * @since bbPress (r2653)
152 *
153 * @param $instance Instance
154 *
155 */
156 public function form($instance) {
157
158 // Get widget settings
159 $settings = $this->parse_settings($instance);
160 ?>
161
162 <p>
163 <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'bbpress'); ?>
164 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($settings['title']); ?>" />
165 </label>
166 </p>
167
168 <p>
169 <label for="<?php echo $this->get_field_id('parent_forum'); ?>"><?php _e('Parent Forum ID:', 'bbpress'); ?>
170 <input class="widefat" id="<?php echo $this->get_field_id('parent_forum'); ?>" name="<?php echo $this->get_field_name('parent_forum'); ?>" type="text" value="<?php echo esc_attr($settings['parent_forum']); ?>" />
171 </label>
172
173 <br />
174
175 <small><?php _e('"0" to show only root - "any" to show all', 'private groups'); ?></small>
176 </p>
177
178 <?php
179 }
180
181 /**
182 * Merge the widget settings into defaults array.
183 *
184 * @since bbPress (r4802)
185 *
186 * @param $instance Instance
187 * @uses bbp_parse_args() To merge widget settings into defaults
188 */
189 public function parse_settings($instance = array()) {
190 return bbp_parse_args($instance, array(
191 'title' => __('Forums', 'bbpress'),
192 'parent_forum' => 0
193 ), 'forum_widget_settings');
194 }
195
196 }
197
198 /**
199 * PRIVATE GROUPS Topic Widget
200 *
201 * Adds a widget which displays the topic list
202 *
203 * @since bbPress (r2653)
204 *
205 * @uses WP_Widget
206 */
207 class pg_Topics_Widget extends WP_Widget {
208
209 /**
210 * bbPress Topic Widget
211 *
212 * Registers the topic widget
213 *
214 * @since bbPress (r2653)
215 *
216 * @uses apply_filters() Calls 'bbp_topics_widget_options' with the
217 * widget options
218 */
219 public function __construct() {
220 $widget_ops = apply_filters('pg_topics_widget_options', array(
221 'classname' => 'widget_display_topics',
222 'description' => __('A list of recent topics, sorted by popularity or freshness.', 'private groups')
223 ));
224
225 parent::__construct(false, __('(Private Groups) Recent Topics', 'private groups'), $widget_ops);
226 }
227
228 /**
229 * Register the widget
230 *
231 * @since bbPress (r3389)
232 *
233 * @uses register_widget()
234 */
235 public static function register_widget() {
236 register_widget('pg_Topics_Widget');
237 }
238
239 /**
240 * Displays the output, the topic list
241 *
242 * @since bbPress (r2653)
243 *
244 * @param mixed $args
245 * @param array $instance
246 * @uses apply_filters() Calls 'bbp_topic_widget_title' with the title
247 * @uses bbp_topic_permalink() To display the topic permalink
248 * @uses bbp_topic_title() To display the topic title
249 * @uses bbp_get_topic_last_active_time() To get the topic last active
250 * time
251 * @uses bbp_get_topic_id() To get the topic id
252 */
253 public function widget($args = array(), $instance = array()) {
254
255 // Get widget settings
256 $settings = $this->parse_settings($instance);
257
258 // Typical WordPress filter
259 $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base);
260
261 // bbPress filter
262 $settings['title'] = apply_filters('pg_topic_widget_title', $settings['title'], $instance, $this->id_base);
263
264 // How do we want to order our results?
265 switch ($settings['order_by']) {
266
267 // Order by most recent replies
268 case 'freshness' :
269 $topics_query = array(
270 'post_type' => bbp_get_topic_post_type(),
271 'post_parent' => $settings['parent_forum'],
272 'posts_per_page' => '50',
273 'post_status' => array(bbp_get_public_status_id(), bbp_get_closed_status_id()),
274 'show_stickies' => false,
275 'meta_key' => '_bbp_last_active_time',
276 'orderby' => 'meta_value',
277 'order' => 'DESC',
278 );
279 break;
280
281 // Order by total number of replies
282 case 'popular' :
283 $topics_query = array(
284 'post_type' => bbp_get_topic_post_type(),
285 'post_parent' => $settings['parent_forum'],
286 'posts_per_page' => '50',
287 'post_status' => array(bbp_get_public_status_id(), bbp_get_closed_status_id()),
288 'show_stickies' => false,
289 'meta_key' => '_bbp_reply_count',
290 'orderby' => 'meta_value',
291 'order' => 'DESC'
292 );
293 break;
294
295 // Order by which topic was created most recently
296 case 'newness' :
297 default :
298 $topics_query = array(
299 'post_type' => bbp_get_topic_post_type(),
300 'post_parent' => $settings['parent_forum'],
301 'posts_per_page' => '50',
302 'post_status' => array(bbp_get_public_status_id(), bbp_get_closed_status_id()),
303 'show_stickies' => false,
304 'order' => 'DESC'
305 );
306 break;
307 }
308
309 //PRIVATE GROUPS Get an array of IDs which the current user has permissions to view
310 $allowed_posts = private_groups_get_permitted_post_ids(new WP_Query($topics_query));
311 // The default forum query with allowed forum ids array added
312 $topics_query['post__in'] = $allowed_posts;
313 //reset the max to be shown
314 $topics_query['posts_per_page'] =(int) $settings['max_shown'] ;
315
316 // Note: private and hidden forums will be excluded via the
317 // bbp_pre_get_posts_exclude_forums filter and function.
318 $widget_query = new WP_Query($topics_query);
319
320 // Bail if no topics are found
321 if (!$widget_query->have_posts()) {
322 return;
323 }
324
325 echo $args['before_widget'];
326
327 if (!empty($settings['title'])) {
328 echo $args['before_title'] . $settings['title'] . $args['after_title'];
329 }
330 ?>
331
332 <ul>
333
334 <?php
335 while ($widget_query->have_posts()) :
336
337 $widget_query->the_post();
338 $topic_id = bbp_get_topic_id($widget_query->post->ID);
339 $author_link = '';
340
341 // Maybe get the topic author
342 if ('on' == $settings['show_user']) :
343 $author_link = bbp_get_topic_author_link(array('post_id' => $topic_id, 'type' => 'both', 'size' => 14));
344 endif;
345 ?>
346
347 <li>
348 <a class="bbp-forum-title" href="<?php echo esc_url(bbp_get_topic_permalink($topic_id)); ?>" title="<?php echo esc_attr(bbp_get_topic_title($topic_id)); ?>"><?php bbp_topic_title($topic_id); ?></a>
349
350 <?php if (!empty($author_link)) : ?>
351
352 <?php printf(_x('by %1$s', 'widgets', 'bbpress'), '<span class="topic-author">' . $author_link . '</span>'); ?>
353
354 <?php endif; ?>
355
356 <?php if ('on' == $settings['show_date']) : ?>
357
358 <div><?php bbp_topic_last_active_time($topic_id); ?></div>
359
360 <?php endif; ?>
361
362 </li>
363
364 <?php endwhile; ?>
365
366 </ul>
367
368 <?php
369 echo $args['after_widget'];
370
371 // Reset the $post global
372 wp_reset_postdata();
373 }
374
375 /**
376 * Update the topic widget options
377 *
378 * @since bbPress (r2653)
379 *
380 * @param array $new_instance The new instance options
381 * @param array $old_instance The old instance options
382 */
383 public function update($new_instance = array(), $old_instance = array()) {
384 $instance = $old_instance;
385 $instance['title'] = strip_tags($new_instance['title']);
386 $instance['order_by'] = strip_tags($new_instance['order_by']);
387 $instance['show_date'] = (bool) $new_instance['show_date'];
388 $instance['show_user'] = (bool) $new_instance['show_user'];
389 $instance['max_shown'] = (int) $new_instance['max_shown'];
390
391 // Force to any
392 if (!empty($instance['parent_forum']) || !is_numeric($instance['parent_forum'])) {
393 $instance['parent_forum'] = 'any';
394 } else {
395 $instance['parent_forum'] = (int) $new_instance['parent_forum'];
396 }
397
398 return $instance;
399 }
400
401 /**
402 * Output the topic widget options form
403 *
404 * @since bbPress (r2653)
405 *
406 * @param $instance Instance
407 *
408 */
409 public function form($instance = array()) {
410
411 // Get widget settings
412 $settings = $this->parse_settings($instance);
413 ?>
414
415 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'bbpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($settings['title']); ?>" /></label></p>
416 <p><label for="<?php echo $this->get_field_id('max_shown'); ?>"><?php _e('Maximum topics to show:', 'bbpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('max_shown'); ?>" name="<?php echo $this->get_field_name('max_shown'); ?>" type="text" value="<?php echo esc_attr($settings['max_shown']); ?>" /></label></p>
417
418 <p>
419 <label for="<?php echo $this->get_field_id('parent_forum'); ?>"><?php _e('Parent Forum ID:', 'bbpress'); ?>
420 <input class="widefat" id="<?php echo $this->get_field_id('parent_forum'); ?>" name="<?php echo $this->get_field_name('parent_forum'); ?>" type="text" value="<?php echo esc_attr($settings['parent_forum']); ?>" />
421 </label>
422
423 <br />
424
425 <small><?php _e('"0" to show only root - "any" to show all', 'bbpress'); ?></small>
426 </p>
427
428 <p><label for="<?php echo $this->get_field_id('show_date'); ?>"><?php _e('Show post date:', 'bbpress'); ?> <input type="checkbox" id="<?php echo $this->get_field_id('show_date'); ?>" name="<?php echo $this->get_field_name('show_date'); ?>" <?php checked('on', $settings['show_date']); ?> /></label></p>
429 <p><label for="<?php echo $this->get_field_id('show_user'); ?>"><?php _e('Show topic author:', 'bbpress'); ?> <input type="checkbox" id="<?php echo $this->get_field_id('show_user'); ?>" name="<?php echo $this->get_field_name('show_user'); ?>" <?php checked('on', $settings['show_user']); ?> /></label></p>
430
431 <p>
432 <label for="<?php echo $this->get_field_id('order_by'); ?>"><?php _e('Order By:', 'bbpress'); ?></label>
433 <select name="<?php echo $this->get_field_name('order_by'); ?>" id="<?php echo $this->get_field_name('order_by'); ?>">
434 <option <?php selected($settings['order_by'], 'newness'); ?> value="newness"><?php _e('Newest Topics', 'bbpress'); ?></option>
435 <option <?php selected($settings['order_by'], 'popular'); ?> value="popular"><?php _e('Popular Topics', 'bbpress'); ?></option>
436 <option <?php selected($settings['order_by'], 'freshness'); ?> value="freshness"><?php _e('Topics With Recent Replies', 'bbpress'); ?></option>
437 </select>
438 </p>
439
440 <?php
441 }
442
443 /**
444 * Merge the widget settings into defaults array.
445 *
446 * @since bbPress (r4802)
447 *
448 * @param $instance Instance
449 * @uses bbp_parse_args() To merge widget options into defaults
450 */
451 public function parse_settings($instance = array()) {
452 return bbp_parse_args($instance, array(
453 'title' => __('Recent Topics', 'bbpress'),
454 'max_shown' => 5,
455 'show_date' => false,
456 'show_user' => false,
457 'parent_forum' => 'any',
458 'order_by' => false
459 ), 'topic_widget_settings');
460 }
461
462 }
463
464 /**
465 * PRIVATE GROUPS Replies Widget
466 *
467 * Adds a widget which displays the replies list
468 *
469 *
470 * @uses WP_Widget
471 */
472 class pg_Replies_Widget extends WP_Widget {
473
474 /**
475 * pg Replies Widget
476 *
477 * Registers the replies widget
478 *
479 *
480 * @uses apply_filters() Calls 'bbp_replies_widget_options' with the
481 * widget options
482 */
483 public function __construct() {
484 $widget_ops = apply_filters('pg_replies_widget_options', array(
485 'classname' => 'widget_display_replies',
486 'description' => __('A list of the most recent replies.', 'private groups')
487 ));
488
489 parent::__construct(false, __('(Private Groups) Recent Replies', 'private groups'), $widget_ops);
490 }
491
492 /**
493 * Register the widget
494 *
495 * @since bbPress (r3389)
496 *
497 * @uses register_widget()
498 */
499 public static function register_widget() {
500 register_widget('pg_Replies_Widget');
501 }
502
503 /**
504 * Displays the output, the replies list
505 *
506 * @since bbPress (r2653)
507 *
508 * @param mixed $args
509 * @param array $instance
510 * @uses apply_filters() Calls 'bbp_reply_widget_title' with the title
511 * @uses bbp_get_reply_author_link() To get the reply author link
512 * @uses bbp_get_reply_author() To get the reply author name
513 * @uses bbp_get_reply_id() To get the reply id
514 * @uses bbp_get_reply_url() To get the reply url
515 * @uses bbp_get_reply_excerpt() To get the reply excerpt
516 * @uses bbp_get_reply_topic_title() To get the reply topic title
517 * @uses get_the_date() To get the date of the reply
518 * @uses get_the_time() To get the time of the reply
519 */
520 public function widget($args, $instance) {
521
522 // Get widget settings
523 $settings = $this->parse_settings($instance);
524
525 // Typical WordPress filter
526 $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base);
527
528 // bbPress filter
529 $settings['title'] = apply_filters('pg_replies_widget_title', $settings['title'], $instance, $this->id_base);
530
531 // Note: private and hidden forums will be excluded via the
532 // bbp_pre_get_posts_exclude_forums filter and function.
533 $query_data = array(
534 'post_type' => bbp_get_reply_post_type(),
535 'post_status' => array(bbp_get_public_status_id(), bbp_get_closed_status_id()),
536 'posts_per_page' => '50',
537
538 );
539
540 //PRIVATE GROUPS Get an array of IDs which the current user has permissions to view
541 $allowed_posts = private_groups_get_permitted_post_ids(new WP_Query($query_data));
542 // The default forum query with allowed forum ids array added
543 $query_data['post__in'] = $allowed_posts;
544
545 //now set max posts
546 $query_data ['posts_per_page'] = (int) $settings['max_shown'] ;
547
548 $widget_query = new WP_Query($query_data);
549
550 // Bail if no replies
551 if (!$widget_query->have_posts()) {
552 return;
553 }
554
555 echo $args['before_widget'];
556
557 if (!empty($settings['title'])) {
558 echo $args['before_title'] . $settings['title'] . $args['after_title'];
559 }
560 ?>
561
562 <ul>
563
564 <?php while ($widget_query->have_posts()) : $widget_query->the_post(); ?>
565
566 <li>
567
568 <?php
569 // Verify the reply ID
570 $reply_id = bbp_get_reply_id($widget_query->post->ID);
571 $reply_link = '<a class="bbp-reply-topic-title" href="' . esc_url(bbp_get_reply_url($reply_id)) . '" title="' . esc_attr(bbp_get_reply_excerpt($reply_id, 50)) . '">' . bbp_get_reply_topic_title($reply_id) . '</a>';
572
573 // Only query user if showing them
574 if ('on' == $settings['show_user']) :
575 $author_link = bbp_get_reply_author_link(array('post_id' => $reply_id, 'type' => 'both', 'size' => 14));
576 else :
577 $author_link = false;
578 endif;
579
580 // Reply author, link, and timestamp
581 if (( 'on' == $settings['show_date'] ) && !empty($author_link)) :
582
583 // translators: 1: reply author, 2: reply link, 3: reply timestamp
584 printf(_x('%1$s on %2$s %3$s', 'widgets', 'bbpress'), $author_link, $reply_link, '<div>' . bbp_get_time_since(get_the_time('U')) . '</div>');
585
586 // Reply link and timestamp
587 elseif ('on' == $settings['show_date']) :
588
589 // translators: 1: reply link, 2: reply timestamp
590 printf(_x('%1$s %2$s', 'widgets', 'bbpress'), $reply_link, '<div>' . bbp_get_time_since(get_the_time('U')) . '</div>');
591
592 // Reply author and title
593 elseif (!empty($author_link)) :
594
595 // translators: 1: reply author, 2: reply link
596 printf(_x('%1$s on %2$s', 'widgets', 'bbpress'), $author_link, $reply_link);
597
598 // Only the reply title
599 else :
600
601 // translators: 1: reply link
602 printf(_x('%1$s', 'widgets', 'bbpress'), $reply_link);
603
604 endif;
605 ?>
606
607 </li>
608
609 <?php endwhile; ?>
610
611 </ul>
612
613 <?php
614 echo $args['after_widget'];
615
616 // Reset the $post global
617 wp_reset_postdata();
618 }
619
620 /**
621 * Update the reply widget options
622 *
623 * @since bbPress (r2653)
624 *
625 * @param array $new_instance The new instance options
626 * @param array $old_instance The old instance options
627 */
628 public function update($new_instance = array(), $old_instance = array()) {
629 $instance = $old_instance;
630 $instance['title'] = strip_tags($new_instance['title']);
631 $instance['show_date'] = (bool) $new_instance['show_date'];
632 $instance['show_user'] = (bool) $new_instance['show_user'];
633 $instance['max_shown'] = (int) $new_instance['max_shown'];
634
635 return $instance;
636 }
637
638 /**
639 * Output the reply widget options form
640 *
641 * @since bbPress (r2653)
642 *
643 * @param $instance Instance
644 *
645 */
646 public function form($instance = array()) {
647
648 // Get widget settings
649 $settings = $this->parse_settings($instance);
650 ?>
651
652 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'bbpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($settings['title']); ?>" /></label></p>
653 <p><label for="<?php echo $this->get_field_id('max_shown'); ?>"><?php _e('Maximum replies to show:', 'bbpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('max_shown'); ?>" name="<?php echo $this->get_field_name('max_shown'); ?>" type="text" value="<?php echo esc_attr($settings['max_shown']); ?>" /></label></p>
654 <p><label for="<?php echo $this->get_field_id('show_date'); ?>"><?php _e('Show post date:', 'bbpress'); ?> <input type="checkbox" id="<?php echo $this->get_field_id('show_date'); ?>" name="<?php echo $this->get_field_name('show_date'); ?>" <?php checked('on', $settings['show_date']); ?> /></label></p>
655 <p><label for="<?php echo $this->get_field_id('show_user'); ?>"><?php _e('Show reply author:', 'bbpress'); ?> <input type="checkbox" id="<?php echo $this->get_field_id('show_user'); ?>" name="<?php echo $this->get_field_name('show_user'); ?>" <?php checked('on', $settings['show_user']); ?> /></label></p>
656
657 <?php
658 }
659
660 /**
661 * Merge the widget settings into defaults array.
662 *
663 * @since bbPress (r4802)
664 *
665 * @param $instance Instance
666 * @uses bbp_parse_args() To merge widget settings into defaults
667 */
668 public function parse_settings($instance = array()) {
669 return bbp_parse_args($instance, array(
670 'title' => __('Recent Replies', 'private groups'),
671 'max_shown' => 5,
672 'show_date' => false,
673 'show_user' => false
674 ), 'replies_widget_settings');
675 }
676
677 }
678 ?>