huntr77
Forum Replies Created
-
Forum: Plugins
In reply to: [Social Connect] [Plugin: Social Connect] Twitter PIN authorization (How?)I have the exact same problem and can’t for the life of me figure it out. Has anyone found a solution for this?
Hi MisaGarcia,
Actually it was only the MostVotedAllTime() function within the plugin. I still use the plugin on my site (look here for an example https://www.phonetipsandtricks.com/tips/apple-iphone-4/) and it causes no problems at all. It was just the function that displayed the top Votes for the whole site. I had that on the sidebar and it must have been running through the whole ‘Votes’ table on every page load – but in a very inefficient way.
My hosting company actually looked into it at the time and couldn’t find the problem. If they didn’t spot that, than at least I don’t have to worry about them kicking me off for excessive usage. Try searching through your code for the above function. If you can’t find it loading on your page, you must have some other problem with your database.
Hope that helps…
Bryan
I’m not surprised! My developer and I just spend hours and hours and hours trying to figure out why my site was taking 10-15 seconds to even display anything on the screen. The developer spend a week minifying css, javascript, installing a W3C cache, installing self-hosted CDN, you name it. nothing worked.
I then made a copy of the whole site, stripped every element out and eventually started removing data from each database table. It wasn’t until I cleared out the voteitup table wp_votes that the site started loading in 1-3 seconds!
I had the MostVotedAllTime() function on the sidebar so every page being loaded was loading the plugin. The wp_votes table had 3,000 records in it, yet there were only about 10 votes across the whole site! Crazy.
I’m going to drop the plugin and get one made from scratch!
hope that helps someone out there…
Forum: Plugins
In reply to: How to display a random post but keep it for the whole dayJust sent it through, although the email address I received in my inbox differs from the one above. Perhaps you updated the post…
Let me know if you didn’t get the email.
Forum: Plugins
In reply to: How to display a random post but keep it for the whole dayhey akaalvin,
I ended up having to write the code myself. it was quite a mission and requires javascript to be enabled.
I had to create a new table in the WP database. I called mine wp_todaysid. The fields are ID, storedDate and randomID
When a user visits the site, it loads the main site index.php and gets today’s date from the browser (using Javascrpt – client side headers don’t contain date info). Then it checks the above table to see if that date is already there. If it is (i.e. someone has visited the site that day), then use the date and the corresponding ID to display that post. If the date is a new one (for that day), then lookup all WP posts IDs (filtering out any unwanted pages, posts etc). Generate a random ID from all those IDs. Put the random ID into the wp_todaysid table. Then place that ID into a session variable. Then load the index.php file for your template and display that post.
This works well because it doesn’t matter what time zone a person is in. The key thing is the date that Javascript returns is the local system date. If they’re in New Zealand and 12 hours ahead of the UK for example, the UK users will still be looking for yesterday’s date. By the time the UK users gets to the next day, the NZ users will have generated a random ID. It means that Kiwis might always be generating IDs, but early bird gets the worm! And it’s all random anyway…
Here is the process the site index.php file goes through to handle the date:
– Get local date from browser (using Javascript)
– Because you can’t pass the Javascript date variable to the PHP (the script has already executed), you have to reload the page, passing the date to the URL
– If date exists in the URL, get it and store in session variable. Reload page.
– Third reload checks for session variable and continues.
– Using date from session variable, connect to database and check wp-todaysID table for today’s date
– If date exists in table, load template index.php file using the post ID corresponding to today’s date
– If date doesn’t exist, generate a random id, store ID and today’s date in wp-todaysID table. Then load your template index.php file using the post ID corresponding to today’s dateIf you want to send me your email, I can send the code across
Regards,
BryanForum: Plugins
In reply to: How to display a random post but keep it for the whole dayCan anyone help me with this please?