diff --git a/app/models/Post/TagMethods.php b/app/models/Post/TagMethods.php index 5e6306e..06acb0c 100755 --- a/app/models/Post/TagMethods.php +++ b/app/models/Post/TagMethods.php @@ -84,7 +84,7 @@ trait PostTagMethods # * :tag:: the tag to search for public function has_tag($tag) { - return isset($this->tags[$tag]); + return array_search($tag, $this->tags) !== false; } # Returns the tags in a URL suitable string @@ -379,8 +379,8 @@ trait PostTagMethods PostTagHistory::create([ 'post_id' => $this->id, 'tags' => $new_cached_tags, - 'user_id' => current_user()->id, - 'ip_addr' => current_user()->ip_addr ?: "127.0.0.1" + 'user_id' => $this->user_id, + 'ip_addr' => current_user() && current_user()->ip_addr ? current_user()->ip_addr : "127.0.0.1" ]); } } diff --git a/config/default_config.php b/config/default_config.php index 7a80559..b38c839 100755 --- a/config/default_config.php +++ b/config/default_config.php @@ -167,14 +167,14 @@ abstract class DefaultConfig { # By default, no posts are hidden. return true; - + # Some examples: # # Hide post if user isn't privileged and post is not safe: - # if($post->rating == 'e' && $user->is('>=20')) return true; + # if ($post->rating == 'e' && $user->is_privileged_or_higher()) return true; # # Hide post if user isn't a mod and post has the loli tag: - # if($post->has_tag('loli') && $user->is('>=40')) return true; + # if ($post->has_tag('loli') && $user->is_mod_or_higher()) return true; } # Determines who can see ads.