Hallo, Gast! (Registrieren)

Wir wünschen allen Besuchern frohe Ostern!

Letzte Ankündigung: MyBB 1.8.37 veröffentlicht (04.11.23)


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste
Plugin nur für bestimmte benutzergruppen
#21
Super es klappt schon mal Smile Gäste können es nicht sehen und ich als admin sehe es Wink

So jetzt bitte noch zum verstehen Wink
Da ich das ja auch mit andere Plugins vor habe...

if($mybb->user['uid'] != '0')
Das ist ist die Benutzergruppe für die das Plugin funktioniert oder?

Mommentan Funktioniert das Plugin ja für ALLE angemeldete User.
Es soll aber nur für Mods, Supermods, admin und in meinem Fall die Benutzergruppe jugglewuggle funktionieren.
Achtung
 nehmen Sie diese Beiträge nicht ernst! Das MyBB wissen beruht auf
(letzter Stand: MyBB 1.2.8)
Zitieren
#22
if($mybb->user['uid'] != '0') führt dazu, dass es für alle Benutzer funktioniert, deren ID nicht 0 ist, d.h. für alle angemeldeten Benutzer. Wenn du es nur bestimmten Benutzergruppen zeigen willst, ersetze die Zeile durch folgende, wobei x, y und z die IDs der berechtigten Benutzergruppen sind.
PHP-Code:
if($mybb->user['usergroup'] == 'x' || $mybb->user['usergroup'] == 'y' || $mybb->user['usergroup'] == 'z'

Gruß,
Michael
[Bild: banner.png]
Support erfolgt NUR im Forum!
Bitte gelöste Themen als "erledigt" markieren.
Beiträge mit mangelhafter Rechtschreibung/Grammatik werden kommentarlos gelöscht.
Zitieren
#23
Cool es funktioniert.
Danke Michael Wink

Jetzt versuche ich mal mein glück bei den anderen sachen Wink
Achtung
 nehmen Sie diese Beiträge nicht ernst! Das MyBB wissen beruht auf
(letzter Stand: MyBB 1.2.8)
Zitieren
#24
Hey ich habe versucht das tagpad plugin zu ändern aber irgendwie geht das nicht.


PHP-Code:
<?php
/*
Plugin Tagpad
(c) 2007 by Jesse Labrocca
Website: http://www.mybbcentral.com
*/

//PLUGIN HOOKS
// $plugins->add_hook("postbit", "tagpad");


// The information that shows up on the plugin manager
function tagpad_info()
{
        return array(
                
"name"                => "Tagpad",
                
"description"        => "Dieses Plugin wird ein kleines, cooles Tagpad in das Forum setzen.",
                
"website"                => "http://www.talkvideogames.com",
                
"author"                => "Jesse Labrocca",
                
"authorsite"        => "http://www.mybbcentral.com",
                
"version"                => "1.0",
                
'guid'          => '8b70f38a8a887c63659ebfd865c1d24c'
        
);
}


// This function runs when the plugin is activated.
function tagpad_activate()
{
 
// Feststellen, dass Benutzer angemeldet ist
    
if($mybb->user['usergroup'] == '9' || $mybb->user['usergroup'] == '4' || $mybb->user['usergroup'] == '3' || $mybb->user['usergroup'] == '6')  {
    
// Code umwandeln
global $db;

    
$tagpad_group = array(
        
"gid" => "NULL",
        
"name" => "tagpad",
        
"title" => "Tagpad",
        
"description" => "Tagpad-Einstellungen f&uuml;r das Board",
        
"disporder" => "29",
        
"isdefault" => "no",
        );
    
$db->insert_query(TABLE_PREFIX."settinggroups"$tagpad_group);
    
$gid $db->insert_id();


    
$tagpad_1 = array(
        
"sid" => "NULL",
        
"name" => "tagpad_guests",
        
"title" => "Erlaube G&auml;ste-Tagpad",
        
"description" => "W&auml;hle \"Ja\", um G&auml;sten den Zugriff auf das Tagpad zu erlauben.",
        
"optionscode" => "yesno",
        
"value" => "no",
        
"disporder" => "1",
        
"gid" => intval($gid),
        );
    
$db->insert_query(TABLE_PREFIX."settings"$tagpad_1);


    
$tagpad_2 = array(
        
"sid" => "NULL",
        
"name" => "tagpad_badwords",
        
"title" => "Tagpad Badwords",
        
"description" => "W&auml;hle \"Ja\", um den MyBB Badword-Filter anzuwenden.",
        
"optionscode" => "yesno",
        
"value" => "yes",
        
"disporder" => "2",
        
"gid" => intval($gid),
        );
    
$db->insert_query(TABLE_PREFIX."settings"$tagpad_2);

    
$tagpad_3 = array(
        
"sid" => "NULL",
        
"name" => "tagpad_archive",
        
"title" => "Anzahl Tags f&uuml;r Archivierung",
        
"description" => "Dies ist die Anzahl an Tags, bevor eine Seite archiviert wird.",
        
"optionscode" => "text",
        
"value" => "32",
        
"disporder" => "3",
        
"gid" => intval($gid),
        );
    
$db->insert_query(TABLE_PREFIX."settings"$tagpad_3);

        
$tagpad_template_1 = array(
                
"tid"                => NULL,
                
"title"                => 'tagpad',
                
"template"        => '<html>
<head>
<title>{\$mybb->settings[bbname]} - Tagpad</title>
{\$headerinclude}
</head>
<body >
{\$header}
<table border="0" cellspacing="{\$theme[borderwidth]}" cellpadding="{\$theme[tablespace]}" class="tborder">
<tr>
<td class="thead"><strong>Klicke auf das Pad um ein Tag zu platzieren.</strong></td>
</tr>
<tr>
<td>
<div style="display:block; background:#fff; padding-left:100px;">
<div style="width:220px; padding-top:150px;float:left;visibility:{\$tagdisplay};">

<form action="tagpad.php" method="post">
Text: <input type="text" name="ps" maxlength="30" style="width: 100px;" /><br />
Farbe: <select name="tc" size="1">
<option value="black">Schwarz</option>
<option value="red">Rot</option>
<option value="green">Gr&uuml;n</option>
<option value="blue">Blau</option>
</select><br />
Font:
<select name="fn" size="1">
{\$fontlist}
</select><br />
Gr&ouml;&szlig;e:
<select name="size" size="1">
<option value="12">klein</option>
<option value="16">medium</option>
<option value="20">gro&szlig;</option>
</select>
<br />
Winkel (Grad): <input type="text" name="an" maxlength="3" style="width: 45px;" value="0" /><br />
<input type="submit" value="Tag!" />
<input type="hidden" value="{\$tagquery}" name="point" />
</form>

</div>
<div id="tagboard">
<img src="tagpad/tagpad_top.jpg" width="400" height="53" alt="tagtop" /><br />
<a href="tagpad.php"><img src="tagpad/tagpad.jpg?{\$tagrand}" ismap width="400" height="615" style="border: 0" alt="Klicke auf irgendeinen Bereich um den Text zu platzieren." /></a>
</div>
</div>
</td>
</tr>
</table>
{\$footer}
</body>
</html>'
,
                
"sid"                => "-1",
                
"version"        => "1.0",
                
"dateline"        => time(),
        );

        
$db->insert_query(TABLE_PREFIX."templates"$tagpad_template_1);



        require 
"../inc/adminfunctions_templates.php";
        
find_replace_templatesets("header"'#toplinks_help}</a></li>#'"toplinks_help}</a></li>\n\n<li><a href=\"{\$mybb->settings[bburl]}/tagpad.php\"><img src=\"{\$mybb->settings[bburl]}/{\$theme[imgdir]}/toplinks/tagpad.png\" alt=\"tagpad\" />Tagpad</a></li>");
    
rebuildsettings();
}


// This function runs when the plugin is deactivated.
function tagpad_deactivate()
{

global 
$db;

    
$query $db->query("SELECT gid FROM ".TABLE_PREFIX."settinggroups WHERE name='tagpad'");
    
$g $db->fetch_array($query);
    
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE gid='".$g['gid']."'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE gid='".$g['gid']."'");
        
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title = 'tagpad'");

        require 
"../inc/adminfunctions_templates.php";
        
find_replace_templatesets("header"'#'.preg_quote('<li><a href="{$mybb->settings[bburl]}/tagpad.php"><img src="{$mybb->settings[bburl]}/{$theme[imgdir]}/toplinks/tagpad.png" alt="tagpad" />Tagpad</a></li>').'#'"",0);

    
rebuildsettings();
}

function 
tagpad()
{

        global 
$mybb$db;



}


?>
So wie ich es gemacht habe gibt das ja keinen sinn.
Das scheint nur zu an/ausschalten des plugins zu sein.
Wo ist denn der fraglichen teil.?
Achtung
 nehmen Sie diese Beiträge nicht ernst! Das MyBB wissen beruht auf
(letzter Stand: MyBB 1.2.8)
Zitieren
#25
Du musst den Code in die Funktion tagpad() einbauen und nicht in die Funktion tagpad_activate(). Diese enthält die Anweisungen, die zur Aktivierung notwendig sind. Beim Betrieb wird der Code nicht mehr ausgeführt.

Gruß,
Michael
[Bild: banner.png]
Support erfolgt NUR im Forum!
Bitte gelöste Themen als "erledigt" markieren.
Beiträge mit mangelhafter Rechtschreibung/Grammatik werden kommentarlos gelöscht.
Zitieren
#26
PHP-Code:
<?php

define
("IN_MYBB"1);

$templatelist "tagpad";

require 
"./global.php";

add_breadcrumb("Tagpad""tagpad.php");

if (
$mybb->settings['tagpad_guests'] == "no" && $mybb->user['uid'] == '0'){

    
header("Location:member.php?action=login");
    exit;
}
 
// Feststellen, dass Benutzer angemeldet ist
    
if($mybb->user['usergroup'] == '9' || $mybb->user['usergroup'] == '4' || $mybb->user['usergroup'] == '3' || $mybb->user['usergroup'] == '6')  {
    
// Code umwandeln

   
if(isset($_POST['ps']) && isset($_POST['tc']) && isset($_POST['an']) && isset($_SERVER['QUERY_STRING'])) {
         if(
file_exists('tagpad/tag.count')) {
         
$tagcount str_replace("\n"''join(''file('tagpad/tag.count')));
         
$fh fopen('tagpad/tag.count''w');
            if(
$tagcount $mybb->settings['tagpad_archive']) {
               ++
$tagcount;
               
fwrite($fh$tagcount);
               
fclose($fh);
            } else {
               
fwrite($fh'1');
               
fclose($fh);
               
copy(MYBB_ROOT.'tagpad/tagpad.jpg'MYBB_ROOT.'tagpad/archive/' time() . '.jpg');
               
copy(MYBB_ROOT.'tagpad/clean.jpg''tagpad/tagpad.jpg');
            }
      } else {
         
$fh fopen('tagpad/tag.count''w');
         
fwrite($fh'1');
         
fclose($fh);
      }
      
$im = @imagecreatefromjpeg('./tagpad/tagpad.jpg');
      switch(
$_POST['tc']) {
         case 
'red':
            
$textColor imagecolorallocate($im17956);
            break;
         case 
'green':
            
$textColor imagecolorallocate($im6511874);
            break;
         case 
'blue':
            
$textColor imagecolorallocate($im6099128);
            break;
         case 
'black':
            
$textColor imagecolorallocate($im000);
      }
      
$xy split(','$_POST['point']);



if (
$mybb->settings['tagpad_badwords'] == "yes"){
require_once 
MYBB_ROOT."inc/class_parser.php";
$parser = new Postparser();
$tag $parser->parse_badwords($_POST['ps']);
}else{
$tag $_POST['ps'];
}

      
imagettftext($im,$_POST['size'] , $_POST['an'], intval($xy[0]), intval($xy[1]), $textColor'./tagpad/fonts/'.$_POST['fn'].'.ttf'stripslashes($tag));
      
imagejpeg($im'./tagpad/tagpad.jpg'85);
      unset(
$_POST);
   }



$files listdir('./tagpad/fonts');
foreach (
$files as $fonts){
$fonts str_replace('.ttf''',$fonts);
$fontlist .= '<option value="'.$fonts'">'.$fonts.'</option>';
}

function 
listdir($start_dir=MYBB_ROOT) {

global 
$db$files$mybb;

  
$files = array();
  if (
is_dir($start_dir)) {
    
$fh opendir($start_dir);
    while ((
$file readdir($fh)) !== false) {
      
# loop through the files, skipping . and .., and recursing if necessary
      
if (strcmp($file'.')==|| strcmp($file'..')==0) continue;
      
$filepath $file;
      if ( 
is_dir($filepath) )
        
$files array_merge($fileslistdir($filepath));
      else
        
array_push($files$filepath);
    }
    
closedir($fh);
  } else {
    
# false if the function was called with an invalid non-directory argument
    
$files false;
  }

  return 
$files;

}

$tagquery $_SERVER['QUERY_STRING'];
$tagrand rand(10000100000);

if(!isset(
$_SERVER['QUERY_STRING']) || $tagquery != ""){
 
$tagdisplay "visible";
}else{
 
$tagdisplay "hidden";
}

eval(
"\$tagpad = \"".$templates->get("tagpad")."\";");
output_page($tagpad);

?>

Fehler meldung:
Zitat:Parse error: syntax error, unexpected $end in /users/phoenix-jonglage/www/forum/tagpad.php on line 116
Achtung
 nehmen Sie diese Beiträge nicht ernst! Das MyBB wissen beruht auf
(letzter Stand: MyBB 1.2.8)
Zitieren
#27
In der Zeile 16 bei
PHP-Code:
if($mybb->user['usergroup'] == '9' || $mybb->user['usergroup'] == '4' ||
 
$mybb->user['usergroup'] == '3' || $mybb->user['usergroup'] == '6')  { 
hast Du eine { aufgemacht aber dann nicht geschlossen. Zu dieser Abfrage geht ja auch ab, was passieren soll, wenn die Bedingung eintrifft oder eben nicht.
viele Grüße
Jockl
übersetzte und eigene Plugins
Zitieren
#28
Die Fehlermeldung deutet darauf hin, dass eine geschweifte Klammer nicht geschlossen wurde.

Gruß,
Michael
[Bild: banner.png]
Support erfolgt NUR im Forum!
Bitte gelöste Themen als "erledigt" markieren.
Beiträge mit mangelhafter Rechtschreibung/Grammatik werden kommentarlos gelöscht.
Zitieren