We want to avoid having to manually enter the data to each post when we use this block, and be able to input it once for each of the options, and then be able to simply pick which ones appear on the page.
Is that possible?
Thank you!
]]>I did read your help, but still a bit lost. There will be a lot of fields on my page (about 200). Will this be practical and will I be able to do using CFF?
Could you explain the below in more details if it’s a solution? Sorry.
[CP_CALCULATED_FIELDS_VAR name=”variable_name” from=”cookie”]
In the previous shortcode the variable_name text should be replaced by the name of the session variable. For example: myVar
[CP_CALCULATED_FIELDS_VAR name=”myVar” from=”cookie”]
At this point has been created a javascript variable, with the same name of the cookie variable, myVar, with a global scope.
Now, you simply should use the new variable directly in the equation, for example: fieldname1*myVar, or any other equation.
https://www.ads-software.com/plugins/calculated-fields-form/
]]>I would like to have a sort of database on my site that I as the administrator can save and view for later. I’d like to know what plugins do the following (and for what price) so that I can try it out on my site to see what works:
I know gravity forms can do most of this, but the biggest problem I have is that they only keep the data for 30 days. If there’s an easy coding workaround great, but I haven’t found any through googling. Also I don’t know if they allow non-users to view saved data and users to edit the data.
Here’s an example of what I’d like:
Sample form 1 (found on various pages of the site):
Accomplishment 1
(Checkbox), (Date field)
Accomplishment 2
(Checkbox), (Date field)
Previous accomplishments all completed!
(Checkbox), (Date field). Once checked, this allows the user to edit:
Accomplishment 3
(Checkbox), (Date field)
Where the site admins can edit this data but users can view what the edits are. This needs to a template because I will have multiple pages that this form is on.
Any help is appreciated, and thank you in advance!
]]>I found your TablePress plugin interesting and promissing. And I am wondering if it could do what we need.
We are making a WP site for an international school. We would need data of different courses (like it’s name, date, location, teacher, list of participants) to be entered, saved, retrieved, filtered, sorted and showed on the WP site.
Entering, deleting and modifying data should be done by some users only, who has the priviledge level to change things about the courses.
How can this task be handled by TablePress?
Thanks,
Tamas
https://www.ads-software.com/plugins/tablepress/
]]>And after reading this article i add this code to my mytheme/functions.php ;
/*
>>> ADD CUSTOM FIELDS TO SINGLE PRODUCT <<<
============================================== */
/* Add the field to the checkout */
add_action( ‘woocommerce_single_product_summary’, ‘my_custom_checkout_field’ );
function my_custom_checkout_field() {
global $post;
$terms = wp_get_post_terms( $post->ID, ‘product_cat’ );
foreach ( $terms as $term ) $categories[] = $term->slug;
// start if > it will add field only to product category called “c”
if ( in_array( ‘c’, $categories ) )
{
// Set Width
echo ‘<div id=”setWidth”><h2>’ . __(‘Width’) . ‘</h2>’ . ‘</br>’;
woocommerce_form_field( ‘setWidth’, array(
‘type’ => ‘text’,
‘class’ => array(‘my-field-class form-row-wide’),
‘label’ => __(‘Your Width (cm.mm)’) . ‘</br>’,
‘placeholder’ => __(‘40.25’)
) );
echo ‘</div>’;
}// end if
} // end function
/*
>>> ADD CUSTOM DATA TO SESSION <<<
======================================== */
// Adding AJAX validation
add_action(‘woocommerce_single_product_summary’,’wdm_enque_scripts’);
function wdm_enque_scripts()
{
wp_register_script( ‘wdm_singleProductJs’, plugins_url(‘/wp-content/themes/mkplisy/js/wdm_single_product_page.js’, __FILE__), array(‘jquery’), false, true );
wp_enqueue_script(‘wdm_singleProductJs’);
$array_to_be_sent = array( ‘ajax_file_path’ => admin_url(‘admin-ajax.php’));
wp_localize_script( ‘wdm_singleProductJs’, ‘wdm_object’, $array_to_be_sent);
}
// Step 1: Add Data in a Custom Session, on ‘Add to Cart’ Button Click
add_action(‘wp_ajax_wdm_add_user_custom_data_options’, ‘wdm_add_user_custom_data_options_callback’);
add_action(‘wp_ajax_nopriv_wdm_add_user_custom_data_options’, ‘wdm_add_user_custom_data_options_callback’);
function wdm_add_user_custom_data_options_callback()
{
//Custom data – Sent Via AJAX post method
$product_id = $_POST[‘id’]; //This is product ID
$user_custom_data_values = $_POST[‘user_data’]; //This is User custom value sent via AJAX
session_start();
$_SESSION[‘wdm_user_custom_data’] = $user_custom_data_values;
die();
}
// Step 2: Add Custom Data in WooCommerce Session
add_filter(‘woocommerce_add_cart_item_data’,’wdm_add_item_data’,1,2);
if(!function_exists(‘wdm_add_item_data’))
{
function wdm_add_item_data($cart_item_data,$product_id)
{
/*Here, We are adding item in WooCommerce session with, wdm_user_custom_data_value name*/
global $woocommerce;
session_start();
if (isset($_SESSION[‘wdm_user_custom_data’])) {
$option = $_SESSION[‘wdm_user_custom_data’];
$new_value = array(‘wdm_user_custom_data_value’ => $option);
}
if(empty($option))
return $cart_item_data;
else
{
if(empty($cart_item_data))
return $new_value;
else
return array_merge($cart_item_data,$new_value);
}
unset($_SESSION[‘wdm_user_custom_data’]);
//Unset our custom session variable, as it is no longer needed.
}
}
// Step 3: Extract Custom Data from WooCommerce Session and Insert it into Cart Object
add_filter(‘woocommerce_get_cart_item_from_session’, ‘wdm_get_cart_items_from_session’, 1, 3 );
if(!function_exists(‘wdm_get_cart_items_from_session’))
{
function wdm_get_cart_items_from_session($item,$values,$key)
{
if (array_key_exists( ‘wdm_user_custom_data_value’, $values ) )
{
$item[‘wdm_user_custom_data_value’] = $values[‘wdm_user_custom_data_value’];
}
return $item;
}
}
// Step 4: Display User Custom Data on Cart and Checkout page
add_filter(‘woocommerce_checkout_cart_item_quantity’,’wdm_add_user_custom_option_from_session_into_cart’,1,3);
add_filter(‘woocommerce_cart_item_price’,’wdm_add_user_custom_option_from_session_into_cart’,1,3);
if(!function_exists(‘wdm_add_user_custom_option_from_session_into_cart’))
{
function wdm_add_user_custom_option_from_session_into_cart($product_name, $values, $cart_item_key )
{
/*code to add custom data on Cart & checkout Page*/
if(count($values[‘wdm_user_custom_data_value’]) > 0)
{
$return_string = $product_name . “<dl class=’variation’>”;
$return_string .= “<table class=’wdm_options_table’ id='” . $values[‘product_id’] . “‘>”;
$return_string .= “<tr><td>” . $values[‘wdm_user_custom_data_value’] . “</td></tr>”;
$return_string .= “</table></dl>”;
return $return_string;
}
else
{
return $product_name;
}
}
}
// Step 5: Add Custom Data as Metadata to the Order Items
add_action(‘woocommerce_add_order_item_meta’,’wdm_add_values_to_order_item_meta’,1,2);
if(!function_exists(‘wdm_add_values_to_order_item_meta’))
{
function wdm_add_values_to_order_item_meta($item_id, $values)
{
global $woocommerce,$wpdb;
$user_custom_values = $values[‘wdm_user_custom_data_value’];
if(!empty($user_custom_values))
{
wc_add_order_item_meta($item_id,’wdm_user_custom_data’,$user_custom_values);
}
}
}
// Step 6: Remove User Custom Data, if Product is Removed from Cart
add_action(‘woocommerce_before_cart_item_quantity_zero’,’wdm_remove_user_custom_data_options_from_cart’,1,1);
if(!function_exists(‘wdm_remove_user_custom_data_options_from_cart’))
{
function wdm_remove_user_custom_data_options_from_cart($cart_item_key)
{
global $woocommerce;
// Get cart
$cart = $woocommerce->cart->get_cart();
// For each item in cart, if item is upsell of deleted product, delete it
foreach( $cart as $key => $values)
{
if ( $values[‘wdm_user_custom_data_value’] == $cart_item_key )
unset( $woocommerce->cart->cart_contents[ $key ] );
}
}
}
And this code should save typed values from input in my order pages,but it doesn’t work, i don’t have any errors, but there is no any values from input saved after “adding product” to cart
Maybe someone have similar problem,or can fix my code??
https://www.ads-software.com/plugins/woocommerce/
]]>Hope you’re having a fabulous day or week so far.
A plugin designer wants me to “make a full backup of your site.” Okay, I should know this but I don’t so how do I do I make a full backup on my website?
Thank you for your service,
Christine
https://www.ads-software.com/extend/plugins/participants-database/
]]>Designed a form with heading of subscribe to our Email newsletter.
It works fine – posted the short code to Text widget on the sidebar.
My problem
I do not want emails daily from new subscribers
I want all the names to be saved in the site…..so I can get to them later
Contact 7 has an export to a database function —I need this to have a database function?? Any ideas??
https://www.ads-software.com/extend/plugins/si-contact-form/
]]>I’m planning to write a plugin that uses iframe in the admin panel. The iframe tag includes a php file in the plugin folder which displays an external web site information with some form fields.
So the user submits the form included in the iframe panel then I’d like to save the data somewhere. I thought I simply save it as text but I guess some users cannot change the permission if the directory is not writable.
Then I wondered if it is possible for the iframed php page to access the WordPress database and save the submitted info in there as options which could be retrieved with get_option() from the main plugin execution.
If it’s possible, could somebody give an example?
Thanks in advance.
]]>I modified the code and placed it in my functions.php instead of a separate plugin. I also repeated the code (with customizations) for 2 post types – ‘product’ and ‘post’. The code works for the ‘product’ post type, but the data is not being saved on ‘post’ types.
Can someone look it over and help me figure out the problem? The code is below:
[Code moderated as per the Forum Rules. Please use the pastebin]
]]>