PluginProbe
Stream – Activity Log & Audit Trail / 3.4.2
Stream – Activity Log & Audit Trail v3.4.2
4.4.0 4.3.0 4.2.2 4.2.1 trunk 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1 3.1.1 3.10.0 3.2.0 3.2.1 3.2.2 3.2.3 All 50 releases
← All changes | classes/class-admin.php +187 -86 3.2.03.4.2 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 namespace WP_Stream;
3 4
4 5 use DateTime;
5 6 use DateTimeZone;
@@ -7,8 +8,9 @@
7 8 use \WP_CLI;
8 9 use \WP_Roles;
9 10
10 11 class Admin {
12 +
11 13 /**
12 14 * Hold Plugin class
13 15 *
14 16 * @var Plugin
@@ -124,9 +126,9 @@
124 126 add_action( 'init', array( $this, 'init' ) );
125 127
126 128 // Ensure function used in various methods is pre-loaded.
127 129 if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
128 - require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
130 + require_once ABSPATH . '/wp-admin/includes/plugin.php';
129 131 }
130 132
131 133 // User and role caps.
132 134 add_filter( 'user_has_cap', array( $this, 'filter_user_caps' ), 10, 4 );
@@ -131,9 +133,9 @@
131 133 // User and role caps.
132 134 add_filter( 'user_has_cap', array( $this, 'filter_user_caps' ), 10, 4 );
133 135 add_filter( 'role_has_cap', array( $this, 'filter_role_caps' ), 10, 3 );
134 136
135 - if ( is_multisite() && is_plugin_active_for_network( $this->plugin->locations['plugin'] ) && ! is_network_admin() ) {
137 + if ( is_multisite() && $plugin->is_network_activated() && ! is_network_admin() ) {
136 138 $options = (array) get_site_option( 'wp_stream_network', array() );
137 139 $option = isset( $options['general_site_access'] ) ? absint( $options['general_site_access'] ) : 1;
138 140
139 141 $this->disable_access = ( $option ) ? false : true;
@@ -151,16 +153,36 @@
151 153 // Add admin body class.
152 154 add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
153 155
154 156 // Plugin action links.
155 - add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
157 + add_filter(
158 + 'plugin_action_links',
159 + array(
160 + $this,
161 + 'plugin_action_links',
162 + ),
163 + 10,
164 + 2
165 + );
156 166
157 167 // Load admin scripts and styles.
158 - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
168 + add_action(
169 + 'admin_enqueue_scripts',
170 + array(
171 + $this,
172 + 'admin_enqueue_scripts',
173 + )
174 + );
159 175 add_action( 'admin_enqueue_scripts', array( $this, 'admin_menu_css' ) );
160 176
161 177 // Reset Streams database.
162 - add_action( 'wp_ajax_wp_stream_reset', array( $this, 'wp_ajax_reset' ) );
178 + add_action(
179 + 'wp_ajax_wp_stream_reset',
180 + array(
181 + $this,
182 + 'wp_ajax_reset',
183 + )
184 + );
163 185
164 186 // Uninstall Streams and Deactivate plugin.
165 187 $uninstall = $this->plugin->db->driver->purge_storage( $this->plugin );
166 188
@@ -165,12 +187,24 @@
165 187 $uninstall = $this->plugin->db->driver->purge_storage( $this->plugin );
166 188
167 189 // Auto purge setup.
168 190 add_action( 'wp_loaded', array( $this, 'purge_schedule_setup' ) );
169 - add_action( 'wp_stream_auto_purge', array( $this, 'purge_scheduled_action' ) );
191 + add_action(
192 + 'wp_stream_auto_purge',
193 + array(
194 + $this,
195 + 'purge_scheduled_action',
196 + )
197 + );
170 198
171 199 // Ajax users list.
172 - add_action( 'wp_ajax_wp_stream_filters', array( $this, 'ajax_filters' ) );
200 + add_action(
201 + 'wp_ajax_wp_stream_filters',
202 + array(
203 + $this,
204 + 'ajax_filters',
205 + )
206 + );
173 207 }
174 208
175 209 /**
176 210 * Load admin classes
@@ -330,9 +364,15 @@
330 364 */
331 365 do_action( 'wp_stream_admin_menu_screens' );
332 366
333 367 // Register the list table early, so it associates the column headers with 'Screen settings'.
334 - add_action( 'load-' . $this->screen_id['main'], array( $this, 'register_list_table' ) );
368 + add_action(
369 + 'load-' . $this->screen_id['main'],
370 + array(
371 + $this,
372 + 'register_list_table',
373 + )
374 + );
335 375 }
336 376 }
337 377
338 378 /**
@@ -357,9 +397,10 @@
357 397 } else {
358 398 wp_register_script( 'wp-stream-timeago-locale', $this->plugin->locations['url'] . sprintf( $file_tmpl, 'en' ), array( 'wp-stream-timeago' ), '1' );
359 399 }
360 400
361 - wp_enqueue_style( 'wp-stream-admin', $this->plugin->locations['url'] . 'ui/css/admin.css', array(), $this->plugin->get_version() );
401 + $min = wp_stream_min_suffix();
402 + wp_enqueue_style( 'wp-stream-admin', $this->plugin->locations['url'] . 'ui/css/admin.' . $min . 'css', array(), $this->plugin->get_version() );
362 403
363 404 $script_screens = array( 'plugins.php' );
364 405
365 406 if ( in_array( $hook, $this->screen_id, true ) || in_array( $hook, $script_screens, true ) ) {
@@ -368,11 +409,35 @@
368 409
369 410 wp_enqueue_script( 'wp-stream-timeago' );
370 411 wp_enqueue_script( 'wp-stream-timeago-locale' );
371 412
372 - wp_enqueue_script( 'wp-stream-admin', $this->plugin->locations['url'] . 'ui/js/admin.js', array( 'jquery', 'wp-stream-select2' ), $this->plugin->get_version() );
373 - wp_enqueue_script( 'wp-stream-admin-exclude', $this->plugin->locations['url'] . 'ui/js/exclude.js', array( 'jquery', 'wp-stream-select2' ), $this->plugin->get_version() );
374 - wp_enqueue_script( 'wp-stream-live-updates', $this->plugin->locations['url'] . 'ui/js/live-updates.js', array( 'jquery', 'heartbeat' ), $this->plugin->get_version() );
413 + wp_enqueue_script(
414 + 'wp-stream-admin',
415 + $this->plugin->locations['url'] . 'ui/js/admin.' . $min . 'js',
416 + array(
417 + 'jquery',
418 + 'wp-stream-select2',
419 + ),
420 + $this->plugin->get_version()
421 + );
422 + wp_enqueue_script(
423 + 'wp-stream-admin-exclude',
424 + $this->plugin->locations['url'] . 'ui/js/exclude.' . $min . 'js',
425 + array(
426 + 'jquery',
427 + 'wp-stream-select2',
428 + ),
429 + $this->plugin->get_version()
430 + );
431 + wp_enqueue_script(
432 + 'wp-stream-live-updates',
433 + $this->plugin->locations['url'] . 'ui/js/live-updates.' . $min . 'js',
434 + array(
435 + 'jquery',
436 + 'heartbeat',
437 + ),
438 + $this->plugin->get_version()
439 + );
375 440
376 441 wp_localize_script(
377 442 'wp-stream-admin',
378 443 'wp_stream',
@@ -391,12 +456,16 @@
391 456 'wp-stream-live-updates',
392 457 'wp_stream_live_updates',
393 458 array(
394 459 'current_screen' => $hook,
395 - 'current_page' => isset( $_GET['paged'] ) ? esc_js( $_GET['paged'] ) : '1', // input var okay
396 - 'current_order' => isset( $_GET['order'] ) ? esc_js( $_GET['order'] ) : 'desc', // input var okay
397 - 'current_query' => wp_stream_json_encode( $_GET ), // input var okay
398 - 'current_query_count' => count( $_GET ), // input var okay
460 + 'current_page' => isset( $_GET['paged'] ) ? esc_js( $_GET['paged'] ) : '1', // WPCS: CSRF ok.
461 + // input var okay, CSRF okay
462 + 'current_order' => isset( $_GET['order'] ) ? esc_js( $_GET['order'] ) : 'desc', // WPCS: CSRF ok.
463 + // input var okay, CSRF okay
464 + 'current_query' => wp_stream_json_encode( $_GET ), // WPCS: CSRF ok.
465 + // input var okay, CSRF okay
466 + 'current_query_count' => count( $_GET ), // WPCS: CSRF ok.
467 + // input var okay, CSRF okay
399 468 )
400 469 );
401 470 }
402 471
@@ -413,15 +482,16 @@
413 482 * @return int
414 483 */
415 484 $bulk_actions_threshold = apply_filters( 'wp_stream_bulk_actions_threshold', 100 );
416 485
417 - wp_enqueue_script( 'wp-stream-global', $this->plugin->locations['url'] . 'ui/js/global.js', array( 'jquery' ), $this->plugin->get_version() );
486 + wp_enqueue_script( 'wp-stream-global', $this->plugin->locations['url'] . 'ui/js/global.' . $min . 'js', array( 'jquery' ), $this->plugin->get_version() );
418 487 wp_localize_script(
419 488 'wp-stream-global',
420 489 'wp_stream_global',
421 490 array(
422 - 'bulk_actions' => array(
423 - 'i18n' => array(
491 + 'bulk_actions' => array(
492 + 'i18n' => array(
493 + // translators: Placeholder refers to a number of items (e.g. "1,742")
424 494 'confirm_action' => sprintf( esc_html__( 'Are you sure you want to perform bulk actions on over %s items? This process could take a while to complete.', 'stream' ), number_format( absint( $bulk_actions_threshold ) ) ),
425 495 ),
426 496 'threshold' => absint( $bulk_actions_threshold ),
427 497 ),
@@ -462,10 +532,10 @@
462 532
463 533 if ( $this->is_stream_screen() ) {
464 534 $stream_classes[] = $this->admin_body_class;
465 535
466 - if ( isset( $_GET['page'] ) ) {
467 - $stream_classes[] = sanitize_key( $_GET['page'] ); // input var okay
536 + if ( isset( $_GET['page'] ) ) { // CSRF okay
537 + $stream_classes[] = sanitize_key( $_GET['page'] ); // input var okay, CSRF okay
468 538 }
469 539 }
470 540
471 541 /**
@@ -486,9 +556,10 @@
486 556 *
487 557 * @action admin_enqueue_scripts
488 558 */
489 559 public function admin_menu_css() {
490 - wp_register_style( 'wp-stream-datepicker', $this->plugin->locations['url'] . 'ui/css/datepicker.css', array(), $this->plugin->get_version() );
560 + $min = wp_stream_min_suffix();
561 + wp_register_style( 'wp-stream-datepicker', $this->plugin->locations['url'] . 'ui/css/datepicker.' . $min . 'css', array(), $this->plugin->get_version() );
491 562 wp_register_style( 'wp-stream-icons', $this->plugin->locations['url'] . 'ui/stream-icons/style.css', array(), $this->plugin->get_version() );
492 563
493 564 // Make sure we're working off a clean version
494 565 if ( ! file_exists( ABSPATH . WPINC . '/version.php' ) ) {
@@ -493,9 +564,9 @@
493 564 // Make sure we're working off a clean version
494 565 if ( ! file_exists( ABSPATH . WPINC . '/version.php' ) ) {
495 566 return;
496 567 }
497 - include( ABSPATH . WPINC . '/version.php' );
568 + include ABSPATH . WPINC . '/version.php';
498 569
499 570 if ( ! isset( $wp_version ) ) {
500 571 return;
501 572 }
@@ -554,10 +625,15 @@
554 625
555 626 \wp_add_inline_style( 'wp-admin', $css );
556 627 }
557 628
629 + /**
630 + * Handle the reset AJAX request to reset logs.
631 + *
632 + * @return bool
633 + */
558 634 public function wp_ajax_reset() {
559 - check_ajax_referer( 'stream_nonce', 'wp_stream_nonce' );
635 + check_ajax_referer( 'stream_nonce_reset', 'wp_stream_nonce_reset' );
560 636
561 637 if ( ! current_user_can( $this->settings_cap ) ) {
562 638 wp_die(
563 639 esc_html__( "You don't have sufficient privileges to do this action.", 'stream' )
@@ -587,9 +663,9 @@
587 663 global $wpdb;
588 664
589 665 $where = '';
590 666
591 - if ( is_multisite() && ! is_plugin_active_for_network( $this->plugin->locations['plugin'] ) ) {
667 + if ( is_multisite() && ! $this->plugin->is_network_activated() ) {
592 668 $where .= $wpdb->prepare( ' AND `blog_id` = %d', get_current_blog_id() );
593 669 }
594 670
595 671 $wpdb->query(
@@ -615,14 +691,14 @@
615 691 is_multisite()
616 692 &&
617 693 is_network_admin()
618 694 &&
619 - ! is_plugin_active_for_network( $this->plugin->locations['plugin'] )
695 + ! $this->plugin->is_network_activated()
620 696 ) {
621 697 return;
622 698 }
623 699
624 - if ( is_multisite() && is_plugin_active_for_network( $this->plugin->locations['plugin'] ) ) {
700 + if ( is_multisite() && $this->plugin->is_network_activated() ) {
625 701 $options = (array) get_site_option( 'wp_stream_network', array() );
626 702 } else {
627 703 $options = (array) get_option( 'wp_stream', array() );
628 704 }
@@ -630,10 +706,11 @@
630 706 if ( ! empty( $options['general_keep_records_indefinitely'] ) || ! isset( $options['general_records_ttl'] ) ) {
631 707 return;
632 708 }
633 709
634 - $days = $options['general_records_ttl'];
635 - $date = new DateTime( 'now', $timezone = new DateTimeZone( 'UTC' ) );
710 + $days = $options['general_records_ttl'];
711 + $timezone = new DateTimeZone( 'UTC' );
712 + $date = new DateTime( 'now', $timezone );
636 713
637 714 $date->sub( DateInterval::createFromDateString( "$days days" ) );
638 715
639 716 $where = $wpdb->prepare( ' AND `stream`.`created` < %s', $date->format( 'Y-m-d H:i:s' ) );
@@ -638,9 +715,9 @@
638 715
639 716 $where = $wpdb->prepare( ' AND `stream`.`created` < %s', $date->format( 'Y-m-d H:i:s' ) );
640 717
641 718 // Multisite but NOT network activated, only purge the current blog
642 - if ( is_multisite() && ! is_plugin_active_for_network( $this->plugin->locations['plugin'] ) ) {
719 + if ( is_multisite() && ! $this->plugin->is_network_activated() ) {
643 720 $where .= $wpdb->prepare( ' AND `blog_id` = %d', get_current_blog_id() );
644 721 }
645 722
646 723 $wpdb->query(
@@ -652,9 +729,9 @@
652 729 );
653 730 }
654 731
655 732 /**
656 - * @param array $links
733 + * @param array $links
657 734 * @param string $file
658 735 *
659 736 * @filter plugin_action_links
660 737 *
@@ -665,29 +742,41 @@
665 742 return $links;
666 743 }
667 744
668 745 // Also don't show links in Network Admin if Stream isn't network enabled
669 - if ( is_network_admin() && is_multisite() && ! is_plugin_active_for_network( $this->plugin->locations['plugin'] ) ) {
746 + if ( is_network_admin() && is_multisite() && ! $this->plugin->is_network_activated() ) {
670 747 return $links;
671 748 }
672 749
673 750 if ( is_network_admin() ) {
674 - $admin_page_url = add_query_arg( array( 'page' => $this->network->network_settings_page_slug ), network_admin_url( $this->admin_parent_page ) );
751 + $admin_page_url = add_query_arg(
752 + array(
753 + 'page' => $this->network->network_settings_page_slug,
754 + ),
755 + network_admin_url( $this->admin_parent_page )
756 + );
675 757 } else {
676 - $admin_page_url = add_query_arg( array( 'page' => $this->settings_page_slug ), admin_url( $this->admin_parent_page ) );
758 + $admin_page_url = add_query_arg(
759 + array(
760 + 'page' => $this->settings_page_slug,
761 + ),
762 + admin_url( $this->admin_parent_page )
763 + );
677 764 }
678 765
679 766 $links[] = sprintf( '<a href="%s">%s</a>', esc_url( $admin_page_url ), esc_html__( 'Settings', 'default' ) );
680 767
681 - $url = add_query_arg(
682 - array(
683 - 'action' => 'wp_stream_uninstall',
684 - 'wp_stream_nonce' => wp_create_nonce( 'stream_nonce' ),
685 - ),
686 - admin_url( 'admin-ajax.php' )
687 - );
768 + if ( ! defined( 'DISALLOW_FILE_MODS' ) || false === DISALLOW_FILE_MODS ) {
769 + $url = add_query_arg(
770 + array(
771 + 'action' => 'wp_stream_uninstall',
772 + 'wp_stream_nonce' => wp_create_nonce( 'stream_nonce' ),
773 + ),
774 + admin_url( 'admin-ajax.php' )
775 + );
688 776
689 - $links[] = sprintf( '<span id="wp_stream_uninstall" class="delete"><a href="%s">%s</a></span>', esc_url( $url ), esc_html__( 'Uninstall', 'stream' ) );
777 + $links[] = sprintf( '<span id="wp_stream_uninstall" class="delete"><a href="%s">%s</a></span>', esc_url( $url ), esc_html__( 'Uninstall', 'stream' ) );
778 + }
690 779
691 780 return $links;
692 781 }
693 782
@@ -697,12 +786,12 @@
697 786 public function render_list_table() {
698 787 $this->list_table->prepare_items();
699 788 ?>
700 789 <div class="wrap">
701 - <h1><?php echo esc_html( get_admin_page_title() ) ?></h1>
702 - <?php $this->list_table->display() ?>
790 + <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
791 + <?php $this->list_table->display(); ?>
703 792 </div>
704 - <?php
793 + <?php
705 794 }
706 795
707 796 /**
708 797 * Render settings page
@@ -714,28 +803,28 @@
714 803 $page_description = apply_filters( 'wp_stream_settings_form_description', '' );
715 804
716 805 $sections = $this->plugin->settings->get_fields();
717 806 $active_tab = wp_stream_filter_input( INPUT_GET, 'tab' );
718 -
719 - wp_enqueue_script( 'wp-stream-settings', $this->plugin->locations['url'] . 'ui/js/settings.js', array( 'jquery' ), $this->plugin->get_version(), true );
807 + $min = wp_stream_min_suffix();
808 + wp_enqueue_script( 'wp-stream-settings', $this->plugin->locations['url'] . 'ui/js/settings.' . $min . 'js', array( 'jquery' ), $this->plugin->get_version(), true );
720 809 ?>
721 810 <div class="wrap">
722 - <h1><?php echo esc_html( get_admin_page_title() ) ?></h1>
811 + <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
723 812
724 813 <?php if ( ! empty( $page_description ) ) : ?>
725 - <p><?php echo esc_html( $page_description ) ?></p>
814 + <p><?php echo esc_html( $page_description ); ?></p>
726 815 <?php endif; ?>
727 816
728 - <?php settings_errors() ?>
817 + <?php settings_errors(); ?>
729 818
730 819 <?php if ( count( $sections ) > 1 ) : ?>
731 820 <h2 class="nav-tab-wrapper">
732 - <?php $i = 0 ?>
821 + <?php $i = 0; ?>
733 822 <?php foreach ( $sections as $section => $data ) : ?>
734 - <?php $i ++ ?>
735 - <?php $is_active = ( ( 1 === $i && ! $active_tab ) || $active_tab === $section ) ?>
736 - <a href="<?php echo esc_url( add_query_arg( 'tab', $section ) ) ?>" class="nav-tab<?php if ( $is_active ) { echo esc_attr( ' nav-tab-active' ); } ?>">
737 - <?php echo esc_html( $data['title'] ) ?>
823 + <?php $i++; ?>
824 + <?php $is_active = ( ( 1 === $i && ! $active_tab ) || $active_tab === $section ); ?>
825 + <a href="<?php echo esc_url( add_query_arg( 'tab', $section ) ); ?>" class="nav-tab <?php echo $is_active ? esc_attr( ' nav-tab-active' ) : ''; ?>">
826 + <?php echo esc_html( $data['title'] ); ?>
738 827 </a>
739 828 <?php endforeach; ?>
740 829 </h2>
741 830 <?php endif; ?>
@@ -740,29 +829,29 @@
740 829 </h2>
741 830 <?php endif; ?>
742 831
743 832 <div class="nav-tab-content" id="tab-content-settings">
744 - <form method="post" action="<?php echo esc_attr( $form_action ) ?>" enctype="multipart/form-data">
833 + <form method="post" action="<?php echo esc_attr( $form_action ); ?>" enctype="multipart/form-data">
745 834 <div class="settings-sections">
746 - <?php
747 - $i = 0;
748 - foreach ( $sections as $section => $data ) {
749 - $i++;
835 + <?php
836 + $i = 0;
837 + foreach ( $sections as $section => $data ) {
838 + $i++;
750 839
751 - $is_active = ( ( 1 === $i && ! $active_tab ) || $active_tab === $section );
840 + $is_active = ( ( 1 === $i && ! $active_tab ) || $active_tab === $section );
752 841
753 - if ( $is_active ) {
754 - settings_fields( $option_key );
755 - do_settings_sections( $option_key );
756 - }
757 - }
758 - ?>
842 + if ( $is_active ) {
843 + settings_fields( $option_key );
844 + do_settings_sections( $option_key );
845 + }
846 + }
847 + ?>
759 848 </div>
760 - <?php submit_button() ?>
849 + <?php submit_button(); ?>
761 850 </form>
762 851 </div>
763 852 </div>
764 - <?php
853 + <?php
765 854 }
766 855
767 856 /**
768 857 * Instantiate the list table
@@ -767,9 +856,14 @@
767 856 /**
768 857 * Instantiate the list table
769 858 */
770 859 public function register_list_table() {
771 - $this->list_table = new List_Table( $this->plugin, array( 'screen' => $this->screen_id['main'] ) );
860 + $this->list_table = new List_Table(
861 + $this->plugin,
862 + array(
863 + 'screen' => $this->screen_id['main'],
864 + )
865 + );
772 866 }
773 867
774 868 /**
775 869 * Check if a particular role has access
@@ -867,9 +961,13 @@
867 961
868 962 switch ( wp_stream_filter_input( INPUT_GET, 'filter' ) ) {
869 963 case 'user_id':
870 964 $users = array_merge(
871 - array( 0 => (object) array( 'display_name' => 'WP-CLI' ) ),
965 + array(
966 + 0 => (object) array(
967 + 'display_name' => 'WP-CLI',
968 + ),
969 + ),
872 970 get_users()
873 971 );
874 972
875 973 $search = wp_stream_filter_input( INPUT_GET, 'q' );
@@ -876,9 +974,9 @@
876 974 if ( $search ) {
877 975 // `search` arg for get_users() is not enough
878 976 $users = array_filter(
879 977 $users,
880 - function( $user ) use ( $search ) {
978 + function ( $user ) use ( $search ) {
881 979 return false !== mb_strpos( mb_strtolower( $user->display_name ), mb_strtolower( $search ) );
882 980 }
883 981 );
884 982 }
@@ -906,13 +1004,13 @@
906 1004 foreach ( $authors as $user_id => $args ) {
907 1005 $author = new Author( $args->ID );
908 1006
909 1007 $authors_records[ $user_id ] = array(
910 - 'text' => $author->get_display_name(),
911 - 'id' => $author->id,
912 - 'label' => $author->get_display_name(),
913 - 'icon' => $author->get_avatar_src( 32 ),
914 - 'title' => '',
1008 + 'text' => $author->get_display_name(),
1009 + 'id' => $author->id,
1010 + 'label' => $author->get_display_name(),
1011 + 'icon' => $author->get_avatar_src( 32 ),
1012 + 'title' => '',
915 1013 );
916 1014 }
917 1015
918 1016 return $authors_records;
@@ -920,18 +1018,19 @@
920 1018
921 1019 /**
922 1020 * Get user meta in a way that is also safe for VIP
923 1021 *
924 - * @param int $user_id
1022 + * @param int $user_id
925 1023 * @param string $meta_key
926 - * @param bool $single (optional)
1024 + * @param bool $single (optional)
927 1025 *
928 1026 * @return mixed
929 1027 */
930 - function get_user_meta( $user_id, $meta_key, $single = true ) {
1028 + public function get_user_meta( $user_id, $meta_key, $single = true ) {
931 1029 if ( wp_stream_is_vip() && function_exists( 'get_user_attribute' ) ) {
932 1030 return get_user_attribute( $user_id, $meta_key );
933 1031 }
1032 +
934 1033 return get_user_meta( $user_id, $meta_key, $single );
935 1034 }
936 1035
937 1036 /**
@@ -936,19 +1035,20 @@
936 1035
937 1036 /**
938 1037 * Update user meta in a way that is also safe for VIP
939 1038 *
940 - * @param int $user_id
1039 + * @param int $user_id
941 1040 * @param string $meta_key
942 1041 * @param mixed $meta_value
943 - * @param mixed $prev_value (optional)
1042 + * @param mixed $prev_value (optional)
944 1043 *
945 1044 * @return int|bool
946 1045 */
947 - function update_user_meta( $user_id, $meta_key, $meta_value, $prev_value = '' ) {
1046 + public function update_user_meta( $user_id, $meta_key, $meta_value, $prev_value = '' ) {
948 1047 if ( wp_stream_is_vip() && function_exists( 'update_user_attribute' ) ) {
949 1048 return update_user_attribute( $user_id, $meta_key, $meta_value );
950 1049 }
1050 +
951 1051 return update_user_meta( $user_id, $meta_key, $meta_value, $prev_value );
952 1052 }
953 1053
954 1054 /**
@@ -953,17 +1053,18 @@
953 1053
954 1054 /**
955 1055 * Delete user meta in a way that is also safe for VIP
956 1056 *
957 - * @param int $user_id
1057 + * @param int $user_id
958 1058 * @param string $meta_key
959 - * @param mixed $meta_value (optional)
1059 + * @param mixed $meta_value (optional)
960 1060 *
961 1061 * @return bool
962 1062 */
963 - function delete_user_meta( $user_id, $meta_key, $meta_value = '' ) {
1063 + public function delete_user_meta( $user_id, $meta_key, $meta_value = '' ) {
964 1064 if ( wp_stream_is_vip() && function_exists( 'delete_user_attribute' ) ) {
965 1065 return delete_user_attribute( $user_id, $meta_key, $meta_value );
966 1066 }
1067 +
967 1068 return delete_user_meta( $user_id, $meta_key, $meta_value );
968 1069 }
969 1070 }