Codigo para el panel de usuarios

Aca pongo el código para la página de usuarios en organic sa,

<?php
//arg(1) pais
$path = arg(0);
$tid = '';
$term = arg(1);
$term = str_replace('-',' ',$term);
$term = str_replace('.htm','',$term);
$pais_user = '';
if (
$term && !is_numeric($term)) {
$tid = "AND pv.value =  '$term'";
$sql2 = "SELECT count(pf.uid) as cont
        from {profile_values} AS pf
        WHERE pf.value = '$term'
        group by pf.value"
;   
}
if (
$term == '') {
$sql2 = 'SELECT count(uid) as cont FROM {users} LIMIT 0 , 30';
print
'no hay pais especifico';
}


$order = $_GET["order"];

switch (
$order) {
case
'':
   
$order = 'u.created DESC';
break;
case
'ciudad':
   
$order = 'pv1.value ASC';
break;
case
'alfa':
   
$order = 'u.name ASC';
break;
}
$sql = 'SELECT Distinct pv1.value, u.name, u.uid, u.picture,  pv.value as pais   
        FROM {profile_values} AS pv1
        INNER JOIN {profile_values} AS pv ON pv.uid = pv1.uid
        INNER JOIN {users} AS u ON u.uid = pv.uid
    WHERE  pv.fid = 1 AND pv1.fid =5 '
. $tid .'  ORDER BY '. $order;               
               
       
$result = pager_query(db_rewrite_sql($sql),12);
$result2 = db_query($sql2);
$num = db_fetch_object($result2);
while(
$usuarios = db_fetch_object($result)) {
if (
$term) { $pais_user = 'en '. $usuarios->pais;}
$pic = theme('imagecache', 'icon', $usuarios->picture);
$pais_dir = $usuarios->pais;
$pais_dir = str_replace(' ','-',$pais_dir);
$pais_link = l($usuarios->pais, "$path/$pais_dir");

$sal = '<div class="pro-box">';
$sal .= '<h3 class="title">'. l($usuarios->name, "user/$usuarios->uid") .'</h3>';
$sal .= '<div class="pro-pic">'$pic .'</div>';
$sal .= '<div class="pro-content">';
$sal .= '<div class="pro-ciudad"><span class="title">Ciudad: </span>'. $usuarios->value .'</div>';
$sal .='<div  class="pro-pais"><span class="title">Pa&iacute;s</span>'. $pais_link .'</div>';
$sal .= '<div class="clear"></div></div></div>';
$list[] = $sal;
}
$output = '<div class="pro-wrapper">'. theme('item_list',$list) .'<div class="clear"></div></div>';

 
 
//armado de los links para el navegador
 
$enlace = arg(0);
  if (
arg(1) != '') {
     
$enlace .= '/'. arg(1);
    }

$link[] = array(
'title' => 'Ciudad',
'href' => $enlace,
'query' => 'order=ciudad',
);
$link[] = array(
'title' => 'Alfabeticamente',
'href' => $enlace,
'query' => 'order=alfa',
);
$link[] = array(
'title' => 'Todos los Usuarios',
'href' => arg(0),
);

  print
'<h2 class="title">Usuarios '. $pais_user .'('. $num->cont .')</h2>';
  print
theme_links($link, $attributes = array('class' => 'users-links'));
  print
$output;
  print
theme('pager', NULL, 12);
?>

cuando haya completado el css,voy a ponerlo debajo del codigo de php, puede ser una buena forma de escribir tutoriales, el codigo en php con su correspondiente CSS.

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><h2><h3><div><del><img><hr>
  • Lines and paragraphs break automatically.
  • You may use [inline:xx] tags to display uploaded files or images inline.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
10 + 6 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.