Forums

[Plugin: TDO Mini Forms] Submissions links in sidebar (5 posts)

  1. mrarrow
    Member
    Posted 2 years ago #

    Trying to avoid users having to get into the WP backend at all, are there any hooks or functions that I can use to add a list of submissions made by the logged in user, to the sidebar?

    Exactly the same list that appears in 'Your submissions' page, but on the front end instead.

    Running TDO 0.13.6 and WP 2.8.6

  2. mrarrow
    Member
    Posted 2 years ago #

    Sorted! I built my own submissions file based on a lot of the functions used in 'tdomf-your-submissions.php'. Then I simply included that file in a sidebar.

  3. beanfair
    Member
    Posted 2 years ago #

    Would you be willing to share your code with us? I am needing to add this function to my blog as well

  4. reszek
    Member
    Posted 2 years ago #

    I need the same solution. Please share this code! Or someone please write the same code.

  5. mrarrow
    Member
    Posted 2 years ago #

    Something like this worked for me.

    You can edit the line tdomf_get_user_published_posts($current_user->ID,0,200); to show however many user-submitted posts you want (by default its only set to 5 for some reason!)

    Works fine in 0.13.7 at least.

    <!-- Displays published submissions -->
    <h3><?php printf(__('Published','tdomf'),($app_total < 5) ? $app_total : 5 ); ?></h3>
             <ul>
             <?php $app_posts = tdomf_get_user_published_posts($current_user->ID,0,200);
                    foreach($app_posts as $p) { ?>
              <li>
              <?php $t_time = get_the_time(__('Y/m/d g:i:s A'));
                    $m_time = $p->post_date;
                    $time = tdomf_get_post_time('G', true, $p);
                    if ( ( abs(time() - $time) ) < 86400 ) {
                        $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
                    } else {
                        $h_time = mysql2date(__('Y/m/d'), $m_time);
                    } ?>
                    <?php printf(__("<a href='%s'>%s</a> approved %s","tdomf"),get_permalink($p->ID),$p->post_title,"<abbr
    title='$t_time'>$h_time</abbr>"); ?>
              </li>
             <?php } ?>
              </ul>
    
    <h3><?php $mod_posts = tdomf_get_user_draft_posts($current_user->ID);
      $mod_total = count($mod_posts);
            _e('Awaiting moderation','tdomf'); ?></h3>
             <ul>
             <?php foreach($mod_posts as $p) { ?>
              <li>"<?php echo $p->post_title; ?>"</li>
             <?php } ?>
              </ul>
    
             <?php } ?>
              </ul>

Topic Closed

This topic has been closed to new replies.

About this Topic