Home » Topics » Pods 1.x » problems after upgrading to 1.12.4
problems after upgrading to 1.12.4
This topic contains 5 replies, has 2 voices, and was last updated by andysweet 1 year ago.
-
AuthorPosts
-
May 8, 2012 at 9:23 am #167791
I upgraded to 1.12.4 last night, and in the process my site seems to have become a bit broken!
I’m currently getting warnings such as:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/****/public_html/wp-content/plugins/pods/classes/Pod.php(1280) : eval()’d code on line 141
(on this Pod page for example – http://www.stravaiging.com/history/pictish/stone/struan)
Some pages aren’t showing any of the Pods-stored content that they should be, for example there should be hundreds of accommodation options listed on this page:
http://www.stravaiging.com/travel/accommodation/city/edinburgh
Other pages are displaying completely normally, eg:
http://www.stravaiging.com/history/castles
In addition to this, in the back end of Pods there’s a problem with the Setup tab which means I can’t see anything on that page, so can’t edit anything.
All I can see are the Pods Setup title, and the headings:
Pods
Templates
Pages
Helpers
Roles
SettingsBut there is nothing below there where the edit window should be, it’s just blank.
Any ideas?
The reason for upgrading last night was that my site was hacked by Russian spammers via a vulnerability in the TinyMCE file manager used by Zenphoto. I also re-installed Zenphoto’s latest version and made some changes that that required to my htaccess file. Is this likely to be the source of my problem?
Thanks in advance for any help!
May 8, 2012 at 2:02 pm #167796Ok, I’ve made some progress. I now have the normal appearance back for the Pods Setup section. It was my own fault – while looking for solutions to my Russian hacker problem late last night I didn’t read a guide properly and deleted the line "do_action( ‘init’ );" from my wp-settings.php file which obviously caused a problem with Pods!
But I’m still having problems with the actual displaying of Pods pages at the front end of my website detailed above.
Could something have changed in the latest version of Pods that means some of the code I was using is no longer working?
May 8, 2012 at 11:20 pm #167792I’ve been trying all afternoon and evening and still can’t get to the bottom of this.
On various pages that were working before I upgraded Pods I’m getting the following type of error messages:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/stravaig/public_html/wp-content/plugins/pods/classes/Pod.php(1280) : eval()’d code on line 141
It seems to be to do with having previously been using Magic Tags in MySQL statements, such as:
"SELECT * FROM wp_pod_tbl_xxxx WHERE slug = ‘{@slug}’"
These were working until upgrading, but now no longer work.
I can’t quite figure out the exact syntax to replace the Magic Tags with something along the lines of:
$this->get_field(‘slug’)
Can anyone advise?
May 9, 2012 at 5:00 am #167793Sorry for the delay, busy week! You’re using magic tags within PHP. This was actually a bug that had existed for quite some time since we enabled PHP in the pod templates.
You can’t use magic tags within PHP, you can however, use PHP to build magic tags. PHP is parsed first, then magic tags are parsed.
See here: http://podscms.org/qna/questions/1471/magic-tags-dont-work
If you’re in a template, you can use $this->get_field(‘field_name’) to access fields of the pod the template has been called from. If you need to output the value, simply use:
Which is the same as a magic tag would do:
May 9, 2012 at 10:14 am #167794Thanks Scott, I know you’re (always) busy.
I’d actually figured that bit out, but not being a code expert it was the exact syntax to use in the SELECT statement that had me stumped. In case anyone is looking for that answer, this is what now works:
$slug = pods_url_variable(‘last’); // returns slug of the page you’re on
// Retrieve all the data from the "xxxx" table
$result = mysql_query("SELECT * FROM wp_pod_tbl_xxxx WHERE slug = ‘$slug’");
May 10, 2012 at 12:53 pm #167795I still haven’t fully got my head around Pods’ capabilities when it comes to using MySQL rather than just Magic Tags (mainly due to a lack of time).
I’m self-taught with regards to PHP and MySQL, so a lot of my code has been cobbled together from various sources over the years and isn’t necessarily the best way of doing things.
The query in that case was to find the 10 nearest castles next to the castle on that current Pod page.
I didn’t actually know $wpdb->get_row existed!
-
AuthorPosts
You must be logged in to reply to this topic.