[x] Navigation

[x] Languages

[x] Design
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.

[x] Downloads (Top)

Anzeige in Block "Groups" ändern
Fragen und Diskussionen zu Modulen / Erweiterungen
Post new topic    Reply to topic    Printer Friendly Page     Forum Index ›  Module & Blöcke

View previous topic :: View next topic  
Author Message
Joerg12
Investigator
Investigator

Offline Offline
Joined: Aug 11, 2006
Posts: 42

PostPosted: 07.02.2009 00:16
Post subject: Anzeige in Block "Groups" ändern

Hallo,

verwendet man das neue Club-Module, kann man sich die 10-Top-Clubs als Block anzeigen lassen.

Leider werden nun aber auch alle Clubs im Block Groups angezeigt. Dies kann bei vielen Clubs dazu führen, daß der Block "Groups" immer länger wird.

Ich wollte nun im Block "Groups" nur 2 Benutzergruppen anzeigen lassen. Alle anderen soll der Block ignorieren.

Der PHP Code sieht folgendermaßen aus:

PHP:
<?php
if (!defined('CPG_NUKE')) { exit; }

if (!
is_active('Groups')) {
$content = 'ERROR';
return trigger_error('Groups module is inactive', E_USER_WARNING);
}

global
$db, $prefix, $userinfo,$lang;
get_lang('forums');
$in_group = array();

// Select all groups where the user is a member
if (isset($userinfo['_mem_of_groups'])) {
$s_member_groups = '';
foreach ($userinfo['_mem_of_groups'] as $id => $name) {
$in_group[] = $id;
if (!empty($name)){
$s_member_groups .= '&nbsp;&nbsp;&nbsp;&nbsp;<a title="'.$name.'" href="' . getlink('Groups&amp;g='.$id) . '">&nbsp;<img src="images/arrow.gif" alt="'.$name.'" border="0" height="9" width="9" /> ' . $name . '</a><br />';
}
}
}
// Select all groups where the user has a pending membership.
if (is_user()) {
$result = $db->sql_query('SELECT g.group_id, g.group_name, g.group_type
FROM '
. $prefix.'_bbgroups g, ' . $prefix.'_bbuser_group ug
WHERE ug.user_id = '
. $userinfo['user_id'] . '
AND ug.group_id = g.group_id
AND ug.user_pending = 1
AND g.group_single_user = 0
ORDER BY g.group_name, ug.user_id'
);
if ($db->sql_numrows($result)) {
$s_pending_groups = '';
while ( $row = $db->sql_fetchrow($result) ) {
$in_group[] = $row['group_id'];
$s_pending_groups .= '&nbsp;&nbsp;&nbsp;&nbsp;<a title="'.$row['group_name'].'" href="' . getlink('Groups&amp;g='.$row['group_id']) . '"> <img src="images/arrow.gif" alt="'.$row['group_name'].'" border="0" height="9" width="9" /> ' . $row['group_name'] . '</a><br />';
}

}
}

// Select all other groups i.e. groups that this user is not a member of
$ignore_group_sql = ( count($in_group) ) ? "AND group_id NOT IN (" . implode(', ', $in_group) . ")" : '';
$result = $db->sql_query("SELECT group_id, group_name, group_type
FROM "
. $prefix."_bbgroups
WHERE group_single_user = 0
$ignore_group_sql
ORDER BY group_name"
);

$s_group_list = '';
while (
$row = $db->sql_fetchrow($result)) {
if ($row['group_type'] != 2 || is_admin()) {
$s_group_list .='&nbsp;&nbsp;&nbsp;&nbsp;<a title="'.$row['group_name'].'" href="' . getlink('Groups&amp;g='.$row['group_id']) . '"> <img src="images/arrow.gif" alt="'.$row['group_name'].'" border="0" height="9" width="9" /> ' . $row['group_name'] . '</a><br />';
}
}

$content = '';
if (isset(
$s_member_groups)) {
$content .= '<img src="images/blocks/group-1.gif" alt="'.$lang['Current_memberships'].'" border="0" height="14" width="17" /> '.$lang['Current_memberships'].'<br />'.$s_member_groups;
}
if (isset(
$s_pending_groups)) {
$content .= '<img src="images/blocks/group-3.gif" alt="'.$lang['Memberships_pending'].'" border="0" height="14" width="17" /> '.$lang['Memberships_pending'].'<br />'.$s_pending_groups;
}
if (
$s_group_list != '') {
$content .= '<img src="images/blocks/group-4.gif" alt="'.$lang['Group_member_join'].'" border="0" height="14" width="17" /> '.$lang['Group_member_join'].'<br />'.$s_group_list;
}
if (!
is_user()) {
$content .= '<br />'.$lang['Login_to_join'];
}

Kann mir jemand sagen, wie ich nur 2 ausgewählte Benutzergruppen (Gruppe1 und Gruppe2) in diesem Block anzeigen lassen kann ?

Vielen Dank !

Gruss
Jörg.


Joerg12's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Dragonfly CMS 9.2.1, PHP 5.2.5, MySQL 5.0.18
Back to top
View user's profile
Joerg12
Investigator
Investigator

Offline Offline
Joined: Aug 11, 2006
Posts: 42

PostPosted: 21.06.2009 15:34
Post subject: Re: Anzeige in Block "Groups" ändern

Hallo,

hmmmm... warum antwortet mir keiner auf dieses Posting ?

Ich suche immer noch jemanden, der mir kurz sagt, wie ich die Datei "block-Groups.php" verändern muß, damit mir NUR die beiden Usergruppen 1+2 (goup_id 1 und 2) angezeigt werden.

Alle anderen Usergruppen mit der group_id 3 und höher sollen ignoriert werden.

Ist doch sicherlich keine große Sache....

Bitte noch einmal um Antwort.

Gruss
Jörg.


Joerg12's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Dragonfly CMS 9.2.1, PHP 5.2.5, MySQL 5.0.18
Back to top
View user's profile
Poldi
Moderator
Moderator

Offline Offline
Joined: Nov 14, 2004
Posts: 705

PostPosted: 21.06.2009 17:57
Post subject: Re: Anzeige in Block "Groups" ändern

Dafür brauchst du nicht den Groups-Block ändern, sondern es sollte reichen, einen einfachen HTML-Block mit den beiden Links zu erstellen ...

Array:
<a href="http://www.deinedomain.de/index.php?name=Groups&g=1"  target="_self">Gruppe 1</a>
<a href="http://www.deinedomain.de/index.php?name=Groups&g=2"  target="_self">Gruppe 2</a>

Nicht unbedingt elegant, aber einfach und funktionell ...

_________________
gG,
Poldi
www.green-dragon.de (Dragonfly 9.2.1)
www.tampones.de (Dragonfly 9.2.1)
www.bfg-deggendorf.de (Dragonfly 9.2.1)
www.sexy-goths.de (Dragonfly 9.1.2.1)
www.gig-hunter.de (deceased)
www.green-dragon.net (Dragonfly CVS ... Testseite)

Poldi's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/1.3.37/4.0.27-5.0.18/4.4.9-5.2.1/9.1.0.0-9.2.1
Back to top
View user's profile Visit poster's website
Joerg12
Investigator
Investigator

Offline Offline
Joined: Aug 11, 2006
Posts: 42

PostPosted: 22.06.2009 21:14
Post subject: Re: Anzeige in Block "Groups" ändern

Hallo Poldi,

genau so habe ich es derzeit auch gelöst, ABER auf diese Art und Weise wird mir dem User nicht angezeigt ob er schon Mitglied in der Benutzergruppe ist, oder nicht. (Sonst bräuchte man ja auch den ganzen Code im Block nicht....)

Gruss
Jörg.


Joerg12's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Dragonfly CMS 9.2.1, PHP 5.2.5, MySQL 5.0.18
Back to top
View user's profile
Poldi
Moderator
Moderator

Offline Offline
Joined: Nov 14, 2004
Posts: 705

PostPosted: 23.06.2009 09:00
Post subject: Re: Anzeige in Block "Groups" ändern

Hmm ...
wie gesagt, bei mir funktioniert der ganze Groups-Block nicht, wird daher etwas schwieriger mit testen, aber ich gucks mir mal an ...

_________________
gG,
Poldi
www.green-dragon.de (Dragonfly 9.2.1)
www.tampones.de (Dragonfly 9.2.1)
www.bfg-deggendorf.de (Dragonfly 9.2.1)
www.sexy-goths.de (Dragonfly 9.1.2.1)
www.gig-hunter.de (deceased)
www.green-dragon.net (Dragonfly CVS ... Testseite)

Poldi's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/1.3.37/4.0.27-5.0.18/4.4.9-5.2.1/9.1.0.0-9.2.1
Back to top
View user's profile Visit poster's website
Poldi
Moderator
Moderator

Offline Offline
Joined: Nov 14, 2004
Posts: 705

PostPosted: 23.06.2009 13:35
Post subject: Re: Anzeige in Block "Groups" ändern

So, auf die Schnelle hab ichs mal etwas geändert ...

Die Gruppen, in denen man Mitglied ist, werden leider immernoch alle angezeigt, daran muß ich noch arbeiten,
aber bei den Gruppen, denen man beitreten kann bzw. bei denen seine Mitgliedschaft noch nicht freigegeben ist (geschlossene Gruppen) werden nur die ersten X Gruppen angezeigt.

In den Zeiten 29 und 48 einfach die 3 durch die ID der Gruppe ersetzen, welche als erste NICHT mehr angezeigt werden soll.

Ich hoffe, das ist in etwa das, was du dir vorgestellt hast ...


PHP:
<?php
if (!defined('CPG_NUKE')) { exit; }

if (!
is_active('Groups')) {
$content = 'ERROR';
return trigger_error('Groups module is inactive', E_USER_WARNING);
}

global
$db, $prefix, $userinfo,$lang;
get_lang('forums');
$in_group = array();

// Select all groups where the user is a member
if (isset($userinfo['_mem_of_groups'])) {
$s_member_groups = '';
foreach ($userinfo['_mem_of_groups'] as $id => $name) {
$in_group[] = $id;
if (!empty($name)){
$s_member_groups .= '&nbsp;&nbsp;&nbsp;&nbsp;<a title="'.$name.'" href="' . getlink('Groups&amp;g='.$id) . '">&nbsp;<img src="images/arrow.gif" alt="'.$name.'" border="0" height="9" width="9" /> ' . $name . '</a><br />';
}
}
}
// Select all groups where the user has a pending membership.
if (is_user()) {
$result = $db->sql_query('SELECT g.group_id, g.group_name, g.group_type
FROM '
. $prefix.'_bbgroups g, ' . $prefix.'_bbuser_group ug
WHERE ug.user_id = '
. $userinfo['user_id'] . '
AND ug.group_id = g.group_id
AND ug.group_id < 3
AND ug.user_pending = 1
AND g.group_single_user = 0
ORDER BY g.group_name, ug.user_id'
);
if ($db->sql_numrows($result)) {
$s_pending_groups = '';
while ( $row = $db->sql_fetchrow($result) ) {
$in_group[] = $row['group_id'];
$s_pending_groups .= '&nbsp;&nbsp;&nbsp;&nbsp;<a title="'.$row['group_name'].'" href="' . getlink('Groups&amp;g='.$row['group_id']) . '"> <img src="images/arrow.gif" alt="'.$row['group_name'].'" border="0" height="9" width="9" /> ' . $row['group_name'] . '</a><br />';
}

}
}

// Select all other groups i.e. groups that this user is not a member of
$ignore_group_sql = ( count($in_group) ) ? "AND group_id NOT IN (" . implode(', ', $in_group) . ")" : '';
$result = $db->sql_query("SELECT group_id, group_name, group_type
FROM "
. $prefix."_bbgroups
WHERE group_single_user = 0
AND group_id < 3
$ignore_group_sql
ORDER BY group_name"
);

$s_group_list = '';
while (
$row = $db->sql_fetchrow($result)) {
if ($row['group_type'] != 2 || is_admin()) {
$s_group_list .='&nbsp;&nbsp;&nbsp;&nbsp;<a title="'.$row['group_name'].'" href="' . getlink('Groups&amp;g='.$row['group_id']) . '"> <img src="images/arrow.gif" alt="'.$row['group_name'].'" border="0" height="9" width="9" /> ' . $row['group_name'] . '</a><br />';
}
}

$content = '';
if (isset(
$s_member_groups)) {
$content .= '<img src="images/blocks/group-1.gif" alt="'.$lang['Current_memberships'].'" border="0" height="14" width="17" /> '.$lang['Current_memberships'].'<br />'.$s_member_groups;
}
if (isset(
$s_pending_groups)) {
$content .= '<img src="images/blocks/group-3.gif" alt="'.$lang['Memberships_pending'].'" border="0" height="14" width="17" /> '.$lang['Memberships_pending'].'<br />'.$s_pending_groups;
}
if (
$s_group_list != '') {
$content .= '<img src="images/blocks/group-4.gif" alt="'.$lang['Group_member_join'].'" border="0" height="14" width="17" /> '.$lang['Group_member_join'].'<br />'.$s_group_list;
}
if (!
is_user()) {
$content .= '<br />'.$lang['Login_to_join'];
}

_________________
gG,
Poldi
www.green-dragon.de (Dragonfly 9.2.1)
www.tampones.de (Dragonfly 9.2.1)
www.bfg-deggendorf.de (Dragonfly 9.2.1)
www.sexy-goths.de (Dragonfly 9.1.2.1)
www.gig-hunter.de (deceased)
www.green-dragon.net (Dragonfly CVS ... Testseite)

Poldi's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/1.3.37/4.0.27-5.0.18/4.4.9-5.2.1/9.1.0.0-9.2.1
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic    Reply to topic    Printer Friendly Page    Forum Index ›  Module & Blöcke
Page 1 of 1
All times are GMT + 1 Hour



Jump to:  


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum




Interactive software released under GNU GPL, Code Credits, Privacy Policy