1

I am using Osclass v 3.5.3 and I am having trouble displaying seller's name (to display their name as a link to their public profile). The last thing I have tried is the following code:

 <?php if( osc_item_user_id() != null ) { ?>
                        <a href="<?php echo osc_user_public_profile_url( osc_item_user_id() ); ?>" ><?php echo osc_item_contact_name(); ?></a>
                    <?php } else { ?>
                        <?php printf(__('%s', 'aiclassy'), osc_item_contact_name()); ?>
                    <?php } ?>

I have tried different variations and realized that osc_item_contact_name() is the problem. When I take it out of the code, link to the profile shows, but I need it to be in a form of their name. I've searched everywhere and am currently out of luck. Can anyone help me resolve this? I would be very grateful. Thank you.

Nancy
  • 504
  • 2
  • 6
  • 21

1 Answers1

0

After many hours of searching and researching and posting question here, I have managed to resolve this myself. The problem wasn't where I thought it was. The correct code which helped me do this is as follows:

 <?php if( osc_user_name() != null ) { ?>
                        <a href="<?php echo osc_user_public_profile_url( osc_item_user_id() ); ?>" ><?php echo osc_user_name(); ?></a>
                    <?php } else { ?>
                        <?php printf(__('%s', 'aiclassy'), osc_user_name()); ?>
                    <?php } ?>

Instead of checking if osc_item_user_id wasn't null, like this

<?php if( osc_item_user_id() != null ) { ?>

I checked if osc_user_name() wasn't null and then put it in link like this

 <?php if( osc_user_name() != null ) { ?>
                        <a href="<?php echo osc_user_public_profile_url( osc_item_user_id() ); ?>" ><?php echo osc_user_name(); ?></a>
<?php } else { ?>
                        <?php printf(__('%s', 'aiclassy'), osc_user_name()); ?>

And it worked like a charm. I really hope this helps someone if in similar trouble. Cheers!

Nancy
  • 504
  • 2
  • 6
  • 21