Every time I use wp_get_current_user() my plugin breaks

You can get current user ID easily using get_current_user_id(). $usersid = get_current_user_id(); $activity = $_POST[‘activity’]; $reason = $_POST[‘reason’]; $explanation = $_POST[‘explanation’]; For your function f2user() you can change your code to this: $current_user = wp_get_current_user(); return $current_user->ID; According to wp_get_current_user() doc, if no user is signed in, $current_user->ID would return 0.

throttle/limit a logged in user’s http requests to specific page on a per day basis

First, check for get_current_user_id. Then create a log of visits by adding information to a user’s metadata with update_user_meta & get_user_meta. On every page hit that you care about you can run a function to determine rate/limit of usage per user. If they break the rules, you can redirect to a page that doesn’t contain … Read more

Compare date of user’s last posts

According to the codex, you’re manipulating get_most_recent_post_of_user()‘s returned value the wrong way. get_most_recent_post_of_user() directly returns the post_date_gmt among blog_id, post_id, and post_gmt_ts. Anyway, if you want to get the 2 last posts of a specific author, use WP_Query instead, which should by default get last posts in the order you need. $author_id = $author_id; $args … Read more

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