Dodane tłumaczenia + usunięto nachalne komunikaty ulepszenia do wersji PRO

This commit is contained in:
PiotrParysek 2017-06-06 22:04:46 +02:00
parent 78298e5106
commit db17150983
8 changed files with 3255 additions and 4923 deletions

View File

@ -19,10 +19,10 @@ add_action( 'admin_menu', 'wppb_register_basic_info_submenu_page', 2 );
* @return string * @return string
*/ */
function wppb_basic_info_content() { function wppb_basic_info_content() {
$version = 'Free'; $version = 'Free';
$version = ( ( PROFILE_BUILDER == 'Profile Builder Pro' ) ? 'Pro' : $version ); //$version = ( ( PROFILE_BUILDER == 'Profile Builder Pro' ) ? 'Pro' : $version );
$version = ( ( PROFILE_BUILDER == 'Profile Builder Hobbyist' ) ? 'Hobbyist' : $version ); //$version = ( ( PROFILE_BUILDER == 'Profile Builder Hobbyist' ) ? 'Hobbyist' : $version );
?> ?>
<div class="wrap wppb-wrap wppb-info-wrap"> <div class="wrap wppb-wrap wppb-info-wrap">
@ -45,7 +45,7 @@ function wppb_basic_info_content() {
<p><?php printf( __( 'Straight forward edit profile forms using %s shortcode.', 'profile-builder' ), '<strong class="nowrap">[wppb-edit-profile]</strong>' ); ?></p> <p><?php printf( __( 'Straight forward edit profile forms using %s shortcode.', 'profile-builder' ), '<strong class="nowrap">[wppb-edit-profile]</strong>' ); ?></p>
</div> </div>
</div> </div>
<?php ob_start(); ?> <?php ob_start(); /*?>
<hr/> <hr/>
<div> <div>
<h3><?php _e( 'Extra Features', 'profile-builder' );?></h3> <h3><?php _e( 'Extra Features', 'profile-builder' );?></h3>
@ -76,6 +76,7 @@ function wppb_basic_info_content() {
</div> </div>
<?php <?php
// Output here the Extra Features html for the Free version // Output here the Extra Features html for the Free version
$extra_features_html = ob_get_contents(); $extra_features_html = ob_get_contents();
ob_end_clean(); ob_end_clean();
@ -121,7 +122,7 @@ function wppb_basic_info_content() {
</div> </div>
</div> </div>
<hr/> <hr/>
<div> <div>
<h3><?php _e( 'Powerful Modules (**)', 'profile-builder' );?></h3> <h3><?php _e( 'Powerful Modules (**)', 'profile-builder' );?></h3>
<p><?php _e( 'Everything you will need to manage your users is probably already available using the Pro Modules.', 'profile-builder' ); ?></p> <p><?php _e( 'Everything you will need to manage your users is probably already available using the Pro Modules.', 'profile-builder' ); ?></p>
<?php if( file_exists ( WPPB_PLUGIN_DIR.'/modules/modules.php' ) ): ?> <?php if( file_exists ( WPPB_PLUGIN_DIR.'/modules/modules.php' ) ): ?>
@ -189,5 +190,5 @@ function wppb_basic_info_content() {
</ul> </ul>
</div> </div>
</div> </div>
<?php <?php*/
} }

View File

@ -26,7 +26,7 @@ function wppb_generate_default_settings_defaults(){
*/ */
function wppb_general_settings_content() { function wppb_general_settings_content() {
wppb_generate_default_settings_defaults(); wppb_generate_default_settings_defaults();
?> ?>
<div class="wrap wppb-wrap"> <div class="wrap wppb-wrap">
<form method="post" action="options.php#general-settings"> <form method="post" action="options.php#general-settings">
<?php $wppb_generalSettings = get_option( 'wppb_general_settings' ); ?> <?php $wppb_generalSettings = get_option( 'wppb_general_settings' ); ?>
@ -74,7 +74,7 @@ function wppb_general_settings_content() {
<optgroup label="<?php _e( 'Existing Pages', 'profile-builder' ); ?>"> <optgroup label="<?php _e( 'Existing Pages', 'profile-builder' ); ?>">
<?php <?php
$pages = get_pages( apply_filters( 'wppb_page_args_filter', array( 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'post_type' => 'page', 'post_status' => array( 'publish' ) ) ) ); $pages = get_pages( apply_filters( 'wppb_page_args_filter', array( 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'post_type' => 'page', 'post_status' => array( 'publish' ) ) ) );
foreach ( $pages as $key => $value ){ foreach ( $pages as $key => $value ){
echo '<option value="'.$value->ID.'"'; echo '<option value="'.$value->ID.'"';
if ( $wppb_generalSettings['activationLandingPage'] == $value->ID ) if ( $wppb_generalSettings['activationLandingPage'] == $value->ID )
@ -158,7 +158,7 @@ function wppb_general_settings_content() {
<?php } ?> <?php } ?>
<?php <?php
if ( PROFILE_BUILDER == 'Profile Builder Free' ) { /*if ( PROFILE_BUILDER == 'Profile Builder Free' ) {
?> ?>
<tr> <tr>
<th scope="row"> <th scope="row">
@ -168,7 +168,7 @@ function wppb_general_settings_content() {
<p><em> <?php printf( __( 'You decide who is a user on your website. Get notified via email or approve multiple users at once from the WordPress UI. Enable Admin Approval by upgrading to %1$sHobbyist or PRO versions%2$s.', 'profile-builder' ),'<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=general-settings-link&utm_campaign=PBFree">', '</a>' )?></em></p> <p><em> <?php printf( __( 'You decide who is a user on your website. Get notified via email or approve multiple users at once from the WordPress UI. Enable Admin Approval by upgrading to %1$sHobbyist or PRO versions%2$s.', 'profile-builder' ),'<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=general-settings-link&utm_campaign=PBFree">', '</a>' )?></em></p>
</td> </td>
</tr> </tr>
<?php } ?> <?php }*/ ?>
<tr> <tr>
<th scope="row"> <th scope="row">
@ -217,14 +217,14 @@ function wppb_general_settings_content() {
<?php do_action( 'wppb_extra_general_settings', $wppb_generalSettings ); ?> <?php do_action( 'wppb_extra_general_settings', $wppb_generalSettings ); ?>
</table> </table>
<input type="hidden" name="action" value="update" /> <input type="hidden" name="action" value="update" />
<p class="submit"><input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ); ?>" /></p> <p class="submit"><input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ); ?>" /></p>
</form> </form>
</div> </div>
<?php <?php
} }

View File

@ -19,7 +19,7 @@ function wppb_manage_fields_submenu(){
); );
$all_fields = new WCK_Page_Creator_PB( $args ); $all_fields = new WCK_Page_Creator_PB( $args );
// populate this page // populate this page
$manage_field_types[] = 'Default - Name (Heading)'; $manage_field_types[] = 'Default - Name (Heading)';
$manage_field_types[] = 'Default - Contact Info (Heading)'; $manage_field_types[] = 'Default - Contact Info (Heading)';
@ -76,13 +76,13 @@ function wppb_manage_fields_submenu(){
$manage_field_types[] = 'Map'; $manage_field_types[] = 'Map';
$manage_field_types[] = 'HTML'; $manage_field_types[] = 'HTML';
} }
//Free to Pro call to action on Manage Fields page //Free to Pro call to action on Manage Fields page
$field_description = __('Choose one of the supported field types','profile-builder'); $field_description = __('Choose one of the supported field types','profile-builder');
if( PROFILE_BUILDER == 'Profile Builder Free' ) { /*if( PROFILE_BUILDER == 'Profile Builder Free' ) {
$field_description .= sprintf( __('. Extra Field Types are available in <a href="%s">Hobbyist or PRO versions</a>.' , 'profile-builder'), esc_url( 'https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=manage-fields-link&utm_campaign=PBFree' ) ); $field_description .= sprintf( __('. Extra Field Types are available in <a href="%s">Hobbyist or PRO versions</a>.' , 'profile-builder'), esc_url( 'https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=manage-fields-link&utm_campaign=PBFree' ) );
} }*/
//user roles //user roles
@ -160,7 +160,7 @@ function wppb_manage_fields_submenu(){
array( 'type' => 'select', 'slug' => 'required', 'title' => __( 'Required', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( 'Whether the field is required or not', 'profile-builder' ) ), array( 'type' => 'select', 'slug' => 'required', 'title' => __( 'Required', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( 'Whether the field is required or not', 'profile-builder' ) ),
array( 'type' => 'select', 'slug' => 'overwrite-existing', 'title' => __( 'Overwrite Existing', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( "Selecting 'Yes' will add the field to the list, but will overwrite any other field in the database that has the same meta-name<br/>Use this at your own risk", 'profile-builder' ) ), array( 'type' => 'select', 'slug' => 'overwrite-existing', 'title' => __( 'Overwrite Existing', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( "Selecting 'Yes' will add the field to the list, but will overwrite any other field in the database that has the same meta-name<br/>Use this at your own risk", 'profile-builder' ) ),
) ); ) );
// create the new submenu with the above options // create the new submenu with the above options
$args = array( $args = array(
'metabox_id' => 'manage-fields', 'metabox_id' => 'manage-fields',
@ -206,14 +206,14 @@ function wppb_prepopulate_fields(){
$prepopulated_fields[] = array( 'field' => 'Default - Contact Info (Heading)', 'field-title' => __( 'Contact Info', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '7', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); $prepopulated_fields[] = array( 'field' => 'Default - Contact Info (Heading)', 'field-title' => __( 'Contact Info', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '7', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
$prepopulated_fields[] = array( 'field' => 'Default - E-mail', 'field-title' => __( 'E-mail', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '8', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' ); $prepopulated_fields[] = array( 'field' => 'Default - E-mail', 'field-title' => __( 'E-mail', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '8', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' );
$prepopulated_fields[] = array( 'field' => 'Default - Website', 'field-title' => __( 'Website', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '9', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); $prepopulated_fields[] = array( 'field' => 'Default - Website', 'field-title' => __( 'Website', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '9', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
// Default contact methods were removed in WP 3.6. A filter dictates contact methods. // Default contact methods were removed in WP 3.6. A filter dictates contact methods.
if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){ if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){
$prepopulated_fields[] = array( 'field' => 'Default - AIM', 'field-title' => __( 'AIM', 'profile-builder' ), 'meta-name' => 'aim', 'overwrite-existing' => 'No', 'id' => '10', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); $prepopulated_fields[] = array( 'field' => 'Default - AIM', 'field-title' => __( 'AIM', 'profile-builder' ), 'meta-name' => 'aim', 'overwrite-existing' => 'No', 'id' => '10', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
$prepopulated_fields[] = array( 'field' => 'Default - Yahoo IM', 'field-title' => __( 'Yahoo IM', 'profile-builder' ), 'meta-name' => 'yim', 'overwrite-existing' => 'No', 'id' => '11', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); $prepopulated_fields[] = array( 'field' => 'Default - Yahoo IM', 'field-title' => __( 'Yahoo IM', 'profile-builder' ), 'meta-name' => 'yim', 'overwrite-existing' => 'No', 'id' => '11', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
$prepopulated_fields[] = array( 'field' => 'Default - Jabber / Google Talk', 'field-title' => __( 'Jabber / Google Talk', 'profile-builder' ), 'meta-name' => 'jabber', 'overwrite-existing' => 'No', 'id' => '12', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); $prepopulated_fields[] = array( 'field' => 'Default - Jabber / Google Talk', 'field-title' => __( 'Jabber / Google Talk', 'profile-builder' ), 'meta-name' => 'jabber', 'overwrite-existing' => 'No', 'id' => '12', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
} }
$prepopulated_fields[] = array( 'field' => 'Default - About Yourself (Heading)', 'field-title' => __( 'About Yourself', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '13', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' ); $prepopulated_fields[] = array( 'field' => 'Default - About Yourself (Heading)', 'field-title' => __( 'About Yourself', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '13', 'description' => '', 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'No' );
$prepopulated_fields[] = array( 'field' => 'Default - Biographical Info', 'field-title' => __( 'Biographical Info', 'profile-builder' ), 'meta-name' => 'description', 'overwrite-existing' => 'No', 'id' => '14', 'description' => __( 'Share a little biographical information to fill out your profile. This may be shown publicly.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'required' => 'No' ); $prepopulated_fields[] = array( 'field' => 'Default - Biographical Info', 'field-title' => __( 'Biographical Info', 'profile-builder' ), 'meta-name' => 'description', 'overwrite-existing' => 'No', 'id' => '14', 'description' => __( 'Share a little biographical information to fill out your profile. This may be shown publicly.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'required' => 'No' );
$prepopulated_fields[] = array( 'field' => 'Default - Password', 'field-title' => __( 'Password', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '15', 'description' => __( 'Type your password.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' ); $prepopulated_fields[] = array( 'field' => 'Default - Password', 'field-title' => __( 'Password', 'profile-builder' ), 'meta-name' => '', 'overwrite-existing' => 'No', 'id' => '15', 'description' => __( 'Type your password.', 'profile-builder' ), 'row-count' => '5', 'allowed-image-extensions' => '.*', 'allowed-upload-extensions' => '.*', 'avatar-size' => '100', 'date-format' => 'mm/dd/yy', 'terms-of-agreement' => '', 'options' => '', 'labels' => '', 'public-key' => '', 'private-key' => '', 'default-value' => '', 'default-option' => '', 'default-options' => '', 'default-content' => '', 'required' => 'Yes' );
@ -234,7 +234,7 @@ function wppb_prepopulate_fields(){
*/ */
function wppb_get_meta_name( $option = 'wppb_manage_fields', $prefix = 'custom_field_' ){ function wppb_get_meta_name( $option = 'wppb_manage_fields', $prefix = 'custom_field_' ){
$id = 1; $id = 1;
$wppb_manage_fields = get_option( $option, 'not_found' ); $wppb_manage_fields = get_option( $option, 'not_found' );
if ( ( $wppb_manage_fields === 'not_found' ) || ( empty( $wppb_manage_fields ) ) ){ if ( ( $wppb_manage_fields === 'not_found' ) || ( empty( $wppb_manage_fields ) ) ){
@ -920,7 +920,7 @@ add_filter( 'wck_add_meta_filter_values_wppb_manage_fields', 'wppb_check_unique_
function wppb_return_unique_field_list( $only_default_fields = false ){ function wppb_return_unique_field_list( $only_default_fields = false ){
$unique_field_list[] = 'Default - Name (Heading)'; $unique_field_list[] = 'Default - Name (Heading)';
$unique_field_list[] = 'Default - Contact Info (Heading)'; $unique_field_list[] = 'Default - Contact Info (Heading)';
$unique_field_list[] = 'Default - About Yourself (Heading)'; $unique_field_list[] = 'Default - About Yourself (Heading)';
@ -937,7 +937,7 @@ function wppb_return_unique_field_list( $only_default_fields = false ){
$unique_field_list[] = 'Default - Yahoo IM'; $unique_field_list[] = 'Default - Yahoo IM';
$unique_field_list[] = 'Default - Jabber / Google Talk'; $unique_field_list[] = 'Default - Jabber / Google Talk';
} }
$unique_field_list[] = 'Default - Password'; $unique_field_list[] = 'Default - Password';
$unique_field_list[] = 'Default - Repeat Password'; $unique_field_list[] = 'Default - Repeat Password';
$unique_field_list[] = 'Default - Biographical Info'; $unique_field_list[] = 'Default - Biographical Info';
@ -974,15 +974,15 @@ function wppb_check_field_on_edit_add( $message, $fields, $required_fields, $met
global $wpdb; global $wpdb;
if ( $meta_name == 'wppb_manage_fields' ){ if ( $meta_name == 'wppb_manage_fields' ){
// check for a valid field-type (fallback) // check for a valid field-type (fallback)
if ( $posted_values['field'] == '' ) if ( $posted_values['field'] == '' )
$message .= __( "You must select a field\n", 'profile-builder' ); $message .= __( "You must select a field\n", 'profile-builder' );
// END check for a valid field-type (fallback) // END check for a valid field-type (fallback)
$unique_field_list = wppb_return_unique_field_list(); $unique_field_list = wppb_return_unique_field_list();
$all_fields = apply_filters( 'wppb_manage_fields_check_field_on_edit_add', get_option ( $meta_name, 'not_set' ), $posted_values ); $all_fields = apply_filters( 'wppb_manage_fields_check_field_on_edit_add', get_option ( $meta_name, 'not_set' ), $posted_values );
// check if the unique fields are only added once // check if the unique fields are only added once
if( $all_fields != 'not_set' ){ if( $all_fields != 'not_set' ){
foreach( $all_fields as $field ){ foreach( $all_fields as $field ){
@ -999,23 +999,23 @@ function wppb_check_field_on_edit_add( $message, $fields, $required_fields, $met
if ( is_numeric( $posted_values['avatar-size'] ) ){ if ( is_numeric( $posted_values['avatar-size'] ) ){
if ( ( $posted_values['avatar-size'] < 20 ) || ( $posted_values['avatar-size'] > 200 ) ) if ( ( $posted_values['avatar-size'] < 20 ) || ( $posted_values['avatar-size'] > 200 ) )
$message .= __( "The entered avatar size is not between 20 and 200\n", 'profile-builder' ); $message .= __( "The entered avatar size is not between 20 and 200\n", 'profile-builder' );
}else }else
$message .= __( "The entered avatar size is not numerical\n", 'profile-builder' ); $message .= __( "The entered avatar size is not numerical\n", 'profile-builder' );
} }
// END check for avatar size // END check for avatar size
// check for correct row value // check for correct row value
if ( ( $posted_values['field'] == 'Default - Biographical Info' ) || ( $posted_values['field'] == 'Textarea' ) ){ if ( ( $posted_values['field'] == 'Default - Biographical Info' ) || ( $posted_values['field'] == 'Textarea' ) ){
if ( !is_numeric( $posted_values['row-count'] ) ) if ( !is_numeric( $posted_values['row-count'] ) )
$message .= __( "The entered row number is not numerical\n", 'profile-builder' ); $message .= __( "The entered row number is not numerical\n", 'profile-builder' );
elseif ( trim( $posted_values['row-count'] ) == '' ) elseif ( trim( $posted_values['row-count'] ) == '' )
$message .= __( "You must enter a value for the row number\n", 'profile-builder' ); $message .= __( "You must enter a value for the row number\n", 'profile-builder' );
} }
// END check for correct row value // END check for correct row value
// check for the public and private keys // check for the public and private keys
if ( $posted_values['field'] == 'reCAPTCHA'){ if ( $posted_values['field'] == 'reCAPTCHA'){
@ -1025,26 +1025,26 @@ function wppb_check_field_on_edit_add( $message, $fields, $required_fields, $met
$message .= __( "You must enter the secret key\n", 'profile-builder' ); $message .= __( "You must enter the secret key\n", 'profile-builder' );
} }
// END check for the public and private keys // END check for the public and private keys
// check for the correct the date-format // check for the correct the date-format
if ( $posted_values['field'] == 'Datepicker' ){ if ( $posted_values['field'] == 'Datepicker' ){
$date_format = strtolower( $posted_values['date-format'] ); $date_format = strtolower( $posted_values['date-format'] );
if ( trim( $date_format ) != 'mm/dd/yy' && trim( $date_format ) != 'mm/yy/dd' && trim( $date_format ) != 'dd/yy/mm' && if ( trim( $date_format ) != 'mm/dd/yy' && trim( $date_format ) != 'mm/yy/dd' && trim( $date_format ) != 'dd/yy/mm' &&
trim( $date_format ) != 'dd/mm/yy' && trim( $date_format ) != 'yy/dd/mm' && trim( $date_format ) != 'yy/mm/dd' && trim( $date_format ) != 'dd/mm/yy' && trim( $date_format ) != 'yy/dd/mm' && trim( $date_format ) != 'yy/mm/dd' &&
trim( $date_format ) != 'yy-mm-dd' && trim( $date_format ) != 'DD, dd-M-y' && trim( $date_format ) != 'D, dd M yy' && trim( $date_format ) != 'yy-mm-dd' && trim( $date_format ) != 'DD, dd-M-y' && trim( $date_format ) != 'D, dd M yy' &&
trim( $date_format ) != 'D, d M y' && trim( $date_format ) != 'D, d M yy' && trim( $date_format ) != 'mm-dd-yy' && trim( $date_format ) != '@' ) trim( $date_format ) != 'D, d M y' && trim( $date_format ) != 'D, d M yy' && trim( $date_format ) != 'mm-dd-yy' && trim( $date_format ) != '@' )
$message .= __( "The entered value for the Datepicker is not a valid date-format\n", 'profile-builder' ); $message .= __( "The entered value for the Datepicker is not a valid date-format\n", 'profile-builder' );
elseif ( trim( $date_format ) == '' ) elseif ( trim( $date_format ) == '' )
$message .= __( "You must enter a value for the date-format\n", 'profile-builder' ); $message .= __( "You must enter a value for the date-format\n", 'profile-builder' );
} }
// END check for the correct the date-format // END check for the correct the date-format
//check for empty meta-name and duplicate meta-name //check for empty meta-name and duplicate meta-name
if ( $posted_values['overwrite-existing'] == 'No' ){ if ( $posted_values['overwrite-existing'] == 'No' ){
$skip_check_for_fields = wppb_return_unique_field_list(true); $skip_check_for_fields = wppb_return_unique_field_list(true);
$skip_check_for_fields = apply_filters ( 'wppb_skip_check_for_fields', $skip_check_for_fields ); $skip_check_for_fields = apply_filters ( 'wppb_skip_check_for_fields', $skip_check_for_fields );
if ( !in_array( trim( $posted_values['field'] ), $skip_check_for_fields ) ){ if ( !in_array( trim( $posted_values['field'] ), $skip_check_for_fields ) ){
$unique_meta_name_list = array( 'first_name', 'last_name', 'nickname', 'description' ); $unique_meta_name_list = array( 'first_name', 'last_name', 'nickname', 'description' );
@ -1061,24 +1061,24 @@ function wppb_check_field_on_edit_add( $message, $fields, $required_fields, $met
$unique_meta_name_list[] = 'yim'; $unique_meta_name_list[] = 'yim';
$unique_meta_name_list[] = 'jabber'; $unique_meta_name_list[] = 'jabber';
} }
// if the desired meta-name is one of the following, automatically give an error // if the desired meta-name is one of the following, automatically give an error
if ( in_array( trim( $posted_values['meta-name'] ), apply_filters ( 'wppb_unique_meta_name_list', $unique_meta_name_list ) ) ) if ( in_array( trim( $posted_values['meta-name'] ), apply_filters ( 'wppb_unique_meta_name_list', $unique_meta_name_list ) ) )
$message .= __( "That meta-name is already in use\n", 'profile-builder' ); $message .= __( "That meta-name is already in use\n", 'profile-builder' );
else{ else{
$found_in_custom_fields = false; $found_in_custom_fields = false;
if( $all_fields != 'not_set' ) if( $all_fields != 'not_set' )
foreach( $all_fields as $field ){ foreach( $all_fields as $field ){
if ( $posted_values['meta-name'] != '' && ( $field['meta-name'] == $posted_values['meta-name'] ) && ( $field['id'] != $posted_values['id'] ) ){ if ( $posted_values['meta-name'] != '' && ( $field['meta-name'] == $posted_values['meta-name'] ) && ( $field['id'] != $posted_values['id'] ) ){
$message .= __( "That meta-name is already in use\n", 'profile-builder' ); $message .= __( "That meta-name is already in use\n", 'profile-builder' );
$found_in_custom_fields = true; $found_in_custom_fields = true;
}elseif ( ( $field['meta-name'] == $posted_values['meta-name'] ) && ( $field['id'] == $posted_values['id'] ) ) }elseif ( ( $field['meta-name'] == $posted_values['meta-name'] ) && ( $field['id'] == $posted_values['id'] ) )
$found_in_custom_fields = true; $found_in_custom_fields = true;
} }
if ( $found_in_custom_fields === false ){ if ( $found_in_custom_fields === false ){
if( $posted_values['meta-name'] != '' ) { if( $posted_values['meta-name'] != '' ) {
$found_meta_name = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE meta_key = %s", $posted_values['meta-name'])); $found_meta_name = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE meta_key = %s", $posted_values['meta-name']));
@ -1098,7 +1098,7 @@ function wppb_check_field_on_edit_add( $message, $fields, $required_fields, $met
} }
} }
// END check for correct meta name on upload field // END check for correct meta name on upload field
// check for valid default option (checkbox, select, radio) // check for valid default option (checkbox, select, radio)
if ( ( $posted_values['field'] == 'Checkbox' ) || ( $posted_values['field'] == 'Select (Multiple)' ) ) { if ( ( $posted_values['field'] == 'Checkbox' ) || ( $posted_values['field'] == 'Select (Multiple)' ) ) {
$options = array_map( 'trim', explode( ',', $posted_values['options'] ) ); $options = array_map( 'trim', explode( ',', $posted_values['options'] ) );
@ -1106,16 +1106,16 @@ function wppb_check_field_on_edit_add( $message, $fields, $required_fields, $met
/* echo "<script>console.log( Posted options: " . print_r($options, true) . "' );</script>"; /* echo "<script>console.log( Posted options: " . print_r($options, true) . "' );</script>";
echo "<script>console.log( Default options: " . print_r($default_options, true) . "' );</script>"; */ echo "<script>console.log( Default options: " . print_r($default_options, true) . "' );</script>"; */
$not_found = ''; $not_found = '';
foreach ( $default_options as $key => $value ){ foreach ( $default_options as $key => $value ){
if ( !in_array( $value, $options ) ) if ( !in_array( $value, $options ) )
$not_found .= $value . ', '; $not_found .= $value . ', ';
} }
if ( $not_found != '' ) if ( $not_found != '' )
$message .= sprintf( __( "The following option(s) did not coincide with the ones in the options list: %s\n", 'profile-builder' ), trim( $not_found, ', ' ) ); $message .= sprintf( __( "The following option(s) did not coincide with the ones in the options list: %s\n", 'profile-builder' ), trim( $not_found, ', ' ) );
}elseif ( ( $posted_values['field'] == 'Radio' ) || ( $posted_values['field'] == 'Select' ) ){ }elseif ( ( $posted_values['field'] == 'Radio' ) || ( $posted_values['field'] == 'Select' ) ){
if ( ( trim( $posted_values['default-option'] ) != '' ) && ( !in_array( $posted_values['default-option'], array_map( 'trim', explode( ',', $posted_values['options'] ) ) ) ) ) if ( ( trim( $posted_values['default-option'] ) != '' ) && ( !in_array( $posted_values['default-option'], array_map( 'trim', explode( ',', $posted_values['options'] ) ) ) ) )
$message .= sprintf( __( "The following option did not coincide with the ones in the options list: %s\n", 'profile-builder' ), $posted_values['default-option'] ); $message .= sprintf( __( "The following option did not coincide with the ones in the options list: %s\n", 'profile-builder' ), $posted_values['default-option'] );
@ -1135,10 +1135,10 @@ function wppb_check_field_on_edit_add( $message, $fields, $required_fields, $met
}elseif ( ( $meta_name == 'wppb_rf_fields' ) || ( $meta_name == 'wppb_epf_fields' ) ){ }elseif ( ( $meta_name == 'wppb_rf_fields' ) || ( $meta_name == 'wppb_epf_fields' ) ){
if ( $posted_values['field'] == '' ){ if ( $posted_values['field'] == '' ){
$message .= __( "You must select a field\n", 'profile-builder' ); $message .= __( "You must select a field\n", 'profile-builder' );
}else{ }else{
$fields_so_far = get_post_meta ( $post_id, $meta_name, true ); $fields_so_far = get_post_meta ( $post_id, $meta_name, true );
foreach ( $fields_so_far as $key => $value ){ foreach ( $fields_so_far as $key => $value ){
if ( $value['id'] == $posted_values['id'] ) if ( $value['id'] == $posted_values['id'] )
$message .= __( "That field is already added in this form\n", 'profile-builder' ); $message .= __( "That field is already added in this form\n", 'profile-builder' );
@ -1212,12 +1212,12 @@ function wppb_add_content_before_manage_fields(){
<li><strong class="nowrap">[wppb-register role="author"]</strong></li> <li><strong class="nowrap">[wppb-register role="author"]</strong></li>
</ul> </ul>
<p> <p>
<?php <?php/*
if( PROFILE_BUILDER == 'Profile Builder Pro' ) if( PROFILE_BUILDER == 'Profile Builder Pro' )
_e("If you're interested in displaying different fields in the registration and edit profile forms, please use the Multiple Registration & Edit Profile Forms Modules.", 'profile-builder'); _e("If you're interested in displaying different fields in the registration and edit profile forms, please use the Multiple Registration & Edit Profile Forms Modules.", 'profile-builder');
else else
_e( "With Profile Builder Pro v2 you can display different fields in the registration and edit profile forms, using the Multiple Registration & Edit Profile Forms module.", "profile-builder" ) _e( "With Profile Builder Pro v2 you can display different fields in the registration and edit profile forms, using the Multiple Registration & Edit Profile Forms module.", "profile-builder" )
?> */?>
</p> </p>
<?php <?php
} }

View File

@ -234,10 +234,10 @@ function wppb_pms_cross_promo() {
* *
* @Since 2.2.5 * @Since 2.2.5
*/ */
/*
if ( !isset($_GET['page']) || $_GET['page'] != 'profile-builder-pms-promo'){ if ( !isset($_GET['page']) || $_GET['page'] != 'profile-builder-pms-promo'){
new WPPB_Add_General_Notices('wppb_pms_cross_promo', new WPPB_Add_General_Notices('wppb_pms_cross_promo',
sprintf(__('Allow your users to have <strong>paid accounts with Profile Builder</strong>. %1$sFind out how >%2$s %3$sDismiss%4$s', 'profile-builder'), "<a href='" . admin_url('options.php?page=profile-builder-pms-promo') . "'>", "</a>", "<a class='wppb-dismiss-notification' href='" . esc_url( add_query_arg('wppb_pms_cross_promo_dismiss_notification', '0') ) . "'>", "</a>"), sprintf(__('Allow your users to have <strong>paid accounts with Profile Builder</strong>. %1$sFind out how >%2$s %3$sDismiss%4$s', 'profile-builder'), "<a href='" . admin_url('options.php?page=profile-builder-pms-promo') . "'>", "</a>", "<a class='wppb-dismiss-notification' href='" . esc_url( add_query_arg('wppb_pms_cross_promo_dismiss_notification', '0') ) . "'>", "</a>"),
'pms-cross-promo'); 'pms-cross-promo');
} }
*/

View File

@ -3,7 +3,7 @@
* Functions Load * Functions Load
* *
*/ */
// whitelist options, you can add more register_settings changing the second parameter // whitelist options, you can add more register_settings changing the second parameter
function wppb_register_settings() { function wppb_register_settings() {
register_setting( 'wppb_option_group', 'wppb_default_settings' ); register_setting( 'wppb_option_group', 'wppb_default_settings' );
@ -23,10 +23,10 @@ function wppb_register_settings() {
// WPML support // WPML support
function wppb_icl_t($context, $name, $value){ function wppb_icl_t($context, $name, $value){
if( function_exists( 'icl_t' ) ) if( function_exists( 'icl_t' ) )
return icl_t( $context, $name, $value ); return icl_t( $context, $name, $value );
else else
return $value; return $value;
} }
@ -73,10 +73,10 @@ function wppb_show_admin_bar($content){
if(!function_exists('wppb_curpageurl')){ if(!function_exists('wppb_curpageurl')){
function wppb_curpageurl() { function wppb_curpageurl() {
$pageURL = 'http'; $pageURL = 'http';
if ((isset($_SERVER["HTTPS"])) && ($_SERVER["HTTPS"] == "on")) if ((isset($_SERVER["HTTPS"])) && ($_SERVER["HTTPS"] == "on"))
$pageURL .= "s"; $pageURL .= "s";
$pageURL .= "://"; $pageURL .= "://";
if( strpos( $_SERVER["HTTP_HOST"], $_SERVER["SERVER_NAME"] ) !== false ){ if( strpos( $_SERVER["HTTP_HOST"], $_SERVER["SERVER_NAME"] ) !== false ){
@ -88,7 +88,7 @@ if(!function_exists('wppb_curpageurl')){
else else
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
} }
if ( function_exists('apply_filters') ) $pageURL = apply_filters('wppb_curpageurl', $pageURL); if ( function_exists('apply_filters') ) $pageURL = apply_filters('wppb_curpageurl', $pageURL);
return $pageURL; return $pageURL;
@ -99,12 +99,12 @@ if(!function_exists('wppb_curpageurl')){
if ( is_admin() ){ if ( is_admin() ){
// register the settings for the menu only display sidebar menu for a user with a certain capability, in this case only the "admin" // register the settings for the menu only display sidebar menu for a user with a certain capability, in this case only the "admin"
add_action( 'admin_init', 'wppb_register_settings' ); add_action( 'admin_init', 'wppb_register_settings' );
// display the same extra profile fields in the admin panel also // display the same extra profile fields in the admin panel also
if ( file_exists ( WPPB_PLUGIN_DIR.'/front-end/extra-fields/extra-fields.php' ) ){ if ( file_exists ( WPPB_PLUGIN_DIR.'/front-end/extra-fields/extra-fields.php' ) ){
require_once( WPPB_PLUGIN_DIR.'/front-end/extra-fields/extra-fields.php' ); require_once( WPPB_PLUGIN_DIR.'/front-end/extra-fields/extra-fields.php' );
add_action( 'show_user_profile', 'display_profile_extra_fields_in_admin', 10 ); add_action( 'show_user_profile', 'display_profile_extra_fields_in_admin', 10 );
add_action( 'edit_user_profile', 'display_profile_extra_fields_in_admin', 10 ); add_action( 'edit_user_profile', 'display_profile_extra_fields_in_admin', 10 );
global $pagenow; global $pagenow;
@ -116,15 +116,15 @@ if ( is_admin() ){
}else if ( !is_admin() ){ }else if ( !is_admin() ){
// include the stylesheet // include the stylesheet
add_action( 'wp_print_styles', 'wppb_add_plugin_stylesheet' ); add_action( 'wp_print_styles', 'wppb_add_plugin_stylesheet' );
// include the menu file for the profile informations // include the menu file for the profile informations
include_once( WPPB_PLUGIN_DIR.'/front-end/edit-profile.php' ); include_once( WPPB_PLUGIN_DIR.'/front-end/edit-profile.php' );
include_once( WPPB_PLUGIN_DIR.'/front-end/class-formbuilder.php' ); include_once( WPPB_PLUGIN_DIR.'/front-end/class-formbuilder.php' );
add_shortcode( 'wppb-edit-profile', 'wppb_front_end_profile_info' ); add_shortcode( 'wppb-edit-profile', 'wppb_front_end_profile_info' );
// include the menu file for the login screen // include the menu file for the login screen
include_once( WPPB_PLUGIN_DIR.'/front-end/login.php' ); include_once( WPPB_PLUGIN_DIR.'/front-end/login.php' );
add_shortcode( 'wppb-login', 'wppb_front_end_login' ); add_shortcode( 'wppb-login', 'wppb_front_end_login' );
// include the menu file for the logout screen // include the menu file for the logout screen
@ -132,11 +132,11 @@ if ( is_admin() ){
add_shortcode( 'wppb-logout', 'wppb_front_end_logout' ); add_shortcode( 'wppb-logout', 'wppb_front_end_logout' );
// include the menu file for the register screen // include the menu file for the register screen
include_once( WPPB_PLUGIN_DIR.'/front-end/register.php' ); include_once( WPPB_PLUGIN_DIR.'/front-end/register.php' );
add_shortcode( 'wppb-register', 'wppb_front_end_register_handler' ); add_shortcode( 'wppb-register', 'wppb_front_end_register_handler' );
// include the menu file for the recover password screen // include the menu file for the recover password screen
include_once( WPPB_PLUGIN_DIR.'/front-end/recover.php' ); include_once( WPPB_PLUGIN_DIR.'/front-end/recover.php' );
add_shortcode( 'wppb-recover-password', 'wppb_front_end_password_recovery' ); add_shortcode( 'wppb-recover-password', 'wppb_front_end_password_recovery' );
// set the front-end admin bar to show/hide // set the front-end admin bar to show/hide
@ -165,7 +165,7 @@ function wppb_mail( $to, $subject, $message, $message_from = null, $context = nu
$message = apply_filters( 'wppb_email_message', $message, $context ); $message = apply_filters( 'wppb_email_message', $message, $context );
do_action( 'wppb_before_sending_email', $to, $subject, $message, $send_email, $context ); do_action( 'wppb_before_sending_email', $to, $subject, $message, $send_email, $context );
if ( $send_email ) { if ( $send_email ) {
//we add this filter to enable html encoding //we add this filter to enable html encoding
add_filter( 'wp_mail_content_type', create_function( '', 'return "text/html"; ' ) ); add_filter( 'wp_mail_content_type', create_function( '', 'return "text/html"; ' ) );
@ -187,7 +187,7 @@ function wppb_activate_account_check(){
$wppb_generalSettings = get_option( 'wppb_general_settings' ); $wppb_generalSettings = get_option( 'wppb_general_settings' );
$activation_landing_page_id = ( ( isset( $wppb_generalSettings['activationLandingPage'] ) && ( trim( $wppb_generalSettings['activationLandingPage'] ) != '' ) ) ? $wppb_generalSettings['activationLandingPage'] : 'not_set' ); $activation_landing_page_id = ( ( isset( $wppb_generalSettings['activationLandingPage'] ) && ( trim( $wppb_generalSettings['activationLandingPage'] ) != '' ) ) ? $wppb_generalSettings['activationLandingPage'] : 'not_set' );
if ( $activation_landing_page_id != 'not_set' ){ if ( $activation_landing_page_id != 'not_set' ){
//an activation page was selected, but we still need to check if the current page doesn't already have the registration shortcode //an activation page was selected, but we still need to check if the current page doesn't already have the registration shortcode
if ( strpos( $post->post_content, '[wppb-register' ) === false ) if ( strpos( $post->post_content, '[wppb-register' ) === false )
@ -210,7 +210,7 @@ function wppb_add_activation_message( $content ){
// Create a new, top-level page // Create a new, top-level page
$args = array( $args = array(
'page_title' => 'Profile Builder', 'page_title' => 'Profile Builder',
'menu_title' => 'Profile Builder', 'menu_title' => 'Profile Builder',
'capability' => 'manage_options', 'capability' => 'manage_options',
@ -244,7 +244,7 @@ add_action( 'admin_menu', 'wppb_remove_main_menu_page', 11 );
function wppb_print_cpt_script( $hook ){ function wppb_print_cpt_script( $hook ){
wp_enqueue_script( 'jquery-ui-dialog' ); wp_enqueue_script( 'jquery-ui-dialog' );
wp_enqueue_style( 'wp-jquery-ui-dialog' ); wp_enqueue_style( 'wp-jquery-ui-dialog' );
if ( $hook == 'profile-builder_page_manage-fields' ){ if ( $hook == 'profile-builder_page_manage-fields' ){
wp_enqueue_script( 'wppb-manage-fields-live-change', WPPB_PLUGIN_URL . 'assets/js/jquery-manage-fields-live-change.js', array(), PROFILE_BUILDER_VERSION, true ); wp_enqueue_script( 'wppb-manage-fields-live-change', WPPB_PLUGIN_URL . 'assets/js/jquery-manage-fields-live-change.js', array(), PROFILE_BUILDER_VERSION, true );
} }
@ -265,7 +265,7 @@ function wppb_print_cpt_script( $hook ){
( $hook == 'admin_page_profile-builder-pms-promo') ) { ( $hook == 'admin_page_profile-builder-pms-promo') ) {
wp_enqueue_style( 'wppb-back-end-style', WPPB_PLUGIN_URL . 'assets/css/style-back-end.css', false, PROFILE_BUILDER_VERSION ); wp_enqueue_style( 'wppb-back-end-style', WPPB_PLUGIN_URL . 'assets/css/style-back-end.css', false, PROFILE_BUILDER_VERSION );
} }
if ( $hook == 'profile-builder_page_profile-builder-general-settings' ) if ( $hook == 'profile-builder_page_profile-builder-general-settings' )
wp_enqueue_script( 'wppb-manage-fields-live-change', WPPB_PLUGIN_URL . 'assets/js/jquery-email-confirmation.js', array(), PROFILE_BUILDER_VERSION, true ); wp_enqueue_script( 'wppb-manage-fields-live-change', WPPB_PLUGIN_URL . 'assets/js/jquery-email-confirmation.js', array(), PROFILE_BUILDER_VERSION, true );
@ -279,10 +279,10 @@ function wppb_print_cpt_script( $hook ){
if ( isset( $_GET['post_type'] ) || isset( $_GET['post'] ) ){ if ( isset( $_GET['post_type'] ) || isset( $_GET['post'] ) ){
if ( isset( $_GET['post_type'] ) ) if ( isset( $_GET['post_type'] ) )
$post_type = sanitize_text_field( $_GET['post_type'] ); $post_type = sanitize_text_field( $_GET['post_type'] );
elseif ( isset( $_GET['post'] ) ) elseif ( isset( $_GET['post'] ) )
$post_type = get_post_type( absint( $_GET['post'] ) ); $post_type = get_post_type( absint( $_GET['post'] ) );
if ( ( 'wppb-epf-cpt' == $post_type ) || ( 'wppb-rf-cpt' == $post_type ) || ( 'wppb-ul-cpt' == $post_type ) ){ if ( ( 'wppb-epf-cpt' == $post_type ) || ( 'wppb-rf-cpt' == $post_type ) || ( 'wppb-ul-cpt' == $post_type ) ){
wp_enqueue_style( 'wppb-back-end-style', WPPB_PLUGIN_URL . 'assets/css/style-back-end.css', false, PROFILE_BUILDER_VERSION ); wp_enqueue_style( 'wppb-back-end-style', WPPB_PLUGIN_URL . 'assets/css/style-back-end.css', false, PROFILE_BUILDER_VERSION );
wp_enqueue_script( 'wppb-epf-rf', WPPB_PLUGIN_URL . 'assets/js/jquery-epf-rf.js', array(), PROFILE_BUILDER_VERSION, true ); wp_enqueue_script( 'wppb-epf-rf', WPPB_PLUGIN_URL . 'assets/js/jquery-epf-rf.js', array(), PROFILE_BUILDER_VERSION, true );
@ -507,7 +507,7 @@ add_action('admin_print_styles-users_page_ProfileBuilderOptionsAndSettings', 'wp
function wppb_user_meta_exists( $id, $meta_name ){ function wppb_user_meta_exists( $id, $meta_name ){
global $wpdb; global $wpdb;
return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $id, $meta_name ) ); return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $id, $meta_name ) );
} }
@ -730,6 +730,7 @@ add_filter('wck_metabox_content_header_wppb_epf_page_settings', 'wppb_change_met
/* Add a notice if people are not able to register via Profile Builder; Membership -> "Anyone can register" checkbox is not checked under WordPress admin UI -> Settings -> General tab */ /* Add a notice if people are not able to register via Profile Builder; Membership -> "Anyone can register" checkbox is not checked under WordPress admin UI -> Settings -> General tab */
/*
if ( (get_option('users_can_register') == false) && (!class_exists('PMS_Add_General_Notices')) ) { if ( (get_option('users_can_register') == false) && (!class_exists('PMS_Add_General_Notices')) ) {
if( is_multisite() ) { if( is_multisite() ) {
new WPPB_Add_General_Notices('wppb_anyone_can_register', new WPPB_Add_General_Notices('wppb_anyone_can_register',
@ -741,7 +742,7 @@ if ( (get_option('users_can_register') == false) && (!class_exists('PMS_Add_Gene
'update-nag'); 'update-nag');
} }
} }
*/
/*Filter default WordPress notices ("Post published. Post updated."), add post type name for User Listing, Registration Forms and Edit Profile Forms*/ /*Filter default WordPress notices ("Post published. Post updated."), add post type name for User Listing, Registration Forms and Edit Profile Forms*/
function wppb_change_default_post_updated_messages($messages){ function wppb_change_default_post_updated_messages($messages){
global $post; global $post;
@ -1006,4 +1007,4 @@ function wppb_build_redirect( $redirect_url, $redirect_delay, $redirect_type = N
*/ */
function wppb_sanitize_value( $string ){ function wppb_sanitize_value( $string ){
return preg_replace( '/<script\b[^>]*>(.*?)<\/script>/is', '', $string ); return preg_replace( '/<script\b[^>]*>(.*?)<\/script>/is', '', $string );
} }

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ License: GPL
Version: 1.1 Version: 1.1
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation. published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
@ -27,8 +27,8 @@ register_activation_hook(__FILE__,'upf_install');
register_deactivation_hook(__FILE__, 'upf_uninstall'); register_deactivation_hook(__FILE__, 'upf_uninstall');
function upf_install(){ function upf_install(){
upf_uninstall();//force to uninstall option upf_uninstall();//force to uninstall option
add_option('upf_email_subject','New File Upload'); add_option('upf_email_subject','Przesłano nowy plik');//New File Upload
add_option('upf_email_message',"Hello %user_login%,\nYou have a new file upload. The file name is %filename%, you can download it here %download_url%"); add_option('upf_email_message',"Witaj %user_login%,\nPrzesłano dla Ciebie nowy plik o nazwie %filename%, możesz go pobrać na stronie %download_url%\nDo zobaczenia!");//Hello %user_login%,\nYou have a new file upload. The file name is %filename%, you can download it here %download_url%
} }
function upf_uninstall(){ function upf_uninstall(){
@ -55,15 +55,15 @@ function upf_options() {
if (!empty($_POST['update'])) { if (!empty($_POST['update'])) {
if($_POST['upf_email_subject'] ) { if($_POST['upf_email_subject'] ) {
update_option('upf_email_subject',$_POST['upf_email_subject'] ); update_option('upf_email_subject',$_POST['upf_email_subject'] );
} }
if($_POST['upf_email_message'] ) { if($_POST['upf_email_message'] ) {
update_option('upf_email_message',esc_attr($_POST['upf_email_message']) ); update_option('upf_email_message',esc_attr($_POST['upf_email_message']) );
} }
?> ?>
<div class="updated settings-error" id="setting-error-settings_updated"><p><strong><?php _e('Settings Saved', 'user-private-files');?>.</strong></p></div> <div class="updated settings-error" id="setting-error-settings_updated"><p><strong><?php _e('Ustawienia zapisane', 'user-private-files');?>.</strong></p></div><!--Settings Saved-->
<?php <?php
} }
@ -71,26 +71,26 @@ function upf_options() {
$upf_email_message = get_option('upf_email_message'); $upf_email_message = get_option('upf_email_message');
?> ?>
<div class="wrap"> <div class="wrap">
<h2><?php _e('User Private Files Settings', 'user-private-files');?></h2> <h2><?php _e('Ustawienia plików użytkownika', 'user-private-files');?></h2><!--User Private Files Settings-->
<form method="POST" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <form method="POST" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
<h3><?php _e('Notification', 'user-private-files');?></h3> <h3><?php _e('Notyfikacja', 'user-private-files');?></h3><!--Notification-->
<table class="form-table"> <table class="form-table">
<tbody> <tbody>
<tr valign="top"> <tr valign="top">
<th scope="row"><label for="upf_email_subject"><?php _e('Email Subject:', 'user-private-files');?></label></th> <th scope="row"><label for="upf_email_subject"><?php _e('Temat wiadomości email:', 'user-private-files');?></label></th><!--Email Subject:-->
<td><input type="text" class="regular-text" name="upf_email_subject" id="upf_email_subject" value="<?php echo $upf_email_subject; ?>"></td> <td><input type="text" class="regular-text" name="upf_email_subject" id="upf_email_subject" value="<?php echo $upf_email_subject; ?>"></td>
</tr> </tr>
<tr valign="top"> <tr valign="top">
<th scope="row"><label for="upf_email_subject"><?php _e('Email Message:', 'user-private-files');?></label></th> <th scope="row"><label for="upf_email_subject"><?php _e('Treść wiadomości email:', 'user-private-files');?></label></th><!--Email Message-->
<td> <td>
<textarea name="upf_email_message" class="regular-text" rows="5" cols="50"><?php echo $upf_email_message; ?></textarea> <textarea name="upf_email_message" class="regular-text" rows="5" cols="50"><?php echo $upf_email_message; ?></textarea>
<p class="description"><?php _e('Available Variables: ', 'user-private-files');?> <br/><strong>%blogname%, %siteurl%, %user_login%, %filename%, %download_url%, %category%</strong></p> <p class="description"><?php _e('Dostępne zmienne: ', 'user-private-files');?> <br/><strong>%blogname%, %siteurl%, %user_login%, %filename%, %download_url%, %category%</strong></p> <!--Available Variables-->
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<input type="hidden" name="update" value="update"> <input type="hidden" name="update" value="update">
<p class="submit"><input type="submit" value="<?php _e('Save Changes', 'user-private-files');?>" class="button-primary" id="submit" name="submit"></p> <p class="submit"><input type="submit" value="<?php _e('Zapisz zmiany', 'user-private-files');?>" class="button-primary" id="submit" name="submit"></p><!--Save Changes-->
</form> </form>
</div> </div>
<?php <?php
@ -100,22 +100,22 @@ add_action( 'init', 'upf_register_cpt_userfile' );
function upf_register_cpt_userfile() { function upf_register_cpt_userfile() {
$labels = array( $labels = array(
'name' => _x( 'User Files', 'userfile' ), 'name' => _x( 'Pliki użytkowników', 'userfile' ),//User Files
'singular_name' => _x( 'User File', 'userfile' ), 'singular_name' => _x( 'Plik użytkownika', 'userfile' ),//User File
'add_new' => _x( 'Add New', 'userfile' ), 'add_new' => _x( 'Dodaj nowy', 'userfile' ),//Add New
'add_new_item' => _x( 'Add New User File', 'userfile' ), 'add_new_item' => _x( 'Dodaj nowy plik użytkownika', 'userfile' ),//Add New User File
'edit_item' => _x( 'Edit User File', 'userfile' ), 'edit_item' => _x( 'Zedytuj plik użytkownika', 'userfile' ),//Edit User File
'new_item' => _x( 'New User File', 'userfile' ), 'new_item' => _x( 'Nowy plik użytkownika', 'userfile' ),//New User File
'view_item' => _x( 'View User File', 'userfile' ), 'view_item' => _x( 'Wyświetl plik użytkownika', 'userfile' ),//View User File
'search_items' => _x( 'Search User Files', 'userfile' ), 'search_items' => _x( 'Wyszukaj pliki użytkownika', 'userfile' ),//Search User Files
'not_found' => _x( 'No user files found', 'userfile' ), 'not_found' => _x( 'Nie znaleziono plików użytkownika', 'userfile' ),//No user files found
'not_found_in_trash' => _x( 'No user files found in Trash', 'userfile' ), 'not_found_in_trash' => _x( 'Nie znaleziono plików użytkownika w koszu', 'userfile' ),//No user files found in Trash
'parent_item_colon' => _x( 'Parent User File:', 'userfile' ), 'parent_item_colon' => _x( 'Plik użytkownika "Rodzica"', 'userfile' ),//Parent User File:
'menu_name' => _x( 'User Files', 'userfile' ), 'menu_name' => _x( 'Pliki użytkownika', 'userfile' ),//User Files
); );
$args = array( $args = array(
'labels' => $labels, 'labels' => $labels,
'hierarchical' => false, 'hierarchical' => false,
'supports' => array( 'title', 'author', 'editor' ), 'supports' => array( 'title', 'author', 'editor' ),
@ -148,25 +148,25 @@ add_action( 'init', 'upf_register_taxonomy_file_categories' );
function upf_register_taxonomy_file_categories() { function upf_register_taxonomy_file_categories() {
$labels = array( $labels = array(
'name' => _x( 'Categories', 'file_categories' ), 'name' => _x( 'Kategorie', 'file_categories' ),//Categories
'singular_name' => _x( 'Category', 'file_categories' ), 'singular_name' => _x( 'Kategoria', 'file_categories' ),//Category
'search_items' => _x( 'Search Categories', 'file_categories' ), 'search_items' => _x( 'Wyszukaj kategorie', 'file_categories' ),//Search Categories
'popular_items' => _x( 'Popular Categories', 'file_categories' ), 'popular_items' => _x( 'Popularne kategorie', 'file_categories' ),//Popular Categories
'all_items' => _x( 'All Categories', 'file_categories' ), 'all_items' => _x( 'Wszystkie kategorie', 'file_categories' ),//All Categories
'parent_item' => _x( 'Parent Category', 'file_categories' ), 'parent_item' => _x( 'Kategoria "Rodzica"', 'file_categories' ),//Parent Category
'parent_item_colon' => _x( 'Parent Category:', 'file_categories' ), 'parent_item_colon' => _x( 'Kategoria "Rodzica":', 'file_categories' ),//Parent Category
'edit_item' => _x( 'Edit Category', 'file_categories' ), 'edit_item' => _x( 'Edytuj kategorie', 'file_categories' ),//Edit Category
'update_item' => _x( 'Update Category', 'file_categories' ), 'update_item' => _x( 'Zaktualizuj kategorie', 'file_categories' ),//Update Category
'add_new_item' => _x( 'Add New Category', 'file_categories' ), 'add_new_item' => _x( 'Dodaj nową kategorię', 'file_categories' ),//Add New Category
'new_item_name' => _x( 'New Category', 'file_categories' ), 'new_item_name' => _x( 'Nowa kategoria', 'file_categories' ),//New Category
'separate_items_with_commas' => _x( 'Separate categories with commas', 'file_categories' ), 'separate_items_with_commas' => _x( 'Oddziel kategorie przecinkami', 'file_categories' ),//Separate categories with commas
'add_or_remove_items' => _x( 'Add or remove categories', 'file_categories' ), 'add_or_remove_items' => _x( 'Dodaj lub usuń kategorię', 'file_categories' ),//Add or remove categories
'choose_from_most_used' => _x( 'Choose from the most used categories', 'file_categories' ), 'choose_from_most_used' => _x( 'Wybierz z najczęściej wykorzystywanych kategorii', 'file_categories' ),//Choose from the most used categories
'menu_name' => _x( 'Categories', 'file_categories' ), 'menu_name' => _x( 'Kategorie', 'file_categories' ),//Categories
); );
$args = array( $args = array(
'labels' => $labels, 'labels' => $labels,
'public' => true, 'public' => true,
'show_in_nav_menus' => false, 'show_in_nav_menus' => false,
@ -192,7 +192,7 @@ add_filter( 'manage_edit-userfile_columns', 'upf_user_column_register' );
function upf_user_column_display( $column_name, $post_id ) { function upf_user_column_display( $column_name, $post_id ) {
if ( 'user' != $column_name ) if ( 'user' != $column_name )
return; return;
$username = get_post_meta($post_id, 'upf_user', true); $username = get_post_meta($post_id, 'upf_user', true);
echo $username; echo $username;
} }
@ -201,7 +201,7 @@ add_action( 'manage_userfile_posts_custom_column', 'upf_user_column_display', 10
// Register the column as sortable // Register the column as sortable
function upf_user_column_register_sortable( $columns ) { function upf_user_column_register_sortable( $columns ) {
$columns['user'] = 'user'; $columns['user'] = 'user';
return $columns; return $columns;
} }
add_filter( 'manage_edit-userfile_sortable_columns', 'upf_user_column_register_sortable' ); add_filter( 'manage_edit-userfile_sortable_columns', 'upf_user_column_register_sortable' );
@ -213,7 +213,7 @@ function upf_user_column_orderby( $vars ) {
'orderby' => 'meta_value' 'orderby' => 'meta_value'
) ); ) );
} }
return $vars; return $vars;
} }
add_filter( 'request', 'upf_user_column_orderby' ); add_filter( 'request', 'upf_user_column_orderby' );
@ -231,7 +231,7 @@ function upf_hide_sample_permalink($return, $id, $new_title, $new_slug){
return $return; return $return;
} }
function upf_get_user_dir($user_id) { function upf_get_user_dir($user_id) {
if (empty($user_id)) return false; if (empty($user_id)) return false;
$dir = get_user_meta($user_id, 'upf_dir', true); $dir = get_user_meta($user_id, 'upf_dir', true);
@ -249,7 +249,7 @@ function upf_post_edit_form_tag() {
// if invalid $post object or post type is not 'userfile', return // if invalid $post object or post type is not 'userfile', return
if(!$post || get_post_type($post->ID) != 'userfile') return; if(!$post || get_post_type($post->ID) != 'userfile') return;
echo ' enctype="multipart/form-data" autocomplete="off"'; echo ' enctype="multipart/form-data" autocomplete="off"';
} }
@ -258,9 +258,9 @@ function upf_meta_box() {
add_meta_box('userfile', __('User File', 'user-private-files'), 'upf_meta_fields', 'userfile', 'normal', 'high'); add_meta_box('userfile', __('User File', 'user-private-files'), 'upf_meta_fields', 'userfile', 'normal', 'high');
} }
function upf_meta_fields() {
function upf_meta_fields() {
global $post; global $post;
wp_nonce_field(plugin_basename(__FILE__), 'wp_upf_nonce'); wp_nonce_field(plugin_basename(__FILE__), 'wp_upf_nonce');
@ -270,9 +270,9 @@ function upf_meta_fields() {
<?php <?php
} }
?> ?>
<p class="label"><label for="upf_file"><?php _e('Upload a PDF file here', 'user-private-files');?></label></p> <p class="label"><label for="upf_file"><?php _e('Prześlij plik PDF tutaj', 'user-private-files');?></label></p><!--Upload a PDF file here-->
<p><input type="file" name="upf_file" id="upf_file" /></p> <p><input type="file" name="upf_file" id="upf_file" /></p>
<p class="label"><label for="upf_user"><?php _e('Select a user', 'user-private-files');?></label></p> <p class="label"><label for="upf_user"><?php _e('Wybierz użytkownika', 'user-private-files');?></label></p><!--Select a user-->
<select name="upf_user" id="upf_user"> <select name="upf_user" id="upf_user">
<?php <?php
$users = get_users(); $users = get_users();
@ -283,20 +283,20 @@ function upf_meta_fields() {
} }
?> ?>
</select> </select>
<p class="label"><input type="checkbox" name="upf_notify" value="1"> <label for="upf_notify"><?php _e('Notify User', 'user-private-files');?></label></p> <p class="label"><input type="checkbox" name="upf_notify" value="1"> <label for="upf_notify"><?php _e('Powiadom użytkownika', 'user-private-files');?></label></p><!--Notify User-->
<?php <?php
} }
add_action('save_post', 'upf_save_post'); add_action('save_post', 'upf_save_post');
function upf_save_post($post_id, $post = null) { function upf_save_post($post_id, $post = null) {
global $post; global $post;
/* --- security verification --- */ /* --- security verification --- */
if(!wp_verify_nonce($_POST['wp_upf_nonce'], plugin_basename(__FILE__))) if(!wp_verify_nonce($_POST['wp_upf_nonce'], plugin_basename(__FILE__)))
return $post_id; return $post_id;
if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
return $post_id; return $post_id;
// if invalid $post object or post type is not 'userfile', return // if invalid $post object or post type is not 'userfile', return
if(!$post || get_post_type($post->ID) != 'userfile') return; if(!$post || get_post_type($post->ID) != 'userfile') return;
@ -352,10 +352,10 @@ function upf_save_post($post_id, $post = null) {
$email_msg = str_replace('%download_url%', get_bloginfo('url').'/?upf=dl&id='.$post_id, $email_msg); $email_msg = str_replace('%download_url%', get_bloginfo('url').'/?upf=dl&id='.$post_id, $email_msg);
$cats = wp_get_post_terms($post_id, 'file_categories', array("fields" => "names")); $cats = wp_get_post_terms($post_id, 'file_categories', array("fields" => "names"));
$email_msg = str_replace('%category%', implode(", ", $cats), $email_msg); $email_msg = str_replace('%category%', implode(", ", $cats), $email_msg);
$headers[] ='From: "'.htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES).'" <'.get_option('admin_email').'>'; $headers[] ='From: "'.htmlspecialchars_decode(get_bloginfo('name'), ENT_QUOTES).'" <'.get_option('admin_email').'>';
wp_mail($user_info->user_email, $email_subject, $email_msg, $headers); wp_mail($user_info->user_email, $email_subject, $email_msg, $headers);
} }
} }
@ -378,17 +378,17 @@ function upf_custom_upload_dir( $default_dir ) {
$burl = $url; $burl = $url;
$subdir = '/'.upf_get_user_dir($_POST['upf_user']); $subdir = '/'.upf_get_user_dir($_POST['upf_user']);
$dir .= $subdir; $dir .= $subdir;
$url .= $subdir; $url .= $subdir;
$custom_dir = array( $custom_dir = array(
'path' => $dir, 'path' => $dir,
'url' => $url, 'url' => $url,
'subdir' => $subdir, 'subdir' => $subdir,
'basedir' => $bdir, 'basedir' => $bdir,
'baseurl' => $burl, 'baseurl' => $burl,
'error' => false, 'error' => false,
); );
return $custom_dir; return $custom_dir;
@ -403,7 +403,7 @@ function upf_get_download() {
global $current_user; global $current_user;
get_currentuserinfo(); get_currentuserinfo();
// if the file was not assigned to the current user, return // if the file was not assigned to the current user, return
if (get_post_meta($_GET['id'], 'upf_user', true) != $current_user->user_login) return; if (get_post_meta($_GET['id'], 'upf_user', true) != $current_user->user_login) return;
$upf_file = get_post_meta($_GET['id'], 'upf_file', true); $upf_file = get_post_meta($_GET['id'], 'upf_file', true);
@ -511,11 +511,11 @@ function output_file($file, $name, $mime_type='', $action = 'download') {
$bytes_send += strlen($buffer); $bytes_send += strlen($buffer);
} }
fclose($file); fclose($file);
} }
else die('Error - can not open file.'); else die('Error - can not open file.');
die(); die();
} }
function upf_list_user_files() { function upf_list_user_files() {
if (!is_user_logged_in()) return; if (!is_user_logged_in()) return;
@ -523,7 +523,7 @@ function upf_list_user_files() {
global $current_user; global $current_user;
get_currentuserinfo(); get_currentuserinfo();
$current_url = get_permalink(); $current_url = get_permalink();
if (strpos($current_url,'?') !== false) $current_url .= '&'; if (strpos($current_url,'?') !== false) $current_url .= '&';
else $current_url .= '?'; else $current_url .= '?';
@ -532,22 +532,22 @@ function upf_list_user_files() {
?> ?>
<div class="filter clearfix"> <div class="filter clearfix">
<form action="<?php the_permalink();?>" method="post" autocomplete="off"> <form action="<?php the_permalink();?>" method="post" autocomplete="off">
<select name="upf_year"> <select name="upf_year">
<option value=""><?php _e('Show all years', 'user-private-files');?></option> <option value=""><?php _e('Show all years', 'user-private-files');?></option>
<?php <?php
global $wpdb; global $wpdb;
$years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) $years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date)
FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
WHERE wposts.ID = wpostmeta.post_id WHERE wposts.ID = wpostmeta.post_id
AND wposts.post_type = 'userfile' AND wposts.post_type = 'userfile'
AND wpostmeta.meta_key = 'upf_user' AND wpostmeta.meta_key = 'upf_user'
AND wpostmeta.meta_value = '$current_user->user_login' AND wpostmeta.meta_value = '$current_user->user_login'
ORDER BY post_date DESC"); ORDER BY post_date DESC");
foreach($years as $year) { ?> foreach($years as $year) { ?>
<option <?php if (isset($_POST['upf_year']) && $_POST['upf_year']==$year) echo 'selected="selected"';?>><?php echo $year; ?></option> <option <?php if (isset($_POST['upf_year']) && $_POST['upf_year']==$year) echo 'selected="selected"';?>><?php echo $year; ?></option>
<?php <?php
} }
?> ?>
</select> </select>
@ -557,11 +557,11 @@ function upf_list_user_files() {
$cats = get_terms('file_categories'); $cats = get_terms('file_categories');
foreach($cats as $cat) { ?> foreach($cats as $cat) { ?>
<option value="<?php echo $cat->slug;?>" <?php if (isset($_POST['upf_cat']) && $_POST['upf_cat']==$cat->slug) echo 'selected="selected"';?>><?php echo $cat->name;?></option> <option value="<?php echo $cat->slug;?>" <?php if (isset($_POST['upf_cat']) && $_POST['upf_cat']==$cat->slug) echo 'selected="selected"';?>><?php echo $cat->name;?></option>
<?php <?php
} }
?> ?>
</select> </select>
<input type="submit" value="<?php _e('Filter', 'user-private-files');?>" /> <input type="submit" value="<?php _e('Filter', 'user-private-files');?>" />
</form> </form>
</div> </div>
@ -569,7 +569,7 @@ function upf_list_user_files() {
<?php <?php
$args = array( $args = array(
'post_type' => 'userfile', 'post_type' => 'userfile',
'meta_key' => 'upf_user', 'meta_key' => 'upf_user',
'meta_value' => $current_user->user_login, 'meta_value' => $current_user->user_login,
'orderby' => 'date', 'orderby' => 'date',
'order' => DESC 'order' => DESC
@ -577,7 +577,7 @@ function upf_list_user_files() {
if (!empty($_POST['upf_year'])) $args['year'] = $_POST['upf_year']; if (!empty($_POST['upf_year'])) $args['year'] = $_POST['upf_year'];
if (!empty($_POST['upf_cat'])) $args['file_categories'] = $_POST['upf_cat']; if (!empty($_POST['upf_cat'])) $args['file_categories'] = $_POST['upf_cat'];
$the_query = new WP_Query( $args ); $the_query = new WP_Query( $args );
@ -586,8 +586,8 @@ function upf_list_user_files() {
$current_year = ''; $current_year = '';
// The Loop // The Loop
if ($the_query->have_posts()) : if ($the_query->have_posts()) :
while ( $the_query->have_posts() ) : $the_query->the_post(); while ( $the_query->have_posts() ) : $the_query->the_post();
$year = get_the_date('Y'); $year = get_the_date('Y');
if ($year != $current_year) { if ($year != $current_year) {
echo '<h2>'.$year.'</h2>'; echo '<h2>'.$year.'</h2>';
@ -602,7 +602,7 @@ function upf_list_user_files() {
</div> </div>
</div> </div>
<?php <?php
endwhile; endwhile;
endif; endif;
// Reset Post Data // Reset Post Data
@ -620,7 +620,7 @@ add_action('wp_head', 'upf_userfile_cpt_noindex');
function upf_userfile_cpt_noindex() { function upf_userfile_cpt_noindex() {
if ( get_post_type() == 'userfile' ) { ?> if ( get_post_type() == 'userfile' ) { ?>
<meta name="robots" content="noindex,nofollow" /> <meta name="robots" content="noindex,nofollow" />
<?php <?php
} }
} }
@ -650,7 +650,7 @@ function upf_userfile_cpt_template_filter( $content ) {
global $current_user; global $current_user;
get_currentuserinfo(); get_currentuserinfo();
// if the file was not assigned to the current user, return // if the file was not assigned to the current user, return
if (get_post_meta($post_id, 'upf_user', true) == $current_user->user_login) { if (get_post_meta($post_id, 'upf_user', true) == $current_user->user_login) {
$output = $content; $output = $content;
$output .= '<p><a href="?upf=vw&id='.$post_id.'" class="view-print" target="_blank">' . __('View and Print', 'user-private-files') . '</a><br/> $output .= '<p><a href="?upf=vw&id='.$post_id.'" class="view-print" target="_blank">' . __('View and Print', 'user-private-files') . '</a><br/>