PluginProbe
bbPress / 2.6.19
bbPress v2.6.19
2.6.19 2.6.18 2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 All 74 releases
← All changes | includes/admin/settings.php +100 -46 2.6.17 → 2.6.19 View file →
@@ -14,9 +14,9 @@
14 14
15 15 /**
16 16 * Get the Forums settings sections.
17 17 *
18 - * @since 2.1.0 bbPress (r4001)
18 + * @since 2.1.0 bbPress (r4002)
19 19 *
20 20 * @return array
21 21 */
22 22 function bbp_admin_get_settings_sections() {
@@ -97,9 +97,9 @@
97 97
98 98 /**
99 99 * Get all of the settings fields.
100 100 *
101 - * @since 2.1.0 bbPress (r4001)
101 + * @since 2.1.0 bbPress (r4002)
102 102 *
103 103 * @return array
104 104 */
105 105 function bbp_admin_get_settings_fields() {
@@ -114,9 +114,9 @@
114 114 'bbp_settings_users' => array(
115 115
116 116 // Default role setting
117 117 '_bbp_default_role' => array(
118 - 'sanitize_callback' => 'sanitize_text_field',
118 + 'sanitize_callback' => 'bbp_admin_sanitize_default_role',
119 119 'args' => array()
120 120 ),
121 121
122 122 // Allow global access
@@ -271,9 +271,9 @@
271 271 // Theme package setting
272 272 '_bbp_theme_package_id' => array(
273 273 'title' => esc_html__( 'Current Package', 'bbpress' ),
274 274 'callback' => 'bbp_admin_setting_callback_subtheme_id',
275 - 'sanitize_callback' => 'esc_sql',
275 + 'sanitize_callback' => 'bbp_admin_sanitize_theme_package_id',
276 276 'args' => array()
277 277 )
278 278 ),
279 279
@@ -613,11 +613,55 @@
613 613 );
614 614 }
615 615
616 616 /**
617 + * Keep the default forum role within the roles offered by bbPress.
618 + *
619 + * @since 2.6.19 bbPress (r7707)
620 + *
621 + * @param mixed $role Submitted role ID.
622 + * @return string Valid role ID.
623 + */
624 +function bbp_admin_sanitize_default_role( $role ) {
625 + $roles = bbp_get_dynamic_roles();
626 +
627 + if ( is_string( $role ) && isset( $roles[ $role ] ) ) {
628 + return $role;
629 + }
630 +
631 + $current = get_option( '_bbp_default_role', bbp_get_participant_role() );
632 +
633 + return is_string( $current ) && isset( $roles[ $current ] )
634 + ? $current
635 + : bbp_get_participant_role();
636 +}
637 +
638 +/**
639 + * Keep the active theme package within the registered packages.
640 + *
641 + * @since 2.6.19 bbPress (r7707)
642 + *
643 + * @param mixed $package Submitted package ID.
644 + * @return string Valid package ID.
645 + */
646 +function bbp_admin_sanitize_theme_package_id( $package ) {
647 + $packages = (array) bbpress()->theme_compat->packages;
648 +
649 + if ( is_string( $package ) && isset( $packages[ $package ] ) ) {
650 + return $package;
651 + }
652 +
653 + $current = get_option( '_bbp_theme_package_id', 'default' );
654 +
655 + return is_string( $current ) && isset( $packages[ $current ] )
656 + ? $current
657 + : 'default';
658 +}
659 +
660 +/**
617 661 * Get settings fields by section.
618 662 *
619 - * @since 2.1.0 bbPress (r4001)
663 + * @since 2.1.0 bbPress (r4002)
620 664 *
621 665 * @param string $section_id ID of the section to get fields for
622 666 * @staticvar array $fields All of the available fields
623 667 * @return mixed False if section is invalid, array of fields otherwise.
@@ -651,9 +695,9 @@
651 695
652 696 /**
653 697 * User settings section description for the settings page
654 698 *
655 - * @since 2.0.0 bbPress (r2786)
699 + * @since 2.4.0 bbPress (r4968)
656 700 */
657 701 function bbp_admin_setting_callback_user_section() {
658 702 ?>
659 703
@@ -785,9 +829,9 @@
785 829
786 830 /**
787 831 * Features settings section description for the settings page
788 832 *
789 - * @since 2.0.0 bbPress (r2786)
833 + * @since 2.4.0 bbPress (r4968)
790 834 */
791 835 function bbp_admin_setting_callback_features_section() {
792 836 ?>
793 837
@@ -826,9 +870,9 @@
826 870
827 871 /**
828 872 * Allow engagements setting field
829 873 *
830 - * @since 2.0.0 bbPress (r2737)
874 + * @since 2.6.0 bbPress (r6321)
831 875 */
832 876 function bbp_admin_setting_callback_engagements() {
833 877 ?>
834 878
@@ -840,9 +884,9 @@
840 884
841 885 /**
842 886 * Allow topic tags setting field
843 887 *
844 - * @since 2.4.0 bbPress (r4944)
888 + * @since 2.2.0 bbPress (r4098)
845 889 */
846 890 function bbp_admin_setting_callback_topic_tags() {
847 891 ?>
848 892
@@ -869,9 +913,9 @@
869 913
870 914 /**
871 915 * Allow super-mods setting field
872 916 *
873 - * @since 2.6.0 bbPress (r6562)
917 + * @since 2.6.0 bbPress (r6563)
874 918 */
875 919 function bbp_admin_setting_callback_super_mods() {
876 920 ?>
877 921
@@ -884,9 +928,9 @@
884 928
885 929 /**
886 930 * Allow forum wide search
887 931 *
888 - * @since 2.4.0 bbPress (r4970)
932 + * @since 2.4.0 bbPress (r4971)
889 933 */
890 934 function bbp_admin_setting_callback_search() {
891 935 ?>
892 936
@@ -940,9 +984,9 @@
940 984
941 985 /**
942 986 * Allow topic and reply revisions
943 987 *
944 - * @since 2.0.0 bbPress (r3412)
988 + * @since 2.0.0 bbPress (r3416)
945 989 */
946 990 function bbp_admin_setting_callback_revisions() {
947 991 ?>
948 992
@@ -968,9 +1012,9 @@
968 1012
969 1013 /**
970 1014 * Main subtheme section
971 1015 *
972 - * @since 2.0.0 bbPress (r2786)
1016 + * @since 2.1.0 bbPress (r3830)
973 1017 */
974 1018 function bbp_admin_setting_callback_subtheme_section() {
975 1019 ?>
976 1020
@@ -981,9 +1025,9 @@
981 1025
982 1026 /**
983 1027 * Use the WordPress editor setting field
984 1028 *
985 - * @since 2.1.0 bbPress (r3586)
1029 + * @since 2.1.0 bbPress (r3830)
986 1030 */
987 1031 function bbp_admin_setting_callback_subtheme_id() {
988 1032
989 1033 // Declare locale variable
@@ -1013,9 +1057,9 @@
1013 1057
1014 1058 /**
1015 1059 * Allow oEmbed in replies
1016 1060 *
1017 - * @since 2.1.0 bbPress (r3752)
1061 + * @since 2.1.0 bbPress (r3753)
1018 1062 */
1019 1063 function bbp_admin_setting_callback_use_autoembed() {
1020 1064 ?>
1021 1065
@@ -1072,9 +1116,9 @@
1072 1116
1073 1117 /**
1074 1118 * Per page settings section description for the settings page
1075 1119 *
1076 - * @since 2.0.0 bbPress (r2786)
1120 + * @since 2.0.0 bbPress (r3170)
1077 1121 */
1078 1122 function bbp_admin_setting_callback_per_rss_page_section() {
1079 1123 ?>
1080 1124
@@ -1085,9 +1129,9 @@
1085 1129
1086 1130 /**
1087 1131 * Topics per RSS page setting field
1088 1132 *
1089 - * @since 2.0.0 bbPress (r2786)
1133 + * @since 2.0.0 bbPress (r3170)
1090 1134 */
1091 1135 function bbp_admin_setting_callback_topics_per_rss_page() {
1092 1136 ?>
1093 1137
@@ -1099,9 +1143,9 @@
1099 1143
1100 1144 /**
1101 1145 * Replies per RSS page setting field
1102 1146 *
1103 - * @since 2.0.0 bbPress (r2786)
1147 + * @since 2.0.0 bbPress (r3170)
1104 1148 */
1105 1149 function bbp_admin_setting_callback_replies_per_rss_page() {
1106 1150 ?>
1107 1151
@@ -1115,9 +1159,9 @@
1115 1159
1116 1160 /**
1117 1161 * Slugs settings section description for the settings page
1118 1162 *
1119 - * @since 2.0.0 bbPress (r2786)
1163 + * @since 2.0.0 bbPress (r3170)
1120 1164 */
1121 1165 function bbp_admin_setting_callback_root_slug_section() {
1122 1166
1123 1167 // Flush rewrite rules when this section is saved
@@ -1161,9 +1205,9 @@
1161 1205
1162 1206 /**
1163 1207 * Include root slug setting field
1164 1208 *
1165 - * @since 2.0.0 bbPress (r2786)
1209 + * @since 2.4.0 bbPress (r4932)
1166 1210 */
1167 1211 function bbp_admin_setting_callback_show_on_root() {
1168 1212
1169 1213 // Current setting
@@ -1210,9 +1254,9 @@
1210 1254
1211 1255 /**
1212 1256 * Slugs settings section description for the settings page
1213 1257 *
1214 - * @since 2.0.0 bbPress (r2786)
1258 + * @since 2.4.0 bbPress (r4932)
1215 1259 */
1216 1260 function bbp_admin_setting_callback_user_slug_section() {
1217 1261 ?>
1218 1262
@@ -1238,9 +1282,9 @@
1238 1282
1239 1283 /**
1240 1284 * Topic archive slug setting field
1241 1285 *
1242 - * @since 2.0.0 bbPress (r2786)
1286 + * @since 2.0.0 bbPress (r3186)
1243 1287 */
1244 1288 function bbp_admin_setting_callback_topic_archive_slug() {
1245 1289 ?>
1246 1290
@@ -1315,9 +1359,9 @@
1315 1359
1316 1360 /**
1317 1361 * Slugs settings section description for the settings page
1318 1362 *
1319 - * @since 2.0.0 bbPress (r2786)
1363 + * @since 2.0.0 bbPress (r3170)
1320 1364 */
1321 1365 function bbp_admin_setting_callback_single_slug_section() {
1322 1366 ?>
1323 1367
@@ -1419,9 +1463,9 @@
1419 1463
1420 1464 /**
1421 1465 * Edit slug setting field
1422 1466 *
1423 - * @since 2.6.2 bbPress (r6965)
1467 + * @since 2.6.2 bbPress (r6966)
1424 1468 */
1425 1469 function bbp_admin_setting_callback_edit_slug() {
1426 1470 ?>
1427 1471
@@ -1556,9 +1600,9 @@
1556 1600
1557 1601 /**
1558 1602 * The main settings page
1559 1603 *
1560 - * @since 2.0.0 bbPress (r2643)
1604 + * @since 2.0.0 bbPress (r2594)
1561 1605 */
1562 1606 function bbp_admin_settings() {
1563 1607 ?>
1564 1608
@@ -1585,9 +1629,9 @@
1585 1629
1586 1630 /**
1587 1631 * Main settings section description for the settings page
1588 1632 *
1589 - * @since 2.1.0 bbPress (r3813)
1633 + * @since 2.1.0 bbPress (r3816)
1590 1634 */
1591 1635 function bbp_converter_setting_callback_main_section() {
1592 1636 ?>
1593 1637
@@ -1598,9 +1642,9 @@
1598 1642
1599 1643 /**
1600 1644 * Edit Platform setting field
1601 1645 *
1602 - * @since 2.1.0 bbPress (r3813)
1646 + * @since 2.1.0 bbPress (r3816)
1603 1647 */
1604 1648 function bbp_converter_setting_callback_platform() {
1605 1649
1606 1650 // Converters
@@ -1621,9 +1665,9 @@
1621 1665
1622 1666 /**
1623 1667 * Edit Database Server setting field
1624 1668 *
1625 - * @since 2.1.0 bbPress (r3813)
1669 + * @since 2.1.0 bbPress (r3816)
1626 1670 */
1627 1671 function bbp_converter_setting_callback_dbserver() {
1628 1672 ?>
1629 1673
@@ -1639,9 +1683,9 @@
1639 1683
1640 1684 /**
1641 1685 * Edit Database Server Port setting field
1642 1686 *
1643 - * @since 2.1.0 bbPress (r3813)
1687 + * @since 2.1.0 bbPress (r3816)
1644 1688 */
1645 1689 function bbp_converter_setting_callback_dbport() {
1646 1690 ?>
1647 1691
@@ -1658,9 +1702,9 @@
1658 1702
1659 1703 /**
1660 1704 * Edit Database User setting field
1661 1705 *
1662 - * @since 2.1.0 bbPress (r3813)
1706 + * @since 2.1.0 bbPress (r3816)
1663 1707 */
1664 1708 function bbp_converter_setting_callback_dbuser() {
1665 1709 ?>
1666 1710
@@ -1672,21 +1716,26 @@
1672 1716
1673 1717 /**
1674 1718 * Edit Database Pass setting field
1675 1719 *
1676 - * @since 2.1.0 bbPress (r3813)
1720 + * @since 2.1.0 bbPress (r3816)
1721 + * @since 2.6.19 bbPress (r7739) Stop displaying the saved source password.
1677 1722 */
1678 1723 function bbp_converter_setting_callback_dbpass() {
1679 1724 ?>
1680 1725
1681 1726 <span class="bbp-converter-db-password-wrapper">
1682 - <input name="_bbp_converter_db_pass" id="_bbp_converter_db_pass" class="bbp-converter-db-pass code" type="password" value="<?php bbp_form_option( '_bbp_converter_db_pass' ); ?>" autocomplete="off" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_pass' ); ?> />
1727 + <input name="_bbp_converter_db_pass" id="_bbp_converter_db_pass" class="bbp-converter-db-pass code" type="password" value="" autocomplete="off" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_pass' ); ?> />
1683 1728 <button type="button" class="bbp-db-pass-toggle password">
1684 1729 <span class="screen-reader-text"><?php esc_html_e( 'Toggle', 'bbpress' ); ?></span>
1685 1730 <span class="toggle-indicator" aria-hidden="true"></span>
1686 1731 </button>
1687 1732 </span>
1688 - <p class="description"><?php esc_html_e( 'Password for the above database user', 'bbpress' ); ?></p>
1733 + <p class="description"><?php esc_html_e( 'Leave blank to keep the saved password.', 'bbpress' ); ?></p>
1734 + <label for="_bbp_converter_db_pass_clear">
1735 + <input name="_bbp_converter_db_pass_clear" id="_bbp_converter_db_pass_clear" type="checkbox" value="1" />
1736 + <?php esc_html_e( 'Clear the saved password to use no password.', 'bbpress' ); ?>
1737 + </label>
1689 1738
1690 1739 <?php
1691 1740 }
1692 1741
@@ -1692,9 +1741,9 @@
1692 1741
1693 1742 /**
1694 1743 * Edit Database Name setting field
1695 1744 *
1696 - * @since 2.1.0 bbPress (r3813)
1745 + * @since 2.1.0 bbPress (r3816)
1697 1746 */
1698 1747 function bbp_converter_setting_callback_dbname() {
1699 1748 ?>
1700 1749
@@ -1706,9 +1755,9 @@
1706 1755
1707 1756 /**
1708 1757 * Main settings section description for the settings page
1709 1758 *
1710 - * @since 2.1.0 bbPress (r3813)
1759 + * @since 2.1.0 bbPress (r3872)
1711 1760 */
1712 1761 function bbp_converter_setting_callback_options_section() {
1713 1762 ?>
1714 1763
@@ -1719,9 +1768,9 @@
1719 1768
1720 1769 /**
1721 1770 * Edit Table Prefix setting field
1722 1771 *
1723 - * @since 2.1.0 bbPress (r3813)
1772 + * @since 2.1.0 bbPress (r3816)
1724 1773 */
1725 1774 function bbp_converter_setting_callback_dbprefix() {
1726 1775 ?>
1727 1776
@@ -1737,9 +1786,9 @@
1737 1786
1738 1787 /**
1739 1788 * Edit Rows Limit setting field
1740 1789 *
1741 - * @since 2.1.0 bbPress (r3813)
1790 + * @since 2.1.0 bbPress (r3816)
1742 1791 */
1743 1792 function bbp_converter_setting_callback_rows() {
1744 1793 ?>
1745 1794
@@ -1752,9 +1801,9 @@
1752 1801
1753 1802 /**
1754 1803 * Edit Delay Time setting field
1755 1804 *
1756 - * @since 2.1.0 bbPress (r3813)
1805 + * @since 2.1.0 bbPress (r3816)
1757 1806 */
1758 1807 function bbp_converter_setting_callback_delay_time() {
1759 1808 ?>
1760 1809
@@ -1767,9 +1816,9 @@
1767 1816
1768 1817 /**
1769 1818 * Edit Halt setting field
1770 1819 *
1771 - * @since 2.6.0 bbPress (r6599)
1820 + * @since 2.6.0 bbPress (r6600)
1772 1821 */
1773 1822 function bbp_converter_setting_callback_halt() {
1774 1823 ?>
1775 1824
@@ -1783,9 +1832,9 @@
1783 1832
1784 1833 /**
1785 1834 * Edit Restart setting field
1786 1835 *
1787 - * @since 2.1.0 bbPress (r3813)
1836 + * @since 2.1.0 bbPress (r3816)
1788 1837 */
1789 1838 function bbp_converter_setting_callback_restart() {
1790 1839 ?>
1791 1840
@@ -1798,9 +1847,9 @@
1798 1847
1799 1848 /**
1800 1849 * Edit Clean setting field
1801 1850 *
1802 - * @since 2.1.0 bbPress (r3813)
1851 + * @since 2.1.0 bbPress (r3816)
1803 1852 */
1804 1853 function bbp_converter_setting_callback_clean() {
1805 1854 ?>
1806 1855
@@ -1813,16 +1862,21 @@
1813 1862
1814 1863 /**
1815 1864 * Edit Convert Users setting field
1816 1865 *
1817 - * @since 2.1.0 bbPress (r3813)
1866 + * @since 2.1.0 bbPress (r3816)
1818 1867 */
1819 1868 function bbp_converter_setting_callback_convert_users() {
1869 + $network_users_only = ! current_user_can( 'bbp_tools_import_users' );
1820 1870 ?>
1821 1871
1822 - <input name="_bbp_converter_convert_users" id="_bbp_converter_convert_users" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_convert_users', false ) ); ?> <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_convert_users' ); ?> />
1872 + <input name="_bbp_converter_convert_users" id="_bbp_converter_convert_users" type="checkbox" value="1" <?php checked( ! $network_users_only && get_option( '_bbp_converter_convert_users', false ) ); ?> <?php disabled( $network_users_only || isset( bbpress()->options['_bbp_converter_convert_users'] ) ); ?> />
1823 1873 <label for="_bbp_converter_convert_users"><?php esc_html_e( 'Import user accounts from previous forums', 'bbpress' ); ?></label>
1824 - <p class="description"><?php esc_html_e( 'Passwords remain encrypted, and are converted as individual users log in.', 'bbpress' ); ?></p>
1874 + <?php if ( $network_users_only ) : ?>
1875 + <p class="description"><?php esc_html_e( 'A network administrator is required to import user accounts.', 'bbpress' ); ?></p>
1876 + <?php else : ?>
1877 + <p class="description"><?php esc_html_e( 'Passwords remain encrypted, and are converted as individual users log in.', 'bbpress' ); ?></p>
1878 + <?php endif; ?>
1825 1879
1826 1880 <?php
1827 1881 }
1828 1882
@@ -1830,9 +1884,9 @@
1830 1884
1831 1885 /**
1832 1886 * The main settings page
1833 1887 *
1834 - * @since 2.1.0 bbPress (r3186)
1888 + * @since 2.6.0 bbPress (r6277)
1835 1889 */
1836 1890 function bbp_converter_settings_page() {
1837 1891
1838 1892 // Status
@@ -2015,9 +2069,9 @@
2015 2069
2016 2070 /**
2017 2071 * Disable a settings field if it is forcibly set in the global options array.
2018 2072 *
2019 - * @since 2.2.0 bbPress (r4347)
2073 + * @since 2.2.0 bbPress (r4348)
2020 2074 *
2021 2075 * @param string $option_key
2022 2076 */
2023 2077 function bbp_maybe_admin_setting_disabled( $option_key = '' ) {