How to load WooCommerce cross sell and cart-collaterals inside one div - php

I'm trying to load the WooCommerce .cross-sells div inside a custom div named .cart-collaterals-cross-sell which already includes the .cart-collaterals elements, so that i can style them better in one row. At the moment the .cross-sells is loaded by the cross-sells.php and i tried to implement the code of it into the cart.php, so that i have both functions in one file and that i could put them inside the same div. Problem is that the cross sells doesn't load when i copy the code inside the cart.php
That's the original code of the cart.php which includes already the .cart-collaterals
<div class="cart-collaterals-cross-sell">
<div class="cart-collaterals">
<h2><?php _e( 'Cart totals', 'woocommerce' ); ?></h2>
<?php if ( ! is_ajax() && wc_coupons_enabled() ) { ?>
<div class="nm-coupon-wrap">
<div class="nm-coupon-inner">
<?php esc_html_e( 'Gutschein', 'nm-framework' ); ?>
<div class="nm-coupon">
<input type="text" id="nm-coupon-code" class="input-text" name="nm_coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" />
<input type="submit" id="nm-apply-coupon-btn" class="button border" name="nm_apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>" />
<?php do_action( 'woocommerce_cart_coupon' ); ?>
</div>
</div>
</div>
<?php } ?>
<?php
/**
* Cart collaterals hook.
*
* #hooked woocommerce_cross_sell_display
* #hooked woocommerce_cart_totals - 10
*/
do_action( 'woocommerce_cart_collaterals' );
?>
</div>
</div>
And that's the way i tried it. What am i doing wrong?
<div class="cart-collaterals-cross-sell">
<div class="cart-collaterals">
<h2><?php _e( 'Cart totals', 'woocommerce' ); ?></h2>
<?php if ( ! is_ajax() && wc_coupons_enabled() ) { ?>
<div class="nm-coupon-wrap">
<div class="nm-coupon-inner">
<?php esc_html_e( 'Gutschein', 'nm-framework' ); ?>
<div class="nm-coupon">
<input type="text" id="nm-coupon-code" class="input-text" name="nm_coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" />
<input type="submit" id="nm-apply-coupon-btn" class="button border" name="nm_apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>" />
<?php do_action( 'woocommerce_cart_coupon' ); ?>
</div>
</div>
</div>
<?php } ?>
<?php
/**
* Cart collaterals hook.
*
* #hooked woocommerce_cross_sell_display
* #hooked woocommerce_cart_totals - 10
*/
do_action( 'woocommerce_cart_collaterals' );
?>
</div>
<div class="cross-sells">
<h2><?php _e( 'You may be interested in…', 'woocommerce' ) ?></h2>
<?php woocommerce_product_loop_start(); ?>
<?php foreach ( $cross_sells as $cross_sell ) : ?>
<?php
$post_object = get_post( $cross_sell->get_id() );
setup_postdata( $GLOBALS['post'] =& $post_object );
wc_get_template_part( 'content', 'product' ); ?>
<?php endforeach; ?>
<?php woocommerce_product_loop_end(); ?>
</div>
</div>

You can use following two functions
For Cart collaterals ==> woocommerce_cart_totals();
For Cross Sells =======> woocommerce_cross_sell_display();
Try Using following code I am providing here:
<div class="cart-collaterals-cross-sell">
<div class="cart-collaterals">
<h2><?php _e( 'Cart totals', 'woocommerce' ); ?></h2>
<?php if ( ! is_ajax() && wc_coupons_enabled() ) { ?>
<div class="nm-coupon-wrap">
<div class="nm-coupon-inner">
<?php esc_html_e( 'Gutschein', 'nm-framework' ); ?>
<div class="nm-coupon">
<input type="text" id="nm-coupon-code" class="input-text" name="nm_coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" />
<input type="submit" id="nm-apply-coupon-btn" class="button border" name="nm_apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>" />
<?php do_action( 'woocommerce_cart_coupon' ); ?>
</div>
</div>
</div>
<?php } ?>
<?php
/**
* Cart collaterals hook.
*
* #hooked woocommerce_cross_sell_display
* #hooked woocommerce_cart_totals - 10
*/
//do_action( 'woocommerce_cart_collaterals' );
woocommerce_cart_totals();
?>
</div>
<div class="cross-sells">
<?php woocommerce_cross_sell_display(); ?>
</div>
</div>

Related

Change Woocommerce variable.php from table to div

I am currently customizing (or trying) the yourtheme/woocommerce/single-product/add-to-cart/variable.php in my theme however even though I've tried I can't seem to get rid of the table in the woocommerce code and replace it by divs and dropdown lists. I would like it to look like the sections below:
<!-- Product Section -->
<section>
<div class="container my-5 px-5 pt-4 bg-light">
<div class="row no-gutters">
<div class="col-md-5">
<img src="<?php bloginfo('template_directory'); ?>/assets/images/best-seller.jpg" class="img-fluid w-75 m-auto d-block"
alt="Best Seller">
</div>
<div class="col-md-7 pr-md-5">
<h1 class="main-heading my-4">BLACK MATTE JAR</h1>
<form>
<div class="form-row">
<div class="form-group col-md-7">
<label for="inputSize">Size</label>
<select id="inputSize" class="form-control">
<option selected>Big - 14 oz</option>
<option>Small - 10 oz</option>
</select>
</div>
<div class="form-group col-md-4 offset-md-1">
<label for="inputQuantity">Quantity</label>
<select id="inputQuantity" class="form-control">
<option selected>1 unit</option>
<option>2 unit</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-7">
<label for="inputFragrance">Fragrance</label>
<select id="inputFragrance" class="form-control">
<option selected><img src="<?php bloginfo('template_directory'); ?>/assets/images/icon-1.png" class="d-inline w-25">Peace
of mind</option>
<option>Refreshing</option>
</select>
</div>
<div class="form-group col-md-4 offset-md-1 mt-auto">
<div class="product-price pb-3">
<h5>Price <span class="float-right">25$</span></h5>
</div>
</div>
</div>
<button type="submit" class="btn btn-lg px-5 my-4">ADD TO CART</button>
</form>
</div>
</div>
</div>
</section>
So when I started all this, I managed to get all my product variations with the code below, however I couldn't figure out how to manage the woocommerce hooks and how to get the proper variation price when the user changed the dropdown list (so the code below was not using hooks at all)
`<div class="col-md-7 pr-md-5">
<h1 class="main-heading my-4"><?php the_title(); ?></h1>
<?php
/*** ADD TO CART DYNAMIC */
$attribute_keys = array_keys( $attributes );
$variations_json = wp_json_encode( $available_variations );
$variations_attr = function_exists( 'wc_esc_json' ) ? wc_esc_json( $variations_json ) : _wp_specialchars( $variations_json, ENT_QUOTES, 'UTF-8', true );
do_action( 'woocommerce_before_add_to_cart_form' ); ?>
<form class="variations_form cart" action="<?php echo esc_url( apply_filters( 'woocommerce_add_to_cart_form_action', $product->get_permalink() ) ); ?>" method="post" enctype='multipart/form-data' data-product_id="<?php echo absint( $product->get_id() ); ?>" data-product_variations="<?php echo $variations_attr; // WPCS: XSS ok. ?>">
<div class="form-row">
<div class="form-group col-md-7">
<label for="inputSize">Size</label>
<select id="inputSize" class="form-control">
<?php
$product = wc_get_product( get_the_id() );
$size = $product->get_attribute('size');
$size_array = print_r ($size , TRUE);
$size_text = explode ('|', $size_array);
$aux_size = 0;
foreach ($size_text as $s_txt){
if ($aux ==0) {
?><option selected><?php echo $s_txt ?></option>
<?php
} else {
?><option><?php echo $s_txt ?></option>
<?php
}
}
?>
</select>
</div>
<div class="form-group col-md-4 offset-md-1">
<label for="inputQuantity">Quantity</label>
<select id="inputQuantity" class="form-control">
<option selected>1 Unit</option>
<option>2 Units</option>
<option>3 Units</option>
<option>4 Units</option>
<option>5 Units</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-7">
<label for="inputFragrance">Fragrance</label>
<select id="inputFragrance" class="form-control">
<?php
$fragrance = $product->get_attribute('fragrance');
$fragrance_array = print_r ($fragrance , TRUE);
$fragrance_text = explode ('|', $fragrance_array);
$aux_size = 0;
foreach ($fragrance_text as $f_txt){
if ($aux ==0) {
?><option selected><?php echo $f_txt ?></option>
<?php
} else {
?><option><?php echo $f_txt ?></option>
<?php
}
}
?>
</select>
</div>
<div class="form-group col-md-4 offset-md-1 mt-auto">
<div class="product-price pb-3">
<h5>Price <span class="float-right">25$</span></h5>
</div>
</div>
</div>
<button onclick="Add_to_cart(<?php $product?>)" type="submit" class="btn btn-lg px-5 my-4">ADD TO CART</button>`
Then I discovered the variable.php, so below is what I can't make it:
1 - can't seem to give the same look and feel as before (refer to first code shown in this post.
2 - When I replace in the below code the and by div's the first div on the first iteration gives me $attribute_name = null.
<?php foreach ( $attributes as $attribute_name => $options ) : ?>
<tr>
<td class="label"><label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo wc_attribute_label( $attribute_name ); // WPCS: XSS ok. ?></label></td>
<td class="value">
3 - I can't seem to fetch the variation price upon user change the product attributes.
Did any of you managed to achieve this? If so could you share your code? I really hope this thread is cleaner and clearer. I've added till where I've got in the code below.
<div class="col-md-7 pr-md-5">
<h1 class="main-heading my-4"><?php the_title(); ?></h1>
<?php
/*** ADD TO CART DYNAMIC */
$available_variations = $product->get_available_variations();
$attributes = $product->get_variation_attributes();
$attribute_keys = array_keys( $attributes );
$variations_json = wp_json_encode( $available_variations );
$variations_attr = function_exists( 'wc_esc_json' ) ? wc_esc_json( $variations_json ) : _wp_specialchars( $variations_json, ENT_QUOTES, 'UTF-8', true );
do_action( 'woocommerce_before_add_to_cart_form' ); ?>
<form class="variations_form cart" action="<?php echo esc_url( apply_filters( 'woocommerce_add_to_cart_form_action', $product->get_permalink() ) ); ?>" method="post" enctype='multipart/form-data' data-product_id="<?php echo absint( $product->get_id() ); ?>" data-product_variations="<?php echo $variations_attr; // WPCS: XSS ok. ?>">
<?php do_action( 'woocommerce_before_variations_form' );
?>
<?php if ( empty( $available_variations ) && false !== $available_variations ) : ?>
<p class="stock out-of-stock"><?php echo esc_html( apply_filters( 'woocommerce_out_of_stock_message', __( 'This product is currently out of stock and unavailable.', 'woocommerce' ) ) ); ?></p>
<?php else : ?>
<table class="variations" cellspacing="0">
<tbody>
<?php foreach ( $attributes as $attribute_name => $options ) : ?>
<tr>
<td class="label"><label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo wc_attribute_label( $attribute_name ); // WPCS: XSS ok. ?></label></td>
<td class="value">
<?php
wc_dropdown_variation_attribute_options(
array(
'options' => $options,
'attribute' => $attribute_name,
'product' => $product,
)
);
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="single_variation_wrap">
<?php
/**
* Hook: woocommerce_before_single_variation.
*/
do_action( 'woocommerce_before_single_variation' );
/**
* Hook: woocommerce_single_variation. Used to output the cart button and placeholder for variation data.
*
* #since 2.4.0
* #hooked woocommerce_single_variation - 10 Empty div for variation data.
* #hooked woocommerce_single_variation_add_to_cart_button - 20 Qty and cart button.
*/
do_action( 'woocommerce_single_variation' );
/**
* Hook: woocommerce_after_single_variation.
*/
do_action( 'woocommerce_after_single_variation' );
?>
</div>
<?php endif; ?>
Ive been trying to change it for days without any success I return back to the original code most of the time this is the reason why I made my first post here as I cannot add the price into this code, nor turn it as per my html design.
Sorry for the simple question but I can't find anyone online that have achieved this before.
I've managed to do it with the following code:
<?php endforeach; ?>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="">Quantity</label>
<div class="single_variation_wrap">
<?php
/**
* Hook: woocommerce_before_single_variation.
*/
do_action( 'woocommerce_before_single_variation' );
/**
* Hook: woocommerce_single_variation. Used to output the cart button and placeholder for variation data.
*
* #since 2.4.0
* #hooked woocommerce_single_variation - 10 Empty div for variation data.
* #hooked woocommerce_single_variation_add_to_cart_button - 20 Qty and cart button.
*/
do_action( 'woocommerce_single_variation' );
/**
* Hook: woocommerce_after_single_variation.
*/
do_action( 'woocommerce_after_single_variation' );
?>
</div>
</div>
<div class="form-group col-md-6 mt-6">
<div class="product-price pb-3">
<h5 >Price <?php echo $product->get_price_html(); ?></h5>
</div>
</div>
</div>
<?php endif; ?>
<?php do_action( 'woocommerce_after_variations_form' ); ?>
</form>
I've converted the tds into div's in an easy manner that is still identifiable by woocommerce. Furthermore I've managed to fetch the price as shown in the code.
Now I am only having one issue which is to force the user to stay in my custom page if no selection is made.
Hope someone can suport me

Bypass "Billing" section when customer is paying with gift card - woocommerce

My wp theme was custom built and has a great ajax checkout experience, but I am having an issue when customers attempt to pay with a yith gift card that covers the total amount of the cart. Essentially throughout the checkout process there is a single button to proceed through the checkout steps; Shipping>billing>summary.
When a gift card is applied that covers the total amount, customers put in their shipping info, then click next to go to billing, at this point the credit card fields are hidden (as they should be), but the button (which now states "Proceed To Summary") is no longer clickable. The customer cant move from the empty billing page to complete their order. As such, is there a way to bypass the "billing" step if the order total is 0 and go straight to summary so the customer can complete their order?
Here is the code from my theme form-checkout.php :
<?php
/**
* Checkout Form
*
* This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-checkout.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* #see https://docs.woocommerce.com/document/template-structure/
* #package WooCommerce/Templates
* #version 3.5.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
do_action( 'woocommerce_before_checkout_form', $checkout );
// If checkout registration is disabled and not logged in, the user cannot checkout.
if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in() ) {
echo esc_html( apply_filters( 'woocommerce_checkout_must_be_logged_in_message', __( 'You must be logged in to checkout.', 'woocommerce' ) ) );
return;
}
?>
<div class="checkout-container d-lg-flex">
<!-- Checkout main -->
<div class="checkout-main">
<!-- Header -->
<div class="checkout-header"><?php _e('Secure checkout', 'woocommerce'); ?></div>
<?php if( !is_user_logged_in() ){ ?>
<div class="checkout-section section-checkout-logreg">
<?php
if( isset($_GET['action']) && $_GET['action'] == 'register' ) {
//wc_get_template( '/checkout/checkout_registration_page.php' );
wc_get_template( 'myaccount/form-registration.php' );
}
else if( isset($_GET['action']) && $_GET['action'] == 'forgot_pass' ) {
//wc_get_template( '/checkout/checkout_registration_page.php' );
wc_get_template( 'myaccount/form-lost-password.php' );
}
else{
//wc_get_template( '/checkout/checkout_login_page.php' );
wc_get_template( 'myaccount/form-login-single.php' );
}
?>
<!-- Button area -->
<div class="checkout-button-area d-flex flex-wrap justify-content-between">
<?php _e('Back To store', 'woocommerce'); ?>
</div>
</div>
<?php } ?>
<!-- Progress -->
<div class="checkout-progress"<?php if(!is_user_logged_in()){ echo ' style="display: none;"'; } ?>>
<div class="progress-step active" id="progress-shipping">
<?php _e('Shipping', 'woocommerce'); ?>
</div>
<div class="progress-step" id="progress-payment">
<?php _e('Payment', 'woocommerce'); ?>
</div>
<div class="progress-step" id="progress-summary">
<?php _e('Summary', 'woocommerce'); ?>
</div>
</div>
<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data"<?php if(!is_user_logged_in()){ echo ' style="display: none;"'; } ?>>
<?php if ( $checkout->get_checkout_fields() ) : ?>
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
<div id="customer_details">
<!-- Checkout Shipping -->
<div class="checkout-section section-shipping">
<?php do_action( 'woocommerce_checkout_shipping' ); ?>
</div>
<!-- Checkout Billing -->
<div class="checkout-section section-billing" style="display: none;">
<?php do_action( 'woocommerce_checkout_billing' ); ?>
</div>
<!-- Checkout Summary -->
<div class="checkout-section section-summary" style="display: none;">
<div class="row">
<div class="summary-section summary-shipping col-12 col-sm-6">
<div class="summary-section-wrap">
<h4 class="summary-title"><?php _e('Shipping Address', 'woocommerce'); ?></h4>
<button type="button" class="summary-edit" title="<?php _e('Edit', 'woocommerce'); ?>"><?php _e('Edit', 'woocommerce'); ?></button>
<div class="summary-section-content"></div>
</div>
</div>
<div class="summary-section summary-option col-12 col-sm-6">
<div class="summary-section-wrap">
<h4 class="summary-title"><?php _e('Shipping Option', 'woocommerce'); ?></h4>
<button type="button" class="summary-edit" title="<?php _e('Edit', 'woocommerce'); ?>"><?php _e('Edit', 'woocommerce'); ?></button>
<div class="summary-section-content"></div>
</div>
</div>
<div class="summary-section summary-payment col-12 col-sm-6" data-ending="<?php _e('Ending in', 'woocommerce'); ?>">
<div class="summary-section-wrap">
<h4 class="summary-title"><?php _e('Payment Details', 'woocommerce'); ?></h4>
<button type="button" class="summary-edit" title="<?php _e('Edit', 'woocommerce'); ?>"><?php _e('Edit', 'woocommerce'); ?></button>
<div class="summary-section-content"></div>
</div>
</div>
</div>

Editing User Profile Content in BuddyBoss and/or BuddyPress

I'm trying to remove 'Notifications', 'Groups', 'Messages', & 'Settngs' from user profiles.
How do I go about removing them?
Check out below:
<?php do_action( 'bp_before_profile_edit_content' );
if ( bp_has_profile( 'profile_group_id=' . bp_get_current_profile_group_id() ) ) :
while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
<form action="<?php bp_the_profile_group_edit_form_action(); ?>" method="post" id="profile-edit-form" class="standard-form <?php bp_the_profile_group_slug(); ?>">
<?php do_action( 'bp_before_profile_field_content' ); ?>
<h4><?php printf( __( "Editing '%s' Profile Group", "buddypress" ), bp_get_the_profile_group_name() ); ?></h4>
<ul class="button-nav">
<?php bp_profile_group_tabs(); ?>
</ul>
<div class="clear"></div>
<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
<div<?php bp_field_css_class( 'editfield' ); ?>>
<?php
$field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
$field_type->edit_field_html();
do_action( 'bp_custom_profile_edit_fields_pre_visibility' );
?>
<?php if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
<p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
<?php printf( __( 'This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress' ), bp_get_the_profile_field_visibility_level_label() ) ?> <?php _e( 'Change', 'buddypress' ); ?>
</p>
<div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id() ?>">
<fieldset>
<legend><?php _e( 'Who can see this field?', 'buddypress' ) ?></legend>
<?php bp_profile_visibility_radio_buttons() ?>
</fieldset>
<a class="field-visibility-settings-close" href="#"><?php _e( 'Close', 'buddypress' ) ?></a>
</div>
<?php else : ?>
<div class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
<?php printf( __( 'This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress' ), bp_get_the_profile_field_visibility_level_label() ) ?>
</div>
<?php endif ?>
<p class="description"><?php bp_the_profile_field_description(); ?></p>
</div>
<?php do_action( 'bp_custom_profile_edit_fields' ); ?>
<?php endwhile; ?>
<?php do_action( 'bp_after_profile_field_content' ); ?>
<div class="submit">
<input type="submit" name="profile-group-edit-submit" id="profile-group-edit-submit" value="<?php esc_attr_e( 'Save Changes', 'buddypress' ); ?> " />
</div>
<input type="hidden" name="field_ids" id="field_ids" value="<?php bp_the_profile_group_field_ids(); ?>" />
<?php wp_nonce_field( 'bp_xprofile_edit' ); ?>
</form>
<?php endwhile; endif; ?>
<?php do_action( 'bp_after_profile_edit_content' ); ?>
Try:
function evin_remove_nav() {
bp_core_remove_nav_item( 'messages' );
//etc
}
add_action( 'bp_ready', 'evin_remove_nav', 10 );

Divide a form in two columns

I'm trying to divide my checkout form in two columns (Twitter Bootstrap), but it doesn't really work out.
When I enter all the required information, it says that the fields aren't filled as required. I'm guessing it's got something to do with the form script being loaded two times.
Here's the code and where I'm trying to divide it:
<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( $get_checkout_url ); ?>" enctype="multipart/form-data">
<?php if ( sizeof( $checkout->checkout_fields ) > 0 ) : ?>
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
<div class="col2-set" id="customer_details">
<div class="col-1">
<?php do_action( 'woocommerce_checkout_billing' ); ?>
</div>
<div class="col-2">
<?php do_action( 'woocommerce_checkout_shipping' ); ?>
</div>
</div>
<?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
<h3 id="order_review_heading"><?php _e( 'Your order', 'woocommerce' ); ?></h3>
<?php endif; ?>
I want to divide it here:
<?php do_action( 'woocommerce_checkout_before_order_review' ); ?>
<div id="order_review" class="woocommerce-checkout-review-order">
<?php do_action( 'woocommerce_checkout_order_review' ); ?>
</div>
<?php do_action( 'woocommerce_checkout_after_order_review' ); ?>
</form>
What am I doing wrong?
To see the page that I'm trying to edit, go to link and add the product to the cart. Then go here link

BuddyPress registration form shortcode

I'm trying to get the registration form for BuddyPress.
I searching for a shortcode or just php code.
I've try to copy the field in template's of buddypress plugin. But it's dosen't work.
Here is the code I place in a custom post type.
<div id="buddypress">
<?php do_action( 'bp_before_register_page' ); ?>
<div class="page" id="register-page">
<form action="" name="signup_form" id="signup_form" class="standard-form" method="post" enctype="multipart/form-data">
<?php if ( 'registration-disabled' == bp_get_current_signup_step() ) : ?>
<?php do_action( 'template_notices' ); ?>
<?php do_action( 'bp_before_registration_disabled' ); ?>
<p><?php _e( 'User registration is currently not allowed.', 'buddypress' ); ?></p>
<?php do_action( 'bp_after_registration_disabled' ); ?>
<?php endif; // registration-disabled signup setp ?>
<?php if ( 'request-details' == bp_get_current_signup_step() ) : ?>
<?php do_action( 'template_notices' ); ?>
<p><?php _e( 'Registering for this site is easy. Just fill in the fields below, and we\'ll get a new account set up for you in no time.', 'buddypress' ); ?></p>
<?php do_action( 'bp_before_account_details_fields' ); ?>
<div class="register-section" id="basic-details-section">
<?php /***** Basic Account Details ******/ ?>
<h4><?php _e( 'Account Details', 'buddypress' ); ?></h4>
<label for="signup_username"><?php _e( 'Username', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
<?php do_action( 'bp_signup_username_errors' ); ?>
<input type="text" name="signup_username" id="signup_username" value="<?php bp_signup_username_value(); ?>" />
<label for="signup_email"><?php _e( 'Email Address', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
<?php do_action( 'bp_signup_email_errors' ); ?>
<input type="text" name="signup_email" id="signup_email" value="<?php bp_signup_email_value(); ?>" />
<label for="signup_password"><?php _e( 'Choose a Password', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
<?php do_action( 'bp_signup_password_errors' ); ?>
<input type="password" name="signup_password" id="signup_password" value="" class="password-entry" />
<div id="pass-strength-result"></div>
<label for="signup_password_confirm"><?php _e( 'Confirm Password', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
<?php do_action( 'bp_signup_password_confirm_errors' ); ?>
<input type="password" name="signup_password_confirm" id="signup_password_confirm" value="" class="password-entry-confirm" />
<?php do_action( 'bp_account_details_fields' ); ?>
</div><!-- #basic-details-section -->
<?php do_action( 'bp_after_account_details_fields' ); ?>
<?php /***** Extra Profile Details ******/ ?>
<?php if ( bp_is_active( 'xprofile' ) ) : ?>
<?php do_action( 'bp_before_signup_profile_fields' ); ?>
<div class="register-section" id="profile-details-section">
<h4><?php _e( 'Profile Details', 'buddypress' ); ?></h4>
<?php /* Use the profile field loop to render input fields for the 'base' profile field group */ ?>
<?php if ( bp_is_active( 'xprofile' ) ) : if ( bp_has_profile( array( 'profile_group_id' => 1, 'fetch_field_data' => false ) ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
<div<?php bp_field_css_class( 'editfield' ); ?>>
<?php
$field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
$field_type->edit_field_html();
do_action( 'bp_custom_profile_edit_fields_pre_visibility' );
if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
<p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
<?php printf( __( 'This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress' ), bp_get_the_profile_field_visibility_level_label() ) ?> <?php _ex( 'Change', 'Change profile field visibility level', 'buddypress' ); ?>
</p>
<div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id() ?>">
<fieldset>
<legend><?php _e( 'Who can see this field?', 'buddypress' ) ?></legend>
<?php bp_profile_visibility_radio_buttons() ?>
</fieldset>
<a class="field-visibility-settings-close" href="#"><?php _e( 'Close', 'buddypress' ) ?></a>
</div>
<?php else : ?>
<p class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
<?php printf( __( 'This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress' ), bp_get_the_profile_field_visibility_level_label() ) ?>
</p>
<?php endif ?>
<?php do_action( 'bp_custom_profile_edit_fields' ); ?>
<p class="description"><?php bp_the_profile_field_description(); ?></p>
</div>
<?php endwhile; ?>
<input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php bp_the_profile_field_ids(); ?>" />
<?php endwhile; endif; endif; ?>
<?php do_action( 'bp_signup_profile_fields' ); ?>
</div><!-- #profile-details-section -->
<?php do_action( 'bp_after_signup_profile_fields' ); ?>
<?php endif; ?>
<?php if ( bp_get_blog_signup_allowed() ) : ?>
<?php do_action( 'bp_before_blog_details_fields' ); ?>
<?php /***** Blog Creation Details ******/ ?>
<div class="register-section" id="blog-details-section">
<h4><?php _e( 'Blog Details', 'buddypress' ); ?></h4>
<p><input type="checkbox" name="signup_with_blog" id="signup_with_blog" value="1"<?php if ( (int) bp_get_signup_with_blog_value() ) : ?> checked="checked"<?php endif; ?> /> <?php _e( 'Yes, I\'d like to create a new site', 'buddypress' ); ?></p>
<div id="blog-details"<?php if ( (int) bp_get_signup_with_blog_value() ) : ?>class="show"<?php endif; ?>>
<label for="signup_blog_url"><?php _e( 'Blog URL', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
<?php do_action( 'bp_signup_blog_url_errors' ); ?>
<?php if ( is_subdomain_install() ) : ?>
http:// <input type="text" name="signup_blog_url" id="signup_blog_url" value="<?php bp_signup_blog_url_value(); ?>" /> .<?php bp_signup_subdomain_base(); ?>
<?php else : ?>
<?php echo home_url( '/' ); ?> <input type="text" name="signup_blog_url" id="signup_blog_url" value="<?php bp_signup_blog_url_value(); ?>" />
<?php endif; ?>
<label for="signup_blog_title"><?php _e( 'Site Title', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
<?php do_action( 'bp_signup_blog_title_errors' ); ?>
<input type="text" name="signup_blog_title" id="signup_blog_title" value="<?php bp_signup_blog_title_value(); ?>" />
<span class="label"><?php _e( 'I would like my site to appear in search engines, and in public listings around this network.', 'buddypress' ); ?></span>
<?php do_action( 'bp_signup_blog_privacy_errors' ); ?>
<label><input type="radio" name="signup_blog_privacy" id="signup_blog_privacy_public" value="public"<?php if ( 'public' == bp_get_signup_blog_privacy_value() || !bp_get_signup_blog_privacy_value() ) : ?> checked="checked"<?php endif; ?> /> <?php _e( 'Yes', 'buddypress' ); ?></label>
<label><input type="radio" name="signup_blog_privacy" id="signup_blog_privacy_private" value="private"<?php if ( 'private' == bp_get_signup_blog_privacy_value() ) : ?> checked="checked"<?php endif; ?> /> <?php _e( 'No', 'buddypress' ); ?></label>
<?php do_action( 'bp_blog_details_fields' ); ?>
</div>
</div><!-- #blog-details-section -->
<?php do_action( 'bp_after_blog_details_fields' ); ?>
<?php endif; ?>
<?php do_action( 'bp_before_registration_submit_buttons' ); ?>
<div class="submit">
<input type="submit" name="signup_submit" id="signup_submit" value="<?php esc_attr_e( 'Complete Sign Up', 'buddypress' ); ?>" />
</div>
<?php do_action( 'bp_after_registration_submit_buttons' ); ?>
<?php wp_nonce_field( 'bp_new_signup' ); ?>
<?php endif; // request-details signup step ?>
<?php if ( 'completed-confirmation' == bp_get_current_signup_step() ) : ?>
<?php do_action( 'template_notices' ); ?>
<?php do_action( 'bp_before_registration_confirmed' ); ?>
<?php if ( bp_registration_needs_activation() ) : ?>
<p><?php _e( 'You have successfully created your account! To begin using this site you will need to activate your account via the email we have just sent to your address.', 'buddypress' ); ?></p>
<?php else : ?>
<p><?php _e( 'You have successfully created your account! Please log in using the username and password you have just created.', 'buddypress' ); ?></p>
<?php endif; ?>
<?php do_action( 'bp_after_registration_confirmed' ); ?>
<?php endif; // completed-confirmation signup step ?>
<?php do_action( 'bp_custom_signup_steps' ); ?>
</form>
</div>
<?php do_action( 'bp_after_register_page' ); ?>
</div><!-- #buddypress -->
Are you not happy with the default form that shows up? When buddypress is installed it creates a few pages on your site. If you navigate to Settings->BuddyPress ->pages, you will see that the register page is pointing to... well Register :) There should be a "Register" page present in your All Pages. This is installed by buddypress
By Default, buddypress installs a Register page at : www.yoursite.com/Register
Open it while you are not log in and you can see the Registration Form.
Go to buddypress plugin template folder:
wp-content\plugins\buddypress\bp-templates\bp-legacy\buddypress
Copy the buddypress folder and paste it into your theme's root.
Now go to:
wp-content\YOURTHEME\buddypress\bp-templates\bp-legacy\buddypress\members folder and you will find a register.php file. You can work with it.

Categories