Seite 2 von 2

Re: Thema mit Passwort schützen

Verfasst: 03.10.2012 12:58
von ace
Miriam hat geschrieben:Oder Du machst es so:
  • Finde in der viewtopic.php

    Code: Alles auswählen

    $forum_id = (int) $topic_data['forum_id']; 
  • davor füge ein:

    Code: Alles auswählen

    if ((($topic_id > 0) && in_array($topic_id, not_allowed_hook_topics())) OR ($topic_id == 0))
    {
        trigger_error('NO_TOPIC');
    } 
  • Finde in der viewforum.php

    Code: Alles auswählen

    while ($row = $db->sql_fetchrow($result))
    {
        $topic_list[] = (int) $row['topic_id'];
    }
    $db->sql_freeresult($result); 
  • tausche aus gegen:

    Code: Alles auswählen

    while ($row = $db->sql_fetchrow($result))
    {
        if(!in_array((int) $row['topic_id'], not_allowed_hook_topics()))
        {
            $topic_list[] = (int) $row['topic_id'];
        }
    } 
  • Finde in der includes/functions.php:
    ?>
  • davor füge ein:

    Code: Alles auswählen

    function not_allowed_hook_topics()
    {
        global $db, $user;
    
        $allowed_topics = $not_allowed_topics = array();
    
        $sql = 'SELECT topic_id FROM ' . HOOKUP_MEMBERS_TABLE . '
                WHERE user_id = ' . $user->data['user_id'];
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result))
        {
            $allowed_topics[] = (int) $row['topic_id'];
        }
        $db->sql_freeresult($result);
    
        if (sizeof($allowed_topics))
        {
            $sql = 'SELECT topic_id FROM ' . HOOKUP_MEMBERS_TABLE . ' 
                WHERE ' . $db->sql_in_set('topic_id', $allowed_topics, true);
        }
        else
        {
            $sql = 'SELECT topic_id FROM ' . HOOKUP_MEMBERS_TABLE;
        }
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result))
        {
            $not_allowed_topics[] = (int) $row['topic_id'];
        }
        $db->sql_freeresult($result);
        
        return $not_allowed_topics;
    } 
Die User, die auf der Terminplaner-Liste sind, können das jeweilge Thema sehen und auch darin posten / lesen. Alle anderen können das nicht.
Funzt TOP - vielen Dank noch a moi! :-)

Re: Thema mit Passwort schützen

Verfasst: 25.12.2012 11:24
von ace
Miriam hat geschrieben:Oder Du machst es so:
  • Finde in der viewtopic.php

    Code: Alles auswählen

    $forum_id = (int) $topic_data['forum_id']; 
  • davor füge ein:

    Code: Alles auswählen

    if ((($topic_id > 0) && in_array($topic_id, not_allowed_hook_topics())) OR ($topic_id == 0))
    {
        trigger_error('NO_TOPIC');
    } 
  • Finde in der viewforum.php

    Code: Alles auswählen

    while ($row = $db->sql_fetchrow($result))
    {
        $topic_list[] = (int) $row['topic_id'];
    }
    $db->sql_freeresult($result); 
  • tausche aus gegen:

    Code: Alles auswählen

    while ($row = $db->sql_fetchrow($result))
    {
        if(!in_array((int) $row['topic_id'], not_allowed_hook_topics()))
        {
            $topic_list[] = (int) $row['topic_id'];
        }
    } 
  • Finde in der includes/functions.php:
    ?>
  • davor füge ein:

    Code: Alles auswählen

    function not_allowed_hook_topics()
    {
        global $db, $user;
    
        $allowed_topics = $not_allowed_topics = array();
    
        $sql = 'SELECT topic_id FROM ' . HOOKUP_MEMBERS_TABLE . '
                WHERE user_id = ' . $user->data['user_id'];
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result))
        {
            $allowed_topics[] = (int) $row['topic_id'];
        }
        $db->sql_freeresult($result);
    
        if (sizeof($allowed_topics))
        {
            $sql = 'SELECT topic_id FROM ' . HOOKUP_MEMBERS_TABLE . ' 
                WHERE ' . $db->sql_in_set('topic_id', $allowed_topics, true);
        }
        else
        {
            $sql = 'SELECT topic_id FROM ' . HOOKUP_MEMBERS_TABLE;
        }
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result))
        {
            $not_allowed_topics[] = (int) $row['topic_id'];
        }
        $db->sql_freeresult($result);
        
        return $not_allowed_topics;
    } 
Die User, die auf der Terminplaner-Liste sind, können das jeweilge Thema sehen und auch darin posten / lesen. Alle anderen können das nicht.
Das funktioniert alles soweit 1A. :)
Gibt es eine Möglichkeit, eine Gruppe oder 1-2 Benutzer automatisch immer alles sehen zu lassen? (ohne das sie eingeladen sind)
Geht das?

Re: Thema mit Passwort schützen

Verfasst: 26.12.2012 23:52
von Miriam
Ich sage einfach mal: Ja.

Mußt es halt nur hinein programmieren; mit dem aktuellen Code geht es nicht.

Re: Thema mit Passwort schützen

Verfasst: 27.12.2012 08:27
von ace
Kann das jemand?

Ich muss da leider passen!