ThWboard Support-Forum (Archiv)

Ort: / Boardübersicht / Code Hack Requests / gepostet links nur für mitglieder


Seite 1 von 1

forenwurm schrieb am 22.11.2004 um 11:16 Uhr

Hallo,

ist es möglich die von Mitgliedern geposteten Links auch nur für Mitlgieder
breitzustellen?

z.B.:

Für Gast wird ausgegeben: (Dieser Link ist nur für Mitglieder sichtbar)

Für Mitglieder wird der Normale Link ausgegeben.


Kann man dies mittels

if( $g_user['userid'] == 0 )

und

if( $g_user['userid'] != 0 )


realisieren?

--
http://www.forenwurm.de/banner/banner02.gif

PhoenixDH schrieb am 22.11.2004 um 11:18 Uhr

Wäre eigentlich keine schlechte Idee, nur die Realisierung dürfte so einfach wie du sie beschreibst glaube ich nicht sein !

Aber wenn dann sollten nicht alle Links verschlüsselt sein, sondern nur die gewünschten, also bräuchte man noch einen neuen TAG oin dem man das definiert !

Luki schrieb am 22.11.2004 um 11:41 Uhr

sollte eigentlich ziemlich einfach sein in der thwbcode.php halt eben mit der Guest Abfrage...

müsste man halt alle URL Tags ein wenig umformen a la z.B.

if if( $g_user['userid'] == 0 )

// http://www.thwboard.de
$a_thwbcode[SEARCH][] = "/(^|[\]\( \n])([a-zA-Z0-9.\-+]+):\/\/([^ \"\n]+?)([\?!,\.\)]*)(?=[ \"\n\[]|$)/";
$a_thwbcode[REPLACE][] = '[noparse]<a href="register.php" target="_blank">*Links nur für Mitglieder*</a>';

else

// http://www.thwboard.de
$a_thwbcode[SEARCH][] = "/(^|[\]\( \n])([a-zA-Z0-9.\-+]+):\/\/([^ \"\n]+?)([\?!,\.\)]*)(?=[ \"\n\[]|$)/";
$a_thwbcode[REPLACE][] = '\1[noparse]<a href="\2://\3" target="_blank">[/noparse]\2://\3</a>\4';

forenwurm schrieb am 22.11.2004 um 12:14 Uhr

@Luki,

das ganze bitte nocheinmal ohne aktive Code-Formatierung.

(ps. "müsste" oder funktioniert es damit wirklich?)

MrNase schrieb am 22.11.2004 um 12:30 Uhr

Das sollte eigentlich funktionieren..


Allerdings muss:

function get_thwb_tags()
{
    global $style, $a_thwbcode, $a_thwbcode2nd;

mit

function get_thwb_tags()
{
    global $style, $a_thwbcode, $a_thwbcode2nd, $g_user;

ersetzt werden.

Lukas? Denkst du bitte an die { und }? ;)

PhoenixDH schrieb am 22.11.2004 um 12:35 Uhr

Finde es aber nicht so sinnvoll das es für jeden Link passiert, könnte man ja was neues definieren mmit neuem TAG z.B. [HIDE] [/HIDE], das nur die gewünschten Links versteckt sind ! Denn weiß net ob das so ansprewchend ist, wenn ein Gast ins Forum kommt und keine Links sieht !

MrNase schrieb am 22.11.2004 um 12:50 Uhr

Es gibt Leute die Gästen garnix zeigen :)


Lukas Version da oben funktioniert eigentlich.. Ihr müsst nur aus dem "if if" ein einzelnes "if" machen. Denkt aber bitte daran, dass er nur verdeutlichen wollte wie es geht. Ihr müsst schon ein bissl mehr editieren damit es für alle Links funktioniert :)

forenwurm schrieb am 22.11.2004 um 12:53 Uhr

@PhoenixDH

...wenn ein Gast ins Forum kommt und keine Links sieht !

Gäste werden mit *Links nur für Mitglieder* darauf hingewiesen...

Luki schrieb am 22.11.2004 um 13:05 Uhr

wenn du es umgebaut hast wäre es cool, wenn du das bei hacks.slware.com posten könntest :)

du hattest hier eben noch einen fetten Code Block stehen den würde ich einfach bei


if( $g_user['userid'] == 0 )

hierher posten nur halt mit der abänderung, das bei Replace halt dein Wunschtext steht...

else

hier würde ich den orginalen Code Block hinpflanzen



und natürlich noch wie mrnase zeigt die Funktion:
function get_thwb_tags() abändern!

forenwurm schrieb am 22.11.2004 um 13:30 Uhr

Hallo MrNase / Luki

könntest du Bitte ein "Komplett" Paket schnüren damit alle Linkvariationen funktionieren?


Danke...

forenwurm schrieb am 22.11.2004 um 15:30 Uhr

Hallo habe es nun wie folgt:


##########

// Postetlinks nur für Mitglieder [START1]
if( $g_user['userid'] == 0 )
{
// http://www.thwboard.de
$a_thwbcode[SEARCH][] = "/(^|[ \n])([a-zA-Z0-9.\-+]+):\/\/([^ \"\n]+?)([\?!,\.]*)(?=[ \"\n]|$)/";
$a_thwbcode[REPLACE][] = '<font color="#CC0000">*Link nur für Mitglieder sichtbar*</font>';
}

// http://www.thwboard.de
$a_thwbcode[SEARCH][] = "/(^|[ \n])([a-zA-Z0-9.\-+]+):\/\/([^ \"\n]+?)([\?!,\.]*)(?=[ \"\n]|$)/";
$a_thwbcode[REPLACE][] = '\1[noparse]<a href="\2://\3" target="_blank">[/noparse]\2://\3</a>\4';
// Postetlinks nur für Mitglieder [END1]

// Postetlinks nur für Mitglieder [START2]
if( $g_user['userid'] == 0 )
{
// www.thwboard.de
$a_thwbcode[SEARCH][] = "/(^|[ \n])www\.([^ \"\n]+?)([\?!,\.]*)(?=[ \"\n]|$)/i";
$a_thwbcode[REPLACE][] = '<font color="#CC0000">*Link nur für Mitglieder sichtbar*</font>';
}

// www.thwboard.de
$a_thwbcode[SEARCH][] = "/(^|[ \n])www\.([^ \"\n]+?)([\?!,\.]*)(?=[ \"\n]|$)/i";
$a_thwbcode[REPLACE][] = '\1[noparse]<a href="http://www.\2" target="_blank">[/noparse]www.\2</a>\3';
// Postetlinks nur für Mitglieder [END2]

// Postetlinks nur für Mitglieder [START3]
if( $g_user['userid'] == 0 )
{
// www.thwboard.de
$a_thwbcode[SEARCH][] = "/\[url\]www\.([^ ,\"\n]+)\[\/url\]/Ui";
$a_thwbcode[REPLACE][] = '<font color="#CC0000">*Link nur für Mitglieder sichtbar*</font>';
}

// www.thwboard.de
$a_thwbcode[SEARCH][] = "/\[url\]www\.([^ ,\"\n]+)\[\/url\]/Ui";
$a_thwbcode[REPLACE][] = '[noparse]<a href="http://www.\1" target="_blank">www.\1</a>[/noparse]';
// Postetlinks nur für Mitglieder [END3]

// Postetlinks nur für Mitglieder [START4]
if( $g_user['userid'] == 0 )
{
// http://www.thwboard.de
$a_thwbcode[SEARCH][] = "/\[url\]([a-zA-Z0-9.\-+]+):\/\/([^ \"\n]+)\[\/url\]/Ui";
$a_thwbcode[REPLACE][] = '<font color="#CC0000">*Link nur für Mitglieder sichtbar*</font>';
}

// http://www.thwboard.de
$a_thwbcode[SEARCH][] = "/\[url\]([a-zA-Z0-9.\-+]+):\/\/([^ \"\n]+)\[\/url\]/Ui";
$a_thwbcode[REPLACE][] = '[noparse]<a href="\1://\2" target="_blank">\1://\2</a>[/noparse]';
// Postetlinks nur für Mitglieder [END4]

// Postetlinks nur für Mitglieder [START5]
if( $g_user['userid'] == 0 )
{
// [url=""]
$a_thwbcode[SEARCH][] = "/\[url=\"([a-zA-Z0-9.\-+]+):\/\/([^ \"\n]+)\"\](.*)\[\/url\]/Usi";
$a_thwbcode[REPLACE][] = '<font color="#CC0000">*Link nur für Mitglieder sichtbar*</font>';
}

// [url=""]
$a_thwbcode[SEARCH][] = "/\[url=\"([a-zA-Z0-9.\-+]+):\/\/([^ \"\n]+)\"\](.*)\[\/url\]/Usi";
$a_thwbcode[REPLACE][] = '[noparse]<a href="\1://\2" target="_blank">[/noparse]\3</a>';
// Postetlinks nur für Mitglieder [END5]

// Postetlinks nur für Mitglieder [START6]
if( $g_user['userid'] == 0 )
{
// [url="www.thwboard.de"]
$a_thwbcode[SEARCH][] = "/\[url=\"www\.([^ \"\n]+)\"\](.*)\[\/url\]/Usi";
$a_thwbcode[REPLACE][] = '<font color="#CC0000">*Link nur für Mitglieder sichtbar*</font>';
}

$a_thwbcode[SEARCH][] = "/\[url=\"www\.([^ \"\n]+)\"\](.*)\[\/url\]/Usi";
$a_thwbcode[REPLACE][] = '[noparse]<a href="http://www.\1" target="_blank">[/noparse]\2</a>';
// Postetlinks nur für Mitglieder [END6]

##########

Hi,

wenn ich else einsetze kommt einfach nur ein weißer Bildschirm.

ohne esle funktioniert es nun das bei einem Link:
*Link nur für Mitglieder sichtbar* steht, jedoch auch für Mitlgieder?

was mass mann hier nun noch ändern?

MrNase schrieb am 22.11.2004 um 15:42 Uhr

Hast du die Ergänzung wie in Beitrag 004 beschrieben gemacht?

forenwurm schrieb am 22.11.2004 um 15:46 Uhr

aja, danke MrNase,

ganz übersehen...

scheint nun zu funktionieren...


Aber! was is denn jetzt mit dem "else" ? habe ja nun jediglich

if( $g_user['userid'] == 0 )
{

---

}

zu stehen...

und sind das jetzt alle Urlvarianten die ich jetzt geändert habe?

forenwurm schrieb am 22.11.2004 um 17:28 Uhr

Hallo, habe es nun eingefügt:

*close*

Luki schrieb am 22.11.2004 um 17:37 Uhr

cool :) bitte @hacks.slware.com :)

Luki schrieb am 22.11.2004 um 18:15 Uhr

ich würde die Links dann auf die Anmeldung setzen also:
<a href="register.php" .... *nur für Mitglieder* </a>

PhoenixDH schrieb am 23.11.2004 um 09:16 Uhr

Könnt ihr das jetzt mal auf hacks.slware.com veröffentlichen mit den Änderungen ?

forenwurm schrieb am 23.11.2004 um 14:58 Uhr

http://hacks.slware.com/tboard/showtopic.php?threadid=696

Seite 1 von 1