Support Forum
I've successfully updated to Version 6 and installed the new plugins, but keep getting an error when activating the "Featured Topics and Posts" plugin.
The error message reads,
" Fatal error: Can't use method return value in write context in /home/caroltic/public_html/beta/wp-content/sp-resources/forum-plugins/featured/library/sp-featured-components.php on line 15"
At the moment, Simple Press is the ONLY active plugin.
WP 5.1.1
Simple Press 6.0.6
Has anyone else encountered this?
Thanks,
Mark
Just for a sanity check I quickly installed the Featured Topics plugin on a relatively new install of WP 5.1.1 and Simple:Press. I didn't run into that issue. So I took a look at line #15 referenced in the error message and didn't see anything obvious. So its possible that there is something in the data returned from your database that isn't expected (not that the data is necessarily wrong, its just not expected). But I don't have any way of knowing what that might be right now.
For another sanity check I activated it on a site with a ton of data (our own website and forum) with no issues there as well.
So my strong suspicion is there's something unexpected being returned from the DB.
Not sure if you have the skills for it, but if you're willing to dig into the code on your site a bit - maybe just before that line you can print out the value of SP()->meta->get_value('featured', 'topics')
to the wp errorlog file and check to see what it contains.
If that looks ok then you'll want to check the contents of the other variables on that line - $topic['topic_id'] and SP()->meta->get_value('featured', 'topics')
Hope this helps a bit.
Thanks for checking a couple of different scenarios on your end!
I do have the skills to dig into the code, so I'll look into how to print to wp errorlog. I'm familiar with using debuggers and console.logs in python and js, but less experienced with wp and php in general.
Thanks for the recommendation!
I'll report my findings here.
Great.
Printing out the data to the debug log should be as simple as something like this:
error_log( SP()->meta->get_value('featured', 'topics') );
For arrays, you would use something like this:error_log( print_r( your_array_variable, true ) ) ;Hopefully you find something interesting that can help isolate the issue.
Thanks.
What I currently have in the error logs from yesterday......... I deleted consecutive duplicate messages for readability. From what I see, it looks like the function SP() isn't initially defined, but not sure why....
[19-Mar-2019 08:33:58 America/Los_Angeles] PHP Fatal error: Call to undefined function SP() in /home/caroltic/public_html/beta/wp-content/sp-resources/forum-themes/default-new/templates/spGroupView.php on line 29
[19-Mar-2019 15:49:45 UTC] WordPress database error Unknown column 'permalink_slug' in 'field list' for query SELECT forum_slug, permalink_slug FROM fwd0611_sfforums made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/simplepress/sp-control.php'), SP, spcSimplePress::instance, spcSimplePress->startup, spcCoreLoader->load, spcPermalinks->__construct, spcPermalinks->load, spcDB->select, spcDB->executeSelect
[19-Mar-2019 15:49:46 UTC] WordPress database error Unknown column 'permalink_slug' in 'field list' for query SELECT forum_slug, permalink_slug FROM fwd0611_sfforums made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/simplepress/sp-control.php'), SP, spcSimplePress::instance, spcSimplePress->startup, spcCoreLoader->load, spcPermalinks->__construct, spcPermalinks->load, spcDB->select, spcDB->executeSelect
[19-Mar-2019 15:49:56 UTC] WordPress database error Unknown column 'permalink_slug' in 'field list' for query SELECT forum_slug, permalink_slug FROM fwd0611_sfforums made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/simplepress/sp-control.php'), SP, spcSimplePress::instance, spcSimplePress->startup, spcCoreLoader->load, spcPermalinks->__construct, spcPermalinks->load, spcDB->select, spcDB->executeSelect
[19-Mar-2019 11:48:42 America/Los_Angeles] PHP Fatal error: Can't use method return value in write context in /home/caroltic/public_html/beta/wp-content/sp-resources/forum-plugins/featured/library/sp-featured-components.php on line 15
If SP() is really not defined you'd probably notice a lot of other errors - I suspect that is a misleading message. What theme are you using?
You should probably still try to output the variables to the error log as discussed previously. It SP really isn't defined you should get the same error there too.
Thanks.
Ok, my apologies, I looked at the backup database I had created before I upgraded. :-/
When viewing the correct database, the field was created, so I'm not sure why the query would fail. I just re-saved permalinks, so I'll re-activate the plugin and see if that solves it.
Thanks for sticking with me!
1 Guest(s)