lukoie
Forum Replies Created
-
ok, add this code to the line #315 in the “/includes/classes/class-functions.php” file:
function get_current_time(){ return date( 'h:i A T' ); }and it will work as a charm
PS you need to call this function as a global in the class, that’s why it didn’t workWell, actually there’s another problem regading the same issue.
If you just comment the timezone redefining, you will get an issue in the plugin itself.
So the time on the WP will be correct, but the time for the plugin will be altered.
For example, the time is 10:30am right now. The plugin is activated and that line is commented/deleted. The time on the WP config page will be correct, BUT on the plugin’s page it will be 8:30am.
Even though you have a plain “php echo date( ‘h:i A T’ );” it get the wrong time.
If you copy this line into separate php file and place it in the site’s root and open this file in the browser, you will get the right time (10:30).
This means you’re treatin my timezone(well, actually my server’s timezone) as a UTC base.
Need to mention as well that I use a city name as a timezone definition(it respects the summer time shifts correctly).In the previous version of the plugin(I like the backend of it) do the same in the
/includes/functions.php file, line #67I’ve commented the line #45 in the includes/classes/class-functions.php and the time stamp went back to normal.
There was the code linedate_default_timezone_set( $this->get_timezone_string() );for some reason. Mate, it just says to get my current time zone and treat it as the UTC base. Why would you do that?Forum: Developing with WordPress
In reply to: WordPress hook fires before, not after the callThank you.
Forum: Fixing WordPress
In reply to: WP JSON file explanations?Thank you @jcastaneda
This could be a pretty loaded question and answer.
I thought the json for the wp-json is somehow restricted
for example, the field types are limited in number and those field types has their relevant keys, like for example these are the keys and values for the “google_maps”, but i bet there could be more which i don’t know:"name": "map", "type": "google_map", "instructions": "", "required": 0, "center_lat": "field_975841be30ac6", "center_lng": "field_975841be31ac6", "zoom": "", "height": "", "conditional_logic": 0,If I’m building the custom post type via JSON, i suppose there could be some kind of documentation for the available properties.
How is that being created? Is it from a plugin, a theme, a combination of the two?
\www\html\dev\wp-content\plugins\NAME\acf-json\group_5b57d126a97c3.json”
... "location": [ [ { "param": "post_type", "operator": "==", "value": "school" } ] ], "menu_order": 0, "position": "normal", "style": "default", "label_placement": "top", "instruction_placement": "label", "hide_on_screen": [ "permalink", "the_content" ], "active": 1, "description": "School Post Type", "modified": 1532482279 ...- This reply was modified 7 years, 8 months ago by lukoie.
Forum: Fixing WordPress
In reply to: WP JSON file explanations?@prashantvatsh your link is irrelevant to this topic!
- This reply was modified 7 years, 8 months ago by lukoie.
Forum: Developing with WordPress
In reply to: REST meta key in DATE format?Thank you.
Forum: Developing with WordPress
In reply to: WordPress hook fires before, not after the callAnyone else, please?
At least, confirm this behavior.Forum: Developing with WordPress
In reply to: REST meta key in DATE format?Yeah, that was my intention, but my client want it to be in DATE format.
Will need to negotiate on that then.
Thank you.Forum: Developing with WordPress
In reply to: WordPress hook fires before, not after the callNo, mate, it is updating.
For instance, if I have my “OTP”=”1111” i change it via rest to “2222”.- This reply was modified 7 years, 8 months ago by lukoie.
Forum: Developing with WordPress
In reply to: WordPress hook fires before, not after the callThank you for your support, @bcworkz
What JSON was returned from your POST request? There should be some sort of error indication.
No, the response is 201, it’s all good.
Did you check your DB to see if the value was changed or not?
Yes, the changing works fine. Only the issue I have is with the triggering that meta data change on the WP side, so if user changes his metadata(otp), I send him the sms with that OTP on his phone number.
At this point it looks like your update is failing and you are getting confusing data in your action hook due to unrelated meta updates.
I’ve got this field showing on the user page as well. Everything is working fine with the metadata change.
What I need to achieve is the triggering part, where the changed metadata(OTP) would send to this particular user’s email, or sends to his phone number.
But instead I’m getting only first user’s data in the function’s parameters.Forum: Developing with WordPress
In reply to: WordPress hook fires before, not after the callIt looks like we’re encountering the problem.
the function in the functions.php is this:add_action( 'updated_user_meta', 'second_otp', 10, 4 ); function second_otp($meta_id, $object_id, $meta_key, $_meta_value) { error_log( $meta_id ); error_log( $object_id ); error_log( $meta_key ); error_log( $_meta_value ); };and the rest POST is:
{ "id": "31", "meta": {"otp":"1O25"} }to the http://SITE.com/dev/index.php/wp-json/wp/v2/users/31/
I’ve got these in logs:
[17-Sep-2018 13:11:21 UTC] 73 [17-Sep-2018 13:11:21 UTC] 1 [17-Sep-2018 13:11:21 UTC] _application_passwords [17-Sep-2018 13:11:21 UTC] PHP Warning: error_log() expects parameter 1 to be string, array given in /var/www/html/dev/wp-content/themes/twentyseventeen/functions.php on line 637which indicates that the function is getting user id 1 and not the 31!
here’s the screenshot of the DB with this user meta:
http://i63.tinypic.com/2u8fqqq.jpgwell, for the time being, i just have put the prefix @{site-name} so it uploads all files into the folder, and there’s no year/month categories
but personally, i think this is not the right way to manage thatI second that.
Looked everywhere in the code, there are no hooks/filters/actions