ranchhand6
Forum Replies Created
-
Forum: Plugins
In reply to: [Connections Business Directory] Error with Connections PluginThat was it. I apparently had a card.php that was extremely old. I copied the one from wp-content/plugins/connections/templates/card/ to wp-content/connections-templates/card/ and that seemed to solve the problem.
I didn’t diff the rest of the directory contents. Would it be advisable to take the rest of the files in wp-content/plugins/connections/templates/card/ and replace the old ones as well?
Forum: Plugins
In reply to: [WP Email Users] Apostrophe in Subject line always escapedI assume you mean 3 Sept 2018. 😉
Thanks, we appreciate the quick response!
Forum: Plugins
In reply to: [Connections Business Directory] Future of JSON APIMy pleasure!
I synchronized my fork to your /develop branch, so I see where you are. With regards to the API, what can I do to help that keeps me out of your way?
Forum: Plugins
In reply to: [Connections Business Directory] Future of JSON APII can’t say I’m an expert, but the approach you took looked reasonable to me. I think I would have done two separate assertions instead of putting the test in an
ifstatement because I think it reads better. Something like:public function test_category_exists_alternate() { $term = cnTerm::getBy( 'name', 'Uncategorized', 'category' ); $this->assertFalse( is_wp_error( $term ) , 'WP Error occurred. Uncategorized category not found.'); $this->assertEquals( array( 'name' => 'Uncategorized', 'slug' => 'uncategorized', ), array( 'name' => $term->name, 'slug' => $term->slug, ), 'Uncategorized category not found.' ); }Same thing, just a bit different stylistically.
- This reply was modified 9 years, 6 months ago by ranchhand6.
Forum: Plugins
In reply to: [Connections Business Directory] Future of JSON APII finally resolved it down to a transaction isolation problem between tests in the same file. I was adding a mocked entry in one test and was able to retrieve it in another so I assumed that I would be able to update it as well. This is not the case. The test framework apparently prevents this. When I added the mocked entry inside the test case I was trying to do the update in, everything started working as expected.
Write it up to my inexperience with WP_Unit.
Forum: Plugins
In reply to: [Connections Business Directory] Future of JSON APII support your idea of the new functions, I had been thinking along the same lines but wanted to make sure the testing framework was working before launching off into that.
I’ve resolved my problem down into a failure to retrieve the record during the update. It’s puzzling to me that the
addworks in the test context but theupdatedoes not. I thought that perhaps I was on to something when I realized that I was passing a string rather than a integer into theupdatemethod, but then I realized that you had protected against that with anabsint()call in the$entry->set()method in class.entry-actions.php.Sigh. Still looking.
Forum: Plugins
In reply to: [Connections Business Directory] Future of JSON APII’m using the
idfrom theaddimmediately prior, looking at the $response object and getting theidfrom there and putting it into theupdate.However, not seeing the entry in the database after the test. I suspect this is because the test framework is using transactions to isolate the test data, but am not deeply familiar enough with WP_Unit as yet to know if this is true. Is there a caching layer I need to flush after the
add?Forum: Plugins
In reply to: [Connections Business Directory] Future of JSON APIThanks for the explanation. I’m getting a ‘0’ for some reason.
After cn_update-entry 0Hmm. I know the record exists because I can see it during a previous portion of the test. It makes me suspect that somehow I’m not doing the update() correctly.
Let me work with it some more. If I have other questions, I’ll open an issue on github.
Cheers!
AWD
Forum: Plugins
In reply to: [Connections Business Directory] Future of JSON APINot sure if this is the right place to ask a programming question, if there’s a different way to communicate, I’m more than happy to use whatever means you are comfortable with. Also, I haven’t been doing PHP for awhile now, so apologies is this error resulted from simple oversight.
We decided to go ahead and put a little work into the REST API interface, so I’ve forked your github repo and have been working my way forward using WP_Unit tests. Please consider everything done to date as draft, we are not married to any of it.
I have a question about an interaction I’m seeing between class.entry-data and class.actions. We’re mocking some data into an entry, and the thing we’re trying to do is to attach an image in the WP_Unit test so that we can test and debug the output of the REST API. The problems seems to be that for everything _but_ the image, the mocked data seems to work fine but with the image data the “update” action fails. While exploring this, we noticed the following:
At class.entry-data->update():5003 (or so), after submitting the CN_ENTRY_TABLE update, you use the following check before allowing the remainder of the tables to update:
if ( FALSE !== $result ) {In our test case, this succeeds because the rest of the updates work. The variable $result is returned later in the method as the result of the entire method.
However, at class.entry-actions->process():789 (or so), you use the following check on the return:
if ( $entry->update() == FALSE ) {In our case, this fails.
Indeed, when we put some testing code into the method,
echo "After cn_update-entry ". ((FALSE !== $result) ? "true" : "false" ). " \r\n"; echo "After cn_update-entry ". ((FALSE == $result) ? "FALSE" : "TRUE" ). " \r\n";… we get these results:
After cn_update-entry true
After cn_update-entry FALSEThis seems a little counter-intuitive.
I hesitate to go much deeper into the base code without consulting with you. I have a branch and a test that stimulates the issue, if you care to look at it. Again, what we’re trying to do is to attach an image to a test entry in order to test the output, if you have an easy way to do that without looping through the class.entry-actions->add() and class.entry-actions->update() we’re more than happy to take a different approach.
Thanks.
AWD
- This reply was modified 9 years, 6 months ago by ranchhand6.
Forum: Plugins
In reply to: [Connections Business Directory] Future of JSON APIThanks for your response, this is very helpful.
One of the things that confused me was your use of the v1 namespace in the routing. I had assumed from other code that I’d looked at that this distinguished the v1 from the v2 WP API library, but reading further in the documentation, I see that it’s an internal API version indicator. We’re learning all the time.
I also missed your github reference in the Description, but I have it now. I’ll talk it over with our customer here and see how they want to proceed.
Again, thanks for your help.
AWD
Ok, we’ll give that a try.
Thanks for the help!
Figured it out. We had the main Calendar page set so that it was visible to members only. The calendar on the front page was an agenda view of a filtered list of events. When we removed the permissions on the internal calendar to make it public, then the calendar on the front page started working as expected.
So, I think we can work around this. I think the need for us to hide the calendar from nonmembers has passed. But if it arises again, is there a way to display some events to logged in users and make others public?
Tracked down through the php.ini. These values look right to me:
error_log = /var/log/php5-fpm.log
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
track_errors = Off
xmlrpc_errors = 0
xmlrpc_error_number = 0
html_errors = Onetc.
Is there a setting inside WP that might be setting the error level lower at runtime?
Yeah, I checked that one too, it’s blank.
Pretty sure I’ve got the right PHP-FPM log, I get this in the php5-fpm.log.1 log:
[03-Jan-2016 18:08:01] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful
Thanks for responding so quickly!
Forum: Plugins
In reply to: [Exports and Reports] How to convert Timestamp field to local WP Time?Thanks for responding.
This is was a little interesting to run to ground. I don’t have shell access onto the server, only cPannel.
First, MySQL. Through PHPMyAdmin:
SELECT @@global.time_zone , @@session.time_zone; @@global.time_zone @@session.time_zone SYSTEM SYSTEMSo it appears as if MySQL is using the same timezone that’s set on the server.
From phpinfo();
Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Los_Angeles’ for ‘PDT/-7.0/DST’ instead
“Date” section of phpinfo();
date/time support enabled "Olson" Timezone Database Version 2013.3 Timezone Database internal Default timezone America/Los_AngelesThis is a little strange, but probably Ok. I didn’t set a timezone when I ran phpinfo(), so php selected one for me based on where it thought it was. Ok, it was probably right.
Again, from phpinfo();
“PHP Variables”
_SERVER["REQUEST_TIME"] 1395423577Aha!
UNIX time 1395423577 is 03/21/2014 5:39pm GMT.
This translates into 10:39 am PDT, which is when I made the request.
So it seems like the unix timestamps on the server are correct.
To confirm, if I do a
SELECT UNIX_TIMESTAMP( TIMESTAMP )on the field in question, it puts out a GMT time that matches the value that I see in the report.
I agree that the date_i18n( $format, $time ) should do it, but it doesn’t appear to for some reason.
Any ideas or suggestions appreciated.
T