News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Ban feature - kind of

Started by Owdy, December 25, 2005, 02:34:10 PM

Previous topic - Next topic

Owdy

When user is banned, it would automaticly show 'banned' or 'post banned' in display.template, under username. Same area where custom title is.
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Ben_S

Shouldn't be too difficult with RC2 given such data is already available in profiles.
Liverpool FC Forum with 14 million+ posts.

JayBachatero

I tried this Ben and it's not working.


// If user is banned show that he/she is banned
                        if (!empty($context['member']['bans']))
                                echo '
                                                                [BANNED]<br />';


$context['member']['bans'] is what is used on Profile.template.php

-JayBachatero
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Thantos

Well it would be $message['member']['is_banned'] however it does not check if the poster is currently banned or not so even if they are banned by name then it'll still be false.

An easy option in my opinion would be to change their title when they are banned.

File:  ManageBans.php
Find:
        
// We welcome our new members in the realm of the banned.
        if (!empty($newMembers))
                db_query("
                        DELETE FROM 
{$db_prefix}log_online
                        WHERE ID_MEMBER IN (" 
implode(', '$newMembers) . ")
                        LIMIT " 
count($newMembers), __FILE____LINE__);


and replace it with


        
// We welcome our new members in the realm of the banned.
        if (!empty($newMembers))
        {
                db_query("
                        DELETE FROM 
{$db_prefix}log_online
                        WHERE ID_MEMBER IN (" 
implode(', '$newMembers) . ")
                        LIMIT " 
count($newMembers), __FILE____LINE__);
                db_query("
                        UPDATE 
{$db_prefix}members 
                        SET usertitle='[BANNED]'
                        WHERE ID_MEMBER IN ("
.implode(',',$newMembers).")
                        LIMIT " 
count($newMembers), __FILE____LINE__);
        }


And in case they get unbanned

Find

        
while ($row mysql_fetch_assoc($request))
                
$updates[$row['new_value']][] = $row['ID_MEMBER'];
        
mysql_free_result($request);
        if (!empty(
$updates))
                foreach (
$updates as $newStatus => $members)
                        
updateMemberData($members, array('is_activated' => $newStatus));


replace with


        $redeemed 
= array();
        while (
$row mysql_fetch_assoc($request))
        {
                
$updates[$row['new_value']][] = $row['ID_MEMBER'];
                
$redeemed[] = $row['ID_MEMBER'];
        }
        
mysql_free_result($request);
        if (!empty(
$updates))
                foreach (
$updates as $newStatus => $members)
                        
updateMemberData($members, array('is_activated' => $newStatus));
        if ( !empty(
$redeemed) )
                
db_query("
                        UPDATE 
{$db_prefix}members 
                        SET usertitle=''
                        WHERE ID_MEMBER IN ("
.implode(',',$redeemed).")
                        LIMIT " 
count($redeemed), __FILE____LINE__);

Owdy

Thanks! But what if i want it to show 'banned' or 'post banned'?
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Thantos

Just change the '[BANNED]' to whatever you wanted.  Or do you mean being able to do [FULL BAN] and [POST BAN] depending on the correct one?

Also looking at the code a little closer I think I found a better method.  Let me test some things out

Owdy

I mean if member is full banned, it would show *banned*. If post banned, it would show *post banned*. Automaticly.
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Thantos

I think it can be done using the above, just need to modify it a little :)  Give me a bit and I'll whip something up

Elmacik

I remember Grudge told that he put it in RC2 already..
(I mean $message['member']['is_banned'])
Then didnt he ? :(
Home of Elmacik

Grudge

Elmacik,

It's available to the templates, I didn't change the templates apart from in the Profile, as I think that's a theme writers decision - not a developers. I wouldn't want that information in the default display template.
I'm only a half geek really...

Thantos

#10
Grudge, quick test showed that while the index is in there its not holding a value for fully banned members.  Using 12/25 CVS

Edit:  Found the problem and have posted to the devs.  However will only show fully banned members.  Trying to come up with a good solution for banned from posting.

Elmacik

Grudge,

I didnt meant for you to put into display template.
I mean there is a variable like that in RC2 right? This is what I was recalling "Grudge was going to put it" The variable, not the template.
(As you know, $message['member']['is_banned'] takes place in RC1 but doesnt handle anything.
Home of Elmacik

Owdy

Lets bump some air to this topic. Heres an idea: Profile page shows red flag with text when user is banned. If member is post banned its says that, if totally banned it says that. It could be shown also in display page.

Could some write mod like that? :)

My co-admin asked this feature. She says its feature in phpBB. That i dont know, because i dont use it.
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

JayBachatero

I'll post something later on tonight or tom.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Jannejt

Quote from: Owdy on August 18, 2006, 01:05:24 PM
Lets bump some air to this topic. Heres an idea: Profile page shows red flag with text when user is banned. If member is post banned its says that, if totally banned it says that. It could be shown also in display page.

Could some write mod like that? :)

My co-admin asked this feature. She says its feature in phpBB. That i dont know, because i dont use it.


*bump* again..

that's sounds great! hope someone will write some mod to 1.1rc3 or something ;D

i just searched something like that, i would like to get 'banned' title for users and then i find that thread.. sound v nice :)

JayBachatero

I looked into this in the past.  Right now you need the moderate_forum permission in order to see this.  Let me see if changing this causes other issues.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Advertisement: