Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    New Pligger Jonase's Avatar
    Joined
    Dec 2009
    Posts
    20

    Question Send Private Message directly from user profile

    Hello,

    I have received great help from the forum before and I've now gotten stuck again with a problem I can't seem to solve myself, hopefully somebody could point me in the right direction.

    I would like to add a link to private message the user who's profile you're currently viewing. Instead of only having a private message icon at the "users you're following page", I would also like to have such a private message link directly on a users profile.

    In code the statement "myfriend" is used to refer to a friend of the user on the "users you're following page", but I can't figure out what statement is used to refer to the user who's profile you're viewing.

    I have copied the following code from user_center.tpl and inserted it at the top of the same file:

    Code:
    {foreach from=$friends item=myfriend}
    			{php}
    				$this->_vars['friend_avatar'] = get_avatar('small', $this->_vars['myfriend']['user_avatar_source'], $this->_vars['myfriend']['user_login'], $this->_vars['myfriend']['user_email']);	
    			{/php}
    		  	<tr>
    			<td><a href="{$my_pligg_base}/module.php?module=simple_messaging&view=compose&to={$myfriend.user_login}&return={$templatelite.server.REQUEST_URI|urlencode}"><img src="{$my_pligg_base}/templates/{$the_template}/images/user_message.png" border="0"></a></td>
    			</tr>
    		{/foreach}
    		</table>
    Although the above code inserts a link to private message a user when I insert it at the top of user_center.tpl. But when clicking the link you're not taken to private message the user who's profile you're looking at, it instead directs you to send a private message to a friend of the user who's profile you're looking at.
    I understand that this is due to the "$friends item=myfriend" statement at the beginning of the code I've posted and the others references to "myfriend" in the code, but I don't know what to replace them with to indicate the user who's profile you're currently looking at. So my question is what line of code instead of "myfriend" could I use to refer to the user who's profile you're looking at?

    Thanks very much for taking your time and helping me!

    Best regards, Jonas

  2. #2
    Pligg Developer chuckroast's Avatar
    Joined
    Jun 2006
    Posts
    5,478
    You would need to use something like this
    Code:
    <a href="{$my_pligg_base}/module.php?module=simple_messaging&view=compose&to={$user_username}">Send message to this user</a>

  3. #3
    New Pligger Jonase's Avatar
    Joined
    Dec 2009
    Posts
    20

    Thank You!

    Chuckroast, thank you very much! That was exactly what I was looking for!
    As a small thank you I just made a small donation on your website.

    I added some small changes to the code so users wouldn't see the link on their own profile and when a message is submitted you're returned to the user profile. In case it would be useful to anyone else trying to do something similar, here is the code from Chuckroast with my small addons:

    Code:
    {if $is_friend gt 0}
    			<a href="{$my_pligg_base}/module.php?module=simple_messaging&view=compose&return={$templatelite.server.REQUEST_URI|urlencode}&to={$user_username}">Send message to this user</a>
    			 {/if}

    Thanks again Chuckroast, I appreciate your help and wish you a nice evening.

    Best regards, Jonas

  4. #4
    Constant Pligger anudeepkanwar's Avatar
    Joined
    Sep 2009
    Posts
    103
    Thanks to both of you .Now it;s easy to send message.

  5. #5
    Constant Pligger anudeepkanwar's Avatar
    Joined
    Sep 2009
    Posts
    103
    I have place Chuckroast code only then it shows send message in profile , i have send message to user after submitting it shows blank page .
    Then i use
    {if $is_friend gt 0}
    <a href="{$my_pligg_base}/module.php?module=simple_messaging&view=compose&re turn={$templatelite.server.REQUEST_URI|urlencode}& to={$user_username}">Send message to this user</a>
    {/if}
    This code it doesn;t show send message in profile and i have remove both and when i check sent messages in my inbox it shows error 2 and i have check from another user , faked one and on his profile sent messages is working fine but not on mine profile .....

    i have delete that user to whom i have send message like that and delete it from phpmyadmin also , still sent message not working

  6. #6
    Constant Pligger anudeepkanwar's Avatar
    Joined
    Sep 2009
    Posts
    103
    Please reply anyone ....
    Thanks in advance

  7. #7
    New Pligger Jonase's Avatar
    Joined
    Dec 2009
    Posts
    20
    Quote Originally Posted by anudeepkanwar View Post
    I have place Chuckroast code only then it shows send message in profile , i have send message to user after submitting it shows blank page .
    Then i use
    This code it doesn;t show send message in profile and i have remove both and when i check sent messages in my inbox it shows error 2 and i have check from another user , faked one and on his profile sent messages is working fine but not on mine profile .....

    i have delete that user to whom i have send message like that and delete it from phpmyadmin also , still sent message not working
    Anudeepkanwar; In order to see the send message icon in the profile with the small addons I made to the code by Chuckroast, you must first be friend with the user who's profile you're viewing. If you're not friend with the user of the profile you're viewing the send message icon won't be visible with the addon code I provided. Try adding as a friend the user who's profile you're viewing, then it should work.
    Hope this solves it for you!

    Best regards, Jonas

  8. #8
    Constant Pligger anudeepkanwar's Avatar
    Joined
    Sep 2009
    Posts
    103
    Ya now i understood , my sent messages is not working , like there is option we can check our sent messages , after i have sent messages by using chuckroast code , i am not able to check my sent messages . it showing error 2 and but i have check from another account ,there i am able to see that user sent messages

  9. #9
    New Pligger Jonase's Avatar
    Joined
    Dec 2009
    Posts
    20
    Quote Originally Posted by anudeepkanwar View Post
    Ya now i understood , my sent messages is not working , like there is option we can check our sent messages , after i have sent messages by using chuckroast code , i am not able to check my sent messages . it showing error 2 and but i have check from another account ,there i am able to see that user sent messages
    Checking sent messages is working fine for me with the code, so its must be a problem specific to your installation. If you have made any modifications to the Simple Messaging Module try undoing them and see if the problem persists. Otherwise you could download the latest version of Pligg and not upload the whole Pligg package to your server but only the folder with the Simple messaging module. That way any errors should probably go away.

  10. #10
    Constant Pligger anudeepkanwar's Avatar
    Joined
    Sep 2009
    Posts
    103
    no i have make new account in my site and have check that account sent messages working fine for that user just not working for my account .

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 09-14-2008, 12:54 PM
  2. How to remove "javascript" and link directly to user profile
    By xmlham in forum Questions & Comments
    Replies: 3
    Last Post: 05-17-2008, 09:46 AM
  3. Send Welcome Private Message & Private Messaging problem
    By aurem in forum Questions & Comments
    Replies: 0
    Last Post: 06-12-2007, 08:40 AM
  4. [Fixed] Send a Message - clicking on send a message to friend broken?
    By TrailofDead in forum Questions & Comments
    Replies: 2
    Last Post: 03-12-2007, 06:23 PM
  5. send god(user) a message is error
    By iweb in forum Questions & Comments
    Replies: 1
    Last Post: 03-18-2006, 07:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Donate to Pligg CMS Dreamhost Web Hosting Host Gator Web Hosting