Skip to content

Commit

Permalink
Merge pull request #127 from Themekraft/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
gfirem authored Sep 18, 2017
2 parents 276662b + 034d6ae commit 8a8ae70
Show file tree
Hide file tree
Showing 101 changed files with 10,174 additions and 5,897 deletions.
17 changes: 0 additions & 17 deletions admin/admin-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,10 @@ public function wc4bp_screen_pages($active_tab) {
*/
public function wc4bp_register_admin_pages_settings() {
add_settings_section( 'section_general1', '', '', 'wc4bp_options_pages' );
add_settings_field( 'template', __( '<b>Change the page template to be used for the attached pages.</b>', 'wc4bp' ), array( $this, 'wc4bp_page_template' ), 'wc4bp_options_pages', 'section_general1' );

// Settings fields and sections
add_settings_section( 'section_general', '', array( $this, 'wc4bp_shop_pages_add' ), 'wc4bp_options_pages' );
}

/**
* View to select the page view template by default
*/
public function wc4bp_page_template() {
$wc4bp_options = get_option( 'wc4bp_options_pages' );

$page_template = '';
if ( ! empty( $wc4bp_options['page_template'] ) ) {
$page_template = $wc4bp_options['page_template'];
}
include_once( WC4BP_ABSPATH_ADMIN_VIEWS_PATH . 'main/html_admin_page_template.php' );

submit_button();
}

public function wc4bp_shop_pages_add() {
$this->wc4bp_get_forms_table();

Expand Down
36 changes: 24 additions & 12 deletions admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,15 @@ public function wc4bp_register_admin_settings() {
* Shop settings view
*/
public function wc4bp_shop_tabs() {

$wc4bp_options = get_option( 'wc4bp_options' );
$tab_activity_disabled = 0;
$wc4bp_options = get_option( 'wc4bp_options' );
$tab_activity_disabled = 0;
$disable_shop_settings_tab = 0;
if ( isset( $wc4bp_options['tab_activity_disabled'] ) ) {
$tab_activity_disabled = 1;
}
if ( isset( $wc4bp_options['disable_shop_settings_tab'] ) ) {
$disable_shop_settings_tab = 1;
}
if ( WC4BP_Loader::getFreemius()->is_plan__premium_only(wc4bp_base::$professional_plan_id)) {
//Get all actives tabs and custom pages
$wc4bp_pages_options = $this->get_pages_option();
Expand All @@ -131,6 +137,9 @@ public function wc4bp_shop_tabs() {
if (isset($wc4bp_options['tab_activity_disabled'])) {
$tab_activity_disabled = $wc4bp_options['tab_activity_disabled'];
}
if (isset($wc4bp_options['disable_shop_settings_tab'])) {
$disable_shop_settings_tab = $wc4bp_options['disable_shop_settings_tab'];
}

}
}
Expand Down Expand Up @@ -205,18 +214,16 @@ public function wc4bp_turn_off_profile_sync() {
*/
public function wc4bp_overwrite_default_shop_home_tab() {
$wc4bp_options = get_option( 'wc4bp_options' );
$custom_pages = get_option( 'wc4bp_pages_options' );
$custom_pages = get_option( 'wc4bp_pages_options' );
$wc4bp_pages_options = array();
$tab_activity_disabled = 0;
if ( ! empty( $custom_pages ) && is_string( $custom_pages ) ) {
$custom_pages_temp = json_decode( $custom_pages, true );
if ( isset( $custom_pages_temp['selected_pages'] ) && is_array( $custom_pages_temp['selected_pages'] ) ) {

foreach ( $custom_pages_temp['selected_pages'] as $key => $attached_page ) {
$wc4bp_pages_options["selected_pages"][$attached_page['tab_slug'] ] = array(
'tab_name' => $attached_page['tab_name']
);

}
}
}
Expand All @@ -230,9 +237,6 @@ public function wc4bp_overwrite_default_shop_home_tab() {
);
}
}

//If wc4bp['tab_shop_default'] is empty add a default value to avoid offset warning
$wc4bp_options['tab_shop_default']='default';
// Add the shop tab to the array
if (empty($wc4bp_options['tab_cart_disabled'])) {
$wc4bp_pages_options["selected_pages"][ "cart"] = array(
Expand All @@ -254,9 +258,17 @@ public function wc4bp_overwrite_default_shop_home_tab() {
'tab_name' => "Track my order"
);
}



//If wc4bp['tab_shop_default'] is empty add a default value to avoid offset warning
if ( ! isset( $wc4bp_options['tab_shop_default'] ) ) {
$wc4bp_options['tab_shop_default'] = 'default';
} else {
if ( ! array_key_exists( $wc4bp_options['tab_shop_default'], $wc4bp_pages_options["selected_pages"] ) ) {
$wc4bp_options['tab_shop_default'] = 'default';
update_option('wc4bp_options', $wc4bp_options);
}
}
} else {
$wc4bp_options['tab_shop_default'] = 'default';
}

include_once( WC4BP_ABSPATH_ADMIN_VIEWS_PATH . 'main/html_admin_shop_home.php' );
Expand Down
9 changes: 2 additions & 7 deletions admin/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,12 @@ jQuery(document).ready(function () {
});

jQuery('.wc_bp_sync_all_user_data').click(function () {

update_type = jQuery(this).attr('id');
visibility_level = jQuery('#' + update_type).val();

if (visibility_level == 'none') {
alert(visibility_level);
}
visibility_level = jQuery('#' + update_type + '_options').val();

wc4bp_total_user_pages = jQuery('#wc4bp_total_user_pages').val();
wc4bp_this_user_pages = 0;
wc4bp_update_user(update_type);
wc4bp_update_user();
});

});
Expand Down
4 changes: 0 additions & 4 deletions admin/views/main/html_admin_page_template.php

This file was deleted.

6 changes: 3 additions & 3 deletions admin/views/main/html_admin_shop_home.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<p><?php _e( 'Select the tab you want to use as your Shop Home.', 'wc4bp' ); ?></p>
<p <?php echo $this->disable_class_tag( 'p', wc4bp_base::$starter_plan_id ); ?>></p>
<select <?php echo $this->disable_input_tag( 'checkbox', wc4bp_base::$starter_plan_id ); ?> name='wc4bp_options[tab_shop_default]'>
<select <?php echo $this->disable_input_tag( 'checkbox', wc4bp_base::$starter_plan_id ); ?> name='wc4bp_options[tab_shop_default]'>
<?php
if ( isset( $wc4bp_pages_options['selected_pages'] ) && is_array( $wc4bp_pages_options['selected_pages'] ) && count( $wc4bp_pages_options['selected_pages'] ) > 0 ) {
echo '<option value="default" ' . selected( $wc4bp_options['tab_shop_default'], 'default', false ) . '>Default</option>';
$wc4bp_pages_options['selected_pages'] = array_merge( array( 'default' => array( 'tab_name' => __( 'Default', 'wc4bp' ) ) ), $wc4bp_pages_options['selected_pages'] );
foreach ( $wc4bp_pages_options['selected_pages'] as $key => $attached_page ) {
echo '<option value="' . $key . '" ' . selected( $wc4bp_options['tab_shop_default'], $key, false ) . '>' . $attached_page['tab_name'] . '</option>';
}
} else {
$wc4bp_options["tab_activity_disabled"]=1;
$wc4bp_options["tab_activity_disabled"] = 1;
echo '<option value="default">' . __( 'You need at least one Page added to Member Profiles!', 'wc4bp' ) . '</option>';
}
?>
Expand Down
9 changes: 7 additions & 2 deletions admin/views/main/html_admin_shop_tabs.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<p <?php /** @var wc4bp_admin $this */ echo $this->disable_class_tag( 'p', wc4bp_base::$starter_plan_id ); ?>>
<input <?php echo $this->disable_input_tag( 'checkbox', wc4bp_base::$starter_plan_id ); ?> name='wc4bp_options[tab_activity_disabled]' type='checkbox' value='1' <?php checked( $tab_activity_disabled, 1 ); ?> />
<b><?php _e( 'Turn off \'Shop\' ', 'wc4bp' ); ?></b>
<?php _e( 'Tab inside "Settings" for the activity stream settings.', 'wc4bp' ); ?>
<b><?php _e( 'Turn off Shop', 'wc4bp' ); ?></b>

</p>
<p <?php /** @var wc4bp_admin $this */ echo $this->disable_class_tag( 'p', wc4bp_base::$starter_plan_id ); ?>>
<input <?php echo $this->disable_input_tag( 'checkbox', wc4bp_base::$starter_plan_id ); ?> name='wc4bp_options[disable_shop_settings_tab]' type='checkbox' value='1' <?php checked( $disable_shop_settings_tab, 1 ); ?> />
<b><?php _e( 'Turn off \'Shop Tab\' ', 'wc4bp' ); ?></b>
<?php _e( 'inside "Settings" for the activity stream settings.', 'wc4bp' ); ?>
</p>
3 changes: 2 additions & 1 deletion admin/views/sync/html_admin_sync_change_xprofile.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?php /** @var wc4bp_admin_sync $this */ ?>
<b>
<p><?php _e( 'Set the Profile Field Visibility for all Users:', 'wc4bp' ); ?></p>
</b>
Expand All @@ -8,5 +9,5 @@
<?php _e( '"Allow Custom Visibility Change by User" is set to "Let members change this field\'s visibility"', 'wc4bp' ); ?>
</p>

<?php $this->select_visibility_levels( 'visibility_levels' ); ?>
<?php $this->select_visibility_levels( 'field_visibility_options' ); ?>
<input type="button" id="wc4bp_set_bp_field_visibility" name="wc4bp_options_sync[change_xprofile_visibility]" class="button wc_bp_sync_all_user_data" value="<?php _e( "Sync Now", "wc4bp" ); ?>">
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
echo '</ul>';
echo '<ul>';
foreach ( $shipping as $key => $field_id ) {
bp_xprofile_update_field_meta( $field_id, 'allow_custom_visibility', $wc4bp_options_sync['visibility_levels'] );
bp_xprofile_update_field_meta( $field_id, 'allow_custom_visibility', $wc4bp_options_sync['custom_visibility'] );
echo sprintf( __( '<li>shipping_%s default visibility changed to %s</li>', 'wc4bp' ), $key, $wc4bp_options_sync['custom_visibility'] );
}
echo '</ul>';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?php /** @var wc4bp_admin_sync $this */?>
<input id="continue_update_paged" type="hidden" value="<?php echo $paged ?>">
<p>
<?php _e( 'If the Update stops for some reason you can continue the update manually', 'wc4bp' ); ?>
Expand Down
6 changes: 2 additions & 4 deletions class/core/wc4bp-component.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function setup_nav( $main_nav = Array(), $sub_nav = Array() ) {
}

// Add shop settings subpage
if ( ! isset( $wc4bp_options['tab_activity_disabled'] ) ) {
if ( ! isset( $wc4bp_options['disable_shop_settings_tab'] ) ) {
if ( WC4BP_Loader::getFreemius()->is_plan__premium_only( wc4bp_base::$professional_plan_id ) ) {
$name = apply_filters( 'bp_shop_settings_link_label', __( 'Shop', 'wc4bp' ) );
} else {
Expand Down Expand Up @@ -305,7 +305,7 @@ function setup_admin_bar( $wp_admin_nav = Array() ) {
$user_domain = bp_loggedin_user_domain();
$settings_link = trailingslashit( $user_domain . BP_SETTINGS_SLUG );

if ( ! isset( $wc4bp_options['tab_activity_disabled'] ) ) {
if ( ! isset( $wc4bp_options['disable_shop_settings_tab'] ) ) {
if ( WC4BP_Loader::getFreemius()->is_plan__premium_only( wc4bp_base::$professional_plan_id ) ) {
$title = apply_filters( 'bp_shop_settings_nav_link_label', __( 'Shop', 'wc4bp' ) );
} else {
Expand Down Expand Up @@ -472,7 +472,6 @@ function wc4bp_members_load_template_filter( $found_template, $templates ) {
$page_name = wc4bp_Manager::get_prefix() . key($wc_active_endpoints);
$bp->current_action = $page_name;
}else{

if (empty($wc4bp_options['tab_checkout_disabled'])) {
$path = 'shop/member/checkout';
}
Expand All @@ -494,7 +493,6 @@ function wc4bp_members_load_template_filter( $found_template, $templates ) {
break;
}
}

}
}
} else {
Expand Down
Loading

0 comments on commit 8a8ae70

Please sign in to comment.