Advertisement:

Author Topic: Search in public profile  (Read 3681 times)

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Search in public profile
« Reply #15 on: November 24, 2017, 09:20:52 am »
2. Make Teseo's mod . That will fix it.

1. I'll put a button near the text from search that says that you are viewing results from a user's items.

Note. To seach with filters etc, the search page is needed.
I leave this mod , to put results in user-public-profile to other more experienced users (or the search page can be modified to copy user-public-profile when the results shown are from one user).

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Search in public profile
« Reply #16 on: November 24, 2017, 12:36:25 pm »

EDITED AGAIN to resolve some php warnings when user changes the url by hand

EDITED to work also for search pattern "user,"
This will show if the search is made by one or more users and the link to eliminate the user/users from the search

Edit search.php from Bender:

Put

Code: [Select]
<?php osc_current_web_theme_path('header.php') ; ?>
     <div class="list-header">
        <div class="resp-wrapper">
<?php 
if(strpos($_SERVER['REQUEST_URI'], '/user,') !== false)
{
echo '<h5 style="margin-top: -25px;">Results from profile:';
$uri $_SERVER['REQUEST_URI'];
$poz strpos($uri'/user,');
$rest substr($uri, ($poz+6)  );
$beguri=substr($uri,0,$poz);


preg_match('/\d+/'$rest$matches);
if(!empty($matches)) if(!is_array($matches[0])) {
$usr User::newInstance()->findByPrimaryKey($matches[0]);
echo ' <a href="'.osc_user_public_profile_url($matches[0]).'">' $usr['s_name'] . '</a>';
$rest=substr($rest,strlen($matches[0]));
}
while(strpos($rest,",")===0)
{
$rest=substr($rest,1);

preg_match('/\d+/'$rest$matches);

if(!empty($matches)) if(!is_array($matches[0]))
{ $usr User::newInstance()->findByPrimaryKey($matches[0]);
        echo ', <a href="'.osc_user_public_profile_url($matches[0]).'">' $usr['s_name'] . '</a>';

$rest substr($rest strlen($matches[0]));
}
}


$searchwithoutusersuri $beguri  $rest;
echo '. | <a style="" href="'.$searchwithoutusersuri.'">Eliminate</a> </h5> ';
}
?>

            <?php osc_run_hook('search_ads_listing_top'); ?>

instead of

Code: [Select]
<?php osc_current_web_theme_path('header.php') ; ?>
     <div class="list-header">
        <div class="resp-wrapper">
            <?php osc_run_hook('search_ads_listing_top'); ?>

For Modern:
edit search.php (the original file from modern)

Put:

Code: [Select]
            <div id="main">
<?php 
if(strpos($_SERVER['REQUEST_URI'], '/user,') !== false)
{
echo '<h5 style="margin-top: -25px;">Results from profile:';
$uri $_SERVER['REQUEST_URI'];
$poz strpos($uri'/user,');
$rest substr($uri, ($poz+6)  );
$beguri=substr($uri,0,$poz);


preg_match('/\d+/'$rest$matches);
        if(!empty(
$matches)) if(!is_array($matches[0])) {
$usr User::newInstance()->findByPrimaryKey($matches[0]);
echo ' <a href="'.osc_user_public_profile_url($matches[0]).'">' $usr['s_name'] . '</a>';
$rest=substr($rest,strlen($matches[0]));
}
while(strpos($rest,",")===0)
{
$rest=substr($rest,1);

preg_match('/\d+/'$rest$matches);

if(!empty($matches)) if(!is_array($matches[0]))
{ $usr User::newInstance()->findByPrimaryKey($matches[0]);
        echo ', <a href="'.osc_user_public_profile_url($matches[0]).'">' $usr['s_name'] . '</a>';

$rest substr($rest strlen($matches[0]));
}
}


$searchwithoutusersuri $beguri  $rest;
echo '. | <a style="" href="'.$searchwithoutusersuri.'">Eliminate</a> </h5> ';
}
?>

instead of

Code: [Select]
            <div id="main">

These mods together with Teseo's mod mentioned earlier and the other mods from user-public-profile should work.
You may need to adjust the styling to fit your themes, in mobile view and destktop view.
« Last Edit: November 26, 2017, 10:53:56 pm by marius-ciclistu »

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Search in public profile
« Reply #17 on: November 25, 2017, 10:08:01 pm »
Thank you marius

1 - This is good but it confuses the users, can you marius please help me to see the result in user-public-profile.php? i don't need to search with filters.

2 - what is Teseo's mod? please explain what that is and how to fix pagination problem with that. thanks.

Thanks

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Search in public profile
« Reply #18 on: November 25, 2017, 11:04:19 pm »
2.
https://forums.osclass.org/development/admin-items-filter-by-email-not-showing-pagination-modern-theme-3-7-1/msg157903/#msg157903

1. The search page can de modified(sidebar hidden + header from user public profile added) if the word /user, is in url.

You can do it your self. I don't have modern installed.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Search in public profile
« Reply #19 on: November 26, 2017, 02:47:09 am »
2.
https://forums.osclass.org/development/admin-items-filter-by-email-not-showing-pagination-modern-theme-3-7-1/msg157903/#msg157903

1. The search page can de modified(sidebar hidden + header from user public profile added) if the word /user, is in url.

You can do it your self. I don't have modern installed.

Thank you very much marius for helping
the reason that i want to show the result in user-public-profile.php is because users confuse and they don't know how to reset and search in all website again. please help me to finish this by showing the results in user-public-profile.php. if you don't have the modern theme i can attach it here.
thanks

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Search in public profile
« Reply #20 on: November 26, 2017, 11:20:47 am »
In my last mod there is a link "eliminate" for searching in all site.
I have no idea how to move the search results in public user profile.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Search in public profile
« Reply #21 on: November 26, 2017, 10:55:09 pm »
I noticed some php warnings when the url is manually changed. I've modified the solution to deal with them.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Search in public profile
« Reply #22 on: December 11, 2017, 12:58:14 pm »
Hi. I noticed an issue with my solution.

If the page viewed in user-public-profile.php is 2 or more, the page is auto added to the url of the search. Any Idea how the search page is getting that parameter?

EDIT
The problem is solved when using:

Code: [Select]
    var uriuisearch="/search/pattern," + uisearch + "/user," + <?php echo osc_user_id();?> ;
    window.location=<?php echo '"'; echo (isset($_SERVER['HTTPS']) ? 'https' 'http') . "://" $_SERVER['HTTP_HOST']; echo '"';?> + uriuisearch;

Instead of

Code: [Select]
    var uriuisearch="/search/pattern," + uisearch + "/user," + <?php echo osc_user_id();?> ;
    window.location.pathname=uriuisearch;
« Last Edit: December 11, 2017, 01:28:17 pm by marius-ciclistu »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Search in public profile
« Reply #23 on: January 05, 2018, 12:28:05 am »
SOLUTION regardless of the permalinks enabled or not

1.For the solution to work in search page for searching in multiple user's profiles( Username and/or user id),

replace (from my solutions above) in search.php

Code: [Select]
if(strpos($_SERVER['REQUEST_URI'], '/user,') !== false)
{
echo '<h5 style="margin-top: -25px;">Results from profile:';
$uri = $_SERVER['REQUEST_URI'];
$poz = strpos($uri, '/user,');
$rest = substr($uri, ($poz+6)  );
$beguri=substr($uri,0,$poz);


preg_match('/\d+/', $rest, $matches);
if(!empty($matches)) if(!is_array($matches[0])) {
$usr = User::newInstance()->findByPrimaryKey($matches[0]);
echo ' <a href="'.osc_user_public_profile_url($matches[0]).'">' . $usr['s_name'] . '</a>';
$rest=substr($rest,strlen($matches[0]));
}
while(strpos($rest,",")===0)
{
$rest=substr($rest,1);

preg_match('/\d+/', $rest, $matches);

if(!empty($matches)) if(!is_array($matches[0]))
{ $usr = User::newInstance()->findByPrimaryKey($matches[0]);
        echo ', <a href="'.osc_user_public_profile_url($matches[0]).'">' . $usr['s_name'] . '</a>';

$rest = substr($rest , strlen($matches[0]));
}
}


$searchwithoutusersuri = $beguri  . $rest;
echo '. | <a style="" href="'.$searchwithoutusersuri.'">Eliminate</a> </h5> ';
}



with

Code: [Select]
$usrs=Params::getParam('sUser');
if($usrs){
$users=explode(",", $usrs);
echo '<h4> Results from ';
    foreach($users as $u){
        if(is_numeric($u)) $user = User::newInstance()->findByPrimaryKey($u); else $user = User::newInstance()->findByUsername($u);
        echo ' <a href="'.osc_user_public_profile_url($user['pk_i_id']).'">' . $user['s_name'] . '</a>';
    }
$request=Params::getParamsAsArray();
unset($request['sUser']);
echo ': <a style="text-decoration:none;margin-left:20px;" href="'.osc_search_url($request).'" title="Show results from all users"> &#10006; </a> </h4> ';
}

2.
and in user-items.php

Code: [Select]
    var uriuisearch=<?php echo '"'; echo (isset($_SERVER['HTTPS']) ? 'https' 'http') . "://" $_SERVER['HTTP_HOST']; echo '"';?> + "/bazar/search/pattern," + uisearch + "/user," + <?php echo osc_user_id();?> ;

with

Code: [Select]
    var uriuisearch=<?php echo '"'; echo (isset($_SERVER['HTTPS']) ? 'https' 'http') . "://" $_SERVER['HTTP_HOST']; echo '"';?> + "/index.php?page=search&sPattern=" + uisearch + "&sUser=" + <?php echo osc_user_id();?> ;

3.
and in user-public-profile.php

replace

Code: [Select]
    var uriuisearch="/search/pattern," + uisearch + "/user," + <?php echo osc_user_id();?> ;

with

Code: [Select]
    var uriuisearch="/index.php?page=search&sPattern=" + uisearch + "&sUser=" + <?php echo osc_user_id();?> ;
« Last Edit: January 05, 2018, 01:14:13 am by marius-ciclistu »

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Search in public profile
« Reply #24 on: January 08, 2018, 04:31:39 am »
SOLUTION regardless of the permalinks enabled or not

1.For the solution to work in search page for searching in multiple user's profiles( Username and/or user id),


Please post for modern theme too,
Thanks

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Search in public profile
« Reply #25 on: January 08, 2018, 09:34:08 am »
Look in those files and replace what I wrote above.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Search in public profile
« Reply #26 on: June 22, 2018, 11:01:59 pm »
Look in those files and replace what I wrote above.

@marius-ciclistu
Marius can you please help to search just in public profile page? not in search.php (Modern theme)

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Search in public profile
« Reply #27 on: June 22, 2018, 11:22:05 pm »
I did not made that solution, so no.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: Search in public profile
« Reply #28 on: June 23, 2018, 05:04:25 am »
I did not made that solution, so no.

lets work and make this happen.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Search in public profile
« Reply #29 on: June 23, 2018, 09:31:40 am »
:) I won't do this.