Cameron Brown
asked 10 years ago

I want a user to see their listings (and their listings only) on their login landing page, is there a shortcode for this?
If not I would be willing to implement a PHP solution.

5 Answers
Cameron Brown
answered 10 years ago

This is a plug-and-play solution modified from @BigHug ‘s solution 

 <ul>
<?php
$author_id = get_current_user_id(); // Specify the user ID whole questions will be shown
$args = array(
    'posts_per_page' => 5, //Number of Questions
    'post_type' => 'dwqa-question', //Get the questions only
    'post_author' => $author_id, // the ID of user
        'post_status' => 'publish'
    );
    $myposts = get_posts( $args );
    foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
       <?php if ($post->post_author==$author_id): ?>
       <li>
            <a href="<?php echo $post->guid; ?>"><?php echo $post->post_title; ?></a>
            <p><?php echo $post->post_content; ?></p>
            <span><?php echo $post->comment_count; ?> comments</span>
       </li>
        <?php endif; ?>
    <?php endforeach; ?>
<?php wp_reset_postdata();?>
</ul>
Guru
replied 10 years ago

Glad that you have found the solution 🙂

well wisher
answered 10 years ago

you can install buddypress and then set the “questions tab” as the default landing tab(default is set to activity tab) when a user logs in, there are a whole lot of plugin out there which can do this for you !!!
Only a plugin to redirect user to custom link after login you specify in settings should work for you try theme my login plugin and redirect each user to the qustions tab link after login !!! 

Cameron Brown
replied 10 years ago

I'm afraid you misunderstood the question. I already have the user redirected to the page I want, on that page I want to display their questions. I don't want another plugin to make this work, as that may conflict with the other plugins that already function in this way.
I either want [dwqa-manage-questions] or dwqa_get_questions($cur_user);

well wisher
replied 10 years ago

Oh now i got it i think you just want to create a section in your predefined page which will include a list of questions asked by the logged in user along with you other content using shortcodes well in that case i think there are no shortcodes available to do that task for you currently but if you only want to display the list of questions asked by the logged in user check my comment in the answer provided by guru

well wisher
answered 10 years ago

Ok this is the link to your profile’s question tab on the design wall website http://designwall.com/profile/calibre/questions/ is that what you want to do on your default page (displaying only the questions you have asked)?

Cameron Brown
replied 10 years ago

That’s what I’m looking for, is this only available through buddy press? I’m working on a project with limited scope and I would sooner leave this boxed un-ticked than spend time getting my head around another plugin

Guru
replied 10 years ago

You can work with other plugins such as bbpress too, but not having a plugin would mean alot of work, which would require a dedicated coder.

Guru
answered 10 years ago

Hi all I guess what you are looking for is for the logged-in user to only see the question they have posted and the related answers.
If this is the case, I am afraid this is not available by default. It requires modification of the code. This is a special case as in normal circumstances you won’t require this functionality.
 

well wisher
replied 10 years ago

Yaa thats what i am trying to say the designwall team has added a bp-custom.php file in wordpress along with the buddypress installed the code in the bp-custom.php is to create a new custom tab for every profile showing only the questions asked by him/her like if you click on this link http://cmspioneer.com/designwall/profile/calibre/questions/ it will only show the questions asked by Cameron Brown himself and thats what he need i suppose ,did i missed something ?

Cameron Brown
replied 10 years ago

I should repeat I’m willing to implement a PHP solution!

Guru
replied 10 years ago

sorry I have lost you there!

Yan
answered 10 years ago

Hi Cameron,
Did you manage to customize the profile page without buddypress?
Thanks!

DominicStaff
answered 10 years ago

Apologies for the delay in replying. At the moment, you only possible use the Buddypress plugin to create a profile page.
Regards,

Powered by DW Question & Answer Pro