توسط این افزونه برای کاربر در داشبورد به صورت رندوم تعدادی ازکاربران را نمایش و امکان دنبال کردن را فراهم می کند. در فایل system/controllers/dashboard کد زیر را بیابید : کد زیر را قبل از آن قرار دهید به داشبورد قالب رفته کد زیر را در هرکجا که دوست داشتید قرار بدید بعد برو تو […]
توسط این افزونه برای کاربر در داشبورد به صورت رندوم تعدادی ازکاربران را نمایش و امکان دنبال کردن را فراهم می کند.
در فایل system/controllers/dashboard کد زیر را بیابید :
$this->load_template('dashboard.php');
کد زیر را قبل از آن قرار دهید
$who_to_follow_num=5; $D->userw = array(); $D->users = array(); $D->who_to_follow = array(); $x = $db2->query('SELECT * FROM users_followed WHERE who="'.$this->user->id.'" order by id desc'); while($y = $db2->fetch_object($x)) { if($this->user->id!=$y->whom){ $D->userw[]=$y->whom; } } if(count($D->userw)>0){ for($i=0;$i<count($D->userw);$i++){ $x = $db2->query('SELECT * FROM users_followed WHERE who="'.$D->userw[$i].'"'); while($y = $db2->fetch_object($x)) { if($this->user->id!=$y->whom){ $D->users[]=$y->whom; } } } } $D->users = array_diff($D->users,$D->userw); $D->users = array_unique($D->users); if(count($D->users)>0){ foreach($D->users as $users){ if(count($D->who_to_follow)>20){ break; } $D->who_to_follow[] = $this->network->get_user_by_id($users); } $D->who_to_follow = array_slice($D->who_to_follow, 0, $who_to_follow_num); shuffle($D->who_to_follow); }
به داشبورد قالب رفته کد زیر را در هرکجا که دوست داشتید قرار بدید
<div class="slimusergroup" style="margin-right:0px; margin-bottom:0px;"> <?php foreach($D->who_to_follow as $u) { ?> <style> .۱box { background-color: #E7FFCE; border: 1px solid #360; color:#060; font-family:Tahoma, Geneva, sans-serif; border-radius: 5px 5px 5px 5px; margin-bottom: 5px; padding: 5px; } .۲box { background-color: #FFE1E1; border: 1px solid #900; color:#C10000; font-family:Tahoma, Geneva, sans-serif; border-radius: 5px 5px 5px 5px; margin-bottom: 5px; padding: 5px; } </style> <div id="<?= $u->username ?>" align="center" style="background-color:#FFF; border: 1px solid #779403; border-radius: 5px 5px 5px 5px; width:220px;"> <table width="220"> <tr height="50"> <td width="50"> <a href="<?= userlink($u->username) ?>" class="groupavatar" title="<?= htmlspecialchars($u->fullname) ?>"><img src="<?= $C->IMG_URL ?>avatars/thumbs1/<?= $u->avatar ?>" style="width:50px; height:50px;" /></a> </td> <td width="170"> <center> <table> <tr> <center><font style="font-size:14px" face="Tahoma, Geneva, sans-serif" color="#003300"><?= str_cut($u->username,10) ?></font><br /><font face="Tahoma, Geneva, sans-serif" color="#89A38A" style="font-size:12px"><?= str_cut($u->fullname,20) ?><br /></font><font style="font-size:2px"> </font></center> </tr> <tr> <table width="140"> <tr> <td> <a href="javascript:;" id="usr_followbtn_<?= $u->id ?>" onclick="user_follow('<?= $u->username ?>',this,'usr_unfollowbtn_<?= $u->id ?>','<?= addslashes($this->lang('msg_follow_user_on',array('#USERNAME#'=>$u->username))) ?>');" onfocus="this.blur();"><div align="center" style="background-color: #E7FFCE; border: 1px solid #360; color:#060;font-family:Tahoma, Geneva, sans-serif; font-size:11px; border-radius: 5px 5px 5px 5px; margin-bottom: 5px; width:70px;"><b>دنبال کردن</b></div></a> </td> <td> <a href="javascript:;" onclick="visible('<?= $u->username ?>');"><div align="center" style="background-color: #FFDFE2; border: 1px solid #900; color:#C00;font-family:Tahoma, Geneva, sans-serif; font-size:11px; border-radius: 5px 5px 5px 5px; margin-bottom: 5px; width:70px;"><b>نمیشناسم</b></div></a> </td> </tr> </table> </tr> </table></center> </td> </tr> </table> </div> <?php } ?> برای دیدن افراد بیشتر ریفرش کنید (F5) ... <br /> </div> </div>
بعد برو تو js/inside.js و کد زیر رو پیدا کن:
function user_follow(username, thislink, unfollow_linkid, msg_after) { var req = ajax_init(false); if( ! req ) { return; } req.onreadystatechange = function() { if( req.readyState != 4 ) { return; } if( req.responseText != "OK" ) { return; } thislink.style.cursor = "pointer"; thislink.style.display = "none"; if(unfollow_linkid) { d.getElementById(unfollow_linkid).style.display = "block"; } if(msg_after) { slim_msgbox(msg_after); } } req.open("POST", siteurl+"ajax/follow/r:"+Math.round(Math.random()*1000), true); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); req.send("type=on&username="+encodeURIComponent(username)); thislink.style.cursor = "wait"; }
و با این کد عوضش کنید:
function user_follow(username, thislink, unfollow_linkid, msg_after) { var req = ajax_init(false); if( ! req ) { return; } req.onreadystatechange = function() { if( req.readyState != 4 ) { return; } if( req.responseText != "OK" ) { return; } thislink.style.cursor = "pointer"; thislink.style.display = "none"; visible(username); if(unfollow_linkid) { d.getElementById(unfollow_linkid).style.display = "block"; } if(msg_after) { slim_msgbox(msg_after); } } req.open("POST", siteurl+"ajax/follow/r:"+Math.round(Math.random()*1000), true); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); req.send("type=on&username="+encodeURIComponent(username)); thislink.style.cursor = "wait"; }
به heder.php قالب رفته و در تگ head کد زیر را قرار دهید
<script type="text/javascript"> function visible(id) { var m = document.getElementById(id); if( m.style.display == 'none') m.style.display = 'block'; else m.style.display = 'none';} </script>برچسب: افزونه شاید بشناسید، افزونه شاید بشناسید شیرترانیکس، شاید بشناسید شیرترانیکس
تمامی حقوق این سایت محفوظ است.