Advertisement:

Author Topic: [Résolu]display all ads from a user  (Read 363 times)

grisbi

  • Jr. Member
  • **
  • Posts: 51
[Résolu]display all ads from a user
« on: July 27, 2019, 07:42:41 pm »
Hello ,

How to display all ads from a user
I saw that in a forum post and I can not find it anymore

Thank you for your help
« Last Edit: August 08, 2019, 12:19:41 pm by grisbi »

WEBmods

  • Hero Member
  • *****
  • Posts: 983
Re: display all ads from a user
« Reply #1 on: July 27, 2019, 08:15:09 pm »

grisbi

  • Jr. Member
  • **
  • Posts: 51
Re: display all ads from a user
« Reply #2 on: July 27, 2019, 11:23:54 pm »
Hi WEBmods

Thank you but I would have preferred the address of the post where I could have this function

so if someone to thank you in advance

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1682
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: display all ads from a user
« Reply #3 on: July 28, 2019, 12:43:52 am »
Add to your url  /search/user,id  if you use permalinks.

Replace Id with user's id

grisbi

  • Jr. Member
  • **
  • Posts: 51
Re: display all ads from a user
« Reply #4 on: July 28, 2019, 12:54:04 pm »
Hi
I would like to add a button in the ad to display all ads from the author of this ad

I do not quite understand how to do, I saw this post in the forum that I can not find anymore

thank you

p206ab

  • Sr. Member
  • ****
  • Posts: 344
Re: display all ads from a user
« Reply #5 on: July 29, 2019, 12:55:59 pm »
There is a plugin List all sellers item on the Market (I believe it's free) which does exactly that.

grisbi

  • Jr. Member
  • **
  • Posts: 51
Re: display all ads from a user
« Reply #6 on: August 01, 2019, 11:21:40 pm »
Hi p206ab

Yes I could take this plugin solution but I would rather have a live code that I could adapt to my situation

Thank you for your help

BritWeb

  • Hero Member
  • *****
  • Posts: 775
  • If it ain't broke, don't fix it.
Re: display all ads from a user
« Reply #7 on: August 02, 2019, 01:05:27 am »
Hi p206ab

Yes I could take this plugin solution but I would rather have a live code that I could adapt to my situation

Thank you for your help

Is the following any good for you?

Code: [Select]
<?php if( osc_item_user_id() > 0) { ?>
<span><a href="<?php echo osc_search_url(array('sUser' => osc_user_username())); ?>"><?php _e('See all ads by this user''bender'); ?></a></span>
<?php ?>


Regards

grisbi

  • Jr. Member
  • **
  • Posts: 51
Re: display all ads from a user
« Reply #8 on: August 02, 2019, 04:32:02 pm »
I copied this code into item.php and nothing is displayed

would I have forgotten something?

BritWeb

  • Hero Member
  • *****
  • Posts: 775
  • If it ain't broke, don't fix it.
Re: display all ads from a user
« Reply #9 on: August 03, 2019, 12:28:32 am »
This code works fine with 'bender' theme when applied to item-sidebar.php. This gives a link, 'See all ads by this user' and when clicked it takes to the page that lists all the ads by that user.

Regards
« Last Edit: August 03, 2019, 12:33:37 am by BritWeb »

grisbi

  • Jr. Member
  • **
  • Posts: 51
Re: display all ads from a user
« Reply #10 on: August 03, 2019, 11:37:33 am »
still nothing displayed

I copied this code into item_sidebar.php

BritWeb

  • Hero Member
  • *****
  • Posts: 775
  • If it ain't broke, don't fix it.
Re: display all ads from a user
« Reply #11 on: August 03, 2019, 12:29:05 pm »
still nothing displayed

I copied this code into item_sidebar.php

Download and rename the attached 'item-sidebar.txt' file as 'item-sidebar.php'. Upload this to your 'bender' theme folder replacing the existing 'item-sidebar.php'

Backup your original file before doing so.


Best of luck!


grisbi

  • Jr. Member
  • **
  • Posts: 51
Re: display all ads from a user
« Reply #12 on: August 03, 2019, 05:15:34 pm »
test avec ton fichier It still does not work
« Last Edit: August 03, 2019, 05:17:28 pm by grisbi »

grisbi

  • Jr. Member
  • **
  • Posts: 51
Re: display all ads from a user
« Reply #13 on: August 08, 2019, 12:18:58 pm »
I found the solution

in the file item-sidebar.php

Replace:
Code: [Select]
<?php if( osc_item_user_id() != null ) { ?>
        <p class="name"><?php _e('Name''bender'?>: <a href="<?php echo osc_user_public_profile_urlosc_item_user_id() ); ?>" ><?php echo osc_item_contact_name(); ?></a></p>
    <?php } else { ?>
        <p class="name"><?php printf(__('Name: %s''bender'), osc_item_contact_name()); ?></p>
    <?php ?>
By :
Code: [Select]
    <?php if( osc_item_user_id() != null ) { ?>
    <p class="name"><?php _e('Name''bender'?><?php echo osc_item_contact_name(); ?></a></p>
        <p class=""><a href="<?php echo osc_user_public_profile_urlosc_item_user_id() ); ?>" ><?php _e('See all ads''bender'); ?></a></p>
    <?php } else { ?>
        <p class="name"><?php printf(__('Name: %s''bender'), osc_item_contact_name()); ?></p>
    <?php ?>

it is for the theme "Bender" adapt it for your theme
« Last Edit: August 08, 2019, 12:23:17 pm by grisbi »

grisbi

  • Jr. Member
  • **
  • Posts: 51
Re: [Résolu]display all ads from a user
« Reply #14 on: August 18, 2019, 04:58:39 pm »
Unfortunately this does not work if the user is not registered

would someone have a solution?