Hi all,
with "Block Manager" panel (under "TinyPortal section") i can choose membergroups that are able to see blocks, but i can choose only from "Regular groups" and not from "Post count based groups".
I want some blocks to be visible only to members that have a minimum of posts.
Is it possible?
Thanks in advance.
Currently TP does not use Post based groups. You may be able to code a block to only show to certain post based groups, but I'm unaware of where that can be called from. I'll search and see if I can find any info.
Thanks for your quick reply ;)
i specify that managing post count based groups is not strictly necessary, since i "only" want some blocks to be visible only to members that have a minimum of posts (i.e. > 50)
I use TP v0.9.7
In a php block try something like this. (Replace the number 4 with your group ID). You can get the ID number by hovering over the group in your admin panel.
global $user_info;
if($user_info['groups'] == 4)
{
echo 'all the html or php you need in here';
}
Tnx for the code!
i tried using it creating a new phpblock
global $user_info;
if($user_info['groups'] == 4 && $user_info['groups'] == 5)
{
echo "first html code";
}
else
{
echo 'second html code';
}
but it does not seem to function and always the "second html code" is shown: i tried using an account with over 6000 posts and another one with 35 posts, after changing the number of posts required for Newbie group (4) and Jr Member group (5) to 0 and 40; both are able to see the block even if the account with 35 posts should not (35<40)
what's wrong?
i'm very newbie with php, but i try to add a line
echo $user_info['groups'];
and the output is Array
Can this info help?
Thank you very much
I'm not sure on the exact synax for this. But I'm wondering if this line should look like this:
if(($user_info['groups'] == 4) && ($user_info['groups'] == 5))
You do know that what the above says, If user belongs to group4 AND group5. So if both situations does not exist it will always display or else statement. Perhaps you meant to do || (or) instead of && (and). Which means that either can exist instead of both.
you are right, i would have used || (or) instead of && (and)
if(($user_info['groups'] == 4) && ($user_info['groups'] == 5))
(the () are not necessary)
with the help of a friend of mine i added these lines
$n=count($user_info['groups']);
for ($i=0; $i<$n; $i++) {
echo $user_info['groups'][$i];
}
to show every single value of the array
For me the output is 18323 because i belong to Admin group (1), Hero Member (8), Test (32); i don't know what the final number 3 correspond to, since there is no group with ID_group = 3
For the other account, Jr Member (5), i receive 05; i don't know why there is an initial zero for the same reason
Now i suppose i have to check if every single value of the array matches 4 or 5
Thanks a lot for the support
Problem solved with this code
if($user_info['posts'] <= number_of_posts_required_here)
;)
You wanna see whats inside $user_info just do this in a phpbox block
global $user_info;
echo '<pre>', print_r($user_info),'</pre>';