Hans Schuijff
Forum Replies Created
-
Forum: Plugins
In reply to: [Mention comment's Authors by Wabeo] PHP Warning about paramaterI have tried one comment with myself as mentioned author, but get a http error 405 now. With the warning it didn’t. I think since the in_array warning was about the first selection in the function that send the emails, the if in the beginning never was true so the functionality was never actually performed. Now it is, it results in a http 405. I guess it should be debugged some more. Perhaps better do that before using it.
Forum: Plugins
In reply to: [Mention comment's Authors by Wabeo] PHP Warning about paramaterTo be honest, I hadn’t even noticed that functionality in the plugin. Perhaps I test it at some later point. The faq gives some instructions about how to disable that functionality and change the emails, but it should work. I’ll let you know when I find something. Given the lack of respons from the developer, I quess this isn’t a plugin that is actively maintained at the moment.
Forum: Plugins
In reply to: [Mention comment's Authors by Wabeo] PHP Warning about paramaterHi Lucas.
I’ve Looked into the code now and think it isn’t that hard to solve myself. It seems that the plugin developer has just got the arguments of the in_array() function switched.
The warning is generated by the use of in_array in following code:
function mca_email_poked_ones( $comment_id, $approved ) { if( add_filter( 'mca_send_email_on_mention', true ) && in_array( array( 1, 'approve' ), $approved ) ) {
As you can see the second parameter ($approved) is passed through by the caller of mca_email_poked_ones.
The only call of the function mca_email_poked_ones I could find is in line 277, which says:
mca_email_poked_ones( $comment_id, 1 );
The second parameter being the integer 1.
The syntax of in_array being
in_array(term_to_search_for,array,type)
Changing line 249 to
if( add_filter( 'mca_send_email_on_mention', true ) && in_array( $approved, array( 1, 'approve' ) ) ) {
should do the trick. Line 249 probably just wants to check if $approved is either 1 or ‘approve’.
Hope it helps.
Hans
- This reply was modified 8 years, 5 months ago by Hans Schuijff. Reason: typo
Forum: Plugins
In reply to: [Mention comment's Authors by Wabeo] PHP Warning about paramaterHi Lucas,
No I didn’t get answer on this point and the error is still reported in my own log.
Hans
Forum: Plugins
In reply to: [The Events Calendar] Event list widget and database errorHi Caroline,
I’m not that patient anymore about this bug and dove into the code myself. After finding out a lot about TEC and Sensei and this bug in particular, I found that the cause of it is known already too, so i’m wondering why it isn’t fixed yet, since it involves two populair premium plugins with capable teams behind it.
The most obvious workaround, that I implemented, is changing Sensei’s class-sensei-course.php and putting return; in the beginning of the problem-causing method “allow_course_archive_on_front_page()”. This is fine if one doesn’t use sensei course archives on the frontpage anyway.
And another obvious fix would be to make sure that TEC’s query method pre_get_posts() isn’t queued behind allow_course_archive_on_front_page(), by changing init() in TEC’s query.php likewise, so changing the statement:
add_action( ‘pre_get_posts’, array( CLASS, ‘pre_get_posts’ ), 50 );
to
add_action( ‘pre_get_posts’, array( CLASS, ‘pre_get_posts’ ), 9 );But in that case one should test if all is well after that, since perhaps there are legitimate reasons this method wants to be at the end of the queue.
The more structural solution will probably be a core update fixing the cause that is triggered by Sensei’s allow_course_archive_on_front_page() to remove action itself to prevent an endless loop when it re-calls the core get_posts() method for a cloned query object. And as another workaround Sensei could figure out another way to prevent such a loop by more selectively calling the get_posts method again by setting f.i. some kind of switch somehow that prevents it from calling get_posts when allow_course_archive_on_front_page() is called from within the cloned query object.
The bug seems only to affect TEC because it’s pre_get_posts action is run after Sensei’s allow_course_archive_on_front_page(), but can affect any other plugin too that does the same. It’s actually a sensei problem and not a TEC problem, but perhaps can be fixed by TEC too, at least making sure that it doesn’t affect it.
I hope this information can help some other users with this problem and trigger sensei to more actively fix it. I have reported it as a ticket to them too. What’s a bit troubling to me, is that this information seems to have been available to the developers for some time now. So why isn’t it fixed yet?
I’ve just read a book on php and have some experience with using snippets from other websites and was able to follow the logic and find the cause, so I would hope that more advanced developers would be able to think of a lot more clever solutions than I can.
I looked at the API a bit longer, and found it also saves the meta and performs some checks and stuf to prepare the meta, so the API does add to the experience. One should (to be current) change the objectname then to Tribe__Events__API.
Thank you Igustaw. I have tried Duplicate Post and duplicate now and found duplicate post works very well, while duplicate page also has part of the same problem as Duplicate TEC event. Is has a lot more checks too, like checking a users capabilities to see he is allowed to duplicate in the first place.
I also tested some more and examined the code of Duplicate TEC Event as a programming education project. I think I have found both the problem and a solution. Those that want to know or keep using this plugin may use it.
In more detail the problem was two way. After duplication:
1. In editor of the original event, the link to the fronted permalink was fine, while it showed and remembered the slug of the duplicate.
2. When viewing the original event as a single event, the edit permalink in the admin-bar referred to the duplicate event in stead of the original event. That gave me some Clues.I examined how both duplicate-tec-event and duplicate-post duplicate the post and meta and found that duplicate-page and duplicate-post both use a new array in which they only fill the post-data that they need for a new post in stead of removing just the ID of the existing post and recreating it. The problem was that both the quid and post_name attribute stayed filled in that way.
an unset of $event[‘guid’] helped to correct the admin-bar problem.
an unset of $event[‘post_name’] helped to correct the permalink in editor.I have found no data in the $event table to explain why wordpress changes the post_name that is offered in both the original and duplicate in the edit screen, but it must remember in some way that they belong together. Saving the duplicate doesn’t correct that, only changing and saving it in the duplicate. My only quess at this point is that if a post is created by wp_insert_post, that if the post_name offered already exists, wp gets confused. Or it may be a plugin like Yoast SEO that interferes. In the end I found only just unsetting both guid and post_name did the job.
Also I don’t know if wp_insert_post enters the event-meta too (although I think not), so offering that to it as an argument might be redundant and in that case the fallback coding updating the meta might be actually inserting it in the first place. Looking at the used API method of TEC (the object used is deprecated also), I found it to only call wp_insert_post anyway, so one could easily just call that directly.
And after all this I found that the duplicate-post is a better maintained and flawless an more complete plugin, so I too think at this point it is better used in stead of this plugin. And with one million+ installs it is better tested too.
It took me a lot of time to find the problem, but it was educational too (and that was my main motive). For those that want to use this plugin. You should edit the file duplicate-tec-event.php and insert two unset-statements where it unsets event[‘ID’]. The code could look like this:
unset( $event['ID'] ); unset( $event['guid'] ); unset( $event['post_name'] );
In that case wordpress just creates a new quid and post_name and all goes well. When you want to remember the original post_name in the duplicate, you should at least after insert call the wp_unique_post_slug() function to make it unique and use the wp_update_post() function to update the post-slug. You should probably just use the duplicate-post plugin though since this plugin does exactly the same and duplicate-post does it better.
Cheers.
Forum: Plugins
In reply to: [The Events Calendar] ACF with The Event CalendarThanks ??
Forum: Plugins
In reply to: [The Events Calendar] ACF with The Event CalendarGlad I could help. Was my first try at ACF, so I’ve learned some too.
Forum: Plugins
In reply to: [The Events Calendar] ACF with The Event CalendarI’ve tried the above code in my own install and find it works perfectly.
I added it in the template file single-event.php in the folder “List” of tec. I didn’t make a theme-copy for this test, so I was sure the template file would be used.
Perhaps there is something wrong in your acf-field-settings so it doesn’t return the file URL instead of the file or something? Or perhaps more likely, the template you edited is not the template that is being used?
You can easily check if your template is being used by changing a word somewhere or setting the meta-data part in comments and see if the frontend shows that.
My starting point was:
https://theeventscalendar.com/support/forums/topic/using-advanced-custom-fields-with-pro-calendar-version/Kind regards, Hans
Forum: Plugins
In reply to: [Yoast SEO] Longer texts lead to slow performanceYes, it’s really unworkable slowing down. I am afraid Yoast doesn’t really tend to reactions here, since his own text points to GitHub for bugs and to his premium version for support. The free users seem to be on their own.
Hans
Hi Angelo,
I’ve tried your string, but it doesn’t work for me. The first part shows a correct starting date, but the enddate isn’t shown. To test it I’ve first took a event having the same startdate en enddate, which results in a startdate in #j #M #Y format, then I changed the enddate of the event, and looked if the enddate was shown (and no it wasn’t).
To test your string I just duplicated the line in the single event page that shows the dates, and changed the duplicated line to your format. In that way I could also see that the default presentation in the single event page showed the start and enddate, and the newly duplicated version in both cases only showed the starting date.
I don’t know why it doesn’t work, but if the enddate is shown in your installation, it must be something in my installation.
I was able to use the format without the brackets to add sufficient microdata to the event, category, tag and location pages, so I think I might be good without the brackets also.
Thanks for your suggestion. Helas the brackets really don’t work here.
Forum: Plugins
In reply to: [Yoast SEO] Longer texts lead to slow performanceExactly. It’s not only that my edit page slows down to a standstill when I edit the content of the article, but in the yoast-seo part I have to wait after sometimes every character for the page to open up again (which takes a lot of seconds) so I can enter my search focus term.
I have already started to type the summary text for google in a external editor en past it in the snippet because of that and because the snippet-field also seems to loos focus a lot and close down automatically. For me the change to javascript hasn’t worked out.
Sorry Yoast, it’s not really an improvement untill now. Can there at least be a button to start the analysis in stead of it running continually in the background?
Forum: Plugins
In reply to: [Genesis Featured Page Advanced] Language files aren't loadedHi Nick,
I’m very happy with the new functionality. Thank you for adding it so quickly.
Regards,
HansForum: Plugins
In reply to: [The Events Calendar] TEC on genesis framework?Oke, thanks.
In thinking about the choice between genesis_site_layout or structurally using genesis_pre_get_option_site_layout, I’m wondering if there is added control in using the first.
As I understand it from you, the layout controls on page level are shown and even after using the snippet to show them, they are not functional, and if one chooses to use functions.php to control layout would it be logical to do that in a way that genesis theme options would overrule that setting? Why use functions.php to set a layout that could just as well be controlled by the general theme settings anyway?
So the only question would be if the control on page level is available, and as I understand it that would involve php-knowledge (or additional snippets) that is not provided in the page in which you provide integrational instruction.
So the question to me would be: why not use genesis_pre_get_option_site_layout?
It’s just a thought. Thanks for all the help and for giving my thoughts and questions the attention you have.