Closed (fixed)
Project:
Privatemsg
Version:
6.x-1.0-rc3
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Aug 2009 at 11:57 UTC
Updated:
6 Sep 2009 at 13:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
michelleCheck this file for how it's done for Author Pane. You can use the same thing. Or you can just use Author Pane and have it done for you. :)
Michelle
Comment #2
halloffame commentedI'm a newbie so apologize for this question...
If am going to install the Author Pane Module any variables available in author-pane-block.tpl or author-pane.tpl is directly available to me via my user-profile.tpl? Is this correct?
Thanks.
Comment #3
michelleNo, the entire Author Pane will be available as one variable if you call its theme function. So if you don't need the whole thing, just grab the code out of that file I linked you to for getting the privatemsg link and put it in your user profile preprocess.
Michelle
Comment #4
halloffame commentedThanks Michelle for pointing me to the right direction. I was able to figure this thing out and the preprocess function I need to implement in case I don't want to use AP Module.
I decided to use AP module instead because of its integration with some of the modules I'm already using.
I still have one more question though... The 'send private message' and 'add a relationship' link only displays to authenticated users and disappears on anonymous users. But I want this link to be visible to anyone who's viewing the profile including the none authenticated ones.
Thanks.
Comment #5
berdirYou can't, because anonymous users can't write private messages nor can they create relationships. However, you can of course display your own link which then links to the user registration form, for example "Register to write a private message" or whatever you want.
Comment #6
halloffame commentedI'm trying to figure out how to set conditional php to show $privatemsg_link for auth users and my custom link (as you suggested) for anonymous users. I can't seem to figure it out.
Any hint?
Comment #7
liliplanet commentedReplace 'yourrole1' and 'yourrole2' with your roles ..
Still trying to figure out how to print an image in the link, but this code will restrict users by role.
Hope this helps,
Lilian
Comment #8
halloffame commentedThank you Lilian. But where am I supposed to put this code?
I'm actually looking for something simpler... Something like...
I'm sorry cuz I feel like its more of an Author Pane issue than Privatemsg. I'm trying to achieve this via author-pane.tpl.
Comment #9
liliplanet commentedevilgenius, it is in your custom template for users (my case with http://drupal.org/project/content_profile is the content_profile-display-view.tpl.php) but I'm sure you should be able to use it on any user profile page.
The code restricts PM's by role : which enable to send a private message to that specific user, if they are not in that role, cannot send a PM.
Comment #10
michelleThe if test is already in the template... Just add an else:
Michelle
Comment #11
liliplanet commentedMichelle Hi!
Sorry to hijack this thread, but have been trying all afternoon to add an image to my link:
Would like the 'send_a_private_message.png' to replace the text. Currently I just see the link ..
Please, would you be so kind to guide me in the right direction :)
Thank you so much :)
Lilian
Comment #12
michelleIt looks ok to me... If the image isn't showing up, maybe you've got the path wrong. path_to_theme() isn't always your site's theme. It can be the path to the current template, too.
Michelle
Comment #13
liliplanet commentedHi Michelle,
Thank you so much for your reply. Michelle, my template and the image is in the same folder. It's on a localhost, so unable to show you at this moment.
When I change the path, the link disappears so it seems not to load the image. I'm quite happy to make it an absolute url instead of path_to_theme, so please how would I change the print l( to an absolute url?
I'm attaching the screenshot of the problem.
So appreciate the amazing work you are doing on Drupal :)
All the best,
Lilian
Comment #14
michelleOh! That screenshot makes it clearer. It's printing out the HTML because you're missing a paramater to l(). Try:
I just got up and am barely awake so not 100% sure I got that right. See http://api.drupal.org/api/function/l/6
Michelle
PS: I'm not on IRC at 4am. ;)
Comment #15
liliplanet commentedMichelle, you are a super-star! Thank you so much for your kind help, most most appreciated :)
Saw you online on irc, did not know that you are seen when unavailable, sorry.
Comment #16
michelleDid it work?
I'm always connected to IRC unless my computer is off. Most people just leave it connected all the time.
Michelle
Comment #17
halloffame commentedYes Michelle thanks so much too! You're such a super (duper) star indeed.
Comment #18
michelleLOL! Thanks. *blush*
Michelle