Ovidiu Zeicu
Forum Replies Created
-
No luck, I’ve tried different variations based on your suggestion, haven’t been able to make it work. It works with WP’s data (like {display_name}), but I couldn’t make it work with UM placeholders. This process, which should be pretty simple, is way too confusing, anyway (search placeholders one by one, then replace them one by one… then when adding it in the page it’s placeholder inside a shortcode inside a PHP echo…).
I would’ve liked a PHP solution, but I’ve ended up using JS to replace those placeholders and I even managed to automate the process and not change it one by one. It will replace any
{usermeta:placeholder}
placeholder in the target element with the text value of the corresponding.um-field[data-key="placeholder"] .um-field-value')
. It works great.Thank you for the help, anyway.
PS: For anyone looking for similar functionality, this is the code I’ve used, it may help someone, or at least it’ll be a good starting point for different goals:
document.addEventListener('DOMContentLoaded', function() { function replacePlaceholders() { var agreementElements = document.querySelectorAll('.agreement'); agreementElements.forEach(function(agreementElement) { var html = agreementElement.innerHTML; var matches = html.match(/{usermeta:[^}]+}/g); if (matches) { matches.forEach(function(placeholder) { var key = placeholder.replace('{usermeta:', '').replace('}', ''); var valueElement = document.querySelector('.um-field[data-key="' + key + '"] .um-field-value'); var value = '-----'; // Default value if not found if (valueElement) { value = valueElement.textContent.trim() || '-----'; } html = html.replace(new RegExp(placeholder, 'g'), value); }); agreementElement.innerHTML = html; } }); } replacePlaceholders(); });
Thank you.
Same thing happened in the topic linked above, developers were informed, but 2 years later the problem still exist. Do you think this time will be different?
Hello @missveronicatv and thank you.
Yes, that’s one of the codes I’ve used and tried to modify, but it displays the value only on the form, I’m not able to further work with that fallback value. For example, it won’t be visible as tagline field in members directory or in emails. So… what I basically need is that the default values to be written to the database and reusable, the fields that doesn’t have a manually added value, but have a default value set, will actually use that default value as a real value. Because, as I said before, at this point, this default/fallback value works just as another placeholder.
Thank you.
Hello Aswin.
If that’s the case, this default value behaves just as a placeholder. So now we have 2 placeholders. I don’t understand the logic behind this decision, but hey… each with their own ??
Anyway… I do need that those values to be also displayed on view mode. Or, at least, I need the default value of one particular custom field to be displayed in view mode. Is there a way of doing it? A function or something? I’ve found some functions that does something similar, but my PHP is not strong enough to modify those functions to work for me.
Thank you.
Hello again.
This thread has been inactive because we’ve been waiting for your input with a solution to fix the issue, either here, either on Github. Just marking it as solved doesn’t fix the issue.
Latest plugin update didn’t solved the issue either.
Thank you.
Thank you missveronica… hopefuly it will be solved soon.
————————————–
It seems my ping-mention upset some people.
I’m sorry about that, was not my intention, but I’m not sure how else to do it…I needed some support on some custom code the person I pinged offered in another thread. But if I ask for help there, I’m deleted and instructed to open my own thread. If I open this new thread and ask here for help, I’m told that it’s rude and then I get the account flagged for moderation. I don’t know for another way to contact this person, which provided custom code, without ping-mentioning…
If there is another way, please share it.
Thank you.
Thank you!
@missveronicatv You Are AWESOME! Works like a charm.
Thank you very much.
I still have one last (I hope) issue, but that’s unrelated to emails, so it’s for another topic.
OK… actually everything works just fine. The problem was with me and my way of thinking the process through.
So… when a member edits his own profile, both member and admin gets the emails (using your snippet). However, when an admin edits member’s profile, no emails are sent. This was what misled me… I was under the impression that the emails are sent when member’s profile is changed, no matter who does the changes. My mistake… I’m sorry.
But now we have another problem. In our case, the admins are the ones that edits members profiles most of the times, but we still need the emails to be sent to the admin, for data centralization (if the member gets the email or not doesn’t matter). Is there a way so the Account Updated Email to be sent to the admin no matter who modifies member’s profile?
Thank you.
I’m using WP SMTP plugin (https://www.ads-software.com/plugins/wp-smtp/), it’s simpler and seems lighter than the popular ones, and it done the job so far.
Thank you, @champsupertramp, this also helped me solve my problem. But I still have one more issue, which is related to this one, I don’t think it needs it’s own thread, so I’ll ask here:
I’m using some conditional fields that will show when a value is selected from a dropdown. Users needs to pick one company from a dropdown list of 3 companies and underneath that selector will appear some data about that company. That I’ve managed to do that using placeholder and I’ve thought to use default data to send that info to the email template. However, the default data will not be sent via email using {usermeta:company1_data} placeholder in the email template.
Is there a way so the default data is also picked up and used in the email template?
Thank you.
@missveronicatv that did the trick.
Thank you very much.
Thank you for your reply @aswingiri.
That’s the way I’ve set it a couple of days ago, but it’s not good enough. I’m not the only one adding the users and the others are not very technical and they’re struggling. I’ve also created custom role for them with just enough permissions to access dashboard to approve their users, but they’re still complaining. They usually add their users on the fly from the phone and it’s hard for them to navigate.
The ideal setup would be to just add user data in registration form, submit the form and be done with it.
So I’m still looking for a way to achieve that.
Forum: Plugins
In reply to: [JVM WooCommerce Wishlist] Header Wishlist items counterHi there, Joris.
Just a heads up, it seems that the stock check doesn’t work on the Wishlist page, every product is displayed as in stock, even though some of them are out of stock (as seen by the missing price and on the product’s page).
And as an update, I haven’t been able to make the Wishlist counter to update, not by AJAX, nor by fragments. But because at page refresh the counter is correct, I ended up writing a JS function to get the initial count and update it when items are added to or removed from Wishlist. It doesn’t store anything and it doesn’t need to, the counter will be updated by your function at any page load. Not perfect, but it works great. And it’s way faster than Woo’s add to cart AJAX.
Best regards,
OvidiuForum: Plugins
In reply to: [JVM WooCommerce Wishlist] Header Wishlist items counterOk, got some partial progress with the fragments, but counter it’s only updating when cart is updating. So if I add to wishlist nothing happens, but if I add to cart a product, both counters updates.
Here’s my function:
function evo_wishlist_count_fragments( $fragments ) { ob_start(); $fragments['a.wishlist-count'] = '<a class="wishlist-count" href="/wishlist/"><span>' . jvm_woocommerce_wishlist_get_count() . '</span></a>'; return $fragments; } add_filter( 'woocommerce_add_to_cart_fragments', 'evo_wishlist_count_fragments', 10, 1 );