• Resolved Gnocchi

    (@mygraphicfriend)


    When I unlink a gallery to a custom field, all the other galleries’ data input in this field gone too! It’s TERRIBLE, as I have 60 galleries in total, all linked to this custom field.

    The reason I unlinked one of the gallery is because I made the mistake of having line breaks in the text area input of the custom field in this gallery, and all the custom fields of this gallery just disappeared. I need to unlink the gallery to the field and then relink it to make all the custom fields appear again. That’s when I realized that for all the other galleries (well 59 of them) the content of that custom fields also gone! Now I have to redo all of them.

    ??

    Is it a bug of this plugin? Or is it just me?

Viewing 15 replies - 1 through 15 (of 15 total)
  • That does sound bad! I try to look into it sometime this weekend.

    Fixed, new version committed: 1.0.1

    PS. Sorry about the data loss, I hope it’s not too much trouble to get it back

    Thread Starter Gnocchi

    (@mygraphicfriend)

    Shauno, thanks so much for the prompt support!

    If I update the plugin, will I lose my data? I really am afraid that, as it took me two weeks to enter the custom fields’ data for the 60 galleries and more than 2000 images. (And I still haven’t finished yet! ?? )

    I know that I can go to my hosting account cpanel to do a WordPress database backup, but I don’t know how to restore it if something bad happens, and with that database backup will I be able to restore the NextGen custom field data as well?

    Thread Starter Gnocchi

    (@mygraphicfriend)

    I’ve just installed WP-DB-Backup plugin. Such a nice plugin! I now have the custom field tables backup:
    wp_nggcf_field_values
    wp_nggcf_fields
    wp_nggcf_fields_link

    I hope that would be enough. I’m a novice at MySQL so still don’t know what to do if something bad happens when I update NextGen Custom fields plugin, but at least I’ll have those backups to work with if that happens.

    Any more guidance here would be greatly appreciated!!!

    Thread Starter Gnocchi

    (@mygraphicfriend)

    Also, about the problem with line breaks in text area (which will dismiss the custom fields after Save), is there a way to fix that, Shauno?

    I searched and found this:
    $fldtextArea_name = str_replace("<br />", "\n", $fldtextArea_name);

    Wonder if that can be applied somewhere in the plugin php file?

    Hi
    Don’t worry about your data, you won’t lose any in the upgrade. It was just a minor code change in the link/unlink code.

    I haven’t experienced the problem of the data not being saved if there are line breaks. I will investigate and let you know.

    Hi again

    I found the problem you mention with the new lines breaking the plugin.

    It seems it was javascript freaking out at unescaped new line chars. I have committed a fix in version 1.0.2.

    Let me know if you have any more problems!

    Thread Starter Gnocchi

    (@mygraphicfriend)

    Hi Shauno,

    Thanks so much again for the prompt fixes. The link/unlink problem solved. New lines in text area do not break the plugin any more.

    However, the output does not preserve the line breaks or paragraph breaks. The text area input is being displayed as one long line of text.

    I can still achieve paragraph breaks by using the <p></p> tag in the text area (that used to break the plugin but it’s now ok). Is it possible to preserve the breaks (input by Enter or Command+Enter in the text area)? Or using <p></p> tags is the way to go?

    Many thanks,

    Thread Starter Gnocchi

    (@mygraphicfriend)

    When I use the <p></p> tags in the text area field, the output has one extra empty <p></p>tag.

    For example, if I enter into the text area:

    <p>Line 1.</p>
    <p>Line 2.</p>

    The output HTML will be:

    <p></p>
    <p>Line 1.</p>
    <p>Line 2.</p>

    If I use double <br /> tags to create the breaks, it seems to be okay. The HTML ouput will be: <p>Line 1.<br /><br />Line 2.</p>

    I tried to “mess up” your PHP code with nl2br() in the hope to find a way to preserve the breaks, but it didn’t work. ??

    Thread Starter Gnocchi

    (@mygraphicfriend)

    Shauno, the fix that you did for the link/unlink problem has also fixed another problem that I didn’t mention before: when editing the name of a custom field, all data of that field was lost. That happened to one image custom field of my 2000 images, and I had to redo all of them at the time!! ??

    So glad that it is fixed now!

    Wow, you really are bug testing this well for me. I must admit I never really use the plugin myself so the only testing I did was very basic ??

    I will look into these new issues when I get a chance, but I am really busy at work this week, so it might not be too soon.

    Thanks again for all the awesome feedback

    Hi
    I have just had a minute to look into the new line problem you are having, but I cannot reproduce it on my side.

    I tried adding new lines to Gallery and Image custom fields, and they are preserved perfectly. I also tried adding the 2 paragraphs in <p> tags as you suggested, and they are preserved correctly too.

    The only thing I can think of, is that you are using line ending characters the plugin has not accounted for.

    What operating system are you using?

    If anyone else is having the same or similar problems, please post here with your OS details.

    Thread Starter Gnocchi

    (@mygraphicfriend)

    Hi Shauno,

    Thanks for looking into the problem. I’m using OS X (v 10.5.8) and Windows XP. In both OS, adding new lines by pressing Enter or Ctrl+Enter were not preserved. I tried with most browsers: IE, Safari, Firefox, Chrome, the problem was the same.

    I’m surprised that you didn’t encounter this problem.

    There’s also a minor problem with the class name assigned for <td> and <th> tags of the custom fields (in admin). For example: for the original field “Alt & Title Text / Description” it’s <td class="alt_title_desc column-alt_title_desc"> ( combination of 2 classes here), but for a custom field named “Artist bio”, it’d be <td class="artist bio column-artist bio"> (a combination of 4 classes here), while it should be <td class="artist_bio column-artist_bio">. Most users won’t have a problem with this, I only encountered it when I tried to set a fixed width for my custom fields’ table columns in admin.

    Thread Starter Gnocchi

    (@mygraphicfriend)

    Also, I just wanted to share a good trick when using NextGen Gallery and NextGen Custom Fields:

    As I have a large amount of pictures (over 3000) to be organized into NextGen galleries and albums, there’re a lot of data inputs to be done, so I found a way to save my time:

    Each pic has 4 custom fields: Title, Medium, Size, and Sold/Unsold (drop down). I’ve input data for all the four fields. I then needed to input the Alt & Title Text / Description fields’ data followed the formula: Title (medium, size) Sold/Unsold.

    Here’s my trick: I modify the code of manage-images.php (in /nextgen-gallery/admin/),

    replace the code: (line 426)
    <input name="alttext[<?php echo $pid ?>]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php echo stripslashes($picture->alttext) ?>" />

    with the code below:
    <input name="alttext[<?php echo $pid ?>]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php echo nggcf_get_field($pid, "title"); ?> (<?php echo nggcf_get_field($pid, "medium"); ?>, <?php echo nggcf_get_field($pid, "size"); ?>) <?php echo nggcf_get_field($pid, "sold"); ?>" />

    same thing for the text area: (line 428)
    <textarea name="description[<?php echo $pid ?>]" style="width:95%; margin-top: 2px;" rows="2" ><?php echo stripslashes($picture->description) ?></textarea>

    replaced by:
    <textarea name="description[<?php echo $pid ?>]" style="width:95%; margin-top: 2px;" rows="2" ><?php echo nggcf_get_field($pid, "title"); ?> (<?php echo nggcf_get_field($pid, "medium"); ?>, <?php echo nggcf_get_field($pid, "size"); ?>) <?php echo nggcf_get_field($pid, "sold"); ?></textarea>

    The new code helped adding the Alt & Title Text / Description fields’ data automatically after I saved the custom field’s data (and also followed the the formula: Title (medium, size) Sold/Unsold). I need to hit Save twice, in order to save the automatically added data of the the Alt & Title Text / Description.

    This trick has saved me a lot of time!

    I don’t know if I explained myself well. Just want to share the trick. If anyone has a question about this, please feel free to ask.

    Hi
    Thanks for sharing some tips that have helped you. Hopefully that helps a bunch of people using the plugin!

    The class names on the <td>s are not generated by me. As far as I remember, they are generated by NGG, when I pass it the custom fields name. I will look into it when I re-look at your new line problems though.

    Sorry I can’t help more yet

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘NextGen custom fields: ERROR when unlink a gallery to a custom field’ is closed to new replies.