The example in this article describes the modification method of deducting membership points from the top of the Empire CMS. Share it with everyone for your reference. The specific implementation method is as follows:
1. Add int field top radio button 0, 1 (0 means no, 1 means yes) in the required system model
2. Modify e/ class/qinfofun.php found in the file
esetcookie("lastaddinfotime",time(),time() 3600*24);
until//-------------
Replace all with:
The code is as follows:
//置顶扣分 $t=$empire->fetch1("select top from {$dbtbpre}ecms_".$tbname." where userid='$muserid' and id='$id' and classid='$classid' limit 1"); if($t[top]) { $w=$empire->fetch1("select userfen from {$dbtbpre}enewsmember where userid='$muserid'"); if($w[userfen]>=10) { $sql3=$empire->query("update {$dbtbpre}enewsmember set userfen=userfen-10 where userid='$muserid'"); printerror("AddQinfoSuccess",$reurl,1); } else { $sql4=$empire->query("update {$dbtbpre}ecms_".$tbname." set top=0 where userid='$muserid' and id='$id' and classid='$classid' limit 1"); printerror("jifenbugou",$reurl,1); } } else{printerror("AddQinfoSuccess",$reurl,1);} } else {printerror("DbError","history.go(-1)",1);} }
Recommended to study "Empirecms Tutorial"
3. Modify e/class/qinfofun.php and find the
code in the file as follows:
if($sql) { $reurl=DoingReturnUrl("ListInfo.php?mid=$mid",$add['ecmsfrom']); if($add['editgotoinfourl']&&$infor['checked'])//返回内容页 { if($cr['showdt']==1) { $reurl=$public_r[newsurl]."e/action/ShowInfo/?classid=$classid&id=$id"; } elseif($cr['showdt']==2) { $reurl=$public_r[newsurl]."e/action/ShowInfo.php?classid=$classid&id=$id"; } else { $reurl=$titleurl; } }
to //--------------- Replace it with:
The code is as follows:
//置顶扣分 $t=$empire->fetch1("select top from {$dbtbpre}ecms_".$tbname." where userid='$muserid' and id='$id' and classid='$classid' limit 1"); if($t[top]) { $w=$empire->fetch1("select userfen from {$dbtbpre}enewsmember where userid='$muserid'"); if($w[userfen]>=10) { $sql3=$empire->query("update {$dbtbpre}enewsmember set userfen=userfen-10 where userid='$muserid'"); printerror("EditQinfoSuccess",$reurl,1); } else { $sql4=$empire->query("update {$dbtbpre}ecms_".$tbname." set top=0 where userid='$muserid' and id='$id' and classid='$classid' limit 1"); printerror("jifenbugou",$reurl,1); </p> <p> } } else{printerror("EditQinfoSuccess",$reurl,1);} } else {printerror("DbError","history.go(-1)",1);} }
Note that the 10 in the part is set by yourself for the deducted points, and jifenbuzhu can provide the prompts he needs in e/data/language/gb/pub/q_message. Added in php (gb2312 version)
This field is added mainly to avoid conflicts with the boss’s firsttitle and to avoid trouble caused by future upgrades
If the member has insufficient points, it will prompt that there are insufficient points but information It can still be submitted but cannot be pinned.
Call the method in the list template:
The code is as follows:
[e:loop={"select * from phome_ecms_house where top=1 and checked=1 and classid='$GLOBALS[navclassid]' limit 3",3,24,0}] <tr onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#F1F5FC'"> <td><?=$bqr[myarea]?></td> <td class="tx"><font color="red">[置顶]</font> <a href="<?=$bqsr[titleurl]?>" title="<?=$bqr[title]?>" target="_blank"><?=$bqr[xiangxidizhi]?></a></td> <td><?=$bqr[shi]?>室<?=$bqr[ting]?>厅</td> <td><?=$bqr[size]?><span class="m">㎡</span></td> <td><?=$bqr[money]?></td> <td align="right"><?=date('Y-m-d',$bqr[newstime])?></td> </tr> [/e:loop]
01.23 Daily update function adds an expiration time field and the top function is invalid after the date expires.
Add the
code to the above list template sql as follows:
and (unix_timestamp(youxiaoqi)-UNIX_TIMESTAMP(NOW()))>0
You can modify the template by yourself, I believe it is not difficult to solve it.
The above is the detailed content of How to deduct membership points from Empire CMS and cancel the top after expiration. For more information, please follow other related articles on the PHP Chinese website!