Results 1 to 4 of 4

Thread: Add Follow Me on Bookmarking_Post.php

  1. #1
    Senior Member
    Join Date
    Sep 2009
    Location
    WorldWid3
    Posts
    272
    Thanks
    35
    Thanked 38 Times in 26 Posts

    Default Add Follow Me on Bookmarking_Post.php

    Hi I'm interested in finding out the easiest/best way to display a registered users twitter handle at the bottom of their posts:

    I know a user can simply add "Follow Me On Twitter" at the end, but is there a better way?

    Would it be possible to display their twitter handle based on custom user profile field?

    Thanks in advance!
    Last edited by angolanmade; 02-21-2012 at 04:03 AM.

  2. #2
    Donor
    Join Date
    Sep 2010
    Posts
    214
    Thanks
    29
    Thanked 54 Times in 39 Posts

    Default

    I think that the easiest way would be to add a field to the user's profile where they could insert their twitter username. Then, you could open bookmarking_post.php and insert a code that displays a link if the user has set their twitter name in their profile.

    I would do it like this:

    In plugins -> users -> templates -> users_edit_profile.php, right above where it says "add your own profile [something] stuff here:

    PHP Code:
    $profile['twitter'] = $h->cage->post->testAlnumLines('twitter'); 
    Then, a little further down that page, right after this:

    PHP Code:
    <textarea rows=5 name='bio'><?php echo $profile['bio']; ?></textarea>
    Insert this:

    HTML Code:
    <tr><td>Twitter Username: </td><td><input type="text" name="twitter" value="<?php echo $profile['twitter']; ?>"><br />Display a link to your Twitter account on your posts</td></tr>
    Then open bookmarking_post.php in plugins->bookmarking->templates-> bookmarking_post.php, and just after this:

    PHP Code:
    <?php echo ($h->post->content?>
    You could do something like this:

    PHP Code:
    <?php 
    $profile 
    $h->getProfileSettingsData('user_profile'$h->post->author);  
            
            if (isset(
    $h->vars['twitter']) && !empty($profile['twitter'])) { 
                
                
                
    $h->vars['twitter'] = $profile['twitter'];
                
            
    ?>

    <a href="http://twitter.com/#/<?php echo $h->vars['twitter']; ?>/">Follow Me on Twitter</a> <?php ?>
    I haven't tested that yet, but I think it will work.
    Last edited by seekyt; 02-20-2012 at 08:02 PM. Reason: typo ;)

  3. #3
    Senior Member
    Join Date
    Sep 2009
    Location
    WorldWid3
    Posts
    272
    Thanks
    35
    Thanked 38 Times in 26 Posts

    Default

    Hey seekyt

    Thank you for your input, I was under the impression that your suggestion would be the ideal way to go, however I have been unsuccessful in getting the twitter handle to work to display. is there anything missing from your example?

    Thanks in advance.

  4. #4
    Donor
    Join Date
    Sep 2010
    Posts
    214
    Thanks
    29
    Thanked 54 Times in 39 Posts

    Default

    Hmm, I don't think I left anything out, unless I made a typo. I use codes similar to that for all kinds of unique variables on my Hotaru site. Are you getting any errors in your error log? (Besides the "Undefined Index" errors that would be expected with this)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Follow 0.5
    By shibuya246 in forum Plugin Downloads
    Replies: 14
    Last Post: 05-21-2013, 10:22 PM
  2. How to make no follow links and open in new windows
    By jaffarhusain2010 in forum How-To and Troubleshooting
    Replies: 4
    Last Post: 03-11-2011, 05:56 AM
  3. How to add adsense in bookmarking_post.php file
    By azhar4546 in forum How-To and Troubleshooting
    Replies: 2
    Last Post: 12-20-2010, 04:19 PM
  4. Problem On Follow Pages
    By skorpyo in forum How-To and Troubleshooting
    Replies: 11
    Last Post: 06-15-2010, 10:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •