WordPress Wpdb Error Checking

Live performance listings for WordPress.

Current version: 2.3.22
Released November 13, 2018

GigPress requires WordPress 4.5, and has been tested to version 4.8.8. It is a free download, released under the GNU General Public License. Since December 17th, 2007 it has been downloaded 325,192 times.

Installation and usage

After downloading, unzip the gigpress.zip file on your computer, then upload the gigpress folder to the wp-content/plugins directory on your web server. It willВ then appear on the Plugins page in your WordPress administration panel. Upon activation, there will be a new top-level menu in the WordPress admin called GigPress.

For details on displaying the tour dates you enter into GigPress on your site, please refer to the documentation.

GigPress is fully internationalized, but depends on users like you to translate it into different languages. As of version 2.3.22, GigPress includes localization files for:

  • Belarusian
  • Brazilian Portuguese (thanks to VinГ­cius Massuchetto)
  • Bulgarian (thanks to Ivo Minchev)
  • Simplified Chinese (thanks to Liang Chuan)
  • Danish (thanks toВ Rasmus Kern)
  • Dutch (thanks to Guido Vrouwe)
  • Finnish (thanks toВ Niilo Sirola)
  • French (thanks to FrГ©dГ©ric Barry)
  • German (thanks to David Scott)
  • Hebrew (thanks to Nimrod Dweck/Dice Marketing)
  • Italian (thanks to Chiara Esposito)
  • Japanese (thanks to @takipone)
  • Norwegian (thanks to Espen Kvalheim)
  • Polish (thanks to Krystian Buczak)
  • Romanian
  • Russian (thanks to Ravi)
  • Slovak
  • Spanish (thanks to Karin Sequen)
  • Swedish (thanks to Karl Sandoval)

Share Your PHP Talks

wordpress post

List post based on therir social ads

Recently i have found a plugin to list the posts based on there number of social shares…

This plugin list the post based of there number of social shares (facebook, google+, twitter)

How to modify post data before saving to database in wordpress.

Sometime we want to put custom validation on the post data that is saved in the database.For this we can use the edit_post action.

Below code is checking for non alphanumeric character and removing them from the post title of the post

global $_POST;// this array has all the post data in the $_POST array

// the below code is removing the non alphanumeric character from the post title

$_POST[‘post_title’] = preg_replace(“/[^a-zA-Z0-9\s]/”, “”, $_POST[‘post_title’]);

$wpdb->query(“update “.$wpdb->prefix.”posts set post_title=’”.$_POST[‘post_title’].”‘ WHERE ID=”.$_POST[‘ID’]);
>

BuddyPress.org

How to add custom $usermeta to registration

Below is an example of how to add a simple text field to a new users usermeta when they register…

In a new plugin file, your functions.php, or bp-custom.php put…

Then somewhere in your custom register.php file, put…

Replace “name_of_field_in_template” and “field_name” with what you need, and rename the functions if you want to, etc… Now when people sign up on your website, you can have custom usermeta that gets entered when they activate their account!

If you wanted to pump this up a notch, it’s possible to create a function to retain the value and send/receive field formatting errors also, so you can expand this to do something like youtube or twitter id’s on sign-up, outside of tying the fields into xprofile. Obvious uses for this would be to integrate BP with existing plugins that use usermeta already, letting your sign-up process get the headstart on setting up user accounts with the information those plugins want/need.

Have fun! Happy hacking!

I might make an example plugin for people to tear apart later if there’s interest.

HOW-TO: Make WordPress Blogroll’s smarter

Warning: Heavy geek content ahead. If you’re not interested in PHP code, you can safely skip this post.

One thing that not a lot of people know about is that WordPress is capable of checking your bookmarks/blogroll links for you and organizing them according to the time they were last updated.

The reasons people don’t know this are:
a) It’s not automatically setup and working, and
b) It rarely works in the first place.

If you look at all the ways you can display links, one option kinda stands out.. In the case of wp_list_bookmarks(), that option is “orderby=updated”.

What does this do? Well, the Blogroll/Bookmarks have a field that is supposed to store the last time that each link was updated. And there’s a script in the wp-admin directory designed to keep it up to date. The script is named “update-links.php” and it… well… doesn’t work.

You see, pingomatic.com is included by default as one of the sites that gets pinged on every new post. So this site probably knows when every blog was updated. More or less. The bright idea at the time was to make the update-links script ask pingomatic when all these links were updated. And that’s what it still does. The problem with this is that pingomatic… well… it kinda sucks. The updated-batch request in it’s API rarely works. In point of fact, I’ve never gotten it to work.

So “update-links.php”, sadly, sits there. Semi-dead code. Nobody uses the “orderby=updated” parameter, because it doesn’t work without knowing when things were actually updated.

But nowadays, we have something better.. We have RSS feeds. And with a minor bit of code, you can revive your update-links.php. How? Well, one other thing every Blogroll/Bookmark link includes is a special field just for RSS feeds. Scroll down when you add or edit a link to find that field. Most people probably don’t fill that field in. But now we can make it useful.

The concept is simple: For every bookmark that has an RSS feed filled in, we’ll get the feed, find the Last-Modified time on the feed, and update our bookmark’s updated time. Then “orderby=updated” will actually work, and we’ll be able to have our Blogrolls reorder themselves automatically, putting the ones with the latest updates at the top of the list. Neat!

Here’s how you do it. First, you need to replace update-links.php with this code:

It’s a lot simpler than the old update-links.php, really.

Now, you need to find some way to run it every once in a while. If you’ve ever set a cron job up, you already know how to do this. You just need to make a cron job that loads http://example.com/blog/wp-admin/update-links.php every once in a while. However often you want to update. I recommend no more than once every 6 hours though, you’re pulling RSS feeds here. No need for extremes.

And that’s it. Change your sidebar to use “orderby=updated” and you’ll find that it works.

Future versions of WordPress may or may not have this change, and may or may not have the need for an external cron job (still working on these).. But this works right now, it’s a minor thing to do, and it’s kinda fun to have anyway.

3 thoughts on “HOW-TO: Make WordPress Blogroll’s smarter”

Hello. I just wanted to drop by and say thanks for helping me out in the WordPress forum. You guys are real experts. Thanks alot !

$wpdb->insert not working, last_query doesn’t show insert “SHOW FULL COLUMNS FROM”

Posted by: admin January 31, 2018 Leave a comment

I run $wpdb->insert($table, $data) where data is an array with column_name => value and the insert is not working. I tried $wpdb->last_query and something bizarre comes back:

Why is the last query not my insert?

I found the problem. Apparently with the new WP update if you try to insert into a VARCHAR column and the column length is less than what you are trying to insert it just won’t work. Prior to this update it will insert it but trim off the excess characters.

Related Posts

Check if table exists without using “select from”

Questions: Is there a way to check if a table exists without selecting and checking values from it? That is, I know I can go SELECT testcol FROM testtable and check the count of fields returned, but i.

How can I run an SQL script in MySQL?

Questions: I am new to MySQL. I want to execute a text file containing SQL queries. I tried to run source /Desktop/test.sql and received the error, mysql> . \home\sivakumar\Desktop\test.sql ERROR: .

Check if table exists without using “select from”

Questions: Is there a way to check if a table exists without selecting and checking values from it? That is, I know I can go SELECT testcol FROM testtable and check the count of fields returned, but i.

Leave a Reply

Your email address will not be published. Required fields are marked *