Results 1 to 2 of 2

Thread: Custom field bulk editor?

  1. #1
    Thread Starter
    lucrothe's Avatar
    Join Date
    Apr 2010
    Location
    United States
    Posts
    91
    Thanks
    18
    Thanked 13 Times in 7 Posts

    Custom field bulk editor?

    Does anyone know of a way to easily update custom fields in bulk? I've created a URL custom field and I need to edit most of the responses people put in for it to include the "http://www" part of the URL. Any ideas?

  2. #2
    dragos's Avatar
    Join Date
    Jan 2011
    Location
    Romania
    Posts
    63
    Thanks
    4
    Thanked 9 Times in 8 Posts
    Hi, from what I understand you have a custom field, let's call it 'cp_example' that users complete with text (it's a text input) and you want to add "http://www." in front of the value that the user inputs. Is this correct? if this is what you want you can modify /classipress/includes/forms/step3.php on top of the file you can put a function that will save the meta_value of the custom field in a variable, add the desired text and overwrite the database input with the new value. custom function would be something like:
    function url_custom_field($post_id) {
    $old_value = get_post_meta($post_id, 'cp_example', true); //where 'cp_example' is the custom field you want to use.
    $new_value = "http://www.";
    $new_value .= $old_value;
    $wpdb->update('wp_postmeta', array('meta_value' => $new_value), array ('post_id' => $post_id, 'meta_key' => 'cp_example') );
    }

    I didn't verified the code but it should work all you need to add in the step3.php file is the call of this function with the post id parameter!
    Hope it will work as is if not, just contact me, I'm more then happy to help you set it up correct if I miss-understand the request cler things up and we will see what we can do for you.
    Regards

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Description field - HTML editor
    By ramswebsolution in forum Report ClassiPress Bugs
    Replies: 13
    Last Post: April 23rd, 2014, 01:35 PM
  2. How to bulk change field entries for Advanced Search
    By lausha in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: July 27th, 2012, 01:32 AM
  3. Custom fields editor 3.0.5.3 wacky dating in Admin
    By vienna in forum Report ClassiPress Bugs
    Replies: 19
    Last Post: May 2nd, 2011, 08:45 AM
  4. [TUTORIAL] Mod to Rename Custom Fields Editor for Fun and Frolic
    By vienna in forum ClassiPress General Discussion
    Replies: 1
    Last Post: February 23rd, 2011, 08:26 AM
  5. [SOLVED] Custom field order in frontend doesn't match with custom field order set in backend
    By bluecafe in forum Report ClassiPress Bugs
    Replies: 11
    Last Post: November 24th, 2010, 08:47 AM