Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter jmlmj

    (@jmlmj)

    I’m probably missing something. I saw this here, but not sure what I actually have available to me with init other than the example. Is there another place where the documentation is expanded?

    Thread Starter jmlmj

    (@jmlmj)

    What if I want to have all logins expire after a certain amount of inactivity?

    Thread Starter jmlmj

    (@jmlmj)

    Ah, OK.
    Thanks for the clarifications.

    I think I would prefer to limit _all_ logins, unless the logged in user is admin. I’ll try to work up a conditional based on this…

    Thread Starter jmlmj

    (@jmlmj)

    Anyone?

    Thread Starter jmlmj

    (@jmlmj)

    Hey thanks again. So great.

    I’m marking this topic as ‘resolved’ because although I’d like to know more about making that admin page, I realize that from the admin view you can simply look at posts and filter via search, which meets my criteria.

    You’ve been really helpful and I can’t thank you enough.
    Have a great one!!

    Thread Starter jmlmj

    (@jmlmj)

    Great, it works! Thanks a ton, @bcworks. Much appreciated. Now, on to the custom admin page with the drop-down. 🙂

    BTW; Out of curiosity, is there a gain in efficiency by not calling get_comments()?
    I’d imagine that my comment callback gets called for every instance of a comment, perhaps?

    Thread Starter jmlmj

    (@jmlmj)

    Sorry, I should have clarified – I did look at the callback in twentytwelve (there is none implemented in 2013/2014), but didn’t see the parameter utilization. Thanks very much. Will try this out ASAP.

    Thread Starter jmlmj

    (@jmlmj)

    FWIW, the error I get is:

    Catchable fatal error: Object of class stdClass could not be converted to string in /home/<username>/<mydomain>.com/location/wp-content/themes/my-child-theme/functions.php on line 22

    Thread Starter jmlmj

    (@jmlmj)

    Great, thanks. I looked into doing this without using the twenty* code, as I was able to successfully get a custom callback happening with my current child theme. I might not be wrapping the callback correctly, so I wanted to show you what I have:

    function comments_conditional(){
            global $current_user;
            $comments = get_comments();
            $usern = $current_user->user_login;
    
            foreach($comments as $comment){
                    $author = $comment->comment_author;
                    if($author == $usern){
                            echo($comment) . '<br />';
                    }
            }
    }

    Do I need to simply echo $comments that have matched based on other criteria? For whatever reason I cannot compare ‘$usern’ and ‘$author’. :/

    Thread Starter jmlmj

    (@jmlmj)

    OK, progress.
    I made a child theme and activated it.
    I found the call to wp_list_comments(), but I am having trouble discerning whether or not it has a “comment callback function”, so I am including the div I found there. I think what I found indicates that there is no callback function (see question below):

    <div id="comments">
    
            <?php if ( have_comments() ) : ?>
    
                    <hr />
                    <h2><?php comments_number( __( 'Leave a Comment', 'academica' ) ); ?></h2>
    
                    <ol class="commentlist">
                            <?php wp_list_comments( 'avatar_size=40' ); ?>
                    </ol>
    
                    <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
                    <nav id="comment-nav-below" class="navigation clearfix">
                            <h1 class="assistive-text"><?php _e( 'Comment navigation', 'academica' ); ?></h1>
                            <span class="nav-previous"><?php previous_comments_link( __( '← Older Comments', 'academica' ) ); ?></span>
                            <span class="nav-next"><?php next_comments_link( __( 'Newer Comments →', 'academica' ) ); ?></span>
                    </nav>
                    <?php endif; // check for comment navigation
    
            endif;
    
            // If comments are closed and there are comments, let's leave a little note, shall we?
            if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
    
                    <p class="nocomments"><?php _e( 'Comments are closed.', 'academica' ); ?></p>
    
            <?php
            endif;
    
            comment_form(); ?>
    
    </div><!-- #comments -->

    How can I extend the behavior of comments.php (if/then) in my child theme?

    For example, do I need to do either/both of the following:
    1. override comments.php to include a function callback in wp_list_comments() ?
    2. extend functions.php to include that custom callback function?

    Thread Starter jmlmj

    (@jmlmj)

    Hey, thanks a lot for your feedback, and thanks for the tips regarding the conditional.
    The custom thing isn’t a huge deal; I could stand to learn more about the internals of WP. 🙂

    Can I ask just a couple more questions?

    – What is a child theme, or can you link me to what people normally do to create, link to, and maintain one?

    – I don’t mind making a custom admin page, although I will definitely go with the easy sortable option first. Do you have a link to a place whereby I could research a way to
    a) create a drop-down to choose a user
    b) display all comments for that user

    Much appreciated!
    jml

Viewing 11 replies - 1 through 11 (of 11 total)