Display ad image in user account manager

From OSClass

If you'd like to display a photo for each ad item listed in the User Account Manager, this customization will show you how.


Here is an example screen-shot of what this customization will do:

Useritemimage screen.jpg


How to do it

There are several pages within the user account manager where this customization would be applicable, but for this example, we'll edit user-items.php, located within the theme folder.

First, located this code within user-items.php:

                            <?php while(osc_has_items()) { ?>
                                <div class="item" >
                                    <h3>


Then, add this code immediately below it:

			<?php if( osc_images_enabled_at_items() ) { ?>
                            <?php if( osc_count_item_resources() > 0 ) { ?>
                                <?php for ( $i = 0; osc_has_item_resources() ; $i++ ) { ?>
                                <a href="<?php echo osc_resource_url(); ?>" rel="image_group">
                                    <?php if( $i == 0 ) { ?>
                                        <img src="<?php echo osc_resource_thumbnail_url(); ?>" width="75" alt="" title=""/>
                                    <?php } ?>
                                </a>
                                <?php } ?>
                            <?php } else { ?>
				<img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="" title=""/>
			    <?php } ?>
                        <?php } ?>



Lastly, to display the image to the left of the item title & information, add these two lines to your theme's style.css file in the appropriate locations:


This one:

.user_account img { float:left; padding-right:5px; }


(optional) And this one (this will insert a horizontal separator line between each item, such as shown in the example image above)

.user_account #main .item { border-bottom:1px dotted #DDD;}



Notes and references

  1. See this OSClass.org forum topic


--Jesse 11:35, 4 January 2012 (CET)