Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • After the database update some fields were still missing. The data was still there in the database but I had to manually add all of the missing fields for the data to be available on the site.

    Tomi Toivio

    (@tomitoivio)

    You can just add the prefix to the name of your table and then do SQL queries with $wpdb->get_results().

    $table_name = $wpdb->prefix . "mytable";
    $mytablecontents = $wpdb->get_results("SELECT * FROM " . $table_name);
    Tomi Toivio

    (@tomitoivio)

    I don’t know what you wanna do, but I can do something when admin posts a comment reply from the admin panel with a function like this.

    /* Call the function when comment is posted */
    add_action('comment_post', 'my_admin_reply');
    
    function my_admin_reply($id) {
    
          /* Only do it when posting from admin */
          if (is_admin()) {
          $mycomment = get_comment($id);
          $mycommentid =  $mycomment->comment_ID;
          $mycommentparent = $mycomment->comment_parent;
          $mycommentcontent = $mycomment->comment_content;
    
          /* Only do it when the comment has a parent */
          if (!empty($mycommentparent)) {
                  /* Doing something with the comment contents */
          	      $mycommentarr = array();
    	      $mycommentarr['comment_ID'] = $mycommentid;
    	      $mycommentarr['comment_content'] = $mycommentcontent . " Doing something!";
    	      wp_update_comment($mycommentarr);
          }
        }
     }
    Tomi Toivio

    (@tomitoivio)

    I think you are passing making a query which includes the query string of the original category. So you are actually making a query with two categories.

    Leaving out the original $query_string from the query_posts() works for me:

    $posts = query_posts('posts_per_page=6&cat=6');

    Forum: Hacks
    In reply to: Post Title issue
    Tomi Toivio

    (@tomitoivio)

    Something like this?

    function my_remove_title_spaces ($title) {
    	 $title = preg_replace("/ /","",$title);
      	 return $title;
    }
    add_filter( 'the_title', 'my_remove_title_spaces');
    Tomi Toivio

    (@tomitoivio)

    Maybe you should use $wpdb?

    Forum: Hacks
    In reply to: store tweet in database
    Tomi Toivio

    (@tomitoivio)

    It was easy to fetch tweets from Twitter Search with curl, decode the json and add them to a database table. I had a snippet of code for doing that.

    However Twitter now requires that you authenticate with OAuth even for searches. It makes the business of fetching tweets a lot harder than it used to be.

    So I would use a plugin like Twitter Tools rather than bothering with the OAuth authentication.

Viewing 7 replies - 1 through 7 (of 7 total)