Forum

Forum - DatingScript

Online dating software

You are not logged in.

#1 2017-08-11 09:14:16

vlad
Support staff
Registered: 2013-03-11
Posts: 2,095

Add a link to take user back to search results when viewing profiles

If you want users to be able to go back to search results after they view someone's profile, follow these steps:

1. Edit 'application/views/users/elements/picture.php' file and replace this code

<?=html_helper::anchor(isset($customURL) && $customURL ? $customURL : $user['slug'],

with this one

<?=html_helper::anchor((isset($customURL) && $customURL ? $customURL : $user['slug']).(uri::segment(1) == 'users' && uri::segment(2) == 'results' ? '?search_id=' . input::get('search_id') : ''),

2. Edit 'application/views/users/elements/profile.php' file and replace this code

<?=users_helper::anchor($user)?>

with this one

<?=users_helper::anchor((uri::segment(1) == 'users' && uri::segment(2) == 'results' ? array_merge($user, array('slug' => $user['slug'].'?search_id=' . input::get('search_id'))) : $user))?>

3. Edit 'application/views/users/view.php' file and find this code

<?=hook::action('view:users/view/actions', $user)?>

Right below it add the following

<? if ( input::get('search_id') ): ?>
	<li><?=html_helper::anchor('users/results?search_id='.input::get('search_id'), 'Back to search')?></li>
<? endif; ?>

Feel free to tweak the code further if necessary.

Offline

#2 2017-08-11 09:18:42

matrimo
Member
From: Brussels (BE) & Bacau (RO)
Registered: 2013-04-04
Posts: 1,290
Website

Re: Add a link to take user back to search results when viewing profiles

Like it. Thanks.

Offline

#3 2017-08-11 18:36:17

david0321
Member
Registered: 2013-03-11
Posts: 240
Website

Re: Add a link to take user back to search results when viewing profiles

There is no name.php in the elements folder.

Edit 'application/views/users/elements/name.php' file and replace this code

Offline

#4 2017-08-13 05:40:37

levelup
Member
Registered: 2013-06-11
Posts: 187
Website

Re: Add a link to take user back to search results when viewing profiles

nice, should be added as standard to ds package too

Offline

#5 2017-08-13 09:28:47

david0321
Member
Registered: 2013-03-11
Posts: 240
Website

Re: Add a link to take user back to search results when viewing profiles

I still don't see name.php in the elements folder.

Offline

#6 2017-08-13 10:40:56

vlad
Support staff
Registered: 2013-03-11
Posts: 2,095

Re: Add a link to take user back to search results when viewing profiles

I still don't see name.php in the elements folder.

It's profile.php

nice, should be added as standard to ds package too

Not everyone wants this feature.

Offline

#7 2017-08-17 08:37:14

littlebit
Member
Registered: 2016-02-21
Posts: 414

Re: Add a link to take user back to search results when viewing profiles

Nice extra Vlad, Thanks.

>>  nice, should be added as standard to ds package too
> Not everyone wants this feature.
Perhaps it can be added standard
and users that don't want it can easily comment-out the lines.

> 'Back to search'
Can somebody advise how to make this multi language ?

Offline

#8 2017-08-18 07:18:52

moomoocow
Member
Registered: 2014-11-20
Posts: 809

Re: Add a link to take user back to search results when viewing profiles

lovely.. Thank you Littlebit.. smile

Offline

#9 2017-08-18 07:34:38

matrimo
Member
From: Brussels (BE) & Bacau (RO)
Registered: 2013-04-04
Posts: 1,290
Website

Re: Add a link to take user back to search results when viewing profiles

To make it multilinguage, suposing you have more than one language installed,

create a new file custom.php in each of your application/language/name_of_your_laguage_folder

with this content for english language

<?php
$language = array(
	'back_to_search' => 'Back to search'	
);
?>

or this code for french

<?php
$language = array(
	'back_to_search' => 'Retour aux resultats'	
);
?>

and replace the last step of this tutorial with this code:

	<? if ( input::get('search_id') ): ?>
	<li><?=html_helper::anchor('users/results?search_id='.input::get('search_id'), __('back_to_search', 'custom'))?></li>
    <? endif; ?>

Offline

#10 2017-08-18 08:41:03

littlebit
Member
Registered: 2016-02-21
Posts: 414

Re: Add a link to take user back to search results when viewing profiles

@Matrimo
Thanks for your contribution
again I know a littlebit more about DS.

Offline

#11 2017-08-21 05:38:39

moomoocow
Member
Registered: 2014-11-20
Posts: 809

Re: Add a link to take user back to search results when viewing profiles

Thank you guys,, Excellent work..

Offline

#12 2017-10-16 02:54:41

lovecanon
Member
Registered: 2017-02-20
Posts: 10

Re: Add a link to take user back to search results when viewing profiles

I get an Internal Server Error in search results after step 1 (replacing <?=html_helper::anchor($user['slug'], with the new code). Any ideas? Thanks

Offline

#13 2017-10-16 22:07:54

littlebit
Member
Registered: 2016-02-21
Posts: 414

Re: Add a link to take user back to search results when viewing profiles

lovecanon wrote:

I get an Internal Server Error in search results after step 1 (replacing <?=html_helper::anchor($user['slug'], with the new code). Any ideas? Thanks

Drop your code here and we can check it.

Offline

#14 2017-10-27 07:37:50

lovecanon
Member
Registered: 2017-02-20
Posts: 10

Re: Add a link to take user back to search results when viewing profiles

sorry for the late reply. Following is the code;

    <div class="image size size_<?=$picture_file_suffix?>">
        <?=html_helper::anchor($user['slug'].(uri::segment(1) == 'users' && uri::segment(2) == 'results' ? '?search_id=' . input::get('search_id') : ''), ' ', $attr)?>

        <? if ( !isset($invisible) || !$invisible ): ?>

Offline

#15 2017-12-02 22:56:45

rdog
Member
Registered: 2016-02-20
Posts: 431

Re: Add a link to take user back to search results when viewing profiles

it should be this

    <div class="image">
        <?=html_helper::anchor($user['slug'].(uri::segment(1) == 'users' && uri::segment(2) == 'results' ? '?search_id=' . input::get('search_id') : ''), html_helper::image($picturePath ? $picturePath : $pictureNone.($user['picture_file_suffix'] ? '_'.$user['picture_file_suffix'] : '').'.'.$pictureNoneExt, array('alt' => $name, 'width' => config::item('picture_dimensions_'.$user['picture_file_suffix'].'_width', 'users'), 'height' => config::item('picture_dimensions_'.$user['picture_file_suffix'].'_height', 'users'))), $attr)?>

        <? if ( !isset($user['invisible']) || !$user['invisible'] ): ?>

Offline

#16 2017-12-20 12:18:19

Marcio
Member
From: Brazil
Registered: 2013-04-11
Posts: 495

Re: Add a link to take user back to search results when viewing profiles

Does not work very well because always backs to the first page of results. Should have an option to work with infinite scroll, as well.

Last edited by Marcio (2017-12-20 12:20:09)

Offline

#17 2018-01-04 04:22:13

Interactive007
Member
From: Chiang Mai, Thailand
Registered: 2017-03-16
Posts: 16
Website

Re: Add a link to take user back to search results when viewing profiles

Done as told above but not working. I get no errors but see nowhere the back to the results button. I clear the cache folder and browser and still not see the back to the results link.

Any idea where to look more to get it visible?

Offline

#18 2018-06-19 00:38:08

samirosanna
Member
From: italia
Registered: 2018-04-05
Posts: 244

Re: Add a link to take user back to search results when viewing profiles

not work in datingscript 1.30 please fix thank you

Offline

#19 2018-06-19 09:12:39

vlad
Support staff
Registered: 2013-03-11
Posts: 2,095

Re: Add a link to take user back to search results when viewing profiles

Updated for v1.3.0

Offline

#20 2018-06-19 15:44:26

samirosanna
Member
From: italia
Registered: 2018-04-05
Posts: 244

Re: Add a link to take user back to search results when viewing profiles

There is a problem this works only for users without photos, and others who have the photo does not work

1.jpg

with foto
2.jpg

Offline

#21 2019-03-26 03:15:28

samirosanna
Member
From: italia
Registered: 2018-04-05
Posts: 244

Re: Add a link to take user back to search results when viewing profiles

vlad wrote:

If you want users to be able to go back to search results after they view someone's profile, follow these steps:

1. Edit 'application/views/users/elements/picture.php' file and replace this code

<?=html_helper::anchor(isset($customURL) && $customURL ? $customURL : $user['slug'],

with this one

<?=html_helper::anchor((isset($customURL) && $customURL ? $customURL : $user['slug']).(uri::segment(1) == 'users' && uri::segment(2) == 'results' ? '?search_id=' . input::get('search_id') : ''),

2. Edit 'application/views/users/elements/profile.php' file and replace this code

<?=users_helper::anchor($user)?>

with this one

<?=users_helper::anchor((uri::segment(1) == 'users' && uri::segment(2) == 'results' ? array_merge($user, array('slug' => $user['slug'].'?search_id=' . input::get('search_id'))) : $user))?>

3. Edit 'application/views/users/view.php' file and find this code

<?=hook::action('view:users/view/actions', $user)?>

Right below it add the following

<? if ( input::get('search_id') ): ?>
	<li><?=html_helper::anchor('users/results?search_id='.input::get('search_id'), 'Back to search')?></li>
<? endif; ?>

Feel free to tweak the code further if necessary.



in version 1.3.2 the path application / views / users / view.php and different from 1.3.0 I can't find the code <?=hook::action('view:users/view/actions', $user)?>

Offline

#22 2019-03-27 01:27:50

djpro
Member
Registered: 2017-01-10
Posts: 48

Re: Add a link to take user back to search results when viewing profiles

Why not carry over the search results to the profile view page so that the user can continue browsing through the search results there without having to click a button to go back to the search results page? especially if lazy load is being used, the user will be jumped back to the begin of the search results and would have to scroll all the way down to get to the exact spot they were at in the search results.

Offline

#23 2019-09-28 22:27:13

radioact
Staff
Registered: 2013-05-26
Posts: 190

Re: Add a link to take user back to search results when viewing profiles

samirosanna wrote:

in version 1.3.2 the path application / views / users / view.php and different from 1.3.0 I can't find the code <?=hook::action('view:users/view/actions', $user)?>

It is back again

Offline

#24 2019-09-28 22:38:26

radioact
Staff
Registered: 2013-05-26
Posts: 190

Re: Add a link to take user back to search results when viewing profiles

Nice option, I am adding it to next release.

Offline

#25 2019-10-13 18:28:17

littlebit
Member
Registered: 2016-02-21
Posts: 414

Re: Add a link to take user back to search results when viewing profiles

radioact wrote:

Nice option, I am adding it to next release.

*)
This comment is from sept. 2019
The option is not yet available in the recent v1.4.0

*)
In the start-topic Vlad indicates
> 1. Edit 'application/views/users/elements/picture.php' file and replace this code
> <?=html_helper::anchor(isset($customURL) && $customURL ? $customURL : $user['slug'

But in v1.4.0 .... I find that code 3 times in that file.
Should I only replace the first code-line ?

Last edited by littlebit (2019-10-13 18:28:51)

Offline

Board footer