FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Suggestions » Groups and supergroups
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Groups and supergroups [message #33973 is a reply to message #33972] Sat, 30 September 2006 05:23 Go to previous messageGo to previous message
otherbird is currently offline  otherbird   Israel
Messages: 25
Registered: September 2006
Karma:
Junior Member
Ignore me, I've been smoking that funny stuff again.

All's working now Wink although I had to hard-code the group_id to make it so. Everything's towards the end of user_login() in users_reg.inc.t:

($arr is an array of allowed country codes)

        
if ($flag) {
    $flag_start = substr($flag, 9);
    $flag_cc = substr($flag_start, 0, strpos($flag_start, "'"));

    /* assign privileges */
    if (in_array($flag_cc, $arr)) {
        $perms = '378767'; // standard registered user
    } else {
        $perms = '327683'; // standard anonymous user
    }         

    if (!q_singleval('SELECT id FROM {SQL_TABLE_PREFIX}group_members 
                      WHERE group_id=19 AND user_id='.$id)) {
        // insert one if there isn't
        q('INSERT INTO {SQL_TABLE_PREFIX}group_members (group_members_opt, user_id, group_id) 
           VALUES ('.$perms.', '.$id.', 19)');
    } else {
        // update the entry if it exists
        q('UPDATE {SQL_TABLE_PREFIX}group_members 
           SET group_members_opt='.$perms.' 
           WHERE group_id=19 AND user_id='.$id);
    }

} // if flag


GeoIP overrides come a little earlier, just before the 'users' table is updated:

if ($id == 7) $flag = "flag_cc='lb', flag_country='LEBANON',";


- I was going wrong in thinking this would be an array. Hrm hrm. 'Course that override actually _is_ an array in tmpl_drawmsg() (in drawmsg.inc.t):

if (!$hide_controls && $GLOBALS['FUD_OPT_3'] & 524288) {
    $geo = db_saq("SELECT cc,country FROM {SQL_TABLE_PREFIX}geoip 
                   WHERE ".sprintf("%u", ip2long($obj->ip_addr))." 
                   BETWEEN ips AND ipe");
} elseif ($obj->poster_id == 7) {
    $geo = array('lb', 'LEBANON');
} else {
    $geo = null;
}


So, my immediate issues are solved. I still think it could be nice to have some option via the interface for setting scripted on-the-fly permissions in this way though - no?

[Updated on: Sun, 01 October 2006 19:44]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: the system for insert image isn't good
Next Topic: Flagging threads with own involvement
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 11:41:21 GMT 2024

Total time taken to generate the page: 0.04371 seconds