shagdirty
Forum Replies Created
-
Just remembered that submissions are a custom post type so used:
update_post_meta( 1338, '_field_105', 'HELLO META!' );
and that works great. I’d still like to know how to do it via API fanciness though. Perhaps creating a field and adding the data vs updating an existing field would be nice.
@amaryder this might help. Gets you the ID of the submission…
https://www.ads-software.com/support/topic/passing-submission-id-to-redirect-page/
Submissions are a custom post type as well so you can maybe run some queries that way depending on what you’re trying to do.
Still haven’t figured this out but accomplished what I needed which was to get the submission ID for the current form. See this post regarding that: https://www.ads-software.com/support/topic/passing-submission-id-to-redirect-page/
I CAN get the correct form data on submit using the code below but I still get the wrong form ID when I run log on ‘form’ for some reason.
(in my theme’s custom js file…)
var mySubmitController = Marionette.Object.extend( { initialize: function() { this.listenTo( Backbone.Radio.channel( 'forms' ), 'submit:response', this.actionSubmit ); }, actionSubmit: function( response ) { console.log(response); }, }); jQuery( document ).ready( function( $ ) { // Instantiate our custom field's controller, defined above. new mySubmitController(); });
I’ll leave this open for a bit in hopes that someone can tell me why this works and console.log(form) doesn’t.
Actually figured it out using cookies…
Added this to my themes custom js file…
var mySubmitController = Marionette.Object.extend( { initialize: function() { this.listenTo( Backbone.Radio.channel( 'forms' ), 'submit:response', this.actionSubmit ); }, actionSubmit: function( response ) { // delete any old subid cookies... (probably not necessary since we're (re)setting it below but whatever) document.cookie = 'subid=;expires=Thu, 01 Jan 1970 00:00:01 GMT;'; var subID = response.data.actions.save.sub_id; // just to make sure we're getting the correct sub_id... console.log('SUB ID: ' + subID); // you can see all the data for this form submission... console.log(response); // set a cookie to hold the sub_id... document.cookie = 'subid=' + subID + '; expires=Thu, 31 Dec 2030 12:00:00 UTC; path=/'; }, }); jQuery( document ).ready( function( $ ) { // Instantiate our custom field's controller, defined above. new mySubmitController(); });
At this point you should have a cookie ‘subid’ with a value of the submission id. You can do with that whatever you need. I’m getting/displaying mine on the redirect page with php:
$sub_id = $_COOKIE['subid']; echo 'sub_id: ' . $sub_id;
There may be a more reliable and efficient way to do this but this works for my purposes.
- This reply was modified 6 years, 3 months ago by shagdirty.
Forum: Plugins
In reply to: [Import and export users and customers] Cron Import Not WorkingThanks for the tip @carazo. I installed that plugin and looks like default WP ‘cron’ wasn’t running for whatever reason (which I didn’t try to figure out). Did some digging and adding this to the wp-config.php file seems to have solved the issues on at least one dev server (WP Engine).
define('ALTERNATE_WP_CRON', true);
Might be worth adding a note in the docs about it.
Still waiting to test other servers but fingers crossed it works there too. Once I do that, I’ll close this string and mark as solved.
- This reply was modified 6 years, 9 months ago by shagdirty.
Nevermind. I’m a dumbass. Typo in the meta value in my query.
I can’t help but think of Karl from Sling Blade: https://www.youtube.com/watch?v=AynXoLjYrKc. It ain’t got no gas in it.
you could probably do this with css. probably needs some tweaking but something like:
.um-profile-body .um-item {
float: left;
width: 45%;
margin: 0 5% 30px 0;
}.um-profile-body .um-item:nth-child(2n) {
margin-right: none;
}.um-profile-body .um-item:nth-child(2n+1) {
clear: left;
}Very nice. That’s a great way to edit products and definitely a big help.
I still think it would be a very sensible feature to be able to add pricing to attribute terms. This is the way many other ecommerce systems work and seems like it would be relatively easy to implement.
I did find this plugin: https://github.com/m4olivei/woocommerce-attribute-pricing which needed some tweaks to get working with the latest version of WC but it overwrote the prices set on product page instead of just ADDING the term’s set price to the product price set on the edit page.
So still looking for a long-term solution but Smart Manager will work for now. Thanks!
I need this too. I’ve tried echo $event->ticket_url in my custom agenda template but it won’t spit out the url. I can echo other data from the same table using that technique so not sure why the url won’t work.
Forum: Fixing WordPress
In reply to: Excluding Child Posts When Using next_post_linknope. I had a finite number of posts so the solution was hard-coded logic to skip those particular two/three child posts. let me know if you end up figuring anything out though.
Forum: Fixing WordPress
In reply to: Display an array in a custom meta box select fieldActually, I never resolved the issue. I ended up going with a different solution due to time constraints. It seems like I was very close but I’m not supper savvy with arrays.
I’d still like to know how so if you figure it out please post back.
shag
Forum: Fixing WordPress
In reply to: is_user_logged_in only working on home page – HELP!Apparently .html pages were being cached by the server. The site uses .html extensions on all pages but the home page so thus the issue only appeared on internal pages. Hope that helps someone else.
Forum: Fixing WordPress
In reply to: Only allowing users to select top level post/pages as parentDug up a solution for this via the in-ter-net. This creates a custom meta box and apparently WP looks for a parent_id which doesn’t necessarily need to be in the default Attributes meta box. Place this in your functions.php file and change the custom post type name as applicable. hope this helps someone.
[Code moderated as per the Forum Rules. Please use the pastebin]
Forum: Fixing WordPress
In reply to: Display an array in a custom meta box select fieldbump. anyone?
Forum: Fixing WordPress
In reply to: Display an array in a custom meta box select fieldquick update, I’ve utilized the implode() function to get the array values into a nice comma separated format but the entire array appears as one option in the select field:
so I added this:
$InArray = '\'' . implode('\', \'', array_map('mysql_real_escape_string', $in_list)) . '\'';
which will display the array in a nice comma separated list when echoed but when placed in my fields array all of the array values appear as one option rather than separate
'options' => array('default option', $InArray)
Thoughts on why the options don’t appear separate???