I have an option value in the wp_options table as such: option_name . twitter_feed . and the value is there in the options value column. But when I run the following in my code, I get false:
$tf = get_option('twitter_feed');
var_dump($tf);
I have access to my DB and I can see that there is an option named twitter_feed and there is a value. The value starts with a format of:
a:20:{i:0;O:8:"stdClass":28:{s:10:"created_at";s:30:"Tue Sep 19 22:16:26 +0000 2017";s:2:"id";i:910266359799525376;s:6:"id_str";s:18:"910266359799525376";s:4:"text";s:70:"We can't wait for the Grand Opening on Oct 19!'
Does the format that is saved in the DB has anything to do with not being able to pull the value? I would assume I would at least get an error and not false.
I also have a facebook_feed value that works. It is also an option in the wp_options table of facebook_feed and that value starts with a format of:
a:25:{i:0;a:6:{s:7:"message";s:412:""Our scientific and research-based training and programs were devised to help
How can I access the value of my twitter_feed value?
This looks like serialized data. See:
http://php.net/manual/en/function.unserialize.php
Let me know if this helps.
I tried this:
$ff = get_option('twitter_feed');
$ff = unserialize($ff);
var_dump($ff);
the same false. Since I have access to the DB, I grabbed the original twitter feed value and save it to a text editor and then copied the facebook feed value and placed it in the twitter_feed options value. Still FALSE. This makes no sense. AS I have a facebook_feed option and a twitter_feed option both with the same value in my wp_options table and only the facebook_feed works. I have deleted all of the transients in wp_options table thinking this might be an issue but no luck.
Any other ideas?
Well after many hours I finally got it working. I inherited this WP site and it seems to have been coded by someone who just learned OOP. Got to give them props for trying but Many issues. So I created a brand new function to consume the Twitter API and save the new feed in my twitter_feed options value and that worked. Not sure if the data was corrupted, but when I would try to pull the original data out I would receive a FALSE value. Now with the new data feed saved, it works.
Thanks Paul for the suggestion.
Related
I want to change or reset the total_sales to 0 at worst.
When I modify in phpMyAdmin (wc_product_meta_lookup) nothing happens and everything goes back to the way it was before after a new order.
I searched for 2 hours without finding anything.
thank you in advance.
total_sales is a post meta field, a row in postmeta table. wc_product_meta_lookup just contains consolidated data from postmeta to avoid making multiple postmeta selects when product data are needed.
postmeta is the source of truth in this case, you need to set your desired value in there. Either directly in the database or using a custom field in the product edit view.
Reports (including total sales value in the dashboard widget) are dynamically generated, so I believe the value your setting in the database will just be set back to it's true value when WordPress runs.
According to the docs, you need to delete all prior orders (permanently) and clear your browser cache for new reports.
More info: https://docs.woocommerce.com/document/reports/#section-12
In odoo every model will be having a write_date column which will store the last edited time and date of the record.I want to take the value of that field to a variable/ field. But when I print this , it is printing False . What to do.?
code
variable = self.write_date
Thanks in Advance..
The problem is that you're getting in self a new recordset (odoo.models.NewId object at 0x7fe0c05717d0). Therefore, you're trying to get the write_date of a record which has not been created yet. If the record has never been updated (even not created), it's not going to have a value in write_date.
Remember that write_date stores the latest date in which the record was updated.
So, first, at least, you must create the record, and then, you will be able to apply this: variable = self.write_date.
But take a look at this:
What's happening with these transient models' IDs?
May be you get the write_date without creating the record, give a try to this: variable = self._origin.write_date.
Even though we can see a field named write_date in the table, First of all, what we have to do is that you have to add a field named write_date into your model and then try the same.
write_date = fields.Datetime(string='Write Date') solved my problem.Thanks everyone for helping.
I am trying to build a PowerApp to log setup times of our machines by our fitters.
This is what my app looks like:
There are buttons named "Uhrzeit". Pressing these will write the current date and time into the Date/Time fields. I am using the following code:
UpdateContext({Total8:(Text( Now(); "[$-de-DE]dd/mm/yyyy hh:mm:ss" ))})
The Date/Time field is named Total8.
The code is working well but after saving the form and opening a new record the old data is still available in the fields. By clicking on the button "Zeiten zurücksetzen" I can "delete" the old data.
UpdateContext({Total8:""})
Problem: When I open one of the older records the old data is not available in the form. There is only the value of the last record. In the Common Data Service where my records are saved the values are correct.
As an example, I am saving this record:
When I open a new record, the values of the record 1 are still available. This should not be the case if my app worked properly.
For your Information:
If I enter the date/time without tapping the button, saving the record and opening a new record I don't have the problem. I think the "UpdateContext" code is not the code I should use here.
Can anyone help me solve the problem?
I don't think there's a problem with using the contexts in this way -- but remember that a context is just a variable. It isn't automatically linked to a datasource in any special way - so if you set it equal to Now(), it's going to keep that value until you do something different.
When you view an old record, you need to get the data from CDS and update your contexts to match the CDS data. Does this make sense?
Yeah thats my problem.
I want the variable to be linked to a datasource. Or is it possible to write the date/time into the fields without using a context variable?
I created an app with the sxc module.
Now I have like 500 empty rows which I want to delete.
I searched for them in the database to delete them all but I cannot seem to find them and I think it is a waste of time to delete them all 1 by 1.
It's data in "Manage content / data" table.
Let me know please.
I have another question:
If I edit an item. The title of the module gets changed with the first items 'name' field. How to avoid that? Is it an bug?
Thanks in advance.
Basically JKings answer is correct - this kind of bulk-operation can easily be done using export/import, because on re-import you can tell 2sxc to delete all items not found in the import. This ensures that 2sxc can take care of data integrity etc. Instructions https://2sxc.org/en/Learn/Content-Export-and-Import
So the correct steps are:
export the list
open in notepad, xml editor (or use excel, as shown in the link)
Remove all those you don't want
Re-import, but choose the option to "Remove all entities not found in import"
You're set :)
For my pourpose I need to sort Employee app list items by last modified date.
I see that in the object there is a Modified that is a date field (I assume it is a 2sxc internal field).
Using the Value sort datasource setting Modified as attribute I get an empty object.
It does work using my custom fields as sorting attribute.
What I'm missing please?
I believe the value-filter didn't include modified till very, very recently, like v08.05.04 or similar. Since then I believe it was added - see https://github.com/2sic/eav-server/blob/master/ToSic.Eav.DataSources/ValueFilter.cs#L146-L167
So I believe if you upgrade it should work.