Title: User Submitted Posts Plugin
Last modified: August 20, 2016

---

# User Submitted Posts Plugin

 *  Resolved [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/)
 * Hello Im using the User Submitted Posts plugin to all users to post to the front
   page.
 * I use the code below in my content.php to get the pictures to appear too. Its
   all find when the users submit a photo.
 * Problem is when the users don’t add a photo, there is a dead link that appears.(
   you can see this happening here: [http://www.breakuppedia.com](http://www.breakuppedia.com))
   Do help me if you can.
 * Thank you so much!
 * <?php global $wpdb;
    $query = “SELECT `ID`, `guid` FROM `$wpdb->posts` WHERE `
   post_type` = ‘attachment’ AND `post_parent` = ‘{$post->ID}'”; $adimages = $wpdb-
   >get_results($wpdb->prepare($query), OBJECT); // To display the first image..?
   >
 * <img style=”float: left; height: 380px;border: 2px solid #464646;” src=”<?php
   if(is_public_submission()){echo $adimages[0]->guid;} ?>” />

Viewing 15 replies - 1 through 15 (of 40 total)

1 [2](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/?output_format=md)

 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144508)
 * I think it may just be getting the border,
 * border: 2px solid #464646
 * if you can do without it try removing it.
 * if you need it, you may try adding it in your style.css with the appropriate 
   body class, that way it doesn’t get called untill there’s an image.
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144510)
 * thanks for your help deepbevel.
 * I removed border: 2px solid #464646
 * but the dead link is still there. Just without a border. 🙁
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144518)
 * you probably need to mod your code with a condition added to “if is public submisission-
   echo addimages”, it may need to be followed by an “else return” or something.
   I’m not sure how to write it though, I’d have to mess with it.
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144520)
 * It looks different in firefox, not sure but I think it looks how it should.
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144523)
 * yeah man!!
    damn. There’s no deadlink in firefox!
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144524)
 * haha, Any solutions to make the site load like it does on firefox?
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144526)
 * that I have no experience with, and no clue. You’d probably have to know what
   it is that ie is not doing right.. might be easier to mod the condition so nothing
   renders if no image.
 * if_is_public_submission (and if an image exitsts!) bla bla bla
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144527)
 * this might provide a clue, they are talking about if-no-image conditionals.
 * [http://wordpress.org/support/topic/displaying-standard-imagecustom-field-image-if-no-image-excists?replies=7](http://wordpress.org/support/topic/displaying-standard-imagecustom-field-image-if-no-image-excists?replies=7)
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144529)
 * I’d try something like this, but of course it’s not tested and I’d be shocked
   if it worked as is.
 *     ```
       <?php global $wpdb;
        $query = "SELECT ID, guid FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = '{$post->ID}'";
   
       if ($attachments) {
   
        $adimages = $wpdb->get_results($wpdb->prepare($query), OBJECT);
        // To display the first image.. ?>
   
       <img style="float: left; height: 380px;border: 2px solid #464646;" src="<?php if(is_public_submission()){echo $adimages[0]->guid;} ?>" />
       <?php }
       ?>
       ```
   
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144532)
 * Unfortunately, the images don’t appear at all.
    hmmm
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144533)
 * do my eyes deceive me..? is it fixed? no way my code worked, no way.
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144535)
 * hmmmm, maybe need to get the post id in the condtional?
 *     ```
       if ($attachments) {
   
       if (post_parent = '{$post->ID}'){
   
       bla bla bla
   
       <?php } }?>
       ```
   
 * but again, I realy doubt i’m writing it correctly. It would be great if coder
   would jump in here right about now.
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144536)
 * ha no. I don’t think its working.
    It just stopped displaying all images.
 * even the posts that have images aren’t displaying.
 *  [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * (@deepbevel)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144538)
 * I’m just happy it didn’t brake your page, at least my syntax must be right. maybe
   try it with the id. Could be it’s needed to get the images that do exist.
 *  Thread Starter [breakuppedia](https://wordpress.org/support/users/breakuppedia/)
 * (@breakuppedia)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/#post-3144539)
 * haha now the whole site’s not loading.
    only the header’s left. This is the current
   code i have on
 *     ```
       <?php global $wpdb;
            $query = "SELECT 'ID', 'guid' FROM '$wpdb->posts' WHERE 'post_type' = 'attachment' AND post_parent = '{$post->ID}'";
   
       if ($attachments) {
       if (post_parent = '{$post->ID}'){
        $adimages = $wpdb->get_results($wpdb->prepare($query), OBJECT);
        // To display the first image.. ?>
   
       <img style="float: left; height: 380px;border: 2px solid #464646;" src="<?php if(is_public_submission()){echo $adimages[0]->guid;} ?>" />
       <?php }
       ?>
       ```
   

Viewing 15 replies - 1 through 15 (of 40 total)

1 [2](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/2/?output_format=md)

The topic ‘User Submitted Posts Plugin’ is closed to new replies.

## Tags

 * [Coding](https://wordpress.org/support/topic-tag/coding/)
 * [Pictures](https://wordpress.org/support/topic-tag/pictures/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 40 replies
 * 2 participants
 * Last reply from: [deepbevel](https://wordpress.org/support/users/deepbevel/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/user-submitted-posts-plugin/page/3/#post-3144579)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
