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

oscman

  • ****
  • 227 posts
Link to user profile inside messages
« on: March 20, 2017, 08:33:46 PM »
Hello what would be the code to generate a link to user profile of the person that is messaging you inside conversations? Thanks

*

MB Themes

Re: Link to user profile inside messages
« Reply #1 on: March 20, 2017, 10:11:33 PM »
@oscman
https://doc.osclass.org/HUsers.php
osc_user_public_profile_url($id = null) - Gets user's profile url
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

oscman

  • ****
  • 227 posts
Re: Link to user profile inside messages
« Reply #2 on: March 20, 2017, 10:28:47 PM »
Yes this shows my user profile but i need it to show sender's user profile  :'(

*

MB Themes

Re: Link to user profile inside messages
« Reply #3 on: March 21, 2017, 11:49:49 AM »
@oscman
If you define user ID inside function, it should generate link of this user.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

oscman

  • ****
  • 227 posts
Re: Link to user profile inside messages
« Reply #4 on: March 21, 2017, 01:50:10 PM »
i have problem finding the sender's user id
tried with <?php echo osc_user_public_profile_url($id = $thread['i_from_user_id']); ?>
but it prints only my profile url how to generate the id of the user that sent you message and not your?

*

MB Themes

Re: Link to user profile inside messages
« Reply #5 on: March 21, 2017, 03:04:36 PM »
@oscman
It require little more of identification:
Code: [Select]
        if($t['i_from_user_id'] == osc_logged_user_id()) {
          $u_id = $t['i_to_user_id'];
        } else {
          $u_id = $t['i_from_user_id'];
        }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

oscman

  • ****
  • 227 posts
Re: Link to user profile inside messages
« Reply #6 on: March 22, 2017, 04:57:02 PM »
Thanks for taking the time!
i tried like this but it still prints my profile url

Code: [Select]
  <?php if($t['i_from_user_id'] == osc_logged_user_id()) {
          
$u_id $t['i_to_user_id'];
        } else {
          
$u_id $t['i_from_user_id'];
        } 
?>

<?php echo osc_user_public_profile_url($id $u_id); ?>

did i misunderstand something?

*

MB Themes

Re: Link to user profile inside messages
« Reply #7 on: March 22, 2017, 07:43:39 PM »
@oscman
should be osc_user_public_profile_url($u_id) instead of osc_user_public_profile_url($id = $u_id)

// not sure if it has some effect
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

oscman

  • ****
  • 227 posts
Re: Link to user profile inside messages
« Reply #8 on: March 22, 2017, 07:47:33 PM »
yep i tried like that too it was the same, users are complaining that now they can't see the user profile of the person they are speaking too.

Also in conversations instead of showing the listing id how can i show the listing title?
« Last Edit: March 22, 2017, 07:54:06 PM by oscman »

*

MB Themes

Re: Link to user profile inside messages
« Reply #9 on: March 22, 2017, 08:21:12 PM »
@oscman
If function does not work, report bug to osclass.
For other questions regarding functions how to retrieve data, I recommend to check osclass models and documentation to understand it, cannot provide support on custom development.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

oscman

  • ****
  • 227 posts
Re: Link to user profile inside messages
« Reply #10 on: March 25, 2017, 02:24:36 PM »
Ok i managed to make it work, if anyone wants to link to user profile inside messages here is the code:

in user/messages.php

changed to this code around lines 144 to 154
Code: [Select]
        <div class="im-table-row <?php if( $logged_is_owner ) { ?>im-from<?php ?>">
          <div class="im-horizontal">
            <span class="left"></span>
            <span class="right"><a href="<?php echo osc_user_public_profile_url($u_id); ?>"><img src="<?php echo ($img <> '' $img $def_img); ?>"></a></span>
          </div>

          <div class="im-line">
            <div class="im-col-12 im-name im-align-left">
                            <strong><?php if( $m['i_type'] == ) { ?> <a href="<?php echo osc_user_public_profile_url($u_id); ?>"><?php echo $thread['s_from_user_name']; ?> </a> <?php } else { ?> <a href="<?php echo osc_user_public_profile_url($u_id); ?>"> <?php echo $thread['s_to_user_name']; } ?></a></strong>
              <span class="im-identifier"><?php if( $logged_is_owner ) { ?><?php _e('you''instant_messenger'); ?><?php } else { ?><?php echo $identify_name?><?php ?></span>
            </div>

Marked as best answer by oscman on March 25, 2017, 05:04:34 PM
*

MB Themes

Re: Link to user profile inside messages
« Reply #11 on: March 25, 2017, 03:36:57 PM »
@oscman
Cool, thanks for sharing code.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots