eau18
Messages postés97Date d'inscriptionlundi 31 décembre 2007StatutMembreDernière intervention11 novembre 2024
-
2 mars 2021 à 14:01
eau18
Messages postés97Date d'inscriptionlundi 31 décembre 2007StatutMembreDernière intervention11 novembre 2024
-
17 mars 2021 à 22:43
Bonjour,
J'ai mis à jour mon wordpress, et j'ai un gros soucis on m'affiche 3 erreurs : je n'y connais rien, mais quelqu'un pourrait il m'aider svp ?
- pour la première erreur, on me dit
S_Query::get_endpoint_title($endpoint) should be compatible with WC_Query::get_endpoint_title($endpoint, $action = '')
et voici le code, sachant que la ligne censée avoir un problème est la dernière, la parenthèse
if ( in_the_loop() && is_account_page() ) {
foreach ( $this->query_vars as $key => $query_var ) {
if ( $this->is_query( $query_var ) ) {
$title = $this->get_endpoint_title( $key );
// unhook after we've returned our title to prevent it from overriding others
remove_filter( 'the_title', array( $this, __FUNCTION__ ), 11 );
}
}
}
return $title;
}
/**
Set the subscription page title when viewing a subscription.
*
@since 2.0
@param $title
/
public function get_endpoint_title( $endpoint ) {
global $wp;
// If the Subscriptions endpoint setting is empty, don't display it in line with core WC behaviour.
if ( empty( $this->query_vars['subscriptions'] ) ) {
return $menu_items;
}
// Add our menu item after the Orders tab if it exists, otherwise just add it to the end
if ( array_key_exists( 'orders', $menu_items ) ) {
$menu_items = wcs_array_insert_after( 'orders', $menu_items, 'subscriptions', $label );
} else {
$menu_items['subscriptions'] = $label;
}
return $menu_items;
}
/**
Changes the URL for the subscriptions endpoint when there's only one user subscription.
*
@since 2.2.17
@param string $url
@param string $endpoint
@return string
/
public function maybe_redirect_to_only_subscription( $url, $endpoint ) {
if ( $this->query_vars['subscriptions'] === $endpoint && is_account_page() ) {
$subscriptions = wcs_get_users_subscriptions();
if ( ! $subscription->can_be_updated_to( 'new-payment-method' ) ) {
$url = $subscription->get_view_order_url();
wc_add_notice( __( 'The payment method can not be changed for that subscription.', 'woocommerce-subscriptions' ), 'error' );
Reset the woocommerce_myaccount_view_subscriptions_endpoint option name to woocommerce_myaccount_view_subscription_endpoint
*
@return mixed Value set for the option
@since 2.2.18
/
private function get_view_subscription_endpoint(){
$value = get_option( 'woocommerce_myaccount_view_subscriptions_endpoint', null );
if ( isset( $value ) ) {
wcs_doing_it_wrong( 'woocommerce_myaccount_view_subscriptions_endpoint', sprintf( '%1$s option is deprecated. Use %2$s option instead.', 'woocommerce_myaccount_view_subscriptions_endpoint', 'woocommerce_myaccount_view_subscription_endpoint' ), '2.2.17' );
// Update the current option name with the value that was set in the deprecated option name
update_option( 'woocommerce_myaccount_view_subscription_endpoint', $value );
// Now that things are upto date, do away with the deprecated option name
delete_option( 'woocommerce_myaccount_view_subscriptions_endpoint' );
}