本帖最后由 曾子图 于 2013-5-9 17:22 编辑
相信很多人不爽dz的活动模块,因为没有添加外挂的选项。
实际情况,很多会员是会带一些新朋友来参加活动,而这些新朋友又不喜欢注册或者不会上网。
所以报名的时候就让人很纠结。
鉴于如此,我找了一下,论坛上也没有很好的解决方法,只有一个插件,简单改了一下留言,变成携带人数。
这样也要收100块(原价500),感觉有点坑爹。
于是自己研究了一下,修改了一下代码。也可以跟实现添加外挂的要求。
下面我把的代码分享给大家,希望对大家有帮助!(我的版本是dz2.5 utf8版,应该gbk和2.0也支持)
1、打开template/default/forum/viewthread_activity.htm
查找
<tr>
<th>{lang leaveword}</th>
<td><textarea name="message" maxlength="200" cols="38" rows="3" class="pt">$applyinfo[message]</textarea></td>
</tr>
大概143-146行,替换成
<tr>
<th>携带</th>
<td><select id="selectedmessage" name="message">
<option value="0">0</option>
<!--{if $activity['number']}-->
{if $aboutmembers > 1}<option value="1">1</option>{/if}
{if $aboutmembers > 2}<option value="2">2</option>{/if}
{if $aboutmembers > 3}<option value="3">3</option>{/if}
{if $aboutmembers > 4}<option value="4">4</option>{/if}
{if $aboutmembers > 5}<option value="5">5</option>{/if}
{if $aboutmembers > 6}<option value="6">6</option>{/if}
{if $aboutmembers > 7}<option value="7">7</option>{/if}
{if $aboutmembers > 8}<option value="8">8</option>{/if}
{if $aboutmembers > 9}<option value="9">9</option>{/if}
{if $aboutmembers > 10}<option value="10">10</option>{/if}
<!--{else}-->
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<!--{/if}-->
</select>人</td>
</tr>
查找
<td><!--{if $apply[message]}--><p>$apply[message]</p><!--{/if}--></td>
大概228行,替换成
<td><!--{if $apply[message]}--><p>携带 $apply[message] 人</p><!--{/if}--></td>
查找
<td><!--{if $_G['forum_thread']['authorid'] == $_G['uid'] && $apply[message]}-->$apply[message]<!--{/if}--></td>
大概265行,替换成
<td><!--{if $apply[message]}-->携带 $apply[message] 人<!--{/if}--></td>
2、source/include/thread/thread_activity.php
查找
$query = C::t('forum_activityapply')->fetch_all_for_thread($_G['tid'], 0, 0, 0, 1);
foreach($query as $activityapplies) {
$activityapplies['dateline'] = dgmdate($activityapplies['dateline'], 'u');
if($activityapplies['verified'] == 1) {
$activityapplies['ufielddata'] = dunserialize($activityapplies['ufielddata']);
if(count($applylist) < $_G['setting']['activitypp']) {
$activityapplies['message'] = preg_replace("/(".lang('forum/misc', 'contact').".*)/", '', $activityapplies['message']);
$applylist[] = $activityapplies;
}
} else {
if(count($applylistverified) < 8) {
$applylistverified[] = $activityapplies;
}
$noverifiednum++;
}
}
$applynumbers = $activity['applynumber'];
$aboutmembers = $activity['number'] >= $applynumbers ? $activity['number'] - $applynumbers : 0;
大概70-89行,替换成
$waigua_1 = 0;
$waigua_2 = 0;
$query = C::t('forum_activityapply')->fetch_all_for_thread($_G['tid'], 0, 0, 0, 1);
foreach($query as $activityapplies) {
$activityapplies['dateline'] = dgmdate($activityapplies['dateline'], 'u');
if($activityapplies['verified'] == 1) {
$activityapplies['ufielddata'] = dunserialize($activityapplies['ufielddata']);
if(count($applylist) < $_G['setting']['activitypp']) {
$activityapplies['message'] = preg_replace("/(".lang('forum/misc', 'contact').".*)/", '', $activityapplies['message']);
$applylist[] = $activityapplies;
}
$waigua_1 = $waigua_1 + $activityapplies['message'];
} else {
if(count($applylistverified) < 8) {
$applylistverified[] = $activityapplies;
}
$noverifiednum++;
$waigua_2 = $waigua_2 + $activityapplies['message'];
}
}
$applynumbers = $activity['applynumber'] + $waigua_1;
$aboutmembers = $activity['number'] >= $applynumbers ? $activity['number'] - $applynumbers : 0;
$noverifiednum = $noverifiednum + $waigua_2;
如果没有做过其他修改的,可以直接下载附件,覆盖到根目录。
演示地址:http://www.5dlj.com/bbs/forum.php?mod=viewthread&tid=148
最后别忘了支持一下我的网站http://www.5dlj.com/bbs邻居拼饭网
|