Need some help with a bit of code.

Discussion in 'Programming' started by johno123, Nov 8, 2008.

  1. #1
    Hi all,

    I need some help with a new project im working on in wordpress.



    I have a question, maybe it is simple for you but im stumped.

    "In wordpress" ...

    I would like to have it so browsing users, that are looking at a post someone posted. Can send an email relating to that post directly to the author. Just by clicking on a button located at the bottom of the post.

    It would be “mailto:” function of sorts i would guess. ?

    I want the button to be able to send the email to the author of that specific post, maybe with the post's title in the emailed subject line..

    If anyone could give me any idea on what to do, i would really appreciate the help.

    [​IMG]

    thx
     
    johno123, Nov 8, 2008 IP
  2. shineDarkly

    shineDarkly Banned

    Messages:
    241
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i'm not really sure on what ready made wp functions to use but if you're only looking to create links, i guess the mailto in the href will work, something along these lines

    <a href="mailto:<?php echo wp_author().'?Subject='.wp_post_title(); ?>" >link label here</a>
     
    shineDarkly, Nov 8, 2008 IP
  3. johno123

    johno123 Well-Known Member

    Messages:
    1,492
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    #3
    Im gunna try that right now.. i let ya know my progress shortly. Thank alot..




    I am using article directory plugin for wordpres, and tried the code you made and did not work.



    This is my error.


    <a href="mailto:
    Fatal error: Call to undefined function: wp_author() in /home/content/i/n/e/ineters/html/mysite/wp-content/themes/article-directory/single.php on line 22


    maybe wp_author has been renamed to something else ?



    i can send ya the plugin if you want.
     
    johno123, Nov 8, 2008 IP
  4. YIAM

    YIAM Notable Member

    Messages:
    2,480
    Likes Received:
    240
    Best Answers:
    0
    Trophy Points:
    280
    #4
    This should work:

    
    <a href="mailto:<?php the_author_email(); ?>?subject=<?php the_title(); ?>
    ">Contact the author</a>
    
    
    PHP:
     
    YIAM, Nov 9, 2008 IP
  5. johno123

    johno123 Well-Known Member

    Messages:
    1,492
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    #5
    Oh nice!!!!


    It worked thank you sooooooooooooooooo much,

    Is it possible to have it so link is only clickable to registered users? Or make it go to a form page that hides the authors email?

    (" i am trying to keep away email harvesters and spammers..")

    thx oh grand master... You have saved me a huge headache.. :D
     
    johno123, Nov 9, 2008 IP
  6. johno123

    johno123 Well-Known Member

    Messages:
    1,492
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    #6
    Anyone have any clue on how to accomplish my question?

    " Is it possible to have it so link is only clickable to registered users? Or make it go to a form page that hides the authors email?

    (" i am trying to keep away email harvesters and spammers..") "


    And my second question is

    " I also wanted to know if it is possible to show how many posts are shown in the profile page of the author?

    example. ( (2) Articles posted ) - And would also like the number shown, to be clickable to go to the authors articles..

    What file would i edit for this info to go into the profile page of authors? "
     
    johno123, Nov 9, 2008 IP