userlist with columns

17 years 7 months ago #19145 by PekkaM
userlist with columns was created by PekkaM
I would like to create a userlist with many users in a row. It could be very simple, for example only a picture and users name below the pic. Then, if a have a site with about 30 users, i could show them all in a single page.

That would be very nice. I have tried to find this feature in CB, but I haven't found it.

-Pekka

Please Log in to join the conversation.

17 years 7 months ago #19165 by spikec

Please Log in to join the conversation.

17 years 7 months ago #19572 by zephhk
Replied by zephhk on topic Re:userlist with columns
I have been looking for the same solution, (with simply 2 columns of users on the userlist page). The solution spikec referenced in the previous post does not pertain to the current verion of CB.

It does provide clues as to how it can be done, but manipulating php code isn't a stong suite of mine.

Has anyone had success modifying the userlist to more than one column of users? (in CB Stable)

Please Log in to join the conversation.

17 years 7 months ago #19587 by spikec
Replied by spikec on topic Re:userlist with columns
It works fine on my site running 1.01....

Please Log in to join the conversation.

17 years 7 months ago #19602 by zephhk
Replied by zephhk on topic Re:userlist with columns
Really?! :)

That is very interesting. Would you mind posting your URL so we can check it out? Also, if you would be so kind to give any insight into the changes you made that would be wonderful. Here is my userlist, as you can tell, it desperatly needs a 2 column approach...
www.rockstardallas.com/index.php?option=com_comprofiler&task=usersList

Concerning hermanandp's solution, it appears the code block is different in the current version of CB from when he posted his sample. For example, from hermanandp:

1. locate file- comprofiler.html
2. locate the area-
/******************************
List Functions
******************************/
3. within this find the code-

[code:1]<?php
$i = 1;
foreach($users as $user) {
$evenodd = $i % 2;
if ($evenodd == 0) {
$class = "sectiontableentry1";
} else {
$class = "sectiontableentry2";
}
//print $user->name;
if($ueConfig==1) {
$onclick = "onclick=\"javascript:window.location='".sefRelToAbs("index.php?option=com_comprofiler&amp;task=userProfile&amp;user=".$user->id)."'\"";
$style="style=\"cursor:hand;cursor:«»pointer;\"";
}
print "\t<tr class=\"$class\" ".$style."
".$onclick.">\n";
//print $lfields;
$str = null;
eval("\$str = \"$lfields\";"«»);
echo $str. "\n";


print "\t</tr>\n";
$i++;
}
?>
[/code:1]

and replace it with-

[code:1]
<tr>
<?php
$i = 1;
foreach($users as $user) {
$endofrow= 0;

//print $user->name;
if($ueConfig==1) {
$onclick = "onclick=\"javascript:window.location='".sefRelToAbs("index.php?option=com_comprofiler&amp;task=userProfile&amp;user=".$user->id)."'\"";
$style="style=\"cursor:hand;cursor:«»pointer;\"";
}

//print $lfields;
$str = null;
eval("\$str = \"$lfields\";"«»);
echo $str. "\n";



$oneinthree = $i % 3;
if ($oneinthree == 0) {
print "\t</tr><tr>\n";
$endofrow= 1;
}

$i++;


}

if ($endofrow == 0) {
print "\t</tr>\n";
}


?>[/code:1]


Now in the current version of CB it appears we must:

1. locate file- comprofiler.html.php
2. locate the area-
/******************************
List Functions
******************************/
3. within this find the code-

[code:1]
</tr>
<?php
$i = 0;
if (is_array($users) && count($users)>0) {
foreach($users as $user) {
$evenodd = $i % 2;
if ($evenodd == 0) {
$class = "sectiontableentry1";
} else {
$class = "sectiontableentry2";
}
//print $user->name;
if($ueConfig==1) {
$style = "style=\"cursor:hand;cursor:«»pointer;\"";
$style .= " id=\"cbU".$i."\"" ;
// $style .= " onclick=\"javascript:window.location='".sefRelToAbs("index.php?option=com_comprofiler&amp;task=userProfile&amp;user=".$user->id.$option_itemid)."'\"";
} else {
$style = "";
}
if ($user->banned) {
$colsNbr = 1+($row->col2enabled ? 1:0)+($row->col3enabled ? 1:0)+($row->col4enabled ? 1:0);
echo "\t<tr class=\"$class\"><td colspan=\"".$colsNbr."\"><span class=\"error\" style=\"color:red;\">"._UE_BANNEDUSER." ("._UE_VISIBLE_ONLY_MODERATOR."«») :</span></td></tr>";
}
print "\t<tr class=\"$class\" ".$style.">\n";
//print $lfields;
$str = null;
eval("\$str = \"$lfields\";"«»);
echo $str. "\n";
print "\t</tr>\n";
$i++;
}
} else {
$colsNbr = 1+($row->col2enabled ? 1:0)+($row->col3enabled ? 1:0)+($row->col4enabled ? 1:0);
echo "\t<tr class=\"sectiontableentry1\"><td colspan=\"".$colsNbr."\">"._UE_NO_USERS_IN_LIST."</td></tr>";
}
?>[/code:1]

And this is where I get lost... :blink:

It seems the principal of the change might be the same, but I am a mere coding mortal. (design background) Any insight into this would be greatly appreciated.

-zep

Please Log in to join the conversation.

17 years 7 months ago #19721 by zephhk
Replied by zephhk on topic Re:userlist with columns
Well, it's like my dad used to tell me, "Son, even a broken clock is right twice a day, now go get me a beer".

That being said, it appears I succeeded in achieving the 2 column layout in CB Stable. I played around with hermanandp's solution and came up with this. I am not sure if this code configuration will cause the world to come to an end tomorrow, but it seems to work today. (so use it at your own risk) If any php guru's have any suggestions on improvements, fire away.

So, here goes:

1. locate file- comprofiler.html.php
2. locate the area-
/******************************
List Functions
******************************/
3. within this find the code-

[code:1]<?php
$i = 0;
if (is_array($users) && count($users)>0) {
foreach($users as $user) {
$evenodd = $i % 2;
if ($evenodd == 0) {
$class = "sectiontableentry1";
} else {
$class = "sectiontableentry2";
}
//print $user->name;
if($ueConfig==1) {
$style = "style=\"cursor:hand;cursor:«»pointer;\"";
$style .= " id=\"cbU".$i."\"" ;
// $style .= " onclick=\"javascript:window.location='".sefRelToAbs("index.php?option=com_comprofiler&amp;task=userProfile&amp;user=".$user->id.$option_itemid)."'\"";
} else {
$style = "";
}
if ($user->banned) {
$colsNbr = 1+($row->col2enabled ? 1:0)+($row->col3enabled ? 1:0)+($row->col4enabled ? 1:0);
echo "\t<tr class=\"$class\"><td colspan=\"".$colsNbr."\"><span class=\"error\" style=\"color:red;\">"._UE_BANNEDUSER." ("._UE_VISIBLE_ONLY_MODERATOR."«») :</span></td></tr>";
}
print "\t<tr class=\"$class\" ".$style.">\n";
//print $lfields;
$str = null;
eval("\$str = \"$lfields\";"«»);
echo $str. "\n";
print "\t</tr>\n";
$i++;
}
} else {
$colsNbr = 1+($row->col2enabled ? 1:0)+($row->col3enabled ? 1:0)+($row->col4enabled ? 1:0);
echo "\t<tr class=\"sectiontableentry1\"><td colspan=\"".$colsNbr."\">"._UE_NO_USERS_IN_LIST."</td></tr>";
}
?>
[/code:1]
and replace it with this:

[code:1]
<?php
$i = 1;
foreach($users as $user) {
$endofrow= 0;

//print $user->name;
if($ueConfig==1) {
$onclick = "onclick=\"javascript:window.location='".sefRelToAbs("index.php?option=com_comprofiler&amp;task=userProfile&amp;user=".$user->id)."'\"";
$style="style=\"cursor:hand;cursor:«»pointer;\"";
}

//print $lfields;
$str = null;
eval("\$str = \"$lfields\";"«»);
echo $str. "\n";
$oneintwo = $i % 2;
if ($oneintwo == 0) {
print "\t</tr><tr>\n";
$endofrow= 1;
}
$i++;
}
if ($endofrow == 0) {
print "\t</tr>\n";
}
else {
$colsNbr = 1+($row->col2enabled ? 1:0)+($row->col3enabled ? 1:0)+($row->col4enabled ? 1:0);
echo "\t<tr class=\"sectiontableentry1\"><td colspan=\"".$colsNbr."\">"._UE_NO_USERS_IN_LIST."</td></tr>";
}
?>[/code:1]

You can check out the end result here, however, I used some additional mods on this page not included in this example (to remove the search function and user list at the top of the page)

www.rockstardallas.com/index.php?option=com_comprofiler&task=usersList

Enjoy

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.292 seconds

Facebook Twitter LinkedIn