This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

ishan

  • ****
  • 126 posts
How to display specific user listing on home page?
« on: November 26, 2019, 06:45:15 AM »
Please help me how to display particular user listings on home page?

i want to show user 5 all listings on home page so how to do ?

*

MB Themes

  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

ishan

  • ****
  • 126 posts
Re: How to display specific user listing on home page?
« Reply #2 on: November 26, 2019, 03:01:05 PM »
Hello i used your code for author but its not working


<?php osc_query_item("author=demo");
if( osc_count_custom_items() == 0) { ?>
    <p class="empty"><?php _e('No Listings', 'modern') ; ?></p>
<?php } else { ?>
    <table border="0" cellspacing="0">
         <tbody>
            <?php $class = "even"; ?>
            <?php while ( osc_has_custom_items() ) { ?>
             <tr class="<?php echo $class. (osc_item_is_premium()?" premium":"") ; ?>">
                    <?php if( osc_images_enabled_at_items() ) { ?>
                     <td class="photo">
                        <?php if( osc_count_item_resources() ) { ?>
                            <a href="<?php echo osc_item_url() ; ?>">
                                <img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="75" height="56" title="<?php echo osc_item_title(); ?>" alt="<?php echo osc_item_title(); ?>" />
                            </a>
                        <?php } else { ?>
                            <img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="" title=""/>
                        <?php } ?>
                     </td>
                    <?php } ?>
                     <td class="text">
                         <h3><a href="<?php echo osc_item_url() ; ?>"><?php echo osc_item_title() ; ?></a></h3>
                         <p><strong><?php if( osc_price_enabled_at_items() ) { echo osc_item_formated_price() ; ?> - <?php } echo osc_item_city(); ?> (<?php echo osc_item_region();?>) - <?php echo osc_format_date(osc_item_pub_date()); ?></strong></p>
                         <p><?php echo osc_highlight( strip_tags( osc_item_description() ) ) ; ?></p>
                     </td>                                       
                 </tr>
                <?php $class = ($class == 'even') ? 'odd' : 'even' ; ?>
            <?php } ?>
        </tbody>
    </table>
<?php }; ?>

*

MB Themes

Re: How to display specific user listing on home page?
« Reply #3 on: November 26, 2019, 06:12:12 PM »
Code looks ok, just first line may need updates.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

ishan

  • ****
  • 126 posts
Re: How to display specific user listing on home page?
« Reply #4 on: November 27, 2019, 06:28:39 AM »
Please tell me what link i need to update? which code will put therE?

*

MB Themes

Re: How to display specific user listing on home page?
« Reply #5 on: November 27, 2019, 03:12:40 PM »
Test different parameters of osc_query_item function
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

ishan

  • ****
  • 126 posts
Re: How to display specific user listing on home page?
« Reply #6 on: November 28, 2019, 07:11:22 AM »
i tried all but those are not working for particular user.

i want to show only 1 user ads on home page

Marked as best answer by ishan on December 01, 2019, 07:29:38 AM
*

MB Themes

Re: How to display specific user listing on home page?
« Reply #7 on: November 30, 2019, 09:08:18 AM »
Usually people do not try anything if they tried all combinations.

osc_query_item(array('author' => user_id / username));

If does not work (that usually do), you must create your own function.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

ishan

  • ****
  • 126 posts
Re: How to display specific user listing on home page?
« Reply #8 on: December 01, 2019, 07:30:12 AM »
thanks its working with username... You are best


<?php osc_query_item(array('author' => "username"));
if( osc_count_custom_items() == 0) { ?>
    <p class="empty"><?php _e('No Listings', 'modern') ; ?></p>
<?php } else { ?>
    <table border="0" cellspacing="0">
         <tbody>
            <?php $class = "even"; ?>
            <?php while ( osc_has_custom_items() ) { ?>
             <tr class="<?php echo $class. (osc_item_is_premium()?" premium":"") ; ?>">
                    <?php if( osc_images_enabled_at_items() ) { ?>
                     <td class="photo">
                        <?php if( osc_count_item_resources() ) { ?>
                            <a href="<?php echo osc_item_url() ; ?>">
                                <img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="75" height="56" title="<?php echo osc_item_title(); ?>" alt="<?php echo osc_item_title(); ?>" />
                            </a>
                        <?php } else { ?>
                            <img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="" title=""/>
                        <?php } ?>
                     </td>
                    <?php } ?>
                     <td class="text">
                         <h3><a href="<?php echo osc_item_url() ; ?>"><?php echo osc_item_title() ; ?></a></h3>
                         <p><strong><?php if( osc_price_enabled_at_items() ) { echo osc_item_formated_price() ; ?> - <?php } echo osc_item_city(); ?> (<?php echo osc_item_region();?>) - <?php echo osc_format_date(osc_item_pub_date()); ?></strong></p>
                         <p><?php echo osc_highlight( strip_tags( osc_item_description() ) ) ; ?></p>
                     </td>                                       
                 </tr>
                <?php $class = ($class == 'even') ? 'odd' : 'even' ; ?>
            <?php } ?>
        </tbody>
    </table>
<?php }; ?>