Page Index Toggle Pages: 1
Topic Tools
Normal Topic Extended Profiles bug in 2.5AE, 2.5.2 (Read 198 times)
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,484
Location: Earth

YaBB 2.6.1
Extended Profiles bug in 2.5AE, 2.5.2
Apr 1st, 2014 at 2:13pm
Post Tools
View Extended profiles by Group permissions doesn't work. (You can set the fields for 'view by group'  but they just don't show when that option is selected.

In Extended Profiles.pl find:
Code (Perl)
Select All
# returns whenever the current user is allowed to view a field or not
sub ext_has_access {
	my ($allowed_users, $allowed_groups, $usergroup, $useraddgroup, $postcount, $groupid) = (shift, shift, 0, ${$uid.$username}{'position'}, ${$uid.$username}{'addgroups'}, ${$uid.$username}{'postcount'}, undef);

	if ($allowed_users ne "" || $allowed_groups ne "") {
		foreach (split(/,/, $allowed_users)) { return 1 if $_ eq $username; }

		# example list of allowed groups:
		# ('Administrator', 'Moderator', 'Global Moderator', 'Post{-1}', 'NoPost{1}')
		foreach my $group (split(/\s*,\s*/, $allowed_groups)) {
			# check if user is in one of these groups
			if ($group eq "Administrator" || $group eq "Moderator" || $group eq "Global Moderator") {
				if ($usergroup eq $group) { return 1; }

			# check if user is on a post-independend group
			} elsif ($group =~ m~^NoPost{(\d+)}$~) {
				$groupid = $1;
				# check if group exists at all
				if ($groupid ne "" && exists $NoPost{$groupid}) {
					# check if group id is in user position or addgroup field
					if ($usergroup eq $groupid) { return 1; }
					foreach (split(/,/,$useraddgroup)) {
						if ($_ eq $groupid) { return 1; }
					}
				}

			# check if user is in one of the post-depending groups...
			} elsif ($group =~ m~^Post{(\d+)}$~) {
				$groupid = $1;
				foreach (sort { $b <=> $a } keys %Post) {
					if ($postcount > $_) {
						# found the group the user is in
						if ($_ eq $groupid) { return 1; }
					}
				}
			}
		}
		return 0;
	}
	return 1;
} 



replace with
Code (Perl)
Select All
sub ext_has_access {
	my ($allowed_users, $allowed_groups, $access, $usergroup, $useraddgroup, $postcount, $user, @users, $group, @groups, $groupid, $postamount) = (shift, shift, 0, ${$uid.$username}{'position'}, ${$uid.$username}{'addgroups'}, ${$uid.$username}{'postcount'});

	if (($allowed_users ne "") || ($allowed_groups ne "")) {
		if ($allowed_users ne "") {
			@users = split(/\,/,$allowed_users);
			foreach $user (@users) {
				if ($user eq $username) { $access = 1; return $access; }
			}
		}
		if ($allowed_groups ne "") {
			# generate list of allowed groups
			# example: @groups = ('Administrator', 'Moderator', 'Global Moderator', 'Post{-1}', 'NoPost{1}');
			@groups = split(/\s*\,\s*/,$allowed_groups);
			foreach $group (@groups) {
				# check if user is in one of these groups
				if ($group eq "Administrator" || $group eq "Moderator" || $group eq "Global Moderator") {
					if ($group eq $usergroup) { $access = 1; return $access; }
				} elsif ($group =~ m~^NoPost{(\d+)}$~) {
					# check if user is on a post-independend groups
					$groupid = $1;
					# check if group exists at all
					if (exists $NoPost{$groupid} && $groupid ne "") {
						# check if group id is in user position or addgroup field
						if ($usergroup eq $groupid) { $access = 1; return $access; }
						foreach $group (split(/,/,$useraddgroup)) {
							if ($group eq $groupid) { $access = 1; return $access; }
						}
					}
				} elsif ($group =~ m~^Post{(\d+)}$~) {
					# check if user is in one of the post-depending groups...
					$groupid = $1;
					foreach $postamount (sort { $b <=> $a } keys %Post) {
						if ($postcount > $postamount) {
							# found the group the user is in
							if ($postamount eq $groupid) { $access = 1; return $access; }
						}
					}
				}
			}
		}
	} else { $access = 1; }

	$access;
} 

  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools