• Resolved sharecommons

    (@sharecommons)


    Good day guys!

    I’m trying to add some stuff to the Author Template and I’m successful in doing what I’m trying to do. Please see the author pages on my website Sharecommons
    I followed this article to add some custom fields to the PROFILE EDITING page so that contributors can add their social networking links. to their profile.
    The only problem is that the latest author’s social network stuff appears on ALL author’s profile pages. I’m trying to set the coding so that things work properly. Paula’s social networking links appear on Paula’s profile. John’s social networking links appear on John’s profile only. This is the Author.php template: https://pastebin.ca/1924405
    I believe, the problem is around 33-37 lines. I don’t understand this code much but I’m trying my best to work this out.

    To understand what I’m trying to do, please visit these links:
    https://sharecommons.com/author/pangel/
    https://sharecommons.com/author/shamrock/

    pangel’s bookmarks are showing up on shamrock’s profile. I have not provided links in shamrock’s profile yet but pangel’s bookmarks should appear only on her own profile page. Why are they appearing on everyone’s profile? I can’t understand that ..

    Thanks for any help you guys can provide.

    Regards.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter sharecommons

    (@sharecommons)

    Hello friends,

    Please provide some help with this issue, I’m totally stuck and don’t know what to do.

    Would appreciate your help a lot.

    Regards.

    Thread Starter sharecommons

    (@sharecommons)

    Damn, 16 hours of just reading and reading and reading. Is there anyone who knows a solution to this? Please help. I’m sure, the problem is with this code. I’m unable to straighten the query:

    <?php
                    $authors = $wpdb->get_results('SELECT DISTINCT post_author FROM '.$wpdb->posts);
                    if($authors):
                    foreach($authors as $author):
    ?>

    Would appreciate your help if you can suggest anything. Thanks.

    Thread Starter sharecommons

    (@sharecommons)

    Nobody knows how to set this query straight so that the social networking links can be pulled by the author slug?

    Please help as much as you guys can, I’m still counting on you folks ??

    Thanks guys.

    The problem is that you are using a get_results query which returns ALL authors. I can’t test this code, but I think it will work. Save a copy of your author.php template, then try the code below for the socialntwrk div, removing the get_results query and replacing $author->post_author with $curauth->ID:

    <div id="socialntwrk">
    <?php if(get_the_author_meta('twitter', $curauth->ID) || get_the_author_meta('facebook', $curauth->ID) || get_the_author_meta('linkedin', $curauth->ID) || get_the_author_meta('digg', $curauth->ID) || get_the_author_meta('flickr', $curauth->ID)): ?>
    	<ul>
    			<?php if(get_the_author_meta('twitter', $curauth->ID)): ?>
    			<li><a href='https://twitter.com/<?php the_author_meta('twitter', $curauth->ID); ?>'><img title="Follow me" src="https://sharecommons.com/images/twitter.png" alt="Twitter" /></a></li>
    			<?php endif; ?>
    			<?php if(get_the_author_meta('facebook', $curauth->ID)): ?>
    			<li><a href='https://www.facebook.com/<?php the_author_meta('facebook', $curauth->ID); ?>'><img title="Become a fan" src="https://sharecommons.com/images/facebook.png" alt="Facebook" /></a></li>
    			<?php endif; ?>
    			<?php if(get_the_author_meta('linkedin', $curauth->ID)): ?>
    			<li><a href='https://www.linkedin.com/in/<?php the_author_meta('linkedin', $curauth->ID); ?>'><img title="Connect with me" src="https://sharecommons.com/images/linkedin.png" alt="Linkedin" /></a></li>
    			<?php endif; ?>
    			<?php if(get_the_author_meta('digg', $curauth->ID)): ?>
    			<li><a href='https://digg.com/users/<?php the_author_meta('digg', $curauth->ID); ?>'><img title="Digg me" src="https://sharecommons.com/images/digg.png" alt="Digg" /></a></li>
    			<?php endif; ?>
    			<?php if(get_the_author_meta('flickr', $curauth->ID)): ?>
    			<li><a href='https://www.flickr.com/photos/<?php the_author_meta('flickr', $curauth->ID); ?>/'><img title="My Flickr" src="https://sharecommons.com/images/flickr.png" alt="Flickr" /></a></li>
    			<?php endif; ?>
    	</ul>
    <?php endif; ?>
    
    <?php endforeach; endif; ?>
    </div>
    Thread Starter sharecommons

    (@sharecommons)

    OH MAN! You are my hero! Love you! Thank you so so much!
    You’re a life saver, thank you for the help ??

    You are welcome. Now, please use the dropdown at top right to mark this topic ‘Resolved’.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Templating Author.php’ is closed to new replies.