How to limit comment author to one comment per post

This would depend on how your theme handles saving comments. For instance if it submits the form via ajax it will be expecting certain returns. The way I would hook into this would probably be through the pre_comment_approved filter. Checking the received email against any previously submitted posts then return unapproved if it fails. function … Read more

Limit posts per author role (excluding admin) in home page

If I understand your problem then this should definitely work. <?php get_header(); $users = get_users( array( ‘who’ => ‘author’ ) );//get all the users with author role in an array foreach ( $users as $user ) { //travers the array if($user->caps[‘administrator’]==1)continue; // skip the user if user also have administrative capabilities $query = new WP_Query( … Read more

How to only show posts assigned to current user, only in certain post types

Roles and capabilities are used to control access and normally you should use them. For example, capabilities edit_other_posts and edit_published_posts are needed to edit other user’s posts. It’s the same with othe types (pages -> edit_other_pages, edit_published_pages). Since, besides limiting the right to change other user’s posts, you also want them to be invisible, you … Read more

Limit amout of sessions on user-by-user basis?

One user account per person would definitely be easier, but I think you could kind of get this done by playing with the user sessions, which are stored as user_meta with the session_tokens key. Something along these lines maybe. add_action(‘template_redirect’, ‘check_max_num_sessions’); function check_max_num_sessions() { // Only check for logged in users if ( is_user_logged_in() ) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)